1586
|
1 |
(* Title: HOL/ex/mesontest
|
969
|
2 |
ID: $Id$
|
1465
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
969
|
4 |
Copyright 1992 University of Cambridge
|
|
5 |
|
|
6 |
Test data for the MESON proof procedure
|
|
7 |
(Excludes the equality problems 51, 52, 56, 58)
|
|
8 |
|
1718
|
9 |
show_hyps := false;
|
969
|
10 |
|
1718
|
11 |
keep_derivs := MinDeriv;
|
969
|
12 |
by (rtac ccontr 1);
|
|
13 |
val [prem] = gethyps 1;
|
|
14 |
val nnf = make_nnf prem;
|
|
15 |
val xsko = skolemize nnf;
|
|
16 |
by (cut_facts_tac [xsko] 1 THEN REPEAT (etac exE 1));
|
|
17 |
val [_,sko] = gethyps 1;
|
1465
|
18 |
val clauses = make_clauses [sko];
|
969
|
19 |
val horns = make_horns clauses;
|
1600
|
20 |
val goes = gocls clauses;
|
969
|
21 |
|
|
22 |
goal HOL.thy "False";
|
1600
|
23 |
by (resolve_tac goes 1);
|
1718
|
24 |
keep_derivs := FullDeriv;
|
1586
|
25 |
|
969
|
26 |
by (prolog_step_tac horns 1);
|
1600
|
27 |
by (iter_deepen_prolog_tac horns);
|
969
|
28 |
by (depth_prolog_tac horns);
|
|
29 |
by (best_prolog_tac size_of_subgoals horns);
|
|
30 |
*)
|
|
31 |
|
|
32 |
writeln"File HOL/ex/meson-test.";
|
|
33 |
|
1586
|
34 |
(*Deep unifications can be required, esp. during transformation to clauses*)
|
|
35 |
val orig_trace_bound = !Unify.trace_bound
|
|
36 |
and orig_search_bound = !Unify.search_bound;
|
|
37 |
Unify.trace_bound := 20;
|
|
38 |
Unify.search_bound := 40;
|
|
39 |
|
969
|
40 |
(**** Interactive examples ****)
|
|
41 |
|
|
42 |
(*Generate nice names for Skolem functions*)
|
|
43 |
Logic.auto_rename := true; Logic.set_rename_prefix "a";
|
|
44 |
|
|
45 |
|
|
46 |
writeln"Problem 25";
|
1586
|
47 |
goal HOL.thy "(? x. P x) & \
|
|
48 |
\ (! x. L x --> ~ (M x & R x)) & \
|
|
49 |
\ (! x. P x --> (M x & L x)) & \
|
|
50 |
\ ((! x. P x --> Q x) | (? x. P x & R x)) \
|
|
51 |
\ --> (? x. Q x & P x)";
|
969
|
52 |
by (rtac ccontr 1);
|
|
53 |
val [prem25] = gethyps 1;
|
|
54 |
val nnf25 = make_nnf prem25;
|
|
55 |
val xsko25 = skolemize nnf25;
|
|
56 |
by (cut_facts_tac [xsko25] 1 THEN REPEAT (etac exE 1));
|
|
57 |
val [_,sko25] = gethyps 1;
|
1465
|
58 |
val clauses25 = make_clauses [sko25]; (*7 clauses*)
|
|
59 |
val horns25 = make_horns clauses25; (*16 Horn clauses*)
|
1600
|
60 |
val go25::_ = gocls clauses25;
|
969
|
61 |
|
|
62 |
goal HOL.thy "False";
|
1600
|
63 |
by (rtac go25 1);
|
969
|
64 |
by (depth_prolog_tac horns25);
|
|
65 |
|
|
66 |
|
|
67 |
writeln"Problem 26";
|
1586
|
68 |
goal HOL.thy "((? x. p x) = (? x. q x)) & \
|
|
69 |
\ (! x. ! y. p x & q y --> (r x = s y)) \
|
|
70 |
\ --> ((! x. p x --> r x) = (! x. q x --> s x))";
|
969
|
71 |
by (rtac ccontr 1);
|
|
72 |
val [prem26] = gethyps 1;
|
|
73 |
val nnf26 = make_nnf prem26;
|
|
74 |
val xsko26 = skolemize nnf26;
|
|
75 |
by (cut_facts_tac [xsko26] 1 THEN REPEAT (etac exE 1));
|
|
76 |
val [_,sko26] = gethyps 1;
|
1465
|
77 |
val clauses26 = make_clauses [sko26]; (*9 clauses*)
|
|
78 |
val horns26 = make_horns clauses26; (*24 Horn clauses*)
|
1600
|
79 |
val go26::_ = gocls clauses26;
|
969
|
80 |
|
|
81 |
goal HOL.thy "False";
|
1600
|
82 |
by (rtac go26 1);
|
1586
|
83 |
by (depth_prolog_tac horns26); (*1.4 secs*)
|
|
84 |
(*Proof is of length 107!!*)
|
969
|
85 |
|
|
86 |
|
1586
|
87 |
writeln"Problem 43 NOW PROVED AUTOMATICALLY!!"; (*16 Horn clauses*)
|
1465
|
88 |
goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool))) \
|
969
|
89 |
\ --> (! x. (! y. q x y = (q y x::bool)))";
|
|
90 |
by (rtac ccontr 1);
|
|
91 |
val [prem43] = gethyps 1;
|
|
92 |
val nnf43 = make_nnf prem43;
|
|
93 |
val xsko43 = skolemize nnf43;
|
|
94 |
by (cut_facts_tac [xsko43] 1 THEN REPEAT (etac exE 1));
|
|
95 |
val [_,sko43] = gethyps 1;
|
1465
|
96 |
val clauses43 = make_clauses [sko43]; (*6*)
|
|
97 |
val horns43 = make_horns clauses43; (*16*)
|
1600
|
98 |
val go43::_ = gocls clauses43;
|
969
|
99 |
|
|
100 |
goal HOL.thy "False";
|
1600
|
101 |
by (rtac go43 1);
|
1586
|
102 |
by (best_prolog_tac size_of_subgoals horns43); (*1.6 secs*)
|
|
103 |
|
|
104 |
(*
|
|
105 |
#1 (q x xa ==> ~ q x xa) ==> q xa x
|
|
106 |
#2 (q xa x ==> ~ q xa x) ==> q x xa
|
|
107 |
#3 (~ q x xa ==> q x xa) ==> ~ q xa x
|
|
108 |
#4 (~ q xa x ==> q xa x) ==> ~ q x xa
|
|
109 |
#5 [| ~ q ?U ?V ==> q ?U ?V; ~ p ?W ?U ==> p ?W ?U |] ==> p ?W ?V
|
|
110 |
#6 [| ~ p ?W ?U ==> p ?W ?U; p ?W ?V ==> ~ p ?W ?V |] ==> ~ q ?U ?V
|
|
111 |
#7 [| p ?W ?V ==> ~ p ?W ?V; ~ q ?U ?V ==> q ?U ?V |] ==> ~ p ?W ?U
|
|
112 |
#8 [| ~ q ?U ?V ==> q ?U ?V; ~ p ?W ?V ==> p ?W ?V |] ==> p ?W ?U
|
|
113 |
#9 [| ~ p ?W ?V ==> p ?W ?V; p ?W ?U ==> ~ p ?W ?U |] ==> ~ q ?U ?V
|
|
114 |
#10 [| p ?W ?U ==> ~ p ?W ?U; ~ q ?U ?V ==> q ?U ?V |] ==> ~ p ?W ?V
|
|
115 |
#11 [| p (xb ?U ?V) ?U ==> ~ p (xb ?U ?V) ?U;
|
|
116 |
p (xb ?U ?V) ?V ==> ~ p (xb ?U ?V) ?V |] ==> q ?U ?V
|
|
117 |
#12 [| p (xb ?U ?V) ?V ==> ~ p (xb ?U ?V) ?V; q ?U ?V ==> ~ q ?U ?V |] ==>
|
|
118 |
p (xb ?U ?V) ?U
|
|
119 |
#13 [| q ?U ?V ==> ~ q ?U ?V; p (xb ?U ?V) ?U ==> ~ p (xb ?U ?V) ?U |] ==>
|
|
120 |
p (xb ?U ?V) ?V
|
|
121 |
#14 [| ~ p (xb ?U ?V) ?U ==> p (xb ?U ?V) ?U;
|
|
122 |
~ p (xb ?U ?V) ?V ==> p (xb ?U ?V) ?V |] ==> q ?U ?V
|
|
123 |
#15 [| ~ p (xb ?U ?V) ?V ==> p (xb ?U ?V) ?V; q ?U ?V ==> ~ q ?U ?V |] ==>
|
|
124 |
~ p (xb ?U ?V) ?U
|
|
125 |
#16 [| q ?U ?V ==> ~ q ?U ?V; ~ p (xb ?U ?V) ?U ==> p (xb ?U ?V) ?U |] ==>
|
|
126 |
~ p (xb ?U ?V) ?V
|
|
127 |
|
|
128 |
And here is the proof! (Unkn is the start state after use of goal clause)
|
|
129 |
[Unkn, Res ([Thm "#14"], false, 1), Res ([Thm "#5"], false, 1),
|
|
130 |
Res ([Thm "#1"], false, 1), Asm 1, Res ([Thm "#13"], false, 1), Asm 2,
|
|
131 |
Asm 1, Res ([Thm "#13"], false, 1), Asm 1, Res ([Thm "#10"], false, 1),
|
|
132 |
Res ([Thm "#16"], false, 1), Asm 2, Asm 1, Res ([Thm "#1"], false, 1),
|
|
133 |
Asm 1, Res ([Thm "#14"], false, 1), Res ([Thm "#5"], false, 1),
|
|
134 |
Res ([Thm "#2"], false, 1), Asm 1, Res ([Thm "#13"], false, 1), Asm 2,
|
|
135 |
Asm 1, Res ([Thm "#8"], false, 1), Res ([Thm "#2"], false, 1), Asm 1,
|
|
136 |
Res ([Thm "#12"], false, 1), Asm 2, Asm 1] : lderiv list
|
|
137 |
*)
|
969
|
138 |
|
|
139 |
|
|
140 |
(*Restore variable name preservation*)
|
|
141 |
Logic.auto_rename := false;
|
|
142 |
|
|
143 |
|
|
144 |
(**** Batch test data ****)
|
|
145 |
|
|
146 |
(*Sample problems from
|
|
147 |
F. J. Pelletier,
|
|
148 |
Seventy-Five Problems for Testing Automatic Theorem Provers,
|
|
149 |
J. Automated Reasoning 2 (1986), 191-216.
|
|
150 |
Errata, JAR 4 (1988), 236-236.
|
|
151 |
|
|
152 |
The hardest problems -- judging by experience with several theorem provers,
|
|
153 |
including matrix ones -- are 34 and 43.
|
|
154 |
*)
|
|
155 |
|
|
156 |
writeln"Pelletier's examples";
|
|
157 |
(*1*)
|
1586
|
158 |
goal HOL.thy "(P --> Q) = (~Q --> ~P)";
|
969
|
159 |
by (safe_meson_tac 1);
|
|
160 |
result();
|
|
161 |
|
|
162 |
(*2*)
|
|
163 |
goal HOL.thy "(~ ~ P) = P";
|
|
164 |
by (safe_meson_tac 1);
|
|
165 |
result();
|
|
166 |
|
|
167 |
(*3*)
|
|
168 |
goal HOL.thy "~(P-->Q) --> (Q-->P)";
|
|
169 |
by (safe_meson_tac 1);
|
|
170 |
result();
|
|
171 |
|
|
172 |
(*4*)
|
|
173 |
goal HOL.thy "(~P-->Q) = (~Q --> P)";
|
|
174 |
by (safe_meson_tac 1);
|
|
175 |
result();
|
|
176 |
|
|
177 |
(*5*)
|
|
178 |
goal HOL.thy "((P|Q)-->(P|R)) --> (P|(Q-->R))";
|
|
179 |
by (safe_meson_tac 1);
|
|
180 |
result();
|
|
181 |
|
|
182 |
(*6*)
|
|
183 |
goal HOL.thy "P | ~ P";
|
|
184 |
by (safe_meson_tac 1);
|
|
185 |
result();
|
|
186 |
|
|
187 |
(*7*)
|
|
188 |
goal HOL.thy "P | ~ ~ ~ P";
|
|
189 |
by (safe_meson_tac 1);
|
|
190 |
result();
|
|
191 |
|
|
192 |
(*8. Peirce's law*)
|
|
193 |
goal HOL.thy "((P-->Q) --> P) --> P";
|
|
194 |
by (safe_meson_tac 1);
|
|
195 |
result();
|
|
196 |
|
|
197 |
(*9*)
|
|
198 |
goal HOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
|
|
199 |
by (safe_meson_tac 1);
|
|
200 |
result();
|
|
201 |
|
|
202 |
(*10*)
|
|
203 |
goal HOL.thy "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)";
|
|
204 |
by (safe_meson_tac 1);
|
|
205 |
result();
|
|
206 |
|
|
207 |
(*11. Proved in each direction (incorrectly, says Pelletier!!) *)
|
|
208 |
goal HOL.thy "P=(P::bool)";
|
|
209 |
by (safe_meson_tac 1);
|
|
210 |
result();
|
|
211 |
|
|
212 |
(*12. "Dijkstra's law"*)
|
|
213 |
goal HOL.thy "((P = Q) = R) = (P = (Q = R))";
|
1586
|
214 |
by (safe_meson_tac 1);
|
969
|
215 |
result();
|
|
216 |
|
|
217 |
(*13. Distributive law*)
|
|
218 |
goal HOL.thy "(P | (Q & R)) = ((P | Q) & (P | R))";
|
|
219 |
by (safe_meson_tac 1);
|
|
220 |
result();
|
|
221 |
|
|
222 |
(*14*)
|
|
223 |
goal HOL.thy "(P = Q) = ((Q | ~P) & (~Q|P))";
|
|
224 |
by (safe_meson_tac 1);
|
|
225 |
result();
|
|
226 |
|
|
227 |
(*15*)
|
|
228 |
goal HOL.thy "(P --> Q) = (~P | Q)";
|
|
229 |
by (safe_meson_tac 1);
|
|
230 |
result();
|
|
231 |
|
|
232 |
(*16*)
|
|
233 |
goal HOL.thy "(P-->Q) | (Q-->P)";
|
|
234 |
by (safe_meson_tac 1);
|
|
235 |
result();
|
|
236 |
|
|
237 |
(*17*)
|
|
238 |
goal HOL.thy "((P & (Q-->R))-->S) = ((~P | Q | S) & (~P | ~R | S))";
|
|
239 |
by (safe_meson_tac 1);
|
|
240 |
result();
|
|
241 |
|
|
242 |
writeln"Classical Logic: examples with quantifiers";
|
|
243 |
|
1586
|
244 |
goal HOL.thy "(! x. P x & Q x) = ((! x. P x) & (! x. Q x))";
|
969
|
245 |
by (safe_meson_tac 1);
|
|
246 |
result();
|
|
247 |
|
1586
|
248 |
goal HOL.thy "(? x. P --> Q x) = (P --> (? x.Q x))";
|
969
|
249 |
by (safe_meson_tac 1);
|
|
250 |
result();
|
|
251 |
|
1586
|
252 |
goal HOL.thy "(? x.P x --> Q) = ((! x.P x) --> Q)";
|
969
|
253 |
by (safe_meson_tac 1);
|
|
254 |
result();
|
|
255 |
|
1586
|
256 |
goal HOL.thy "((! x.P x) | Q) = (! x. P x | Q)";
|
969
|
257 |
by (safe_meson_tac 1);
|
|
258 |
result();
|
|
259 |
|
1586
|
260 |
goal HOL.thy "(! x. P x --> P(f x)) & P d --> P(f(f(f d)))";
|
969
|
261 |
by (safe_meson_tac 1);
|
|
262 |
result();
|
|
263 |
|
1259
|
264 |
(*Needs double instantiation of EXISTS*)
|
1586
|
265 |
goal HOL.thy "? x. P x --> P a & P b";
|
969
|
266 |
by (safe_meson_tac 1);
|
|
267 |
result();
|
|
268 |
|
1586
|
269 |
goal HOL.thy "? z. P z --> (! x. P x)";
|
969
|
270 |
by (safe_meson_tac 1);
|
|
271 |
result();
|
|
272 |
|
|
273 |
writeln"Hard examples with quantifiers";
|
|
274 |
|
|
275 |
writeln"Problem 18";
|
1586
|
276 |
goal HOL.thy "? y. ! x. P y --> P x";
|
969
|
277 |
by (safe_meson_tac 1);
|
|
278 |
result();
|
|
279 |
|
|
280 |
writeln"Problem 19";
|
1586
|
281 |
goal HOL.thy "? x. ! y z. (P y --> Q z) --> (P x --> Q x)";
|
969
|
282 |
by (safe_meson_tac 1);
|
|
283 |
result();
|
|
284 |
|
|
285 |
writeln"Problem 20";
|
1586
|
286 |
goal HOL.thy "(! x y. ? z. ! w. (P x & Q y --> R z & S w)) \
|
|
287 |
\ --> (? x y. P x & Q y) --> (? z. R z)";
|
969
|
288 |
by (safe_meson_tac 1);
|
|
289 |
result();
|
|
290 |
|
|
291 |
writeln"Problem 21";
|
1586
|
292 |
goal HOL.thy "(? x. P --> Q x) & (? x. Q x --> P) --> (? x. P=Q x)";
|
969
|
293 |
by (safe_meson_tac 1);
|
|
294 |
result();
|
|
295 |
|
|
296 |
writeln"Problem 22";
|
1586
|
297 |
goal HOL.thy "(! x. P = Q x) --> (P = (! x. Q x))";
|
969
|
298 |
by (safe_meson_tac 1);
|
|
299 |
result();
|
|
300 |
|
|
301 |
writeln"Problem 23";
|
1586
|
302 |
goal HOL.thy "(! x. P | Q x) = (P | (! x. Q x))";
|
969
|
303 |
by (safe_meson_tac 1);
|
|
304 |
result();
|
|
305 |
|
1586
|
306 |
writeln"Problem 24"; (*The first goal clause is useless*)
|
|
307 |
goal HOL.thy "~(? x. S x & Q x) & (! x. P x --> Q x | R x) & \
|
|
308 |
\ ~(? x.P x) --> (? x.Q x) & (! x. Q x | R x --> S x) \
|
|
309 |
\ --> (? x. P x & R x)";
|
969
|
310 |
by (safe_meson_tac 1);
|
|
311 |
result();
|
|
312 |
|
|
313 |
writeln"Problem 25";
|
1586
|
314 |
goal HOL.thy "(? x. P x) & \
|
|
315 |
\ (! x. L x --> ~ (M x & R x)) & \
|
|
316 |
\ (! x. P x --> (M x & L x)) & \
|
|
317 |
\ ((! x. P x --> Q x) | (? x. P x & R x)) \
|
|
318 |
\ --> (? x. Q x & P x)";
|
969
|
319 |
by (safe_meson_tac 1);
|
|
320 |
result();
|
|
321 |
|
1586
|
322 |
writeln"Problem 26"; (*24 Horn clauses*)
|
|
323 |
goal HOL.thy "((? x. p x) = (? x. q x)) & \
|
|
324 |
\ (! x. ! y. p x & q y --> (r x = s y)) \
|
|
325 |
\ --> ((! x. p x --> r x) = (! x. q x --> s x))";
|
969
|
326 |
by (safe_meson_tac 1);
|
|
327 |
result();
|
|
328 |
|
1586
|
329 |
writeln"Problem 27"; (*13 Horn clauses*)
|
|
330 |
goal HOL.thy "(? x. P x & ~Q x) & \
|
|
331 |
\ (! x. P x --> R x) & \
|
|
332 |
\ (! x. M x & L x --> P x) & \
|
|
333 |
\ ((? x. R x & ~ Q x) --> (! x. L x --> ~ R x)) \
|
|
334 |
\ --> (! x. M x --> ~L x)";
|
969
|
335 |
by (safe_meson_tac 1);
|
|
336 |
result();
|
|
337 |
|
1586
|
338 |
writeln"Problem 28. AMENDED"; (*14 Horn clauses*)
|
|
339 |
goal HOL.thy "(! x. P x --> (! x. Q x)) & \
|
|
340 |
\ ((! x. Q x | R x) --> (? x. Q x & S x)) & \
|
|
341 |
\ ((? x.S x) --> (! x. L x --> M x)) \
|
|
342 |
\ --> (! x. P x & L x --> M x)";
|
969
|
343 |
by (safe_meson_tac 1);
|
|
344 |
result();
|
|
345 |
|
|
346 |
writeln"Problem 29. Essentially the same as Principia Mathematica *11.71";
|
1586
|
347 |
(*62 Horn clauses*)
|
|
348 |
goal HOL.thy "(? x. F x) & (? y. G y) \
|
|
349 |
\ --> ( ((! x. F x --> H x) & (! y. G y --> J y)) = \
|
|
350 |
\ (! x y. F x & G y --> H x & J y))";
|
|
351 |
by (safe_meson_tac 1); (*0.7 secs*)
|
969
|
352 |
result();
|
|
353 |
|
|
354 |
writeln"Problem 30";
|
1586
|
355 |
goal HOL.thy "(! x. P x | Q x --> ~ R x) & \
|
|
356 |
\ (! x. (Q x --> ~ S x) --> P x & R x) \
|
|
357 |
\ --> (! x. S x)";
|
969
|
358 |
by (safe_meson_tac 1);
|
|
359 |
result();
|
|
360 |
|
1586
|
361 |
writeln"Problem 31"; (*10 Horn clauses; first negative clauses is useless*)
|
|
362 |
goal HOL.thy "~(? x.P x & (Q x | R x)) & \
|
|
363 |
\ (? x. L x & P x) & \
|
|
364 |
\ (! x. ~ R x --> M x) \
|
|
365 |
\ --> (? x. L x & M x)";
|
969
|
366 |
by (safe_meson_tac 1);
|
|
367 |
result();
|
|
368 |
|
|
369 |
writeln"Problem 32";
|
1586
|
370 |
goal HOL.thy "(! x. P x & (Q x | R x)-->S x) & \
|
|
371 |
\ (! x. S x & R x --> L x) & \
|
|
372 |
\ (! x. M x --> R x) \
|
|
373 |
\ --> (! x. P x & M x --> L x)";
|
969
|
374 |
by (safe_meson_tac 1);
|
|
375 |
result();
|
|
376 |
|
1586
|
377 |
writeln"Problem 33"; (*55 Horn clauses*)
|
|
378 |
goal HOL.thy "(! x. P a & (P x --> P b)-->P c) = \
|
|
379 |
\ (! x. (~P a | P x | P c) & (~P a | ~P b | P c))";
|
1465
|
380 |
by (safe_meson_tac 1); (*5.6 secs*)
|
969
|
381 |
result();
|
|
382 |
|
1586
|
383 |
writeln"Problem 34 AMENDED (TWICE!!)"; (*924 Horn clauses*)
|
969
|
384 |
(*Andrews's challenge*)
|
1586
|
385 |
goal HOL.thy "((? x. ! y. p x = p y) = \
|
|
386 |
\ ((? x. q x) = (! y. p y))) = \
|
|
387 |
\ ((? x. ! y. q x = q y) = \
|
|
388 |
\ ((? x. p x) = (! y. q y)))";
|
|
389 |
by (safe_meson_tac 1); (*13 secs*)
|
969
|
390 |
result();
|
|
391 |
|
|
392 |
writeln"Problem 35";
|
|
393 |
goal HOL.thy "? x y. P x y --> (! u v. P u v)";
|
|
394 |
by (safe_meson_tac 1);
|
|
395 |
result();
|
|
396 |
|
1586
|
397 |
writeln"Problem 36"; (*15 Horn clauses*)
|
969
|
398 |
goal HOL.thy "(! x. ? y. J x y) & \
|
|
399 |
\ (! x. ? y. G x y) & \
|
1465
|
400 |
\ (! x y. J x y | G x y --> \
|
969
|
401 |
\ (! z. J y z | G y z --> H x z)) \
|
|
402 |
\ --> (! x. ? y. H x y)";
|
|
403 |
by (safe_meson_tac 1);
|
|
404 |
result();
|
|
405 |
|
1586
|
406 |
writeln"Problem 37"; (*10 Horn clauses*)
|
969
|
407 |
goal HOL.thy "(! z. ? w. ! x. ? y. \
|
1586
|
408 |
\ (P x z --> P y w) & P y z & (P y w --> (? u.Q u w))) & \
|
969
|
409 |
\ (! x z. ~P x z --> (? y. Q y z)) & \
|
|
410 |
\ ((? x y. Q x y) --> (! x. R x x)) \
|
|
411 |
\ --> (! x. ? y. R x y)";
|
|
412 |
by (safe_meson_tac 1); (*causes unification tracing messages*)
|
|
413 |
result();
|
|
414 |
|
1586
|
415 |
writeln"Problem 38"; (*Quite hard: 422 Horn clauses!!*)
|
969
|
416 |
goal HOL.thy
|
1586
|
417 |
"(! x. p a & (p x --> (? y. p y & r x y)) --> \
|
|
418 |
\ (? z. ? w. p z & r x w & r w z)) = \
|
|
419 |
\ (! x. (~p a | p x | (? z. ? w. p z & r x w & r w z)) & \
|
|
420 |
\ (~p a | ~(? y. p y & r x y) | \
|
|
421 |
\ (? z. ? w. p z & r x w & r w z)))";
|
|
422 |
by (safe_best_meson_tac 1); (*10 secs; iter. deepening is slightly slower*)
|
969
|
423 |
result();
|
|
424 |
|
|
425 |
writeln"Problem 39";
|
|
426 |
goal HOL.thy "~ (? x. ! y. F y x = (~F y y))";
|
|
427 |
by (safe_meson_tac 1);
|
|
428 |
result();
|
|
429 |
|
|
430 |
writeln"Problem 40. AMENDED";
|
|
431 |
goal HOL.thy "(? y. ! x. F x y = F x x) \
|
|
432 |
\ --> ~ (! x. ? y. ! z. F z y = (~F z x))";
|
|
433 |
by (safe_meson_tac 1);
|
|
434 |
result();
|
|
435 |
|
|
436 |
writeln"Problem 41";
|
1465
|
437 |
goal HOL.thy "(! z. (? y. (! x. f x y = (f x z & ~ f x x)))) \
|
969
|
438 |
\ --> ~ (? z. ! x. f x z)";
|
|
439 |
by (safe_meson_tac 1);
|
|
440 |
result();
|
|
441 |
|
|
442 |
writeln"Problem 42";
|
|
443 |
goal HOL.thy "~ (? y. ! x. p x y = (~ (? z. p x z & p z x)))";
|
|
444 |
by (safe_meson_tac 1);
|
|
445 |
result();
|
|
446 |
|
|
447 |
writeln"Problem 43 NOW PROVED AUTOMATICALLY!!";
|
1465
|
448 |
goal HOL.thy "(! x. ! y. q x y = (! z. p z x = (p z y::bool))) \
|
969
|
449 |
\ --> (! x. (! y. q x y = (q y x::bool)))";
|
1586
|
450 |
by (safe_best_meson_tac 1);
|
|
451 |
(*1.6 secs; iter. deepening is slightly slower*)
|
969
|
452 |
result();
|
|
453 |
|
1586
|
454 |
writeln"Problem 44"; (*13 Horn clauses; 7-step proof*)
|
|
455 |
goal HOL.thy "(! x. f x --> \
|
|
456 |
\ (? y. g y & h x y & (? y. g y & ~ h x y))) & \
|
|
457 |
\ (? x. j x & (! y. g y --> h x y)) \
|
|
458 |
\ --> (? x. j x & ~f x)";
|
969
|
459 |
by (safe_meson_tac 1);
|
|
460 |
result();
|
|
461 |
|
1586
|
462 |
writeln"Problem 45"; (*27 Horn clauses; 54-step proof*)
|
|
463 |
goal HOL.thy "(! x. f x & (! y. g y & h x y --> j x y) \
|
|
464 |
\ --> (! y. g y & h x y --> k y)) & \
|
|
465 |
\ ~ (? y. l y & k y) & \
|
|
466 |
\ (? x. f x & (! y. h x y --> l y) \
|
|
467 |
\ & (! y. g y & h x y --> j x y)) \
|
|
468 |
\ --> (? x. f x & ~ (? y. g y & h x y))";
|
|
469 |
by (safe_best_meson_tac 1);
|
|
470 |
(*1.6 secs; iter. deepening is slightly slower*)
|
|
471 |
result();
|
|
472 |
|
|
473 |
writeln"Problem 46"; (*26 Horn clauses; 21-step proof*)
|
|
474 |
goal HOL.thy
|
|
475 |
"(! x. f x & (! y. f y & h y x --> g y) --> g x) & \
|
|
476 |
\ ((? x.f x & ~g x) --> \
|
|
477 |
\ (? x. f x & ~g x & (! y. f y & ~g y --> j x y))) & \
|
|
478 |
\ (! x y. f x & f y & h x y --> ~j y x) \
|
|
479 |
\ --> (! x. f x --> g x)";
|
|
480 |
by (safe_best_meson_tac 1);
|
|
481 |
(*1.7 secs; iter. deepening is slightly slower*)
|
969
|
482 |
result();
|
|
483 |
|
1586
|
484 |
writeln"Problem 47. Schubert's Steamroller";
|
|
485 |
(*26 clauses; 63 Horn clauses*)
|
969
|
486 |
goal HOL.thy
|
1586
|
487 |
"(! x. P1 x --> P0 x) & (? x.P1 x) & \
|
|
488 |
\ (! x. P2 x --> P0 x) & (? x.P2 x) & \
|
|
489 |
\ (! x. P3 x --> P0 x) & (? x.P3 x) & \
|
|
490 |
\ (! x. P4 x --> P0 x) & (? x.P4 x) & \
|
|
491 |
\ (! x. P5 x --> P0 x) & (? x.P5 x) & \
|
|
492 |
\ (! x. Q1 x --> Q0 x) & (? x.Q1 x) & \
|
|
493 |
\ (! x. P0 x --> ((! y.Q0 y-->R x y) | \
|
|
494 |
\ (! y.P0 y & S y x & \
|
|
495 |
\ (? z.Q0 z&R y z) --> R x y))) & \
|
|
496 |
\ (! x y. P3 y & (P5 x|P4 x) --> S x y) & \
|
|
497 |
\ (! x y. P3 x & P2 y --> S x y) & \
|
|
498 |
\ (! x y. P2 x & P1 y --> S x y) & \
|
|
499 |
\ (! x y. P1 x & (P2 y|Q1 y) --> ~R x y) & \
|
|
500 |
\ (! x y. P3 x & P4 y --> R x y) & \
|
|
501 |
\ (! x y. P3 x & P5 y --> ~R x y) & \
|
|
502 |
\ (! x. (P4 x|P5 x) --> (? y.Q0 y & R x y)) \
|
|
503 |
\ --> (? x y. P0 x & P0 y & (? z. Q1 z & R y z & R x y))";
|
|
504 |
by (safe_meson_tac 1); (*119 secs*)
|
969
|
505 |
result();
|
|
506 |
|
1259
|
507 |
(*The Los problem? Circulated by John Harrison*)
|
1465
|
508 |
goal HOL.thy "(! x y z. P x y & P y z --> P x z) & \
|
|
509 |
\ (! x y z. Q x y & Q y z --> Q x z) & \
|
|
510 |
\ (! x y. P x y --> P y x) & \
|
|
511 |
\ (! (x::'a) y. P x y | Q x y) \
|
1259
|
512 |
\ --> (! x y. P x y) | (! x y. Q x y)";
|
1586
|
513 |
by (safe_best_meson_tac 1); (*3 secs; iter. deepening is VERY slow*)
|
1259
|
514 |
result();
|
|
515 |
|
|
516 |
(*A similar example, suggested by Johannes Schumann and credited to Pelletier*)
|
969
|
517 |
goal HOL.thy "(!x y z. P x y --> P y z --> P x z) --> \
|
1465
|
518 |
\ (!x y z. Q x y --> Q y z --> Q x z) --> \
|
|
519 |
\ (!x y.Q x y --> Q y x) --> (!x y. P x y | Q x y) --> \
|
|
520 |
\ (!x y.P x y) | (!x y.Q x y)";
|
1586
|
521 |
by (safe_best_meson_tac 1); (*2.7 secs*)
|
969
|
522 |
result();
|
|
523 |
|
|
524 |
writeln"Problem 50";
|
|
525 |
(*What has this to do with equality?*)
|
|
526 |
goal HOL.thy "(! x. P a x | (! y.P x y)) --> (? x. ! y.P x y)";
|
|
527 |
by (safe_meson_tac 1);
|
|
528 |
result();
|
|
529 |
|
|
530 |
writeln"Problem 55";
|
|
531 |
|
|
532 |
(*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
|
|
533 |
meson_tac cannot report who killed Agatha. *)
|
1586
|
534 |
goal HOL.thy "lives agatha & lives butler & lives charles & \
|
969
|
535 |
\ (killed agatha agatha | killed butler agatha | killed charles agatha) & \
|
|
536 |
\ (!x y. killed x y --> hates x y & ~richer x y) & \
|
|
537 |
\ (!x. hates agatha x --> ~hates charles x) & \
|
|
538 |
\ (hates agatha agatha & hates agatha charles) & \
|
1586
|
539 |
\ (!x. lives x & ~richer x agatha --> hates butler x) & \
|
969
|
540 |
\ (!x. hates agatha x --> hates butler x) & \
|
|
541 |
\ (!x. ~hates x agatha | ~hates x butler | ~hates x charles) --> \
|
|
542 |
\ (? x. killed x agatha)";
|
|
543 |
by (safe_meson_tac 1);
|
|
544 |
result();
|
|
545 |
|
|
546 |
writeln"Problem 57";
|
|
547 |
goal HOL.thy
|
|
548 |
"P (f a b) (f b c) & P (f b c) (f a c) & \
|
|
549 |
\ (! x y z. P x y & P y z --> P x z) --> P (f a b) (f a c)";
|
|
550 |
by (safe_meson_tac 1);
|
|
551 |
result();
|
|
552 |
|
|
553 |
writeln"Problem 58";
|
|
554 |
(* Challenge found on info-hol *)
|
|
555 |
goal HOL.thy
|
1586
|
556 |
"! P Q R x. ? v w. ! y z. P x & Q y --> (P v | R w) & (R z --> Q v)";
|
969
|
557 |
by (safe_meson_tac 1);
|
|
558 |
result();
|
|
559 |
|
|
560 |
writeln"Problem 59";
|
1586
|
561 |
goal HOL.thy "(! x. P x = (~P(f x))) --> (? x. P x & ~P(f x))";
|
969
|
562 |
by (safe_meson_tac 1);
|
|
563 |
result();
|
|
564 |
|
|
565 |
writeln"Problem 60";
|
|
566 |
goal HOL.thy "! x. P x (f x) = (? y. (! z. P z y --> P z (f x)) & P x y)";
|
|
567 |
by (safe_meson_tac 1);
|
|
568 |
result();
|
|
569 |
|
1404
|
570 |
writeln"Problem 62 as corrected in AAR newletter #31";
|
|
571 |
goal HOL.thy
|
1465
|
572 |
"(ALL x. p a & (p x --> p(f x)) --> p(f(f x))) = \
|
|
573 |
\ (ALL x. (~ p a | p x | p(f(f x))) & \
|
1404
|
574 |
\ (~ p a | ~ p(f x) | p(f(f x))))";
|
|
575 |
by (safe_meson_tac 1);
|
|
576 |
result();
|
|
577 |
|
1586
|
578 |
|
|
579 |
(** Charles Morgan's problems **)
|
|
580 |
|
|
581 |
val axa = "! x y. T(i x(i y x))";
|
|
582 |
val axb = "! x y z. T(i(i x(i y z))(i(i x y)(i x z)))";
|
|
583 |
val axc = "! x y. T(i(i(n x)(n y))(i y x))";
|
|
584 |
val axd = "! x y. T(i x y) & T x --> T y";
|
|
585 |
|
|
586 |
fun axjoin ([], q) = q
|
|
587 |
| axjoin (p::ps, q) = "(" ^ p ^ ") --> (" ^ axjoin(ps,q) ^ ")";
|
|
588 |
|
|
589 |
goal HOL.thy (axjoin([axa,axb,axd], "! x. T(i x x)"));
|
|
590 |
by (safe_meson_tac 1);
|
|
591 |
result();
|
|
592 |
|
|
593 |
writeln"Problem 66";
|
|
594 |
goal HOL.thy (axjoin([axa,axb,axc,axd], "! x. T(i x(n(n x)))"));
|
|
595 |
(*TOO SLOW: more than 24 minutes!
|
|
596 |
by (safe_meson_tac 1);
|
|
597 |
result();
|
|
598 |
*)
|
|
599 |
|
|
600 |
writeln"Problem 67";
|
|
601 |
goal HOL.thy (axjoin([axa,axb,axc,axd], "! x. T(i(n(n x)) x)"));
|
|
602 |
(*TOO SLOW: more than 3 minutes!
|
|
603 |
by (safe_meson_tac 1);
|
|
604 |
result();
|
|
605 |
*)
|
|
606 |
|
|
607 |
|
|
608 |
(*Restore original values*)
|
|
609 |
Unify.trace_bound := orig_trace_bound;
|
|
610 |
Unify.search_bound := orig_search_bound;
|
|
611 |
|
969
|
612 |
writeln"Reached end of file.";
|
|
613 |
|
|
614 |
(*26 August 1992: loaded in 277 secs. New Jersey v 75*)
|