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