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: binary_morphism mtcarr mtcarr mtcarr
22 nrecord magma (A: magma_type) : Type[1] ≝
24 op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op A x y ∈ mcarr
26 (* le coercion non vanno; sospetto setoid1_of_setoid *)
27 nrecord magma_morphism_type (A,B: magma_type) : Type[0] ≝
28 { mmcarr:> unary_morphism A B;
29 mmprop: ∀x,y:carr A. mmcarr (op ? x y) = op … (mmcarr x) (mmcarr y)
31 (* le coercion non vanno *)
32 nrecord magma_morphism (A) (B) (Ma: magma A) (Mb: magma B) : Type[0] ≝
33 { mmmcarr:> magma_morphism_type A B;
34 mmclosed: ∀x:carr A. x ∈ mcarr ? Ma → mmmcarr x ∈ mcarr ? Mb
38 ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism … Ma Mb → magma B.
41 [ napply (image … f Ma)
42 | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd;
46 [ napply op_closed; nassumption
49 napply (mmprop … f)]##]
52 ndefinition mm_counter_image:
53 ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism … Ma Mb → magma A.
56 [ napply (counter_image … f Mb)
57 | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd;
61 [ napply op_closed; nassumption
64 napply (mmprop … f)]##]
68 ndefinition m_intersect: ∀A. magma A → magma A → magma A.
71 [ napply (intersects_ok ? M1 M2)
72 | #x; #y; nwhd in ⊢ (% → % → %); *; #Hx1; #Hx2; *; #Hy1; #Hy2;
73 napply conj; napply op_closed; nassumption ]