]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/relocation/lifts.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[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 lemma lifts_inv_push_zero_sn (f):
291       ∀X. ⇧*[⫯f]#0 ≘ X → #0 = X.
292 #f #X #H
293 elim (lifts_inv_lref1 … H) -H #i #Hi #H destruct
294 lapply (at_inv_ppx … Hi ???) -Hi //
295 qed-.
296
297 lemma lifts_inv_push_succ_sn (f) (i1):
298       ∀X. ⇧*[⫯f]#(↑i1) ≘ X →
299       ∃∃i2. ⇧*[f]#i1 ≘ #i2 & #(↑i2) = X.
300 #f #i1 #X #H
301 elim (lifts_inv_lref1 … H) -H #j #Hij #H destruct
302 elim (at_inv_npx … Hij) -Hij [|*: // ] #i2 #Hi12 #H destruct
303 /3 width=3 by lifts_lref, ex2_intro/
304 qed-.
305
306 (* Inversion lemmas with uniform relocations ********************************)
307
308 lemma lifts_inv_lref1_uni: ∀l,Y,i. ⇧*[l] #i ≘ Y → Y = #(l+i).
309 #l #Y #i1 #H elim (lifts_inv_lref1 … H) -H /4 width=4 by at_mono, eq_f/
310 qed-.
311
312 lemma lifts_inv_lref2_uni: ∀l,X,i2. ⇧*[l] X ≘ #i2 →
313                            ∃∃i1. X = #i1 & i2 = l + i1.
314 #l #X #i2 #H elim (lifts_inv_lref2 … H) -H
315 /3 width=3 by at_inv_uni, ex2_intro/
316 qed-.
317
318 lemma lifts_inv_lref2_uni_ge: ∀l,X,i. ⇧*[l] X ≘ #(l + i) → X = #i.
319 #l #X #i2 #H elim (lifts_inv_lref2_uni … H) -H
320 #i1 #H1 #H2 destruct /4 width=2 by injective_plus_r, eq_f, sym_eq/
321 qed-.
322
323 lemma lifts_inv_lref2_uni_lt: ∀l,X,i. ⇧*[l] X ≘ #i → i < l → ⊥.
324 #l #X #i2 #H elim (lifts_inv_lref2_uni … H) -H
325 #i1 #_ #H1 #H2 destruct /2 width=4 by lt_le_false/
326 qed-.
327
328 (* Basic forward lemmas *****************************************************)
329
330 (* Basic_2A1: includes: lift_inv_O2 *)
331 lemma lifts_fwd_isid: ∀f,T1,T2. ⇧*[f] T1 ≘ T2 → 𝐈❪f❫ → T1 = T2.
332 #f #T1 #T2 #H elim H -f -T1 -T2
333 /4 width=3 by isid_inv_at_mono, isid_push, eq_f2, eq_f/
334 qed-.
335
336 (* Basic_2A1: includes: lift_fwd_pair1 *)
337 lemma lifts_fwd_pair1: ∀f:rtmap. ∀I,V1,T1,Y. ⇧*[f] ②[I]V1.T1 ≘ Y →
338                        ∃∃V2,T2. ⇧*[f] V1 ≘ V2 & Y = ②[I]V2.T2.
339 #f * [ #p ] #I #V1 #T1 #Y #H
340 [ elim (lifts_inv_bind1 … H) -H /2 width=4 by ex2_2_intro/
341 | elim (lifts_inv_flat1 … H) -H /2 width=4 by ex2_2_intro/
342 ]
343 qed-.
344
345 (* Basic_2A1: includes: lift_fwd_pair2 *)
346 lemma lifts_fwd_pair2: ∀f:rtmap. ∀I,V2,T2,X. ⇧*[f] X ≘ ②[I]V2.T2 →
347                        ∃∃V1,T1. ⇧*[f] V1 ≘ V2 & X = ②[I]V1.T1.
348 #f * [ #p ] #I #V2 #T2 #X #H
349 [ elim (lifts_inv_bind2 … H) -H /2 width=4 by ex2_2_intro/
350 | elim (lifts_inv_flat2 … H) -H /2 width=4 by ex2_2_intro/
351 ]
352 qed-.
353
354 (* Basic properties *********************************************************)
355
356 lemma liftable2_sn_dx (R): symmetric … R → liftable2_sn R → liftable2_dx R.
357 #R #H2R #H1R #T1 #T2 #HT12 #f #U2 #HTU2
358 elim (H1R … T1 … HTU2) -H1R /3 width=3 by ex2_intro/
359 qed-.
360
361 lemma deliftable2_sn_dx (R): symmetric … R → deliftable2_sn R → deliftable2_dx R.
362 #R #H2R #H1R #U1 #U2 #HU12 #f #T2 #HTU2
363 elim (H1R … U1 … HTU2) -H1R /3 width=3 by ex2_intro/
364 qed-.
365
366 lemma lifts_eq_repl_back: ∀T1,T2. eq_repl_back … (λf. ⇧*[f] T1 ≘ T2).
367 #T1 #T2 #f1 #H elim H -T1 -T2 -f1
368 /4 width=5 by lifts_flat, lifts_bind, lifts_lref, at_eq_repl_back, eq_push/
369 qed-.
370
371 lemma lifts_eq_repl_fwd: ∀T1,T2. eq_repl_fwd … (λf. ⇧*[f] T1 ≘ T2).
372 #T1 #T2 @eq_repl_sym /2 width=3 by lifts_eq_repl_back/ (**) (* full auto fails *)
373 qed-.
374
375 (* Basic_1: includes: lift_r *)
376 (* Basic_2A1: includes: lift_refl *)
377 lemma lifts_refl: ∀T,f. 𝐈❪f❫ → ⇧*[f] T ≘ T.
378 #T elim T -T *
379 /4 width=3 by lifts_flat, lifts_bind, lifts_lref, isid_inv_at, isid_push/
380 qed.
381
382 (* Basic_2A1: includes: lift_total *)
383 lemma lifts_total: ∀T1,f. ∃T2. ⇧*[f] T1 ≘ T2.
384 #T1 elim T1 -T1 *
385 /3 width=2 by lifts_lref, lifts_sort, lifts_gref, ex_intro/
386 [ #p ] #I #V1 #T1 #IHV1 #IHT1 #f
387 elim (IHV1 f) -IHV1 #V2 #HV12
388 [ elim (IHT1 (⫯f)) -IHT1 /3 width=2 by lifts_bind, ex_intro/
389 | elim (IHT1 f) -IHT1 /3 width=2 by lifts_flat, ex_intro/
390 ]
391 qed-.
392
393 lemma lifts_push_zero (f): ⇧*[⫯f]#0 ≘ #0.
394 /2 width=1 by lifts_lref/ qed.
395
396 lemma lifts_push_lref (f) (i1) (i2): ⇧*[f]#i1 ≘ #i2 → ⇧*[⫯f]#(↑i1) ≘ #(↑i2).
397 #f1 #i1 #i2 #H
398 elim (lifts_inv_lref1 … H) -H #j #Hij #H destruct
399 /3 width=7 by lifts_lref, at_push/
400 qed.
401
402 lemma lifts_lref_uni: ∀l,i. ⇧*[l] #i ≘ #(l+i).
403 #l elim l -l /2 width=1 by lifts_lref/
404 qed.
405
406 (* Basic_1: includes: lift_free (right to left) *)
407 (* Basic_2A1: includes: lift_split *)
408 lemma lifts_split_trans: ∀f,T1,T2. ⇧*[f] T1 ≘ T2 →
409                          ∀f1,f2. f2 ⊚ f1 ≘ f →
410                          ∃∃T. ⇧*[f1] T1 ≘ T & ⇧*[f2] T ≘ T2.
411 #f #T1 #T2 #H elim H -f -T1 -T2
412 [ /3 width=3 by lifts_sort, ex2_intro/
413 | #f #i1 #i2 #Hi #f1 #f2 #Ht elim (after_at_fwd … Hi … Ht) -Hi -Ht
414   /3 width=3 by lifts_lref, ex2_intro/
415 | /3 width=3 by lifts_gref, ex2_intro/
416 | #f #p #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f1 #f2 #Ht
417   elim (IHV … Ht) elim (IHT (⫯f1) (⫯f2)) -IHV -IHT
418   /3 width=5 by lifts_bind, after_O2, ex2_intro/
419 | #f #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f1 #f2 #Ht
420   elim (IHV … Ht) elim (IHT … Ht) -IHV -IHT -Ht
421   /3 width=5 by lifts_flat, ex2_intro/
422 ]
423 qed-.
424
425 (* Note: apparently, this was missing in Basic_2A1 *)
426 lemma lifts_split_div: ∀f1,T1,T2. ⇧*[f1] T1 ≘ T2 →
427                        ∀f2,f. f2 ⊚ f1 ≘ f →
428                        ∃∃T. ⇧*[f2] T2 ≘ T & ⇧*[f] T1 ≘ T.
429 #f1 #T1 #T2 #H elim H -f1 -T1 -T2
430 [ /3 width=3 by lifts_sort, ex2_intro/
431 | #f1 #i1 #i2 #Hi #f2 #f #Ht elim (after_at1_fwd … Hi … Ht) -Hi -Ht
432   /3 width=3 by lifts_lref, ex2_intro/
433 | /3 width=3 by lifts_gref, ex2_intro/
434 | #f1 #p #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f2 #f #Ht
435   elim (IHV … Ht) elim (IHT (⫯f2) (⫯f)) -IHV -IHT
436   /3 width=5 by lifts_bind, after_O2, ex2_intro/
437 | #f1 #I #V1 #V2 #T1 #T2 #_ #_ #IHV #IHT #f2 #f #Ht
438   elim (IHV … Ht) elim (IHT … Ht) -IHV -IHT -Ht
439   /3 width=5 by lifts_flat, ex2_intro/
440 ]
441 qed-.
442
443 (* Basic_1: includes: dnf_dec2 dnf_dec *)
444 (* Basic_2A1: includes: is_lift_dec *)
445 lemma is_lifts_dec: ∀T2,f. Decidable (∃T1. ⇧*[f] T1 ≘ T2).
446 #T1 elim T1 -T1
447 [ * [1,3: /3 width=2 by lifts_sort, lifts_gref, ex_intro, or_introl/ ]
448   #i2 #f elim (is_at_dec f i2) //
449   [ * /4 width=3 by lifts_lref, ex_intro, or_introl/
450   | #H @or_intror *
451     #X #HX elim (lifts_inv_lref2 … HX) -HX
452     /3 width=2 by ex_intro/
453   ]
454 | * [ #p ] #I #V2 #T2 #IHV2 #IHT2 #f
455   [ elim (IHV2 f) -IHV2
456     [ * #V1 #HV12 elim (IHT2 (⫯f)) -IHT2
457       [ * #T1 #HT12 @or_introl /3 width=2 by lifts_bind, ex_intro/
458       | -V1 #HT2 @or_intror * #X #H
459         elim (lifts_inv_bind2 … H) -H /3 width=2 by ex_intro/
460       ]
461     | -IHT2 #HV2 @or_intror * #X #H
462       elim (lifts_inv_bind2 … H) -H /3 width=2 by ex_intro/
463     ]
464   | elim (IHV2 f) -IHV2
465     [ * #V1 #HV12 elim (IHT2 f) -IHT2
466       [ * #T1 #HT12 /4 width=2 by lifts_flat, ex_intro, or_introl/
467       | -V1 #HT2 @or_intror * #X #H
468         elim (lifts_inv_flat2 … H) -H /3 width=2 by ex_intro/
469       ]
470     | -IHT2 #HV2 @or_intror * #X #H
471       elim (lifts_inv_flat2 … H) -H /3 width=2 by ex_intro/
472     ]
473   ]
474 ]
475 qed-.
476
477 (* Properties with uniform relocation ***************************************)
478
479 lemma lifts_uni: ∀n1,n2,T,U. ⇧*[𝐔❨n1❩∘𝐔❨n2❩] T ≘ U → ⇧*[n1+n2] T ≘ U.
480 /3 width=4 by lifts_eq_repl_back, after_inv_total/ qed.
481
482 (* Basic_2A1: removed theorems 14:
483               lifts_inv_nil lifts_inv_cons
484               lift_inv_Y1 lift_inv_Y2 lift_inv_lref_Y1 lift_inv_lref_Y2 lift_lref_Y lift_Y1
485               lift_lref_lt_eq lift_lref_ge_eq lift_lref_plus lift_lref_pred
486               lift_lref_ge_minus lift_lref_ge_minus_eq
487 *)
488 (* Basic_1: removed theorems 8:
489             lift_lref_gt
490             lift_head lift_gen_head
491             lift_weight_map lift_weight lift_weight_add lift_weight_add_O
492             lift_tlt_dx
493 *)