]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/integration_algebras.ma
1. developed up to algebras
[helm.git] / matita / dama / integration_algebras.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/integration_algebras/".
16
17 include "higher_order_defs/functions.ma".
18 include "nat/nat.ma".
19 include "nat/orders.ma".
20
21 definition left_neutral \def λC,op.λe:C. ∀x:C. op e x = x.
22
23 definition left_inverse \def λC,op.λe:C.λinv:C→C. ∀x:C. op (inv x) x = e.
24
25 definition distributive_right ≝
26  λA:Type.λf:A→A→A.λg:A→A→A.
27   ∀x,y,z. f (g x y) z = g (f x z) (f y z).
28
29 record is_abelian_group (C:Type) (plus:C→C→C) (zero:C) (opp:C→C) : Prop \def
30  { (* abelian additive semigroup properties *)
31     plus_assoc: associative ? plus;
32     plus_comm: symmetric ? plus;
33     (* additive monoid properties *)
34     zero_neutral: left_neutral ? plus zero;
35     (* additive group properties *)
36     opp_inverse: left_inverse ? plus zero opp
37  }.
38
39 record is_ring (C:Type) (plus:C→C→C) (mult:C→C→C) (zero:C) (opp:C→C) : Prop
40
41  { (* abelian group properties *)
42     abelian_group:> is_abelian_group ? plus zero opp;
43     (* multiplicative semigroup properties *)
44     mult_assoc: associative ? mult;
45     (* ring properties *)
46     mult_plus_distr_left: distributive ? mult plus;
47     mult_plus_distr_right: distributive_right C mult plus
48  }.
49  
50 record ring : Type \def
51  { r_carrier:> Type;
52    r_plus: r_carrier → r_carrier → r_carrier;
53    r_mult: r_carrier → r_carrier → r_carrier;
54    r_zero: r_carrier;
55    r_opp: r_carrier → r_carrier;
56    r_ring_properties:> is_ring ? r_plus r_mult r_zero r_opp
57  }.
58
59 notation "0" with precedence 89
60 for @{ 'zero }.
61
62 interpretation "Ring zero" 'zero =
63  (cic:/matita/integration_algebras/r_zero.con _).
64
65 interpretation "Ring plus" 'plus a b =
66  (cic:/matita/integration_algebras/r_plus.con _ a b).
67
68 interpretation "Ring mult" 'times a b =
69  (cic:/matita/integration_algebras/r_mult.con _ a b).
70
71 interpretation "Ring opp" 'uminus a =
72  (cic:/matita/integration_algebras/r_opp.con _ a).
73
74 lemma eq_mult_zero_x_zero: ∀R:ring.∀x:R.0*x=0.
75  intros;
76  generalize in match (zero_neutral ? ? ? ? R 0); intro;
77  generalize in match (eq_f ? ? (λy.y*x) ? ? H); intro; clear H;
78  rewrite > (mult_plus_distr_right ? ? ? ? ? R) in H1;
79  generalize in match (eq_f ? ? (λy.-(0*x)+y) ? ? H1); intro; clear H1;
80  rewrite < (plus_assoc ? ? ? ? R) in H;
81  rewrite > (opp_inverse ? ? ? ? R) in H;
82  rewrite > (zero_neutral ? ? ? ? R) in H;
83  assumption.
84 qed.
85
86 record is_field (C:Type) (plus:C→C→C) (mult:C→C→C) (zero,one:C) (opp:C→C)
87  (inv:∀x:C.x ≠ zero →C)  : Prop
88
89  {  (* ring properties *)
90     ring_properties: is_ring ? plus mult zero opp;
91     (* multiplicative abelian properties *)
92     mult_comm: symmetric ? mult;
93     (* multiplicative monoid properties *)
94     one_neutral: left_neutral ? mult one;
95     (* multiplicative group properties *)
96     inv_inverse: ∀x.∀p: x ≠ zero. mult (inv x p) x = one;
97     (* integral domain *)
98     not_eq_zero_one: zero ≠ one
99  }.
100
101 let rec sum (C:Type) (plus:C→C→C) (zero,one:C) (n:nat) on n  ≝
102  match n with
103   [ O ⇒ zero
104   | (S m) ⇒ plus one (sum C plus zero one m)
105   ].
106
107 record field : Type \def
108  { f_ring:> ring;
109    one: f_ring;
110    inv: ∀x:f_ring. x ≠ 0 → f_ring;
111    field_properties:
112     is_field ? (r_plus f_ring) (r_mult f_ring) (r_zero f_ring) one
113      (r_opp f_ring) inv
114  }.
115
116 definition sum_field ≝
117  λF:field. sum ? (r_plus F) (r_zero F) (one F).
118  
119 notation "1" with precedence 89
120 for @{ 'one }.
121
122 interpretation "Field one" 'one =
123  (cic:/matita/integration_algebras/one.con _).
124
125 record is_ordered_field_ch0 (C:Type) (plus,mult:C→C→C) (zero,one:C) (opp:C→C)
126  (inv:∀x:C.x ≠ zero → C) (le:C→C→Prop) : Prop \def
127  { (* field properties *)
128    of_is_field:> is_field C plus mult zero one opp inv;
129    of_mult_compat: ∀a,b. le zero a → le zero b → le zero (mult a b);
130    of_plus_compat: ∀a,b,c. le a b → le (plus a c) (plus b c);
131    of_weak_tricotomy : ∀a,b. a≠b → le a b ∨ le b a;
132    (* 0 characteristics *)
133    of_char0: ∀n. n > O → sum ? plus zero one n ≠ zero
134  }.
135  
136 record ordered_field_ch0 : Type \def
137  { of_field:> field;
138    of_le: of_field → of_field → Prop;
139    of_ordered_field_properties:>
140     is_ordered_field_ch0 ? (r_plus of_field) (r_mult of_field) (r_zero of_field)
141      (one of_field) (r_opp of_field) (inv of_field) of_le
142  }.
143
144 interpretation "Ordered field le" 'leq a b =
145  (cic:/matita/integration_algebras/of_le.con _ a b).
146  
147 definition lt \def λF:ordered_field_ch0.λa,b:F.a ≤ b ∧ a ≠ b.
148
149 interpretation "Ordered field lt" 'lt a b =
150  (cic:/matita/integration_algebras/lt.con _ a b).
151
152 axiom le_zero_x_to_le_opp_x_zero: ∀F:ordered_field_ch0.∀x:F. 0 ≤ x → -x ≤ 0.
153 (* intros;
154  generalize in match (of_plus_compat ? ? ? ? ? ? ? ? F ? ? (-x) H); intro;
155  rewrite > (zero_neutral ? ? ? ? F) in H1;
156  rewrite > (plus_comm ? ? ? ? F) in H1;
157  rewrite > (opp_inverse ? ? ? ? F) in H1;
158  assumption.
159 qed.*)
160
161 axiom le_x_zero_to_le_zero_opp_x: ∀F:ordered_field_ch0.∀x:F. x ≤ 0 → 0 ≤ -x.
162 (* intros;
163  generalize in match (of_plus_compat ? ? ? ? ? ? ? ? F ? ? (-x) H); intro;
164  rewrite > (zero_neutral ? ? ? ? F) in H1;
165  rewrite > (plus_comm ? ? ? ? F) in H1;
166  rewrite > (opp_inverse ? ? ? ? F) in H1;
167  assumption.
168 qed.*)
169
170 (*
171 lemma eq_opp_x_times_opp_one_x: ∀F:ordered_field_ch0.∀x:F.-x = -1*x.
172  intros;
173  
174 lemma not_eq_x_zero_to_lt_zero_mult_x_x:
175  ∀F:ordered_field_ch0.∀x:F. x ≠ 0 → 0 < x * x.
176  intros;
177  elim (of_weak_tricotomy ? ? ? ? ? ? ? ? F ? ? H);
178   [ generalize in match (le_x_zero_to_le_zero_opp_x F ? H1); intro;
179     generalize in match (of_mult_compat ? ? ? ? ? ? ? ?  F ? ? H2 H2); intro;
180 *)  
181
182 axiom not_eq_sum_field_zero: ∀F,n. n > O → sum_field F n ≠ 0.
183
184 record is_vector_space (K: field) (C:Type) (plus:C→C→C) (zero:C) (opp:C→C)
185  (emult:K→C→C) : Prop
186
187  { (* abelian group properties *)
188    vs_abelian_group: is_abelian_group ? plus zero opp;
189    (* other properties *)
190    vs_nilpotent: ∀v. emult 0 v = zero;
191    vs_neutral: ∀v. emult 1 v = v;
192    vs_distributive: ∀a,b,v. emult (a + b) v = plus (emult a v) (emult b v);
193    vs_associative: ∀a,b,v. emult (a * b) v = emult a (emult b v)
194  }.
195
196 record is_lattice (C:Type) (join,meet:C→C→C) : Prop \def
197  { (* abelian semigroup properties *)
198    l_comm_j: symmetric ? join;
199    l_associative_j: associative ? join;
200    l_comm_m: symmetric ? meet;
201    l_associative_m: associative ? meet;
202    (* other properties *)
203    l_adsorb_j_m: ∀f,g. join f (meet f g) = f;
204    l_adsorb_m_j: ∀f,g. meet f (join f g) = f
205  }.
206
207 definition le \def λC.λmeet:C→C→C.λf,g. meet f g = f.
208
209 record is_riesz_space (K:ordered_field_ch0) (C:Type) (plus:C→C→C) (zero:C)
210  (opp:C→C) (emult:K→C→C) (join,meet:C→C→C) : Prop \def
211  { (* vector space properties *)
212    rs_vector_space: is_vector_space K C plus zero opp emult;
213    (* lattice properties *)
214    rs_lattice: is_lattice C join meet;
215    (* other properties *)
216    rs_compat_le_plus: ∀f,g,h. le ? meet f g →le ? meet (plus f h) (plus g h);
217    rs_compat_le_times: ∀a,f. 0≤a → le ? meet zero f → le ? meet zero (emult a f)  
218  }.
219
220 definition absolute_value \def λC:Type.λopp.λjoin:C→C→C.λf.join f (opp f).   
221
222 record is_archimedean_riesz_space (K:ordered_field_ch0) (C:Type) (plus:C→C→C)
223  (zero:C) (opp:C→C) (mult:Type_OF_ordered_field_ch0 K→C→C) (join,meet:C→C→C)
224  :Prop \def
225   { ars_riesz_space: is_riesz_space ? ? plus zero opp mult join meet;
226     ars_archimedean: ∃u.∀n,a.∀p:n > O.
227      le C meet (absolute_value ? opp join a)
228       (mult (inv K (sum_field K n) (not_eq_sum_field_zero K n p)) u) →
229      a = zero
230   }.
231
232 record is_algebra (K: field) (C:Type) (plus:C→C→C) (zero:C) (opp:C→C)
233  (emult:K→C→C) (mult:C→C→C) : Prop
234
235  { (* vector space properties *)
236    a_vector_space_properties: is_vector_space ? ? plus zero opp emult;
237    (* ring properties *)
238    a_ring: is_ring ? plus mult zero opp;
239    (* algebra properties *)
240    a_associative_left: ∀a,f,g. emult a (mult f g) = mult (emult a f) g;
241    a_associative_right: ∀a,f,g. emult a (mult f g) = mult f (emult a g)
242  }.