new theory list.Prefix

parent 8b293634
...@@ -341,6 +341,20 @@ theory Distinct ...@@ -341,6 +341,20 @@ theory Distinct
end end
theory Prefix
use export List
use import int.Int
function prefix (n: int) (l: list 'a) : list 'a =
if n <= 0 then Nil else
match l with
| Nil -> Nil
| Cons x r -> Cons x (prefix (n-1) r)
end
end
(** {2 Induction on lists} *) (** {2 Induction on lists} *)
theory Induction theory Induction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment