X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbasic_2%2Funfold%2Flstas.ma;h=289992d5f5640fb876df5693db42be4d76efe984;hb=ad3ca38634cfae29e8c26d0ab23cb466407eca5e;hp=feed03e3fd64b4bb0e09a808e4f63e7d9a522e59;hpb=ff7754f834f937bfe2384c7703cf63f552885395;p=helm.git diff --git a/matita/matita/contribs/lambdadelta/basic_2/unfold/lstas.ma b/matita/matita/contribs/lambdadelta/basic_2/unfold/lstas.ma index feed03e3f..289992d5f 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/unfold/lstas.ma +++ b/matita/matita/contribs/lambdadelta/basic_2/unfold/lstas.ma @@ -13,119 +13,176 @@ (**************************************************************************) include "basic_2/notation/relations/statictypestar_6.ma". -include "basic_2/static/sta.ma". +include "basic_2/grammar/genv.ma". +include "basic_2/substitution/drop.ma". +include "basic_2/static/sh.ma". (* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************) -definition lstas: ∀h. genv → lenv → nat → relation term ≝ - λh,G,L. lstar … (sta h G L). +(* activate genv *) +inductive lstas (h): nat → relation4 genv lenv term term ≝ +| lstas_sort: ∀G,L,d,k. lstas h d G L (⋆k) (⋆((next h)^d k)) +| lstas_ldef: ∀G,L,K,V,W,U,i,d. ⬇[i] L ≡ K.ⓓV → lstas h d G K V W → + ⬆[0, i+1] W ≡ U → lstas h d G L (#i) U +| lstas_zero: ∀G,L,K,W,V,i. ⬇[i] L ≡ K.ⓛW → lstas h 0 G K W V → + lstas h 0 G L (#i) (#i) +| lstas_succ: ∀G,L,K,W,V,U,i,d. ⬇[i] L ≡ K.ⓛW → lstas h d G K W V → + ⬆[0, i+1] V ≡ U → lstas h (d+1) G L (#i) U +| lstas_bind: ∀a,I,G,L,V,T,U,d. lstas h d G (L.ⓑ{I}V) T U → + lstas h d G L (ⓑ{a,I}V.T) (ⓑ{a,I}V.U) +| lstas_appl: ∀G,L,V,T,U,d. lstas h d G L T U → lstas h d G L (ⓐV.T) (ⓐV.U) +| lstas_cast: ∀G,L,W,T,U,d. lstas h d G L T U → lstas h d G L (ⓝW.T) U +. interpretation "nat-iterated static type assignment (term)" - 'StaticTypeStar h G L l T U = (lstas h G L l T U). - -(* Basic eliminators ********************************************************) - -lemma lstas_ind_sn: ∀h,G,L,U2. ∀R:relation2 nat term. - R 0 U2 → ( - ∀l,T,U1. ⦃G, L⦄ ⊢ T •[h] U1 → ⦃G, L⦄ ⊢ U1 •* [h, l] U2 → - R l U1 → R (l+1) T - ) → - ∀l,T. ⦃G, L⦄ ⊢ T •*[h, l] U2 → R l T. -/3 width=5 by lstar_ind_l/ qed-. - -lemma lstas_ind_dx: ∀h,G,L,T. ∀R:relation2 nat term. - R 0 T → ( - ∀l,U1,U2. ⦃G, L⦄ ⊢ T •* [h, l] U1 → ⦃G, L⦄ ⊢ U1 •[h] U2 → - R l U1 → R (l+1) U2 - ) → - ∀l,U. ⦃G, L⦄ ⊢ T •*[h, l] U → R l U. -/3 width=5 by lstar_ind_r/ qed-. + 'StaticTypeStar h G L d T U = (lstas h d G L T U). (* Basic inversion lemmas ***************************************************) -lemma lstas_inv_O: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •*[h, 0] U → T = U. -/2 width=4 by lstar_inv_O/ qed-. - -lemma lstas_inv_SO: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •*[h, 1] U → ⦃G, L⦄ ⊢ T •[h] U. -/2 width=1 by lstar_inv_step/ qed-. - -lemma lstas_inv_step_sn: ∀h,G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 •*[h, l+1] T2 → - ∃∃T. ⦃G, L⦄ ⊢ T1 •[h] T & ⦃G, L⦄ ⊢ T •*[h, l] T2. -/2 width=3 by lstar_inv_S/ qed-. - -lemma lstas_inv_step_dx: ∀h,G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 •*[h, l+1] T2 → - ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, l] T & ⦃G, L⦄ ⊢ T •[h] T2. -/2 width=3 by lstar_inv_S_dx/ qed-. - -lemma lstas_inv_sort1: ∀h,G,L,X,k,l. ⦃G, L⦄ ⊢ ⋆k •*[h, l] X → X = ⋆((next h)^l k). -#h #G #L #X #k #l #H @(lstas_ind_dx … H) -X -l // -#l #X #X0 #_ #H #IHX destruct -lapply (sta_inv_sort1 … H) -H #H destruct ->iter_SO // +fact lstas_inv_sort1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀k0. T = ⋆k0 → + U = ⋆((next h)^d k0). +#h #G #L #T #U #d * -G -L -T -U -d +[ #G #L #d #k #k0 #H destruct // +| #G #L #K #V #W #U #i #d #_ #_ #_ #k0 #H destruct +| #G #L #K #W #V #i #_ #_ #k0 #H destruct +| #G #L #K #W #V #U #i #d #_ #_ #_ #k0 #H destruct +| #a #I #G #L #V #T #U #d #_ #k0 #H destruct +| #G #L #V #T #U #d #_ #k0 #H destruct +| #G #L #W #T #U #d #_ #k0 #H destruct qed-. -lemma lstas_inv_gref1: ∀h,G,L,X,p,l. ⦃G, L⦄ ⊢ §p •*[h, l+1] X → ⊥. -#h #G #L #X #p #l #H elim (lstas_inv_step_sn … H) -H -#U #H #HUX elim (sta_inv_gref1 … H) +(* Basic_1: was just: sty0_gen_sort *) +lemma lstas_inv_sort1: ∀h,G,L,X,k,d. ⦃G, L⦄ ⊢ ⋆k •*[h, d] X → X = ⋆((next h)^d k). +/2 width=5 by lstas_inv_sort1_aux/ qed-. -lemma lstas_inv_bind1: ∀h,a,I,G,L,V,T,X,l. ⦃G, L⦄ ⊢ ⓑ{a,I}V.T •*[h, l] X → - ∃∃U. ⦃G, L.ⓑ{I}V⦄ ⊢ T •*[h, l] U & X = ⓑ{a,I}V.U. -#h #a #I #G #L #V #T #X #l #H @(lstas_ind_dx … H) -X -l /2 width=3 by ex2_intro/ -#l #X #X0 #_ #HX0 * #U #HTU #H destruct -elim (sta_inv_bind1 … HX0) -HX0 #U0 #HU0 #H destruct /3 width=3 by lstar_dx, ex2_intro/ +fact lstas_inv_lref1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀j. T = #j → ∨∨ + (∃∃K,V,W. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d] W & + ⬆[0, j+1] W ≡ U + ) | + (∃∃K,W,V. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V & + U = #j & d = 0 + ) | + (∃∃K,W,V,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d0] V & + ⬆[0, j+1] V ≡ U & d = d0+1 + ). +#h #G #L #T #U #d * -G -L -T -U -d +[ #G #L #d #k #j #H destruct +| #G #L #K #V #W #U #i #d #HLK #HVW #HWU #j #H destruct /3 width=6 by or3_intro0, ex3_3_intro/ +| #G #L #K #W #V #i #HLK #HWV #j #H destruct /3 width=5 by or3_intro1, ex4_3_intro/ +| #G #L #K #W #V #U #i #d #HLK #HWV #HWU #j #H destruct /3 width=8 by or3_intro2, ex4_4_intro/ +| #a #I #G #L #V #T #U #d #_ #j #H destruct +| #G #L #V #T #U #d #_ #j #H destruct +| #G #L #W #T #U #d #_ #j #H destruct +] qed-. -lemma lstas_inv_appl1: ∀h,G,L,V,T,X,l. ⦃G, L⦄ ⊢ ⓐV.T •*[h, l] X → - ∃∃U. ⦃G, L⦄ ⊢ T •*[h, l] U & X = ⓐV.U. -#h #G #L #V #T #X #l #H @(lstas_ind_dx … H) -X -l /2 width=3 by ex2_intro/ -#l #X #X0 #_ #HX0 * #U #HTU #H destruct -elim (sta_inv_appl1 … HX0) -HX0 #U0 #HU0 #H destruct /3 width=3 by lstar_dx, ex2_intro/ +lemma lstas_inv_lref1: ∀h,G,L,X,i,d. ⦃G, L⦄ ⊢ #i •*[h, d] X → ∨∨ + (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d] W & + ⬆[0, i+1] W ≡ X + ) | + (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V & + X = #i & d = 0 + ) | + (∃∃K,W,V,d0. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d0] V & + ⬆[0, i+1] V ≡ X & d = d0+1 + ). +/2 width=3 by lstas_inv_lref1_aux/ qed-. -lemma lstas_inv_cast1: ∀h,G,L,W,T,U,l. ⦃G, L⦄ ⊢ ⓝW.T •*[h, l+1] U → ⦃G, L⦄ ⊢ T •*[h, l+1] U. -#h #G #L #W #T #X #l #H elim (lstas_inv_step_sn … H) -H -#U #H #HUX lapply (sta_inv_cast1 … H) -H /2 width=3 by lstar_S/ +lemma lstas_inv_lref1_O: ∀h,G,L,X,i. ⦃G, L⦄ ⊢ #i •*[h, 0] X → + (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, 0] W & + ⬆[0, i+1] W ≡ X + ) ∨ + (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V & + X = #i + ). +#h #G #L #X #i #H elim (lstas_inv_lref1 … H) -H * /3 width=6 by ex3_3_intro, or_introl, or_intror/ +#K #W #V #d #_ #_ #_ iter_SO /2 width=3 by sta_sort, lstas_step_dx/ -qed. +fact lstas_inv_appl1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀X,Y. T = ⓐY.X → + ∃∃Z. ⦃G, L⦄ ⊢ X •*[h, d] Z & U = ⓐY.Z. +#h #G #L #T #U #d * -G -L -T -U -d +[ #G #L #d #k #X #Y #H destruct +| #G #L #K #V #W #U #i #d #_ #_ #_ #X #Y #H destruct +| #G #L #K #W #V #i #_ #_ #X #Y #H destruct +| #G #L #K #W #V #U #i #d #_ #_ #_ #X #Y #H destruct +| #a #I #G #L #V #T #U #d #_ #X #Y #H destruct +| #G #L #V #T #U #d #HTU #X #Y #H destruct /2 width=3 by ex2_intro/ +| #G #L #W #T #U #d #_ #X #Y #H destruct +] +qed-. -lemma lstas_bind: ∀h,I,G,L,V,T,U,l. ⦃G, L.ⓑ{I}V⦄ ⊢ T •*[h, l] U → - ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V.T •*[h, l] ⓑ{a,I}V.U. -#h #I #G #L #V #T #U #l #H @(lstas_ind_dx … H) -U -l /3 width=3 by sta_bind, lstar_O, lstas_step_dx/ -qed. +(* Basic_1: was just: sty0_gen_appl *) +lemma lstas_inv_appl1: ∀h,G,L,V,T,X,d. ⦃G, L⦄ ⊢ ⓐV.T •*[h, d] X → + ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d] U & X = ⓐV.U. +/2 width=3 by lstas_inv_appl1_aux/ +qed-. -lemma lstas_appl: ∀h,G,L,T,U,l. ⦃G, L⦄ ⊢ T •*[h, l] U → - ∀V.⦃G, L⦄ ⊢ ⓐV.T •*[h, l] ⓐV.U. -#h #G #L #T #U #l #H @(lstas_ind_dx … H) -U -l /3 width=3 by sta_appl, lstar_O, lstas_step_dx/ -qed. +fact lstas_inv_cast1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀X,Y. T = ⓝY.X → + ⦃G, L⦄ ⊢ X •*[h, d] U. +#h #G #L #T #U #d * -G -L -T -U -d +[ #G #L #d #k #X #Y #H destruct +| #G #L #K #V #W #U #i #d #_ #_ #_ #X #Y #H destruct +| #G #L #K #W #V #i #_ #_ #X #Y #H destruct +| #G #L #K #W #V #U #i #d #_ #_ #_ #X #Y #H destruct +| #a #I #G #L #V #T #U #d #_ #X #Y #H destruct +| #G #L #V #T #U #d #_ #X #Y #H destruct +| #G #L #W #T #U #d #HTU #X #Y #H destruct // +] +qed-. -lemma lstas_cast: ∀h,G,L,T,U,l. ⦃G, L⦄ ⊢ T •*[h, l+1] U → - ∀W. ⦃G, L⦄ ⊢ ⓝW.T •*[h, l+1] U. -#h #G #L #T #U #l #H elim (lstas_inv_step_sn … H) -H /3 width=3 by sta_cast, lstas_step_sn/ -qed. +(* Basic_1: was just: sty0_gen_cast *) +lemma lstas_inv_cast1: ∀h,G,L,W,T,U,d. ⦃G, L⦄ ⊢ ⓝW.T •*[h, d] U → ⦃G, L⦄ ⊢ T •*[h, d] U. +/2 width=4 by lstas_inv_cast1_aux/ +qed-. (* Basic_1: removed theorems 7: sty1_abbr sty1_appl sty1_bind sty1_cast2