]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc_new/drops/drops_append.etc
- degree-based equivalene for terms
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc_new / drops / drops_append.etc
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/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 //
26 [ #l #m #_ #_ #H >(yle_inv_O2 … H) -m //
27 | /4 width=1 by drop_drop, yle_inv_succ/
28 | #I #L1 #L2 #V1 #V2 #l #m #_ #_ #_ #H elim (ysucc_inv_O_dx … H)
29 ]
30 qed-.
31
32 lemma drop_O1_append_sn_le: ∀L1,L2,s,m. ⬇[s, yinj 0, m] L1 ≡ L2 → m ≤ |L1| →
33                             ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
34 /2 width=3 by drop_O1_append_sn_le_aux/ qed.
35
36 (* Inversion lemmas on append for local environments ************************)
37
38 lemma drop_O1_inv_append1_ge: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K →
39                               ∀m0. |L2| + m0 = m → ⬇[s, 0, m0] L1 ≡ K.
40 #K #L1 #L2 elim L2 -L2
41 [ #s #m #H #m0 >yplus_O1 #H0 destruct //
42 | #L2 #I #V #IHL2 #s #m #H #m0 >yplus_succ1
43   #H0 elim (drop_inv_O1_pair1 … H) -H * #Hm #HL12 destruct
44   [ elim (ysucc_inv_O_dx … Hm)
45   | /2 width=3 by/
46   ]
47 ]
48 qed-.
49
50 lemma drop_O1_inv_append1_le: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K → m ≤ |L2| →
51                               ∀K2. ⬇[s, 0, m] L2 ≡ K2 → K = L1 @@ K2.
52 #K #L1 #L2 elim L2 -L2
53 [ #s #m #H1 #H2 #K2 #H3 lapply (yle_inv_O2 … H2) -H2
54   #H2 elim (drop_inv_atom1 … H3) -H3 #H3 #_ destruct
55   >(drop_inv_O2 … H1) -H1 //
56 | #L2 #I #V #IHL2 #s #m @(ynat_ind … m) -m [ -IHL2 || -IHL2 ]
57   [ #H1 #_ #K2 #H2
58     lapply (drop_inv_O2 … H1) -H1 #H1
59     lapply (drop_inv_O2 … H2) -H2 #H2 destruct //
60   | /3 width=7 by drop_inv_drop1, yle_inv_succ/
61   | #_ #H lapply (yle_inv_Y1 … H) -H
62     #H elim (ylt_yle_false (|L2.ⓑ{I}V|) (∞)) //
63   ]
64 ]
65 qed-.