X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=matita%2Fmatita%2Fcontribs%2Flambda_delta%2FGround_2%2Flist.ma;h=09a52f57d4c8bb8bc6719cb1bfc2672d8dd8c037;hb=7e6643f9ce7ae87e9241aeac5b6d828e9d47fb63;hp=1b64bacce22699003281361352b1e8a009663a41;hpb=55dc00c1c44cc21c7ae179cb9df03e7446002c46;p=helm.git diff --git a/matita/matita/contribs/lambda_delta/Ground_2/list.ma b/matita/matita/contribs/lambda_delta/Ground_2/list.ma index 1b64bacce..09a52f57d 100644 --- a/matita/matita/contribs/lambda_delta/Ground_2/list.ma +++ b/matita/matita/contribs/lambda_delta/Ground_2/list.ma @@ -12,23 +12,36 @@ (* *) (**************************************************************************) -include "Ground-2/arith.ma". -include "Ground-2/notation.ma". +include "Ground_2/arith.ma". (* LISTS ********************************************************************) inductive list (A:Type[0]) : Type[0] := | nil : list A - | cons: A -> list A -> list A. + | cons: A → list A → list A. interpretation "nil (list)" 'Nil = (nil ?). interpretation "cons (list)" 'Cons hd tl = (cons ? hd tl). -let rec append A (l1: list A) l2 on l1 ≝ - match l1 with - [ nil ⇒ l2 - | cons hd tl ⇒ hd :: append A tl l2 +let rec all A (R:predicate A) (l:list A) on l ≝ + match l with + [ nil ⇒ True + | cons hd tl ⇒ R hd ∧ all A R tl ]. -interpretation "append (list)" 'Append l1 l2 = (append ? l1 l2). +inductive list2 (A1,A2:Type[0]) : Type[0] := + | nil2 : list2 A1 A2 + | cons2: A1 → A2 → list2 A1 A2 → list2 A1 A2. + +interpretation "nil (list of pairs)" 'Nil2 = (nil2 ? ?). (**) (* 'Nil causes unification error in aacr_abst *) + +interpretation "cons (list of pairs)" 'Cons hd1 hd2 tl = (cons2 ? ? hd1 hd2 tl). + +let rec append2 (A1,A2:Type[0]) (l1,l2:list2 A1 A2) on l1 ≝ match l1 with +[ nil2 ⇒ l2 +| cons2 a1 a2 tl ⇒ {a1, a2} :: append2 A1 A2 tl l2 +]. + +interpretation "append (list of pairs)" + 'Append l1 l2 = (append2 ? ? l1 l2).