@@ -6,9 +6,9 @@ For various structures we omit declaration of substructures. For example, if we
6
6
say:
7
7
8
8
Class Setoid_Morphism :=
9
- { setoidmor_a :> Setoid A
10
- ; setoidmor_b :> Setoid B
11
- ; sm_proper :> Proper ((=) ==> (=)) f }.
9
+ { setoidmor_a :: Setoid A
10
+ ; setoidmor_b :: Setoid B
11
+ ; sm_proper :: Proper ((=) ==> (=)) f }.
12
12
13
13
then each time a Setoid instance is required, Coq will try to prove that a
14
14
Setoid_Morphism exists. This obviously results in an enormous blow-up of the
@@ -20,14 +20,14 @@ Setoid_Morphism as a substructure, setoid rewriting will become horribly slow.
20
20
*)
21
21
22
22
(* An unbundled variant of the former CoRN RSetoid *)
23
- Class Setoid A {Ae : Equiv A} : Prop := setoid_eq :> Equivalence (@equiv A Ae).
23
+ Class Setoid A {Ae : Equiv A} : Prop := setoid_eq :: Equivalence (@equiv A Ae).
24
24
25
25
(* An unbundled variant of the former CoRN CSetoid. We do not
26
26
include a proof that A is a Setoid because it can be derived. *)
27
27
Class StrongSetoid A {Ae : Equiv A} `{Aap : Apart A} : Prop :=
28
- { strong_setoid_irreflexive :> Irreflexive (≶)
29
- ; strong_setoid_symmetric :> Symmetric (≶)
30
- ; strong_setoid_cotrans :> CoTransitive (≶)
28
+ { strong_setoid_irreflexive :: Irreflexive (≶)
29
+ ; strong_setoid_symmetric :: Symmetric (≶)
30
+ ; strong_setoid_cotrans :: CoTransitive (≶)
31
31
; tight_apart : ∀ x y, ¬x ≶ y ↔ x = y }.
32
32
33
33
Arguments tight_apart {A Ae Aap StrongSetoid} _ _.
@@ -38,7 +38,7 @@ Section setoid_morphisms.
38
38
Class Setoid_Morphism :=
39
39
{ setoidmor_a : Setoid A
40
40
; setoidmor_b : Setoid B
41
- ; sm_proper :> Proper ((=) ==> (=)) f }.
41
+ ; sm_proper :: Proper ((=) ==> (=)) f }.
42
42
43
43
Class StrongSetoid_Morphism :=
44
44
{ strong_setoidmor_a : StrongSetoid A
@@ -70,80 +70,80 @@ Section upper_classes.
70
70
Context A {Ae : Equiv A}.
71
71
72
72
Class SemiGroup {Aop: SgOp A} : Prop :=
73
- { sg_setoid :> Setoid A
74
- ; sg_ass :> Associative (&)
75
- ; sg_op_proper :> Proper ((=) ==> (=) ==> (=)) (&) }.
73
+ { sg_setoid :: Setoid A
74
+ ; sg_ass :: Associative (&)
75
+ ; sg_op_proper :: Proper ((=) ==> (=) ==> (=)) (&) }.
76
76
77
77
Class CommutativeSemiGroup {Aop : SgOp A} : Prop :=
78
- { comsg_setoid :> @SemiGroup Aop
79
- ; comsg_ass :> Commutative (&) }.
78
+ { comsg_setoid :: @SemiGroup Aop
79
+ ; comsg_ass :: Commutative (&) }.
80
80
81
81
Class SemiLattice {Aop : SgOp A} : Prop :=
82
- { semilattice_sg :> @CommutativeSemiGroup Aop
83
- ; semilattice_idempotent :> BinaryIdempotent (&)}.
82
+ { semilattice_sg :: @CommutativeSemiGroup Aop
83
+ ; semilattice_idempotent :: BinaryIdempotent (&)}.
84
84
85
85
Class Monoid {Aop : SgOp A} {Aunit : MonUnit A} : Prop :=
86
- { monoid_semigroup :> SemiGroup
87
- ; monoid_left_id :> LeftIdentity (&) mon_unit
88
- ; monoid_right_id :> RightIdentity (&) mon_unit }.
86
+ { monoid_semigroup :: SemiGroup
87
+ ; monoid_left_id :: LeftIdentity (&) mon_unit
88
+ ; monoid_right_id :: RightIdentity (&) mon_unit }.
89
89
90
90
Class CommutativeMonoid {Aop Aunit} : Prop :=
91
- { commonoid_mon :> @Monoid Aop Aunit
92
- ; commonoid_commutative :> Commutative (&) }.
91
+ { commonoid_mon :: @Monoid Aop Aunit
92
+ ; commonoid_commutative :: Commutative (&) }.
93
93
94
94
Class Group {Aop Aunit} {Anegate : Negate A} : Prop :=
95
- { group_monoid :> @Monoid Aop Aunit
96
- ; negate_proper :> Setoid_Morphism (-)
97
- ; negate_l :> LeftInverse (&) (-) mon_unit
98
- ; negate_r :> RightInverse (&) (-) mon_unit }.
95
+ { group_monoid :: @Monoid Aop Aunit
96
+ ; negate_proper :: Setoid_Morphism (-)
97
+ ; negate_l :: LeftInverse (&) (-) mon_unit
98
+ ; negate_r :: RightInverse (&) (-) mon_unit }.
99
99
100
100
Class BoundedSemiLattice {Aop Aunit} : Prop :=
101
- { bounded_semilattice_mon :> @CommutativeMonoid Aop Aunit
102
- ; bounded_semilattice_idempotent :> BinaryIdempotent (&)}.
101
+ { bounded_semilattice_mon :: @CommutativeMonoid Aop Aunit
102
+ ; bounded_semilattice_idempotent :: BinaryIdempotent (&)}.
103
103
104
104
Class AbGroup {Aop Aunit Anegate} : Prop :=
105
- { abgroup_group :> @Group Aop Aunit Anegate
106
- ; abgroup_commutative :> Commutative (&) }.
105
+ { abgroup_group :: @Group Aop Aunit Anegate
106
+ ; abgroup_commutative :: Commutative (&) }.
107
107
108
108
Context {Aplus : Plus A} {Amult : Mult A} {Azero : Zero A} {Aone : One A}.
109
109
110
110
Class SemiRing : Prop :=
111
- { semiplus_monoid :> @CommutativeMonoid plus_is_sg_op zero_is_mon_unit
112
- ; semimult_monoid :> @CommutativeMonoid mult_is_sg_op one_is_mon_unit
113
- ; semiring_distr :> LeftDistribute (.*.) (+)
114
- ; semiring_left_absorb :> LeftAbsorb (.*.) 0 }.
111
+ { semiplus_monoid :: @CommutativeMonoid plus_is_sg_op zero_is_mon_unit
112
+ ; semimult_monoid :: @CommutativeMonoid mult_is_sg_op one_is_mon_unit
113
+ ; semiring_distr :: LeftDistribute (.*.) (+)
114
+ ; semiring_left_absorb :: LeftAbsorb (.*.) 0 }.
115
115
116
116
Context {Anegate : Negate A}.
117
117
118
118
Class Ring : Prop :=
119
- { ring_group :> @AbGroup plus_is_sg_op zero_is_mon_unit _
120
- ; ring_monoid :> @CommutativeMonoid mult_is_sg_op one_is_mon_unit
121
- ; ring_dist :> LeftDistribute (.*.) (+) }.
119
+ { ring_group :: @AbGroup plus_is_sg_op zero_is_mon_unit _
120
+ ; ring_monoid :: @CommutativeMonoid mult_is_sg_op one_is_mon_unit
121
+ ; ring_dist :: LeftDistribute (.*.) (+) }.
122
122
123
123
(* For now, we follow CoRN/ring_theory's example in having Ring and SemiRing
124
124
require commutative multiplication. *)
125
125
126
126
Class IntegralDomain : Prop :=
127
127
{ intdom_ring : Ring
128
128
; intdom_nontrivial : PropHolds (1 ≠ 0)
129
- ; intdom_nozeroes :> NoZeroDivisors A }.
129
+ ; intdom_nozeroes :: NoZeroDivisors A }.
130
130
131
131
(* We do not include strong extensionality for (-) and (/) because it can de derived *)
132
132
Class Field {Aap: Apart A} {Arecip: Recip A} : Prop :=
133
- { field_ring :> Ring
134
- ; field_strongsetoid :> StrongSetoid A
135
- ; field_plus_ext :> StrongSetoid_BinaryMorphism (+)
136
- ; field_mult_ext :> StrongSetoid_BinaryMorphism (.*.)
133
+ { field_ring :: Ring
134
+ ; field_strongsetoid :: StrongSetoid A
135
+ ; field_plus_ext :: StrongSetoid_BinaryMorphism (+)
136
+ ; field_mult_ext :: StrongSetoid_BinaryMorphism (.*.)
137
137
; field_nontrivial : PropHolds (1 ≶ 0)
138
- ; recip_proper :> Setoid_Morphism (//)
138
+ ; recip_proper :: Setoid_Morphism (//)
139
139
; recip_inverse : ∀ x, `x // x = 1 }.
140
140
141
141
(* We let /0 = 0 so properties as Injective (/), f (/x) = / (f x), / /x = x, /x * /y = /(x * y)
142
142
hold without any additional assumptions *)
143
143
Class DecField {Adec_recip : DecRecip A} : Prop :=
144
- { decfield_ring :> Ring
144
+ { decfield_ring :: Ring
145
145
; decfield_nontrivial : PropHolds (1 ≠ 0)
146
- ; dec_recip_proper :> Setoid_Morphism (/)
146
+ ; dec_recip_proper :: Setoid_Morphism (/)
147
147
; dec_recip_0 : /0 = 0
148
148
; dec_recip_inverse : ∀ x, x ≠ 0 → x / x = 1 }.
149
149
End upper_classes.
@@ -159,7 +159,7 @@ Hint Extern 5 (PropHolds (1 ≠ 0)) => eapply @decfield_nontrivial : typeclass_i
159
159
(*
160
160
For a strange reason Ring instances of Integers are sometimes obtained by
161
161
Integers -> IntegralDomain -> Ring and sometimes directly. Making this an
162
- instance with a low priority instead of using intdom_ring:> Ring forces Coq to
162
+ instance with a low priority instead of using intdom_ring:: Ring forces Coq to
163
163
take the right way
164
164
*)
165
165
#[global]
@@ -174,29 +174,29 @@ Section lattice.
174
174
Context A `{Ae: Equiv A} {Ajoin: Join A} {Ameet: Meet A} `{Abottom : Bottom A}.
175
175
176
176
Class JoinSemiLattice : Prop :=
177
- join_semilattice :> @SemiLattice A Ae join_is_sg_op.
177
+ join_semilattice :: @SemiLattice A Ae join_is_sg_op.
178
178
Class BoundedJoinSemiLattice : Prop :=
179
- bounded_join_semilattice :> @BoundedSemiLattice A Ae join_is_sg_op bottom_is_mon_unit.
179
+ bounded_join_semilattice :: @BoundedSemiLattice A Ae join_is_sg_op bottom_is_mon_unit.
180
180
Class MeetSemiLattice : Prop :=
181
- meet_semilattice :> @SemiLattice A Ae meet_is_sg_op.
181
+ meet_semilattice :: @SemiLattice A Ae meet_is_sg_op.
182
182
183
183
Class Lattice : Prop :=
184
- { lattice_join :> JoinSemiLattice
185
- ; lattice_meet :> MeetSemiLattice
186
- ; join_meet_absorption :> Absorption (⊔) (⊓)
187
- ; meet_join_absorption :> Absorption (⊓) (⊔)}.
184
+ { lattice_join :: JoinSemiLattice
185
+ ; lattice_meet :: MeetSemiLattice
186
+ ; join_meet_absorption :: Absorption (⊔) (⊓)
187
+ ; meet_join_absorption :: Absorption (⊓) (⊔)}.
188
188
189
189
Class DistributiveLattice : Prop :=
190
- { distr_lattice_lattice :> Lattice
191
- ; join_meet_distr_l :> LeftDistribute (⊔) (⊓) }.
190
+ { distr_lattice_lattice :: Lattice
191
+ ; join_meet_distr_l :: LeftDistribute (⊔) (⊓) }.
192
192
End lattice.
193
193
194
194
Class Category O `{!Arrows O} `{∀ x y: O, Equiv (x ⟶ y)} `{!CatId O} `{!CatComp O}: Prop :=
195
- { arrow_equiv :> ∀ x y, Setoid (x ⟶ y)
196
- ; comp_proper :> ∀ x y z, Proper ((=) ==> (=) ==> (=)) (comp x y z)
197
- ; comp_assoc :> ArrowsAssociative O
198
- ; id_l :> ∀ x y, LeftIdentity (comp x y y) cat_id
199
- ; id_r :> ∀ x y, RightIdentity (comp x x y) cat_id }.
195
+ { arrow_equiv :: ∀ x y, Setoid (x ⟶ y)
196
+ ; comp_proper :: ∀ x y z, Proper ((=) ==> (=) ==> (=)) (comp x y z)
197
+ ; comp_assoc :: ArrowsAssociative O
198
+ ; id_l :: ∀ x y, LeftIdentity (comp x y y) cat_id
199
+ ; id_r :: ∀ x y, RightIdentity (comp x x y) cat_id }.
200
200
(* note: no equality on objects. *)
201
201
202
202
(* todo: use my comp everywhere *)
@@ -208,46 +208,46 @@ Section morphism_classes.
208
208
Class SemiGroup_Morphism {Aop Bop} (f : A → B) :=
209
209
{ sgmor_a : @SemiGroup A Ae Aop
210
210
; sgmor_b : @SemiGroup B Be Bop
211
- ; sgmor_setmor :> Setoid_Morphism f
211
+ ; sgmor_setmor :: Setoid_Morphism f
212
212
; preserves_sg_op : ∀ x y, f (x & y) = f x & f y }.
213
213
214
214
Class JoinSemiLattice_Morphism {Ajoin Bjoin} (f : A → B) :=
215
215
{ join_slmor_a : @JoinSemiLattice A Ae Ajoin
216
216
; join_slmor_b : @JoinSemiLattice B Be Bjoin
217
- ; join_slmor_sgmor :> @SemiGroup_Morphism join_is_sg_op join_is_sg_op f }.
217
+ ; join_slmor_sgmor :: @SemiGroup_Morphism join_is_sg_op join_is_sg_op f }.
218
218
219
219
Class MeetSemiLattice_Morphism {Ameet Bmeet} (f : A → B) :=
220
220
{ meet_slmor_a : @MeetSemiLattice A Ae Ameet
221
221
; meet_slmor_b : @MeetSemiLattice B Be Bmeet
222
- ; meet_slmor_sgmor :> @SemiGroup_Morphism meet_is_sg_op meet_is_sg_op f }.
222
+ ; meet_slmor_sgmor :: @SemiGroup_Morphism meet_is_sg_op meet_is_sg_op f }.
223
223
224
224
Class Monoid_Morphism {Aunit Bunit Aop Bop} (f : A → B) :=
225
225
{ monmor_a : @Monoid A Ae Aop Aunit
226
226
; monmor_b : @Monoid B Be Bop Bunit
227
- ; monmor_sgmor :> SemiGroup_Morphism f
227
+ ; monmor_sgmor :: SemiGroup_Morphism f
228
228
; preserves_mon_unit : f mon_unit = mon_unit }.
229
229
230
230
Class BoundedJoinSemiLattice_Morphism {Abottom Bbottom Ajoin Bjoin} (f : A → B) :=
231
231
{ bounded_join_slmor_a : @BoundedJoinSemiLattice A Ae Ajoin Abottom
232
232
; bounded_join_slmor_b : @BoundedJoinSemiLattice B Be Bjoin Bbottom
233
- ; bounded_join_slmor_monmor :> @Monoid_Morphism bottom_is_mon_unit bottom_is_mon_unit join_is_sg_op join_is_sg_op f }.
233
+ ; bounded_join_slmor_monmor :: @Monoid_Morphism bottom_is_mon_unit bottom_is_mon_unit join_is_sg_op join_is_sg_op f }.
234
234
235
235
Class SemiRing_Morphism {Aplus Amult Azero Aone Bplus Bmult Bzero Bone} (f : A → B) :=
236
236
{ semiringmor_a : @SemiRing A Ae Aplus Amult Azero Aone
237
237
; semiringmor_b : @SemiRing B Be Bplus Bmult Bzero Bone
238
- ; semiringmor_plus_mor :> @Monoid_Morphism zero_is_mon_unit zero_is_mon_unit plus_is_sg_op plus_is_sg_op f
239
- ; semiringmor_mult_mor :> @Monoid_Morphism one_is_mon_unit one_is_mon_unit mult_is_sg_op mult_is_sg_op f }.
238
+ ; semiringmor_plus_mor :: @Monoid_Morphism zero_is_mon_unit zero_is_mon_unit plus_is_sg_op plus_is_sg_op f
239
+ ; semiringmor_mult_mor :: @Monoid_Morphism one_is_mon_unit one_is_mon_unit mult_is_sg_op mult_is_sg_op f }.
240
240
241
241
Class Lattice_Morphism {Ajoin Ameet Bjoin Bmeet} (f : A → B) :=
242
242
{ latticemor_a : @Lattice A Ae Ajoin Ameet
243
243
; latticemor_b : @Lattice B Be Bjoin Bmeet
244
- ; latticemor_join_mor :> JoinSemiLattice_Morphism f
245
- ; latticemor_meet_mor :> MeetSemiLattice_Morphism f }.
244
+ ; latticemor_join_mor :: JoinSemiLattice_Morphism f
245
+ ; latticemor_meet_mor :: MeetSemiLattice_Morphism f }.
246
246
247
247
Context {Aap : Apart A} {Bap : Apart B}.
248
248
Class StrongSemiRing_Morphism {Aplus Amult Azero Aone Bplus Bmult Bzero Bone} (f : A → B) :=
249
- { strong_semiringmor_sr_mor :> @SemiRing_Morphism Aplus Amult Azero Aone Bplus Bmult Bzero Bone f
250
- ; strong_semiringmor_strong_mor :> StrongSetoid_Morphism f }.
249
+ { strong_semiringmor_sr_mor :: @SemiRing_Morphism Aplus Amult Azero Aone Bplus Bmult Bzero Bone f
250
+ ; strong_semiringmor_strong_mor :: StrongSetoid_Morphism f }.
251
251
End morphism_classes.
252
252
253
253
Section jections.
@@ -267,8 +267,8 @@ Section jections.
267
267
; surjective_mor : Setoid_Morphism f }.
268
268
269
269
Class Bijective : Prop :=
270
- { bijective_injective :> Injective
271
- ; bijective_surjective :> Surjective }.
270
+ { bijective_injective :: Injective
271
+ ; bijective_surjective :: Surjective }.
272
272
End jections.
273
273
274
274
#[global]
0 commit comments