]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/groups.ma
snapshot
[helm.git] / matita / dama / groups.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/groups/".
16
17 include "excedence.ma".
18
19 definition left_neutral ≝ λC:apartness.λop.λe:C. ∀x:C. op e x ≈ x.
20 definition right_neutral ≝ λC:apartness.λop. λe:C. ∀x:C. op x e ≈ x.
21 definition left_inverse ≝ λC:apartness.λop.λe:C.λinv:C→C. ∀x:C. op (inv x) x ≈ e.
22 definition right_inverse ≝ λC:apartness.λop.λe:C.λ inv: C→ C. ∀x:C. op x (inv x) ≈ e. 
23 definition strong_ext ≝ λA:apartness.λop:A→A.∀x,y. op x # op y → x # y.
24 (* ALLOW DEFINITION WITH SOME METAS *)
25
26 definition distributive_left ≝
27  λA:apartness.λf:A→A→A.λg:A→A→A.
28   ∀x,y,z. f x (g y z) ≈ g (f x y) (f x z).
29
30 definition distributive_right ≝
31  λA:apartness.λf:A→A→A.λg:A→A→A.
32   ∀x,y,z. f (g x y) z ≈ g (f x z) (f y z).
33
34 record abelian_group : Type ≝
35  { carr:> apartness;
36    plus: carr → carr → carr;
37    zero: carr;
38    opp: carr → carr;
39    plus_assoc: associative ? plus (eq carr);
40    plus_comm: commutative ? plus (eq carr);
41    zero_neutral: left_neutral ? plus zero;
42    opp_inverse: left_inverse ? plus zero opp;
43    plus_strong_ext: ∀z.strong_ext ? (plus z)  
44 }.
45  
46 notation "0" with precedence 89 for @{ 'zero }.
47
48 interpretation "Abelian group zero" 'zero =
49  (cic:/matita/groups/zero.con _).
50
51 interpretation "Abelian group plus" 'plus a b =
52  (cic:/matita/groups/plus.con _ a b).
53
54 interpretation "Abelian group opp" 'uminus a =
55  (cic:/matita/groups/opp.con _ a).
56
57 definition minus ≝
58  λG:abelian_group.λa,b:G. a + -b.
59
60 interpretation "Abelian group minus" 'minus a b =
61  (cic:/matita/groups/minus.con _ a b).
62  
63 lemma ap_rewl: ∀A:apartness.∀x,z,y:A. x ≈ y → y # z → x # z.
64 intros (A x z y Exy Ayz); cases (ap_cotransitive ???x Ayz); [2:assumption]
65 cases (Exy (ap_symmetric ??? a));
66 qed.
67   
68 lemma ap_rewr: ∀A:apartness.∀x,z,y:A. x ≈ y → z # y → z # x.
69 intros (A x z y Exy Azy); apply ap_symmetric; apply (ap_rewl ???? Exy);
70 apply ap_symmetric; assumption;
71 qed.
72
73 definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
74
75 lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op.
76 intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption;
77 qed. 
78
79 lemma f_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  x+y ≈ x+z.
80 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x));
81 assumption;
82 qed.  
83    
84 lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z).
85 intros 5 (G z x y A); simplify in A;
86 lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2;
87 lapply (ap_rewl ???? E1 A) as A1; lapply (ap_rewr ???? E2 A1) as A2;
88 apply (plus_strong_ext ???? A2);
89 qed.
90    
91 lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  y+x ≈ z+x.
92 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x));
93 assumption;
94 qed.   
95    
96 lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z →  x+y # x+z. 
97 intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
98 apply (ap_rewl ??? ((-x + x) + y));
99 [1: apply plus_assoc; 
100 |2: apply (ap_rewr ??? ((-x +x) +z));
101     [1: apply plus_assoc; 
102     |2: apply (ap_rewl ??? (0 + y));
103         [1: apply (feq_plusr ???? (opp_inverse ??)); 
104         |2: apply (ap_rewl ???? (zero_neutral ? y)); apply (ap_rewr ??? (0 + z));
105             [1: apply (feq_plusr ???? (opp_inverse ??)); 
106             |2: apply (ap_rewr ???? (zero_neutral ? z)); assumption;]]]]
107 qed.
108
109 lemma plus_canc: ∀G:abelian_group.∀x,y,z:G. x+y ≈ x+z → y ≈ z. 
110 intros 6 (G x y z E Ayz); apply E; apply fap_plusl; assumption;
111 qed. 
112
113 (*
114
115 theorem eq_opp_plus_plus_opp_opp: ∀G:abelian_group.∀x,y:G. -(x+y) = -x + -y.
116  intros;
117  apply (cancellationlaw ? (x+y));
118  rewrite < plus_comm;
119  rewrite > opp_inverse;
120  rewrite > plus_assoc;
121  rewrite > plus_comm in ⊢ (? ? ? (? ? ? (? ? ? %)));
122  rewrite < plus_assoc in ⊢ (? ? ? (? ? ? %));
123  rewrite > plus_comm;
124  rewrite > plus_comm in ⊢ (? ? ? (? ? (? ? % ?) ?));
125  rewrite > opp_inverse;
126  rewrite > zero_neutral;
127  rewrite > opp_inverse;
128  reflexivity.
129 qed.
130
131 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x=x.
132  intros;
133  apply (cancellationlaw ? (-x));
134  rewrite > opp_inverse;
135  rewrite > plus_comm;
136  rewrite > opp_inverse;
137  reflexivity.
138 qed.
139
140 theorem eq_zero_opp_zero: ∀G:abelian_group.0=-0.
141  [ assumption
142  | intros;
143    apply (cancellationlaw ? 0);
144    rewrite < plus_comm in ⊢ (? ? ? %);
145    rewrite > opp_inverse;
146    rewrite > zero_neutral;
147    reflexivity
148  ].
149 qed.
150
151 *)