doc-src/IsarRef/pure.tex
author wenzelm
Thu, 13 Jul 2000 23:08:20 +0200
changeset 9308 4adf25becaa4
parent 9273 798673f65f02
child 9471 f778551af3ed
permissions -rw-r--r--
defs: (overloaded) option;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7046
9f755ff43cff skeleton only;
wenzelm
parents:
diff changeset
     1
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
     2
\chapter{Basic Isar Language Elements}\label{ch:pure-syntax}
7167
wenzelm
parents: 7141
diff changeset
     3
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
     4
Subsequently, we introduce the main part of Pure Isar theory and proof
8547
wenzelm
parents: 8533
diff changeset
     5
commands, together with fundamental proof methods and attributes.
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
     6
Chapter~\ref{ch:gen-tools} describes further Isar elements provided by generic
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
     7
tools and packages (such as the Simplifier) that are either part of Pure
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
     8
Isabelle or pre-installed by most object logics.  Chapter~\ref{ch:hol-tools}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
     9
refers to actual object-logic specific elements of Isabelle/HOL.
7046
9f755ff43cff skeleton only;
wenzelm
parents:
diff changeset
    10
7167
wenzelm
parents: 7141
diff changeset
    11
\medskip
wenzelm
parents: 7141
diff changeset
    12
wenzelm
parents: 7141
diff changeset
    13
Isar commands may be either \emph{proper} document constructors, or
7466
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
    14
\emph{improper commands}.  Some proof methods and attributes introduced later
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
    15
are classified as improper as well.  Improper Isar language elements, which
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
    16
are subsequently marked by $^*$, are often helpful when developing proof
7981
wenzelm
parents: 7974
diff changeset
    17
documents, while their use is discouraged for the final outcome.  Typical
wenzelm
parents: 7974
diff changeset
    18
examples are diagnostic commands that print terms or theorems according to the
wenzelm
parents: 7974
diff changeset
    19
current context; other commands even emulate old-style tactical theorem
8547
wenzelm
parents: 8533
diff changeset
    20
proving.
7167
wenzelm
parents: 7141
diff changeset
    21
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    22
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    23
\section{Theory commands}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    24
7167
wenzelm
parents: 7141
diff changeset
    25
\subsection{Defining theories}\label{sec:begin-thy}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    26
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    27
\indexisarcmd{header}\indexisarcmd{theory}\indexisarcmd{end}\indexisarcmd{context}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    28
\begin{matharray}{rcl}
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    29
  \isarcmd{header} & : & \isarkeep{toplevel} \\
8510
863bc8086f62 fixed theory, context typing;
wenzelm
parents: 8485
diff changeset
    30
  \isarcmd{theory} & : & \isartrans{toplevel}{theory} \\
863bc8086f62 fixed theory, context typing;
wenzelm
parents: 8485
diff changeset
    31
  \isarcmd{context}^* & : & \isartrans{toplevel}{theory} \\
863bc8086f62 fixed theory, context typing;
wenzelm
parents: 8485
diff changeset
    32
  \isarcmd{end} & : & \isartrans{theory}{toplevel} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    33
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    34
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    35
Isabelle/Isar ``new-style'' theories are either defined via theory files or
7981
wenzelm
parents: 7974
diff changeset
    36
interactively.  Both theory-level specifications and proofs are handled
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
    37
uniformly --- occasionally definitional mechanisms even require some explicit
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
    38
proof as well.  In contrast, ``old-style'' Isabelle theories support batch
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
    39
processing only, with the proof scripts collected in separate ML files.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    40
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    41
The first actual command of any theory has to be $\THEORY$, starting a new
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    42
theory based on the merge of existing ones.  Just preceding $\THEORY$, there
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    43
may be an optional $\isarkeyword{header}$ declaration, which is relevant to
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    44
document preparation only; it acts very much like a special pre-theory markup
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    45
command (cf.\ \S\ref{sec:markup-thy} and \S\ref{sec:markup-thy}).  The theory
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    46
context may be also changed by $\CONTEXT$ without creating a new theory.  In
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    47
both cases, $\END$ concludes the theory development; it has to be the very
8547
wenzelm
parents: 8533
diff changeset
    48
last command of any theory file.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    49
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    50
\begin{rail}
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    51
  'header' text
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    52
  ;
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    53
  'theory' name '=' (name + '+') filespecs? ':'
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    54
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    55
  'context' name
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    56
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    57
  'end'
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    58
  ;;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    59
7167
wenzelm
parents: 7141
diff changeset
    60
  filespecs: 'files' ((name | parname) +);
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    61
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    62
7167
wenzelm
parents: 7141
diff changeset
    63
\begin{descr}
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    64
\item [$\isarkeyword{header}~text$] provides plain text markup just preceding
8547
wenzelm
parents: 8533
diff changeset
    65
  the formal beginning of a theory.  In actual document preparation the
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    66
  corresponding {\LaTeX} macro \verb,\isamarkupheader, may be redefined to
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    67
  produce chapter or section headings.  See also \S\ref{sec:markup-thy} and
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    68
  \S\ref{sec:markup-prf} for further markup commands.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    69
  
7981
wenzelm
parents: 7974
diff changeset
    70
\item [$\THEORY~A = B@1 + \cdots + B@n\colon$] commences a new theory $A$
wenzelm
parents: 7974
diff changeset
    71
  based on existing ones $B@1 + \cdots + B@n$.  Isabelle's theory loader
wenzelm
parents: 7974
diff changeset
    72
  system ensures that any of the base theories are properly loaded (and fully
wenzelm
parents: 7974
diff changeset
    73
  up-to-date when $\THEORY$ is executed interactively).  The optional
wenzelm
parents: 7974
diff changeset
    74
  $\isarkeyword{files}$ specification declares additional dependencies on ML
wenzelm
parents: 7974
diff changeset
    75
  files.  Unless put in parentheses, any file will be loaded immediately via
wenzelm
parents: 7974
diff changeset
    76
  $\isarcmd{use}$ (see also \S\ref{sec:ML}).  The optional ML file
wenzelm
parents: 7974
diff changeset
    77
  \texttt{$A$.ML} that may be associated with any theory should \emph{not} be
wenzelm
parents: 7974
diff changeset
    78
  included in $\isarkeyword{files}$, though.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    79
  
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    80
\item [$\CONTEXT~B$] enters an existing theory context, basically in read-only
7981
wenzelm
parents: 7974
diff changeset
    81
  mode, so only a limited set of commands may be performed without destroying
wenzelm
parents: 7974
diff changeset
    82
  the theory.  Just as for $\THEORY$, the theory loader ensures that $B$ is
wenzelm
parents: 7974
diff changeset
    83
  loaded and up-to-date.
7175
wenzelm
parents: 7167
diff changeset
    84
  
7167
wenzelm
parents: 7141
diff changeset
    85
\item [$\END$] concludes the current theory definition or context switch.
7981
wenzelm
parents: 7974
diff changeset
    86
Note that this command cannot be undone, but the whole theory definition has
wenzelm
parents: 7974
diff changeset
    87
to be retracted.
7167
wenzelm
parents: 7141
diff changeset
    88
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    89
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    90
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    91
\subsection{Theory markup commands}\label{sec:markup-thy}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    92
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    93
\indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
    94
\indexisarcmd{subsubsection}\indexisarcmd{text}\indexisarcmd{text-raw}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    95
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    96
  \isarcmd{chapter} & : & \isartrans{theory}{theory} \\
7167
wenzelm
parents: 7141
diff changeset
    97
  \isarcmd{section} & : & \isartrans{theory}{theory} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    98
  \isarcmd{subsection} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
    99
  \isarcmd{subsubsection} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   100
  \isarcmd{text} & : & \isartrans{theory}{theory} \\
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   101
  \isarcmd{text_raw} & : & \isartrans{theory}{theory} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   102
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   103
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   104
Apart from formal comments (see \S\ref{sec:comments}), markup commands provide
7981
wenzelm
parents: 7974
diff changeset
   105
a structured way to insert text into the document generated from a theory (see
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   106
\cite{isabelle-sys} for more information on Isabelle's document preparation
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   107
tools).
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   108
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   109
\railalias{textraw}{text\_raw}
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   110
\railterm{textraw}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   111
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   112
\begin{rail}
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   113
  ('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text' | textraw) text
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   114
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   115
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   116
7167
wenzelm
parents: 7141
diff changeset
   117
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   118
\item [$\isarkeyword{chapter}$, $\isarkeyword{section}$,
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   119
  $\isarkeyword{subsection}$, and $\isarkeyword{subsubsection}$] mark chapter
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   120
  and section headings.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   121
\item [$\TEXT$] specifies paragraphs of plain text, including references to
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   122
  formal entities.\footnote{The latter feature is not yet supported.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   123
    Nevertheless, any source text of the form
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   124
    ``\texttt{\at\ttlbrace$\dots$\ttrbrace}'' should be considered as reserved
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   125
    for future use.}
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   126
\item [$\isarkeyword{text_raw}$] inserts {\LaTeX} source into the output,
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   127
  without additional markup.  Thus the full range of document manipulations
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   128
  becomes available.  A typical application would be to emit
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   129
  \verb,\begin{comment}, and \verb,\end{comment}, commands to exclude certain
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   130
  parts from the final document.\footnote{This requires the \texttt{comment}
8547
wenzelm
parents: 8533
diff changeset
   131
    package to be included in {\LaTeX}, of course.}
7167
wenzelm
parents: 7141
diff changeset
   132
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   133
8684
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   134
Any of these markup elements corresponds to a {\LaTeX} command with the name
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   135
prefixed by \verb,\isamarkup,.  For the sectioning commands this is a plain
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   136
macro with a single argument, e.g.\ \verb,\isamarkupchapter{,\dots\verb,}, for
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   137
$\isarkeyword{chapter}$.  The $\isarkeyword{text}$ markup results in a
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   138
{\LaTeX} environment \verb,\begin{isamarkuptext}, {\dots}
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   139
  \verb,\end{isamarkuptext},, while $\isarkeyword{text_raw}$ causes the text
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   140
to be inserted directly into the {\LaTeX} source.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   141
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
   142
\medskip
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
   143
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
   144
Additional markup commands are available for proofs (see
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   145
\S\ref{sec:markup-prf}).  Also note that the $\isarkeyword{header}$
8684
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   146
declaration (see \S\ref{sec:begin-thy}) admits to insert section markup just
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   147
preceding the actual theory definition.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   148
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   149
7135
wenzelm
parents: 7134
diff changeset
   150
\subsection{Type classes and sorts}\label{sec:classes}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   151
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   152
\indexisarcmd{classes}\indexisarcmd{classrel}\indexisarcmd{defaultsort}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   153
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   154
  \isarcmd{classes} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   155
  \isarcmd{classrel} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   156
  \isarcmd{defaultsort} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   157
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   158
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   159
\begin{rail}
7167
wenzelm
parents: 7141
diff changeset
   160
  'classes' (classdecl comment? +)
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   161
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   162
  'classrel' nameref '<' nameref comment?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   163
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   164
  'defaultsort' sort comment?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   165
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   166
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   167
7167
wenzelm
parents: 7141
diff changeset
   168
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   169
\item [$\isarkeyword{classes}~c<\vec c$] declares class $c$ to be a subclass
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   170
  of existing classes $\vec c$.  Cyclic class structures are ruled out.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   171
