]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/syntax/append.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / syntax / append.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
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".
23
24 (* APPEND FOR LOCAL ENVIRONMENTS ********************************************)
25
26 rec definition append L K on K ≝ match K with
27 [ LAtom     ⇒ L
28 | LBind K I ⇒ (append L K).ⓘ[I]
29 ].
30
31 interpretation "append (local environment)" 'plus L1 L2 = (append L1 L2).
32
33 interpretation "local environment tail binding construction (generic)"
34    'SnItem I L = (append (LBind LAtom I) L).
35
36 interpretation "local environment tail binding construction (unary)"
37    'SnBind1 I L = (append (LBind LAtom (BUnit I)) L).
38
39 interpretation "local environment tail binding construction (binary)"
40    'SnBind2 I T L = (append (LBind LAtom (BPair I T)) L).
41
42 interpretation "tail exclusion (local environment)"
43    'SnVoid L = (append (LBind LAtom (BUnit Void)) L).
44
45 interpretation "tail abbreviation (local environment)"
46    'SnAbbr T L = (append (LBind LAtom (BPair Abbr T)) L).
47
48 interpretation "tail abstraction (local environment)"
49    'SnAbst L T = (append (LBind LAtom (BPair Abst T)) L).
50
51 definition d_appendable_sn: predicate (lenv→relation term) ≝ λR.
52                             ∀K,T1,T2. R K T1 T2 → ∀L. R (L+K) T1 T2.
53
54 (* Basic properties *********************************************************)
55
56 lemma append_atom: ∀L. (L + ⋆) = L. (**) (* () should be redundant *)
57 // qed.
58
59 (* Basic_2A1: uses: append_pair *)
60 lemma append_bind: ∀I,L,K. L+(K.ⓘ[I]) = (L+K).ⓘ[I].
61 // qed.
62
63 lemma append_atom_sn: ∀L. ⋆ + L = L.
64 #L elim L -L //
65 #L #I >append_bind //
66 qed.
67
68 lemma append_assoc: associative … append.
69 #L1 #L2 #L3 elim L3 -L3 //
70 qed.
71
72 lemma append_shift: ∀L,K,I. L+(ⓘ[I].K) = (L.ⓘ[I])+K.
73 #L #K #I <append_assoc //
74 qed.
75
76 (* Basic inversion lemmas ***************************************************)
77
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
81 qed-.
82
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/
88 qed-.
89
90 lemma append_inj_sn: ∀K,L1,L2. L1+K = L2+K → L1 = L2.
91 #K elim K -K //
92 #K #I #IH #L1 #L2 >append_bind #H
93 elim (destruct_lbind_lbind_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
94 qed-.
95
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/
101 qed-.