doc-src/IsarRef/generic.tex
author oheimb
Mon, 23 Jul 2001 13:50:23 +0200
changeset 11442 8682a88c3d6a
parent 11333 d6b69fe04c1b
child 11469 57b072f00626
permissions -rw-r--r--
slight improvement for iff attribute
wenzelm@7135
     1
wenzelm@7167
     2
\chapter{Generic Tools and Packages}\label{ch:gen-tools}
wenzelm@7167
     3
wenzelm@8517
     4
\section{Axiomatic Type Classes}\label{sec:axclass}
wenzelm@7167
     5
wenzelm@8904
     6
%FIXME
wenzelm@8904
     7
% - qualified names
wenzelm@8904
     8
% - class intro rules;
wenzelm@8904
     9
% - class axioms;
wenzelm@8904
    10
wenzelm@8517
    11
\indexisarcmd{axclass}\indexisarcmd{instance}\indexisarmeth{intro-classes}
wenzelm@7167
    12
\begin{matharray}{rcl}
wenzelm@8517
    13
  \isarcmd{axclass} & : & \isartrans{theory}{theory} \\
wenzelm@8517
    14
  \isarcmd{instance} & : & \isartrans{theory}{proof(prove)} \\
wenzelm@8517
    15
  intro_classes & : & \isarmeth \\
wenzelm@7167
    16
\end{matharray}
wenzelm@7167
    17
wenzelm@8517
    18
Axiomatic type classes are provided by Isabelle/Pure as a \emph{definitional}
wenzelm@8517
    19
interface to type classes (cf.~\S\ref{sec:classes}).  Thus any object logic
wenzelm@8547
    20
may make use of this light-weight mechanism of abstract theories
wenzelm@8901
    21
\cite{Wenzel:1997:TPHOL}.  There is also a tutorial on using axiomatic type
wenzelm@8901
    22
classes in isabelle \cite{isabelle-axclass} that is part of the standard
wenzelm@8901
    23
Isabelle documentation.
wenzelm@8517
    24
wenzelm@7167
    25
\begin{rail}
wenzelm@8517
    26
  'axclass' classdecl (axmdecl prop comment? +)
wenzelm@8517
    27
  ;
wenzelm@11100
    28
  'instance' (nameref ('<' | subseteq) nameref | nameref '::' simplearity) comment?
wenzelm@7167
    29
  ;
wenzelm@7167
    30
\end{rail}
wenzelm@7167
    31
wenzelm@7167
    32
\begin{descr}
wenzelm@11100
    33
\item [$\AXCLASS~c \subseteq \vec c~axms$] defines an axiomatic type class as
wenzelm@11100
    34
  the intersection of existing classes, with additional axioms holding.  Class
wenzelm@10223
    35
  axioms may not contain more than one type variable.  The class axioms (with
wenzelm@10223
    36
  implicit sort constraints added) are bound to the given names.  Furthermore
wenzelm@10223
    37
  a class introduction rule is generated, which is employed by method
wenzelm@10223
    38
  $intro_classes$ to support instantiation proofs of this class.
wenzelm@10223
    39
  
wenzelm@11100
    40
\item [$\INSTANCE~c@1 \subseteq c@2$ and $\INSTANCE~t :: (\vec s)c$] setup a
wenzelm@11100
    41
  goal stating a class relation or type arity.  The proof would usually
wenzelm@11100
    42
  proceed by $intro_classes$, and then establish the characteristic theorems
wenzelm@11100
    43
  of the type classes involved.  After finishing the proof, the theory will be
wenzelm@11100
    44
  augmented by a type signature declaration corresponding to the resulting
wenzelm@11100
    45
  theorem.
wenzelm@8517
    46
\item [$intro_classes$] repeatedly expands all class introduction rules of
wenzelm@10858
    47
  this theory.  Note that this method usually needs not be named explicitly,
wenzelm@10858
    48
  as it is already included in the default proof step (of $\PROOFNAME$,
wenzelm@10858
    49
  $\BYNAME$, etc.).  In particular, instantiation of trivial (syntactic)
wenzelm@10858
    50
  classes may be performed by a single ``$\DDOT$'' proof step.
wenzelm@7167
    51
\end{descr}
wenzelm@7167
    52
wenzelm@7315
    53
wenzelm@7315
    54
\section{Calculational proof}\label{sec:calculation}
wenzelm@7315
    55
wenzelm@8619
    56
\indexisarcmd{also}\indexisarcmd{finally}
wenzelm@8619
    57
\indexisarcmd{moreover}\indexisarcmd{ultimately}
wenzelm@9606
    58
\indexisarcmd{print-trans-rules}\indexisaratt{trans}
wenzelm@7315
    59
\begin{matharray}{rcl}
wenzelm@7315
    60
  \isarcmd{also} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7315
    61
  \isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm@8619
    62
  \isarcmd{moreover} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@8619
    63
  \isarcmd{ultimately} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm@10154
    64
  \isarcmd{print_trans_rules}^* & : & \isarkeep{theory~|~proof} \\
wenzelm@7315
    65
  trans & : & \isaratt \\
wenzelm@7315
    66
\end{matharray}
wenzelm@7315
    67
wenzelm@7315
    68
Calculational proof is forward reasoning with implicit application of
oheimb@11332
    69
transitivity rules (such those of $=$, $\leq$, $<$).  Isabelle/Isar maintains
wenzelm@7391
    70
an auxiliary register $calculation$\indexisarthm{calculation} for accumulating
wenzelm@7897
    71
results obtained by transitivity composed with the current result.  Command
wenzelm@7897
    72
$\ALSO$ updates $calculation$ involving $this$, while $\FINALLY$ exhibits the
wenzelm@7897
    73
final $calculation$ by forward chaining towards the next goal statement.  Both
wenzelm@7897
    74
commands require valid current facts, i.e.\ may occur only after commands that
wenzelm@7897
    75
produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or some finished proof of
wenzelm@8619
    76
$\HAVENAME$, $\SHOWNAME$ etc.  The $\MOREOVER$ and $\ULTIMATELY$ commands are
wenzelm@8619
    77
similar to $\ALSO$ and $\FINALLY$, but only collect further results in
wenzelm@8619
    78
$calculation$ without applying any rules yet.
wenzelm@7315
    79
wenzelm@7315
    80
Also note that the automatic term abbreviation ``$\dots$'' has its canonical
wenzelm@8619
    81
application with calculational proofs.  It refers to the argument\footnote{The
wenzelm@8619
    82
  argument of a curried infix expression is its right-hand side.} of the
wenzelm@8619
    83
preceding statement.
wenzelm@7315
    84
wenzelm@7315
    85
Isabelle/Isar calculations are implicitly subject to block structure in the
wenzelm@7315
    86
sense that new threads of calculational reasoning are commenced for any new
wenzelm@7315
    87
block (as opened by a local goal, for example).  This means that, apart from
wenzelm@7315
    88
being able to nest calculations, there is no separate \emph{begin-calculation}
wenzelm@7315
    89
command required.
wenzelm@7315
    90
wenzelm@8619
    91
\medskip
wenzelm@8619
    92
wenzelm@8619
    93
The Isar calculation proof commands may be defined as
wenzelm@8619
    94
follows:\footnote{Internal bookkeeping such as proper handling of
wenzelm@8619
    95
  block-structure has been suppressed.}
wenzelm@8619
    96
\begin{matharray}{rcl}
wenzelm@8619
    97
  \ALSO@0 & \equiv & \NOTE{calculation}{this} \\
wenzelm@9606
    98
  \ALSO@{n+1} & \equiv & \NOTE{calculation}{trans~[OF~calculation~this]} \\[0.5ex]
wenzelm@8619
    99
  \FINALLY & \equiv & \ALSO~\FROM{calculation} \\
