]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/append.ma
- degree-based equivalene for terms
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / syntax / 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 "ground_2/notation/functions/append_2.ma".
16 include "basic_2/notation/functions/snbind2_3.ma".
17 include "basic_2/notation/functions/snabbr_2.ma".
18 include "basic_2/notation/functions/snabst_2.ma".
19 include "basic_2/syntax/lenv.ma".
20
21 (* APPEND FOR LOCAL ENVIRONMENTS ********************************************)
22
23 rec definition append L K on K ≝ match K with
24 [ LAtom       ⇒ L
25 | LPair K I V ⇒ (append L K).ⓑ{I}V
26 ].
27
28 interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2).
29
30 interpretation "local environment tail binding construction (binary)"
31    'SnBind2 I T L = (append (LPair LAtom I T) L).
32
33 interpretation "tail abbreviation (local environment)"
34    'SnAbbr T L = (append (LPair LAtom Abbr T) L).
35
36 interpretation "tail abstraction (local environment)"
37    'SnAbst L T = (append (LPair LAtom Abst T) L).
38
39 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
40                             ∀K,T1,T2. R K T1 T2 → ∀L. R (L@@K) T1 T2.
41
42 (* Basic properties *********************************************************)
43
44 lemma append_atom: ∀L. L @@ ⋆ = L.
45 // qed.
46
47 lemma append_pair: ∀I,L,K,V. L@@(K.ⓑ{I}V) = (L@@K).ⓑ{I}V.
48 // qed.
49
50 lemma append_atom_sn: ∀L. ⋆@@L = L.
51 #L elim L -L //
52 #L #I #V >append_pair //
53 qed.
54
55 lemma append_assoc: associative … append.
56 #L1 #L2 #L3 elim L3 -L3 //
57 qed.
58
59 lemma append_shift: ∀L,K,I,V. L@@(ⓑ{I}V.K) = (L.ⓑ{I}V)@@K.
60 #L #K #I #V <append_assoc //
61 qed.
62
63 (* Basic inversion lemmas ***************************************************)
64
65 lemma append_inj_sn: ∀K,L1,L2. L1@@K = L2@@K → L1 = L2.
66 #K elim K -K //
67 #K #I #V #IH #L1 #L2 >append_pair #H
68 elim (destruct_lpair_lpair_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
69 qed-.