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