include "sets/sets.ma".
nrecord magma (A: Type) : Type[1] ≝
- { carr: Ω \sup A;
+ { mcarr: Ω \sup A;
op: A → A → A;
- op_closed: ∀x,y. x ∈ carr → y ∈ carr → op x y ∈ carr
- }.
\ No newline at end of file
+ op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op x y ∈ mcarr
+ }.
+(* this is a projection *)
+ndefinition mcarr ≝ λA.λM: magma A. match M with [ mk_magma mcarr _ _ ⇒ mcarr ].
+ndefinition op ≝ λA.λM: magma A. match M with [ mk_magma _ op _ ⇒ op ].
+
+(* to be splitted *)
+nrecord magma_morphism (A,B: Type) (Ma: magma A) (Mb: magma B) : Type ≝
+ { mmcarr: A → B;
+ mmclosed: ∀x. x ∈ mcarr ? Ma → mmcarr x ∈ mcarr ? Mb;
+ (* need a canonical structure in next line? *)
+ mmprop: ∀x,y:A. x ∈ mcarr ? Ma → y ∈ mcarr ? Ma → mmcarr (op ? Ma x y) = op B Mb (mmcarr x) (mmcarr y)
+ }.
+(* this is a projection *)
+ndefinition mmcarr ≝
+ λA,B,Ma,Mb.λf: magma_morphism A B Ma Mb. match f with [ mk_magma_morphism f _ _ ⇒ f ].
+
+ndefinition sub_magma ≝
+ λA.λM1,M2: magma A. ∀x. x ∈ mcarr ? M1 → x ∈ mcarr ? M2.
+
+ndefinition image: ∀A,B. (A → B) → Ω \sup A → Ω \sup B ≝
+ λA,B,f,Sa. {y | ∃x. x ∈ Sa ∧ f x = y}.
+
+naxiom daemon: False.
+
+ndefinition mm_image:
+ ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism ?? Ma Mb → magma B.
+ #A; #B; #Ma; #Mb; #f;
+ napply (mk_magma ????)
+ [ napply (image ?? (mmcarr ???? f) (mcarr ? Ma))
+ | napply (op ? Mb)
+ | #x; #y; *; #x0; #Hx0; *; #y0; #Hy0; nwhd;
+ napply (ex_intro ????)
+ [ napply (op ? Ma x0 y0) (* BAD HERE! need a canonical structure? *)
+ | nelim daemon ]]
+nqed.
\ No newline at end of file