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/snitem_2.ma".
17 include "basic_2/notation/functions/snbind1_2.ma".
18 include "basic_2/notation/functions/snbind2_3.ma".
19 include "basic_2/notation/functions/snvoid_1.ma".
20 include "basic_2/notation/functions/snabbr_2.ma".
21 include "basic_2/notation/functions/snabst_2.ma".
22 include "basic_2/syntax/lenv.ma".
24 (* APPEND FOR LOCAL ENVIRONMENTS ********************************************)
26 rec definition append L K on K ≝ match K with
28 | LBind K I ⇒ (append L K).ⓘ{I}
31 interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2).
33 interpretation "local environment tail binding construction (generic)"
34 'SnItem I L = (append (LBind LAtom I) L).
36 interpretation "local environment tail binding construction (unary)"
37 'SnBind1 I L = (append (LBind LAtom (BUnit I)) L).
39 interpretation "local environment tail binding construction (binary)"
40 'SnBind2 I T L = (append (LBind LAtom (BPair I T)) L).
42 interpretation "tail exclusion (local environment)"
43 'SnVoid L = (append (LBind LAtom (BUnit Void)) L).
45 interpretation "tail abbreviation (local environment)"
46 'SnAbbr T L = (append (LBind LAtom (BPair Abbr T)) L).
48 interpretation "tail abstraction (local environment)"
49 'SnAbst L T = (append (LBind LAtom (BPair Abst T)) L).
51 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
52 ∀K,T1,T2. R K T1 T2 → ∀L. R (L@@K) T1 T2.
54 (* Basic properties *********************************************************)
56 lemma append_atom: ∀L. L @@ ⋆ = L.
59 (* Basic_2A1: uses: append_pair *)
60 lemma append_bind: ∀I,L,K. L@@(K.ⓘ{I}) = (L@@K).ⓘ{I}.
63 lemma append_atom_sn: ∀L. ⋆@@L = L.
68 lemma append_assoc: associative … append.
69 #L1 #L2 #L3 elim L3 -L3 //
72 lemma append_shift: ∀L,K,I. L@@(ⓘ{I}.K) = (L.ⓘ{I})@@K.
73 #L #K #I <append_assoc //
76 (* Basic inversion lemmas ***************************************************)
78 lemma append_inj_sn: ∀K,L1,L2. L1@@K = L2@@K → L1 = L2.
80 #K #I #IH #L1 #L2 >append_bind #H
81 elim (destruct_lbind_lbind_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
84 (* Basic_1: uses: chead_ctail *)
85 (* Basic_2A1: uses: lpair_ltail *)
86 lemma lenv_case_tail: ∀L. L = ⋆ ∨ ∃∃K,I. L = ⓘ{I}.K.
87 #L elim L -L /2 width=1 by or_introl/
88 #L #I * [2: * ] /3 width=3 by ex1_2_intro, or_intror/