Skip to content

Commit 641eef1

Browse files
authored
Merge pull request #9 from coq-community/compat-8.20
Compatibility with Coq 8.20
2 parents fecbacd + c277412 commit 641eef1

File tree

3 files changed

+57
-28
lines changed

3 files changed

+57
-28
lines changed

.github/workflows/docker-action.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
matrix:
1919
image:
2020
- 'coqorg/coq:dev'
21+
- 'coqorg/coq:8.20'
2122
- 'coqorg/coq:8.19'
2223
- 'coqorg/coq:8.18'
2324
- 'coqorg/coq:8.17'

Hierarchy/Type_class_definition.v

+55-28
Original file line numberDiff line numberDiff line change
@@ -38,120 +38,147 @@ Definition scalar A B := A -> B -> B.
3838
Definition value A := A -> R.
3939

4040
Class Metric_Space (A : Type) (eqA : relation A) (d : A -> A -> R) := {
41-
metric_space_setoid :> Equivalence eqA ;
41+
metric_space_setoid : Equivalence eqA ;
4242
metric_space_positive : forall x y : A, 0 <= d x y ;
4343
metric_space_symmetry : forall x y : A, d x y = d y x ;
4444
metric_space_separation : forall x y : A, (0 = d x y -> eqA x y) /\ (eqA x y -> 0 = d x y);
4545
metric_space_triangular_inequality : forall x y z : A, d x z <= (d x y) + (d y z)
4646
}.
47+
#[global] Existing Instance metric_space_setoid.
4748

4849
Class Monoid (M : Type) (eqM : relation M) (f : operation M) (eps : M) := {
49-
monoid_setoid :> Equivalence eqM ;
50+
monoid_setoid : Equivalence eqM ;
5051
monoid_iden_l : forall x : M, eqM (f eps x) x ;
5152
monoid_iden_r : forall x : M, eqM (f x eps) x ;
52-
monoid_assoc :> Associative eqM f;
53+
monoid_assoc : Associative eqM f;
5354
monoid_eq_compat_l : forall x y z : M, eqM y z -> eqM (f x y) (f x z);
5455
monoid_eq_compat_r: forall x y z : M, eqM x y -> eqM (f x z) (f y z)
5556
}.
57+
#[global] Existing Instance monoid_setoid.
58+
#[global] Existing Instance monoid_assoc.
5659

5760
Class Monoid_Commutative (M : Type) (eqM : relation M) (f : operation M) (eps : M) := {
58-
monoid_comm_monoid :> Monoid M eqM f eps ;
59-
monoid_comm :> Commutative eqM f
61+
monoid_comm_monoid : Monoid M eqM f eps ;
62+
monoid_comm : Commutative eqM f
6063
}.
64+
#[global] Existing Instance monoid_comm_monoid.
65+
#[global] Existing Instance monoid_comm.
6166

6267
Class Group (G : Type) (eqG : relation G) (f : operation G) (eps : G) := {
63-
group_monoid :> Monoid G eqG f eps;
68+
group_monoid : Monoid G eqG f eps;
6469
group_reverse : forall x : G, sig (fun y => eqG (f x y) eps)
6570
}.
71+
#[global] Existing Instance group_monoid.
6672

6773
Class Group_Commutative (G : Type) (eqG : relation G) (f : operation G) (eps : G) := {
68-
group_comm_group :> Group G eqG f eps ;
69-
group_comm :> Commutative eqG f
74+
group_comm_group : Group G eqG f eps ;
75+
group_comm : Commutative eqG f
7076
}.
77+
#[global] Existing Instance group_comm_group.
78+
#[global] Existing Instance group_comm.
7179

7280
Class Group_Multiplicative (G : Type) (eqG : relation G) (mult : operation G) (eps0 : G) (eps1 : G) := {
73-
group_setoid :> Equivalence eqG ;
81+
group_setoid : Equivalence eqG ;
7482
group_multiplicative_iden_l : forall x : G, eqG (mult eps1 x) x ;
7583
group_multiplicative_iden_r : forall x : G, eqG (mult x eps1) x ;
7684
group_multiplicative_reverse : forall x : G, ~(eqG x eps0) -> sig (fun y => eqG (mult x y) eps1);
77-
group_multiplicative_assoc :> Associative eqG mult;
85+
group_multiplicative_assoc : Associative eqG mult;
7886
group_multiplicative_eq_compat_l : forall x y z : G, eqG y z -> eqG (mult x y) (mult x z);
7987
group_multiplicative_eq_compat_r: forall x y z : G, eqG x y -> eqG (mult x z) (mult y z)
8088
}.
89+
#[global] Existing Instance group_setoid.
90+
#[global] Existing Instance group_multiplicative_assoc.
8191

