Isabelle Proof General supports all major generic features of Proof General, including integration with Isabelle's theory loader for proper automatic multiple file handling. Only support for tags and proof-by-pointing is missing.
It is very important to note that there are actually two different versions of Isabelle Proof General: for "classic" Isabelle and for Isabelle/Isar. An old-style Isabelle theory typically consists of `.thy' and correspondent `.ML' files, while Isabelle/Isar theories usually have a new-style `.thy' only, which has a slightly different syntax and may contain both definitions and proofs.
While Isabelle is able to manage both classic and Isar theories at the
same time (the theory loader determines the source format
automatically), Proof General does not admit to work on both kinds
of Isabelle source files at the same time! Proof General treats
isa
and isar
as different instances; there is no way to
switch modes once Proof General has been started.
The classic version of Isabelle Proof General includes a mode for
editing theory files taken from David Aspinall's Isamode interface, see
http://www.proofgeneral.org/~isamode. Detailed documentation for
the theory file mode is included with Isamode
, there are some
notes on the special functions available and customization settings
below.
Note that in "classic" Isabelle, `.thy' files contain definitions and declarations for a theory, while `.ML' contain proof scripts. So most of Proof General's functions only make sense in `.ML' files, and there is no toolbar and only a short menu for `.thy' files.
In Isabelle/Isar, on the other hand, `.thy' files contain proofs as well as definitions for theories, so scripting takes place there and you see the usual toolbar and scripting functions of Proof General.
The default Emacs mode setup of Proof General prefers the newer
isar
version over isa
. To load the "classic" Isabelle
mode, you can either make sure to visit a `.ML' before a
`.thy' file, or set the environment variable
PROOFGENERAL_ASSISTANTS=isa
before starting Emacs in order to
prevent loading of the Isabelle/Isar mode. Another way of
selecting Isa is to put a special modeline like this:
(* -*- isa -*- *)
near the top of your Isabelle `.thy' files (or at least, the first file you visit). This Emacs feature overrides the default choice of mode based on the file extension.
Isabelle provides yet another way to invoke Proof General, including
additional means to select either version. The standard installation
of Isabelle also makes the isar
version of Proof General its
default user interface: running plain Isabelle
starts an Emacs
session with Isabelle/Isar Proof General; giving an option -I
false
refers to the classic version instead. The defaults may be
changed by editing the Isabelle settings, see the Isabelle
documentation for details.
Proof General for classic Isabelle primarily manages `.ML' files containing proof scripts. There is a separate mode for editing old-style `.thy' files, which supports batch mode only.
In Isabelle, ML files are used to hold proof scripts, as well as definitions of tactics, proof procedures, etc. So ML files are the normal domain of Proof General. But there are some things to be wary of.
Proof General does not understand full ML syntax, so ideally you should only use Proof General's scripting commands on `.ML' files which contain proof commands (no ML functions, structures, etc).
If you do use files with Proof General which declare functions, structures, etc, you should be okay provided your code doesn't include non top-level semi-colons (which will confuse Proof General's simplistic parser), and provided all value declarations (and other non proof-steps) occur outside proofs. This is because within proofs, Proof General considers every ML command to be a proof step which is undoable.
For example, do this:
structure S = struct val x = 3 val y = 4 end;
instead of this:
structure S = struct val x = 3; val y = 4; end
In the second case, just the first binding in the structure body will be sent to Isabelle and Proof General will wait indefinitely.
And do this:
val intros1 = REPEAT (resolve_tac [impI,allI] 1); Goal "Q(x) --> (ALL x. P(x) --> P(x))"; br impI 1; by intros1; ba 1; qed "mythm";
instead of this:
Goal "Q(x) --> (ALL x. P(x) --> P(x))"; br impI 1; val intros1 = REPEAT (resolve_tac [impI,allI] 1); by intros1; ba 1; qed "mythm";
In the last case, when you undo, Proof General wrongly considers the
val
declaration to be a proof step, and it will issue an
undo
to Isabelle to undo it. This leads to a loss of
synchronization. To fix things when this happens, simply retract to
some point before the Goal
command and rearrange your script.
Having ML as a top-level, Isabelle even lets you redefine the entire proof command language, which will certainly confuse Proof General. Stick to using the standard functions, tactics, and tacticals and there should be no problems. (In fact, there should be no problems provided you don't use your own "goal" or "qed" forms, which Proof General recognizes. As the example above shows, Proof General makes no attempt to recognize arbitrary tactic applications).
As well as locking ML files, Isabelle Proof General locks theory files when they are loaded. Theory files are always completely locked or completely unlocked, because they are processed atomically.
Proof General tries to load the theory file for a `.ML' file automatically before you start scripting. This relies on support especially for Proof General built into Isabelle's theory loader.
However, because scripting cannot begin until the theory is loaded, and it should not begin if an error occurs during loading the theory, Proof General blocks waiting for the theory loader to finish. If you have a theory file which takes a long time to load, you might want to load it directly, from the `.thy' buffer. Extra commands are provided in theory mode for this:
The key C-c C-b (isa-process-thy-file
) will cause Isabelle
to read the theory file being edited. This causes the file and all its
children (both theory and ML files) to be read. Any top-level ML file
associated with this theory file is not read, in contrast
with the use_thy
command of Isabelle.
The key C-c C-u (isa-retract-thy-file
) will retract
(unlock) the theory file being edited. This unlocks the file and all
its children (theory and ML files); no changes occur in Isabelle itself.
buffer-file-name
.
buffer-file-name
.This section has some notes on the instantiation of the generic part of Proof General for Isabelle. (The generic part of Proof General applies to all proof assistants supported, and is described in detail in the rest of this manual).
Find theorems. This toolbar/menu command invokes a special
version of thms_containing
. To give several constants, separate
their names with commas.
This section mentions some commands which are added specifically to the Isabelle Proof General instance.
In Isabelle proof script mode, C-c C-o (thy-find-other-file
)
finds and switches to the associated theory file, that is, the file with
the same base name but extension `.thy' swapped for `.ML'.
The same function (and key-binding) switches back to an ML file from the theory file.
Here are some of the user options specific to Isabelle. You can set these as usual with the customization mechanism.
sml-mode
inside "ML" section of theory files.sml-mode
, but at the moment there is no way to do this.
The default value is nil
.
The default value is 2
.
thy-insert-header
,thy-insert-class
,thy-insert-default-sort
,thy-insert-const
,thy-insert-rule
.
The nil template does nothing. You can add extra sections to theory files by extending this variable.
`%t' -- replaced by theory name.
`%p' -- replaced by names of parents, separated by `+' characters.
Proof General for Isabelle/Isar manages new-style `.thy' files, which may contain both definitions and proofs. Proofs may be human readable proof texts as well as traditional tactic scripts adjusted to follow the Isar syntax.
The syntax of Isabelle/Isar input is technically simple, enabling Proof General to provide reliable control over incremental execution of the text. Thus it is very hard to let Proof General lose synchronization with the Isabelle/Isar process. The caveats of `.ML' files discussed for the classic Isabelle version (see section 10.1 Classic Isabelle) do not apply here.
Find theorems. This toolbar/menu command invokes
thms_containing
. Several term arguments may be given, separated
by white space as usual in Isar.
The Isabelle/Isar instance of Proof General supplies several specific help key bindings; these functions are offered within the prover help menu as well.
The following shortcuts insert control sequences into the text, modifying the appearance of individual symbols (single letters, mathematical entities etc.); the X-Symbol package will provide immediate visual feedback.
Command termination via `;
' is an optional feature of Isar
syntax. Neither Isabelle/Isar nor Proof General require semicolons to
do their job. The following command allows to get rid of command
terminators in existing texts.
Go to the first, previous, next, last section, table of contents.