\item [$\isarkeyword{classrel}~c@1<c@2$] states a subclass relation between
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   172
  existing classes $c@1$ and $c@2$.  This is done axiomatically!  The
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   173
  $\isarkeyword{instance}$ command (see \S\ref{sec:axclass}) provides a way to
7175
wenzelm
parents: 7167
diff changeset
   174
  introduce proven class relations.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   175
\item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   176
  any type variables given without sort constraints.  Usually, the default
8547
wenzelm
parents: 8533
diff changeset
   177
  sort would be only changed when defining new object-logics.
7167
wenzelm
parents: 7141
diff changeset
   178
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   179
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   180
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   181
\subsection{Primitive types and type abbreviations}\label{sec:types-pure}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   182
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   183
\indexisarcmd{typedecl}\indexisarcmd{types}\indexisarcmd{nonterminals}\indexisarcmd{arities}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   184
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   185
  \isarcmd{types} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   186
  \isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   187
  \isarcmd{nonterminals} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   188
  \isarcmd{arities} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   189
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   190
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   191
\begin{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   192
  'types' (typespec '=' type infix? comment? +)
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   193
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   194
  'typedecl' typespec infix? comment?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   195
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   196
  'nonterminals' (name +) comment?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   197
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   198
  'arities' (nameref '::' arity comment? +)
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   199
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   200
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   201
7167
wenzelm
parents: 7141
diff changeset
   202
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   203
\item [$\TYPES~(\vec\alpha)t = \tau$] introduces \emph{type synonym}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   204
  $(\vec\alpha)t$ for existing type $\tau$.  Unlike actual type definitions,
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   205
  as are available in Isabelle/HOL for example, type synonyms are just purely
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   206
  syntactic abbreviations without any logical significance.  Internally, type
7981
wenzelm
parents: 7974
diff changeset
   207
  synonyms are fully expanded.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   208
\item [$\isarkeyword{typedecl}~(\vec\alpha)t$] declares a new type constructor
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   209
  $t$, intended as an actual logical type.  Note that object-logics such as
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   210
  Isabelle/HOL override $\isarkeyword{typedecl}$ by their own version.
7175
wenzelm
parents: 7167
diff changeset
   211
\item [$\isarkeyword{nonterminals}~\vec c$] declares $0$-ary type constructors
wenzelm
parents: 7167
diff changeset
   212
  $\vec c$ to act as purely syntactic types, i.e.\ nonterminal symbols of
wenzelm
parents: 7167
diff changeset
   213
  Isabelle's inner syntax of terms or types.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   214
\item [$\isarkeyword{arities}~t::(\vec s)s$] augments Isabelle's order-sorted
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   215
  signature of types by new type constructor arities.  This is done
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   216
  axiomatically!  The $\isarkeyword{instance}$ command (see
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   217
  \S\ref{sec:axclass}) provides a way to introduce proven type arities.
7167
wenzelm
parents: 7141
diff changeset
   218
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   219
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   220
7981
wenzelm
parents: 7974
diff changeset
   221
\subsection{Constants and simple definitions}\label{sec:consts}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   222
7175
wenzelm
parents: 7167
diff changeset
   223
\indexisarcmd{consts}\indexisarcmd{defs}\indexisarcmd{constdefs}\indexoutertoken{constdecl}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   224
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   225
  \isarcmd{consts} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   226
  \isarcmd{defs} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   227
  \isarcmd{constdefs} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   228
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   229
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   230
\begin{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   231
  'consts' (constdecl +)
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   232
  ;
9308
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   233
  'defs' ('(overloaded)')? (axmdecl prop comment? +)
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   234
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   235
  'constdefs' (constdecl prop comment? +)
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   236
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   237
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   238
  constdecl: name '::' type mixfix? comment?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   239
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   240
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   241
7167
wenzelm
parents: 7141
diff changeset
   242
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   243
\item [$\CONSTS~c::\sigma$] declares constant $c$ to have any instance of type
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   244
  scheme $\sigma$.  The optional mixfix annotations may attach concrete syntax
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   245
  to the constants declared.
9308
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   246
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   247
\item [$\DEFS~name: eqn$] introduces $eqn$ as a definitional axiom for some
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   248
  existing constant.  See \cite[\S6]{isabelle-ref} for more details on the
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   249
  form of equations admitted as constant definitions.
9308
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   250
  
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   251
  The $overloaded$ option declares definitions to be potentially overloaded.
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   252
  Unless this option is given, a warning message would be issued for any
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   253
  definitional equation with a more special type than that of the
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   254
  corresponding constant declaration.
4adf25becaa4 defs: (overloaded) option;
wenzelm
parents: 9273
diff changeset
   255
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   256
\item [$\isarkeyword{constdefs}~c::\sigma~eqn$] combines declarations and
8547
wenzelm
parents: 8533
diff changeset
   257
  definitions of constants, using the canonical name $c_def$ for the
wenzelm
parents: 8533
diff changeset
   258
  definitional axiom.
7167
wenzelm
parents: 7141
diff changeset
   259
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   260
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   261
7981
wenzelm
parents: 7974
diff changeset
   262
\subsection{Syntax and translations}\label{sec:syn-trans}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   263
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   264
\indexisarcmd{syntax}\indexisarcmd{translations}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   265
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   266
  \isarcmd{syntax} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   267
  \isarcmd{translations} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   268
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   269
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   270
\begin{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   271
  'syntax' ('(' name 'output'? ')')? (constdecl +)
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   272
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   273
  'translations' (transpat ('==' | '=>' | '<=') transpat comment? +)
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   274
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   275
  transpat: ('(' nameref ')')? string
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   276
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   277
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   278
7167
wenzelm
parents: 7141
diff changeset
   279
\begin{descr}
7175
wenzelm
parents: 7167
diff changeset
   280
\item [$\isarkeyword{syntax}~(mode)~decls$] is similar to $\CONSTS~decls$,
wenzelm
parents: 7167
diff changeset
   281
  except that the actual logical signature extension is omitted.  Thus the
wenzelm
parents: 7167
diff changeset
   282
  context free grammar of Isabelle's inner syntax may be augmented in
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   283
  arbitrary ways, independently of the logic.  The $mode$ argument refers to
8547
wenzelm
parents: 8533
diff changeset
   284
  the print mode that the grammar rules belong; unless the \texttt{output}
wenzelm
parents: 8533
diff changeset
   285
  flag is given, all productions are added both to the input and output
wenzelm
parents: 8533
diff changeset
   286
  grammar.
7175
wenzelm
parents: 7167
diff changeset
   287
\item [$\isarkeyword{translations}~rules$] specifies syntactic translation
7981
wenzelm
parents: 7974
diff changeset
   288
  rules (i.e.\ \emph{macros}): parse~/ print rules (\texttt{==}), parse rules
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   289
  (\texttt{=>}), or print rules (\texttt{<=}).  Translation patterns may be
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   290
  prefixed by the syntactic category to be used for parsing; the default is
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   291
  \texttt{logic}.
7167
wenzelm
parents: 7141
diff changeset
   292
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   293
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   294
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   295
\subsection{Axioms and theorems}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   296
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   297
\indexisarcmd{axioms}\indexisarcmd{theorems}\indexisarcmd{lemmas}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   298
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   299
  \isarcmd{axioms} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   300
  \isarcmd{theorems} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   301
  \isarcmd{lemmas} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   302
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   303
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   304
\begin{rail}
7135
wenzelm
parents: 7134
diff changeset
   305
  'axioms' (axmdecl prop comment? +)
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   306
  ;
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   307
  ('theorems' | 'lemmas') (thmdef? thmrefs comment? + 'and')
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   308
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   309
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   310
7167
wenzelm
parents: 7141
diff changeset
   311
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   312
\item [$\isarkeyword{axioms}~a: \phi$] introduces arbitrary statements as
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   313
  axioms of the meta-logic.  In fact, axioms are ``axiomatic theorems'', and
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   314
  may be referred later just as any other theorem.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   315
  
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   316
  Axioms are usually only introduced when declaring new logical systems.
7175
wenzelm
parents: 7167
diff changeset
   317
  Everyday work is typically done the hard way, with proper definitions and
8547
wenzelm
parents: 8533
diff changeset
   318
  actual proven theorems.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   319
\item [$\isarkeyword{theorems}~a = \vec b$] stores lists of existing theorems.
8547
wenzelm
parents: 8533
diff changeset
   320
  Typical applications would also involve attributes, to declare Simplifier
wenzelm
parents: 8533
diff changeset
   321
  rules, for example.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   322
\item [$\isarkeyword{lemmas}$] is similar to $\isarkeyword{theorems}$, but
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   323
  tags the results as ``lemma''.
7167
wenzelm
parents: 7141
diff changeset
   324
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   325
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   326
7167
wenzelm
parents: 7141
diff changeset
   327
\subsection{Name spaces}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   328
8726
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   329
\indexisarcmd{global}\indexisarcmd{local}\indexisarcmd{hide}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   330
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   331
  \isarcmd{global} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   332
  \isarcmd{local} & : & \isartrans{theory}{theory} \\
8726
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   333
  \isarcmd{hide} & : & \isartrans{theory}{theory} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   334
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   335
8726
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   336
\begin{rail}
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   337
  'global' comment?
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   338
  ;
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   339
  'local' comment?
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   340
  ;
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   341
  'hide' name (nameref + ) comment?
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   342
  ;
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   343
\end{rail}
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   344
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   345
Isabelle organizes any kind of name declarations (of types, constants,
8547
wenzelm
parents: 8533
diff changeset
   346
theorems etc.) by separate hierarchically structured name spaces.  Normally
8726
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   347
the user does not have to control the behavior of name spaces by hand, yet the
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   348
following commands provide some way to do so.
7175
wenzelm
parents: 7167
diff changeset
   349
7167
wenzelm
parents: 7141
diff changeset
   350
\begin{descr}
wenzelm
parents: 7141
diff changeset
   351
\item [$\isarkeyword{global}$ and $\isarkeyword{local}$] change the current
wenzelm
parents: 7141
diff changeset
   352
  name declaration mode.  Initially, theories start in $\isarkeyword{local}$
wenzelm
parents: 7141
diff changeset
   353
  mode, causing all names to be automatically qualified by the theory name.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   354
  Changing this to $\isarkeyword{global}$ causes all names to be declared
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   355
  without the theory prefix, until $\isarkeyword{local}$ is declared again.
8726
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   356
  
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   357
  Note that global names are prone to get hidden accidently later, when
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   358
  qualified names of the same base name are introduced.
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   359
  
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   360
\item [$\isarkeyword{hide}~space~names$] removes declarations from a given
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   361
  name space (which may be $class$, $type$, or $const$).  Hidden objects
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   362
  remain valid within the logic, but are inaccessible from user input.  In
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   363
  output, the special qualifier ``$\mathord?\mathord?$'' is prefixed to the
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   364
  full internal name.
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   365
  
7b15f4bdd72f 'global' / 'local': comment;
wenzelm
parents: 8696
diff changeset
   366
  Unqualified (global) names may not be hidden deliberately.
7167
wenzelm
parents: 7141
diff changeset
   367
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   368
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   369
7167
wenzelm
parents: 7141
diff changeset
   370
\subsection{Incorporating ML code}\label{sec:ML}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   371
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   372
\indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{ML-command}
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   373
\indexisarcmd{ML-setup}\indexisarcmd{setup}
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   374
\indexisarcmd{method-setup}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   375
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   376
  \isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   377
  \isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   378
  \isarcmd{ML_command} & : & \isartrans{\cdot}{\cdot} \\
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   379
  \isarcmd{ML_setup} & : & \isartrans{theory}{theory} \\
7175
wenzelm
parents: 7167
diff changeset
   380
  \isarcmd{setup} & : & \isartrans{theory}{theory} \\
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   381
  \isarcmd{method_setup} & : & \isartrans{theory}{theory} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   382
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   383
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   384
\railalias{MLsetup}{ML\_setup}
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   385
\railterm{MLsetup}
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   386
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   387
\railalias{methodsetup}{method\_setup}
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   388
\railterm{methodsetup}
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   389
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   390
\railalias{MLcommand}{ML\_command}
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   391
\railterm{MLcommand}
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   392
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   393
\begin{rail}
9273
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   394
  'use' name comment?
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   395
  ;
9273
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   396
  ('ML' | MLcommand | MLsetup | 'setup') text comment?
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   397
  ;
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   398
  methodsetup name '=' text text comment?
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   399
  ;
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   400
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   401
7167
wenzelm
parents: 7141
diff changeset
   402
\begin{descr}
7175
wenzelm
parents: 7167
diff changeset
   403
\item [$\isarkeyword{use}~file$] reads and executes ML commands from $file$.
7466
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   404
  The current theory context (if present) is passed down to the ML session,
7981
wenzelm
parents: 7974
diff changeset
   405
  but may not be modified.  Furthermore, the file name is checked with the
7466
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   406
  $\isarkeyword{files}$ dependency declaration given in the theory header (see
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   407
  also \S\ref{sec:begin-thy}).
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   408
  
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   409
\item [$\isarkeyword{ML}~text$ and $\isarkeyword{ML_command}~text$] execute ML
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   410
  commands from $text$.  The theory context is passed in the same way as for
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   411
  $\isarkeyword{use}$, but may not be changed.  Note that
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
   412
  $\isarkeyword{ML_command}$ is less verbose than plain $\isarkeyword{ML}$.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   413
  
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   414
\item [$\isarkeyword{ML_setup}~text$] executes ML commands from $text$.  The
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   415
  theory context is passed down to the ML session, and fetched back
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   416
  afterwards.  Thus $text$ may actually change the theory as a side effect.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   417
  
7167
wenzelm
parents: 7141
diff changeset
   418
\item [$\isarkeyword{setup}~text$] changes the current theory context by
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   419
  applying $text$, which refers to an ML expression of type
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   420
  \texttt{(theory~->~theory)~list}.  The $\isarkeyword{setup}$ command is the
8547
wenzelm
parents: 8533
diff changeset
   421
  canonical way to initialize any object-logic specific tools and packages
wenzelm
parents: 8533
diff changeset
   422
  written in ML.
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   423
  
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   424
\item [$\isarkeyword{method_setup}~name = text~description$] defines a proof
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   425
  method in the current theory.  The given $text$ has to be an ML expression
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   426
  of type \texttt{Args.src -> Proof.context -> Proof.method}.  Parsing
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   427
  concrete method syntax from \texttt{Args.src} input can be quite tedious in
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   428
  general.  The following simple examples are for methods without any explicit
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   429
  arguments, or a list of theorems, respectively.
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   430
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   431
{\footnotesize
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   432
\begin{verbatim}
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   433
Method.no_args (Method.METHOD (fn facts => foobar_tac))
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   434
Method.thms_args (fn thms => (Method.METHOD (fn facts => foobar_tac)))
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   435
\end{verbatim}
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   436
}
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   437
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   438
Note that mere tactic emulations may ignore the \texttt{facts} parameter
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   439
above.  Proper proof methods would do something ``appropriate'' with the list
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   440
of current facts, though.  Single-rule methods usually do strict
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   441
forward-chaining (e.g.\ by using \texttt{Method.multi_resolves}), while
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   442
automatic ones just insert the facts using \texttt{Method.insert_tac} before
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   443
applying the main tactic.
7167
wenzelm
parents: 7141
diff changeset
   444
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   445
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   446
8250
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   447
\subsection{Syntax translation functions}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   448
8250
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   449
\indexisarcmd{parse-ast-translation}\indexisarcmd{parse-translation}
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   450
\indexisarcmd{print-translation}\indexisarcmd{typed-print-translation}
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   451
\indexisarcmd{print-ast-translation}\indexisarcmd{token-translation}
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   452
\begin{matharray}{rcl}
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   453
  \isarcmd{parse_ast_translation} & : & \isartrans{theory}{theory} \\
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   454
  \isarcmd{parse_translation} & : & \isartrans{theory}{theory} \\
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   455
  \isarcmd{print_translation} & : & \isartrans{theory}{theory} \\
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   456
  \isarcmd{typed_print_translation} & : & \isartrans{theory}{theory} \\
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   457
  \isarcmd{print_ast_translation} & : & \isartrans{theory}{theory} \\
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   458
  \isarcmd{token_translation} & : & \isartrans{theory}{theory} \\
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   459
\end{matharray}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   460
9273
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   461
\railalias{parseasttranslation}{parse\_ast\_translation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   462
\railterm{parseasttranslation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   463
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   464
\railalias{parsetranslation}{parse\_translation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   465
\railterm{parsetranslation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   466
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   467
\railalias{printtranslation}{print\_translation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   468
\railterm{printtranslation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   469
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   470
\railalias{typedprinttranslation}{typed\_print\_translation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   471
\railterm{typedprinttranslation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   472
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   473
\railalias{printasttranslation}{print\_ast\_translation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   474
\railterm{printasttranslation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   475
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   476
\railalias{tokentranslation}{token\_translation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   477
\railterm{tokentranslation}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   478
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   479
\begin{rail}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   480
  ( parseasttranslation | parsetranslation | printtranslation | typedprinttranslation |
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   481
  printasttranslation | tokentranslation ) text comment?
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   482
\end{rail}
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
   483
8250
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   484
Syntax translation functions written in ML admit almost arbitrary
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   485
manipulations of Isabelle's inner syntax.  Any of the above commands have a
f4029c34adef Syntax translation functions;
wenzelm
parents: 8207
diff changeset
   486
single \railqtoken{text} argument that refers to an ML expression of
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   487
appropriate type.
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   488
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   489
\begin{ttbox}
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   490
val parse_ast_translation   : (string * (ast list -> ast)) list
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   491
val parse_translation       : (string * (term list -> term)) list
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   492
val print_translation       : (string * (term list -> term)) list
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   493
val typed_print_translation :
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   494
  (string * (bool -> typ -> term list -> term)) list
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   495
val print_ast_translation   : (string * (ast list -> ast)) list
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   496
val token_translation       :
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   497
  (string * string * (string -> string * real)) list
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   498
\end{ttbox}
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   499
See \cite[\S8]{isabelle-ref} for more information on syntax transformations.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   500
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   501
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   502
\subsection{Oracles}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   503
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   504
\indexisarcmd{oracle}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   505
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   506
  \isarcmd{oracle} & : & \isartrans{theory}{theory} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   507
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   508
7175
wenzelm
parents: 7167
diff changeset
   509
Oracles provide an interface to external reasoning systems, without giving up
wenzelm
parents: 7167
diff changeset
   510
control completely --- each theorem carries a derivation object recording any
wenzelm
parents: 7167
diff changeset
   511
oracle invocation.  See \cite[\S6]{isabelle-ref} for more information.
wenzelm
parents: 7167
diff changeset
   512
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   513
\begin{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   514
  'oracle' name '=' text comment?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   515
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   516
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   517
7167
wenzelm
parents: 7141
diff changeset
   518
\begin{descr}
7175
wenzelm
parents: 7167
diff changeset
   519
\item [$\isarkeyword{oracle}~name=text$] declares oracle $name$ to be ML
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   520
  function $text$, which has to be of type
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   521
  \texttt{Sign.sg~*~Object.T~->~term}.
7167
wenzelm
parents: 7141
diff changeset
   522
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   523
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   524
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   525
\section{Proof commands}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   526
7987
wenzelm
parents: 7981
diff changeset
   527
Proof commands perform transitions of Isar/VM machine configurations, which
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   528
are block-structured, consisting of a stack of nodes with three main
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   529
components: logical proof context, current facts, and open goals.  Isar/VM
8547
wenzelm
parents: 8533
diff changeset
   530
transitions are \emph{typed} according to the following three different modes
wenzelm
parents: 8533
diff changeset
   531
of operation:
7167
wenzelm
parents: 7141
diff changeset
   532
\begin{descr}
wenzelm
parents: 7141
diff changeset
   533
\item [$proof(prove)$] means that a new goal has just been stated that is now
8547
wenzelm
parents: 8533
diff changeset
   534
  to be \emph{proven}; the next command may refine it by some proof method,
wenzelm
parents: 8533
diff changeset
   535
  and enter a sub-proof to establish the actual result.
7167
wenzelm
parents: 7141
diff changeset
   536
\item [$proof(state)$] is like an internal theory mode: the context may be
7987
wenzelm
parents: 7981
diff changeset
   537
  augmented by \emph{stating} additional assumptions, intermediate results
wenzelm
parents: 7981
diff changeset
   538
  etc.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   539
\item [$proof(chain)$] is intermediate between $proof(state)$ and
7987
wenzelm
parents: 7981
diff changeset
   540
  $proof(prove)$: existing facts (i.e.\ the contents of the special ``$this$''
wenzelm
parents: 7981
diff changeset
   541
  register) have been just picked up in order to be used when refining the
wenzelm
parents: 7981
diff changeset
   542
  goal claimed next.
7167
wenzelm
parents: 7141
diff changeset
   543
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   544
7167
wenzelm
parents: 7141
diff changeset
   545
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   546
\subsection{Proof markup commands}\label{sec:markup-prf}
7167
wenzelm
parents: 7141
diff changeset
   547
7987
wenzelm
parents: 7981
diff changeset
   548
\indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsubsect}
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   549
\indexisarcmd{txt}\indexisarcmd{txt-raw}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   550
\begin{matharray}{rcl}
8101
ae555dd9585b proof markup: any mode;
wenzelm
parents: 7988
diff changeset
   551
  \isarcmd{sect} & : & \isartrans{proof}{proof} \\
ae555dd9585b proof markup: any mode;
wenzelm
parents: 7988
diff changeset
   552
  \isarcmd{subsect} & : & \isartrans{proof}{proof} \\
ae555dd9585b proof markup: any mode;
wenzelm
parents: 7988
diff changeset
   553
  \isarcmd{subsubsect} & : & \isartrans{proof}{proof} \\
ae555dd9585b proof markup: any mode;
wenzelm
parents: 7988
diff changeset
   554
  \isarcmd{txt} & : & \isartrans{proof}{proof} \\
ae555dd9585b proof markup: any mode;
wenzelm
parents: 7988
diff changeset
   555
  \isarcmd{txt_raw} & : & \isartrans{proof}{proof} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   556
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   557
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   558
These markup commands for proof mode closely correspond to the ones of theory
8684
dfe444b748aa improved document preparation;
wenzelm
parents: 8682
diff changeset
   559
mode (see \S\ref{sec:markup-thy}).
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   560
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   561
\railalias{txtraw}{txt\_raw}
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   562
\railterm{txtraw}
7175
wenzelm
parents: 7167
diff changeset
   563
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   564
\begin{rail}
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   565
  ('sect' | 'subsect' | 'subsubsect' | 'txt' | txtraw) text
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   566
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   567
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   568
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   569
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   570
\subsection{Proof context}\label{sec:proof-context}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   571
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   572
\indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   573
\begin{matharray}{rcl}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   574
  \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   575
  \isarcmd{assume} & : & \isartrans{proof(state)}{proof(state)} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   576
  \isarcmd{presume} & : & \isartrans{proof(state)}{proof(state)} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   577
  \isarcmd{def} & : & \isartrans{proof(state)}{proof(state)} \\
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   578
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   579
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   580
The logical proof context consists of fixed variables and assumptions.  The
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   581
former closely correspond to Skolem constants, or meta-level universal
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   582
quantification as provided by the Isabelle/Pure logical framework.
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   583
Introducing some \emph{arbitrary, but fixed} variable via $\FIX x$ results in
7987
wenzelm
parents: 7981
diff changeset
   584
a local value that may be used in the subsequent proof as any other variable
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   585
or constant.  Furthermore, any result $\edrv \phi[x]$ exported from the
7987
wenzelm
parents: 7981
diff changeset
   586
context will be universally closed wrt.\ $x$ at the outermost level: $\edrv
wenzelm
parents: 7981
diff changeset
   587
\All x \phi$ (this is expressed using Isabelle's meta-variables).
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   588
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   589
Similarly, introducing some assumption $\chi$ has two effects.  On the one
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   590
hand, a local theorem is created that may be used as a fact in subsequent
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   591
proof steps.  On the other hand, any result $\chi \drv \phi$ exported from the
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   592
context becomes conditional wrt.\ the assumption: $\edrv \chi \Imp \phi$.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   593
Thus, solving an enclosing goal using such a result would basically introduce
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   594
a new subgoal stemming from the assumption.  How this situation is handled
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   595
depends on the actual version of assumption command used: while $\ASSUMENAME$
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   596
insists on solving the subgoal by unification with some premise of the goal,
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   597
$\PRESUMENAME$ leaves the subgoal unchanged in order to be proved later by the
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   598
user.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   599
7319
wenzelm
parents: 7315
diff changeset
   600
Local definitions, introduced by $\DEF{}{x \equiv t}$, are achieved by
7987
wenzelm
parents: 7981
diff changeset
   601
combining $\FIX x$ with another version of assumption that causes any
wenzelm
parents: 7981
diff changeset
   602
hypothetical equation $x \equiv t$ to be eliminated by the reflexivity rule.
wenzelm
parents: 7981
diff changeset
   603
Thus, exporting some result $x \equiv t \drv \phi[x]$ yields $\edrv \phi[t]$.
7175
wenzelm
parents: 7167
diff changeset
   604
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   605
\begin{rail}
7431
83e60a678c3a fix: vars;
wenzelm
parents: 7397
diff changeset
   606
  'fix' (vars + 'and') comment?
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   607
  ;
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   608
  ('assume' | 'presume') (assm comment? + 'and')
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   609
  ;
7175
wenzelm
parents: 7167
diff changeset
   610
  'def' thmdecl? \\ var '==' term termpat? comment?
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   611
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   612
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   613
  var: name ('::' type)?
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   614
  ;
7458
bb282845ca77 updated;
wenzelm
parents: 7431
diff changeset
   615
  vars: (name+) ('::' type)?
7431
83e60a678c3a fix: vars;
wenzelm
parents: 7397
diff changeset
   616
  ;
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   617
  assm: thmdecl? (prop proppat? +)
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   618
  ;
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   619
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   620
7167
wenzelm
parents: 7141
diff changeset
   621
\begin{descr}
8547
wenzelm
parents: 8533
diff changeset
   622
\item [$\FIX{\vec x}$] introduces local \emph{arbitrary, but fixed} variables
wenzelm
parents: 8533
diff changeset
   623
  $\vec x$.
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   624
\item [$\ASSUME{a}{\vec\phi}$ and $\PRESUME{a}{\vec\phi}$] introduce local
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   625
  theorems $\vec\phi$ by assumption.  Subsequent results applied to an
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   626
  enclosing goal (e.g.\ by $\SHOWNAME$) are handled as follows: $\ASSUMENAME$
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   627
  expects to be able to unify with existing premises in the goal, while
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   628
  $\PRESUMENAME$ leaves $\vec\phi$ as new subgoals.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   629
  
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   630
  Several lists of assumptions may be given (separated by
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   631
  $\isarkeyword{and}$); the resulting list of current facts consists of all of
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   632
  these concatenated.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   633
\item [$\DEF{a}{x \equiv t}$] introduces a local (non-polymorphic) definition.
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   634
  In results exported from the context, $x$ is replaced by $t$.  Basically,
7987
wenzelm
parents: 7981
diff changeset
   635
  $\DEF{}{x \equiv t}$ abbreviates $\FIX{x}~\ASSUME{}{x \equiv t}$, with the
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   636
  resulting hypothetical equation solved by reflexivity.
7431
83e60a678c3a fix: vars;
wenzelm
parents: 7397
diff changeset
   637
  
83e60a678c3a fix: vars;
wenzelm
parents: 7397
diff changeset
   638
  The default name for the definitional equation is $x_def$.
7167
wenzelm
parents: 7141
diff changeset
   639
\end{descr}
wenzelm
parents: 7141
diff changeset
   640
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   641
The special name $prems$\indexisarthm{prems} refers to all assumptions of the
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   642
current context as a list of theorems.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   643
7167
wenzelm
parents: 7141
diff changeset
   644
wenzelm
parents: 7141
diff changeset
   645
\subsection{Facts and forward chaining}
wenzelm
parents: 7141
diff changeset
   646
wenzelm
parents: 7141
diff changeset
   647
\indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
wenzelm
parents: 7141
diff changeset
   648
\begin{matharray}{rcl}
wenzelm
parents: 7141
diff changeset
   649
  \isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm
parents: 7141
diff changeset
   650
  \isarcmd{then} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm
parents: 7141
diff changeset
   651
  \isarcmd{from} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm
parents: 7141
diff changeset
   652
  \isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm
parents: 7141
diff changeset
   653
\end{matharray}
wenzelm
parents: 7141
diff changeset
   654
7319
wenzelm
parents: 7315
diff changeset
   655
New facts are established either by assumption or proof of local statements.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   656
Any fact will usually be involved in further proofs, either as explicit
8547
wenzelm
parents: 8533
diff changeset
   657
arguments of proof methods, or when forward chaining towards the next goal via
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   658
$\THEN$ (and variants).  Note that the special theorem name
7987
wenzelm
parents: 7981
diff changeset
   659
$this$\indexisarthm{this} refers to the most recently established facts.
7167
wenzelm
parents: 7141
diff changeset
   660
\begin{rail}
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   661
  'note' (thmdef? thmrefs comment? + 'and')
7167
wenzelm
parents: 7141
diff changeset
   662
  ;
wenzelm
parents: 7141
diff changeset
   663
  'then' comment?
wenzelm
parents: 7141
diff changeset
   664
  ;
9199
7a1a856f0571 facts: support multiple lists of arguments;
wenzelm
parents: 9030
diff changeset
   665
  ('from' | 'with') (thmrefs comment? + 'and')
7167
wenzelm
parents: 7141
diff changeset
   666
  ;
wenzelm
parents: 7141
diff changeset
   667
\end{rail}
wenzelm
parents: 7141
diff changeset
   668
wenzelm
parents: 7141
diff changeset
   669
\begin{descr}
7175
wenzelm
parents: 7167
diff changeset
   670
\item [$\NOTE{a}{\vec b}$] recalls existing facts $\vec b$, binding the result
wenzelm
parents: 7167
diff changeset
   671
  as $a$.  Note that attributes may be involved as well, both on the left and
wenzelm
parents: 7167
diff changeset
   672
  right hand sides.
7167
wenzelm
parents: 7141
diff changeset
   673
\item [$\THEN$] indicates forward chaining by the current facts in order to
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   674
  establish the goal to be claimed next.  The initial proof method invoked to
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   675
  refine that will be offered the facts to do ``anything appropriate'' (cf.\ 
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   676
  also \S\ref{sec:proof-steps}).  For example, method $rule$ (see
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   677
  \S\ref{sec:pure-meth-att}) would typically do an elimination rather than an
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   678
  introduction.  Automatic methods usually insert the facts into the goal
8547
wenzelm
parents: 8533
diff changeset
   679
  state before operation.  This provides a simple scheme to control relevance
wenzelm
parents: 8533
diff changeset
   680
  of facts in automated proof search.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   681
\item [$\FROM{\vec b}$] abbreviates $\NOTE{}{\vec b}~\THEN$; thus $\THEN$ is
7458
bb282845ca77 updated;
wenzelm
parents: 7431
diff changeset
   682
  equivalent to $\FROM{this}$.
7175
wenzelm
parents: 7167
diff changeset
   683
\item [$\WITH{\vec b}$] abbreviates $\FROM{\vec b~facts}$; thus the forward
wenzelm
parents: 7167
diff changeset
   684
  chaining is from earlier facts together with the current ones.
7167
wenzelm
parents: 7141
diff changeset
   685
\end{descr}
wenzelm
parents: 7141
diff changeset
   686
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   687
Basic proof methods (such as $rule$, see \S\ref{sec:pure-meth-att}) expect
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   688
multiple facts to be given in their proper order, corresponding to a prefix of
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   689
the premises of the rule involved.  Note that positions may be easily skipped
8547
wenzelm
parents: 8533
diff changeset
   690
using something like $\FROM{\text{\texttt{_}}~a~b}$, for example.  This
wenzelm
parents: 8533
diff changeset
   691
involves the trivial rule $\PROP\psi \Imp \PROP\psi$, which happens to be
wenzelm
parents: 8533
diff changeset
   692
bound in Isabelle/Pure as ``\texttt{_}''
wenzelm
parents: 8533
diff changeset
   693
(underscore).\indexisarthm{_@\texttt{_}}
7389
f647f463abeb '_' theorem;
wenzelm
parents: 7335
diff changeset
   694
9238
ad37b21c0dc6 added "nothing" (empty list of theorems);
wenzelm
parents: 9233
diff changeset
   695
Forward chaining with an empty list of theorems is the same as not chaining.
ad37b21c0dc6 added "nothing" (empty list of theorems);
wenzelm
parents: 9233
diff changeset
   696
Thus $\FROM{nothing}$ has no effect apart from entering $prove(chain)$ mode,
ad37b21c0dc6 added "nothing" (empty list of theorems);
wenzelm
parents: 9233
diff changeset
   697
since $nothing$\indexisarthm{nothing} is bound to the empty list of facts.
ad37b21c0dc6 added "nothing" (empty list of theorems);
wenzelm
parents: 9233
diff changeset
   698
7167
wenzelm
parents: 7141
diff changeset
   699
wenzelm
parents: 7141
diff changeset
   700
\subsection{Goal statements}
wenzelm
parents: 7141
diff changeset
   701
wenzelm
parents: 7141
diff changeset
   702
\indexisarcmd{theorem}\indexisarcmd{lemma}
wenzelm
parents: 7141
diff changeset
   703
\indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
wenzelm
parents: 7141
diff changeset
   704
\begin{matharray}{rcl}
wenzelm
parents: 7141
diff changeset
   705
  \isarcmd{theorem} & : & \isartrans{theory}{proof(prove)} \\
wenzelm
parents: 7141
diff changeset
   706
  \isarcmd{lemma} & : & \isartrans{theory}{proof(prove)} \\
7987
wenzelm
parents: 7981
diff changeset
   707
  \isarcmd{have} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
wenzelm
parents: 7981
diff changeset
   708
  \isarcmd{show} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
7167
wenzelm
parents: 7141
diff changeset
   709
  \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm
parents: 7141
diff changeset
   710
  \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm
parents: 7141
diff changeset
   711
\end{matharray}
wenzelm
parents: 7141
diff changeset
   712
7175
wenzelm
parents: 7167
diff changeset
   713
Proof mode is entered from theory mode by initial goal commands $\THEOREMNAME$
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   714
and $\LEMMANAME$.  New local goals may be claimed within proof mode as well.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   715
Four variants are available, indicating whether the result is meant to solve
8547
wenzelm
parents: 8533
diff changeset
   716
some pending goal or whether forward chaining is indicated.
7175
wenzelm
parents: 7167
diff changeset
   717
7167
wenzelm
parents: 7141
diff changeset
   718
\begin{rail}
wenzelm
parents: 7141
diff changeset
   719
  ('theorem' | 'lemma') goal
wenzelm
parents: 7141
diff changeset
   720
  ;
wenzelm
parents: 7141
diff changeset
   721
  ('have' | 'show' | 'hence' | 'thus') goal
wenzelm
parents: 7141
diff changeset
   722
  ;
wenzelm
parents: 7141
diff changeset
   723
8632
14a69a0e8679 fixed goal syntax;
wenzelm
parents: 8620
diff changeset
   724
  goal: thmdecl? prop proppat? comment?
7167
wenzelm
parents: 7141
diff changeset
   725
  ;
wenzelm
parents: 7141
diff changeset
   726
\end{rail}
wenzelm
parents: 7141
diff changeset
   727
wenzelm
parents: 7141
diff changeset
   728
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   729
\item [$\THEOREM{a}{\phi}$] enters proof mode with $\phi$ as main goal,
8547
wenzelm
parents: 8533
diff changeset
   730
  eventually resulting in some theorem $\turn \phi$ to be put back into the
wenzelm
parents: 8533
diff changeset
   731
  theory.
7987
wenzelm
parents: 7981
diff changeset
   732
\item [$\LEMMA{a}{\phi}$] is similar to $\THEOREMNAME$, but tags the result as
7167
wenzelm
parents: 7141
diff changeset
   733
  ``lemma''.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   734
\item [$\HAVE{a}{\phi}$] claims a local goal, eventually resulting in a
7167
wenzelm
parents: 7141
diff changeset
   735
  theorem with the current assumption context as hypotheses.
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   736
\item [$\SHOW{a}{\phi}$] is similar to $\HAVE{a}{\phi}$, but solves some
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   737
  pending goal with the result \emph{exported} into the corresponding context
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   738
  (cf.\ \S\ref{sec:proof-context}).
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   739
\item [$\HENCENAME$] abbreviates $\THEN~\HAVENAME$, i.e.\ claims a local goal
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   740
  to be proven by forward chaining the current facts.  Note that $\HENCENAME$
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   741
  is also equivalent to $\FROM{this}~\HAVENAME$.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   742
\item [$\THUSNAME$] abbreviates $\THEN~\SHOWNAME$.  Note that $\THUSNAME$ is
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   743
  also equivalent to $\FROM{this}~\SHOWNAME$.
7167
wenzelm
parents: 7141
diff changeset
   744
\end{descr}
wenzelm
parents: 7141
diff changeset
   745
8991
dc70b797827f case 'antecedent';
wenzelm
parents: 8947
diff changeset
   746
Note that any goal statement causes some term abbreviations (such as
dc70b797827f case 'antecedent';
wenzelm
parents: 8947
diff changeset
   747
$\Var{thesis}$, $\dots$) to be bound automatically, see also
dc70b797827f case 'antecedent';
wenzelm
parents: 8947
diff changeset
   748
\S\ref{sec:term-abbrev}.  Furthermore, the local context of a (non-atomic)
dc70b797827f case 'antecedent';
wenzelm
parents: 8947
diff changeset
   749
goal is provided via the case name $antecedent$\indexisarcase{antecedent}, see
dc70b797827f case 'antecedent';
wenzelm
parents: 8947
diff changeset
   750
also \S\ref{sec:cases}.
dc70b797827f case 'antecedent';
wenzelm
parents: 8947
diff changeset
   751
7167
wenzelm
parents: 7141
diff changeset
   752
wenzelm
parents: 7141
diff changeset
   753
\subsection{Initial and terminal proof steps}\label{sec:proof-steps}
wenzelm
parents: 7141
diff changeset
   754
7175
wenzelm
parents: 7167
diff changeset
   755
\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
wenzelm
parents: 7167
diff changeset
   756
\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
wenzelm
parents: 7167
diff changeset
   757
\begin{matharray}{rcl}
wenzelm
parents: 7167
diff changeset
   758
  \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
wenzelm
parents: 7167
diff changeset
   759
  \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
wenzelm
parents: 7167
diff changeset
   760
  \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm
parents: 7167
diff changeset
   761
  \isarcmd{.\,.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm
parents: 7167
diff changeset
   762
  \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm
parents: 7167
diff changeset
   763
  \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm
parents: 7167
diff changeset
   764
\end{matharray}
wenzelm
parents: 7167
diff changeset
   765
8547
wenzelm
parents: 8533
diff changeset
   766
Arbitrary goal refinement via tactics is considered harmful.  Properly, the
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   767
Isar framework admits proof methods to be invoked in two places only.
7167
wenzelm
parents: 7141
diff changeset
   768
\begin{enumerate}
7175
wenzelm
parents: 7167
diff changeset
   769
\item An \emph{initial} refinement step $\PROOF{m@1}$ reduces a newly stated
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   770
  goal to a number of sub-goals that are to be solved later.  Facts are passed
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   771
  to $m@1$ for forward chaining, if so indicated by $proof(chain)$ mode.
7167
wenzelm
parents: 7141
diff changeset
   772
  
7987
wenzelm
parents: 7981
diff changeset
   773
\item A \emph{terminal} conclusion step $\QED{m@2}$ is intended to solve
wenzelm
parents: 7981
diff changeset
   774
  remaining goals.  No facts are passed to $m@2$.
7167
wenzelm
parents: 7141
diff changeset
   775
\end{enumerate}
wenzelm
parents: 7141
diff changeset
   776
8547
wenzelm
parents: 8533
diff changeset
   777
The only other proper way to affect pending goals is by $\SHOWNAME$, which
wenzelm
parents: 8533
diff changeset
   778
involves an explicit statement of what is to be solved.
7167
wenzelm
parents: 7141
diff changeset
   779
7175
wenzelm
parents: 7167
diff changeset
   780
\medskip
wenzelm
parents: 7167
diff changeset
   781
7167
wenzelm
parents: 7141
diff changeset
   782
Also note that initial proof methods should either solve the goal completely,
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   783
or constitute some well-understood reduction to new sub-goals.  Arbitrary
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   784
automatic proof tools that are prone leave a large number of badly structured
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   785
sub-goals are no help in continuing the proof document in any intelligible
7987
wenzelm
parents: 7981
diff changeset
   786
way.
7167
wenzelm
parents: 7141
diff changeset
   787
7175
wenzelm
parents: 7167
diff changeset
   788
\medskip
wenzelm
parents: 7167
diff changeset
   789
8547
wenzelm
parents: 8533
diff changeset
   790
Unless given explicitly by the user, the default initial method is ``$rule$'',
wenzelm
parents: 8533
diff changeset
   791
which applies a single standard elimination or introduction rule according to
wenzelm
parents: 8533
diff changeset
   792
the topmost symbol involved.  There is no separate default terminal method.
wenzelm
parents: 8533
diff changeset
   793
Any remaining goals are always solved by assumption in the very last step.
7167
wenzelm
parents: 7141
diff changeset
   794
wenzelm
parents: 7141
diff changeset
   795
\begin{rail}
wenzelm
parents: 7141
diff changeset
   796
  'proof' interest? meth? comment?
wenzelm
parents: 7141
diff changeset
   797
  ;
wenzelm
parents: 7141
diff changeset
   798
  'qed' meth? comment?
wenzelm
parents: 7141
diff changeset
   799
  ;
wenzelm
parents: 7141
diff changeset
   800
  'by' meth meth? comment?
wenzelm
parents: 7141
diff changeset
   801
  ;
wenzelm
parents: 7141
diff changeset
   802
  ('.' | '..' | 'sorry') comment?
wenzelm
parents: 7141
diff changeset
   803
  ;
wenzelm
parents: 7141
diff changeset
   804
wenzelm
parents: 7141
diff changeset
   805
  meth: method interest?
wenzelm
parents: 7141
diff changeset
   806
  ;
wenzelm
parents: 7141
diff changeset
   807
\end{rail}
wenzelm
parents: 7141
diff changeset
   808
wenzelm
parents: 7141
diff changeset
   809
\begin{descr}
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   810
\item [$\PROOF{m@1}$] refines the goal by proof method $m@1$; facts for
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   811
  forward chaining are passed if so indicated by $proof(chain)$ mode.
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
   812
\item [$\QED{m@2}$] refines any remaining goals by proof method $m@2$ and
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   813
  concludes the sub-proof by assumption.  If the goal had been $\SHOWNAME$ (or
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   814
  $\THUSNAME$), some pending sub-goal is solved as well by the rule resulting
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   815
  from the result \emph{exported} into the enclosing goal context.  Thus
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   816
  $\QEDNAME$ may fail for two reasons: either $m@2$ fails, or the resulting
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   817
  rule does not fit to any pending goal\footnote{This includes any additional
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   818
    ``strong'' assumptions as introduced by $\ASSUMENAME$.} of the enclosing
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   819
  context.  Debugging such a situation might involve temporarily changing
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   820
  $\SHOWNAME$ into $\HAVENAME$, or weakening the local context by replacing
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   821
  some occurrences of $\ASSUMENAME$ by $\PRESUMENAME$.
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   822
\item [$\BYY{m@1}{m@2}$] is a \emph{terminal proof}\index{proof!terminal}; it
7987
wenzelm
parents: 7981
diff changeset
   823
  abbreviates $\PROOF{m@1}~\QED{m@2}$, with backtracking across both methods,
wenzelm
parents: 7981
diff changeset
   824
  though.  Debugging an unsuccessful $\BYY{m@1}{m@2}$ commands might be done
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   825
  by expanding its definition; in many cases $\PROOF{m@1}$ is already
7175
wenzelm
parents: 7167
diff changeset
   826
  sufficient to see what is going wrong.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   827
\item [``$\DDOT$''] is a \emph{default proof}\index{proof!default}; it
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   828
  abbreviates $\BY{rule}$.
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   829
\item [``$\DOT$''] is a \emph{trivial proof}\index{proof!trivial}; it
8195
af2575a5c5ae '.' == by this;
wenzelm
parents: 8101
diff changeset
   830
  abbreviates $\BY{this}$.
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   831
\item [$\SORRY$] is a \emph{fake proof}\index{proof!fake}; provided that the
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
   832
  \texttt{quick_and_dirty} flag is enabled, $\SORRY$ pretends to solve the
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   833
  goal without further ado.  Of course, the result would be a fake theorem
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   834
  only, involving some oracle in its internal derivation object (this is
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   835
  indicated as ``$[!]$'' in the printed result).  The main application of
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   836
  $\SORRY$ is to support experimentation and top-down proof development.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   837
\end{descr}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   838
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   839
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   840
\subsection{Fundamental methods and attributes}\label{sec:pure-meth-att}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   841
8547
wenzelm
parents: 8533
diff changeset
   842
The following proof methods and attributes refer to basic logical operations
wenzelm
parents: 8533
diff changeset
   843
of Isar.  Further methods and attributes are provided by several generic and
wenzelm
parents: 8533
diff changeset
   844
object-logic specific tools and packages (see chapters \ref{ch:gen-tools} and
wenzelm
parents: 8533
diff changeset
   845
\ref{ch:hol-tools}).
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   846
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   847
\indexisarmeth{assumption}\indexisarmeth{this}\indexisarmeth{rule}\indexisarmeth{$-$}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   848
\indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   849
\indexisaratt{OF}\indexisaratt{of}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   850
\begin{matharray}{rcl}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   851
  assumption & : & \isarmeth \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   852
  this & : & \isarmeth \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   853
  rule & : & \isarmeth \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   854
  - & : & \isarmeth \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   855
  OF & : & \isaratt \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   856
  of & : & \isaratt \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   857
  intro & : & \isaratt \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   858
  elim & : & \isaratt \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   859
  dest & : & \isaratt \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   860
  delrule & : & \isaratt \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   861
\end{matharray}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   862
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   863
\begin{rail}
8547
wenzelm
parents: 8533
diff changeset
   864
  'rule' thmrefs?
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   865
  ;
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   866
  'OF' thmrefs
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   867
  ;
8693
feb1f9af3836 'insts' syntax;
wenzelm
parents: 8684
diff changeset
   868
  'of' insts ('concl' ':' insts)?
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   869
  ;
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   870
\end{rail}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   871
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   872
\begin{descr}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   873
\item [$assumption$] solves some goal by a single assumption step.  Any facts
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   874
  given (${} \le 1$) are guaranteed to participate in the refinement.  Recall
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   875
  that $\QEDNAME$ (see \S\ref{sec:proof-steps}) already concludes any
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   876
  remaining sub-goals by assumption.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   877
\item [$this$] applies all of the current facts directly as rules.  Recall
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   878
  that ``$\DOT$'' (dot) abbreviates $\BY{this}$.
8547
wenzelm
parents: 8533
diff changeset
   879
\item [$rule~\vec a$] applies some rule given as argument in backward manner;
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   880
  facts are used to reduce the rule before applying it to the goal.  Thus
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   881
  $rule$ without facts is plain \emph{introduction}, while with facts it
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   882
  becomes \emph{elimination}.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   883
  
8547
wenzelm
parents: 8533
diff changeset
   884
  When no arguments are given, the $rule$ method tries to pick appropriate
wenzelm
parents: 8533
diff changeset
   885
  rules automatically, as declared in the current context using the $intro$,
wenzelm
parents: 8533
diff changeset
   886
  $elim$, $dest$ attributes (see below).  This is the default behavior of
wenzelm
parents: 8533
diff changeset
   887
  $\PROOFNAME$ and ``$\DDOT$'' (double-dot) steps (see
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   888
  \S\ref{sec:proof-steps}).
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   889
\item [``$-$''] does nothing but insert the forward chaining facts as premises
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   890
  into the goal.  Note that command $\PROOFNAME$ without any method actually
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   891
  performs a single reduction step using the $rule$ method; thus a plain
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   892
  \emph{do-nothing} proof step would be $\PROOF{-}$ rather than $\PROOFNAME$
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   893
  alone.
8547
wenzelm
parents: 8533
diff changeset
   894
\item [$OF~\vec a$] applies some theorem to given rules $\vec a$ (in
wenzelm
parents: 8533
diff changeset
   895
  parallel).  This corresponds to the \texttt{MRS} operator in ML
wenzelm
parents: 8533
diff changeset
   896
  \cite[\S5]{isabelle-ref}, but note the reversed order.  Positions may be
wenzelm
parents: 8533
diff changeset
   897
  skipped by including ``$\_$'' (underscore) as argument.
wenzelm
parents: 8533
diff changeset
   898
\item [$of~\vec t$] performs positional instantiation.  The terms $\vec t$ are
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   899
  substituted for any schematic variables occurring in a theorem from left to
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   900
  right; ``\texttt{_}'' (underscore) indicates to skip a position.  Arguments
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   901
  following a ``$concl\colon$'' specification refer to positions of the
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   902
  conclusion of a rule.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   903
\item [$intro$, $elim$, and $dest$] declare introduction, elimination, and
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   904
  destruct rules, respectively.  Note that the classical reasoner (see
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   905
  \S\ref{sec:classical-basic}) introduces different versions of these
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   906
  attributes, and the $rule$ method, too.  In object-logics with classical
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   907
  reasoning enabled, the latter version should be used all the time to avoid
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   908
  confusion!
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
   909
\item [$delrule$] undeclares introduction or elimination rules.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   910
\end{descr}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   911
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   912
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   913
\subsection{Term abbreviations}\label{sec:term-abbrev}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   914
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   915
\indexisarcmd{let}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   916
\begin{matharray}{rcl}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   917
  \isarcmd{let} & : & \isartrans{proof(state)}{proof(state)} \\
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   918
  \isarkeyword{is} & : & syntax \\
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   919
\end{matharray}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   920
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   921
Abbreviations may be either bound by explicit $\LET{p \equiv t}$ statements,
7987
wenzelm
parents: 7981
diff changeset
   922
or by annotating assumptions or goal statements with a list of patterns
wenzelm
parents: 7981
diff changeset
   923
$\ISS{p@1\;\dots}{p@n}$.  In both cases, higher-order matching is invoked to
wenzelm
parents: 7981
diff changeset
   924
bind extra-logical term variables, which may be either named schematic
wenzelm
parents: 7981
diff changeset
   925
variables of the form $\Var{x}$, or nameless dummies ``\texttt{_}''
wenzelm
parents: 7981
diff changeset
   926
(underscore).\indexisarvar{_@\texttt{_}} Note that in the $\LETNAME$ form the
wenzelm
parents: 7981
diff changeset
   927
patterns occur on the left-hand side, while the $\ISNAME$ patterns are in
wenzelm
parents: 7981
diff changeset
   928
postfix position.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   929
8620
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   930
Polymorphism of term bindings is handled in Hindley-Milner style, as in ML.
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   931
Type variables referring to local assumptions or open goal statements are
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   932
\emph{fixed}, while those of finished results or bound by $\LETNAME$ may occur
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   933
in \emph{arbitrary} instances later.  Even though actual polymorphism should
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   934
be rarely used in practice, this mechanism is essential to achieve proper
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   935
incremental type-inference, as the user proceeds to build up the Isar proof
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   936
text.
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   937
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   938
\medskip
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   939
7319
wenzelm
parents: 7315
diff changeset
   940
Term abbreviations are quite different from actual local definitions as
wenzelm
parents: 7315
diff changeset
   941
introduced via $\DEFNAME$ (see \S\ref{sec:proof-context}).  The latter are
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   942
visible within the logic as actual equations, while abbreviations disappear
8620
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   943
during the input process just after type checking.  Also note that $\DEFNAME$
3786d47f5570 support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents: 8547
diff changeset
   944
does not support polymorphism.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   945
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   946
\begin{rail}
8664
aa383eeb3359 'let': replaced 'as' by 'and';
wenzelm
parents: 8632
diff changeset
   947
  'let' ((term + 'and') '=' term comment? + 'and')
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   948
  ;  
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   949
\end{rail}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   950
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   951
The syntax of $\ISNAME$ patterns follows \railnonterm{termpat} or
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   952
\railnonterm{proppat} (see \S\ref{sec:term-pats}).
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   953
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   954
\begin{descr}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   955
\item [$\LET{\vec p = \vec t}$] binds any text variables in patters $\vec p$
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   956
  by simultaneous higher-order matching against terms $\vec t$.
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   957
\item [$\IS{\vec p}$] resembles $\LETNAME$, but matches $\vec p$ against the
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   958
  preceding statement.  Also note that $\ISNAME$ is not a separate command,
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   959
  but part of others (such as $\ASSUMENAME$, $\HAVENAME$ etc.).
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   960
\end{descr}
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   961
7988
wenzelm
parents: 7987
diff changeset
   962
A few \emph{automatic} term abbreviations\index{term abbreviations} for goals
wenzelm
parents: 7987
diff changeset
   963
and facts are available as well.  For any open goal,
7466
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   964
$\Var{thesis_prop}$\indexisarvar{thesis-prop} refers to the full proposition
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   965
(which may be a rule), $\Var{thesis_concl}$\indexisarvar{thesis-concl} to its
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   966
(atomic) conclusion, and $\Var{thesis}$\indexisarvar{thesis} to its
8547
wenzelm
parents: 8533
diff changeset
   967
object-level statement.  The latter two abstract over any meta-level
7987
wenzelm
parents: 7981
diff changeset
   968
parameters.
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   969
7466
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   970
Fact statements resulting from assumptions or finished goals are bound as
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   971
$\Var{this_prop}$\indexisarvar{this-prop},
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   972
$\Var{this_concl}$\indexisarvar{this-concl}, and
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   973
$\Var{this}$\indexisarvar{this}, similar to $\Var{thesis}$ above.  In case
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   974
$\Var{this}$ refers to an object-logic statement that is an application
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
   975
$f(t)$, then $t$ is bound to the special text variable
7466
7df66ce6508a updated;
wenzelm
parents: 7458
diff changeset
   976
``$\dots$''\indexisarvar{\dots} (three dots).  The canonical application of
7987
wenzelm
parents: 7981
diff changeset
   977
the latter are calculational proofs (see \S\ref{sec:calculation}).
7315
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   978
76a39a3784b5 checkpoint;
wenzelm
parents: 7175
diff changeset
   979
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   980
\subsection{Block structure}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
   981
8896
c80aba8c1d5e replaced {{ }} by { };
wenzelm
parents: 8883
diff changeset
   982
\indexisarcmd{next}\indexisarcmd{\{}\indexisarcmd{\}}
7397
wenzelm
parents: 7389
diff changeset
   983
\begin{matharray}{rcl}
8448
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
   984
  \NEXT & : & \isartrans{proof(state)}{proof(state)} \\
7974
34245feb6e82 improved;
wenzelm
parents: 7895
diff changeset
   985
  \BG & : & \isartrans{proof(state)}{proof(state)} \\
34245feb6e82 improved;
wenzelm
parents: 7895
diff changeset
   986
  \EN & : & \isartrans{proof(state)}{proof(state)} \\
7397
wenzelm
parents: 7389
diff changeset
   987
\end{matharray}
wenzelm
parents: 7389
diff changeset
   988
9030
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   989
\railalias{lbrace}{\ttlbrace}
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   990
\railterm{lbrace}
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   991
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   992
\railalias{rbrace}{\ttrbrace}
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   993
\railterm{rbrace}
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   994
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   995
\begin{rail}
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   996
  'next' comment?
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   997
  ;
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   998
  lbrace comment?
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
   999
  ;
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
  1000
  rbrace comment?
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
  1001
  ;
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
  1002
\end{rail}
bb7622789bf2 'next', '{', '}': comment;
wenzelm
parents: 9006
diff changeset
  1003
7167
wenzelm
parents: 7141
diff changeset
  1004
While Isar is inherently block-structured, opening and closing blocks is
wenzelm
parents: 7141
diff changeset
  1005
mostly handled rather casually, with little explicit user-intervention.  Any
wenzelm
parents: 7141
diff changeset
  1006
local goal statement automatically opens \emph{two} blocks, which are closed
wenzelm
parents: 7141
diff changeset
  1007
again when concluding the sub-proof (by $\QEDNAME$ etc.).  Sections of
8448
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1008
different context within a sub-proof may be switched via $\NEXT$, which is
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1009
just a single block-close followed by block-open again.  Thus the effect of
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1010
$\NEXT$ to reset the local proof context. There is no goal focus involved
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1011
here!
7167
wenzelm
parents: 7141
diff changeset
  1012
7175
wenzelm
parents: 7167
diff changeset
  1013
For slightly more advanced applications, there are explicit block parentheses
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1014
as well.  These typically achieve a stronger forward style of reasoning.
7167
wenzelm
parents: 7141
diff changeset
  1015
wenzelm
parents: 7141
diff changeset
  1016
\begin{descr}
8448
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1017
\item [$\NEXT$] switches to a fresh block within a sub-proof, resetting the
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1018
  local context to the initial one.
8896
c80aba8c1d5e replaced {{ }} by { };
wenzelm
parents: 8883
diff changeset
  1019
\item [$\BG$ and $\EN$] explicitly open and close blocks.  Any current facts
c80aba8c1d5e replaced {{ }} by { };
wenzelm
parents: 8883
diff changeset
  1020
  pass through ``$\BG$'' unchanged, while ``$\EN$'' causes any result to be
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1021
  \emph{exported} into the enclosing context.  Thus fixed variables are
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1022
  generalized, assumptions discharged, and local definitions unfolded (cf.\ 
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1023
  \S\ref{sec:proof-context}).  There is no difference of $\ASSUMENAME$ and
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1024
  $\PRESUMENAME$ in this mode of forward reasoning --- in contrast to plain
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1025
  backward reasoning with the result exported at $\SHOWNAME$ time.
7167
wenzelm
parents: 7141
diff changeset
  1026
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1027
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1028
8533
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1029
\subsection{Emulating tactic scripts}\label{sec:tactical-proof}
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1030
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1031
The following elements emulate unstructured tactic scripts to some extent.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1032
While these are anathema for writing proper Isar proof documents, they might
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1033
come in handy for interactive exploration and debugging, or even actual
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1034
tactical proof within new-style theories (to benefit from document
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1035
preparation, for example).
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1036
8946
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1037
\indexisarcmd{apply}\indexisarcmd{done}\indexisarcmd{apply-end}
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1038
\indexisarcmd{defer}\indexisarcmd{prefer}\indexisarcmd{back}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1039
\begin{matharray}{rcl}
8533
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1040
  \isarcmd{apply}^* & : & \isartrans{proof(prove)}{proof(prove)} \\
8946
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1041
  \isarcmd{done}^* & : & \isartrans{proof(prove)}{proof(state)} \\
8533
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1042
  \isarcmd{apply_end}^* & : & \isartrans{proof(state)}{proof(state)} \\
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1043
  \isarcmd{defer}^* & : & \isartrans{proof}{proof} \\
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1044
  \isarcmd{prefer}^* & : & \isartrans{proof}{proof} \\
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1045
  \isarcmd{back}^* & : & \isartrans{proof}{proof} \\
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1046
\end{matharray}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1047
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1048
\railalias{applyend}{apply\_end}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1049
\railterm{applyend}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1050
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1051
\begin{rail}
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
  1052
  'apply' method comment?
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1053
  ;
8946
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1054
  'done' comment?
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1055
  ;
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
  1056
  applyend method comment?
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1057
  ;
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
  1058
  'defer' nat? comment?
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1059
  ;
8682
82ebf8618e6b added 'ML_command';
wenzelm
parents: 8664
diff changeset
  1060
  'prefer' nat comment?
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1061
  ;
9273
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
  1062
  'back' comment?
798673f65f02 allow comment in more commands;
wenzelm
parents: 9238
diff changeset
  1063
  ;
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1064
\end{rail}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1065
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1066
\begin{descr}
8547
wenzelm
parents: 8533
diff changeset
  1067
\item [$\isarkeyword{apply}~(m)$] applies proof method $m$ in initial
wenzelm
parents: 8533
diff changeset
  1068
  position, but unlike $\PROOFNAME$ it retains ``$proof(prove)$'' mode.  Thus
8946
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1069
  consecutive method applications may be given just as in tactic scripts.
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1070
  
8881
0467dd0d66ff 'apply' consumes facts;
wenzelm
parents: 8726
diff changeset
  1071
  Facts are passed to $m$ as indicated by the goal's forward-chain mode, and
0467dd0d66ff 'apply' consumes facts;
wenzelm
parents: 8726
diff changeset
  1072
  are \emph{consumed} afterwards.  Thus any further $\isarkeyword{apply}$
0467dd0d66ff 'apply' consumes facts;
wenzelm
parents: 8726
diff changeset
  1073
  command would always work in a purely backward manner.
8946
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1074
  
40e06237934c "done" command;
wenzelm
parents: 8896
diff changeset
  1075
\item [$\isarkeyword{done}$] completes a proof script, provided that the
8947
wenzelm
parents: 8946
diff changeset
  1076
  current goal state is already solved completely.  Note that actual
wenzelm
parents: 8946
diff changeset
  1077
  structured proof commands (e.g.\ ``$\DOT$'' or $\SORRY$) may be used to
wenzelm
parents: 8946
diff changeset
  1078
  conclude proof scripts as well.
8881
0467dd0d66ff 'apply' consumes facts;
wenzelm
parents: 8726
diff changeset
  1079
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1080
\item [$\isarkeyword{apply_end}~(m)$] applies proof method $m$ as if in
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1081
  terminal position.  Basically, this simulates a multi-step tactic script for
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1082
  $\QEDNAME$, but may be given anywhere within the proof body.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1083
  
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1084
  No facts are passed to $m$.  Furthermore, the static context is that of the
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1085
  enclosing goal (as for actual $\QEDNAME$).  Thus the proof method may not
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1086
  refer to any assumptions introduced in the current body, for example.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1087
\item [$\isarkeyword{defer}~n$ and $\isarkeyword{prefer}~n$] shuffle the list
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1088
  of pending goals: $defer$ puts off goal $n$ to the end of the list ($n = 1$
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1089
  by default), while $prefer$ brings goal $n$ to the top.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1090
\item [$\isarkeyword{back}$] does back-tracking over the result sequence of
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1091
  the latest proof command.\footnote{Unlike the ML function \texttt{back}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1092
    \cite{isabelle-ref}, the Isar command does not search upwards for further
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1093
    branch points.} Basically, any proof command may return multiple results.
9006
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1094
\end{descr}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1095
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1096
Any proper Isar proof method may be used with tactic script commands such as
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1097
$\isarkeyword{apply}$.  A few additional emulations of actual tactics are
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1098
provided as well; these would be never used in actual structured proofs, of
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1099
course.
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1100
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1101
\indexisarmeth{tactic}\indexisarmeth{insert}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1102
\indexisarmeth{res-inst-tac}\indexisarmeth{eres-inst-tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1103
\indexisarmeth{dres-inst-tac}\indexisarmeth{forw-inst-tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1104
\indexisarmeth{subgoal-tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1105
\begin{matharray}{rcl}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1106
  tactic^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1107
  insert^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1108
  res_inst_tac^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1109
  eres_inst_tac^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1110
  dres_inst_tac^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1111
  forw_inst_tac^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1112
  subgoal_tac^* & : & \isarmeth \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1113
\end{matharray}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1114
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1115
\railalias{resinsttac}{res\_inst\_tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1116
\railterm{resinsttac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1117
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1118
\railalias{eresinsttac}{eres\_inst\_tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1119
\railterm{eresinsttac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1120
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1121
\railalias{dresinsttac}{dres\_inst\_tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1122
\railterm{dresinsttac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1123
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1124
\railalias{forwinsttac}{forw\_inst\_tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1125
\railterm{forwinsttac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1126
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1127
\railalias{subgoaltac}{subgoal\_tac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1128
\railterm{subgoaltac}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1129
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1130
\begin{rail}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1131
  'tactic' text
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1132
  ;
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1133
  'insert' thmrefs
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1134
  ;
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1135
  ( resinsttac | eresinsttac | dresinsttac | forwinsttac ) goalspec? \\
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1136
    ((name '=' term) + 'and') 'in' thmref
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1137
  ;
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1138
  subgoaltac goalspec? prop
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1139
  ;
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1140
\end{rail}
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1141
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1142
\begin{descr}
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1143
\item [$tactic~text$] produces a proof method from any ML text of type
8547
wenzelm
parents: 8533
diff changeset
  1144
  \texttt{tactic}.  Apart from the usual ML environment and the current
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1145
  implicit theory context, the ML code may refer to the following locally
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1146
  bound values:
9006
3832cc6f4a43 tuned tactic emulation;
wenzelm
parents: 8991
diff changeset
  1147
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1148
%%FIXME ttbox produces too much trailing space (why?)
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1149
{\footnotesize\begin{verbatim}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1150
val ctxt  : Proof.context
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1151
val facts : thm list
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1152
val thm   : string -> thm
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1153
val thms  : string -> thm list
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1154
\end{verbatim}}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1155
  Here \texttt{ctxt} refers to the current proof context, \texttt{facts}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1156
  indicates any current facts for forward-chaining, and
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1157
  \texttt{thm}~/~\texttt{thms} retrieve named facts (including global
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1158
  theorems) from the context.
8696
wenzelm
parents: 8693
diff changeset
  1159
\item [$insert~\vec a$] inserts theorems as facts into all goals of the proof
wenzelm
parents: 8693
diff changeset
  1160
  state; the current facts indicated for forward chaining are ignored!
8533
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1161
\item [$res_inst_tac$ etc.] do resolution of rules with explicit
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1162
  instantiation.  This works the same way as the corresponding ML tactics, see
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1163
  \cite[\S3]{isabelle-ref}.
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1164
  
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1165
  It is very important to note that the instantiations are read and
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1166
  type-checked according to the dynamic goal state, rather than the static
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1167
  proof context!  In particular, locally fixed variables and term
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1168
  abbreviations may not be included in the term specifications.
8547
wenzelm
parents: 8533
diff changeset
  1169
\item [$subgoal_tac~\phi$] emulates the ML tactic of the same name, see
8533
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1170
  \cite[\S3]{isabelle-ref}.  Syntactically, the given proposition is handled
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1171
  as the instantiations in $res_inst_tac$ etc.
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1172
  
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1173
  Note that the proper Isar command $\PRESUMENAME$ achieves a similar effect
d534ddf14076 res_inst_tac etc.;
wenzelm
parents: 8515
diff changeset
  1174
  as $subgoal_tac$.
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1175
\end{descr}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1176
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1177
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1178
\subsection{Meta-linguistic features}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1179
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1180
\indexisarcmd{oops}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1181
\begin{matharray}{rcl}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1182
  \isarcmd{oops} & : & \isartrans{proof}{theory} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1183
\end{matharray}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1184
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1185
The $\OOPS$ command discontinues the current proof attempt, while considering
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1186
the partial proof text as properly processed.  This is conceptually quite
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1187
different from ``faking'' actual proofs via $\SORRY$ (see
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1188
\S\ref{sec:proof-steps}): $\OOPS$ does not observe the proof structure at all,
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1189
but goes back right to the theory level.  Furthermore, $\OOPS$ does not
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1190
produce any result theorem --- there is no claim to be able to complete the
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1191
proof anyhow.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1192
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1193
A typical application of $\OOPS$ is to explain Isar proofs \emph{within} the
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1194
system itself, in conjunction with the document preparation tools of Isabelle
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1195
described in \cite{isabelle-sys}.  Thus partial or even wrong proof attempts
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1196
can be discussed in a logically sound manner.  Note that the Isabelle {\LaTeX}
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1197
macros can be easily adapted to print something like ``$\dots$'' instead of an
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1198
``$\OOPS$'' keyword.
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1199
8547
wenzelm
parents: 8533
diff changeset
  1200
\medskip The $\OOPS$ command is undoable, unlike $\isarkeyword{kill}$ (see
wenzelm
parents: 8533
diff changeset
  1201
\S\ref{sec:history}).  The effect is to get back to the theory \emph{before}
wenzelm
parents: 8533
diff changeset
  1202
the opening of the proof.
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1203
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1204
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1205
\section{Other commands}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1206
8448
e7df316491d4 tuned 'case';
wenzelm
parents: 8379
diff changeset
  1207
\subsection{Diagnostics}\label{sec:diag}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1208
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1209
\indexisarcmd{pr}\indexisarcmd{thm}\indexisarcmd{term}\indexisarcmd{prop}\indexisarcmd{typ}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1210
\indexisarcmd{print-facts}\indexisarcmd{print-binds}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1211
\begin{matharray}{rcl}
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1212
  \isarcmd{pr}^* & : & \isarkeep{\cdot} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1213
  \isarcmd{thm}^* & : & \isarkeep{theory~|~proof} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1214
  \isarcmd{term}^* & : & \isarkeep{theory~|~proof} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1215
  \isarcmd{prop}^* & : & \isarkeep{theory~|~proof} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1216
  \isarcmd{typ}^* & : & \isarkeep{theory~|~proof} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1217
  \isarcmd{print_facts}^* & : & \isarkeep{proof} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1218
  \isarcmd{print_binds}^* & : & \isarkeep{proof} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1219
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1220
7335
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
  1221
These commands are not part of the actual Isabelle/Isar syntax, but assist
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
  1222
interactive development.  Also note that $undo$ does not apply here, since the
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
  1223
theory or proof configuration is not changed.
abba35b98892 draft release;
wenzelm
parents: 7321
diff changeset
  1224
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1225
\begin{rail}
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1226
  'pr' modes? nat?
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1227
  ;
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1228
  'thm' modes? thmrefs
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1229
  ;
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1230
  'term' modes? term
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1231
  ;
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1232
  'prop' modes? prop
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1233
  ;
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1234
  'typ' modes? type
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1235
  ;
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1236
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1237
  modes: '(' (name + ) ')'
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1238
  ;
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1239
\end{rail}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1240
7167
wenzelm
parents: 7141
diff changeset
  1241
\begin{descr}
8883
2a94bfd31285 'pr' now prints actual proof states only;
wenzelm
parents: 8881
diff changeset
  1242
\item [$\isarkeyword{pr}~n$] prints the current proof state (if present),
2a94bfd31285 'pr' now prints actual proof states only;
wenzelm
parents: 8881
diff changeset
  1243
  including the proof context, current facts and goals.  The optional argument
2a94bfd31285 'pr' now prints actual proof states only;
wenzelm
parents: 8881
diff changeset
  1244
  $n$ affects the implicit limit of goals to be displayed, which is initially
2a94bfd31285 'pr' now prints actual proof states only;
wenzelm
parents: 8881
diff changeset
  1245
  10.  Omitting the limit leaves the current value unchanged.
8547
wenzelm
parents: 8533
diff changeset
  1246
\item [$\isarkeyword{thm}~\vec a$] retrieves theorems from the current theory
wenzelm
parents: 8533
diff changeset
  1247
  or proof context.  Note that any attributes included in the theorem
7974
34245feb6e82 improved;
wenzelm
parents: 7895
diff changeset
  1248
  specifications are applied to a temporary context derived from the current
8547
wenzelm
parents: 8533
diff changeset
  1249
  theory or proof; the result is discarded, i.e.\ attributes involved in $\vec
wenzelm
parents: 8533
diff changeset
  1250
  a$ do not have any permanent effect.
7987
wenzelm
parents: 7981
diff changeset
  1251
\item [$\isarkeyword{term}~t$, $\isarkeyword{prop}~\phi$] read, type-check and
wenzelm
parents: 7981
diff changeset
  1252
  print terms or propositions according to the current theory or proof
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1253
  context; the inferred type of $t$ is output as well.  Note that these
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1254
  commands are also useful in inspecting the current environment of term
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1255
  abbreviations.
7974
34245feb6e82 improved;
wenzelm
parents: 7895
diff changeset
  1256
\item [$\isarkeyword{typ}~\tau$] reads and prints types of the meta-logic
34245feb6e82 improved;
wenzelm
parents: 7895
diff changeset
  1257
  according to the current theory or proof context.
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
  1258
\item [$\isarkeyword{print_facts}$] prints any named facts of the current
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
  1259
  context, including assumptions and local results.
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
  1260
\item [$\isarkeyword{print_binds}$] prints all term abbreviations present in
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
  1261
  the context.
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1262
\end{descr}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1263
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1264
The basic diagnostic commands above admit a list of $modes$ to be specified,
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1265
which is appended to the current print mode (see also \cite{isabelle-ref}).
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1266
Thus the output behavior may be modified according particular print mode
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1267
features.
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1268
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1269
For example, $\isarkeyword{pr}~(latex~xsymbols~symbols)$ would print the
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1270
current proof state with mathematical symbols and special characters
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1271
represented in {\LaTeX} source, according to the Isabelle style
8547
wenzelm
parents: 8533
diff changeset
  1272
\cite{isabelle-sys}.  The resulting text can be directly pasted into a
wenzelm
parents: 8533
diff changeset
  1273
\verb,\begin{isabelle},\dots\verb,\end{isabelle}, environment.  Note that
wenzelm
parents: 8533
diff changeset
  1274
$\isarkeyword{pr}~(latex)$ is sufficient to achieve the same output, if the
wenzelm
parents: 8533
diff changeset
  1275
current Isabelle session has the other modes already activated, say due to
wenzelm
parents: 8533
diff changeset
  1276
some particular user interface configuration such as Proof~General
8510
863bc8086f62 fixed theory, context typing;
wenzelm
parents: 8485
diff changeset
  1277
\cite{proofgeneral,Aspinall:TACAS:2000} with X-Symbol mode \cite{x-symbol}.
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1278
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1279
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1280
\subsection{History commands}\label{sec:history}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1281
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1282
\indexisarcmd{undo}\indexisarcmd{redo}\indexisarcmd{kill}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1283
\begin{matharray}{rcl}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1284
  \isarcmd{undo}^{{*}{*}} & : & \isarkeep{\cdot} \\
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1285
  \isarcmd{redo}^{{*}{*}} & : & \isarkeep{\cdot} \\
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1286
  \isarcmd{kill}^{{*}{*}} & : & \isarkeep{\cdot} \\
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1287
\end{matharray}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1288
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1289
The Isabelle/Isar top-level maintains a two-stage history, for theory and
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1290
proof state transformation.  Basically, any command can be undone using
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1291
$\isarkeyword{undo}$, excluding mere diagnostic elements.  Its effect may be
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1292
revoked via $\isarkeyword{redo}$, unless the corresponding the
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1293
$\isarkeyword{undo}$ step has crossed the beginning of a proof or theory.  The
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1294
$\isarkeyword{kill}$ command aborts the current history node altogether,
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1295
discontinuing a proof or even the whole theory.  This operation is \emph{not}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1296
undoable.
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1297
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1298
\begin{warn}
8547
wenzelm
parents: 8533
diff changeset
  1299
  History commands should never be used with user interfaces such as
wenzelm
parents: 8533
diff changeset
  1300
  Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes care of
wenzelm
parents: 8533
diff changeset
  1301
  stepping forth and back itself.  Interfering by manual $\isarkeyword{undo}$,
8510
863bc8086f62 fixed theory, context typing;
wenzelm
parents: 8485
diff changeset
  1302
  $\isarkeyword{redo}$, or even $\isarkeyword{kill}$ commands would quickly
863bc8086f62 fixed theory, context typing;
wenzelm
parents: 8485
diff changeset
  1303
  result in utter confusion.
8485
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1304
\end{warn}
80ddf678e533 moved "cases" to generic.tex;
wenzelm
parents: 8448
diff changeset
  1305
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
  1306
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1307
\subsection{System operations}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1308
7167
wenzelm
parents: 7141
diff changeset
  1309
\indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
wenzelm
parents: 7141
diff changeset
  1310
\indexisarcmd{update-thy}\indexisarcmd{update-thy-only}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1311
\begin{matharray}{rcl}
8515
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1312
  \isarcmd{cd}^* & : & \isarkeep{\cdot} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1313
  \isarcmd{pwd}^* & : & \isarkeep{\cdot} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1314
  \isarcmd{use_thy}^* & : & \isarkeep{\cdot} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1315
  \isarcmd{use_thy_only}^* & : & \isarkeep{\cdot} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1316
  \isarcmd{update_thy}^* & : & \isarkeep{\cdot} \\
160739e1f443 pure methods / atts moved here;
wenzelm
parents: 8510
diff changeset
  1317
  \isarcmd{update_thy_only}^* & : & \isarkeep{\cdot} \\
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1318
\end{matharray}
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1319
7167
wenzelm
parents: 7141
diff changeset
  1320
\begin{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1321
\item [$\isarkeyword{cd}~name$] changes the current directory of the Isabelle
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1322
  process.
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1323
\item [$\isarkeyword{pwd}~$] prints the current working directory.
7175
wenzelm
parents: 7167
diff changeset
  1324
\item [$\isarkeyword{use_thy}$, $\isarkeyword{use_thy_only}$,
7987
wenzelm
parents: 7981
diff changeset
  1325
  $\isarkeyword{update_thy}$, $\isarkeyword{update_thy_only}$] load some
7895
7c492d8bc8e3 updated;
wenzelm
parents: 7608
diff changeset
  1326
  theory given as $name$ argument.  These commands are basically the same as
7987
wenzelm
parents: 7981
diff changeset
  1327
  the corresponding ML functions\footnote{The ML versions also change the
wenzelm
parents: 7981
diff changeset
  1328
    implicit theory context to that of the theory loaded.}  (see also
wenzelm
parents: 7981
diff changeset
  1329
  \cite[\S1,\S6]{isabelle-ref}).  Note that both the ML and Isar versions may
wenzelm
parents: 7981
diff changeset
  1330
  load new- and old-style theories alike.
7167
wenzelm
parents: 7141
diff changeset
  1331
\end{descr}
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1332
7987
wenzelm
parents: 7981
diff changeset
  1333
These system commands are scarcely used when working with the Proof~General
wenzelm
parents: 7981
diff changeset
  1334
interface, since loading of theories is done fully transparently.
7134
320b412e5800 more stuff;
wenzelm
parents: 7046
diff changeset
  1335
8379
4c7659e98eb9 tuned ML types;
wenzelm
parents: 8250
diff changeset
  1336
7046
9f755ff43cff skeleton only;
wenzelm
parents:
diff changeset
  1337
%%% Local Variables: 
9f755ff43cff skeleton only;
wenzelm
parents:
diff changeset
  1338
%%% mode: latex
9f755ff43cff skeleton only;
wenzelm
parents:
diff changeset
  1339
%%% TeX-master: "isar-ref"
9f755ff43cff skeleton only;
wenzelm
parents:
diff changeset
  1340
%%% End: