doc-src/ProgProve/Thys/MyList.thy
author nipkow
Mon, 02 Apr 2012 10:49:03 +0200
changeset 47269 29aa0c071875
child 47302 70239da25ef6
permissions -rw-r--r--
New manual Programming and Proving in Isabelle/HOL

theory MyList
imports Main
begin

datatype 'a list = Nil | Cons "'a" "('a list)"

fun app :: "'a list => 'a list => 'a list" where
"app Nil ys = ys" |
"app (Cons x xs) ys = Cons x (app xs ys)"

fun rev :: "'a list => 'a list" where
"rev Nil = Nil" |
"rev (Cons x xs) = app (rev xs) (Cons x Nil)"

value "rev(Cons True (Cons False Nil))"

end