doc-src/Ref/classical.tex
author wenzelm
Thu, 03 Nov 2011 23:32:31 +0100
changeset 45329 dd8208a3655a
parent 43367 3f1469de9e47
permissions -rw-r--r--
tuned whitespace;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30184
37969710e61f removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents: 12366
diff changeset
     1
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
     2
\chapter{The Classical Reasoner}\label{chap:classical}
286
e7efbf03562b first draft of Springer book
lcp
parents: 104
diff changeset
     3
\index{classical reasoner|(}
308
f4cecad9b6a0 modifications towards final draft
lcp
parents: 286
diff changeset
     4
\newcommand\ainfer[2]{\begin{array}{r@{\,}l}#2\\ \hline#1\end{array}}
f4cecad9b6a0 modifications towards final draft
lcp
parents: 286
diff changeset
     5
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     6
\section{Classical rule sets}
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
     7
\index{classical sets}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     8
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
     9
For elimination and destruction rules there are variants of the add operations
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    10
adding a rule in a way such that it is applied only if also its second premise
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    11
can be unified with an assumption of the current proof state:
5576
dc6ee60d2be8 exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents: 5550
diff changeset
    12
\indexbold{*addSE2}\indexbold{*addSD2}\indexbold{*addE2}\indexbold{*addD2}
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    13
\begin{ttbox}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    14
addSE2      : claset * (string * thm) -> claset           \hfill{\bf infix 4}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    15
addSD2      : claset * (string * thm) -> claset           \hfill{\bf infix 4}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    16
addE2       : claset * (string * thm) -> claset           \hfill{\bf infix 4}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    17
addD2       : claset * (string * thm) -> claset           \hfill{\bf infix 4}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    18
\end{ttbox}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    19
\begin{warn}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    20
  A rule to be added in this special way must be given a name, which is used 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    21
  to delete it again -- when desired -- using \texttt{delSWrappers} or 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    22
  \texttt{delWrappers}, respectively. This is because these add operations
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    23
  are implemented as wrappers (see \ref{sec:modifying-search} below).
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    24
\end{warn}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    25
1099
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    26
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    27
\subsection{Modifying the search step}
4665
ef6a546d6b69 added minimal description of rep_cs
oheimb
parents: 4649
diff changeset
    28
\label{sec:modifying-search}
3716
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
    29
For a given classical set, the proof strategy is simple.  Perform as many safe
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
    30
inferences as possible; or else, apply certain safe rules, allowing
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
    31
instantiation of unknowns; or else, apply an unsafe rule.  The tactics also
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
    32
eliminate assumptions of the form $x=t$ by substitution if they have been set
11181
d04f57b91166 renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents: 9695
diff changeset
    33
up to do so (see \texttt{hyp_subst_tacs} in~{\S}\ref{sec:classical-setup} below).
3716
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
    34
They may perform a form of Modus Ponens: if there are assumptions $P\imp Q$
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
    35
and~$P$, then replace $P\imp Q$ by~$Q$.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    36
3720
a5b9e0ade194 Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents: 3716
diff changeset
    37
The classical reasoning tactics --- except \texttt{blast_tac}! --- allow
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    38
you to modify this basic proof strategy by applying two lists of arbitrary 
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    39
{\bf wrapper tacticals} to it. 
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    40
The first wrapper list, which is considered to contain safe wrappers only, 
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    41
affects \ttindex{safe_step_tac} and all the tactics that call it.  
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    42
The second one, which may contain unsafe wrappers, affects the unsafe parts
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    43
of \ttindex{step_tac}, \ttindex{slow_step_tac}, and the tactics that call them.
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    44
A wrapper transforms each step of the search, for example 
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    45
by attempting other tactics before or after the original step tactic. 
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    46
All members of a wrapper list are applied in turn to the respective step tactic.
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    47
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    48
Initially the two wrapper lists are empty, which means no modification of the
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    49
step tactics. Safe and unsafe wrappers are added to a claset 
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    50
with the functions given below, supplying them with wrapper names. 
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    51
These names may be used to selectively delete wrappers.
1099
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    52
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    53
\begin{ttbox} 
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    54
type wrapper = (int -> tactic) -> (int -> tactic);
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    55
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    56
addSWrapper  : claset * (string *  wrapper       ) -> claset \hfill{\bf infix 4}
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    57
addSbefore   : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4}
11181
d04f57b91166 renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents: 9695
diff changeset
    58
addSafter    : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4}
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    59
delSWrapper  : claset *  string                    -> claset \hfill{\bf infix 4}
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    60
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    61
addWrapper   : claset * (string *  wrapper       ) -> claset \hfill{\bf infix 4}
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    62
addbefore    : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4}
11181
d04f57b91166 renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents: 9695
diff changeset
    63
addafter     : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4}
4649
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    64
delWrapper   : claset *  string                    -> claset \hfill{\bf infix 4}
89ad3eb863a1 changed wrapper mechanism of classical reasoner
oheimb
parents: 4597
diff changeset
    65
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    66
addSss       : claset * simpset -> claset                 \hfill{\bf infix 4}
2632
1612b99395d4 corrected minor mistakes
oheimb
parents: 2631
diff changeset
    67
addss        : claset * simpset -> claset                 \hfill{\bf infix 4}
1099
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    68
\end{ttbox}
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    69
%
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    70
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
    71
\begin{ttdescription}
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    72
\item[$cs$ addSWrapper $(name,wrapper)$] \indexbold{*addSWrapper}
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    73
adds a new wrapper, which should yield a safe tactic, 
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    74
to modify the existing safe step tactic.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    75
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    76
\item[$cs$ addSbefore $(name,tac)$] \indexbold{*addSbefore}
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    77
adds the given tactic as a safe wrapper, such that it is tried 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    78
{\em before} each safe step of the search.
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    79
11181
d04f57b91166 renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents: 9695
diff changeset
    80
\item[$cs$ addSafter $(name,tac)$] \indexbold{*addSafter}
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    81
adds the given tactic as a safe wrapper, such that it is tried 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    82
when a safe step of the search would fail.
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    83
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    84
\item[$cs$ delSWrapper $name$] \indexbold{*delSWrapper}
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    85
deletes the safe wrapper with the given name.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    86
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    87
\item[$cs$ addWrapper $(name,wrapper)$] \indexbold{*addWrapper}
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    88
adds a new wrapper to modify the existing (unsafe) step tactic.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    89
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    90
\item[$cs$ addbefore $(name,tac)$] \indexbold{*addbefore}
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    91
adds the given tactic as an unsafe wrapper, such that it its result is 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    92
concatenated {\em before} the result of each unsafe step.
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    93
11181
d04f57b91166 renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents: 9695
diff changeset
    94
\item[$cs$ addafter $(name,tac)$] \indexbold{*addafter}
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    95
adds the given tactic as an unsafe wrapper, such that it its result is 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
    96
concatenated {\em after} the result of each unsafe step.
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    97
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    98
\item[$cs$ delWrapper $name$] \indexbold{*delWrapper}
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
    99
deletes the unsafe wrapper with the given name.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   100
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   101
\item[$cs$ addSss $ss$] \indexbold{*addss}
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   102
adds the simpset~$ss$ to the classical set.  The assumptions and goal will be
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   103
simplified, in a rather safe way, after each safe step of the search.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   104
1099
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
   105
\item[$cs$ addss $ss$] \indexbold{*addss}
3485
f27a30a18a17 Now there are TWO spaces after each full stop, so that the Emacs sentence
paulson
parents: 3224
diff changeset
   106
adds the simpset~$ss$ to the classical set.  The assumptions and goal will be
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   107
simplified, before the each unsafe step of the search.
2631
5e5c78ba955e description of safe vs. unsafe wrapper and the functions involved
oheimb
parents: 2479
diff changeset
   108
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   109
\end{ttdescription}
2631
5e5c78ba955e description of safe vs. unsafe wrapper and the functions involved
oheimb
parents: 2479
diff changeset
   110
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   111
\index{simplification!from classical reasoner} 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   112
Strictly speaking, the operators \texttt{addss} and \texttt{addSss}
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   113
are not part of the classical reasoner.
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   114
, which are used as primitives 
11181
d04f57b91166 renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents: 9695
diff changeset
   115
