doc-src/IsarRef/intro.tex
author wenzelm
Thu, 21 Oct 1999 17:42:21 +0200
changeset 7895 7c492d8bc8e3
parent 7875 1baf422ec16a
child 7981 5120a2a15d06
permissions -rw-r--r--
updated;
wenzelm@7046
     1
wenzelm@7046
     2
\chapter{Introduction}
wenzelm@7046
     3
wenzelm@7167
     4
\section{Quick start}
wenzelm@7167
     5
wenzelm@7175
     6
Isar is already part of Isabelle (as of version Isabelle99, or later).  The
wenzelm@7175
     7
\texttt{isabelle} binary provides option \texttt{-I} to run the Isar
wenzelm@7175
     8
interaction loop at startup, rather than the plain ML top-level.  Thus the
wenzelm@7175
     9
quickest way to do anything with Isabelle/Isar is as follows:
wenzelm@7175
    10
\begin{ttbox}
wenzelm@7175
    11
isabelle -I HOL\medskip
wenzelm@7175
    12
\out{> Welcome to Isabelle/HOL (Isabelle99)}\medskip
wenzelm@7175
    13
theory Foo = Main:
wenzelm@7297
    14
constdefs foo :: nat  "foo == 1";
wenzelm@7297
    15
lemma "0 < foo" by (simp add: foo_def);
wenzelm@7175
    16
end
wenzelm@7175
    17
\end{ttbox}
wenzelm@7895
    18
Note that any Isabelle/Isar command may be retracted by \texttt{undo}; the
wenzelm@7895
    19
\texttt{help} command prints the list of available language elements.
wenzelm@7167
    20
wenzelm@7175
    21
Plain TTY-based interaction like this used to be quite feasible with
wenzelm@7175
    22
traditional tactic based theorem proving, but developing Isar documents
wenzelm@7297
    23
demands some better user-interface support.  \emph{Proof~General}\index{Proof
wenzelm@7297
    24
  General} of LFCS Edinburgh \cite{proofgeneral} offers a generic Emacs-based
wenzelm@7297
    25
environment for interactive theorem provers that does all the cut-and-paste
wenzelm@7297
    26
and forward-backward walk through the document in a very neat way.  Note that
wenzelm@7895
    27
in Isabelle/Isar, the current position within a partial proof document is
wenzelm@7895
    28
equally important than the actual proof state.  Thus Proof~General provides
wenzelm@7895
    29
the canonical working environment for Isabelle/Isar, both for getting
wenzelm@7895
    30
acquainted (e.g.\ by replaying existing Isar documents) and real production
wenzelm@7895
    31
work.
wenzelm@7175
    32
wenzelm@7175
    33
\medskip
wenzelm@7175
    34
wenzelm@7315
    35
The easiest way to use Proof~General is to make it the default Isabelle user
wenzelm@7895
    36
interface.  Just put something like this into your Isabelle settings file (see
wenzelm@7895
    37
also \cite{isabelle-sys}):
wenzelm@7175
    38
\begin{ttbox}
wenzelm@7175
    39
ISABELLE_INTERFACE=\$ISABELLE_HOME/contrib/ProofGeneral/isar/interface
wenzelm@7875
    40
PROOFGENERAL_OPTIONS="-u false"
wenzelm@7175
    41
\end{ttbox}
wenzelm@7175
    42
You may have to change \texttt{\$ISABELLE_HOME/contrib/ProofGeneral} to the
wenzelm@7335
    43
actual installation directory of Proof~General.  From now on, the capital
wenzelm@7315
    44
\texttt{Isabelle} executable refers to the \texttt{ProofGeneral/isar}
wenzelm@7335
    45
interface.  Its usage is as follows:
wenzelm@7175
    46
\begin{ttbox}
wenzelm@7175
    47
Usage: interface [OPTIONS] [FILES ...]
wenzelm@7175
    48
wenzelm@7460
    49
  Options are:
wenzelm@7460
    50
    -l NAME      logic image name (default $ISABELLE_LOGIC=HOL)
wenzelm@7460
    51
    -p NAME      Emacs program name (default xemacs)
wenzelm@7460
    52
    -u BOOL      use .emacs file (default true)
wenzelm@7460
    53
    -w BOOL      use window system (default true)
wenzelm@7175
    54
wenzelm@7460
    55
  Starts Proof General for Isabelle/Isar with proof documents FILES
wenzelm@7460
    56
  (default Scratch.thy).
wenzelm@7460
    57
wenzelm@7460
    58
  PROOFGENERAL_OPTIONS=
wenzelm@7508
    59
