src/Sequents/LK/hardquant.ML
 author wenzelm Sun Sep 18 15:20:08 2005 +0200 (2005-09-18) changeset 17481 75166ebb619b parent 7119 02d94b69ae04 permissions -rw-r--r--
converted to Isar theory format;
1 (*  Title:      LK/ex/hard-quant
2     ID:         \$Id\$
3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
4     Copyright   1992  University of Cambridge
6 Hard examples with quantifiers.  Can be read to test the LK system.
7 From  F. J. Pelletier,
8   Seventy-Five Problems for Testing Automatic Theorem Provers,
9   J. Automated Reasoning 2 (1986), 191-216.
10   Errata, JAR 4 (1988), 236-236.
12 Uses pc_tac rather than fast_tac when the former is significantly faster.
13 *)
15 context (theory "LK");
17 Goal "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x))  &  (ALL x. Q(x))";
18 by (Fast_tac 1);
19 result();
21 Goal "|- (EX x. P-->Q(x))  <->  (P --> (EX x. Q(x)))";
22 by (Fast_tac 1);
23 result();
25 Goal "|- (EX x. P(x)-->Q)  <->  (ALL x. P(x)) --> Q";
26 by (Fast_tac 1);
27 result();
29 Goal "|- (ALL x. P(x)) | Q  <->  (ALL x. P(x) | Q)";
30 by (Fast_tac 1);
31 result();
33 writeln"Problems requiring quantifier duplication";
35 (*Not provable by Fast_tac: needs multiple instantiation of ALL*)
36 Goal "|- (ALL x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))";
37 by (best_tac LK_dup_pack 1);
38 result();
40 (*Needs double instantiation of the quantifier*)
41 Goal "|- EX x. P(x) --> P(a) & P(b)";
42 by (fast_tac LK_dup_pack 1);
43 result();
45 Goal "|- EX z. P(z) --> (ALL x. P(x))";
46 by (best_tac LK_dup_pack 1);
47 result();
49 writeln"Hard examples with quantifiers";
51 writeln"Problem 18";
52 Goal "|- EX y. ALL x. P(y)-->P(x)";
53 by (best_tac LK_dup_pack 1);
54 result();
56 writeln"Problem 19";
57 Goal "|- EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))";
58 by (best_tac LK_dup_pack 1);
59 result();
61 writeln"Problem 20";
62 Goal "|- (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))     \
63 \   --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))";
64 by (Fast_tac 1);
65 result();
67 writeln"Problem 21";
68 Goal "|- (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> (EX x. P<->Q(x))";
69 by (best_tac LK_dup_pack 1);
70 result();
72 writeln"Problem 22";
73 Goal "|- (ALL x. P <-> Q(x))  -->  (P <-> (ALL x. Q(x)))";
74 by (Fast_tac 1);
75 result();
77 writeln"Problem 23";
78 Goal "|- (ALL x. P | Q(x))  <->  (P | (ALL x. Q(x)))";
79 by (best_tac LK_pack 1);
80 result();
82 writeln"Problem 24";
83 Goal "|- ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &  \
84 \    ~(EX x. P(x)) --> (EX x. Q(x)) & (ALL x. Q(x)|R(x) --> S(x))  \
85 \   --> (EX x. P(x)&R(x))";
86 by (pc_tac LK_pack 1);
87 result();
89 writeln"Problem 25";
90 Goal "|- (EX x. P(x)) &  \
91 \       (ALL x. L(x) --> ~ (M(x) & R(x))) &  \
92 \       (ALL x. P(x) --> (M(x) & L(x))) &   \
93 \       ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x)))  \
94 \   --> (EX x. Q(x)&P(x))";
95 by (best_tac LK_pack 1);
96 result();
98 writeln"Problem 26";
99 Goal "|- ((EX x. p(x)) <-> (EX x. q(x))) &       \
100 \     (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y)))   \
101 \ --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))";
102 by (pc_tac LK_pack 1);
103 result();
105 writeln"Problem 27";
106 Goal "|- (EX x. P(x) & ~Q(x)) &   \
107 \             (ALL x. P(x) --> R(x)) &   \
108 \             (ALL x. M(x) & L(x) --> P(x)) &   \
109 \             ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x)))  \
110 \         --> (ALL x. M(x) --> ~L(x))";
111 by (pc_tac LK_pack 1);
112 result();
114 writeln"Problem 28.  AMENDED";
115 Goal "|- (ALL x. P(x) --> (ALL x. Q(x))) &   \
116 \       ((ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) &  \
117 \       ((EX x. S(x)) --> (ALL x. L(x) --> M(x)))  \
118 \   --> (ALL x. P(x) & L(x) --> M(x))";
119 by (pc_tac LK_pack 1);
120 result();
122 writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
123 Goal "|- (EX x. P(x)) & (EX y. Q(y))  \
124 \   --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y))   <->     \
125 \        (ALL x y. P(x) & Q(y) --> R(x) & S(y)))";
126 by (pc_tac LK_pack 1);
127 result();
129 writeln"Problem 30";
130 Goal "|- (ALL x. P(x) | Q(x) --> ~ R(x)) & \
131 \       (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))  \
132 \   --> (ALL x. S(x))";
133 by (Fast_tac 1);
134 result();
136 writeln"Problem 31";
137 Goal "|- ~(EX x. P(x) & (Q(x) | R(x))) & \
138 \       (EX x. L(x) & P(x)) & \
139 \       (ALL x. ~ R(x) --> M(x))  \
140 \   --> (EX x. L(x) & M(x))";
141 by (Fast_tac 1);
142 result();
144 writeln"Problem 32";
145 Goal "|- (ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \
146 \       (ALL x. S(x) & R(x) --> L(x)) & \
147 \       (ALL x. M(x) --> R(x))  \
148 \   --> (ALL x. P(x) & M(x) --> L(x))";
149 by (best_tac LK_pack 1);
150 result();
152 writeln"Problem 33";
153 Goal "|- (ALL x. P(a) & (P(x)-->P(b))-->P(c))  <->    \
154 \    (ALL x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))";
155 by (Fast_tac 1);
156 result();
158 writeln"Problem 34  AMENDED (TWICE!!)";
159 (*Andrews's challenge*)
160 Goal "|- ((EX x. ALL y. p(x) <-> p(y))  <->              \
161 \              ((EX x. q(x)) <-> (ALL y. p(y))))     <->        \
162 \             ((EX x. ALL y. q(x) <-> q(y))  <->                \
163 \              ((EX x. p(x)) <-> (ALL y. q(y))))";
164 by (best_tac LK_dup_pack 1); (*10 secs!*)
165 result();
168 writeln"Problem 35";
169 Goal "|- EX x y. P(x,y) -->  (ALL u v. P(u,v))";
170 by (best_tac LK_dup_pack 1);
171 result();
173 writeln"Problem 36";
174 Goal "|- (ALL x. EX y. J(x,y)) & \
175 \        (ALL x. EX y. G(x,y)) & \
176 \        (ALL x y. J(x,y) | G(x,y) -->   \
177 \        (ALL z. J(y,z) | G(y,z) --> H(x,z)))   \
178 \        --> (ALL x. EX y. H(x,y))";
179 by (Fast_tac 1);
180 result();
182 writeln"Problem 37";
183 Goal "|- (ALL z. EX w. ALL x. EX y. \
184 \          (P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u. Q(u,w)))) & \
185 \       (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) & \
186 \       ((EX x y. Q(x,y)) --> (ALL x. R(x,x)))  \
187 \   --> (ALL x. EX y. R(x,y))";
188 by (pc_tac LK_pack 1);
189 result();
191 writeln"Problem 38";
192 Goal "|- (ALL x. p(a) & (p(x) --> (EX y. p(y) & r(x,y))) -->        \
193 \                (EX z. EX w. p(z) & r(x,w) & r(w,z)))  <->         \
194 \        (ALL x. (~p(a) | p(x) | (EX z. EX w. p(z) & r(x,w) & r(w,z))) &    \
195 \                (~p(a) | ~(EX y. p(y) & r(x,y)) |                          \
196 \                (EX z. EX w. p(z) & r(x,w) & r(w,z))))";
197 by (pc_tac LK_pack 1);
198 result();
200 writeln"Problem 39";
201 Goal "|- ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";
202 by (Fast_tac 1);
203 result();
205 writeln"Problem 40.  AMENDED";
206 Goal "|- (EX y. ALL x. F(x,y) <-> F(x,x)) -->  \
207 \        ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))";
208 by (Fast_tac 1);
209 result();
211 writeln"Problem 41";
212 Goal "|- (ALL z. EX y. ALL x. f(x,y) <-> f(x,z) & ~ f(x,x))      \
213 \        --> ~ (EX z. ALL x. f(x,z))";
214 by (Fast_tac 1);
215 result();
217 writeln"Problem 42";
218 Goal "|- ~ (EX y. ALL x. p(x,y) <-> ~ (EX z. p(x,z) & p(z,x)))";
220 writeln"Problem 43  NOT PROVED AUTOMATICALLY";
221 Goal "|- (ALL x. ALL y. q(x,y) <-> (ALL z. p(z,x) <-> p(z,y))) \
222 \         --> (ALL x. (ALL y. q(x,y) <-> q(y,x)))";
224 writeln"Problem 44";
225 Goal "|- (ALL x. f(x) -->                                        \
226 \                (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y))))  &       \
227 \        (EX x. j(x) & (ALL y. g(y) --> h(x,y)))                   \
228 \        --> (EX x. j(x) & ~f(x))";
229 by (Fast_tac 1);
230 result();
232 writeln"Problem 45";
233 Goal "|- (ALL x. f(x) & (ALL y. g(y) & h(x,y) --> j(x,y))        \
234 \                     --> (ALL y. g(y) & h(x,y) --> k(y))) &    \
235 \     ~ (EX y. l(y) & k(y)) &                                   \
236 \     (EX x. f(x) & (ALL y. h(x,y) --> l(y))                    \
237 \                  & (ALL y. g(y) & h(x,y) --> j(x,y)))         \
238 \     --> (EX x. f(x) & ~ (EX y. g(y) & h(x,y)))";
239 by (best_tac LK_pack 1);
240 result();
243 writeln"Problems (mainly) involving equality or functions";
245 writeln"Problem 48";
246 Goal "|- (a=b | c=d) & (a=c | b=d) --> a=d | b=c";
247 by (fast_tac (pack() add_safes [subst]) 1);
248 result();
250 writeln"Problem 50";
251 Goal "|- (ALL x. P(a,x) | (ALL y. P(x,y))) --> (EX x. ALL y. P(x,y))";
252 by (best_tac LK_dup_pack 1);
253 result();
255 writeln"Problem 51";
256 Goal "|- (EX z w. ALL x y. P(x,y) <->  (x=z & y=w)) -->  \
257 \        (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)";
258 by (fast_tac (pack() add_safes [subst]) 1);
259 result();
261 writeln"Problem 52";
262 (*Almost the same as 51. *)
263 Goal "|- (EX z w. ALL x y. P(x,y) <->  (x=z & y=w)) -->  \
264 \        (EX w. ALL y. EX z. (ALL x. P(x,y) <-> x=z) <-> y=w)";
265 by (fast_tac (pack() add_safes [subst]) 1);
266 result();
268 writeln"Problem 56";
269 Goal "|- (ALL x.(EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))";
270 by (best_tac (pack() add_unsafes [symL, subst]) 1);
271 (*requires tricker to orient the equality properly*)
272 result();
274 writeln"Problem 57";
275 Goal "|- P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \
276 \        (ALL x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))";
277 by (Fast_tac 1);
278 result();
280 writeln"Problem 58!";
281 Goal "|- (ALL x y. f(x)=g(y)) --> (ALL x y. f(f(x))=f(g(y)))";
282 by (fast_tac (pack() add_safes [subst]) 1);
283 result();
285 writeln"Problem 59";
286 (*Unification works poorly here -- the abstraction %sobj prevents efficient
287   operation of the occurs check*)
288 Unify.trace_bound := !Unify.search_bound - 1;
289 Goal "|- (ALL x. P(x) <-> ~P(f(x))) --> (EX x. P(x) & ~P(f(x)))";
290 by (best_tac LK_dup_pack 1);
291 result();
293 writeln"Problem 60";
294 Goal "|- ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))";
295 by (Fast_tac 1);
296 result();
298 writeln"Problem 62 as corrected in JAR 18 (1997), page 135";
299 Goal "|- (ALL x. p(a) & (p(x) --> p(f(x))) --> p(f(f(x))))  <->     \
300 \     (ALL x. (~p(a) | p(x) | p(f(f(x)))) &                      \
301 \             (~p(a) | ~p(f(x)) | p(f(f(x)))))";
302 by (Fast_tac 1);
303 result();
305 (*18 June 92: loaded in 372 secs*)
306 (*19 June 92: loaded in 166 secs except #34, using repeat_goal_tac*)
307 (*29 June 92: loaded in 370 secs*)
308 (*18 September 2005: loaded in 1.809 secs*)