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/xoa/ex_1_2.ma".
16 include "static_2/notation/functions/snitem_2.ma".
17 include "static_2/notation/functions/snbind1_2.ma".
18 include "static_2/notation/functions/snbind2_3.ma".
19 include "static_2/notation/functions/snvoid_1.ma".
20 include "static_2/notation/functions/snabbr_2.ma".
21 include "static_2/notation/functions/snabst_2.ma".
22 include "static_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)" 'plus 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. (**) (* () should be redundant *)
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_inv_atom3_sn: ∀L,K. ⋆ = L + K → ∧∧ ⋆ = L & ⋆ = K.
79 #L * /2 width=1 by conj/
80 #K #I >append_bind #H destruct
83 lemma append_inv_bind3_sn: ∀I0,L,L0,K. L0.ⓘ[I0] = L + K →
84 ∨∨ ∧∧ L0.ⓘ[I0] = L & ⋆ = K
85 | ∃∃K0. K = K0.ⓘ[I0] & L0 = L + K0.
86 #I0 #L #L0 * /3 width=1 by or_introl, conj/
87 #K #I >append_bind #H destruct /3 width=3 by ex2_intro, or_intror/
90 lemma append_inj_sn: ∀K,L1,L2. L1+K = L2+K → L1 = L2.
92 #K #I #IH #L1 #L2 >append_bind #H
93 elim (destruct_lbind_lbind_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
96 (* Basic_1: uses: chead_ctail *)
97 (* Basic_2A1: uses: lpair_ltail *)
98 lemma lenv_case_tail: ∀L. L = ⋆ ∨ ∃∃K,I. L = ⓘ[I].K.
99 #L elim L -L /2 width=1 by or_introl/
100 #L #I * [2: * ] /3 width=3 by ex1_2_intro, or_intror/