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_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".
23 (* APPEND FOR LOCAL ENVIRONMENTS ********************************************)
25 rec definition append L K on K ≝ match K with
27 | LPair K I V ⇒ (append L K).ⓑ{I}V
30 interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2).
32 interpretation "local environment tail binding construction (unary)"
33 'SnBind1 I L = (append (LUnit LAtom I) L).
35 interpretation "local environment tail binding construction (binary)"
36 'SnBind2 I T L = (append (LPair LAtom I T) L).
38 interpretation "tail exclusion (local environment)"
39 'SnVoid L = (append (LUnit LAtom Void) L).
41 interpretation "tail abbreviation (local environment)"
42 'SnAbbr T L = (append (LPair LAtom Abbr T) L).
44 interpretation "tail abstraction (local environment)"
45 'SnAbst L T = (append (LPair LAtom Abst T) L).
47 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
48 ∀K,T1,T2. R K T1 T2 → ∀L. R (L@@K) T1 T2.
50 (* Basic properties *********************************************************)
52 lemma append_atom: ∀L. L @@ ⋆ = L.
55 lemma append_pair: ∀I,L,K,V. L@@(K.ⓑ{I}V) = (L@@K).ⓑ{I}V.
58 lemma append_atom_sn: ∀L. ⋆@@L = L.
60 #L #I #V >append_pair //
63 lemma append_assoc: associative … append.
64 #L1 #L2 #L3 elim L3 -L3 //
67 lemma append_shift: ∀L,K,I,V. L@@(ⓑ{I}V.K) = (L.ⓑ{I}V)@@K.
68 #L #K #I #V <append_assoc //
71 (* Basic inversion lemmas ***************************************************)
73 lemma append_inj_sn: ∀K,L1,L2. L1@@K = L2@@K → L1 = L2.
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 *)
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/