src/Doc/Tutorial/ToyList/ToyList1
author blanchet
Fri, 14 Mar 2014 01:28:15 +0100
changeset 56120 04c37dfef684
parent 48985 5386df44a037
permissions -rw-r--r--
updated Sledgehammer docs w.r.t. 'smt2' and 'z3_new'

theory ToyList
imports Datatype
begin

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

(* This is the append function: *)
primrec app :: "'a list => 'a list => 'a list"  (infixr "@" 65)
where
"[] @ ys       = ys" |
"(x # xs) @ ys = x # (xs @ ys)"

primrec rev :: "'a list => 'a list" where
"rev []        = []" |
"rev (x # xs)  = (rev xs) @ (x # [])"