]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/snta/snta_thin.etc
- extended multiple substitutions now uses bounds in ynat (ie. they
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / snta / snta_thin.etc
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/unfold/thin_ldrop.ma".
16 include "basic_2/equivalence/cpcs_delift.ma".
17 include "basic_2/dynamic/snta_lift.ma".
18
19 (* STRATIFIED NATIVE TYPE ASSIGNMENT ON TERMS *******************************)
20
21 (* Properties on basic local environment thinning ***************************)
22
23 (* Note: this is known as the substitution lemma *)
24 lemma snta_thin_conf: ∀h,L1,T1,U1,l. ⦃h, L1⦄ ⊢ T1 :[l] U1 →
25                       ∀L2,d,e. ≽ [d, e] L1 → L1 ▼*[d, e] ≡ L2 →
26                       ∃∃T2,U2. ⦃h, L2⦄ ⊢ T2 :[l] U2 &
27                                L1 ⊢ T1 ▼*[d, e] ≡ T2 & L1 ⊢ U1 ▼*[d, e] ≡ U2.
28 #h #L1 #T1 #U1 #l #H elim H -L1 -T1 -U1 -l
29 [ /2 width=5/
30 | #L1 #K1 #V1 #W1 #U1 #i #l #HLK1 #HVW1 #HWU1 #IHVW1 #L2 #d #e #HL1 #HL12
31   elim (lt_or_ge i d) #Hdi [ -HVW1 ]
32   [ lapply (sfr_ldrop_trans_ge … HLK1 … HL1 ?) -HL1 /2 width=2/ #H
33     lapply (sfr_inv_skip … H ?) -H /2 width=1/ #HK1
34     elim (thin_ldrop_conf_le … HL12 … HLK1 ?) -HL12 /2 width=2/ #X #H #HLK2
35     elim (thin_inv_delift1 … H ?) -H /2 width=1/ #K2 #V2 #HK12 #HV12 #H destruct
36     elim (IHVW1 … HK1 HK12) -IHVW1 -HK1 -HK12 #X2 #W2 #HVW2 #H #HW12
37     lapply (delift_mono … H … HV12) -H -HV12 #H destruct
38     elim (lift_total W2 0 (i+1)) #U2 #HWU2
39     lapply (ldrop_fwd_ldrop2 … HLK1) -V1 #HLK1
40     lapply (delift_lift_ge … HW12 … HLK1 HWU1 … HWU2) -HW12 -HLK1 -HWU1 //
41     >minus_plus <plus_minus_m_m // /3 width=6/
42   | elim (lt_or_ge i (d+e)) #Hide [ -HVW1 | -Hdi -IHVW1 -HL1 ]
43     [ lapply (sfr_ldrop_trans_be_up … HLK1 … HL1 ? ?) -HL1 // /2 width=2/ <minus_n_O #H
44       elim (sfr_inv_bind … H ?) -H /2 width=1/ #HK1 #_
45       elim (thin_ldrop_conf_be … HL12 … HLK1 ? ?) -HL12 /2 width=2/ #K2 #H #HLK2
46       lapply (thin_inv_thin1 … H ?) -H /2 width=1/ #HK12
47       elim (IHVW1 … HK1 HK12) -IHVW1 -HK1 -HK12 #V2 #W2 #HVW2 #HV12 #HW12
48       elim (lift_total V2 0 d) #T2 #HVT2
49       elim (lift_total W2 0 d) #U2 #HWU2
50       elim (lift_total W2 0 (i+1)) #U #HW2U
51       lapply (snta_lift … HVW2 … HLK2 … HVT2 … HWU2) -HVW2 -HLK2 #HTU2
52       lapply (ldrop_fwd_ldrop2 … HLK1) #HLK0
53       lapply (delift_lift_ge … HW12 … HLK0 HWU1 … HW2U) -HW12 -HLK0 -HWU1 // >minus_plus #HU1
54       lapply (lift_conf_be … HWU2 … HW2U ?) -W2 /2 width=1/ #HU2
55       lapply (delift_lift_div_be … HU1 … HU2 ? ?) -U // /2 width=1/ /3 width=8/
56     | lapply (transitive_le … (i+1) Hide ?) /2 width=1/ #Hdei
57       lapply (thin_ldrop_conf_ge … HL12 … HLK1 ?) -HL12 -HLK1 // #HL2K1
58       elim (lift_split … HWU1 d (i+1-e) ? ? ?) -HWU1 // /2 width=1/ #W
59       <plus_minus in ⊢ (??%??→?); /2 width=2/ #HW1
60       <minus_minus // /2 width=2/ -Hdei >commutative_plus <minus_n_n /3 width=6/
61     ]
62   ]
63 | #L1 #K1 #W1 #V1 #U1 #i #l #HLK1 #HWV1 #HWU1 #IHWV1 #L2 #d #e #HL1 #HL12
64   elim (lt_or_ge i d) #Hdi [ -HWV1 | -IHWV1 ]
65   [ lapply (sfr_ldrop_trans_ge … HLK1 … HL1 ?) -HL1 /2 width=2/ #H
66     lapply (sfr_inv_skip … H ?) -H /2 width=1/ #HK1
67     elim (thin_ldrop_conf_le … HL12 … HLK1 ?) -HL12 /2 width=2/ #X #H #HLK2
68     elim (thin_inv_delift1 … H ?) -H /2 width=1/ #K2 #W2 #HK12 #HW12 #H destruct
69     elim (IHWV1 … HK1 HK12) -IHWV1 -HK1 -HK12 #X2 #V2 #HWV2 #H #_
70     lapply (delift_mono … H … HW12) -H #H destruct
71     elim (lift_total W2 0 (i+1)) #U2 #HWU2
72     lapply (ldrop_fwd_ldrop2 … HLK1) -HLK1 #HLK1
73     lapply (delift_lift_ge … HW12 … HLK1 HWU1 … HWU2) -HW12 -HLK1 -HWU1 //
74     >minus_plus <plus_minus_m_m // /3 width=6/
75   | elim (lt_or_ge i (d+e)) #Hide [ -HWV1 -HWU1 -HL12 | -Hdi -HL1 ]
76     [ lapply (sfr_inv_ldrop … HLK1 … HL1 ? ?) -HLK1 -HL1 // -Hdi -Hide #H destruct 
77     | lapply (transitive_le … (i+1) Hide ?) /2 width=1/ #Hdei
78       lapply (thin_ldrop_conf_ge … HL12 … HLK1 ?) -HL12 -HLK1 // #HL2K1
79       elim (lift_split … HWU1 d (i+1-e) ? ? ?) -HWU1 // /2 width=1/ #W
80       <plus_minus in ⊢ (??%??→?); /2 width=2/ #HW1
81       <minus_minus // /2 width=2/ -Hdei >commutative_plus <minus_n_n /3 width=6/
82     ]
83   ]
84 | #I #L1 #V1 #W1 #T1 #U1 #l1 #l2 #_ #_ #IHVW1 #IHTU1 #L2 #d #e #HL1 #HL12
85   elim (IHVW1 … HL1 HL12) -IHVW1 #V2 #W2 #HVW2 #HV12 #_
86   elim (IHTU1 (L2.ⓑ{I}V2) (d+1) e ? ?) -IHTU1 /2 width=1/ -HL1 -HL12 #T2 #U2 #HTU2 #HT12 #HU12
87   lapply (delift_lsubs_trans … HT12 (L1.ⓑ{I}V2) ?) -HT12 /2 width=1/
88   lapply (delift_lsubs_trans … HU12 (L1.ⓑ{I}V2) ?) -HU12 /2 width=1/ /3 width=7/
89 | #L1 #V1 #W11 #W12 #T1 #U1 #l1 #l2 #_ #_ #IHVW1 #IHTU1 #L2 #d #e #HL1 #HL12
90   elim (IHVW1 … HL1 HL12) -IHVW1 #V2 #W22 #HVW2 #HV12 #HW122
91   elim (IHTU1 … HL1 HL12) -IHTU1 -HL1 -HL12 #X2 #Y2 #HXY2 #HX2 #HY2
92   elim (delift_inv_bind1 … HX2) -HX2 #W21 #T2 #W121 #HT12 #H destruct
93   elim (delift_inv_bind1 … HY2) -HY2 #X #U2 #HX #HU12 #H destruct
94   lapply (delift_mono … HX … HW122) -HX #H destruct
95   @(ex3_2_intro … (ⓐV2.ⓛW21.T2) (ⓐV2.ⓛW22.U2)) [ /2 width=2/ | 2,3: /3 width=1/ ] (**) (* explict constructor, /4 depth=?/ is too slow *)
96 | #L1 #V1 #T1 #U1 #W1 #l #_ #_ #IHTU1 #IHUW1 #L2 #d #e #HL1 #HL12
97   elim (IHTU1 … HL1 HL12) -IHTU1 #T2 #U2 #HTU2 #HT12 #HU12
98   elim (IHUW1 … HL1 HL12) -IHUW1 -HL1 -HL12 #X2 #W2 #HXW2 #H #HW12
99   elim (delift_inv_flat1 … H) -H #V2 #Y2 #HV12 #HY2 #H destruct
100   lapply (delift_mono … HY2 … HU12) -HY2 #H destruct /3 width=7/
101 | #L1 #T1 #U1 #W1 #l1 #l2 #_ #_ #IHTU1 #IHUW1 #L2 #d #e #HL1 #HL12
102   elim (IHTU1 … HL1 HL12) -IHTU1 #T2 #U2 #HTU2 #HT12 #HU12
103   elim (IHUW1 … HL1 HL12) -IHUW1 -HL1 -HL12 #Y2 #W2 #HUW2 #HY2 #HW12
104   lapply (delift_mono … HY2 … HU12) -HY2 #H destruct /3 width=5/
105 | #L1 #T1 #U11 #U12 #V1 #l #_ #HU112 #_ #IHT1 #IHU12 #L2 #d #e #HL1 #HL12
106   elim (IHT1 … HL1 HL12) -IHT1 #T2 #U21 #HT2 #HT12 #HU121
107   elim (IHU12 … HL1 HL12) -IHU12 -HL1 #U22 #V2 #HU22 #HU122 #_
108   lapply (thin_cpcs_delift_mono … HU112 … HL12 … HU121 … HU122) -HU112 -HL12 -HU121 /3 width=5/
109 ]
110 qed.
111
112 lemma snta_ldrop_conf: ∀h,L1,T1,U1,l. ⦃h, L1⦄ ⊢ T1 :[l] U1 →
113                        ∀L2,d,e. ≽ [d, e] L1 → ⇩[d, e] L1 ≡ L2 →
114                        ∃∃T2,U2. ⦃h, L2⦄ ⊢ T2 :[l] U2 &
115                                 L1 ⊢ T1 ▼*[d, e] ≡ T2 & L1 ⊢ U1 ▼*[d, e] ≡ U2.
116 /3 width=1/ qed.