]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/append.ma
some improvements before setting up the exclusion binder
[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/snbind1_2.ma".
17 include "basic_2/notation/functions/snbind2_3.ma".
18 include "basic_2/notation/functions/snvoid_1.ma".
19 include "basic_2/notation/functions/snabbr_2.ma".
20 include "basic_2/notation/functions/snabst_2.ma".
21 include "basic_2/syntax/lenv.ma".
22
23 (* APPEND FOR LOCAL ENVIRONMENTS ********************************************)
24
25 rec definition append L K on K ≝ match K with
26 [ LAtom       ⇒ L
27 | LPair K I V ⇒ (append L K).ⓑ{I}V
28 ].
29
30 interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2).
31 (*
32 interpretation "local environment tail binding construction (unary)"
33    'SnBind1 I L = (append (LUnit LAtom I) L).
34 *)
35 interpretation "local environment tail binding construction (binary)"
36    'SnBind2 I T L = (append (LPair LAtom I T) L).
37 (*
38 interpretation "tail exclusion (local environment)"
39    'SnVoid L = (append (LUnit LAtom Void) L).
40 *)
41 interpretation "tail abbreviation (local environment)"
42    'SnAbbr T L = (append (LPair LAtom Abbr T) L).
43
44 interpretation "tail abstraction (local environment)"
45    'SnAbst L T = (append (LPair LAtom Abst T) L).
46
47 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
48                             ∀K,T1,T2. R K T1 T2 → ∀L. R (L@@K) T1 T2.
49
50 (* Basic properties *********************************************************)
51
52 lemma append_atom: ∀L. L @@ ⋆ = L.
53 // qed.
54
55 lemma append_pair: ∀I,L,K,V. L@@(K.ⓑ{I}V) = (L@@K).ⓑ{I}V.
56 // qed.
57
58 lemma append_atom_sn: ∀L. ⋆@@L = L.
59 #L elim L -L //
60 #L #I #V >append_pair //
61 qed.
62
63 lemma append_assoc: associative … append.
64 #L1 #L2 #L3 elim L3 -L3 //
65 qed.
66
67 lemma append_shift: ∀L,K,I,V. L@@(ⓑ{I}V.K) = (L.ⓑ{I}V)@@K.
68 #L #K #I #V <append_assoc //
69 qed.
70
71 (* Basic inversion lemmas ***************************************************)
72
73 lemma append_inj_sn: ∀K,L1,L2. L1@@K = L2@@K → L1 = L2.
74 #K elim K -K //
75 #K #I #V #IH #L1 #L2 >append_pair #H
76 elim (destruct_lpair_lpair_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
77 qed-.
78
79 (* Basic_1: uses: chead_ctail *)
80 (* Basic_2A1: uses: lpair_ltail *)
81 lemma lenv_case_tail: ∀L. L = ⋆ ∨ ∃∃K,I,V. L = ⓑ{I}V.K.
82 #L elim L -L /2 width=1 by or_introl/
83 #L #I #V * [2: * ] /3 width=4 by ex1_3_intro, or_intror/
84 qed-.