for the automatic tactics described in {\S}\ref{sec:automatic-tactics}, are
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   116
implemented as wrapper tacticals.
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   117
they  
4881
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   118
\begin{warn}
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   119
Being defined as wrappers, these operators are inappropriate for adding more 
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   120
than one simpset at a time: the simpset added last overwrites any earlier ones.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   121
When a simpset combined with a claset is to be augmented, this should done 
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   122
{\em before} combining it with the claset.
d80faf83c82f corrected and updated description of wrapper mechanism (including addss)
oheimb
parents: 4666
diff changeset
   123
\end{warn}
1099
f4335b56f772 Covers wrapper tacticals: setwrapper, ..., addss
lcp
parents: 875
diff changeset
   124
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   125
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   126
\section{The classical tactics}
5576
dc6ee60d2be8 exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents: 5550
diff changeset
   127
3224
4ea2aa9f93a5 Documented auto_tac
paulson
parents: 3108
diff changeset
   128
\subsection{Other classical tactics}
332
01b87a921967 final Springer copy
lcp
parents: 319
diff changeset
   129
\begin{ttbox} 
875
a0b71a4bbe5e documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents: 332
diff changeset
   130
slow_best_tac : claset -> int -> tactic
332
01b87a921967 final Springer copy
lcp
parents: 319
diff changeset
   131
\end{ttbox}
875
a0b71a4bbe5e documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents: 332
diff changeset
   132
332
01b87a921967 final Springer copy
lcp
parents: 319
diff changeset
   133
\begin{ttdescription}
8136
8c65f3ca13f2 fixed many bad line & page breaks
paulson
parents: 7990
diff changeset
   134
\item[\ttindexbold{slow_best_tac} $cs$ $i$] applies \texttt{slow_step_tac} with
8c65f3ca13f2 fixed many bad line & page breaks
paulson
parents: 7990
diff changeset
   135
best-first search to prove subgoal~$i$.
875
a0b71a4bbe5e documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents: 332
diff changeset
   136
\end{ttdescription}
a0b71a4bbe5e documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents: 332
diff changeset
   137
a0b71a4bbe5e documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents: 332
diff changeset
   138
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   139
\subsection{Other useful tactics}
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   140
\index{tactics!for contradiction}
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   141
\index{tactics!for Modus Ponens}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   142
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   143
contr_tac    :             int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   144
mp_tac       :             int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   145
eq_mp_tac    :             int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   146
swap_res_tac : thm list -> int -> tactic
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   147
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   148
These can be used in the body of a specialized search.
308
f4cecad9b6a0 modifications towards final draft
lcp
parents: 286
diff changeset
   149
\begin{ttdescription}
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   150
\item[\ttindexbold{contr_tac} {\it i}]\index{assumptions!contradictory}
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   151
  solves subgoal~$i$ by detecting a contradiction among two assumptions of
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   152
  the form $P$ and~$\neg P$, or fail.  It may instantiate unknowns.  The
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   153
  tactic can produce multiple outcomes, enumerating all possible
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   154
  contradictions.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   155
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   156
\item[\ttindexbold{mp_tac} {\it i}] 
3720
a5b9e0ade194 Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents: 3716
diff changeset
   157
is like \texttt{contr_tac}, but also attempts to perform Modus Ponens in
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   158
subgoal~$i$.  If there are assumptions $P\imp Q$ and~$P$, then it replaces
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   159
$P\imp Q$ by~$Q$.  It may instantiate unknowns.  It fails if it can do
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   160
nothing.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   161
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   162
\item[\ttindexbold{eq_mp_tac} {\it i}] 
3720
a5b9e0ade194 Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents: 3716
diff changeset
   163
is like \texttt{mp_tac} {\it i}, but may not instantiate unknowns --- thus, it
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   164
is safe.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   165
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   166
\item[\ttindexbold{swap_res_tac} {\it thms} {\it i}] refines subgoal~$i$ of
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   167
the proof state using {\it thms}, which should be a list of introduction
3720
a5b9e0ade194 Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents: 3716
diff changeset
   168
