include "sets/sets.ma".
-nrecord pre_magma : Type[1] ≝
+nrecord magma_type : Type[1] ≝
{ carr:> Type;
op: carr → carr → carr
}.
-nrecord magma (A: pre_magma) : Type[1] ≝
+nrecord magma (A: magma_type) : Type[1] ≝
{ mcarr:> Ω \sup A;
op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op A x y ∈ mcarr
}.
-nrecord pre_magma_morphism (A,B: pre_magma) : Type ≝
+nrecord magma_morphism_type (A,B: magma_type) : Type ≝
{ mmcarr:1> A → B;
mmprop: ∀x,y. mmcarr (op ? x y) = op ? (mmcarr x) (mmcarr y)
}.
nrecord magma_morphism (A) (B) (Ma: magma A) (Mb: magma B) : Type ≝
- { mmmcarr:> pre_magma_morphism A B;
+ { mmmcarr:> magma_morphism_type A B;
mmclosed: ∀x. x ∈ Ma → mmmcarr x ∈ Mb
}.
-ndefinition sub_magma ≝
- λA.λM1,M2: magma A. M1 ⊆ M2.
-
ndefinition image: ∀A,B. (A → B) → Ω \sup A → Ω \sup B ≝
λA,B,f,Sa. {y | ∃x. x ∈ Sa ∧ f x = y}.
| nrewrite < Hx1;
nrewrite < Hy1;
napply (mmprop ?? f ??)]##]
+nqed.
+
+ndefinition m_intersect: ∀A. magma A → magma A → magma A.
+ #A; #M1; #M2;
+ napply (mk_magma ???)
+ [ napply (M1 ∩ M2)
+ | #x; #y; nwhd in ⊢ (% → % → %); *; #Hx1; #Hx2; *; #Hy1; #Hy2;
+ napply (conj ????); napply (op_closed ??????); nassumption ]
nqed.
\ No newline at end of file