doc-src/IsarRef/intro.tex
changeset 8547 93b8685d004b
parent 8516 f5f6a97ee43f
child 8684 dfe444b748aa
equal deleted inserted replaced
8546:dc053bc2ea06 8547:93b8685d004b
     6 \subsection{Terminal sessions}
     6 \subsection{Terminal sessions}
     7 
     7 
     8 Isar is already part of Isabelle (as of version Isabelle99, or later).  The
     8 Isar is already part of Isabelle (as of version Isabelle99, or later).  The
     9 \texttt{isabelle} binary provides option \texttt{-I} to run the Isar
     9 \texttt{isabelle} binary provides option \texttt{-I} to run the Isar
    10 interaction loop at startup, rather than the plain ML top-level.  Thus the
    10 interaction loop at startup, rather than the plain ML top-level.  Thus the
    11 quickest way to do anything with Isabelle/Isar is as follows:
    11 quickest way to do \emph{anything} with Isabelle/Isar is as follows:
    12 \begin{ttbox}
    12 \begin{ttbox}
    13 isabelle -I HOL\medskip
    13 isabelle -I HOL\medskip
    14 \out{> Welcome to Isabelle/HOL (Isabelle99)}\medskip
    14 \out{> Welcome to Isabelle/HOL (Isabelle99)}\medskip
    15 theory Foo = Main:
    15 theory Foo = Main:
    16 constdefs foo :: nat  "foo == 1";
    16 constdefs foo :: nat  "foo == 1";
    17 lemma "0 < foo" by (simp add: foo_def);
    17 lemma "0 < foo" by (simp add: foo_def);
    18 end
    18 end
    19 \end{ttbox}
    19 \end{ttbox}
    20 Note that any Isabelle/Isar command may be retracted by \texttt{undo}; the
    20 Note that any Isabelle/Isar command may be retracted by \texttt{undo}.  The
    21 \texttt{help} command prints a list of available language elements.
    21 \texttt{help} command prints a list of available language elements.
    22 
    22 
    23 
    23 
    24 \subsection{The Proof~General interface}
    24 \subsection{The Proof~General interface}
    25 
    25 
    26 Plain TTY-based interaction as above used to be quite feasible with
    26 Plain TTY-based interaction as above used to be quite feasible with
    27 traditional tactic based theorem proving, but developing Isar documents
    27 traditional tactic based theorem proving, but developing Isar documents really
    28 demands some better user-interface support.  David Aspinall's
    28 demands some better user-interface support.  David Aspinall's
    29 \emph{Proof~General}\index{Proof General} environment
    29 \emph{Proof~General}\index{Proof General} environment
    30 \cite{proofgeneral,Aspinall:TACAS:2000} offers a generic Emacs-based interface
    30 \cite{proofgeneral,Aspinall:TACAS:2000} offers a generic Emacs interface for
    31 for interactive theorem provers that does all the cut-and-paste and
    31 interactive theorem provers that does all the cut-and-paste and
    32 forward-backward walk through the text in a very neat way.  In Isabelle/Isar,
    32 forward-backward walk through the text in a very neat way.  In Isabelle/Isar,
    33 the current position within a partial proof document is equally important than
    33 the current position within a partial proof document is equally important than
    34 the actual proof state.  Thus Proof~General provides the canonical working
    34 the actual proof state.  Thus Proof~General provides the canonical working
    35 environment for Isabelle/Isar, both for getting acquainted (e.g.\ by replaying
    35 environment for Isabelle/Isar, both for getting acquainted (e.g.\ by replaying
    36 existing Isar documents) and real production work.
    36 existing Isar documents) and for production work.
    37 
    37 
    38 \medskip
    38 \medskip
    39 
    39 
    40 The easiest way to use Proof~General is to make it the default Isabelle user
    40 The easiest way to use Proof~General is to make it the default Isabelle user
    41 interface (see also \cite{isabelle-sys}).  Just put something like this into
    41 interface (see also \cite{isabelle-sys}).  Just put something like this into
    48 actual installation directory of Proof~General.  From now on, the capital
    48 actual installation directory of Proof~General.  From now on, the capital
    49 \texttt{Isabelle} executable refers to the \texttt{ProofGeneral/isar}
    49 \texttt{Isabelle} executable refers to the \texttt{ProofGeneral/isar}
    50 interface.\footnote{There is also a \texttt{ProofGeneral/isa} interface, for
    50 interface.\footnote{There is also a \texttt{ProofGeneral/isa} interface, for
    51   classic Isabelle tactic scripts.}
    51   classic Isabelle tactic scripts.}
    52 
    52 
    53 The interface script provides several options, just pass ``\texttt{-?}'' to
    53 The interface script provides several options, just pass \verb,-?, to see its
    54 see its usage.  Apart from the command line, the defaults for these options
    54 usage.  Apart from the command line, the defaults for these options may be
    55 may be overridden via the \texttt{PROOFGENERAL_OPTIONS} setting as well.  For
    55 overridden via the \texttt{PROOFGENERAL_OPTIONS} setting as well.  For
    56 example, plain FSF Emacs (instead of the default XEmacs) may be configured in
    56 example, plain FSF Emacs (instead of the default XEmacs) may be configured in
    57 Isabelle's settings via \texttt{PROOFGENERAL_OPTIONS="-p emacs"}.
    57 Isabelle's settings via \texttt{PROOFGENERAL_OPTIONS="-p emacs"}.
    58 
    58 
    59 Occasionally, the user's \verb,~/.emacs, file contains material that is
    59 Occasionally, the user's \verb,~/.emacs, file contains material that is
    60 incompatible with the version of Emacs that Proof~General prefers.  Then
    60 incompatible with the version of Emacs that Proof~General prefers.  Then
    61 proper startup may be still achieved by using the \texttt{-u false} option.
    61 proper startup may be still achieved by using the \texttt{-u false} option.
    62 Also note that any Emacs lisp file \texttt{proofgeneral-settings.el} occurring
    62 Also note that any Emacs lisp file called \texttt{proofgeneral-settings.el}
    63 in \texttt{\$ISABELLE_HOME/etc} or \texttt{\$ISABELLE_HOME_USER/etc} is
    63 occurring in \texttt{\$ISABELLE_HOME/etc} or \texttt{\$ISABELLE_HOME_USER/etc}
    64 automatically loaded by the Proof~General interface script as well.
    64 is automatically loaded by the Proof~General interface script as well.
    65 
    65 
    66 \medskip
    66 \medskip
    67 
    67 
    68 With the proper Isabelle interface setup, Isar documents may now be edited by
    68 With the proper Isabelle interface setup, Isar documents may now be edited by
    69 visiting appropriate theory files, e.g.\ 
    69 visiting appropriate theory files, e.g.\ 
    70 \begin{ttbox}
    70 \begin{ttbox}
    71 Isabelle \({\langle}isabellehome{\rangle}\)/src/HOL/Isar_examples/BasicLogic.thy
    71 Isabelle \({\langle}isabellehome{\rangle}\)/src/HOL/Isar_examples/BasicLogic.thy
    72 \end{ttbox}
    72 \end{ttbox}
    73 Users of XEmacs may note the tool bar for navigating forward and backward
    73 Users of XEmacs may note the tool bar for navigating forward and backward
    74 through the text.  Consult the Proof~General documentation \cite{proofgeneral}
    74 through the text.  Consult the Proof~General documentation \cite{proofgeneral}
    75 for further basic command sequences, such as ``\texttt{c-c c-return}'' or
    75 for further basic command sequences, such as ``\texttt{C-c C-return}'' or
    76 ``\texttt{c-c u}''.
    76 ``\texttt{C-c u}''.
    77 
    77 
    78 \medskip
    78 \medskip
    79 
    79 
    80 Proof~General also supports the Emacs X-Symbol package \cite{x-symbol}, which
    80 Proof~General also supports the Emacs X-Symbol package \cite{x-symbol}, which
    81 provides a nice way to get proper mathematical symbols displayed on screen.
    81 provides a nice way to get proper mathematical symbols displayed on screen.
    86 Note that using actual mathematical symbols in the text easily makes the ASCII
    86 Note that using actual mathematical symbols in the text easily makes the ASCII
    87 sources hard to read.  For example, $\forall$ will appear as \verb,\\<forall>,
    87 sources hard to read.  For example, $\forall$ will appear as \verb,\\<forall>,
    88 according the default set of Isabelle symbols.  On the other hand, the
    88 according the default set of Isabelle symbols.  On the other hand, the
    89 Isabelle document preparation system \cite{isabelle-sys} will be happy to
    89 Isabelle document preparation system \cite{isabelle-sys} will be happy to
    90 print non-ASCII symbols properly.  It is even possible to invent additional
    90 print non-ASCII symbols properly.  It is even possible to invent additional
    91 notation beyond the display capabilities of XEmacs~/X-Symbol.
    91 notation beyond the display capabilities of XEmacs and X-Symbol.
    92 
    92 
    93 
    93 
    94 \section{Isabelle/Isar theories}
    94 \section{Isabelle/Isar theories}
    95 
    95 
    96 Isabelle/Isar offers the following main improvements over classic Isabelle:
    96 Isabelle/Isar offers the following main improvements over classic Isabelle.
    97 \begin{enumerate}
    97 \begin{enumerate}
    98 \item A new \emph{theory format}, occasionally referred to as ``new-style
    98 \item A new \emph{theory format}, occasionally referred to as ``new-style
    99   theories'', supporting interactive development and unlimited undo operation.
    99   theories'', supporting interactive development and unlimited undo operation.
   100 \item A \emph{formal proof document language} designed to support intelligible
   100 \item A \emph{formal proof document language} designed to support intelligible
   101   semi-automated reasoning.  Instead of putting together unreadable tactic
   101   semi-automated reasoning.  Instead of putting together unreadable tactic
   102   scripts, the author is enabled to express the reasoning in way that is close
   102   scripts, the author is enabled to express the reasoning in way that is close
   103   to usual mathematical practice.
   103   to usual mathematical practice.
   104 \item A simple document preparation system for Isabelle/Isar theories, for
   104 \item A simple document preparation system, for typesetting formal
   105   typesetting formal developments together with informal text.  The resulting
   105   developments together with informal text.  The resulting hyper-linked PDF
   106   resulting hyper-linked PDF documents are equally well suited for WWW
   106   documents are equally well suited for WWW presentation and as printed
   107   presentation and printed copies.
   107   copies.
   108 \end{enumerate}
   108 \end{enumerate}
   109 
   109 
   110 The Isar proof language is embedded into the new theory format as a proper
   110 The Isar proof language is embedded into the new theory format as a proper
   111 sub-language.  Proof mode is entered by stating some $\THEOREMNAME$ or
   111 sub-language.  Proof mode is entered by stating some $\THEOREMNAME$ or
   112 $\LEMMANAME$ at the theory level, and left again with the final conclusion
   112 $\LEMMANAME$ at the theory level, and left again with the final conclusion
   113 (e.g.\ via $\QEDNAME$).  A few theory extension mechanisms require proof as
   113 (e.g.\ via $\QEDNAME$).  A few theory extension mechanisms require proof as
   114 well, such as the HOL $\isarkeyword{typedef}$ which demands non-emptiness of
   114 well, such as HOL's $\isarkeyword{typedef}$ which demands non-emptiness of the
   115 the representing sets.
   115 representing sets.
   116 
   116 
   117 New-style theory files may still be associated with separate ML files
   117 New-style theory files may still be associated with separate ML files
   118 consisting of plain old tactic scripts.  There is no longer any ML binding
   118 consisting of plain old tactic scripts.  There is no longer any ML binding
   119 generated for the theory and theorems, though.  ML functions \texttt{theory},
   119 generated for the theory and theorems, though.  ML functions \texttt{theory},
   120 \texttt{thm}, and \texttt{thms} retrieve this information \cite{isabelle-ref}.
   120 \texttt{thm}, and \texttt{thms} retrieve this information \cite{isabelle-ref}.
   121 Nevertheless, migration between classic Isabelle and Isabelle/Isar is
   121 Nevertheless, migration between classic Isabelle and Isabelle/Isar is
   122 relatively easy.  Thus users may start to benefit from interactive theory
   122 relatively easy.  Thus users may start to benefit from interactive theory
   123 development even before they have any idea of the Isar proof language at all.
   123 development and document preparation, even before they have any idea of the
       
   124 Isar proof language at all.
   124 
   125 
   125 \begin{warn}
   126 \begin{warn}
   126   Currently Proof~General does \emph{not} support mixed interactive
   127   Currently, Proof~General does \emph{not} support mixed interactive
   127   development of classic Isabelle theory files or tactic scripts, together
   128   development of classic Isabelle theory files or tactic scripts, together
   128   with Isar documents.  The ``\texttt{isa}'' and ``\texttt{isar}'' versions of
   129   with Isar documents.  The ``\texttt{isa}'' and ``\texttt{isar}'' versions of
   129   Proof~General are handled as two different theorem proving systems, only one
   130   Proof~General are handled as two different theorem proving systems, only one
   130   of these may be active at the same time.
   131   of these may be active at the same time.
   131 \end{warn}
   132 \end{warn}
   144 other hand, Isabelle/Isar comes much closer to existing mathematical practice
   145 other hand, Isabelle/Isar comes much closer to existing mathematical practice
   145 of formal proof, so users with less experience in old-style tactical proving,
   146 of formal proof, so users with less experience in old-style tactical proving,
   146 but a good understanding of mathematical proof, might cope with Isar even
   147 but a good understanding of mathematical proof, might cope with Isar even
   147 better.  See also \cite{Wenzel:1999:TPHOL} for further background information
   148 better.  See also \cite{Wenzel:1999:TPHOL} for further background information
   148 on Isar.
   149 on Isar.
       
   150 %FIXME cite [HahnBanach-in-Isar]
   149 
   151 
   150 \medskip This really is a \emph{reference manual}.  Nevertheless, we will also
   152 \medskip This really is a \emph{reference manual}.  Nevertheless, we will also
   151 give some clues of how the concepts introduced here may be put into practice.
   153 give some clues of how the concepts introduced here may be put into practice.
   152 Appendix~\ref{ap:refcard} provides a quick reference card of the most common
   154 Appendix~\ref{ap:refcard} provides a quick reference card of the most common
   153 Isabelle/Isar language elements.  There are several examples distributed with
   155 Isabelle/Isar language elements.  There are several examples distributed with
   160     \url{http://isabelle.in.tum.de/Isar/} \\
   162     \url{http://isabelle.in.tum.de/Isar/} \\
   161   \end{tabular}
   163   \end{tabular}
   162 \end{center}
   164 \end{center}
   163 
   165 
   164 See \texttt{HOL/Isar_examples} for a collection of introductory examples, and
   166 See \texttt{HOL/Isar_examples} for a collection of introductory examples, and
   165 \texttt{HOL/HOL-Real/HahnBanach} is a big mathematics application.  Apart from
   167 \texttt{HOL/HOL-Real/HahnBanach} for a big mathematics application.  Apart
   166 plain HTML sources, these sessions also provide actual documents (in PDF).
   168 from plain HTML sources, these sessions also provide actual documents (in
       
   169 PDF).
       
   170 
   167 
   171 
   168 %%% Local Variables: 
   172 %%% Local Variables: 
   169 %%% mode: latex
   173 %%% mode: latex
   170 %%% TeX-master: "isar-ref"
   174 %%% TeX-master: "isar-ref"
   171 %%% End: 
   175 %%% End: