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 notation "hvbox( L ⊢ break ▼ * [ term 46 d , break term 46 e ] break term 46 T1 ≡ break term 46 T2 )"
16 non associative with precedence 45
17 for @{ 'TSubst $L $T1 $d $e $T2 }.
19 include "basic_2/unfold/tpss.ma".
21 (* INVERSE BASIC TERM RELOCATION *******************************************)
23 definition delift: nat → nat → lenv → relation term ≝
24 λd,e,L,T1,T2. ∃∃T. L ⊢ T1 ▶* [d, e] T & ⇧[d, e] T2 ≡ T.
26 interpretation "inverse basic relocation (term)"
27 'TSubst L T1 d e T2 = (delift d e L T1 T2).
29 (* Basic properties *********************************************************)
31 lemma lift_delift: ∀T1,T2,d,e. ⇧[d, e] T1 ≡ T2 →
32 ∀L. L ⊢ ▼*[d, e] T2 ≡ T1.
35 lemma delift_refl_O2: ∀L,T,d. L ⊢ ▼*[d, 0] T ≡ T.
38 lemma delift_lsubr_trans: ∀L1,T1,T2,d,e. L1 ⊢ ▼*[d, e] T1 ≡ T2 →
39 ∀L2. L2 ⊑ [d, e] L1 → L2 ⊢ ▼*[d, e] T1 ≡ T2.
40 #L1 #T1 #T2 #d #e * /3 width=3/
43 lemma delift_sort: ∀L,d,e,k. L ⊢ ▼*[d, e] ⋆k ≡ ⋆k.
46 lemma delift_lref_lt: ∀L,d,e,i. i < d → L ⊢ ▼*[d, e] #i ≡ #i.
49 lemma delift_lref_ge: ∀L,d,e,i. d + e ≤ i → L ⊢ ▼*[d, e] #i ≡ #(i - e).
52 lemma delift_gref: ∀L,d,e,p. L ⊢ ▼*[d, e] §p ≡ §p.
55 lemma delift_bind: ∀a,I,L,V1,V2,T1,T2,d,e.
56 L ⊢ ▼*[d, e] V1 ≡ V2 → L. ⓑ{I} V2 ⊢ ▼*[d+1, e] T1 ≡ T2 →
57 L ⊢ ▼*[d, e] ⓑ{a,I} V1. T1 ≡ ⓑ{a,I} V2. T2.
58 #a #I #L #V1 #V2 #T1 #T2 #d #e * #V #HV1 #HV2 * #T #HT1 #HT2
59 lapply (tpss_lsubr_trans … HT1 (L. ⓑ{I} V) ?) -HT1 /2 width=1/ /3 width=5/
62 lemma delift_flat: ∀I,L,V1,V2,T1,T2,d,e.
63 L ⊢ ▼*[d, e] V1 ≡ V2 → L ⊢ ▼*[d, e] T1 ≡ T2 →
64 L ⊢ ▼*[d, e] ⓕ{I} V1. T1 ≡ ⓕ{I} V2. T2.
65 #I #L #V1 #V2 #T1 #T2 #d #e * #V #HV1 #HV2 * /3 width=5/
68 (* Basic inversion lemmas ***************************************************)
70 lemma delift_inv_sort1: ∀L,U2,d,e,k. L ⊢ ▼*[d, e] ⋆k ≡ U2 → U2 = ⋆k.
71 #L #U2 #d #e #k * #U #HU
72 >(tpss_inv_sort1 … HU) -HU #HU2
73 >(lift_inv_sort2 … HU2) -HU2 //
76 lemma delift_inv_gref1: ∀L,U2,d,e,p. L ⊢ ▼*[d, e] §p ≡ U2 → U2 = §p.
77 #L #U #d #e #p * #U #HU
78 >(tpss_inv_gref1 … HU) -HU #HU2
79 >(lift_inv_gref2 … HU2) -HU2 //
82 lemma delift_inv_bind1: ∀a,I,L,V1,T1,U2,d,e. L ⊢ ▼*[d, e] ⓑ{a,I} V1. T1 ≡ U2 →
83 ∃∃V2,T2. L ⊢ ▼*[d, e] V1 ≡ V2 &
84 L. ⓑ{I} V2 ⊢ ▼*[d+1, e] T1 ≡ T2 &
86 #a #I #L #V1 #T1 #U2 #d #e * #U #HU #HU2
87 elim (tpss_inv_bind1 … HU) -HU #V #T #HV1 #HT1 #X destruct
88 elim (lift_inv_bind2 … HU2) -HU2 #V2 #T2 #HV2 #HT2
89 lapply (tpss_lsubr_trans … HT1 (L. ⓑ{I} V2) ?) -HT1 /2 width=1/ /3 width=5/
92 lemma delift_inv_flat1: ∀I,L,V1,T1,U2,d,e. L ⊢ ▼*[d, e] ⓕ{I} V1. T1 ≡ U2 →
93 ∃∃V2,T2. L ⊢ ▼*[d, e] V1 ≡ V2 &
94 L ⊢ ▼*[d, e] T1 ≡ T2 &
96 #I #L #V1 #T1 #U2 #d #e * #U #HU #HU2
97 elim (tpss_inv_flat1 … HU) -HU #V #T #HV1 #HT1 #X destruct
98 elim (lift_inv_flat2 … HU2) -HU2 /3 width=5/
101 lemma delift_inv_refl_O2: ∀L,T1,T2,d. L ⊢ ▼*[d, 0] T1 ≡ T2 → T1 = T2.
102 #L #T1 #T2 #d * #T #HT1
103 >(tpss_inv_refl_O2 … HT1) -HT1 #HT2
104 >(lift_inv_refl_O2 … HT2) -HT2 //
107 (* Basic forward lemmas *****************************************************)
109 lemma delift_fwd_tw: ∀L,T1,T2,d,e. L ⊢ ▼*[d, e] T1 ≡ T2 → ♯{T1} ≤ ♯{T2}.
110 #L #T1 #T2 #d #e * #T #HT1 #HT2
111 >(lift_fwd_tw … HT2) -T2 /2 width=4 by tpss_fwd_tw/