1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/computation/cpds_lift.ma".
16 include "basic_2/equivalence/cpcs_cpcs.ma".
17 include "basic_2/dynamic/snv.ma".
19 (* STRATIFIED NATIVE VALIDITY FOR TERMS *************************************)
21 (* Relocation properties ****************************************************)
23 lemma snv_lift: ∀h,g,G,K,T. ⦃G, K⦄ ⊢ T ¡[h, g] → ∀L,s,d,e. ⇩[s, d, e] L ≡ K →
24 ∀U. ⇧[d, e] T ≡ U → ⦃G, L⦄ ⊢ U ¡[h, g].
25 #h #g #G #K #T #H elim H -G -K -T
26 [ #G #K #k #L #s #d #e #_ #X #H
27 >(lift_inv_sort1 … H) -X -K -d -e //
28 | #I #G #K #K0 #V #i #HK0 #_ #IHV #L #s #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 by lt_to_le/ #X #HL0 #H
31 elim (ldrop_inv_skip2 … H) -H /2 width=1 by lt_plus_to_minus_r/ -Hid #L0 #W #HLK0 #HVW #H destruct
32 /3 width=9 by snv_lref/
33 | lapply (ldrop_trans_ge … HLK … HK0 ?) -K
34 /3 width=9 by snv_lref, ldrop_inv_gen/
36 | #a #I #G #K #V #T #_ #_ #IHV #IHT #L #s #d #e #HLK #X #H
37 elim (lift_inv_bind1 … H) -H #W #U #HVW #HTU #H destruct
38 /4 width=5 by snv_bind, ldrop_skip/
39 | #a #G #K #V #V0 #V1 #T #T1 #l #_ #_ #Hl #HV0 #HV01 #HT1 #IHV #IHT #L #s #d #e #HLK #X #H
40 elim (lift_inv_flat1 … H) -H #W #U #HVW #HTU #H destruct
41 elim (lift_total V0 d e) #W0 #HVW0
42 elim (lift_total V1 d e) #W1 #HVW1
43 elim (lift_total T1 (d+1) e) #U1 #HTU1
44 @(snv_appl … a … W0 … W1 … U1 l)
45 [1,2,3,4,5: /2 width=10 by cprs_lift, ssta_lift, da_lift/ ]
46 @(cpds_lift … HT1 … HLK … HTU) /2 width=1 by lift_bind/ (**) (* full auto raises typecjhecker failure *)
47 | #G #K #V0 #T #V #l #_ #_ #Hl #HTV #HV0 #IHV0 #IHT #L #s #d #e #HLK #X #H
48 elim (lift_inv_flat1 … H) -H #W0 #U #HVW0 #HTU #H destruct
49 elim (lift_total V d e)
50 /3 width=12 by snv_cast, cpcs_lift, ssta_lift, da_lift/
54 lemma snv_inv_lift: ∀h,g,G,L,U. ⦃G, L⦄ ⊢ U ¡[h, g] → ∀K,s,d,e. ⇩[s, d, e] L ≡ K →
55 ∀T. ⇧[d, e] T ≡ U → ⦃G, K⦄ ⊢ T ¡[h, g].
56 #h #g #G #L #U #H elim H -G -L -U
57 [ #G #L #k #K #s #d #e #_ #X #H
58 >(lift_inv_sort2 … H) -X -L -d -e //
59 | #I #G #L #L0 #W #i #HL0 #_ #IHW #K #s #d #e #HLK #X #H
60 elim (lift_inv_lref2 … H) * #Hid #H destruct
61 [ elim (ldrop_conf_le … HLK … HL0) -L /2 width=2 by lt_to_le/ #X #HK0 #H
62 elim (ldrop_inv_skip1 … H) -H /2 width=1 by lt_plus_to_minus_r/ -Hid #K0 #V #HLK0 #HVW #H destruct
63 /3 width=12 by snv_lref/
64 | lapply (ldrop_conf_ge … HLK … HL0 ?) -L /3 width=9 by snv_lref/
66 | #a #I #G #L #W #U #_ #_ #IHW #IHU #K #s #d #e #HLK #X #H
67 elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct
68 /4 width=5 by snv_bind, ldrop_skip/
69 | #a #G #L #W #W0 #W1 #U #U1 #l #_ #_ #Hl #HW0 #HW01 #HU1 #IHW #IHU #K #s #d #e #HLK #X #H
70 elim (lift_inv_flat2 … H) -H #V #T #HVW #HTU #H destruct
71 lapply (da_inv_lift … Hl … HLK … HVW) -Hl #Hl
72 elim (ssta_inv_lift1 … HW0 … HLK … HVW) -HW0 #V0 #HVW0 #HV0
73 elim (cprs_inv_lift1 … HW01 … HLK … HVW0) -W0 #V1 #HVW1 #HV01
74 elim (cpds_inv_lift1 … HU1 … HLK … HTU) -HU1 #X #H #HTU
75 elim (lift_inv_bind2 … H) -H #Y #T1 #HY #HTU1 #H destruct
76 lapply (lift_inj … HY … HVW1) -HY #H destruct
77 /3 width=8 by snv_appl/
78 | #G #L #W0 #U #W #l #_ #_ #Hl #HUW #HW0 #IHW0 #IHU #K #s #d #e #HLK #X #H
79 elim (lift_inv_flat2 … H) -H #V0 #T #HVW0 #HTU #H destruct
80 lapply (da_inv_lift … Hl … HLK … HTU) -Hl #Hl
81 elim (ssta_inv_lift1 … HUW … HLK … HTU) -HUW #V #HVW #HTV
82 lapply (cpcs_inv_lift G … HLK … HVW … HVW0 ?) // -W
83 /3 width=8 by snv_cast/
87 (* Advanced properties ******************************************************)
89 lemma snv_fqu_conf: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃ ⦃G2, L2, T2⦄ →
90 ⦃G1, L1⦄ ⊢ T1 ¡[h, g] → ⦃G2, L2⦄ ⊢ T2 ¡[h, g].
91 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
93 elim (snv_inv_lref … H) -H #I2 #L2 #V2 #H #HV2
94 lapply (ldrop_inv_O2 … H) -H #H destruct //
96 |5,6: /3 width=8 by snv_inv_lift/
98 [1,3: #a #I #G1 #L1 #V1 #T1 #H elim (snv_inv_bind … H) -H //
99 |2,4: * #G1 #L1 #V1 #T1 #H
100 [1,3: elim (snv_inv_appl … H) -H //
101 |2,4: elim (snv_inv_cast … H) -H //