src/LK/ex/hardquant.ML
author clasohm
Thu Sep 16 12:20:38 1993 +0200 (1993-09-16)
changeset 0 a5a9c433f639
child 650 ab49d4f96a09
permissions -rw-r--r--
Initial revision
clasohm@0
     1
(*  Title: 	LK/ex/hard-quant
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1992  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Hard examples with quantifiers.  Can be read to test the LK system.
clasohm@0
     7
From  F. J. Pelletier,
clasohm@0
     8
  Seventy-Five Problems for Testing Automatic Theorem Provers,
clasohm@0
     9
  J. Automated Reasoning 2 (1986), 191-216.
clasohm@0
    10
  Errata, JAR 4 (1988), 236-236.
clasohm@0
    11
clasohm@0
    12
Uses pc_tac rather than fast_tac when the former is significantly faster.
clasohm@0
    13
*)
clasohm@0
    14
clasohm@0
    15
writeln"File LK/ex/hard-quant.";
clasohm@0
    16
clasohm@0
    17
goal LK.thy "|- (ALL x. P(x) & Q(x)) <-> (ALL x. P(x))  &  (ALL x. Q(x))";
clasohm@0
    18
by (fast_tac LK_pack 1);
clasohm@0
    19
result(); 
clasohm@0
    20
clasohm@0
    21
goal LK.thy "|- (EX x. P-->Q(x))  <->  (P --> (EX x.Q(x)))";
clasohm@0
    22
by (fast_tac LK_pack 1);
clasohm@0
    23
result(); 
clasohm@0
    24
clasohm@0
    25
goal LK.thy "|- (EX x.P(x)-->Q)  <->  (ALL x.P(x)) --> Q";
clasohm@0
    26
by (fast_tac LK_pack 1);
clasohm@0
    27
result(); 
clasohm@0
    28
clasohm@0
    29
goal LK.thy "|- (ALL x.P(x)) | Q  <->  (ALL x. P(x) | Q)";
clasohm@0
    30
by (fast_tac LK_pack 1);
clasohm@0
    31
result(); 
clasohm@0
    32
clasohm@0
    33
writeln"Problems requiring quantifier duplication";
clasohm@0
    34
clasohm@0
    35
(*Not provable by fast_tac LK_pack: needs multiple instantiation of ALL*)
clasohm@0
    36
goal LK.thy "|- (ALL x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))";
clasohm@0
    37
by (best_tac LK_dup_pack 1);
clasohm@0
    38
result();
clasohm@0
    39
clasohm@0
    40
(*Needs double instantiation of the quantifier*)
clasohm@0
    41
goal LK.thy "|- EX x. P(x) --> P(a) & P(b)";
clasohm@0
    42
by (fast_tac LK_dup_pack 1);
clasohm@0
    43
result();
clasohm@0
    44
clasohm@0
    45
goal LK.thy "|- EX z. P(z) --> (ALL x. P(x))";
clasohm@0
    46
by (best_tac LK_dup_pack 1);
clasohm@0
    47
result();
clasohm@0
    48
clasohm@0
    49
writeln"Hard examples with quantifiers";
clasohm@0
    50
clasohm@0
    51
writeln"Problem 18";
clasohm@0
    52
goal LK.thy "|- EX y. ALL x. P(y)-->P(x)";
clasohm@0
    53
by (best_tac LK_dup_pack 1);
clasohm@0
    54
result(); 
clasohm@0
    55
clasohm@0
    56
writeln"Problem 19";
clasohm@0
    57
goal LK.thy "|- EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))";
clasohm@0
    58
by (best_tac LK_dup_pack 1);
clasohm@0
    59
result();
clasohm@0
    60
clasohm@0
    61
writeln"Problem 20";
clasohm@0
    62
goal LK.thy "|- (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))     \
clasohm@0
    63
\   --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))";
clasohm@0
    64
by (fast_tac LK_pack 1); 
clasohm@0
    65
result();
clasohm@0
    66
clasohm@0
    67
writeln"Problem 21";
clasohm@0
    68
goal LK.thy "|- (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> (EX x. P<->Q(x))";
clasohm@0
    69
by (best_tac LK_dup_pack 1);
clasohm@0
    70
result();
clasohm@0
    71
clasohm@0
    72
writeln"Problem 22";
clasohm@0
    73
goal LK.thy "|- (ALL x. P <-> Q(x))  -->  (P <-> (ALL x. Q(x)))";
clasohm@0
    74
by (fast_tac LK_pack 1); 
clasohm@0
    75
result();
clasohm@0
    76
clasohm@0
    77
