1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/lib/arith_2a.ma".
16 include "basic_2A/grammar/lenv_append.ma".
17 include "basic_2A/substitution/drop.ma".
19 (* DROPPING *****************************************************************)
21 (* Properties on append for local environments ******************************)
23 fact drop_O1_append_sn_le_aux: ∀L1,L2,s,l,m. ⬇[s, l, m] L1 ≡ L2 →
25 ∀L. ⬇[s, 0, m] L ● L1 ≡ L ● L2.
26 #L1 #L2 #s #l #m #H elim H -L1 -L2 -l -m normalize
27 [2,3,4: /4 width=1 by drop_skip_lt, drop_drop, arith_b1, lt_minus_to_plus_r, monotonic_pred/ ]
28 #l #m #_ #_ #H <(le_n_O_to_eq … H) -H //
31 lemma drop_O1_append_sn_le: ∀L1,L2,s,m. ⬇[s, 0, m] L1 ≡ L2 → m ≤ |L1| →
32 ∀L. ⬇[s, 0, m] L ● L1 ≡ L ● L2.
33 /2 width=3 by drop_O1_append_sn_le_aux/ qed.
35 (* Inversion lemmas on append for local environments ************************)
37 lemma drop_O1_inv_append1_ge: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 ● L2 ≡ K →
38 |L2| ≤ m → ⬇[s, 0, m - |L2|] L1 ≡ K.
39 #K #L1 #L2 elim L2 -L2 normalize //
40 #L2 #I #V #IHL2 #s #m #H #H1m
41 elim (drop_inv_O1_pair1 … H) -H * #H2m #HL12 destruct
42 [ lapply (le_n_O_to_eq … H1m) -H1m -IHL2
43 >commutative_plus normalize #H destruct
44 | <minus_plus >minus_minus_comm /3 width=1 by monotonic_pred/
48 lemma drop_O1_inv_append1_le: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 ● L2 ≡ K → m ≤ |L2| →
49 ∀K2. ⬇[s, 0, m] L2 ≡ K2 → K = L1 ● K2.
50 #K #L1 #L2 elim L2 -L2 normalize
51 [ #s #m #H1 #H2 #K2 #H3 lapply (le_n_O_to_eq … H2) -H2
52 #H2 elim (drop_inv_atom1 … H3) -H3 #H3 #_ destruct
53 >(drop_inv_O2 … H1) -H1 //
54 | #L2 #I #V #IHL2 #s #m @(nat_ind_plus … m) -m [ -IHL2 ]
56 lapply (drop_inv_O2 … H1) -H1 #H1
57 lapply (drop_inv_O2 … H2) -H2 #H2 destruct //
58 | /4 width=7 by drop_inv_drop1, le_plus_to_le_r/