2323(********************************************************************** *)
2424
2525(* -------------------------------------------------------------------- *)
26+ From HB Require Import structures.
2627From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice.
2728From mathcomp Require Import fintype bigop order generic_quotient.
2829From 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.
571556End 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.
810795End 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