(**************************************************************)
(*   Copyright Dominique Larchey-Wendling [*]                 *)
(*                                                            *)
(*                             [*] Affiliation LORIA -- CNRS  *)
(**************************************************************)
(*      This file is distributed under the terms of the       *)
(*         CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT          *)
(**************************************************************)
(** ** Matric computation *)
Set Implicit Arguments.
Section rings.
Variable (R : Type) (Rzero Rone : R) (Rplus Rmult Rminus : R -> R -> R) (Ropp : R -> R)
(R_is_ring : ring_theory Rzero Rone Rplus Rmult Rminus Ropp eq).
Infix "⊕" := Rplus (at level 50, left associativity).
Infix "⊗" := Rmult (at level 40, left associativity).
Notation z := Rzero.
Notation o := Rone.
Notation "∸" := Ropp.
(* ⊕  ⊗  ∸ *)
(* We use the magical parameterized ring tactic *)
Add Ring Rring : R_is_ring.
(* ⊕  ⊗  ∸ *)
(*   ( a b )   <-> (a,b,c,d) ( c d )                    *)
Definition M22 := (R * R * R * R)%type.
Definition ID_22 : M22 := (o,z,z,o).
Definition ZE_22 : M22 := (z,z,z,z).
Definition PL22 : M22 -> M22 -> M22.
Fact M22plus_comm  : forall x y, x ⊞ y = y ⊞ x.
Fact M22plus_assoc  : forall x y u, x ⊞ (y ⊞ u) = x ⊞ y ⊞ u.
Fact M22minus : forall x, x ⊞ ⊟ x = ZE_22.
Fact M22plus_cancel : forall x a b, x ⊞ a = x ⊞ b -> a = b.

(* Specifications: *)
Theorem M22plus_monoid : monoid_theory PL22 ZE_22.
Definition MU22 : M22 -> M22 -> M22.