author | clasohm |
Tue, 24 Oct 1995 14:59:17 +0100 | |
changeset 251 | f04b33ce250f |
parent 154 | c801110efa1b |
permissions | -rw-r--r-- |
0 | 1 |
(* Title: HOL/ex/cla |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
4 |
Copyright 1994 University of Cambridge |
0 | 5 |
|
6 |
Higher-Order Logic: predicate calculus problems |
|
7 |
||
8 |
Taken from FOL/cla.ML; beware of precedence of = vs <-> |
|
9 |
*) |
|
10 |
||
11 |
writeln"File HOL/ex/cla."; |
|
12 |
||
13 |
goal HOL.thy "(P --> Q | R) --> (P-->Q) | (P-->R)"; |
|
14 |
by (fast_tac HOL_cs 1); |
|
15 |
result(); |
|
16 |
||
17 |
(*If and only if*) |
|
18 |
||
19 |
goal HOL.thy "(P=Q) = (Q=P::bool)"; |
|
20 |
by (fast_tac HOL_cs 1); |
|
21 |
result(); |
|
22 |
||
23 |
goal HOL.thy "~ (P = (~P))"; |
|
24 |
by (fast_tac HOL_cs 1); |
|
25 |
result(); |
|
26 |
||
27 |
||
28 |
(*Sample problems from |
|
29 |
F. J. Pelletier, |
|
30 |
Seventy-Five Problems for Testing Automatic Theorem Provers, |
|
31 |
J. Automated Reasoning 2 (1986), 191-216. |
|
32 |
Errata, JAR 4 (1988), 236-236. |
|
33 |
||
34 |
The hardest problems -- judging by experience with several theorem provers, |
|
35 |
including matrix ones -- are 34 and 43. |
|
36 |
*) |
|
37 |
||
38 |
writeln"Pelletier's examples"; |
|
39 |
(*1*) |
|
40 |
goal HOL.thy "(P-->Q) = (~Q --> ~P)"; |
|
41 |
by (fast_tac HOL_cs 1); |
|
42 |
result(); |
|
43 |
||
44 |
(*2*) |
|
45 |
goal HOL.thy "(~ ~ P) = P"; |
|
46 |
by (fast_tac HOL_cs 1); |
|
47 |
result(); |
|
48 |
||
49 |
(*3*) |
|
50 |
goal HOL.thy "~(P-->Q) --> (Q-->P)"; |
|
51 |
by (fast_tac HOL_cs 1); |
|
52 |
result(); |
|
53 |
||
54 |
(*4*) |
|
55 |
goal HOL.thy "(~P-->Q) = (~Q --> P)"; |
|
56 |
by (fast_tac HOL_cs 1); |
|
57 |
result(); |
|
58 |
||
59 |
(*5*) |
|
60 |
goal HOL.thy "((P|Q)-->(P|R)) --> (P|(Q-->R))"; |
|
61 |
by (fast_tac HOL_cs 1); |
|
62 |
result(); |
|
63 |
||
64 |
(*6*) |
|
65 |
goal HOL.thy "P | ~ P"; |
|
66 |
by (fast_tac HOL_cs 1); |
|
67 |
result(); |
|
68 |
||
69 |
(*7*) |
|
70 |
goal HOL.thy "P | ~ ~ ~ P"; |
|
71 |
by (fast_tac HOL_cs 1); |
|
72 |
result(); |
|
73 |
||
74 |
(*8. Peirce's law*) |
|
75 |
goal HOL.thy "((P-->Q) --> P) --> P"; |
|
76 |
by (fast_tac HOL_cs 1); |
|
77 |
result(); |
|
78 |
||
79 |
(*9*) |
|
80 |
goal HOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"; |
|
81 |
by (fast_tac HOL_cs 1); |
|
82 |
result(); |
|
83 |
||
84 |
(*10*) |
|
85 |
goal HOL.thy "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P=Q)"; |
|
86 |
by (fast_tac HOL_cs 1); |
|
87 |
result(); |
|
88 |
||
89 |
(*11. Proved in each direction (incorrectly, says Pelletier!!) *) |
|
90 |
goal HOL.thy "P=P::bool"; |
|
91 |
by (fast_tac HOL_cs 1); |
|
92 |
result(); |
|
93 |
||
94 |
(*12. "Dijkstra's law"*) |
|
95 |
goal HOL.thy "((P = Q) = R) = (P = (Q = R))"; |
|
96 |
by (fast_tac HOL_cs 1); |
|
97 |
result(); |
|
98 |
||
99 |
(*13. Distributive law*) |
|
100 |
goal HOL.thy "(P | (Q & R)) = ((P | Q) & (P | R))"; |
|
101 |
by (fast_tac HOL_cs 1); |
|
102 |
result(); |
|
103 |
||
104 |
(*14*) |
|
105 |
goal HOL.thy "(P = Q) = ((Q | ~P) & (~Q|P))"; |
|
106 |
by (fast_tac HOL_cs 1); |
|
107 |
result(); |
|
108 |
||
109 |
(*15*) |
|
110 |
goal HOL.thy "(P --> Q) = (~P | Q)"; |
|
111 |
by (fast_tac HOL_cs 1); |
|
112 |
result(); |
|
113 |
||
114 |
(*16*) |
|
115 |
goal HOL.thy "(P-->Q) | (Q-->P)"; |
|
116 |
by (fast_tac HOL_cs 1); |
|
117 |
result(); |
|
118 |
||
119 |
(*17*) |
|
120 |
goal HOL.thy "((P & (Q-->R))-->S) = ((~P | Q | S) & (~P | ~R | S))"; |
|
121 |
by (fast_tac HOL_cs 1); |
|
122 |
result(); |
|
123 |
||
124 |
writeln"Classical Logic: examples with quantifiers"; |
|
125 |
||
126 |
goal HOL.thy "(! x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))"; |
|
127 |
by (fast_tac HOL_cs 1); |
|
128 |
result(); |
|
129 |
||
130 |
goal HOL.thy "(? x. P-->Q(x)) = (P --> (? x.Q(x)))"; |
|
131 |
by (fast_tac HOL_cs 1); |
|
132 |
result(); |
|
133 |
||
134 |
goal HOL.thy "(? x.P(x)-->Q) = ((! x.P(x)) --> Q)"; |
|
135 |
by (fast_tac HOL_cs 1); |
|
136 |
result(); |
|
137 |
||
138 |
goal HOL.thy "((! x.P(x)) | Q) = (! x. P(x) | Q)"; |
|
139 |
by (fast_tac HOL_cs 1); |
|
140 |
result(); |
|
141 |
||
23 | 142 |
(*From Wishnu Prasetya*) |
143 |
goal HOL.thy |
|
144 |
"(!s. q(s) --> r(s)) & ~r(s) & (!s. ~r(s) & ~q(s) --> p(t) | q(t)) \ |
|
145 |
\ --> p(t) | r(t)"; |
|
146 |
by (fast_tac HOL_cs 1); |
|
147 |
result(); |
|
148 |
||
149 |
||
0 | 150 |
writeln"Problems requiring quantifier duplication"; |
151 |
||
152 |
(*Needs multiple instantiation of the quantifier.*) |
|
153 |
goal HOL.thy "(! x. P(x)-->P(f(x))) & P(d)-->P(f(f(f(d))))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
154 |
by (deepen_tac HOL_cs 1 1); |
0 | 155 |
result(); |
156 |
||
157 |
(*Needs double instantiation of the quantifier*) |
|
158 |
goal HOL.thy "? x. P(x) --> P(a) & P(b)"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
159 |
by (deepen_tac HOL_cs 1 1); |
0 | 160 |
result(); |
161 |
||
162 |
goal HOL.thy "? z. P(z) --> (! x. P(x))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
163 |
by (deepen_tac HOL_cs 1 1); |
0 | 164 |
result(); |
165 |
||
98 | 166 |
goal HOL.thy "? x. (? y. P(y)) --> P(x)"; |
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
167 |
by (deepen_tac HOL_cs 1 1); |
98 | 168 |
result(); |
169 |
||
0 | 170 |
writeln"Hard examples with quantifiers"; |
171 |
||
172 |
writeln"Problem 18"; |
|
173 |
goal HOL.thy "? y. ! x. P(y)-->P(x)"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
174 |
by (deepen_tac HOL_cs 1 1); |
0 | 175 |
result(); |
176 |
||
177 |
writeln"Problem 19"; |
|
178 |
goal HOL.thy "? x. ! y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
179 |
by (deepen_tac HOL_cs 1 1); |
0 | 180 |
result(); |
181 |
||
182 |
writeln"Problem 20"; |
|
183 |
goal HOL.thy "(! x y. ? z. ! w. (P(x)&Q(y)-->R(z)&S(w))) \ |
|
184 |
\ --> (? x y. P(x) & Q(y)) --> (? z. R(z))"; |
|
185 |
by (fast_tac HOL_cs 1); |
|
186 |
result(); |
|
187 |
||
188 |
writeln"Problem 21"; |
|
189 |
goal HOL.thy "(? x. P-->Q(x)) & (? x. Q(x)-->P) --> (? x. P=Q(x))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
190 |
by (deepen_tac HOL_cs 1 1); |
0 | 191 |
result(); |
192 |
||
193 |
writeln"Problem 22"; |
|
194 |
goal HOL.thy "(! x. P = Q(x)) --> (P = (! x. Q(x)))"; |
|
195 |
by (fast_tac HOL_cs 1); |
|
196 |
result(); |
|
197 |
||
198 |
writeln"Problem 23"; |
|
199 |
goal HOL.thy "(! x. P | Q(x)) = (P | (! x. Q(x)))"; |
|
200 |
by (best_tac HOL_cs 1); |
|
201 |
result(); |
|
202 |
||
203 |
writeln"Problem 24"; |
|
204 |
goal HOL.thy "~(? x. S(x)&Q(x)) & (! x. P(x) --> Q(x)|R(x)) & \ |
|
205 |
\ ~(? x.P(x)) --> (? x.Q(x)) & (! x. Q(x)|R(x) --> S(x)) \ |
|
206 |
\ --> (? x. P(x)&R(x))"; |
|
207 |
by (fast_tac HOL_cs 1); |
|
208 |
result(); |
|
209 |
||
210 |
writeln"Problem 25"; |
|
211 |
goal HOL.thy "(? x. P(x)) & \ |
|
212 |
\ (! x. L(x) --> ~ (M(x) & R(x))) & \ |
|
213 |
\ (! x. P(x) --> (M(x) & L(x))) & \ |
|
214 |
\ ((! x. P(x)-->Q(x)) | (? x. P(x)&R(x))) \ |
|
215 |
\ --> (? x. Q(x)&P(x))"; |
|
216 |
by (best_tac HOL_cs 1); |
|
217 |
result(); |
|
218 |
||
219 |
writeln"Problem 26"; |
|
220 |
goal HOL.thy "((? x. p(x)) = (? x. q(x))) & \ |
|
221 |
\ (! x. ! y. p(x) & q(y) --> (r(x) = s(y))) \ |
|
222 |
\ --> ((! x. p(x)-->r(x)) = (! x. q(x)-->s(x)))"; |
|
223 |
by (fast_tac HOL_cs 1); |
|
224 |
result(); |
|
225 |
||
226 |
writeln"Problem 27"; |
|
227 |
goal HOL.thy "(? x. P(x) & ~Q(x)) & \ |
|
228 |
\ (! x. P(x) --> R(x)) & \ |
|
229 |
\ (! x. M(x) & L(x) --> P(x)) & \ |
|
230 |
\ ((? x. R(x) & ~ Q(x)) --> (! x. L(x) --> ~ R(x))) \ |
|
231 |
\ --> (! x. M(x) --> ~L(x))"; |
|
232 |
by (fast_tac HOL_cs 1); |
|
233 |
result(); |
|
234 |
||
235 |
writeln"Problem 28. AMENDED"; |
|
236 |
goal HOL.thy "(! x. P(x) --> (! x. Q(x))) & \ |
|
237 |
\ ((! x. Q(x)|R(x)) --> (? x. Q(x)&S(x))) & \ |
|
238 |
\ ((? x.S(x)) --> (! x. L(x) --> M(x))) \ |
|
239 |
\ --> (! x. P(x) & L(x) --> M(x))"; |
|
240 |
by (fast_tac HOL_cs 1); |
|
241 |
result(); |
|
242 |
||
243 |
writeln"Problem 29. Essentially the same as Principia Mathematica *11.71"; |
|
244 |
goal HOL.thy "(? x. F(x)) & (? y. G(y)) \ |
|
245 |
\ --> ( ((! x. F(x)-->H(x)) & (! y. G(y)-->J(y))) = \ |
|
246 |
\ (! x y. F(x) & G(y) --> H(x) & J(y)))"; |
|
247 |
by (fast_tac HOL_cs 1); |
|
248 |
result(); |
|
249 |
||
250 |
writeln"Problem 30"; |
|
251 |
goal HOL.thy "(! x. P(x) | Q(x) --> ~ R(x)) & \ |
|
252 |
\ (! x. (Q(x) --> ~ S(x)) --> P(x) & R(x)) \ |
|
253 |
\ --> (! x. S(x))"; |
|
254 |
by (fast_tac HOL_cs 1); |
|
255 |
result(); |
|
256 |
||
257 |
writeln"Problem 31"; |
|
258 |
goal HOL.thy "~(? x.P(x) & (Q(x) | R(x))) & \ |
|
259 |
\ (? x. L(x) & P(x)) & \ |
|
260 |
\ (! x. ~ R(x) --> M(x)) \ |
|
261 |
\ --> (? x. L(x) & M(x))"; |
|
262 |
by (fast_tac HOL_cs 1); |
|
263 |
result(); |
|
264 |
||
265 |
writeln"Problem 32"; |
|
266 |
goal HOL.thy "(! x. P(x) & (Q(x)|R(x))-->S(x)) & \ |
|
267 |
\ (! x. S(x) & R(x) --> L(x)) & \ |
|
268 |
\ (! x. M(x) --> R(x)) \ |
|
269 |
\ --> (! x. P(x) & M(x) --> L(x))"; |
|
270 |
by (best_tac HOL_cs 1); |
|
271 |
result(); |
|
272 |
||
273 |
writeln"Problem 33"; |
|
274 |
goal HOL.thy "(! x. P(a) & (P(x)-->P(b))-->P(c)) = \ |
|
275 |
\ (! x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))"; |
|
276 |
by (best_tac HOL_cs 1); |
|
277 |
result(); |
|
278 |
||
279 |
writeln"Problem 34 AMENDED (TWICE!!) NOT PROVED AUTOMATICALLY"; |
|
280 |
(*Andrews's challenge*) |
|
281 |
goal HOL.thy "((? x. ! y. p(x) = p(y)) = \ |
|
282 |
\ ((? x. q(x)) = (! y. p(y)))) = \ |
|
283 |
\ ((? x. ! y. q(x) = q(y)) = \ |
|
284 |
\ ((? x. p(x)) = (! y. q(y))))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
285 |
by (deepen_tac HOL_cs 3 1); |
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
286 |
(*slower with smaller bounds*) |
0 | 287 |
result(); |
288 |
||
289 |
writeln"Problem 35"; |
|
290 |
goal HOL.thy "? x y. P(x,y) --> (! u v. P(u,v))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
291 |
by (deepen_tac HOL_cs 1 1); |
0 | 292 |
result(); |
293 |
||
294 |
writeln"Problem 36"; |
|
295 |
goal HOL.thy "(! x. ? y. J(x,y)) & \ |
|
296 |
\ (! x. ? y. G(x,y)) & \ |
|
297 |
\ (! x y. J(x,y) | G(x,y) --> \ |
|
298 |
\ (! z. J(y,z) | G(y,z) --> H(x,z))) \ |
|
299 |
\ --> (! x. ? y. H(x,y))"; |
|
300 |
by (fast_tac HOL_cs 1); |
|
301 |
result(); |
|
302 |
||
303 |
writeln"Problem 37"; |
|
304 |
goal HOL.thy "(! z. ? w. ! x. ? y. \ |
|
305 |
\ (P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (? u.Q(u,w)))) & \ |
|
306 |
\ (! x z. ~P(x,z) --> (? y. Q(y,z))) & \ |
|
307 |
\ ((? x y. Q(x,y)) --> (! x. R(x,x))) \ |
|
308 |
\ --> (! x. ? y. R(x,y))"; |
|
309 |
by (fast_tac HOL_cs 1); |
|
310 |
result(); |
|
311 |
||
312 |
writeln"Problem 38"; |
|
313 |
goal HOL.thy |
|
314 |
"(! x. p(a) & (p(x) --> (? y. p(y) & r(x,y))) --> \ |
|
315 |
\ (? z. ? w. p(z) & r(x,w) & r(w,z))) = \ |
|
316 |
\ (! x. (~p(a) | p(x) | (? z. ? w. p(z) & r(x,w) & r(w,z))) & \ |
|
317 |
\ (~p(a) | ~(? y. p(y) & r(x,y)) | \ |
|
318 |
\ (? z. ? w. p(z) & r(x,w) & r(w,z))))"; |
|
319 |
||
320 |
writeln"Problem 39"; |
|
321 |
goal HOL.thy "~ (? x. ! y. F(y,x) = (~F(y,y)))"; |
|
322 |
by (fast_tac HOL_cs 1); |
|
323 |
result(); |
|
324 |
||
325 |
writeln"Problem 40. AMENDED"; |
|
326 |
goal HOL.thy "(? y. ! x. F(x,y) = F(x,x)) \ |
|
327 |
\ --> ~ (! x. ? y. ! z. F(z,y) = (~F(z,x)))"; |
|
328 |
by (fast_tac HOL_cs 1); |
|
329 |
result(); |
|
330 |
||
331 |
writeln"Problem 41"; |
|
332 |
goal HOL.thy "(! z. ? y. ! x. f(x,y) = (f(x,z) & ~ f(x,x))) \ |
|
333 |
\ --> ~ (? z. ! x. f(x,z))"; |
|
334 |
by (best_tac HOL_cs 1); |
|
335 |
result(); |
|
336 |
||
337 |
writeln"Problem 42"; |
|
338 |
goal HOL.thy "~ (? y. ! x. p(x,y) = (~ (? z. p(x,z) & p(z,x))))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
339 |
by (deepen_tac HOL_cs 3 1); |
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
340 |
result(); |
0 | 341 |
|
342 |
writeln"Problem 43 NOT PROVED AUTOMATICALLY"; |
|
343 |
goal HOL.thy |
|
90
5c7a69cef18b
added parentheses made necessary by change of constrain's precedence
clasohm
parents:
23
diff
changeset
|
344 |
"(! x::'a. ! y::'a. q(x,y) = (! z. p(z,x) = (p(z,y)::bool))) \ |
5c7a69cef18b
added parentheses made necessary by change of constrain's precedence
clasohm
parents:
23
diff
changeset
|
345 |
\ --> (! x. (! y. q(x,y) = (q(y,x)::bool)))"; |
0 | 346 |
|
347 |
||
348 |
writeln"Problem 44"; |
|
349 |
goal HOL.thy "(! x. f(x) --> \ |
|
350 |
\ (? y. g(y) & h(x,y) & (? y. g(y) & ~ h(x,y)))) & \ |
|
351 |
\ (? x. j(x) & (! y. g(y) --> h(x,y))) \ |
|
352 |
\ --> (? x. j(x) & ~f(x))"; |
|
353 |
by (fast_tac HOL_cs 1); |
|
354 |
result(); |
|
355 |
||
356 |
writeln"Problem 45"; |
|
357 |
goal HOL.thy |
|
358 |
"(! x. f(x) & (! y. g(y) & h(x,y) --> j(x,y)) \ |
|
359 |
\ --> (! y. g(y) & h(x,y) --> k(y))) & \ |
|
360 |
\ ~ (? y. l(y) & k(y)) & \ |
|
361 |
\ (? x. f(x) & (! y. h(x,y) --> l(y)) \ |
|
362 |
\ & (! y. g(y) & h(x,y) --> j(x,y))) \ |
|
363 |
\ --> (? x. f(x) & ~ (? y. g(y) & h(x,y)))"; |
|
364 |
by (best_tac HOL_cs 1); |
|
365 |
result(); |
|
366 |
||
367 |
||
368 |
writeln"Problems (mainly) involving equality or functions"; |
|
369 |
||
370 |
writeln"Problem 48"; |
|
371 |
goal HOL.thy "(a=b | c=d) & (a=c | b=d) --> a=d | b=c"; |
|
372 |
by (fast_tac HOL_cs 1); |
|
373 |
result(); |
|
374 |
||
375 |
writeln"Problem 49 NOT PROVED AUTOMATICALLY"; |
|
376 |
(*Hard because it involves substitution for Vars; |
|
377 |
the type constraint ensures that x,y,z have the same type as a,b,u. *) |
|
378 |
goal HOL.thy "(? x y::'a. ! z. z=x | z=y) & P(a) & P(b) & (~a=b) \ |
|
379 |
\ --> (! u::'a.P(u))"; |
|
380 |
by (Classical.safe_tac HOL_cs); |
|
381 |
by (res_inst_tac [("x","a")] allE 1); |
|
382 |
by (assume_tac 1); |
|
383 |
by (res_inst_tac [("x","b")] allE 1); |
|
384 |
by (assume_tac 1); |
|
385 |
by (fast_tac HOL_cs 1); |
|
386 |
result(); |
|
387 |
||
388 |
writeln"Problem 50"; |
|
389 |
(*What has this to do with equality?*) |
|
390 |
goal HOL.thy "(! x. P(a,x) | (! y.P(x,y))) --> (? x. ! y.P(x,y))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
391 |
by (deepen_tac HOL_cs 1 1); |
0 | 392 |
result(); |
393 |
||
394 |
writeln"Problem 51"; |
|
395 |
goal HOL.thy |
|
396 |
"(? z w. ! x y. P(x,y) = (x=z & y=w)) --> \ |
|
397 |
\ (? z. ! x. ? w. (! y. P(x,y) = (y=w)) = (x=z))"; |
|
398 |
by (best_tac HOL_cs 1); |
|
399 |
result(); |
|
400 |
||
401 |
writeln"Problem 52"; |
|
402 |
(*Almost the same as 51. *) |
|
403 |
goal HOL.thy |
|
404 |
"(? z w. ! x y. P(x,y) = (x=z & y=w)) --> \ |
|
405 |
\ (? w. ! y. ? z. (! x. P(x,y) = (x=z)) = (y=w))"; |
|
406 |
by (best_tac HOL_cs 1); |
|
407 |
result(); |
|
408 |
||
409 |
writeln"Problem 55"; |
|
410 |
||
411 |
(*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988). |
|
412 |
fast_tac DISCOVERS who killed Agatha. *) |
|
413 |
goal HOL.thy "lives(agatha) & lives(butler) & lives(charles) & \ |
|
414 |
\ (killed(agatha,agatha) | killed(butler,agatha) | killed(charles,agatha)) & \ |
|
415 |
\ (!x y. killed(x,y) --> hates(x,y) & ~richer(x,y)) & \ |
|
416 |
\ (!x. hates(agatha,x) --> ~hates(charles,x)) & \ |
|
417 |
\ (hates(agatha,agatha) & hates(agatha,charles)) & \ |
|
418 |
\ (!x. lives(x) & ~richer(x,agatha) --> hates(butler,x)) & \ |
|
419 |
\ (!x. hates(agatha,x) --> hates(butler,x)) & \ |
|
420 |
\ (!x. ~hates(x,agatha) | ~hates(x,butler) | ~hates(x,charles)) --> \ |
|
421 |
\ killed(?who,agatha)"; |
|
422 |
by (fast_tac HOL_cs 1); |
|
423 |
result(); |
|
424 |
||
425 |
writeln"Problem 56"; |
|
426 |
goal HOL.thy |
|
427 |
"(! x. (? y. P(y) & x=f(y)) --> P(x)) = (! x. P(x) --> P(f(x)))"; |
|
428 |
by (fast_tac HOL_cs 1); |
|
429 |
result(); |
|
430 |
||
431 |
writeln"Problem 57"; |
|
432 |
goal HOL.thy |
|
433 |
"P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \ |
|
434 |
\ (! x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))"; |
|
435 |
by (fast_tac HOL_cs 1); |
|
436 |
result(); |
|
437 |
||
438 |
writeln"Problem 58 NOT PROVED AUTOMATICALLY"; |
|
439 |
goal HOL.thy "(! x y. f(x)=g(y)) --> (! x y. f(f(x))=f(g(y)))"; |
|
440 |
val f_cong = read_instantiate [("f","f")] arg_cong; |
|
441 |
by (fast_tac (HOL_cs addIs [f_cong]) 1); |
|
442 |
result(); |
|
443 |
||
444 |
writeln"Problem 59"; |
|
445 |
goal HOL.thy "(! x. P(x) = (~P(f(x)))) --> (? x. P(x) & ~P(f(x)))"; |
|
154
c801110efa1b
HOL/ex/cla: proofs now use deepen_tac instead of best_tac HOL_dup_cs
lcp
parents:
98
diff
changeset
|
446 |
by (deepen_tac HOL_cs 1 1); |
0 | 447 |
result(); |
448 |
||
449 |
writeln"Problem 60"; |
|
450 |
goal HOL.thy |
|
451 |
"! x. P(x,f(x)) = (? y. (! z. P(z,y) --> P(z,f(x))) & P(x,y))"; |
|
452 |
by (fast_tac HOL_cs 1); |
|
453 |
result(); |
|
454 |
||
455 |
writeln"Reached end of file."; |