]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/library/list/list.ma
more work on q
[helm.git] / helm / software / matita / library / list / list.ma
index 2e0df971e20be45531554c7839d739cc7605e1c4..e4787fe8422fcf55a0888cc9da3b4d237239ff0c 100644 (file)
@@ -142,21 +142,29 @@ reflexivity.
 qed.
 *)
 
-let rec nth (A:Type) l d n on n ≝
- match n with
-  [ O ⇒
-     match l with
-      [ nil ⇒ d
-      | cons (x : A) _ ⇒ x
-      ]
-  | S n' ⇒ nth A (tail ? l) d n'
-  ].
+definition nth ≝
+  λA:Type.
+    let rec nth l d n on n ≝
+      match n with
+      [ O ⇒
+         match l with
+         [ nil ⇒ d
+         | cons (x : A) _ ⇒ x
+         ]
+      | S n' ⇒ nth (tail ? l) d n']
+    in nth.
   
-let rec map (A,B:Type) (f: A → B) (l : list A) on l : list B ≝
-  match l with [ nil ⇒ nil ? | cons x tl ⇒ f x :: (map A B f tl)].
+definition map ≝
+  λA,B:Type.λf:A→B.
+  let rec map (l : list A) on l : list B ≝
+    match l with [ nil ⇒ nil ? | cons x tl ⇒ f x :: (map tl)]
+  in map.
   
-let rec foldr (A,B:Type) (f : A → B → B) (b : B) (l : list A) on l : B := 
-  match l with [ nil ⇒ b | (cons a l) ⇒ f a (foldr ? ? f b l)].
+definition foldr ≝
+  λA,B:Type.λf:A→B→B.λb:B.
+  let rec foldr (l : list A) on l : B := 
+    match l with [ nil ⇒ b | (cons a l) ⇒ f a (foldr l)]
+  in foldr.
    
 definition length ≝ λT:Type.λl:list T.foldr T nat (λx,c.S c) O l.