wenzelm@8619
   100
  \MOREOVER & \equiv & \NOTE{calculation}{calculation~this} \\
wenzelm@8619
   101
  \ULTIMATELY & \equiv & \MOREOVER~\FROM{calculation} \\
wenzelm@8619
   102
\end{matharray}
wenzelm@8619
   103
wenzelm@7315
   104
\begin{rail}
wenzelm@7315
   105
  ('also' | 'finally') transrules? comment?
wenzelm@7315
   106
  ;
wenzelm@8619
   107
  ('moreover' | 'ultimately') comment?
wenzelm@8619
   108
  ;
wenzelm@8507
   109
  'trans' (() | 'add' | 'del')
wenzelm@7315
   110
  ;
wenzelm@7315
   111
wenzelm@7315
   112
  transrules: '(' thmrefs ')' interest?
wenzelm@7315
   113
  ;
wenzelm@7315
   114
\end{rail}
wenzelm@7315
   115
wenzelm@7315
   116
\begin{descr}
wenzelm@8547
   117
\item [$\ALSO~(\vec a)$] maintains the auxiliary $calculation$ register as
wenzelm@7315
   118
  follows.  The first occurrence of $\ALSO$ in some calculational thread
wenzelm@7905
   119
  initializes $calculation$ by $this$. Any subsequent $\ALSO$ on the same
wenzelm@7335
   120
  level of block-structure updates $calculation$ by some transitivity rule
wenzelm@7458
   121
  applied to $calculation$ and $this$ (in that order).  Transitivity rules are
wenzelm@11095
   122
  picked from the current context, unless alternative rules are given as
wenzelm@11095
   123
  explicit arguments.
wenzelm@9614
   124
wenzelm@8547
   125
\item [$\FINALLY~(\vec a)$] maintaining $calculation$ in the same way as
wenzelm@7315
   126
  $\ALSO$, and concludes the current calculational thread.  The final result
wenzelm@7315
   127
  is exhibited as fact for forward chaining towards the next goal. Basically,
wenzelm@7987
   128
  $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$.  Note that
wenzelm@7987
   129
  ``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and
wenzelm@7987
   130
  ``$\FINALLY~\HAVE{}{\phi}~\DOT$'' are typical idioms for concluding
wenzelm@7987
   131
  calculational proofs.
wenzelm@9614
   132
wenzelm@8619
   133
\item [$\MOREOVER$ and $\ULTIMATELY$] are analogous to $\ALSO$ and $\FINALLY$,
wenzelm@8619
   134
  but collect results only, without applying rules.
wenzelm@9614
   135
wenzelm@9606
   136
\item [$\isarkeyword{print_trans_rules}$] prints the list of transitivity
wenzelm@9606
   137
  rules declared in the current context.
wenzelm@9614
   138
wenzelm@8547
   139
\item [$trans$] declares theorems as transitivity rules.
wenzelm@9614
   140
wenzelm@7315
   141
\end{descr}
wenzelm@7315
   142
wenzelm@7315
   143
wenzelm@8483
   144
\section{Named local contexts (cases)}\label{sec:cases}
wenzelm@8483
   145
wenzelm@8483
   146
\indexisarcmd{case}\indexisarcmd{print-cases}
wenzelm@10548
   147
\indexisaratt{case-names}\indexisaratt{params}\indexisaratt{consumes}
wenzelm@8483
   148
\begin{matharray}{rcl}
wenzelm@8483
   149
  \isarcmd{case} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@8517
   150
  \isarcmd{print_cases}^* & : & \isarkeep{proof} \\
wenzelm@8483
   151
  case_names & : & \isaratt \\
wenzelm@8483
   152
  params & : & \isaratt \\
wenzelm@10548
   153
  consumes & : & \isaratt \\
wenzelm@8483
   154
\end{matharray}
wenzelm@8483
   155
wenzelm@8483
   156
Basically, Isar proof contexts are built up explicitly using commands like
wenzelm@8483
   157
$\FIXNAME$, $\ASSUMENAME$ etc.\ (see \S\ref{sec:proof-context}).  In typical
wenzelm@8483
   158
verification tasks this can become hard to manage, though.  In particular, a
wenzelm@8483
   159
large number of local contexts may emerge from case analysis or induction over
wenzelm@8483
   160
inductive sets and types.
wenzelm@8483
   161
wenzelm@8483
   162
\medskip
wenzelm@8483
   163
wenzelm@8483
   164
The $\CASENAME$ command provides a shorthand to refer to certain parts of
wenzelm@8483
   165
logical context symbolically.  Proof methods may provide an environment of
wenzelm@8507
   166
named ``cases'' of the form $c\colon \vec x, \vec \phi$.  Then the effect of
wenzelm@8507
   167
$\CASE{c}$ is exactly the same as $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$.
wenzelm@8483
   168
wenzelm@8483
   169
It is important to note that $\CASENAME$ does \emph{not} provide any means to
wenzelm@8483
   170
peek at the current goal state, which is treated as strictly non-observable in
wenzelm@8483
   171
Isar!  Instead, the cases considered here usually emerge in a canonical way
wenzelm@8483
   172
from certain pieces of specification that appear in the theory somewhere else
wenzelm@8483
   173
(e.g.\ in an inductive definition, or recursive function).  See also
wenzelm@8483
   174
\S\ref{sec:induct-method} for more details of how this works in HOL.
wenzelm@8483
   175
wenzelm@8483
   176
\medskip
wenzelm@8483
   177
wenzelm@8483
   178
Named cases may be exhibited in the current proof context only if both the
wenzelm@8547
   179
proof method and the rules involved support this.  Case names and parameters
wenzelm@8547
   180
of basic rules may be declared by hand as well, by using appropriate
wenzelm@8547
   181
attributes.  Thus variant versions of rules that have been derived manually
wenzelm@8547
   182
may be used in advanced case analysis later.
wenzelm@8483
   183
wenzelm@8483
   184
\railalias{casenames}{case\_names}
wenzelm@8483
   185
\railterm{casenames}
wenzelm@8483
   186
wenzelm@8483
   187
\begin{rail}
wenzelm@8483
   188
  'case' nameref attributes?
wenzelm@8483
   189
  ;
wenzelm@8483
   190
  casenames (name + )
wenzelm@8483
   191
  ;
wenzelm@8483
   192
  'params' ((name * ) + 'and')
wenzelm@8483
   193
  ;
wenzelm@10548
   194
  'consumes' nat?
wenzelm@10548
   195
  ;
wenzelm@8483
   196
\end{rail}
wenzelm@8547
   197
%FIXME bug in rail
wenzelm@8483
   198
wenzelm@8483
   199
\begin{descr}
wenzelm@8507
   200
\item [$\CASE{c}$] invokes a named local context $c\colon \vec x, \vec \phi$,
wenzelm@8547
   201
  as provided by an appropriate proof method (such as $cases$ and $induct$ in
wenzelm@8547
   202
  Isabelle/HOL, see \S\ref{sec:induct-method}).  The command $\CASE{c}$
wenzelm@8547
   203
  abbreviates $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$.
wenzelm@8483
   204
\item [$\isarkeyword{print_cases}$] prints all local contexts of the current
wenzelm@8547
   205
  state, using Isar proof language notation.  This is a diagnostic command;
wenzelm@8547
   206
  $undo$ does not apply.
wenzelm@8483
   207
\item [$case_names~\vec c$] declares names for the local contexts of premises
wenzelm@10627
   208
  of some theorem; $\vec c$ refers to the \emph{suffix} of the list of
wenzelm@10627
   209
  premises.
wenzelm@8483
   210
\item [$params~\vec p@1 \dots \vec p@n$] renames the innermost parameters of
wenzelm@8547
   211
  premises $1, \dots, n$ of some theorem.  An empty list of names may be given
