Given the following primitive recursion theorem for labelled binary trees:
|- !f0 f1.
?! fn.
(!x. fn(LEAF x) = f0 x) /\
(!b1 b2. fn(NODE b1 b2) = f1(fn b1)(fn b2)b1 b2)
prove_induction_thm proves and returns the theorem:
|- !P. (!x. P(LEAF x)) /\ (!b1 b2. P b1 /\ P b2 ==> P(NODE b1 b2)) ==>
(!b. P b)
This theorem states the principle of structural induction on labelled
binary trees: if a predicate P is true of all leaf nodes, and if whenever it
is true of two subtrees b1 and b2 it is also true of the tree NODE b1 b2,
then P is true of all labelled binary trees.