Skip to content

Commit f56e7f1

Browse files
committed
Rocq 9.0
1 parent 35bece2 commit f56e7f1

6 files changed

Lines changed: 54 additions & 56 deletions

File tree

.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.20'
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ reflect
4343
- Author(s):
4444
- Laurent Théry
4545
- License: [MIT License](LICENSE)
46-
- Compatible Coq versions: 8.20 or later
46+
- Compatible Rocq/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 field 2.3 or later](https://math-comp.github.io)
51-
- Coq namespace: `twoSquare`
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 field 2.4 or later](https://math-comp.github.io)
51+
- Rocq/Coq namespace: `twoSquare`
5252
- Related publication(s): none
5353

5454
## Building and installation instructions

coq-twoSquare.opam

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ reflect
4141
build: [make "-j%{jobs}%"]
4242
install: [make "install"]
4343
depends: [
44-
"coq" {(>= "8.20")}
45-
"coq-mathcomp-ssreflect" {(>= "2.3.0")}
46-
"coq-mathcomp-algebra" {(>= "2.3.0")}
47-
"coq-mathcomp-field" {(>= "2.3.0")}
44+
"coq" {(>= "9.0")}
45+
"coq-mathcomp-ssreflect" {(>= "2.4.0")}
46+
"coq-mathcomp-algebra" {(>= "2.4.0")}
47+
"coq-mathcomp-field" {(>= "2.4.0")}
4848
]
4949

5050
tags: [

fermat2.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ apply: (iffP idP) => [/sum2sP[m [n ->]]|[x1->]].
5252
exists (m%:R + iGI * n%:R)%R.
5353
by rewrite normGIE /= !algGI_nat Re_rect ?Im_rect
5454
?CrealE ?conjC_nat ?natrK // !normr_nat !natrK.
55-
rewrite normGIE; set m := Num.trunc _; set n := Num.trunc _.
55+
rewrite normGIE; set m := Num.truncn _; set n := Num.truncn _.
5656
by apply/sum2sP; exists m; exists n.
5757
Qed.
5858

@@ -191,7 +191,7 @@ have pE : p = (k * 4).+1 by rewrite (divn_eq p 4) (eqP pM4) addn1.
191191
rewrite pE => F.
192192
have [/eqP-> _|] := boolP (k == 0); first exact: sum2s1.
193193
rewrite -leqn0 -ltnNge => Pk.
194-
rewrite fact_prod (big_cat_nat _ _ _ (_ : 1 <= (k * 2).+1)) //=; last first.
194+
rewrite fact_prod (big_cat_nat (_ : 1 <= (k * 2).+1)) //=; last first.
195195
by rewrite ltnS leq_mul2l orbT.
196196
set S1 := \prod_(_ <= _ < _ ) _.
197197
rewrite -addn1 -modnDml -modnMmr big_nat_rev /=.

gauss_int.v

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,8 @@ canonical property for the predicate gaussInt
245245
246246
*)
247247

248-
HB.howto GI subComRingType.
249-
250248
HB.instance Definition _ := [Countable of GI by <:].
251-
HB.instance Definition _ := [SubChoice_isSubComRing of GI by <:].
249+
HB.instance Definition _ := [SubChoice_isSubComNzRing of GI by <:].
252250

253251
(**
254252
@@ -297,7 +295,7 @@ by apply: val_inj; rewrite /invGI ?val_insubd /= ?xGIF // invr0 if_same.
297295
Qed.
298296

299297
HB.instance Definition _ :=
300-
GRing.ComRing_hasMulInverse.Build GI mulGIr unitGIP unitGI_out.
298+
GRing.ComNzRing_hasMulInverse.Build GI mulGIr unitGIP unitGI_out.
301299

302300
(**
303301
@@ -368,7 +366,7 @@ Delimit Scope GI_scope with GI.
368366

369367
Open Scope GI_scope.
370368

371-
Definition normGI (x : GI) := Num.trunc (gaussNorm (val x)).
369+
Definition normGI (x : GI) := Num.truncn (gaussNorm (val x)).
372370
Local Notation "'N x" := (normGI x%R) (at level 10) : GI_scope.
373371

374372
(**
@@ -394,7 +392,7 @@ Lemma gaussNormM : {morph gaussNorm : x y / x * y}.
394392
Proof. by move=> x y; rewrite /gaussNorm rmorphM mulrACA. Qed.
395393

396394
Lemma normGIM x y : 'N (x * y) = ('N x * 'N y)%N.
397-
Proof. by rewrite /normGI gaussNormM truncM. Qed.
395+
Proof. by rewrite /normGI gaussNormM truncnM. Qed.
398396

399397
Lemma normGIX x n : 'N (x ^+ n) = ('N x ^ n)%N.
400398
Proof.
@@ -408,8 +406,8 @@ Proof. by rewrite gaussNormE sqrf_eq0 normr_eq0. Qed.
408406

409407
Lemma normGI_eq0 (x : GI) : ('N x == 0%N) = (x == 0).
410408
Proof.
411-
have /charf0P<- := Cchar.
412-
by rewrite truncK // gaussNorm_eq0.
409+
have /pcharf0P<- := Cpchar.
410+
by rewrite truncnK // gaussNorm_eq0.
413411
Qed.
414412

415413
Lemma normGI_gt0 (x : GI) : ('N x > 0)%N = (x != 0).
@@ -423,32 +421,32 @@ Qed.
423421

424422
Lemma normGI_nat n : 'N n%:R = (n ^ 2)%N.
425423
Proof.
426-
by rewrite /normGI [val _]algGI_nat gaussNormE normr_nat truncX // natrK.
424+
by rewrite /normGI [val _]algGI_nat gaussNormE normr_nat truncnX // natrK.
427425
Qed.
428426

429-
Lemma normGIE (x : GI) : ('N(x) = Num.trunc (`|'Re (val x)|)%R ^ 2 +
430-
Num.trunc (`|'Im (val x)|)%R ^ 2)%N.
427+
Lemma normGIE (x : GI) : ('N(x) = Num.truncn (`|'Re (val x)|)%R ^ 2 +
428+
Num.truncn (`|'Im (val x)|)%R ^ 2)%N.
431429
Proof.
432-
rewrite /normGI gaussNormE normC2_Re_Im truncD ?natr_exp_even //; last first.
430+
rewrite /normGI gaussNormE normC2_Re_Im truncnD ?natr_exp_even //; last first.
433431
by rewrite qualifE /= natr_ge0 // natr_exp_even.
434-
by rewrite -!truncX ?natr_norm_int // !intr_normK.
432+
by rewrite -!truncnX ?natr_norm_int // !intr_normK.
435433
Qed.
436434

437-
Lemma truncC_Cint (x : algC) :
438-
x \is a Num.int -> x = (-1) ^+ (x < 0)%R * (Num.trunc `|x|)%:R.
435+
Lemma truncnC_Cint (x : algC) :
436+
x \is a Num.int -> x = (-1) ^+ (x < 0)%R * (Num.truncn `|x|)%:R.
439437
Proof.
440-
by move=> xCint; rewrite {1}[x]intrEsign // truncK // natr_norm_int.
438+
by move=> xCint; rewrite {1}[x]intrEsign // truncnK // natr_norm_int.
441439
Qed.
442440

443441
Lemma normGI_eq1 (x : GI) : ('N(x) == 1)%N = (val x \in [::1;-1;'i;-'i]).
444442
Proof.
445443
apply/idP/idP; last first.
446444
by rewrite normGIE !inE => /or4P[] /eqP->;
447445
rewrite ?raddfN /= ?(Creal_ReP 1 _) ?(Creal_ImP 1 _) ?Re_i ?Im_i //=
448-
?normrN ?normr1 ?normr0 ?trunc0 ?trunc1.
446+
?normrN ?normr1 ?normr0 ?truncn0 ?truncn1.
449447
rewrite [val x]algCrect normGIE.
450-
have /andP[/truncC_Cint {2}-> /truncC_Cint {2}->] := algGIP x.
451-
by case: Num.trunc => [|[|m]] //; case: Num.trunc => [|[|n]] // _;
448+
have /andP[/truncnC_Cint {2}-> /truncnC_Cint {2}->] := algGIP x.
449+
by case: Num.truncn => [|[|m]] //; case: Num.truncn => [|[|n]] // _;
452450
rewrite !(mulr1, mulr0, add0r, addr0); case: (_ < _)%R;
453451
rewrite ?(expr1, expr0, mulrN, mulr1, inE, eqxx, orbT).
454452
Qed.
@@ -573,9 +571,9 @@ have := xNz.
573571
rewrite -normGI_eq0.
574572
rewrite /normGI gaussNormE [val x]algCrect normC2_rect ?(realr_int, intr_int) //.
575573
set u :=_ + _ * _ => uNz.
576-
have->: Num.floor u = Num.trunc u.
574+
have->: Num.floor u = Num.truncn u.
577575
apply: floor_def.
578-
rewrite [(_+ 1)%Z]addrC -intS trunc_itv //.
576+
rewrite [(_+ 1)%Z]addrC -intS truncn_itv //.
579577
rewrite addr_ge0 // -expr2 real_exprn_even_ge0 ?(realr_int, intr_int) //.
580578
by rewrite cdivzz ?mul1r ?subrr.
581579
Qed.
@@ -610,13 +608,13 @@ set Uy := Num.floor _.
610608
have UxRe : Ux%:~R = 'Re (algGI x / algGI y * ('N y)%:R).
611609
rewrite algReM ['Re _%:R](Creal_ReP _ _) ?qualifE /= ?ler0n //.
612610
rewrite ?['Im _%:R](Creal_ImP _ _) ?qualifE /= ?ler0n // mulr0 subr0.
613-
rewrite /normGI truncK // algRe_div -gaussNormE divfK; last first.
611+
rewrite /normGI truncnK // algRe_div -gaussNormE divfK; last first.
614612
by rewrite gaussNorm_eq0.
615613
by rewrite floorK // rpredD // rpredM.
616614
have UyIm : Uy%:~R = 'Im (algGI x / algGI y * ('N(y))%GI%:R).
617615
rewrite algImM ['Re _%:R](Creal_ReP _ _) ?qualifE /= ?ler0n //.
618616
rewrite ?['Im _%:R](Creal_ImP _ _) ?qualifE /= ?ler0n // mulr0 add0r mulrC.
619-
rewrite /normGI truncK // algIm_div -gaussNormE divfK; last first.
617+
rewrite /normGI truncnK // algIm_div -gaussNormE divfK; last first.
620618
by rewrite gaussNorm_eq0.
621619
by rewrite floorK // rpredB // rpredM.
622620
rewrite ['N (_ * _)]/normGI /= -[algGI x](divfK yNz).
@@ -627,7 +625,7 @@ rewrite subC_rect ![_ + cmodz _ _]addrC.
627625
rewrite rmorphD /= rmorphM /= addrK.
628626
rewrite [(_ + _)%:~R]rmorphD /= rmorphM /= addrK.
629627
rewrite !gaussNormM gaussNormE normC2_rect ?(Rreal_int, intr_int) //.
630-
rewrite truncM //; last by rewrite rpredD // natr_exp_even // intr_int.
628+
rewrite truncnM //; last by rewrite rpredD // natr_exp_even // intr_int.
631629
rewrite mulnC ltn_pmul2l; last by rewrite lt0n normGI_eq0.
632630
rewrite -!rmorphXn /= -!rmorphD /=.
633631
rewrite -[_ + _]gez0_abs ?natrK; last first.
@@ -799,8 +797,8 @@ rewrite gaussIntE Re_rect ?Im_rect; last 4 first.
799797
- by rewrite !(rpredM, rpredV) 1? rpredD ?Rreal_int.
800798
- by rewrite !(rpredM, rpredV) 1? rpredB ?rpredD ?Rreal_int.
801799
rewrite (intrEsign Cm) (intrEsign Cn).
802-
rewrite -(truncK (natr_norm_int Cm)) -(truncK (natr_norm_int Cn)).
803-
rewrite -[Num.trunc `|m|]odd_double_half -[Num.trunc `|n|]odd_double_half.
800+
rewrite -(truncnK (natr_norm_int Cm)) -(truncnK (natr_norm_int Cn)).
801+
rewrite -[Num.truncn `|m|]odd_double_half -[Num.truncn `|n|]odd_double_half.
804802
rewrite Omn !natrD !mulrDr ![(-1) ^+ _]signrE.
805803
set u := nat_of_bool _; set v := nat_of_bool _; set w := nat_of_bool _.
806804
set x1 := _./2; set y1 := _./2.
@@ -1101,7 +1099,7 @@ Qed.
11011099

11021100
Lemma conjGIM_norm x : x * conjGI x = ('N x)%:R.
11031101
Proof.
1104-
by apply/val_eqP; rewrite /= -normCK -gaussNormE algGI_nat truncK.
1102+
by apply/val_eqP; rewrite /= -normCK -gaussNormE algGI_nat truncnK.
11051103
Qed.
11061104

11071105
Lemma eqGIP (x y : GI) :
@@ -1317,22 +1315,22 @@ Proof.
13171315
rewrite mem_pmap.
13181316
apply/mapP; exists (GI_of_ord x); last by rewrite valK.
13191317
apply/mapP.
1320-
pose xr := Num.trunc ('Re (algGI (GI_of_ord x)) + n%:R).
1321-
pose yr := Num.trunc ('Im (algGI (GI_of_ord x)) + n%:R).
1318+
pose xr := Num.truncn ('Re (algGI (GI_of_ord x)) + n%:R).
1319+
pose yr := Num.truncn ('Im (algGI (GI_of_ord x)) + n%:R).
13221320
pose nD := (Num.NumDomain.clone _ algC).
13231321
have := ltn_ordGI x.
1324-
rewrite normGIE -(ltr_nat nD) natrD !natrX !truncK ?natr_norm_int //.
1322+
rewrite normGIE -(ltr_nat nD) natrD !natrX !truncnK ?natr_norm_int //.
13251323
move => HH.
13261324
have /andP[Hrx1 Lx1] := int_norm_nat (GIRe _) (GIIm _) HH.
1327-
have F1 : (Num.trunc ('Re (val (GI_of_ord x)) + n%:R)%R < n.*2)%N.
1328-
by rewrite -(ltr_nat nD) truncK.
1325+
have F1 : (Num.truncn ('Re (val (GI_of_ord x)) + n%:R)%R < n.*2)%N.
1326+
by rewrite -(ltr_nat nD) truncnK.
13291327
rewrite addrC in HH.
13301328
have /andP[Hrx2 Lx2] := int_norm_nat (GIIm _) (GIRe _) HH.
1331-
have F2 : (Num.trunc ('Im (val (GI_of_ord x)) + n%:R)%R < n.*2)%N.
1332-
by rewrite -(ltr_nat nD) truncK.
1329+
have F2 : (Num.truncn ('Im (val (GI_of_ord x)) + n%:R)%R < n.*2)%N.
1330+
by rewrite -(ltr_nat nD) truncnK.
13331331
exists (Ordinal F1, Ordinal F2); rewrite ?mem_enum //=.
13341332
apply/val_eqP=> /=.
1335-
by rewrite !algGI_nat !truncK // !addrK -algCrect.
1333+
by rewrite !algGI_nat !truncnK // !addrK -algCrect.
13361334
Qed.
13371335

13381336
Definition ordGI_uniq_enumP : Finite.axiom _ :=

meta.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,29 @@ license:
4949
identifier: MIT
5050

5151
supported_coq_versions:
52-
text: '8.20 or later'
53-
opam: '{(>= "8.20")}'
52+
text: '9.0 or later'
53+
opam: '{(>= "9.0")}'
5454

5555
dependencies:
5656
- opam:
5757
name: coq-mathcomp-ssreflect
58-
version: '{(>= "2.3.0")}'
58+
version: '{(>= "2.4.0")}'
5959
description: |-
60-
[MathComp ssreflect 2.3 or later](https://math-comp.github.io)
60+
[MathComp ssreflect 2.4 or later](https://math-comp.github.io)
6161
- opam:
6262
name: coq-mathcomp-algebra
63-
version: '{(>= "2.3.0")}'
63+
version: '{(>= "2.4.0")}'
6464
description: |-
65-
[MathComp algebra 2.3 or later](https://math-comp.github.io)
65+
[MathComp algebra 2.4 or later](https://math-comp.github.io)
6666
6767
- opam:
6868
name: coq-mathcomp-field
69-
version: '{(>= "2.3.0")}'
69+
version: '{(>= "2.4.0")}'
7070
description: |-
71-
[MathComp field 2.3 or later](https://math-comp.github.io)
71+
[MathComp field 2.4 or later](https://math-comp.github.io)
7272
7373
tested_coq_opam_versions:
74-
- version: '2.3.0-coq-8.20'
74+
- version: '2.4.0-rocq-prover-9.0'
7575
repo: 'mathcomp/mathcomp'
7676

7777
namespace: twoSquare

0 commit comments

Comments
 (0)