doc-src/TutorialI/Misc/Tree.thy
author wenzelm
Tue, 01 Aug 2000 13:43:22 +0200
changeset 9490 c2606af9922c
parent 9458 c613cd06d5cf
child 9493 494f8cd34df7
permissions -rw-r--r--
tuned msg;

(*<*)
theory Tree = Main:
(*>*)

text{*\noindent
Define the datatype of binary trees
*}

datatype 'a tree = Tip | Node "'a tree" 'a "'a tree";(*<*)

consts mirror :: "'a tree \\<Rightarrow> 'a tree";
primrec
"mirror Tip = Tip"
"mirror (Node l x r) = Node (mirror l) x (mirror r)";(*>*)

text{*\noindent
and a function \isa{mirror} that mirrors a binary tree
by swapping subtrees (recursively). Prove
*}

lemma mirror_mirror: "mirror(mirror t) = t";
(*<*)
apply(induct_tac t);
by(auto);

end
(*>*)