equal
deleted
inserted
replaced
1 % |
1 % |
2 \begin{isabellebody}% |
2 \begin{isabellebody}% |
3 \def\isabellecontext{Nested{\isadigit{1}}}% |
3 \def\isabellecontext{Nested{\isadigit{1}}}% |
|
4 \isamarkupfalse% |
4 % |
5 % |
5 \begin{isamarkuptext}% |
6 \begin{isamarkuptext}% |
6 \noindent |
7 \noindent |
7 Although the definition of \isa{trev} below is quite natural, we will have |
8 Although the definition of \isa{trev} below is quite natural, we will have |
8 to overcome a minor difficulty in convincing Isabelle of its termination. |
9 to overcome a minor difficulty in convincing Isabelle of its termination. |
11 |
12 |
12 Defining \isa{trev} by \isacommand{recdef} rather than \isacommand{primrec} |
13 Defining \isa{trev} by \isacommand{recdef} rather than \isacommand{primrec} |
13 simplifies matters because we are now free to use the recursion equation |
14 simplifies matters because we are now free to use the recursion equation |
14 suggested at the end of \S\ref{sec:nested-datatype}:% |
15 suggested at the end of \S\ref{sec:nested-datatype}:% |
15 \end{isamarkuptext}% |
16 \end{isamarkuptext}% |
|
17 \isamarkuptrue% |
16 \isacommand{recdef}\ trev\ {\isachardoublequote}measure\ size{\isachardoublequote}\isanewline |
18 \isacommand{recdef}\ trev\ {\isachardoublequote}measure\ size{\isachardoublequote}\isanewline |
17 \ {\isachardoublequote}trev\ {\isacharparenleft}Var\ x{\isacharparenright}\ \ \ \ {\isacharequal}\ Var\ x{\isachardoublequote}\isanewline |
19 \ {\isachardoublequote}trev\ {\isacharparenleft}Var\ x{\isacharparenright}\ \ \ \ {\isacharequal}\ Var\ x{\isachardoublequote}\isanewline |
18 \ {\isachardoublequote}trev\ {\isacharparenleft}App\ f\ ts{\isacharparenright}\ {\isacharequal}\ App\ f\ {\isacharparenleft}rev{\isacharparenleft}map\ trev\ ts{\isacharparenright}{\isacharparenright}{\isachardoublequote}% |
20 \ {\isachardoublequote}trev\ {\isacharparenleft}App\ f\ ts{\isacharparenright}\ {\isacharequal}\ App\ f\ {\isacharparenleft}rev{\isacharparenleft}map\ trev\ ts{\isacharparenright}{\isacharparenright}{\isachardoublequote}\isamarkupfalse% |
|
21 % |
19 \begin{isamarkuptext}% |
22 \begin{isamarkuptext}% |
20 \noindent |
23 \noindent |
21 Remember that function \isa{size} is defined for each \isacommand{datatype}. |
24 Remember that function \isa{size} is defined for each \isacommand{datatype}. |
22 However, the definition does not succeed. Isabelle complains about an |
25 However, the definition does not succeed. Isabelle complains about an |
23 unproved termination condition |
26 unproved termination condition |
35 recursive call of \isa{trev} is strictly less than \isa{size\ {\isacharparenleft}App\ f\ ts{\isacharparenright}}, |
38 recursive call of \isa{trev} is strictly less than \isa{size\ {\isacharparenleft}App\ f\ ts{\isacharparenright}}, |
36 which equals \isa{Suc\ {\isacharparenleft}term{\isacharunderscore}list{\isacharunderscore}size\ ts{\isacharparenright}}. We will now prove the termination condition and |
39 which equals \isa{Suc\ {\isacharparenleft}term{\isacharunderscore}list{\isacharunderscore}size\ ts{\isacharparenright}}. We will now prove the termination condition and |
37 continue with our definition. Below we return to the question of how |
40 continue with our definition. Below we return to the question of how |
38 \isacommand{recdef} knows about \isa{map}.% |
41 \isacommand{recdef} knows about \isa{map}.% |
39 \end{isamarkuptext}% |
42 \end{isamarkuptext}% |
|
43 \isamarkuptrue% |
|
44 \isamarkupfalse% |
40 \end{isabellebody}% |
45 \end{isabellebody}% |
41 %%% Local Variables: |
46 %%% Local Variables: |
42 %%% mode: latex |
47 %%% mode: latex |
43 %%% TeX-master: "root" |
48 %%% TeX-master: "root" |
44 %%% End: |
49 %%% End: |