doc-src/IsarRef/Thy/intro.thy
author wenzelm
Thu, 08 May 2008 23:02:23 +0200
changeset 26860 7c749112261c
parent 26852 a31203f58b20
child 26908 25fb7241f32e
permissions -rw-r--r--
replaced some latex macros by antiquotations;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents: 26760
diff changeset
     1
(* $Id$ *)
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     2
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     3
theory intro
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     4
imports CPure
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     5
begin
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     6
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     7
chapter {* Introduction *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     8
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
     9
section {* Overview *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    10
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    11
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    12
  The \emph{Isabelle} system essentially provides a generic
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    13
  infrastructure for building deductive systems (programmed in
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    14
  Standard ML), with a special focus on interactive theorem proving in
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    15
  higher-order logics.  In the olden days even end-users would refer
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    16
  to certain ML functions (goal commands, tactics, tacticals etc.) to
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    17
  pursue their everyday theorem proving tasks
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    18
  \cite{isabelle-intro,isabelle-ref}.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    19
  
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    20
  In contrast \emph{Isar} provides an interpreted language environment
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    21
  of its own, which has been specifically tailored for the needs of
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    22
  theory and proof development.  Compared to raw ML, the Isabelle/Isar
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    23
  top-level provides a more robust and comfortable development
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    24
  platform, with proper support for theory development graphs,
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    25
  single-step transactions with unlimited undo, etc.  The
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    26
  Isabelle/Isar version of the \emph{Proof~General} user interface
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    27
  \cite{proofgeneral,Aspinall:TACAS:2000} provides an adequate
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    28
  front-end for interactive theory and proof development in this
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    29
  advanced theorem proving environment.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    30
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    31
  \medskip Apart from the technical advances over bare-bones ML
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    32
  programming, the main purpose of the Isar language is to provide a
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    33
  conceptually different view on machine-checked proofs
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    34
  \cite{Wenzel:1999:TPHOL,Wenzel-PhD}.  ``Isar'' stands for
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    35
  ``Intelligible semi-automated reasoning''.  Drawing from both the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    36
  traditions of informal mathematical proof texts and high-level
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    37
  programming languages, Isar offers a versatile environment for
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    38
  structured formal proof documents.  Thus properly written Isar
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    39
  proofs become accessible to a broader audience than unstructured
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    40
  tactic scripts (which typically only provide operational information
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    41
  for the machine).  Writing human-readable proof texts certainly
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    42
  requires some additional efforts by the writer to achieve a good
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    43
  presentation, both of formal and informal parts of the text.  On the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    44
  other hand, human-readable formal texts gain some value in their own
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    45
  right, independently of the mechanic proof-checking process.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    46
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    47
  Despite its grand design of structured proof texts, Isar is able to
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    48
  assimilate the old tactical style as an ``improper'' sub-language.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    49
  This provides an easy upgrade path for existing tactic scripts, as
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    50
  well as additional means for interactive experimentation and
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    51
  debugging of structured proofs.  Isabelle/Isar supports a broad
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    52
  range of proof styles, both readable and unreadable ones.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    53
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    54
  \medskip The Isabelle/Isar framework is generic and should work
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    55
  reasonably well for any Isabelle object-logic that conforms to the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    56
  natural deduction view of the Isabelle/Pure framework.  Major
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    57
  Isabelle logics like HOL \cite{isabelle-HOL}, HOLCF
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    58
  \cite{MuellerNvOS99}, FOL \cite{isabelle-logics}, and ZF
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    59
  \cite{isabelle-ZF} have already been set up for end-users.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    60
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    61
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    62
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    63
section {* Quick start *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    64
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    65
subsection {* Terminal sessions *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    66
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    67
text {*
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    68
  Isar is already part of Isabelle.  The low-level @{verbatim
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    69
  isabelle} binary provides option @{verbatim "-I"} to run the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    70
  Isabelle/Isar interaction loop at startup, rather than the raw ML
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    71
  top-level.  So the most basic way to do anything with Isabelle/Isar
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    72
  is as follows:
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    73
\begin{ttbox}  % FIXME update
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    74
isabelle -I HOL\medskip
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    75
\out{> Welcome to Isabelle/HOL (Isabelle2005)}\medskip
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    76
theory Foo imports Main begin;
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    77
definition foo :: nat where "foo == 1";
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    78
lemma "0 < foo" by (simp add: foo_def);
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    79
end;
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    80
\end{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    81
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    82
  Note that any Isabelle/Isar command may be retracted by @{command
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    83
  "undo"}.  See the Isabelle/Isar Quick Reference
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    84
  (\appref{ap:refcard}) for a comprehensive overview of available
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
    85
  commands and other language elements.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    86
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    87
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    88
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    89
subsection {* Proof General *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    90
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    91
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    92
  Plain TTY-based interaction as above used to be quite feasible with
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    93
  traditional tactic based theorem proving, but developing Isar
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    94
  documents really demands some better user-interface support.  The
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    95
  Proof~General environment by David Aspinall
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    96
  \cite{proofgeneral,Aspinall:TACAS:2000} offers a generic Emacs
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    97
  interface for interactive theorem provers that organizes all the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    98
  cut-and-paste and forward-backward walk through the text in a very
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
    99
  neat way.  In Isabelle/Isar, the current position within a partial
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   100
  proof document is equally important than the actual proof state.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   101
  Thus Proof~General provides the canonical working environment for
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   102
  Isabelle/Isar, both for getting acquainted (e.g.\ by replaying
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   103
  existing Isar documents) and for production work.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   104
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   105
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   106
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   107
subsubsection{* Proof~General as default Isabelle interface *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   108
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   109
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   110
  The Isabelle interface wrapper script provides an easy way to invoke
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   111
  Proof~General (including XEmacs or GNU Emacs).  The default
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   112
  configuration of Isabelle is smart enough to detect the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   113
  Proof~General distribution in several canonical places (e.g.\
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   114
  @{verbatim "$ISABELLE_HOME/contrib/ProofGeneral"}).  Thus the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   115
  capital @{verbatim Isabelle} executable would already refer to the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   116
  @{verbatim "ProofGeneral/isar"} interface without further ado.  The
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   117
  Isabelle interface script provides several options; pass @{verbatim
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   118
  "-?"}  to see its usage.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   119
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   120
  With the proper Isabelle interface setup, Isar documents may now be edited by
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   121
  visiting appropriate theory files, e.g.\ 
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   122
\begin{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   123
Isabelle \({\langle}isabellehome{\rangle}\)/src/HOL/Isar_examples/Summation.thy
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   124
\end{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   125
  Beginners may note the tool bar for navigating forward and backward
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   126
  through the text (this depends on the local Emacs installation).
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   127
  Consult the Proof~General documentation \cite{proofgeneral} for
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   128
  further basic command sequences, in particular ``@{verbatim "C-c C-return"}''
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   129
  and ``@{verbatim "C-c u"}''.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   130
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   131
  \medskip Proof~General may be also configured manually by giving
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   132
  Isabelle settings like this (see also \cite{isabelle-sys}):
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   133
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   134
\begin{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   135
ISABELLE_INTERFACE=\$ISABELLE_HOME/contrib/ProofGeneral/isar/interface
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   136
PROOFGENERAL_OPTIONS=""
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   137
\end{ttbox}
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   138
  You may have to change @{verbatim
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   139
  "$ISABELLE_HOME/contrib/ProofGeneral"} to the actual installation
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   140
  directory of Proof~General.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   141
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   142
  \medskip Apart from the Isabelle command line, defaults for
26860
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   143
  interface options may be given by the @{verbatim PROOFGENERAL_OPTIONS}
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   144
  setting.  For example, the Emacs executable to be used may be
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   145
  configured in Isabelle's settings like this:
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   146
\begin{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   147
PROOFGENERAL_OPTIONS="-p xemacs-mule"  
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   148
\end{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   149
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   150
  Occasionally, a user's @{verbatim "~/.emacs"} file contains code
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   151
  that is incompatible with the (X)Emacs version used by
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   152
  Proof~General, causing the interface startup to fail prematurely.
26860
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   153
  Here the @{verbatim "-u false"} option helps to get the interface
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   154
  process up and running.  Note that additional Lisp customization
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   155
  code may reside in @{verbatim "proofgeneral-settings.el"} of
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   156
  @{verbatim "$ISABELLE_HOME/etc"} or @{verbatim
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   157
  "$ISABELLE_HOME_USER/etc"}.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   158
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   159
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   160
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   161
subsubsection {* The X-Symbol package *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   162
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   163
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   164
  Proof~General incorporates a version of the Emacs X-Symbol package
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   165
  \cite{x-symbol}, which handles proper mathematical symbols displayed
26860
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   166
  on screen.  Pass option @{verbatim "-x true"} to the Isabelle
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   167
  interface script, or check the appropriate Proof~General menu
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   168
  setting by hand.  The main challenge of getting X-Symbol to work
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   169
  properly is the underlying (semi-automated) X11 font setup.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   170
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   171
  \medskip Using proper mathematical symbols in Isabelle theories can
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   172
  be very convenient for readability of large formulas.  On the other
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   173
  hand, the plain ASCII sources easily become somewhat unintelligible.
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   174
  For example, @{text "\<Longrightarrow>"} would appear as @{verbatim "\<Longrightarrow>"} according
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   175
  the default set of Isabelle symbols.  Nevertheless, the Isabelle
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   176
  document preparation system (see \secref{sec:document-prep}) will be
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   177
  happy to print non-ASCII symbols properly.  It is even possible to
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   178
  invent additional notation beyond the display capabilities of Emacs
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   179
  and X-Symbol.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   180
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   181
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   182
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   183
section {* Isabelle/Isar theories *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   184
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   185
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   186
  Isabelle/Isar offers the following main improvements over classic
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   187
  Isabelle.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   188
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   189
  \begin{enumerate}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   190
  
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   191
  \item A \emph{theory format} that integrates specifications and
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   192
  proofs, supporting interactive development and unlimited undo
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   193
  operation.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   194
  
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   195
  \item A \emph{formal proof document language} designed to support
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   196
  intelligible semi-automated reasoning.  Instead of putting together
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   197
  unreadable tactic scripts, the author is enabled to express the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   198
  reasoning in way that is close to usual mathematical practice.  The
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   199
  old tactical style has been assimilated as ``improper'' language
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   200
  elements.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   201
  
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   202
  \item A simple document preparation system, for typesetting formal
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   203
  developments together with informal text.  The resulting
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   204
  hyper-linked PDF documents are equally well suited for WWW
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   205
  presentation and as printed copies.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   206
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   207
  \end{enumerate}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   208
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   209
  The Isar proof language is embedded into the new theory format as a
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   210
  proper sub-language.  Proof mode is entered by stating some
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   211
  @{command "theorem"} or @{command "lemma"} at the theory level, and
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   212
  left again with the final conclusion (e.g.\ via @{command "qed"}).
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   213
  A few theory specification mechanisms also require some proof, such
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   214
  as HOL's @{command "typedef"} which demands non-emptiness of the
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   215
  representing sets.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   216
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   217
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   218
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   219
subsection {* Document preparation \label{sec:document-prep} *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   220
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   221
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   222
  Isabelle/Isar provides a simple document preparation system based on
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   223
  existing {PDF-\LaTeX} technology, with full support of hyper-links
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   224
  (both local references and URLs), bookmarks, and thumbnails.  Thus
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   225
  the results are equally well suited for WWW browsing and as printed
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   226
  copies.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   227
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   228
  \medskip
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   229
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   230
  Isabelle generates {\LaTeX} output as part of the run of a
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   231
  \emph{logic session} (see also \cite{isabelle-sys}).  Getting
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   232
  started with a working configuration for common situations is quite
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   233
  easy by using the Isabelle @{verbatim mkdir} and @{verbatim make}
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   234
  tools.  First invoke
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   235
\begin{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   236
  isatool mkdir Foo
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   237
\end{ttbox}
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   238
  to initialize a separate directory for session @{verbatim Foo} ---
26860
7c749112261c replaced some latex macros by antiquotations;
wenzelm
parents: 26852
diff changeset
   239
  it is safe to experiment, since @{verbatim "isatool mkdir"} never
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   240
  overwrites existing files.  Ensure that @{verbatim "Foo/ROOT.ML"}
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   241
  holds ML commands to load all theories required for this session;
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   242
  furthermore @{verbatim "Foo/document/root.tex"} should include any
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   243
  special {\LaTeX} macro packages required for your document (the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   244
  default is usually sufficient as a start).
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   245
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   246
  The session is controlled by a separate @{verbatim IsaMakefile}
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   247
  (with crude source dependencies by default).  This file is located
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   248
  one level up from the @{verbatim Foo} directory location.  Now
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   249
  invoke
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   250
\begin{ttbox}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   251
  isatool make Foo
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   252
\end{ttbox}
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   253
  to run the @{verbatim Foo} session, with browser information and
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   254
  document preparation enabled.  Unless any errors are reported by
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   255
  Isabelle or {\LaTeX}, the output will appear inside the directory
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   256
  @{verbatim ISABELLE_BROWSER_INFO}, as reported by the batch job in
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   257
  verbose mode.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   258
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   259
  \medskip You may also consider to tune the @{verbatim usedir}
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   260
  options in @{verbatim IsaMakefile}, for example to change the output
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   261
  format from @{verbatim pdf} to @{verbatim dvi}, or activate the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   262
  @{verbatim "-D"} option to retain a second copy of the generated
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26741
diff changeset
   263
  {\LaTeX} sources.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   264
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   265
  \medskip See \emph{The Isabelle System Manual} \cite{isabelle-sys}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   266
  for further details on Isabelle logic sessions and theory
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   267
  presentation.  The Isabelle/HOL tutorial \cite{isabelle-hol-book}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   268
  also covers theory presentation issues.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   269
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   270
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   271
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   272
subsection {* How to write Isar proofs anyway? \label{sec:isar-howto} *}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   273
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   274
text {*
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   275
  This is one of the key questions, of course.  First of all, the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   276
  tactic script emulation of Isabelle/Isar essentially provides a
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   277
  clarified version of the very same unstructured proof style of
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   278
  classic Isabelle.  Old-time users should quickly become acquainted
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   279
  with that (slightly degenerative) view of Isar.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   280
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   281
  Writing \emph{proper} Isar proof texts targeted at human readers is
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   282
  quite different, though.  Experienced users of the unstructured
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   283
  style may even have to unlearn some of their habits to master proof
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   284
  composition in Isar.  In contrast, new users with less experience in
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   285
  old-style tactical proving, but a good understanding of mathematical
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   286
  proof in general, often get started easier.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   287
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   288
  \medskip The present text really is only a reference manual on
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   289
  Isabelle/Isar, not a tutorial.  Nevertheless, we will attempt to
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   290
  give some clues of how the concepts introduced here may be put into
26852
a31203f58b20 misc tuning;
wenzelm
parents: 26767
diff changeset
   291
  practice.  Especially note that \appref{ap:refcard} provides a quick
a31203f58b20 misc tuning;
wenzelm
parents: 26767
diff changeset
   292
  reference card of the most common Isabelle/Isar language elements.
26741
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   293
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   294
  Further issues concerning the Isar concepts are covered in the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   295
  literature
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   296
  \cite{Wenzel:1999:TPHOL,Wiedijk:2000:MV,Bauer-Wenzel:2000:HB,Bauer-Wenzel:2001}.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   297
  The author's PhD thesis \cite{Wenzel-PhD} presently provides the
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   298
  most complete exposition of Isar foundations, techniques, and
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   299
  applications.  A number of example applications are distributed with
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   300
  Isabelle, and available via the Isabelle WWW library (e.g.\
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   301
  \url{http://isabelle.in.tum.de/library/}).  The ``Archive of Formal
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   302
  Proofs'' \url{http://afp.sourceforge.net/} also provides plenty of
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   303
  examples, both in proper Isar proof style and unstructured tactic
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   304
  scripts.
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   305
*}
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   306
eb15fd4cd1ad converted intro.tex to Thy/intro.thy;
wenzelm
parents:
diff changeset
   307
end