--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "algebra/magmas.ma".
+
+nrecord abelian_magma_type: Type[1] ≝
+ { amt_magma:> magma_type;
+ symm: ∀x,y: amt_magma. op ? x y = op ? y x
+ }.
\ No newline at end of file
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "algebra/magmas.ma".
+
+nrecord unital_magma_type : Type[1] ≝
+ { umt_magma:> magma_type;
+ unit: umt_magma;
+ umt_is_neutral_l: ∀x. op ? unit x = x;
+ umt_is_neutral_r: ∀x. op ? x unit = x
+ }.
+
+nrecord unital_magma (A: unital_magma_type) : Type[1] ≝
+ { um_magma:> magma A;
+ neutral_closed: unit A ∈ um_magma
+ }.
\ No newline at end of file
sets/setoids.ma logic/connectives.ma properties/relations.ma
logic/equality.ma logic/connectives.ma properties/relations.ma
logic/connectives.ma logic/pts.ma
-nat/plus.ma algebra/magmas.ma nat/nat.ma
+algebra/abelian_magmas.ma algebra/magmas.ma
+nat/plus.ma algebra/abelian_magmas.ma algebra/unital_magmas.ma nat/nat.ma
algebra/magmas.ma sets/sets.ma
nat/nat.ma logic/equality.ma sets/setoids.ma
properties/relations1.ma logic/pts.ma
properties/relations.ma logic/pts.ma
+algebra/unital_magmas.ma algebra/magmas.ma
logic/pts.ma
ninductive eq (A: Type[0]) (a: A) : A → CProp[0] ≝
refl: eq A a a.
+nlemma eq_rect_CProp0_r':
+ ∀A.∀a,x.∀p:eq ? x a.∀P: ∀x:A. eq ? x a → CProp[0]. P a (refl A a) → P x p.
+ #A; #a; #x; #p; ncases p; #P; #H; nassumption.
+nqed.
+
+nlemma eq_rect_CProp0_r:
+ ∀A.∀a.∀P: ∀x:A. eq ? x a → CProp[0]. P a (refl A a) → ∀x.∀p:eq ? x a.P x p.
+ #A; #a; #x; #p; #x0; #p0; napply eq_rect_CProp0_r'; nassumption.
+nqed.
+
interpretation "leibnitz's equality" 'eq t x y = (eq t x y).
interpretation "leibnitz's non-equality" 'neq t x y = (Not (eq t x y)).
(**************************************************************************)
include "nat/nat.ma".
-include "algebra/magmas.ma".
+include "algebra/unital_magmas.ma".
+include "algebra/abelian_magmas.ma".
nlet rec plus (n:nat) (m:nat) on n : nat ≝
match n with
| napply mk_binary_morphism
[ napply plus
| #a; #a'; #b; #b'; #Ha; #Hb; nrewrite < Ha; nrewrite < Hb; napply refl ]##]
+nqed.
+
+ndefinition plus_abelian_magma_type: abelian_magma_type.
+ napply mk_abelian_magma_type
+ [ napply plus_magma_type
+ | nnormalize; #x;
+ (* nelim non va *) napply (nat_rect_CProp0 ??? x);
+ ##[ #y; napply (nat_rect_CProp0 ??? y) [ napply refl | #n; #H; nnormalize; nrewrite < H; napply refl]
+ ##| #n; #H; #y; nnormalize;
+ (* rewrite qui non va *)
+ napply (eq_rect_CProp0_r ????? (H y));
+ napply (nat_rect_CProp0 ??? y)
+ [ napply refl
+ | #n0; #K; nnormalize in K; nnormalize;
+ napply (eq_rect_CProp0 ????? K); napply refl] ##]
+nqed.
+
+ndefinition plus_unital_magma_type: unital_magma_type.
+ napply mk_unital_magma_type
+ [ napply plus_magma_type
+ | napply O
+ | #x; napply refl
+ | #x; (* qua manca ancora l'hint *) napply (symm plus_abelian_magma_type) ]
nqed.
\ No newline at end of file