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