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 "basic_2/notation/functions/snitem_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 | LBind K I ⇒ (append L K).ⓘ{I}
30 interpretation "append (local environment)" 'plus L1 L2 = (append L1 L2).
32 interpretation "local environment tail binding construction (generic)"
33 'SnItem I L = (append (LBind LAtom I) L).
35 interpretation "local environment tail binding construction (unary)"
36 'SnBind1 I L = (append (LBind LAtom (BUnit I)) L).
38 interpretation "local environment tail binding construction (binary)"
39 'SnBind2 I T L = (append (LBind LAtom (BPair I T)) L).
41 interpretation "tail exclusion (local environment)"
42 'SnVoid L = (append (LBind LAtom (BUnit Void)) L).
44 interpretation "tail abbreviation (local environment)"
45 'SnAbbr T L = (append (LBind LAtom (BPair Abbr T)) L).
47 interpretation "tail abstraction (local environment)"
48 'SnAbst L T = (append (LBind LAtom (BPair Abst T)) L).
50 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
51 ∀K,T1,T2. R K T1 T2 → ∀L. R (L+K) T1 T2.
53 (* Basic properties *********************************************************)
55 lemma append_atom: ∀L. (L + ⋆) = L. (**) (* () should be redundant *)
58 (* Basic_2A1: uses: append_pair *)
59 lemma append_bind: ∀I,L,K. L+(K.ⓘ{I}) = (L+K).ⓘ{I}.
62 lemma append_atom_sn: ∀L. ⋆ + L = L.
67 lemma append_assoc: associative … append.
68 #L1 #L2 #L3 elim L3 -L3 //
71 lemma append_shift: ∀L,K,I. L+(ⓘ{I}.K) = (L.ⓘ{I})+K.
72 #L #K #I <append_assoc //
75 (* Basic inversion lemmas ***************************************************)
77 lemma append_inv_atom3_sn: ∀L,K. ⋆ = L + K → ∧∧ ⋆ = L & ⋆ = K.
78 #L * /2 width=1 by conj/
79 #K #I >append_bind #H destruct
82 lemma append_inv_bind3_sn: ∀I0,L,L0,K. L0.ⓘ{I0} = L + K →
83 ∨∨ ∧∧ L0.ⓘ{I0} = L & ⋆ = K
84 | ∃∃K0. K = K0.ⓘ{I0} & L0 = L + K0.
85 #I0 #L #L0 * /3 width=1 by or_introl, conj/
86 #K #I >append_bind #H destruct /3 width=3 by ex2_intro, or_intror/
89 lemma append_inj_sn: ∀K,L1,L2. L1+K = L2+K → L1 = L2.
91 #K #I #IH #L1 #L2 >append_bind #H
92 elim (destruct_lbind_lbind_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
95 (* Basic_1: uses: chead_ctail *)
96 (* Basic_2A1: uses: lpair_ltail *)
97 lemma lenv_case_tail: ∀L. L = ⋆ ∨ ∃∃K,I. L = ⓘ{I}.K.
98 #L elim L -L /2 width=1 by or_introl/
99 #L #I * [2: * ] /3 width=3 by ex1_2_intro, or_intror/