From: Claudio Sacerdoti Coen Date: Fri, 10 Jul 2009 06:15:13 +0000 (+0000) Subject: Coercions used here and there. X-Git-Tag: make_still_working~3704 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=2ecac72aa0961834dd63f0245d2ec563ea96bef2;p=helm.git Coercions used here and there. --- diff --git a/helm/software/matita/nlibrary/algebra/magmas.ma b/helm/software/matita/nlibrary/algebra/magmas.ma index dd6f9ae48..e49d8ea82 100644 --- a/helm/software/matita/nlibrary/algebra/magmas.ma +++ b/helm/software/matita/nlibrary/algebra/magmas.ma @@ -19,44 +19,56 @@ nrecord pre_magma : Type[1] ≝ op: carr → carr → carr }. (* this is a projection *) -ndefinition carr ≝ λM: pre_magma. match M with [ mk_pre_magma carr _ ⇒ carr ]. +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. carr M → carr M → carr M with [ mk_pre_magma _ op ⇒ op ]. -(* ncoercion carr. *) + λ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 (carr 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.∀x,y. x ∈ mcarr ? M → y ∈ mcarr ? M → op A x y ∈ mcarr ? M with + 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: carr A → carr B; + { mmcarr: 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 ∀_.?. nrecord magma_morphism (A) (B) (Ma: magma A) (Mb: magma B) : Type ≝ { mmmcarr: pre_magma_morphism A B; - mmclosed: ∀x. x ∈ mcarr ? Ma → mmcarr ?? mmmcarr x ∈ mcarr ? Mb + 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 mmcarr_mmmcarr ≝ + λA,B,Ma,Mb.λf: magma_morphism A B Ma Mb. mmcarr ?? (mmmcarr ???? f). +ncoercion mmcarr_mmmcarr : ∀A,B,Ma,Mb.∀f: magma_morphism A B Ma Mb. A → B ≝ mmcarr_mmmcarr + on _f: magma_morphism ???? to ∀_.?. ndefinition mmclosed ≝ λA,B,Ma,Mb.λf: magma_morphism A B Ma Mb. - match f return λf.∀x. x ∈ mcarr ? Ma → mmcarr ?? (mmmcarr ???? f) x ∈ mcarr ? Mb with + 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. mcarr ? M1 ⊆ 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}.