doc-src/TutorialI/Recdef/Nested0.thy
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 12 Aug 2010 15:03:34 +0200
branchisac-from-Isabelle2009-2
changeset 37913 20e3616b2d9c
parent 16417 9bc16273c2d4
permissions -rw-r--r--
prepare reactivation of isac-update-Isa09-2
nipkow@9645
     1
(*<*)
haftmann@16417
     2
theory Nested0 imports Main begin
nipkow@9645
     3
(*>*)
nipkow@9645
     4
nipkow@9645
     5
text{*
paulson@11494
     6
\index{datatypes!nested}%
nipkow@9645
     7
In \S\ref{sec:nested-datatype} we defined the datatype of terms
nipkow@9645
     8
*}
nipkow@9645
     9
nipkow@9645
    10
datatype ('a,'b)"term" = Var 'a | App 'b "('a,'b)term list"
nipkow@9645
    11
nipkow@9645
    12
text{*\noindent
nipkow@9645
    13
and closed with the observation that the associated schema for the definition
nipkow@9645
    14
of primitive recursive functions leads to overly verbose definitions. Moreover,
nipkow@9645
    15
if you have worked exercise~\ref{ex:trev-trev} you will have noticed that
paulson@10885
    16
you needed to declare essentially the same function as @{term"rev"}
nipkow@11196
    17
and prove many standard properties of list reversal all over again. 
paulson@10885
    18
We will now show you how \isacommand{recdef} can simplify
nipkow@9645
    19
definitions and proofs about nested recursive datatypes. As an example we
nipkow@9754
    20
choose exercise~\ref{ex:trev-trev}:
nipkow@9645
    21
*}
nipkow@10186
    22
nipkow@10186
    23
consts trev  :: "('a,'b)term \<Rightarrow> ('a,'b)term"
nipkow@10186
    24
(*<*)end(*>*)