next up previous
Next: Step 7: Making Up: The TkHol Tutorial Previous: Step 5: Making

Step 6: Doing a Backward Proof

  By now you should have:

  1. Started TkHol.
  2. Created a theory segment called btree in which to develop a theory of binary trees.
  3. Defined the primitive recursive type btree using the New Recursive Type tool.
  4. Defined Size and PasteLeft using the New Recursive Definition tool.
We now want to prove some simple facts about Size and PasteLeft. Begin by selecting New Backward Proof from the Proofs menu of the Theory Viewer. A ``Goal Proof'' window will appear. This tool is a powerful goalstack manager, and will probably be the tool you will be using most.

Proving Size btree > 0

In the Current Goal(s) area enter

!btree:'a btree. Size btree > 0
and select the Set Goal button. You may also press Ctrl-Return to set the goal when the keyboard focus is in the goal area. The goal should now be formatted in a pretty printed fashion.

The goal can be proved easily by structural induction on binary trees in simplification with the HOL arithmetic decision procedures. In the Next Tactic box enter

INDUCT_THEN btree_Induct STRIP_ASSUME_TAC
and press the Apply Tactic button. You may also press Ctrl-Return to apply a tactic, when the focus is in the Next Tactic area. Two subgoals should now be generated, and the first of these displayed.

To solve the first subgoal, simply apply the tactics

REWRITE_TAC [Size_DEF]
and
CONV_TAC ARITH_CONV

 
Figure: The Second Case of the Induction

To solve the second subgoal we also need to expand the definition of Size. There is a history mechanism available in the Next Tactic window. Press Meta-P twice and

REWRITE_TAC [Size_DEF]
should reappear. Again applying
CONV_TAC ARITH_CONV
solves the goal.

You will now be prompted with a box asking what you wish to do with the theorem you have just proved.

NOTE: The Goal Proof has several sophisticated features not explained in this tutorial. In due course a proper manual explaining things will appear. In the mean time just experiment.

Proving Size (PasteLeft b1 b2) = Size b1 + Size b2



next up previous
Next: Step 7: Making Up: The TkHol Tutorial Previous: Step 5: Making



Donald Syme
Fri Sep 1 04:00:07 BST 1995