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/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".
21 (* APPEND FOR LOCAL ENVIRONMENTS ********************************************)
23 rec definition append L K on K ≝ match K with
25 | LPair K I V ⇒ (append L K).ⓑ{I}V
28 interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2).
30 interpretation "local environment tail binding construction (binary)"
31 'SnBind2 I T L = (append (LPair LAtom I T) L).
33 interpretation "tail abbreviation (local environment)"
34 'SnAbbr T L = (append (LPair LAtom Abbr T) L).
36 interpretation "tail abstraction (local environment)"
37 'SnAbst L T = (append (LPair LAtom Abst T) L).
39 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
40 ∀K,T1,T2. R K T1 T2 → ∀L. R (L@@K) T1 T2.
42 (* Basic properties *********************************************************)
44 lemma append_atom: ∀L. L @@ ⋆ = L.
47 lemma append_pair: ∀I,L,K,V. L@@(K.ⓑ{I}V) = (L@@K).ⓑ{I}V.
50 lemma append_atom_sn: ∀L. ⋆@@L = L.
52 #L #I #V >append_pair //
55 lemma append_assoc: associative … append.
56 #L1 #L2 #L3 elim L3 -L3 //
59 lemma append_shift: ∀L,K,I,V. L@@(ⓑ{I}V.K) = (L.ⓑ{I}V)@@K.
60 #L #K #I #V <append_assoc //
63 (* Basic inversion lemmas ***************************************************)
65 lemma append_inj_sn: ∀K,L1,L2. L1@@K = L2@@K → L1 = L2.
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 *)