1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "algebra/semigroups.ma".
17 record PreMonoid : Type ≝
22 (* FG: the interpretation goes just after its definition *)
23 interpretation "Monoid unit" 'neutral = (e ?).
25 record isMonoid (M:PreMonoid) : Prop ≝
26 { is_semi_group:> isSemiGroup M;
28 is_left_unit (mk_SemiGroup ? is_semi_group) (e M);
30 is_right_unit (mk_SemiGroup ? is_semi_group) (e M)
33 record Monoid : Type ≝
34 { premonoid:> PreMonoid;
35 monoid_properties:> isMonoid premonoid
38 definition is_left_inverse ≝
43 definition is_right_inverse ≝
48 theorem is_left_inverse_to_is_right_inverse_to_eq:
50 is_left_inverse M l → is_right_inverse M r →
53 generalize in match (H x); intro;
54 generalize in match (eq_f ? ? (λy.y·(r x)) ? ? H2);
55 simplify; fold simplify (op M);
57 generalize in match (op_associative ? (is_semi_group ? (monoid_properties M)));
59 rewrite > H2 in H3; clear H2;
61 rewrite > (e_is_left_unit ? (monoid_properties M)) in H3;
62 rewrite > (e_is_right_unit ? (monoid_properties M)) in H3;