doc-src/Logics/LK.tex
author paulson
Fri, 08 Jan 1999 14:02:04 +0100
changeset 6072 5583261db33d
parent 5151 1e944fe5ce96
child 7116 8c1caac3e54e
permissions -rw-r--r--
removal of FOL, ZF to a separate manual
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     1
%% $Id$
291
a615050a7494 first draft of Springer volume
lcp
parents: 264
diff changeset
     2
\chapter{First-Order Sequent Calculus}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
     3
\index{sequent calculus|(}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
     4
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
     5
The theory~\thydx{LK} implements classical first-order logic through
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     6
Gentzen's sequent calculus (see Gallier~\cite{gallier86} or
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     7
Takeuti~\cite{takeuti87}).  Resembling the method of semantic tableaux, the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     8
calculus is well suited for backwards proof.  Assertions have the form
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     9
\(\Gamma\turn \Delta\), where \(\Gamma\) and \(\Delta\) are lists of
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    10
formulae.  Associative unification, simulated by higher-order unification,
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    11
handles lists.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    12
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    13
The logic is many-sorted, using Isabelle's type classes.  The class of
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    14
first-order terms is called \cldx{term}.  No types of individuals are
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    15
provided, but extensions can define types such as {\tt nat::term} and type
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    16
constructors such as {\tt list::(term)term}.  Below, the type variable
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    17
$\alpha$ ranges over class {\tt term}; the equality symbol and quantifiers
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    18
are polymorphic (many-sorted).  The type of formulae is~\tydx{o}, which
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    19
belongs to class {\tt logic}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    20
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    21
No generic packages are instantiated, since Isabelle does not provide
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    22
packages for sequent calculi at present.  \LK{} implements a classical
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    23
logic theorem prover that is as powerful as the generic classical reasoner,
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    24
except that it does not perform equality reasoning.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    25
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    26
To work in LK, start up Isabelle specifying  \texttt{Sequents} as the
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    27
object-logic.  Once in Isabelle, change the context to theory \texttt{LK.thy}:
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    28
\begin{ttbox}
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    29
isabelle Sequents
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    30
context LK.thy;
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    31
\end{ttbox}
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    32
Model logic and linear logic are also available, but unfortunately they are
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    33
not documented.
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
    34
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    35
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    36
\begin{figure} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    37
\begin{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    38
\begin{tabular}{rrr} 
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
    39
  \it name      &\it meta-type          & \it description       \\ 
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    40
  \cdx{Trueprop}& $[sobj\To sobj, sobj\To sobj]\To prop$ & coercion to $prop$\\
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    41
  \cdx{Seqof}   & $[o,sobj]\To sobj$    & singleton sequence    \\
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    42
  \cdx{Not}     & $o\To o$              & negation ($\neg$)     \\
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    43
  \cdx{True}    & $o$                   & tautology ($\top$)    \\
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    44
  \cdx{False}   & $o$                   & absurdity ($\bot$)
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    45
\end{tabular}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    46
\end{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    47
\subcaption{Constants}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    48
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    49
\begin{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    50
\begin{tabular}{llrrr} 
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    51
  \it symbol &\it name     &\it meta-type & \it priority & \it description \\
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    52
  \sdx{ALL}  & \cdx{All}  & $(\alpha\To o)\To o$ & 10 & 
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
    53
        universal quantifier ($\forall$) \\
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    54
  \sdx{EX}   & \cdx{Ex}   & $(\alpha\To o)\To o$ & 10 & 
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
    55
        existential quantifier ($\exists$) \\
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    56
  \sdx{THE} & \cdx{The}  & $(\alpha\To o)\To \alpha$ & 10 & 
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
    57
        definite description ($\iota$)
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    58
\end{tabular}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    59
\end{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    60
\subcaption{Binders} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    61
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    62
\begin{center}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    63
\index{*"= symbol}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    64
\index{&@{\tt\&} symbol}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    65
\index{*"| symbol}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    66
\index{*"-"-"> symbol}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    67
\index{*"<"-"> symbol}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    68
\begin{tabular}{rrrr} 
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    69
    \it symbol  & \it meta-type         & \it priority & \it description \\ 
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
    70
    \tt = &     $[\alpha,\alpha]\To o$  & Left 50 & equality ($=$) \\
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    71
    \tt \& &    $[o,o]\To o$ & Right 35 & conjunction ($\conj$) \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    72
    \tt | &     $[o,o]\To o$ & Right 30 & disjunction ($\disj$) \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    73
    \tt --> &   $[o,o]\To o$ & Right 25 & implication ($\imp$) \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    74
    \tt <-> &   $[o,o]\To o$ & Right 25 & biconditional ($\bimp$) 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    75
\end{tabular}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    76
\end{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    77
\subcaption{Infixes}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    78
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    79
\begin{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    80
\begin{tabular}{rrr} 
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
    81
  \it external          & \it internal  & \it description \\ 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    82
  \tt $\Gamma$ |- $\Delta$  &  \tt Trueprop($\Gamma$, $\Delta$) &
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    83
        sequent $\Gamma\turn \Delta$ 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    84
\end{tabular}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    85
\end{center}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    86
\subcaption{Translations} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    87
\caption{Syntax of {\tt LK}} \label{lk-syntax}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    88
\end{figure}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    89
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    90
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    91
\begin{figure} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    92
\dquotes
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    93
\[\begin{array}{rcl}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    94
    prop & = & sequence " |- " sequence 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    95
\\[2ex]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    96
sequence & = & elem \quad (", " elem)^* \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    97
         & | & empty 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    98
\\[2ex]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    99
    elem & = & "\$ " id \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   100
         & | & "\$ " var \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   101
         & | & formula 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   102
\\[2ex]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   103
 formula & = & \hbox{expression of type~$o$} \\
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   104
         & | & term " = " term \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   105
         & | & "\ttilde\ " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   106
         & | & formula " \& " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   107
         & | & formula " | " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   108
         & | & formula " --> " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   109
         & | & formula " <-> " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   110
         & | & "ALL~" id~id^* " . " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   111
         & | & "EX~~" id~id^* " . " formula \\
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   112
         & | & "THE~" id~     " . " formula
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   113
  \end{array}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   114
\]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   115
\caption{Grammar of {\tt LK}} \label{lk-grammar}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   116
\end{figure}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   117
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   118
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   119
\section{Unification for lists}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   120
Higher-order unification includes associative unification as a special
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   121
case, by an encoding that involves function composition
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   122
\cite[page~37]{huet78}.  To represent lists, let $C$ be a new constant.
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   123
The empty list is $\lambda x. x$, while $[t@1,t@2,\ldots,t@n]$ is
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   124
represented by
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   125
\[ \lambda x. C(t@1,C(t@2,\ldots,C(t@n,x))).  \]
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   126
The unifiers of this with $\lambda x.\Var{f}(\Var{g}(x))$ give all the ways
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   127
of expressing $[t@1,t@2,\ldots,t@n]$ as the concatenation of two lists.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   128
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   129
Unlike orthodox associative unification, this technique can represent certain
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   130
infinite sets of unifiers by flex-flex equations.   But note that the term
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   131
$\lambda x. C(t,\Var{a})$ does not represent any list.  Flex-flex constraints
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   132
containing such garbage terms may accumulate during a proof.
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   133
\index{flex-flex constraints}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   134
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   135
This technique lets Isabelle formalize sequent calculus rules,
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   136
where the comma is the associative operator:
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   137
\[ \infer[(\conj\hbox{-left})]
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   138
         {\Gamma,P\conj Q,\Delta \turn \Theta}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   139
         {\Gamma,P,Q,\Delta \turn \Theta}  \] 
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   140
Multiple unifiers occur whenever this is resolved against a goal containing
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   141
more than one conjunction on the left.  
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   142
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   143
\LK{} exploits this representation of lists.  As an alternative, the
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   144
sequent calculus can be formalized using an ordinary representation of
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   145
lists, with a logic program for removing a formula from a list.  Amy Felty
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   146
has applied this technique using the language $\lambda$Prolog~\cite{felty91a}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   147
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   148
Explicit formalization of sequents can be tiresome.  But it gives precise
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   149
control over contraction and weakening, and is essential to handle relevant
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   150
and linear logics.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   151
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   152
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   153
\begin{figure} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   154
\begin{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   155
\tdx{basic}       $H, P, $G |- $E, P, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   156
\tdx{thinR}       $H |- $E, $F ==> $H |- $E, P, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   157
\tdx{thinL}       $H, $G |- $E ==> $H, P, $G |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   158
\tdx{cut}         [| $H |- $E, P;  $H, P |- $E |] ==> $H |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   159
\subcaption{Structural rules}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   160
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   161
\tdx{refl}        $H |- $E, a=a, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   162
\tdx{sym}         $H |- $E, a=b, $F ==> $H |- $E, b=a, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   163
\tdx{trans}       [| $H|- $E, a=b, $F;  $H|- $E, b=c, $F |] ==> 
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   164
            $H|- $E, a=c, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   165
\subcaption{Equality rules}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   166
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   167
\tdx{True_def}    True  == False-->False
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   168
\tdx{iff_def}     P<->Q == (P-->Q) & (Q-->P)
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   169
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   170
\tdx{conjR}   [| $H|- $E, P, $F;  $H|- $E, Q, $F |] ==> $H|- $E, P&Q, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   171
\tdx{conjL}   $H, P, Q, $G |- $E ==> $H, P & Q, $G |- $E
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   172
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   173
\tdx{disjR}   $H |- $E, P, Q, $F ==> $H |- $E, P|Q, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   174
\tdx{disjL}   [| $H, P, $G |- $E;  $H, Q, $G |- $E |] ==> $H, P|Q, $G |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   175
            
841
14b96e3bd4ab fixed minor typos;
wenzelm
parents: 333
diff changeset
   176
\tdx{impR}    $H, P |- $E, Q, $F ==> $H |- $E, P-->Q, $F
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   177
\tdx{impL}    [| $H,$G |- $E,P;  $H, Q, $G |- $E |] ==> $H, P-->Q, $G |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   178
            
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   179
\tdx{notR}    $H, P |- $E, $F ==> $H |- $E, ~P, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   180
\tdx{notL}    $H, $G |- $E, P ==> $H, ~P, $G |- $E
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   181
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   182
\tdx{FalseL}  $H, False, $G |- $E
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   183
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   184
\tdx{allR}    (!!x. $H|- $E, P(x), $F) ==> $H|- $E, ALL x. P(x), $F
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   185
\tdx{allL}    $H, P(x), $G, ALL x. P(x) |- $E ==> $H, ALL x. P(x), $G|- $E
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   186
            
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   187
\tdx{exR}     $H|- $E, P(x), $F, EX x. P(x) ==> $H|- $E, EX x. P(x), $F
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   188
\tdx{exL}     (!!x. $H, P(x), $G|- $E) ==> $H, EX x. P(x), $G|- $E
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   189
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   190
\tdx{The}     [| $H |- $E, P(a), $F;  !!x. $H, P(x) |- $E, x=a, $F |] ==>
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   191
        $H |- $E, P(THE x. P(x)), $F
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   192
\subcaption{Logical rules}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   193
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   194
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   195
\caption{Rules of {\tt LK}}  \label{lk-rules}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   196
\end{figure}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   197
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   198
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   199
\section{Syntax and rules of inference}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   200
\index{*sobj type}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   201
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   202
Figure~\ref{lk-syntax} gives the syntax for {\tt LK}, which is complicated
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   203
by the representation of sequents.  Type $sobj\To sobj$ represents a list
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   204
of formulae.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   205
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   206
The {\bf definite description} operator~$\iota x. P[x]$ stands for some~$a$
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   207
satisfying~$P[a]$, if one exists and is unique.  Since all terms in \LK{}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   208
denote something, a description is always meaningful, but we do not know
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   209
its value unless $P[x]$ defines it uniquely.  The Isabelle notation is
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   210
\hbox{\tt THE $x$. $P[x]$}.  The corresponding rule (Fig.\ts\ref{lk-rules})
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   211
does not entail the Axiom of Choice because it requires uniqueness.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   212
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   213
Figure~\ref{lk-grammar} presents the grammar of \LK.  Traditionally,
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   214
\(\Gamma\) and \(\Delta\) are meta-variables for sequences.  In Isabelle's
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   215
notation, the prefix~\verb|$| on a variable makes it range over sequences.
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   216
In a sequent, anything not prefixed by \verb|$| is taken as a formula.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   217
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   218
Figure~\ref{lk-rules} presents the rules of theory \thydx{LK}.  The
111
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   219
connective $\bimp$ is defined using $\conj$ and $\imp$.  The axiom for
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   220
basic sequents is expressed in a form that provides automatic thinning:
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   221
redundant formulae are simply ignored.  The other rules are expressed in
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   222
the form most suitable for backward proof --- they do not require exchange
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   223
or contraction rules.  The contraction rules are actually derivable (via
1b3cddf41b2d Various updates for Isabelle-93
lcp
parents: 104
diff changeset
   224
cut) in this formulation.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   225
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   226
Figure~\ref{lk-derived} presents derived rules, including rules for
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   227
$\bimp$.  The weakened quantifier rules discard each quantification after a
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   228
single use; in an automatic proof procedure, they guarantee termination,
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   229
but are incomplete.  Multiple use of a quantifier can be obtained by a
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   230
contraction rule, which in backward proof duplicates a formula.  The tactic
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   231
{\tt res_inst_tac} can instantiate the variable~{\tt?P} in these rules,
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   232
specifying the formula to duplicate.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   233
3148
f081757ce757 tuned ref to src;
wenzelm
parents: 3137
diff changeset
   234
See theory {\tt Sequents/LK} in the sources for complete listings of
f081757ce757 tuned ref to src;
wenzelm
parents: 3137
diff changeset
   235
the rules and derived rules.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   236
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   237
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   238
\begin{figure} 
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   239
\begin{ttbox}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   240
\tdx{conR}        $H |- $E, P, $F, P ==> $H |- $E, P, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   241
\tdx{conL}        $H, P, $G, P |- $E ==> $H, P, $G |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   242
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   243
\tdx{symL}        $H, $G, B = A |- $E ==> $H, A = B, $G |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   244
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   245
\tdx{TrueR}       $H |- $E, True, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   246
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   247
\tdx{iffR}        [| $H, P |- $E, Q, $F;  $H, Q |- $E, P, $F |] ==> 
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   248
            $H |- $E, P<->Q, $F
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   249
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   250
\tdx{iffL}        [| $H, $G |- $E, P, Q;  $H, Q, P, $G |- $E |] ==>
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   251
            $H, P<->Q, $G |- $E
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   252
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   253
\tdx{allL_thin}   $H, P(x), $G |- $E ==> $H, ALL x. P(x), $G |- $E
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   254
\tdx{exR_thin}    $H |- $E, P(x), $F ==> $H |- $E, EX x. P(x), $F
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   255
\end{ttbox}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   256
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   257
\caption{Derived rules for {\tt LK}} \label{lk-derived}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   258
\end{figure}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   259
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   260
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   261
\section{Tactics for the cut rule}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   262
According to the cut-elimination theorem, the cut rule can be eliminated
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   263
from proofs of sequents.  But the rule is still essential.  It can be used
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   264
to structure a proof into lemmas, avoiding repeated proofs of the same
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   265
formula.  More importantly, the cut rule can not be eliminated from
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   266
derivations of rules.  For example, there is a trivial cut-free proof of
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   267
the sequent \(P\conj Q\turn Q\conj P\).
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   268
Noting this, we might want to derive a rule for swapping the conjuncts
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   269
in a right-hand formula:
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   270
\[ \Gamma\turn \Delta, P\conj Q\over \Gamma\turn \Delta, Q\conj P \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   271
The cut rule must be used, for $P\conj Q$ is not a subformula of $Q\conj
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   272
P$.  Most cuts directly involve a premise of the rule being derived (a
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   273
meta-assumption).  In a few cases, the cut formula is not part of any
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   274
premise, but serves as a bridge between the premises and the conclusion.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   275
In such proofs, the cut formula is specified by calling an appropriate
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   276
tactic.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   277
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   278
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   279
cutR_tac : string -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   280
cutL_tac : string -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   281
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   282
These tactics refine a subgoal into two by applying the cut rule.  The cut
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   283
formula is given as a string, and replaces some other formula in the sequent.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   284
\begin{ttdescription}
264
ca6eb7e6e94f correction to cut tactics
lcp
parents: 111
diff changeset
   285
\item[\ttindexbold{cutR_tac} {\it P\/} {\it i}] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   286
reads an \LK{} formula~$P$, and applies the cut rule to subgoal~$i$.  It
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   287
then deletes some formula from the right side of subgoal~$i$, replacing
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   288
that formula by~$P$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   289
264
ca6eb7e6e94f correction to cut tactics
lcp
parents: 111
diff changeset
   290
\item[\ttindexbold{cutL_tac} {\it P\/} {\it i}] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   291
reads an \LK{} formula~$P$, and applies the cut rule to subgoal~$i$.  It
291
a615050a7494 first draft of Springer volume
lcp
parents: 264
diff changeset
   292
then deletes some formula from the left side of the new subgoal $i+1$,
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   293
replacing that formula by~$P$.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   294
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   295
All the structural rules --- cut, contraction, and thinning --- can be
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   296
applied to particular formulae using {\tt res_inst_tac}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   297
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   298
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   299
\section{Tactics for sequents}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   300
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   301
forms_of_seq       : term -> term list
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   302
could_res          : term * term -> bool
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   303
could_resolve_seq  : term * term -> bool
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   304
filseq_resolve_tac : thm list -> int -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   305
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   306
Associative unification is not as efficient as it might be, in part because
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   307
the representation of lists defeats some of Isabelle's internal
333
2ca08f62df33 final Springer copy
lcp
parents: 316
diff changeset
   308
optimisations.  The following operations implement faster rule application,
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   309
and may have other uses.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   310
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   311
\item[\ttindexbold{forms_of_seq} {\it t}] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   312
returns the list of all formulae in the sequent~$t$, removing sequence
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   313
variables.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   314
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   315
\item[\ttindexbold{could_res} ($t$,$u$)] 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   316
tests whether two formula lists could be resolved.  List $t$ is from a
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   317
premise or subgoal, while $u$ is from the conclusion of an object-rule.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   318
Assuming that each formula in $u$ is surrounded by sequence variables, it
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   319
checks that each conclusion formula is unifiable (using {\tt could_unify})
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   320
with some subgoal formula.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   321
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   322
\item[\ttindexbold{could_resolve_seq} ($t$,$u$)] 
291
a615050a7494 first draft of Springer volume
lcp
parents: 264
diff changeset
   323
  tests whether two sequents could be resolved.  Sequent $t$ is a premise
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   324
  or subgoal, while $u$ is the conclusion of an object-rule.  It simply
291
a615050a7494 first draft of Springer volume
lcp
parents: 264
diff changeset
   325
  calls {\tt could_res} twice to check that both the left and the right
a615050a7494 first draft of Springer volume
lcp
parents: 264
diff changeset
   326
  sides of the sequents are compatible.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   327
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   328
\item[\ttindexbold{filseq_resolve_tac} {\it thms} {\it maxr} {\it i}] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   329
uses {\tt filter_thms could_resolve} to extract the {\it thms} that are
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   330
applicable to subgoal~$i$.  If more than {\it maxr\/} theorems are
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   331
applicable then the tactic fails.  Otherwise it calls {\tt resolve_tac}.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   332
Thus, it is the sequent calculus analogue of \ttindex{filt_resolve_tac}.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   333
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   334
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   335
6072
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   336
\section{Packaging sequent rules}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   337
6072
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   338
The sequent calculi come with simple proof procedures.  These are incomplete
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   339
but are reasonably powerful for interactive use.  They expect rules to be
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   340
classified as {\bf safe} or {\bf unsafe}.  A rule is safe if applying it to a
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   341
provable goal always yields provable subgoals.  If a rule is safe then it can
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   342
be applied automatically to a goal without destroying our chances of finding a
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   343
proof.  For instance, all the standard rules of the classical sequent calculus
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   344
{\sc lk} are safe.  An unsafe rule may render the goal unprovable; typical
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   345
examples are the weakened quantifier rules {\tt allL_thin} and {\tt exR_thin}.
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   346
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   347
Proof procedures use safe rules whenever possible, using an unsafe rule as a
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   348
last resort.  Those safe rules are preferred that generate the fewest
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   349
subgoals.  Safe rules are (by definition) deterministic, while the unsafe
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   350
rules require a search strategy, such as backtracking.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   351
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   352
A {\bf pack} is a pair whose first component is a list of safe rules and
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   353
whose second is a list of unsafe rules.  Packs can be extended in an
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   354
obvious way to allow reasoning with various collections of rules.  For
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   355
clarity, \LK{} declares \mltydx{pack} as an \ML{} datatype, although is
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   356
essentially a type synonym:
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   357
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   358
datatype pack = Pack of thm list * thm list;
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   359
\end{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   360
Pattern-matching using constructor {\tt Pack} can inspect a pack's
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   361
contents.  Packs support the following operations:
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   362
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   363
empty_pack  : pack
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   364
prop_pack   : pack
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   365
LK_pack     : pack
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   366
LK_dup_pack : pack
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   367
add_safes   : pack * thm list -> pack               \hfill{\bf infix 4}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   368
add_unsafes : pack * thm list -> pack               \hfill{\bf infix 4}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   369
\end{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   370
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   371
\item[\ttindexbold{empty_pack}] is the empty pack.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   372
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   373
\item[\ttindexbold{prop_pack}] contains the propositional rules, namely
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   374
those for $\conj$, $\disj$, $\neg$, $\imp$ and~$\bimp$, along with the
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   375
rules {\tt basic} and {\tt refl}.  These are all safe.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   376
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   377
\item[\ttindexbold{LK_pack}] 
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   378
extends {\tt prop_pack} with the safe rules {\tt allR}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   379
and~{\tt exL} and the unsafe rules {\tt allL_thin} and
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   380
{\tt exR_thin}.  Search using this is incomplete since quantified
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   381
formulae are used at most once.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   382
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   383
\item[\ttindexbold{LK_dup_pack}] 
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   384
extends {\tt prop_pack} with the safe rules {\tt allR}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   385
and~{\tt exL} and the unsafe rules \tdx{allL} and~\tdx{exR}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   386
Search using this is complete, since quantified formulae may be reused, but
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   387
frequently fails to terminate.  It is generally unsuitable for depth-first
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   388
search.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   389
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   390
\item[$pack$ \ttindexbold{add_safes} $rules$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   391
adds some safe~$rules$ to the pack~$pack$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   392
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   393
\item[$pack$ \ttindexbold{add_unsafes} $rules$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   394
adds some unsafe~$rules$ to the pack~$pack$.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   395
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   396
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   397
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   398
\section{Proof procedures}
6072
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   399
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   400
The \LK{} proof procedure is similar to the classical reasoner
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   401
described in 
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   402
\iflabelundefined{chap:classical}{the {\em Reference Manual\/}}%
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   403
            {Chap.\ts\ref{chap:classical}}.  
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   404
%
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   405
In fact it is simpler, since it works directly with sequents rather than
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   406
simulating them.  There is no need to distinguish introduction rules from
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   407
elimination rules, and of course there is no swap rule.  As always,
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   408
Isabelle's classical proof procedures are less powerful than resolution
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   409
theorem provers.  But they are more natural and flexible, working with an
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   410
open-ended set of rules.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   411
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   412
Backtracking over the choice of a safe rule accomplishes nothing: applying
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   413
them in any order leads to essentially the same result.  Backtracking may
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   414
be necessary over basic sequents when they perform unification.  Suppose
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   415
that~0, 1, 2,~3 are constants in the subgoals
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   416
\[  \begin{array}{c}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   417
      P(0), P(1), P(2) \turn P(\Var{a})  \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   418
      P(0), P(2), P(3) \turn P(\Var{a})  \\
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   419
      P(1), P(3), P(2) \turn P(\Var{a})  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   420
    \end{array}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   421
\]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   422
The only assignment that satisfies all three subgoals is $\Var{a}\mapsto 2$,
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   423
and this can only be discovered by search.  The tactics given below permit
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   424
backtracking only over axioms, such as {\tt basic} and {\tt refl};
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   425
otherwise they are deterministic.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   426
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   427
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   428
\subsection{Method A}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   429
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   430
reresolve_tac   : thm list -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   431
repeat_goal_tac : pack -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   432
pc_tac          : pack -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   433
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   434
These tactics use a method developed by Philippe de Groote.  A subgoal is
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   435
refined and the resulting subgoals are attempted in reverse order.  For
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   436
some reason, this is much faster than attempting the subgoals in order.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   437
The method is inherently depth-first.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   438
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   439
At present, these tactics only work for rules that have no more than two
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   440
premises.  They fail --- return no next state --- if they can do nothing.
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   441
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   442
\item[\ttindexbold{reresolve_tac} $thms$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   443
repeatedly applies the $thms$ to subgoal $i$ and the resulting subgoals.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   444
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   445
\item[\ttindexbold{repeat_goal_tac} $pack$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   446
applies the safe rules in the pack to a goal and the resulting subgoals.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   447
If no safe rule is applicable then it applies an unsafe rule and continues.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   448
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   449
\item[\ttindexbold{pc_tac} $pack$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   450
applies {\tt repeat_goal_tac} using depth-first search to solve subgoal~$i$.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   451
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   452
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   453
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   454
\subsection{Method B}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   455
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   456
safe_goal_tac : pack -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   457
step_tac      : pack -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   458
fast_tac      : pack -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   459
best_tac      : pack -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   460
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   461
These tactics are precisely analogous to those of the generic classical
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   462
reasoner.  They use `Method~A' only on safe rules.  They fail if they
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   463
can do nothing.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   464
\begin{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   465
\item[\ttindexbold{safe_goal_tac} $pack$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   466
applies the safe rules in the pack to a goal and the resulting subgoals.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   467
It ignores the unsafe rules.  
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   468
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   469
\item[\ttindexbold{step_tac} $pack$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   470
either applies safe rules (using {\tt safe_goal_tac}) or applies one unsafe
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   471
rule.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   472
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   473
\item[\ttindexbold{fast_tac} $pack$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   474
applies {\tt step_tac} using depth-first search to solve subgoal~$i$.
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   475
Despite its name, it is frequently slower than {\tt pc_tac}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   476
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   477
\item[\ttindexbold{best_tac} $pack$ $i$] 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   478
applies {\tt step_tac} using best-first search to solve subgoal~$i$.  It is
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   479
particularly useful for quantifier duplication (using \ttindex{LK_dup_pack}).
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   480
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   481
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   482
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   483
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   484
\section{A simple example of classical reasoning} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   485
The theorem $\turn\ex{y}\all{x}P(y)\imp P(x)$ is a standard example of the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   486
classical treatment of the existential quantifier.  Classical reasoning
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   487
is easy using~{\LK}, as you can see by comparing this proof with the one
6072
5583261db33d removal of FOL, ZF to a separate manual
paulson
parents: 5151
diff changeset
   488
given in the FOL manual~\cite{isabelle-ZF}.  From a logical point of view, the
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   489
proofs are essentially the same; the key step here is to use \tdx{exR}
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   490
rather than the weaker~\tdx{exR_thin}.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   491
\begin{ttbox}
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   492
Goal "|- EX y. ALL x. P(y)-->P(x)";
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   493
{\out Level 0}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   494
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   495
{\out  1.  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   496
by (resolve_tac [exR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   497
{\out Level 1}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   498
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   499
{\out  1.  |- ALL x. P(?x) --> P(x), EX x. ALL xa. P(x) --> P(xa)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   500
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   501
There are now two formulae on the right side.  Keeping the existential one
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   502
in reserve, we break down the universal one.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   503
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   504
by (resolve_tac [allR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   505
{\out Level 2}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   506
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   507
{\out  1. !!x.  |- P(?x) --> P(x), EX x. ALL xa. P(x) --> P(xa)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   508
by (resolve_tac [impR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   509
{\out Level 3}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   510
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   511
{\out  1. !!x. P(?x) |- P(x), EX x. ALL xa. P(x) --> P(xa)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   512
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   513
Because {\LK} is a sequent calculus, the formula~$P(\Var{x})$ does not
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   514
become an assumption;  instead, it moves to the left side.  The
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   515
resulting subgoal cannot be instantiated to a basic sequent: the bound
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   516
variable~$x$ is not unifiable with the unknown~$\Var{x}$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   517
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   518
by (resolve_tac [basic] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   519
{\out by: tactic failed}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   520
\end{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   521
We reuse the existential formula using~\tdx{exR_thin}, which discards
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   522
it; we shall not need it a third time.  We again break down the resulting
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   523
formula.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   524
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   525
by (resolve_tac [exR_thin] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   526
{\out Level 4}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   527
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   528
{\out  1. !!x. P(?x) |- P(x), ALL xa. P(?x7(x)) --> P(xa)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   529
by (resolve_tac [allR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   530
{\out Level 5}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   531
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   532
{\out  1. !!x xa. P(?x) |- P(x), P(?x7(x)) --> P(xa)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   533
by (resolve_tac [impR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   534
{\out Level 6}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   535
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   536
{\out  1. !!x xa. P(?x), P(?x7(x)) |- P(x), P(xa)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   537
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   538
Subgoal~1 seems to offer lots of possibilities.  Actually the only useful
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   539
step is instantiating~$\Var{x@7}$ to $\lambda x. x$,
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   540
transforming~$\Var{x@7}(x)$ into~$x$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   541
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   542
by (resolve_tac [basic] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   543
{\out Level 7}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   544
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   545
{\out No subgoals!}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   546
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   547
This theorem can be proved automatically.  Because it involves quantifier
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   548
duplication, we employ best-first search:
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   549
\begin{ttbox}
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   550
Goal "|- EX y. ALL x. P(y)-->P(x)";
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   551
{\out Level 0}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   552
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   553
{\out  1.  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   554
by (best_tac LK_dup_pack 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   555
{\out Level 1}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   556
{\out  |- EX y. ALL x. P(y) --> P(x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   557
{\out No subgoals!}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   558
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   559
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   560
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   561
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   562
\section{A more complex proof}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   563
Many of Pelletier's test problems for theorem provers \cite{pelletier86}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   564
can be solved automatically.  Problem~39 concerns set theory, asserting
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   565
that there is no Russell set --- a set consisting of those sets that are
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   566
not members of themselves:
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   567
\[  \turn \neg (\exists x. \forall y. y\in x \bimp y\not\in y) \]
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   568
This does not require special properties of membership; we may
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   569
generalize $x\in y$ to an arbitrary predicate~$F(x,y)$.  The theorem has a
291
a615050a7494 first draft of Springer volume
lcp
parents: 264
diff changeset
   570
short manual proof.  See the directory {\tt LK/ex} for many more
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   571
examples.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   572
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   573
We set the main goal and move the negated formula to the left.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   574
\begin{ttbox}
5151
1e944fe5ce96 Got rid of obsolete "goal" commands.
paulson
parents: 3148
diff changeset
   575
Goal "|- ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   576
{\out Level 0}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   577
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   578
{\out  1.  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   579
by (resolve_tac [notR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   580
{\out Level 1}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   581
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   582
{\out  1. EX x. ALL y. F(y,x) <-> ~ F(y,y) |-}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   583
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   584
The right side is empty; we strip both quantifiers from the formula on the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   585
left.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   586
\begin{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   587
by (resolve_tac [exL] 1);
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   588
{\out Level 2}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   589
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   590
{\out  1. !!x. ALL y. F(y,x) <-> ~ F(y,y) |-}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   591
by (resolve_tac [allL_thin] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   592
{\out Level 3}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   593
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   594
{\out  1. !!x. F(?x2(x),x) <-> ~ F(?x2(x),?x2(x)) |-}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   595
\end{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   596
The rule \tdx{iffL} says, if $P\bimp Q$ then $P$ and~$Q$ are either
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   597
both true or both false.  It yields two subgoals.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   598
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   599
by (resolve_tac [iffL] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   600
{\out Level 4}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   601
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   602
{\out  1. !!x.  |- F(?x2(x),x), ~ F(?x2(x),?x2(x))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   603
{\out  2. !!x. ~ F(?x2(x),?x2(x)), F(?x2(x),x) |-}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   604
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   605
We must instantiate~$\Var{x@2}$, the shared unknown, to satisfy both
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   606
subgoals.  Beginning with subgoal~2, we move a negated formula to the left
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   607
and create a basic sequent.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   608
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   609
by (resolve_tac [notL] 2);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   610
{\out Level 5}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   611
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   612
{\out  1. !!x.  |- F(?x2(x),x), ~ F(?x2(x),?x2(x))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   613
{\out  2. !!x. F(?x2(x),x) |- F(?x2(x),?x2(x))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   614
by (resolve_tac [basic] 2);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   615
{\out Level 6}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   616
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   617
{\out  1. !!x.  |- F(x,x), ~ F(x,x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   618
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   619
Thanks to the instantiation of~$\Var{x@2}$, subgoal~1 is obviously true.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   620
\begin{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   621
by (resolve_tac [notR] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   622
{\out Level 7}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   623
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   624
{\out  1. !!x. F(x,x) |- F(x,x)}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   625
by (resolve_tac [basic] 1);
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   626
{\out Level 8}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   627
{\out  |- ~ (EX x. ALL y. F(y,x) <-> ~ F(y,y))}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   628
{\out No subgoals!}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   629
\end{ttbox}
316
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   630
813ee27cd4d5 penultimate Springer draft
lcp
parents: 291
diff changeset
   631
\index{sequent calculus|)}