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: unary_morphism mtcarr (unary_morph_setoid mtcarr mtcarr)
22 nrecord magma (A: magma_type) : Type[1] ≝
23 { mcarr:> ext_powerclass A;
24 op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op A x y ∈ mcarr
27 alias symbol "hint_decl" = "hint_decl_Type2".
29 A : ? ⊢ carr1 (ext_powerclass_setoid A) ≡ ext_powerclass A.
32 ncoercion mcarr' : ∀A. ∀M: magma A. carr1 (qpowerclass_setoid (mtcarr A))
33 ≝ λA.λM: magma A.mcarr ? M
34 on _M: magma ? to carr1 (qpowerclass_setoid (mtcarr ?)).
37 nrecord magma_morphism_type (A,B: magma_type) : Type[0] ≝
38 { mmcarr:> unary_morphism A B;
39 mmprop: ∀x,y:A. mmcarr (op ? x y) = op … (mmcarr x) (mmcarr y)
42 nrecord magma_morphism (A) (B) (Ma: magma A) (Mb: magma B) : Type[0] ≝
43 { mmmcarr:> magma_morphism_type A B;
44 mmclosed: ∀x:A. x ∈ mcarr ? Ma → (fun1 ?? mmmcarr x) ∈ mcarr ? Mb
45 }. (* XXX bug nelle coercions, fun1 non inserita *)
49 ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism … Ma Mb → magma B.
52 [ napply (image … f Ma)
53 | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd;
57 [ napply op_closed; nassumption
60 napply (mmprop … f)]##]
63 ndefinition mm_counter_image:
64 ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism … Ma Mb → magma A.
67 [ napply (counter_image … f Mb)
68 | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd;
72 [ napply op_closed; nassumption
75 napply (mmprop … f)]##]
79 ndefinition m_intersect: ∀A. magma A → magma A → magma A.
82 [ napply (intersect_is_ext_morph ? M1 M2)
83 | #x; #y; nwhd in ⊢ (% → % → %); *; #Hx1; #Hx2; *; #Hy1; #Hy2;
84 napply conj; napply op_closed; nassumption ]