]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/relocation/ldrop.ma
commit of the "relocation" component with the new definition of ldrop,
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / ldrop.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/lib/bool.ma".
16 include "ground_2/lib/lstar.ma".
17 include "basic_2/notation/relations/rdrop_5.ma".
18 include "basic_2/notation/relations/rdrop_4.ma".
19 include "basic_2/notation/relations/rdrop_3.ma".
20 include "basic_2/grammar/lenv_length.ma".
21 include "basic_2/grammar/cl_restricted_weight.ma".
22 include "basic_2/relocation/lift.ma".
23
24 (* BASIC SLICING FOR LOCAL ENVIRONMENTS *************************************)
25
26 (* Basic_1: includes: drop_skip_bind *)
27 inductive ldrop (s:bool): relation4 nat nat lenv lenv ≝
28 | ldrop_atom: ∀d,e. (s = Ⓕ → e = 0) → ldrop s d e (⋆) (⋆)
29 | ldrop_pair: ∀I,L,V. ldrop s 0 0 (L.ⓑ{I}V) (L.ⓑ{I}V)
30 | ldrop_drop: ∀I,L1,L2,V,e. ldrop s 0 e L1 L2 → ldrop s 0 (e+1) (L1.ⓑ{I}V) L2
31 | ldrop_skip: ∀I,L1,L2,V1,V2,d,e.
32               ldrop s d e L1 L2 → ⇧[d, e] V2 ≡ V1 →
33               ldrop s (d+1) e (L1.ⓑ{I}V1) (L2.ⓑ{I}V2)
34 .
35
36 interpretation
37    "basic slicing (local environment) abstract"
38    'RDrop s d e L1 L2 = (ldrop s d e L1 L2).
39
40 interpretation
41    "basic slicing (local environment) general"
42    'RDrop d e L1 L2 = (ldrop true d e L1 L2).
43
44 interpretation
45    "basic slicing (local environment) lget"
46    'RDrop e L1 L2 = (ldrop false O e L1 L2).
47
48 definition l_liftable: predicate (lenv → relation term) ≝
49                        λR. ∀K,T1,T2. R K T1 T2 → ∀L,s,d,e. ⇩[s, d, e] L ≡ K →
50                        ∀U1. ⇧[d, e] T1 ≡ U1 → ∀U2. ⇧[d, e] T2 ≡ U2 → R L U1 U2.
51
52 definition l_deliftable_sn: predicate (lenv → relation term) ≝
53                             λR. ∀L,U1,U2. R L U1 U2 → ∀K,s,d,e. ⇩[s, d, e] L ≡ K →
54                             ∀T1. ⇧[d, e] T1 ≡ U1 →
55                             ∃∃T2. ⇧[d, e] T2 ≡ U2 & R K T1 T2.
56
57 definition dropable_sn: predicate (relation lenv) ≝
58                         λR. ∀L1,K1,s,d,e. ⇩[s, d, e] L1 ≡ K1 → ∀L2. R L1 L2 →
59                         ∃∃K2. R K1 K2 & ⇩[s, d, e] L2 ≡ K2.
60
61 definition dedropable_sn: predicate (relation lenv) ≝
62                           λR. ∀L1,K1,s,d,e. ⇩[s, d, e] L1 ≡ K1 → ∀K2. R K1 K2 →
63                           ∃∃L2. R L1 L2 & ⇩[s, d, e] L2 ≡ K2.
64
65 definition dropable_dx: predicate (relation lenv) ≝
66                         λR. ∀L1,L2. R L1 L2 → ∀K2,s,e. ⇩[s, 0, e] L2 ≡ K2 →
67                         ∃∃K1. ⇩[s, 0, e] L1 ≡ K1 & R K1 K2.
68
69 (* Basic inversion lemmas ***************************************************)
70
71 fact ldrop_inv_atom1_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → L1 = ⋆ →
72                           L2 = ⋆ ∧ (s = Ⓕ → e = 0).
73 #L1 #L2 #s #d #e * -L1 -L2 -d -e
74 [ /3 width=1 by conj/
75 | #I #L #V #H destruct
76 | #I #L1 #L2 #V #e #_ #H destruct
77 | #I #L1 #L2 #V1 #V2 #d #e #_ #_ #H destruct
78 ]
79 qed-.
80
81 (* Basic_1: was: drop_gen_sort *)
82 lemma ldrop_inv_atom1: ∀L2,s,d,e. ⇩[s, d, e] ⋆ ≡ L2 → L2 = ⋆ ∧ (s = Ⓕ → e = 0).
83 /2 width=4 by ldrop_inv_atom1_aux/ qed-.
84
85 fact ldrop_inv_O1_pair1_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → d = 0 →
86                              ∀K,I,V. L1 = K.ⓑ{I}V →
87                              (e = 0 ∧ L2 = K.ⓑ{I}V) ∨
88                              (0 < e ∧ ⇩[s, d, e-1] K ≡ L2).
89 #L1 #L2 #s #d #e * -L1 -L2 -d -e
90 [ #d #e #_ #_ #K #J #W #H destruct
91 | #I #L #V #_ #K #J #W #HX destruct /3 width=1 by or_introl, conj/
92 | #I #L1 #L2 #V #e #HL12 #_ #K #J #W #H destruct /3 width=1 by or_intror, conj/
93 | #I #L1 #L2 #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct
94 ]
95 qed-.
96
97 lemma ldrop_inv_O1_pair1: ∀I,K,L2,V,s,e. ⇩[s, 0, e] K. ⓑ{I} V ≡ L2 →
98                           (e = 0 ∧ L2 = K.ⓑ{I}V) ∨
99                           (0 < e ∧ ⇩[s, 0, e-1] K ≡ L2).
100 /2 width=3 by ldrop_inv_O1_pair1_aux/ qed-.
101
102 lemma ldrop_inv_pair1: ∀I,K,L2,V,s. ⇩[s, 0, 0] K.ⓑ{I}V ≡ L2 → L2 = K.ⓑ{I}V.
103 #I #K #L2 #V #s #H
104 elim (ldrop_inv_O1_pair1 … H) -H * // #H destruct
105 elim (lt_refl_false … H)
106 qed-.
107
108 (* Basic_1: was: drop_gen_drop *)
109 lemma ldrop_inv_drop1_lt: ∀I,K,L2,V,s,e.
110                           ⇩[s, 0, e] K.ⓑ{I}V ≡ L2 → 0 < e → ⇩[s, 0, e-1] K ≡ L2.
111 #I #K #L2 #V #s #e #H #He
112 elim (ldrop_inv_O1_pair1 … H) -H * // #H destruct
113 elim (lt_refl_false … He)
114 qed-.
115
116 lemma ldrop_inv_drop1: ∀I,K,L2,V,s,e.
117                        ⇩[s, 0, e+1] K.ⓑ{I}V ≡ L2 → ⇩[s, 0, e] K ≡ L2.
118 #I #K #L2 #V #s #e #H lapply (ldrop_inv_drop1_lt … H ?) -H //
119 qed-.
120
121 fact ldrop_inv_skip1_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → 0 < d →
122                           ∀I,K1,V1. L1 = K1.ⓑ{I}V1 →
123                           ∃∃K2,V2. ⇩[s, d-1, e] K1 ≡ K2 &
124                                    ⇧[d-1, e] V2 ≡ V1 &
125                                    L2 = K2.ⓑ{I}V2.
126 #L1 #L2 #s #d #e * -L1 -L2 -d -e
127 [ #d #e #_ #_ #J #K1 #W1 #H destruct
128 | #I #L #V #H elim (lt_refl_false … H)
129 | #I #L1 #L2 #V #e #_ #H elim (lt_refl_false … H)
130 | #I #L1 #L2 #V1 #V2 #d #e #HL12 #HV21 #_ #J #K1 #W1 #H destruct /2 width=5 by ex3_2_intro/
131 ]
132 qed-.
133
134 (* Basic_1: was: drop_gen_skip_l *)
135 lemma ldrop_inv_skip1: ∀I,K1,V1,L2,s,d,e. ⇩[s, d, e] K1.ⓑ{I}V1 ≡ L2 → 0 < d →
136                        ∃∃K2,V2. ⇩[s, d-1, e] K1 ≡ K2 &
137                                 ⇧[d-1, e] V2 ≡ V1 &
138                                 L2 = K2.ⓑ{I}V2.
139 /2 width=3 by ldrop_inv_skip1_aux/ qed-.
140
141 lemma ldrop_inv_O1_pair2: ∀I,K,V,s,e,L1. ⇩[s, 0, e] L1 ≡ K.ⓑ{I}V →
142                           (e = 0 ∧ L1 = K.ⓑ{I}V) ∨
143                           ∃∃I1,K1,V1. ⇩[s, 0, e-1] K1 ≡ K.ⓑ{I}V & L1 = K1.ⓑ{I1}V1 & 0 < e.
144 #I #K #V #s #e *
145 [ #H elim (ldrop_inv_atom1 … H) -H #H destruct
146 | #L1 #I1 #V1 #H
147   elim (ldrop_inv_O1_pair1 … H) -H *
148   [ #H1 #H2 destruct /3 width=1 by or_introl, conj/
149   | /3 width=5 by ex3_3_intro, or_intror/
150   ]
151 ]
152 qed-.
153
154 fact ldrop_inv_skip2_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → 0 < d →
155                           ∀I,K2,V2. L2 = K2.ⓑ{I}V2 →
156                           ∃∃K1,V1. ⇩[s, d-1, e] K1 ≡ K2 &
157                                    ⇧[d-1, e] V2 ≡ V1 &
158                                    L1 = K1.ⓑ{I}V1.
159 #L1 #L2 #s #d #e * -L1 -L2 -d -e
160 [ #d #e #_ #_ #J #K2 #W2 #H destruct
161 | #I #L #V #H elim (lt_refl_false … H)
162 | #I #L1 #L2 #V #e #_ #H elim (lt_refl_false … H)
163 | #I #L1 #L2 #V1 #V2 #d #e #HL12 #HV21 #_ #J #K2 #W2 #H destruct /2 width=5 by ex3_2_intro/
164 ]
165 qed-.
166
167 (* Basic_1: was: drop_gen_skip_r *)
168 lemma ldrop_inv_skip2: ∀I,L1,K2,V2,s,d,e. ⇩[s, d, e] L1 ≡ K2.ⓑ{I}V2 → 0 < d →
169                        ∃∃K1,V1. ⇩[s, d-1, e] K1 ≡ K2 & ⇧[d-1, e] V2 ≡ V1 &
170                                 L1 = K1.ⓑ{I}V1.
171 /2 width=3 by ldrop_inv_skip2_aux/ qed-.
172
173 (* Basic properties *********************************************************)
174
175 lemma ldrop_refl_atom_O2: ∀s,d. ⇩[s, d, O] ⋆ ≡ ⋆.
176 /2 width=1 by ldrop_atom/ qed.
177
178 (* Basic_1: was by definition: drop_refl *)
179 lemma ldrop_refl: ∀L,d,s. ⇩[s, d, 0] L ≡ L.
180 #L elim L -L //
181 #L #I #V #IHL #d #s @(nat_ind_plus … d) -d /2 width=1 by ldrop_pair, ldrop_skip/
182 qed.
183
184 lemma ldrop_drop_lt: ∀I,L1,L2,V,s,e.
185                      ⇩[s, 0, e-1] L1 ≡ L2 → 0 < e → ⇩[s, 0, e] L1.ⓑ{I}V ≡ L2.
186 #I #L1 #L2 #V #s #e #HL12 #He >(plus_minus_m_m e 1) /2 width=1 by ldrop_drop/
187 qed.
188
189 lemma ldrop_skip_lt: ∀I,L1,L2,V1,V2,s,d,e.
190                      ⇩[s, d-1, e] L1 ≡ L2 → ⇧[d-1, e] V2 ≡ V1 → 0 < d →
191                      ⇩[s, d, e] L1. ⓑ{I} V1 ≡ L2.ⓑ{I}V2.
192 #I #L1 #L2 #V1 #V2 #s #d #e #HL12 #HV21 #Hd >(plus_minus_m_m d 1) /2 width=1 by ldrop_skip/
193 qed.
194
195 lemma ldrop_O1_le: ∀e,L. e ≤ |L| → ∃K. ⇩[e] L ≡ K.
196 #e @(nat_ind_plus … e) -e /2 width=2 by ex_intro/
197 #e #IHe *
198 [ #H lapply (le_n_O_to_eq … H) -H >commutative_plus normalize #H destruct
199 | #L #I #V normalize #H
200   elim (IHe L) -IHe /3 width=2 by ldrop_drop, monotonic_pred, ex_intro/
201 ]
202 qed-.
203
204 lemma ldrop_O1_lt: ∀L,e. e < |L| → ∃∃I,K,V. ⇩[e] L ≡ K.ⓑ{I}V.
205 #L elim L -L
206 [ #e #H elim (lt_zero_false … H)
207 | #L #I #V #IHL #e @(nat_ind_plus … e) -e /2 width=4 by ldrop_pair, ex1_3_intro/
208   #e #_ normalize #H
209   elim (IHL e) -IHL /3 width=4 by ldrop_drop, lt_plus_to_minus_r, lt_plus_to_lt_l, ex1_3_intro/
210 ]
211 qed-.
212
213 lemma ldrop_FT: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → ⇩[Ⓣ, d, e] L1 ≡ L2.
214 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e
215 /3 width=1 by ldrop_atom, ldrop_drop, ldrop_skip/
216 qed.
217
218 lemma ldrop_gen: ∀L1,L2,s,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → ⇩[s, d, e] L1 ≡ L2.
219 #L1 #L2 * /2 width=1 by ldrop_FT/
220 qed-.
221
222 lemma ldrop_T: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → ⇩[Ⓣ, d, e] L1 ≡ L2.
223 #L1 #L2 * /2 width=1 by ldrop_FT/
224 qed-.
225
226 lemma l_liftable_LTC: ∀R. l_liftable R → l_liftable (LTC … R).
227 #R #HR #K #T1 #T2 #H elim H -T2
228 [ /3 width=10 by inj/
229 | #T #T2 #_ #HT2 #IHT1 #L #s #d #e #HLK #U1 #HTU1 #U2 #HTU2
230   elim (lift_total T d e) /4 width=12 by step/
231 ]
232 qed-.
233
234 lemma l_deliftable_sn_LTC: ∀R. l_deliftable_sn R → l_deliftable_sn (LTC … R).
235 #R #HR #L #U1 #U2 #H elim H -U2
236 [ #U2 #HU12 #K #s #d #e #HLK #T1 #HTU1
237   elim (HR … HU12 … HLK … HTU1) -HR -L -U1 /3 width=3 by inj, ex2_intro/
238 | #U #U2 #_ #HU2 #IHU1 #K #s #d #e #HLK #T1 #HTU1
239   elim (IHU1 … HLK … HTU1) -IHU1 -U1 #T #HTU #HT1
240   elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5 by step, ex2_intro/
241 ]
242 qed-.
243
244 lemma dropable_sn_TC: ∀R. dropable_sn R → dropable_sn (TC … R).
245 #R #HR #L1 #K1 #s #d #e #HLK1 #L2 #H elim H -L2
246 [ #L2 #HL12 elim (HR … HLK1 … HL12) -HR -L1
247   /3 width=3 by inj, ex2_intro/
248 | #L #L2 #_ #HL2 * #K #HK1 #HLK elim (HR … HLK … HL2) -HR -L
249   /3 width=3 by step, ex2_intro/
250 ]
251 qed-.
252
253 lemma dedropable_sn_TC: ∀R. dedropable_sn R → dedropable_sn (TC … R).
254 #R #HR #L1 #K1 #s #d #e #HLK1 #K2 #H elim H -K2
255 [ #K2 #HK12 elim (HR … HLK1 … HK12) -HR -K1
256   /3 width=3 by inj, ex2_intro/
257 | #K #K2 #_ #HK2 * #L #HL1 #HLK elim (HR … HLK … HK2) -HR -K
258   /3 width=3 by step, ex2_intro/
259 ]
260 qed-.
261
262 lemma dropable_dx_TC: ∀R. dropable_dx R → dropable_dx (TC … R).
263 #R #HR #L1 #L2 #H elim H -L2
264 [ #L2 #HL12 #K2 #s #e #HLK2 elim (HR … HL12 … HLK2) -HR -L2
265   /3 width=3 by inj, ex2_intro/
266 | #L #L2 #_ #HL2 #IHL1 #K2 #s #e #HLK2 elim (HR … HL2 … HLK2) -HR -L2
267   #K #HLK #HK2 elim (IHL1 … HLK) -L
268   /3 width=5 by step, ex2_intro/
269 ]
270 qed-.
271
272 lemma l_deliftable_sn_llstar: ∀R. l_deliftable_sn R →
273                               ∀l. l_deliftable_sn (llstar … R l).
274 #R #HR #l #L #U1 #U2 #H @(lstar_ind_r … l U2 H) -l -U2
275 [ /2 width=3 by lstar_O, ex2_intro/
276 | #l #U #U2 #_ #HU2 #IHU1 #K #s #d #e #HLK #T1 #HTU1
277   elim (IHU1 … HLK … HTU1) -IHU1 -U1 #T #HTU #HT1
278   elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5 by lstar_dx, ex2_intro/
279 ]
280 qed-.
281
282 (* Basic forvard lemmas *****************************************************)
283
284 (* Basic_1: was: drop_S *)
285 lemma ldrop_fwd_drop2: ∀L1,I2,K2,V2,s,e. ⇩[s, O, e] L1 ≡ K2. ⓑ{I2} V2 →
286                        ⇩[s, O, e + 1] L1 ≡ K2.
287 #L1 elim L1 -L1
288 [ #I2 #K2 #V2 #s #e #H lapply (ldrop_inv_atom1 … H) -H * #H destruct
289 | #K1 #I1 #V1 #IHL1 #I2 #K2 #V2 #s #e #H
290   elim (ldrop_inv_O1_pair1 … H) -H * #He #H
291   [ -IHL1 destruct /2 width=1 by ldrop_drop/
292   | @ldrop_drop >(plus_minus_m_m e 1) /2 width=3 by/
293   ]
294 ]
295 qed-.
296
297 lemma ldrop_fwd_length: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → |L1| = |L2| + e.
298 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e // normalize /2 width=1 by/
299 qed-.
300
301 lemma ldrop_fwd_length_minus2: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → |L2| = |L1| - e.
302 #L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H /2 width=1 by plus_minus, le_n/
303 qed-.
304
305 lemma ldrop_fwd_length_minus4: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → e = |L1| - |L2|.
306 #L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H //
307 qed-.
308
309 lemma ldrop_fwd_length_le2: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → e ≤ |L1|.
310 #L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H //
311 qed-.
312
313 lemma ldrop_fwd_length_le4: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → |L2| ≤ |L1|.
314 #L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H //
315 qed-.
316
317 lemma ldrop_fwd_length_lt2: ∀L1,I2,K2,V2,d,e.
318                             ⇩[Ⓕ, d, e] L1 ≡ K2. ⓑ{I2} V2 → e < |L1|.
319 #L1 #I2 #K2 #V2 #d #e #H
320 lapply (ldrop_fwd_length … H) normalize in ⊢ (%→?); -I2 -V2 //
321 qed-.
322
323 lemma ldrop_fwd_length_lt4: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → 0 < e → |L2| < |L1|.
324 #L1 #L2 #d #e #H lapply (ldrop_fwd_length … H) -H /2 width=1 by lt_minus_to_plus_r/
325 qed-.
326
327 lemma ldrop_fwd_length_eq1: ∀L1,L2,K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
328                             |L1| = |L2| → |K1| = |K2|.
329 #L1 #L2 #K1 #K2 #d #e #HLK1 #HLK2 #HL12
330 lapply (ldrop_fwd_length … HLK1) -HLK1
331 lapply (ldrop_fwd_length … HLK2) -HLK2
332 /2 width=2 by injective_plus_r/
333 qed-.
334
335 lemma ldrop_fwd_length_eq2: ∀L1,L2,K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
336                             |K1| = |K2| → |L1| = |L2|.
337 #L1 #L2 #K1 #K2 #d #e #HLK1 #HLK2 #HL12
338 lapply (ldrop_fwd_length … HLK1) -HLK1
339 lapply (ldrop_fwd_length … HLK2) -HLK2 //
340 qed-.
341
342 lemma ldrop_fwd_lw: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → ♯{L2} ≤ ♯{L1}.
343 #L1 #L2 #s #d #e #H elim H -L1 -L2 -d -e // normalize
344 [ /2 width=3 by transitive_le/
345 | #I #L1 #L2 #V1 #V2 #d #e #_ #HV21 #IHL12
346   >(lift_fwd_tw … HV21) -HV21 /2 width=1 by monotonic_le_plus_l/
347 ]
348 qed-.
349
350 lemma ldrop_fwd_lw_lt: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → 0 < e → ♯{L2} < ♯{L1}.
351 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e
352 [ #d #e #H >H -H //
353 | #I #L #V #H elim (lt_refl_false … H)
354 | #I #L1 #L2 #V #e #HL12 #_ #_
355   lapply (ldrop_fwd_lw … HL12) -HL12 #HL12
356   @(le_to_lt_to_lt … HL12) -HL12 //
357 | #I #L1 #L2 #V1 #V2 #d #e #_ #HV21 #IHL12 #H normalize in ⊢ (?%%); -I
358   >(lift_fwd_tw … HV21) -V2 /3 by lt_minus_to_plus/
359 ]
360 qed-.
361
362 lemma ldrop_fwd_rfw: ∀I,L,K,V,i. ⇩[i] L ≡ K.ⓑ{I}V → ♯{K, V} < ♯{L, #i}.
363 #I #L #K #V #i #HLK lapply (ldrop_fwd_lw … HLK) -HLK
364 normalize in ⊢ (%→?%%); /2 width=1 by le_S_S/
365 qed-.
366
367 (* Advanced inversion lemmas ************************************************)
368
369 fact ldrop_inv_O2_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → e = 0 → L1 = L2.
370 #L1 #L2 #s #d #e #H elim H -L1 -L2 -d -e
371 [ //
372 | //
373 | #I #L1 #L2 #V #e #_ #_ >commutative_plus normalize #H destruct
374 | #I #L1 #L2 #V1 #V2 #d #e #_ #HV21 #IHL12 #H
375   >(IHL12 H) -L1 >(lift_inv_O2_aux … HV21 … H) -V2 -d -e //
376 ]
377 qed-.
378
379 (* Basic_1: was: drop_gen_refl *)
380 lemma ldrop_inv_O2: ∀L1,L2,s,d. ⇩[s, d, 0] L1 ≡ L2 → L1 = L2.
381 /2 width=5 by ldrop_inv_O2_aux/ qed-.
382
383 lemma ldrop_inv_length_eq: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → |L1| = |L2| → e = 0.
384 #L1 #L2 #d #e #H #HL12 lapply (ldrop_fwd_length_minus4 … H) //
385 qed-.
386
387 lemma ldrop_inv_refl: ∀L,d,e. ⇩[Ⓕ, d, e] L ≡ L → e = 0.
388 /2 width=5 by ldrop_inv_length_eq/ qed-.
389
390 fact ldrop_inv_FT_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 →
391                        ∀I,K,V. L2 = K.ⓑ{I}V → s = Ⓣ → d = 0 →
392                        ⇩[Ⓕ, d, e] L1 ≡ K.ⓑ{I}V.
393 #L1 #L2 #s #d #e #H elim H -L1 -L2 -d -e
394 [ #d #e #_ #J #K #W #H destruct
395 | #I #L #V #J #K #W #H destruct //
396 | #I #L1 #L2 #V #e #_ #IHL12 #J #K #W #H1 #H2 destruct
397   /3 width=1 by ldrop_drop/
398 | #I #L1 #L2 #V1 #V2 #d #e #_ #_ #_ #J #K #W #_ #_
399   <plus_n_Sm #H destruct
400 ]
401 qed-.
402
403 lemma ldrop_inv_FT: ∀I,L,K,V,e. ⇩[Ⓣ, 0, e] L ≡ K.ⓑ{I}V → ⇩[e] L ≡ K.ⓑ{I}V.
404 /2 width=5 by ldrop_inv_FT_aux/ qed.
405
406 lemma ldrop_inv_gen: ∀I,L,K,V,s,e. ⇩[s, 0, e] L ≡ K.ⓑ{I}V → ⇩[e] L ≡ K.ⓑ{I}V.
407 #I #L #K #V * /2 width=1 by ldrop_inv_FT/
408 qed-.
409
410 lemma ldrop_inv_T: ∀I,L,K,V,s,e. ⇩[Ⓣ, 0, e] L ≡ K.ⓑ{I}V → ⇩[s, 0, e] L ≡ K.ⓑ{I}V.
411 #I #L #K #V * /2 width=1 by ldrop_inv_FT/
412 qed-.
413
414 (* Basic_1: removed theorems 50:
415             drop_ctail drop_skip_flat
416             cimp_flat_sx cimp_flat_dx cimp_bind cimp_getl_conf
417             drop_clear drop_clear_O drop_clear_S
418             clear_gen_sort clear_gen_bind clear_gen_flat clear_gen_flat_r
419             clear_gen_all clear_clear clear_mono clear_trans clear_ctail clear_cle
420             getl_ctail_clen getl_gen_tail clear_getl_trans getl_clear_trans
421             getl_clear_bind getl_clear_conf getl_dec getl_drop getl_drop_conf_lt
422             getl_drop_conf_ge getl_conf_ge_drop getl_drop_conf_rev
423             drop_getl_trans_lt drop_getl_trans_le drop_getl_trans_ge
424             getl_drop_trans getl_flt getl_gen_all getl_gen_sort getl_gen_O
425             getl_gen_S getl_gen_2 getl_gen_flat getl_gen_bind getl_conf_le
426             getl_trans getl_refl getl_head getl_flat getl_ctail getl_mono
427 *)