9645
|
1 |
(*<*)
|
|
2 |
theory Nested0 = Main:
|
|
3 |
(*>*)
|
|
4 |
|
|
5 |
text{*
|
|
6 |
In \S\ref{sec:nested-datatype} we defined the datatype of terms
|
|
7 |
*}
|
|
8 |
|
|
9 |
datatype ('a,'b)"term" = Var 'a | App 'b "('a,'b)term list"
|
|
10 |
|
|
11 |
text{*\noindent
|
|
12 |
and closed with the observation that the associated schema for the definition
|
|
13 |
of primitive recursive functions leads to overly verbose definitions. Moreover,
|
|
14 |
if you have worked exercise~\ref{ex:trev-trev} you will have noticed that
|
|
15 |
you needed to reprove many lemmas reminiscent of similar lemmas about
|
|
16 |
@{term"rev"}. We will now show you how \isacommand{recdef} can simplify
|
|
17 |
definitions and proofs about nested recursive datatypes. As an example we
|
9754
|
18 |
choose exercise~\ref{ex:trev-trev}:
|
9645
|
19 |
*}
|
10186
|
20 |
|
|
21 |
consts trev :: "('a,'b)term \<Rightarrow> ('a,'b)term"
|
|
22 |
(*<*)end(*>*)
|