3 \index{classical reasoner|(} |
3 \index{classical reasoner|(} |
4 \newcommand\ainfer[2]{\begin{array}{r@{\,}l}#2\\ \hline#1\end{array}} |
4 \newcommand\ainfer[2]{\begin{array}{r@{\,}l}#2\\ \hline#1\end{array}} |
5 |
5 |
6 \section{Classical rule sets} |
6 \section{Classical rule sets} |
7 \index{classical sets} |
7 \index{classical sets} |
8 Each automatic tactic takes a {\bf classical set} --- a collection of |
|
9 rules, classified as introduction or elimination and as {\bf safe} or {\bf |
|
10 unsafe}. In general, safe rules can be attempted blindly, while unsafe |
|
11 rules must be used with care. A safe rule must never reduce a provable |
|
12 goal to an unprovable set of subgoals. |
|
13 |
|
14 The rule~$({\disj}I1)$ is unsafe because it reduces $P\disj Q$ to~$P$. Any |
|
15 rule is unsafe whose premises contain new unknowns. The elimination |
|
16 rule~$(\forall E@2)$ is unsafe, since it is applied via elim-resolution, |
|
17 which discards the assumption $\forall x{.}P(x)$ and replaces it by the |
|
18 weaker assumption~$P(\Var{t})$. The rule $({\exists}I)$ is unsafe for |
|
19 similar reasons. The rule~$(\forall E@3)$ is unsafe in a different sense: |
|
20 since it keeps the assumption $\forall x{.}P(x)$, it is prone to looping. |
|
21 In classical first-order logic, all rules are safe except those mentioned |
|
22 above. |
|
23 |
|
24 The safe/unsafe distinction is vague, and may be regarded merely as a way |
|
25 of giving some rules priority over others. One could argue that |
|
26 $({\disj}E)$ is unsafe, because repeated application of it could generate |
|
27 exponentially many subgoals. Induction rules are unsafe because inductive |
|
28 proofs are difficult to set up automatically. Any inference is unsafe that |
|
29 instantiates an unknown in the proof state --- thus \ttindex{match_tac} |
|
30 must be used, rather than \ttindex{resolve_tac}. Even proof by assumption |
|
31 is unsafe if it instantiates unknowns shared with other subgoals --- thus |
|
32 \ttindex{eq_assume_tac} must be used, rather than \ttindex{assume_tac}. |
|
33 |
|
34 \subsection{Adding rules to classical sets} |
|
35 Classical rule sets belong to the abstract type \mltydx{claset}, which |
|
36 supports the following operations (provided the classical reasoner is |
|
37 installed!): |
|
38 \begin{ttbox} |
|
39 empty_cs : claset |
|
40 print_cs : claset -> unit |
|
41 rep_cs : claset -> \{safeEs: thm list, safeIs: thm list, |
|
42 hazEs: thm list, hazIs: thm list, |
|
43 swrappers: (string * wrapper) list, |
|
44 uwrappers: (string * wrapper) list, |
|
45 safe0_netpair: netpair, safep_netpair: netpair, |
|
46 haz_netpair: netpair, dup_netpair: netpair\} |
|
47 addSIs : claset * thm list -> claset \hfill{\bf infix 4} |
|
48 addSEs : claset * thm list -> claset \hfill{\bf infix 4} |
|
49 addSDs : claset * thm list -> claset \hfill{\bf infix 4} |
|
50 addIs : claset * thm list -> claset \hfill{\bf infix 4} |
|
51 addEs : claset * thm list -> claset \hfill{\bf infix 4} |
|
52 addDs : claset * thm list -> claset \hfill{\bf infix 4} |
|
53 delrules : claset * thm list -> claset \hfill{\bf infix 4} |
|
54 \end{ttbox} |
|
55 The add operations ignore any rule already present in the claset with the same |
|
56 classification (such as safe introduction). They print a warning if the rule |
|
57 has already been added with some other classification, but add the rule |
|
58 anyway. Calling \texttt{delrules} deletes all occurrences of a rule from the |
|
59 claset, but see the warning below concerning destruction rules. |
|
60 \begin{ttdescription} |
|
61 \item[\ttindexbold{empty_cs}] is the empty classical set. |
|
62 |
|
63 \item[\ttindexbold{print_cs} $cs$] displays the printable contents of~$cs$, |
|
64 which is the rules. All other parts are non-printable. |
|
65 |
|
66 \item[\ttindexbold{rep_cs} $cs$] decomposes $cs$ as a record of its internal |
|
67 components, namely the safe introduction and elimination rules, the unsafe |
|
68 introduction and elimination rules, the lists of safe and unsafe wrappers |
|
69 (see \ref{sec:modifying-search}), and the internalized forms of the rules. |
|
70 |
|
71 \item[$cs$ addSIs $rules$] \indexbold{*addSIs} |
|
72 adds safe introduction~$rules$ to~$cs$. |
|
73 |
|
74 \item[$cs$ addSEs $rules$] \indexbold{*addSEs} |
|
75 adds safe elimination~$rules$ to~$cs$. |
|
76 |
|
77 \item[$cs$ addSDs $rules$] \indexbold{*addSDs} |
|
78 adds safe destruction~$rules$ to~$cs$. |
|
79 |
|
80 \item[$cs$ addIs $rules$] \indexbold{*addIs} |
|
81 adds unsafe introduction~$rules$ to~$cs$. |
|
82 |
|
83 \item[$cs$ addEs $rules$] \indexbold{*addEs} |
|
84 adds unsafe elimination~$rules$ to~$cs$. |
|
85 |
|
86 \item[$cs$ addDs $rules$] \indexbold{*addDs} |
|
87 adds unsafe destruction~$rules$ to~$cs$. |
|
88 |
|
89 \item[$cs$ delrules $rules$] \indexbold{*delrules} |
|
90 deletes~$rules$ from~$cs$. It prints a warning for those rules that are not |
|
91 in~$cs$. |
|
92 \end{ttdescription} |
|
93 |
|
94 \begin{warn} |
|
95 If you added $rule$ using \texttt{addSDs} or \texttt{addDs}, then you must delete |
|
96 it as follows: |
|
97 \begin{ttbox} |
|
98 \(cs\) delrules [make_elim \(rule\)] |
|
99 \end{ttbox} |
|
100 \par\noindent |
|
101 This is necessary because the operators \texttt{addSDs} and \texttt{addDs} convert |
|
102 the destruction rules to elimination rules by applying \ttindex{make_elim}, |
|
103 and then insert them using \texttt{addSEs} and \texttt{addEs}, respectively. |
|
104 \end{warn} |
|
105 |
|
106 Introduction rules are those that can be applied using ordinary resolution. |
|
107 The classical set automatically generates their swapped forms, which will |
|
108 be applied using elim-resolution. Elimination rules are applied using |
|
109 elim-resolution. In a classical set, rules are sorted by the number of new |
|
110 subgoals they will yield; rules that generate the fewest subgoals will be |
|
111 tried first (see {\S}\ref{biresolve_tac}). |
|
112 |
8 |
113 For elimination and destruction rules there are variants of the add operations |
9 For elimination and destruction rules there are variants of the add operations |
114 adding a rule in a way such that it is applied only if also its second premise |
10 adding a rule in a way such that it is applied only if also its second premise |
115 can be unified with an assumption of the current proof state: |
11 can be unified with an assumption of the current proof state: |
116 \indexbold{*addSE2}\indexbold{*addSD2}\indexbold{*addE2}\indexbold{*addD2} |
12 \indexbold{*addSE2}\indexbold{*addSD2}\indexbold{*addE2}\indexbold{*addD2} |