]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/algebra/monoids.ma
782da09d7a85150ae86ada7b02311bd4fb4c1a78
[helm.git] / helm / matita / library / algebra / monoids.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/algebra/monoids/".
16
17 include "algebra/semigroups.ma".
18
19 record isMonoid (SS:SemiGroup) (e:SS) : Prop ≝
20  { e_is_left_unit: is_left_unit SS e;
21    e_is_right_unit: is_right_unit SS e
22  }.
23  
24 record Monoid : Type ≝
25  { semigroup: SemiGroup;
26    e: semigroup;
27    properties: isMonoid ? e
28  }.
29  
30 coercion cic:/matita/algebra/monoids/semigroup.con.
31
32 definition is_left_inverse ≝
33  λM:Monoid. let op ≝ op M in let e ≝ e M in
34   λopp: M → M.
35    ∀x:M. op (opp x) x = e.
36
37 definition is_right_inverse ≝
38  λM:Monoid. let op ≝ op M in let e ≝ e M in
39   λopp: M → M.
40    ∀x:M. op x (opp x) = e.
41
42 theorem is_left_inverse_to_is_right_inverse_to_eq:
43  ∀M:Monoid. ∀oppL,oppR.
44   is_left_inverse M oppL → is_right_inverse M oppR → 
45    ∀x:M. oppL x = oppR x.
46  intros;
47  letin op ≝ (op M);
48  letin e ≝ (e M);
49  generalize in match (H x); intro;
50  change in H2 with (op (oppL x) x = e); 
51  generalize in match (eq_f ? ? (λy. op y (oppR x)) ? ? H2);
52  simplify; fold simplify op;
53  intro; clear H2;
54  generalize in match (properties (semigroup M)); intro;
55  unfold isSemiGroup in H2; unfold associative in H2;
56  rewrite > H2 in H3; clear H2;
57  rewrite > H1 in H3;
58  rewrite > (e_is_left_unit ? ? (properties M)) in H3;
59  rewrite > (e_is_right_unit ? ? (properties M)) in H3;
60  assumption.
61 qed.
62