]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/dynamic/snv_lift.ma
- bug fix il ldrop (interesting), fsup, fsups
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / dynamic / snv_lift.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/computation/dxprs_lift.ma".
16 include "basic_2/equivalence/cpcs_cpcs.ma".
17 include "basic_2/dynamic/snv.ma".
18
19 (* STRATIFIED NATIVE VALIDITY FOR TERMS *************************************)
20
21 (* Relocation properties ****************************************************)
22
23 lemma snv_lift: ∀h,g,K,T. ⦃h, K⦄ ⊢ T ¡[g] → ∀L,d,e. ⇩[d, e] L ≡ K →
24                 ∀U. ⇧[d, e] T ≡ U → ⦃h, L⦄ ⊢ U ¡[g].
25 #h #g #K #T #H elim H -K -T
26 [ #K #k #L #d #e #_ #X #H
27   >(lift_inv_sort1 … H) -X -K -d -e //
28 | #I #K #K0 #V #i #HK0 #_ #IHV #L #d #e #HLK #X #H
29   elim (lift_inv_lref1 … H) * #Hid #H destruct
30   [ elim (ldrop_trans_le … HLK … HK0 ?) -K /2 width=2/ #X #HL0 #H
31     elim (ldrop_inv_skip2 … H ?) -H /2 width=1/ -Hid #L0 #W #HLK0 #HVW #H destruct
32     /3 width=8/
33   | lapply (ldrop_trans_ge … HLK … HK0 ?) -K // -Hid /3 width=8/
34   ]
35 | #a #I #K #V #T #_ #_ #IHV #IHT #L #d #e #HLK #X #H
36   elim (lift_inv_bind1 … H) -H #W #U #HVW #HTU #H destruct
37   /4 width=4/
38 | #a #K #V #V0 #V1 #T #T1 #l #_ #_ #HV0 #HV01 #HT1 #IHV #IHT #L #d #e #HLK #X #H
39   elim (lift_inv_flat1 … H) -H #W #U #HVW #HTU #H destruct
40   elim (lift_total V0 d e) #W0 #HVW0
41   elim (lift_total V1 d e) #W1 #HVW1
42   elim (lift_total T1 (d+1) e) #U1 #HTU1
43   @(snv_appl … a … W0 … W1 … U1 l)
44   [ /2 width=4/ | /2 width=4/ | /2 width=9/ | /2 width=9/ ]
45   @(dxprs_lift … HLK … HTU … HT1) /2 width=1/
46 | #K #V0 #T #V #l #_ #_ #HTV #HV0 #IHV0 #IHT #L #d #e #HLK #X #H
47   elim (lift_inv_flat1 … H) -H #W0 #U #HVW0 #HTU #H destruct
48   elim (lift_total V d e) #W #HVW
49   @(snv_cast … W l) [ /2 width=4/ | /2 width=4/ | /2 width=9/ | /2 width=9/ ]
50 ]
51 qed.
52
53 lemma snv_inv_lift: ∀h,g,L,U. ⦃h, L⦄ ⊢ U ¡[g] → ∀K,d,e. ⇩[d, e] L ≡ K →
54                     ∀T. ⇧[d, e] T ≡ U → ⦃h, K⦄ ⊢ T ¡[g].
55 #h #g #L #U #H elim H -L -U
56 [ #L #k #K #d #e #_ #X #H
57   >(lift_inv_sort2 … H) -X -L -d -e //
58 | #I #L #L0 #W #i #HL0 #_ #IHW #K #d #e #HLK #X #H
59   elim (lift_inv_lref2 … H) * #Hid #H destruct
60   [ elim (ldrop_conf_le … HLK … HL0 ?) -L /2 width=2/ #X #HK0 #H
61     elim (ldrop_inv_skip1 … H ?) -H /2 width=1/ -Hid #K0 #V #HLK0 #HVW #H destruct
62     /3 width=8/
63   | lapply (ldrop_conf_ge … HLK … HL0 ?) -L // -Hid /3 width=8/
64   ]
65 | #a #I #L #W #U #_ #_ #IHW #IHU #K #d #e #HLK #X #H
66   elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct /4 width=4/
67 | #a #L #W #W0 #W1 #U #U1 #l #_ #_ #HW0 #HW01 #HU1 #IHW #IHU #K #d #e #HLK #X #H
68   elim (lift_inv_flat2 … H) -H #V #T #HVW #HTU #H destruct
69   elim (ssta_inv_lift1 … HW0 … HLK … HVW) -HW0 #V0 #HV0 #HVW0
70   elim (cprs_inv_lift1 … HW01 … HLK … HVW0) -W0 #V1 #HVW1 #HV01
71   elim (dxprs_inv_lift1 … HLK … HTU … HU1) -HU1 #X #H #HTU
72   elim (lift_inv_bind2 … H) -H #Y #T1 #HY #HTU1 #H destruct
73   lapply (lift_inj … HY … HVW1) -HY #H destruct /3 width=8/
74 | #L #W0 #U #W #l #_ #_ #HUW #HW0 #IHW0 #IHU #K #d #e #HLK #X #H
75   elim (lift_inv_flat2 … H) -H #V0 #T #HVW0 #HTU #H destruct
76   elim (ssta_inv_lift1 … HUW … HLK … HTU) -HUW #V #HTV #HVW
77   lapply (cpcs_inv_lift … HLK … HVW … HVW0 ?) // -W /3 width=4/
78 ]
79 qed-.
80
81 (* Advanced properties ******************************************************)
82
83 lemma snv_fsup_conf: ∀h,g,L1,L2,T1,T2. ⦃L1, T1⦄ ⊃ ⦃L2, T2⦄ →
84                      ⦃h, L1⦄ ⊢ T1 ¡[g] → ⦃h, L2⦄ ⊢ T2 ¡[g].
85 #h #g #L1 #L2 #T1 #T2 #H elim H -L1 -L2 -T1 -T2
86 [ #I1 #L1 #V1 #H
87   elim (snv_inv_lref … H) -H #I2 #L2 #V2 #H #HV2
88   lapply (ldrop_inv_O2 … H) -H #H destruct //
89 |2: *
90 |5,6: /3 width=7 by snv_inv_lift/
91 ]
92 [1,3: #a #I #L1 #V1 #T1 #H elim (snv_inv_bind … H) -H //
93 |2,4: * #L1 #V1 #T1 #H
94   [1,3: elim (snv_inv_appl … H) -H //
95   |2,4: elim (snv_inv_cast … H) -H //
96   ]
97 ]
98 qed-.