writeln"Problem 23";
clasohm@0
    78
goal LK.thy "|- (ALL x. P | Q(x))  <->  (P | (ALL x. Q(x)))";
clasohm@0
    79
by (best_tac LK_pack 1);  
clasohm@0
    80
result();
clasohm@0
    81
clasohm@0
    82
writeln"Problem 24";
clasohm@0
    83
goal LK.thy "|- ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &  \
clasohm@0
    84
\    ~(EX x.P(x)) --> (EX x.Q(x)) & (ALL x. Q(x)|R(x) --> S(x))  \
clasohm@0
    85
\   --> (EX x. P(x)&R(x))";
clasohm@0
    86
by (pc_tac LK_pack 1);
clasohm@0
    87
result();
clasohm@0
    88
clasohm@0
    89
writeln"Problem 25";
clasohm@0
    90
goal LK.thy "|- (EX x. P(x)) &  \
clasohm@0
    91
\       (ALL x. L(x) --> ~ (M(x) & R(x))) &  \
clasohm@0
    92
\       (ALL x. P(x) --> (M(x) & L(x))) &   \
clasohm@0
    93
\       ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x)))  \
clasohm@0
    94
\   --> (EX x. Q(x)&P(x))";
clasohm@0
    95
by (best_tac LK_pack 1);  
clasohm@0
    96
result();
clasohm@0
    97
clasohm@0
    98
writeln"Problem 26";
clasohm@0
    99
goal LK.thy "|- ((EX x. p(x)) <-> (EX x. q(x))) &	\
clasohm@0
   100
\     (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y)))	\
clasohm@0
   101
\ --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))";
clasohm@0
   102
by (pc_tac LK_pack 1);
clasohm@0
   103
result();
clasohm@0
   104
clasohm@0
   105
writeln"Problem 27";
clasohm@0
   106
goal LK.thy "|- (EX x. P(x) & ~Q(x)) &   \
clasohm@0
   107
\             (ALL x. P(x) --> R(x)) &   \
clasohm@0
   108
\             (ALL x. M(x) & L(x) --> P(x)) &   \
clasohm@0
   109
\             ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x)))  \
clasohm@0
   110
\         --> (ALL x. M(x) --> ~L(x))";
clasohm@0
   111
by (pc_tac LK_pack 1); 
clasohm@0
   112
result();
clasohm@0
   113
clasohm@0
   114
writeln"Problem 28.  AMENDED";
clasohm@0
   115
goal LK.thy "|- (ALL x. P(x) --> (ALL x. Q(x))) &   \
clasohm@0
   116
\       ((ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) &  \
clasohm@0
   117
\       ((EX x.S(x)) --> (ALL x. L(x) --> M(x)))  \
clasohm@0
   118
\   --> (ALL x. P(x) & L(x) --> M(x))";
clasohm@0
   119
by (pc_tac LK_pack 1);  
clasohm@0
   120
result();
clasohm@0
   121
clasohm@0
   122
writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
clasohm@0
   123
goal LK.thy "|- (EX x. P(x)) & (EX y. Q(y))  \
clasohm@0
   124
\   --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y))   <->     \
clasohm@0
   125
\        (ALL x y. P(x) & Q(y) --> R(x) & S(y)))";
clasohm@0
   126
by (pc_tac LK_pack 1); 
clasohm@0
   127
result();
clasohm@0
   128
clasohm@0
   129
writeln"Problem 30";
clasohm@0
   130
goal LK.thy "|- (ALL x. P(x) | Q(x) --> ~ R(x)) & \
clasohm@0
   131
\       (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))  \
clasohm@0
   132
\   --> (ALL x. S(x))";
clasohm@0
   133
by (fast_tac LK_pack 1);  
clasohm@0
   134
result();
clasohm@0
   135
clasohm@0
   136
writeln"Problem 31";
clasohm@0
   137
goal LK.thy "|- ~(EX x.P(x) & (Q(x) | R(x))) & \
clasohm@0
   138
\       (EX x. L(x) & P(x)) & \
clasohm@0
   139
\       (ALL x. ~ R(x) --> M(x))  \
clasohm@0
   140
\   --> (EX x. L(x) & M(x))";
clasohm@0
   141
by (fast_tac LK_pack 1);
clasohm@0
   142
result();
clasohm@0
   143
clasohm@0
   144
writeln"Problem 32";
clasohm@0
   145
goal LK.thy "|- (ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \
clasohm@0
   146
\       (ALL x. S(x) & R(x) --> L(x)) & \
clasohm@0
   147