\end{ttbox} %$
wenzelm@7335
    60
Apart from the command line, the defaults for these options may be overridden
wenzelm@7335
    61
via the \texttt{PROOFGENERAL_OPTIONS} setting as well.  For example, plain GNU
wenzelm@7460
    62
Emacs may be configured as follows:
wenzelm@7175
    63
\begin{ttbox}
wenzelm@7460
    64
PROOFGENERAL_OPTIONS="-p emacs"
wenzelm@7175
    65
\end{ttbox}
wenzelm@7175
    66
wenzelm@7175
    67
With the proper Isabelle interface setup, Isar documents may now be edited by
wenzelm@7175
    68
visiting appropriate theory files, e.g.\ 
wenzelm@7175
    69
\begin{ttbox}
wenzelm@7175
    70
Isabelle \({\langle}isabellehome{\rangle}\)/src/HOL/Isar_examples/BasicLogic.thy
wenzelm@7175
    71
\end{ttbox}
wenzelm@7315
    72
Users of XEmacs may note the tool bar for navigating forward and backward
wenzelm@7297
    73
through the text.  Consult the Proof~General documentation \cite{proofgeneral}
wenzelm@7895
    74
for further basic command sequences, like ``\texttt{c-c return}'' or
wenzelm@7895
    75
``\texttt{c-c u}''.
wenzelm@7175
    76
wenzelm@7460
    77
\medskip
wenzelm@7460
    78
wenzelm@7895
    79
Occasionally, a user's \texttt{.emacs} file contains material that is
wenzelm@7895
    80
incompatible with the version of (X)Emacs that Proof~General prefers.  Then
wenzelm@7895
    81
proper startup may be still achieved by using the \texttt{-u false}
wenzelm@7895
    82
option.\footnote{Any Emacs lisp file \texttt{proofgeneral-settings.el}
wenzelm@7895
    83
  occurring in \texttt{\$ISABELLE_HOME/etc} or
wenzelm@7895
    84
  \texttt{\$ISABELLE_HOME_USER/etc} is automatically loaded by the
wenzelm@7895
    85
  Proof~General interface script as well.}
wenzelm@7167
    86
wenzelm@7167
    87
\section{How to write Isar proofs anyway?}
wenzelm@7167
    88
wenzelm@7297
    89
This is one of the key questions, of course.  Isar offers a rather different
wenzelm@7297
    90
approach to formal proof documents than plain old tactic scripts.  Experienced
wenzelm@7297
    91
users of existing interactive theorem proving systems may have to learn
wenzelm@7895
    92
thinking differently in order to make effective use of Isabelle/Isar.  On the
wenzelm@7297
    93
other hand, Isabelle/Isar comes much closer to existing mathematical practice
wenzelm@7297
    94
of formal proof, so users with less experience in old-style tactical proving,
wenzelm@7895
    95
but a good understanding of mathematical proof, might cope with Isar even
wenzelm@7297
    96
better.
wenzelm@7297
    97
wenzelm@7836
    98
This document really is a \emph{reference manual}.  Nevertheless, we will give
wenzelm@7836
    99
some discussions of the general principles underlying Isar in
wenzelm@7297
   100
chapter~\ref{ch:basics}, and provide some clues of how these may be put into
wenzelm@7297
   101
practice.  Some more background information on Isar is given in
wenzelm@7836
   102
\cite{Wenzel:1999:TPHOL}.  While there is no proper tutorial on Isabelle/Isar
wenzelm@7836
   103
available yet, there are several examples distributed with Isabelle.  See
wenzelm@7836
   104
\texttt{HOL/Isar_examples} and \texttt{HOL/HOL-Real/HahnBanach} in the
wenzelm@7836
   105
Isabelle library:
wenzelm@7175
   106
wenzelm@7836
   107
\begin{center}\small
wenzelm@7836
   108
  \begin{tabular}{l}
wenzelm@7836
   109
    \url{http://www.cl.cam.ac.uk/Research/HVG/Isabelle/library/} \\
wenzelm@7836
   110
    \url{http://isabelle.in.tum.de/library/} \\
wenzelm@7836
   111
  \end{tabular}
wenzelm@7836
   112
\end{center}
wenzelm@7836
   113
wenzelm@7895
   114
Apart from browsable HTML sources, both Isabelle/Isar sessions also provide
wenzelm@7895
   115
actual documents (in PDF).
wenzelm@7167
   116
wenzelm@7046
   117
%%% Local Variables: 
wenzelm@7046
   118
%%% mode: latex
wenzelm@7046
   119
%%% TeX-master: "isar-ref"
wenzelm@7046
   120
%%% End: