Debian Codegraph @

contrib/boyer-moore/READ-ME

raw
1 % --------------------------------------------------------------------------- %
2 % DIRECTORY: boyer-moore %
3 % %
4 % DESCRIPTION: Boyer-Moore Automation for HOL %
5 % %
6 % AUTHORS: Richard J. Boulton %
7 % %
8 % ADDRESS: University of Cambridge Computer Laboratory %
9 % New Museums Site %
10 % Pembroke Street %
11 % Cambridge, CB2 3QG %
12 % England %
13 % %
14 % email: [email protected] %
15 % %
16 % DATE: 92.10.16 %
17 % --------------------------------------------------------------------------- %
18
19 This directory contains an implementation for the HOL system
20 (HOL88 Version 2.01) of Boyer and Moore's automatic proof heuristics. The code
21 is based on the description in `A Computational Logic' and so does not reflect
22 the advances made to the Boyer-Moore theorem prover since 1979. There are many
23 limitations, the most significant of which is the assumption that recursive
24 functions are defined in a `constructor-style' according to the restrictions
25 of the automatic definition tools currently available in HOL. The code was
26 written more as an experiment than as a practical tool. However, it may be
27 found to be useful. Minimal documentation can be found below.
28
29 Richard Boulton, 16th October 1992.
30
31
32 % --------------------------------------------------------------------------- %
33 % References %
34 % --------------------------------------------------------------------------- %
35
36 R. S. Boyer and J S. Moore.
37 "A Computational Logic".
38 ACM Monograph Series. Academic Press, New York, 1979.
39
40 R. J. Boulton.
41 "Boyer-Moore Automation for the HOL System".
42 In participants proceedings of the 1992 International Workshop on Higher Order
43 Logic Theorem Proving and its Applications.
44 IMEC, Leuven, Belgium. September 1992.
45
46
47 % --------------------------------------------------------------------------- %
48 % Compiling %
49 % --------------------------------------------------------------------------- %
50
51 1) edit the pathnames in the Makefile (if necessary)
52
53 2) type "make clean"
54
55 3) type "make all"
56
57
58 % --------------------------------------------------------------------------- %
59 % Loading %
60 % --------------------------------------------------------------------------- %
61
62 Load boyer-moore.ml
63
64
65 % --------------------------------------------------------------------------- %
66 % General Remark %
67 % --------------------------------------------------------------------------- %
68
69 The automatic proof procedures described below access an environment of
70 definitions and rewrite rules. You must add definitions and rules to this
71 environment if the procedures are to be effective. This can be done using the
72 functions supplied (see below). The most important thing is to provide the
73 procedures with the definitions of any functions appearing in the formula to
74 be proved.
75
76
77 % --------------------------------------------------------------------------- %
78 % Proof Functions %
79 % --------------------------------------------------------------------------- %
80
81 BOYER_MOORE : conv
82
83 Boyer-Moore-style automatic theorem prover.
84 Given a term "tm", attempts to prove |- tm.
85
86 BOYER_MOORE_CONV : conv
87
88 Boyer-Moore-style automatic theorem prover.
89 Given a term "tm", attempts to prove |- tm = T.
90
91 CLAUSAL_FORM_CONV : conv
92
93 Puts into clausal form terms consisting of =,==>,COND,/\,\/,~ and atoms.
94
95
96 % --------------------------------------------------------------------------- %
97 % Tactics %
98 % --------------------------------------------------------------------------- %
99
100 HEURISTIC_TAC : ((term # bool) -> ((term # bool) list # proof)) list -> tactic
101
102 Tactic to do automatic proof using a list of heuristics. The tactic will
103 fail if it thinks the goal is not a theorem. Otherwise it will either
104 prove the goal, or return as subgoals the conjectures it couldn't handle.
105
106 If the proof printing flag is set to true, the tactic displays each new
107 conjecture it generates, prints blank lines between subconjectures which
108 resulted from a split, and prints a final blank line when it can do no
109 more.
110
111 BOYER_MOORE_TAC : tactic
112
113 Tactic to do automatic proof using Boyer & Moore's heuristics. The tactic
114 will fail if it thinks the goal is not a theorem. Otherwise it will either
115 prove the goal, or return as subgoals the conjectures it couldn't handle.
116
117 WARNING: the subgoals returned may be invalid even when the original goal
118 is valid. This is due to the procedure's generalisation heuristic.
119
120 BM_SIMPLIFY_TAC : tactic
121
122 Tactic to do automatic simplification using Boyer & Moore's heuristics.
123 The tactic will fail if it thinks the goal is not a theorem. Otherwise, it
124 will either prove the goal or return the simplified conjectures as
125 subgoals.
126
127 BM_INDUCT_TAC : tactic
128
129 Tactic which attempts to do a SINGLE induction using Boyer & Moore's
130 heuristics. The cases of the induction are returned as subgoals.
131
132
133 % --------------------------------------------------------------------------- %
134 % Environment Manipulation Functions %
135 % --------------------------------------------------------------------------- %
136
137 new_def : thm -> void
138
139 Makes a definition available to the proof procedures. The theorem must be
140 of the form returned by the automatic function definition facilities
141 available in HOL.
142
143 defs : void -> thm list list
144
145 Returns a list of lists of theorems currently being used as definitions.
146 Each list in this list is for one operator.
147
148 new_rewrite_rule : thm -> void
149
150 Makes a new rewrite rule available. Checks that the theorem has no
151 hypotheses. A conjunction of rules may be given. The function will treat
152 each conjunct in the theorem as a separate rule.
153
154 rewrite_rules : void -> thm list
155
156 Returns the list of theorems currently being used as rewrites.
157
158 new_gen_lemma : thm -> void
159
160 Makes a new generalisation lemma available. Checks that the theorem has no
161 hypotheses.
162
163 gen_lemmas : void -> thm list
164
165 Returns the list of theorems currently being used as generalisation lemmas.
166
167 define_shell : string -> string -> (string # string list) list -> void
168
169 Function for defining a new HOL type together with accessor functions, and
170 making a new Boyer-Moore shell from these definitions. If the type already
171 exists the function attempts to load the corresponding theorems from the
172 current theory hierarchy and use them to make the shell.
173
174 The first two arguments correspond to the arguments taken by the built-in
175 HOL function `define_type' and the third argument defines the accessor
176 functions. This is a list of constructor names each with names of
177 accessors. The function assumes that there are no accessors for a
178 constructor that doesn't appear in the list, so it is not necessary to
179 include an entry for a nullary constructor. For other constructors there
180 must be one accessor name for each argument and they should be given in the
181 correct order. The function ignores any item in the list with a constructor
182 name that does not belong to the type.
183
184 The constructor and accessor names must all be distinct and must not be
185 the names of existing constants.
186
187 Example:
188
189 define_shell `sexp` `sexp = Nil | Atom * | Cons sexp sexp`
190 [(`Atom`,[`Tok`]);(`Cons`,[`Car`;`Cdr`])];;
191
192 This results in the following theorems being stored in the current theory
193 (or these are the theorems the function would expect to find in the theory
194 hierarchy if the type already exists):
195
196 sexp (type axiom)
197 sexp_Induct (induction theorem)
198 sexp_one_one (injectivity of constructors)
199 sexp_distinct (distinctness of constructors)
200 sexp_cases (cases theorem)
201
202 The following definitions for the accessor functions are also stored:
203
204 Tok |- !x. Tok(Atom x) = x
205 Car |- !s1 s2. Car(Cons s1 s2) = s1
206 Cdr |- !s1 s2. Cdr(Cons s1 s2) = s2
207
208 In certain cases the distinctness or injectivity theorems may not exist,
209 when nothing is saved for them.
210
211 Finally, a new Boyer-Moore shell is added to the environment, based on the
212 definitions and theorems.
213
214 shells : void -> string list
215
216 Function to compute the names of the currently defined shells.
217
218 proof_printer : bool -> bool
219
220 Function for setting the flag that controls the printing of clauses as the
221 automatic proof attempt proceeds. Set to `true' to see what the procedure
222 is doing.
223
224
225 % --------------------------------------------------------------------------- %
226 % The Heuristics %
227 % --------------------------------------------------------------------------- %
228
229 clausal_form_heuristic : (term # bool) -> ((term # bool) list # proof)
230
231 Heuristic that tests a term to see if it is in clausal form, and if not
232 converts it to clausal form and returns the resulting clauses as new
233 `goals'. If the term is in clausal form, but is not a single clause, it is
234 split into single clauses. If the term is in clausal form but contains
235 Boolean constants, the normaliser is applied to it. A single new goal will
236 be produced in this case unless the result of the normalisation was true.
237
238 subst_heuristic : (term # bool) -> ((term # bool) list # proof)
239
240 Heuristic for eliminating from a clause, a negated equality between a
241 variable and another term not containing the variable. For example, given
242 the clause:
243
244 x1 \/ ~(x = t) \/ x3 \/ f x \/ x5
245
246 the heuristic returns the clause:
247
248 x1 \/ F \/ x3 \/ f t \/ x5
249
250 So, all occurrences of x are replaced by t, and the equality x = t is
251 `thrown away'.
252
253 simplify_heuristic : (term # bool) -> ((term # bool) list # proof)
254
255 Heuristic for simplifying a clause by rewriting each literal in turn
256 assuming the negations of the others.
257
258 use_equality_heuristic : (term # bool) -> ((term # bool) list # proof)
259
260 Heuristic for using equalities, and in particular for cross-fertilizing.
261 Given a clause, the function looks for a literal of the form ~(s' = t')
262 where t' occurs in another literal and is not an explicit value template.
263 If no such literal is present, the function looks for a literal of the
264 form ~(t' = s') where t' occurs in another literal and is not an explicit
265 value template. If a substitution literal of one of these two forms is
266 found, substitution takes place.
267
268 generalize_heuristic : (term # bool) -> ((term # bool) list # proof)
269
270 Heuristic for generalising a conjecture when this may help an induction
271 to succeed. It may generalise when it shouldn't.
272
273 irrelevance_heuristic : (term # bool) -> ((term # bool) list # proof)
274
275 Heuristic for eliminating irrelevant literals, that is ones that can no
276 longer contribute to the proof and which could interfere with future
277 inductions.
278
279 induction_heuristic : (term # bool) -> ((term # bool) list # proof)
280
281 Heuristic for induction. It performs one of the possible unflawed
282 inductions on a clause, or failing that, one of the flawed inductions.
283 The heuristic fails if no inductions are possible.
284