Skip to content

Commit 40637d5

Browse files
authored
Merge pull request #39 from proux01/hierarchy-builder
Port to Hierarchy Builder
2 parents 2046446 + 14224b1 commit 40637d5

File tree

7 files changed

+62
-142
lines changed

7 files changed

+62
-142
lines changed

.github/workflows/docker-action.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,8 @@ jobs:
1717
strategy:
1818
matrix:
1919
image:
20-
- 'mathcomp/mathcomp:1.12.0-coq-8.13'
21-
- 'mathcomp/mathcomp:1.12.0-coq-8.14'
22-
- 'mathcomp/mathcomp:1.13.0-coq-8.13'
23-
- 'mathcomp/mathcomp:1.13.0-coq-8.14'
24-
- 'mathcomp/mathcomp:1.13.0-coq-8.15'
25-
- 'mathcomp/mathcomp:1.14.0-coq-8.13'
26-
- 'mathcomp/mathcomp:1.14.0-coq-8.14'
27-
- 'mathcomp/mathcomp:1.14.0-coq-8.15'
28-
- 'mathcomp/mathcomp:1.15.0-coq-8.13'
29-
- 'mathcomp/mathcomp:1.15.0-coq-8.14'
30-
- 'mathcomp/mathcomp:1.15.0-coq-8.15'
31-
- 'mathcomp/mathcomp:1.15.0-coq-8.16'
32-
- 'mathcomp/mathcomp:1.16.0-coq-8.13'
33-
- 'mathcomp/mathcomp:1.16.0-coq-8.14'
34-
- 'mathcomp/mathcomp:1.16.0-coq-8.15'
35-
- 'mathcomp/mathcomp:1.16.0-coq-8.16'
36-
- 'mathcomp/mathcomp:1.16.0-coq-8.17'
37-
- 'mathcomp/mathcomp-dev:coq-8.13'
38-
- 'mathcomp/mathcomp-dev:coq-8.14'
39-
- 'mathcomp/mathcomp-dev:coq-8.15'
20+
- 'mathcomp/mathcomp:2.0.0-coq-8.16'
21+
- 'mathcomp/mathcomp:2.0.0-coq-8.17'
4022
- 'mathcomp/mathcomp-dev:coq-8.16'
4123
- 'mathcomp/mathcomp-dev:coq-8.17'
4224
- 'mathcomp/mathcomp-dev:coq-dev'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ by extending the zify tactic.
2121
- Author(s):
2222
- Kazuhiko Sakaguchi (initial)
2323
- License: [CeCILL-B Free Software License Agreement](CeCILL-B)
24-
- Compatible Coq versions: 8.13 or later
24+
- Compatible Coq versions: 8.16 or later
2525
- Additional dependencies:
26-
- [MathComp](https://math-comp.github.io) ssreflect 1.12 or later
26+
- [MathComp](https://math-comp.github.io) ssreflect 2.0 or later
2727
- [MathComp](https://math-comp.github.io) algebra
2828
- Coq namespace: `mathcomp.zify`
2929
- Related publication(s): none

coq-mathcomp-zify.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ by extending the zify tactic."""
1919
build: [make "-j%{jobs}%"]
2020
install: [make "install"]
2121
depends: [
22-
"coq" {>= "8.13"}
23-
"coq-mathcomp-ssreflect" {>= "1.12"}
22+
"coq" {>= "8.16"}
23+
"coq-mathcomp-ssreflect" {>= "2.0"}
2424
"coq-mathcomp-algebra"
2525
]
2626

meta.yml

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,52 +25,16 @@ license:
2525
file: CeCILL-B
2626

2727
supported_coq_versions:
28-
text: 8.13 or later
29-
opam: '{>= "8.13"}'
28+
text: 8.16 or later
29+
opam: '{>= "8.16"}'
3030

3131
tested_coq_nix_versions:
3232

3333
tested_coq_opam_versions:
34-
- version: '1.12.0-coq-8.13'
34+
- version: '2.0.0-coq-8.16'
3535
repo: 'mathcomp/mathcomp'
36-
- version: '1.12.0-coq-8.14'
36+
- version: '2.0.0-coq-8.17'
3737
repo: 'mathcomp/mathcomp'
38-
- version: '1.13.0-coq-8.13'
39-
repo: 'mathcomp/mathcomp'
40-
- version: '1.13.0-coq-8.14'
41-
repo: 'mathcomp/mathcomp'
42-
- version: '1.13.0-coq-8.15'
43-
repo: 'mathcomp/mathcomp'
44-
- version: '1.14.0-coq-8.13'
45-
repo: 'mathcomp/mathcomp'
46-
- version: '1.14.0-coq-8.14'
47-
repo: 'mathcomp/mathcomp'
48-
- version: '1.14.0-coq-8.15'
49-
repo: 'mathcomp/mathcomp'
50-
- version: '1.15.0-coq-8.13'
51-
repo: 'mathcomp/mathcomp'
52-
- version: '1.15.0-coq-8.14'
53-
repo: 'mathcomp/mathcomp'
54-
- version: '1.15.0-coq-8.15'
55-
repo: 'mathcomp/mathcomp'
56-
- version: '1.15.0-coq-8.16'
57-
repo: 'mathcomp/mathcomp'
58-
- version: '1.16.0-coq-8.13'
59-
repo: 'mathcomp/mathcomp'
60-
- version: '1.16.0-coq-8.14'
61-
repo: 'mathcomp/mathcomp'
62-
- version: '1.16.0-coq-8.15'
63-
repo: 'mathcomp/mathcomp'
64-
- version: '1.16.0-coq-8.16'
65-
repo: 'mathcomp/mathcomp'
66-
- version: '1.16.0-coq-8.17'
67-
repo: 'mathcomp/mathcomp'
68-
- version: 'coq-8.13'
69-
repo: 'mathcomp/mathcomp-dev'
70-
- version: 'coq-8.14'
71-
repo: 'mathcomp/mathcomp-dev'
72-
- version: 'coq-8.15'
73-
repo: 'mathcomp/mathcomp-dev'
7438
- version: 'coq-8.16'
7539
repo: 'mathcomp/mathcomp-dev'
7640
- version: 'coq-8.17'
@@ -81,9 +45,9 @@ tested_coq_opam_versions:
8145
dependencies:
8246
- opam:
8347
name: coq-mathcomp-ssreflect
84-
version: '{>= "1.12"}'
48+
version: '{>= "2.0"}'
8549
description: |-
86-
[MathComp](https://math-comp.github.io) ssreflect 1.12 or later
50+
[MathComp](https://math-comp.github.io) ssreflect 2.0 or later
8751
- opam:
8852
name: coq-mathcomp-algebra
8953
description: |-

theories/ssrZ.v

Lines changed: 36 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
From Coq Require Import ZArith.
22

3+
From HB Require Import structures.
34
From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path.
45
From mathcomp Require Import div choice fintype tuple finfun bigop finset prime.
56
From mathcomp Require Import order binomial ssralg countalg ssrnum ssrint.
@@ -41,19 +42,19 @@ Implicit Types (m n : Z).
4142
Fact eqZP : Equality.axiom Z.eqb.
4243
Proof. by move=> x y; apply: (iffP idP); lia. Qed.
4344

44-
Canonical Z_eqType := EqType Z (EqMixin eqZP).
45-
Canonical Z_choiceType := ChoiceType Z (CanChoiceMixin int_of_ZK).
46-
Canonical Z_countType := CountType Z (CanCountMixin int_of_ZK).
45+
#[export]
46+
HB.instance Definition _ := hasDecEq.Build Z eqZP.
4747

48-
Definition Z_zmodMixin :=
49-
ZmodMixin Zplus_assoc Zplus_comm Zplus_0_l Zplus_opp_l.
50-
Canonical Z_zmodType := ZmodType Z Z_zmodMixin.
48+
#[export]
49+
HB.instance Definition _ := Countable.copy Z (can_type int_of_ZK).
5150

52-
Definition Z_ringMixin :=
53-
RingMixin
54-
Zmult_assoc Zmult_1_l Zmult_1_r Zmult_plus_distr_l Zmult_plus_distr_r isT.
55-
Canonical Z_ringType := RingType Z Z_ringMixin.
56-
Canonical Z_comRingType := ComRingType Z Zmult_comm.
51+
#[export]
52+
HB.instance Definition _ := GRing.isZmodule.Build Z
53+
Zplus_assoc Zplus_comm Zplus_0_l Zplus_opp_l.
54+
55+
#[export]
56+
HB.instance Definition _ := GRing.Zmodule_isComRing.Build Z
57+
Zmult_assoc Zmult_comm Zmult_1_l Zmult_plus_distr_l isT.
5758

5859
Definition unitZ := [qualify a n : Z | (n == Z.pos xH) || (n == Z.neg xH)].
5960
Definition invZ n := n.
@@ -67,20 +68,15 @@ Proof. case: m n => [|[m|m|]|[m|m|]] [|n|n] //= []; lia. Qed.
6768
Fact invZ_out : {in [predC unitZ], invZ =1 id}.
6869
Proof. exact. Qed.
6970

71+
#[export]
72+
HB.instance Definition _ := GRing.ComRing_hasMulInverse.Build Z
73+
mulVZ unitZPl invZ_out.
74+
7075
Fact idomain_axiomZ m n : (m * n = 0)%R -> (m == 0%R) || (n == 0%R).
7176
Proof. by case: m n => [|m|m] []. Qed.
7277

73-
Canonical Z_unitRingType :=
74-
UnitRingType Z (ComUnitRingMixin mulVZ unitZPl invZ_out).
75-
Canonical Z_comUnitRing := [comUnitRingType of Z].
76-
Canonical Z_idomainType := IdomainType Z idomain_axiomZ.
77-
78-
Canonical Z_countZmodType := [countZmodType of Z].
79-
Canonical Z_countRingType := [countRingType of Z].
80-
Canonical Z_countComRingType := [countComRingType of Z].
81-
Canonical Z_countUnitRingType := [countUnitRingType of Z].
82-
Canonical Z_countComUnitRingType := [countComUnitRingType of Z].
83-
Canonical Z_countIdomainType := [countIdomainType of Z].
78+
#[export]
79+
HB.instance Definition _ := GRing.ComUnitRing_isIntegral.Build Z idomain_axiomZ.
8480

8581
Fact leZ_add m n : Z.leb 0 m -> Z.leb 0 n -> Z.leb 0 (m + n). Proof. lia. Qed.
8682
Fact leZ_mul m n : Z.leb 0 m -> Z.leb 0 n -> Z.leb 0 (m * n). Proof. lia. Qed.
@@ -98,17 +94,9 @@ Fact geZ0_norm m : Z.leb 0 m -> Z.abs m = m. Proof. lia. Qed.
9894
Fact ltZ_def m n : (Z.ltb m n) = (n != m) && (Z.leb m n).
9995
Proof. by rewrite eqE /=; lia. Qed.
10096

101-
Definition Mixin : realLeMixin [idomainType of Z] :=
102-
RealLeMixin
103-
leZ_add leZ_mul leZ_anti subZ_ge0 (leZ_total 0) normZN geZ0_norm ltZ_def.
104-
105-
Canonical Z_porderType := POrderType ring_display Z Mixin.
106-
Canonical Z_latticeType := LatticeType Z Mixin.
107-
Canonical Z_distrLatticeType := DistrLatticeType Z Mixin.
108-
Canonical Z_orderType := OrderType Z leZ_total.
109-
Canonical Z_numDomainType := NumDomainType Z Mixin.
110-
Canonical Z_normedZmodType := NormedZmodType Z Z Mixin.
111-
Canonical Z_realDomainType := [realDomainType of Z].
97+
#[export]
98+
HB.instance Definition _ := Num.IntegralDomain_isLeReal.Build Z
99+
leZ_add leZ_mul leZ_anti subZ_ge0 (leZ_total 0) normZN geZ0_norm ltZ_def.
112100

113101
Fact Z_of_intE (n : int) : Z_of_int n = (n%:~R)%R.
114102
Proof.
@@ -121,48 +109,33 @@ Qed.
121109
Fact Z_of_int_is_additive : additive Z_of_int.
122110
Proof. by move=> m n; rewrite !Z_of_intE raddfB. Qed.
123111

124-
Canonical Z_of_int_additive := Additive Z_of_int_is_additive.
112+
#[export]
113+
HB.instance Definition _ := GRing.isAdditive.Build int Z Z_of_int
114+
Z_of_int_is_additive.
125115

126116
Fact int_of_Z_is_additive : additive int_of_Z.
127117
Proof. exact: can2_additive Z_of_intK int_of_ZK. Qed.
128118

129-
Canonical int_of_Z_additive := Additive int_of_Z_is_additive.
119+
#[export]
120+
HB.instance Definition _ := GRing.isAdditive.Build Z int int_of_Z
121+
int_of_Z_is_additive.
130122

131123
Fact Z_of_int_is_multiplicative : multiplicative Z_of_int.
132124
Proof. by split => // n m; rewrite !Z_of_intE rmorphM. Qed.
133125

134-
Canonical Z_of_int_rmorphism := AddRMorphism Z_of_int_is_multiplicative.
126+
#[export]
127+
HB.instance Definition _ := GRing.isMultiplicative.Build int Z Z_of_int
128+
Z_of_int_is_multiplicative.
135129

136130
Fact int_of_Z_is_multiplicative : multiplicative int_of_Z.
137131
Proof. exact: can2_rmorphism Z_of_intK int_of_ZK. Qed.
138132

139-
Canonical int_of_Z_rmorphism := AddRMorphism int_of_Z_is_multiplicative.
133+
#[export]
134+
HB.instance Definition _ := GRing.isMultiplicative.Build Z int int_of_Z
135+
int_of_Z_is_multiplicative.
136+
137+
Module Exports. HB.reexport. End Exports.
140138

141139
End ZInstances.
142140

143-
Canonical ZInstances.Z_eqType.
144-
Canonical ZInstances.Z_choiceType.
145-
Canonical ZInstances.Z_countType.
146-
Canonical ZInstances.Z_zmodType.
147-
Canonical ZInstances.Z_ringType.
148-
Canonical ZInstances.Z_comRingType.
149-
Canonical ZInstances.Z_unitRingType.
150-
Canonical ZInstances.Z_comUnitRing.
151-
Canonical ZInstances.Z_idomainType.
152-
Canonical ZInstances.Z_countZmodType.
153-
Canonical ZInstances.Z_countRingType.
154-
Canonical ZInstances.Z_countComRingType.
155-
Canonical ZInstances.Z_countUnitRingType.
156-
Canonical ZInstances.Z_countComUnitRingType.
157-
Canonical ZInstances.Z_countIdomainType.
158-
Canonical ZInstances.Z_porderType.
159-
Canonical ZInstances.Z_latticeType.
160-
Canonical ZInstances.Z_distrLatticeType.
161-
Canonical ZInstances.Z_orderType.
162-
Canonical ZInstances.Z_numDomainType.
163-
Canonical ZInstances.Z_normedZmodType.
164-
Canonical ZInstances.Z_realDomainType.
165-
Canonical ZInstances.Z_of_int_additive.
166-
Canonical ZInstances.int_of_Z_additive.
167-
Canonical ZInstances.Z_of_int_rmorphism.
168-
Canonical ZInstances.int_of_Z_rmorphism.
141+
Export ZInstances.Exports.

theories/zify_algebra.v

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Instance Op_int_eq : BinRel (@eq int) :=
4949
Add Zify BinRel Op_int_eq.
5050

5151
#[global]
52-
Instance Op_int_eq_op : BinOp (@eq_op int_eqType : int -> int -> bool) :=
52+
Instance Op_int_eq_op : BinOp (@eq_op int : int -> int -> bool) :=
5353
{ TBOp := Z.eqb;
5454
TBOpInj := ltac:(move=> [] ? [] ?; do 2 rewrite eqE /=; lia) }.
5555
Add Zify BinOp Op_int_eq_op.
@@ -98,7 +98,7 @@ Instance Op_int_intmul : BinOp ( *~%R%R : int -> int -> int) :=
9898
Add Zify BinOp Op_int_intmul.
9999

100100
#[global]
101-
Instance Op_int_scale : BinOp (@GRing.scale _ [lmodType int of int^o]) :=
101+
Instance Op_int_scale : BinOp (@GRing.scale _ int^o) :=
102102
Op_mulz.
103103
Add Zify BinOp Op_int_scale.
104104

@@ -274,7 +274,8 @@ Instance Op_Z_intmul : BinOp ( *~%R%R : Z -> int -> Z) :=
274274
Add Zify BinOp Op_Z_intmul.
275275

276276
#[global]
277-
Instance Op_Z_scale : BinOp (@GRing.scale _ [lmodType Z of Z^o]) := Op_Z_mulr.
277+
Instance Op_Z_scale : BinOp (@GRing.scale _ Z^o) :=
278+
Op_Z_mulr.
278279
Add Zify BinOp Op_Z_scale.
279280

280281
Fact Op_Z_exp_subproof n m : (n ^+ m)%R = (n ^ Z.of_nat m)%Z.

theories/zify_ssreflect.v

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,23 @@ Instance Op_bool_join' : BinOp (Order.meet : bool^d -> _) := Op_orb.
117117
Add Zify BinOp Op_bool_join'.
118118

119119
#[global]
120-
Instance Op_bool_bottom : CstOp (Order.bottom : bool) := Op_false.
120+
Instance Op_bool_bottom : CstOp (\bot : bool)%O := Op_false.
121121
Add Zify CstOp Op_bool_bottom.
122122

123123
#[global]
124-
Instance Op_bool_bottom' : CstOp (Order.top : bool^d) := Op_false.
124+
Instance Op_bool_bottom' : CstOp (\top : bool^d)%O := Op_false.
125125
Add Zify CstOp Op_bool_bottom'.
126126

127127
#[global]
128-
Instance Op_bool_top : CstOp (Order.top : bool) := Op_true.
128+
Instance Op_bool_top : CstOp (\top : bool)%O := Op_true.
129129
Add Zify CstOp Op_bool_top.
130130

131131
#[global]
132-
Instance Op_bool_top' : CstOp (Order.bottom : bool^d) := Op_true.
132+
Instance Op_bool_top' : CstOp (\bot : bool^d)%O := Op_true.
133133
Add Zify CstOp Op_bool_top'.
134134

135135
#[global]
136-
Instance Op_bool_sub : BinOp (Order.sub : bool -> bool -> bool) :=
136+
Instance Op_bool_sub : BinOp (Order.diff : bool -> bool -> bool) :=
137137
{ TBOp x y := x && ~~ y; TBOpInj := ltac:(by case=> [][]) }.
138138
Add Zify BinOp Op_bool_sub.
139139

@@ -351,7 +351,7 @@ Instance Op_nat_join' : BinOp (Order.meet : nat^d -> _) := Op_maxn.
351351
Add Zify BinOp Op_nat_join'.
352352

353353
#[global]
354-
Instance Op_nat_bottom : CstOp (Order.bottom : nat) := Op_O.
354+
Instance Op_nat_bottom : CstOp (\bot : nat)%O := Op_O.
355355
Add Zify CstOp Op_nat_bottom.
356356

357357
(******************************************************************************)
@@ -578,20 +578,20 @@ Instance Op_natdvd_join' : BinOp (Order.meet : natdvd^d -> _) := Op_lcmn.
578578
Add Zify BinOp Op_natdvd_join'.
579579

580580
#[global]
581-
Instance Op_natdvd_bottom : CstOp (Order.bottom : natdvd) :=
581+
Instance Op_natdvd_bottom : CstOp (\bot : natdvd)%O :=
582582
{ TCst := 1%Z; TCstInj := erefl }.
583583
Add Zify CstOp Op_natdvd_bottom.
584584

585585
#[global]
586-
Instance Op_natdvd_bottom' : CstOp (Order.top : natdvd^d) := Op_natdvd_bottom.
586+
Instance Op_natdvd_bottom' : CstOp (\top : natdvd^d)%O := Op_natdvd_bottom.
587587
Add Zify CstOp Op_natdvd_bottom'.
588588

589589
#[global]
590-
Instance Op_natdvd_top : CstOp (Order.top : natdvd) := Op_O.
590+
Instance Op_natdvd_top : CstOp (\top : natdvd)%O := Op_O.
591591
Add Zify CstOp Op_natdvd_top.
592592

593593
#[global]
594-
Instance Op_natdvd_top' : CstOp (Order.bottom : natdvd^d) := Op_O.
594+
Instance Op_natdvd_top' : CstOp (\bot : natdvd^d)%O := Op_O.
595595
Add Zify CstOp Op_natdvd_top'.
596596

597597
Module Exports.

0 commit comments

Comments
 (0)