@@ -38,120 +38,147 @@ Definition scalar A B := A -> B -> B.
38
38
Definition value A := A -> R.
39
39
40
40
Class Metric_Space (A : Type ) (eqA : relation A) (d : A -> A -> R) := {
41
- metric_space_setoid :> Equivalence eqA ;
41
+ metric_space_setoid : Equivalence eqA ;
42
42
metric_space_positive : forall x y : A, 0 <= d x y ;
43
43
metric_space_symmetry : forall x y : A, d x y = d y x ;
44
44
metric_space_separation : forall x y : A, (0 = d x y -> eqA x y) /\ (eqA x y -> 0 = d x y);
45
45
metric_space_triangular_inequality : forall x y z : A, d x z <= (d x y) + (d y z)
46
46
}.
47
+ #[global] Existing Instance metric_space_setoid.
47
48
48
49
Class Monoid (M : Type ) (eqM : relation M) (f : operation M) (eps : M) := {
49
- monoid_setoid :> Equivalence eqM ;
50
+ monoid_setoid : Equivalence eqM ;
50
51
monoid_iden_l : forall x : M, eqM (f eps x) x ;
51
52
monoid_iden_r : forall x : M, eqM (f x eps) x ;
52
- monoid_assoc :> Associative eqM f;
53
+ monoid_assoc : Associative eqM f;
53
54
monoid_eq_compat_l : forall x y z : M, eqM y z -> eqM (f x y) (f x z);
54
55
monoid_eq_compat_r: forall x y z : M, eqM x y -> eqM (f x z) (f y z)
55
56
}.
57
+ #[global] Existing Instance monoid_setoid.
58
+ #[global] Existing Instance monoid_assoc.
56
59
57
60
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
60
63
}.
64
+ #[global] Existing Instance monoid_comm_monoid.
65
+ #[global] Existing Instance monoid_comm.
61
66
62
67
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;
64
69
group_reverse : forall x : G, sig (fun y => eqG (f x y) eps)
65
70
}.
71
+ #[global] Existing Instance group_monoid.
66
72
67
73
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
70
76
}.
77
+ #[global] Existing Instance group_comm_group.
78
+ #[global] Existing Instance group_comm.
71
79
72
80
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 ;
74
82
group_multiplicative_iden_l : forall x : G, eqG (mult eps1 x) x ;
75
83
group_multiplicative_iden_r : forall x : G, eqG (mult x eps1) x ;
76
84
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;
78
86
group_multiplicative_eq_compat_l : forall x y z : G, eqG y z -> eqG (mult x y) (mult x z);
79
87
group_multiplicative_eq_compat_r: forall x y z : G, eqG x y -> eqG (mult x z) (mult y z)
80
88
}.
89
+ #[global] Existing Instance group_setoid.
90
+ #[global] Existing Instance group_multiplicative_assoc.
81
91
82
92
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 ;
85
95
semiring_distributive_r : forall x y z : S, eqS (mult x (add y z)) (add (mult x y) (mult x z)) ;
86
96
semiring_distributive_l : forall x y z : S, eqS (mult (add x y) z) (add (mult x z) (mult y z)) ;
87
97
semiring_absorption_r : forall x : S, eqS (mult x eps0) eps0 ;
88
98
semiring_absorption_l : forall x : S, eqS (mult eps0 x) eps0
89
99
}.
100
+ #[global] Existing Instance semiring_monoid_comm.
101
+ #[global] Existing Instance semiring_monoid.
90
102
91
103
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
94
106
}.
107
+ #[global] Existing Instance semiring_comm_semiring.
108
+ #[global] Existing Instance semiring_comm.
95
109
96
110
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 ;
99
113
ring_distributive_r : forall x y z : R, eqR (mult x (add y z)) (add (mult x y) (mult x z)) ;
100
114
ring_distributive_l : forall x y z : R, eqR (mult (add x y) z) (add (mult x z) (mult y z))
101
115
}.
116
+ #[global] Existing Instance ring_group_comm.
117
+ #[global] Existing Instance ring_monoid.
102
118
103
119
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
106
122
}.
123
+ #[global] Existing Instance ring_comm_ring.
124
+ #[global] Existing Instance ring_comm.
107
125
108
126
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 ;
111
129
field_distributive_r : forall x y z : F, eqF (mult x (add y z)) (add (mult x y) (mult x z)) ;
112
130
field_distributive_l : forall x y z : F, eqF (mult (add x y) z) (add (mult x z) (mult y z))
113
131
}.
132
+ #[global] Existing Instance field_group_comm.
133
+ #[global] Existing Instance field_group_multiplicative.
114
134
115
135
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
118
138
}.
139
+ #[global] Existing Instance field_comm_field.
140
+ #[global] Existing Instance field_comm.
119
141
120
142
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 ;
122
144
field_valued_positive : forall x : F, 0 <= (abs x) ;
123
145
field_valued_separation : (abs eps0) = 0 /\ forall x : F, (abs x) = 0 -> eqF x eps0 ;
124
146
field_valued_triangular_inequality : forall x y : F, abs (add x y) <= (abs x) + (abs y);
125
147
field_valued_homogeneity : forall x y : F, abs (mult x y) = (abs x) * (abs y)
126
148
}.
149
+ #[global] Existing Instance field_valued_field_commutative.
127
150
128
151
Class Vector_Space (E : Type ) (eqE : relation E) (F : Type ) (eqF : relation F)
129
152
(v_add : operation E) (v_mult : scalar F E)
130
153
(add : operation F) (mult : operation F)
131
154
(v_null : E)
132
155
(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 ;
135
158
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)) ;
136
159
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)) ;
137
160
vector_space_assoc : forall a b : F, forall x : E, eqE (v_mult (mult a b) x) (v_mult a (v_mult b x)) ;
138
161
vector_space_iden_l : forall a : F, forall x : E, eqE (v_mult eps1 x) x;
139
162
vector_space_eq_compat_l : forall a : F, forall x y :E, eqE x y -> eqE (v_mult a x) (v_mult a y);
140
163
vector_space_eq_compat_r : forall a b : F, forall x : E, eqF a b -> (eqE (v_mult a x) (v_mult b x))
141
164
}.
165
+ #[global] Existing Instance vector_space_field.
166
+ #[global] Existing Instance vector_space_group_comm.
142
167
143
168
Class Vector_Space_Normed (E : Type ) (eqE : relation E) (F : Type ) (eqF : relation F)
144
169
(v_add : operation E) (v_mult : scalar F E)
145
170
(add : operation F) (mult : operation F)
146
171
(v_null : E)
147
172
(eps0 : F) (eps1 : F)
148
173
(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 ;
151
176
vector_space_normed_separation : forall v : E, (norm v) = 0 -> eqE v v_null ;
152
177
vector_space_normed_triangular_inequality : forall v w : E, norm (v_add v w) <= (norm v) + (norm w) ;
153
178
vector_space_normed_homogeneity : forall x : F, forall v : E, norm (v_mult x v) = (abs x) * (norm v)
154
179
}.
180
+ #[global] Existing Instance vector_space_normed_field_valued.
181
+ #[global] Existing Instance vector_space_normed_vector_space.
155
182
156
183
Close Scope R_scope.
157
184
@@ -168,4 +195,4 @@ Hint Rewrite
168
195
@monoid_eq_compat_r
169
196
@op_assoc
170
197
@op_comm
171
- : typeclass. *)
198
+ : typeclass. *)
0 commit comments