1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "sets/sets.ma".
17 nrecord magma_type : Type[1] ≝
19 op: carr → carr → carr
22 nrecord magma (A: magma_type) : Type[1] ≝
24 op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op A x y ∈ mcarr
27 nrecord magma_morphism_type (A,B: magma_type) : Type ≝
29 mmprop: ∀x,y. mmcarr (op ? x y) = op ? (mmcarr x) (mmcarr y)
32 nrecord magma_morphism (A) (B) (Ma: magma A) (Mb: magma B) : Type ≝
33 { mmmcarr:> magma_morphism_type A B;
34 mmclosed: ∀x. x ∈ Ma → mmmcarr x ∈ Mb
37 ndefinition image: ∀A,B. (A → B) → Ω \sup A → Ω \sup B ≝
38 λA,B,f,Sa. {y | ∃x. x ∈ Sa ∧ f x = y}.
41 ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism ?? Ma Mb → magma B.
44 [ napply (image ?? f Ma)
45 | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd;
46 napply (ex_intro ????)
49 [ napply (op_closed ??????); nassumption
52 napply (mmprop ?? f ??)]##]
55 ndefinition counter_image: ∀A,B. (A → B) → Ω \sup B → Ω \sup A ≝
56 λA,B,f,Sb. {x | ∃y. y ∈ Sb ∧ f x = y}.
58 ndefinition mm_counter_image:
59 ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism ?? Ma Mb → magma A.
62 [ napply (counter_image ?? f Mb)
63 | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd;
64 napply (ex_intro ????)
67 [ napply (op_closed ??????); nassumption
70 napply (mmprop ?? f ??)]##]
73 ndefinition m_intersect: ∀A. magma A → magma A → magma A.
77 | #x; #y; nwhd in ⊢ (% → % → %); *; #Hx1; #Hx2; *; #Hy1; #Hy2;
78 napply (conj ????); napply (op_closed ??????); nassumption ]