X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fground_2%2Flib%2Flist.ma;h=fb643311a4a5082d5f0483ae77315f9af01623f2;hp=ffce3128641951c7429d9aaeef7ae488dd000305;hb=ff612dc35167ec0c145864c9aa8ae5e1ebe20a48;hpb=a77d0bd6a04e94f765d329d47b37d9e04d349b14 diff --git a/matita/matita/contribs/lambdadelta/ground_2/lib/list.ma b/matita/matita/contribs/lambdadelta/ground_2/lib/list.ma index ffce31286..fb643311a 100644 --- a/matita/matita/contribs/lambdadelta/ground_2/lib/list.ma +++ b/matita/matita/contribs/lambdadelta/ground_2/lib/list.ma @@ -12,9 +12,9 @@ (* *) (**************************************************************************) -include "ground_2/notation/constructors/nil_0.ma". -include "ground_2/notation/constructors/oplusright_3.ma". -include "ground_2/lib/arith.ma". +include "ground_2/notation/functions/circledE_1.ma". +include "ground_2/notation/functions/oplusright_3.ma". +include "ground_2/lib/relations.ma". (* LISTS ********************************************************************) @@ -22,47 +22,12 @@ inductive list (A:Type[0]) : Type[0] := | nil : list A | cons: A → list A → list A. -interpretation "nil (list)" 'Nil = (nil ?). +interpretation "nil (list)" 'CircledE A = (nil A). interpretation "cons (list)" 'OPlusRight A hd tl = (cons A hd tl). -rec definition length A (l:list A) on l ≝ match l with -[ nil ⇒ 0 -| cons _ l ⇒ ↑(length A l) -]. - -interpretation "length (list)" - 'card l = (length ? l). - rec definition all A (R:predicate A) (l:list A) on l ≝ match l with [ nil ⇒ ⊤ - | cons hd tl ⇒ R hd ∧ all A R tl + | cons hd tl ⇒ ∧∧ R hd & all A R tl ]. - -(* Basic properties on length ***********************************************) - -lemma length_nil (A:Type[0]): |nil A| = 0. -// qed. - -lemma length_cons (A:Type[0]) (l:list A) (a:A): |a⨮l| = ↑|l|. -// qed. - -(* Basic inversion lemmas on length *****************************************) - -lemma length_inv_zero_dx (A:Type[0]) (l:list A): |l| = 0 → l = ◊. -#A * // #a #l >length_cons #H destruct -qed-. - -lemma length_inv_zero_sn (A:Type[0]) (l:list A): 0 = |l| → l = ◊. -/2 width=1 by length_inv_zero_dx/ qed-. - -lemma length_inv_succ_dx (A:Type[0]) (l:list A) (x): |l| = ↑x → - ∃∃tl,a. x = |tl| & l = a ⨮ tl. -#A * /2 width=4 by ex2_2_intro/ ->length_nil #x #H destruct -qed-. - -lemma length_inv_succ_sn (A:Type[0]) (l:list A) (x): ↑x = |l| → - ∃∃tl,a. x = |tl| & l = a ⨮ tl. -/2 width=1 by length_inv_succ_dx/ qed.