]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/substitution/lift.ma
update in binararies for λδ
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / substitution / 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 "ground/xoa/ex_3_2.ma".
16 include "basic_2A/notation/relations/rlift_4.ma".
17 include "basic_2A/grammar/term_weight.ma".
18 include "basic_2A/grammar/term_simple.ma".
19
20 (* BASIC TERM RELOCATION ****************************************************)
21
22 inductive lift: relation4 nat nat term term ≝
23 | lift_sort   : ∀k,l,m. lift l m (⋆k) (⋆k)
24 | lift_lref_lt: ∀i,l,m. i < l → lift l m (#i) (#i)
25 | lift_lref_ge: ∀i,l,m. l ≤ i → lift l m (#i) (#(i + m))
26 | lift_gref   : ∀p,l,m. lift l m (§p) (§p)
27 | lift_bind   : ∀a,I,V1,V2,T1,T2,l,m.
28                 lift l m V1 V2 → lift (l + 1) m T1 T2 →
29                 lift l m (ⓑ{a,I} V1. T1) (ⓑ{a,I} V2. T2)
30 | lift_flat   : ∀I,V1,V2,T1,T2,l,m.
31                 lift l m V1 V2 → lift l m T1 T2 →
32                 lift l m (ⓕ{I} V1. T1) (ⓕ{I} V2. T2)
33 .
34
35 interpretation "relocation" 'RLift l m T1 T2 = (lift l m T1 T2).
36
37 (* Basic inversion lemmas ***************************************************)
38
39 fact lift_inv_O2_aux: ∀l,m,T1,T2. ⬆[l, m] T1 ≡ T2 → m = 0 → T1 = T2.
40 #l #m #T1 #T2 #H elim H -l -m -T1 -T2 /3 width=1 by eq_f2/
41 qed-.
42
43 lemma lift_inv_O2: ∀l,T1,T2. ⬆[l, 0] T1 ≡ T2 → T1 = T2.
44 /2 width=4 by lift_inv_O2_aux/ qed-.
45
46 fact lift_inv_sort1_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 → ∀k. T1 = ⋆k → T2 = ⋆k.
47 #l #m #T1 #T2 * -l -m -T1 -T2 //
48 [ #i #l #m #_ #k #H destruct
49 | #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
50 | #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
51 ]
52 qed-.
53
54 lemma lift_inv_sort1: ∀l,m,T2,k. ⬆[l,m] ⋆k ≡ T2 → T2 = ⋆k.
55 /2 width=5 by lift_inv_sort1_aux/ qed-.
56
57 fact lift_inv_lref1_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 → ∀i. T1 = #i →
58                          (i < l ∧ T2 = #i) ∨ (l ≤ i ∧ T2 = #(i + m)).
59 #l #m #T1 #T2 * -l -m -T1 -T2
60 [ #k #l #m #i #H destruct
61 | #j #l #m #Hj #i #Hi destruct /3 width=1 by or_introl, conj/
62 | #j #l #m #Hj #i #Hi destruct /3 width=1 by or_intror, conj/
63 | #p #l #m #i #H destruct
64 | #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #i #H destruct
65 | #I #V1 #V2 #T1 #T2 #l #m #_ #_ #i #H destruct
66 ]
67 qed-.
68
69 lemma lift_inv_lref1: ∀l,m,T2,i. ⬆[l,m] #i ≡ T2 →
70                       (i < l ∧ T2 = #i) ∨ (l ≤ i ∧ T2 = #(i + m)).
71 /2 width=3 by lift_inv_lref1_aux/ qed-.
72
73 lemma lift_inv_lref1_lt: ∀l,m,T2,i. ⬆[l,m] #i ≡ T2 → i < l → T2 = #i.
74 #l #m #T2 #i #H elim (lift_inv_lref1 … H) -H * //
75 #Hli #_ #Hil lapply (le_to_lt_to_lt … Hli Hil) -Hli -Hil #Hll
76 elim (lt_refl_false … Hll)
77 qed-.
78
79 lemma lift_inv_lref1_ge: ∀l,m,T2,i. ⬆[l,m] #i ≡ T2 → l ≤ i → T2 = #(i + m).
80 #l #m #T2 #i #H elim (lift_inv_lref1 … H) -H * //
81 #Hil #_ #Hli lapply (le_to_lt_to_lt … Hli Hil) -Hli -Hil #Hll
82 elim (lt_refl_false … Hll)
83 qed-.
84
85 fact lift_inv_gref1_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 → ∀p. T1 = §p → T2 = §p.
86 #l #m #T1 #T2 * -l -m -T1 -T2 //
87 [ #i #l #m #_ #k #H destruct
88 | #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
89 | #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
90 ]
91 qed-.
92
93 lemma lift_inv_gref1: ∀l,m,T2,p. ⬆[l,m] §p ≡ T2 → T2 = §p.
94 /2 width=5 by lift_inv_gref1_aux/ qed-.
95
96 fact lift_inv_bind1_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 →
97                          ∀a,I,V1,U1. T1 = ⓑ{a,I} V1.U1 →
98                          ∃∃V2,U2. ⬆[l,m] V1 ≡ V2 & ⬆[l+1,m] U1 ≡ U2 &
99                                   T2 = ⓑ{a,I} V2. U2.
100 #l #m #T1 #T2 * -l -m -T1 -T2
101 [ #k #l #m #a #I #V1 #U1 #H destruct
102 | #i #l #m #_ #a #I #V1 #U1 #H destruct
103 | #i #l #m #_ #a #I #V1 #U1 #H destruct
104 | #p #l #m #a #I #V1 #U1 #H destruct
105 | #b #J #W1 #W2 #T1 #T2 #l #m #HW #HT #a #I #V1 #U1 #H destruct /2 width=5 by ex3_2_intro/
106 | #J #W1 #W2 #T1 #T2 #l #m #_ #HT #a #I #V1 #U1 #H destruct
107 ]
108 qed-.
109
110 lemma lift_inv_bind1: ∀l,m,T2,a,I,V1,U1. ⬆[l,m] ⓑ{a,I} V1. U1 ≡ T2 →
111                       ∃∃V2,U2. ⬆[l,m] V1 ≡ V2 & ⬆[l+1,m] U1 ≡ U2 &
112                                T2 = ⓑ{a,I} V2. U2.
113 /2 width=3 by lift_inv_bind1_aux/ qed-.
114
115 fact lift_inv_flat1_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 →
116                          ∀I,V1,U1. T1 = ⓕ{I} V1.U1 →
117                          ∃∃V2,U2. ⬆[l,m] V1 ≡ V2 & ⬆[l,m] U1 ≡ U2 &
118                                   T2 = ⓕ{I} V2. U2.
119 #l #m #T1 #T2 * -l -m -T1 -T2
120 [ #k #l #m #I #V1 #U1 #H destruct
121 | #i #l #m #_ #I #V1 #U1 #H destruct
122 | #i #l #m #_ #I #V1 #U1 #H destruct
123 | #p #l #m #I #V1 #U1 #H destruct
124 | #a #J #W1 #W2 #T1 #T2 #l #m #_ #_ #I #V1 #U1 #H destruct
125 | #J #W1 #W2 #T1 #T2 #l #m #HW #HT #I #V1 #U1 #H destruct /2 width=5 by ex3_2_intro/
126 ]
127 qed-.
128
129 lemma lift_inv_flat1: ∀l,m,T2,I,V1,U1. ⬆[l,m] ⓕ{I} V1. U1 ≡ T2 →
130                       ∃∃V2,U2. ⬆[l,m] V1 ≡ V2 & ⬆[l,m] U1 ≡ U2 &
131                                T2 = ⓕ{I} V2. U2.
132 /2 width=3 by lift_inv_flat1_aux/ qed-.
133
134 fact lift_inv_sort2_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 → ∀k. T2 = ⋆k → T1 = ⋆k.
135 #l #m #T1 #T2 * -l -m -T1 -T2 //
136 [ #i #l #m #_ #k #H destruct
137 | #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
138 | #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
139 ]
140 qed-.
141
142 lemma lift_inv_sort2: ∀l,m,T1,k. ⬆[l,m] T1 ≡ ⋆k → T1 = ⋆k.
143 /2 width=5 by lift_inv_sort2_aux/ qed-.
144
145 fact lift_inv_lref2_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 → ∀i. T2 = #i →
146                          (i < l ∧ T1 = #i) ∨ (l + m ≤ i ∧ T1 = #(i - m)).
147 #l #m #T1 #T2 * -l -m -T1 -T2
148 [ #k #l #m #i #H destruct
149 | #j #l #m #Hj #i #Hi destruct /3 width=1 by or_introl, conj/
150 | #j #l #m #Hj #i #Hi destruct <minus_plus_m_m /4 width=1 by monotonic_le_plus_l, or_intror, conj/
151 | #p #l #m #i #H destruct
152 | #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #i #H destruct
153 | #I #V1 #V2 #T1 #T2 #l #m #_ #_ #i #H destruct
154 ]
155 qed-.
156
157 lemma lift_inv_lref2: ∀l,m,T1,i. ⬆[l,m] T1 ≡ #i →
158                       (i < l ∧ T1 = #i) ∨ (l + m ≤ i ∧ T1 = #(i - m)).
159 /2 width=3 by lift_inv_lref2_aux/ qed-.
160
161 lemma lift_inv_lref2_lt: ∀l,m,T1,i. ⬆[l,m] T1 ≡ #i → i < l → T1 = #i.
162 #l #m #T1 #i #H elim (lift_inv_lref2 … H) -H * //
163 #Hli #_ #Hil lapply (le_to_lt_to_lt … Hli Hil) -Hli -Hil #Hll
164 elim (lt_inv_plus_l … Hll) -Hll #Hll
165 elim (lt_refl_false … Hll)
166 qed-.
167
168 lemma lift_inv_lref2_be: ∀l,m,T1,i. ⬆[l,m] T1 ≡ #i →
169                          l ≤ i → i < l + m → ⊥.
170 #l #m #T1 #i #H elim (lift_inv_lref2 … H) -H *
171 [ #H1 #_ #H2 #_ | #H2 #_ #_ #H1 ]
172 lapply (le_to_lt_to_lt … H2 H1) -H2 -H1 #H
173 elim (lt_refl_false … H)
174 qed-.
175
176 lemma lift_inv_lref2_ge: ∀l,m,T1,i. ⬆[l,m] T1 ≡ #i → l + m ≤ i → T1 = #(i - m).
177 #l #m #T1 #i #H elim (lift_inv_lref2 … H) -H * //
178 #Hil #_ #Hli lapply (le_to_lt_to_lt … Hli Hil) -Hli -Hil #Hll
179 elim (lt_inv_plus_l … Hll) -Hll #Hll
180 elim (lt_refl_false … Hll)
181 qed-.
182
183 fact lift_inv_gref2_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 → ∀p. T2 = §p → T1 = §p.
184 #l #m #T1 #T2 * -l -m -T1 -T2 //
185 [ #i #l #m #_ #k #H destruct
186 | #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
187 | #I #V1 #V2 #T1 #T2 #l #m #_ #_ #k #H destruct
188 ]
189 qed-.
190
191 lemma lift_inv_gref2: ∀l,m,T1,p. ⬆[l,m] T1 ≡ §p → T1 = §p.
192 /2 width=5 by lift_inv_gref2_aux/ qed-.
193
194 fact lift_inv_bind2_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 →
195                          ∀a,I,V2,U2. T2 = ⓑ{a,I} V2.U2 →
196                          ∃∃V1,U1. ⬆[l,m] V1 ≡ V2 & ⬆[l+1,m] U1 ≡ U2 &
197                                   T1 = ⓑ{a,I} V1. U1.
198 #l #m #T1 #T2 * -l -m -T1 -T2
199 [ #k #l #m #a #I #V2 #U2 #H destruct
200 | #i #l #m #_ #a #I #V2 #U2 #H destruct
201 | #i #l #m #_ #a #I #V2 #U2 #H destruct
202 | #p #l #m #a #I #V2 #U2 #H destruct
203 | #b #J #W1 #W2 #T1 #T2 #l #m #HW #HT #a #I #V2 #U2 #H destruct /2 width=5 by ex3_2_intro/
204 | #J #W1 #W2 #T1 #T2 #l #m #_ #_ #a #I #V2 #U2 #H destruct
205 ]
206 qed-.
207
208 lemma lift_inv_bind2: ∀l,m,T1,a,I,V2,U2. ⬆[l,m] T1 ≡ ⓑ{a,I} V2. U2 →
209                       ∃∃V1,U1. ⬆[l,m] V1 ≡ V2 & ⬆[l+1,m] U1 ≡ U2 &
210                                T1 = ⓑ{a,I} V1. U1.
211 /2 width=3 by lift_inv_bind2_aux/ qed-.
212
213 fact lift_inv_flat2_aux: ∀l,m,T1,T2. ⬆[l,m] T1 ≡ T2 →
214                          ∀I,V2,U2. T2 = ⓕ{I} V2.U2 →
215                          ∃∃V1,U1. ⬆[l,m] V1 ≡ V2 & ⬆[l,m] U1 ≡ U2 &
216                                   T1 = ⓕ{I} V1. U1.
217 #l #m #T1 #T2 * -l -m -T1 -T2
218 [ #k #l #m #I #V2 #U2 #H destruct
219 | #i #l #m #_ #I #V2 #U2 #H destruct
220 | #i #l #m #_ #I #V2 #U2 #H destruct
221 | #p #l #m #I #V2 #U2 #H destruct
222 | #a #J #W1 #W2 #T1 #T2 #l #m #_ #_ #I #V2 #U2 #H destruct
223 | #J #W1 #W2 #T1 #T2 #l #m #HW #HT #I #V2 #U2 #H destruct /2 width=5 by ex3_2_intro/
224 ]
225 qed-.
226
227 lemma lift_inv_flat2: ∀l,m,T1,I,V2,U2. ⬆[l,m] T1 ≡  ⓕ{I} V2. U2 →
228                       ∃∃V1,U1. ⬆[l,m] V1 ≡ V2 & ⬆[l,m] U1 ≡ U2 &
229                                T1 = ⓕ{I} V1. U1.
230 /2 width=3 by lift_inv_flat2_aux/ qed-.
231
232 lemma lift_inv_pair_xy_x: ∀l,m,I,V,T. ⬆[l, m] ②{I} V. T ≡ V → ⊥.
233 #l #m #J #V elim V -V
234 [ * #i #T #H
235   [ lapply (lift_inv_sort2 … H) -H #H destruct
236   | elim (lift_inv_lref2 … H) -H * #_ #H destruct
237   | lapply (lift_inv_gref2 … H) -H #H destruct
238   ]
239 | * [ #a ] #I #W2 #U2 #IHW2 #_ #T #H
240   [ elim (lift_inv_bind2 … H) -H #W1 #U1 #HW12 #_ #H destruct /2 width=2 by/
241   | elim (lift_inv_flat2 … H) -H #W1 #U1 #HW12 #_ #H destruct /2 width=2 by/
242   ]
243 ]
244 qed-.
245
246 lemma lift_inv_pair_xy_y: ∀I,T,V,l,m. ⬆[l, m] ②{I} V. T ≡ T → ⊥.
247 #J #T elim T -T
248 [ * #i #V #l #m #H
249   [ lapply (lift_inv_sort2 … H) -H #H destruct
250   | elim (lift_inv_lref2 … H) -H * #_ #H destruct
251   | lapply (lift_inv_gref2 … H) -H #H destruct
252   ]
253 | * [ #a ] #I #W2 #U2 #_ #IHU2 #V #l #m #H
254   [ elim (lift_inv_bind2 … H) -H #W1 #U1 #_ #HU12 #H destruct /2 width=4 by/
255   | elim (lift_inv_flat2 … H) -H #W1 #U1 #_ #HU12 #H destruct /2 width=4 by/
256   ]
257 ]
258 qed-.
259
260 (* Basic forward lemmas *****************************************************)
261
262 lemma lift_fwd_pair1: ∀I,T2,V1,U1,l,m. ⬆[l,m] ②{I}V1.U1 ≡ T2 →
263                       ∃∃V2,U2. ⬆[l,m] V1 ≡ V2 & T2 = ②{I}V2.U2.
264 * [ #a ] #I #T2 #V1 #U1 #l #m #H
265 [ elim (lift_inv_bind1 … H) -H /2 width=4 by ex2_2_intro/
266 |  elim (lift_inv_flat1 … H) -H /2 width=4 by ex2_2_intro/
267 ]
268 qed-.
269
270 lemma lift_fwd_pair2: ∀I,T1,V2,U2,l,m. ⬆[l,m] T1 ≡ ②{I}V2.U2 →
271                       ∃∃V1,U1. ⬆[l,m] V1 ≡ V2 & T1 = ②{I}V1.U1.
272 * [ #a ] #I #T1 #V2 #U2 #l #m #H
273 [ elim (lift_inv_bind2 … H) -H /2 width=4 by ex2_2_intro/
274 |  elim (lift_inv_flat2 … H) -H /2 width=4 by ex2_2_intro/
275 ]
276 qed-.
277
278 lemma lift_fwd_tw: ∀l,m,T1,T2. ⬆[l, m] T1 ≡ T2 → ♯{T1} = ♯{T2}.
279 #l #m #T1 #T2 #H elim H -l -m -T1 -T2 normalize //
280 qed-.
281
282 lemma lift_simple_dx: ∀l,m,T1,T2. ⬆[l, m] T1 ≡ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
283 #l #m #T1 #T2 #H elim H -l -m -T1 -T2 //
284 #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #_ #_ #H
285 elim (simple_inv_bind … H)
286 qed-.
287
288 lemma lift_simple_sn: ∀l,m,T1,T2. ⬆[l, m] T1 ≡ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
289 #l #m #T1 #T2 #H elim H -l -m -T1 -T2 //
290 #a #I #V1 #V2 #T1 #T2 #l #m #_ #_ #_ #_ #H
291 elim (simple_inv_bind … H)
292 qed-.
293
294 (* Basic properties *********************************************************)
295
296 lemma lift_lref_ge_minus: ∀l,m,i. l + m ≤ i → ⬆[l, m] #(i - m) ≡ #i.
297 #l #m #i #H >(plus_minus_m_m i m) in ⊢ (? ? ? ? %); /3 width=2 by lift_lref_ge, le_plus_to_minus_r, le_plus_b/
298 qed.
299
300 lemma lift_lref_ge_minus_eq: ∀l,m,i,j. l + m ≤ i → j = i - m → ⬆[l, m] #j ≡ #i.
301 /2 width=1 by lift_lref_ge_minus/ qed-.
302
303 lemma lift_refl: ∀T,l. ⬆[l, 0] T ≡ T.
304 #T elim T -T
305 [ * #i // #l elim (lt_or_ge i l) /2 width=1 by lift_lref_lt, lift_lref_ge/
306 | * /2 width=1 by lift_bind, lift_flat/
307 ]
308 qed.
309
310 lemma lift_total: ∀T1,l,m. ∃T2. ⬆[l,m] T1 ≡ T2.
311 #T1 elim T1 -T1
312 [ * #i /2 width=2 by lift_sort, lift_gref, ex_intro/
313   #l #m elim (lt_or_ge i l) /3 width=2 by lift_lref_lt, lift_lref_ge, ex_intro/
314 | * [ #a ] #I #V1 #T1 #IHV1 #IHT1 #l #m
315   elim (IHV1 l m) -IHV1 #V2 #HV12
316   [ elim (IHT1 (l+1) m) -IHT1 /3 width=2 by lift_bind, ex_intro/
317   | elim (IHT1 l m) -IHT1 /3 width=2 by lift_flat, ex_intro/
318   ]
319 ]
320 qed.
321
322 lemma lift_split: ∀l1,m2,T1,T2. ⬆[l1, m2] T1 ≡ T2 →
323                   ∀l2,m1. l1 ≤ l2 → l2 ≤ l1 + m1 → m1 ≤ m2 →
324                   ∃∃T. ⬆[l1, m1] T1 ≡ T & ⬆[l2, m2 - m1] T ≡ T2.
325 #l1 #m2 #T1 #T2 #H elim H -l1 -m2 -T1 -T2
326 [ /3 width=3 by lift_sort, ex2_intro/
327 | #i #l1 #m2 #Hil1 #l2 #m1 #Hl12 #_ #_
328   lapply (lt_to_le_to_lt … Hil1 Hl12) -Hl12 #Hil2 /4 width=3 by lift_lref_lt, ex2_intro/
329 | #i #l1 #m2 #Hil1 #l2 #m1 #_ #Hl21 #Hm12
330   lapply (transitive_le … (i+m1) Hl21 ?) /2 width=1 by monotonic_le_plus_l/ -Hl21 #Hl21
331   >(plus_minus_m_m m2 m1 ?) /3 width=3 by lift_lref_ge, ex2_intro/
332 | /3 width=3 by lift_gref, ex2_intro/
333 | #a #I #V1 #V2 #T1 #T2 #l1 #m2 #_ #_ #IHV #IHT #l2 #m1 #Hl12 #Hl21 #Hm12
334   elim (IHV … Hl12 Hl21 Hm12) -IHV #V0 #HV0a #HV0b
335   elim (IHT (l2+1) … ? ? Hm12) /3 width=5 by lift_bind, monotonic_le_plus_l, ex2_intro/
336 | #I #V1 #V2 #T1 #T2 #l1 #m2 #_ #_ #IHV #IHT #l2 #m1 #Hl12 #Hl21 #Hm12
337   elim (IHV … Hl12 Hl21 Hm12) -IHV #V0 #HV0a #HV0b
338   elim (IHT l2 … ? ? Hm12) /3 width=5 by lift_flat, ex2_intro/
339 ]
340 qed.
341
342 lemma is_lift_dec: ∀T2,l,m. Decidable (∃T1. ⬆[l,m] T1 ≡ T2).
343 #T1 elim T1 -T1
344 [ * [1,3: /3 width=2 by lift_sort, lift_gref, ex_intro, or_introl/ ] #i #l #m
345   elim (lt_or_ge i l) #Hli
346   [ /4 width=3 by lift_lref_lt, ex_intro, or_introl/
347   | elim (lt_or_ge i (l + m)) #Hilm
348     [ @or_intror * #T1 #H elim (lift_inv_lref2_be … H Hli Hilm)
349     | -Hli /4 width=2 by lift_lref_ge_minus, ex_intro, or_introl/
350     ]
351   ]
352 | * [ #a ] #I #V2 #T2 #IHV2 #IHT2 #l #m
353   [ elim (IHV2 l m) -IHV2
354     [ * #V1 #HV12 elim (IHT2 (l+1) m) -IHT2
355       [ * #T1 #HT12 @or_introl /3 width=2 by lift_bind, ex_intro/
356       | -V1 #HT2 @or_intror * #X #H
357         elim (lift_inv_bind2 … H) -H /3 width=2 by ex_intro/
358       ]
359     | -IHT2 #HV2 @or_intror * #X #H
360       elim (lift_inv_bind2 … H) -H /3 width=2 by ex_intro/
361     ]
362   | elim (IHV2 l m) -IHV2
363     [ * #V1 #HV12 elim (IHT2 l m) -IHT2
364       [ * #T1 #HT12 /4 width=2 by lift_flat, ex_intro, or_introl/
365       | -V1 #HT2 @or_intror * #X #H
366         elim (lift_inv_flat2 … H) -H /3 width=2 by ex_intro/
367       ]
368     | -IHT2 #HV2 @or_intror * #X #H
369       elim (lift_inv_flat2 … H) -H /3 width=2 by ex_intro/
370     ]
371   ]
372 ]
373 qed.