]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/library/list/list.ma
fast and sound registry lists
[helm.git] / helm / software / matita / library / list / list.ma
index f214ff3efa11b6b2559bfa302f2d5dfb4174495d..f832d502002f3c9a59855a13acea0ac966fa69bc 100644 (file)
@@ -133,3 +133,13 @@ simplify.
 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'
+  ].