tuned;
authorwenzelm
Tue Aug 03 18:56:51 1999 +0200 (1999-08-03)
changeset 71670b2e3ef1d8f4
parent 7166 a4a870ec2e67
child 7168 741dc2a434b7
tuned;
much more material;
doc-src/IsarRef/generic.tex
doc-src/IsarRef/hol.tex
doc-src/IsarRef/intro.tex
doc-src/IsarRef/isar-ref.tex
doc-src/IsarRef/pure.tex
doc-src/IsarRef/syntax.tex
     1.1 --- a/doc-src/IsarRef/generic.tex	Tue Aug 03 13:16:29 1999 +0200
     1.2 +++ b/doc-src/IsarRef/generic.tex	Tue Aug 03 18:56:51 1999 +0200
     1.3 @@ -1,5 +1,76 @@
     1.4  
     1.5 -\chapter{Generic Tools and Packages}
     1.6 +\chapter{Generic Tools and Packages}\label{ch:gen-tools}
     1.7 +
     1.8 +\section{Basic proof methods and attributes}\label{sec:pure-meth}
     1.9 +
    1.10 +\indexisarmeth{fail}\indexisarmeth{succeed}\indexisarmeth{$-$}\indexisarmeth{assumption}
    1.11 +\indexisarmeth{finish}\indexisarmeth{fold}\indexisarmeth{unfold}
    1.12 +\indexisarmeth{rule}\indexisarmeth{erule}
    1.13 +\begin{matharray}{rcl}
    1.14 +  fail & : & \isarmeth \\
    1.15 +  succeed & : & \isarmeth \\
    1.16 +  - & : & \isarmeth \\
    1.17 +  assumption & : & \isarmeth \\
    1.18 +  finish & : & \isarmeth \\
    1.19 +  fold & : & \isarmeth \\
    1.20 +  unfold & : & \isarmeth \\
    1.21 +  rule & : & \isarmeth \\
    1.22 +  erule^* & : & \isarmeth \\
    1.23 +\end{matharray}
    1.24 +
    1.25 +\begin{rail}
    1.26 +  ('fold' | 'unfold' | 'rule' | 'erule') thmrefs
    1.27 +  ;
    1.28 +\end{rail}
    1.29 +
    1.30 +\begin{descr}
    1.31 +\item [$ $]
    1.32 +\end{descr}
    1.33 +
    1.34 +FIXME
    1.35 +
    1.36 +%FIXME sort
    1.37 +%FIXME thmref (single)
    1.38 +%FIXME var vs. term
    1.39 +
    1.40 +\indexisaratt{tag}\indexisaratt{untag}\indexisaratt{COMP}\indexisaratt{RS}
    1.41 +\indexisaratt{OF}\indexisaratt{where}\indexisaratt{of}\indexisaratt{standard}
    1.42 +\indexisaratt{elimify}\indexisaratt{transfer}\indexisaratt{export}
    1.43 +\begin{matharray}{rcl}
    1.44 +  tag & : & \isaratt \\
    1.45 +  untag & : & \isaratt \\
    1.46 +  COMP & : & \isaratt \\
    1.47 +  RS & : & \isaratt \\
    1.48 +  OF & : & \isaratt \\
    1.49 +  where & : & \isaratt \\
    1.50 +  of & : & \isaratt \\
    1.51 +  standard & : & \isaratt \\
    1.52 +  elimify & : & \isaratt \\
    1.53 +  transfer & : & \isaratt \\
    1.54 +  export & : & \isaratt \\
    1.55 +\end{matharray}
    1.56 +
    1.57 +\begin{rail}
    1.58 +  ('tag' | 'untag') (nameref+)
    1.59 +  ;
    1.60 +  ('COMP' | 'RS') nat? thmref
    1.61 +  ;
    1.62 +  'OF' thmrefs
    1.63 +  ;
    1.64 +  'where' (term '=' term * 'and')
    1.65 +  ;
    1.66 +  'of' (inst * ) ('concl:' (inst * ))?
    1.67 +  ;
    1.68 +
    1.69 +  inst: underscore | term
    1.70 +  ;
    1.71 +\end{rail}
    1.72 +
    1.73 +\begin{descr}
    1.74 +\item [$ $]
    1.75 +\end{descr}
    1.76 +
    1.77 +FIXME
    1.78  
    1.79  \section{Axiomatic Type Classes}\label{sec:axclass}
    1.80  
    1.81 @@ -23,7 +94,7 @@
    1.82    ;
    1.83  \end{rail}
    1.84  
    1.85 -\begin{description}
    1.86 +\begin{descr}
    1.87  \item [$\isarkeyword{axclass}~$] FIXME
    1.88  \item [$\isarkeyword{instance}~c@1 < c@2$ and $\isarkeyword{instance}~c@1 <
    1.89    c@2$] setup up a goal stating the class relation or type arity.  The proof
    1.90 @@ -31,7 +102,7 @@
    1.91    characteristic theorems of the type classes involved.  After finishing the
    1.92    proof the theory will be augmented by a type signature declaration
    1.93    corresponding to the resulting theorem.
    1.94 -\end{description}
    1.95 +\end{descr}
    1.96  
    1.97  
    1.98  
    1.99 @@ -49,9 +120,9 @@
   1.100    
   1.101  %\end{rail}
   1.102  
   1.103 -%\begin{description}
   1.104 +%\begin{descr}
   1.105  %\item [$ $]
   1.106 -%\end{description}
   1.107 +%\end{descr}
   1.108  
   1.109  
   1.110  %%% Local Variables: 
     2.1 --- a/doc-src/IsarRef/hol.tex	Tue Aug 03 13:16:29 1999 +0200
     2.2 +++ b/doc-src/IsarRef/hol.tex	Tue Aug 03 18:56:51 1999 +0200
     2.3 @@ -1,5 +1,5 @@
     2.4  
     2.5 -\chapter{Isabelle/HOL Tools and Packages}
     2.6 +\chapter{Isabelle/HOL Tools and Packages}\label{ch:hol-tools}
     2.7  
     2.8  \section{Primitive types}
     2.9  
    2.10 @@ -16,7 +16,7 @@
    2.11    ;
    2.12  \end{rail}
    2.13  
    2.14 -\begin{description}
    2.15 +\begin{descr}
    2.16  \item [$\isarkeyword{typedecl}~(\vec\alpha)t$] is similar to the original
    2.17    $\isarkeyword{typedecl}$ of Isabelle/Pure (see \S\ref{sec:types-pure}), but
    2.18    also declares type arity $t :: (term, \dots, term) term$, making $t$ an
    2.19 @@ -28,7 +28,7 @@
    2.20    refer to the HOL $\isarkeyword{typedef}$ primitive, but uses more advanced
    2.21    packages such as $\isarkeyword{record}$ (\S\ref{sec:record}) or
    2.22    $\isarkeyword{datatype}$ (\S\ref{sec:datatype}).
    2.23 -\end{description}
    2.24 +\end{descr}
    2.25  
    2.26  
    2.27  \section{Records}\label{sec:record}
    2.28 @@ -47,18 +47,18 @@
    2.29    ;
    2.30  \end{rail}
    2.31  
    2.32 -\begin{description}
    2.33 +\begin{descr}
    2.34  \item [$\isarkeyword{record}~(\vec\alpha)t = \tau + \vec c :: \vec\sigma$]
    2.35    defines extensible record type $(\vec\alpha)t$, derived from the optional
    2.36    parent record $\tau$ by adding new field components $\vec c :: \vec\sigma$.
    2.37    See \cite{isabelle-HOL,NaraschewskiW-TPHOLs98} for more information only
    2.38    simply-typed records.
    2.39 -\end{description}
    2.40 +\end{descr}
    2.41  
    2.42  
    2.43  \section{Datatypes}\label{sec:datatype}
    2.44  
    2.45 -\indexisarcmd{datatype}\indexisarcmd{rep_datatype}
    2.46 +\indexisarcmd{datatype}\indexisarcmd{rep-datatype}
    2.47  \begin{matharray}{rcl}
    2.48    \isarcmd{datatype} & : & \isartrans{theory}{theory} \\
    2.49    \isarcmd{rep_datatype} & : & \isartrans{theory}{theory} \\
    2.50 @@ -77,10 +77,10 @@
    2.51    ;
    2.52  \end{rail}
    2.53  
    2.54 -\begin{description}
    2.55 +\begin{descr}
    2.56  \item [$\isarkeyword{datatype}$] FIXME
    2.57  \item [$\isarkeyword{rep_datatype}$] FIXME
    2.58 -\end{description}
    2.59 +\end{descr}
    2.60  
    2.61  
    2.62  \section{Recursive functions}
    2.63 @@ -100,15 +100,15 @@
    2.64    ;
    2.65  \end{rail}
    2.66  
    2.67 -\begin{description}
    2.68 +\begin{descr}
    2.69  \item [$\isarkeyword{primrec}$] FIXME
    2.70  \item [$\isarkeyword{recdef}$] FIXME
    2.71 -\end{description}
    2.72 +\end{descr}
    2.73  
    2.74  
    2.75  \section{(Co)Inductive sets}
    2.76  
    2.77 -\indexisarcmd{inductive}\indexisarcmd{coinductive}\indexisarcmd{inductive\_cases}
    2.78 +\indexisarcmd{inductive}\indexisarcmd{coinductive}\indexisarcmd{inductive-cases}
    2.79  \begin{matharray}{rcl}
    2.80    \isarcmd{inductive} & : & \isartrans{theory}{theory} \\
    2.81    \isarcmd{coinductive} & : & \isartrans{theory}{theory} \\
    2.82 @@ -128,10 +128,10 @@
    2.83    ;
    2.84  \end{rail}
    2.85  
    2.86 -\begin{description}
    2.87 +\begin{descr}
    2.88  \item [$\isarkeyword{inductive}$ and $\isarkeyword{coinductive}$] FIXME
    2.89  \item [$\isarkeyword{inductive_cases}$] FIXME
    2.90 -\end{description}
    2.91 +\end{descr}
    2.92  
    2.93  
    2.94  \section{Proof by induction}
     3.1 --- a/doc-src/IsarRef/intro.tex	Tue Aug 03 13:16:29 1999 +0200
     3.2 +++ b/doc-src/IsarRef/intro.tex	Tue Aug 03 18:56:51 1999 +0200
     3.3 @@ -1,6 +1,15 @@
     3.4  
     3.5  \chapter{Introduction}
     3.6  
     3.7 +\section{Quick start}
     3.8 +
     3.9 +FIXME examples, ProofGeneral setup
    3.10 +
    3.11 +\section{Examples}
    3.12 +
    3.13 +\section{How to write Isar proofs anyway?}
    3.14 +
    3.15 +
    3.16  %%% Local Variables: 
    3.17  %%% mode: latex
    3.18  %%% TeX-master: "isar-ref"
     4.1 --- a/doc-src/IsarRef/isar-ref.tex	Tue Aug 03 13:16:29 1999 +0200
     4.2 +++ b/doc-src/IsarRef/isar-ref.tex	Tue Aug 03 18:56:51 1999 +0200
     4.3 @@ -9,8 +9,8 @@
     4.4  
     4.5  \makeindex
     4.6  
     4.7 -\railterm{lbrace,rbrace,llbrace,rrbrace}
     4.8 -\railterm{ident,longident,symident,var,textvar,typefree,typevar,nat,string,verbatim}
     4.9 +\railterm{percent,ppercent,underscore,lbrace,rbrace,llbrace,rrbrace}
    4.10 +\railterm{ident,longident,symident,var,textvar,typefree,typevar,nat,string,verbatim,keyword}
    4.11  
    4.12  \railalias{name}{\railqtoken{name}}
    4.13  \railalias{nameref}{\railqtoken{nameref}}
    4.14 @@ -37,7 +37,38 @@
    4.15  \maketitle 
    4.16  
    4.17  \begin{abstract}
    4.18 -  FIXME
    4.19 +  \emph{Intelligible semi-automated reasoning} (\emph{Isar}) is a generic
    4.20 +  approach to readable formal proof documents.  It sets out to bridge the
    4.21 +  semantic gap between any internal notions of proof based on primitive
    4.22 +  inferences and tactics, and an appropriate level of abstraction for
    4.23 +  user-level work.  The Isar formal proof language has been designed to
    4.24 +  satisfy quite contradictory requirements, being both ``declarative'' and
    4.25 +  immediately ``executable'', by virtue of the \emph{Isar/VM} interpreter.
    4.26 +  
    4.27 +  The current version of Isabelle offers Isar as an alternative proof language
    4.28 +  interface layer, beyond traditional tactic scripts.  The Isabelle/Isar
    4.29 +  system provides an interpreter for the Isar formal proof document language.
    4.30 +  Isabelle/Isar input may consist either of \emph{proper document
    4.31 +    constructors}, or \emph{improper auxiliary commands} (for diagnostics,
    4.32 +  exploration etc.).  Proof texts consisting of proper document constructors
    4.33 +  only admit a purely static reading, thus being intelligible later without
    4.34 +  requiring dynamic replay that is so typical for traditional proof scripts.
    4.35 +  Any of the Isabelle/Isar commands may be executed in single-steps, so
    4.36 +  basically the interpreter has a proof text debugger already built-in.
    4.37 +  
    4.38 +  Employing the \emph{ProofGeneral/isar} instantiation of the generic Emacs
    4.39 +  interface for interactive proof assistants of LFCS Edinburgh, we arrive at a
    4.40 +  reasonable environment for \emph{live document editing}.  Thus proof texts
    4.41 +  may be developed incrementally by issuing proper document constructors,
    4.42 +  including forward and backward tracing of partial documents; intermediate
    4.43 +  states may be inspected by diagnostic commands.
    4.44 +  
    4.45 +  The Isar subsystem of Isabelle is tightly integrated into the Isabelle/Pure
    4.46 +  meta-logic implementation.  Theories, theorems, proof procedures etc.\ may
    4.47 +  be used interchangeably between Isabelle-classic proof scripts and
    4.48 +  Isabelle/Isar documents.  Isar is as generic as Isabelle, able to support a
    4.49 +  wide range of object-logics.  The current end-user setup is mainly for
    4.50 +  Isabelle/HOL.
    4.51  \end{abstract}
    4.52  
    4.53  \pagenumbering{roman} \tableofcontents \clearfirst
     5.1 --- a/doc-src/IsarRef/pure.tex	Tue Aug 03 13:16:29 1999 +0200
     5.2 +++ b/doc-src/IsarRef/pure.tex	Tue Aug 03 18:56:51 1999 +0200
     5.3 @@ -1,11 +1,27 @@
     5.4  
     5.5 -\chapter{Common Isar elements}
     5.6 +\chapter{Basic Isar elements}
     5.7 +
     5.8 +Subsequently, we introduce most of the basic Isar theory and proof commands as
     5.9 +provided by Isabelle/Pure.  Chapter~\ref{ch:gen-tools} describes further Isar
    5.10 +elements as provided by generic tools and packages that are either part of
    5.11 +Pure Isabelle, or preloaded by most object logics (such as the simplifier).
    5.12 +See chapter~\ref{ch:hol-tools} for actual object-logic specific elements (for
    5.13 +Isabelle/HOL).
    5.14  
    5.15 -FIXME $*$ indicates \emph{improper commands}
    5.16 +\medskip
    5.17 +
    5.18 +Isar commands may be either \emph{proper} document constructors, or
    5.19 +\emph{improper commands} (indicated by $^*$).  Improper commands might be
    5.20 +helpful when developing proof documents, while their use is strongly
    5.21 +discouraged for the final outcome.  Typical examples are diagnostic commands
    5.22 +that print terms or theorems according to the current context; other commands
    5.23 +even emulate old-style tactical theorem proving, which facilitates porting of
    5.24 +legacy proof scripts.
    5.25 +
    5.26  
    5.27  \section{Theory commands}
    5.28  
    5.29 -\subsection{Defining theories}
    5.30 +\subsection{Defining theories}\label{sec:begin-thy}
    5.31  
    5.32  \indexisarcmd{theory}\indexisarcmd{end}\indexisarcmd{context}
    5.33  \begin{matharray}{rcl}
    5.34 @@ -15,15 +31,16 @@
    5.35  \end{matharray}
    5.36  
    5.37  Isabelle/Isar ``new-style'' theories are either defined via theory files or
    5.38 -interactively.\footnote{In contrast, ``old-style'' Isabelle theories support
    5.39 -  batch processing only, with only the ML proof script part suitable for
    5.40 -  interaction.}
    5.41 +interactively.  Both actual theory specifications and proofs are handled
    5.42 +uniformly --- occasionally definitional mechanisms even require some proof.
    5.43 +In contrast, ``old-style'' Isabelle theories support batch processing only,
    5.44 +with the proof scripts collected in separate ML files.
    5.45  
    5.46  The first command of any theory has to be $\THEORY$, starting a new theory
    5.47 -based on the merge of existing ones.  In interactive experiments, the theory
    5.48 -context may be changed by $\CONTEXT$ without creating a new theory.  In both
    5.49 -cases the concluding command is $\END$, which has to be the very last one of
    5.50 -any proper theory file.
    5.51 +based on the merge of existing ones.  The theory context may be changed by
    5.52 +$\CONTEXT$ without creating a new theory.  In both cases $\END$ concludes the
    5.53 +theory development; it has to be the very last command of any proper theory
    5.54 +file.
    5.55  
    5.56  \begin{rail}
    5.57    'theory' name '=' (name + '+') filespecs? ':'
    5.58 @@ -33,38 +50,42 @@
    5.59    'end'
    5.60    ;;
    5.61  
    5.62 -  filespecs : 'files' ((name | '(' name ')') +);
    5.63 +  filespecs: 'files' ((name | parname) +);
    5.64  \end{rail}
    5.65  
    5.66 -\begin{description}
    5.67 +\begin{descr}
    5.68  \item [$\THEORY~A = B@1 + \cdots + B@n$] commences a new theory $A$ based on
    5.69    existing ones $B@1 + \cdots + B@n$.  Note that Isabelle's theory loader
    5.70    system ensures that any of the base theories are properly loaded (and fully
    5.71 -  up-to-date when $\THEORY$ is executed interactively).
    5.72 +  up-to-date when $\THEORY$ is executed interactively).  The optional
    5.73 +  $\isarkeyword{files}$ specification declares additional dependencies on ML
    5.74 +  files.  Unless put in in parentheses, any file will be loaded immediately
    5.75 +  via $\isarcmd{use}$ (see also \S\ref{sec:ML}).
    5.76    
    5.77 -\item [$\CONTEXT~B$] enters existing theory context $B$, basically in
    5.78 +\item [$\CONTEXT~B$] enters an existing theory context $B$, basically in
    5.79    read-only mode, so only a limited set of commands may be performed.  Just as
    5.80    for $\THEORY$, the theory loader ensures that $B$ is loaded and up-to-date.
    5.81  
    5.82 -\item [$\END$] concludes the current theory definition of context switch.
    5.83 -\end{description}
    5.84 +\item [$\END$] concludes the current theory definition or context switch.
    5.85 +\end{descr}
    5.86  
    5.87  
    5.88 -\subsection{Formal comments}
    5.89 +\subsection{Formal comments}\label{sec:formal-cmt-thy}
    5.90  
    5.91 -\indexisarcmd{title}\indexisarcmd{chapter}\indexisarcmd{subsection}\indexisarcmd{subsubsection}
    5.92 -\indexisarcmd{text}\indexisarcmd{txt}
    5.93 +\indexisarcmd{title}\indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
    5.94 +\indexisarcmd{subsubsection}\indexisarcmd{text}
    5.95  \begin{matharray}{rcl}
    5.96    \isarcmd{title} & : & \isartrans{theory}{theory} \\
    5.97    \isarcmd{chapter} & : & \isartrans{theory}{theory} \\
    5.98 +  \isarcmd{section} & : & \isartrans{theory}{theory} \\
    5.99    \isarcmd{subsection} & : & \isartrans{theory}{theory} \\
   5.100    \isarcmd{subsubsection} & : & \isartrans{theory}{theory} \\
   5.101    \isarcmd{text} & : & \isartrans{theory}{theory} \\
   5.102 -  \isarcmd{txt} & : & \isartrans{proof(state)}{proof(state)} \\
   5.103  \end{matharray}
   5.104  
   5.105 -There are several commands to include \emph{formal comments} in theory and
   5.106 -proof specification.  In contrast to source-level comments
   5.107 +There are several commands to include \emph{formal comments} in theory
   5.108 +specification (a few more are available for proofs, see
   5.109 +\S\ref{sec:formal-cmt-prf}).  In contrast to source-level comments
   5.110  \verb|(*|\dots\verb|*)|, which are stripped at the lexical level, any text
   5.111  given as formal comment is meant to be part of the actual document.
   5.112  Consequently, it would be included in the final printed version.
   5.113 @@ -81,28 +102,20 @@
   5.114  \begin{rail}
   5.115    'title' text text? text?
   5.116    ;
   5.117 -  'chapter' text
   5.118 -  ;
   5.119 -  'subsection' text
   5.120 -  ;
   5.121 -  'subsubsection' text
   5.122 -  ;
   5.123 -  'text' text
   5.124 -  ;
   5.125 -  'txt' text
   5.126 +  ('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text') text
   5.127    ;
   5.128  \end{rail}
   5.129  
   5.130 -\begin{description}
   5.131 +\begin{descr}
   5.132  \item [$\isarkeyword{title}~title~author~date$] specifies the document title
   5.133    just as in typical LaTeX documents.
   5.134 -\item [$\isarkeyword{chapter}~text$, $\isarkeyword{subsection}~text$,
   5.135 -  $\isarkeyword{subsubsection}~text$] specify chapter and subsection headings.
   5.136 +\item [$\isarkeyword{chapter}~text$, $\isarkeyword{section}~text$,
   5.137 +  $\isarkeyword{subsection}~text$, $\isarkeyword{subsubsection}~text$] specify
   5.138 +  chapter and subsection headings.
   5.139  \item [$\TEXT~text$] specifies an actual body of prose text, including
   5.140    references to formal entities.\footnote{The latter feature is not yet
   5.141      exploited in any way.}
   5.142 -\item [$\TXT~text$] is similar to $\TEXT$, but may appear within proofs.
   5.143 -\end{description}
   5.144 +\end{descr}
   5.145  
   5.146  
   5.147  \subsection{Type classes and sorts}\label{sec:classes}
   5.148 @@ -115,7 +128,7 @@
   5.149  \end{matharray}
   5.150  
   5.151  \begin{rail}
   5.152 -  'classes' (classdecl +)
   5.153 +  'classes' (classdecl comment? +)
   5.154    ;
   5.155    'classrel' nameref '<' nameref comment?
   5.156    ;
   5.157 @@ -123,7 +136,7 @@
   5.158    ;
   5.159  \end{rail}
   5.160  
   5.161 -\begin{description}
   5.162 +\begin{descr}
   5.163  \item [$\isarkeyword{classes}~c<cs ~\dots$] declares class $c$ to be a
   5.164    subclass of existing classes $cs$.  Cyclic class structures are ruled out.
   5.165  \item [$\isarkeyword{classrel}~c@1<c@2$] states a subclass relation between
   5.166 @@ -133,7 +146,7 @@
   5.167  \item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
   5.168    any type variables input without sort constraints.  Typically, the default
   5.169    sort would be only changed when defining new logics.
   5.170 -\end{description}
   5.171 +\end{descr}
   5.172  
   5.173  
   5.174  \subsection{Types}\label{sec:types-pure}
   5.175 @@ -157,7 +170,7 @@
   5.176    ;
   5.177  \end{rail}
   5.178  
   5.179 -\begin{description}
   5.180 +\begin{descr}
   5.181  \item [$\TYPES~(\vec\alpha)t = \tau~\dots$] introduces \emph{type synonym}
   5.182    $(\vec\alpha)t$ for existing type $\tau$.  Unlike actual type definitions,
   5.183    as are available in Isabelle/HOL for example, type synonyms are just purely
   5.184 @@ -174,7 +187,7 @@
   5.185    order-sorted signature of types by new type constructor arities.  This is
   5.186    done axiomatically!  The $\isarkeyword{instance}$ command provides a way
   5.187    introduce proven type arities (see \S\ref{sec:axclass}).
   5.188 -\end{description}
   5.189 +\end{descr}
   5.190  
   5.191  
   5.192  \subsection{Constants and simple definitions}
   5.193 @@ -198,7 +211,7 @@
   5.194    ;
   5.195  \end{rail}
   5.196  
   5.197 -\begin{description}
   5.198 +\begin{descr}
   5.199  \item [$\CONSTS~c::\tau~\dots$] declares constant $c$ to have any instance of
   5.200    type scheme $\tau$.  The optional mixfix annotations may attach concrete
   5.201    syntax to the constant.
   5.202 @@ -208,10 +221,10 @@
   5.203  \item [$\isarkeyword{constdefs}~c::\tau~eqn~\dots$] combines constant
   5.204    declarations and definitions, using canonical name $c_def$ for the
   5.205    definitional axiom.
   5.206 -\end{description}
   5.207 +\end{descr}
   5.208  
   5.209  
   5.210 -\subsection{Concrete syntax}
   5.211 +\subsection{Syntax and translations}
   5.212  
   5.213  \indexisarcmd{syntax}\indexisarcmd{translations}
   5.214  \begin{matharray}{rcl}
   5.215 @@ -228,7 +241,7 @@
   5.216    ;
   5.217  \end{rail}
   5.218  
   5.219 -\begin{description}
   5.220 +\begin{descr}
   5.221  \item [$\isarkeyword{syntax}~mode~decls$] is similar to $\CONSTS~decls$,
   5.222    except the actual logical signature extension.  Thus the context free
   5.223    grammar of Isabelle's inner syntax may be augmented in arbitrary ways.  The
   5.224 @@ -240,7 +253,7 @@
   5.225    (\texttt{=>}), print rules (\texttt{<=}).  Translation patterns may be
   5.226    prefixed by the syntactic category to be used for parsing; the default is
   5.227    \texttt{logic}.
   5.228 -\end{description}
   5.229 +\end{descr}
   5.230  
   5.231  
   5.232  \subsection{Axioms and theorems}
   5.233 @@ -259,7 +272,7 @@
   5.234    ;
   5.235  \end{rail}
   5.236  
   5.237 -\begin{description}
   5.238 +\begin{descr}
   5.239  \item [$\isarkeyword{axioms}~name: \phi~\dots$] introduces arbitrary
   5.240    statements as logical axioms.  In fact, axioms are ``axiomatic theorems'',
   5.241    and may be referred as any other theorems later.
   5.242 @@ -272,35 +285,32 @@
   5.243    the default simpset, for example.
   5.244  \item [$\isarkeyword{lemmas}$] is similar to $\isarkeyword{theorems}$, but
   5.245    tags the results as ``lemma''.
   5.246 -\end{description}
   5.247 +\end{descr}
   5.248  
   5.249  
   5.250 -\subsection{Manipulating name spaces}
   5.251 +\subsection{Name spaces}
   5.252  
   5.253 -\indexisarcmd{global}\indexisarcmd{local}\indexisarcmd{path}
   5.254 +Isabelle organizes any kind of names (of types, constants, theorems etc.)  by
   5.255 +hierarchically structured name spaces.  Normally the user never has to control
   5.256 +the behavior of name space entry by hand, yet the following commands provide
   5.257 +some way to do so.
   5.258 +
   5.259 +\indexisarcmd{global}\indexisarcmd{local}
   5.260  \begin{matharray}{rcl}
   5.261    \isarcmd{global} & : & \isartrans{theory}{theory} \\
   5.262    \isarcmd{local} & : & \isartrans{theory}{theory} \\
   5.263 -  \isarcmd{path} & : & \isartrans{theory}{theory} \\
   5.264  \end{matharray}
   5.265  
   5.266 -\begin{rail}
   5.267 -  'global'
   5.268 -  ;
   5.269 -  'local'
   5.270 -  ;
   5.271 -  'path' nameref
   5.272 -  ;
   5.273 -\end{rail}
   5.274 -
   5.275 -\begin{description}
   5.276 -\item [$\isarkeyword{global}$] FIXME
   5.277 -\item [$\isarkeyword{local}$] FIXME
   5.278 -\item [$\isarkeyword{path}~name$] FIXME
   5.279 -\end{description}
   5.280 +\begin{descr}
   5.281 +\item [$\isarkeyword{global}$ and $\isarkeyword{local}$] change the current
   5.282 +  name declaration mode.  Initially, theories start in $\isarkeyword{local}$
   5.283 +  mode, causing all names to be automatically qualified by the theory name.
   5.284 +  Changing this to $\isarkeyword{global}$ causes all names to be declared as
   5.285 +  base names only.
   5.286 +\end{descr}
   5.287  
   5.288  
   5.289 -\subsection{Incorporating ML code}
   5.290 +\subsection{Incorporating ML code}\label{sec:ML}
   5.291  
   5.292  \indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{setup}
   5.293  \begin{matharray}{rcl}
   5.294 @@ -318,18 +328,25 @@
   5.295    ;
   5.296  \end{rail}
   5.297  
   5.298 -\begin{description}
   5.299 -\item [$\isarkeyword{use}~file$] FIXME
   5.300 -\item [$\isarkeyword{ML}~text$] FIXME
   5.301 -\item [$\isarkeyword{setup}~text$] FIXME
   5.302 -\end{description}
   5.303 +\begin{descr}
   5.304 +\item [$\isarkeyword{use}~file$] reads and execute ML commands from $file$.
   5.305 +  The current theory context as passed down to the ML session.  Furthermore,
   5.306 +  the file name is checked with the dependency declarations given in the
   5.307 +  theory header (see also \S\ref{sec:begin-thy}).
   5.308 +  \item [$\isarkeyword{ML}~text$] reads and executes ML commands from $text$.
   5.309 +  The theory context is passed just as in $\isarkeyword{use}$.
   5.310 +\item [$\isarkeyword{setup}~text$] changes the current theory context by
   5.311 +  applying setup functions $text$ (which has to be an ML expression of type
   5.312 +  $(theory -> theory)~list$.  The $\isarkeyword{setup}$ is the usual way to
   5.313 +  initialize object-logic specific tools and packages written in ML.
   5.314 +\end{descr}
   5.315  
   5.316  
   5.317 -\subsection{ML translation functions}
   5.318 +\subsection{Syntax translation functions}
   5.319  
   5.320 -\indexisarcmd{parse\_ast\_translation}\indexisarcmd{parse\_translation}
   5.321 -\indexisarcmd{print\_translation}\indexisarcmd{typed\_print\_translation}
   5.322 -\indexisarcmd{print\_ast\_translation}\indexisarcmd{token\_translation}
   5.323 +\indexisarcmd{parse-ast-translation}\indexisarcmd{parse-translation}
   5.324 +\indexisarcmd{print-translation}\indexisarcmd{typed-print-translation}
   5.325 +\indexisarcmd{print-ast-translation}\indexisarcmd{token-translation}
   5.326  \begin{matharray}{rcl}
   5.327    \isarcmd{parse_ast_translation} & : & \isartrans{theory}{theory} \\
   5.328    \isarcmd{parse_translation} & : & \isartrans{theory}{theory} \\
   5.329 @@ -358,107 +375,50 @@
   5.330    ;
   5.331  \end{rail}
   5.332  
   5.333 -\begin{description}
   5.334 +\begin{descr}
   5.335  \item [$\isarkeyword{oracle}~name=text$] FIXME
   5.336 -\end{description}
   5.337 +\end{descr}
   5.338  
   5.339  
   5.340  \section{Proof commands}
   5.341  
   5.342 -\subsection{Goal statements}
   5.343 +Proof commands provide transitions of Isar/VM machine configurations.  There
   5.344 +are three different kinds of operation:
   5.345 +\begin{descr}
   5.346 +\item [$proof(prove)$] means that a new goal has just been stated that is now
   5.347 +  to be \emph{proven}; the next command may refine it by some proof method
   5.348 +  ($\approx$ tactic) and enter a sub-proof to establish the final result.
   5.349 +\item [$proof(state)$] is like an internal theory mode: the context may be
   5.350 +  augmented by \emph{stating} additional assumptions, intermediate result;
   5.351 +\item [$proof(chain)$] indicates an intermediate mode between $proof(state)$
   5.352 +  and $proof(state)$: some already established facts have been just picked up
   5.353 +  in order to use them when refining the subsequent goal.
   5.354 +\end{descr}
   5.355  
   5.356 -\indexisarcmd{theorem}\indexisarcmd{lemma}
   5.357 -\indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
   5.358 +
   5.359 +\subsection{Formal comments}\label{sec:formal-cmt-prf}
   5.360 +
   5.361 +The following formal comments in proof mode closely correspond to the ones of
   5.362 +theory mode (see \S\ref{sec:formal-cmt-thy} for more information).
   5.363 +
   5.364 +\indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsect}\indexisarcmd{txt}
   5.365  \begin{matharray}{rcl}
   5.366 -  \isarcmd{theorem} & : & \isartrans{theory}{proof(prove)} \\
   5.367 -  \isarcmd{lemma} & : & \isartrans{theory}{proof(prove)} \\
   5.368 -  \isarcmd{have} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.369 -  \isarcmd{show} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.370 -  \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.371 -  \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.372 +  \isarcmd{sect} & : & \isartrans{proof(state)}{proof(state)} \\
   5.373 +  \isarcmd{subsect} & : & \isartrans{proof(state)}{proof(state)} \\
   5.374 +  \isarcmd{subsubsect} & : & \isartrans{proof(state)}{proof(state)} \\
   5.375 +  \isarcmd{txt} & : & \isartrans{proof(state)}{proof(state)} \\
   5.376  \end{matharray}
   5.377  
   5.378  \begin{rail}
   5.379 -  ('theorem' | 'lemma') goal
   5.380 -  ;
   5.381 -  ('have' | 'show' | 'hence' | 'thus') goal
   5.382 -  ;
   5.383 -
   5.384 -  goal: thmdecl? proppat comment?
   5.385 +  ('sect' | 'subsect' | 'subsubsect' | 'txt') text
   5.386    ;
   5.387  \end{rail}
   5.388  
   5.389 -\begin{description}
   5.390 -\item [$\THEOREM{name}{\phi}$] enters proof mode with $\phi$ as main goal,
   5.391 -  eventually resulting in some theorem $\turn \phi$, which stored in the
   5.392 -  theory.
   5.393 -\item [$\LEMMANAME$] is similar to $\THEOREMNAME$, but tags the result as
   5.394 -  ``lemma''.
   5.395 -\item [$\HAVE{name}{\phi}$] FIXME
   5.396 -\item [$\SHOW{name}{\phi}$] FIXME
   5.397 -\item [$\HENCE{name}{\phi}$] FIXME
   5.398 -\item [$\THUS{name}{\phi}$] FIXME
   5.399 -\end{description}
   5.400 -
   5.401 -
   5.402 -\subsection{Initial and terminal proof steps}
   5.403 -
   5.404 -\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
   5.405 -\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
   5.406 -\begin{matharray}{rcl}
   5.407 -  \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
   5.408 -  \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
   5.409 -  \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.410 -  \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.411 -  \isarcmd{..} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.412 -  \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.413 -\end{matharray}
   5.414 -
   5.415 -\begin{rail}
   5.416 -  'proof' interest? meth? comment?
   5.417 -  ;
   5.418 -  'qed' meth? comment?
   5.419 -  ;
   5.420 -  'by' meth meth? comment?
   5.421 -  ;
   5.422 -  ('.' | '..' | 'sorry') comment?
   5.423 -  ;
   5.424 -
   5.425 -  meth: method interest?
   5.426 -  ;
   5.427 -\end{rail}
   5.428 -
   5.429 -\begin{description}
   5.430 -\item [$ $] FIXME
   5.431 -\end{description}
   5.432 -
   5.433 -
   5.434 -\subsection{Facts and forward chaining}
   5.435 -
   5.436 -\indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
   5.437 -\begin{matharray}{rcl}
   5.438 -  \isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
   5.439 -  \isarcmd{then} & : & \isartrans{proof(state)}{proof(chain)} \\
   5.440 -  \isarcmd{from} & : & \isartrans{proof(state)}{proof(chain)} \\
   5.441 -  \isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
   5.442 -\end{matharray}
   5.443 -
   5.444 -\begin{rail}
   5.445 -  'note' thmdef? thmrefs comment?
   5.446 -  ;
   5.447 -  'then' comment?
   5.448 -  ;
   5.449 -  ('from' | 'with') thmrefs comment?
   5.450 -  ;
   5.451 -\end{rail}
   5.452 -
   5.453 -\begin{description}
   5.454 -\item [$ $] FIXME
   5.455 -\end{description}
   5.456 -
   5.457  
   5.458  \subsection{Proof context}
   5.459  
   5.460 +FIXME
   5.461 +
   5.462  \indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}\indexisarcmd{let}
   5.463  \begin{matharray}{rcl}
   5.464    \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
   5.465 @@ -482,13 +442,195 @@
   5.466    ;
   5.467  \end{rail}
   5.468  
   5.469 -\begin{description}
   5.470 -\item [$ $] FIXME
   5.471 -\end{description}
   5.472 +\begin{descr}
   5.473 +\item [$\FIX{x}$] FIXME
   5.474 +\item [$\ASSUME{a}{\Phi}$ and $\PRESUME{a}{\Phi}$] FIXME
   5.475 +\item [$\DEF{a}{x \equiv t}$] FIXME
   5.476 +\item [$\LET{\vec p = \vec t}$] FIXME
   5.477 +\end{descr}
   5.478 +
   5.479 +
   5.480 +\subsection{Facts and forward chaining}
   5.481 +
   5.482 +FIXME
   5.483 +
   5.484 +\indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
   5.485 +\begin{matharray}{rcl}
   5.486 +  \isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
   5.487 +  \isarcmd{then} & : & \isartrans{proof(state)}{proof(chain)} \\
   5.488 +  \isarcmd{from} & : & \isartrans{proof(state)}{proof(chain)} \\
   5.489 +  \isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
   5.490 +\end{matharray}
   5.491 +
   5.492 +\begin{rail}
   5.493 +  'note' thmdef? thmrefs comment?
   5.494 +  ;
   5.495 +  'then' comment?
   5.496 +  ;
   5.497 +  ('from' | 'with') thmrefs comment?
   5.498 +  ;
   5.499 +\end{rail}
   5.500 +
   5.501 +\begin{descr}
   5.502 +\item [$\NOTE{a}{bs}$] recalls existing facts $bs$, binding the result as $a$
   5.503 +  (and $facts$).  Note that attributes may be involved as well, both on the
   5.504 +  left and right hand side.
   5.505 +\item [$\THEN$] indicates forward chaining by the current facts in order to
   5.506 +  establish the subsequent goal.  The initial proof method invoked to solve
   5.507 +  that will be offered these facts to do anything ``appropriate'' (see also
   5.508 +  \S\ref{sec:proof-steps}).  For example, method $rule$ (see
   5.509 +  \S\ref{sec:pure-meth}) would do an elimination rather than an introduction.
   5.510 +\item [$\FROM{bs}$] abbreviates $\NOTE{facts}{bs}~\THEN$; also note that
   5.511 +  $\THEN$ is equivalent to $\FROM{facts}$.
   5.512 +\item [$\WITH{bs}$] abbreviates $\FROM{bs~facts}$; thus the forward chaining
   5.513 +  is from earlier facts together with the current ones.
   5.514 +\end{descr}
   5.515 +
   5.516 +
   5.517 +\subsection{Goal statements}
   5.518 +
   5.519 +Proof mode is entered from theory mode by initial goal commands $\THEOREMNAME$
   5.520 +and $\LEMMANAME$.  New local goals may be claimed within proof mode: four
   5.521 +variants indicate whether the result is meant to solve some pending goal and
   5.522 +whether forward chaining is employed.
   5.523 +
   5.524 +\indexisarcmd{theorem}\indexisarcmd{lemma}
   5.525 +\indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
   5.526 +\begin{matharray}{rcl}
   5.527 +  \isarcmd{theorem} & : & \isartrans{theory}{proof(prove)} \\
   5.528 +  \isarcmd{lemma} & : & \isartrans{theory}{proof(prove)} \\
   5.529 +  \isarcmd{have} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.530 +  \isarcmd{show} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.531 +  \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.532 +  \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
   5.533 +\end{matharray}
   5.534 +
   5.535 +\begin{rail}
   5.536 +  ('theorem' | 'lemma') goal
   5.537 +  ;
   5.538 +  ('have' | 'show' | 'hence' | 'thus') goal
   5.539 +  ;
   5.540 +
   5.541 +  goal: thmdecl? proppat comment?
   5.542 +  ;
   5.543 +\end{rail}
   5.544 +
   5.545 +\begin{descr}
   5.546 +\item [$\THEOREM{name}{\phi}$] enters proof mode with $\phi$ as main goal,
   5.547 +  eventually resulting in some theorem $\turn \phi$, which stored in the
   5.548 +  theory.
   5.549 +\item [$\LEMMANAME$] is similar to $\THEOREMNAME$, but tags the result as
   5.550 +  ``lemma''.
   5.551 +\item [$\HAVE{name}{\phi}$] claims a local goal, eventually resulting in a
   5.552 +  theorem with the current assumption context as hypotheses.
   5.553 +\item [$\SHOW{name}{\phi}$] same as $\HAVE{name}{\phi}$, but solves some
   5.554 +  pending goal with the result exported to the enclosing assumption context.
   5.555 +\item [$\HENCE{name}{\phi}$] abbreviates $\THEN~\HAVE{name}{\phi}$, i.e.\ 
   5.556 +  claims a local goal to be proven by forward chaining the current facts.
   5.557 +\item [$\THUS{name}{\phi}$] abbreviates $\THEN~\SHOW{name}{\phi}$.
   5.558 +\end{descr}
   5.559 +
   5.560 +
   5.561 +\subsection{Initial and terminal proof steps}\label{sec:proof-steps}
   5.562 +
   5.563 +Arbitrary goal refinements via tactics is considered harmful.  Consequently
   5.564 +the Isar framework admits proof methods to be invoked in two places only.
   5.565 +\begin{enumerate}
   5.566 +\item An \emph{initial} refinement step (via $\PROOF{m@1}$) reduces a newly
   5.567 +  stated intermediate goal to a number of sub-goals that are to be solved
   5.568 +  subsequently.  Facts are passed to $m@1$ for forward chaining if so
   5.569 +  indicated by $proof(chain)$ mode.
   5.570 +  
   5.571 +\item A \emph{terminal} conclusion step (via $\QED{m@2}$)) solves any remaining
   5.572 +  pending goals completely.  No facts are passed to $m@2$.
   5.573 +\end{enumerate}
   5.574 +
   5.575 +The only other proper way to affect pending goals is by $\SHOWNAME$, which
   5.576 +involves an explicit statement of what is solved.
   5.577 +
   5.578 +Also note that initial proof methods should either solve the goal completely,
   5.579 +or constitute some well-understood deterministic reduction to new sub-goals.
   5.580 +Arbitrary automatic proof tools that are prone leave a large number of badly
   5.581 +structured sub-goals are no help in continuing the proof document in any
   5.582 +intelligible way.  A much better technique is to $\SHOWNAME$ some non-trivial
   5.583 +reduction as an explicit rule, which is solved completely by some automated
   5.584 +method, and then applied to some pending goal.
   5.585 +
   5.586 +\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
   5.587 +\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
   5.588 +\begin{matharray}{rcl}
   5.589 +  \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
   5.590 +  \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
   5.591 +  \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.592 +  \isarcmd{..} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.593 +  \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.594 +  \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
   5.595 +\end{matharray}
   5.596 +
   5.597 +\begin{rail}
   5.598 +  'proof' interest? meth? comment?
   5.599 +  ;
   5.600 +  'qed' meth? comment?
   5.601 +  ;
   5.602 +  'by' meth meth? comment?
   5.603 +  ;
   5.604 +  ('.' | '..' | 'sorry') comment?
   5.605 +  ;
   5.606 +
   5.607 +  meth: method interest?
   5.608 +  ;
   5.609 +\end{rail}
   5.610 +
   5.611 +\begin{descr}
   5.612 +\item [$\PROOF{m}$] refines the pending goal by proof method $m$ (facts for
   5.613 +  forward chaining are passed if indicated by $proof(chain)$).
   5.614 +\item [$\QED{m}$] refines any remaining goals by proof method $m$ and
   5.615 +  concludes the sub-proof.  If the goal had been $\SHOWNAME$, some pending
   5.616 +  sub-goal is solved as well by the rule resulting from the result exported to
   5.617 +  the enclosing goal context.
   5.618 +  
   5.619 +  Thus $\QEDNAME$ may fail for two reasons: either $m$ fails to solve all
   5.620 +  remaining goals completely, or the resulting rule does not resolve with any
   5.621 +  enclosing goal.  Debugging such a situation might involve temporarily
   5.622 +  changing $\SHOWNAME$ into $\HAVENAME$, or weakening the local context by
   5.623 +  replacing $\ASSUMENAME$ by $\PRESUMENAME$.
   5.624 +\item [$\BY{m@1}{m@2}$] is a \emph{terminal proof}; it abbreviates
   5.625 +  $\PROOF{m@1}~\QED{m@2}$, automatically backtracking across both methods.
   5.626 +  
   5.627 +  Debugging an unsuccessful $\BY{m@1}{m@2}$ commands might be done by simply
   5.628 +  expanding the abbreviation by hand; usually $\PROOF{m@1}$ is already
   5.629 +  sufficient to see what goes wrong.
   5.630 +\item [$\isarkeyword{..}$] is a \emph{default proof}; it abbreviates
   5.631 +  $\BY{default}{finish}$, where method $default$ usually applies a single
   5.632 +  elimination or introduction rule according to the topmost symbol, and
   5.633 +  $finish$ solves all goals by assumption.
   5.634 +\item [$\isarkeyword{.}$] is a \emph{trivial proof}, it abbreviates
   5.635 +  $\BY{-}{finish}$, where method $-$ does nothing except inserting any facts
   5.636 +  into the proof state.
   5.637 +\item [$\isarkeyword{sorry}$] is a \emph{fake proof}; provided that
   5.638 +  \texttt{quick_and_dirty} is enabled, $\isarkeyword{sorry}$ pretends to solve
   5.639 +  the goal without much ado.  Of course, the result is a fake theorem only,
   5.640 +  involving some oracle in its internal derivation object.  Note that this is
   5.641 +  indicated as \texttt{[!]} in the printed result.  The main application of
   5.642 +  $\isarkeyword{sorry}$ is to support top-down proof development.
   5.643 +\end{descr}
   5.644  
   5.645  
   5.646  \subsection{Block structure}
   5.647  
   5.648 +While Isar is inherently block-structured, opening and closing blocks is
   5.649 +mostly handled rather casually, with little explicit user-intervention.  Any
   5.650 +local goal statement automatically opens \emph{two} blocks, which are closed
   5.651 +again when concluding the sub-proof (by $\QEDNAME$ etc.).  Sections of
   5.652 +different context within a sub-proof are typically switched via
   5.653 +$\isarkeyword{next}$, which is just a single block-close followed by
   5.654 +block-open again.  Thus the effect of $\isarkeyword{next}$ is to reset the
   5.655 +proof context to that of the head of the sub-proof.  Note that there is no
   5.656 +goal focus involved!
   5.657 +
   5.658 +There are explicit block parentheses as well.  These typically achieve a
   5.659 +strong forward style of reasoning.
   5.660 +
   5.661  \indexisarcmd{next}\indexisarcmd{\{\{}\indexisarcmd{\}\}}
   5.662  \begin{matharray}{rcl}
   5.663    \isarcmd{next} & : & \isartrans{proof(state)}{proof(state)} \\
   5.664 @@ -496,10 +638,15 @@
   5.665    \isarcmd{\}\}} & : & \isartrans{proof(state)}{proof(state)} \\
   5.666  \end{matharray}
   5.667  
   5.668 -\begin{description}
   5.669 -\item [$ $] FIXME
   5.670 -\end{description}
   5.671 -
   5.672 +\begin{descr}
   5.673 +\item [$\isarkeyword{next}$] switches to a fresh block within a sub-proof,
   5.674 +  resetting the context to the initial one.
   5.675 +\item [$\isarkeyword{\{\{}$ and $\isarkeyword{\}\}}$] explicitly open and
   5.676 +  close blocks.  Any current facts pass through $\isarkeyword{\{\{}$
   5.677 +  unchanged, while $\isarkeyword{\}\}}$ causes them to be \emph{exported} into
   5.678 +  the enclosing context.  Thus fixed variables are generalized, assumptions
   5.679 +  discharged, and local definitions eliminated.
   5.680 +\end{descr}
   5.681  
   5.682  \subsection{Calculational proof}
   5.683  
   5.684 @@ -517,15 +664,19 @@
   5.685    ;
   5.686  \end{rail}
   5.687  
   5.688 -\begin{description}
   5.689 +\begin{descr}
   5.690  \item [$ $] FIXME
   5.691 -\end{description}
   5.692 +\end{descr}
   5.693  
   5.694  
   5.695  
   5.696  \subsection{Improper proof steps}
   5.697  
   5.698 -\indexisarcmd{apply}\indexisarcmd{then\_apply}\indexisarcmd{back}
   5.699 +The following commands emulate tactic scripts to some extent.  While these are
   5.700 +anathema for writing proper Isar proof documents, they might come in handy for
   5.701 +exploring and debugging.
   5.702 +
   5.703 +\indexisarcmd{apply}\indexisarcmd{then-apply}\indexisarcmd{back}
   5.704  \begin{matharray}{rcl}
   5.705    \isarcmd{apply}^* & : & \isartrans{proof}{proof} \\
   5.706    \isarcmd{then_apply}^* & : & \isartrans{proof}{proof} \\
   5.707 @@ -544,9 +695,9 @@
   5.708    ;
   5.709  \end{rail}
   5.710  
   5.711 -\begin{description}
   5.712 +\begin{descr}
   5.713  \item [$ $] FIXME
   5.714 -\end{description}
   5.715 +\end{descr}
   5.716  
   5.717  
   5.718  \section{Other commands}
   5.719 @@ -572,7 +723,7 @@
   5.720    ;
   5.721  \end{rail}
   5.722  
   5.723 -\begin{description}
   5.724 +\begin{descr}
   5.725  \item [$\isarkeyword{typ}~\tau$, $\isarkeyword{term}~t$,
   5.726    $\isarkeyword{prop}~\phi$] read and print types / terms / propositions
   5.727    according to the current theory or proof context.
   5.728 @@ -580,13 +731,13 @@
   5.729    theory or proof context.  Note that any attributes included in the theorem
   5.730    specifications are applied to a temporary proof context derived from the
   5.731    current theory or proof; the resulting context is discarded.
   5.732 -\end{description}
   5.733 +\end{descr}
   5.734  
   5.735  
   5.736  \subsection{System operations}
   5.737  
   5.738 -\indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use\_thy}\indexisarcmd{use\_thy\_only}
   5.739 -\indexisarcmd{update\_thy}\indexisarcmd{update\_thy\_only}
   5.740 +\indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
   5.741 +\indexisarcmd{update-thy}\indexisarcmd{update-thy-only}
   5.742  \begin{matharray}{rcl}
   5.743    \isarcmd{cd} & : & \isarkeep{\cdot} \\
   5.744    \isarcmd{pwd} & : & \isarkeep{\cdot} \\
   5.745 @@ -596,7 +747,7 @@
   5.746    \isarcmd{update_thy_only} & : & \isarkeep{\cdot} \\
   5.747  \end{matharray}
   5.748  
   5.749 -\begin{description}
   5.750 +\begin{descr}
   5.751  \item [$\isarkeyword{cd}~name$] changes the current directory of the Isabelle
   5.752    process.
   5.753  \item [$\isarkeyword{pwd}~$] prints the current working directory.
   5.754 @@ -604,7 +755,7 @@
   5.755    $\isarkeyword{update_thy}~name$, $\isarkeyword{update_thy_only}~name$] load
   5.756    theory files.  These commands are exactly the same as the corresponding ML
   5.757    functions (see also \cite[\S1 and \S6]{isabelle-ref}).
   5.758 -\end{description}
   5.759 +\end{descr}
   5.760  
   5.761  
   5.762  %%% Local Variables: 
     6.1 --- a/doc-src/IsarRef/syntax.tex	Tue Aug 03 13:16:29 1999 +0200
     6.2 +++ b/doc-src/IsarRef/syntax.tex	Tue Aug 03 18:56:51 1999 +0200
     6.3 @@ -18,18 +18,18 @@
     6.4  entities, such as names, terms, theorem specifications, which have been
     6.5  factored out of the actual Isar language elements described later.
     6.6  
     6.7 -Some of the basic syntactic entities introduced below act much like tokens
     6.8 -rather than nonterminals, in particular for error messages are concerned.
     6.9 +Note that some of the basic syntactic entities introduced below act much like
    6.10 +tokens rather than nonterminals, in particular for the sake of error messages.
    6.11  E.g.\ syntax elements such as $\CONSTS$ referring to \railqtoken{name} or
    6.12 -\railqtoken{type} would really report a missing \railqtoken{name} or
    6.13 -\railqtoken{type} rather than any of its constituent primitive tokens
    6.14 -(\railtoken{ident}, \railtoken{string} etc.).
    6.15 +\railqtoken{type} would really report a missing name or type rather than any
    6.16 +of the constituent primitive tokens such as \railtoken{ident} or
    6.17 +\railtoken{string}.
    6.18  
    6.19  
    6.20  \subsection{Names}
    6.21  
    6.22  Entity \railqtoken{name} usually refers to any name of types, constants,
    6.23 -theorems, etc.\ to be \emph{declared} or \emph{defined} (so qualified
    6.24 +theorems etc.\ that are to be \emph{declared} or \emph{defined} (so qualified
    6.25  identifiers are excluded).  Quoted strings provide an escape for
    6.26  non-identifier names or those ruled out by outer syntax keywords (e.g.\ 
    6.27  \verb|"let"|).  Already existing objects are usually referenced by
    6.28 @@ -37,34 +37,37 @@
    6.29  
    6.30  \indexoutertoken{name}\indexoutertoken{parname}\indexoutertoken{nameref}
    6.31  \begin{rail}
    6.32 -  name : ident | symident | string
    6.33 +  name: ident | symident | string
    6.34    ;
    6.35 -  parname : '(' name ')'
    6.36 +  parname: '(' name ')'
    6.37    ;
    6.38 -  nameref : name | longident
    6.39 +  nameref: name | longident
    6.40    ;
    6.41  \end{rail}
    6.42  
    6.43  
    6.44  \subsection{Comments}
    6.45  
    6.46 -Large chunks of plain \railqtoken{text} are usually given \railtoken{verbatim},
    6.47 -i.e.\ enclosed in \verb|{*|\dots\verb|*}|.  For convenience, any of the
    6.48 -smaller text entities (\railtoken{ident}, \railtoken{string} etc.)  are
    6.49 -admitted as well.  Almost any of the Isar commands may be annotated by a
    6.50 -marginal \railnonterm{comment}: \texttt{--} \railqtoken{text}.  Note that this
    6.51 -kind of comment is actually part of the language, while source level comments
    6.52 -\verb|(*|\dots\verb|*)| are already stripped at the lexical level.  A few
    6.53 -commands such as $\PROOFNAME$ admit additional markup with a ``level of
    6.54 -interest'', currently only \texttt{\%} for ``boring, don't read this''.
    6.55 +Large chunks of plain \railqtoken{text} are usually given
    6.56 +\railtoken{verbatim}, i.e.\ enclosed in \verb|{*|\dots\verb|*}|.  For
    6.57 +convenience, any of the smaller text conforming to \railqtoken{nameref} are
    6.58 +admitted as well.  Almost any of the Isar commands may be annotated by some
    6.59 +marginal \railnonterm{comment} of the form \texttt{--} \railqtoken{text}.
    6.60 +Note that this kind of comment is actually part of the language, while source
    6.61 +level comments \verb|(*|\dots\verb|*)| are already stripped at the lexical
    6.62 +level.  A few commands such as $\PROOFNAME$ admit additional markup with a
    6.63 +``level of interest'': \texttt{\%} followed by an optional number $n$ (default
    6.64 +$n = 1$) indicates that the respective part of the document becomes $n$ levels
    6.65 +more boring or obscure; \texttt{\%\%} means that the interest drops by
    6.66 +$\infty$ --- abandon every hope, who enter here.
    6.67  
    6.68  \indexoutertoken{text}\indexouternonterm{comment}\indexouternonterm{interest}
    6.69  \begin{rail}
    6.70 -  text : verbatim | nameref
    6.71 +  text: verbatim | nameref
    6.72    ;
    6.73 -  comment : '--' text
    6.74 +  comment: '--' text
    6.75    ;
    6.76 -  interest : '\%'
    6.77 +  interest: percent nat? | ppercent
    6.78    ;
    6.79  \end{rail}
    6.80  
    6.81 @@ -72,68 +75,67 @@
    6.82  \subsection{Sorts and arities}
    6.83  
    6.84  The syntax of sorts and arities is given directly at the outer level.  Note
    6.85 -that this in contrast to that types and terms (see below).  Only few commands
    6.86 -ever refer to sorts or arities explicitly.
    6.87 +that this is in contrast to that types and terms (see \ref{sec:types-terms}).
    6.88  
    6.89  \indexouternonterm{sort}\indexouternonterm{arity}\indexouternonterm{simplearity}
    6.90  \indexouternonterm{classdecl}
    6.91  \begin{rail}
    6.92 -  sort : nameref | lbrace (nameref * ',') rbrace
    6.93 +  classdecl: name ('<' (nameref ',' +))?
    6.94    ;
    6.95 -  arity : ( () | '(' (sort + ',') ')' ) sort
    6.96 +  sort: nameref | lbrace (nameref * ',') rbrace
    6.97    ;
    6.98 -  simplearity : ( () | '(' (sort + ',') ')' ) nameref
    6.99 +  arity: ('(' (sort + ',') ')')? sort
   6.100    ;
   6.101 -  classdecl: name ('<' (nameref ',' +))? comment?
   6.102 +  simplearity: ('(' (sort + ',') ')')? nameref
   6.103 +  ;
   6.104  \end{rail}
   6.105  
   6.106  
   6.107 -\subsection{Types and terms}
   6.108 +\subsection{Types and terms}\label{sec:types-terms}
   6.109  
   6.110 -The actual inner Isabelle syntax, i.e.\ that of types and terms, is far too
   6.111 -flexible in order to be modeled explicitly at the outer theory level.
   6.112 -Basically, any such entity would have to be quoted at the outer level to turn
   6.113 -it into a single token, with the actual parsing deferred to some functions
   6.114 -that read and type-check terms etc.\ (note that \railqtoken{prop}s will be
   6.115 -handled differently from plain \railqtoken{term}s here).  For convenience, the
   6.116 -quotes may be omitted for any \emph{atomic} term or type (e.g.\ a single
   6.117 -variable).
   6.118 +The actual inner Isabelle syntax, that of types and terms of the logic, is far
   6.119 +too flexible in order to be modeled explicitly at the outer theory level.
   6.120 +Basically, any such entity has to be quoted at the outer level to turn it into
   6.121 +a single token, with the actual parsing deferred to some functions for reading
   6.122 +and type-checking.  For convenience, a more liberal convention is adopted:
   6.123 +quotes may be omitted for any type or term that is already \emph{atomic} at
   6.124 +the outer level.  E.g.\ one may write \texttt{x} instead of \texttt{"x"}.
   6.125  
   6.126  \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop}
   6.127  \begin{rail}
   6.128 -  type : nameref | typefree | typevar
   6.129 +  type: nameref | typefree | typevar
   6.130    ;
   6.131 -  term : nameref | var | textvar | nat
   6.132 +  term: nameref | var | textvar | nat
   6.133    ;
   6.134 -  prop : term
   6.135 +  prop: term
   6.136    ;
   6.137  \end{rail}
   6.138  
   6.139 -Type definitions etc.\ usually refer to \railnonterm{typespec} on the
   6.140 -left-hand side.  This models basic type constructor application at the outer
   6.141 -syntax level.  Note that only plain postfix notation is available here, but no
   6.142 -infixes.
   6.143 +Type declarations and definitions usually refer to \railnonterm{typespec} on
   6.144 +the left-hand side.  This models basic type constructor application at the
   6.145 +outer syntax level.  Note that only plain postfix notation is available here,
   6.146 +but no infixes.
   6.147  
   6.148  \indexouternonterm{typespec}
   6.149  \begin{rail}
   6.150 -  typespec : (() | typefree | '(' ( typefree + ',' ) ')') name
   6.151 +  typespec: (() | typefree | '(' ( typefree + ',' ) ')') name
   6.152    ;
   6.153  \end{rail}
   6.154  
   6.155  
   6.156  \subsection{Term patterns}
   6.157  
   6.158 -Statements like $\SHOWNAME$ involve propositions, some others like $\DEFNAME$
   6.159 -plain terms.  Any of these usually admit automatic binding of schematic text
   6.160 -variables by giving (optional) patterns $\IS{p@1 \dots p@n}$.  For
   6.161 -\railqtoken{prop}s the $\CONCLNAME$ part refers to the conclusion only, in case
   6.162 -actual rules are involved, rather than atomic propositions.
   6.163 +Assumptions and goal statements usually admit automatic binding of schematic
   6.164 +text variables by giving (optional) patterns of the form $\IS{p@1 \dots p@n}$.
   6.165 +There are separate versions available for \railqtoken{term}s and
   6.166 +\railqtoken{prop}s.  The latter provides a $\CONCLNAME$ part with patterns
   6.167 +referring the (atomic) conclusion of a rule.
   6.168  
   6.169  \indexouternonterm{termpat}\indexouternonterm{proppat}
   6.170  \begin{rail}
   6.171 -  termpat : '(' (term + 'is' ) ')'
   6.172 +  termpat: '(' ('is' term +) ')'
   6.173    ;
   6.174 -  proppat : '(' (() | (prop + 'is' )) (() | 'concl' (prop + 'is' )) ')'
   6.175 +  proppat: '(' (('is' prop +) | 'concl' ('is' prop +) | ('is' prop +) 'concl' ('is' prop +)) ')'
   6.176    ;
   6.177  \end{rail}
   6.178  
   6.179 @@ -141,16 +143,17 @@
   6.180  \subsection{Mixfix annotations}
   6.181  
   6.182  Mixfix annotations specify concrete \emph{inner} syntax of Isabelle types and
   6.183 -terms.  Some commands such as $\TYPES$ admit infixes only, while $\CONSTS$
   6.184 -etc.\ support the full range of general mixfixes and binders.
   6.185 +terms.  Some commands such as $\TYPES$ admit infixes only, while $\CONSTS$ and
   6.186 +$\isarkeyword{syntax}$ support the full range of general mixfixes and binders.
   6.187  
   6.188  \indexouternonterm{infix}\indexouternonterm{mixfix}
   6.189  \begin{rail}
   6.190 -  infix : '(' ('infixl' | 'infixr') (() | string) nat ')'
   6.191 +  infix: '(' ('infixl' | 'infixr') string? nat ')'
   6.192 +  ;
   6.193 +  mixfix: infix | '(' string pris? nat? ')' | '(' 'binder' string pris? nat ')'
   6.194    ;
   6.195  
   6.196 -  mixfix : infix | string (() | '[' (nat + ',') ']') (() | nat) |
   6.197 -  'binder' string (() | '[' (nat + ',') ']') nat
   6.198 +  pris: '[' (nat + ',') ']'
   6.199    ;
   6.200  \end{rail}
   6.201  
   6.202 @@ -161,42 +164,41 @@
   6.203  ``semi-inner'' syntax, which does not have to be atomic at the outer level
   6.204  unlike that of types and terms.  Instead, the attribute argument
   6.205  specifications may be any sequence of atomic entities (identifiers, strings
   6.206 -etc.), or properly bracketed argument lists.  Below \railqtoken{atom} refers to
   6.207 -any atomic entity (\railtoken{ident}, \railtoken{longident},
   6.208 -\railtoken{symident} etc.), including keywords that conform to
   6.209 -\railtoken{symident}, but do not coincide with actual command names.
   6.210 +etc.), or properly bracketed argument lists.  Below \railqtoken{atom} refers
   6.211 +to any atomic entity, including keywords that conform to \railtoken{symident}.
   6.212  
   6.213  \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes}
   6.214  \begin{rail}
   6.215 -  atom : nameref | typefree | typevar | var | textvar | nat
   6.216 +  atom: nameref | typefree | typevar | var | textvar | nat | keyword
   6.217    ;
   6.218 -  arg : atom | '(' args ')' | '[' args ']' | lbrace args rbrace
   6.219 +  arg: atom | '(' args ')' | '[' args ']' | lbrace args rbrace
   6.220    ;
   6.221 -  args : arg *
   6.222 +  args: arg *
   6.223    ;
   6.224 -  attributes : '[' (nameref args * ',') ']'
   6.225 +  attributes: '[' (nameref args * ',') ']'
   6.226    ;
   6.227  \end{rail}
   6.228  
   6.229 -Theorem specifications come in three flavors: \railnonterm{thmdecl} usually
   6.230 -refers to the result of an assumption or goal statement (e.g.\ $\SHOWNAME$),
   6.231 -\railnonterm{thmdef} collects lists of existing theorems (as in $\NOTENAME$),
   6.232 -\railnonterm{thmrefs} refers to any list of existing theorems (e.g.\ occurring
   6.233 -as proof method arguments).  Any of these may include lists of attributes,
   6.234 -which are applied to the preceding theorem or list of theorems.
   6.235 +Theorem specifications come in several flavors: \railnonterm{axmdecl} and
   6.236 +\railnonterm{thmdecl} usually refer to assumptions or results of goal
   6.237 +statements, \railnonterm{thmdef} collects lists of existing theorems,
   6.238 +\railnonterm{thmrefs} refers to any lists of existing theorems.  Any of these
   6.239 +may include lists of attributes, which are applied to the preceding theorem or
   6.240 +list of theorems.
   6.241  
   6.242  \indexouternonterm{thmdecl}\indexouternonterm{axmdecl}
   6.243  \indexouternonterm{thmdef}\indexouternonterm{thmrefs}
   6.244  \begin{rail}
   6.245 -  thmname : name attributes | name | attributes
   6.246 +  axmdecl: name attributes? ':'
   6.247    ;
   6.248 -  axmdecl : name attributes? ':'
   6.249 +  thmdecl: thmname ':'
   6.250    ;
   6.251 -  thmdecl : thmname ':'
   6.252 +  thmdef: thmname '='
   6.253    ;
   6.254 -  thmdef : thmname '='
   6.255 +  thmrefs: nameref attributes? +
   6.256    ;
   6.257 -  thmrefs : nameref (() | attributes) +
   6.258 +
   6.259 +  thmname: name attributes | name | attributes
   6.260    ;
   6.261  \end{rail}
   6.262  
   6.263 @@ -205,19 +207,18 @@
   6.264  
   6.265  Proof methods are either basic ones, or expressions composed of methods via
   6.266  ``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternatives),
   6.267 -``\texttt{?}'' (try), ``\texttt{*}'' (repeat, ${} \ge 0$ times),
   6.268 -``\texttt{+}'' (repeat, ${} > 0$ times).  In practice, proof methods are very
   6.269 -often just a comma separated list of \railqtoken{nameref}~\railnonterm{args}
   6.270 -specifications.  Thus the syntax is similar to that of attributes, with plain
   6.271 -parentheses instead of square brackets (see also \S\ref{sec:syn-att}).  Note
   6.272 -that parentheses may be dropped for single method specifications without
   6.273 -arguments.
   6.274 +``\texttt{?}'' (try), ``\texttt{*}'' (repeat ${} \ge 0$ times), ``\texttt{+}''
   6.275 +(repeat ${} > 0$ times).  In practice, proof methods are usually just a comma
   6.276 +separated list of \railqtoken{nameref}~\railnonterm{args} specifications.
   6.277 +Thus the syntax is similar to that of attributes, with plain parentheses
   6.278 +instead of square brackets (see also \S\ref{sec:syn-att}).  Note that
   6.279 +parentheses may be dropped for single method specifications without arguments.
   6.280  
   6.281  \indexouternonterm{method}
   6.282  \begin{rail}
   6.283 -  method : (nameref | '(' methods ')') (() | '?' | '*' | '+')
   6.284 +  method: (nameref | '(' methods ')') (() | '?' | '*' | '+')
   6.285    ;
   6.286 -  methods : (nameref args | method) + (',' | '|')
   6.287 +  methods: (nameref args | method) + (',' | '|')
   6.288    ;
   6.289  \end{rail}
   6.290