]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/algebra/monoids.ma
7c40db1fd89bffad6aefb0b284c01f10e4f1b169
[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    monoid_properties: isMonoid ? e
28  }.
29  
30 coercion cic:/matita/algebra/monoids/semigroup.con.
31
32 (* too ugly
33 notation "hvbox(1 \sub S)" with precedence 89
34 for @{ 'munit $S }.
35
36 interpretation "Monoid unit" 'munit S =
37  (cic:/matita/algebra/monoids/e.con S). *)
38
39 notation "1" with precedence 89
40 for @{ 'munit }.
41
42 interpretation "Monoid unit" 'munit =
43  (cic:/matita/algebra/monoids/e.con _).
44   
45 notation < "M"
46 for @{ 'semigroup $M }.
47
48 interpretation "Semigroup coercion" 'semigroup M =
49  (cic:/matita/algebra/monoids/semigroup.con M).
50
51 definition is_left_inverse ≝
52  λM:Monoid.
53   λopp: M → M.
54    ∀x:M. op M (opp x) x = 1.
55    
56 definition is_right_inverse ≝
57  λM:Monoid.
58   λopp: M → M.
59    ∀x:M. op M x (opp x) = 1.
60
61 theorem is_left_inverse_to_is_right_inverse_to_eq:
62  ∀M:Monoid. ∀l,r.
63   is_left_inverse M l → is_right_inverse M r → 
64    ∀x:M. l x = r x.
65  intros;
66  generalize in match (H x); intro;
67  generalize in match (eq_f ? ? (λy. op M y (r x)) ? ? H2);
68  simplify; fold simplify (op M);
69  intro; clear H2;
70  generalize in match (semigroup_properties M);
71  fold simplify (Type_of_Monoid M);
72  intro;
73  unfold isSemiGroup in H2; unfold associative in H2;
74  rewrite > H2 in H3; clear H2;
75  rewrite > H1 in H3;
76  rewrite > (e_is_left_unit ? ? (monoid_properties M)) in H3;
77  rewrite > (e_is_right_unit ? ? (monoid_properties M)) in H3;
78  assumption.
79 qed.