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