doc-src/IsarRef/Thy/document/pure.tex
author wenzelm
Fri, 09 May 2008 23:20:43 +0200
changeset 26867 6274cf7e2b8e
parent 26854 9b4aec46ad78
child 26870 94bedbb34b92
permissions -rw-r--r--
updated generated file;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     1
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{pure}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     4
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     5
\isadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     6
\isanewline
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     7
\isanewline
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     8
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
     9
\endisadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    10
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    11
\isatagtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    12
\isacommand{theory}\isamarkupfalse%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    13
\ pure\isanewline
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    14
\isakeyword{imports}\ CPure\isanewline
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    15
\isakeyword{begin}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    16
\endisatagtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    17
{\isafoldtheory}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    18
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    19
\isadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    20
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    21
\endisadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    22
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    23
\isamarkupchapter{Basic language elements \label{ch:pure-syntax}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    24
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    25
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    26
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    27
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    28
Subsequently, we introduce the main part of Pure theory and proof
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    29
  commands, together with fundamental proof methods and attributes.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    30
  \Chref{ch:gen-tools} describes further Isar elements provided by
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    31
  generic tools and packages (such as the Simplifier) that are either
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    32
  part of Pure Isabelle or pre-installed in most object logics.
26852
a31203f58b20 misc tuning;
wenzelm
parents: 26842
diff changeset
    33
  Specific language elements introduced by the major object-logics are
a31203f58b20 misc tuning;
wenzelm
parents: 26842
diff changeset
    34
  described in \chref{ch:hol} (Isabelle/HOL), \chref{ch:holcf}
a31203f58b20 misc tuning;
wenzelm
parents: 26842
diff changeset
    35
  (Isabelle/HOLCF), and \chref{ch:zf} (Isabelle/ZF).  Nevertheless,
a31203f58b20 misc tuning;
wenzelm
parents: 26842
diff changeset
    36
  examples given in the generic parts will usually refer to
a31203f58b20 misc tuning;
wenzelm
parents: 26842
diff changeset
    37
  Isabelle/HOL as well.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    38
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    39
  \medskip Isar commands may be either \emph{proper} document
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    40
  constructors, or \emph{improper commands}.  Some proof methods and
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    41
  attributes introduced later are classified as improper as well.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    42
  Improper Isar language elements, which are subsequently marked by
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
    43
  ``\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}}'', are often helpful when developing proof
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    44
  documents, while their use is discouraged for the final
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    45
  human-readable outcome.  Typical examples are diagnostic commands
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    46
  that print terms or theorems according to the current context; other
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    47
  commands emulate old-style tactical theorem proving.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    48
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    49
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    50
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    51
\isamarkupsection{Theory commands%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    52
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    53
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    54
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    55
\isamarkupsubsection{Defining theories \label{sec:begin-thy}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    56
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    57
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    58
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    59
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    60
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    61
    \indexdef{}{command}{header}\mbox{\isa{\isacommand{header}}} & : & \isarkeep{toplevel} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    62
    \indexdef{}{command}{theory}\mbox{\isa{\isacommand{theory}}} & : & \isartrans{toplevel}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    63
    \indexdef{}{command}{end}\mbox{\isa{\isacommand{end}}} & : & \isartrans{theory}{toplevel} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    64
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    65
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    66
  Isabelle/Isar theories are defined via theory, which contain both
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    67
  specifications and proofs; occasionally definitional mechanisms also
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    68
  require some explicit proof.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    69
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    70
  The first ``real'' command of any theory has to be \mbox{\isa{\isacommand{theory}}}, which starts a new theory based on the merge of existing
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    71
  ones.  Just preceding the \mbox{\isa{\isacommand{theory}}} keyword, there may be
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    72
  an optional \mbox{\isa{\isacommand{header}}} declaration, which is relevant to
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    73
  document preparation only; it acts very much like a special
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    74
  pre-theory markup command (cf.\ \secref{sec:markup-thy} and
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    75
  \secref{sec:markup-thy}).  The \mbox{\isa{\isacommand{end}}} command concludes a
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    76
  theory development; it has to be the very last command of any theory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    77
  file loaded in batch-mode.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    78
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    79
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    80
    'header' text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    81
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    82
    'theory' name 'imports' (name +) uses? 'begin'
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    83
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    84
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    85
    uses: 'uses' ((name | parname) +);
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    86
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    87
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    88
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    89
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
    90
  \item [\mbox{\isa{\isacommand{header}}}~\isa{{\isachardoublequote}text{\isachardoublequote}}] provides plain text
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    91
  markup just preceding the formal beginning of a theory.  In actual
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    92
  document preparation the corresponding {\LaTeX} macro \verb|\isamarkupheader| may be redefined to produce chapter or section
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    93
  headings.  See also \secref{sec:markup-thy} and
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    94
  \secref{sec:markup-prf} for further markup commands.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    95
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
    96
  \item [\mbox{\isa{\isacommand{theory}}}~\isa{{\isachardoublequote}A\ {\isasymIMPORTS}\ B\isactrlsub {\isadigit{1}}\ {\isasymdots}\ B\isactrlsub n\ {\isasymBEGIN}{\isachardoublequote}}] starts a new theory \isa{A} based on the
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
    97
  merge of existing theories \isa{{\isachardoublequote}B\isactrlsub {\isadigit{1}}\ {\isasymdots}\ B\isactrlsub n{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    98
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
    99
  Due to inclusion of several ancestors, the overall theory structure
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   100
  emerging in an Isabelle session forms a directed acyclic graph
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   101
  (DAG).  Isabelle's theory loader ensures that the sources
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   102
  contributing to the development graph are always up-to-date.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   103
  Changed files are automatically reloaded when processing theory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   104
  headers.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   105
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   106
  The optional \indexdef{}{keyword}{uses}\mbox{\isa{\isakeyword{uses}}} specification declares additional
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   107
  dependencies on extra files (usually ML sources).  Files will be
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   108
  loaded immediately (as ML), unless the name is put in parentheses,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   109
  which merely documents the dependency to be resolved later in the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   110
  text (typically via explicit \indexref{}{command}{use}\mbox{\isa{\isacommand{use}}} in the body text,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   111
  see \secref{sec:ML}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   112
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   113
  \item [\mbox{\isa{\isacommand{end}}}] concludes the current theory definition or
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   114
  context switch.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   115
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   116
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   117
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   118
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   119
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   120
\isamarkupsubsection{Markup commands \label{sec:markup-thy}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   121
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   122
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   123
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   124
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   125
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   126
    \indexdef{}{command}{chapter}\mbox{\isa{\isacommand{chapter}}} & : & \isarkeep{local{\dsh}theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   127
    \indexdef{}{command}{section}\mbox{\isa{\isacommand{section}}} & : & \isarkeep{local{\dsh}theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   128
    \indexdef{}{command}{subsection}\mbox{\isa{\isacommand{subsection}}} & : & \isarkeep{local{\dsh}theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   129
    \indexdef{}{command}{subsubsection}\mbox{\isa{\isacommand{subsubsection}}} & : & \isarkeep{local{\dsh}theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   130
    \indexdef{}{command}{text}\mbox{\isa{\isacommand{text}}} & : & \isarkeep{local{\dsh}theory} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   131
    \indexdef{}{command}{text\_raw}\mbox{\isa{\isacommand{text{\isacharunderscore}raw}}} & : & \isarkeep{local{\dsh}theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   132
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   133
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   134
  Apart from formal comments (see \secref{sec:comments}), markup
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   135
  commands provide a structured way to insert text into the document
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   136
  generated from a theory (see \cite{isabelle-sys} for more
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   137
  information on Isabelle's document preparation tools).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   138
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   139
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   140
    ('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text') target? text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   141
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   142
    'text\_raw' text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   143
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   144
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   145
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   146
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   147
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   148
  \item [\mbox{\isa{\isacommand{chapter}}}, \mbox{\isa{\isacommand{section}}}, \mbox{\isa{\isacommand{subsection}}}, and \mbox{\isa{\isacommand{subsubsection}}}] mark chapter and
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   149
  section headings.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   150
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   151
  \item [\mbox{\isa{\isacommand{text}}}] specifies paragraphs of plain text.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   152
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   153
  \item [\mbox{\isa{\isacommand{text{\isacharunderscore}raw}}}] inserts {\LaTeX} source into the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   154
  output, without additional markup.  Thus the full range of document
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   155
  manipulations becomes available.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   156
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   157
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   158
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   159
  The \isa{{\isachardoublequote}text{\isachardoublequote}} argument of these markup commands (except for
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   160
  \mbox{\isa{\isacommand{text{\isacharunderscore}raw}}}) may contain references to formal entities
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   161
  (``antiquotations'', see also \secref{sec:antiq}).  These are
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   162
  interpreted in the present theory context, or the named \isa{{\isachardoublequote}target{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   163
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   164
  Any of these markup elements corresponds to a {\LaTeX} command with
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   165
  the name prefixed by \verb|\isamarkup|.  For the sectioning
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   166
  commands this is a plain macro with a single argument, e.g.\
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   167
  \verb|\isamarkupchapter{|\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}\verb|}| for
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   168
  \mbox{\isa{\isacommand{chapter}}}.  The \mbox{\isa{\isacommand{text}}} markup results in a
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   169
  {\LaTeX} environment \verb|\begin{isamarkuptext}| \isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} \verb|\end{isamarkuptext}|, while \mbox{\isa{\isacommand{text{\isacharunderscore}raw}}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   170
  causes the text to be inserted directly into the {\LaTeX} source.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   171
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   172
  \medskip Additional markup commands are available for proofs (see
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   173
  \secref{sec:markup-prf}).  Also note that the \indexref{}{command}{header}\mbox{\isa{\isacommand{header}}} declaration (see \secref{sec:begin-thy}) admits to insert
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   174
  section markup just preceding the actual theory definition.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   175
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   176
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   177
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   178
\isamarkupsubsection{Type classes and sorts \label{sec:classes}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   179
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   180
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   181
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   182
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   183
\begin{matharray}{rcll}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   184
    \indexdef{}{command}{classes}\mbox{\isa{\isacommand{classes}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   185
    \indexdef{}{command}{classrel}\mbox{\isa{\isacommand{classrel}}} & : & \isartrans{theory}{theory} & (axiomatic!) \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   186
    \indexdef{}{command}{defaultsort}\mbox{\isa{\isacommand{defaultsort}}} & : & \isartrans{theory}{theory} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   187
    \indexdef{}{command}{class\_deps}\mbox{\isa{\isacommand{class{\isacharunderscore}deps}}} & : & \isarkeep{theory~|~proof} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   188
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   189
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   190
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   191
    'classes' (classdecl +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   192
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   193
    'classrel' (nameref ('<' | subseteq) nameref + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   194
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   195
    'defaultsort' sort
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   196
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   197
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   198
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   199
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   200
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   201
  \item [\mbox{\isa{\isacommand{classes}}}~\isa{{\isachardoublequote}c\ {\isasymsubseteq}\ c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub n{\isachardoublequote}}]
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   202
  declares class \isa{c} to be a subclass of existing classes \isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub n{\isachardoublequote}}.  Cyclic class structures are not permitted.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   203
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   204
  \item [\mbox{\isa{\isacommand{classrel}}}~\isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}\ {\isasymsubseteq}\ c\isactrlsub {\isadigit{2}}{\isachardoublequote}}] states
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   205
  subclass relations between existing classes \isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}{\isachardoublequote}} and
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   206
  \isa{{\isachardoublequote}c\isactrlsub {\isadigit{2}}{\isachardoublequote}}.  This is done axiomatically!  The \indexref{}{command}{instance}\mbox{\isa{\isacommand{instance}}} command (see \secref{sec:axclass}) provides a way to
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   207
  introduce proven class relations.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   208
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   209
  \item [\mbox{\isa{\isacommand{defaultsort}}}~\isa{s}] makes sort \isa{s} the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   210
  new default sort for any type variables given without sort
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   211
  constraints.  Usually, the default sort would be only changed when
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   212
  defining a new object-logic.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   213
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   214
  \item [\mbox{\isa{\isacommand{class{\isacharunderscore}deps}}}] visualizes the subclass relation,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   215
  using Isabelle's graph browser tool (see also \cite{isabelle-sys}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   216
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   217
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   218
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   219
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   220
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   221
\isamarkupsubsection{Primitive types and type abbreviations \label{sec:types-pure}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   222
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   223
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   224
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   225
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   226
\begin{matharray}{rcll}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   227
    \indexdef{}{command}{types}\mbox{\isa{\isacommand{types}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   228
    \indexdef{}{command}{typedecl}\mbox{\isa{\isacommand{typedecl}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   229
    \indexdef{}{command}{nonterminals}\mbox{\isa{\isacommand{nonterminals}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   230
    \indexdef{}{command}{arities}\mbox{\isa{\isacommand{arities}}} & : & \isartrans{theory}{theory} & (axiomatic!) \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   231
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   232
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   233
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   234
    'types' (typespec '=' type infix? +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   235
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   236
    'typedecl' typespec infix?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   237
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   238
    'nonterminals' (name +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   239
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   240
    'arities' (nameref '::' arity +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   241
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   242
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   243
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   244
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   245
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   246
  \item [\mbox{\isa{\isacommand{types}}}~\isa{{\isachardoublequote}{\isacharparenleft}{\isasymalpha}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlsub n{\isacharparenright}\ t\ {\isacharequal}\ {\isasymtau}{\isachardoublequote}}]
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   247
  introduces \emph{type synonym} \isa{{\isachardoublequote}{\isacharparenleft}{\isasymalpha}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlsub n{\isacharparenright}\ t{\isachardoublequote}}
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   248
  for existing type \isa{{\isachardoublequote}{\isasymtau}{\isachardoublequote}}.  Unlike actual type definitions, as
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   249
  are available in Isabelle/HOL for example, type synonyms are just
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   250
  purely syntactic abbreviations without any logical significance.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   251
  Internally, type synonyms are fully expanded.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   252
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   253
  \item [\mbox{\isa{\isacommand{typedecl}}}~\isa{{\isachardoublequote}{\isacharparenleft}{\isasymalpha}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlsub n{\isacharparenright}\ t{\isachardoublequote}}]
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   254
  declares a new type constructor \isa{t}, intended as an actual
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   255
  logical type (of the object-logic, if available).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   256
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   257
  \item [\mbox{\isa{\isacommand{nonterminals}}}~\isa{c}] declares type
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   258
  constructors \isa{c} (without arguments) to act as purely
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   259
  syntactic types, i.e.\ nonterminal symbols of Isabelle's inner
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   260
  syntax of terms or types.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   261
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   262
  \item [\mbox{\isa{\isacommand{arities}}}~\isa{{\isachardoublequote}t\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}s\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ s\isactrlsub n{\isacharparenright}\ s{\isachardoublequote}}] augments Isabelle's order-sorted signature of types by new type
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   263
  constructor arities.  This is done axiomatically!  The \indexref{}{command}{instance}\mbox{\isa{\isacommand{instance}}} command (see \S\ref{sec:axclass}) provides a way to
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   264
  introduce proven type arities.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   265
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   266
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   267
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   268
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   269
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   270
\isamarkupsubsection{Primitive constants and definitions \label{sec:consts}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   271
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   272
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   273
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   274
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   275
Definitions essentially express abbreviations within the logic.  The
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   276
  simplest form of a definition is \isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}\ {\isasymequiv}\ t{\isachardoublequote}}, where \isa{c} is a newly declared constant.  Isabelle also allows derived forms
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   277
  where the arguments of \isa{c} appear on the left, abbreviating a
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   278
  prefix of \isa{{\isasymlambda}}-abstractions, e.g.\ \isa{{\isachardoublequote}c\ {\isasymequiv}\ {\isasymlambda}x\ y{\isachardot}\ t{\isachardoublequote}} may be
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   279
  written more conveniently as \isa{{\isachardoublequote}c\ x\ y\ {\isasymequiv}\ t{\isachardoublequote}}.  Moreover,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   280
  definitions may be weakened by adding arbitrary pre-conditions:
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   281
  \isa{{\isachardoublequote}A\ {\isasymLongrightarrow}\ c\ x\ y\ {\isasymequiv}\ t{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   282
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   283
  \medskip The built-in well-formedness conditions for definitional
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   284
  specifications are:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   285
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   286
  \begin{itemize}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   287
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   288
  \item Arguments (on the left-hand side) must be distinct variables.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   289
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   290
  \item All variables on the right-hand side must also appear on the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   291
  left-hand side.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   292
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   293
  \item All type variables on the right-hand side must also appear on
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   294
  the left-hand side; this prohibits \isa{{\isachardoublequote}{\isadigit{0}}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymequiv}\ length\ {\isacharparenleft}{\isacharbrackleft}{\isacharbrackright}\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ list{\isacharparenright}{\isachardoublequote}} for example.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   295
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   296
  \item The definition must not be recursive.  Most object-logics
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   297
  provide definitional principles that can be used to express
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   298
  recursion safely.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   299
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   300
  \end{itemize}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   301
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   302
  Overloading means that a constant being declared as \isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ decl{\isachardoublequote}} may be defined separately on type instances \isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}{\isasymbeta}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymbeta}\isactrlsub n{\isacharparenright}\ t\ decl{\isachardoublequote}} for each type constructor \isa{t}.  The right-hand side may mention overloaded constants
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   303
  recursively at type instances corresponding to the immediate
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   304
  argument types \isa{{\isachardoublequote}{\isasymbeta}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymbeta}\isactrlsub n{\isachardoublequote}}.  Incomplete
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   305
  specification patterns impose global constraints on all occurrences,
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   306
  e.g.\ \isa{{\isachardoublequote}d\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ {\isasymtimes}\ {\isasymalpha}{\isachardoublequote}} on the left-hand side means that all
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   307
  corresponding occurrences on some right-hand side need to be an
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   308
  instance of this, general \isa{{\isachardoublequote}d\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ {\isasymtimes}\ {\isasymbeta}{\isachardoublequote}} will be disallowed.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   309
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   310
  \begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   311
    \indexdef{}{command}{consts}\mbox{\isa{\isacommand{consts}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   312
    \indexdef{}{command}{defs}\mbox{\isa{\isacommand{defs}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   313
    \indexdef{}{command}{constdefs}\mbox{\isa{\isacommand{constdefs}}} & : & \isartrans{theory}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   314
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   315
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   316
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   317
    'consts' ((name '::' type mixfix?) +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   318
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   319
    'defs' ('(' 'unchecked'? 'overloaded'? ')')? \\ (axmdecl prop +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   320
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   321
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   322
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   323
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   324
    'constdefs' structs? (constdecl? constdef +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   325
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   326
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   327
    structs: '(' 'structure' (vars + 'and') ')'
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   328
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   329
    constdecl:  ((name '::' type mixfix | name '::' type | name mixfix) 'where'?) | name 'where'
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   330
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   331
    constdef: thmdecl? prop
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   332
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   333
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   334
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   335
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   336
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   337
  \item [\mbox{\isa{\isacommand{consts}}}~\isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}{\isachardoublequote}}] declares constant
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   338
  \isa{c} to have any instance of type scheme \isa{{\isasymsigma}}.  The
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   339
  optional mixfix annotations may attach concrete syntax to the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   340
  constants declared.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   341
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   342
  \item [\mbox{\isa{\isacommand{defs}}}~\isa{{\isachardoublequote}name{\isacharcolon}\ eqn{\isachardoublequote}}] introduces \isa{eqn}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   343
  as a definitional axiom for some existing constant.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   344
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   345
  The \isa{{\isachardoublequote}{\isacharparenleft}unchecked{\isacharparenright}{\isachardoublequote}} option disables global dependency checks
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   346
  for this definition, which is occasionally useful for exotic
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   347
  overloading.  It is at the discretion of the user to avoid malformed
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   348
  theory specifications!
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   349
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   350
  The \isa{{\isachardoublequote}{\isacharparenleft}overloaded{\isacharparenright}{\isachardoublequote}} option declares definitions to be
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   351
  potentially overloaded.  Unless this option is given, a warning
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   352
  message would be issued for any definitional equation with a more
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   353
  special type than that of the corresponding constant declaration.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   354
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   355
  \item [\mbox{\isa{\isacommand{constdefs}}}] provides a streamlined combination of
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   356
  constants declarations and definitions: type-inference takes care of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   357
  the most general typing of the given specification (the optional
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   358
  type constraint may refer to type-inference dummies ``\isa{{\isacharunderscore}}'' as usual).  The resulting type declaration needs to agree with
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   359
  that of the specification; overloading is \emph{not} supported here!
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   360
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   361
  The constant name may be omitted altogether, if neither type nor
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   362
  syntax declarations are given.  The canonical name of the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   363
  definitional axiom for constant \isa{c} will be \isa{c{\isacharunderscore}def},
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   364
  unless specified otherwise.  Also note that the given list of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   365
  specifications is processed in a strictly sequential manner, with
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   366
  type-checking being performed independently.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   367
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   368
  An optional initial context of \isa{{\isachardoublequote}{\isacharparenleft}structure{\isacharparenright}{\isachardoublequote}} declarations
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   369
  admits use of indexed syntax, using the special symbol \verb|\<index>| (printed as ``\isa{{\isachardoublequote}{\isasymindex}{\isachardoublequote}}'').  The latter concept is
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   370
  particularly useful with locales (see also \S\ref{sec:locale}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   371
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   372
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   373
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   374
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   375
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   376
\isamarkupsubsection{Syntax and translations \label{sec:syn-trans}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   377
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   378
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   379
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   380
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   381
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   382
    \indexdef{}{command}{syntax}\mbox{\isa{\isacommand{syntax}}} & : & \isartrans{theory}{theory} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   383
    \indexdef{}{command}{no\_syntax}\mbox{\isa{\isacommand{no{\isacharunderscore}syntax}}} & : & \isartrans{theory}{theory} \\
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   384
    \indexdef{}{command}{translations}\mbox{\isa{\isacommand{translations}}} & : & \isartrans{theory}{theory} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   385
    \indexdef{}{command}{no\_translations}\mbox{\isa{\isacommand{no{\isacharunderscore}translations}}} & : & \isartrans{theory}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   386
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   387
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   388
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   389
    ('syntax' | 'no\_syntax') mode? (constdecl +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   390
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   391
    ('translations' | 'no\_translations') (transpat ('==' | '=>' | '<=' | rightleftharpoons | rightharpoonup | leftharpoondown) transpat +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   392
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   393
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   394
    mode: ('(' ( name | 'output' | name 'output' ) ')')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   395
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   396
    transpat: ('(' nameref ')')? string
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   397
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   398
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   399
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   400
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   401
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   402
  \item [\mbox{\isa{\isacommand{syntax}}}~\isa{{\isachardoublequote}{\isacharparenleft}mode{\isacharparenright}\ decls{\isachardoublequote}}] is similar to
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   403
  \mbox{\isa{\isacommand{consts}}}~\isa{decls}, except that the actual logical
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   404
  signature extension is omitted.  Thus the context free grammar of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   405
  Isabelle's inner syntax may be augmented in arbitrary ways,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   406
  independently of the logic.  The \isa{mode} argument refers to the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   407
  print mode that the grammar rules belong; unless the \indexref{}{keyword}{output}\mbox{\isa{\isakeyword{output}}} indicator is given, all productions are added both to the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   408
  input and output grammar.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   409
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   410
  \item [\mbox{\isa{\isacommand{no{\isacharunderscore}syntax}}}~\isa{{\isachardoublequote}{\isacharparenleft}mode{\isacharparenright}\ decls{\isachardoublequote}}] removes
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   411
  grammar declarations (and translations) resulting from \isa{decls}, which are interpreted in the same manner as for \mbox{\isa{\isacommand{syntax}}} above.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   412
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   413
  \item [\mbox{\isa{\isacommand{translations}}}~\isa{rules}] specifies syntactic
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   414
  translation rules (i.e.\ macros): parse~/ print rules (\isa{{\isachardoublequote}{\isasymrightleftharpoons}{\isachardoublequote}}),
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   415
  parse rules (\isa{{\isachardoublequote}{\isasymrightharpoonup}{\isachardoublequote}}), or print rules (\isa{{\isachardoublequote}{\isasymleftharpoondown}{\isachardoublequote}}).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   416
  Translation patterns may be prefixed by the syntactic category to be
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   417
  used for parsing; the default is \isa{logic}.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   418
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   419
  \item [\mbox{\isa{\isacommand{no{\isacharunderscore}translations}}}~\isa{rules}] removes syntactic
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   420
  translation rules, which are interpreted in the same manner as for
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   421
  \mbox{\isa{\isacommand{translations}}} above.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   422
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   423
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   424
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   425
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   426
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   427
\isamarkupsubsection{Axioms and theorems \label{sec:axms-thms}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   428
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   429
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   430
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   431
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   432
\begin{matharray}{rcll}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   433
    \indexdef{}{command}{axioms}\mbox{\isa{\isacommand{axioms}}} & : & \isartrans{theory}{theory} & (axiomatic!) \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   434
    \indexdef{}{command}{lemmas}\mbox{\isa{\isacommand{lemmas}}} & : & \isarkeep{local{\dsh}theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   435
    \indexdef{}{command}{theorems}\mbox{\isa{\isacommand{theorems}}} & : & isarkeep{local{\dsh}theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   436
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   437
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   438
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   439
    'axioms' (axmdecl prop +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   440
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   441
    ('lemmas' | 'theorems') target? (thmdef? thmrefs + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   442
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   443
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   444
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   445
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   446
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   447
  \item [\mbox{\isa{\isacommand{axioms}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] introduces arbitrary
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   448
  statements as axioms of the meta-logic.  In fact, axioms are
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   449
  ``axiomatic theorems'', and may be referred later just as any other
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   450
  theorem.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   451
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   452
  Axioms are usually only introduced when declaring new logical
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   453
  systems.  Everyday work is typically done the hard way, with proper
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   454
  definitions and proven theorems.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   455
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   456
  \item [\mbox{\isa{\isacommand{lemmas}}}~\isa{{\isachardoublequote}a\ {\isacharequal}\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}]
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   457
  retrieves and stores existing facts in the theory context, or the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   458
  specified target context (see also \secref{sec:target}).  Typical
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   459
  applications would also involve attributes, to declare Simplifier
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   460
  rules, for example.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   461
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   462
  \item [\mbox{\isa{\isacommand{theorems}}}] is essentially the same as \mbox{\isa{\isacommand{lemmas}}}, but marks the result as a different kind of facts.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   463
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   464
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   465
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   466
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   467
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   468
\isamarkupsubsection{Name spaces%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   469
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   470
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   471
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   472
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   473
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   474
    \indexdef{}{command}{global}\mbox{\isa{\isacommand{global}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   475
    \indexdef{}{command}{local}\mbox{\isa{\isacommand{local}}} & : & \isartrans{theory}{theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   476
    \indexdef{}{command}{hide}\mbox{\isa{\isacommand{hide}}} & : & \isartrans{theory}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   477
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   478
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   479
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   480
    'hide' ('(open)')? name (nameref + )
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   481
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   482
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   483
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   484
  Isabelle organizes any kind of name declarations (of types,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   485
  constants, theorems etc.) by separate hierarchically structured name
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   486
  spaces.  Normally the user does not have to control the behavior of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   487
  name spaces by hand, yet the following commands provide some way to
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   488
  do so.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   489
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   490
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   491
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   492
  \item [\mbox{\isa{\isacommand{global}}} and \mbox{\isa{\isacommand{local}}}] change the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   493
  current name declaration mode.  Initially, theories start in
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   494
  \mbox{\isa{\isacommand{local}}} mode, causing all names to be automatically
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   495
  qualified by the theory name.  Changing this to \mbox{\isa{\isacommand{global}}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   496
  causes all names to be declared without the theory prefix, until
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   497
  \mbox{\isa{\isacommand{local}}} is declared again.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   498
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   499
  Note that global names are prone to get hidden accidently later,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   500
  when qualified names of the same base name are introduced.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   501
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   502
  \item [\mbox{\isa{\isacommand{hide}}}~\isa{{\isachardoublequote}space\ names{\isachardoublequote}}] fully removes
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   503
  declarations from a given name space (which may be \isa{{\isachardoublequote}class{\isachardoublequote}},
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   504
  \isa{{\isachardoublequote}type{\isachardoublequote}}, \isa{{\isachardoublequote}const{\isachardoublequote}}, or \isa{{\isachardoublequote}fact{\isachardoublequote}}); with the \isa{{\isachardoublequote}{\isacharparenleft}open{\isacharparenright}{\isachardoublequote}} option, only the base name is hidden.  Global
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   505
  (unqualified) names may never be hidden.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   506
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   507
  Note that hiding name space accesses has no impact on logical
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   508
  declarations -- they remain valid internally.  Entities that are no
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   509
  longer accessible to the user are printed with the special qualifier
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   510
  ``\isa{{\isachardoublequote}{\isacharquery}{\isacharquery}{\isachardoublequote}}'' prefixed to the full internal name.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   511
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   512
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   513
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   514
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   515
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   516
\isamarkupsubsection{Incorporating ML code \label{sec:ML}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   517
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   518
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   519
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   520
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   521
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   522
    \indexdef{}{command}{use}\mbox{\isa{\isacommand{use}}} & : & \isarkeep{theory~|~local{\dsh}theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   523
    \indexdef{}{command}{ML}\mbox{\isa{\isacommand{ML}}} & : & \isarkeep{theory~|~local{\dsh}theory} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   524
    \indexdef{}{command}{ML\_val}\mbox{\isa{\isacommand{ML{\isacharunderscore}val}}} & : & \isartrans{\cdot}{\cdot} \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   525
    \indexdef{}{command}{ML\_command}\mbox{\isa{\isacommand{ML{\isacharunderscore}command}}} & : & \isartrans{\cdot}{\cdot} \\
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   526
    \indexdef{}{command}{setup}\mbox{\isa{\isacommand{setup}}} & : & \isartrans{theory}{theory} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   527
    \indexdef{}{command}{method\_setup}\mbox{\isa{\isacommand{method{\isacharunderscore}setup}}} & : & \isartrans{theory}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   528
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   529
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   530
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   531
    'use' name
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   532
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   533
    ('ML' | 'ML\_val' | 'ML\_command' | 'setup') text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   534
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   535
    'method\_setup' name '=' text text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   536
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   537
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   538
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   539
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   540
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   541
  \item [\mbox{\isa{\isacommand{use}}}~\isa{{\isachardoublequote}file{\isachardoublequote}}] reads and executes ML
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   542
  commands from \isa{{\isachardoublequote}file{\isachardoublequote}}.  The current theory context is passed
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   543
  down to the ML toplevel and may be modified, using \verb|"Context.>>"| or derived ML commands.  The file name is checked with
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   544
  the \indexref{}{keyword}{uses}\mbox{\isa{\isakeyword{uses}}} dependency declaration given in the theory
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   545
  header (see also \secref{sec:begin-thy}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   546
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   547
  \item [\mbox{\isa{\isacommand{ML}}}~\isa{{\isachardoublequote}text{\isachardoublequote}}] is similar to \mbox{\isa{\isacommand{use}}}, but executes ML commands directly from the given \isa{{\isachardoublequote}text{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   548
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   549
  \item [\mbox{\isa{\isacommand{ML{\isacharunderscore}val}}} and \mbox{\isa{\isacommand{ML{\isacharunderscore}command}}}] are
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   550
  diagnostic versions of \mbox{\isa{\isacommand{ML}}}, which means that the context
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   551
  may not be updated.  \mbox{\isa{\isacommand{ML{\isacharunderscore}val}}} echos the bindings produced
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   552
  at the ML toplevel, but \mbox{\isa{\isacommand{ML{\isacharunderscore}command}}} is silent.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   553
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   554
  \item [\mbox{\isa{\isacommand{setup}}}~\isa{{\isachardoublequote}text{\isachardoublequote}}] changes the current theory
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   555
  context by applying \isa{{\isachardoublequote}text{\isachardoublequote}}, which refers to an ML expression
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   556
  of type \verb|"theory -> theory"|.  This enables to initialize
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   557
  any object-logic specific tools and packages written in ML, for
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   558
  example.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   559
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   560
  \item [\mbox{\isa{\isacommand{method{\isacharunderscore}setup}}}~\isa{{\isachardoublequote}name\ {\isacharequal}\ text\ description{\isachardoublequote}}]
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   561
  defines a proof method in the current theory.  The given \isa{{\isachardoublequote}text{\isachardoublequote}} has to be an ML expression of type \verb|"Args.src ->|\isasep\isanewline%
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   562
\verb|  Proof.context -> Proof.method"|.  Parsing concrete method syntax
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   563
  from \verb|Args.src| input can be quite tedious in general.  The
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   564
  following simple examples are for methods without any explicit
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   565
  arguments, or a list of theorems, respectively.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   566
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   567
%FIXME proper antiquotations
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   568
{\footnotesize
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   569
\begin{verbatim}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   570
 Method.no_args (Method.METHOD (fn facts => foobar_tac))
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   571
 Method.thms_args (fn thms => Method.METHOD (fn facts => foobar_tac))
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   572
 Method.ctxt_args (fn ctxt => Method.METHOD (fn facts => foobar_tac))
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   573
 Method.thms_ctxt_args (fn thms => fn ctxt =>
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   574
    Method.METHOD (fn facts => foobar_tac))
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   575
\end{verbatim}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   576
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   577
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   578
  Note that mere tactic emulations may ignore the \isa{facts}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   579
  parameter above.  Proper proof methods would do something
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   580
  appropriate with the list of current facts, though.  Single-rule
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   581
  methods usually do strict forward-chaining (e.g.\ by using \verb|Drule.multi_resolves|), while automatic ones just insert the facts
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   582
  using \verb|Method.insert_tac| before applying the main tactic.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   583
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   584
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   585
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   586
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   587
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   588
\isamarkupsubsection{Syntax translation functions%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   589
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   590
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   591
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   592
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   593
\begin{matharray}{rcl}
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   594
    \indexdef{}{command}{parse\_ast\_translation}\mbox{\isa{\isacommand{parse{\isacharunderscore}ast{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   595
    \indexdef{}{command}{parse\_translation}\mbox{\isa{\isacommand{parse{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   596
    \indexdef{}{command}{print\_translation}\mbox{\isa{\isacommand{print{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   597
    \indexdef{}{command}{typed\_print\_translation}\mbox{\isa{\isacommand{typed{\isacharunderscore}print{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   598
    \indexdef{}{command}{print\_ast\_translation}\mbox{\isa{\isacommand{print{\isacharunderscore}ast{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   599
    \indexdef{}{command}{token\_translation}\mbox{\isa{\isacommand{token{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   600
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   601
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   602
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   603
  ( 'parse\_ast\_translation' | 'parse\_translation' | 'print\_translation' |
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   604
    'typed\_print\_translation' | 'print\_ast\_translation' ) ('(advanced)')? text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   605
  ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   606
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   607
  'token\_translation' text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   608
  ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   609
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   610
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   611
  Syntax translation functions written in ML admit almost arbitrary
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   612
  manipulations of Isabelle's inner syntax.  Any of the above commands
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   613
  have a single \railqtok{text} argument that refers to an ML
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   614
  expression of appropriate type, which are as follows by default:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   615
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   616
%FIXME proper antiquotations
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   617
\begin{ttbox}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   618
val parse_ast_translation   : (string * (ast list -> ast)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   619
val parse_translation       : (string * (term list -> term)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   620
val print_translation       : (string * (term list -> term)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   621
val typed_print_translation :
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   622
  (string * (bool -> typ -> term list -> term)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   623
val print_ast_translation   : (string * (ast list -> ast)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   624
val token_translation       :
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   625
  (string * string * (string -> string * real)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   626
\end{ttbox}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   627
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   628
  If the \isa{{\isachardoublequote}{\isacharparenleft}advanced{\isacharparenright}{\isachardoublequote}} option is given, the corresponding
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   629
  translation functions may depend on the current theory or proof
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   630
  context.  This allows to implement advanced syntax mechanisms, as
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   631
  translations functions may refer to specific theory declarations or
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   632
  auxiliary proof data.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   633
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   634
  See also \cite[\S8]{isabelle-ref} for more information on the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   635
  general concept of syntax transformations in Isabelle.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   636
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   637
%FIXME proper antiquotations
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   638
\begin{ttbox}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   639
val parse_ast_translation:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   640
  (string * (Context.generic -> ast list -> ast)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   641
val parse_translation:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   642
  (string * (Context.generic -> term list -> term)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   643
val print_translation:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   644
  (string * (Context.generic -> term list -> term)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   645
val typed_print_translation:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   646
  (string * (Context.generic -> bool -> typ -> term list -> term)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   647
val print_ast_translation:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   648
  (string * (Context.generic -> ast list -> ast)) list
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   649
\end{ttbox}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   650
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   651
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   652
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   653
\isamarkupsubsection{Oracles%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   654
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   655
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   656
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   657
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   658
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   659
    \indexdef{}{command}{oracle}\mbox{\isa{\isacommand{oracle}}} & : & \isartrans{theory}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   660
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   661
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   662
  The oracle interface promotes a given ML function \verb|theory -> T -> term| to \verb|theory -> T -> thm|, for some
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   663
  type \verb|T| given by the user.  This acts like an infinitary
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   664
  specification of axioms -- there is no internal check of the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   665
  correctness of the results!  The inference kernel records oracle
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   666
  invocations within the internal derivation object of theorems, and
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   667
  the pretty printer attaches ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' to indicate results
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   668
  that are not fully checked by Isabelle inferences.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   669
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   670
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   671
    'oracle' name '(' type ')' '=' text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   672
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   673
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   674
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   675
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   676
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   677
  \item [\mbox{\isa{\isacommand{oracle}}}~\isa{{\isachardoublequote}name\ {\isacharparenleft}type{\isacharparenright}\ {\isacharequal}\ text{\isachardoublequote}}] turns the
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   678
  given ML expression \isa{{\isachardoublequote}text{\isachardoublequote}} of type
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   679
  \verb|theory ->|~\isa{{\isachardoublequote}type{\isachardoublequote}}~\verb|-> term| into an
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   680
  ML function of type
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   681
  \verb|theory ->|~\isa{{\isachardoublequote}type{\isachardoublequote}}~\verb|-> thm|, which is
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   682
  bound to the global identifier \verb|name|.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   683
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   684
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   685
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   686
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   687
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   688
\isamarkupsection{Proof commands%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   689
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   690
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   691
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   692
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   693
Proof commands perform transitions of Isar/VM machine
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   694
  configurations, which are block-structured, consisting of a stack of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   695
  nodes with three main components: logical proof context, current
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   696
  facts, and open goals.  Isar/VM transitions are \emph{typed}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   697
  according to the following three different modes of operation:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   698
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   699
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   700
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   701
  \item [\isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}] means that a new goal has just been
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   702
  stated that is now to be \emph{proven}; the next command may refine
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   703
  it by some proof method, and enter a sub-proof to establish the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   704
  actual result.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   705
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   706
  \item [\isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}}] is like a nested theory mode: the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   707
  context may be augmented by \emph{stating} additional assumptions,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   708
  intermediate results etc.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   709
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   710
  \item [\isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}}] is intermediate between \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} and \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}: existing facts (i.e.\
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   711
  the contents of the special ``\indexref{}{fact}{this}\mbox{\isa{this}}'' register) have been
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   712
  just picked up in order to be used when refining the goal claimed
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   713
  next.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   714
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   715
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   716
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   717
  The proof mode indicator may be read as a verb telling the writer
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   718
  what kind of operation may be performed next.  The corresponding
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   719
  typings of proof commands restricts the shape of well-formed proof
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   720
  texts to particular command sequences.  So dynamic arrangements of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   721
  commands eventually turn out as static texts of a certain structure.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   722
  \Appref{ap:refcard} gives a simplified grammar of the overall
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   723
  (extensible) language emerging that way.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   724
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   725
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   726
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   727
\isamarkupsubsection{Markup commands \label{sec:markup-prf}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   728
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   729
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   730
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   731
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   732
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   733
    \indexdef{}{command}{sect}\mbox{\isa{\isacommand{sect}}} & : & \isartrans{proof}{proof} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   734
    \indexdef{}{command}{subsect}\mbox{\isa{\isacommand{subsect}}} & : & \isartrans{proof}{proof} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   735
    \indexdef{}{command}{subsubsect}\mbox{\isa{\isacommand{subsubsect}}} & : & \isartrans{proof}{proof} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   736
    \indexdef{}{command}{txt}\mbox{\isa{\isacommand{txt}}} & : & \isartrans{proof}{proof} \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   737
    \indexdef{}{command}{txt\_raw}\mbox{\isa{\isacommand{txt{\isacharunderscore}raw}}} & : & \isartrans{proof}{proof} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   738
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   739
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   740
  These markup commands for proof mode closely correspond to the ones
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   741
  of theory mode (see \S\ref{sec:markup-thy}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   742
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   743
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   744
    ('sect' | 'subsect' | 'subsubsect' | 'txt' | 'txt\_raw') text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   745
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   746
  \end{rail}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   747
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   748
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   749
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   750
\isamarkupsubsection{Context elements \label{sec:proof-context}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   751
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   752
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   753
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   754
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   755
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   756
    \indexdef{}{command}{fix}\mbox{\isa{\isacommand{fix}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   757
    \indexdef{}{command}{assume}\mbox{\isa{\isacommand{assume}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   758
    \indexdef{}{command}{presume}\mbox{\isa{\isacommand{presume}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   759
    \indexdef{}{command}{def}\mbox{\isa{\isacommand{def}}} & : & \isartrans{proof(state)}{proof(state)} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   760
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   761
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   762
  The logical proof context consists of fixed variables and
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   763
  assumptions.  The former closely correspond to Skolem constants, or
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   764
  meta-level universal quantification as provided by the Isabelle/Pure
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   765
  logical framework.  Introducing some \emph{arbitrary, but fixed}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   766
  variable via ``\mbox{\isa{\isacommand{fix}}}~\isa{x}'' results in a local value
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   767
  that may be used in the subsequent proof as any other variable or
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   768
  constant.  Furthermore, any result \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} exported from
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   769
  the context will be universally closed wrt.\ \isa{x} at the
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   770
  outermost level: \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymAnd}x{\isachardot}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} (this is expressed in normal
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   771
  form using Isabelle's meta-variables).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   772
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   773
  Similarly, introducing some assumption \isa{{\isasymchi}} has two effects.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   774
  On the one hand, a local theorem is created that may be used as a
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   775
  fact in subsequent proof steps.  On the other hand, any result
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   776
  \isa{{\isachardoublequote}{\isasymchi}\ {\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} exported from the context becomes conditional wrt.\
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   777
  the assumption: \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymchi}\ {\isasymLongrightarrow}\ {\isasymphi}{\isachardoublequote}}.  Thus, solving an enclosing goal
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   778
  using such a result would basically introduce a new subgoal stemming
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   779
  from the assumption.  How this situation is handled depends on the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   780
  version of assumption command used: while \mbox{\isa{\isacommand{assume}}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   781
  insists on solving the subgoal by unification with some premise of
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   782
  the goal, \mbox{\isa{\isacommand{presume}}} leaves the subgoal unchanged in order
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   783
  to be proved later by the user.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   784
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   785
  Local definitions, introduced by ``\mbox{\isa{\isacommand{def}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'', are achieved by combining ``\mbox{\isa{\isacommand{fix}}}~\isa{x}'' with
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   786
  another version of assumption that causes any hypothetical equation
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   787
  \isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}} to be eliminated by the reflexivity rule.  Thus,
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   788
  exporting some result \isa{{\isachardoublequote}x\ {\isasymequiv}\ t\ {\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} yields \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}t{\isacharbrackright}{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   789
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   790
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   791
    'fix' (vars + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   792
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   793
    ('assume' | 'presume') (props + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   794
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   795
    'def' (def + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   796
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   797
    def: thmdecl? \\ name ('==' | equiv) term termpat?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   798
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   799
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   800
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   801
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   802
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   803
  \item [\mbox{\isa{\isacommand{fix}}}~\isa{x}] introduces a local variable
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   804
  \isa{x} that is \emph{arbitrary, but fixed.}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   805
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   806
  \item [\mbox{\isa{\isacommand{assume}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} and \mbox{\isa{\isacommand{presume}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] introduce a local fact \isa{{\isachardoublequote}{\isasymphi}\ {\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} by
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   807
  assumption.  Subsequent results applied to an enclosing goal (e.g.\
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   808
  by \indexref{}{command}{show}\mbox{\isa{\isacommand{show}}}) are handled as follows: \mbox{\isa{\isacommand{assume}}} expects to be able to unify with existing premises in the
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   809
  goal, while \mbox{\isa{\isacommand{presume}}} leaves \isa{{\isasymphi}} as new subgoals.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   810
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   811
  Several lists of assumptions may be given (separated by
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   812
  \indexref{}{keyword}{and}\mbox{\isa{\isakeyword{and}}}; the resulting list of current facts consists
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   813
  of all of these concatenated.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   814
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   815
  \item [\mbox{\isa{\isacommand{def}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}] introduces a local
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   816
  (non-polymorphic) definition.  In results exported from the context,
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   817
  \isa{x} is replaced by \isa{t}.  Basically, ``\mbox{\isa{\isacommand{def}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'' abbreviates ``\mbox{\isa{\isacommand{fix}}}~\isa{x}~\mbox{\isa{\isacommand{assume}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'', with the resulting
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   818
  hypothetical equation solved by reflexivity.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   819
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   820
  The default name for the definitional equation is \isa{x{\isacharunderscore}def}.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   821
  Several simultaneous definitions may be given at the same time.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   822
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   823
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   824
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   825
  The special name \indexref{}{fact}{prems}\mbox{\isa{prems}} refers to all assumptions of the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   826
  current context as a list of theorems.  This feature should be used
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   827
  with great care!  It is better avoided in final proof texts.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   828
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   829
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   830
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   831
\isamarkupsubsection{Facts and forward chaining%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   832
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   833
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   834
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   835
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   836
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   837
    \indexdef{}{command}{note}\mbox{\isa{\isacommand{note}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   838
    \indexdef{}{command}{then}\mbox{\isa{\isacommand{then}}} & : & \isartrans{proof(state)}{proof(chain)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   839
    \indexdef{}{command}{from}\mbox{\isa{\isacommand{from}}} & : & \isartrans{proof(state)}{proof(chain)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   840
    \indexdef{}{command}{with}\mbox{\isa{\isacommand{with}}} & : & \isartrans{proof(state)}{proof(chain)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   841
    \indexdef{}{command}{using}\mbox{\isa{\isacommand{using}}} & : & \isartrans{proof(prove)}{proof(prove)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   842
    \indexdef{}{command}{unfolding}\mbox{\isa{\isacommand{unfolding}}} & : & \isartrans{proof(prove)}{proof(prove)} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   843
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   844
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   845
  New facts are established either by assumption or proof of local
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   846
  statements.  Any fact will usually be involved in further proofs,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   847
  either as explicit arguments of proof methods, or when forward
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   848
  chaining towards the next goal via \mbox{\isa{\isacommand{then}}} (and variants);
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   849
  \mbox{\isa{\isacommand{from}}} and \mbox{\isa{\isacommand{with}}} are composite forms
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   850
  involving \mbox{\isa{\isacommand{note}}}.  The \mbox{\isa{\isacommand{using}}} elements
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   851
  augments the collection of used facts \emph{after} a goal has been
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   852
  stated.  Note that the special theorem name \indexref{}{fact}{this}\mbox{\isa{this}} refers
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   853
  to the most recently established facts, but only \emph{before}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   854
  issuing a follow-up claim.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   855
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   856
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   857
    'note' (thmdef? thmrefs + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   858
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   859
    ('from' | 'with' | 'using' | 'unfolding') (thmrefs + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   860
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   861
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   862
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   863
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   864
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   865
  \item [\mbox{\isa{\isacommand{note}}}~\isa{{\isachardoublequote}a\ {\isacharequal}\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}]
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   866
  recalls existing facts \isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ b\isactrlsub n{\isachardoublequote}}, binding
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   867
  the result as \isa{a}.  Note that attributes may be involved as
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   868
  well, both on the left and right hand sides.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   869
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   870
  \item [\mbox{\isa{\isacommand{then}}}] indicates forward chaining by the current
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   871
  facts in order to establish the goal to be claimed next.  The
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   872
  initial proof method invoked to refine that will be offered the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   873
  facts to do ``anything appropriate'' (see also
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   874
  \secref{sec:proof-steps}).  For example, method \indexref{}{method}{rule}\mbox{\isa{rule}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   875
  (see \secref{sec:pure-meth-att}) would typically do an elimination
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   876
  rather than an introduction.  Automatic methods usually insert the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   877
  facts into the goal state before operation.  This provides a simple
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   878
  scheme to control relevance of facts in automated proof search.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   879
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   880
  \item [\mbox{\isa{\isacommand{from}}}~\isa{b}] abbreviates ``\mbox{\isa{\isacommand{note}}}~\isa{b}~\mbox{\isa{\isacommand{then}}}''; thus \mbox{\isa{\isacommand{then}}} is
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   881
  equivalent to ``\mbox{\isa{\isacommand{from}}}~\isa{this}''.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   882
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   883
  \item [\mbox{\isa{\isacommand{with}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}]
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   884
  abbreviates ``\mbox{\isa{\isacommand{from}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n\ {\isasymAND}\ this{\isachardoublequote}}''; thus the forward chaining is from earlier facts together
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   885
  with the current ones.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   886
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   887
  \item [\mbox{\isa{\isacommand{using}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}] augments
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   888
  the facts being currently indicated for use by a subsequent
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   889
  refinement step (such as \indexref{}{command}{apply}\mbox{\isa{\isacommand{apply}}} or \indexref{}{command}{proof}\mbox{\isa{\isacommand{proof}}}).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   890
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   891
  \item [\mbox{\isa{\isacommand{unfolding}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}] is
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   892
  structurally similar to \mbox{\isa{\isacommand{using}}}, but unfolds definitional
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   893
  equations \isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} throughout the goal state
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   894
  and facts.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   895
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   896
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   897
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   898
  Forward chaining with an empty list of theorems is the same as not
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   899
  chaining at all.  Thus ``\mbox{\isa{\isacommand{from}}}~\isa{nothing}'' has no
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   900
  effect apart from entering \isa{{\isachardoublequote}prove{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode, since
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   901
  \indexref{}{fact}{nothing}\mbox{\isa{nothing}} is bound to the empty list of theorems.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   902
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   903
  Basic proof methods (such as \indexref{}{method}{rule}\mbox{\isa{rule}}) expect multiple
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   904
  facts to be given in their proper order, corresponding to a prefix
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   905
  of the premises of the rule involved.  Note that positions may be
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   906
  easily skipped using something like \mbox{\isa{\isacommand{from}}}~\isa{{\isachardoublequote}{\isacharunderscore}\ {\isasymAND}\ a\ {\isasymAND}\ b{\isachardoublequote}}, for example.  This involves the trivial rule
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   907
  \isa{{\isachardoublequote}PROP\ {\isasympsi}\ {\isasymLongrightarrow}\ PROP\ {\isasympsi}{\isachardoublequote}}, which is bound in Isabelle/Pure as
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
   908
  ``\indexref{}{fact}{\_}\mbox{\isa{{\isacharunderscore}}}'' (underscore).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   909
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   910
  Automated methods (such as \mbox{\isa{simp}} or \mbox{\isa{auto}}) just
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   911
  insert any given facts before their usual operation.  Depending on
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   912
  the kind of procedure involved, the order of facts is less
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   913
  significant here.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   914
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   915
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   916
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   917
\isamarkupsubsection{Goal statements \label{sec:goals}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   918
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   919
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   920
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   921
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   922
\begin{matharray}{rcl}
26867
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   923
    \indexdef{}{command}{lemma}\mbox{\isa{\isacommand{lemma}}} & : & \isartrans{local{\dsh}theory}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   924
    \indexdef{}{command}{theorem}\mbox{\isa{\isacommand{theorem}}} & : & \isartrans{local{\dsh}theory}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   925
    \indexdef{}{command}{corollary}\mbox{\isa{\isacommand{corollary}}} & : & \isartrans{local{\dsh}theory}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   926
    \indexdef{}{command}{have}\mbox{\isa{\isacommand{have}}} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   927
    \indexdef{}{command}{show}\mbox{\isa{\isacommand{show}}} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   928
    \indexdef{}{command}{hence}\mbox{\isa{\isacommand{hence}}} & : & \isartrans{proof(state)}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   929
    \indexdef{}{command}{thus}\mbox{\isa{\isacommand{thus}}} & : & \isartrans{proof(state)}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
   930
    \indexdef{}{command}{print\_statement}\mbox{\isa{\isacommand{print{\isacharunderscore}statement}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   931
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   932
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   933
  From a theory context, proof mode is entered by an initial goal
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   934
  command such as \mbox{\isa{\isacommand{lemma}}}, \mbox{\isa{\isacommand{theorem}}}, or
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   935
  \mbox{\isa{\isacommand{corollary}}}.  Within a proof, new claims may be
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   936
  introduced locally as well; four variants are available here to
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   937
  indicate whether forward chaining of facts should be performed
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   938
  initially (via \indexref{}{command}{then}\mbox{\isa{\isacommand{then}}}), and whether the final result
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   939
  is meant to solve some pending goal.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   940
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   941
  Goals may consist of multiple statements, resulting in a list of
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   942
  facts eventually.  A pending multi-goal is internally represented as
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   943
  a meta-level conjunction (printed as \isa{{\isachardoublequote}{\isacharampersand}{\isacharampersand}{\isachardoublequote}}), which is usually
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   944
  split into the corresponding number of sub-goals prior to an initial
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   945
  method application, via \indexref{}{command}{proof}\mbox{\isa{\isacommand{proof}}}
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   946
  (\secref{sec:proof-steps}) or \indexref{}{command}{apply}\mbox{\isa{\isacommand{apply}}}
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   947
  (\secref{sec:tactic-commands}).  The \indexref{}{method}{induct}\mbox{\isa{induct}} method
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   948
  covered in \secref{sec:cases-induct} acts on multiple claims
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   949
  simultaneously.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   950
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   951
  Claims at the theory level may be either in short or long form.  A
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   952
  short goal merely consists of several simultaneous propositions
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   953
  (often just one).  A long goal includes an explicit context
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   954
  specification for the subsequent conclusion, involving local
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   955
  parameters and assumptions.  Here the role of each part of the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   956
  statement is explicitly marked by separate keywords (see also
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   957
  \secref{sec:locale}); the local assumptions being introduced here
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   958
  are available as \indexref{}{fact}{assms}\mbox{\isa{assms}} in the proof.  Moreover, there
26788
57b54e586989 updated generated file;
wenzelm
parents: 26776
diff changeset
   959
  are two kinds of conclusions: \indexdef{}{element}{shows}\mbox{\isa{\isakeyword{shows}}} states several
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   960
  simultaneous propositions (essentially a big conjunction), while
26788
57b54e586989 updated generated file;
wenzelm
parents: 26776
diff changeset
   961
  \indexdef{}{element}{obtains}\mbox{\isa{\isakeyword{obtains}}} claims several simultaneous simultaneous
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   962
  contexts of (essentially a big disjunction of eliminated parameters
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   963
  and assumptions, cf.\ \secref{sec:obtain}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   964
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   965
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   966
    ('lemma' | 'theorem' | 'corollary') target? (goal | longgoal)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   967
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   968
    ('have' | 'show' | 'hence' | 'thus') goal
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   969
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   970
    'print\_statement' modes? thmrefs
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   971
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   972
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   973
    goal: (props + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   974
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   975
    longgoal: thmdecl? (contextelem *) conclusion
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   976
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   977
    conclusion: 'shows' goal | 'obtains' (parname? case + '|')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   978
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   979
    case: (vars + 'and') 'where' (props + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   980
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   981
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   982
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   983
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   984
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   985
  \item [\mbox{\isa{\isacommand{lemma}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] enters proof mode with
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   986
  \isa{{\isasymphi}} as main goal, eventually resulting in some fact \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} to be put back into the target context.  An additional
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   987
  \railnonterm{context} specification may build up an initial proof
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   988
  context for the subsequent claim; this includes local definitions
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   989
  and syntax as well, see the definition of \mbox{\isa{contextelem}} in
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   990
  \secref{sec:locale}.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   991
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   992
  \item [\mbox{\isa{\isacommand{theorem}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} and \mbox{\isa{\isacommand{corollary}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] are essentially the same as \mbox{\isa{\isacommand{lemma}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}, but the facts are internally marked as
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   993
  being of a different kind.  This discrimination acts like a formal
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   994
  comment.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   995
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   996
  \item [\mbox{\isa{\isacommand{have}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] claims a local goal,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   997
  eventually resulting in a fact within the current logical context.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
   998
  This operation is completely independent of any pending sub-goals of
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   999
  an enclosing goal statements, so \mbox{\isa{\isacommand{have}}} may be freely
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1000
  used for experimental exploration of potential results within a
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1001
  proof body.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1002
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1003
  \item [\mbox{\isa{\isacommand{show}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] is like \mbox{\isa{\isacommand{have}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} plus a second stage to refine some pending
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1004
  sub-goal for each one of the finished result, after having been
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1005
  exported into the corresponding context (at the head of the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1006
  sub-proof of this \mbox{\isa{\isacommand{show}}} command).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1007
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1008
  To accommodate interactive debugging, resulting rules are printed
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1009
  before being applied internally.  Even more, interactive execution
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1010
  of \mbox{\isa{\isacommand{show}}} predicts potential failure and displays the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1011
  resulting error as a warning beforehand.  Watch out for the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1012
  following message:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1013
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1014
  %FIXME proper antiquitation
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1015
  \begin{ttbox}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1016
  Problem! Local statement will fail to solve any pending goal
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1017
  \end{ttbox}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1018
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1019
  \item [\mbox{\isa{\isacommand{hence}}}] abbreviates ``\mbox{\isa{\isacommand{then}}}~\mbox{\isa{\isacommand{have}}}'', i.e.\ claims a local goal to be proven by forward
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1020
  chaining the current facts.  Note that \mbox{\isa{\isacommand{hence}}} is also
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1021
  equivalent to ``\mbox{\isa{\isacommand{from}}}~\isa{this}~\mbox{\isa{\isacommand{have}}}''.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1022
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1023
  \item [\mbox{\isa{\isacommand{thus}}}] abbreviates ``\mbox{\isa{\isacommand{then}}}~\mbox{\isa{\isacommand{show}}}''.  Note that \mbox{\isa{\isacommand{thus}}} is also equivalent to
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1024
  ``\mbox{\isa{\isacommand{from}}}~\isa{this}~\mbox{\isa{\isacommand{show}}}''.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1025
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1026
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}statement}}}~\isa{a}] prints facts from the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1027
  current theory or proof context in long statement form, according to
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1028
  the syntax for \mbox{\isa{\isacommand{lemma}}} given above.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1029
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1030
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1031
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1032
  Any goal statement causes some term abbreviations (such as
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1033
  \indexref{}{variable}{?thesis}\mbox{\isa{{\isacharquery}thesis}}) to be bound automatically, see also
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1034
  \secref{sec:term-abbrev}.  Furthermore, the local context of a
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26852
diff changeset
  1035
  (non-atomic) goal is provided via the \indexref{}{case}{rule\_context}\mbox{\isa{rule{\isacharunderscore}context}} case.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1036
26788
57b54e586989 updated generated file;
wenzelm
parents: 26776
diff changeset
  1037
  The optional case names of \indexref{}{element}{obtains}\mbox{\isa{\isakeyword{obtains}}} have a twofold
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1038
  meaning: (1) during the of this claim they refer to the the local
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1039
  context introductions, (2) the resulting rule is annotated
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1040
  accordingly to support symbolic case splits when used with the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1041
  \indexref{}{method}{cases}\mbox{\isa{cases}} method (cf.  \secref{sec:cases-induct}).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1042
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1043
  \medskip
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1044
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1045
  \begin{warn}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1046
    Isabelle/Isar suffers theory-level goal statements to contain
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1047
    \emph{unbound schematic variables}, although this does not conform
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1048
    to the aim of human-readable proof documents!  The main problem
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1049
    with schematic goals is that the actual outcome is usually hard to
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1050
    predict, depending on the behavior of the proof methods applied
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1051
    during the course of reasoning.  Note that most semi-automated
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1052
    methods heavily depend on several kinds of implicit rule
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1053
    declarations within the current theory context.  As this would
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1054
    also result in non-compositional checking of sub-proofs,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1055
    \emph{local goals} are not allowed to be schematic at all.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1056
    Nevertheless, schematic goals do have their use in Prolog-style
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1057
    interactive synthesis of proven results, usually by stepwise
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1058
    refinement via emulation of traditional Isabelle tactic scripts
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1059
    (see also \secref{sec:tactic-commands}).  In any case, users
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1060
    should know what they are doing.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1061
  \end{warn}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1062
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1063
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1064
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1065
\isamarkupsubsection{Initial and terminal proof steps \label{sec:proof-steps}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1066
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1067
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1068
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1069
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1070
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1071
    \indexdef{}{command}{proof}\mbox{\isa{\isacommand{proof}}} & : & \isartrans{proof(prove)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1072
    \indexdef{}{command}{qed}\mbox{\isa{\isacommand{qed}}} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1073
    \indexdef{}{command}{by}\mbox{\isa{\isacommand{by}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1074
    \indexdef{}{command}{..}\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1075
    \indexdef{}{command}{.}\mbox{\isa{\isacommand{{\isachardot}}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1076
    \indexdef{}{command}{sorry}\mbox{\isa{\isacommand{sorry}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1077
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1078
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1079
  Arbitrary goal refinement via tactics is considered harmful.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1080
  Structured proof composition in Isar admits proof methods to be
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1081
  invoked in two places only.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1082
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1083
  \begin{enumerate}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1084
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1085
  \item An \emph{initial} refinement step \indexref{}{command}{proof}\mbox{\isa{\isacommand{proof}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} reduces a newly stated goal to a number
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1086
  of sub-goals that are to be solved later.  Facts are passed to
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1087
  \isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} for forward chaining, if so indicated by \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1088
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1089
  \item A \emph{terminal} conclusion step \indexref{}{command}{qed}\mbox{\isa{\isacommand{qed}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} is intended to solve remaining goals.  No facts are
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1090
  passed to \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1091
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1092
  \end{enumerate}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1093
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1094
  The only other (proper) way to affect pending goals in a proof body
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1095
  is by \indexref{}{command}{show}\mbox{\isa{\isacommand{show}}}, which involves an explicit statement of
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1096
  what is to be solved eventually.  Thus we avoid the fundamental
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1097
  problem of unstructured tactic scripts that consist of numerous
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1098
  consecutive goal transformations, with invisible effects.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1099
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1100
  \medskip As a general rule of thumb for good proof style, initial
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1101
  proof methods should either solve the goal completely, or constitute
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1102
  some well-understood reduction to new sub-goals.  Arbitrary
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1103
  automatic proof tools that are prone leave a large number of badly
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1104
  structured sub-goals are no help in continuing the proof document in
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1105
  an intelligible manner.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1106
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1107
  Unless given explicitly by the user, the default initial method is
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1108
  ``\indexref{}{method}{rule}\mbox{\isa{rule}}'', which applies a single standard elimination
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1109
  or introduction rule according to the topmost symbol involved.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1110
  There is no separate default terminal method.  Any remaining goals
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1111
  are always solved by assumption in the very last step.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1112
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1113
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1114
    'proof' method?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1115
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1116
    'qed' method?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1117
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1118
    'by' method method?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1119
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1120
    ('.' | '..' | 'sorry')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1121
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1122
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1123
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1124
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1125
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1126
  \item [\mbox{\isa{\isacommand{proof}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}] refines the goal by
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1127
  proof method \isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}; facts for forward chaining are
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1128
  passed if so indicated by \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1129
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1130
  \item [\mbox{\isa{\isacommand{qed}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}] refines any remaining
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1131
  goals by proof method \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} and concludes the
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1132
  sub-proof by assumption.  If the goal had been \isa{{\isachardoublequote}show{\isachardoublequote}} (or
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1133
  \isa{{\isachardoublequote}thus{\isachardoublequote}}), some pending sub-goal is solved as well by the rule
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1134
  resulting from the result \emph{exported} into the enclosing goal
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1135
  context.  Thus \isa{{\isachardoublequote}qed{\isachardoublequote}} may fail for two reasons: either \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} fails, or the resulting rule does not fit to any
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1136
  pending goal\footnote{This includes any additional ``strong''
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1137
  assumptions as introduced by \mbox{\isa{\isacommand{assume}}}.} of the enclosing
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1138
  context.  Debugging such a situation might involve temporarily
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1139
  changing \mbox{\isa{\isacommand{show}}} into \mbox{\isa{\isacommand{have}}}, or weakening the
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1140
  local context by replacing occurrences of \mbox{\isa{\isacommand{assume}}} by
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1141
  \mbox{\isa{\isacommand{presume}}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1142
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1143
  \item [\mbox{\isa{\isacommand{by}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}\ m\isactrlsub {\isadigit{2}}{\isachardoublequote}}] is a
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1144
  \emph{terminal proof}\index{proof!terminal}; it abbreviates
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1145
  \mbox{\isa{\isacommand{proof}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}~\isa{{\isachardoublequote}qed{\isachardoublequote}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}, but with backtracking across both methods.  Debugging
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1146
  an unsuccessful \mbox{\isa{\isacommand{by}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}\ m\isactrlsub {\isadigit{2}}{\isachardoublequote}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1147
  command can be done by expanding its definition; in many cases
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1148
  \mbox{\isa{\isacommand{proof}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} (or even \isa{{\isachardoublequote}apply{\isachardoublequote}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}) is already sufficient to see the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1149
  problem.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1150
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1151
  \item [``\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}''] is a \emph{default
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1152
  proof}\index{proof!default}; it abbreviates \mbox{\isa{\isacommand{by}}}~\isa{{\isachardoublequote}rule{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1153
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1154
  \item [``\mbox{\isa{\isacommand{{\isachardot}}}}''] is a \emph{trivial
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1155
  proof}\index{proof!trivial}; it abbreviates \mbox{\isa{\isacommand{by}}}~\isa{{\isachardoublequote}this{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1156
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1157
  \item [\mbox{\isa{\isacommand{sorry}}}] is a \emph{fake proof}\index{proof!fake}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1158
  pretending to solve the pending claim without further ado.  This
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1159
  only works in interactive development, or if the \verb|quick_and_dirty| flag is enabled (in ML).  Facts emerging from fake
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1160
  proofs are not the real thing.  Internally, each theorem container
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1161
  is tainted by an oracle invocation, which is indicated as ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' in the printed result.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1162
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1163
  The most important application of \mbox{\isa{\isacommand{sorry}}} is to support
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1164
  experimentation and top-down proof development.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1165
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1166
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1167
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1168
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1169
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1170
\isamarkupsubsection{Fundamental methods and attributes \label{sec:pure-meth-att}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1171
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1172
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1173
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1174
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1175
The following proof methods and attributes refer to basic logical
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1176
  operations of Isar.  Further methods and attributes are provided by
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1177
  several generic and object-logic specific tools and packages (see
26852
a31203f58b20 misc tuning;
wenzelm
parents: 26842
diff changeset
  1178
  \chref{ch:gen-tools} and \chref{ch:hol}).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1179
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1180
  \begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1181
    \indexdef{}{method}{-}\mbox{\isa{{\isacharminus}}} & : & \isarmeth \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1182
    \indexdef{}{method}{fact}\mbox{\isa{fact}} & : & \isarmeth \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1183
    \indexdef{}{method}{assumption}\mbox{\isa{assumption}} & : & \isarmeth \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1184
    \indexdef{}{method}{this}\mbox{\isa{this}} & : & \isarmeth \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1185
    \indexdef{}{method}{rule}\mbox{\isa{rule}} & : & \isarmeth \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1186
    \indexdef{}{method}{iprover}\mbox{\isa{iprover}} & : & \isarmeth \\[0.5ex]
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1187
    \indexdef{}{attribute}{intro}\mbox{\isa{intro}} & : & \isaratt \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1188
    \indexdef{}{attribute}{elim}\mbox{\isa{elim}} & : & \isaratt \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1189
    \indexdef{}{attribute}{dest}\mbox{\isa{dest}} & : & \isaratt \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1190
    \indexdef{}{attribute}{rule}\mbox{\isa{rule}} & : & \isaratt \\[0.5ex]
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1191
    \indexdef{}{attribute}{OF}\mbox{\isa{OF}} & : & \isaratt \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1192
    \indexdef{}{attribute}{of}\mbox{\isa{of}} & : & \isaratt \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1193
    \indexdef{}{attribute}{where}\mbox{\isa{where}} & : & \isaratt \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1194
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1195
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1196
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1197
    'fact' thmrefs?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1198
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1199
    'rule' thmrefs?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1200
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1201
    'iprover' ('!' ?) (rulemod *)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1202
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1203
    rulemod: ('intro' | 'elim' | 'dest') ((('!' | () | '?') nat?) | 'del') ':' thmrefs
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1204
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1205
    ('intro' | 'elim' | 'dest') ('!' | () | '?') nat?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1206
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1207
    'rule' 'del'
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1208
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1209
    'OF' thmrefs
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1210
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1211
    'of' insts ('concl' ':' insts)?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1212
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1213
    'where' ((name | var | typefree | typevar) '=' (type | term) * 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1214
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1215
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1216
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1217
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1218
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1219
  \item [``\mbox{\isa{{\isacharminus}}}'' (minus)] does nothing but insert the
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1220
  forward chaining facts as premises into the goal.  Note that command
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1221
  \indexref{}{command}{proof}\mbox{\isa{\isacommand{proof}}} without any method actually performs a single
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1222
  reduction step using the \indexref{}{method}{rule}\mbox{\isa{rule}} method; thus a plain
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1223
  \emph{do-nothing} proof step would be ``\mbox{\isa{\isacommand{proof}}}~\isa{{\isachardoublequote}{\isacharminus}{\isachardoublequote}}'' rather than \mbox{\isa{\isacommand{proof}}} alone.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1224
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1225
  \item [\mbox{\isa{fact}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] composes
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1226
  some fact from \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}} (or implicitly from
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1227
  the current proof context) modulo unification of schematic type and
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1228
  term variables.  The rule structure is not taken into account, i.e.\
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1229
  meta-level implication is considered atomic.  This is the same
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1230
  principle underlying literal facts (cf.\ \secref{sec:syn-att}):
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1231
  ``\mbox{\isa{\isacommand{have}}}~\isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}~\mbox{\isa{\isacommand{by}}}~\isa{fact}'' is
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1232
  equivalent to ``\mbox{\isa{\isacommand{note}}}~\verb|`|\isa{{\isasymphi}}\verb|`|'' provided that \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} is an instance of some known
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1233
  \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} in the proof context.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1234
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1235
  \item [\mbox{\isa{assumption}}] solves some goal by a single assumption
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1236
  step.  All given facts are guaranteed to participate in the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1237
  refinement; this means there may be only 0 or 1 in the first place.
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1238
  Recall that \mbox{\isa{\isacommand{qed}}} (\secref{sec:proof-steps}) already
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1239
  concludes any remaining sub-goals by assumption, so structured
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1240
  proofs usually need not quote the \mbox{\isa{assumption}} method at
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1241
  all.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1242
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1243
  \item [\mbox{\isa{this}}] applies all of the current facts directly as
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1244
  rules.  Recall that ``\mbox{\isa{\isacommand{{\isachardot}}}}'' (dot) abbreviates ``\mbox{\isa{\isacommand{by}}}~\isa{this}''.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1245
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1246
  \item [\mbox{\isa{rule}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] applies some
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1247
  rule given as argument in backward manner; facts are used to reduce
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1248
  the rule before applying it to the goal.  Thus \mbox{\isa{rule}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1249
  without facts is plain introduction, while with facts it becomes
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1250
  elimination.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1251
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1252
  When no arguments are given, the \mbox{\isa{rule}} method tries to pick
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1253
  appropriate rules automatically, as declared in the current context
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1254
  using the \mbox{\isa{intro}}, \mbox{\isa{elim}}, \mbox{\isa{dest}}
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1255
  attributes (see below).  This is the default behavior of \mbox{\isa{\isacommand{proof}}} and ``\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}'' (double-dot) steps (see
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1256
  \secref{sec:proof-steps}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1257
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1258
  \item [\mbox{\isa{iprover}}] performs intuitionistic proof search,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1259
  depending on specifically declared rules from the context, or given
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1260
  as explicit arguments.  Chained facts are inserted into the goal
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1261
  before commencing proof search; ``\mbox{\isa{iprover}}\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' 
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1262
  means to include the current \mbox{\isa{prems}} as well.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1263
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1264
  Rules need to be classified as \mbox{\isa{intro}}, \mbox{\isa{elim}}, or \mbox{\isa{dest}}; here the ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' indicator
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1265
  refers to ``safe'' rules, which may be applied aggressively (without
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1266
  considering back-tracking later).  Rules declared with ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'' are ignored in proof search (the single-step \mbox{\isa{rule}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1267
  method still observes these).  An explicit weight annotation may be
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1268
  given as well; otherwise the number of rule premises will be taken
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1269
  into account here.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1270
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1271
  \item [\mbox{\isa{intro}}, \mbox{\isa{elim}}, and \mbox{\isa{dest}}]
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1272
  declare introduction, elimination, and destruct rules, to be used
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1273
  with the \mbox{\isa{rule}} and \mbox{\isa{iprover}} methods.  Note that
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1274
  the latter will ignore rules declared with ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'', while
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1275
  ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}''  are used most aggressively.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1276
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1277
  The classical reasoner (see \secref{sec:classical}) introduces its
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1278
  own variants of these attributes; use qualified names to access the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1279
  present versions of Isabelle/Pure, i.e.\ \mbox{\isa{Pure{\isachardot}intro}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1280
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1281
  \item [\mbox{\isa{rule}}~\isa{del}] undeclares introduction,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1282
  elimination, or destruct rules.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1283
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1284
  \item [\mbox{\isa{OF}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] applies some
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1285
  theorem to all of the given rules \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}}
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1286
  (in parallel).  This corresponds to the \verb|"op MRS"| operation in
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1287
  ML, but note the reversed order.  Positions may be effectively
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1288
  skipped by including ``\isa{{\isacharunderscore}}'' (underscore) as argument.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1289
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1290
  \item [\mbox{\isa{of}}~\isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}\ {\isasymdots}\ t\isactrlsub n{\isachardoublequote}}] performs
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1291
  positional instantiation of term variables.  The terms \isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ t\isactrlsub n{\isachardoublequote}} are substituted for any schematic
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1292
  variables occurring in a theorem from left to right; ``\isa{{\isacharunderscore}}'' (underscore) indicates to skip a position.  Arguments following
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1293
  a ``\mbox{\isa{\isakeyword{concl}}}\isa{{\isachardoublequote}{\isacharcolon}{\isachardoublequote}}'' specification refer to positions
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1294
  of the conclusion of a rule.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1295
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1296
  \item [\mbox{\isa{where}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isacharequal}\ t\isactrlsub {\isadigit{1}}\ {\isasymAND}\ {\isasymdots}\ x\isactrlsub n\ {\isacharequal}\ t\isactrlsub n{\isachardoublequote}}] performs named instantiation of schematic
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1297
  type and term variables occurring in a theorem.  Schematic variables
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1298
  have to be specified on the left-hand side (e.g.\ \isa{{\isachardoublequote}{\isacharquery}x{\isadigit{1}}{\isachardot}{\isadigit{3}}{\isachardoublequote}}).
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1299
  The question mark may be omitted if the variable name is a plain
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1300
  identifier without index.  As type instantiations are inferred from
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1301
  term instantiations, explicit type instantiations are seldom
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1302
  necessary.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1303
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1304
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1305
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1306
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1307
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1308
\isamarkupsubsection{Term abbreviations \label{sec:term-abbrev}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1309
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1310
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1311
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1312
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1313
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1314
    \indexdef{}{command}{let}\mbox{\isa{\isacommand{let}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1315
    \indexdef{}{keyword}{is}\mbox{\isa{\isakeyword{is}}} & : & syntax \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1316
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1317
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1318
  Abbreviations may be either bound by explicit \mbox{\isa{\isacommand{let}}}~\isa{{\isachardoublequote}p\ {\isasymequiv}\ t{\isachardoublequote}} statements, or by annotating assumptions or
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1319
  goal statements with a list of patterns ``\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}''.  In both cases, higher-order matching is invoked to
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1320
  bind extra-logical term variables, which may be either named
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1321
  schematic variables of the form \isa{{\isacharquery}x}, or nameless dummies
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1322
  ``\mbox{\isa{{\isacharunderscore}}}'' (underscore). Note that in the \mbox{\isa{\isacommand{let}}}
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1323
  form the patterns occur on the left-hand side, while the \mbox{\isa{\isakeyword{is}}} patterns are in postfix position.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1324
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1325
  Polymorphism of term bindings is handled in Hindley-Milner style,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1326
  similar to ML.  Type variables referring to local assumptions or
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1327
  open goal statements are \emph{fixed}, while those of finished
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1328
  results or bound by \mbox{\isa{\isacommand{let}}} may occur in \emph{arbitrary}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1329
  instances later.  Even though actual polymorphism should be rarely
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1330
  used in practice, this mechanism is essential to achieve proper
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1331
  incremental type-inference, as the user proceeds to build up the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1332
  Isar proof text from left to right.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1333
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1334
  \medskip Term abbreviations are quite different from local
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1335
  definitions as introduced via \mbox{\isa{\isacommand{def}}} (see
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1336
  \secref{sec:proof-context}).  The latter are visible within the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1337
  logic as actual equations, while abbreviations disappear during the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1338
  input process just after type checking.  Also note that \mbox{\isa{\isacommand{def}}} does not support polymorphism.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1339
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1340
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1341
    'let' ((term + 'and') '=' term + 'and')
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1342
    ;  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1343
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1344
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1345
  The syntax of \mbox{\isa{\isakeyword{is}}} patterns follows \railnonterm{termpat}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1346
  or \railnonterm{proppat} (see \secref{sec:term-decls}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1347
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1348
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1349
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1350
  \item [\mbox{\isa{\isacommand{let}}}~\isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}\ {\isacharequal}\ t\isactrlsub {\isadigit{1}}\ {\isasymAND}\ {\isasymdots}\ p\isactrlsub n\ {\isacharequal}\ t\isactrlsub n{\isachardoublequote}}] binds any text variables in patterns \isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ p\isactrlsub n{\isachardoublequote}} by simultaneous higher-order matching
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1351
  against terms \isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ t\isactrlsub n{\isachardoublequote}}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1352
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1353
  \item [\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}] resembles \mbox{\isa{\isacommand{let}}}, but matches \isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ p\isactrlsub n{\isachardoublequote}} against the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1354
  preceding statement.  Also note that \mbox{\isa{\isakeyword{is}}} is not a
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1355
  separate command, but part of others (such as \mbox{\isa{\isacommand{assume}}},
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1356
  \mbox{\isa{\isacommand{have}}} etc.).
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1357
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1358
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1359
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1360
  Some \emph{implicit} term abbreviations\index{term abbreviations}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1361
  for goals and facts are available as well.  For any open goal,
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1362
  \indexref{}{variable}{thesis}\mbox{\isa{thesis}} refers to its object-level statement,
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1363
  abstracted over any meta-level parameters (if present).  Likewise,
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1364
  \indexref{}{variable}{this}\mbox{\isa{this}} is bound for fact statements resulting from
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1365
  assumptions or finished goals.  In case \mbox{\isa{this}} refers to
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1366
  an object-logic statement that is an application \isa{{\isachardoublequote}f\ t{\isachardoublequote}}, then
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1367
  \isa{t} is bound to the special text variable ``\mbox{\isa{{\isasymdots}}}''
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1368
  (three dots).  The canonical application of this convenience are
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1369
  calculational proofs (see \secref{sec:calculation}).%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1370
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1371
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1372
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1373
\isamarkupsubsection{Block structure%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1374
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1375
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1376
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1377
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1378
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1379
    \indexdef{}{command}{next}\mbox{\isa{\isacommand{next}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1380
    \indexdef{}{command}{\{}\mbox{\isa{\isacommand{{\isacharbraceleft}}}} & : & \isartrans{proof(state)}{proof(state)} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1381
    \indexdef{}{command}{\}}\mbox{\isa{\isacommand{{\isacharbraceright}}}} & : & \isartrans{proof(state)}{proof(state)} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1382
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1383
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1384
  While Isar is inherently block-structured, opening and closing
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1385
  blocks is mostly handled rather casually, with little explicit
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1386
  user-intervention.  Any local goal statement automatically opens
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1387
  \emph{two} internal blocks, which are closed again when concluding
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1388
  the sub-proof (by \mbox{\isa{\isacommand{qed}}} etc.).  Sections of different
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1389
  context within a sub-proof may be switched via \mbox{\isa{\isacommand{next}}},
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1390
  which is just a single block-close followed by block-open again.
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1391
  The effect of \mbox{\isa{\isacommand{next}}} is to reset the local proof context;
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1392
  there is no goal focus involved here!
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1393
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1394
  For slightly more advanced applications, there are explicit block
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1395
  parentheses as well.  These typically achieve a stronger forward
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1396
  style of reasoning.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1397
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1398
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1399
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1400
  \item [\mbox{\isa{\isacommand{next}}}] switches to a fresh block within a
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1401
  sub-proof, resetting the local context to the initial one.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1402
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1403
  \item [\mbox{\isa{\isacommand{{\isacharbraceleft}}}} and \mbox{\isa{\isacommand{{\isacharbraceright}}}}] explicitly open and close
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1404
  blocks.  Any current facts pass through ``\mbox{\isa{\isacommand{{\isacharbraceleft}}}}''
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1405
  unchanged, while ``\mbox{\isa{\isacommand{{\isacharbraceright}}}}'' causes any result to be
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1406
  \emph{exported} into the enclosing context.  Thus fixed variables
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1407
  are generalized, assumptions discharged, and local definitions
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1408
  unfolded (cf.\ \secref{sec:proof-context}).  There is no difference
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1409
  of \mbox{\isa{\isacommand{assume}}} and \mbox{\isa{\isacommand{presume}}} in this mode of
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1410
  forward reasoning --- in contrast to plain backward reasoning with
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1411
  the result exported at \mbox{\isa{\isacommand{show}}} time.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1412
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1413
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1414
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1415
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1416
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1417
\isamarkupsubsection{Emulating tactic scripts \label{sec:tactic-commands}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1418
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1419
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1420
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1421
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1422
The Isar provides separate commands to accommodate tactic-style
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1423
  proof scripts within the same system.  While being outside the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1424
  orthodox Isar proof language, these might come in handy for
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1425
  interactive exploration and debugging, or even actual tactical proof
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1426
  within new-style theories (to benefit from document preparation, for
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1427
  example).  See also \secref{sec:tactics} for actual tactics, that
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1428
  have been encapsulated as proof methods.  Proper proof methods may
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1429
  be used in scripts, too.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1430
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1431
  \begin{matharray}{rcl}
26867
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1432
    \indexdef{}{command}{apply}\mbox{\isa{\isacommand{apply}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(prove)}{proof(prove)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1433
    \indexdef{}{command}{apply\_end}\mbox{\isa{\isacommand{apply{\isacharunderscore}end}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(state)}{proof(state)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1434
    \indexdef{}{command}{done}\mbox{\isa{\isacommand{done}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(prove)}{proof(state)} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1435
    \indexdef{}{command}{defer}\mbox{\isa{\isacommand{defer}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof}{proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1436
    \indexdef{}{command}{prefer}\mbox{\isa{\isacommand{prefer}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof}{proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1437
    \indexdef{}{command}{back}\mbox{\isa{\isacommand{back}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof}{proof} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1438
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1439
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1440
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1441
    ( 'apply' | 'apply\_end' ) method
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1442
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1443
    'defer' nat?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1444
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1445
    'prefer' nat
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1446
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1447
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1448
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1449
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1450
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1451
  \item [\mbox{\isa{\isacommand{apply}}}~\isa{m}] applies proof method \isa{m}
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1452
  in initial position, but unlike \mbox{\isa{\isacommand{proof}}} it retains
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1453
  ``\isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}'' mode.  Thus consecutive method
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1454
  applications may be given just as in tactic scripts.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1455
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1456
  Facts are passed to \isa{m} as indicated by the goal's
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1457
  forward-chain mode, and are \emph{consumed} afterwards.  Thus any
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1458
  further \mbox{\isa{\isacommand{apply}}} command would always work in a purely
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1459
  backward manner.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1460
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1461
  \item [\mbox{\isa{\isacommand{apply{\isacharunderscore}end}}}~\isa{{\isachardoublequote}m{\isachardoublequote}}] applies proof method
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1462
  \isa{m} as if in terminal position.  Basically, this simulates a
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1463
  multi-step tactic script for \mbox{\isa{\isacommand{qed}}}, but may be given
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1464
  anywhere within the proof body.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1465
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1466
  No facts are passed to \mbox{\isa{m}} here.  Furthermore, the static
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1467
  context is that of the enclosing goal (as for actual \mbox{\isa{\isacommand{qed}}}).  Thus the proof method may not refer to any assumptions
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1468
  introduced in the current body, for example.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1469
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1470
  \item [\mbox{\isa{\isacommand{done}}}] completes a proof script, provided that
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1471
  the current goal state is solved completely.  Note that actual
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1472
  structured proof commands (e.g.\ ``\mbox{\isa{\isacommand{{\isachardot}}}}'' or \mbox{\isa{\isacommand{sorry}}}) may be used to conclude proof scripts as well.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1473
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1474
  \item [\mbox{\isa{\isacommand{defer}}}~\isa{n} and \mbox{\isa{\isacommand{prefer}}}~\isa{n}] shuffle the list of pending goals: \mbox{\isa{\isacommand{defer}}} puts off
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1475
  sub-goal \isa{n} to the end of the list (\isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}} by
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1476
  default), while \mbox{\isa{\isacommand{prefer}}} brings sub-goal \isa{n} to the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1477
  front.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1478
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1479
  \item [\mbox{\isa{\isacommand{back}}}] does back-tracking over the result
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1480
  sequence of the latest proof command.  Basically, any proof command
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1481
  may return multiple results.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1482
  
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1483
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1484
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1485
  Any proper Isar proof method may be used with tactic script commands
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1486
  such as \mbox{\isa{\isacommand{apply}}}.  A few additional emulations of actual
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1487
  tactics are provided as well; these would be never used in actual
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1488
  structured proofs, of course.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1489
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1490
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1491
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1492
\isamarkupsubsection{Meta-linguistic features%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1493
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1494
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1495
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1496
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1497
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1498
    \indexdef{}{command}{oops}\mbox{\isa{\isacommand{oops}}} & : & \isartrans{proof}{theory} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1499
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1500
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1501
  The \mbox{\isa{\isacommand{oops}}} command discontinues the current proof
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1502
  attempt, while considering the partial proof text as properly
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1503
  processed.  This is conceptually quite different from ``faking''
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1504
  actual proofs via \indexref{}{command}{sorry}\mbox{\isa{\isacommand{sorry}}} (see
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1505
  \secref{sec:proof-steps}): \mbox{\isa{\isacommand{oops}}} does not observe the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1506
  proof structure at all, but goes back right to the theory level.
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1507
  Furthermore, \mbox{\isa{\isacommand{oops}}} does not produce any result theorem
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1508
  --- there is no intended claim to be able to complete the proof
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1509
  anyhow.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1510
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1511
  A typical application of \mbox{\isa{\isacommand{oops}}} is to explain Isar proofs
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1512
  \emph{within} the system itself, in conjunction with the document
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1513
  preparation tools of Isabelle described in \cite{isabelle-sys}.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1514
  Thus partial or even wrong proof attempts can be discussed in a
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1515
  logically sound manner.  Note that the Isabelle {\LaTeX} macros can
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1516
  be easily adapted to print something like ``\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}'' instead of
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1517
  the keyword ``\mbox{\isa{\isacommand{oops}}}''.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1518
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1519
  \medskip The \mbox{\isa{\isacommand{oops}}} command is undo-able, unlike
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1520
  \indexref{}{command}{kill}\mbox{\isa{\isacommand{kill}}} (see \secref{sec:history}).  The effect is to
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1521
  get back to the theory just before the opening of the proof.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1522
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1523
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1524
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1525
\isamarkupsection{Other commands%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1526
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1527
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1528
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1529
\isamarkupsubsection{Diagnostics%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1530
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1531
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1532
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1533
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1534
\begin{matharray}{rcl}
26867
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1535
    \indexdef{}{command}{pr}\mbox{\isa{\isacommand{pr}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1536
    \indexdef{}{command}{thm}\mbox{\isa{\isacommand{thm}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1537
    \indexdef{}{command}{term}\mbox{\isa{\isacommand{term}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1538
    \indexdef{}{command}{prop}\mbox{\isa{\isacommand{prop}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1539
    \indexdef{}{command}{typ}\mbox{\isa{\isacommand{typ}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1540
    \indexdef{}{command}{prf}\mbox{\isa{\isacommand{prf}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1541
    \indexdef{}{command}{full\_prf}\mbox{\isa{\isacommand{full{\isacharunderscore}prf}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1542
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1543
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1544
  These diagnostic commands assist interactive development.  Note that
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1545
  \mbox{\isa{\isacommand{undo}}} does not apply here, the theory or proof
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1546
  configuration is not changed.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1547
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1548
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1549
    'pr' modes? nat? (',' nat)?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1550
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1551
    'thm' modes? thmrefs
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1552
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1553
    'term' modes? term
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1554
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1555
    'prop' modes? prop
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1556
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1557
    'typ' modes? type
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1558
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1559
    'prf' modes? thmrefs?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1560
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1561
    'full\_prf' modes? thmrefs?
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1562
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1563
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1564
    modes: '(' (name + ) ')'
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1565
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1566
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1567
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1568
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1569
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1570
  \item [\mbox{\isa{\isacommand{pr}}}~\isa{{\isachardoublequote}goals{\isacharcomma}\ prems{\isachardoublequote}}] prints the current
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1571
  proof state (if present), including the proof context, current facts
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1572
  and goals.  The optional limit arguments affect the number of goals
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1573
  and premises to be displayed, which is initially 10 for both.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1574
  Omitting limit values leaves the current setting unchanged.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1575
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1576
  \item [\mbox{\isa{\isacommand{thm}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] retrieves
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1577
  theorems from the current theory or proof context.  Note that any
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1578
  attributes included in the theorem specifications are applied to a
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1579
  temporary context derived from the current theory or proof; the
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1580
  result is discarded, i.e.\ attributes involved in \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}} do not have any permanent effect.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1581
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1582
  \item [\mbox{\isa{\isacommand{term}}}~\isa{t} and \mbox{\isa{\isacommand{prop}}}~\isa{{\isasymphi}}]
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1583
  read, type-check and print terms or propositions according to the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1584
  current theory or proof context; the inferred type of \isa{t} is
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1585
  output as well.  Note that these commands are also useful in
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1586
  inspecting the current environment of term abbreviations.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1587
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1588
  \item [\mbox{\isa{\isacommand{typ}}}~\isa{{\isasymtau}}] reads and prints types of the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1589
  meta-logic according to the current theory or proof context.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1590
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1591
  \item [\mbox{\isa{\isacommand{prf}}}] displays the (compact) proof term of the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1592
  current proof state (if present), or of the given theorems. Note
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1593
  that this requires proof terms to be switched on for the current
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1594
  object logic (see the ``Proof terms'' section of the Isabelle
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1595
  reference manual for information on how to do this).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1596
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1597
  \item [\mbox{\isa{\isacommand{full{\isacharunderscore}prf}}}] is like \mbox{\isa{\isacommand{prf}}}, but displays
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1598
  the full proof term, i.e.\ also displays information omitted in the
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1599
  compact proof term, which is denoted by ``\isa{{\isacharunderscore}}'' placeholders
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1600
  there.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1601
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1602
  \end{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1603
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1604
  All of the diagnostic commands above admit a list of \isa{modes}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1605
  to be specified, which is appended to the current print mode (see
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1606
  also \cite{isabelle-ref}).  Thus the output behavior may be modified
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1607
  according particular print mode features.  For example, \mbox{\isa{\isacommand{pr}}}~\isa{{\isachardoublequote}{\isacharparenleft}latex\ xsymbols\ symbols{\isacharparenright}{\isachardoublequote}} would print the current
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1608
  proof state with mathematical symbols and special characters
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1609
  represented in {\LaTeX} source, according to the Isabelle style
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1610
  \cite{isabelle-sys}.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1611
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1612
  Note that antiquotations (cf.\ \secref{sec:antiq}) provide a more
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1613
  systematic way to include formal items into the printed text
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1614
  document.%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1615
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1616
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1617
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1618
\isamarkupsubsection{Inspecting the context%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1619
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1620
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1621
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1622
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1623
\begin{matharray}{rcl}
26867
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1624
    \indexdef{}{command}{print\_commands}\mbox{\isa{\isacommand{print{\isacharunderscore}commands}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1625
    \indexdef{}{command}{print\_theory}\mbox{\isa{\isacommand{print{\isacharunderscore}theory}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1626
    \indexdef{}{command}{print\_syntax}\mbox{\isa{\isacommand{print{\isacharunderscore}syntax}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1627
    \indexdef{}{command}{print\_methods}\mbox{\isa{\isacommand{print{\isacharunderscore}methods}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1628
    \indexdef{}{command}{print\_attributes}\mbox{\isa{\isacommand{print{\isacharunderscore}attributes}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1629
    \indexdef{}{command}{print\_theorems}\mbox{\isa{\isacommand{print{\isacharunderscore}theorems}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1630
    \indexdef{}{command}{find\_theorems}\mbox{\isa{\isacommand{find{\isacharunderscore}theorems}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1631
    \indexdef{}{command}{thms\_deps}\mbox{\isa{\isacommand{thms{\isacharunderscore}deps}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1632
    \indexdef{}{command}{print\_facts}\mbox{\isa{\isacommand{print{\isacharunderscore}facts}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{proof} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1633
    \indexdef{}{command}{print\_binds}\mbox{\isa{\isacommand{print{\isacharunderscore}binds}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{proof} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1634
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1635
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1636
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1637
    'print\_theory' ( '!'?)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1638
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1639
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1640
    'find\_theorems' (('(' (nat)? ('with\_dups')? ')')?) (criterion *)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1641
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1642
    criterion: ('-'?) ('name' ':' nameref | 'intro' | 'elim' | 'dest' |
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1643
      'simp' ':' term | term)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1644
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1645
    'thm\_deps' thmrefs
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1646
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1647
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1648
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1649
  These commands print certain parts of the theory and proof context.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1650
  Note that there are some further ones available, such as for the set
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1651
  of rules declared for simplifications.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1652
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1653
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1654
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1655
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}commands}}}] prints Isabelle's outer theory
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1656
  syntax, including keywords and command.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1657
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1658
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}theory}}}] prints the main logical content of
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1659
  the theory context; the ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' option indicates extra
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1660
  verbosity.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1661
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1662
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}syntax}}}] prints the inner syntax of types
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1663
  and terms, depending on the current context.  The output can be very
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1664
  verbose, including grammar tables and syntax translation rules.  See
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1665
  \cite[\S7, \S8]{isabelle-ref} for further information on Isabelle's
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1666
  inner syntax.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1667
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1668
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}methods}}}] prints all proof methods
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1669
  available in the current theory context.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1670
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1671
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}attributes}}}] prints all attributes
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1672
  available in the current theory context.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1673
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1674
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}theorems}}}] prints theorems resulting from
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1675
  the last command.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1676
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1677
  \item [\mbox{\isa{\isacommand{find{\isacharunderscore}theorems}}}~\isa{criteria}] retrieves facts
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1678
  from the theory or proof context matching all of given search
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1679
  criteria.  The criterion \isa{{\isachardoublequote}name{\isacharcolon}\ p{\isachardoublequote}} selects all theorems
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1680
  whose fully qualified name matches pattern \isa{p}, which may
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1681
  contain ``\isa{{\isachardoublequote}{\isacharasterisk}{\isachardoublequote}}'' wildcards.  The criteria \isa{intro},
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1682
  \isa{elim}, and \isa{dest} select theorems that match the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1683
  current goal as introduction, elimination or destruction rules,
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1684
  respectively.  The criterion \isa{{\isachardoublequote}simp{\isacharcolon}\ t{\isachardoublequote}} selects all rewrite
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1685
  rules whose left-hand side matches the given term.  The criterion
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1686
  term \isa{t} selects all theorems that contain the pattern \isa{t} -- as usual, patterns may contain occurrences of the dummy
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1687
  ``\isa{{\isacharunderscore}}'', schematic variables, and type constraints.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1688
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1689
  Criteria can be preceded by ``\isa{{\isachardoublequote}{\isacharminus}{\isachardoublequote}}'' to select theorems that
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1690
  do \emph{not} match. Note that giving the empty list of criteria
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1691
  yields \emph{all} currently known facts.  An optional limit for the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1692
  number of printed facts may be given; the default is 40.  By
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1693
  default, duplicates are removed from the search result. Use
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1694
  \mbox{\isa{\isakeyword{with{\isacharunderscore}dups}}} to display duplicates.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1695
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
  1696
  \item [\mbox{\isa{\isacommand{thm{\isacharunderscore}deps}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}]
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1697
  visualizes dependencies of facts, using Isabelle's graph browser
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1698
  tool (see also \cite{isabelle-sys}).
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1699
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1700
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}facts}}}] prints all local facts of the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1701
  current context, both named and unnamed ones.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1702
  
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1703
  \item [\mbox{\isa{\isacommand{print{\isacharunderscore}binds}}}] prints all term abbreviations
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1704
  present in the context.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1705
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1706
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1707
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1708
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1709
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1710
\isamarkupsubsection{History commands \label{sec:history}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1711
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1712
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1713
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1714
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1715
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1716
    \indexdef{}{command}{undo}\mbox{\isa{\isacommand{undo}}}^{{ * }{ * }} & : & \isarkeep{\cdot} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1717
    \indexdef{}{command}{redo}\mbox{\isa{\isacommand{redo}}}^{{ * }{ * }} & : & \isarkeep{\cdot} \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1718
    \indexdef{}{command}{kill}\mbox{\isa{\isacommand{kill}}}^{{ * }{ * }} & : & \isarkeep{\cdot} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1719
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1720
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1721
  The Isabelle/Isar top-level maintains a two-stage history, for
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1722
  theory and proof state transformation.  Basically, any command can
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1723
  be undone using \mbox{\isa{\isacommand{undo}}}, excluding mere diagnostic
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1724
  elements.  Its effect may be revoked via \mbox{\isa{\isacommand{redo}}}, unless
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1725
  the corresponding \mbox{\isa{\isacommand{undo}}} step has crossed the beginning
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1726
  of a proof or theory.  The \mbox{\isa{\isacommand{kill}}} command aborts the
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1727
  current history node altogether, discontinuing a proof or even the
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1728
  whole theory.  This operation is \emph{not} undo-able.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1729
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1730
  \begin{warn}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1731
    History commands should never be used with user interfaces such as
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1732
    Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1733
    care of stepping forth and back itself.  Interfering by manual
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1734
    \mbox{\isa{\isacommand{undo}}}, \mbox{\isa{\isacommand{redo}}}, or even \mbox{\isa{\isacommand{kill}}}
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1735
    commands would quickly result in utter confusion.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1736
  \end{warn}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1737
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1738
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1739
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1740
\isamarkupsubsection{System operations%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1741
}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1742
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1743
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1744
\begin{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1745
\begin{matharray}{rcl}
26867
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1746
    \indexdef{}{command}{cd}\mbox{\isa{\isacommand{cd}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1747
    \indexdef{}{command}{pwd}\mbox{\isa{\isacommand{pwd}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1748
    \indexdef{}{command}{use\_thy}\mbox{\isa{\isacommand{use{\isacharunderscore}thy}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1749
    \indexdef{}{command}{display\_drafts}\mbox{\isa{\isacommand{display{\isacharunderscore}drafts}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
6274cf7e2b8e updated generated file;
wenzelm
parents: 26854
diff changeset
  1750
    \indexdef{}{command}{print\_drafts}\mbox{\isa{\isacommand{print{\isacharunderscore}drafts}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1751
  \end{matharray}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1752
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1753
  \begin{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1754
    ('cd' | 'use\_thy' | 'update\_thy') name
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1755
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1756
    ('display\_drafts' | 'print\_drafts') (name +)
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1757
    ;
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1758
  \end{rail}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1759
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1760
  \begin{descr}
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1761
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1762
  \item [\mbox{\isa{\isacommand{cd}}}~\isa{path}] changes the current directory
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1763
  of the Isabelle process.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1764
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1765
  \item [\mbox{\isa{\isacommand{pwd}}}] prints the current working directory.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1766
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1767
  \item [\mbox{\isa{\isacommand{use{\isacharunderscore}thy}}}~\isa{A}] preload theory \isa{A}.
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1768
  These system commands are scarcely used when working interactively,
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1769
  since loading of theories is done automatically as required.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1770
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
  1771
  \item [\mbox{\isa{\isacommand{display{\isacharunderscore}drafts}}}~\isa{paths} and \mbox{\isa{\isacommand{print{\isacharunderscore}drafts}}}~\isa{paths}] perform simple output of a given list
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1772
  of raw source files.  Only those symbols that do not require
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1773
  additional {\LaTeX} packages are displayed properly, everything else
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1774
  is left verbatim.
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1775
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1776
  \end{descr}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1777
\end{isamarkuptext}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1778
\isamarkuptrue%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1779
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1780
\isadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1781
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1782
\endisadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1783
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1784
\isatagtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1785
\isacommand{end}\isamarkupfalse%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1786
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1787
\endisatagtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1788
{\isafoldtheory}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1789
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1790
\isadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1791
%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1792
\endisadelimtheory
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1793
\isanewline
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1794
\end{isabellebody}%
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1795
%%% Local Variables:
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1796
%%% mode: latex
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1797
%%% TeX-master: "root"
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents:
diff changeset
  1798
%%% End: