9722
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
9924
|
3 |
\def\isabellecontext{Tree2}%
|
9493
|
4 |
%
|
|
5 |
\begin{isamarkuptext}%
|
|
6 |
\noindent In Exercise~\ref{ex:Tree} we defined a function
|
|
7 |
\isa{flatten} from trees to lists. The straightforward version of
|
9792
|
8 |
\isa{flatten} is based on \isa{{\isacharat}} and is thus, like \isa{rev},
|
|
9 |
quadratic. A linear time version of \isa{flatten} again reqires an extra
|
9493
|
10 |
argument, the accumulator:%
|
|
11 |
\end{isamarkuptext}%
|
10187
|
12 |
\isacommand{consts}\ flatten{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ tree\ {\isacharequal}{\isachargreater}\ {\isacharprime}a\ list\ {\isacharequal}{\isachargreater}\ {\isacharprime}a\ list{\isachardoublequote}%
|
9493
|
13 |
\begin{isamarkuptext}%
|
10187
|
14 |
\noindent Define \isa{flatten{\isadigit{2}}} and prove%
|
9493
|
15 |
\end{isamarkuptext}%
|
10187
|
16 |
\isacommand{lemma}\ {\isachardoublequote}flatten{\isadigit{2}}\ t\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ flatten\ t{\isachardoublequote}\end{isabellebody}%
|
9493
|
17 |
%%% Local Variables:
|
|
18 |
%%% mode: latex
|
|
19 |
%%% TeX-master: "root"
|
|
20 |
%%% End:
|