include "algebra/semigroups.ma".
-record isMonoid (SS:SemiGroup) (e:SS) : Prop ≝
- { e_is_left_unit: is_left_unit SS e;
- e_is_right_unit: is_right_unit SS e
+record PreMonoid : Type ≝
+ { magma:> Magma;
+ e: magma
+ }.
+
+notation < "M" for @{ 'pmmagma $M }.
+interpretation "premonoid magma coercion" 'pmmagma M =
+ (cic:/matita/algebra/monoids/magma.con M).
+
+record isMonoid (M:PreMonoid) : Prop ≝
+ { is_semi_group: isSemiGroup M;
+ e_is_left_unit:
+ is_left_unit (mk_SemiGroup ? is_semi_group) (e M);
+ e_is_right_unit:
+ is_right_unit (mk_SemiGroup ? is_semi_group) (e M)
}.
record Monoid : Type ≝
- { semigroup: SemiGroup;
- e: semigroup;
- monoid_properties: isMonoid ? e
+ { premonoid:> PreMonoid;
+ monoid_properties:> isMonoid premonoid
}.
-
-coercion cic:/matita/algebra/monoids/semigroup.con.
-
-(* too ugly
-notation "hvbox(1 \sub S)" with precedence 89
-for @{ 'munit $S }.
-
-interpretation "Monoid unit" 'munit S =
- (cic:/matita/algebra/monoids/e.con S). *)
+notation < "M" for @{ 'semigroup $M }.
+interpretation "premonoid coercion" 'premonoid M =
+ (cic:/matita/algebra/monoids/premonoid.con M).
+
+notation < "M" for @{ 'typeofmonoid $M }.
+interpretation "premonoid coercion" 'typeofmonoid M =
+ (cic:/matita/algebra/monoids/Type_of_Monoid.con M).
+
+notation < "M" for @{ 'magmaofmonoid $M }.
+interpretation "premonoid coercion" 'magmaofmonoid M =
+ (cic:/matita/algebra/monoids/Magma_of_Monoid.con M).
+
notation "1" with precedence 89
for @{ 'munit }.
interpretation "Monoid unit" 'munit =
(cic:/matita/algebra/monoids/e.con _).
-notation < "M"
-for @{ 'semigroup $M }.
-
-interpretation "Semigroup coercion" 'semigroup M =
- (cic:/matita/algebra/monoids/semigroup.con M).
-
definition is_left_inverse ≝
λM:Monoid.
λopp: M → M.
generalize in match (eq_f ? ? (λy.y·(r x)) ? ? H2);
simplify; fold simplify (op M);
intro; clear H2;
- generalize in match (semigroup_properties M);
- fold simplify (Type_of_Monoid M);
+ generalize in match (associative ? (is_semi_group ? (monoid_properties M)));
intro;
- unfold isSemiGroup in H2; unfold associative in H2;
rewrite > H2 in H3; clear H2;
rewrite > H1 in H3;
- rewrite > (e_is_left_unit ? ? (monoid_properties M)) in H3;
- rewrite > (e_is_right_unit ? ? (monoid_properties M)) in H3;
+ rewrite > (e_is_left_unit ? (monoid_properties M)) in H3;
+ rewrite > (e_is_right_unit ? (monoid_properties M)) in H3;
assumption.
qed.