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/substitution/tps.ma".
17 (* PARALLEL SUBSTITUTION ON LOCAL ENVIRONMENTS ******************************)
19 (* Basic_1: includes: csubst1_bind *)
20 inductive ltps: nat → nat → relation lenv ≝
21 | ltps_atom: ∀d,e. ltps d e (⋆) (⋆)
22 | ltps_pair: ∀L,I,V. ltps 0 0 (L. 𝕓{I} V) (L. 𝕓{I} V)
23 | ltps_tps2: ∀L1,L2,I,V1,V2,e.
24 ltps 0 e L1 L2 → L2 ⊢ V1 [0, e] ≫ V2 →
25 ltps 0 (e + 1) (L1. 𝕓{I} V1) L2. 𝕓{I} V2
26 | ltps_tps1: ∀L1,L2,I,V1,V2,d,e.
27 ltps d e L1 L2 → L2 ⊢ V1 [d, e] ≫ V2 →
28 ltps (d + 1) e (L1. 𝕓{I} V1) (L2. 𝕓{I} V2)
31 interpretation "parallel substritution (local environment)"
32 'PSubst L1 d e L2 = (ltps d e L1 L2).
34 (* Basic properties *********************************************************)
36 lemma ltps_tps2_lt: ∀L1,L2,I,V1,V2,e.
37 L1 [0, e - 1] ≫ L2 → L2 ⊢ V1 [0, e - 1] ≫ V2 →
38 0 < e → L1. 𝕓{I} V1 [0, e] ≫ L2. 𝕓{I} V2.
39 #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #He
40 >(plus_minus_m_m e 1) /2 width=1/
43 lemma ltps_tps1_lt: ∀L1,L2,I,V1,V2,d,e.
44 L1 [d - 1, e] ≫ L2 → L2 ⊢ V1 [d - 1, e] ≫ V2 →
45 0 < d → L1. 𝕓{I} V1 [d, e] ≫ L2. 𝕓{I} V2.
46 #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #Hd
47 >(plus_minus_m_m d 1) /2 width=1/
50 (* Basic_1: was by definition: csubst1_refl *)
51 lemma ltps_refl: ∀L,d,e. L [d, e] ≫ L.
53 #L #I #V #IHL * /2 width=1/ * /2 width=1/
56 (* Basic inversion lemmas ***************************************************)
58 fact ltps_inv_refl_O2_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → e = 0 → L1 = L2.
59 #d #e #L1 #L2 #H elim H -d -e -L1 -L2 //
60 [ #L1 #L2 #I #V1 #V2 #e #_ #_ #_ >commutative_plus normalize #H destruct
61 | #L1 #L2 #I #V1 #V2 #d #e #_ #HV12 #IHL12 #He destruct
62 >(IHL12 ?) -IHL12 // >(tps_inv_refl_O2 … HV12) //
66 lemma ltps_inv_refl_O2: ∀d,L1,L2. L1 [d, 0] ≫ L2 → L1 = L2.
69 fact ltps_inv_atom1_aux: ∀d,e,L1,L2.
70 L1 [d, e] ≫ L2 → L1 = ⋆ → L2 = ⋆.
71 #d #e #L1 #L2 * -d -e -L1 -L2
73 | #L #I #V #H destruct
74 | #L1 #L2 #I #V1 #V2 #e #_ #_ #H destruct
75 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct
79 lemma ltps_inv_atom1: ∀d,e,L2. ⋆ [d, e] ≫ L2 → L2 = ⋆.
82 fact ltps_inv_tps21_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → d = 0 → 0 < e →
83 ∀K1,I,V1. L1 = K1. 𝕓{I} V1 →
84 ∃∃K2,V2. K1 [0, e - 1] ≫ K2 &
85 K2 ⊢ V1 [0, e - 1] ≫ V2 &
87 #d #e #L1 #L2 * -d -e -L1 -L2
88 [ #d #e #_ #_ #K1 #I #V1 #H destruct
89 | #L1 #I #V #_ #H elim (lt_refl_false … H)
90 | #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K1 #J #W1 #H destruct /2 width=5/
91 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
95 lemma ltps_inv_tps21: ∀e,K1,I,V1,L2. K1. 𝕓{I} V1 [0, e] ≫ L2 → 0 < e →
96 ∃∃K2,V2. K1 [0, e - 1] ≫ K2 & K2 ⊢ V1 [0, e - 1] ≫ V2 &
100 fact ltps_inv_tps11_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → 0 < d →
101 ∀I,K1,V1. L1 = K1. 𝕓{I} V1 →
102 ∃∃K2,V2. K1 [d - 1, e] ≫ K2 &
103 K2 ⊢ V1 [d - 1, e] ≫ V2 &
105 #d #e #L1 #L2 * -d -e -L1 -L2
106 [ #d #e #_ #I #K1 #V1 #H destruct
107 | #L #I #V #H elim (lt_refl_false … H)
108 | #L1 #L2 #I #V1 #V2 #e #_ #_ #H elim (lt_refl_false … H)
109 | #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #_ #J #K1 #W1 #H destruct /2 width=5/
113 lemma ltps_inv_tps11: ∀d,e,I,K1,V1,L2. K1. 𝕓{I} V1 [d, e] ≫ L2 → 0 < d →
114 ∃∃K2,V2. K1 [d - 1, e] ≫ K2 &
115 K2 ⊢ V1 [d - 1, e] ≫ V2 &
119 fact ltps_inv_atom2_aux: ∀d,e,L1,L2.
120 L1 [d, e] ≫ L2 → L2 = ⋆ → L1 = ⋆.
121 #d #e #L1 #L2 * -d -e -L1 -L2
123 | #L #I #V #H destruct
124 | #L1 #L2 #I #V1 #V2 #e #_ #_ #H destruct
125 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct
129 lemma ltps_inv_atom2: ∀d,e,L1. L1 [d, e] ≫ ⋆ → L1 = ⋆.
132 fact ltps_inv_tps22_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → d = 0 → 0 < e →
133 ∀K2,I,V2. L2 = K2. 𝕓{I} V2 →
134 ∃∃K1,V1. K1 [0, e - 1] ≫ K2 &
135 K2 ⊢ V1 [0, e - 1] ≫ V2 &
137 #d #e #L1 #L2 * -d -e -L1 -L2
138 [ #d #e #_ #_ #K1 #I #V1 #H destruct
139 | #L1 #I #V #_ #H elim (lt_refl_false … H)
140 | #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K2 #J #W2 #H destruct /2 width=5/
141 | #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
145 lemma ltps_inv_tps22: ∀e,L1,K2,I,V2. L1 [0, e] ≫ K2. 𝕓{I} V2 → 0 < e →
146 ∃∃K1,V1. K1 [0, e - 1] ≫ K2 & K2 ⊢ V1 [0, e - 1] ≫ V2 &
150 fact ltps_inv_tps12_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → 0 < d →
151 ∀I,K2,V2. L2 = K2. 𝕓{I} V2 →
152 ∃∃K1,V1. K1 [d - 1, e] ≫ K2 &
153 K2 ⊢ V1 [d - 1, e] ≫ V2 &
155 #d #e #L1 #L2 * -d -e -L1 -L2
156 [ #d #e #_ #I #K2 #V2 #H destruct
157 | #L #I #V #H elim (lt_refl_false … H)
158 | #L1 #L2 #I #V1 #V2 #e #_ #_ #H elim (lt_refl_false … H)
159 | #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #_ #J #K2 #W2 #H destruct /2 width=5/
163 lemma ltps_inv_tps12: ∀L1,K2,I,V2,d,e. L1 [d, e] ≫ K2. 𝕓{I} V2 → 0 < d →
164 ∃∃K1,V1. K1 [d - 1, e] ≫ K2 &
165 K2 ⊢ V1 [d - 1, e] ≫ V2 &
169 (* Basic_1: removed theorems 27:
170 csubst0_clear_O csubst0_ldrop_lt csubst0_ldrop_gt csubst0_ldrop_eq
171 csubst0_clear_O_back csubst0_clear_S csubst0_clear_trans
172 csubst0_ldrop_gt_back csubst0_ldrop_eq_back csubst0_ldrop_lt_back
173 csubst0_gen_sort csubst0_gen_head csubst0_getl_ge csubst0_getl_lt
174 csubst0_gen_S_bind_2 csubst0_getl_ge_back csubst0_getl_lt_back
175 csubst0_snd_bind csubst0_fst_bind csubst0_both_bind
176 csubst1_head csubst1_flat csubst1_gen_head
177 csubst1_getl_ge csubst1_getl_lt csubst1_getl_ge_back getl_csubst1