]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/dynamic/lsubsv_lstas.ma
some renaming and some typos corrected ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / dynamic / lsubsv_lstas.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 "basic_2/static/da_sta.ma".
16 include "basic_2/static/lsubd_da.ma".
17 include "basic_2/unfold/lstas_alt.ma".
18 include "basic_2/equivalence/cpcs_cpcs.ma".
19 include "basic_2/dynamic/lsubsv_lsubd.ma".
20
21 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED NATIVE VALIDITY **************)
22
23 (* Properties on nat-iterated static type assignment ************************)
24
25 lemma lsubsv_lstas_trans: ∀h,g,G,L2,T,U2,l1. ⦃G, L2⦄ ⊢ T •*[h, l1] U2 →
26                           ∀l2. l1 ≤ l2 → ⦃G, L2⦄ ⊢ T ▪[h, g] l2 →
27                           ∀L1. G ⊢ L1 ⫃¡[h, g] L2 →
28                           ∃∃U1. ⦃G, L1⦄ ⊢ T •*[h, l1] U1 & ⦃G, L1⦄ ⊢ U1 ⬌* U2.
29 #h #g #G #L2 #T #U #l1 #H @(lstas_ind_alt … H) -G -L2 -T -U -l1
30 [1,2: /2 width=3 by ex2_intro/
31 | #G #L2 #K2 #X #Y #U #i #l1 #HLK2 #_ #HYU #IHXY #l2 #Hl12 #Hl2 #L1 #HL12
32   elim (da_inv_lref … Hl2) -Hl2 * #K0 #V0 [| #l0 ] #HK0 #HV0
33   lapply (drop_mono … HK0 … HLK2) -HK0 #H destruct
34   elim (lsubsv_drop_O1_trans … HL12 … HLK2) -L2 #X #H #HLK1
35   elim (lsubsv_inv_pair2 … H) -H * #K1 [ | -HYU -IHXY -HLK1 ]
36   [ #HK12 #H destruct
37     elim (IHXY … Hl12 HV0 … HK12) -K2 -l2 #T #HXT #HTY
38     lapply (drop_fwd_drop2 … HLK1) #H
39     elim (lift_total T 0 (i+1))
40     /3 width=12 by lstas_ldef, cpcs_lift, ex2_intro/
41   | #V #l0 #_ #_ #_ #_ #_ #_ #_ #H destruct
42   ]
43 | #G #L2 #K2 #X #Y #Y0 #U #i #l1 #HLK2 #HXY0 #_ #HYU #IHXY #l2 #Hl12 #Hl2 #L1 #HL12
44   elim (da_inv_lref … Hl2) -Hl2 * #K0 #V0 [| #l0 ] #HK0 #HV0 [| #H1 ]
45   lapply (drop_mono … HK0 … HLK2) -HK0 #H2 destruct
46   lapply (le_plus_to_le_r … Hl12) -Hl12 #Hl12
47   elim (lsubsv_drop_O1_trans … HL12 … HLK2) -L2 #X #H #HLK1
48   elim (lsubsv_inv_pair2 … H) -H * #K1
49   [ #HK12 #H destruct
50     lapply (lsubsv_fwd_lsubd … HK12) #H
51     lapply (lsubd_da_trans … HV0 … H) -H #H
52     elim (da_inv_sta … H) -H
53     elim (IHXY … Hl12 HV0 … HK12) -K2 -Hl12 #Y1
54     lapply (drop_fwd_drop2 … HLK1)
55     elim (lift_total Y1 0 (i+1))
56     /3 width=12 by lstas_ldec, cpcs_lift, ex2_intro/
57   | #V #l #_ #_ #HVX #_ #HV #HX #HK12 #_ #H destruct
58     lapply (da_mono … HX … HV0) -HX #H destruct
59     elim (IHXY … Hl12 HV0 … HK12) -K2 #Y0 #HXY0 #HY0
60     elim (da_inv_sta … HV) -HV #W #HVW
61     elim (lstas_total … HVW (l1+1)) -W #W #HVW
62     lapply (HVX … Hl12 HVW HXY0) -HVX -Hl12 -HXY0 #HWY0
63     lapply (cpcs_trans … HWY0 … HY0) -Y0
64     lapply (drop_fwd_drop2 … HLK1)
65     elim (lift_total W 0 (i+1))
66     /4 width=12 by lstas_ldef, lstas_cast, cpcs_lift, ex2_intro/
67   ]
68 | #a #I #G #L2 #V2 #T2 #U2 #l1 #_ #IHTU2 #l2 #Hl12 #Hl2 #L1 #HL12
69   lapply (da_inv_bind … Hl2) -Hl2 #Hl2
70   elim (IHTU2 … Hl2 (L1.ⓑ{I}V2) …)
71   /3 width=3 by lsubsv_pair, lstas_bind, cpcs_bind_dx, ex2_intro/
72 | #G #L2 #V2 #T2 #U2 #l1 #_ #IHTU2 #l2 #Hl12 #Hl2 #L1 #HL12
73   lapply (da_inv_flat … Hl2) -Hl2 #Hl2
74   elim (IHTU2 … Hl2 … HL12) -L2
75   /3 width=5 by lstas_appl, cpcs_flat, ex2_intro/
76 | #G #L2 #W2 #T2 #U2 #l1 #_ #IHTU2 #l2 #Hl12 #Hl2 #L1 #HL12
77   lapply (da_inv_flat … Hl2) -Hl2 #Hl2
78   elim (IHTU2 … Hl2 … HL12) -L2
79   /3 width=3 by lstas_cast, ex2_intro/
80 ]
81 qed-.
82
83 lemma lsubsv_sta_trans: ∀h,g,G,L2,T,U2. ⦃G, L2⦄ ⊢ T •[h] U2 →
84                         ∀l. ⦃G, L2⦄ ⊢ T ▪[h, g] l+1 →
85                         ∀L1. G ⊢ L1 ⫃¡[h, g] L2 →
86                         ∃∃U1. ⦃G, L1⦄ ⊢ T •[h] U1 & ⦃G, L1⦄ ⊢ U1 ⬌* U2.
87 #h #g #G #L2 #T #U2 #H #l #HTl #L1 #HL12
88 elim (lsubsv_lstas_trans … U2 1 … HTl … HL12)
89 /3 width=3 by lstas_inv_SO, sta_lstas, ex2_intro/
90 qed-.