8292
Class SemiRing (S : Type) (eqS : relation S) (add : operation S) (mult : operation S) (eps0 : S) (eps1 : S) := {
83-
semiring_monoid_comm :> Monoid_Commutative S eqS add eps0 ;
84-
semiring_monoid :> Monoid S eqS mult eps1 ;
93+
semiring_monoid_comm : Monoid_Commutative S eqS add eps0 ;
94+
semiring_monoid : Monoid S eqS mult eps1 ;
8595
semiring_distributive_r : forall x y z : S, eqS (mult x (add y z)) (add (mult x y) (mult x z)) ;
8696
semiring_distributive_l : forall x y z : S, eqS (mult (add x y) z) (add (mult x z) (mult y z)) ;
8797
semiring_absorption_r : forall x : S, eqS (mult x eps0) eps0 ;
8898
semiring_absorption_l : forall x : S, eqS (mult eps0 x) eps0
8999
}.
100+
#[global] Existing Instance semiring_monoid_comm.
101+
#[global] Existing Instance semiring_monoid.
90102

91103
Class SemiRing_Commutative (S : Type) (eqS : relation S) (add : operation S) (mult : operation S) (eps0 : S) (eps1 : S) := {
92-
semiring_comm_semiring :> SemiRing S eqS add mult eps0 eps1 ;
93-
semiring_comm :> Commutative eqS mult
104+
semiring_comm_semiring : SemiRing S eqS add mult eps0 eps1 ;
105+
semiring_comm : Commutative eqS mult
94106
}.
107+
#[global] Existing Instance semiring_comm_semiring.
108+
#[global] Existing Instance semiring_comm.
95109

96110
Class Ring (R : Type) (eqR : relation R) (add : operation R) (mult : operation R) (eps0 : R) (eps1 : R) := {
97-
ring_group_comm :> Group_Commutative R eqR add eps0 ;
98-
ring_monoid :> Monoid R eqR mult eps1 ;
111+
ring_group_comm : Group_Commutative R eqR add eps0 ;
112+
ring_monoid : Monoid R eqR mult eps1 ;
99113
ring_distributive_r : forall x y z : R, eqR (mult x (add y z)) (add (mult x y) (mult x z)) ;
100114
ring_distributive_l : forall x y z : R, eqR (mult (add x y) z) (add (mult x z) (mult y z))
101115
}.
116+
#[global] Existing Instance ring_group_comm.
117+
#[global] Existing Instance ring_monoid.
102118

103119
Class Ring_Commutative (R : Type) (eqR : relation R) (add : operation R) (mult : operation R) (eps0 : R) (eps1 : R) := {
104-
ring_comm_ring :> Ring R eqR add mult eps0 eps1 ;
105-
ring_comm :> Commutative eqR mult
120+
ring_comm_ring : Ring R eqR add mult eps0 eps1 ;
121+
ring_comm : Commutative eqR mult
106122
}.
123+
#[global] Existing Instance ring_comm_ring.
124+
#[global] Existing Instance ring_comm.
107125

108126
Class Field (F : Type) (eqF : relation F) (add : operation F) (mult : operation F) (eps0 : F) (eps1 : F) := {
109-
field_group_comm :> Group_Commutative F eqF add eps0 ;
110-
field_group_multiplicative :> Group_Multiplicative F eqF mult eps0 eps1 ;
127+
field_group_comm : Group_Commutative F eqF add eps0 ;
128+
field_group_multiplicative : Group_Multiplicative F eqF mult eps0 eps1 ;
111129
field_distributive_r : forall x y z : F, eqF (mult x (add y z)) (add (mult x y) (mult x z)) ;
112130
field_distributive_l : forall x y z : F, eqF (mult (add x y) z) (add (mult x z) (mult y z))
113131
}.
132+
#[global] Existing Instance field_group_comm.
133+
#[global] Existing Instance field_group_multiplicative.
114134

115135
Class Field_Commutative (F : Type) (eqF : relation F) (add : operation F) (mult : operation F) (eps0 : F) (eps1 : F) := {
116-
field_comm_field :> Field F eqF add mult eps0 eps1 ;
117-
field_comm :> Commutative eqF mult
136+
field_comm_field : Field F eqF add mult eps0 eps1 ;
137+
field_comm : Commutative eqF mult
118138
}.
139+
#[global] Existing Instance field_comm_field.
140+
#[global] Existing Instance field_comm.
119141

