]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/substitution/drop_append.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / substitution / drop_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_2A/grammar/lenv_append.ma".
16 include "basic_2A/substitution/drop.ma".
17
18 (* DROPPING *****************************************************************)
19
20 (* Properties on append for local environments ******************************)
21
22 fact drop_O1_append_sn_le_aux: ∀L1,L2,s,l,m. ⬇[s, l, m] L1 ≡ L2 →
23                                l = 0 → m ≤ |L1| →
24                                ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
25 #L1 #L2 #s #l #m #H elim H -L1 -L2 -l -m normalize
26 [2,3,4: /4 width=1 by drop_skip_lt, drop_drop, arith_b1, lt_minus_to_plus_r, monotonic_pred/ ]
27 #l #m #_ #_ #H <(le_n_O_to_eq … H) -H //
28 qed-.
29
30 lemma drop_O1_append_sn_le: ∀L1,L2,s,m. ⬇[s, 0, m] L1 ≡ L2 → m ≤ |L1| →
31                             ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
32 /2 width=3 by drop_O1_append_sn_le_aux/ qed.
33
34 (* Inversion lemmas on append for local environments ************************)
35
36 lemma drop_O1_inv_append1_ge: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K →
37                               |L2| ≤ m → ⬇[s, 0, m - |L2|] L1 ≡ K.
38 #K #L1 #L2 elim L2 -L2 normalize //
39 #L2 #I #V #IHL2 #s #m #H #H1m
40 elim (drop_inv_O1_pair1 … H) -H * #H2m #HL12 destruct
41 [ lapply (le_n_O_to_eq … H1m) -H1m -IHL2
42   >commutative_plus normalize #H destruct
43 | <minus_plus >minus_minus_comm /3 width=1 by monotonic_pred/
44 ]
45 qed-.
46
47 lemma drop_O1_inv_append1_le: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K → m ≤ |L2| →
48                               ∀K2. ⬇[s, 0, m] L2 ≡ K2 → K = L1 @@ K2.
49 #K #L1 #L2 elim L2 -L2 normalize
50 [ #s #m #H1 #H2 #K2 #H3 lapply (le_n_O_to_eq … H2) -H2
51   #H2 elim (drop_inv_atom1 … H3) -H3 #H3 #_ destruct
52   >(drop_inv_O2 … H1) -H1 //
53 | #L2 #I #V #IHL2 #s #m @(nat_ind_plus … m) -m [ -IHL2 ]
54   [ #H1 #_ #K2 #H2
55     lapply (drop_inv_O2 … H1) -H1 #H1
56     lapply (drop_inv_O2 … H2) -H2 #H2 destruct //
57   | /4 width=7 by drop_inv_drop1, le_plus_to_le_r/
58   ]
59 ]
60 qed-.