wenzelm@8547
   212
  to skip positions, leaving the present parameters unchanged.
wenzelm@9614
   213
wenzelm@9614
   214
  Note that the default usage of case rules does \emph{not} directly expose
wenzelm@9614
   215
  parameters to the proof context (see also \S\ref{sec:induct-method-proper}).
wenzelm@10548
   216
\item [$consumes~n$] declares the number of ``major premises'' of a rule,
wenzelm@10548
   217
  i.e.\ the number of facts to be consumed when it is applied by an
wenzelm@10548
   218
  appropriate proof method (cf.\ \S\ref{sec:induct-method}).  The default
wenzelm@10548
   219
  value of $consumes$ is $n = 1$, which is appropriate for the usual kind of
wenzelm@10548
   220
  cases and induction rules for inductive sets (cf.\ \S\ref{sec:inductive}).
wenzelm@10548
   221
  Rules without any $consumes$ declaration given are treated as if
wenzelm@10548
   222
  $consumes~0$ had been specified.
wenzelm@10548
   223
  
wenzelm@10548
   224
  Note that explicit $consumes$ declarations are only rarely needed; this is
wenzelm@10548
   225
  already taken care of automatically by the higher-level $cases$ and $induct$
wenzelm@10548
   226
  declarations, see also \S\ref{sec:induct-att}.
wenzelm@8483
   227
\end{descr}
wenzelm@8483
   228
wenzelm@8483
   229
wenzelm@9614
   230
\section{Generalized existence}\label{sec:obtain}
wenzelm@7135
   231
wenzelm@8517
   232
\indexisarcmd{obtain}
wenzelm@7135
   233
\begin{matharray}{rcl}
wenzelm@9480
   234
  \isarcmd{obtain} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm@7135
   235
\end{matharray}
wenzelm@7135
   236
wenzelm@9480
   237
Generalized existence means that additional elements with certain properties
wenzelm@9480
   238
may introduced in the current context.  Technically, the $\OBTAINNAME$
wenzelm@9480
   239
language element is like a declaration of $\FIXNAME$ and $\ASSUMENAME$ (see
wenzelm@9480
   240
also see \S\ref{sec:proof-context}), together with a soundness proof of its
wenzelm@9480
   241
additional claim.  According to the nature of existential reasoning,
wenzelm@9480
   242
assumptions get eliminated from any result exported from the context later,
wenzelm@9480
   243
provided that the corresponding parameters do \emph{not} occur in the
wenzelm@9480
   244
conclusion.
wenzelm@7135
   245
wenzelm@7135
   246
\begin{rail}
wenzelm@8517
   247
  'obtain' (vars + 'and') comment? \\ 'where' (assm comment? + 'and')
wenzelm@7135
   248
  ;
wenzelm@8517
   249
\end{rail}
wenzelm@8517
   250
wenzelm@9480
   251
$\OBTAINNAME$ is defined as a derived Isar command as follows, where $\vec b$
wenzelm@9480
   252
shall refer to (optional) facts indicated for forward chaining.
wenzelm@8517
   253
\begin{matharray}{l}
wenzelm@9480
   254
  \langle facts~\vec b\rangle \\
wenzelm@9480
   255
  \OBTAIN{\vec x}{a}{\vec \phi}~~\langle proof\rangle \equiv {} \\[1ex]
wenzelm@9480
   256
  \quad \BG \\
wenzelm@9480
   257
  \qquad \FIX{thesis} \\
wenzelm@10160
   258
  \qquad \ASSUME{that~[simp, intro]}{\All{\vec x} \vec\phi \Imp thesis} \\
wenzelm@9480
   259
  \qquad \FROM{\vec b}~\HAVE{}{thesis}~~\langle proof\rangle \\
wenzelm@9480
   260
  \quad \EN \\
wenzelm@10154
   261
  \quad \FIX{\vec x}~\ASSUMENAME^\ast~a\colon~\vec\phi \\
wenzelm@8517
   262
\end{matharray}
wenzelm@8517
   263
wenzelm@8517
   264
Typically, the soundness proof is relatively straight-forward, often just by
wenzelm@8517
   265
canonical automated tools such as $\BY{simp}$ (see \S\ref{sec:simp}) or
wenzelm@9480
   266
$\BY{blast}$ (see \S\ref{sec:classical-auto}).  Accordingly, the ``$that$''
wenzelm@9480
   267
reduction above is declared as simplification and introduction rule.
wenzelm@8517
   268
wenzelm@8517
   269
\medskip
wenzelm@8517
   270
wenzelm@8517
   271
In a sense, $\OBTAINNAME$ represents at the level of Isar proofs what would be
wenzelm@8517
   272
meta-logical existential quantifiers and conjunctions.  This concept has a
wenzelm@8517
   273
broad range of useful applications, ranging from plain elimination (or even
wenzelm@8517
   274
introduction) of object-level existentials and conjunctions, to elimination
wenzelm@8517
   275
over results of symbolic evaluation of recursive definitions, for example.
wenzelm@9480
   276
Also note that $\OBTAINNAME$ without parameters acts much like $\HAVENAME$,
wenzelm@9480
   277
where the result is treated as an assumption.
wenzelm@8517
   278
wenzelm@8517
   279
wenzelm@10031
   280
\section{Miscellaneous methods and attributes}\label{sec:misc-methods}
wenzelm@8517
   281
wenzelm@9606
   282
\indexisarmeth{unfold}\indexisarmeth{fold}\indexisarmeth{insert}
wenzelm@8517
   283
\indexisarmeth{erule}\indexisarmeth{drule}\indexisarmeth{frule}
wenzelm@8517
   284
\indexisarmeth{fail}\indexisarmeth{succeed}
wenzelm@8517
   285
\begin{matharray}{rcl}
wenzelm@8517
   286
  unfold & : & \isarmeth \\
wenzelm@10741
   287
  fold & : & \isarmeth \\
wenzelm@10741
   288
  insert & : & \isarmeth \\[0.5ex]
wenzelm@8517
   289
  erule^* & : & \isarmeth \\
wenzelm@8517
   290
  drule^* & : & \isarmeth \\
wenzelm@8517
   291
  frule^* & : & \isarmeth \\[0.5ex]
wenzelm@8517
   292
  succeed & : & \isarmeth \\
wenzelm@8517
   293
  fail & : & \isarmeth \\
wenzelm@8517
   294
\end{matharray}
wenzelm@8517
   295
wenzelm@8517
   296
\begin{rail}
wenzelm@10741
   297
  ('fold' | 'unfold' | 'insert') thmrefs
wenzelm@10741
   298
  ;
wenzelm@10741
   299
  ('erule' | 'drule' | 'frule') ('('nat')')? thmrefs
wenzelm@7135
   300
  ;
wenzelm@7135
   301
\end{rail}
wenzelm@7135
   302
wenzelm@7167
   303
\begin{descr}
wenzelm@8547
   304
\item [$unfold~\vec a$ and $fold~\vec a$] expand and fold back again the given
wenzelm@8517
   305
  meta-level definitions throughout all goals; any facts provided are inserted
wenzelm@8517
   306
  into the goal and subject to rewriting as well.
wenzelm@10741
   307
\item [$insert~\vec a$] inserts theorems as facts into all goals of the proof
wenzelm@10741
   308
  state.  Note that current facts indicated for forward chaining are ignored.
wenzelm@8547
   309
\item [$erule~\vec a$, $drule~\vec a$, and $frule~\vec a$] are similar to the
wenzelm@8547
   310
  basic $rule$ method (see \S\ref{sec:pure-meth-att}), but apply rules by
wenzelm@8517
   311
  elim-resolution, destruct-resolution, and forward-resolution, respectively
