X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbasic_2%2Fsyntax%2Fappend.ma;h=b3a07339bbe3bedba4333fccdfde4b04cceb9b10;hp=f78ecb55c873a64bd91fbed03bd67e23e2c164d9;hb=222044da28742b24584549ba86b1805a87def070;hpb=09b4420070d6a71990e16211e499b51dbb0742cb diff --git a/matita/matita/contribs/lambdadelta/basic_2/syntax/append.ma b/matita/matita/contribs/lambdadelta/basic_2/syntax/append.ma index f78ecb55c..b3a07339b 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/syntax/append.ma +++ b/matita/matita/contribs/lambdadelta/basic_2/syntax/append.ma @@ -12,8 +12,10 @@ (* *) (**************************************************************************) -include "ground_2/notation/functions/append_2.ma". +include "basic_2/notation/functions/snitem_2.ma". +include "basic_2/notation/functions/snbind1_2.ma". include "basic_2/notation/functions/snbind2_3.ma". +include "basic_2/notation/functions/snvoid_1.ma". include "basic_2/notation/functions/snabbr_2.ma". include "basic_2/notation/functions/snabst_2.ma". include "basic_2/syntax/lenv.ma". @@ -21,49 +23,78 @@ include "basic_2/syntax/lenv.ma". (* APPEND FOR LOCAL ENVIRONMENTS ********************************************) rec definition append L K on K ≝ match K with -[ LAtom ⇒ L -| LPair K I V ⇒ (append L K).ⓑ{I}V +[ LAtom ⇒ L +| LBind K I ⇒ (append L K).ⓘ{I} ]. -interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2). +interpretation "append (local environment)" 'plus L1 L2 = (append L1 L2). + +interpretation "local environment tail binding construction (generic)" + 'SnItem I L = (append (LBind LAtom I) L). + +interpretation "local environment tail binding construction (unary)" + 'SnBind1 I L = (append (LBind LAtom (BUnit I)) L). interpretation "local environment tail binding construction (binary)" - 'SnBind2 I T L = (append (LPair LAtom I T) L). + 'SnBind2 I T L = (append (LBind LAtom (BPair I T)) L). + +interpretation "tail exclusion (local environment)" + 'SnVoid L = (append (LBind LAtom (BUnit Void)) L). interpretation "tail abbreviation (local environment)" - 'SnAbbr T L = (append (LPair LAtom Abbr T) L). + 'SnAbbr T L = (append (LBind LAtom (BPair Abbr T)) L). interpretation "tail abstraction (local environment)" - 'SnAbst L T = (append (LPair LAtom Abst T) L). + 'SnAbst L T = (append (LBind LAtom (BPair Abst T)) L). definition d_appendable_sn: predicate (lenv→relation term) ≝ λR. - ∀K,T1,T2. R K T1 T2 → ∀L. R (L@@K) T1 T2. + ∀K,T1,T2. R K T1 T2 → ∀L. R (L+K) T1 T2. (* Basic properties *********************************************************) -lemma append_atom: ∀L. L @@ ⋆ = L. +lemma append_atom: ∀L. (L + ⋆) = L. (**) (* () should be redundant *) // qed. -lemma append_pair: ∀I,L,K,V. L@@(K.ⓑ{I}V) = (L@@K).ⓑ{I}V. +(* Basic_2A1: uses: append_pair *) +lemma append_bind: ∀I,L,K. L+(K.ⓘ{I}) = (L+K).ⓘ{I}. // qed. -lemma append_atom_sn: ∀L. ⋆@@L = L. +lemma append_atom_sn: ∀L. ⋆ + L = L. #L elim L -L // -#L #I #V >append_pair // +#L #I >append_bind // qed. lemma append_assoc: associative … append. #L1 #L2 #L3 elim L3 -L3 // qed. -lemma append_shift: ∀L,K,I,V. L@@(ⓑ{I}V.K) = (L.ⓑ{I}V)@@K. -#L #K #I #V append_bind #H destruct +qed-. + +lemma append_inv_bind3_sn: ∀I0,L,L0,K. L0.ⓘ{I0} = L + K → + ∨∨ ∧∧ L0.ⓘ{I0} = L & ⋆ = K + | ∃∃K0. K = K0.ⓘ{I0} & L0 = L + K0. +#I0 #L #L0 * /3 width=1 by or_introl, conj/ +#K #I >append_bind #H destruct /3 width=3 by ex2_intro, or_intror/ +qed-. + +lemma append_inj_sn: ∀K,L1,L2. L1+K = L2+K → L1 = L2. #K elim K -K // -#K #I #V #IH #L1 #L2 >append_pair #H -elim (destruct_lpair_lpair_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *) +#K #I #IH #L1 #L2 >append_bind #H +elim (destruct_lbind_lbind_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *) +qed-. + +(* Basic_1: uses: chead_ctail *) +(* Basic_2A1: uses: lpair_ltail *) +lemma lenv_case_tail: ∀L. L = ⋆ ∨ ∃∃K,I. L = ⓘ{I}.K. +#L elim L -L /2 width=1 by or_introl/ +#L #I * [2: * ] /3 width=3 by ex1_2_intro, or_intror/ qed-.