Section monoid_laws.
Variables (A : Setoid) (op : BinOp A) (e : A).
Let Ap_op (x y : A) := op x y.
Infix "+_M" := Ap_op (at level 40, left associativity).
Definition Monoid_ass := forall x y z : A, x +_M (y +_M z) =_S x +_M y +_M z.
Definition Monoid_idl := forall x : A, e +_M x =_S x.
Definition Monoid_idr := forall x : A, x =_S x +_M e.
End monoid_laws.
Structure Monoid : Type :=
{Mcarrier :> Setoid;
Mop : BinOp Mcarrier;
Munit : Mcarrier;
Prf_monoid_ass : Monoid_ass Mop;
Prf_monoid_idl : Monoid_idl Mop Munit;
Prf_monoid_idr : Monoid_idr Mop Munit}.
Definition ApMop (m : Monoid) (x y : m) := Mop m x y.
Infix "+_M" := ApMop (at level 40, left associativity).
(*** rewrite rules ***)

Lemma Midr1 : forall (M : Monoid) (x : M), x +_M Munit M =_S x.