]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/dama/groups.ma
snapshot
[helm.git] / matita / dama / groups.ma
index 699bd73fc3286190a3dbcf9ee3c643b0d8b9ce38..da24dadc56ea7d0361f05a23af7dc848969148b5 100644 (file)
 
 set "baseuri" "cic:/matita/groups/".
 
-include "higher_order_defs/functions.ma".
-include "nat/nat.ma".
-include "nat/orders.ma".
-include "constructive_connectives.ma".
+include "excedence.ma".
 
-definition left_neutral \def λC,op.λe:C. ∀x:C. op e x = x.
-
-definition right_neutral \def λC,op. λe:C. ∀x:C. op x e=x.
-
-definition left_inverse \def λC,op.λe:C.λinv:C→C. ∀x:C. op (inv x) x = e.
-
-definition right_inverse \def λC,op.λe:C.λ inv: C→ C. ∀x:C. op x (inv x)=e. 
+definition left_neutral ≝ λC:apartness.λop.λe:C. ∀x:C. op e x ≈ x.
+definition right_neutral ≝ λC:apartness.λop. λe:C. ∀x:C. op x e ≈ x.
+definition left_inverse ≝ λC:apartness.λop.λe:C.λinv:C→C. ∀x:C. op (inv x) x ≈ e.
+definition right_inverse ≝ λC:apartness.λop.λe:C.λ inv: C→ C. ∀x:C. op x (inv x) ≈ e. 
+definition strong_ext ≝ λA:apartness.λop:A→A.∀x,y. op x # op y → x # y.
+(* ALLOW DEFINITION WITH SOME METAS *)
 
 definition distributive_left ≝
- λA:Type.λf:A→A→A.λg:A→A→A.
-  ∀x,y,z. f x (g y z) = g (f x y) (f x z).
+ λA:apartness.λf:A→A→A.λg:A→A→A.
+  ∀x,y,z. f x (g y z)  g (f x y) (f x z).
 
 definition distributive_right ≝
- λA:Type.λf:A→A→A.λg:A→A→A.
-  ∀x,y,z. f (g x y) z = g (f x z) (f y z).
-
-record is_abelian_group (C:Type) (plus:C→C→C) (zero:C) (opp:C→C) : Prop \def
- { (* abelian additive semigroup properties *)
-    plus_assoc_: associative ? plus;
-    plus_comm_: symmetric ? plus;
-    (* additive monoid properties *)
-    zero_neutral_: left_neutral ? plus zero;
-    (* additive group properties *)
-    opp_inverse_: left_inverse ? plus zero opp
- }.
-
-record abelian_group : Type \def
- { carrier:> Type;
-   plus: carrier → carrier → carrier;
-   zero: carrier;
-   opp: carrier → carrier;
-   ag_abelian_group_properties: is_abelian_group ? plus zero opp
- }.
+ λA:apartness.λf:A→A→A.λg:A→A→A.
+  ∀x,y,z. f (g x y) z ≈ g (f x z) (f y z).
+
+record abelian_group : Type ≝
+ { carr:> apartness;
+   plus: carr → carr → carr;
+   zero: carr;
+   opp: carr → carr;
+   plus_assoc: associative ? plus (eq carr);
+   plus_comm: commutative ? plus (eq carr);
+   zero_neutral: left_neutral ? plus zero;
+   opp_inverse: left_inverse ? plus zero opp;
+   plus_strong_ext: ∀z.strong_ext ? (plus z)  
+}.
  
-notation "0" with precedence 89
-for @{ 'zero }.
+notation "0" with precedence 89 for @{ 'zero }.
 
 interpretation "Abelian group zero" 'zero =
  (cic:/matita/groups/zero.con _).
@@ -71,70 +60,101 @@ definition minus ≝
 interpretation "Abelian group minus" 'minus a b =
  (cic:/matita/groups/minus.con _ a b).
  
-theorem plus_assoc: ∀G:abelian_group. associative ? (plus G).
- intro;
- apply (plus_assoc_ ? ? ? ? (ag_abelian_group_properties G)).
+lemma ap_rewl: ∀A:apartness.∀x,z,y:A. x ≈ y → y # z → x # z.
+intros (A x z y Exy Ayz); cases (ap_cotransitive ???x Ayz); [2:assumption]
+cases (Exy (ap_symmetric ??? a));
 qed.
-
-theorem plus_comm: ∀G:abelian_group. symmetric ? (plus G).
- intro;
- apply (plus_comm_ ? ? ? ? (ag_abelian_group_properties G)).
+  
+lemma ap_rewr: ∀A:apartness.∀x,z,y:A. x ≈ y → z # y → z # x.
+intros (A x z y Exy Azy); apply ap_symmetric; apply (ap_rewl ???? Exy);
+apply ap_symmetric; assumption;
 qed.
 
-theorem zero_neutral: ∀G:abelian_group. left_neutral ? (plus G) 0.
- intro;
- apply (zero_neutral_ ? ? ? ? (ag_abelian_group_properties G)).
+definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
+
+lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op.
+intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption;
+qed. 
+
+lemma feq_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  x+y ≈ x+z.
+intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x));
+assumption;
+qed.  
+   
+lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z).
+intros 5 (G z x y A); simplify in A;
+lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2;
+lapply (ap_rewl ???? E1 A) as A1; lapply (ap_rewr ???? E2 A1) as A2;
+apply (plus_strong_ext ???? A2);
+qed.
+   
+lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  y+x ≈ z+x.
+intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x));
+assumption;
+qed.   
+   
+lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z →  x+y # x+z. 
+intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
+apply (ap_rewl ??? ((-x + x) + y));
+[1: apply plus_assoc; 
+|2: apply (ap_rewr ??? ((-x +x) +z));
+    [1: apply plus_assoc; 
+    |2: apply (ap_rewl ??? (0 + y));
+        [1: apply (feq_plusr ???? (opp_inverse ??)); 
+        |2: apply (ap_rewl ???? (zero_neutral ? y)); apply (ap_rewr ??? (0 + z));
+            [1: apply (feq_plusr ???? (opp_inverse ??)); 
+            |2: apply (ap_rewr ???? (zero_neutral ??)); assumption;]]]]
 qed.
 
