1459
|
1 |
(* Title: FOL/ex/int
|
0
|
2 |
ID: $Id$
|
1459
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
0
|
4 |
Copyright 1991 University of Cambridge
|
|
5 |
|
|
6 |
Intuitionistic First-Order Logic
|
|
7 |
|
|
8 |
Single-step commands:
|
|
9 |
by (Int.step_tac 1);
|
|
10 |
by (biresolve_tac safe_brls 1);
|
|
11 |
by (biresolve_tac haz_brls 1);
|
|
12 |
by (assume_tac 1);
|
|
13 |
by (Int.safe_tac 1);
|
|
14 |
by (Int.mp_tac 1);
|
|
15 |
by (Int.fast_tac 1);
|
|
16 |
*)
|
|
17 |
|
|
18 |
writeln"File FOL/ex/int.";
|
|
19 |
|
1006
|
20 |
(*Metatheorem (for PROPOSITIONAL formulae...):
|
|
21 |
P is classically provable iff ~~P is intuitionistically provable.
|
|
22 |
Therefore ~P is classically provable iff it is intuitionistically provable.
|
0
|
23 |
|
1006
|
24 |
Proof: Let Q be the conjuction of the propositions A|~A, one for each atom A
|
|
25 |
in P. Now ~~Q is intuitionistically provable because ~~(A|~A) is and because
|
|
26 |
~~ distributes over &. If P is provable classically, then clearly Q-->P is
|
|
27 |
provable intuitionistically, so ~~(Q-->P) is also provable intuitionistically.
|
|
28 |
The latter is intuitionistically equivalent to ~~Q-->~~P, hence to ~~P, since
|
|
29 |
~~Q is intuitionistically provable. Finally, if P is a negation then ~~P is
|
|
30 |
intuitionstically equivalent to P. [Andy Pitts] *)
|
0
|
31 |
|
|
32 |
goal IFOL.thy "~~(P&Q) <-> ~~P & ~~Q";
|
|
33 |
by (Int.fast_tac 1);
|
|
34 |
result();
|
|
35 |
|
1006
|
36 |
(* ~~ does NOT distribute over | *)
|
|
37 |
|
|
38 |
goal IFOL.thy "~~(P-->Q) <-> (~~P --> ~~Q)";
|
|
39 |
by (Int.fast_tac 1);
|
|
40 |
result();
|
|
41 |
|
0
|
42 |
goal IFOL.thy "~~~P <-> ~P";
|
|
43 |
by (Int.fast_tac 1);
|
|
44 |
result();
|
|
45 |
|
|
46 |
goal IFOL.thy "~~((P --> Q | R) --> (P-->Q) | (P-->R))";
|
|
47 |
by (Int.fast_tac 1);
|
|
48 |
result();
|
|
49 |
|
|
50 |
goal IFOL.thy "(P<->Q) <-> (Q<->P)";
|
|
51 |
by (Int.fast_tac 1);
|
|
52 |
result();
|
|
53 |
|
|
54 |
|
|
55 |
writeln"Lemmas for the propositional double-negation translation";
|
|
56 |
|
|
57 |
goal IFOL.thy "P --> ~~P";
|
|
58 |
by (Int.fast_tac 1);
|
|
59 |
result();
|
|
60 |
|
|
61 |
goal IFOL.thy "~~(~~P --> P)";
|
|
62 |
by (Int.fast_tac 1);
|
|
63 |
result();
|
|
64 |
|
|
65 |
goal IFOL.thy "~~P & ~~(P --> Q) --> ~~Q";
|
|
66 |
by (Int.fast_tac 1);
|
|
67 |
result();
|
|
68 |
|
|
69 |
|
|
70 |
writeln"The following are classically but not constructively valid.";
|
|
71 |
|
|
72 |
(*The attempt to prove them terminates quickly!*)
|
|
73 |
goal IFOL.thy "((P-->Q) --> P) --> P";
|
|
74 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
75 |
(*Check that subgoals remain: proof failed.*)
|
|
76 |
getgoal 1;
|
|
77 |
|
|
78 |
goal IFOL.thy "(P&Q-->R) --> (P-->R) | (Q-->R)";
|
|
79 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
80 |
getgoal 1;
|
|
81 |
|
|
82 |
|
|
83 |
writeln"Intuitionistic FOL: propositional problems based on Pelletier.";
|
|
84 |
|
|
85 |
writeln"Problem ~~1";
|
|
86 |
goal IFOL.thy "~~((P-->Q) <-> (~Q --> ~P))";
|
|
87 |
by (Int.fast_tac 1);
|
|
88 |
result();
|
|
89 |
(*5 secs*)
|
|
90 |
|
|
91 |
|
|
92 |
writeln"Problem ~~2";
|
|
93 |
goal IFOL.thy "~~(~~P <-> P)";
|
|
94 |
by (Int.fast_tac 1);
|
|
95 |
result();
|
|
96 |
(*1 secs*)
|
|
97 |
|
|
98 |
|
|
99 |
writeln"Problem 3";
|
|
100 |
goal IFOL.thy "~(P-->Q) --> (Q-->P)";
|
|
101 |
by (Int.fast_tac 1);
|
|
102 |
result();
|
|
103 |
|
|
104 |
writeln"Problem ~~4";
|
|
105 |
goal IFOL.thy "~~((~P-->Q) <-> (~Q --> P))";
|
|
106 |
by (Int.fast_tac 1);
|
|
107 |
result();
|
|
108 |
(*9 secs*)
|
|
109 |
|
|
110 |
writeln"Problem ~~5";
|
|
111 |
goal IFOL.thy "~~((P|Q-->P|R) --> P|(Q-->R))";
|
|
112 |
by (Int.fast_tac 1);
|
|
113 |
result();
|
|
114 |
(*10 secs*)
|
|
115 |
|
|
116 |
|
|
117 |
writeln"Problem ~~6";
|
|
118 |
goal IFOL.thy "~~(P | ~P)";
|
|
119 |
by (Int.fast_tac 1);
|
|
120 |
result();
|
|
121 |
|
|
122 |
writeln"Problem ~~7";
|
|
123 |
goal IFOL.thy "~~(P | ~~~P)";
|
|
124 |
by (Int.fast_tac 1);
|
|
125 |
result();
|
|
126 |
|
|
127 |
writeln"Problem ~~8. Peirce's law";
|
|
128 |
goal IFOL.thy "~~(((P-->Q) --> P) --> P)";
|
|
129 |
by (Int.fast_tac 1);
|
|
130 |
result();
|
|
131 |
|
|
132 |
writeln"Problem 9";
|
|
133 |
goal IFOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
|
|
134 |
by (Int.fast_tac 1);
|
|
135 |
result();
|
|
136 |
(*9 secs*)
|
|
137 |
|
|
138 |
|
|
139 |
writeln"Problem 10";
|
|
140 |
goal IFOL.thy "(Q-->R) --> (R-->P&Q) --> (P-->(Q|R)) --> (P<->Q)";
|
|
141 |
by (Int.fast_tac 1);
|
|
142 |
result();
|
|
143 |
|
|
144 |
writeln"11. Proved in each direction (incorrectly, says Pelletier!!) ";
|
|
145 |
goal IFOL.thy "P<->P";
|
|
146 |
by (Int.fast_tac 1);
|
|
147 |
|
|
148 |
writeln"Problem ~~12. Dijkstra's law ";
|
|
149 |
goal IFOL.thy "~~(((P <-> Q) <-> R) <-> (P <-> (Q <-> R)))";
|
|
150 |
by (Int.fast_tac 1);
|
|
151 |
result();
|
|
152 |
|
|
153 |
goal IFOL.thy "((P <-> Q) <-> R) --> ~~(P <-> (Q <-> R))";
|
|
154 |
by (Int.fast_tac 1);
|
|
155 |
result();
|
|
156 |
|
|
157 |
writeln"Problem 13. Distributive law";
|
|
158 |
goal IFOL.thy "P | (Q & R) <-> (P | Q) & (P | R)";
|
|
159 |
by (Int.fast_tac 1);
|
|
160 |
result();
|
|
161 |
|
|
162 |
writeln"Problem ~~14";
|
|
163 |
goal IFOL.thy "~~((P <-> Q) <-> ((Q | ~P) & (~Q|P)))";
|
|
164 |
by (Int.fast_tac 1);
|
|
165 |
result();
|
|
166 |
|
|
167 |
writeln"Problem ~~15";
|
|
168 |
goal IFOL.thy "~~((P --> Q) <-> (~P | Q))";
|
|
169 |
by (Int.fast_tac 1);
|
|
170 |
result();
|
|
171 |
|
|
172 |
writeln"Problem ~~16";
|
|
173 |
goal IFOL.thy "~~((P-->Q) | (Q-->P))";
|
|
174 |
by (Int.fast_tac 1);
|
|
175 |
result();
|
|
176 |
|
|
177 |
writeln"Problem ~~17";
|
|
178 |
goal IFOL.thy
|
|
179 |
"~~(((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S)))";
|
|
180 |
by (Int.fast_tac 1);
|
|
181 |
result();
|
|
182 |
|
|
183 |
(*Dijkstra's "Golden Rule"*)
|
|
184 |
goal IFOL.thy "(P&Q) <-> P <-> Q <-> (P|Q)";
|
|
185 |
by (Int.fast_tac 1);
|
|
186 |
result();
|
|
187 |
|
|
188 |
|
232
|
189 |
writeln"****Examples with quantifiers****";
|
0
|
190 |
|
|
191 |
|
|
192 |
writeln"The converse is classical in the following implications...";
|
|
193 |
|
|
194 |
goal IFOL.thy "(EX x.P(x)-->Q) --> (ALL x.P(x)) --> Q";
|
|
195 |
by (Int.fast_tac 1);
|
|
196 |
result();
|
|
197 |
|
|
198 |
goal IFOL.thy "((ALL x.P(x))-->Q) --> ~ (ALL x. P(x) & ~Q)";
|
|
199 |
by (Int.fast_tac 1);
|
|
200 |
result();
|
|
201 |
|
|
202 |
goal IFOL.thy "((ALL x. ~P(x))-->Q) --> ~ (ALL x. ~ (P(x)|Q))";
|
|
203 |
by (Int.fast_tac 1);
|
|
204 |
result();
|
|
205 |
|
|
206 |
goal IFOL.thy "(ALL x.P(x)) | Q --> (ALL x. P(x) | Q)";
|
|
207 |
by (Int.fast_tac 1);
|
|
208 |
result();
|
|
209 |
|
|
210 |
goal IFOL.thy "(EX x. P --> Q(x)) --> (P --> (EX x. Q(x)))";
|
|
211 |
by (Int.fast_tac 1);
|
|
212 |
result();
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
writeln"The following are not constructively valid!";
|
|
218 |
(*The attempt to prove them terminates quickly!*)
|
|
219 |
|
|
220 |
goal IFOL.thy "((ALL x.P(x))-->Q) --> (EX x.P(x)-->Q)";
|
|
221 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
222 |
getgoal 1;
|
|
223 |
|
|
224 |
goal IFOL.thy "(P --> (EX x.Q(x))) --> (EX x. P-->Q(x))";
|
|
225 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
226 |
getgoal 1;
|
|
227 |
|
|
228 |
goal IFOL.thy "(ALL x. P(x) | Q) --> ((ALL x.P(x)) | Q)";
|
|
229 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
230 |
getgoal 1;
|
|
231 |
|
|
232 |
goal IFOL.thy "(ALL x. ~~P(x)) --> ~~(ALL x. P(x))";
|
|
233 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
234 |
getgoal 1;
|
|
235 |
|
|
236 |
(*Classically but not intuitionistically valid. Proved by a bug in 1986!*)
|
|
237 |
goal IFOL.thy "EX x. Q(x) --> (ALL x. Q(x))";
|
|
238 |
by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected";
|
|
239 |
getgoal 1;
|
|
240 |
|
|
241 |
|
|
242 |
writeln"Hard examples with quantifiers";
|
|
243 |
|
|
244 |
(*The ones that have not been proved are not known to be valid!
|
|
245 |
Some will require quantifier duplication -- not currently available*)
|
|
246 |
|
|
247 |
writeln"Problem ~~18";
|
|
248 |
goal IFOL.thy "~~(EX y. ALL x. P(y)-->P(x))";
|
|
249 |
(*NOT PROVED*)
|
|
250 |
|
|
251 |
writeln"Problem ~~19";
|
|
252 |
goal IFOL.thy "~~(EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x)))";
|
|
253 |
(*NOT PROVED*)
|
|
254 |
|
|
255 |
writeln"Problem 20";
|
|
256 |
goal IFOL.thy "(ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w))) \
|
|
257 |
\ --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))";
|
|
258 |
by (Int.fast_tac 1);
|
|
259 |
result();
|
|
260 |
|
|
261 |
writeln"Problem 21";
|
|
262 |
goal IFOL.thy "(EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> ~~(EX x. P<->Q(x))";
|
|
263 |
(*NOT PROVED*)
|
|
264 |
|
|
265 |
writeln"Problem 22";
|
|
266 |
goal IFOL.thy "(ALL x. P <-> Q(x)) --> (P <-> (ALL x. Q(x)))";
|
|
267 |
by (Int.fast_tac 1);
|
|
268 |
result();
|
|
269 |
|
|
270 |
writeln"Problem ~~23";
|
|
271 |
goal IFOL.thy "~~ ((ALL x. P | Q(x)) <-> (P | (ALL x. Q(x))))";
|
|
272 |
by (Int.best_tac 1);
|
|
273 |
result();
|
|
274 |
|
|
275 |
writeln"Problem 24";
|
|
276 |
goal IFOL.thy "~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) & \
|
|
277 |
\ ~(EX x.P(x)) --> (EX x.Q(x)) & (ALL x. Q(x)|R(x) --> S(x)) \
|
|
278 |
\ --> (EX x. P(x)&R(x))";
|
|
279 |
by (Int.fast_tac 1);
|
|
280 |
result();
|
|
281 |
|
|
282 |
writeln"Problem 25";
|
|
283 |
goal IFOL.thy "(EX x. P(x)) & \
|
|
284 |
\ (ALL x. L(x) --> ~ (M(x) & R(x))) & \
|
|
285 |
\ (ALL x. P(x) --> (M(x) & L(x))) & \
|
|
286 |
\ ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x))) \
|
|
287 |
\ --> (EX x. Q(x)&P(x))";
|
|
288 |
by (Int.best_tac 1);
|
|
289 |
result();
|
|
290 |
|
|
291 |
writeln"Problem ~~26";
|
1459
|
292 |
goal IFOL.thy "(~~(EX x. p(x)) <-> ~~(EX x. q(x))) & \
|
|
293 |
\ (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y))) \
|
0
|
294 |
\ --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))";
|
|
295 |
(*NOT PROVED*)
|
|
296 |
|
|
297 |
writeln"Problem 27";
|
|
298 |
goal IFOL.thy "(EX x. P(x) & ~Q(x)) & \
|
|
299 |
\ (ALL x. P(x) --> R(x)) & \
|
|
300 |
\ (ALL x. M(x) & L(x) --> P(x)) & \
|
|
301 |
\ ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x))) \
|
|
302 |
\ --> (ALL x. M(x) --> ~L(x))";
|
1006
|
303 |
by (Int.fast_tac 1); (*21 secs*)
|
0
|
304 |
result();
|
|
305 |
|
|
306 |
writeln"Problem ~~28. AMENDED";
|
|
307 |
goal IFOL.thy "(ALL x. P(x) --> (ALL x. Q(x))) & \
|
|
308 |
\ (~~(ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) & \
|
|
309 |
\ (~~(EX x.S(x)) --> (ALL x. L(x) --> M(x))) \
|
|
310 |
\ --> (ALL x. P(x) & L(x) --> M(x))";
|
1006
|
311 |
by (Int.fast_tac 1); (*48 secs*)
|
0
|
312 |
result();
|
|
313 |
|
|
314 |
writeln"Problem 29. Essentially the same as Principia Mathematica *11.71";
|
|
315 |
goal IFOL.thy "(EX x. P(x)) & (EX y. Q(y)) \
|
|
316 |
\ --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y)) <-> \
|
|
317 |
\ (ALL x y. P(x) & Q(y) --> R(x) & S(y)))";
|
|
318 |
by (Int.fast_tac 1);
|
|
319 |
result();
|
|
320 |
|
|
321 |
writeln"Problem ~~30";
|
|
322 |
goal IFOL.thy "(ALL x. (P(x) | Q(x)) --> ~ R(x)) & \
|
|
323 |
\ (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x)) \
|
|
324 |
\ --> (ALL x. ~~S(x))";
|
|
325 |
by (Int.fast_tac 1);
|
|
326 |
result();
|
|
327 |
|
|
328 |
writeln"Problem 31";
|
|
329 |
goal IFOL.thy "~(EX x.P(x) & (Q(x) | R(x))) & \
|
|
330 |
\ (EX x. L(x) & P(x)) & \
|
|
331 |
\ (ALL x. ~ R(x) --> M(x)) \
|
|
332 |
\ --> (EX x. L(x) & M(x))";
|
|
333 |
by (Int.fast_tac 1);
|
|
334 |
result();
|
|
335 |
|
|
336 |
writeln"Problem 32";
|
|
337 |
goal IFOL.thy "(ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \
|
|
338 |
\ (ALL x. S(x) & R(x) --> L(x)) & \
|
|
339 |
\ (ALL x. M(x) --> R(x)) \
|
|
340 |
\ --> (ALL x. P(x) & M(x) --> L(x))";
|
|
341 |
by (Int.best_tac 1);
|
|
342 |
result();
|
|
343 |
|
|
344 |
writeln"Problem ~~33";
|
|
345 |
goal IFOL.thy "(ALL x. ~~(P(a) & (P(x)-->P(b))-->P(c))) <-> \
|
|
346 |
\ (ALL x. ~~((~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c))))";
|
|
347 |
by (Int.best_tac 1);
|
|
348 |
result();
|
|
349 |
|
|
350 |
|
|
351 |
writeln"Problem 36";
|
|
352 |
goal IFOL.thy
|
|
353 |
"(ALL x. EX y. J(x,y)) & \
|
|
354 |
\ (ALL x. EX y. G(x,y)) & \
|
|
355 |
\ (ALL x y. J(x,y) | G(x,y) --> (ALL z. J(y,z) | G(y,z) --> H(x,z))) \
|
|
356 |
\ --> (ALL x. EX y. H(x,y))";
|
|
357 |
by (Int.fast_tac 1); (*35 secs*)
|
|
358 |
result();
|
|
359 |
|
|
360 |
writeln"Problem 37";
|
|
361 |
goal IFOL.thy
|
|
362 |
"(ALL z. EX w. ALL x. EX y. \
|
|
363 |
\ ~~(P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u.Q(u,w)))) & \
|
|
364 |
\ (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) & \
|
|
365 |
\ (~~(EX x y. Q(x,y)) --> (ALL x. R(x,x))) \
|
|
366 |
\ --> ~~(ALL x. EX y. R(x,y))";
|
|
367 |
(*NOT PROVED*)
|
|
368 |
|
|
369 |
writeln"Problem 39";
|
|
370 |
goal IFOL.thy "~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";
|
|
371 |
by (Int.fast_tac 1);
|
|
372 |
result();
|
|
373 |
|
|
374 |
writeln"Problem 40. AMENDED";
|
|
375 |
goal IFOL.thy "(EX y. ALL x. F(x,y) <-> F(x,x)) --> \
|
|
376 |
\ ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))";
|
|
377 |
by (Int.fast_tac 1);
|
|
378 |
result();
|
|
379 |
|
|
380 |
writeln"Problem 44";
|
1459
|
381 |
goal IFOL.thy "(ALL x. f(x) --> \
|
|
382 |
\ (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y)))) & \
|
|
383 |
\ (EX x. j(x) & (ALL y. g(y) --> h(x,y))) \
|
0
|
384 |
\ --> (EX x. j(x) & ~f(x))";
|
|
385 |
by (Int.fast_tac 1);
|
|
386 |
result();
|
|
387 |
|
|
388 |
writeln"Problem 48";
|
|
389 |
goal IFOL.thy "(a=b | c=d) & (a=c | b=d) --> a=d | b=c";
|
|
390 |
by (Int.fast_tac 1);
|
|
391 |
result();
|
|
392 |
|
|
393 |
writeln"Problem 51";
|
|
394 |
goal IFOL.thy
|
|
395 |
"(EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> \
|
|
396 |
\ (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)";
|
1006
|
397 |
by (Int.best_tac 1); (*34 seconds*)
|
0
|
398 |
result();
|
|
399 |
|
|
400 |
writeln"Problem 52";
|
|
401 |
(*Almost the same as 51. *)
|
|
402 |
goal IFOL.thy
|
|
403 |
"(EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> \
|
|
404 |
\ (EX w. ALL y. EX z. (ALL x. P(x,y) <-> x=z) <-> y=w)";
|
1006
|
405 |
by (Int.best_tac 1); (*34 seconds*)
|
0
|
406 |
result();
|
|
407 |
|
|
408 |
writeln"Problem 56";
|
|
409 |
goal IFOL.thy
|
|
410 |
"(ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))";
|
|
411 |
by (Int.fast_tac 1);
|
|
412 |
result();
|
|
413 |
|
|
414 |
writeln"Problem 57";
|
|
415 |
goal IFOL.thy
|
|
416 |
"P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \
|
|
417 |
\ (ALL x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))";
|
|
418 |
by (Int.fast_tac 1);
|
|
419 |
result();
|
|
420 |
|
|
421 |
writeln"Problem 60";
|
|
422 |
goal IFOL.thy
|
|
423 |
"ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))";
|
|
424 |
by (Int.fast_tac 1);
|
|
425 |
result();
|
|
426 |
|
|
427 |
writeln"Reached end of file.";
|