wenzelm@10741
   312
  \cite{isabelle-ref}.  The optional natural number argument (default $0$)
wenzelm@10741
   313
  specifies additional assumption steps to be performed.
wenzelm@10741
   314
  
wenzelm@10741
   315
  Note that these methods are improper ones, mainly serving for
wenzelm@10741
   316
  experimentation and tactic script emulation.  Different modes of basic rule
wenzelm@10741
   317
  application are usually expressed in Isar at the proof language level,
wenzelm@10741
   318
  rather than via implicit proof state manipulations.  For example, a proper
wenzelm@10741
   319
  single-step elimination would be done using the basic $rule$ method, with
wenzelm@10741
   320
  forward chaining of current facts.
wenzelm@8517
   321
\item [$succeed$] yields a single (unchanged) result; it is the identity of
wenzelm@8517
   322
  the ``\texttt{,}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
wenzelm@8517
   323
\item [$fail$] yields an empty result sequence; it is the identity of the
wenzelm@8517
   324
  ``\texttt{|}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
wenzelm@7167
   325
\end{descr}
wenzelm@7135
   326
wenzelm@10318
   327
\indexisaratt{tagged}\indexisaratt{untagged}
wenzelm@9614
   328
\indexisaratt{THEN}\indexisaratt{COMP}
wenzelm@10318
   329
\indexisaratt{where}\indexisaratt{unfolded}\indexisaratt{folded}
wenzelm@10318
   330
\indexisaratt{standard}\indexisaratt{elim-format}
wenzelm@10318
   331
\indexisaratt{no-vars}\indexisaratt{exported}
wenzelm@8517
   332
\begin{matharray}{rcl}
wenzelm@9905
   333
  tagged & : & \isaratt \\
wenzelm@9905
   334
  untagged & : & \isaratt \\[0.5ex]
wenzelm@9614
   335
  THEN & : & \isaratt \\
wenzelm@8517
   336
  COMP & : & \isaratt \\[0.5ex]
wenzelm@8517
   337
  where & : & \isaratt \\[0.5ex]
wenzelm@9905
   338
  unfolded & : & \isaratt \\
wenzelm@9905
   339
  folded & : & \isaratt \\[0.5ex]
wenzelm@8517
   340
  standard & : & \isaratt \\
wenzelm@9941
   341
  elim_format & : & \isaratt \\
wenzelm@9936
   342
  no_vars^* & : & \isaratt \\
wenzelm@9905
   343
  exported^* & : & \isaratt \\
wenzelm@8517
   344
\end{matharray}
wenzelm@8517
   345
wenzelm@8517
   346
\begin{rail}
wenzelm@9905
   347
  'tagged' (nameref+)
wenzelm@8517
   348
  ;
wenzelm@9905
   349
  'untagged' name
wenzelm@8517
   350
  ;
wenzelm@10154
   351
  ('THEN' | 'COMP') ('[' nat ']')? thmref
wenzelm@8517
   352
  ;
wenzelm@8517
   353
  'where' (name '=' term * 'and')
wenzelm@8517
   354
  ;
wenzelm@9905
   355
  ('unfolded' | 'folded') thmrefs
wenzelm@8517
   356
  ;
wenzelm@8517
   357
\end{rail}
wenzelm@8517
   358
wenzelm@8517
   359
\begin{descr}
wenzelm@9905
   360
\item [$tagged~name~args$ and $untagged~name$] add and remove $tags$ of some
wenzelm@8517
   361
  theorem.  Tags may be any list of strings that serve as comment for some
wenzelm@8517
   362
  tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the
wenzelm@8517
   363
  result).  The first string is considered the tag name, the rest its
wenzelm@8517
   364
  arguments.  Note that untag removes any tags of the same name.
wenzelm@9614
   365
\item [$THEN~n~a$ and $COMP~n~a$] compose rules.  $THEN$ resolves with the
wenzelm@9614
   366
  $n$-th premise of $a$; the $COMP$ version skips the automatic lifting
wenzelm@8547
   367
  process that is normally intended (cf.\ \texttt{RS} and \texttt{COMP} in
wenzelm@8547
   368
  \cite[\S5]{isabelle-ref}).
wenzelm@8517
   369
\item [$where~\vec x = \vec t$] perform named instantiation of schematic
wenzelm@9606
   370
  variables occurring in a theorem.  Unlike instantiation tactics such as
wenzelm@9606
   371
  $rule_tac$ (see \S\ref{sec:tactic-commands}), actual schematic variables
wenzelm@8517
   372
  have to be specified (e.g.\ $\Var{x@3}$).
wenzelm@9905
   373
\item [$unfolded~\vec a$ and $folded~\vec a$] expand and fold back again the
wenzelm@9905
   374
  given meta-level definitions throughout a rule.
wenzelm@8517
   375
\item [$standard$] puts a theorem into the standard form of object-rules, just
wenzelm@8517
   376
  as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}).
wenzelm@9941
   377
\item [$elim_format$] turns a destruction rule into elimination rule format;
wenzelm@9941
   378
  see also the ML function \texttt{make\_elim} (see \cite{isabelle-ref}).
wenzelm@9232
   379
\item [$no_vars$] replaces schematic variables by free ones; this is mainly
wenzelm@9232
   380
  for tuning output of pretty printed theorems.
wenzelm@9905
   381
\item [$exported$] lifts a local result out of the current proof context,
wenzelm@8517
   382
  generalizing all fixed variables and discharging all assumptions.  Note that
wenzelm@8547
   383
  proper incremental export is already done as part of the basic Isar
wenzelm@8547
   384
  machinery.  This attribute is mainly for experimentation.
wenzelm@8517
   385
\end{descr}
wenzelm@7135
   386
wenzelm@7135
   387
wenzelm@9606
   388
\section{Tactic emulations}\label{sec:tactics}
wenzelm@9606
   389
wenzelm@9606
   390
The following improper proof methods emulate traditional tactics.  These admit
wenzelm@9606
   391
direct access to the goal state, which is normally considered harmful!  In
wenzelm@9606
   392
particular, this may involve both numbered goal addressing (default 1), and
wenzelm@9606
   393
dynamic instantiation within the scope of some subgoal.
wenzelm@9606
   394
wenzelm@9606
   395
\begin{warn}
wenzelm@9606
   396
  Dynamic instantiations are read and type-checked according to a subgoal of
wenzelm@9606
   397
  the current dynamic goal state, rather than the static proof context!  In
wenzelm@9606
   398
  particular, locally fixed variables and term abbreviations may not be
wenzelm@9606
   399
  included in the term specifications.  Thus schematic variables are left to
wenzelm@9606
   400
  be solved by unification with certain parts of the subgoal involved.
wenzelm@9606
   401
\end{warn}
wenzelm@9606
   402
wenzelm@9606
   403
Note that the tactic emulation proof methods in Isabelle/Isar are consistently
wenzelm@9606
   404
named $foo_tac$.
wenzelm@9606
   405
wenzelm@9606
   406
\indexisarmeth{rule-tac}\indexisarmeth{erule-tac}
wenzelm@9606
   407
\indexisarmeth{drule-tac}\indexisarmeth{frule-tac}
wenzelm@9606
   408
\indexisarmeth{cut-tac}\indexisarmeth{thin-tac}
wenzelm@9642
   409
\indexisarmeth{subgoal-tac}\indexisarmeth{rename-tac}
wenzelm@9614
   410
\indexisarmeth{rotate-tac}\indexisarmeth{tactic}
wenzelm@9606
   411
\begin{matharray}{rcl}
wenzelm@9606
   412
  rule_tac^* & : & \isarmeth \\
wenzelm@9606
   413
  erule_tac^* & : & \isarmeth \\
wenzelm@9606
   414
  drule_tac^* & : & \isarmeth \\
