doc-src/Ref/thm.tex
author paulson
Thu, 26 Sep 1996 17:15:19 +0200
changeset 2040 6db93e6f1b11
parent 1876 b163e192a2bf
child 2044 e8d52d05530a
permissions -rw-r--r--
Documented sort hypotheses and improved discussion of derivations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     1
%% $Id$
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     2
\chapter{Theorems and Forward Proof}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     3
\index{theorems|(}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
     4
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     5
Theorems, which represent the axioms, theorems and rules of object-logics,
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
     6
have type \mltydx{thm}.  This chapter begins by describing operations that
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
     7
print theorems and that join them in forward proof.  Most theorem
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
     8
operations are intended for advanced applications, such as programming new
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
     9
proof procedures.  Many of these operations refer to signatures, certified
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    10
terms and certified types, which have the \ML{} types {\tt Sign.sg}, {\tt
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    11
  Sign.cterm} and {\tt Sign.ctyp} and are discussed in
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    12
Chapter~\ref{theories}.  Beginning users should ignore such complexities
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    13
--- and skip all but the first section of this chapter.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    14
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    15
The theorem operations do not print error messages.  Instead, they raise
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    16
exception~\xdx{THM}\@.  Use \ttindex{print_exn} to display
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    17
exceptions nicely:
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    18
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    19
allI RS mp  handle e => print_exn e;
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    20
{\out Exception THM raised:}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    21
{\out RSN: no unifiers -- premise 1}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    22
{\out (!!x. ?P(x)) ==> ALL x. ?P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    23
{\out [| ?P --> ?Q; ?P |] ==> ?Q}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    24
{\out}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    25
{\out uncaught exception THM}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    26
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    27
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    28
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    29
\section{Basic operations on theorems}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    30
\subsection{Pretty-printing a theorem}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    31
\index{theorems!printing of}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    32
\begin{ttbox} 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    33
prth          : thm -> thm
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    34
prths         : thm list -> thm list
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    35
prthq         : thm Sequence.seq -> thm Sequence.seq
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    36
print_thm     : thm -> unit
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    37
print_goals   : int -> thm -> unit
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    38
string_of_thm : thm -> string
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    39
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    40
The first three commands are for interactive use.  They are identity
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    41
functions that display, then return, their argument.  The \ML{} identifier
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    42
{\tt it} will refer to the value just displayed.
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    43
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    44
The others are for use in programs.  Functions with result type {\tt unit}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    45
are convenient for imperative programming.
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    46
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    47
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    48
\item[\ttindexbold{prth} {\it thm}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    49
prints {\it thm\/} at the terminal.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    50
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    51
\item[\ttindexbold{prths} {\it thms}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    52
prints {\it thms}, a list of theorems.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    53
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    54
\item[\ttindexbold{prthq} {\it thmq}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    55
prints {\it thmq}, a sequence of theorems.  It is useful for inspecting
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    56
the output of a tactic.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    57
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    58
\item[\ttindexbold{print_thm} {\it thm}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    59
prints {\it thm\/} at the terminal.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    60
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    61
\item[\ttindexbold{print_goals} {\it limit\/} {\it thm}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    62
prints {\it thm\/} in goal style, with the premises as subgoals.  It prints
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    63
at most {\it limit\/} subgoals.  The subgoal module calls {\tt print_goals}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    64
to display proof states.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    65
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    66
\item[\ttindexbold{string_of_thm} {\it thm}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    67
converts {\it thm\/} to a string.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    68
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    69
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    70
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    71
\subsection{Forward proof: joining rules by resolution}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    72
\index{theorems!joining by resolution}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    73
\index{resolution}\index{forward proof}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    74
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    75
RSN : thm * (int * thm) -> thm                 \hfill{\bf infix}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    76
RS  : thm * thm -> thm                         \hfill{\bf infix}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    77
MRS : thm list * thm -> thm                    \hfill{\bf infix}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    78
RLN : thm list * (int * thm list) -> thm list  \hfill{\bf infix}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    79
RL  : thm list * thm list -> thm list          \hfill{\bf infix}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    80
MRL : thm list list * thm list -> thm list     \hfill{\bf infix}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    81
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    82
Joining rules together is a simple way of deriving new rules.  These
876
5c18634db55d Under RS added cross reference to bind_thm
lcp
parents: 866
diff changeset
    83
functions are especially useful with destruction rules.  To store
5c18634db55d Under RS added cross reference to bind_thm
lcp
parents: 866
diff changeset
    84
the result in the theorem database, use \ttindex{bind_thm}
5c18634db55d Under RS added cross reference to bind_thm
lcp
parents: 866
diff changeset
    85
(\S\ref{ExtractingAndStoringTheProvedTheorem}). 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    86
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    87
\item[\tt$thm@1$ RSN $(i,thm@2)$] \indexbold{*RSN} 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    88
  resolves the conclusion of $thm@1$ with the $i$th premise of~$thm@2$.
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    89
  Unless there is precisely one resolvent it raises exception
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
    90
  \xdx{THM}; in that case, use {\tt RLN}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    91
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    92
\item[\tt$thm@1$ RS $thm@2$] \indexbold{*RS} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    93
abbreviates \hbox{\tt$thm@1$ RSN $(1,thm@2)$}.  Thus, it resolves the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    94
conclusion of $thm@1$ with the first premise of~$thm@2$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    95
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    96
\item[\tt {$[thm@1,\ldots,thm@n]$} MRS $thm$] \indexbold{*MRS} 
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
    97
  uses {\tt RSN} to resolve $thm@i$ against premise~$i$ of $thm$, for
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    98
  $i=n$, \ldots,~1.  This applies $thm@n$, \ldots, $thm@1$ to the first $n$
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    99
  premises of $thm$.  Because the theorems are used from right to left, it
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   100
  does not matter if the $thm@i$ create new premises.  {\tt MRS} is useful
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   101
  for expressing proof trees.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   102
151
c5e636ca6576 corrected some obvious errors;
wenzelm
parents: 104
diff changeset
   103
\item[\tt$thms@1$ RLN $(i,thms@2)$] \indexbold{*RLN} 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   104
  joins lists of theorems.  For every $thm@1$ in $thms@1$ and $thm@2$ in
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   105
  $thms@2$, it resolves the conclusion of $thm@1$ with the $i$th premise
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   106
  of~$thm@2$, accumulating the results. 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   107
151
c5e636ca6576 corrected some obvious errors;
wenzelm
parents: 104
diff changeset
   108
\item[\tt$thms@1$ RL $thms@2$] \indexbold{*RL} 
c5e636ca6576 corrected some obvious errors;
wenzelm
parents: 104
diff changeset
   109
abbreviates \hbox{\tt$thms@1$ RLN $(1,thms@2)$}. 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   110
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   111
\item[\tt {$[thms@1,\ldots,thms@n]$} MRL $thms$] \indexbold{*MRL} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   112
is analogous to {\tt MRS}, but combines theorem lists rather than theorems.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   113
It too is useful for expressing proof trees.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   114
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   115
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   116
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   117
\subsection{Expanding definitions in theorems}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   118
\index{meta-rewriting!in theorems}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   119
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   120
rewrite_rule       : thm list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   121
rewrite_goals_rule : thm list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   122
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   123
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   124
\item[\ttindexbold{rewrite_rule} {\it defs} {\it thm}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   125
unfolds the {\it defs} throughout the theorem~{\it thm}.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   126
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   127
\item[\ttindexbold{rewrite_goals_rule} {\it defs} {\it thm}]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   128
unfolds the {\it defs} in the premises of~{\it thm}, but leaves the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   129
conclusion unchanged.  This rule underlies \ttindex{rewrite_goals_tac}, but 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   130
serves little purpose in forward proof.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   131
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   132
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   133
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   134
\subsection{Instantiating a theorem}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   135
\index{instantiation}
286
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   136
\begin{ttbox}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   137
read_instantiate    :            (string*string)list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   138
read_instantiate_sg : Sign.sg -> (string*string)list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   139
cterm_instantiate   :    (Sign.cterm*Sign.cterm)list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   140
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   141
These meta-rules instantiate type and term unknowns in a theorem.  They are
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   142
occasionally useful.  They can prevent difficulties with higher-order
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   143
unification, and define specialized versions of rules.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   144
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   145
\item[\ttindexbold{read_instantiate} {\it insts} {\it thm}] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   146
processes the instantiations {\it insts} and instantiates the rule~{\it
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   147
thm}.  The processing of instantiations is described
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   148
in \S\ref{res_inst_tac}, under {\tt res_inst_tac}.  
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   149
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   150
Use {\tt res_inst_tac}, not {\tt read_instantiate}, to instantiate a rule
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   151
and refine a particular subgoal.  The tactic allows instantiation by the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   152
subgoal's parameters, and reads the instantiations using the signature
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   153
associated with the proof state.
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   154
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   155
Use {\tt read_instantiate_sg} below if {\it insts\/} appears to be treated
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   156
incorrectly.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   157
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   158
\item[\ttindexbold{read_instantiate_sg} {\it sg} {\it insts} {\it thm}]
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   159
  resembles \hbox{\tt read_instantiate {\it insts} {\it thm}}, but reads
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   160
  the instantiations under signature~{\it sg}.  This is necessary to
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   161
  instantiate a rule from a general theory, such as first-order logic,
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   162
  using the notation of some specialized theory.  Use the function {\tt
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   163
    sign_of} to get a theory's signature.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   164
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   165
\item[\ttindexbold{cterm_instantiate} {\it ctpairs} {\it thm}] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   166
is similar to {\tt read_instantiate}, but the instantiations are provided
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   167
as pairs of certified terms, not as strings to be read.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   168
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   169
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   170
866
2d3d020eef11 added documentation of bind_thm, qed, qed_goal, get_thm, thms_of
clasohm
parents: 332
diff changeset
   171
\subsection{Miscellaneous forward rules}\label{MiscellaneousForwardRules}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   172
\index{theorems!standardizing}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   173
\begin{ttbox} 
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   174
standard         :           thm -> thm
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   175
zero_var_indexes :           thm -> thm
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   176
make_elim        :           thm -> thm
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   177
rule_by_tactic   : tactic -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   178
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   179
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   180
\item[\ttindexbold{standard} $thm$]  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   181
puts $thm$ into the standard form of object-rules.  It discharges all
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   182
meta-assumptions, replaces free variables by schematic variables, and
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   183
renames schematic variables to have subscript zero.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   184
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   185
\item[\ttindexbold{zero_var_indexes} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   186
makes all schematic variables have subscript zero, renaming them to avoid
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   187
clashes. 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   188
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   189
\item[\ttindexbold{make_elim} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   190
\index{rules!converting destruction to elimination}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   191
converts $thm$, a destruction rule of the form $\List{P@1;\ldots;P@m}\Imp
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   192
Q$, to the elimination rule $\List{P@1; \ldots; P@m; Q\Imp R}\Imp R$.  This
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   193
is the basis for destruct-resolution: {\tt dresolve_tac}, etc.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   194
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   195
\item[\ttindexbold{rule_by_tactic} {\it tac} {\it thm}] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   196
  applies {\it tac\/} to the {\it thm}, freezing its variables first, then
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   197
  yields the proof state returned by the tactic.  In typical usage, the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   198
  {\it thm\/} represents an instance of a rule with several premises, some
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   199
  with contradictory assumptions (because of the instantiation).  The
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   200
  tactic proves those subgoals and does whatever else it can, and returns
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   201
  whatever is left.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   202
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   203
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   204
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   205
\subsection{Taking a theorem apart}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   206
\index{theorems!taking apart}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   207
\index{flex-flex constraints}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   208
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   209
concl_of      : thm -> term
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   210
prems_of      : thm -> term list
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   211
nprems_of     : thm -> int
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   212
tpairs_of     : thm -> (term*term)list
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   213
stamps_of_thy : thm -> string ref list
866
2d3d020eef11 added documentation of bind_thm, qed, qed_goal, get_thm, thms_of
clasohm
parents: 332
diff changeset
   214
theory_of_thm : thm -> theory
286
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   215
dest_state    : thm*int -> (term*term)list*term list*term*term
2040
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   216
rep_thm       : thm -> \{prop: term, hyps: term list, der: deriv, 
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   217
                        maxidx: int, sign: Sign.sg, shyps: sort list\}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   218
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   219
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   220
\item[\ttindexbold{concl_of} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   221
returns the conclusion of $thm$ as a term.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   222
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   223
\item[\ttindexbold{prems_of} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   224
returns the premises of $thm$ as a list of terms.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   225
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   226
\item[\ttindexbold{nprems_of} $thm$] 
286
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   227
returns the number of premises in $thm$, and is equivalent to {\tt
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   228
  length(prems_of~$thm$)}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   229
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   230
\item[\ttindexbold{tpairs_of} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   231
returns the flex-flex constraints of $thm$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   232
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   233
\item[\ttindexbold{stamps_of_thm} $thm$] 
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   234
returns the \rmindex{stamps} of the signature associated with~$thm$.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   235
866
2d3d020eef11 added documentation of bind_thm, qed, qed_goal, get_thm, thms_of
clasohm
parents: 332
diff changeset
   236
\item[\ttindexbold{theory_of_thm} $thm$]
2d3d020eef11 added documentation of bind_thm, qed, qed_goal, get_thm, thms_of
clasohm
parents: 332
diff changeset
   237
returns the theory associated with $thm$.
2d3d020eef11 added documentation of bind_thm, qed, qed_goal, get_thm, thms_of
clasohm
parents: 332
diff changeset
   238
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   239
\item[\ttindexbold{dest_state} $(thm,i)$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   240
decomposes $thm$ as a tuple containing a list of flex-flex constraints, a
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   241
list of the subgoals~1 to~$i-1$, subgoal~$i$, and the rest of the theorem
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   242
(this will be an implication if there are more than $i$ subgoals).
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   243
2040
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   244
\item[\ttindexbold{rep_thm} $thm$] decomposes $thm$ as a record containing the
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   245
  statement of~$thm$ ({\tt prop}), its list of meta-assumptions ({\tt hyps}),
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   246
  its derivation ({\tt der}), a bound on the maximum subscript of its
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   247
  unknowns ({\tt maxidx}), and its signature ({\tt sign}).  The {\tt shyps}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   248
  field is discussed below.
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   249
\end{ttdescription}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   250
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   251
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   252
\subsection{*Sort hypotheses} 
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   253
\index{sort hypotheses}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   254
\begin{ttbox} 
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   255
force_strip_shyps : bool ref \hfill{\bf initially true}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   256
\end{ttbox}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   257
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   258
\begin{ttdescription}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   259
\item[\ttindexbold{force_strip_shyps}]
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   260
causes sort hypotheses to be deleted, printing a warning.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   261
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   262
2040
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   263
A sort is {\em empty\/} if there are no types having that sort.  If a theorem
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   264
contain a type variable whose sort is empty, then that theorem has no
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   265
instances.  In effect, it asserts nothing.  But what if it is used to prove
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   266
another theorem that no longer involves that sort?  The latter theorem holds
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   267
only if the sort is non-empty.
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   268
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   269
Theorems are therefore subject to sort hypotheses, which express that certain
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   270
sorts are non-empty.  The {\tt shyps} field is a list of sorts occurring in
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   271
type variables.  The list includes all sorts from the current theorem (the
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   272
{\tt prop} and {\tt hyps} fields).  It also includes sorts used in the
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   273
theorem's proof --- so-called {\em dangling\/} sort constraints.  These are
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   274
the critical ones that must be non-empty in order for the proof to be valid.
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   275
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   276
Isabelle removes sorts from the {\tt shyps} field whenever
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   277
non-emptiness holds.  Because its current implementation is highly incomplete,
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   278
the flag shown above is available.  Setting it to true (the default) allows
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   279
existing proofs to run.
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   280
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   281
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   282
\subsection{Tracing flags for unification}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   283
\index{tracing!of unification}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   284
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   285
Unify.trace_simp   : bool ref \hfill{\bf initially false}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   286
Unify.trace_types  : bool ref \hfill{\bf initially false}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   287
Unify.trace_bound  : int ref \hfill{\bf initially 10}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   288
Unify.search_bound : int ref \hfill{\bf initially 20}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   289
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   290
Tracing the search may be useful when higher-order unification behaves
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   291
unexpectedly.  Letting {\tt res_inst_tac} circumvent the problem is easier,
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   292
though.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   293
\begin{ttdescription}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   294
\item[Unify.trace_simp := true;] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   295
causes tracing of the simplification phase.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   296
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   297
\item[Unify.trace_types := true;] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   298
generates warnings of incompleteness, when unification is not considering
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   299
all possible instantiations of type unknowns.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   300
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   301
\item[Unify.trace_bound := $n$;] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   302
causes unification to print tracing information once it reaches depth~$n$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   303
Use $n=0$ for full tracing.  At the default value of~10, tracing
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   304
information is almost never printed.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   305
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   306
\item[Unify.search_bound := $n$;] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   307
causes unification to limit its search to depth~$n$.  Because of this
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   308
bound, higher-order unification cannot return an infinite sequence, though
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   309
it can return a very long one.  The search rarely approaches the default
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   310
value of~20.  If the search is cut off, unification prints {\tt
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   311
***Unification bound exceeded}.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   312
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   313
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   314
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   315
\section{Primitive meta-level inference rules}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   316
\index{meta-rules|(}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   317
These implement the meta-logic in {\sc lcf} style, as functions from theorems
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   318
to theorems.  They are, rarely, useful for deriving results in the pure
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   319
theory.  Mainly, they are included for completeness, and most users should
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   320
not bother with them.  The meta-rules raise exception \xdx{THM} to signal
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   321
malformed premises, incompatible signatures and similar errors.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   322
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   323
\index{meta-assumptions}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   324
The meta-logic uses natural deduction.  Each theorem may depend on
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   325
meta-level assumptions.  Certain rules, such as $({\Imp}I)$,
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   326
discharge assumptions; in most other rules, the conclusion depends on all
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   327
of the assumptions of the premises.  Formally, the system works with
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   328
assertions of the form
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   329
\[ \phi \quad [\phi@1,\ldots,\phi@n], \]
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   330
where $\phi@1$,~\ldots,~$\phi@n$ are the assumptions.  Do not confuse
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   331
meta-level assumptions with the object-level assumptions in a subgoal,
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   332
which are represented in the meta-logic using~$\Imp$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   333
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   334
Each theorem has a signature.  Certified terms have a signature.  When a
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   335
rule takes several premises and certified terms, it merges the signatures
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   336
to make a signature for the conclusion.  This fails if the signatures are
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   337
incompatible. 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   338
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   339
\index{meta-implication}
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   340
The {\bf implication} rules are $({\Imp}I)$
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   341
and $({\Imp}E)$:
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   342
\[ \infer[({\Imp}I)]{\phi\Imp \psi}{\infer*{\psi}{[\phi]}}  \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   343
   \infer[({\Imp}E)]{\psi}{\phi\Imp \psi & \phi}  \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   344
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   345
\index{meta-equality}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   346
Equality of truth values means logical equivalence:
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   347
\[ \infer[({\equiv}I)]{\phi\equiv\psi}{\infer*{\psi}{[\phi]} &
286
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   348
                                       \infer*{\phi}{[\psi]}}  
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   349
   \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   350
   \infer[({\equiv}E)]{\psi}{\phi\equiv \psi & \phi}   \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   351
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   352
The {\bf equality} rules are reflexivity, symmetry, and transitivity:
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   353
\[ {a\equiv a}\,(refl)  \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   354
   \infer[(sym)]{b\equiv a}{a\equiv b}  \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   355
   \infer[(trans)]{a\equiv c}{a\equiv b & b\equiv c}   \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   356
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   357
\index{lambda calc@$\lambda$-calculus}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   358
The $\lambda$-conversions are $\alpha$-conversion, $\beta$-conversion, and
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   359
extensionality:\footnote{$\alpha$-conversion holds if $y$ is not free
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   360
in~$a$; $(ext)$ holds if $x$ is not free in the assumptions, $f$, or~$g$.}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   361
\[ {(\lambda x.a) \equiv (\lambda y.a[y/x])}    \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   362
   {((\lambda x.a)(b)) \equiv a[b/x]}           \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   363
   \infer[(ext)]{f\equiv g}{f(x) \equiv g(x)}   \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   364
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   365
The {\bf abstraction} and {\bf combination} rules let conversions be
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   366
applied to subterms:\footnote{Abstraction holds if $x$ is not free in the
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   367
assumptions.}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   368
\[  \infer[(abs)]{(\lambda x.a) \equiv (\lambda x.b)}{a\equiv b}   \qquad
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   369
    \infer[(comb)]{f(a)\equiv g(b)}{f\equiv g & a\equiv b}   \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   370
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   371
\index{meta-quantifiers}
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   372
The {\bf universal quantification} rules are $(\Forall I)$ and $(\Forall
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   373
E)$:\footnote{$(\Forall I)$ holds if $x$ is not free in the assumptions.}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   374
\[ \infer[(\Forall I)]{\Forall x.\phi}{\phi}        \qquad
286
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   375
   \infer[(\Forall E)]{\phi[b/x]}{\Forall x.\phi}   \]
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   376
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   377
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   378
\subsection{Assumption rule}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   379
\index{meta-assumptions}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   380
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   381
assume: Sign.cterm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   382
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   383
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   384
\item[\ttindexbold{assume} $ct$] 
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   385
makes the theorem \(\phi \;[\phi]\), where $\phi$ is the value of~$ct$.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   386
The rule checks that $ct$ has type $prop$ and contains no unknowns, which
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   387
are not allowed in assumptions.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   388
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   389
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   390
\subsection{Implication rules}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   391
\index{meta-implication}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   392
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   393
implies_intr      : Sign.cterm -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   394
implies_intr_list : Sign.cterm list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   395
implies_intr_hyps : thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   396
implies_elim      : thm -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   397
implies_elim_list : thm -> thm list -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   398
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   399
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   400
\item[\ttindexbold{implies_intr} $ct$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   401
is $({\Imp}I)$, where $ct$ is the assumption to discharge, say~$\phi$.  It
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   402
maps the premise~$\psi$ to the conclusion $\phi\Imp\psi$, removing all
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   403
occurrences of~$\phi$ from the assumptions.  The rule checks that $ct$ has
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   404
type $prop$. 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   405
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   406
\item[\ttindexbold{implies_intr_list} $cts$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   407
applies $({\Imp}I)$ repeatedly, on every element of the list~$cts$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   408
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   409
\item[\ttindexbold{implies_intr_hyps} $thm$] 
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   410
applies $({\Imp}I)$ to discharge all the hypotheses (assumptions) of~$thm$.
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   411
It maps the premise $\phi \; [\phi@1,\ldots,\phi@n]$ to the conclusion
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   412
$\List{\phi@1,\ldots,\phi@n}\Imp\phi$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   413
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   414
\item[\ttindexbold{implies_elim} $thm@1$ $thm@2$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   415
applies $({\Imp}E)$ to $thm@1$ and~$thm@2$.  It maps the premises $\phi\Imp
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   416
\psi$ and $\phi$ to the conclusion~$\psi$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   417
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   418
\item[\ttindexbold{implies_elim_list} $thm$ $thms$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   419
applies $({\Imp}E)$ repeatedly to $thm$, using each element of~$thms$ in
151
c5e636ca6576 corrected some obvious errors;
wenzelm
parents: 104
diff changeset
   420
turn.  It maps the premises $\List{\phi@1,\ldots,\phi@n}\Imp\psi$ and
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   421
$\phi@1$,\ldots,$\phi@n$ to the conclusion~$\psi$.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   422
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   423
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   424
\subsection{Logical equivalence rules}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   425
\index{meta-equality}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   426
\begin{ttbox} 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   427
equal_intr : thm -> thm -> thm 
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   428
equal_elim : thm -> thm -> thm
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   429
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   430
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   431
\item[\ttindexbold{equal_intr} $thm@1$ $thm@2$] 
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   432
applies $({\equiv}I)$ to $thm@1$ and~$thm@2$.  It maps the premises~$\psi$
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   433
and~$\phi$ to the conclusion~$\phi\equiv\psi$; the assumptions are those of
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   434
the first premise with~$\phi$ removed, plus those of
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   435
the second premise with~$\psi$ removed.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   436
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   437
\item[\ttindexbold{equal_elim} $thm@1$ $thm@2$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   438
applies $({\equiv}E)$ to $thm@1$ and~$thm@2$.  It maps the premises
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   439
$\phi\equiv\psi$ and $\phi$ to the conclusion~$\psi$.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   440
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   441
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   442
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   443
\subsection{Equality rules}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   444
\index{meta-equality}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   445
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   446
reflexive  : Sign.cterm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   447
symmetric  : thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   448
transitive : thm -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   449
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   450
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   451
\item[\ttindexbold{reflexive} $ct$] 
151
c5e636ca6576 corrected some obvious errors;
wenzelm
parents: 104
diff changeset
   452
makes the theorem \(ct\equiv ct\). 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   453
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   454
\item[\ttindexbold{symmetric} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   455
maps the premise $a\equiv b$ to the conclusion $b\equiv a$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   456
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   457
\item[\ttindexbold{transitive} $thm@1$ $thm@2$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   458
maps the premises $a\equiv b$ and $b\equiv c$ to the conclusion~${a\equiv c}$.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   459
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   460
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   461
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   462
\subsection{The $\lambda$-conversion rules}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   463
\index{lambda calc@$\lambda$-calculus}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   464
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   465
beta_conversion : Sign.cterm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   466
extensional     : thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   467
abstract_rule   : string -> Sign.cterm -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   468
combination     : thm -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   469
\end{ttbox} 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   470
There is no rule for $\alpha$-conversion because Isabelle regards
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   471
$\alpha$-convertible theorems as equal.
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   472
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   473
\item[\ttindexbold{beta_conversion} $ct$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   474
makes the theorem $((\lambda x.a)(b)) \equiv a[b/x]$, where $ct$ is the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   475
term $(\lambda x.a)(b)$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   476
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   477
\item[\ttindexbold{extensional} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   478
maps the premise $f(x) \equiv g(x)$ to the conclusion $f\equiv g$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   479
Parameter~$x$ is taken from the premise.  It may be an unknown or a free
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   480
variable (provided it does not occur in the assumptions); it must not occur
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   481
in $f$ or~$g$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   482
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   483
\item[\ttindexbold{abstract_rule} $v$ $x$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   484
maps the premise $a\equiv b$ to the conclusion $(\lambda x.a) \equiv
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   485
(\lambda x.b)$, abstracting over all occurrences (if any!) of~$x$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   486
Parameter~$x$ is supplied as a cterm.  It may be an unknown or a free
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   487
variable (provided it does not occur in the assumptions).  In the
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   488
conclusion, the bound variable is named~$v$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   489
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   490
\item[\ttindexbold{combination} $thm@1$ $thm@2$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   491
maps the premises $f\equiv g$ and $a\equiv b$ to the conclusion~$f(a)\equiv
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   492
g(b)$.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   493
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   494
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   495
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   496
\subsection{Forall introduction rules}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   497
\index{meta-quantifiers}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   498
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   499
forall_intr       : Sign.cterm      -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   500
forall_intr_list  : Sign.cterm list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   501
forall_intr_frees :                    thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   502
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   503
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   504
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   505
\item[\ttindexbold{forall_intr} $x$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   506
applies $({\Forall}I)$, abstracting over all occurrences (if any!) of~$x$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   507
The rule maps the premise $\phi$ to the conclusion $\Forall x.\phi$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   508
Parameter~$x$ is supplied as a cterm.  It may be an unknown or a free
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   509
variable (provided it does not occur in the assumptions).
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   510
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   511
\item[\ttindexbold{forall_intr_list} $xs$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   512
applies $({\Forall}I)$ repeatedly, on every element of the list~$xs$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   513
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   514
\item[\ttindexbold{forall_intr_frees} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   515
applies $({\Forall}I)$ repeatedly, generalizing over all the free variables
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   516
of the premise.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   517
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   518
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   519
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   520
\subsection{Forall elimination rules}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   521
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   522
forall_elim       : Sign.cterm      -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   523
forall_elim_list  : Sign.cterm list -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   524
forall_elim_var   :             int -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   525
forall_elim_vars  :             int -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   526
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   527
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   528
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   529
\item[\ttindexbold{forall_elim} $ct$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   530
applies $({\Forall}E)$, mapping the premise $\Forall x.\phi$ to the conclusion
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   531
$\phi[ct/x]$.  The rule checks that $ct$ and $x$ have the same type.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   532
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   533
\item[\ttindexbold{forall_elim_list} $cts$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   534
applies $({\Forall}E)$ repeatedly, on every element of the list~$cts$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   535
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   536
\item[\ttindexbold{forall_elim_var} $k$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   537
applies $({\Forall}E)$, mapping the premise $\Forall x.\phi$ to the conclusion
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   538
$\phi[\Var{x@k}/x]$.  Thus, it replaces the outermost $\Forall$-bound
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   539
variable by an unknown having subscript~$k$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   540
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   541
\item[\ttindexbold{forall_elim_vars} $ks$ $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   542
applies {\tt forall_elim_var} repeatedly, for every element of the list~$ks$.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   543
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   544
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   545
\subsection{Instantiation of unknowns}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   546
\index{instantiation}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   547
\begin{ttbox} 
286
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   548
instantiate: (indexname*Sign.ctyp)list * 
e7efbf03562b first draft of Springer book
lcp
parents: 151
diff changeset
   549
             (Sign.cterm*Sign.cterm)list  -> thm -> thm
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   550
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   551
\begin{ttdescription}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   552
\item[\ttindexbold{instantiate} ($tyinsts$, $insts$) $thm$] 
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   553
simultaneously substitutes types for type unknowns (the
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   554
$tyinsts$) and terms for term unknowns (the $insts$).  Instantiations are
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   555
given as $(v,t)$ pairs, where $v$ is an unknown and $t$ is a term (of the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   556
same type as $v$) or a type (of the same sort as~$v$).  All the unknowns
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   557
must be distinct.  The rule normalizes its conclusion.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   558
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   559
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   560
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   561
\subsection{Freezing/thawing type unknowns}
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   562
\index{type unknowns!freezing/thawing of}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   563
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   564
freezeT: thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   565
varifyT: thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   566
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   567
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   568
\item[\ttindexbold{freezeT} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   569
converts all the type unknowns in $thm$ to free type variables.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   570
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   571
\item[\ttindexbold{varifyT} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   572
converts all the free type variables in $thm$ to type unknowns.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   573
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   574
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   575
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   576
\section{Derived rules for goal-directed proof}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   577
Most of these rules have the sole purpose of implementing particular
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   578
tactics.  There are few occasions for applying them directly to a theorem.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   579
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   580
\subsection{Proof by assumption}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   581
\index{meta-assumptions}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   582
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   583
assumption    : int -> thm -> thm Sequence.seq
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   584
eq_assumption : int -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   585
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   586
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   587
\item[\ttindexbold{assumption} {\it i} $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   588
attempts to solve premise~$i$ of~$thm$ by assumption.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   589
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   590
\item[\ttindexbold{eq_assumption}] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   591
is like {\tt assumption} but does not use unification.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   592
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   593
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   594
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   595
\subsection{Resolution}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   596
\index{resolution}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   597
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   598
biresolution : bool -> (bool*thm)list -> int -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   599
               -> thm Sequence.seq
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   600
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   601
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   602
\item[\ttindexbold{biresolution} $match$ $rules$ $i$ $state$] 
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   603
performs bi-resolution on subgoal~$i$ of $state$, using the list of $\it
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   604
(flag,rule)$ pairs.  For each pair, it applies resolution if the flag
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   605
is~{\tt false} and elim-resolution if the flag is~{\tt true}.  If $match$
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   606
is~{\tt true}, the $state$ is not instantiated.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   607
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   608
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   609
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   610
\subsection{Composition: resolution without lifting}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   611
\index{resolution!without lifting}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   612
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   613
compose   : thm * int * thm -> thm list
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   614
COMP      : thm * thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   615
bicompose : bool -> bool * thm * int -> int -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   616
            -> thm Sequence.seq
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   617
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   618
In forward proof, a typical use of composition is to regard an assertion of
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   619
the form $\phi\Imp\psi$ as atomic.  Schematic variables are not renamed, so
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   620
beware of clashes!
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   621
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   622
\item[\ttindexbold{compose} ($thm@1$, $i$, $thm@2$)] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   623
uses $thm@1$, regarded as an atomic formula, to solve premise~$i$
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   624
of~$thm@2$.  Let $thm@1$ and $thm@2$ be $\psi$ and $\List{\phi@1; \ldots;
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   625
\phi@n} \Imp \phi$.  For each $s$ that unifies~$\psi$ and $\phi@i$, the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   626
result list contains the theorem
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   627
\[ (\List{\phi@1; \ldots; \phi@{i-1}; \phi@{i+1}; \ldots; \phi@n} \Imp \phi)s.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   628
\]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   629
1119
49ed9a415637 Indexing of COMP
lcp
parents: 876
diff changeset
   630
\item[$thm@1$ \ttindexbold{COMP} $thm@2$] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   631
calls \hbox{\tt compose ($thm@1$, 1, $thm@2$)} and returns the result, if
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   632
unique; otherwise, it raises exception~\xdx{THM}\@.  It is
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   633
analogous to {\tt RS}\@.  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   634
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   635
For example, suppose that $thm@1$ is $a=b\Imp b=a$, a symmetry rule, and
332
01b87a921967 final Springer copy
lcp
parents: 326
diff changeset
   636
that $thm@2$ is $\List{P\Imp Q; \neg Q} \Imp\neg P$, which is the
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   637
principle of contrapositives.  Then the result would be the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   638
derived rule $\neg(b=a)\Imp\neg(a=b)$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   639
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   640
\item[\ttindexbold{bicompose} $match$ ($flag$, $rule$, $m$) $i$ $state$]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   641
refines subgoal~$i$ of $state$ using $rule$, without lifting.  The $rule$
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   642
is taken to have the form $\List{\psi@1; \ldots; \psi@m} \Imp \psi$, where
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   643
$\psi$ need not be atomic; thus $m$ determines the number of new
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   644
subgoals.  If $flag$ is {\tt true} then it performs elim-resolution --- it
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   645
solves the first premise of~$rule$ by assumption and deletes that
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   646
assumption.  If $match$ is~{\tt true}, the $state$ is not instantiated.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   647
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   648
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   649
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   650
\subsection{Other meta-rules}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   651
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   652
trivial            : Sign.cterm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   653
lift_rule          : (thm * int) -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   654
rename_params_rule : string list * int -> thm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   655
rewrite_cterm      : thm list -> Sign.cterm -> thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   656
flexflex_rule      : thm -> thm Sequence.seq
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   657
\end{ttbox}
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   658
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   659
\item[\ttindexbold{trivial} $ct$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   660
makes the theorem \(\phi\Imp\phi\), where $\phi$ is the value of~$ct$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   661
This is the initial state for a goal-directed proof of~$\phi$.  The rule
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   662
checks that $ct$ has type~$prop$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   663
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   664
\item[\ttindexbold{lift_rule} ($state$, $i$) $rule$] \index{lifting}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   665
prepares $rule$ for resolution by lifting it over the parameters and
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   666
assumptions of subgoal~$i$ of~$state$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   667
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   668
\item[\ttindexbold{rename_params_rule} ({\it names}, {\it i}) $thm$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   669
uses the $names$ to rename the parameters of premise~$i$ of $thm$.  The
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   670
names must be distinct.  If there are fewer names than parameters, then the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   671
rule renames the innermost parameters and may modify the remaining ones to
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   672
ensure that all the parameters are distinct.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   673
\index{parameters!renaming}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   674
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   675
\item[\ttindexbold{rewrite_cterm} $defs$ $ct$]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   676
transforms $ct$ to $ct'$ by repeatedly applying $defs$ as rewrite rules; it
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   677
returns the conclusion~$ct\equiv ct'$.  This underlies the meta-rewriting
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   678
tactics and rules.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   679
\index{meta-rewriting!in terms}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   680
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   681
\item[\ttindexbold{flexflex_rule} $thm$]  \index{flex-flex constraints}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   682
removes all flex-flex pairs from $thm$ using the trivial unifier.
326
bef614030e24 penultimate Springer draft
lcp
parents: 286
diff changeset
   683
\end{ttdescription}
1590
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   684
\index{meta-rules|)}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   685
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   686
1846
763f08fb194f Documentation of oracles and their syntax
paulson
parents: 1590
diff changeset
   687
\section{Proof objects}\label{sec:proofObjects}
1590
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   688
\index{proof objects|(} Isabelle can record the full meta-level proof of each
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   689
theorem.  The proof object contains all logical inferences in detail, while
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   690
omitting bookkeeping steps that have no logical meaning to an outside
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   691
observer.  Rewriting steps are recorded in similar detail as the output of
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   692
simplifier tracing.  The proof object can be inspected by a separate
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   693
proof-checker, or used to generate human-readable proof digests.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   694
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   695
Full proof objects are large.  They multiply storage requirements by about
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   696
seven; attempts to build large logics (such as {\sc zf} and {\sc hol}) may
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   697
fail.  Isabelle normally builds minimal proof objects, which include only uses
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   698
of oracles.  You can also request an intermediate level of detail, containing
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   699
uses of oracles, axioms and theorems.  These smaller proof objects indicate a
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   700
theorem's dependencies.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   701
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   702
Isabelle provides proof objects for the sake of transparency.  Their aim is to
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   703
increase your confidence in Isabelle.  They let you inspect proofs constructed
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   704
by the classical reasoner or simplifier, and inform you of all uses of
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   705
oracles.  Seldom will proof objects be given whole to an automatic
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   706
proof-checker: none has been written.  It is up to you to examine and
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   707
interpret them sensibly.  For example, when scrutinizing a theorem's
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   708
derivation for dependence upon some oracle or axiom, remember to scrutinize
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   709
all of its lemmas.  Their proofs are included in the main derivation, through
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   710
the {\tt Theorem} constructor.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   711
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   712
Proof objects are expressed using a polymorphic type of variable-branching
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   713
trees.  Proof objects (formally known as {\em derivations\/}) are trees
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   714
labelled by rules, where {\tt rule} is a complicated datatype declared in the
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   715
file {\tt Pure/thm.ML}.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   716
\begin{ttbox} 
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   717
datatype 'a mtree = Join of 'a * 'a mtree list;
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   718
datatype rule     = \(\ldots\);
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   719
type deriv        = rule mtree;
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   720
\end{ttbox}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   721
%
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   722
Each theorem's derivation is stored as the {\tt der} field of its internal
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   723
record: 
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   724
\begin{ttbox} 
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   725
#der (rep_thm conjI);
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   726
{\out Join (Theorem ({ProtoPure, CPure, HOL},"conjI"),}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   727
{\out       [Join (MinProof,[])]) : deriv}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   728
\end{ttbox}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   729
This proof object identifies a labelled theorem, {\tt conjI}, whose underlying
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   730
proof has not been recorded; all we have is {\tt MinProof}.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   731
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   732
Nontrivial proof objects are unreadably large and complex.  Isabelle provides
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   733
several functions to help you inspect them informally.  These functions omit
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   734
the more obscure inferences and attempt to restructure the others into natural
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   735
formats, linear or tree-structured.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   736
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   737
\begin{ttbox} 
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   738
keep_derivs  : deriv_kind ref
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   739
Deriv.size   : deriv -> int
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   740
Deriv.drop   : 'a mtree * int -> 'a mtree
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   741
Deriv.linear : deriv -> deriv list
1876
b163e192a2bf Corrected typo involving derivations
paulson
parents: 1846
diff changeset
   742
Deriv.tree   : deriv -> Deriv.orule mtree
1590
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   743
\end{ttbox}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   744
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   745
\begin{ttdescription}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   746
\item[\ttindexbold{keep_derivs} := MinDeriv $|$ ThmDeriv $|$ FullDeriv;] 
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   747
specifies one of the three options for keeping derivations.  They can be
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   748
minimal (oracles only), include theorems and axioms, or be full.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   749
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   750
\item[\ttindexbold{Deriv.size} $der$] yields the size of a derivation,
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   751
  excluding lemmas.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   752
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   753
\item[\ttindexbold{Deriv.drop} ($tree$,$n$)] returns the subtree $n$ levels
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   754
  down, always following the first child.  It is good for stripping off
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   755
  outer level inferences that are used to put a theorem into standard form.
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   756
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   757
\item[\ttindexbold{Deriv.linear} $der$] converts a derivation into a linear
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   758
  format, replacing the deep nesting by a list of rules.  Intuitively, this
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   759
  reveals the single-step Isabelle proof that is constructed internally by
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   760
  tactics.  
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   761
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   762
\item[\ttindexbold{Deriv.tree} $der$] converts a derivation into an
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   763
  object-level proof tree.  A resolution by an object-rule is converted to a
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   764
  tree node labelled by that rule.  Complications arise if the object-rule is
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   765
  itself derived in some way.  Nested resolutions are unravelled, but other
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   766
  operations on rules (such as rewriting) are left as-is.  
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   767
\end{ttdescription}
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   768
2040
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   769
Functions {\tt Deriv.linear} and {\tt Deriv.tree} omit the proof of any named
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   770
theorems (constructor {\tt Theorem}) they encounter in a derivation.  Applying
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   771
them directly to the derivation of a named theorem is therefore pointless.
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   772
Use {\tt Deriv.drop} with argument~1 to skip over the initial {\tt Theorem}
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   773
constructor.
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   774
6db93e6f1b11 Documented sort hypotheses and improved discussion of derivations
paulson
parents: 1876
diff changeset
   775
1590
1547174673e1 Describes proof objects and Deriv module
paulson
parents: 1119
diff changeset
   776
\index{proof objects|)}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   777
\index{theorems|)}