]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/nlibrary/algebra/magmas.ma
Hmmmm. This way we need "canonical structures" also for local definitions => BAD
[helm.git] / helm / software / matita / nlibrary / algebra / magmas.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "sets/sets.ma".
16
17 nrecord magma (A: Type) : Type[1] ≝
18  { mcarr: Ω \sup A;
19    op: A → A → A;
20    op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op x y ∈ mcarr
21  }.
22 (* this is a projection *)
23 ndefinition mcarr ≝ λA.λM: magma A. match M with [ mk_magma mcarr _ _ ⇒ mcarr ].
24 ndefinition op ≝ λA.λM: magma A. match M with [ mk_magma _ op _ ⇒ op ].
25
26 (* to be splitted *)
27 nrecord magma_morphism (A,B: Type) (Ma: magma A) (Mb: magma B) : Type ≝
28  { mmcarr: A → B;
29    mmclosed: ∀x. x ∈ mcarr ? Ma → mmcarr x ∈ mcarr ? Mb;
30    (* need a canonical structure in next line? *)
31    mmprop: ∀x,y:A. x ∈ mcarr ? Ma → y ∈ mcarr ? Ma → mmcarr (op ? Ma x y) = op B Mb (mmcarr x) (mmcarr y)
32  }.
33 (* this is a projection *)
34 ndefinition mmcarr ≝
35  λA,B,Ma,Mb.λf: magma_morphism A B Ma Mb. match f with [ mk_magma_morphism f _ _ ⇒ f ].
36  
37 ndefinition sub_magma ≝
38  λA.λM1,M2: magma A. ∀x. x ∈ mcarr ? M1 → x ∈ mcarr ? M2.
39  
40 ndefinition image: ∀A,B. (A → B) → Ω \sup A → Ω \sup B ≝
41  λA,B,f,Sa. {y | ∃x. x ∈ Sa ∧ f x = y}.
42
43 naxiom daemon: False.
44
45 ndefinition mm_image:
46  ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism ?? Ma Mb → magma B.
47  #A; #B; #Ma; #Mb; #f;
48  napply (mk_magma ????)
49   [ napply (image ?? (mmcarr ???? f) (mcarr ? Ma)) 
50   | napply (op ? Mb)
51   | #x; #y; *; #x0; #Hx0; *; #y0; #Hy0; nwhd;
52     napply (ex_intro ????)
53      [ napply (op ? Ma x0 y0) (* BAD HERE! need a canonical structure? *) 
54      | nelim daemon ]]
55 nqed.