doc-src/IsarRef/syntax.tex
changeset 7981 5120a2a15d06
parent 7895 7c492d8bc8e3
child 8102 424f6e663977
     1.1 --- a/doc-src/IsarRef/syntax.tex	Sat Oct 30 20:12:23 1999 +0200
     1.2 +++ b/doc-src/IsarRef/syntax.tex	Sat Oct 30 20:13:16 1999 +0200
     1.3 @@ -18,9 +18,9 @@
     1.4  
     1.5  \begin{warn}
     1.6    Note that classic Isabelle theories used to fake parts of the inner type
     1.7 -  syntax, with complicated rules when quotes may be omitted.  Despite the
     1.8 -  minor drawback of requiring quotes more often, the syntax of Isabelle/Isar
     1.9 -  is simpler and more robust in that respect.
    1.10 +  syntax, with rather complicated rules when quotes may be omitted.  Despite
    1.11 +  the minor drawback of requiring quotes more often, the syntax of
    1.12 +  Isabelle/Isar is simpler and more robust in that respect.
    1.13  \end{warn}
    1.14  
    1.15  \medskip
    1.16 @@ -28,10 +28,9 @@
    1.17  Another notable point is proper input termination.  Proof~General demands any
    1.18  command to be terminated by ``\texttt{;}''
    1.19  (semicolon)\index{semicolon}\index{*;}.  As far as plain Isabelle/Isar is
    1.20 -concerned, commands may be directly run together, though.  Thus we usually
    1.21 -omit semicolons when presenting Isar proof text here, in order to gain
    1.22 -readability.  Note that the documents which automatically generated from
    1.23 -new-style theories also omit semicolons.
    1.24 +concerned, commands may be directly run together, though.  In the presentation
    1.25 +of Isabelle/Isar documents, semicolons are omitted in order to gain
    1.26 +readability.
    1.27  
    1.28  
    1.29  \section{Lexical matters}\label{sec:lex-syntax}
    1.30 @@ -65,15 +64,15 @@
    1.31  
    1.32  The syntax of \texttt{string} admits any characters, including newlines;
    1.33  ``\verb|"|'' (double-quote) and ``\verb|\|'' (backslash) have to be escaped by
    1.34 -a backslash, though.  Note that ML-style control character notation is
    1.35 -\emph{not} supported.  The body of \texttt{verbatim} may consist of any text
    1.36 -not containing \verb|*}|.
    1.37 +a backslash.  Note that ML-style control characters are \emph{not} supported.
    1.38 +The body of \texttt{verbatim} may consist of any text not containing
    1.39 +``\verb|*}|''.
    1.40  
    1.41  Comments take the form \texttt{(*~\dots~*)} and may be
    1.42 -nested\footnote{Proof~General may get confused by nested comments, though.},
    1.43 -just as in ML. Note that these are \emph{source} comments only, which are
    1.44 -stripped after lexical analysis of the input.  The Isar document syntax also
    1.45 -provides of \emph{formal comments} that are actually part of the text (see
    1.46 +nested\footnote{Proof~General may get confused by nested comments.}, just as
    1.47 +in ML. Note that these are \emph{source} comments only, which are stripped
    1.48 +after lexical analysis of the input.  The Isar document syntax also provides
    1.49 +\emph{formal comments} that are actually part of the text (see
    1.50  \S\ref{sec:comments}).
    1.51  
    1.52  
    1.53 @@ -83,7 +82,7 @@
    1.54  terms, and theorem specifications, which have been factored out of the actual
    1.55  Isar language elements to be described later.
    1.56  
    1.57 -Note that some of the basic syntactic entities introduced below (such as
    1.58 +Note that some of the basic syntactic entities introduced below (e.g.\ 
    1.59  \railqtoken{name}) act much like tokens rather than plain nonterminals (e.g.\ 
    1.60  \railnonterm{sort}), especially for the sake of error messages.  E.g.\ syntax
    1.61  elements such as $\CONSTS$ referring to \railqtoken{name} or \railqtoken{type}
    1.62 @@ -161,12 +160,12 @@
    1.63  The actual inner Isabelle syntax, that of types and terms of the logic, is far
    1.64  too sophisticated in order to be modelled explicitly at the outer theory
    1.65  level.  Basically, any such entity has to be quoted here to turn it into a
    1.66 -single token (the parsing and type-checking is performed later).  For
    1.67 -convenience, a slightly more liberal convention is adopted: quotes may be
    1.68 +single token (the parsing and type-checking is performed internally later).
    1.69 +For convenience, a slightly more liberal convention is adopted: quotes may be
    1.70  omitted for any type or term that is already \emph{atomic} at the outer level.
    1.71  For example, one may write just \texttt{x} instead of \texttt{"x"}.  Note that
    1.72 -symbolic identifiers such as \texttt{++} are available as well, provided these
    1.73 -are not superseded by commands or keywords (like \texttt{+}).
    1.74 +symbolic identifiers (e.g.\ \texttt{++}) are available as well, provided these
    1.75 +are not superseded by commands or keywords (e.g.\ \texttt{+}).
    1.76  
    1.77  \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop}
    1.78  \begin{rail}
    1.79 @@ -193,7 +192,7 @@
    1.80  \subsection{Term patterns}\label{sec:term-pats}
    1.81  
    1.82  Assumptions and goal statements usually admit casual binding of schematic term
    1.83 -variables by giving (optional) patterns of the form $\ISS{p@1 \dots}{p@n}$.
    1.84 +variables by giving (optional) patterns of the form $\ISS{p@1\;\dots}{p@n}$.
    1.85  There are separate versions available for \railqtoken{term}s and
    1.86  \railqtoken{prop}s.  The latter provides a $\CONCLNAME$ part with patterns
    1.87  referring the (atomic) conclusion of a rule.
    1.88 @@ -210,8 +209,10 @@
    1.89  \subsection{Mixfix annotations}
    1.90  
    1.91  Mixfix annotations specify concrete \emph{inner} syntax of Isabelle types and
    1.92 -terms.  Some commands such as $\TYPES$ admit infixes only, while $\CONSTS$ and
    1.93 -$\isarkeyword{syntax}$ support the full range of general mixfixes and binders.
    1.94 +terms.  Some commands such as $\TYPES$ (see \S\ref{sec:types-pure}) admit
    1.95 +infixes only, while $\CONSTS$ (see \S\ref{sec:consts}) and
    1.96 +$\isarkeyword{syntax}$ (see \S\ref{sec:syn-trans}) support the full range of
    1.97 +general mixfixes and binders.
    1.98  
    1.99  \indexouternonterm{infix}\indexouternonterm{mixfix}
   1.100  \begin{rail}
   1.101 @@ -232,8 +233,8 @@
   1.102  \railnonterm{args} below is parsed by the attribute a second time.  The
   1.103  attribute argument specifications may be any sequence of atomic entities
   1.104  (identifiers, strings etc.), or properly bracketed argument lists.  Below
   1.105 -\railqtoken{atom} refers to any atomic entity, including \railtoken{keyword}s
   1.106 -conforming to \railtoken{symident}.
   1.107 +\railqtoken{atom} refers to any atomic entity, including any
   1.108 +\railtoken{keyword} conforming to \railtoken{symident}.
   1.109  
   1.110  \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes}
   1.111  \begin{rail}
   1.112 @@ -249,13 +250,13 @@
   1.113  
   1.114  Theorem specifications come in several flavors: \railnonterm{axmdecl} and
   1.115  \railnonterm{thmdecl} usually refer to axioms, assumptions or results of goal
   1.116 -statements, \railnonterm{thmdef} collects lists of existing theorems.
   1.117 -Existing theorems are given by \railnonterm{thmref} and \railnonterm{thmrefs}
   1.118 -(the former requires an actual singleton result).  Any of these theorem
   1.119 +statements, while \railnonterm{thmdef} collects lists of existing theorems.
   1.120 +Existing theorems are given by \railnonterm{thmref} and \railnonterm{thmrefs},
   1.121 +the former requires an actual singleton result.  Any of these theorem
   1.122  specifications may include lists of attributes both on the left and right hand
   1.123  sides; attributes are applied to any immediately preceding theorem.  If names
   1.124 -are omitted, the theorems are not stored within the theory's theorem database;
   1.125 -any given attributes are still applied, though.
   1.126 +are omitted, the theorems are not stored within the theorem database of the
   1.127 +theory or proof context; any given attributes are still applied, though.
   1.128  
   1.129  \indexouternonterm{thmdecl}\indexouternonterm{axmdecl}
   1.130  \indexouternonterm{thmdef}\indexouternonterm{thmrefs}
   1.131 @@ -280,12 +281,10 @@
   1.132  
   1.133  Proof methods are either basic ones, or expressions composed of methods via
   1.134  ``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternative choices),
   1.135 -``\texttt{?}'' (try once), ``\texttt{+}'' (repeat at least once).  In
   1.136 -practice, proof methods are usually just a comma separated list of
   1.137 -\railqtoken{nameref}~\railnonterm{args} specifications.  Thus the syntax is
   1.138 -similar to that of attributes, with plain parentheses instead of square
   1.139 -brackets.  Note that parentheses may be dropped for single method
   1.140 -specifications (with no arguments).
   1.141 +``\texttt{?}'' (try), ``\texttt{+}'' (repeat at least once).  In practice,
   1.142 +proof methods are usually just a comma separated list of
   1.143 +\railqtoken{nameref}~\railnonterm{args} specifications.  Note that parentheses
   1.144 +may be dropped for single method specifications (with no arguments).
   1.145  
   1.146  \indexouternonterm{method}
   1.147  \begin{rail}