src/Doc/Tutorial/Recdef/Nested0.thy
author wenzelm
Wed, 17 Nov 2021 15:54:11 +0100
changeset 74815 cfc15da73a78
parent 67406 23307fd33906
permissions -rw-r--r--
afford more parallelism for sessions (instead of theories in 5eac4b13d1f1): depend on disjoint data areas (notably base.session_theories in 2ad892ac749a);

(*<*)
theory Nested0 imports Main begin
(*>*)

text\<open>
\index{datatypes!nested}%
In \S\ref{sec:nested-datatype} we defined the datatype of terms
\<close>

datatype ('a,'b)"term" = Var 'a | App 'b "('a,'b)term list"

text\<open>\noindent
and closed with the observation that the associated schema for the definition
of primitive recursive functions leads to overly verbose definitions. Moreover,
if you have worked exercise~\ref{ex:trev-trev} you will have noticed that
you needed to declare essentially the same function as @{term"rev"}
and prove many standard properties of list reversal all over again. 
We will now show you how \isacommand{recdef} can simplify
definitions and proofs about nested recursive datatypes. As an example we
choose exercise~\ref{ex:trev-trev}:
\<close>

consts trev  :: "('a,'b)term \<Rightarrow> ('a,'b)term"
(*<*)end(*>*)