wenzelm@9606
   415
  frule_tac^* & : & \isarmeth \\
wenzelm@9606
   416
  cut_tac^* & : & \isarmeth \\
wenzelm@9606
   417
  thin_tac^* & : & \isarmeth \\
wenzelm@9606
   418
  subgoal_tac^* & : & \isarmeth \\
wenzelm@9614
   419
  rename_tac^* & : & \isarmeth \\
wenzelm@9614
   420
  rotate_tac^* & : & \isarmeth \\
wenzelm@9606
   421
  tactic^* & : & \isarmeth \\
wenzelm@9606
   422
\end{matharray}
wenzelm@9606
   423
wenzelm@9606
   424
\railalias{ruletac}{rule\_tac}
wenzelm@9606
   425
\railterm{ruletac}
wenzelm@9606
   426
wenzelm@9606
   427
\railalias{eruletac}{erule\_tac}
wenzelm@9606
   428
\railterm{eruletac}
wenzelm@9606
   429
wenzelm@9606
   430
\railalias{druletac}{drule\_tac}
wenzelm@9606
   431
\railterm{druletac}
wenzelm@9606
   432
wenzelm@9606
   433
\railalias{fruletac}{frule\_tac}
wenzelm@9606
   434
\railterm{fruletac}
wenzelm@9606
   435
wenzelm@9606
   436
\railalias{cuttac}{cut\_tac}
wenzelm@9606
   437
\railterm{cuttac}
wenzelm@9606
   438
wenzelm@9606
   439
\railalias{thintac}{thin\_tac}
wenzelm@9606
   440
\railterm{thintac}
wenzelm@9606
   441
wenzelm@9606
   442
\railalias{subgoaltac}{subgoal\_tac}
wenzelm@9606
   443
\railterm{subgoaltac}
wenzelm@9606
   444
wenzelm@9614
   445
\railalias{renametac}{rename\_tac}
wenzelm@9614
   446
\railterm{renametac}
wenzelm@9614
   447
wenzelm@9614
   448
\railalias{rotatetac}{rotate\_tac}
wenzelm@9614
   449
\railterm{rotatetac}
wenzelm@9614
   450
wenzelm@9606
   451
\begin{rail}
wenzelm@9606
   452
  ( ruletac | eruletac | druletac | fruletac | cuttac | thintac ) goalspec?
wenzelm@9606
   453
  ( insts thmref | thmrefs )
wenzelm@9606
   454
  ;
wenzelm@9606
   455
  subgoaltac goalspec? (prop +)
wenzelm@9606
   456
  ;
wenzelm@9614
   457
  renametac goalspec? (name +)
wenzelm@9614
   458
  ;
wenzelm@9614
   459
  rotatetac goalspec? int?
wenzelm@9614
   460
  ;
wenzelm@9606
   461
  'tactic' text
wenzelm@9606
   462
  ;
wenzelm@9606
   463
wenzelm@9606
   464
  insts: ((name '=' term) + 'and') 'in'
wenzelm@9606
   465
  ;
wenzelm@9606
   466
\end{rail}
wenzelm@9606
   467
wenzelm@9606
   468
\begin{descr}
wenzelm@9606
   469
\item [$rule_tac$ etc.] do resolution of rules with explicit instantiation.
wenzelm@9606
   470
  This works the same way as the ML tactics \texttt{res_inst_tac} etc. (see
wenzelm@9606
   471
  \cite[\S3]{isabelle-ref}).
wenzelm@9614
   472
wenzelm@9606
   473
  Note that multiple rules may be only given there is no instantiation.  Then
wenzelm@9606
   474
  $rule_tac$ is the same as \texttt{resolve_tac} in ML (see
wenzelm@9606
   475
  \cite[\S3]{isabelle-ref}).
wenzelm@9606
   476
\item [$cut_tac$] inserts facts into the proof state as assumption of a
wenzelm@9606
   477
  subgoal, see also \texttt{cut_facts_tac} in \cite[\S3]{isabelle-ref}.  Note
wenzelm@9606
   478
  that the scope of schmatic variables is spread over the main goal statement.
wenzelm@9606
   479
  Instantiations may be given as well, see also ML tactic
wenzelm@9606
   480
  \texttt{cut_inst_tac} in \cite[\S3]{isabelle-ref}.
wenzelm@9606
   481
\item [$thin_tac~\phi$] deletes the specified assumption from a subgoal; note
wenzelm@9606
   482
  that $\phi$ may contain schematic variables.  See also \texttt{thin_tac} in
wenzelm@9606
   483
  \cite[\S3]{isabelle-ref}.
wenzelm@9606
   484
\item [$subgoal_tac~\phi$] adds $\phi$ as an assumption to a subgoal.  See
wenzelm@9606
   485
  also \texttt{subgoal_tac} and \texttt{subgoals_tac} in
wenzelm@9606
   486
  \cite[\S3]{isabelle-ref}.
wenzelm@9614
   487
\item [$rename_tac~\vec x$] renames parameters of a goal according to the list
wenzelm@9614
   488
  $\vec x$, which refers to the \emph{suffix} of variables.
wenzelm@9614
   489
\item [$rotate_tac~n$] rotates the assumptions of a goal by $n$ positions:
wenzelm@9614
   490
  from right to left if $n$ is positive, and from left to right if $n$ is
wenzelm@9614
   491
  negative; the default value is $1$.  See also \texttt{rotate_tac} in
wenzelm@9614
   492
  \cite[\S3]{isabelle-ref}.
wenzelm@9606
   493
\item [$tactic~text$] produces a proof method from any ML text of type
wenzelm@9606
   494
  \texttt{tactic}.  Apart from the usual ML environment and the current
wenzelm@9606
   495
  implicit theory context, the ML code may refer to the following locally
wenzelm@9606
   496
  bound values:
wenzelm@9606
   497
wenzelm@9606
   498
%%FIXME ttbox produces too much trailing space (why?)
wenzelm@9606
   499
{\footnotesize\begin{verbatim}
wenzelm@9606
   500
val ctxt  : Proof.context
wenzelm@9606
   501
val facts : thm list
wenzelm@9606
   502
val thm   : string -> thm
wenzelm@9606
   503
val thms  : string -> thm list
wenzelm@9606
   504
\end{verbatim}}
wenzelm@9606
   505
  Here \texttt{ctxt} refers to the current proof context, \texttt{facts}
wenzelm@9606
   506
  indicates any current facts for forward-chaining, and
wenzelm@9606
   507
  \texttt{thm}~/~\texttt{thms} retrieve named facts (including global
wenzelm@9606
   508
  theorems) from the context.
wenzelm@9606
   509
\end{descr}
wenzelm@9606
   510
wenzelm@9606
   511
wenzelm@9614
   512
\section{The Simplifier}\label{sec:simplifier}
wenzelm@7135
   513
wenzelm@7321
   514
\subsection{Simplification methods}\label{sec:simp}
wenzelm@7315
   515
wenzelm@8483
   516
\indexisarmeth{simp}\indexisarmeth{simp-all}
wenzelm@7315
   517
\begin{matharray}{rcl}
wenzelm@7315
   518
  simp & : & \isarmeth \\
wenzelm@8483
   519
  simp_all & : & \isarmeth \\
wenzelm@7315
   520
\end{matharray}
wenzelm@7315
   521
wenzelm@8483
   522
\railalias{simpall}{simp\_all}
wenzelm@8483
   523
\railterm{simpall}
wenzelm@8483
   524
wenzelm@8704
   525
\railalias{noasm}{no\_asm}
wenzelm@8704
   526
\railterm{noasm}
wenzelm@8704
   527
wenzelm@8704
   528
\railalias{noasmsimp}{no\_asm\_simp}
wenzelm@8704
   529