rules.  First, it attempts to prove the goal using \texttt{assume_tac} or
a5b9e0ade194 Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents: 3716
diff changeset
   169
\texttt{contr_tac}.  It then attempts to apply each rule in turn, attempting
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   170
resolution and also elim-resolution with the swapped form.
308
f4cecad9b6a0 modifications towards final draft
lcp
parents: 286
diff changeset
   171
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   172
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   173
3716
2885b760a4b4 Clarify_tac and some textual improvements
paulson
parents: 3485
diff changeset
   174
\section{Setting up the classical reasoner}\label{sec:classical-setup}
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   175
\index{classical reasoner!setting up}
5550
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   176
Isabelle's classical object-logics, including \texttt{FOL} and \texttt{HOL}, 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   177
have the classical reasoner already set up.  
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   178
When defining a new classical logic, you should set up the reasoner yourself.  
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   179
It consists of the \ML{} functor \ttindex{ClassicalFun}, which takes the 
8375188ae9b0 introduced addSE2, addSD2, addE2, and addD2
oheimb
parents: 5371
diff changeset
   180
argument signature \texttt{CLASSICAL_DATA}:
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   181
\begin{ttbox} 
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   182
signature CLASSICAL_DATA =
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   183
  sig
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   184
  val mp             : thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   185
  val not_elim       : thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   186
  val swap           : thm
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   187
  val sizef          : thm -> int
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   188
  val hyp_subst_tacs : (int -> tactic) list
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   189
  end;
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   190
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   191
Thus, the functor requires the following items:
308
f4cecad9b6a0 modifications towards final draft
lcp
parents: 286
diff changeset
   192
\begin{ttdescription}
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   193
\item[\tdxbold{mp}] should be the Modus Ponens rule
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   194
$\List{\Var{P}\imp\Var{Q};\; \Var{P}} \Imp \Var{Q}$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   195
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   196
\item[\tdxbold{not_elim}] should be the contradiction rule
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   197
$\List{\neg\Var{P};\; \Var{P}} \Imp \Var{R}$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   198
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   199
\item[\tdxbold{swap}] should be the swap rule
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   200
$\List{\neg \Var{P}; \; \neg \Var{R}\Imp \Var{P}} \Imp \Var{R}$.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   201
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   202
\item[\ttindexbold{sizef}] is the heuristic function used for best-first
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   203
search.  It should estimate the size of the remaining subgoals.  A good
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   204
heuristic function is \ttindex{size_of_thm}, which measures the size of the
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   205
proof state.  Another size function might ignore certain subgoals (say,
6170
9a59cf8ae9b5 standard spelling: type-checking
paulson
parents: 5577
diff changeset
   206
those concerned with type-checking).  A heuristic function might simply
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   207
count the subgoals.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   208
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   209
\item[\ttindexbold{hyp_subst_tacs}] is a list of tactics for substitution in
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   210
the hypotheses, typically created by \ttindex{HypsubstFun} (see
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   211
Chapter~\ref{substitution}).  This list can, of course, be empty.  The
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   212
tactics are assumed to be safe!
308
f4cecad9b6a0 modifications towards final draft
lcp
parents: 286
diff changeset
   213
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   214
The functor is not at all sensitive to the formalization of the
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 3089
diff changeset
   215
object-logic.  It does not even examine the rules, but merely applies
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 3089
diff changeset
   216
them according to its fixed strategy.  The functor resides in {\tt
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 3089
diff changeset
   217
  Provers/classical.ML} in the Isabelle sources.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   218
319
f143f7686cd6 penultimate Springer draft
lcp
parents: 308
diff changeset
   219
\index{classical reasoner|)}
5371
e27558a68b8d emacs local vars;
wenzelm
parents: 4885
diff changeset
   220
e27558a68b8d emacs local vars;
wenzelm
parents: 4885
diff changeset
   221
%%% Local Variables: 
e27558a68b8d emacs local vars;
wenzelm
parents: 4885
diff changeset
   222
%%% mode: latex
e27558a68b8d emacs local vars;
wenzelm
parents: 4885
diff changeset
   223
%%% TeX-master: "ref"
e27558a68b8d emacs local vars;
wenzelm
parents: 4885
diff changeset
   224
%%% End: