2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department of the University of Bologna, Italy.
7 ||A|| This file is distributed under the terms of the
8 \ / GNU General Public License Version 2
10 V_______________________________________________________________ *)
12 include "lambda-delta/substitution/drop_defs.ma".
14 (* PARTIAL TELESCOPIC SUBSTITUTION ******************************************)
16 inductive pts: lenv → term → nat → nat → term → Prop ≝
17 | pts_sort : ∀L,k,d,e. pts L (⋆k) d e (⋆k)
18 | pts_lref : ∀L,i,d,e. pts L (#i) d e (#i)
19 | pts_subst: ∀L,K,V,U1,U2,i,d,e.
21 ↓[0, i] L ≡ K. 𝕓{Abbr} V → pts K V 0 (d + e - i - 1) U1 →
22 ↑[0, i + 1] U1 ≡ U2 → pts L (#i) d e U2
23 | pts_bind : ∀L,I,V1,V2,T1,T2,d,e.
24 pts L V1 d e V2 → pts (L. 𝕓{I} V1) T1 (d + 1) e T2 →
25 pts L (𝕓{I} V1. T1) d e (𝕓{I} V2. T2)
26 | pts_flat : ∀L,I,V1,V2,T1,T2,d,e.
27 pts L V1 d e V2 → pts L T1 d e T2 →
28 pts L (𝕗{I} V1. T1) d e (𝕗{I} V2. T2)
31 interpretation "partial telescopic substritution"
32 'PSubst L T1 d e T2 = (pts L T1 d e T2).
34 (* Basic properties *********************************************************)
36 lemma pts_leq_repl: ∀L1,T1,T2,d,e. L1 ⊢ T1 [d, e] ≫ T2 →
37 ∀L2. L1 [d, e] ≈ L2 → L2 ⊢ T1 [d, e] ≫ T2.
38 #L1 #T1 #T2 #d #e #H elim H -H L1 T1 T2 d e
41 | #L1 #K1 #V #V1 #V2 #i #d #e #Hdi #Hide #HLK1 #_ #HV12 #IHV12 #L2 #HL12
42 elim (drop_leq_drop1 … HL12 … HLK1 ? ?) -HL12 HLK1 // #K2 #HK12 #HLK2
43 @pts_subst [4,5,6,8: // |1,2,3: skip | /2/ ] (**) (* /3 width=6/ is too slow *)
49 lemma pts_refl: ∀T,L,d,e. L ⊢ T [d, e] ≫ T.
54 lemma pts_weak: ∀L,T1,T2,d1,e1. L ⊢ T1 [d1, e1] ≫ T2 →
55 ∀d2,e2. d2 ≤ d1 → d1 + e1 ≤ d2 + e2 →
57 #L #T1 #T #d1 #e1 #H elim H -L T1 T d1 e1
60 | #L #K #V #V1 #V2 #i #d1 #e1 #Hid1 #Hide1 #HLK #_ #HV12 #IHV12 #d2 #e2 #Hd12 #Hde12
61 lapply (transitive_le … Hd12 … Hid1) -Hd12 Hid1 #Hid2
62 lapply (lt_to_le_to_lt … Hide1 … Hde12) -Hide1 #Hide2
63 @pts_subst [4,5,6,8: // |1,2,3: skip | @IHV12 /2/ ] (**) (* /4 width=6/ is too slow *)
69 (* Basic inversion lemmas ***************************************************)
71 lemma pts_inv_bind1_aux: ∀d,e,L,U1,U2. L ⊢ U1 [d, e] ≫ U2 →
72 ∀I,V1,T1. U1 = 𝕓{I} V1. T1 →
73 ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 &
74 L. 𝕓{I} V1 ⊢ T1 [d + 1, e] ≫ T2 &
76 #d #e #L #U1 #U2 * -d e L U1 U2
77 [ #L #k #d #e #I #V1 #T1 #H destruct
78 | #L #i #d #e #I #V1 #T1 #H destruct
79 | #L #K #V #U1 #U2 #i #d #e #_ #_ #_ #_ #_ #I #V1 #T1 #H destruct
80 | #L #J #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #I #V #T #H destruct /2 width=5/
81 | #L #J #V1 #V2 #T1 #T2 #d #e #_ #_ #I #V #T #H destruct
85 lemma pts_inv_bind1: ∀d,e,L,I,V1,T1,U2. L ⊢ 𝕓{I} V1. T1 [d, e] ≫ U2 →
86 ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 &
87 L. 𝕓{I} V1 ⊢ T1 [d + 1, e] ≫ T2 &
91 lemma pts_inv_flat1_aux: ∀d,e,L,U1,U2. L ⊢ U1 [d, e] ≫ U2 →
92 ∀I,V1,T1. U1 = 𝕗{I} V1. T1 →
93 ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & L ⊢ T1 [d, e] ≫ T2 &
95 #d #e #L #U1 #U2 * -d e L U1 U2
96 [ #L #k #d #e #I #V1 #T1 #H destruct
97 | #L #i #d #e #I #V1 #T1 #H destruct
98 | #L #K #V #U1 #U2 #i #d #e #_ #_ #_ #_ #_ #I #V1 #T1 #H destruct
99 | #L #J #V1 #V2 #T1 #T2 #d #e #_ #_ #I #V #T #H destruct
100 | #L #J #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #I #V #T #H destruct /2 width=5/
104 lemma pts_inv_flat1: ∀d,e,L,I,V1,T1,U2. L ⊢ 𝕗{I} V1. T1 [d, e] ≫ U2 →
105 ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & L ⊢ T1 [d, e] ≫ T2 &