The variables described in this chapter should be set in the script mode
before proof-config-done
is called. These variables configure
recognition of commands in the proof script, and also control some of
the behaviour of script management.
The first four settings configure the generic parsing strategy for
commands in the proof script. Usually only one of these three needs to
be set. If the generic parsing functions are not flexible for your
needs, you can supply a value for proof-script-parse-function
.
Note that for the generic functions to work properly, it is
essential that you set the syntax table for your mode properly,
so that comments and strings are recognized. See the Emacs
documentation to discover how to do this (particularly for the function
modify-syntax-entry
).
See section 12.5 Proof script mode, for more details of the parsing functions.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands
', `proof-script-command-end-regexp
',
`proof-script-command-start-regexp
', `proof-terminal-char
',
or `proof-script-parse-function
'.
top-level
sexps.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands
', `proof-script-command-end-regexp
',
`proof-script-command-start-regexp
', `proof-terminal-char
',
or `proof-script-parse-function
'.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands
', `proof-script-command-end-regexp
',
`proof-script-command-start-regexp
', `proof-terminal-char
',
or `proof-script-parse-function
'.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands
', `proof-script-command-end-regexp
',
`proof-script-command-start-regexp
', `proof-terminal-char
',
or `proof-script-parse-function
'.
The next four settings configure the comment syntax. Notice that to get reliable behaviour of the parsing functions, you may need to modify the syntax table for your prover's mode. Read the Elisp manual for details about that.
comment-start
is set to this string plus a space.
Moreover, comments are usually ignored during script management, and not
sent to the proof process.
You should set this variable for reliable working of Proof General,
as well as `proof-script-comment-end
'.
The default value for this is set as (regexp-quote
proof-script-comment-start
)
but you can set this variable to something else more precise if necessary.
comment-end
is set to a space plus this string.
See also `proof-script-comment-start
'.
You should set this variable for reliable working of Proof General,
The default value for this is set as (regexp-quote
proof-script-comment-end
)
but you can set this variable to something else more precise if necessary.
case-fold-search
when recognizing portions of proof scripts.proof-script-complete
'.
The default value is `nil'. If your prover has a case insensitive
input syntax, proof-case-fold-search
should be set to `t' instead.
NB: This setting is not used for matching output from the prover.
Up to three settings each may be supplied for recognizing goal-like and
save-like commands. The -with-hole-
settings are used to make a
record of the name of the theorem proved, and also to build a default
value for the rather complicated setting
proof-script-next-entity-regexps
, which activates the function
menu feature.
The -p
subsidiary predicates were added to allow more
discriminating behaviour for particular proof assistants. (This is a
typical example of where the core framework needs some additional
generalization, to simplify matters, and allow for a smooth handling of
nested proofs; the present state is only part of the way there).
proof-goal-command-p
',
used as an important part of script management to find the start
of an atomic undo block, and (2) to construct the default
for `proof-script-next-entity-regexps
' used for function menus.
proof-goal-with-hole-result
using the same convention as
query-replace-regexp
.
Used for setting names of goal..save regions and for default
function-menu
configuration in proof-script-find-next-entity
.
It's safe to leave this setting as nil.
This is added as a more refined addition to proof-goal-command-regexp
,
to solve the problem that Coq and some other provers can have goals which
look like definitions, etc. (In the future we may generalize
proof-goal-command-regexp
instead).
proof-save-with-hole-result
using the same convention as
query-replace-regexp
.
Used for setting names of goal..save and proof regions and for
default function-menu
configuration in proof-script-find-next-entity
.
It's safe to leave this setting as nil.
nil - nothing special; close only when a save arrives'closeany
- close as soon as the next command arrives, save or not'closegoal
- close when the next "goal" command arrives'extend
- keep extending the closed region until a save or goal.
If your proof assistant allows nested goals, it will be wrong to close off the portion of proof so far, so this variable should be set to nil.
NB: 'extend
behaviour is not currently compatible with appearance of
save commands, so don't use that if your prover has save commands.
This is a more refined addition to proof-save-command-regexp
.
It should be a function taking a span and command as argument,
and can be used to track nested proofs. (See what is done in
isar/ for example). In the future, this setting should be
removed when the generic core is extended to handle nested
proofs smoothly.
To configure the function menu feature, there are a couple of settings. These can be used to recognize named proofs, and other elements in the proof script as well.
(anyentity-regexp discriminator-regexp ... discriminator-regexp)
The idea is that anyentity-regexp matches any named entity in the proof script, on a line where the name appears. This is assumed to be the start or the end of the entity. The discriminators then test which kind of entity has been found, to get its name. A discriminator-regexp has one of the forms
(regexp matchnos) (regexp matchnos'backward
backregexp) (regexp matchnos'forward
forwardregexp)
If regexp matches the string captured by anyentity-regexp, then matchnos are the match numbers for the substrings which name the entity (these may be either a single number or a list of numbers).
If 'backward
backregexp is present, then the start of the entity
is found by searching backwards for backregexp.
Conversely, if 'forward
forwardregexp is found, then the end of
the entity is found by searching forwards for forwardregexp.
Otherwise, the start and end of the entity will be the region matched by anyentity-regexp.
This mechanism allows fairly complex parsing of the buffer, in particular, it allows for goal..save regions which are named only at the end. However, it does not parse strings, comments, or parentheses.
This variable may not need to be set: a default value which should
work for goal..saves is calculated from proof-goal-with-hole-regexp
,
proof-goal-command-regexp
, and proof-save-with-hole-regexp
.
func-menu
. The default value is
proof-script-find-next-entity
, which searches for the next entity
based on fume-function-name-regexp which by default is set from
proof-script-next-entity-regexps
.
The function should move point forward in a buffer, and return a cons cell of the name and the beginning of the entity's region.
Note that proof-script-next-entity-regexps
is set to a default value
from proof-goal-with-hole-regexp
and proof-save-with-hole-regexp
in
the function proof-config-done
, so you may not need to worry about any
of this. See whether function menu does something sensible by
default.
The settings here are used to configure the way "undo" commands are calculated.
proof-generic-state-preserving-p
'
and `proof-generic-count-undos
'. If you don't use those,
may be left as nil.
This setting is used for the default `proof-generic-count-undos
'.
If you set `proof-count-undos-fn
' to some other function, there is no
need to set this variable.
proof-non-undoables-regexp
'.
Used in default function `proof-generic-count-undos
'.
proof-generic-count-undos
' is based on the
settings `proof-non-undoables-regexp
' and
`proof-non-undoables-regexp
'.
proof-undo-n-times-cmd
'.
A default value for `proof-count-undos-fn
'.
For this function to work properly, you must configure
`proof-undo-n-times-cmd
' and `proof-ignore-for-undo-count
'.
It should undo the effect of all settings between its target span
up to (proof-locked-end
). This may involve forgetting a number
of definitions, declarations, or whatever.
The special string proof-no-command
means there is nothing to do.
This is an important function for script management.
Study one of the existing instantiations for examples of how to write it,
or leave it set to the default function `proof-generic-find-and-forget
'
(which see).
This generic implementation assumes it is enough to find the
nearest following span with a `name' property, and retract
that using `proof-forget-id-command
' with the given name.
If this behaviour is not correct, you must customize the function with something different.
This is only used in the implementation of `proof-generic-find-and-forget
',
you only need to set if you use that function (by not customizing
`proof-find-and-forget-fn
'.
'goal'
or 'hyp'
. The second element is a
string: the goal or hypothesis itself.
If you leave this variable unset, no proof-by-pointing markup will be attempted.
If this is set to nil, PG will expect proof-find-and-forget-fn
to do all the work of retracting to an arbitrary point in a file.
Otherwise, the generic split-phase mechanism will be used:
1. If inside an unclosed proof, use proof-count-undos. 2. If retracting to before an unclosed proof, useproof-kill-goal-command
, followed byproof-find-and-forget-fn
if necessary.
Proof General allows configuration for provers which have particular notions of nested proofs. The right thing may happen automatically, or you may need to adjust some of the following settings.
First, you should alter the next setting if the prover retains history for nested proofs.
Used for provers which allow nested atomic goal-saves, but with some nested history that must be undone specially.
At the moment, the behaviour is that a goal-save span has a 'nestedundos
property which is set to the number of commands within it which match
this regexp. The idea is that the prover-specific code can create a
customized undo command to retract the goal-save region, based on the
'nestedundos
setting. Coq uses this to forget declarations, since
declarations in Coq reside in a separate context with its own (flat)
history.
A proof command is "safe" if it can be issued away from the proof script. For this to work it should be state-preserving in the proof assistant (with respect to an on-going proof).
proof-minibuffer-cmd
to filter out scripting
commands which should be entered directly into the script itself.
The default setting for this function, `proof-generic-state-preserving-p
'
tests by negating the match on `proof-non-undoables-regexp
'.
proof-non-undoables-regexp
.
This hook may be useful for synchronizing with the proof assistant, for example, to switch to a new theory (in case that isn't already done by commands in the proof script).
When functions in this hook are called, the variable
`activated-interactively' will be non-nil if
proof-activate-scripting
was called interactively
(rather than as a side-effect of some other action).
If a hook function sends commands to the proof process,
it should wait for them to complete (so the queue is cleared
for scripting commands), unless activated-interactively is set.
See section 8. Handling multiple files, for more details about this setting.
If your proof assistant has no management of file dependencies, or one which depends on a simple linear context, you may be able to use this setting to good effect. If the proof assistant has more complex file dependencies then you should configure it to communicate with Proof General about the dependencies rather than using this setting.
Proof General allows provers to create a completion table to help writing keywords and identifiers in proof scripts. This is documented in the main Proof General user manual but summarized here for (a different kind of) completion.
Completions are filled in according to what has been recently typed, from a database of symbols. The database is automatically saved at the end of a session. Completion is usually a hand-wavy thing, so we don't make any attempt to maintain a precise completion table or anything.
The completion table maintained by `complete.el' is initialized
from PA-completion-table
when `proof-script.el' is loaded.
This is done with the function proof-add-completions
which
you may want to call at other times.
If this table is empty or needs adjusting, please make changes using
`customize-variable
' and send suggestions to support@proofgeneral.org
add-completion
' with a negative number of uses and ancient
last use time, to discourage saving these into the users database.
Go to the first, previous, next, last section, table of contents.