src/FOL/ex/cla.ML
author paulson
Fri, 14 Feb 1997 10:36:33 +0100
changeset 2614 0b1364481214
parent 2601 b301958c465d
child 2715 79c35a051196
permissions -rw-r--r--
Added a new challenge problem
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1462
d991b56cc52a fixed typo
clasohm
parents: 1459
diff changeset
     1
(*  Title:      FOL/ex/cla.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
     4
    Copyright   1994  University of Cambridge
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Classical First-Order Logic
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
1462
d991b56cc52a fixed typo
clasohm
parents: 1459
diff changeset
     9
writeln"File FOL/ex/cla.ML";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
2601
b301958c465d Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
paulson
parents: 2574
diff changeset
    11
open Cla;    (*in case structure IntPr is open!*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
goal FOL.thy "(P --> Q | R) --> (P-->Q) | (P-->R)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    14
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
(*If and only if*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
goal FOL.thy "(P<->Q) <-> (Q<->P)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    20
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
goal FOL.thy "~ (P <-> ~P)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    24
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
(*Sample problems from 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
  F. J. Pelletier, 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
  Seventy-Five Problems for Testing Automatic Theorem Provers,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
  J. Automated Reasoning 2 (1986), 191-216.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  Errata, JAR 4 (1988), 236-236.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
The hardest problems -- judging by experience with several theorem provers,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
including matrix ones -- are 34 and 43.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
writeln"Pelletier's examples";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
(*1*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
goal FOL.thy "(P-->Q)  <->  (~Q --> ~P)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    41
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
(*2*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
goal FOL.thy "~ ~ P  <->  P";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    46
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
(*3*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
goal FOL.thy "~(P-->Q) --> (Q-->P)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    51
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
(*4*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
goal FOL.thy "(~P-->Q)  <->  (~Q --> P)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    56
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
(*5*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
goal FOL.thy "((P|Q)-->(P|R)) --> (P|(Q-->R))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    61
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
(*6*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
goal FOL.thy "P | ~ P";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    66
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    68
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
(*7*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
goal FOL.thy "P | ~ ~ ~ P";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    71
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    74
(*8.  Peirce's law*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    75
goal FOL.thy "((P-->Q) --> P)  -->  P";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    76
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    77
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    78
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    79
(*9*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
goal FOL.thy "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    81
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    82
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    84
(*10*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
goal FOL.thy "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P<->Q)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    86
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
(*11.  Proved in each direction (incorrectly, says Pelletier!!)  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    90
goal FOL.thy "P<->P";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    91
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    94
(*12.  "Dijkstra's law"*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    95
goal FOL.thy "((P <-> Q) <-> R)  <->  (P <-> (Q <-> R))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
    96
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
(*13.  Distributive law*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
goal FOL.thy "P | (Q & R)  <-> (P | Q) & (P | R)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   101
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
(*14*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
goal FOL.thy "(P <-> Q) <-> ((Q | ~P) & (~Q|P))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   106
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   107
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   109
(*15*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
goal FOL.thy "(P --> Q) <-> (~P | Q)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   111
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   113
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
(*16*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
goal FOL.thy "(P-->Q) | (Q-->P)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   116
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
(*17*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
goal FOL.thy "((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   121
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   124
writeln"Classical Logic: examples with quantifiers";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
goal FOL.thy "(ALL x. P(x) & Q(x)) <-> (ALL x. P(x))  &  (ALL x. Q(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   127
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
result(); 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
goal FOL.thy "(EX x. P-->Q(x))  <->  (P --> (EX x.Q(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   131
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   132
result(); 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
goal FOL.thy "(EX x.P(x)-->Q)  <->  (ALL x.P(x)) --> Q";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   135
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
result(); 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   137
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
goal FOL.thy "(ALL x.P(x)) | Q  <->  (ALL x. P(x) | Q)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   139
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   140
result(); 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
13
b73f7e42135e Added example from Avron: Gentzen-Type Systems, Resolution and Tableaux, JAR 10
lcp
parents: 0
diff changeset
   142
(*Discussed in Avron, Gentzen-Type Systems, Resolution and Tableaux,
b73f7e42135e Added example from Avron: Gentzen-Type Systems, Resolution and Tableaux, JAR 10
lcp
parents: 0
diff changeset
   143
  JAR 10 (265-281), 1993.  Proof is trivial!*)
b73f7e42135e Added example from Avron: Gentzen-Type Systems, Resolution and Tableaux, JAR 10
lcp
parents: 0
diff changeset
   144
goal FOL.thy
b73f7e42135e Added example from Avron: Gentzen-Type Systems, Resolution and Tableaux, JAR 10
lcp
parents: 0
diff changeset
   145
    "~ ((EX x.~P(x)) & ((EX x.P(x)) | (EX x.P(x) & Q(x))) & ~ (EX x.P(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   146
by (Fast_tac 1);
13
b73f7e42135e Added example from Avron: Gentzen-Type Systems, Resolution and Tableaux, JAR 10
lcp
parents: 0
diff changeset
   147
result();
b73f7e42135e Added example from Avron: Gentzen-Type Systems, Resolution and Tableaux, JAR 10
lcp
parents: 0
diff changeset
   148
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
writeln"Problems requiring quantifier duplication";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
(*Needs multiple instantiation of ALL.*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   152
goal FOL.thy "(ALL x. P(x)-->P(f(x)))  &  P(d)-->P(f(f(f(d))))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   153
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   154
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   156
(*Needs double instantiation of the quantifier*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   157
goal FOL.thy "EX x. P(x) --> P(a) & P(b)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   158
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
goal FOL.thy "EX z. P(z) --> (ALL x. P(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   162
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
492
7bc980c7585e added a new example due to Robin Arthan
lcp
parents: 428
diff changeset
   165
goal FOL.thy "EX x. (EX y. P(y)) --> P(x)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   166
by (Deepen_tac 0 1);
492
7bc980c7585e added a new example due to Robin Arthan
lcp
parents: 428
diff changeset
   167
result();
7bc980c7585e added a new example due to Robin Arthan
lcp
parents: 428
diff changeset
   168
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
   169
(*V. Lifschitz, What Is the Inverse Method?, JAR 5 (1989), 1--23.  NOT PROVED*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
goal FOL.thy "EX x x'. ALL y. EX z z'. \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
\               (~P(y,y) | P(x,x) | ~S(z,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   172
\               (S(x,y) | ~S(y,z) | Q(z',z'))  & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
\               (Q(x',y) | ~Q(y,z') | S(x',x'))";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   174
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   175
writeln"Hard examples with quantifiers";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   176
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
writeln"Problem 18";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
goal FOL.thy "EX y. ALL x. P(y)-->P(x)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   179
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
result(); 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
writeln"Problem 19";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
goal FOL.thy "EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   184
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   187
writeln"Problem 20";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   188
goal FOL.thy "(ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w)))     \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   189
\   --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   190
by (Fast_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   191
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   192
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   193
writeln"Problem 21";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   194
goal FOL.thy "(EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> (EX x. P<->Q(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   195
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   196
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   197
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   198
writeln"Problem 22";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   199
goal FOL.thy "(ALL x. P <-> Q(x))  -->  (P <-> (ALL x. Q(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   200
by (Fast_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   201
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   202
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   203
writeln"Problem 23";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   204
goal FOL.thy "(ALL x. P | Q(x))  <->  (P | (ALL x. Q(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   205
by (Best_tac 1);  
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   206
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   207
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   208
writeln"Problem 24";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   209
goal FOL.thy "~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) &  \
2574
3a832a3c6376 Correction to Problem 24
paulson
parents: 2469
diff changeset
   210
\    (~(EX x.P(x)) --> (EX x.Q(x))) & (ALL x. Q(x)|R(x) --> S(x))  \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
\   --> (EX x. P(x)&R(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   212
by (Fast_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   214
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   215
writeln"Problem 25";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   216
goal FOL.thy "(EX x. P(x)) &  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   217
\       (ALL x. L(x) --> ~ (M(x) & R(x))) &  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
\       (ALL x. P(x) --> (M(x) & L(x))) &   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   219
\       ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x)))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   220
\   --> (EX x. Q(x)&P(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   221
by (Best_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   222
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   223
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   224
writeln"Problem 26";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   225
goal FOL.thy "((EX x. p(x)) <-> (EX x. q(x))) & \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   226
\     (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y)))   \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
\ --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   228
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
writeln"Problem 27";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   232
goal FOL.thy "(EX x. P(x) & ~Q(x)) &   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
\             (ALL x. P(x) --> R(x)) &   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   234
\             (ALL x. M(x) & L(x) --> P(x)) &   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   235
\             ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x)))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   236
\         --> (ALL x. M(x) --> ~L(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   237
by (Fast_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   238
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   239
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   240
writeln"Problem 28.  AMENDED";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   241
goal FOL.thy "(ALL x. P(x) --> (ALL x. Q(x))) &   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   242
\       ((ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) &  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   243
\       ((EX x.S(x)) --> (ALL x. L(x) --> M(x)))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   244
\   --> (ALL x. P(x) & L(x) --> M(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   245
by (Fast_tac 1);  
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   247
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   248
writeln"Problem 29.  Essentially the same as Principia Mathematica *11.71";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
goal FOL.thy "(EX x. P(x)) & (EX y. Q(y))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   250
\   --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y))   <->     \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   251
\        (ALL x y. P(x) & Q(y) --> R(x) & S(y)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   252
by (Fast_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   253
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   254
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   255
writeln"Problem 30";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   256
goal FOL.thy "(ALL x. P(x) | Q(x) --> ~ R(x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   257
\       (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   258
\   --> (ALL x. S(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   259
by (Fast_tac 1);  
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   260
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   261
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   262
writeln"Problem 31";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   263
goal FOL.thy "~(EX x.P(x) & (Q(x) | R(x))) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   264
\       (EX x. L(x) & P(x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   265
\       (ALL x. ~ R(x) --> M(x))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   266
\   --> (EX x. L(x) & M(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   267
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   268
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   269
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   270
writeln"Problem 32";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   271
goal FOL.thy "(ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
\       (ALL x. S(x) & R(x) --> L(x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
\       (ALL x. M(x) --> R(x))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
\   --> (ALL x. P(x) & M(x) --> L(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   275
by (Best_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   276
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
writeln"Problem 33";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   279
goal FOL.thy "(ALL x. P(a) & (P(x)-->P(b))-->P(c))  <->    \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   280
\    (ALL x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   281
by (Best_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   282
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
   284
writeln"Problem 34  AMENDED (TWICE!!)";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   285
(*Andrews's challenge*)
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   286
goal FOL.thy "((EX x. ALL y. p(x) <-> p(y))  <->                \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   287
\              ((EX x. q(x)) <-> (ALL y. p(y))))     <->        \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   288
\             ((EX x. ALL y. q(x) <-> q(y))  <->                \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   289
\              ((EX x. p(x)) <-> (ALL y. q(y))))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   290
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   291
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
writeln"Problem 35";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
goal FOL.thy "EX x y. P(x,y) -->  (ALL u v. P(u,v))";
732
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   295
by (mini_tac 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   296
by (Fast_tac 1);
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
   297
(*Without miniscope, would have to use deepen_tac; would be slower*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   299
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   300
writeln"Problem 36";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   301
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   302
     "(ALL x. EX y. J(x,y)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   303
\     (ALL x. EX y. G(x,y)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   304
\     (ALL x y. J(x,y) | G(x,y) --> (ALL z. J(y,z) | G(y,z) --> H(x,z)))   \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   305
\ --> (ALL x. EX y. H(x,y))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   306
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   307
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   308
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   309
writeln"Problem 37";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
goal FOL.thy "(ALL z. EX w. ALL x. EX y. \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   311
\          (P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u.Q(u,w)))) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   312
\       (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   313
\       ((EX x y. Q(x,y)) --> (ALL x. R(x,x)))  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   314
\   --> (ALL x. EX y. R(x,y))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   315
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   317
428
49cc52442678 problem 38 is provable
lcp
parents: 36
diff changeset
   318
writeln"Problem 38";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
goal FOL.thy
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   320
    "(ALL x. p(a) & (p(x) --> (EX y. p(y) & r(x,y))) -->        \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   321
\            (EX z. EX w. p(z) & r(x,w) & r(w,z)))  <->         \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   322
\    (ALL x. (~p(a) | p(x) | (EX z. EX w. p(z) & r(x,w) & r(w,z))) &    \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   323
\            (~p(a) | ~(EX y. p(y) & r(x,y)) |                          \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
\             (EX z. EX w. p(z) & r(x,w) & r(w,z))))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   325
by (Deepen_tac 0 1);  (*beats fast_tac!*)
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
   326
result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   327
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   328
writeln"Problem 39";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   329
goal FOL.thy "~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   330
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   331
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   332
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   333
writeln"Problem 40.  AMENDED";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   334
goal FOL.thy "(EX y. ALL x. F(x,y) <-> F(x,x)) -->  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   335
\             ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   336
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   337
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   338
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   339
writeln"Problem 41";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   340
goal FOL.thy "(ALL z. EX y. ALL x. f(x,y) <-> f(x,z) & ~ f(x,x))        \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   341
\         --> ~ (EX z. ALL x. f(x,z))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   342
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   343
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   344
428
49cc52442678 problem 38 is provable
lcp
parents: 36
diff changeset
   345
writeln"Problem 42";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   346
goal FOL.thy "~ (EX y. ALL x. p(x,y) <-> ~ (EX z. p(x,z) & p(z,x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   347
by (Deepen_tac 0 1);
428
49cc52442678 problem 38 is provable
lcp
parents: 36
diff changeset
   348
result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   349
732
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   350
writeln"Problem 43";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   351
goal FOL.thy "(ALL x. ALL y. q(x,y) <-> (ALL z. p(z,x) <-> p(z,y)))     \
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
   352
\         --> (ALL x. ALL y. q(x,y) <-> q(y,x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   353
by (Auto_tac());
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   354
(*The proof above cheats by using rewriting!  A purely logical proof is
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   355
  by (mini_tac 1 THEN Deepen_tac 5 1);
1809
8cb50df49570 Inserted comment about problem 43
paulson
parents: 1651
diff changeset
   356
Can use just deepen_tac but it requires 253 secs?!?
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   357
  by (Deepen_tac 0 1);     
732
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   358
*)
665
97e9ad6c1c4a FOL/ex/cla: proofs now use deepen_tac instead of best_tac FOL_dup_cs
lcp
parents: 644
diff changeset
   359
result();
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   360
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   361
writeln"Problem 44";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   362
goal FOL.thy "(ALL x. f(x) -->                                          \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   363
\             (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y))))  &       \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   364
\             (EX x. j(x) & (ALL y. g(y) --> h(x,y)))                   \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   365
\             --> (EX x. j(x) & ~f(x))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   366
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   367
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   368
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   369
writeln"Problem 45";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   370
goal FOL.thy "(ALL x. f(x) & (ALL y. g(y) & h(x,y) --> j(x,y))  \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   371
\                     --> (ALL y. g(y) & h(x,y) --> k(y))) &    \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   372
\     ~ (EX y. l(y) & k(y)) &                                   \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   373
\     (EX x. f(x) & (ALL y. h(x,y) --> l(y))                    \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   374
\                 & (ALL y. g(y) & h(x,y) --> j(x,y)))          \
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   375
\     --> (EX x. f(x) & ~ (EX y. g(y) & h(x,y)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   376
by (Best_tac 1); 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   377
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   378
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   379
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   380
writeln"Problems (mainly) involving equality or functions";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   381
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   382
writeln"Problem 48";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   383
goal FOL.thy "(a=b | c=d) & (a=c | b=d) --> a=d | b=c";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   384
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   385
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   386
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   387
writeln"Problem 49  NOT PROVED AUTOMATICALLY";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   388
(*Hard because it involves substitution for Vars;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   389
  the type constraint ensures that x,y,z have the same type as a,b,u. *)
36
70c6014c9b6f examples now use ~= for "not equals"
lcp
parents: 13
diff changeset
   390
goal FOL.thy "(EX x y::'a. ALL z. z=x | z=y) & P(a) & P(b) & a~=b \
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   391
\               --> (ALL u::'a.P(u))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   392
by (Step_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   393
by (res_inst_tac [("x","a")] allE 1);
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   394
by (assume_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   395
by (res_inst_tac [("x","b")] allE 1);
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   396
by (assume_tac 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   397
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   398
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   399
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   400
writeln"Problem 50";  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   401
(*What has this to do with equality?*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   402
goal FOL.thy "(ALL x. P(a,x) | (ALL y.P(x,y))) --> (EX x. ALL y.P(x,y))";
732
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   403
by (mini_tac 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   404
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   405
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   406
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   407
writeln"Problem 51";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   408
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   409
    "(EX z w. ALL x y. P(x,y) <->  (x=z & y=w)) -->  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   410
\    (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   411
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   412
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   413
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   414
writeln"Problem 52";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   415
(*Almost the same as 51. *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   416
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   417
    "(EX z w. ALL x y. P(x,y) <->  (x=z & y=w)) -->  \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   418
\    (EX w. ALL y. EX z. (ALL x. P(x,y) <-> x=z) <-> y=w)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   419
by (Best_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   420
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   421
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   422
writeln"Problem 55";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   423
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   424
(*Original, equational version by Len Schubert, via Pelletier *** NOT PROVED
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   425
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   426
  "(EX x. lives(x) & killed(x,agatha)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   427
\  lives(agatha) & lives(butler) & lives(charles) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   428
\  (ALL x. lives(x) --> x=agatha | x=butler | x=charles) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   429
\  (ALL x y. killed(x,y) --> hates(x,y)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   430
\  (ALL x y. killed(x,y) --> ~richer(x,y)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   431
\  (ALL x. hates(agatha,x) --> ~hates(charles,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   432
\  (ALL x. ~ x=butler --> hates(agatha,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   433
\  (ALL x. ~richer(x,agatha) --> hates(butler,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   434
\  (ALL x. hates(agatha,x) --> hates(butler,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   435
\  (ALL x. EX y. ~hates(x,y)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   436
\  ~ agatha=butler --> \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   437
\  killed(?who,agatha)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   438
by (Step_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   439
by (dres_inst_tac [("x1","x")] (spec RS mp) 1);
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   440
by (assume_tac 1);
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   441
by (etac (spec RS exE) 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   442
by (REPEAT (etac allE 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   443
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   444
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   445
****)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   446
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   447
(*Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   448
  fast_tac DISCOVERS who killed Agatha. *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   449
goal FOL.thy "lives(agatha) & lives(butler) & lives(charles) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   450
\  (killed(agatha,agatha) | killed(butler,agatha) | killed(charles,agatha)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   451
\  (ALL x y. killed(x,y) --> hates(x,y) & ~richer(x,y)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   452
\  (ALL x. hates(agatha,x) --> ~hates(charles,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   453
\  (hates(agatha,agatha) & hates(agatha,charles)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   454
\  (ALL x. lives(x) & ~richer(x,agatha) --> hates(butler,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   455
\  (ALL x. hates(agatha,x) --> hates(butler,x)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   456
\  (ALL x. ~hates(x,agatha) | ~hates(x,butler) | ~hates(x,charles)) --> \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   457
\   killed(?who,agatha)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   458
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   459
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   460
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   461
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   462
writeln"Problem 56";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   463
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   464
    "(ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   465
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   466
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   467
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   468
writeln"Problem 57";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   469
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   470
    "P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   471
\    (ALL x y z. P(x,y) & P(y,z) --> P(x,z))    -->   P(f(a,b), f(a,c))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   472
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   473
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   474
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   475
writeln"Problem 58  NOT PROVED AUTOMATICALLY";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   476
goal FOL.thy "(ALL x y. f(x)=g(y)) --> (ALL x y. f(f(x))=f(g(y)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   477
by (slow_tac (!claset addEs [subst_context]) 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   478
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   479
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   480
writeln"Problem 59";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   481
goal FOL.thy "(ALL x. P(x) <-> ~P(f(x))) --> (EX x. P(x) & ~P(f(x)))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   482
by (Deepen_tac 0 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   483
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   484
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   485
writeln"Problem 60";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   486
goal FOL.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   487
    "ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   488
by (Fast_tac 1);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   489
result();
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   490
1404
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 732
diff changeset
   491
writeln"Problem 62 as corrected in AAR newletter #31";
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 732
diff changeset
   492
goal FOL.thy
1459
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   493
    "(ALL x. p(a) & (p(x) --> p(f(x))) --> p(f(f(x))))  <->     \
d12da312eff4 expanded tabs
clasohm
parents: 1404
diff changeset
   494
\    (ALL x. (~p(a) | p(x) | p(f(f(x)))) &                      \
1404
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 732
diff changeset
   495
\            (~p(a) | ~p(f(x)) | p(f(f(x)))))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1915
diff changeset
   496
by (Fast_tac 1);
1404
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 732
diff changeset
   497
result();
57c3f6d2e692 Added Pelletier's problem 62, as corrected in AAR
paulson
parents: 732
diff changeset
   498
1560
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   499
(*Halting problem: Formulation of Li Dafa (AAR Newsletter 27, Oct 1994.)
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   500
	author U. Egly*)
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   501
goal FOL.thy
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   502
"((EX X. a(X) & (ALL Y. c(Y) --> (ALL Z. d(X, Y, Z)))) -->  \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   503
\  (EX W. c(W) & (ALL Y. c(Y) --> (ALL Z. d(W, Y, Z)))))     \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   504
\ &                                                          \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   505
\ (ALL W. c(W) & (ALL U. c(U) --> (ALL V. d(W, U, V))) -->       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   506
\       (ALL Y Z.                                               \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   507
\           (c(Y) & h2(Y, Z) --> h3(W, Y, Z) & o(W, g)) &       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   508
\           (c(Y) & ~h2(Y, Z) --> h3(W, Y, Z) & o(W, b))))  \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   509
\ &                    \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   510
\ (ALL W. c(W) &       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   511
\   (ALL Y Z.          \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   512
\       (c(Y) & h2(Y, Z) --> h3(W, Y, Z) & o(W, g)) &       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   513
\       (c(Y) & ~h2(Y, Z) --> h3(W, Y, Z) & o(W, b))) -->       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   514
\   (EX V. c(V) &       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   515
\         (ALL Y. ((c(Y) & h3(W, Y, Y)) & o(W, g) --> ~h2(V, Y)) &       \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   516
\                 ((c(Y) & h3(W, Y, Y)) & o(W, b) --> h2(V, Y) & o(V, b))))) \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   517
\  -->                  \
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   518
\  ~ (EX X. a(X) & (ALL Y. c(Y) --> (ALL Z. d(X, Y, Z))))";
9d001e5f43d8 Added formulation of Halting Problem
paulson
parents: 1462
diff changeset
   519
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   520
2614
0b1364481214 Added a new challenge problem
paulson
parents: 2601
diff changeset
   521
(* Challenge found on info-hol *)
0b1364481214 Added a new challenge problem
paulson
parents: 2601
diff changeset
   522
goal FOL.thy
0b1364481214 Added a new challenge problem
paulson
parents: 2601
diff changeset
   523
    "ALL x. EX v w. ALL y z. P(x) & Q(y) --> (P(v) | R(w)) & (R(z) --> Q(v))";
0b1364481214 Added a new challenge problem
paulson
parents: 2601
diff changeset
   524
by (Deepen_tac 0 1);
0b1364481214 Added a new challenge problem
paulson
parents: 2601
diff changeset
   525
result();
0b1364481214 Added a new challenge problem
paulson
parents: 2601
diff changeset
   526
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   527
writeln"Reached end of file.";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   528
732
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   529
(*Thu Jul 23 1992: loaded in 467s using iffE [on SPARC2] *)
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   530
(*Mon Nov 14 1994: loaded in 144s [on SPARC10, with deepen_tac] *)
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   531
(*Wed Nov 16 1994: loaded in 138s [after addition of norm_term_skip] *)
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   532
(*Mon Nov 21 1994: loaded in 131s [DEPTH_FIRST suppressing repetitions] *)
584b3475e859 updated for new deepen_tac
lcp
parents: 665
diff changeset
   533