Skip to content

Commit eafee93

Browse files
authored
Merge pull request #42 from proux01/hierarchy-builder
Port to Hierarchy Builder
2 parents 2a51c1d + bc6cbdf commit eafee93

File tree

6 files changed

+481
-688
lines changed

6 files changed

+481
-688
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,11 @@ jobs:
88
strategy:
99
matrix:
1010
image:
11-
- coqorg/coq:8.13-native-ocaml-4.07 # with the coq-native opam pkg
12-
- coqorg/coq:8.17-native-ocaml-4.13-flambda # with the coq-native opam pkg
13-
- mathcomp/mathcomp:1.13.0-coq-8.13 # (without coq-native for now)
14-
- mathcomp/mathcomp:1.13.0-coq-8.14 # (without coq-native for now)
15-
- mathcomp/mathcomp:1.13.0-coq-8.15 # (without coq-native for now)
16-
- mathcomp/mathcomp:1.15.0-coq-8.13
17-
- mathcomp/mathcomp:1.15.0-coq-8.16
18-
- mathcomp/mathcomp:1.16.0-coq-8.13
19-
- mathcomp/mathcomp:1.16.0-coq-8.14
20-
- mathcomp/mathcomp:1.16.0-coq-8.15
21-
- mathcomp/mathcomp:1.16.0-coq-8.16
22-
- mathcomp/mathcomp:1.16.0-coq-8.17
23-
- mathcomp/mathcomp:1.17.0-coq-8.17
24-
- mathcomp/mathcomp-dev:coq-8.15 # (without coq-native for now)
25-
- mathcomp/mathcomp-dev:coq-8.16 # (without coq-native for now)
26-
- mathcomp/mathcomp-dev:coq-8.17 # (without coq-native for now)
27-
- mathcomp/mathcomp-dev:coq-dev # (without coq-native for now)
28-
# the previous comments refer to https://github.com/coq/ceps/pull/48
11+
- mathcomp/mathcomp:2.0.0-coq-8.16
12+
- mathcomp/mathcomp:2.0.0-coq-8.17
13+
- mathcomp/mathcomp-dev:coq-8.16
14+
- mathcomp/mathcomp-dev:coq-8.17
15+
- mathcomp/mathcomp-dev:coq-dev
2916
fail-fast: false
3017
steps:
3118
- uses: actions/checkout@v2

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ default: build
1212
build:
1313
$(DUNE) build
1414

15+
install:
16+
$(DUNE) install
17+
1518
clean:
1619
$(DUNE) clean

