X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fnlibrary%2Falgebra%2Fmagmas.ma;h=4fac05b51c6e2926fdaa85f21e9edc8db03561a0;hb=6003ba0e4600778c6055ed5ea5cb6c1fba3abe32;hp=f58270a3889d027538bb38bd33627292b71aa8de;hpb=4e7271a14ed69938803a64a67e8c8bb61ff6d89e;p=helm.git diff --git a/helm/software/matita/nlibrary/algebra/magmas.ma b/helm/software/matita/nlibrary/algebra/magmas.ma index f58270a38..4fac05b51 100644 --- a/helm/software/matita/nlibrary/algebra/magmas.ma +++ b/helm/software/matita/nlibrary/algebra/magmas.ma @@ -14,28 +14,61 @@ include "sets/sets.ma". -nrecord magma (A: Type) : Type[1] ≝ +nrecord pre_magma : Type[1] ≝ + { carr: Type; + op: carr → carr → carr + }. +(* this is a projection *) +ndefinition carr: pre_magma → Type + ≝ λM: pre_magma. match M with [ mk_pre_magma carr _ ⇒ carr ]. +ncoercion carr: ∀M:pre_magma. Type ≝ carr on _M: pre_magma to Type. +ndefinition op ≝ + λM: pre_magma. match M return λM:pre_magma. M → M → M with [ mk_pre_magma _ op ⇒ op ]. + +nrecord magma (A: pre_magma) : Type[1] ≝ { mcarr: Ω \sup A; - op: A → A → A; - op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op x y ∈ mcarr + op_closed: ∀x,y. x ∈ mcarr → y ∈ mcarr → op A 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 ]. +ndefinition mcarr ≝ λA.λM: magma A. match M with [ mk_magma mcarr _ ⇒ mcarr ]. +ncoercion mcarr: ∀A.∀M: magma A. Ω \sup A ≝ mcarr + on _M: magma ? to Ω \sup ?. +ndefinition op_closed ≝ + λA.λM: magma A. + match M return λM: magma A.∀x,y. x ∈ M → y ∈ M → op ? x y ∈ M with + [ mk_magma _ opc ⇒ opc ]. -(* to be splitted *) -nrecord magma_morphism (A,B: Type) (Ma: magma A) (Mb: magma B) : Type ≝ +nrecord pre_magma_morphism (A,B: pre_magma) : 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) + mmprop: ∀x,y. mmcarr (op ? x y) = op ? (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 ]. + λA,B.λf: pre_magma_morphism A B. match f with [ mk_pre_magma_morphism f _ ⇒ f ]. +ncoercion mmcarr: ∀A,B.∀M: pre_magma_morphism A B. A → B ≝ mmcarr + on _M: pre_magma_morphism ? ? to ∀_.?. +ndefinition mmprop ≝ + λA,B,M. + match M return λM:pre_magma_morphism A B.∀x,y. M (op ? x y) = op ? (M x) (M y) with + [ mk_pre_magma_morphism _ p ⇒ p ]. + +nrecord magma_morphism (A) (B) (Ma: magma A) (Mb: magma B) : Type ≝ + { mmmcarr: pre_magma_morphism A B; + mmclosed: ∀x. x ∈ Ma → mmmcarr x ∈ Mb + }. +(* this is a projection *) +ndefinition mmmcarr ≝ + λA,B,Ma,Mb.λf: magma_morphism A B Ma Mb. match f with [ mk_magma_morphism f _ ⇒ f ]. +ncoercion mmmcarr : ∀A,B,Ma,Mb.∀f: magma_morphism A B Ma Mb. pre_magma_morphism A B + ≝ mmmcarr + on _f: magma_morphism ???? to pre_magma_morphism ??. +ndefinition mmclosed ≝ + λA,B,Ma,Mb.λf: magma_morphism A B Ma Mb. + match f return λf: magma_morphism A B Ma Mb.∀x. x ∈ Ma → f x ∈ Mb with + [ mk_magma_morphism _ p ⇒ p ]. ndefinition sub_magma ≝ - λA.λM1,M2: magma A. ∀x. x ∈ mcarr ? M1 → x ∈ mcarr ? M2. + λA.λM1,M2: magma A. M1 ⊆ M2. ndefinition image: ∀A,B. (A → B) → Ω \sup A → Ω \sup B ≝ λA,B,f,Sa. {y | ∃x. x ∈ Sa ∧ f x = y}. @@ -45,11 +78,15 @@ 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 (mk_magma ???) + [ napply (image ?? (mmcarr ?? (mmmcarr ???? f)) Ma) (* NO COMPOSITE! *) + | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd; napply (ex_intro ????) - [ napply (op ? Ma x0 y0) (* BAD HERE! need a canonical structure? *) - | nelim daemon ]] + [ napply (op ? x0 y0) + | napply (conj ????) + [ napply (op_closed ??????); nassumption + | (* nrewrite < Hx1; DOES NOT WORK *) + napply (eq_rect ?? (λ_.?) ?? Hx1); + napply (eq_rect ?? (λ_.?) ?? Hy1); + napply (mmprop ?? f ??)]##] nqed. \ No newline at end of file