\railterm{noasmsimp}
wenzelm@8704
   530
wenzelm@8704
   531
\railalias{noasmuse}{no\_asm\_use}
wenzelm@8704
   532
\railterm{noasmuse}
wenzelm@8704
   533
wenzelm@11128
   534
\indexouternonterm{simpmod}
wenzelm@7315
   535
\begin{rail}
wenzelm@8706
   536
  ('simp' | simpall) ('!' ?) opt? (simpmod * )
wenzelm@7315
   537
  ;
wenzelm@7315
   538
wenzelm@8811
   539
  opt: '(' (noasm | noasmsimp | noasmuse) ')'
wenzelm@8704
   540
  ;
wenzelm@9711
   541
  simpmod: ('add' | 'del' | 'only' | 'cong' (() | 'add' | 'del') |
wenzelm@9847
   542
    'split' (() | 'add' | 'del')) ':' thmrefs
wenzelm@7315
   543
  ;
wenzelm@7315
   544
\end{rail}
wenzelm@7315
   545
wenzelm@7321
   546
\begin{descr}
wenzelm@8547
   547
\item [$simp$] invokes Isabelle's simplifier, after declaring additional rules
wenzelm@8594
   548
  according to the arguments given.  Note that the \railtterm{only} modifier
wenzelm@8547
   549
  first removes all other rewrite rules, congruences, and looper tactics
wenzelm@8594
   550
  (including splits), and then behaves like \railtterm{add}.
wenzelm@9711
   551
  
wenzelm@9711
   552
  \medskip The \railtterm{cong} modifiers add or delete Simplifier congruence
wenzelm@9711
   553
  rules (see also \cite{isabelle-ref}), the default is to add.
wenzelm@9711
   554
  
wenzelm@9711
   555
  \medskip The \railtterm{split} modifiers add or delete rules for the
wenzelm@9711
   556
  Splitter (see also \cite{isabelle-ref}), the default is to add.  This works
wenzelm@9711
   557
  only if the Simplifier method has been properly setup to include the
wenzelm@9711
   558
  Splitter (all major object logics such HOL, HOLCF, FOL, ZF do this already).
wenzelm@8483
   559
\item [$simp_all$] is similar to $simp$, but acts on all goals.
wenzelm@7321
   560
\end{descr}
wenzelm@7321
   561
wenzelm@8704
   562
By default, the Simplifier methods are based on \texttt{asm_full_simp_tac}
wenzelm@8706
   563
internally \cite[\S10]{isabelle-ref}, which means that assumptions are both
wenzelm@8706
   564
simplified as well as used in simplifying the conclusion.  In structured
wenzelm@8706
   565
proofs this is usually quite well behaved in practice: just the local premises
wenzelm@8706
   566
of the actual goal are involved, additional facts may inserted via explicit
wenzelm@8706
   567
forward-chaining (using $\THEN$, $\FROMNAME$ etc.).  The full context of
wenzelm@8706
   568
assumptions is only included if the ``$!$'' (bang) argument is given, which
wenzelm@8706
   569
should be used with some care, though.
wenzelm@7321
   570
wenzelm@8704
   571
Additional Simplifier options may be specified to tune the behavior even
wenzelm@9614
   572
further: $(no_asm)$ means assumptions are ignored completely (cf.\
wenzelm@8811
   573
\texttt{simp_tac}), $(no_asm_simp)$ means assumptions are used in the
wenzelm@9614
   574
simplification of the conclusion but are not themselves simplified (cf.\
wenzelm@8811
   575
\texttt{asm_simp_tac}), and $(no_asm_use)$ means assumptions are simplified
wenzelm@8811
   576
but are not used in the simplification of each other or the conclusion (cf.
wenzelm@8704
   577
\texttt{full_simp_tac}).
wenzelm@8704
   578
wenzelm@8704
   579
\medskip
wenzelm@8704
   580
wenzelm@8704
   581
The Splitter package is usually configured to work as part of the Simplifier.
wenzelm@9711
   582
The effect of repeatedly applying \texttt{split_tac} can be simulated by
wenzelm@9711
   583
$(simp~only\colon~split\colon~\vec a)$.  There is also a separate $split$
wenzelm@9711
   584
method available for single-step case splitting, see \S\ref{sec:basic-eq}.
wenzelm@8483
   585
wenzelm@8483
   586
wenzelm@8483
   587
\subsection{Declaring rules}
wenzelm@8483
   588
wenzelm@8667
   589
\indexisarcmd{print-simpset}
wenzelm@8638
   590
\indexisaratt{simp}\indexisaratt{split}\indexisaratt{cong}
wenzelm@7321
   591
\begin{matharray}{rcl}
wenzelm@10154
   592
  print_simpset^* & : & \isarkeep{theory~|~proof} \\
wenzelm@7321
   593
  simp & : & \isaratt \\
wenzelm@9711
   594
  cong & : & \isaratt \\
wenzelm@8483
   595
  split & : & \isaratt \\
wenzelm@7321
   596
\end{matharray}
wenzelm@7321
   597
wenzelm@7321
   598
\begin{rail}
wenzelm@9711
   599
  ('simp' | 'cong' | 'split') (() | 'add' | 'del')
wenzelm@7321
   600
  ;
wenzelm@7321
   601
\end{rail}
wenzelm@7321
   602
wenzelm@7321
   603
\begin{descr}
wenzelm@8667
   604
\item [$print_simpset$] prints the collection of rules declared to the
wenzelm@8667
   605
  Simplifier, which is also known as ``simpset'' internally
wenzelm@8667
   606
  \cite{isabelle-ref}.  This is a diagnostic command; $undo$ does not apply.
wenzelm@8547
   607
\item [$simp$] declares simplification rules.
wenzelm@8638
   608
\item [$cong$] declares congruence rules.
wenzelm@9711
   609
\item [$split$] declares case split rules.
wenzelm@7321
   610
\end{descr}
wenzelm@7319
   611
wenzelm@7315
   612
wenzelm@7315
   613
\subsection{Forward simplification}
wenzelm@7315
   614
wenzelm@9905
   615
\indexisaratt{simplified}
wenzelm@7315
   616
\begin{matharray}{rcl}
wenzelm@9905
   617
  simplified & : & \isaratt \\
wenzelm@7315
   618
\end{matharray}
wenzelm@7315
   619
wenzelm@9905
   620
\begin{rail}
wenzelm@9905
   621
  'simplified' opt?
wenzelm@9905
   622
  ;
wenzelm@7905
   623
wenzelm@9905
   624
  opt: '(' (noasm | noasmsimp | noasmuse) ')'
wenzelm@9905
   625
  ;
wenzelm@9905
   626
\end{rail}
wenzelm@9905
   627
wenzelm@9905
   628
\begin{descr}
wenzelm@9905
   629
\item [$simplified$] causes a theorem to be simplified according to the
wenzelm@9905
   630
  current Simplifier context (there are no separate arguments for declaring
wenzelm@9905
   631
  additional rules).  By default the result is fully simplified, including
wenzelm@9905
   632
  assumptions and conclusion.  The options $no_asm$ etc.\ restrict the
wenzelm@9905
   633
  Simplifier in the same way as the for the $simp$ method (see
wenzelm@9905
   634
  \S\ref{sec:simp}).
wenzelm@9905
   635
  
wenzelm@9905
   636
  The $simplified$ operation should be used only very rarely, usually for
wenzelm@9905
   637
  experimentation only.
wenzelm@9905
   638
\end{descr}
wenzelm@7315
   639
wenzelm@7315
   640
wenzelm@9711
   641
\section{Basic equational reasoning}\label{sec:basic-eq}
wenzelm@9614
   642
wenzelm@9703
   643
\indexisarmeth{subst}\indexisarmeth{hypsubst}\indexisarmeth{split}\indexisaratt{symmetric}
wenzelm@9614
   644
