doc-src/TutorialI/ToyList2/ToyList1
author wenzelm
Wed, 11 Oct 2006 00:27:38 +0200
changeset 20963 a7fd8f05a2be
parent 15141 a95c2ff210ba
child 26729 43a72d892594
permissions -rw-r--r--
added type global_theory -- theory or local_theory; added begin/exit_local_theory; removed theory_context; renamed body_context_node to presentation_context; removed copy (checkpoint twice instead -- avoids unrelated theories);

theory ToyList
imports PreList
begin

datatype 'a list = Nil                          ("[]")
                 | Cons 'a "'a list"            (infixr "#" 65)

consts app :: "'a list => 'a list => 'a list"   (infixr "@" 65)
       rev :: "'a list => 'a list"

primrec
"[] @ ys       = ys"
"(x # xs) @ ys = x # (xs @ ys)"

primrec
"rev []        = []"
"rev (x # xs)  = (rev xs) @ (x # [])"