9722
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
8749
|
3 |
%
|
|
4 |
\begin{isamarkuptext}%
|
|
5 |
\noindent
|
|
6 |
Define the datatype of binary trees%
|
|
7 |
\end{isamarkuptext}%
|
9673
|
8 |
\isacommand{datatype}\ {\isacharprime}a\ tree\ {\isacharequal}\ Tip\ {\isacharbar}\ Node\ {\isachardoublequote}{\isacharprime}a\ tree{\isachardoublequote}\ {\isacharprime}a\ {\isachardoublequote}{\isacharprime}a\ tree{\isachardoublequote}%
|
8749
|
9 |
\begin{isamarkuptext}%
|
|
10 |
\noindent
|
|
11 |
and a function \isa{mirror} that mirrors a binary tree
|
|
12 |
by swapping subtrees (recursively). Prove%
|
|
13 |
\end{isamarkuptext}%
|
9673
|
14 |
\isacommand{lemma}\ mirror{\isacharunderscore}mirror{\isacharcolon}\ {\isachardoublequote}mirror{\isacharparenleft}mirror\ t{\isacharparenright}\ {\isacharequal}\ t{\isachardoublequote}%
|
9493
|
15 |
\begin{isamarkuptext}%
|
|
16 |
\noindent
|
|
17 |
Define a function \isa{flatten} that flattens a tree into a list
|
|
18 |
by traversing it in infix order. Prove%
|
|
19 |
\end{isamarkuptext}%
|
9722
|
20 |
\isacommand{lemma}\ {\isachardoublequote}flatten{\isacharparenleft}mirror\ t{\isacharparenright}\ {\isacharequal}\ rev{\isacharparenleft}flatten\ t{\isacharparenright}{\isachardoublequote}\end{isabellebody}%
|
9145
|
21 |
%%% Local Variables:
|
|
22 |
%%% mode: latex
|
|
23 |
%%% TeX-master: "root"
|
|
24 |
%%% End:
|