[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 3. Subterm Activation and Proof by Pointing

This chapter describes what you can do from inside the goals buffer, providing support for these features exists for your proof assistant. As of Proof General 3.0, it only exists for LEGO. If you would like to see subterm activation support for Proof General in another proof assistant, please petition the developers of that proof assistant to provide it!

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 3.1 Goals buffer commands

When you are developing a proof, the input focus (Emacs cursor) is usually on the script buffer. Therefore Proof General binds mouse buttons for commands in the goals buffer, to avoid the need to move the cursor between buffers.

The mouse bindings are these:

`button2`

  `pg-goals-button-action`

`C-button2`

  `proof-undo-and-delete-last-successful-command`

`button3`

  `pg-goals-yank-subterm`

Where `button2` indicates the middle mouse button, and `button3` indicates the right hand mouse button.

The idea is that you can automatically construct parts of a proof by clicking. Using the middle mouse button asks the proof assistant to try to do a step in the proof, based on where you click. If you don't like the command which was inserted into the script, you can use the control key with the middle button to undo the step, and delete it from your script.

Note that proof-by-pointing may construct several commands in one go. These are sent back to the proof assistant altogether and appear as a single step in the proof script. However, if the proof is later replayed (without using PBP), the proof-by-pointing constructions will be considered as separate proof commands, as usual.

Command: pg-goals-button-action event

  Construct a proof-by-pointing command based on the mouse-click event.
  This function should be bound to a mouse button in the Proof General goals buffer.

  The event is used to find the smallest subterm around a point. A position code for the subterm is sent to the proof assistant, to ask it to construct an appropriate proof command. The command which is constructed will be inserted at the end of the locked region in the proof script buffer, and immediately sent back to the proof assistant. If it succeeds, the locked region will be extended to cover the proof-by-pointing command, just as for any proof command the user types by hand.

Proof-by-pointing uses markup describing the term structure of the concrete syntax output by the proof assistant. This markup is useful in itself: it allows you to explore the structure of a term using the mouse (the smallest subexpression that the mouse is over is highlighted), and easily copy subterms from the output to a proof script.

The right-hand mouse button provides this convenient way to copy subterms from the goals buffer, using the function `pg-goals-yank-subterm`.

Command: pg-goals-yank-subterm event

  Copy the subterm indicated by the mouse-click event.
  This function should be bound to a mouse button in the Proof General goals buffer.

  The event is used to find the smallest subterm around a point. The subterm is copied to the ‘``kill-ring``’, and immediately yanked (copied) into the current buffer at the current cursor position.

  In case the current buffer is the goals buffer itself, the yank is not performed. Then the subterm can be retrieved later by an explicit yank.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by David Aspinall on July, 24 2008 using texi2html 1.78.