26322
|
1 |
(* Title: FOLP/ex/Classical.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1993 University of Cambridge
|
|
5 |
|
|
6 |
Classical First-Order Logic.
|
|
7 |
*)
|
|
8 |
|
|
9 |
theory Classical
|
|
10 |
imports FOLP
|
|
11 |
begin
|
|
12 |
|
|
13 |
lemma "?p : (P --> Q | R) --> (P-->Q) | (P-->R)"
|
|
14 |
by (tactic "fast_tac FOLP_cs 1")
|
|
15 |
|
|
16 |
(*If and only if*)
|
|
17 |
lemma "?p : (P<->Q) <-> (Q<->P)"
|
|
18 |
by (tactic "fast_tac FOLP_cs 1")
|
|
19 |
|
|
20 |
lemma "?p : ~ (P <-> ~P)"
|
|
21 |
by (tactic "fast_tac FOLP_cs 1")
|
|
22 |
|
|
23 |
|
|
24 |
(*Sample problems from
|
|
25 |
F. J. Pelletier,
|
|
26 |
Seventy-Five Problems for Testing Automatic Theorem Provers,
|
|
27 |
J. Automated Reasoning 2 (1986), 191-216.
|
|
28 |
Errata, JAR 4 (1988), 236-236.
|
|
29 |
|
|
30 |
The hardest problems -- judging by experience with several theorem provers,
|
|
31 |
including matrix ones -- are 34 and 43.
|
|
32 |
*)
|
|
33 |
|
|
34 |
text "Pelletier's examples"
|
|
35 |
(*1*)
|
|
36 |
lemma "?p : (P-->Q) <-> (~Q --> ~P)"
|
|
37 |
by (tactic "fast_tac FOLP_cs 1")
|
|
38 |
|
|
39 |
(*2*)
|
|
40 |
lemma "?p : ~ ~ P <-> P"
|
|
41 |
by (tactic "fast_tac FOLP_cs 1")
|
|
42 |
|
|
43 |
(*3*)
|
|
44 |
lemma "?p : ~(P-->Q) --> (Q-->P)"
|
|
45 |
by (tactic "fast_tac FOLP_cs 1")
|
|
46 |
|
|
47 |
(*4*)
|
|
48 |
lemma "?p : (~P-->Q) <-> (~Q --> P)"
|
|
49 |
by (tactic "fast_tac FOLP_cs 1")
|
|
50 |
|
|
51 |
(*5*)
|
|
52 |
lemma "?p : ((P|Q)-->(P|R)) --> (P|(Q-->R))"
|
|
53 |
by (tactic "fast_tac FOLP_cs 1")
|
|
54 |
|
|
55 |
(*6*)
|
|
56 |
lemma "?p : P | ~ P"
|
|
57 |
by (tactic "fast_tac FOLP_cs 1")
|
|
58 |
|
|
59 |
(*7*)
|
|
60 |
lemma "?p : P | ~ ~ ~ P"
|
|
61 |
by (tactic "fast_tac FOLP_cs 1")
|
|
62 |
|
|
63 |
(*8. Peirce's law*)
|
|
64 |
lemma "?p : ((P-->Q) --> P) --> P"
|
|
65 |
by (tactic "fast_tac FOLP_cs 1")
|
|
66 |
|
|
67 |
(*9*)
|
|
68 |
lemma "?p : ((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"
|
|
69 |
by (tactic "fast_tac FOLP_cs 1")
|
|
70 |
|
|
71 |
(*10*)
|
|
72 |
lemma "?p : (Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P<->Q)"
|
|
73 |
by (tactic "fast_tac FOLP_cs 1")
|
|
74 |
|
|
75 |
(*11. Proved in each direction (incorrectly, says Pelletier!!) *)
|
|
76 |
lemma "?p : P<->P"
|
|
77 |
by (tactic "fast_tac FOLP_cs 1")
|
|
78 |
|
|
79 |
(*12. "Dijkstra's law"*)
|
|
80 |
lemma "?p : ((P <-> Q) <-> R) <-> (P <-> (Q <-> R))"
|
|
81 |
by (tactic "fast_tac FOLP_cs 1")
|
|
82 |
|
|
83 |
(*13. Distributive law*)
|
|
84 |
lemma "?p : P | (Q & R) <-> (P | Q) & (P | R)"
|
|
85 |
by (tactic "fast_tac FOLP_cs 1")
|
|
86 |
|
|
87 |
(*14*)
|
|
88 |
lemma "?p : (P <-> Q) <-> ((Q | ~P) & (~Q|P))"
|
|
89 |
by (tactic "fast_tac FOLP_cs 1")
|
|
90 |
|
|
91 |
(*15*)
|
|
92 |
lemma "?p : (P --> Q) <-> (~P | Q)"
|
|
93 |
by (tactic "fast_tac FOLP_cs 1")
|
|
94 |
|
|
95 |
(*16*)
|
|
96 |
lemma "?p : (P-->Q) | (Q-->P)"
|
|
97 |
by (tactic "fast_tac FOLP_cs 1")
|
|
98 |
|
|
99 |
(*17*)
|
|
100 |
lemma "?p : ((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S))"
|
|
101 |
by (tactic "fast_tac FOLP_cs 1")
|
|
102 |
|
|
103 |
|
|
104 |
text "Classical Logic: examples with quantifiers"
|
|
105 |
|
|
106 |
lemma "?p : (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))"
|
|
107 |
by (tactic "fast_tac FOLP_cs 1")
|
|
108 |
|
|
109 |
lemma "?p : (EX x. P-->Q(x)) <-> (P --> (EX x. Q(x)))"
|
|
110 |
by (tactic "fast_tac FOLP_cs 1")
|
|
111 |
|
|
112 |
lemma "?p : (EX x. P(x)-->Q) <-> (ALL x. P(x)) --> Q"
|
|
113 |
by (tactic "fast_tac FOLP_cs 1")
|
|
114 |
|
|
115 |
lemma "?p : (ALL x. P(x)) | Q <-> (ALL x. P(x) | Q)"
|
|
116 |
by (tactic "fast_tac FOLP_cs 1")
|
|
117 |
|
|
118 |
|
|
119 |
text "Problems requiring quantifier duplication"
|
|
120 |
|
|
121 |
(*Needs multiple instantiation of ALL.*)
|
|
122 |
lemma "?p : (ALL x. P(x)-->P(f(x))) & P(d)-->P(f(f(f(d))))"
|
|
123 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
124 |
|
|
125 |
(*Needs double instantiation of the quantifier*)
|
|
126 |
lemma "?p : EX x. P(x) --> P(a) & P(b)"
|
|
127 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
128 |
|
|
129 |
lemma "?p : EX z. P(z) --> (ALL x. P(x))"
|
|
130 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
131 |
|
|
132 |
|
|
133 |
text "Hard examples with quantifiers"
|
|
134 |
|
|
135 |
text "Problem 18"
|
|
136 |
lemma "?p : EX y. ALL x. P(y)-->P(x)"
|
|
137 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
138 |
|
|
139 |
text "Problem 19"
|
|
140 |
lemma "?p : EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))"
|
|
141 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
142 |
|
|
143 |
text "Problem 20"
|
|
144 |
lemma "?p : (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))
|
|
145 |
--> (EX x y. P(x) & Q(y)) --> (EX z. R(z))"
|
|
146 |
by (tactic "fast_tac FOLP_cs 1")
|
|
147 |
|
|
148 |
text "Problem 21"
|
|
149 |
lemma "?p : (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> (EX x. P<->Q(x))";
|
|
150 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
151 |
|
|
152 |
text "Problem 22"
|
|
153 |
lemma "?p : (ALL x. P <-> Q(x)) --> (P <-> (ALL x. Q(x)))"
|
|
154 |
by (tactic "fast_tac FOLP_cs 1")
|
|
155 |
|
|
156 |
text "Problem 23"
|
|
157 |
lemma "?p : (ALL x. P | Q(x)) <-> (P | (ALL x. Q(x)))"
|
|
158 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
159 |
|
|
160 |
text "Problem 24"
|
|
161 |
lemma "?p : ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &
|
|
162 |
(~(EX x. P(x)) --> (EX x. Q(x))) & (ALL x. Q(x)|R(x) --> S(x))
|
|
163 |
--> (EX x. P(x)&R(x))"
|
|
164 |
by (tactic "fast_tac FOLP_cs 1")
|
|
165 |
|
|
166 |
text "Problem 25"
|
|
167 |
lemma "?p : (EX x. P(x)) &
|
|
168 |
(ALL x. L(x) --> ~ (M(x) & R(x))) &
|
|
169 |
(ALL x. P(x) --> (M(x) & L(x))) &
|
|
170 |
((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x)))
|
|
171 |
--> (EX x. Q(x)&P(x))"
|
|
172 |
oops
|
|
173 |
|
|
174 |
text "Problem 26"
|
|
175 |
lemma "?u : ((EX x. p(x)) <-> (EX x. q(x))) &
|
|
176 |
(ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y)))
|
|
177 |
--> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))";
|
|
178 |
by (tactic "fast_tac FOLP_cs 1")
|
|
179 |
|
|
180 |
text "Problem 27"
|
|
181 |
lemma "?p : (EX x. P(x) & ~Q(x)) &
|
|
182 |
(ALL x. P(x) --> R(x)) &
|
|
183 |
(ALL x. M(x) & L(x) --> P(x)) &
|
|
184 |
((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x)))
|
|
185 |
--> (ALL x. M(x) --> ~L(x))"
|
|
186 |
by (tactic "fast_tac FOLP_cs 1")
|
|
187 |
|
|
188 |
text "Problem 28. AMENDED"
|
|
189 |
lemma "?p : (ALL x. P(x) --> (ALL x. Q(x))) &
|
|
190 |
((ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) &
|
|
191 |
((EX x. S(x)) --> (ALL x. L(x) --> M(x)))
|
|
192 |
--> (ALL x. P(x) & L(x) --> M(x))"
|
|
193 |
by (tactic "fast_tac FOLP_cs 1")
|
|
194 |
|
|
195 |
text "Problem 29. Essentially the same as Principia Mathematica *11.71"
|
|
196 |
lemma "?p : (EX x. P(x)) & (EX y. Q(y))
|
|
197 |
--> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y)) <->
|
|
198 |
(ALL x y. P(x) & Q(y) --> R(x) & S(y)))"
|
|
199 |
by (tactic "fast_tac FOLP_cs 1")
|
|
200 |
|
|
201 |
text "Problem 30"
|
|
202 |
lemma "?p : (ALL x. P(x) | Q(x) --> ~ R(x)) &
|
|
203 |
(ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))
|
|
204 |
--> (ALL x. S(x))"
|
|
205 |
by (tactic "fast_tac FOLP_cs 1")
|
|
206 |
|
|
207 |
text "Problem 31"
|
|
208 |
lemma "?p : ~(EX x. P(x) & (Q(x) | R(x))) &
|
|
209 |
(EX x. L(x) & P(x)) &
|
|
210 |
(ALL x. ~ R(x) --> M(x))
|
|
211 |
--> (EX x. L(x) & M(x))"
|
|
212 |
by (tactic "fast_tac FOLP_cs 1")
|
|
213 |
|
|
214 |
text "Problem 32"
|
|
215 |
lemma "?p : (ALL x. P(x) & (Q(x)|R(x))-->S(x)) &
|
|
216 |
(ALL x. S(x) & R(x) --> L(x)) &
|
|
217 |
(ALL x. M(x) --> R(x))
|
|
218 |
--> (ALL x. P(x) & M(x) --> L(x))"
|
|
219 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
220 |
|
|
221 |
text "Problem 33"
|
|
222 |
lemma "?p : (ALL x. P(a) & (P(x)-->P(b))-->P(c)) <->
|
|
223 |
(ALL x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))"
|
|
224 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
225 |
|
|
226 |
text "Problem 35"
|
|
227 |
lemma "?p : EX x y. P(x,y) --> (ALL u v. P(u,v))"
|
|
228 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
229 |
|
|
230 |
text "Problem 36"
|
|
231 |
lemma
|
|
232 |
"?p : (ALL x. EX y. J(x,y)) &
|
|
233 |
(ALL x. EX y. G(x,y)) &
|
|
234 |
(ALL x y. J(x,y) | G(x,y) --> (ALL z. J(y,z) | G(y,z) --> H(x,z)))
|
|
235 |
--> (ALL x. EX y. H(x,y))"
|
|
236 |
by (tactic "fast_tac FOLP_cs 1")
|
|
237 |
|
|
238 |
text "Problem 37"
|
|
239 |
lemma "?p : (ALL z. EX w. ALL x. EX y.
|
|
240 |
(P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u. Q(u,w)))) &
|
|
241 |
(ALL x z. ~P(x,z) --> (EX y. Q(y,z))) &
|
|
242 |
((EX x y. Q(x,y)) --> (ALL x. R(x,x)))
|
|
243 |
--> (ALL x. EX y. R(x,y))"
|
|
244 |
by (tactic "fast_tac FOLP_cs 1")
|
|
245 |
|
|
246 |
text "Problem 39"
|
|
247 |
lemma "?p : ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))"
|
|
248 |
by (tactic "fast_tac FOLP_cs 1")
|
|
249 |
|
|
250 |
text "Problem 40. AMENDED"
|
|
251 |
lemma "?p : (EX y. ALL x. F(x,y) <-> F(x,x)) -->
|
|
252 |
~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))"
|
|
253 |
by (tactic "fast_tac FOLP_cs 1")
|
|
254 |
|
|
255 |
text "Problem 41"
|
|
256 |
lemma "?p : (ALL z. EX y. ALL x. f(x,y) <-> f(x,z) & ~ f(x,x))
|
|
257 |
--> ~ (EX z. ALL x. f(x,z))"
|
|
258 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
259 |
|
|
260 |
text "Problem 44"
|
|
261 |
lemma "?p : (ALL x. f(x) -->
|
|
262 |
(EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y)))) &
|
|
263 |
(EX x. j(x) & (ALL y. g(y) --> h(x,y)))
|
|
264 |
--> (EX x. j(x) & ~f(x))"
|
|
265 |
by (tactic "fast_tac FOLP_cs 1")
|
|
266 |
|
|
267 |
text "Problems (mainly) involving equality or functions"
|
|
268 |
|
|
269 |
text "Problem 48"
|
|
270 |
lemma "?p : (a=b | c=d) & (a=c | b=d) --> a=d | b=c"
|
|
271 |
by (tactic "fast_tac FOLP_cs 1")
|
|
272 |
|
|
273 |
text "Problem 50"
|
|
274 |
(*What has this to do with equality?*)
|
|
275 |
lemma "?p : (ALL x. P(a,x) | (ALL y. P(x,y))) --> (EX x. ALL y. P(x,y))"
|
|
276 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
277 |
|
|
278 |
text "Problem 56"
|
|
279 |
lemma
|
|
280 |
"?p : (ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))"
|
|
281 |
by (tactic "fast_tac FOLP_cs 1")
|
|
282 |
|
|
283 |
text "Problem 57"
|
|
284 |
lemma
|
|
285 |
"?p : P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) &
|
|
286 |
(ALL x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))"
|
|
287 |
by (tactic "fast_tac FOLP_cs 1")
|
|
288 |
|
|
289 |
text "Problem 58 NOT PROVED AUTOMATICALLY"
|
|
290 |
lemma
|
|
291 |
notes f_cong = subst_context [where t = f]
|
|
292 |
shows "?p : (ALL x y. f(x)=g(y)) --> (ALL x y. f(f(x))=f(g(y)))"
|
|
293 |
by (tactic {* fast_tac (FOLP_cs addSIs [@{thm f_cong}]) 1 *})
|
|
294 |
|
|
295 |
text "Problem 59"
|
|
296 |
lemma "?p : (ALL x. P(x) <-> ~P(f(x))) --> (EX x. P(x) & ~P(f(x)))"
|
|
297 |
by (tactic "best_tac FOLP_dup_cs 1")
|
|
298 |
|
|
299 |
text "Problem 60"
|
|
300 |
lemma "?p : ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"
|
|
301 |
by (tactic "fast_tac FOLP_cs 1")
|
|
302 |
|
|
303 |
end
|