\       (ALL x. M(x) --> R(x))  \
clasohm@0
   148
\   --> (ALL x. P(x) & M(x) --> L(x))";
clasohm@0
   149
by (best_tac LK_pack 1);
clasohm@0
   150
result();
clasohm@0
   151
clasohm@0
   152
writeln"Problem 33";
clasohm@0
   153
goal LK.thy "|- (ALL x. P(a) & (P(x)-->P(b))-->P(c))  <->    \
clasohm@0
   154
\    (ALL x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))";
clasohm@0
   155
by (fast_tac LK_pack 1);
clasohm@0
   156
result();
clasohm@0
   157
clasohm@0
   158
writeln"Problem 34  AMENDED (TWICE!!)  NOT PROVED AUTOMATICALLY";
clasohm@0
   159
(*Andrews's challenge*)
clasohm@0
   160
goal LK.thy "|- ((EX x. ALL y. p(x) <-> p(y))  <->		\
clasohm@0
   161
\              ((EX x. q(x)) <-> (ALL y. p(y))))     <->	\
clasohm@0
   162
\             ((EX x. ALL y. q(x) <-> q(y))  <->		\
clasohm@0
   163
\              ((EX x. p(x)) <-> (ALL y. q(y))))";
clasohm@0
   164
by (safe_goal_tac LK_pack 1);   (*53 secs*) (*13 secs*)
clasohm@0
   165
by (TRYALL (fast_tac LK_pack));	(*165 secs*)  (*117 secs*)  (*138 secs*)
clasohm@0
   166
(*for some reason, pc_tac leaves 14 subgoals instead of 6*)
clasohm@0
   167
by (TRYALL (best_tac LK_dup_pack)); (*55 secs*) (*29 secs*) (*54 secs*)
clasohm@0
   168
result();
clasohm@0
   169
clasohm@0
   170
clasohm@0
   171
writeln"Problem 35";
clasohm@0
   172
goal LK.thy "|- EX x y. P(x,y) -->  (ALL u v. P(u,v))";
clasohm@0
   173
by (best_tac LK_dup_pack 1);  (*27 secs??*)
clasohm@0
   174
result();
clasohm@0
   175
clasohm@0
   176
writeln"Problem 36";
clasohm@0
   177
goal LK.thy "|- (ALL x. EX y. J(x,y)) & \
clasohm@0
   178
\       (ALL x. EX y. G(x,y)) & \
clasohm@0
   179
\       (ALL x y. J(x,y) | G(x,y) -->	\
clasohm@0
   180
\       (ALL z. J(y,z) | G(y,z) --> H(x,z)))   \
clasohm@0
   181
\   --> (ALL x. EX y. H(x,y))";
clasohm@0
   182
by (fast_tac LK_pack 1);
clasohm@0
   183
result();
clasohm@0
   184
clasohm@0
   185
writeln"Problem 37";
clasohm@0
   186
goal LK.thy "|- (ALL z. EX w. ALL x. EX y. \
clasohm@0
   187
\          (P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u.Q(u,w)))) & \
clasohm@0
   188
\       (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) & \
clasohm@0
   189
\       ((EX x y. Q(x,y)) --> (ALL x. R(x,x)))  \
clasohm@0
   190
\   --> (ALL x. EX y. R(x,y))";
clasohm@0
   191
by (pc_tac LK_pack 1);  (*slow*)
clasohm@0
   192
by flexflex_tac;
clasohm@0
   193
result();
clasohm@0
   194
clasohm@0
   195
writeln"Problem 38. NOT PROVED";
clasohm@0
   196
goal LK.thy
clasohm@0
   197
 "|- (ALL x. p(a) & (p(x) --> (EX y. p(y) & r(x,y))) -->	\
clasohm@0
   198
\            (EX z. EX w. p(z) & r(x,w) & r(w,z)))  <->		\
clasohm@0
   199
\    (ALL x. (~p(a) | p(x) | (EX z. EX w. p(z) & r(x,w) & r(w,z))) &	\
clasohm@0
   200
\            (~p(a) | ~(EX y. p(y) & r(x,y)) |				\
clasohm@0
   201
\             (EX z. EX w. p(z) & r(x,w) & r(w,z))))";
clasohm@0
   202
clasohm@0
   203
writeln"Problem 39";
clasohm@0
   204
goal LK.thy "|- ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";
clasohm@0
   205
by (fast_tac LK_pack 1);
clasohm@0
   206
result();
clasohm@0
   207
clasohm@0
   208
writeln"Problem 40.  AMENDED";
clasohm@0
   209
