9722
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
10267
|
3 |
\def\isabellecontext{Nested{\isadigit{0}}}%
|
17181
|
4 |
\isamarkupfalse%
|
17056
|
5 |
%
|
|
6 |
\isadelimtheory
|
|
7 |
%
|
|
8 |
\endisadelimtheory
|
|
9 |
%
|
|
10 |
\isatagtheory
|
|
11 |
%
|
|
12 |
\endisatagtheory
|
|
13 |
{\isafoldtheory}%
|
|
14 |
%
|
|
15 |
\isadelimtheory
|
|
16 |
%
|
|
17 |
\endisadelimtheory
|
9698
|
18 |
%
|
|
19 |
\begin{isamarkuptext}%
|
11494
|
20 |
\index{datatypes!nested}%
|
9698
|
21 |
In \S\ref{sec:nested-datatype} we defined the datatype of terms%
|
|
22 |
\end{isamarkuptext}%
|
17175
|
23 |
\isamarkuptrue%
|
|
24 |
\isacommand{datatype}\isamarkupfalse%
|
|
25 |
\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}{\isachardoublequoteopen}term{\isachardoublequoteclose}\ {\isacharequal}\ Var\ {\isacharprime}a\ {\isacharbar}\ App\ {\isacharprime}b\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}term\ list{\isachardoublequoteclose}%
|
9698
|
26 |
\begin{isamarkuptext}%
|
|
27 |
\noindent
|
|
28 |
and closed with the observation that the associated schema for the definition
|
|
29 |
of primitive recursive functions leads to overly verbose definitions. Moreover,
|
|
30 |
if you have worked exercise~\ref{ex:trev-trev} you will have noticed that
|
10878
|
31 |
you needed to declare essentially the same function as \isa{rev}
|
11196
|
32 |
and prove many standard properties of list reversal all over again.
|
10878
|
33 |
We will now show you how \isacommand{recdef} can simplify
|
9698
|
34 |
definitions and proofs about nested recursive datatypes. As an example we
|
9754
|
35 |
choose exercise~\ref{ex:trev-trev}:%
|
9698
|
36 |
\end{isamarkuptext}%
|
17175
|
37 |
\isamarkuptrue%
|
|
38 |
\isacommand{consts}\isamarkupfalse%
|
|
39 |
\ trev\ \ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}term\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}b{\isacharparenright}term{\isachardoublequoteclose}%
|
17056
|
40 |
\isadelimtheory
|
|
41 |
%
|
|
42 |
\endisadelimtheory
|
|
43 |
%
|
|
44 |
\isatagtheory
|
|
45 |
%
|
|
46 |
\endisatagtheory
|
|
47 |
{\isafoldtheory}%
|
|
48 |
%
|
|
49 |
\isadelimtheory
|
|
50 |
%
|
|
51 |
\endisadelimtheory
|
11866
|
52 |
\end{isabellebody}%
|
9698
|
53 |
%%% Local Variables:
|
|
54 |
%%% mode: latex
|
|
55 |
%%% TeX-master: "root"
|
|
56 |
%%% End:
|