Skip to content

Commit 40062d3

Browse files
committed
mathcomp 2.4 and rocq 9.0
1 parent c2d3cbd commit 40062d3

File tree

7 files changed

+56
-52
lines changed

7 files changed

+56
-52
lines changed

.github/workflows/docker-action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
image:
20-
- 'mathcomp/mathcomp:2.3.0-coq-8.19'
20+
- 'mathcomp/mathcomp:2.4.0-rocq-prover-9.0'
2121
fail-fast: false
2222
steps:
2323
- uses: actions/checkout@v4

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ An interactive version of the library is available
4343
- Author(s):
4444
- Laurent Théry
4545
- License: [MIT License](LICENSE)
46-
- Compatible Coq versions: 8.19 or later
46+
- Compatible Coq versions: 9.0 or later
4747
- Additional dependencies:
48-
- [MathComp ssreflect 2.3 or later](https://math-comp.github.io)
49-
- [MathComp algebra 2.3 or later](https://math-comp.github.io)
50-
- [MathComp finmap 2.1 or later](https://github.com/math-comp/finmap)
51-
- [MathComp bigenough 1.0.1 or later](https://github.com/math-comp/finmap)
48+
- [MathComp ssreflect 2.4 or later](https://math-comp.github.io)
49+
- [MathComp algebra 2.4 or later](https://math-comp.github.io)
50+
- [MathComp finmap 2.2.1 or later](https://github.com/math-comp/finmap)
5251
- Coq namespace: `hanoi`
5352
- Related publication(s): none
5453

coq-hanoi.opam

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ An interactive version of the library is available
4141
build: [make "-j%{jobs}%"]
4242
install: [make "install"]
4343
depends: [
44-
"coq" {(>= "8.19")}
45-
"coq-mathcomp-ssreflect" {(>= "2.3.0")}
46-
"coq-mathcomp-algebra" {(>= "2.3.0")}
47-
"coq-mathcomp-finmap" {(>= "2.1.0")}
48-
"coq-mathcomp-bigenough" {(>= "1.0.1")}
44+
"coq" {(>= "9.0")}
45+
"coq-mathcomp-ssreflect" {(>= "2.4.0")}
46+
"coq-mathcomp-algebra" {(>= "2.4.0")}
47+
"coq-mathcomp-finmap" {(>= "2.2.1")}
4948
]
5049

5150
tags: [

extra.v

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
(* *)
55
(******************************************************************************)
66

7+
From Stdlib Require Import ArithRing.
78
From mathcomp Require Import all_ssreflect finmap.
89

910
Set Implicit Arguments.
@@ -1018,44 +1019,55 @@ end.
10181019

10191020
Ltac test t1 t2 := let xx := delta_lterm1 t1 t2 in pose kk := xx.
10201021

1022+
1023+
Ltac ring_preprocess := rewrite -?mul2n -?[addn]/Nat.add -?[muln]/Nat.mul.
1024+
Ltac ring_postprocess :=
1025+
rewrite ?[nat_of_bin _]/= -?[Nat.add]/addn -?[Nat.mul]/muln ?add1n ?add2n.
1026+
Ltac hyp_ring_preprocess H := rewrite -?mul2n -?[addn]/Nat.add -?[muln]/Nat.mul in H |- *.
1027+
Ltac hyp_ring_postprocess H :=
1028+
rewrite ?[nat_of_bin _]/= -?[Nat.add]/addn -?[Nat.mul]/muln ?add1n ?add2n in H |-*.
1029+
1030+
Ltac nat_ring := ring_preprocess; ring.
1031+
10211032
Ltac applyr H :=
1022-
rewrite -?mul2n in H |- *;
1033+
hyp_ring_preprocess H;
10231034
match goal with
10241035
H: is_true (leq _ ?X) |- is_true (leq _ ?Y) =>
10251036
ring_simplify X Y in H;
10261037
ring_simplify X Y; rewrite ?[nat_of_bin _]/= in H |- *
10271038
end;
1039+
hyp_ring_postprocess H;
10281040
let Z := fresh "Z" in
10291041
match goal with
10301042
H: is_true (leq _ ?X1) |- is_true (leq _ ?Y1) =>
10311043
let v := delta_lterm1 Y1 X1 in
10321044
(try (rewrite [Z in _ <= Z](_ : _ = v + X1)));
10331045
[ apply: leq_trans (leq_add (leqnn _) H); rewrite {H}// ?(add0n,addn0)
1034-
| ring]
1046+
| nat_ring]
10351047
end.
10361048

10371049
Ltac applyl H :=
1038-
rewrite -?mul2n in H |- *;
1050+
hyp_ring_preprocess H;
10391051
match goal with
10401052
H: is_true (leq ?X _) |- is_true (leq ?Y _) =>
1041-
ring_simplify X Y; ring_simplify X Y in H;
1042-
rewrite ?[nat_of_bin _]/= in H |- *
1053+
ring_simplify X Y; ring_simplify X Y in H
10431054
end;
1055+
hyp_ring_postprocess H;
10441056
let Z := fresh "Z" in
10451057
match goal with
10461058
H: is_true (leq ?X1 _) |- is_true (leq ?Y1 _) =>
10471059
let v := delta_lterm1 Y1 X1 in
10481060
(try rewrite [Z in Z <= _](_ : Y1 = v + X1));
10491061
[apply: leq_trans (leq_add (leqnn _) H) _;
1050-
rewrite {H}// ?(add0n,addn0) | ring]
1062+
rewrite {H}// ?(add0n,addn0) | nat_ring]
10511063
end.
10521064

10531065
Ltac gsimpl :=
1054-
rewrite -?mul2n in |- *;
1066+
ring_preprocess;
10551067
match goal with
1056-
|- is_true (leq ?X ?Y) =>
1057-
ring_simplify X Y; rewrite ?[nat_of_bin _]/=
1068+
|- is_true (leq ?X ?Y) => ring_simplify X Y
10581069
end;
1070+
ring_postprocess;
10591071
let Z := fresh "Z" in
10601072
match goal with
10611073
|- is_true (leq ?X1 ?Y1) =>
@@ -1065,22 +1077,21 @@ Ltac gsimpl :=
10651077
let v := delta_lterm1 X1 Y1 in
10661078
let v1 := delta_lterm1 X1 v in
10671079
let v2 := delta_lterm1 Y1 v1 in
1068-
(try (rewrite [Z in _ <= Z](_ : Y1 = v2 + v1); last by ring));
1069-
(try (rewrite [Z in Z <= _](_ : X1 = v + v1); last by ring));
1080+
(try (rewrite [Z in _ <= Z](_ : Y1 = v2 + v1); last by nat_ring));
1081+
(try (rewrite [Z in Z <= _](_ : X1 = v + v1); last by nat_ring));
10701082
rewrite ?leq_add2r
10711083
| _ =>
10721084
let v1 := delta_lterm1 Y1 v in
10731085
let v2 := delta_lterm1 X1 v1 in
1074-
(try (rewrite [Z in _ <= Z](_ : Y1 = v + v1); last by ring));
1075-
(try (rewrite [Z in Z <= _](_ : X1 = v2 + v1); last by ring));
1086+
(try (rewrite [Z in _ <= Z](_ : Y1 = v + v1); last by nat_ring));
1087+
(try (rewrite [Z in Z <= _](_ : X1 = v2 + v1); last by nat_ring));
10761088
rewrite ?leq_add2r
10771089
end
10781090
end.
1079-
1080-
Ltac sring := rewrite -!mul2n; ring.
1091+
10811092
Ltac changel t :=
10821093
let X := fresh "X" in
1083-
rewrite [X in X <= _](_ : _ = t); last by (ring || sring).
1094+
rewrite [X in X <= _](_ : _ = t); last by (ring || nat_ring).
10841095
Ltac changer t :=
10851096
let X := fresh "X" in
1086-
rewrite [X in _ <= X](_ : _ = t); last by (ring || sring).
1097+
rewrite [X in _ <= X](_ : _ = t); last by (ring || nat_ring).

meta.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,29 @@ license:
5050
identifier: MIT
5151

5252
supported_coq_versions:
53-
text: '8.19 or later'
54-
opam: '{(>= "8.19")}'
53+
text: '9.0 or later'
54+
opam: '{(>= "9.0")}'
5555

5656
dependencies:
5757
- opam:
5858
name: coq-mathcomp-ssreflect
59-
version: '{(>= "2.3.0")}'
59+
version: '{(>= "2.4.0")}'
6060
description: |-
61-
[MathComp ssreflect 2.3 or later](https://math-comp.github.io)
61+
[MathComp ssreflect 2.4 or later](https://math-comp.github.io)
6262
- opam:
6363
name: coq-mathcomp-algebra
64-
version: '{(>= "2.3.0")}'
64+
version: '{(>= "2.4.0")}'
6565
description: |-
66-
[MathComp algebra 2.3 or later](https://math-comp.github.io)
66+
[MathComp algebra 2.4 or later](https://math-comp.github.io)
6767
- opam:
6868
name: coq-mathcomp-finmap
69-
version: '{(>= "2.1.0")}'
69+
version: '{(>= "2.2.1")}'
7070
description: |-
71-
[MathComp finmap 2.1 or later](https://github.com/math-comp/finmap)
72-
- opam:
73-
name: coq-mathcomp-bigenough
74-
version: '{(>= "1.0.1")}'
75-
description: |-
76-
[MathComp bigenough 1.0.1 or later](https://github.com/math-comp/finmap)
71+
[MathComp finmap 2.2.1 or later](https://github.com/math-comp/finmap)
7772
7873
7974
tested_coq_opam_versions:
80-
- version: '2.3.0-coq-8.19'
75+
- version: '2.4.0-rocq-prover-9.0'
8176
repo: 'mathcomp/mathcomp'
8277

8378
namespace: hanoi

psi.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ Lemma phi_3_5_4_sum n :
897897
Proof.
898898
rewrite phiE.
899899
rewrite -(big_mkord xpredT (fun i => 2 ^ troot i)).
900-
rewrite (big_cat_nat _ _ _ (_ : 0 <= 1)) //=.
900+
rewrite (big_cat_nat (_ : 0 <= 1)) //=.
901901
by rewrite big_nat_recl //= big_mkord big_ord0 addn0 add1n.
902902
Qed.
903903

shanoi4.v

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
From Stdlib Require Import ArithRing.
12
From mathcomp Require Import all_ssreflect finmap.
23
From hanoi Require Import extra star gdist lhanoi3 ghanoi ghanoi4 shanoi.
34

@@ -612,7 +613,7 @@ have [/andP[a_gt1 aLlm1]|] := boolP (2 <= a <= l.-1).
612613
have F := big_mkord xpredT
613614
(fun i => `d[u (inord i), u (inord i.+1)]_smove).
614615
rewrite -{}[sd u]F.
615-
rewrite (big_cat_nat _ _ _ (_ : _ <= (a.-1).+1)) //=; last first.
616+
rewrite (big_cat_nat (_ : _ <= (a.-1).+1)) //=; last first.
616617
by rewrite prednK.
617618
rewrite big_mkord big_ord_recr /= prednK //.
618619
rewrite -{9}[a]add0n big_addn -/b big_mkord.
@@ -831,7 +832,6 @@ have [/andP[a_gt1 aLlm1]|] := boolP (2 <= a <= l.-1).
831832
have F9 : α_[1] (n.+2) <= (α_[1] n).*2.+2.
832833
apply: leq_trans (leqnSn _).
833834
by apply: alphaL_4_5.
834-
(* Lia should work now *)
835835
gsimpl.
836836
applyr P1.
837837
rewrite -(leq_add2r x1S); applyr P2.
@@ -846,7 +846,7 @@ have [/andP[a_gt1 aLlm1]|] := boolP (2 <= a <= l.-1).
846846
gsimpl.
847847
rewrite -(leq_add2r (S_[1] n.+1)); applyl F6n; gsimpl.
848848
rewrite F71; gsimpl.
849-
rewrite !add1n {}F73; gsimpl.
849+
rewrite ?add1n {}F73; gsimpl.
850850
rewrite -(leq_add2r (S_[1] n.+2 + S_[2] n.+2)).
851851
applyl F6n1; gsimpl.
852852
rewrite {}F72 {}F721 {}F711 {}F71; gsimpl.
@@ -1131,7 +1131,7 @@ have [/andP[a_gt1 /eqP bE1]|] := boolP ((1 < a) && (b == 1)).
11311131
rewrite lEa; applyr F6n.
11321132
rewrite -(leq_add2r (S_[1] n.+2 + S_[3] n.+2)); applyr F6n1.
11331133
rewrite {}F72 {}F711 {}F71; gsimpl.
1134-
rewrite !add1n -{}F8.
1134+
rewrite ?add1n -{}F8.
11351135
by applyl F9; gsimpl.
11361136
rewrite negb_and -leqNgt => o1H.
11371137
have [/eqP aE1| aD1] := boolP (a == 1).
@@ -1243,7 +1243,7 @@ have [/eqP aE1| aD1] := boolP (a == 1).
12431243
rewrite !alphaL_3E.
12441244
have F := leq_dsum_alpha_2l_1 n.+1; applyr F.
12451245
rewrite !dsum_alphaL_S; gsimpl.
1246-
rewrite !add1n.
1246+
rewrite ?add1n.
12471247
by have F := alphaL_4_5 n; applyl F; gsimpl.
12481248
rewrite (maxn_idPr _) //.
12491249
changer (2 * (S_[3] (n.+1)).+1 + 2 * S_[b] (n.+1)).
@@ -2960,7 +2960,7 @@ move: c_gt0; rewrite leq_eqVlt eq_sym => /orP[/eqP cE1|c_gt1].
29602960
set y3S := sp _ _ _ in P5; set y4S := \sum_(_ < _) _ in P5.
29612961
rewrite /sd -(big_mkord xpredT
29622962
(fun i => `d[u (inord i), u (inord i.+1)]_smove)).
2963-
rewrite (big_cat_nat _ _ _ (_ : 0 <= a1)) //=; last by apply: ltnW.
2963+
rewrite (big_cat_nat (_ : 0 <= a1)) //=; last by apply: ltnW.
29642964
rewrite big_mkord -!addnA.
29652965
apply: leq_trans (leq_add P1l1 (leqnn _)); rewrite -/x1S.
29662966
rewrite -{P1l1}P2 -/x2S {1}lE2 !sum_beta_S //.
@@ -3331,7 +3331,7 @@ have [|b_gt0] := leqP b 0; last first.
33313331
have F2 := dsum_alphaL_S 3 n; rewrite {1}F2.
33323332
have F3 : S_[5] n.+2 <= S_[4] n.+1 + (α_[1] n.+1).*2.
33333333
by apply: dsum_alphaL_alpha.
3334-
rewrite -[3 + 2]/5 -[2 + 2]/4; applyl F3.
3334+
rewrite -[3 + 2]/5; applyl F3.
33353335
have F4 : S_[4] n.+1 <= S_[3] n + (α_[1] n).*2.
33363336
by apply: dsum_alphaL_alpha.
33373337
rewrite -leq_double in F4; applyl F4; gsimpl.
@@ -3569,7 +3569,7 @@ have [c_gt2|c_lt3] := leqP 3 c.
35693569
rewrite -[_ <= _](leq_mul2l 3) mulnA.
35703570
by apply: leq_trans F17 _; gsimpl.
35713571
have cE2 : c = 2 by case: (c) c_gt1 c_lt3 => [|[|[|]]].
3572-
rewrite cE2 (maxn_idPl _) // add1n -[2 * 2]/4 -[(3 * 2).-2]/4 -[2 + 4]/6.
3572+
rewrite cE2 (maxn_idPl _) // -[2 * 2]/4 -[(3 * 2).-2]/4.
35733573
rewrite [in X in _ <= X]mul2n -addnn.
35743574
have F1 := dsum_alphaL_S 5 n; rewrite {1}F1.
35753575
have F2 := dsum_alpha3_S n.+2.
@@ -3591,7 +3591,7 @@ have F9 : 3 * α_[1] n1.+1.+4 <= 4 * α_[1] n1.+4.
35913591
by rewrite alpha_4_3.
35923592
rewrite -[_ <= _]orFb -(leq_mul2l 4) in F9.
35933593
rewrite -[_ <= _](leq_mul2l 3).
3594-
by rewrite add1n; applyl F9; gsimpl.
3594+
by applyl F9; gsimpl.
35953595
Qed.
35963596

35973597
End Case3.

0 commit comments

Comments
 (0)