]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/relocation/ldrop_append.ma
- induction on supclosure replaces induction on weight for closures everywhere
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / ldrop_append.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 "basic_2/grammar/lenv_append.ma".
16 include "basic_2/relocation/ldrop.ma".
17
18 (* DROPPING *****************************************************************)
19
20 (* Properties on append for local environments ******************************)
21
22 fact ldrop_O1_append_sn_le_aux: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 →
23                                 d = 0 → e ≤ |L1| →
24                                 ∀L. ⇩[0, e] L @@ L1 ≡ L @@ L2.
25 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e normalize // /4 width=1/
26 #d #e #_ #H #L -d
27 lapply (le_n_O_to_eq … H) -H //
28 qed-.
29
30 lemma ldrop_O1_append_sn_le: ∀L1,L2,e. ⇩[0, e] L1 ≡ L2 → e ≤ |L1| →
31                              ∀L. ⇩[0, e] L @@ L1 ≡ L @@ L2.
32 /2 width=3 by ldrop_O1_append_sn_le_aux/ qed.
33
34 (* Inversion lemmas on append for local environments ************************)
35
36 lemma ldrop_O1_inv_append1_ge: ∀K,L1,L2,e. ⇩[0, e] L1 @@ L2 ≡ K →
37                                |L2| ≤ e → ⇩[0, e - |L2|] L1 ≡ K.
38 #K #L1 #L2 elim L2 -L2 normalize //
39 #L2 #I #V #IHL2 #e #H #H1e
40 elim (ldrop_inv_O1 … H) -H * #H2e #HL12 destruct
41 [ lapply (le_n_O_to_eq … H1e) -H1e -IHL2
42   >commutative_plus normalize #H destruct
43 | <minus_plus >minus_minus_comm /3 width=1/
44 ]
45 qed-.
46
47 lemma ldrop_O1_inv_append1_le: ∀K,L1,L2,e. ⇩[0, e] L1 @@ L2 ≡ K → e ≤ |L2| →
48                                ∀K2. ⇩[0, e] L2 ≡ K2 → K = L1 @@ K2.
49 #K #L1 #L2 elim L2 -L2 normalize
50 [ #e #H1 #H2 #K2 #H3
51   lapply (le_n_O_to_eq … H2) -H2 #H2
52   lapply (ldrop_inv_atom1 … H3) -H3 #H3 destruct
53   >(ldrop_inv_refl … H1) -H1 //
54 | #L2 #I #V #IHL2 #e @(nat_ind_plus … e) -e [ -IHL2 ]
55   [ #H1 #_ #K2 #H2
56     lapply (ldrop_inv_refl … H1) -H1 #H1
57     lapply (ldrop_inv_refl … H2) -H2 #H2 destruct //
58   | #e #_ #H1 #H #K2 #H2
59     lapply (le_plus_to_le_r … H) -H
60     lapply (ldrop_inv_ldrop1 … H1 ?) -H1 //
61     lapply (ldrop_inv_ldrop1 … H2 ?) -H2 //
62     <minus_plus_m_m /2 width=4/
63   ]
64 ]
65 qed-.