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