120142
Class Field_Valued (F : Type) (eqF : relation F) (add : operation F) (mult : operation F) (eps0 : F) (eps1 : F) (abs : value F) := {
121-
field_valued_field_commutative :> Field_Commutative F eqF add mult eps0 eps1 ;
143+
field_valued_field_commutative : Field_Commutative F eqF add mult eps0 eps1 ;
122144
field_valued_positive : forall x : F, 0 <= (abs x) ;
123145
field_valued_separation : (abs eps0) = 0 /\ forall x : F, (abs x) = 0 -> eqF x eps0 ;
124146
field_valued_triangular_inequality : forall x y : F, abs (add x y) <= (abs x) + (abs y);
125147
field_valued_homogeneity : forall x y : F, abs (mult x y) = (abs x) * (abs y)
126148
}.
149+
#[global] Existing Instance field_valued_field_commutative.
127150

128151
Class Vector_Space (E : Type) (eqE : relation E) (F : Type) (eqF : relation F)
129152
(v_add : operation E) (v_mult : scalar F E)
130153
(add : operation F) (mult : operation F)
131154
(v_null : E)
132155
(eps0 : F) (eps1 : F):= {
133-
vector_space_field :> Field_Commutative F eqF add mult eps0 eps1 ;
134-
vector_space_group_comm :> Group_Commutative E eqE v_add v_null ;
156+
vector_space_field : Field_Commutative F eqF add mult eps0 eps1 ;
157+
vector_space_group_comm : Group_Commutative E eqE v_add v_null ;
135158
vector_space_distributive_r : forall a : F, forall x y : E, eqE (v_mult a (v_add x y)) (v_add (v_mult a x) (v_mult a y)) ;
136159
vector_space_distributive_l : forall a b : F, forall x : E, eqE (v_mult (add a b) x) (v_add (v_mult a x) (v_mult b x)) ;
137160
vector_space_assoc : forall a b : F, forall x : E, eqE (v_mult (mult a b) x) (v_mult a (v_mult b x)) ;
138161
vector_space_iden_l : forall a : F, forall x : E, eqE (v_mult eps1 x) x;
139162
vector_space_eq_compat_l : forall a : F, forall x y :E, eqE x y -> eqE (v_mult a x) (v_mult a y);
140163
vector_space_eq_compat_r : forall a b : F, forall x : E, eqF a b -> (eqE (v_mult a x) (v_mult b x))
141164
}.
165+
#[global] Existing Instance vector_space_field.
166+
#[global] Existing Instance vector_space_group_comm.
142167

143168
Class Vector_Space_Normed (E : Type) (eqE : relation E) (F : Type) (eqF : relation F)
144169
(v_add : operation E) (v_mult : scalar F E)
145170
(add : operation F) (mult : operation F)
146171
(v_null : E)
147172
(eps0 : F) (eps1 : F)
148173
(norm: value E) (abs : value F) := {
149-
vector_space_normed_field_valued :> Field_Valued F eqF add mult eps0 eps1 abs ;
150-
vector_space_normed_vector_space :> Vector_Space E eqE F eqF v_add v_mult add mult v_null eps0 eps1 ;
174+
vector_space_normed_field_valued : Field_Valued F eqF add mult eps0 eps1 abs ;
175+
vector_space_normed_vector_space : Vector_Space E eqE F eqF v_add v_mult add mult v_null eps0 eps1 ;
151176
vector_space_normed_separation : forall v : E, (norm v) = 0 -> eqE v v_null ;
152177
vector_space_normed_triangular_inequality : forall v w : E, norm (v_add v w) <= (norm v) + (norm w) ;
153178
vector_space_normed_homogeneity : forall x : F, forall v : E, norm (v_mult x v) = (abs x) * (norm v)
154179
}.
180+
#[global] Existing Instance vector_space_normed_field_valued.
181+
#[global] Existing Instance vector_space_normed_vector_space.
155182

156183
Close Scope R_scope.
157184

@@ -168,4 +195,4 @@ Hint Rewrite
168195
@monoid_eq_compat_r
169196
@op_assoc
170197
@op_comm
171-
: typeclass.*)
198+
: typeclass.*)

meta.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ tested_coq_nix_versions:
4242

4343
tested_coq_opam_versions:
4444
- version: dev
45+
- version: '8.20'
4546
- version: '8.19'
4647
- version: '8.18'
4748
- version: '8.17'

0 commit comments

Comments
 (0)