X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fmatita%2Fnlibrary%2Falgebra%2Fmagmas.ma;h=1c829997aaf14724a02f5a39c2e22e411d06edf5;hb=40afbcc473baf6de47012181f2b14356d4b8d23a;hp=4fac05b51c6e2926fdaa85f21e9edc8db03561a0;hpb=6003ba0e4600778c6055ed5ea5cb6c1fba3abe32;p=helm.git diff --git a/helm/software/matita/nlibrary/algebra/magmas.ma b/helm/software/matita/nlibrary/algebra/magmas.ma index 4fac05b51..1c829997a 100644 --- a/helm/software/matita/nlibrary/algebra/magmas.ma +++ b/helm/software/matita/nlibrary/algebra/magmas.ma @@ -15,57 +15,24 @@ include "sets/sets.ma". nrecord pre_magma : Type[1] ≝ - { carr: Type; + { 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; + { mcarr:> Ω \sup A; 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 ]. -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 ]. nrecord pre_magma_morphism (A,B: pre_magma) : Type ≝ - { mmcarr: A → B; + { mmcarr:1> A → B; mmprop: ∀x,y. mmcarr (op ? x y) = op ? (mmcarr x) (mmcarr y) }. -(* this is a projection *) -ndefinition mmcarr ≝ - λ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; + { 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. M1 ⊆ M2. @@ -73,20 +40,35 @@ ndefinition sub_magma ≝ ndefinition image: ∀A,B. (A → B) → Ω \sup A → Ω \sup B ≝ λA,B,f,Sa. {y | ∃x. x ∈ Sa ∧ f x = y}. -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 ?? (mmmcarr ???? f)) Ma) (* NO COMPOSITE! *) + [ napply (image ?? f Ma) | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd; napply (ex_intro ????) [ napply (op ? x0 y0) | napply (conj ????) [ napply (op_closed ??????); nassumption - | (* nrewrite < Hx1; DOES NOT WORK *) - napply (eq_rect ?? (λ_.?) ?? Hx1); - napply (eq_rect ?? (λ_.?) ?? Hy1); + | nrewrite < Hx1; + nrewrite < Hy1; napply (mmprop ?? f ??)]##] +nqed. + +ndefinition counter_image: ∀A,B. (A → B) → Ω \sup B → Ω \sup A ≝ + λA,B,f,Sb. {x | ∃y. y ∈ Sb ∧ f x = y}. + +ndefinition mm_counter_image: + ∀A,B. ∀Ma: magma A. ∀Mb: magma B. magma_morphism ?? Ma Mb → magma A. + #A; #B; #Ma; #Mb; #f; + napply (mk_magma ???) + [ napply (counter_image ?? f Mb) + | #x; #y; nwhd in ⊢ (% → % → ?); *; #x0; *; #Hx0; #Hx1; *; #y0; *; #Hy0; #Hy1; nwhd; + napply (ex_intro ????) + [ napply (op ? x0 y0) + | napply (conj ????) + [ napply (op_closed ??????); nassumption + | nrewrite < Hx1; + nrewrite < Hy1; + napply (mmprop ?? f ??)]##] nqed. \ No newline at end of file