tuned;
authorwenzelm
Wed Aug 04 18:20:24 1999 +0200 (1999-08-04)
changeset 71758263d0b50e12
parent 7174 47aa9df578ea
child 7176 a329a37ed91a
tuned;
doc-src/IsarRef/generic.tex
doc-src/IsarRef/hol.tex
doc-src/IsarRef/intro.tex
doc-src/IsarRef/pure.tex
doc-src/IsarRef/syntax.tex
     1.1 --- a/doc-src/IsarRef/generic.tex	Wed Aug 04 18:20:05 1999 +0200
     1.2 +++ b/doc-src/IsarRef/generic.tex	Wed Aug 04 18:20:24 1999 +0200
     1.3 @@ -53,13 +53,19 @@
     1.4  \begin{rail}
     1.5    ('tag' | 'untag') (nameref+)
     1.6    ;
     1.7 +\end{rail}
     1.8 +
     1.9 +\begin{rail}
    1.10    ('COMP' | 'RS') nat? thmref
    1.11    ;
    1.12    'OF' thmrefs
    1.13    ;
    1.14 -  'where' (term '=' term * 'and')
    1.15 +\end{rail}
    1.16 +
    1.17 +\begin{rail}
    1.18 +  'where' (name '=' term * 'and')
    1.19    ;
    1.20 -  'of' (inst * ) ('concl:' (inst * ))?
    1.21 +  'of' (inst * ) ('concl' ':' (inst * ))?
    1.22    ;
    1.23  
    1.24    inst: underscore | term
     2.1 --- a/doc-src/IsarRef/hol.tex	Wed Aug 04 18:20:05 1999 +0200
     2.2 +++ b/doc-src/IsarRef/hol.tex	Wed Aug 04 18:20:24 1999 +0200
     2.3 @@ -23,11 +23,11 @@
     2.4    actual HOL type constructor.
     2.5  \item [$\isarkeyword{typedef}~(\vec\alpha)t = A$] sets up a goal stating
     2.6    non-emptiness of the set $A$.  After finishing the proof, the theory will be
     2.7 -  augmented by a Gordon/HOL-style type definitions.  See \cite{isabelle-HOL}
     2.8 +  augmented by a Gordon/HOL-style type definition.  See \cite{isabelle-HOL}
     2.9    for more information.  Note that user-level work usually does not directly
    2.10    refer to the HOL $\isarkeyword{typedef}$ primitive, but uses more advanced
    2.11 -  packages such as $\isarkeyword{record}$ (\S\ref{sec:record}) or
    2.12 -  $\isarkeyword{datatype}$ (\S\ref{sec:datatype}).
    2.13 +  packages such as $\isarkeyword{record}$ (see \S\ref{sec:record}) or
    2.14 +  $\isarkeyword{datatype}$ (see \S\ref{sec:datatype}).
    2.15  \end{descr}
    2.16  
    2.17  
    2.18 @@ -52,7 +52,7 @@
    2.19    defines extensible record type $(\vec\alpha)t$, derived from the optional
    2.20    parent record $\tau$ by adding new field components $\vec c :: \vec\sigma$.
    2.21    See \cite{isabelle-HOL,NaraschewskiW-TPHOLs98} for more information only
    2.22 -  simply-typed records.
    2.23 +  simply-typed extensible records.
    2.24  \end{descr}
    2.25  
    2.26  
    2.27 @@ -68,12 +68,12 @@
    2.28  \railterm{repdatatype}
    2.29  
    2.30  \begin{rail}
    2.31 -  'datatype' (parname? typespec infix? \\ '=' (cons + '|') + 'and')
    2.32 +  'datatype' (parname? typespec infix? \\ '=' (constructor + '|') + 'and')
    2.33    ;
    2.34    repdatatype (name * ) \\ 'distinct' thmrefs 'inject' thmrefs 'induction' thmrefs
    2.35    ;
    2.36  
    2.37 -  cons: name (type * ) mixfix? comment?
    2.38 +  constructor: name (type * ) mixfix? comment?
    2.39    ;
    2.40  \end{rail}
    2.41  
    2.42 @@ -136,7 +136,7 @@
    2.43  
    2.44  \section{Proof by induction}
    2.45  
    2.46 -%FIXME induct proof method
    2.47 +FIXME induct proof method
    2.48  
    2.49  
    2.50  %%% Local Variables: 
     3.1 --- a/doc-src/IsarRef/intro.tex	Wed Aug 04 18:20:05 1999 +0200
     3.2 +++ b/doc-src/IsarRef/intro.tex	Wed Aug 04 18:20:24 1999 +0200
     3.3 @@ -3,12 +3,79 @@
     3.4  
     3.5  \section{Quick start}
     3.6  
     3.7 -FIXME examples, ProofGeneral setup
     3.8 +Isar is already part of Isabelle (as of version Isabelle99, or later).  The
     3.9 +\texttt{isabelle} binary provides option \texttt{-I} to run the Isar
    3.10 +interaction loop at startup, rather than the plain ML top-level.  Thus the
    3.11 +quickest way to do anything with Isabelle/Isar is as follows:
    3.12 +\begin{ttbox}
    3.13 +isabelle -I HOL\medskip
    3.14 +\out{> Welcome to Isabelle/HOL (Isabelle99)}\medskip
    3.15 +theory Foo = Main:
    3.16 +constdefs foo :: nat  "foo == 1"
    3.17 +lemma "0 < foo" by (simp add: foo_def)
    3.18 +end
    3.19 +\end{ttbox}
    3.20 +
    3.21 +Plain TTY-based interaction like this used to be quite feasible with
    3.22 +traditional tactic based theorem proving, but developing Isar documents
    3.23 +demands some better user-interface support.
    3.24 +\emph{ProofGeneral}\index{ProofGeneral} of LFCS Edinburgh \cite{proofgeneral}
    3.25 +offers a generic Emacs-based environment for interactive theorem provers that
    3.26 +does all the cut-and-paste and forward-backward walk through the document in a
    3.27 +very neat way.  Note that in Isabelle/Isar, the current position within a
    3.28 +partial proof document is more informative than the actual proof state.  Thus
    3.29 +the ProofGeneral/isar interface provides the canonical working environment for
    3.30 +Isabelle/Isar, both for getting acquainted (e.g.\ by replaying existing Isar
    3.31 +documents) and serious production work.
    3.32 +
    3.33 +\medskip
    3.34  
    3.35 -\section{Examples}
    3.36 +The easiest way to use ProofGeneral/isar is to make it the default Isabelle
    3.37 +user interface.  Just say something like this in your Isabelle settings file
    3.38 +(cf.\ \cite{isabelle-sys}):
    3.39 +\begin{ttbox}
    3.40 +ISABELLE_INTERFACE=\$ISABELLE_HOME/contrib/ProofGeneral/isar/interface
    3.41 +PROOFGENERAL_OPTIONS=""
    3.42 +\end{ttbox}
    3.43 +You may have to change \texttt{\$ISABELLE_HOME/contrib/ProofGeneral} to the
    3.44 +actual installation directory of ProofGeneral.  Now the capital
    3.45 +\texttt{Isabelle} binary refers to the ProofGeneral/isar interface.  It's
    3.46 +usage is as follows:
    3.47 +\begin{ttbox}
    3.48 +Usage: interface [OPTIONS] [FILES ...]
    3.49 +
    3.50 +Options are:
    3.51 +  -l NAME      logic image name (default $ISABELLE_LOGIC=HOL)
    3.52 +  -p NAME      Emacs program name (default xemacs)
    3.53 +  -u BOOL      use .emacs file (default false)
    3.54 +  -w BOOL      use window system (default true)
    3.55 +
    3.56 +Starts ProofGeneral for Isabelle/Isar with proof documents FILES
    3.57 +(default Scratch.thy).
    3.58 +\end{ttbox}
    3.59 +The defaults for these options may be changed via the
    3.60 +\texttt{PROOFGENERAL_OPTIONS} setting.  For example, GNU Emacs with loading of
    3.61 +the startup file enabled may be configured as follows:\footnote{The interface
    3.62 +  disables \texttt{.emacs} by default to ensure successful startup despite any
    3.63 +  strange commands that tend to occur there.}
    3.64 +\begin{ttbox}
    3.65 +PROOFGENERAL_OPTIONS="-p emacs -u true"
    3.66 +\end{ttbox}
    3.67 +
    3.68 +With the proper Isabelle interface setup, Isar documents may now be edited by
    3.69 +visiting appropriate theory files, e.g.\ 
    3.70 +\begin{ttbox}
    3.71 +Isabelle \({\langle}isabellehome{\rangle}\)/src/HOL/Isar_examples/BasicLogic.thy
    3.72 +\end{ttbox}
    3.73 +Users of XEmacs may note the toolbar for navigating forward and backward
    3.74 +through the text.  Consult the ProofGeneral documentation for further basic
    3.75 +commands, such as \texttt{c-c return} or \texttt{c-c u}.
    3.76 +
    3.77  
    3.78  \section{How to write Isar proofs anyway?}
    3.79  
    3.80 +FIXME
    3.81 +
    3.82  
    3.83  %%% Local Variables: 
    3.84  %%% mode: latex
     4.1 --- a/doc-src/IsarRef/pure.tex	Wed Aug 04 18:20:05 1999 +0200
     4.2 +++ b/doc-src/IsarRef/pure.tex	Wed Aug 04 18:20:24 1999 +0200
     4.3 @@ -4,19 +4,20 @@
     4.4  Subsequently, we introduce most of the basic Isar theory and proof commands as
     4.5  provided by Isabelle/Pure.  Chapter~\ref{ch:gen-tools} describes further Isar
     4.6  elements as provided by generic tools and packages that are either part of
     4.7 -Pure Isabelle, or preloaded by most object logics (such as the simplifier).
     4.8 +Pure Isabelle, or preloaded by most object logics (such as the Simplifier).
     4.9  See chapter~\ref{ch:hol-tools} for actual object-logic specific elements (for
    4.10  Isabelle/HOL).
    4.11  
    4.12  \medskip
    4.13  
    4.14  Isar commands may be either \emph{proper} document constructors, or
    4.15 -\emph{improper commands} (indicated by $^*$).  Improper commands might be
    4.16 -helpful when developing proof documents, while their use is strongly
    4.17 -discouraged for the final outcome.  Typical examples are diagnostic commands
    4.18 -that print terms or theorems according to the current context; other commands
    4.19 -even emulate old-style tactical theorem proving, which facilitates porting of
    4.20 -legacy proof scripts.
    4.21 +\emph{improper commands} (indicated by $^*$).  Some proof methods and
    4.22 +attributes introduced later may be classified as improper as well.  Improper
    4.23 +Isar language elements might be helpful when developing proof documents, while
    4.24 +their use is strongly discouraged for the final version.  Typical examples are
    4.25 +diagnostic commands that print terms or theorems according to the current
    4.26 +context; other commands even emulate old-style tactical theorem proving, which
    4.27 +facilitates porting of legacy proof scripts.
    4.28  
    4.29  
    4.30  \section{Theory commands}
    4.31 @@ -32,15 +33,15 @@
    4.32  
    4.33  Isabelle/Isar ``new-style'' theories are either defined via theory files or
    4.34  interactively.  Both actual theory specifications and proofs are handled
    4.35 -uniformly --- occasionally definitional mechanisms even require some proof.
    4.36 -In contrast, ``old-style'' Isabelle theories support batch processing only,
    4.37 -with the proof scripts collected in separate ML files.
    4.38 +uniformly --- occasionally definitional mechanisms even require some manual
    4.39 +proof.  In contrast, ``old-style'' Isabelle theories support batch processing
    4.40 +only, with the proof scripts collected in separate ML files.
    4.41  
    4.42  The first command of any theory has to be $\THEORY$, starting a new theory
    4.43 -based on the merge of existing ones.  The theory context may be changed by
    4.44 -$\CONTEXT$ without creating a new theory.  In both cases $\END$ concludes the
    4.45 -theory development; it has to be the very last command of any proper theory
    4.46 -file.
    4.47 +based on the merge of existing ones.  The theory context may be also changed
    4.48 +by $\CONTEXT$ without creating a new theory.  In both cases, $\END$ concludes
    4.49 +the theory development; it has to be the very last command of any proper
    4.50 +theory file.
    4.51  
    4.52  \begin{rail}
    4.53    'theory' name '=' (name + '+') filespecs? ':'
    4.54 @@ -55,18 +56,20 @@
    4.55  
    4.56  \begin{descr}
    4.57  \item [$\THEORY~A = B@1 + \cdots + B@n$] commences a new theory $A$ based on
    4.58 -  existing ones $B@1 + \cdots + B@n$.  Note that Isabelle's theory loader
    4.59 -  system ensures that any of the base theories are properly loaded (and fully
    4.60 -  up-to-date when $\THEORY$ is executed interactively).  The optional
    4.61 -  $\isarkeyword{files}$ specification declares additional dependencies on ML
    4.62 -  files.  Unless put in in parentheses, any file will be loaded immediately
    4.63 -  via $\isarcmd{use}$ (see also \S\ref{sec:ML}).
    4.64 +  existing ones $B@1 + \cdots + B@n$.  Isabelle's theory loader system ensures
    4.65 +  that any of the base theories are properly loaded (and fully up-to-date when
    4.66 +  $\THEORY$ is executed interactively).  The optional $\isarkeyword{files}$
    4.67 +  specification declares additional dependencies on ML files.  Unless put in
    4.68 +  parentheses, any file will be loaded immediately via $\isarcmd{use}$ (see
    4.69 +  also \S\ref{sec:ML}).
    4.70    
    4.71  \item [$\CONTEXT~B$] enters an existing theory context $B$, basically in
    4.72    read-only mode, so only a limited set of commands may be performed.  Just as
    4.73    for $\THEORY$, the theory loader ensures that $B$ is loaded and up-to-date.
    4.74 -
    4.75 +  
    4.76  \item [$\END$] concludes the current theory definition or context switch.
    4.77 +  Note that this command cannot be undone, instead the theory definition
    4.78 +  itself has to be retracted.
    4.79  \end{descr}
    4.80  
    4.81  
    4.82 @@ -91,12 +94,12 @@
    4.83  Consequently, it would be included in the final printed version.
    4.84  
    4.85  Apart from plain prose, formal comments may also refer to logical entities of
    4.86 -the current theory context (types, terms, theorems etc.).  Proper processing
    4.87 -of the text would then include some further consistency checks with the items
    4.88 -declared in the current theory, e.g.\ type-checking of included terms.
    4.89 -\footnote{The current version of Isabelle/Isar does not process formal
    4.90 +the theory context (types, terms, theorems etc.).  Proper processing of the
    4.91 +text would then include some further consistency checks with the items
    4.92 +declared in the current theory, e.g.\ type-checking of included
    4.93 +terms.\footnote{The current version of Isabelle/Isar does not process formal
    4.94    comments in any such way.  This will be available as part of the automatic
    4.95 -  theory and proof document preparation system (via (PDF)LaTeX) that is
    4.96 +  theory and proof document preparation system (using (PDF){\LaTeX}) that is
    4.97    planned for the near future.}
    4.98  
    4.99  \begin{rail}
   4.100 @@ -108,13 +111,13 @@
   4.101  
   4.102  \begin{descr}
   4.103  \item [$\isarkeyword{title}~title~author~date$] specifies the document title
   4.104 -  just as in typical LaTeX documents.
   4.105 +  just as in typical {\LaTeX} documents.
   4.106  \item [$\isarkeyword{chapter}~text$, $\isarkeyword{section}~text$,
   4.107 -  $\isarkeyword{subsection}~text$, $\isarkeyword{subsubsection}~text$] specify
   4.108 -  chapter and subsection headings.
   4.109 +  $\isarkeyword{subsection}~text$, and $\isarkeyword{subsubsection}~text$]
   4.110 +  specify chapter and section headings.
   4.111  \item [$\TEXT~text$] specifies an actual body of prose text, including
   4.112 -  references to formal entities.\footnote{The latter feature is not yet
   4.113 -    exploited in any way.}
   4.114 +  references to formal entities (the latter feature is not yet exploited in
   4.115 +  any way).
   4.116  \end{descr}
   4.117  
   4.118  
   4.119 @@ -137,14 +140,15 @@
   4.120  \end{rail}
   4.121  
   4.122  \begin{descr}
   4.123 -\item [$\isarkeyword{classes}~c<cs ~\dots$] declares class $c$ to be a
   4.124 -  subclass of existing classes $cs$.  Cyclic class structures are ruled out.
   4.125 +\item [$\isarkeyword{classes}~c<\vec c ~\dots$] declares class $c$ to be a
   4.126 +  subclass of existing classes $\vec c$.  Cyclic class structures are ruled
   4.127 +  out.
   4.128  \item [$\isarkeyword{classrel}~c@1<c@2$] states a subclass relation between
   4.129    existing classes $c@1$ and $c@2$.  This is done axiomatically!  The
   4.130 -  $\isarkeyword{instance}$ command provides a way introduce proven class
   4.131 -  relations (see \S\ref{sec:axclass}).
   4.132 +  $\isarkeyword{instance}$ command (see \S\ref{sec:axclass}) provides a way
   4.133 +  introduce proven class relations.
   4.134  \item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
   4.135 -  any type variables input without sort constraints.  Typically, the default
   4.136 +  any type variables input without sort constraints.  Usually, the default
   4.137    sort would be only changed when defining new logics.
   4.138  \end{descr}
   4.139  
   4.140 @@ -180,19 +184,19 @@
   4.141  \item [$\isarkeyword{typedecl}~(\vec\alpha)t$] declares a new type constructor
   4.142    $t$, intended as an actual logical type.  Note that some logics such as
   4.143    Isabelle/HOL provide their own version of $\isarkeyword{typedecl}$.
   4.144 -\item [$\isarkeyword{nonterminals}~c~\dots$] declares $0$-ary type
   4.145 -  constructors $c$ to act as purely syntactic types, i.e.\ nonterminal symbols
   4.146 -  of Isabelle's inner syntax of terms or types.
   4.147 +\item [$\isarkeyword{nonterminals}~\vec c$] declares $0$-ary type constructors
   4.148 +  $\vec c$ to act as purely syntactic types, i.e.\ nonterminal symbols of
   4.149 +  Isabelle's inner syntax of terms or types.
   4.150  \item [$\isarkeyword{arities}~t::(\vec s)s~\dots$] augments Isabelle's
   4.151    order-sorted signature of types by new type constructor arities.  This is
   4.152 -  done axiomatically!  The $\isarkeyword{instance}$ command provides a way
   4.153 -  introduce proven type arities (see \S\ref{sec:axclass}).
   4.154 +  done axiomatically!  The $\isarkeyword{instance}$ command (see
   4.155 +  \S\ref{sec:axclass}) provides a way introduce proven type arities.
   4.156  \end{descr}
   4.157  
   4.158  
   4.159  \subsection{Constants and simple definitions}
   4.160  
   4.161 -\indexisarcmd{consts}\indexisarcmd{defs}\indexisarcmd{constdefs}
   4.162 +\indexisarcmd{consts}\indexisarcmd{defs}\indexisarcmd{constdefs}\indexoutertoken{constdecl}
   4.163  \begin{matharray}{rcl}
   4.164    \isarcmd{consts} & : & \isartrans{theory}{theory} \\
   4.165    \isarcmd{defs} & : & \isartrans{theory}{theory} \\
   4.166 @@ -212,13 +216,13 @@
   4.167  \end{rail}
   4.168  
   4.169  \begin{descr}
   4.170 -\item [$\CONSTS~c::\tau~\dots$] declares constant $c$ to have any instance of
   4.171 -  type scheme $\tau$.  The optional mixfix annotations may attach concrete
   4.172 -  syntax to the constant.
   4.173 +\item [$\CONSTS~c::\sigma~\dots$] declares constant $c$ to have any instance
   4.174 +  of type scheme $\sigma$.  The optional mixfix annotations may attach
   4.175 +  concrete syntax constants.
   4.176  \item [$\DEFS~name: eqn~\dots$] introduces $eqn$ as a definitional axiom for
   4.177    some existing constant.  See \cite[\S6]{isabelle-ref} for more details on
   4.178    the form of equations admitted as constant definitions.
   4.179 -\item [$\isarkeyword{constdefs}~c::\tau~eqn~\dots$] combines constant
   4.180 +\item [$\isarkeyword{constdefs}~c::\sigma~eqn~\dots$] combines constant
   4.181    declarations and definitions, using canonical name $c_def$ for the
   4.182    definitional axiom.
   4.183  \end{descr}
   4.184 @@ -242,15 +246,15 @@
   4.185  \end{rail}
   4.186  
   4.187  \begin{descr}
   4.188 -\item [$\isarkeyword{syntax}~mode~decls$] is similar to $\CONSTS~decls$,
   4.189 -  except the actual logical signature extension.  Thus the context free
   4.190 -  grammar of Isabelle's inner syntax may be augmented in arbitrary ways.  The
   4.191 -  $mode$ argument refers to the print mode that the grammar rules belong;
   4.192 -  unless there is the \texttt{output} flag given, all productions are added
   4.193 -  both to the input and output grammar.
   4.194 -\item [$\isarkeyword{translations}~rule~\dots$] specifies syntactic
   4.195 -  translation rules (macros): parse/print rules (\texttt{==}), parse rules
   4.196 -  (\texttt{=>}), print rules (\texttt{<=}).  Translation patterns may be
   4.197 +\item [$\isarkeyword{syntax}~(mode)~decls$] is similar to $\CONSTS~decls$,
   4.198 +  except that the actual logical signature extension is omitted.  Thus the
   4.199 +  context free grammar of Isabelle's inner syntax may be augmented in
   4.200 +  arbitrary ways.  The $mode$ argument refers to the print mode that the
   4.201 +  grammar rules belong; unless there is the \texttt{output} flag given, all
   4.202 +  productions are added both to the input and output grammar.
   4.203 +\item [$\isarkeyword{translations}~rules$] specifies syntactic translation
   4.204 +  rules (also known as \emph{macros}): parse/print rules (\texttt{==}), parse
   4.205 +  rules (\texttt{=>}), print rules (\texttt{<=}).  Translation patterns may be
   4.206    prefixed by the syntactic category to be used for parsing; the default is
   4.207    \texttt{logic}.
   4.208  \end{descr}
   4.209 @@ -275,14 +279,14 @@
   4.210  \begin{descr}
   4.211  \item [$\isarkeyword{axioms}~name: \phi~\dots$] introduces arbitrary
   4.212    statements as logical axioms.  In fact, axioms are ``axiomatic theorems'',
   4.213 -  and may be referred as any other theorems later.
   4.214 +  and may be referred just as any other theorem later.
   4.215    
   4.216    Axioms are usually only introduced when declaring new logical systems.
   4.217 -  Everyday work is normally done the hard way, with proper definitions and
   4.218 +  Everyday work is typically done the hard way, with proper definitions and
   4.219    actual theorems.
   4.220  \item [$\isarkeyword{theorems}~name = thms$] stores lists of existing theorems
   4.221 -  as $name$.  Typical applications would also involve attributes to augment
   4.222 -  the default simpset, for example.
   4.223 +  as $name$.  Typical applications would also involve attributes (to augment
   4.224 +  the default simpset, for example).
   4.225  \item [$\isarkeyword{lemmas}$] is similar to $\isarkeyword{theorems}$, but
   4.226    tags the results as ``lemma''.
   4.227  \end{descr}
   4.228 @@ -290,23 +294,23 @@
   4.229  
   4.230  \subsection{Name spaces}
   4.231  
   4.232 -Isabelle organizes any kind of names (of types, constants, theorems etc.)  by
   4.233 -hierarchically structured name spaces.  Normally the user never has to control
   4.234 -the behavior of name space entry by hand, yet the following commands provide
   4.235 -some way to do so.
   4.236 -
   4.237  \indexisarcmd{global}\indexisarcmd{local}
   4.238  \begin{matharray}{rcl}
   4.239    \isarcmd{global} & : & \isartrans{theory}{theory} \\
   4.240    \isarcmd{local} & : & \isartrans{theory}{theory} \\
   4.241  \end{matharray}
   4.242  
   4.243 +Isabelle organizes any kind of names (of types, constants, theorems etc.)  by
   4.244 +hierarchically structured name spaces.  Normally the user never has to control
   4.245 +the behavior of name space entry by hand, yet the following commands provide
   4.246 +some way to do so.
   4.247 +
   4.248  \begin{descr}
   4.249  \item [$\isarkeyword{global}$ and $\isarkeyword{local}$] change the current
   4.250    name declaration mode.  Initially, theories start in $\isarkeyword{local}$
   4.251    mode, causing all names to be automatically qualified by the theory name.
   4.252    Changing this to $\isarkeyword{global}$ causes all names to be declared as
   4.253 -  base names only.
   4.254 +  base names only, until $\isarkeyword{local}$ is declared again.
   4.255  \end{descr}
   4.256  
   4.257  
   4.258 @@ -316,7 +320,7 @@
   4.259  \begin{matharray}{rcl}
   4.260    \isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
   4.261    \isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
   4.262 -  \isarcmd{setup} & : & \isartrans{\cdot}{\cdot} \\
   4.263 +  \isarcmd{setup} & : & \isartrans{theory}{theory} \\
   4.264  \end{matharray}
   4.265  
   4.266  \begin{rail}
   4.267 @@ -329,16 +333,17 @@
   4.268  \end{rail}
   4.269  
   4.270  \begin{descr}
   4.271 -\item [$\isarkeyword{use}~file$] reads and execute ML commands from $file$.
   4.272 -  The current theory context as passed down to the ML session.  Furthermore,
   4.273 -  the file name is checked with the dependency declarations given in the
   4.274 -  theory header (see also \S\ref{sec:begin-thy}).
   4.275 -  \item [$\isarkeyword{ML}~text$] reads and executes ML commands from $text$.
   4.276 -  The theory context is passed just as in $\isarkeyword{use}$.
   4.277 +\item [$\isarkeyword{use}~file$] reads and executes ML commands from $file$.
   4.278 +  The current theory context (if present) is passed down to the ML session.
   4.279 +  Furthermore, the file name is checked with the $\isarkeyword{files}$
   4.280 +  dependency declaration given in the theory header (see also
   4.281 +  \S\ref{sec:begin-thy}).
   4.282 +\item [$\isarkeyword{ML}~text$] reads and executes ML commands from $text$.
   4.283 +  The theory context is passed just as for $\isarkeyword{use}$.
   4.284  \item [$\isarkeyword{setup}~text$] changes the current theory context by
   4.285 -  applying setup functions $text$ (which has to be an ML expression of type
   4.286 -  $(theory -> theory)~list$.  The $\isarkeyword{setup}$ is the usual way to
   4.287 -  initialize object-logic specific tools and packages written in ML.
   4.288 +  applying setup functions $text$, which has to be an ML expression of type
   4.289 +  $(theory \to theory)~list$.  The $\isarkeyword{setup}$ command is the usual
   4.290 +  way to initialize object-logic specific tools and packages written in ML.
   4.291  \end{descr}
   4.292  
   4.293  
   4.294 @@ -370,37 +375,40 @@
   4.295    \isarcmd{oracle} & : & \isartrans{theory}{theory} \\
   4.296  \end{matharray}
   4.297  
   4.298 +Oracles provide an interface to external reasoning systems, without giving up
   4.299 +control completely --- each theorem carries a derivation object recording any
   4.300 +oracle invocation.  See \cite[\S6]{isabelle-ref} for more information.
   4.301 +
   4.302  \begin{rail}
   4.303    'oracle' name '=' text comment?
   4.304    ;
   4.305  \end{rail}
   4.306  
   4.307  \begin{descr}
   4.308 -\item [$\isarkeyword{oracle}~name=text$] FIXME
   4.309 +\item [$\isarkeyword{oracle}~name=text$] declares oracle $name$ to be ML
   4.310 +  function $text$, which has to be of type $Sign\mathord.sg \times object \to
   4.311 +  term)$.
   4.312  \end{descr}
   4.313  
   4.314  
   4.315  \section{Proof commands}
   4.316  
   4.317  Proof commands provide transitions of Isar/VM machine configurations.  There
   4.318 -are three different kinds of operation:
   4.319 +are three different modes of operation.
   4.320  \begin{descr}
   4.321  \item [$proof(prove)$] means that a new goal has just been stated that is now
   4.322    to be \emph{proven}; the next command may refine it by some proof method
   4.323 -  ($\approx$ tactic) and enter a sub-proof to establish the final result.
   4.324 +  ($\approx$ tactic), and enter a sub-proof to establish the final result.
   4.325  \item [$proof(state)$] is like an internal theory mode: the context may be
   4.326 -  augmented by \emph{stating} additional assumptions, intermediate result;
   4.327 -\item [$proof(chain)$] indicates an intermediate mode between $proof(state)$
   4.328 -  and $proof(state)$: some already established facts have been just picked up
   4.329 -  in order to use them when refining the subsequent goal.
   4.330 +  augmented by \emph{stating} additional assumptions, intermediate result etc.
   4.331 +\item [$proof(chain)$] is an intermediate mode between $proof(state)$ and
   4.332 +  $proof(prove)$: some existing facts have been just picked up in order to use
   4.333 +  them when refining the goal to be claimed next.
   4.334  \end{descr}
   4.335  
   4.336  
   4.337  \subsection{Formal comments}\label{sec:formal-cmt-prf}
   4.338  
   4.339 -The following formal comments in proof mode closely correspond to the ones of
   4.340 -theory mode (see \S\ref{sec:formal-cmt-thy} for more information).
   4.341 -
   4.342  \indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsect}\indexisarcmd{txt}
   4.343  \begin{matharray}{rcl}
   4.344    \isarcmd{sect} & : & \isartrans{proof(state)}{proof(state)} \\
   4.345 @@ -409,6 +417,9 @@
   4.346    \isarcmd{txt} & : & \isartrans{proof(state)}{proof(state)} \\
   4.347  \end{matharray}
   4.348  
   4.349 +These formal comments in proof mode closely correspond to the ones of theory
   4.350 +mode (see \S\ref{sec:formal-cmt-thy}).
   4.351 +
   4.352  \begin{rail}
   4.353    ('sect' | 'subsect' | 'subsubsect' | 'txt') text
   4.354    ;
   4.355 @@ -417,8 +428,6 @@
   4.356  
   4.357  \subsection{Proof context}
   4.358  
   4.359 -FIXME
   4.360 -
   4.361  \indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}\indexisarcmd{let}
   4.362  \begin{matharray}{rcl}
   4.363    \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
   4.364 @@ -428,12 +437,14 @@
   4.365    \isarcmd{let} & : & \isartrans{proof(state)}{proof(state)} \\
   4.366  \end{matharray}
   4.367  
   4.368 +FIXME
   4.369 +
   4.370  \begin{rail}
   4.371    'fix' (var +) comment?
   4.372    ;
   4.373 -  ('assume' | 'presume') thmdecl? (proppat +) comment?
   4.374 +  ('assume' | 'presume') thmdecl? \\ (prop proppat? +) comment?
   4.375    ;
   4.376 -  'def' thmdecl? var '==' termpat comment?
   4.377 +  'def' thmdecl? \\ var '==' term termpat? comment?
   4.378    ;
   4.379    'let' ((term + 'as') '=' term comment? + 'and')
   4.380    ;
   4.381 @@ -452,8 +463,6 @@
   4.382  
   4.383  \subsection{Facts and forward chaining}
   4.384  
   4.385 -FIXME
   4.386 -
   4.387  \indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
   4.388  \begin{matharray}{rcl}
   4.389    \isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
   4.390 @@ -462,6 +471,8 @@
   4.391    \isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
   4.392  \end{matharray}
   4.393  
   4.394 +FIXME
   4.395 +
   4.396  \begin{rail}
   4.397    'note' thmdef? thmrefs comment?
   4.398    ;
   4.399 @@ -472,28 +483,23 @@
   4.400  \end{rail}
   4.401  
   4.402  \begin{descr}
   4.403 -\item [$\NOTE{a}{bs}$] recalls existing facts $bs$, binding the result as $a$
   4.404 -  (and $facts$).  Note that attributes may be involved as well, both on the
   4.405 -  left and right hand side.
   4.406 +\item [$\NOTE{a}{\vec b}$] recalls existing facts $\vec b$, binding the result
   4.407 +  as $a$.  Note that attributes may be involved as well, both on the left and
   4.408 +  right hand sides.
   4.409  \item [$\THEN$] indicates forward chaining by the current facts in order to
   4.410 -  establish the subsequent goal.  The initial proof method invoked to solve
   4.411 -  that will be offered these facts to do anything ``appropriate'' (see also
   4.412 -  \S\ref{sec:proof-steps}).  For example, method $rule$ (see
   4.413 +  establish the goal to be claimed next.  The initial proof method invoked to
   4.414 +  solve that will be offered these facts to do ``anything appropriate'' (see
   4.415 +  also \S\ref{sec:proof-steps}).  For example, method $rule$ (see
   4.416    \S\ref{sec:pure-meth}) would do an elimination rather than an introduction.
   4.417 -\item [$\FROM{bs}$] abbreviates $\NOTE{facts}{bs}~\THEN$; also note that
   4.418 +\item [$\FROM{\vec b}$] abbreviates $\NOTE{}{\vec b}~\THEN$; also note that
   4.419    $\THEN$ is equivalent to $\FROM{facts}$.
   4.420 -\item [$\WITH{bs}$] abbreviates $\FROM{bs~facts}$; thus the forward chaining
   4.421 -  is from earlier facts together with the current ones.
   4.422 +\item [$\WITH{\vec b}$] abbreviates $\FROM{\vec b~facts}$; thus the forward
   4.423 +  chaining is from earlier facts together with the current ones.
   4.424  \end{descr}
   4.425  
   4.426  
   4.427  \subsection{Goal statements}
   4.428  
   4.429 -Proof mode is entered from theory mode by initial goal commands $\THEOREMNAME$
   4.430 -and $\LEMMANAME$.  New local goals may be claimed within proof mode: four
   4.431 -variants indicate whether the result is meant to solve some pending goal and
   4.432 -whether forward chaining is employed.
   4.433 -
   4.434  \indexisarcmd{theorem}\indexisarcmd{lemma}
   4.435  \indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
   4.436  \begin{matharray}{rcl}
   4.437 @@ -505,6 +511,11 @@
   4.438    \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
   4.439  \end{matharray}
   4.440  
   4.441 +Proof mode is entered from theory mode by initial goal commands $\THEOREMNAME$
   4.442 +and $\LEMMANAME$.  New local goals may be claimed within proof mode: four
   4.443 +variants are available, indicating whether the result is meant to solve some
   4.444 +pending goal and whether forward chaining is employed.
   4.445 +
   4.446  \begin{rail}
   4.447    ('theorem' | 'lemma') goal
   4.448    ;
   4.449 @@ -517,14 +528,14 @@
   4.450  
   4.451  \begin{descr}
   4.452  \item [$\THEOREM{name}{\phi}$] enters proof mode with $\phi$ as main goal,
   4.453 -  eventually resulting in some theorem $\turn \phi$, which stored in the
   4.454 -  theory.
   4.455 +  eventually resulting in some theorem $\turn \phi$, which will be stored in
   4.456 +  the theory.
   4.457  \item [$\LEMMANAME$] is similar to $\THEOREMNAME$, but tags the result as
   4.458    ``lemma''.
   4.459  \item [$\HAVE{name}{\phi}$] claims a local goal, eventually resulting in a
   4.460    theorem with the current assumption context as hypotheses.
   4.461 -\item [$\SHOW{name}{\phi}$] same as $\HAVE{name}{\phi}$, but solves some
   4.462 -  pending goal with the result exported to the enclosing assumption context.
   4.463 +\item [$\SHOW{name}{\phi}$] is similar to $\HAVE{name}{\phi}$, but solves some
   4.464 +  pending goal with the result \emph{exported} into the corresponding context.
   4.465  \item [$\HENCE{name}{\phi}$] abbreviates $\THEN~\HAVE{name}{\phi}$, i.e.\ 
   4.466    claims a local goal to be proven by forward chaining the current facts.
   4.467  \item [$\THUS{name}{\phi}$] abbreviates $\THEN~\SHOW{name}{\phi}$.
   4.468 @@ -533,39 +544,48 @@
   4.469  
   4.470  \subsection{Initial and terminal proof steps}\label{sec:proof-steps}
   4.471  
   4.472 +\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
   4.473 +\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
   4.474 +\begin{matharray}{rcl}
   4.475 +  \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
   4.476 +  \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
   4.477 +  \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.478 +  \isarcmd{.\,.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.479 +  \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.480 +  \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.481 +\end{matharray}
   4.482 +
   4.483  Arbitrary goal refinements via tactics is considered harmful.  Consequently
   4.484  the Isar framework admits proof methods to be invoked in two places only.
   4.485  \begin{enumerate}
   4.486 -\item An \emph{initial} refinement step (via $\PROOF{m@1}$) reduces a newly
   4.487 -  stated intermediate goal to a number of sub-goals that are to be solved
   4.488 -  subsequently.  Facts are passed to $m@1$ for forward chaining if so
   4.489 -  indicated by $proof(chain)$ mode.
   4.490 +\item An \emph{initial} refinement step $\PROOF{m@1}$ reduces a newly stated
   4.491 +  intermediate goal to a number of sub-goals that are to be solved later.
   4.492 +  Facts are passed to $m@1$ for forward chaining if so indicated by
   4.493 +  $proof(chain)$ mode.
   4.494    
   4.495 -\item A \emph{terminal} conclusion step (via $\QED{m@2}$)) solves any remaining
   4.496 +\item A \emph{terminal} conclusion step $\QED{m@2}$ solves any remaining
   4.497    pending goals completely.  No facts are passed to $m@2$.
   4.498  \end{enumerate}
   4.499  
   4.500  The only other proper way to affect pending goals is by $\SHOWNAME$, which
   4.501  involves an explicit statement of what is solved.
   4.502  
   4.503 +\medskip
   4.504 +
   4.505  Also note that initial proof methods should either solve the goal completely,
   4.506  or constitute some well-understood deterministic reduction to new sub-goals.
   4.507  Arbitrary automatic proof tools that are prone leave a large number of badly
   4.508  structured sub-goals are no help in continuing the proof document in any
   4.509 -intelligible way.  A much better technique is to $\SHOWNAME$ some non-trivial
   4.510 -reduction as an explicit rule, which is solved completely by some automated
   4.511 -method, and then applied to some pending goal.
   4.512 +intelligible way.  A much better technique would be to $\SHOWNAME$ some
   4.513 +non-trivial reduction as an explicit rule, which is solved completely by some
   4.514 +automated method, and then applied to some pending goal.
   4.515  
   4.516 -\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
   4.517 -\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
   4.518 -\begin{matharray}{rcl}
   4.519 -  \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
   4.520 -  \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
   4.521 -  \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.522 -  \isarcmd{..} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.523 -  \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.524 -  \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   4.525 -\end{matharray}
   4.526 +\medskip
   4.527 +
   4.528 +Unless given explicitly by the user, the default initial method is
   4.529 +``$default$'', which is usually set up to apply a single standard elimination
   4.530 +or introduction rule according to the topmost symbol involved.  The default
   4.531 +terminal method is ``$finish$''; it solves all goals by assumption.
   4.532  
   4.533  \begin{rail}
   4.534    'proof' interest? meth? comment?
   4.535 @@ -582,36 +602,29 @@
   4.536  \end{rail}
   4.537  
   4.538  \begin{descr}
   4.539 -\item [$\PROOF{m}$] refines the pending goal by proof method $m$ (facts for
   4.540 -  forward chaining are passed if indicated by $proof(chain)$).
   4.541 -\item [$\QED{m}$] refines any remaining goals by proof method $m$ and
   4.542 +\item [$\PROOF{m@1}$] refines the pending goal by proof method $m@1$; facts
   4.543 +  for forward chaining are passed if so indicated by $proof(chain)$.
   4.544 +\item [$\QED{m@2}$] refines any remaining goals by proof method $m@1$ and
   4.545    concludes the sub-proof.  If the goal had been $\SHOWNAME$, some pending
   4.546    sub-goal is solved as well by the rule resulting from the result exported to
   4.547 -  the enclosing goal context.
   4.548 -  
   4.549 -  Thus $\QEDNAME$ may fail for two reasons: either $m$ fails to solve all
   4.550 -  remaining goals completely, or the resulting rule does not resolve with any
   4.551 -  enclosing goal.  Debugging such a situation might involve temporarily
   4.552 -  changing $\SHOWNAME$ into $\HAVENAME$, or weakening the local context by
   4.553 -  replacing $\ASSUMENAME$ by $\PRESUMENAME$.
   4.554 -\item [$\BY{m@1}{m@2}$] is a \emph{terminal proof}; it abbreviates
   4.555 -  $\PROOF{m@1}~\QED{m@2}$, automatically backtracking across both methods.
   4.556 -  
   4.557 -  Debugging an unsuccessful $\BY{m@1}{m@2}$ commands might be done by simply
   4.558 -  expanding the abbreviation by hand; usually $\PROOF{m@1}$ is already
   4.559 -  sufficient to see what goes wrong.
   4.560 -\item [$\isarkeyword{..}$] is a \emph{default proof}; it abbreviates
   4.561 -  $\BY{default}{finish}$, where method $default$ usually applies a single
   4.562 -  elimination or introduction rule according to the topmost symbol, and
   4.563 -  $finish$ solves all goals by assumption.
   4.564 -\item [$\isarkeyword{.}$] is a \emph{trivial proof}, it abbreviates
   4.565 -  $\BY{-}{finish}$, where method $-$ does nothing except inserting any facts
   4.566 -  into the proof state.
   4.567 +  the enclosing goal context.  Thus $\QEDNAME$ may fail for two reasons:
   4.568 +  either $m@2$ fails to solve all remaining goals completely, or the resulting
   4.569 +  rule does not resolve with any enclosing goal.  Debugging such a situation
   4.570 +  might involve temporarily changing $\SHOWNAME$ into $\HAVENAME$, or
   4.571 +  weakening the local context by replacing $\ASSUMENAME$ by $\PRESUMENAME$.
   4.572 +\item [$\BYY{m@1}{m@2}$] is a \emph{terminal proof}; it abbreviates
   4.573 +  $\PROOF{m@1}~\QED{m@2}$, with automatic backtracking across both methods.
   4.574 +  Debugging an unsuccessful $\BYY{m@1}{m@2}$ commands might be done by simply
   4.575 +  expanding the abbreviation by hand; note that $\PROOF{m@1}$ is usually
   4.576 +  sufficient to see what is going wrong.
   4.577 +\item [$\DDOT$] is a \emph{default proof}; it abbreviates $\BY{default}$.
   4.578 +\item [$\DOT$] is a \emph{trivial proof}, it abbreviates $\BY{-}$, where
   4.579 +  method ``$-$'' does nothing except inserting any facts into the proof state.
   4.580  \item [$\isarkeyword{sorry}$] is a \emph{fake proof}; provided that
   4.581    \texttt{quick_and_dirty} is enabled, $\isarkeyword{sorry}$ pretends to solve
   4.582    the goal without much ado.  Of course, the result is a fake theorem only,
   4.583 -  involving some oracle in its internal derivation object.  Note that this is
   4.584 -  indicated as \texttt{[!]} in the printed result.  The main application of
   4.585 +  involving some oracle in its internal derivation object (this is indicated
   4.586 +  as $[!]$ in the printed result.  The main application of
   4.587    $\isarkeyword{sorry}$ is to support top-down proof development.
   4.588  \end{descr}
   4.589  
   4.590 @@ -626,10 +639,10 @@
   4.591  $\isarkeyword{next}$, which is just a single block-close followed by
   4.592  block-open again.  Thus the effect of $\isarkeyword{next}$ is to reset the
   4.593  proof context to that of the head of the sub-proof.  Note that there is no
   4.594 -goal focus involved!
   4.595 +goal focus involved here!
   4.596  
   4.597 -There are explicit block parentheses as well.  These typically achieve a
   4.598 -strong forward style of reasoning.
   4.599 +For slightly more advanced applications, there are explicit block parentheses
   4.600 +as well.  These typically achieve a strong forward style of reasoning.
   4.601  
   4.602  \indexisarcmd{next}\indexisarcmd{\{\{}\indexisarcmd{\}\}}
   4.603  \begin{matharray}{rcl}
   4.604 @@ -656,6 +669,8 @@
   4.605    \isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\
   4.606  \end{matharray}
   4.607  
   4.608 +FIXME
   4.609 +
   4.610  \begin{rail}
   4.611    ('also' | 'finally') transrules? comment?
   4.612    ;
   4.613 @@ -665,16 +680,17 @@
   4.614  \end{rail}
   4.615  
   4.616  \begin{descr}
   4.617 -\item [$ $] FIXME
   4.618 +\item [$\ALSO~(thms)$] FIXME
   4.619 +\item [$\FINALLY~(thms)$] FIXME
   4.620  \end{descr}
   4.621  
   4.622  
   4.623  
   4.624  \subsection{Improper proof steps}
   4.625  
   4.626 -The following commands emulate tactic scripts to some extent.  While these are
   4.627 -anathema for writing proper Isar proof documents, they might come in handy for
   4.628 -exploring and debugging.
   4.629 +The following commands emulate unstructured tactic scripts to some extent.
   4.630 +While these are anathema for writing proper Isar proof documents, they might
   4.631 +come in handy for exploring and debugging.
   4.632  
   4.633  \indexisarcmd{apply}\indexisarcmd{then-apply}\indexisarcmd{back}
   4.634  \begin{matharray}{rcl}
   4.635 @@ -729,8 +745,8 @@
   4.636    according to the current theory or proof context.
   4.637  \item [$\isarkeyword{thm}~thms$] retrieves lists of theorems from the current
   4.638    theory or proof context.  Note that any attributes included in the theorem
   4.639 -  specifications are applied to a temporary proof context derived from the
   4.640 -  current theory or proof; the resulting context is discarded.
   4.641 +  specifications are applied to a temporary context derived from the current
   4.642 +  theory or proof; the result is discarded.
   4.643  \end{descr}
   4.644  
   4.645  
   4.646 @@ -751,10 +767,12 @@
   4.647  \item [$\isarkeyword{cd}~name$] changes the current directory of the Isabelle
   4.648    process.
   4.649  \item [$\isarkeyword{pwd}~$] prints the current working directory.
   4.650 -\item [$\isarkeyword{use_thy}~name$, $\isarkeyword{use_thy_only}~name$,
   4.651 -  $\isarkeyword{update_thy}~name$, $\isarkeyword{update_thy_only}~name$] load
   4.652 -  theory files.  These commands are exactly the same as the corresponding ML
   4.653 -  functions (see also \cite[\S1 and \S6]{isabelle-ref}).
   4.654 +\item [$\isarkeyword{use_thy}$, $\isarkeyword{use_thy_only}$,
   4.655 +  $\isarkeyword{update_thy}$, and $\isarkeyword{update_thy_only}$] load some
   4.656 +  theory given as $name$ argument.  These commands are exactly the same as the
   4.657 +  corresponding ML functions (see also \cite[\S1 and \S6]{isabelle-ref}).
   4.658 +  Note that both the ML and Isar versions of these commands may load new- and
   4.659 +  old-style theories alike.
   4.660  \end{descr}
   4.661  
   4.662  
     5.1 --- a/doc-src/IsarRef/syntax.tex	Wed Aug 04 18:20:05 1999 +0200
     5.2 +++ b/doc-src/IsarRef/syntax.tex	Wed Aug 04 18:20:24 1999 +0200
     5.3 @@ -50,9 +50,9 @@
     5.4  
     5.5  Large chunks of plain \railqtoken{text} are usually given
     5.6  \railtoken{verbatim}, i.e.\ enclosed in \verb|{*|\dots\verb|*}|.  For
     5.7 -convenience, any of the smaller text conforming to \railqtoken{nameref} are
     5.8 -admitted as well.  Almost any of the Isar commands may be annotated by some
     5.9 -marginal \railnonterm{comment} of the form \texttt{--} \railqtoken{text}.
    5.10 +convenience, any of the smaller text units conforming to \railqtoken{nameref}
    5.11 +are admitted as well.  Almost any of the Isar commands may be annotated by
    5.12 +some marginal \railnonterm{comment} of the form \texttt{--} \railqtoken{text}.
    5.13  Note that this kind of comment is actually part of the language, while source
    5.14  level comments \verb|(*|\dots\verb|*)| are already stripped at the lexical
    5.15  level.  A few commands such as $\PROOFNAME$ admit additional markup with a
    5.16 @@ -72,7 +72,7 @@
    5.17  \end{rail}
    5.18  
    5.19  
    5.20 -\subsection{Sorts and arities}
    5.21 +\subsection{Type classes, Sorts and arities}
    5.22  
    5.23  The syntax of sorts and arities is given directly at the outer level.  Note
    5.24  that this is in contrast to that types and terms (see \ref{sec:types-terms}).
    5.25 @@ -96,10 +96,10 @@
    5.26  The actual inner Isabelle syntax, that of types and terms of the logic, is far
    5.27  too flexible in order to be modeled explicitly at the outer theory level.
    5.28  Basically, any such entity has to be quoted at the outer level to turn it into
    5.29 -a single token, with the actual parsing deferred to some functions for reading
    5.30 -and type-checking.  For convenience, a more liberal convention is adopted:
    5.31 -quotes may be omitted for any type or term that is already \emph{atomic} at
    5.32 -the outer level.  E.g.\ one may write \texttt{x} instead of \texttt{"x"}.
    5.33 +a single token (the parsing and type-checking is performed later).  For
    5.34 +convenience, a slightly more liberal convention is adopted: quotes may be
    5.35 +omitted for any type or term that is already \emph{atomic at the outer level}.
    5.36 +E.g.\ one may write just \texttt{x} instead of \texttt{"x"}.
    5.37  
    5.38  \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop}
    5.39  \begin{rail}
    5.40 @@ -150,10 +150,10 @@
    5.41  \begin{rail}
    5.42    infix: '(' ('infixl' | 'infixr') string? nat ')'
    5.43    ;
    5.44 -  mixfix: infix | '(' string pris? nat? ')' | '(' 'binder' string pris? nat ')'
    5.45 +  mixfix: infix | '(' string prios? nat? ')' | '(' 'binder' string prios? nat ')'
    5.46    ;
    5.47  
    5.48 -  pris: '[' (nat + ',') ']'
    5.49 +  prios: '[' (nat + ',') ']'
    5.50    ;
    5.51  \end{rail}
    5.52  
    5.53 @@ -165,7 +165,8 @@
    5.54  unlike that of types and terms.  Instead, the attribute argument
    5.55  specifications may be any sequence of atomic entities (identifiers, strings
    5.56  etc.), or properly bracketed argument lists.  Below \railqtoken{atom} refers
    5.57 -to any atomic entity, including keywords that conform to \railtoken{symident}.
    5.58 +to any atomic entity, including \railtoken{keyword}s conforming to
    5.59 +\railtoken{symident}.
    5.60  
    5.61  \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes}
    5.62  \begin{rail}
    5.63 @@ -180,11 +181,12 @@
    5.64  \end{rail}
    5.65  
    5.66  Theorem specifications come in several flavors: \railnonterm{axmdecl} and
    5.67 -\railnonterm{thmdecl} usually refer to assumptions or results of goal
    5.68 -statements, \railnonterm{thmdef} collects lists of existing theorems,
    5.69 -\railnonterm{thmrefs} refers to any lists of existing theorems.  Any of these
    5.70 -may include lists of attributes, which are applied to the preceding theorem or
    5.71 -list of theorems.
    5.72 +\railnonterm{thmdecl} usually refer to axioms, assumptions or results of goal
    5.73 +statements, \railnonterm{thmdef} collects lists of existing theorems.
    5.74 +Existing theorems are given by \railnonterm{thmref} and \railnonterm{thmrefs}
    5.75 +(the former requires an actual singleton result).  Any of these theorem
    5.76 +specifications may include lists of attributes both on the left and right hand
    5.77 +sides; attributes are applied to the any immediately preceding theorem.
    5.78  
    5.79  \indexouternonterm{thmdecl}\indexouternonterm{axmdecl}
    5.80  \indexouternonterm{thmdef}\indexouternonterm{thmrefs}
    5.81 @@ -195,7 +197,9 @@
    5.82    ;
    5.83    thmdef: thmname '='
    5.84    ;
    5.85 -  thmrefs: nameref attributes? +
    5.86 +  thmref: nameref attributes?
    5.87 +  ;
    5.88 +  thmrefs: thmref +
    5.89    ;
    5.90  
    5.91    thmname: name attributes | name | attributes
    5.92 @@ -206,10 +210,10 @@
    5.93  \subsection{Proof methods}\label{sec:syn-meth}
    5.94  
    5.95  Proof methods are either basic ones, or expressions composed of methods via
    5.96 -``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternatives),
    5.97 +``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternative choices),
    5.98  ``\texttt{?}'' (try), ``\texttt{*}'' (repeat ${} \ge 0$ times), ``\texttt{+}''
    5.99  (repeat ${} > 0$ times).  In practice, proof methods are usually just a comma
   5.100 -separated list of \railqtoken{nameref}~\railnonterm{args} specifications.
   5.101 +separated list of (\railqtoken{nameref}~\railnonterm{args}) specifications.
   5.102  Thus the syntax is similar to that of attributes, with plain parentheses
   5.103  instead of square brackets (see also \S\ref{sec:syn-att}).  Note that
   5.104  parentheses may be dropped for single method specifications without arguments.