coq-mathcomp-multinomials.opam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ build: [
1010
[ "dune" "build" "-p" name "-j" jobs ]
1111
]
1212
depends: [
13-
"coq" {(>= "8.13" & < "8.18~") | = "dev"}
13+
"coq" {(>= "8.16" & < "8.18~") | = "dev"}
1414
"dune" {>= "2.8"}
15-
"coq-mathcomp-ssreflect" {(>= "1.13" & < "1.18~") | = "dev"}
15+
"coq-mathcomp-ssreflect" {(>= "2.0" & < "2.1~") | = "dev"}
1616
"coq-mathcomp-algebra"
1717
"coq-mathcomp-bigenough" {(>= "1.0" & < "1.1~") | = "dev"}
18-
"coq-mathcomp-finmap" {(>= "1.5" & < "1.6~") | = "dev"}
18+
"coq-mathcomp-finmap" {(>= "2.0" & < "2.1~") | = "dev"}
1919
]
2020
tags: [
2121
"keyword:multinomials"

src/freeg.v

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
(***********************************************************************)
2424

2525
(* -------------------------------------------------------------------- *)
26+
From HB Require Import structures.
2627
From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice.
2728
From mathcomp Require Import fintype bigop order generic_quotient.
2829
From mathcomp Require Import ssralg ssrnum ssrint.
@@ -70,13 +71,8 @@ Module FreegDefs.
7071
Lemma prefreeg_uniq (D : prefreeg) : uniq [seq zx.2 | zx <- D].
7172
Proof. exact/reduced_uniq/prefreeg_reduced. Qed.
7273

73-
Canonical prefreeg_subType := [subType for seq_of_prefreeg].
74-
75-
Definition prefreeg_eqMixin := Eval hnf in [eqMixin of prefreeg by <:].
76-
Canonical prefreeg_eqType := Eval hnf in EqType _ prefreeg_eqMixin.
77-
78-
Definition prefreeg_choiceMixin := Eval hnf in [choiceMixin of prefreeg by <:].
79-
Canonical prefreeg_choiceType := Eval hnf in ChoiceType prefreeg prefreeg_choiceMixin.
74+
#[export] HB.instance Definition _ := [isSub for seq_of_prefreeg].
75+
#[export] HB.instance Definition _ := [Choice of prefreeg by <:].
8076
End Defs.
8177

8278
Arguments mkPrefreeg [G K].
@@ -100,15 +96,15 @@ Module FreegDefs.
10096

10197
Notation "{ 'freeg' K / G }" := (type_of (Phant G) (Phant K)).
10298

103-
Canonical freeg_quotType := [quotType of type].
104-
Canonical freeg_eqType := [eqType of type].
105-
Canonical freeg_choiceType := [choiceType of type].
106-
Canonical freeg_eqQuotType := [eqQuotType equiv of type].
99+
#[export] HB.instance Definition _ := Quotient.on type.
100+
#[export] HB.instance Definition _ := Choice.on type.
101+
#[export] HB.instance Definition _ : EqQuotient _ equiv type :=
102+
EqQuotient.on type.
107103

108-
Canonical freeg_of_quotType := [quotType of {freeg K / G}].
109-
Canonical freeg_of_eqType := [eqType of {freeg K / G}].
110-
Canonical freeg_of_choiceType := [choiceType of {freeg K / G}].
111-
Canonical freeg_of_eqQuotType := [eqQuotType equiv of {freeg K / G}].
104+
#[export] HB.instance Definition _ := Quotient.on {freeg K / G}.
105+
#[export] HB.instance Definition _ := Choice.on {freeg K / G}.
106+
#[export] HB.instance Definition _ : EqQuotient _ equiv {freeg K / G} :=
107+
EqQuotient.on {freeg K / G}.
112108
End Quotient.
113109

114110
Module Exports.
@@ -117,18 +113,7 @@ Module FreegDefs.
117113
Canonical prefreeg_equiv.
118114
Canonical prefreeg_equiv_direct.
119115

120-
Canonical prefreeg_subType.
121-
Canonical prefreeg_eqType.
122-
Canonical prefreeg_choiceType.
123-
Canonical prefreeg_equiv.
124-
Canonical freeg_quotType.
125-
Canonical freeg_eqType.
126-
Canonical freeg_choiceType.
127-
Canonical freeg_eqQuotType.
128-
Canonical freeg_of_quotType.
129-
Canonical freeg_of_eqType.
130-
Canonical freeg_of_choiceType.
131-
Canonical freeg_of_eqQuotType.
116+
HB.reexport.
132117

133118
Notation prefreeg := prefreeg.
134119
Notation fgequiv := equiv.
@@ -559,14 +544,14 @@ Module FreegZmodType.
559544
by rewrite !rw /= addrC subrr.
560545
Qed.
561546

562-
Definition freeg_zmodMixin := ZmodMixin addmA addmC addm0 addmN.
563-
Canonical freeg_zmodType := ZmodType {freeg K / R} freeg_zmodMixin.
547+
#[export] HB.instance Definition _ := GRing.isZmodule.Build {freeg K / R}
548+
addmA addmC addm0 addmN.
564549
End Defs.
565550

566551
Module Exports.
567552
Canonical pi_fgadd_morph.
568553
Canonical pi_fgopp_morph.
569-
Canonical freeg_zmodType.
554+
HB.reexport.
570555
End Exports.
571556
End FreegZmodType.
572557

@@ -595,9 +580,11 @@ Section FreegZmodTypeTheory.
595580

596581
(* -------------------------------------------------------------------- *)
597582
Lemma coeff_is_additive x : additive (coeff x).
598-
Proof. exact: lift_is_additive [lalgType R of R^o] _. Qed.
583+
Proof. exact: lift_is_additive R^o _. Qed.
599584

600-
Canonical coeff_additive x := Additive (coeff_is_additive x).
585+
#[export] HB.instance Definition _ x :=
586+
GRing.isAdditive.Build {freeg K / R} R (coeff x)
587+
(coeff_is_additive x).
601588

602589
Lemma coeff0 z : coeff z 0 = 0 . Proof. exact: raddf0. Qed.
603590
Lemma coeffN z : {morph coeff z: x / - x} . Proof. exact: raddfN. Qed.
@@ -803,10 +790,8 @@ Section FreeglModType.
803790
by apply/eqP/freeg_eqP=> x; rewrite !(coeffD, coeff_fgscale) mulrDl.
804791
Qed.
805792

806-
Definition freeg_lmodMixin :=
807-
LmodMixin fgscaleA fgscale1r fgscaleDr fgscaleDl.
808-
Canonical freeg_lmodType :=
809-
Eval hnf in LmodType R {freeg K / R} freeg_lmodMixin.
793+
HB.instance Definition _ := GRing.Zmodule_isLmodule.Build R {freeg K / R}
794+
fgscaleA fgscale1r fgscaleDr fgscaleDl.
810795
End FreeglModType.
811796

812797
(* -------------------------------------------------------------------- *)
@@ -850,10 +835,12 @@ Section Deg.
850835

851836
Definition predeg (D : seq (int * K)) := \sum_(kx <- D) kx.1.
852837

853-
Lemma deg_is_additive : additive deg.
854-
Proof. exact: lift_is_additive K [lalgType int of int^o] _. Qed.
838+
Lemma deg_is_additive: additive deg.
839+
Proof. exact: (@lift_is_additive _ K int^o). Qed.
855840

856-
Canonical deg_additive := Additive deg_is_additive.
841+
#[export] HB.instance Definition _ :=
842+
GRing.isAdditive.Build {freeg K / int} int deg
843+
deg_is_additive.
857844

858845
Lemma deg0 : deg 0 = 0 . Proof. exact: raddf0. Qed.
859846
Lemma degN : {morph deg: x / - x} . Proof. exact: raddfN. Qed.

0 commit comments

Comments
 (0)