| 9722 |      1 | %
 | 
|  |      2 | \begin{isabellebody}%
 | 
| 10267 |      3 | \def\isabellecontext{Tree{\isadigit{2}}}%
 | 
| 17056 |      4 | %
 | 
|  |      5 | \isadelimtheory
 | 
|  |      6 | %
 | 
|  |      7 | \endisadelimtheory
 | 
|  |      8 | %
 | 
|  |      9 | \isatagtheory
 | 
|  |     10 | %
 | 
|  |     11 | \endisatagtheory
 | 
|  |     12 | {\isafoldtheory}%
 | 
|  |     13 | %
 | 
|  |     14 | \isadelimtheory
 | 
|  |     15 | %
 | 
|  |     16 | \endisadelimtheory
 | 
| 9493 |     17 | %
 | 
|  |     18 | \begin{isamarkuptext}%
 | 
|  |     19 | \noindent In Exercise~\ref{ex:Tree} we defined a function
 | 
|  |     20 | \isa{flatten} from trees to lists. The straightforward version of
 | 
| 9792 |     21 | \isa{flatten} is based on \isa{{\isacharat}} and is thus, like \isa{rev},
 | 
|  |     22 | quadratic. A linear time version of \isa{flatten} again reqires an extra
 | 
| 27015 |     23 | argument, the accumulator. Define%
 | 
| 9493 |     24 | \end{isamarkuptext}%
 | 
| 17175 |     25 | \isamarkuptrue%
 | 
| 27015 |     26 | flatten{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ tree\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}%
 | 
| 9493 |     27 | \begin{isamarkuptext}%
 | 
| 27015 |     28 | \noindent and prove%
 | 
| 9493 |     29 | \end{isamarkuptext}%
 | 
| 17175 |     30 | \isamarkuptrue%
 | 
| 17056 |     31 | %
 | 
|  |     32 | \isadelimproof
 | 
|  |     33 | %
 | 
|  |     34 | \endisadelimproof
 | 
|  |     35 | %
 | 
|  |     36 | \isatagproof
 | 
|  |     37 | %
 | 
|  |     38 | \endisatagproof
 | 
|  |     39 | {\isafoldproof}%
 | 
|  |     40 | %
 | 
|  |     41 | \isadelimproof
 | 
|  |     42 | %
 | 
|  |     43 | \endisadelimproof
 | 
| 17175 |     44 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |     45 | \ {\isachardoublequoteopen}flatten{\isadigit{2}}\ t\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ flatten\ t{\isachardoublequoteclose}%
 | 
| 17056 |     46 | \isadelimproof
 | 
|  |     47 | %
 | 
|  |     48 | \endisadelimproof
 | 
|  |     49 | %
 | 
|  |     50 | \isatagproof
 | 
|  |     51 | %
 | 
|  |     52 | \endisatagproof
 | 
|  |     53 | {\isafoldproof}%
 | 
|  |     54 | %
 | 
|  |     55 | \isadelimproof
 | 
|  |     56 | %
 | 
|  |     57 | \endisadelimproof
 | 
|  |     58 | %
 | 
|  |     59 | \isadelimtheory
 | 
|  |     60 | %
 | 
|  |     61 | \endisadelimtheory
 | 
|  |     62 | %
 | 
|  |     63 | \isatagtheory
 | 
|  |     64 | %
 | 
|  |     65 | \endisatagtheory
 | 
|  |     66 | {\isafoldtheory}%
 | 
|  |     67 | %
 | 
|  |     68 | \isadelimtheory
 | 
|  |     69 | %
 | 
|  |     70 | \endisadelimtheory
 | 
| 11866 |     71 | \end{isabellebody}%
 | 
| 9493 |     72 | %%% Local Variables:
 | 
|  |     73 | %%% mode: latex
 | 
|  |     74 | %%% TeX-master: "root"
 | 
|  |     75 | %%% End:
 |