\begin{matharray}{rcl}
wenzelm@9614
   645
  subst & : & \isarmeth \\
wenzelm@9614
   646
  hypsubst^* & : & \isarmeth \\
wenzelm@9703
   647
  split & : & \isarmeth \\
wenzelm@9614
   648
  symmetric & : & \isaratt \\
wenzelm@9614
   649
\end{matharray}
wenzelm@9614
   650
wenzelm@9614
   651
\begin{rail}
wenzelm@9614
   652
  'subst' thmref
wenzelm@9614
   653
  ;
wenzelm@9799
   654
  'split' ('(' 'asm' ')')? thmrefs
wenzelm@9703
   655
  ;
wenzelm@9614
   656
\end{rail}
wenzelm@9614
   657
wenzelm@9614
   658
These methods and attributes provide basic facilities for equational reasoning
wenzelm@9614
   659
that are intended for specialized applications only.  Normally, single step
wenzelm@9614
   660
reasoning would be performed by calculation (see \S\ref{sec:calculation}),
wenzelm@9614
   661
while the Simplifier is the canonical tool for automated normalization (see
wenzelm@9614
   662
\S\ref{sec:simplifier}).
wenzelm@9614
   663
wenzelm@9614
   664
\begin{descr}
wenzelm@9614
   665
\item [$subst~thm$] performs a single substitution step using rule $thm$,
wenzelm@9614
   666
  which may be either a meta or object equality.
wenzelm@9614
   667
\item [$hypsubst$] performs substitution using some assumption.
wenzelm@9703
   668
\item [$split~thms$] performs single-step case splitting using rules $thms$.
wenzelm@9799
   669
  By default, splitting is performed in the conclusion of a goal; the $asm$
wenzelm@9799
   670
  option indicates to operate on assumptions instead.
wenzelm@9799
   671
  
wenzelm@9703
   672
  Note that the $simp$ method already involves repeated application of split
wenzelm@9703
   673
  rules as declared in the current context (see \S\ref{sec:simp}).
wenzelm@9614
   674
\item [$symmetric$] applies the symmetry rule of meta or object equality.
wenzelm@9614
   675
\end{descr}
wenzelm@9614
   676
wenzelm@9614
   677
wenzelm@9847
   678
\section{The Classical Reasoner}\label{sec:classical}
wenzelm@7135
   679
wenzelm@7335
   680
\subsection{Basic methods}\label{sec:classical-basic}
wenzelm@7315
   681
wenzelm@7974
   682
\indexisarmeth{rule}\indexisarmeth{intro}
wenzelm@7974
   683
\indexisarmeth{elim}\indexisarmeth{default}\indexisarmeth{contradiction}
wenzelm@7321
   684
\begin{matharray}{rcl}
wenzelm@7321
   685
  rule & : & \isarmeth \\
wenzelm@7321
   686
  intro & : & \isarmeth \\
wenzelm@7321
   687
  elim & : & \isarmeth \\
wenzelm@7321
   688
  contradiction & : & \isarmeth \\
wenzelm@7321
   689
\end{matharray}
wenzelm@7321
   690
wenzelm@7321
   691
\begin{rail}
wenzelm@8547
   692
  ('rule' | 'intro' | 'elim') thmrefs?
wenzelm@7321
   693
  ;
wenzelm@7321
   694
\end{rail}
wenzelm@7321
   695
wenzelm@7321
   696
\begin{descr}
wenzelm@7466
   697
\item [$rule$] as offered by the classical reasoner is a refinement over the
wenzelm@8517
   698
  primitive one (see \S\ref{sec:pure-meth-att}).  In case that no rules are
wenzelm@7466
   699
  provided as arguments, it automatically determines elimination and
wenzelm@7321
   700
  introduction rules from the context (see also \S\ref{sec:classical-mod}).
wenzelm@8517
   701
  This is made the default method for basic proof steps, such as $\PROOFNAME$
wenzelm@8517
   702
  and ``$\DDOT$'' (two dots), see also \S\ref{sec:proof-steps} and
wenzelm@8517
   703
  \S\ref{sec:pure-meth-att}.
wenzelm@9614
   704
wenzelm@7466
   705
\item [$intro$ and $elim$] repeatedly refine some goal by intro- or
wenzelm@7905
   706
  elim-resolution, after having inserted any facts.  Omitting the arguments
wenzelm@8547
   707
  refers to any suitable rules declared in the context, otherwise only the
wenzelm@8547
   708
  explicitly given ones may be applied.  The latter form admits better control
wenzelm@8547
   709
  of what actually happens, thus it is very appropriate as an initial method
wenzelm@8547
   710
  for $\PROOFNAME$ that splits up certain connectives of the goal, before
wenzelm@8547
   711
  entering the actual sub-proof.
wenzelm@9614
   712
wenzelm@7466
   713
\item [$contradiction$] solves some goal by contradiction, deriving any result
wenzelm@7466
   714
  from both $\neg A$ and $A$.  Facts, which are guaranteed to participate, may
wenzelm@7466
   715
  appear in either order.
wenzelm@7321
   716
\end{descr}
wenzelm@7321
   717
wenzelm@7321
   718
wenzelm@7981
   719
\subsection{Automated methods}\label{sec:classical-auto}
wenzelm@7321
   720
wenzelm@9799
   721
\indexisarmeth{blast}\indexisarmeth{fast}\indexisarmeth{slow}
wenzelm@9799
   722
\indexisarmeth{best}\indexisarmeth{safe}\indexisarmeth{clarify}
wenzelm@7321
   723
\begin{matharray}{rcl}
wenzelm@9780
   724
  blast & : & \isarmeth \\
wenzelm@9780
   725
  fast & : & \isarmeth \\
wenzelm@9799
   726
  slow & : & \isarmeth \\
wenzelm@9780
   727
  best & : & \isarmeth \\
wenzelm@9780
   728
  safe & : & \isarmeth \\
wenzelm@9780
   729
  clarify & : & \isarmeth \\
wenzelm@7321
   730
\end{matharray}
wenzelm@7321
   731
wenzelm@11128
   732
\indexouternonterm{clamod}
wenzelm@7321
   733
\begin{rail}
wenzelm@7905
   734
  'blast' ('!' ?) nat? (clamod * )
wenzelm@7321
   735
  ;
wenzelm@9799
   736
  ('fast' | 'slow' | 'best' | 'safe' | 'clarify') ('!' ?) (clamod * )
wenzelm@7321
   737
  ;
wenzelm@7321
   738
