]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/sta/sta_lift.etc
- lambda_delta: programmed renaming to lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / sta / sta_lift.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/substitution/ldrop_ldrop.ma".
16 include "basic_2/static/sta.ma".
17
18 (* STATIC TYPE ASSIGNMENT ON TERMS ******************************************)
19
20 (* Properties on relocation *************************************************)
21
22 (* Basic_1: was: sty0_lift *)
23 lemma sta_lift: ∀h,L1,T1,U1. ⦃h, L1⦄ ⊢ T1 • U1 → ∀L2,d,e. ⇩[d, e] L2 ≡ L1 →
24                 ∀T2. ⇧[d, e] T1 ≡ T2 → ∀U2. ⇧[d, e] U1 ≡ U2 → ⦃h, L2⦄ ⊢ T2 • U2.
25 #h #L1 #T1 #U1 #H elim H -L1 -T1 -U1
26 [ #L1 #k #L2 #d #e #HL21 #X1 #H1 #X2 #H2
27   >(lift_inv_sort1 … H1) -X1
28   >(lift_inv_sort1 … H2) -X2 //
29 | #L1 #K1 #V1 #W1 #W #i #HLK1 #_ #HW1 #IHVW1 #L2 #d #e #HL21 #X #H #U2 #HWU2
30   elim (lift_inv_lref1 … H) * #Hid #H destruct
31   [ elim (lift_trans_ge … HW1 … HWU2 ?) -W // #W2 #HW12 #HWU2
32     elim (ldrop_trans_le … HL21 … HLK1 ?) -L1 /2 width=2/ #X #HLK2 #H
33     elim (ldrop_inv_skip2 … H ?) -H /2 width=1/ -Hid #K2 #V2 #HK21 #HV12 #H destruct
34     /3 width=8/
35   | lapply (lift_trans_be … HW1 … HWU2 ? ?) -W // /2 width=1/ #HW1U2
36     lapply (ldrop_trans_ge … HL21 … HLK1 ?) -L1 // -Hid /3 width=8/
37   ]
38 | #L1 #K1 #W1 #V1 #W #i #HLK1 #_ #HW1 #IHWV1 #L2 #d #e #HL21 #X #H #U2 #HWU2
39   elim (lift_inv_lref1 … H) * #Hid #H destruct
40   [ elim (lift_trans_ge … HW1 … HWU2 ?) -W // <minus_plus #W #HW1 #HWU2
41     elim (ldrop_trans_le … HL21 … HLK1 ?) -L1 /2 width=2/ #X #HLK2 #H
42     elim (ldrop_inv_skip2 … H ?) -H /2 width=1/ -Hid #K2 #W2 #HK21 #HW12 #H destruct
43     lapply (lift_mono … HW1 … HW12) -HW1 #H destruct
44     elim (lift_total V1 (d-i-1) e) /3 width=8/
45   | lapply (lift_trans_be … HW1 … HWU2 ? ?) -W // /2 width=1/ #HW1U2
46     lapply (ldrop_trans_ge … HL21 … HLK1 ?) -L1 // -Hid /3 width=8/
47   ]
48 | #I #L1 #V1 #T1 #U1 #_ #IHTU1 #L2 #d #e #HL21 #X1 #H1 #X2 #H2
49   elim (lift_inv_bind1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H destruct
50   elim (lift_inv_bind1 … H2) -H2 #X #U2 #H1 #HU12 #H2 destruct
51   lapply (lift_mono … H1 … HV12) -H1 #H destruct /4 width=5/
52 | #L1 #V1 #T1 #U1 #_ #IHTU1 #L2 #d #e #HL21 #X1 #H1 #X2 #H2
53   elim (lift_inv_flat1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H destruct
54   elim (lift_inv_flat1 … H2) -H2 #X #U2 #H1 #HU12 #H2 destruct
55   lapply (lift_mono … H1 … HV12) -H1 #H destruct /4 width=5/
56 | #L1 #W1 #T1 #U1 #_ #IHTU1 #L2 #d #e #HL21 #X #H #U2 #HU12
57   elim (lift_inv_flat1 … H) -H #W2 #T2 #_ #HT12 #H destruct /3 width=5/
58 ]
59 qed.
60
61 (* Note: apparently this was missing in basic_1 *)
62 lemma sta_inv_lift1: ∀h,L2,T2,U2. ⦃h, L2⦄ ⊢ T2 • U2 → ∀L1,d,e. ⇩[d, e] L2 ≡ L1 →
63                      ∀T1. ⇧[d, e] T1 ≡ T2 →
64                      ∃∃U1. ⦃h, L1⦄ ⊢ T1 • U1 & ⇧[d, e] U1 ≡ U2.
65 #h #L2 #T2 #U2 #H elim H -L2 -T2 -U2
66 [ #L2 #k #L1 #d #e #_ #X #H
67   >(lift_inv_sort2 … H) -X /2 width=3/
68 | #L2 #K2 #V2 #W2 #W #i #HLK2 #HVW2 #HW2 #IHVW2 #L1 #d #e #HL21 #X #H
69   elim (lift_inv_lref2 … H) * #Hid #H destruct [ -HVW2 | -IHVW2 ]
70   [ elim (ldrop_conf_lt … HL21 … HLK2 ?) -L2 // #K1 #V1 #HLK1 #HK21 #HV12
71     elim (IHVW2 … HK21 … HV12) -K2 -V2 #W1 #HVW1 #HW12
72     elim (lift_trans_le … HW12 … HW2 ?) -W2 // >minus_plus <plus_minus_m_m // -Hid /3 width=6/
73   | lapply (ldrop_conf_ge … HL21 … HLK2 ?) -L2 // #HL1K2
74     elim (le_inv_plus_l … Hid) -Hid #Hdie #ei
75     elim (lift_split … HW2 d (i-e+1) ? ? ?) -HW2 // [3: /2 width=1/ ]
76     [ #W0 #HW20 <le_plus_minus_comm // >minus_minus_m_m /2 width=1/ /3 width=6/
77     | <le_plus_minus_comm // /2 width=1/
78     ]
79   ]
80 | #L2 #K2 #W2 #V2 #W #i #HLK2 #HWV2 #HW2 #IHWV2 #L1 #d #e #HL21 #X #H
81   elim (lift_inv_lref2 … H) * #Hid #H destruct [ -HWV2 | -IHWV2 ]
82   [ elim (ldrop_conf_lt … HL21 … HLK2 ?) -L2 // #K1 #W1 #HLK1 #HK21 #HW12
83     elim (IHWV2 … HK21 … HW12) -K2 #V1 #HWV1 #_
84     elim (lift_trans_le … HW12 … HW2 ?) -W2 // >minus_plus <plus_minus_m_m // -Hid /3 width=6/
85   | lapply (ldrop_conf_ge … HL21 … HLK2 ?) -L2 // #HL1K2
86     elim (le_inv_plus_l … Hid) -Hid #Hdie #ei
87     elim (lift_split … HW2 d (i-e+1) ? ? ?) -HW2 // [3: /2 width=1/ ]
88     [ #W0 #HW20 <le_plus_minus_comm // >minus_minus_m_m /2 width=1/ /3 width=6/
89     | <le_plus_minus_comm // /2 width=1/
90     ]
91   ]
92 | #I #L2 #V2 #T2 #U2 #_ #IHTU2 #L1 #d #e #HL21 #X #H
93   elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
94   elim (IHTU2 (L1.ⓑ{I}V1) … HT12) -IHTU2 -HT12 /2 width=1/ -HL21 /3 width=5/
95 | #L2 #V2 #T2 #U2 #_ #IHTU2 #L1 #d #e #HL21 #X #H
96   elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
97   elim (IHTU2 … HL21 … HT12) -L2 -HT12 /3 width=5/
98 | #L2 #W2 #T2 #U2 #_ #IHTU2 #L1 #d #e #HL21 #X #H
99   elim (lift_inv_flat2 … H) -H #W1 #T1 #_ #HT12 #H destruct
100   elim (IHTU2 … HL21 … HT12) -L2 -HT12 /3 width=3/
101 ]
102 qed.  
103
104 (* Advanced forvard lemmas **************************************************)
105
106 (* Basic_1: was: sty0_correct *)
107 lemma sta_fwd_correct: ∀h,L,T,U. ⦃h, L⦄ ⊢ T • U → ∃T0. ⦃h, L⦄ ⊢ U • T0.
108 #h #L #T #U #H elim H -L -T -U
109 [ /2 width=2/
110 | #L #K #V #W #W0 #i #HLK #_ #HW0 * #V0 #HWV0
111   lapply (ldrop_fwd_ldrop2 … HLK) -HLK #HLK
112   elim (lift_total V0 0 (i+1)) /3 width=10/
113 | #L #K #W #V #V0 #i #HLK #HWV #HWV0 #_
114   lapply (ldrop_fwd_ldrop2 … HLK) -HLK #HLK
115   elim (lift_total V 0 (i+1)) /3 width=10/
116 | #I #L #V #T #U #_ * /3 width=2/
117 | #L #V #T #U #_ * #T0 #HUT0 /3 width=2/
118 | #L #W #T #U #_ * /2 width=2/
119 ]
120 qed-.