goal LK.thy "|- (EX y. ALL x. F(x,y) <-> F(x,x)) -->  \
clasohm@0
   210
\                    ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))";
clasohm@0
   211
by (fast_tac LK_pack 1);
clasohm@0
   212
result();
clasohm@0
   213
clasohm@0
   214
writeln"Problem 41";
clasohm@0
   215
goal LK.thy "|- (ALL z. EX y. ALL x. f(x,y) <-> f(x,z) & ~ f(x,x))	\
clasohm@0
   216
\         --> ~ (EX z. ALL x. f(x,z))";
clasohm@0
   217
by (fast_tac LK_pack 1);
clasohm@0
   218
result();
clasohm@0
   219
clasohm@0
   220
writeln"Problem 42";
clasohm@0
   221
goal LK.thy "|- ~ (EX y. ALL x. p(x,y) <-> ~ (EX z. p(x,z) & p(z,x)))";
clasohm@0
   222
clasohm@0
   223
writeln"Problem 43  NOT PROVED AUTOMATICALLY";
clasohm@0
   224
goal LK.thy "|- (ALL x. ALL y. q(x,y) <-> (ALL z. p(z,x) <-> p(z,y))) \
clasohm@0
   225
\         --> (ALL x. (ALL y. q(x,y) <-> q(y,x)))";
clasohm@0
   226
clasohm@0
   227
writeln"Problem 44";
clasohm@0
   228
goal LK.thy "|- (ALL x. f(x) -->					\
clasohm@0
   229
\             (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y))))  &   	\
clasohm@0
   230
\             (EX x. j(x) & (ALL y. g(y) --> h(x,y)))			\
clasohm@0
   231
\             --> (EX x. j(x) & ~f(x))";
clasohm@0
   232
by (fast_tac LK_pack 1);
clasohm@0
   233
result();
clasohm@0
   234
clasohm@0
   235
writeln"Problem 45";
clasohm@0
   236
goal LK.thy "|- (ALL x. f(x) & (ALL y. g(y) & h(x,y) --> j(x,y))	\
clasohm@0
   237
\                     --> (ALL y. g(y) & h(x,y) --> k(y))) &	\
clasohm@0
   238
\     ~ (EX y. l(y) & k(y)) &					\
clasohm@0
   239
\     (EX x. f(x) & (ALL y. h(x,y) --> l(y))			\
clasohm@0
   240
\                  & (ALL y. g(y) & h(x,y) --> j(x,y)))		\
clasohm@0
   241
\     --> (EX x. f(x) & ~ (EX y. g(y) & h(x,y)))";
clasohm@0
   242
by (best_tac LK_pack 1); 
clasohm@0
   243
result();
clasohm@0
   244
clasohm@0
   245
clasohm@0
   246
writeln"Problem 50";  
clasohm@0
   247
goal LK.thy
clasohm@0
   248
    "|- (ALL x. P(a,x) | (ALL y.P(x,y))) --> (EX x. ALL y.P(x,y))";
clasohm@0
   249
by (best_tac LK_dup_pack 1);
clasohm@0
   250
result();
clasohm@0
   251
clasohm@0
   252
writeln"Problem 57";
clasohm@0
   253
goal LK.thy
clasohm@0
   254
    "|- P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \
clasohm@0
   255
\    (ALL x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))";
clasohm@0
   256
by (fast_tac LK_pack 1);
clasohm@0
   257
result();
clasohm@0
   258
clasohm@0
   259
writeln"Problem 59";
clasohm@0
   260
(*Unification works poorly here -- the abstraction %sobj prevents efficient
clasohm@0
   261
  operation of the occurs check*)
clasohm@0
   262
Unify.trace_bound := !Unify.search_bound - 1; 
clasohm@0
   263
goal LK.thy "|- (ALL x. P(x) <-> ~P(f(x))) --> (EX x. P(x) & ~P(f(x)))";
clasohm@0
   264
by (best_tac LK_dup_pack 1);
clasohm@0
   265
result();
clasohm@0
   266
clasohm@0
   267
writeln"Problem 60";
clasohm@0
   268
goal LK.thy
clasohm@0
   269
    "|- ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))";
clasohm@0
   270
by (fast_tac LK_pack 1);
clasohm@0
   271
result();
clasohm@0
   272
clasohm@0
   273
writeln"Reached end of file.";
clasohm@0
   274
clasohm@0
   275
(*18 June 92: loaded in 372 secs*)
clasohm@0
   276
(*19 June 92: loaded in 166 secs except #34, using repeat_goal_tac*)
clasohm@0
   277
(*29 June 92: loaded in 370 secs*)