-theorem opp_inverse: ∀G:abelian_group. left_inverse ? (plus G) 0 (opp G).
- intro;
- apply (opp_inverse_ ? ? ? ? (ag_abelian_group_properties G)).
+lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z →  y+x # z+x. 
+intros (G x y z Ayz); apply (plus_strong_extr ? (-x));
+apply (ap_rewl ??? (y + (x + -x)));
+[1: apply (eq_symmetric ??? (plus_assoc ????)); 
+|2: apply (ap_rewr ??? (z + (x + -x)));
+    [1: apply (eq_symmetric ??? (plus_assoc ????)); 
+    |2: apply (ap_rewl ??? (y + (-x+x)) (feq_plusl ???? (plus_comm ???)));
+        apply (ap_rewl ??? (y + 0) (feq_plusl ???? (opp_inverse ??)));
+        apply (ap_rewl ??? (0 + y) (plus_comm ???));
+        apply (ap_rewl ??? y (zero_neutral ??));
+        apply (ap_rewr ??? (z + (-x+x)) (feq_plusl ???? (plus_comm ???)));
+        apply (ap_rewr ??? (z + 0) (feq_plusl ???? (opp_inverse ??)));
+        apply (ap_rewr ??? (0 + z) (plus_comm ???));
+        apply (ap_rewr ??? z (zero_neutral ??));
+        assumption]]
+qed.
+    
+lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z. 
+intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
 qed.
 
-lemma cancellationlaw: ∀G:abelian_group.∀x,y,z:G. x+y=x+z → y=z. 
-intros;
-generalize in match (eq_f ? ? (λa.-x +a) ? ? H);
-intros; clear H;
-rewrite < plus_assoc in H1;
-rewrite < plus_assoc in H1;
-rewrite > opp_inverse in H1;
-rewrite > zero_neutral in H1;
-rewrite > zero_neutral in H1;
-assumption.
+lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z. 
+intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
 qed.
 
-theorem eq_opp_plus_plus_opp_opp: ∀G:abelian_group.∀x,y:G. -(x+y) = -x + -y.
- intros;
- apply (cancellationlaw ? (x+y));
- rewrite < plus_comm;
- rewrite > opp_inverse;
- rewrite > plus_assoc;
- rewrite > plus_comm in ⊢ (? ? ? (? ? ? (? ? ? %)));
- rewrite < plus_assoc in ⊢ (? ? ? (? ? ? %));
- rewrite > plus_comm;
- rewrite > plus_comm in ⊢ (? ? ? (? ? (? ? % ?) ?));
- rewrite > opp_inverse;
- rewrite > zero_neutral;
- rewrite > opp_inverse;
- reflexivity.
+theorem eq_opp_plus_plus_opp_opp: 
+  ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
+intros (G x y); apply (plus_cancr ??? (x+y));
+apply (eq_transitive ?? 0); [apply (opp_inverse ??)]
+apply (eq_transitive ?? (-x + -y + x + y)); [2: apply (eq_symmetric ??? (plus_assoc ????))]
+apply (eq_transitive ?? (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
+apply (eq_transitive ?? (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
+apply (eq_transitive ?? (-y + 0 + y)); 
+  [2: apply feq_plusr; apply feq_plusl; apply eq_symmetric; apply opp_inverse]
+apply (eq_transitive ?? (-y + y)); 
+  [2: apply feq_plusr; apply eq_symmetric; 
+      apply (eq_transitive ?? (0+-y)); [apply plus_comm|apply zero_neutral]]
+apply eq_symmetric; apply opp_inverse.
 qed.
 
-theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x=x.
- intros;
- apply (cancellationlaw ? (-x));
- rewrite > opp_inverse;
- rewrite > plus_comm;
- rewrite > opp_inverse;
- reflexivity.
+theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
+intros (G x); apply (plus_cancl ??? (-x));
+apply (eq_transitive ?? (--x + -x)); [apply plus_comm]
+apply (eq_transitive ?? 0); [apply opp_inverse]
+apply eq_symmetric; apply opp_inverse;
 qed.
 
-theorem eq_zero_opp_zero: ∀G:abelian_group.0=-0.
- [ assumption
- | intros;
-   apply (cancellationlaw ? 0);
-   rewrite < plus_comm in ⊢ (? ? ? %);
-   rewrite > opp_inverse;
-   rewrite > zero_neutral;
-   reflexivity
- ].
-qed.
\ No newline at end of file
+theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
+intro G; apply (plus_cancr ??? 0);
+apply (eq_transitive ?? 0); [apply zero_neutral;]
+apply eq_symmetric; apply opp_inverse;
+qed.