]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/relocation/lifts.ma
some restyling ...
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / relocation / lifts.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_2/relocation/nstream_after.ma".
16 include "static_2/notation/relations/rliftstar_3.ma".
17 include "static_2/syntax/term.ma".
18
19 (* GENERIC RELOCATION FOR TERMS *********************************************)
20
21 (* Basic_1: includes:
22             lift_sort lift_lref_lt lift_lref_ge lift_bind lift_flat
23             lifts_nil lifts_cons
24 *)
25 inductive lifts: rtmap → relation term ≝
26 | lifts_sort: ∀f,s. lifts f (⋆s) (⋆s)
27 | lifts_lref: ∀f,i1,i2. @⦃i1,f⦄ ≘ i2 → lifts f (#i1) (#i2)
28 | lifts_gref: ∀f,l. lifts f (§l) (§l)
29 | lifts_bind: ∀f,p,I,V1,V2,T1,T2.
30               lifts f V1 V2 → lifts (⫯f) T1 T2 →
31               lifts f (ⓑ{p,I}V1.T1) (ⓑ{p,I}V2.T2)
32 | lifts_flat: ∀f,I,V1,V2,T1,T2.
33               lifts f V1 V2 → lifts f T1 T2 →
34               lifts f (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
35 .
36
37 interpretation "uniform relocation (term)"
38    'RLiftStar i T1 T2 = (lifts (uni i) T1 T2).
39
40 interpretation "generic relocation (term)"
41    'RLiftStar f T1 T2 = (lifts f T1 T2).
42
43 definition liftable2_sn: predicate (relation term) ≝
44                          λR. ∀T1,T2. R T1 T2 → ∀f,U1. ⬆*[f] T1 ≘ U1 → 
45                          ∃∃U2. ⬆*[f] T2 ≘ U2 & R U1 U2.
46
47 definition deliftable2_sn: predicate (relation term) ≝
48                            λR. ∀U1,U2. R U1 U2 → ∀f,T1. ⬆*[f] T1 ≘ U1 →
49                            ∃∃T2. ⬆*[f] T2 ≘ U2 & R T1 T2.
50
51 definition liftable2_bi: predicate (relation term) ≝
52                          λR. ∀T1,T2. R T1 T2 → ∀f,U1. ⬆*[f] T1 ≘ U1 → 
53                          ∀U2. ⬆*[f] T2 ≘ U2 → R U1 U2.
54
55 definition deliftable2_bi: predicate (relation term) ≝
56                            λR. ∀U1,U2. R U1 U2 → ∀f,T1. ⬆*[f] T1 ≘ U1 →
57                            ∀T2. ⬆*[f] T2 ≘ U2 → R T1 T2.
58
59 definition liftable2_dx: predicate (relation term) ≝
60                          λR. ∀T1,T2. R T1 T2 → ∀f,U2. ⬆*[f] T2 ≘ U2 →
61                          ∃∃U1. ⬆*[f] T1 ≘ U1 & R U1 U2.
62
63 definition deliftable2_dx: predicate (relation term) ≝
64                            λR. ∀U1,U2. R U1 U2 → ∀f,T2. ⬆*[f] T2 ≘ U2 →
65                            ∃∃T1. ⬆*[f] T1 ≘ U1 & R T1 T2.
66
67 (* Basic inversion lemmas ***************************************************)
68
69 fact lifts_inv_sort1_aux: ∀f,X,Y. ⬆*[f] X ≘ Y → ∀s. X = ⋆s → Y = ⋆s.
70 #f #X #Y * -f -X -Y //
71 [ #f #i1 #i2 #_ #x #H destruct
72 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
73 | #f #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
74 ]
75 qed-.
76
77 (* Basic_1: was: lift1_sort *)
78 (* Basic_2A1: includes: lift_inv_sort1 *)
79 lemma lifts_inv_sort1: ∀f,Y,s. ⬆*[f] ⋆s ≘ Y → Y = ⋆s.
80 /2 width=4 by lifts_inv_sort1_aux/ qed-.
81
82 fact lifts_inv_lref1_aux: ∀f,X,Y. ⬆*[f] X ≘ Y → ∀i1. X = #i1 →
83                           ∃∃i2. @⦃i1,f⦄ ≘ i2 & Y = #i2.
84 #f #X #Y * -f -X -Y
85 [ #f #s #x #H destruct
86 | #f #i1 #i2 #Hi12 #x #H destruct /2 width=3 by ex2_intro/
87 | #f #l #x #H destruct
88 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
89 | #f #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
90 ]
91 qed-.
92
93 (* Basic_1: was: lift1_lref *)
94 (* Basic_2A1: includes: lift_inv_lref1 lift_inv_lref1_lt lift_inv_lref1_ge *)
95 lemma lifts_inv_lref1: ∀f,Y,i1. ⬆*[f] #i1 ≘ Y →
96                        ∃∃i2. @⦃i1,f⦄ ≘ i2 & Y = #i2.
97 /2 width=3 by lifts_inv_lref1_aux/ qed-.
98
99 fact lifts_inv_gref1_aux: ∀f,X,Y. ⬆*[f] X ≘ Y → ∀l. X = §l → Y = §l.
100 #f #X #Y * -f -X -Y //
101 [ #f #i1 #i2 #_ #x #H destruct
102 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
103 | #f #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
104 ]
105 qed-.
106
107 (* Basic_2A1: includes: lift_inv_gref1 *)
108 lemma lifts_inv_gref1: ∀f,Y,l. ⬆*[f] §l ≘ Y → Y = §l.
109 /2 width=4 by lifts_inv_gref1_aux/ qed-.
110
111 fact lifts_inv_bind1_aux: ∀f,X,Y. ⬆*[f] X ≘ Y →
112                           ∀p,I,V1,T1. X = ⓑ{p,I}V1.T1 →
113                           ∃∃V2,T2. ⬆*[f] V1 ≘ V2 & ⬆*[⫯f] T1 ≘ T2 &
114                                    Y = ⓑ{p,I}V2.T2.
115 #f #X #Y * -f -X -Y
116 [ #f #s #q #J #W1 #U1 #H destruct
117 | #f #i1 #i2 #_ #q #J #W1 #U1 #H destruct
118 | #f #l #b #J #W1 #U1 #H destruct
119 | #f #p #I #V1 #V2 #T1 #T2 #HV12 #HT12 #q #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
120 | #f #I #V1 #V2 #T1 #T2 #_ #_ #q #J #W1 #U1 #H destruct
121 ]
122 qed-.
123
124 (* Basic_1: was: lift1_bind *)
125 (* Basic_2A1: includes: lift_inv_bind1 *)
126 lemma lifts_inv_bind1: ∀f,p,I,V1,T1,Y. ⬆*[f] ⓑ{p,I}V1.T1 ≘ Y →
127                        ∃∃V2,T2. ⬆*[f] V1 ≘ V2 & ⬆*[⫯f] T1 ≘ T2 &
128                                 Y = ⓑ{p,I}V2.T2.
129 /2 width=3 by lifts_inv_bind1_aux/ qed-.
130
131 fact lifts_inv_flat1_aux: ∀f:rtmap. ∀X,Y. ⬆*[f] X ≘ Y →
132                           ∀I,V1,T1. X = ⓕ{I}V1.T1 →
133                           ∃∃V2,T2. ⬆*[f] V1 ≘ V2 & ⬆*[f] T1 ≘ T2 &
134                                    Y = ⓕ{I}V2.T2.
135 #f #X #Y * -f -X -Y
136 [ #f #s #J #W1 #U1 #H destruct
137 | #f #i1 #i2 #_ #J #W1 #U1 #H destruct
138 | #f #l #J #W1 #U1 #H destruct
139 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #J #W1 #U1 #H destruct
140 | #f #I #V1 #V2 #T1 #T2 #HV12 #HT12 #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
141 ]
142 qed-.
143
144 (* Basic_1: was: lift1_flat *)
145 (* Basic_2A1: includes: lift_inv_flat1 *)
146 lemma lifts_inv_flat1: ∀f:rtmap. ∀I,V1,T1,Y. ⬆*[f] ⓕ{I}V1.T1 ≘ Y →
147                        ∃∃V2,T2. ⬆*[f] V1 ≘ V2 & ⬆*[f] T1 ≘ T2 &
148                                 Y = ⓕ{I}V2.T2.
149 /2 width=3 by lifts_inv_flat1_aux/ qed-.
150
151 fact lifts_inv_sort2_aux: ∀f,X,Y. ⬆*[f] X ≘ Y → ∀s. Y = ⋆s → X = ⋆s.
152 #f #X #Y * -f -X -Y //
153 [ #f #i1 #i2 #_ #x #H destruct
154 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
155 | #f #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
156 ]
157 qed-.
158
159 (* Basic_1: includes: lift_gen_sort *)
160 (* Basic_2A1: includes: lift_inv_sort2 *)
161 lemma lifts_inv_sort2: ∀f,X,s. ⬆*[f] X ≘ ⋆s → X = ⋆s.
162 /2 width=4 by lifts_inv_sort2_aux/ qed-.
163
164 fact lifts_inv_lref2_aux: ∀f,X,Y. ⬆*[f] X ≘ Y → ∀i2. Y = #i2 →
165                           ∃∃i1. @⦃i1,f⦄ ≘ i2 & X = #i1.
166 #f #X #Y * -f -X -Y
167 [ #f #s #x #H destruct
168 | #f #i1 #i2 #Hi12 #x #H destruct /2 width=3 by ex2_intro/
169 | #f #l #x #H destruct
170 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
171 | #f #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
172 ]
173 qed-.
174
175 (* Basic_1: includes: lift_gen_lref lift_gen_lref_lt lift_gen_lref_false lift_gen_lref_ge *)
176 (* Basic_2A1: includes: lift_inv_lref2 lift_inv_lref2_lt lift_inv_lref2_be lift_inv_lref2_ge lift_inv_lref2_plus *)
177 lemma lifts_inv_lref2: ∀f,X,i2. ⬆*[f] X ≘ #i2 →
178                        ∃∃i1. @⦃i1,f⦄ ≘ i2 & X = #i1.
179 /2 width=3 by lifts_inv_lref2_aux/ qed-.
180
181 fact lifts_inv_gref2_aux: ∀f,X,Y. ⬆*[f] X ≘ Y → ∀l. Y = §l → X = §l.
182 #f #X #Y * -f -X -Y //
183 [ #f #i1 #i2 #_ #x #H destruct
184 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
185 | #f #I #V1 #V2 #T1 #T2 #_ #_ #x #H destruct
186 ]
187 qed-.
188
189 (* Basic_2A1: includes: lift_inv_gref1 *)
190 lemma lifts_inv_gref2: ∀f,X,l. ⬆*[f] X ≘ §l → X = §l.
191 /2 width=4 by lifts_inv_gref2_aux/ qed-.
192
193 fact lifts_inv_bind2_aux: ∀f,X,Y. ⬆*[f] X ≘ Y →
194                           ∀p,I,V2,T2. Y = ⓑ{p,I}V2.T2 →
195                           ∃∃V1,T1. ⬆*[f] V1 ≘ V2 & ⬆*[⫯f] T1 ≘ T2 &
196                                    X = ⓑ{p,I}V1.T1.
197 #f #X #Y * -f -X -Y
198 [ #f #s #q #J #W2 #U2 #H destruct
199 | #f #i1 #i2 #_ #q #J #W2 #U2 #H destruct
200 | #f #l #q #J #W2 #U2 #H destruct
201 | #f #p #I #V1 #V2 #T1 #T2 #HV12 #HT12 #q #J #W2 #U2 #H destruct /2 width=5 by ex3_2_intro/
202 | #f #I #V1 #V2 #T1 #T2 #_ #_ #q #J #W2 #U2 #H destruct
203 ]
204 qed-.
205
206 (* Basic_1: includes: lift_gen_bind *)
207 (* Basic_2A1: includes: lift_inv_bind2 *)
208 lemma lifts_inv_bind2: ∀f,p,I,V2,T2,X. ⬆*[f] X ≘ ⓑ{p,I}V2.T2 →
209                        ∃∃V1,T1. ⬆*[f] V1 ≘ V2 & ⬆*[⫯f] T1 ≘ T2 &
210                                 X = ⓑ{p,I}V1.T1.
211 /2 width=3 by lifts_inv_bind2_aux/ qed-.
212
213 fact lifts_inv_flat2_aux: ∀f:rtmap. ∀X,Y. ⬆*[f] X ≘ Y →
214                           ∀I,V2,T2. Y = ⓕ{I}V2.T2 →
215                           ∃∃V1,T1. ⬆*[f] V1 ≘ V2 & ⬆*[f] T1 ≘ T2 &
216                                    X = ⓕ{I}V1.T1.
217 #f #X #Y * -f -X -Y
218 [ #f #s #J #W2 #U2 #H destruct
219 | #f #i1 #i2 #_ #J #W2 #U2 #H destruct
220 | #f #l #J #W2 #U2 #H destruct
221 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #J #W2 #U2 #H destruct
222 | #f #I #V1 #V2 #T1 #T2 #HV12 #HT12 #J #W2 #U2 #H destruct /2 width=5 by ex3_2_intro/
223 ]
224 qed-.
225
226 (* Basic_1: includes: lift_gen_flat *)
227 (* Basic_2A1: includes: lift_inv_flat2 *)
228 lemma lifts_inv_flat2: ∀f:rtmap. ∀I,V2,T2,X. ⬆*[f] X ≘ ⓕ{I}V2.T2 →
229                        ∃∃V1,T1. ⬆*[f] V1 ≘ V2 & ⬆*[f] T1 ≘ T2 &
230                                 X = ⓕ{I}V1.T1.
231 /2 width=3 by lifts_inv_flat2_aux/ qed-.
232
233 (* Advanced inversion lemmas ************************************************)
234
235 lemma lifts_inv_atom1: ∀f,I,Y. ⬆*[f] ⓪{I} ≘ Y →
236                        ∨∨ ∃∃s. I = Sort s & Y = ⋆s
237                         | ∃∃i,j. @⦃i,f⦄ ≘ j & I = LRef i & Y = #j
238                         | ∃∃l. I = GRef l & Y = §l.
239 #f * #n #Y #H
240 [ lapply (lifts_inv_sort1 … H)
241 | elim (lifts_inv_lref1 … H)
242 | lapply (lifts_inv_gref1 … H)
243 ] -H /3 width=5 by or3_intro0, or3_intro1, or3_intro2, ex3_2_intro, ex2_intro/
244 qed-.
245
246 lemma lifts_inv_atom2: ∀f,I,X. ⬆*[f] X ≘ ⓪{I} →
247                        ∨∨ ∃∃s. X = ⋆s & I = Sort s
248                         | ∃∃i,j. @⦃i,f⦄ ≘ j & X = #i & I = LRef j
249                         | ∃∃l. X = §l & I = GRef l.
250 #f * #n #X #H
251 [ lapply (lifts_inv_sort2 … H)
252 | elim (lifts_inv_lref2 … H)
253 | lapply (lifts_inv_gref2 … H)
254 ] -H /3 width=5 by or3_intro0, or3_intro1, or3_intro2, ex3_2_intro, ex2_intro/
255 qed-.
256
257 (* Basic_2A1: includes: lift_inv_pair_xy_x *)
258 lemma lifts_inv_pair_xy_x: ∀f,I,V,T. ⬆*[f] ②{I}V.T ≘ V → ⊥.
259 #f #J #V elim V -V
260 [ * #i #U #H
261   [ lapply (lifts_inv_sort2 … H) -H #H destruct
262   | elim (lifts_inv_lref2 … H) -H
263     #x #_ #H destruct
264   | lapply (lifts_inv_gref2 … H) -H #H destruct
265   ]
266 | * [ #p ] #I #V2 #T2 #IHV2 #_ #U #H
267   [ elim (lifts_inv_bind2 … H) -H #V1 #T1 #HV12 #_ #H destruct /2 width=3 by/
268   | elim (lifts_inv_flat2 … H) -H #V1 #T1 #HV12 #_ #H destruct /2 width=3 by/
269   ]
270 ]
271 qed-.
272
273 (* Basic_1: includes: thead_x_lift_y_y *)
274 (* Basic_2A1: includes: lift_inv_pair_xy_y *)
275 lemma lifts_inv_pair_xy_y: ∀I,T,V,f. ⬆*[f] ②{I}V.T ≘ T → ⊥.
276 #J #T elim T -T
277 [ * #i #W #f #H
278   [ lapply (lifts_inv_sort2 … H) -H #H destruct
279   | elim (lifts_inv_lref2 … H) -H
280     #x #_ #H destruct
281   | lapply (lifts_inv_gref2 … H) -H #H destruct
282   ]
283 | * [ #p ] #I #V2 #T2 #_ #IHT2 #W #f #H
284   [ elim (lifts_inv_bind2 … H) -H #V1 #T1 #_ #HT12 #H destruct /2 width=4 by/
285   | elim (lifts_inv_flat2 … H) -H #V1 #T1 #_ #HT12 #H destruct /2 width=4 by/
286   ]
287 ]
288 qed-.
289
290 (* Inversion lemmas with uniform relocations ********************************)
291
292 lemma lifts_inv_lref1_uni: ∀l,Y,i. ⬆*[l] #i ≘ Y → Y = #(l+i).
293 #l #Y #i1 #H elim (lifts_inv_lref1 … H) -H /4 width=4 by at_mono, eq_f/
294 qed-.
295
296 lemma lifts_inv_lref2_uni: ∀l,X,i2. ⬆*[l] X ≘ #i2 →
297                            ∃∃i1. X = #i1 & i2 = l + i1.
298 #l #X #i2 #H elim (lifts_inv_lref2 … H) -H
299 /3 width=3 by at_inv_uni, ex2_intro/
300 qed-.
301
302 lemma lifts_inv_lref2_uni_ge: ∀l,X,i. ⬆*[l] X ≘ #(l + i) → X = #i.
303 #l #X #i2 #H elim (lifts_inv_lref2_uni … H) -H
304 #i1 #H1 #H2 destruct /4 width=2 by injective_plus_r, eq_f, sym_eq/
305 qed-.
306
307 lemma lifts_inv_lref2_uni_lt: ∀l,X,i. ⬆*[l] X ≘ #i → i < l → ⊥.
308 #l #X #i2 #H elim (lifts_inv_lref2_uni … H) -H
309 #i1 #_ #H1 #H2 destruct /2 width=4 by lt_le_false/
310 qed-.
311
312 (* Basic forward lemmas *****************************************************)
313
314 (* Basic_2A1: includes: lift_inv_O2 *)
315 lemma lifts_fwd_isid: ∀f,T1,T2. ⬆*[f] T1 ≘ T2 → 𝐈⦃f⦄ → T1 = T2.
316 #f #T1 #T2 #H elim H -f -T1 -T2
317 /4 width=3 by isid_inv_at_mono, isid_push, eq_f2, eq_f/
318 qed-.
319
320 (* Basic_2A1: includes: lift_fwd_pair1 *)
321 lemma lifts_fwd_pair1: ∀f:rtmap. ∀I,V1,T1,Y. ⬆*[f] ②{I}V1.T1 ≘ Y →
322                        ∃∃V2,T2. ⬆*[f] V1 ≘ V2 & Y = ②{I}V2.T2.
323 #f * [ #p ] #I #V1 #T1 #Y #H
324 [ elim (lifts_inv_bind1 … H) -H /2 width=4 by ex2_2_intro/
325 | elim (lifts_inv_flat1 … H) -H /2 width=4 by ex2_2_intro/
326 ]
327 qed-.
328
329 (* Basic_2A1: includes: lift_fwd_pair2 *)
330 lemma lifts_fwd_pair2: ∀f:rtmap. ∀I,V2,T2,X. ⬆*[f] X ≘ ②{I}V2.T2 →
331                        ∃∃V1,T1. ⬆*[f] V1 ≘ V2 & X = ②{I}V1.T1.
332 #f * [ #p ] #I #V2 #T2 #X #H
333 [ elim (lifts_inv_bind2 … H) -H /2 width=4 by ex2_2_intro/
334 | elim (lifts_inv_flat2 … H) -H /2 width=4 by ex2_2_intro/
335 ]
336 qed-.
337
338 (* Basic properties *********************************************************)
339
340 lemma liftable2_sn_dx (R): symmetric … R → liftable2_sn R → liftable2_dx R.
341 #R #H2R #H1R #T1 #T2 #HT12 #f #U2 #HTU2
342 elim (H1R … T1 … HTU2) -H1R /3 width=3 by ex2_intro/
343 qed-.
344
345 lemma deliftable2_sn_dx (R): symmetric … R → deliftable2_sn R → deliftable2_dx R.
346 #R #H2R #H1R #U1 #U2 #HU12 #f #T2 #HTU2
347 elim (H1R … U1 … HTU2) -H1R /3 width=3 by ex2_intro/
348 qed-.
349
350 lemma lifts_eq_repl_back: ∀T1,T2. eq_repl_back … (λf. ⬆*[f] T1 ≘ T2).
351 #T1 #T2 #f1 #H elim H -T1 -T2 -f1
352 /4 width=5 by lifts_flat, lifts_bind, lifts_lref, at_eq_repl_back, eq_push/
353 qed-.
354
355 lemma lifts_eq_repl_fwd: ∀T1,T2. eq_repl_fwd … (λf. ⬆*[f] T1 ≘ T2).
356 #T1 #T2 @eq_repl_sym /2 width=3 by lifts_eq_repl_back/ (**) (* full auto fails *)
357 qed-.
358
359 (* Basic_1: includes: lift_r *)
360 (* Basic_2A1: includes: lift_refl *)
361 lemma lifts_refl: ∀T,f. 𝐈⦃f⦄ → ⬆*[f] T ≘ T.
362 #T elim T -T *
363 /4 width=3 by lifts_flat, lifts_bind, lifts_lref, isid_inv_at, isid_push/
364 qed.
365
366 (* Basic_2A1: includes: lift_total *)
367 lemma lifts_total: ∀T1,f. ∃T2. ⬆*[f] T1 ≘ T2.
368 #T1 elim T1 -T1 *
369 /3 width=2 by lifts_lref, lifts_sort, lifts_gref, ex_intro/
370 [ #p ] #I #V1 #T1 #IHV1 #IHT1 #f
371 elim (IHV1 f) -IHV1 #V2 #HV12
372 [ elim (IHT1 (⫯f)) -IHT1 /3 width=2 by lifts_bind, ex_intro/
373 | elim (IHT1 f) -IHT1 /3 width=2 by lifts_flat, ex_intro/
374 ]
375 qed-.
376
377 lemma lifts_push_zero (f): ⬆*[⫯f]#0 ≘ #0.
378 /2 width=1 by lifts_lref/ qed.
379
380 lemma lifts_push_lref (f) (i1) (i2): ⬆*[f]#i1 ≘ #i2 → ⬆*[⫯f]#(↑i1) ≘ #(↑i2).
381 #f1 #i1 #i2 #H
382 elim (lifts_inv_lref1 … H) -H #j #Hij #H destruct
383 /3 width=7 by lifts_lref, at_push/
384 qed.
385
386 lemma lifts_lref_uni: ∀l,i. ⬆*[l] #i ≘ #(l+i).
387 #l elim l -l /2 width=1 by lifts_lref/
388 qed.
389
390 (* Basic_1: includes: lift_free (right to left) *)
391 (* Basic_2A1: includes: lift_split *)
392 lemma lifts_split_trans: ∀f,T1,T2. ⬆*[f] T1 ≘ T2 →
393                          ∀f1,f2. f2 ⊚ f1 ≘ f →
394                          ∃∃T. ⬆*[f1] T1 ≘ T & ⬆*[f2] T ≘ T2.
395 #f #T1 #T2 #H elim H -f -T1 -T2
396 [ /3 width=3 by lifts_sort, ex2_intro/
397 | #f #i1 #i2 #Hi #f1 #f2 #Ht elim (after_at_fwd … Hi … Ht) -Hi -Ht
398   /3 width=3 by lifts_lref, ex2_intro/
399 | /3 width=3 by lifts_gref, ex2_intro/
400 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f1 #f2 #Ht
401   elim (IHV … Ht) elim (IHT (⫯f1) (⫯f2)) -IHV -IHT
402   /3 width=5 by lifts_bind, after_O2, ex2_intro/
403 | #f #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f1 #f2 #Ht
404   elim (IHV … Ht) elim (IHT … Ht) -IHV -IHT -Ht
405   /3 width=5 by lifts_flat, ex2_intro/
406 ]
407 qed-.
408
409 (* Note: apparently, this was missing in Basic_2A1 *)
410 lemma lifts_split_div: ∀f1,T1,T2. ⬆*[f1] T1 ≘ T2 →
411                        ∀f2,f. f2 ⊚ f1 ≘ f →
412                        ∃∃T. ⬆*[f2] T2 ≘ T & ⬆*[f] T1 ≘ T.
413 #f1 #T1 #T2 #H elim H -f1 -T1 -T2
414 [ /3 width=3 by lifts_sort, ex2_intro/
415 | #f1 #i1 #i2 #Hi #f2 #f #Ht elim (after_at1_fwd … Hi … Ht) -Hi -Ht
416   /3 width=3 by lifts_lref, ex2_intro/
417 | /3 width=3 by lifts_gref, ex2_intro/
418 | #f1 #p #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f2 #f #Ht
419   elim (IHV … Ht) elim (IHT (⫯f2) (⫯f)) -IHV -IHT
420   /3 width=5 by lifts_bind, after_O2, ex2_intro/
421 | #f1 #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f2 #f #Ht
422   elim (IHV … Ht) elim (IHT … Ht) -IHV -IHT -Ht
423   /3 width=5 by lifts_flat, ex2_intro/
424 ]
425 qed-.
426
427 (* Basic_1: includes: dnf_dec2 dnf_dec *)
428 (* Basic_2A1: includes: is_lift_dec *)
429 lemma is_lifts_dec: ∀T2,f. Decidable (∃T1. ⬆*[f] T1 ≘ T2).
430 #T1 elim T1 -T1
431 [ * [1,3: /3 width=2 by lifts_sort, lifts_gref, ex_intro, or_introl/ ]
432   #i2 #f elim (is_at_dec f i2) //
433   [ * /4 width=3 by lifts_lref, ex_intro, or_introl/
434   | #H @or_intror *
435     #X #HX elim (lifts_inv_lref2 … HX) -HX
436     /3 width=2 by ex_intro/
437   ]
438 | * [ #p ] #I #V2 #T2 #IHV2 #IHT2 #f
439   [ elim (IHV2 f) -IHV2
440     [ * #V1 #HV12 elim (IHT2 (⫯f)) -IHT2
441       [ * #T1 #HT12 @or_introl /3 width=2 by lifts_bind, ex_intro/
442       | -V1 #HT2 @or_intror * #X #H
443         elim (lifts_inv_bind2 … H) -H /3 width=2 by ex_intro/
444       ]
445     | -IHT2 #HV2 @or_intror * #X #H
446       elim (lifts_inv_bind2 … H) -H /3 width=2 by ex_intro/
447     ]
448   | elim (IHV2 f) -IHV2
449     [ * #V1 #HV12 elim (IHT2 f) -IHT2
450       [ * #T1 #HT12 /4 width=2 by lifts_flat, ex_intro, or_introl/
451       | -V1 #HT2 @or_intror * #X #H
452         elim (lifts_inv_flat2 … H) -H /3 width=2 by ex_intro/
453       ]
454     | -IHT2 #HV2 @or_intror * #X #H
455       elim (lifts_inv_flat2 … H) -H /3 width=2 by ex_intro/
456     ]
457   ]
458 ]
459 qed-.
460
461 (* Properties with uniform relocation ***************************************)
462
463 lemma lifts_uni: ∀n1,n2,T,U. ⬆*[𝐔❴n1❵∘𝐔❴n2❵] T ≘ U → ⬆*[n1+n2] T ≘ U.
464 /3 width=4 by lifts_eq_repl_back, after_inv_total/ qed.
465
466 (* Basic_2A1: removed theorems 14:
467               lifts_inv_nil lifts_inv_cons
468               lift_inv_Y1 lift_inv_Y2 lift_inv_lref_Y1 lift_inv_lref_Y2 lift_lref_Y lift_Y1
469               lift_lref_lt_eq lift_lref_ge_eq lift_lref_plus lift_lref_pred
470               lift_lref_ge_minus lift_lref_ge_minus_eq
471 *)
472 (* Basic_1: removed theorems 8:
473             lift_lref_gt            
474             lift_head lift_gen_head 
475             lift_weight_map lift_weight lift_weight_add lift_weight_add_O
476             lift_tlt_dx
477 *)