wenzelm@9408
   739
  clamod: (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del') ':' thmrefs
wenzelm@7321
   740
  ;
wenzelm@7321
   741
\end{rail}
wenzelm@7321
   742
wenzelm@7321
   743
\begin{descr}
wenzelm@7321
   744
\item [$blast$] refers to the classical tableau prover (see \texttt{blast_tac}
wenzelm@7335
   745
  in \cite[\S11]{isabelle-ref}).  The optional argument specifies a
wenzelm@10858
   746
  user-supplied search bound (default 20).
wenzelm@9799
   747
\item [$fast$, $slow$, $best$, $safe$, and $clarify$] refer to the generic
wenzelm@9799
   748
  classical reasoner.  See \texttt{fast_tac}, \texttt{slow_tac},
wenzelm@9799
   749
  \texttt{best_tac}, \texttt{safe_tac}, and \texttt{clarify_tac} in
wenzelm@9799
   750
  \cite[\S11]{isabelle-ref} for more information.
wenzelm@7321
   751
\end{descr}
wenzelm@7321
   752
wenzelm@7321
   753
Any of above methods support additional modifiers of the context of classical
wenzelm@8517
   754
rules.  Their semantics is analogous to the attributes given in
wenzelm@8547
   755
\S\ref{sec:classical-mod}.  Facts provided by forward chaining are
wenzelm@8547
   756
inserted\footnote{These methods usually cannot make proper use of actual rules
wenzelm@8547
   757
  inserted that way, though.} into the goal before doing the search.  The
wenzelm@8547
   758
``!''~argument causes the full context of assumptions to be included as well.
wenzelm@8547
   759
This is slightly less hazardous than for the Simplifier (see
wenzelm@8547
   760
\S\ref{sec:simp}).
wenzelm@7321
   761
wenzelm@7315
   762
wenzelm@9847
   763
\subsection{Combined automated methods}\label{sec:clasimp}
wenzelm@7315
   764
wenzelm@9799
   765
\indexisarmeth{auto}\indexisarmeth{force}\indexisarmeth{clarsimp}
wenzelm@9799
   766
\indexisarmeth{fastsimp}\indexisarmeth{slowsimp}\indexisarmeth{bestsimp}
wenzelm@7321
   767
\begin{matharray}{rcl}
wenzelm@9606
   768
  auto & : & \isarmeth \\
wenzelm@7321
   769
  force & : & \isarmeth \\
wenzelm@9438
   770
  clarsimp & : & \isarmeth \\
wenzelm@9606
   771
  fastsimp & : & \isarmeth \\
wenzelm@9799
   772
  slowsimp & : & \isarmeth \\
wenzelm@9799
   773
  bestsimp & : & \isarmeth \\
wenzelm@7321
   774
\end{matharray}
wenzelm@7315
   775
wenzelm@11128
   776
\indexouternonterm{clasimpmod}
wenzelm@7321
   777
\begin{rail}
wenzelm@9780
   778
  'auto' '!'? (nat nat)? (clasimpmod * )
wenzelm@9780
   779
  ;
wenzelm@9799
   780
  ('force' | 'clarsimp' | 'fastsimp' | 'slowsimp' | 'bestsimp') '!'? (clasimpmod * )
wenzelm@7321
   781
  ;
wenzelm@7315
   782
wenzelm@9711
   783
  clasimpmod: ('simp' (() | 'add' | 'del' | 'only') |
wenzelm@10031
   784
    ('cong' | 'split') (() | 'add' | 'del') |
wenzelm@10031
   785
    'iff' (((() | 'add') '?'?) | 'del') |
wenzelm@9408
   786
    (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del')) ':' thmrefs
wenzelm@7321
   787
\end{rail}
wenzelm@7135
   788
wenzelm@7321
   789
\begin{descr}
wenzelm@9799
   790
\item [$auto$, $force$, $clarsimp$, $fastsimp$, $slowsimp$, and $bestsimp$]
wenzelm@9799
   791
  provide access to Isabelle's combined simplification and classical reasoning
wenzelm@9799
   792
  tactics.  These correspond to \texttt{auto_tac}, \texttt{force_tac},
wenzelm@9799
   793
  \texttt{clarsimp_tac}, and Classical Reasoner tactics with the Simplifier
wenzelm@9799
   794
  added as wrapper, see \cite[\S11]{isabelle-ref} for more information.  The
wenzelm@9799
   795
  modifier arguments correspond to those given in \S\ref{sec:simp} and
wenzelm@9606
   796
  \S\ref{sec:classical-auto}.  Just note that the ones related to the
wenzelm@9606
   797
  Simplifier are prefixed by \railtterm{simp} here.
wenzelm@9614
   798
wenzelm@7987
   799
  Facts provided by forward chaining are inserted into the goal before doing
wenzelm@7987
   800
  the search.  The ``!''~argument causes the full context of assumptions to be
wenzelm@7987
   801
  included as well.
wenzelm@7321
   802
\end{descr}
wenzelm@7135
   803
wenzelm@7987
   804
wenzelm@8483
   805
\subsection{Declaring rules}\label{sec:classical-mod}
wenzelm@7135
   806
wenzelm@8667
   807
\indexisarcmd{print-claset}
wenzelm@7391
   808
\indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}
wenzelm@9936
   809
\indexisaratt{iff}\indexisaratt{rule}
wenzelm@7321
   810
\begin{matharray}{rcl}
wenzelm@10154
   811
  print_claset^* & : & \isarkeep{theory~|~proof} \\
wenzelm@7321
   812
  intro & : & \isaratt \\
wenzelm@7321
   813
  elim & : & \isaratt \\
wenzelm@7321
   814
  dest & : & \isaratt \\
wenzelm@9936
   815
  rule & : & \isaratt \\
wenzelm@7391
   816
  iff & : & \isaratt \\
wenzelm@7321
   817
\end{matharray}
wenzelm@7321
   818
wenzelm@7321
   819
\begin{rail}
wenzelm@9408
   820
  ('intro' | 'elim' | 'dest') ('!' | () | '?')
wenzelm@7321
   821
  ;
wenzelm@9936
   822
  'rule' 'del'
wenzelm@9936
   823
  ;
wenzelm@10031
   824
  'iff' (((() | 'add') '?'?) | 'del')
wenzelm@9936
   825
  ;
wenzelm@7321
   826
\end{rail}
wenzelm@7321
   827
wenzelm@7321
   828
\begin{descr}
wenzelm@8667
   829
\item [$print_claset$] prints the collection of rules declared to the
wenzelm@8667
   830
  Classical Reasoner, which is also known as ``simpset'' internally
wenzelm@8667
   831
  \cite{isabelle-ref}.  This is a diagnostic command; $undo$ does not apply.
wenzelm@8517
   832
\item [$intro$, $elim$, and $dest$] declare introduction, elimination, and
oheimb@11332
   833
  destruction rules, respectively.  By default, rules are considered as
wenzelm@9408
   834
  \emph{unsafe} (i.e.\ not applied blindly without backtracking), while a
wenzelm@9408
   835
  single ``!'' classifies as \emph{safe}, and ``?'' as \emph{extra} (i.e.\ not
wenzelm@9408
   836
  applied in the search-oriented automated methods, but only in single-step
wenzelm@9408
   837
  methods such as $rule$).
oheimb@11332
   838
\item [$rule~del$] deletes introduction, elimination, or destruction rules from
wenzelm@9936
   839
  the context.
oheimb@11442
   840
\item [$iff$] declares a (possibly conditional) ``safe'' rule to the context in
oheimb@11442
   841
  several ways.   The rule is declared as a rewrite rule to the Simplifier. 
oheimb@11442
   842
  Furthermore, it is 
oheimb@11332
   843
  declared in several ways (depending on its structure) to the Classical 
oheimb@11332
   844
  Reasoner for aggressive use, which would normally be indicated by ``!'').
oheimb@11332
   845
  If the rule is an equivalence, the two corresponding implications are 
oheimb@11333
   846
  declared as introduction and destruction rules. Otherwise, a warning is issued
oheimb@11333
   847
  and if the rule is an inequality, the corresponding negation elimination rule
oheimb@11442
   848
  is declared, else the rule itself is declared as an introduction rule.
wenzelm@10031
   849
  
wenzelm@10031
   850
  The ``?'' version of $iff$ declares ``extra'' Classical Reasoner rules only,
wenzelm@10031
   851
  and omits the Simplifier declaration.  Thus the declaration does not have
wenzelm@10031
   852
  any effect on automated proof tools, but only on simple methods such as
wenzelm@10031
   853
  $rule$ (see \S\ref{sec:misc-methods}).
wenzelm@7321
   854
\end{descr}
wenzelm@7135
   855
wenzelm@8203
   856
wenzelm@9614
   857
%%% Local Variables:
wenzelm@7135
   858
%%% mode: latex
wenzelm@7135
   859
%%% TeX-master: "isar-ref"
wenzelm@9614
   860
%%% End: