| 
31974
 | 
     1  | 
(*  Title:      FOL/ex/Classical.thy
  | 
| 
14236
 | 
     2  | 
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
  | 
| 
 | 
     3  | 
    Copyright   1994  University of Cambridge
  | 
| 
 | 
     4  | 
*)
  | 
| 
 | 
     5  | 
  | 
| 
61489
 | 
     6  | 
section \<open>Classical Predicate Calculus Problems\<close>
  | 
| 
14236
 | 
     7  | 
  | 
| 
61489
 | 
     8  | 
theory Classical
  | 
| 
 | 
     9  | 
imports FOL
  | 
| 
 | 
    10  | 
begin
  | 
| 
14236
 | 
    11  | 
  | 
| 
69590
 | 
    12  | 
lemma \<open>(P \<longrightarrow> Q \<or> R) \<longrightarrow> (P \<longrightarrow> Q) \<or> (P \<longrightarrow> R)\<close>
  | 
| 
61489
 | 
    13  | 
  by blast
  | 
| 
14236
 | 
    14  | 
  | 
| 
 | 
    15  | 
  | 
| 
61489
 | 
    16  | 
subsubsection \<open>If and only if\<close>
  | 
| 
 | 
    17  | 
  | 
| 
69590
 | 
    18  | 
lemma \<open>(P \<longleftrightarrow> Q) \<longleftrightarrow> (Q \<longleftrightarrow> P)\<close>
  | 
| 
61489
 | 
    19  | 
  by blast
  | 
| 
 | 
    20  | 
  | 
| 
69590
 | 
    21  | 
lemma \<open>\<not> (P \<longleftrightarrow> \<not> P)\<close>
  | 
| 
61489
 | 
    22  | 
  by blast
  | 
| 
 | 
    23  | 
  | 
| 
 | 
    24  | 
  | 
| 
 | 
    25  | 
subsection \<open>Pelletier's examples\<close>
  | 
| 
14236
 | 
    26  | 
  | 
| 
61489
 | 
    27  | 
text \<open>
  | 
| 
 | 
    28  | 
  Sample problems from
  | 
| 
 | 
    29  | 
  | 
| 
 | 
    30  | 
    \<^item> F. J. Pelletier,
  | 
| 
 | 
    31  | 
    Seventy-Five Problems for Testing Automatic Theorem Provers,
  | 
| 
 | 
    32  | 
    J. Automated Reasoning 2 (1986), 191-216.
  | 
| 
 | 
    33  | 
    Errata, JAR 4 (1988), 236-236.
  | 
| 
 | 
    34  | 
  | 
| 
 | 
    35  | 
  The hardest problems -- judging by experience with several theorem
  | 
| 
 | 
    36  | 
  provers, including matrix ones -- are 34 and 43.
  | 
| 
60770
 | 
    37  | 
\<close>
  | 
| 
14236
 | 
    38  | 
  | 
| 
60770
 | 
    39  | 
text\<open>1\<close>
  | 
| 
69590
 | 
    40  | 
lemma \<open>(P \<longrightarrow> Q) \<longleftrightarrow> (\<not> Q \<longrightarrow> \<not> P)\<close>
  | 
| 
61489
 | 
    41  | 
  by blast
  | 
| 
14236
 | 
    42  | 
  | 
| 
60770
 | 
    43  | 
text\<open>2\<close>
  | 
| 
69590
 | 
    44  | 
lemma \<open>\<not> \<not> P \<longleftrightarrow> P\<close>
  | 
| 
61489
 | 
    45  | 
  by blast
  | 
| 
14236
 | 
    46  | 
  | 
| 
60770
 | 
    47  | 
text\<open>3\<close>
  | 
| 
69590
 | 
    48  | 
lemma \<open>\<not> (P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> P)\<close>
  | 
| 
61489
 | 
    49  | 
  by blast
  | 
| 
14236
 | 
    50  | 
  | 
| 
60770
 | 
    51  | 
text\<open>4\<close>
  | 
| 
69590
 | 
    52  | 
lemma \<open>(\<not> P \<longrightarrow> Q) \<longleftrightarrow> (\<not> Q \<longrightarrow> P)\<close>
  | 
| 
61489
 | 
    53  | 
  by blast
  | 
| 
14236
 | 
    54  | 
  | 
| 
60770
 | 
    55  | 
text\<open>5\<close>
  | 
| 
69590
 | 
    56  | 
lemma \<open>((P \<or> Q) \<longrightarrow> (P \<or> R)) \<longrightarrow> (P \<or> (Q \<longrightarrow> R))\<close>
  | 
| 
61489
 | 
    57  | 
  by blast
  | 
| 
14236
 | 
    58  | 
  | 
| 
60770
 | 
    59  | 
text\<open>6\<close>
  | 
| 
69590
 | 
    60  | 
lemma \<open>P \<or> \<not> P\<close>
  | 
| 
61489
 | 
    61  | 
  by blast
  | 
| 
14236
 | 
    62  | 
  | 
| 
60770
 | 
    63  | 
text\<open>7\<close>
  | 
| 
69590
 | 
    64  | 
lemma \<open>P \<or> \<not> \<not> \<not> P\<close>
  | 
| 
61489
 | 
    65  | 
  by blast
  | 
| 
14236
 | 
    66  | 
  | 
| 
61489
 | 
    67  | 
text\<open>8. Peirce's law\<close>
  | 
| 
69590
 | 
    68  | 
lemma \<open>((P \<longrightarrow> Q) \<longrightarrow> P) \<longrightarrow> P\<close>
  | 
| 
61489
 | 
    69  | 
  by blast
  | 
| 
14236
 | 
    70  | 
  | 
| 
60770
 | 
    71  | 
text\<open>9\<close>
  | 
| 
69590
 | 
    72  | 
lemma \<open>((P \<or> Q) \<and> (\<not> P \<or> Q) \<and> (P \<or> \<not> Q)) \<longrightarrow> \<not> (\<not> P \<or> \<not> Q)\<close>
  | 
| 
61489
 | 
    73  | 
  by blast
  | 
| 
14236
 | 
    74  | 
  | 
| 
60770
 | 
    75  | 
text\<open>10\<close>
  | 
| 
69590
 | 
    76  | 
lemma \<open>(Q \<longrightarrow> R) \<and> (R \<longrightarrow> P \<and> Q) \<and> (P \<longrightarrow> Q \<or> R) \<longrightarrow> (P \<longleftrightarrow> Q)\<close>
  | 
| 
61489
 | 
    77  | 
  by blast
  | 
| 
14236
 | 
    78  | 
  | 
| 
61489
 | 
    79  | 
text\<open>11. Proved in each direction (incorrectly, says Pelletier!!)\<close>
  | 
| 
69590
 | 
    80  | 
lemma \<open>P \<longleftrightarrow> P\<close>
  | 
| 
61489
 | 
    81  | 
  by blast
  | 
| 
14236
 | 
    82  | 
  | 
| 
61489
 | 
    83  | 
text\<open>12. "Dijkstra's law"\<close>
  | 
| 
69590
 | 
    84  | 
lemma \<open>((P \<longleftrightarrow> Q) \<longleftrightarrow> R) \<longleftrightarrow> (P \<longleftrightarrow> (Q \<longleftrightarrow> R))\<close>
  | 
| 
61489
 | 
    85  | 
  by blast
  | 
| 
14236
 | 
    86  | 
  | 
| 
61489
 | 
    87  | 
text\<open>13. Distributive law\<close>
  | 
| 
69590
 | 
    88  | 
lemma \<open>P \<or> (Q \<and> R) \<longleftrightarrow> (P \<or> Q) \<and> (P \<or> R)\<close>
  | 
| 
61489
 | 
    89  | 
  by blast
  | 
| 
14236
 | 
    90  | 
  | 
| 
60770
 | 
    91  | 
text\<open>14\<close>
  | 
| 
69590
 | 
    92  | 
lemma \<open>(P \<longleftrightarrow> Q) \<longleftrightarrow> ((Q \<or> \<not> P) \<and> (\<not> Q \<or> P))\<close>
  | 
| 
61489
 | 
    93  | 
  by blast
  | 
| 
14236
 | 
    94  | 
  | 
| 
60770
 | 
    95  | 
text\<open>15\<close>
  | 
| 
69590
 | 
    96  | 
lemma \<open>(P \<longrightarrow> Q) \<longleftrightarrow> (\<not> P \<or> Q)\<close>
  | 
| 
61489
 | 
    97  | 
  by blast
  | 
| 
14236
 | 
    98  | 
  | 
| 
60770
 | 
    99  | 
text\<open>16\<close>
  | 
| 
69590
 | 
   100  | 
lemma \<open>(P \<longrightarrow> Q) \<or> (Q \<longrightarrow> P)\<close>
  | 
| 
61489
 | 
   101  | 
  by blast
  | 
| 
14236
 | 
   102  | 
  | 
| 
60770
 | 
   103  | 
text\<open>17\<close>
  | 
| 
69590
 | 
   104  | 
lemma \<open>((P \<and> (Q \<longrightarrow> R)) \<longrightarrow> S) \<longleftrightarrow> ((\<not> P \<or> Q \<or> S) \<and> (\<not> P \<or> \<not> R \<or> S))\<close>
  | 
| 
61489
 | 
   105  | 
  by blast
  | 
| 
 | 
   106  | 
  | 
| 
14236
 | 
   107  | 
  | 
| 
61489
 | 
   108  | 
subsection \<open>Classical Logic: examples with quantifiers\<close>
  | 
| 
14236
 | 
   109  | 
  | 
| 
69590
 | 
   110  | 
lemma \<open>(\<forall>x. P(x) \<and> Q(x)) \<longleftrightarrow> (\<forall>x. P(x)) \<and> (\<forall>x. Q(x))\<close>
  | 
| 
61489
 | 
   111  | 
  by blast
  | 
| 
14236
 | 
   112  | 
  | 
| 
69590
 | 
   113  | 
lemma \<open>(\<exists>x. P \<longrightarrow> Q(x)) \<longleftrightarrow> (P \<longrightarrow> (\<exists>x. Q(x)))\<close>
  | 
| 
61489
 | 
   114  | 
  by blast
  | 
| 
14236
 | 
   115  | 
  | 
| 
69590
 | 
   116  | 
lemma \<open>(\<exists>x. P(x) \<longrightarrow> Q) \<longleftrightarrow> (\<forall>x. P(x)) \<longrightarrow> Q\<close>
  | 
| 
61489
 | 
   117  | 
  by blast
  | 
| 
14236
 | 
   118  | 
  | 
| 
69590
 | 
   119  | 
lemma \<open>(\<forall>x. P(x)) \<or> Q \<longleftrightarrow> (\<forall>x. P(x) \<or> Q)\<close>
  | 
| 
61489
 | 
   120  | 
  by blast
  | 
| 
14236
 | 
   121  | 
  | 
| 
60770
 | 
   122  | 
text\<open>Discussed in Avron, Gentzen-Type Systems, Resolution and Tableaux,
  | 
| 
 | 
   123  | 
  JAR 10 (265-281), 1993.  Proof is trivial!\<close>
  | 
| 
69590
 | 
   124  | 
lemma \<open>\<not> ((\<exists>x. \<not> P(x)) \<and> ((\<exists>x. P(x)) \<or> (\<exists>x. P(x) \<and> Q(x))) \<and> \<not> (\<exists>x. P(x)))\<close>
  | 
| 
61489
 | 
   125  | 
  by blast
  | 
| 
14236
 | 
   126  | 
  | 
| 
 | 
   127  | 
  | 
| 
61489
 | 
   128  | 
subsection \<open>Problems requiring quantifier duplication\<close>
  | 
| 
 | 
   129  | 
  | 
| 
 | 
   130  | 
text\<open>Theorem B of Peter Andrews, Theorem Proving via General Matings,
  | 
| 
60770
 | 
   131  | 
  JACM 28 (1981).\<close>
  | 
| 
69590
 | 
   132  | 
lemma \<open>(\<exists>x. \<forall>y. P(x) \<longleftrightarrow> P(y)) \<longrightarrow> ((\<exists>x. P(x)) \<longleftrightarrow> (\<forall>y. P(y)))\<close>
  | 
| 
61489
 | 
   133  | 
  by blast
  | 
| 
14236
 | 
   134  | 
  | 
| 
60770
 | 
   135  | 
text\<open>Needs multiple instantiation of ALL.\<close>
  | 
| 
69590
 | 
   136  | 
lemma \<open>(\<forall>x. P(x) \<longrightarrow> P(f(x))) \<and> P(d) \<longrightarrow> P(f(f(f(d))))\<close>
  | 
| 
61489
 | 
   137  | 
  by blast
  | 
| 
14236
 | 
   138  | 
  | 
| 
60770
 | 
   139  | 
text\<open>Needs double instantiation of the quantifier\<close>
  | 
| 
69590
 | 
   140  | 
lemma \<open>\<exists>x. P(x) \<longrightarrow> P(a) \<and> P(b)\<close>
  | 
| 
61489
 | 
   141  | 
  by blast
  | 
| 
14236
 | 
   142  | 
  | 
| 
69590
 | 
   143  | 
lemma \<open>\<exists>z. P(z) \<longrightarrow> (\<forall>x. P(x))\<close>
  | 
| 
61489
 | 
   144  | 
  by blast
  | 
| 
14236
 | 
   145  | 
  | 
| 
69590
 | 
   146  | 
lemma \<open>\<exists>x. (\<exists>y. P(y)) \<longrightarrow> P(x)\<close>
  | 
| 
61489
 | 
   147  | 
  by blast
  | 
| 
14236
 | 
   148  | 
  | 
| 
61489
 | 
   149  | 
text\<open>V. Lifschitz, What Is the Inverse Method?, JAR 5 (1989), 1--23. NOT PROVED.\<close>
  | 
| 
 | 
   150  | 
lemma
  | 
| 
69590
 | 
   151  | 
  \<open>\<exists>x x'. \<forall>y. \<exists>z z'.
  | 
| 
61489
 | 
   152  | 
    (\<not> P(y,y) \<or> P(x,x) \<or> \<not> S(z,x)) \<and>
  | 
| 
 | 
   153  | 
    (S(x,y) \<or> \<not> S(y,z) \<or> Q(z',z')) \<and>
  | 
| 
69590
 | 
   154  | 
    (Q(x',y) \<or> \<not> Q(y,z') \<or> S(x',x'))\<close>
  | 
| 
61489
 | 
   155  | 
  oops
  | 
| 
14236
 | 
   156  | 
  | 
| 
 | 
   157  | 
  | 
| 
61489
 | 
   158  | 
subsection \<open>Hard examples with quantifiers\<close>
  | 
| 
14236
 | 
   159  | 
  | 
| 
60770
 | 
   160  | 
text\<open>18\<close>
  | 
| 
69590
 | 
   161  | 
lemma \<open>\<exists>y. \<forall>x. P(y) \<longrightarrow> P(x)\<close>
  | 
| 
61489
 | 
   162  | 
  by blast
  | 
| 
14236
 | 
   163  | 
  | 
| 
60770
 | 
   164  | 
text\<open>19\<close>
  | 
| 
69590
 | 
   165  | 
lemma \<open>\<exists>x. \<forall>y z. (P(y) \<longrightarrow> Q(z)) \<longrightarrow> (P(x) \<longrightarrow> Q(x))\<close>
  | 
| 
61489
 | 
   166  | 
  by blast
  | 
| 
14236
 | 
   167  | 
  | 
| 
60770
 | 
   168  | 
text\<open>20\<close>
  | 
| 
69590
 | 
   169  | 
lemma \<open>(\<forall>x y. \<exists>z. \<forall>w. (P(x) \<and> Q(y) \<longrightarrow> R(z) \<and> S(w)))
  | 
| 
 | 
   170  | 
  \<longrightarrow> (\<exists>x y. P(x) \<and> Q(y)) \<longrightarrow> (\<exists>z. R(z))\<close>
  | 
| 
61489
 | 
   171  | 
  by blast
  | 
| 
14236
 | 
   172  | 
  | 
| 
60770
 | 
   173  | 
text\<open>21\<close>
  | 
| 
69590
 | 
   174  | 
lemma \<open>(\<exists>x. P \<longrightarrow> Q(x)) \<and> (\<exists>x. Q(x) \<longrightarrow> P) \<longrightarrow> (\<exists>x. P \<longleftrightarrow> Q(x))\<close>
  | 
| 
61489
 | 
   175  | 
  by blast
  | 
| 
14236
 | 
   176  | 
  | 
| 
60770
 | 
   177  | 
text\<open>22\<close>
  | 
| 
69590
 | 
   178  | 
lemma \<open>(\<forall>x. P \<longleftrightarrow> Q(x)) \<longrightarrow> (P \<longleftrightarrow> (\<forall>x. Q(x)))\<close>
  | 
| 
61489
 | 
   179  | 
  by blast
  | 
| 
14236
 | 
   180  | 
  | 
| 
60770
 | 
   181  | 
text\<open>23\<close>
  | 
| 
69590
 | 
   182  | 
lemma \<open>(\<forall>x. P \<or> Q(x)) \<longleftrightarrow> (P \<or> (\<forall>x. Q(x)))\<close>
  | 
| 
61489
 | 
   183  | 
  by blast
  | 
| 
14236
 | 
   184  | 
  | 
| 
60770
 | 
   185  | 
text\<open>24\<close>
  | 
| 
61489
 | 
   186  | 
lemma
  | 
| 
69590
 | 
   187  | 
  \<open>\<not> (\<exists>x. S(x) \<and> Q(x)) \<and> (\<forall>x. P(x) \<longrightarrow> Q(x) \<or> R(x)) \<and>
  | 
| 
61489
 | 
   188  | 
    (\<not> (\<exists>x. P(x)) \<longrightarrow> (\<exists>x. Q(x))) \<and> (\<forall>x. Q(x) \<or> R(x) \<longrightarrow> S(x))
  | 
| 
69590
 | 
   189  | 
    \<longrightarrow> (\<exists>x. P(x) \<and> R(x))\<close>
  | 
| 
61489
 | 
   190  | 
  by blast
  | 
| 
14236
 | 
   191  | 
  | 
| 
60770
 | 
   192  | 
text\<open>25\<close>
  | 
| 
61489
 | 
   193  | 
lemma
  | 
| 
69590
 | 
   194  | 
  \<open>(\<exists>x. P(x)) \<and>
  | 
| 
61489
 | 
   195  | 
    (\<forall>x. L(x) \<longrightarrow> \<not> (M(x) \<and> R(x))) \<and>
  | 
| 
 | 
   196  | 
    (\<forall>x. P(x) \<longrightarrow> (M(x) \<and> L(x))) \<and>
  | 
| 
 | 
   197  | 
    ((\<forall>x. P(x) \<longrightarrow> Q(x)) \<or> (\<exists>x. P(x) \<and> R(x)))
  | 
| 
69590
 | 
   198  | 
    \<longrightarrow> (\<exists>x. Q(x) \<and> P(x))\<close>
  | 
| 
61489
 | 
   199  | 
  by blast
  | 
| 
14236
 | 
   200  | 
  | 
| 
60770
 | 
   201  | 
text\<open>26\<close>
  | 
| 
61489
 | 
   202  | 
lemma
  | 
| 
69590
 | 
   203  | 
  \<open>((\<exists>x. p(x)) \<longleftrightarrow> (\<exists>x. q(x))) \<and>
  | 
| 
61489
 | 
   204  | 
    (\<forall>x. \<forall>y. p(x) \<and> q(y) \<longrightarrow> (r(x) \<longleftrightarrow> s(y)))
  | 
| 
69590
 | 
   205  | 
  \<longrightarrow> ((\<forall>x. p(x) \<longrightarrow> r(x)) \<longleftrightarrow> (\<forall>x. q(x) \<longrightarrow> s(x)))\<close>
  | 
| 
61489
 | 
   206  | 
  by blast
  | 
| 
14236
 | 
   207  | 
  | 
| 
60770
 | 
   208  | 
text\<open>27\<close>
  | 
| 
61489
 | 
   209  | 
lemma
  | 
| 
69590
 | 
   210  | 
  \<open>(\<exists>x. P(x) \<and> \<not> Q(x)) \<and>
  | 
| 
61489
 | 
   211  | 
    (\<forall>x. P(x) \<longrightarrow> R(x)) \<and>
  | 
| 
 | 
   212  | 
    (\<forall>x. M(x) \<and> L(x) \<longrightarrow> P(x)) \<and>
  | 
| 
 | 
   213  | 
    ((\<exists>x. R(x) \<and> \<not> Q(x)) \<longrightarrow> (\<forall>x. L(x) \<longrightarrow> \<not> R(x)))
  | 
| 
69590
 | 
   214  | 
  \<longrightarrow> (\<forall>x. M(x) \<longrightarrow> \<not> L(x))\<close>
  | 
| 
61489
 | 
   215  | 
  by blast
  | 
| 
14236
 | 
   216  | 
  | 
| 
61489
 | 
   217  | 
text\<open>28. AMENDED\<close>
  | 
| 
 | 
   218  | 
lemma
  | 
| 
69590
 | 
   219  | 
  \<open>(\<forall>x. P(x) \<longrightarrow> (\<forall>x. Q(x))) \<and>
  | 
| 
61489
 | 
   220  | 
    ((\<forall>x. Q(x) \<or> R(x)) \<longrightarrow> (\<exists>x. Q(x) \<and> S(x))) \<and>
  | 
| 
 | 
   221  | 
    ((\<exists>x. S(x)) \<longrightarrow> (\<forall>x. L(x) \<longrightarrow> M(x)))
  | 
| 
69590
 | 
   222  | 
  \<longrightarrow> (\<forall>x. P(x) \<and> L(x) \<longrightarrow> M(x))\<close>
  | 
| 
61489
 | 
   223  | 
  by blast
  | 
| 
14236
 | 
   224  | 
  | 
| 
61489
 | 
   225  | 
text\<open>29. Essentially the same as Principia Mathematica *11.71\<close>
  | 
| 
 | 
   226  | 
lemma
  | 
| 
69590
 | 
   227  | 
  \<open>(\<exists>x. P(x)) \<and> (\<exists>y. Q(y))
  | 
| 
61489
 | 
   228  | 
    \<longrightarrow> ((\<forall>x. P(x) \<longrightarrow> R(x)) \<and> (\<forall>y. Q(y) \<longrightarrow> S(y)) \<longleftrightarrow>
  | 
| 
69590
 | 
   229  | 
      (\<forall>x y. P(x) \<and> Q(y) \<longrightarrow> R(x) \<and> S(y)))\<close>
  | 
| 
61489
 | 
   230  | 
  by blast
  | 
| 
14236
 | 
   231  | 
  | 
| 
60770
 | 
   232  | 
text\<open>30\<close>
  | 
| 
61489
 | 
   233  | 
lemma
  | 
| 
69590
 | 
   234  | 
  \<open>(\<forall>x. P(x) \<or> Q(x) \<longrightarrow> \<not> R(x)) \<and>
  | 
| 
61489
 | 
   235  | 
    (\<forall>x. (Q(x) \<longrightarrow> \<not> S(x)) \<longrightarrow> P(x) \<and> R(x))
  | 
| 
69590
 | 
   236  | 
    \<longrightarrow> (\<forall>x. S(x))\<close>
  | 
| 
61489
 | 
   237  | 
  by blast
  | 
| 
14236
 | 
   238  | 
  | 
| 
60770
 | 
   239  | 
text\<open>31\<close>
  | 
| 
61489
 | 
   240  | 
lemma
  | 
| 
69590
 | 
   241  | 
  \<open>\<not> (\<exists>x. P(x) \<and> (Q(x) \<or> R(x))) \<and>
  | 
| 
61489
 | 
   242  | 
    (\<exists>x. L(x) \<and> P(x)) \<and>
  | 
| 
 | 
   243  | 
    (\<forall>x. \<not> R(x) \<longrightarrow> M(x))
  | 
| 
69590
 | 
   244  | 
  \<longrightarrow> (\<exists>x. L(x) \<and> M(x))\<close>
  | 
| 
61489
 | 
   245  | 
  by blast
  | 
| 
14236
 | 
   246  | 
  | 
| 
60770
 | 
   247  | 
text\<open>32\<close>
  | 
| 
61489
 | 
   248  | 
lemma
  | 
| 
69590
 | 
   249  | 
  \<open>(\<forall>x. P(x) \<and> (Q(x) \<or> R(x)) \<longrightarrow> S(x)) \<and>
  | 
| 
61489
 | 
   250  | 
    (\<forall>x. S(x) \<and> R(x) \<longrightarrow> L(x)) \<and>
  | 
| 
 | 
   251  | 
    (\<forall>x. M(x) \<longrightarrow> R(x))
  | 
| 
69590
 | 
   252  | 
  \<longrightarrow> (\<forall>x. P(x) \<and> M(x) \<longrightarrow> L(x))\<close>
  | 
| 
61489
 | 
   253  | 
  by blast
  | 
| 
14236
 | 
   254  | 
  | 
| 
60770
 | 
   255  | 
text\<open>33\<close>
  | 
| 
61489
 | 
   256  | 
lemma
  | 
| 
69590
 | 
   257  | 
  \<open>(\<forall>x. P(a) \<and> (P(x) \<longrightarrow> P(b)) \<longrightarrow> P(c)) \<longleftrightarrow>
  | 
| 
 | 
   258  | 
    (\<forall>x. (\<not> P(a) \<or> P(x) \<or> P(c)) \<and> (\<not> P(a) \<or> \<not> P(b) \<or> P(c)))\<close>
  | 
| 
61489
 | 
   259  | 
  by blast
  | 
| 
14236
 | 
   260  | 
  | 
| 
61489
 | 
   261  | 
text\<open>34. AMENDED (TWICE!!). Andrews's challenge.\<close>
  | 
| 
 | 
   262  | 
lemma
  | 
| 
69590
 | 
   263  | 
  \<open>((\<exists>x. \<forall>y. p(x) \<longleftrightarrow> p(y)) \<longleftrightarrow> ((\<exists>x. q(x)) \<longleftrightarrow> (\<forall>y. p(y)))) \<longleftrightarrow>
  | 
| 
 | 
   264  | 
    ((\<exists>x. \<forall>y. q(x) \<longleftrightarrow> q(y)) \<longleftrightarrow> ((\<exists>x. p(x)) \<longleftrightarrow> (\<forall>y. q(y))))\<close>
  | 
| 
61489
 | 
   265  | 
  by blast
  | 
| 
14236
 | 
   266  | 
  | 
| 
60770
 | 
   267  | 
text\<open>35\<close>
  | 
| 
69590
 | 
   268  | 
lemma \<open>\<exists>x y. P(x,y) \<longrightarrow> (\<forall>u v. P(u,v))\<close>
  | 
| 
61489
 | 
   269  | 
  by blast
  | 
| 
14236
 | 
   270  | 
  | 
| 
60770
 | 
   271  | 
text\<open>36\<close>
  | 
| 
61489
 | 
   272  | 
lemma
  | 
| 
69590
 | 
   273  | 
  \<open>(\<forall>x. \<exists>y. J(x,y)) \<and>
  | 
| 
61489
 | 
   274  | 
    (\<forall>x. \<exists>y. G(x,y)) \<and>
  | 
| 
 | 
   275  | 
    (\<forall>x y. J(x,y) \<or> G(x,y) \<longrightarrow> (\<forall>z. J(y,z) \<or> G(y,z) \<longrightarrow> H(x,z)))
  | 
| 
69590
 | 
   276  | 
  \<longrightarrow> (\<forall>x. \<exists>y. H(x,y))\<close>
  | 
| 
61489
 | 
   277  | 
  by blast
  | 
| 
14236
 | 
   278  | 
  | 
| 
60770
 | 
   279  | 
text\<open>37\<close>
  | 
| 
61489
 | 
   280  | 
lemma
  | 
| 
69590
 | 
   281  | 
  \<open>(\<forall>z. \<exists>w. \<forall>x. \<exists>y.
  | 
| 
61489
 | 
   282  | 
    (P(x,z) \<longrightarrow> P(y,w)) \<and> P(y,z) \<and> (P(y,w) \<longrightarrow> (\<exists>u. Q(u,w)))) \<and>
  | 
| 
 | 
   283  | 
    (\<forall>x z. \<not> P(x,z) \<longrightarrow> (\<exists>y. Q(y,z))) \<and>
  | 
| 
 | 
   284  | 
    ((\<exists>x y. Q(x,y)) \<longrightarrow> (\<forall>x. R(x,x)))
  | 
| 
69590
 | 
   285  | 
  \<longrightarrow> (\<forall>x. \<exists>y. R(x,y))\<close>
  | 
| 
61489
 | 
   286  | 
  by blast
  | 
| 
14236
 | 
   287  | 
  | 
| 
60770
 | 
   288  | 
text\<open>38\<close>
  | 
| 
61489
 | 
   289  | 
lemma
  | 
| 
69590
 | 
   290  | 
  \<open>(\<forall>x. p(a) \<and> (p(x) \<longrightarrow> (\<exists>y. p(y) \<and> r(x,y))) \<longrightarrow>
  | 
| 
61489
 | 
   291  | 
    (\<exists>z. \<exists>w. p(z) \<and> r(x,w) \<and> r(w,z)))  \<longleftrightarrow>
  | 
| 
 | 
   292  | 
    (\<forall>x. (\<not> p(a) \<or> p(x) \<or> (\<exists>z. \<exists>w. p(z) \<and> r(x,w) \<and> r(w,z))) \<and>
  | 
| 
 | 
   293  | 
      (\<not> p(a) \<or> \<not> (\<exists>y. p(y) \<and> r(x,y)) \<or>
  | 
| 
69590
 | 
   294  | 
      (\<exists>z. \<exists>w. p(z) \<and> r(x,w) \<and> r(w,z))))\<close>
  | 
| 
61489
 | 
   295  | 
  by blast
  | 
| 
14236
 | 
   296  | 
  | 
| 
60770
 | 
   297  | 
text\<open>39\<close>
  | 
| 
69590
 | 
   298  | 
lemma \<open>\<not> (\<exists>x. \<forall>y. F(y,x) \<longleftrightarrow> \<not> F(y,y))\<close>
  | 
| 
61489
 | 
   299  | 
  by blast
  | 
| 
14236
 | 
   300  | 
  | 
| 
61489
 | 
   301  | 
text\<open>40. AMENDED\<close>
  | 
| 
 | 
   302  | 
lemma
  | 
| 
69590
 | 
   303  | 
  \<open>(\<exists>y. \<forall>x. F(x,y) \<longleftrightarrow> F(x,x)) \<longrightarrow>
  | 
| 
 | 
   304  | 
    \<not> (\<forall>x. \<exists>y. \<forall>z. F(z,y) \<longleftrightarrow> \<not> F(z,x))\<close>
  | 
| 
61489
 | 
   305  | 
  by blast
  | 
| 
14236
 | 
   306  | 
  | 
| 
60770
 | 
   307  | 
text\<open>41\<close>
  | 
| 
61489
 | 
   308  | 
lemma
  | 
| 
69590
 | 
   309  | 
  \<open>(\<forall>z. \<exists>y. \<forall>x. f(x,y) \<longleftrightarrow> f(x,z) \<and> \<not> f(x,x))
  | 
| 
 | 
   310  | 
    \<longrightarrow> \<not> (\<exists>z. \<forall>x. f(x,z))\<close>
  | 
| 
61489
 | 
   311  | 
  by blast
  | 
| 
14236
 | 
   312  | 
  | 
| 
60770
 | 
   313  | 
text\<open>42\<close>
  | 
| 
69590
 | 
   314  | 
lemma \<open>\<not> (\<exists>y. \<forall>x. p(x,y) \<longleftrightarrow> \<not> (\<exists>z. p(x,z) \<and> p(z,x)))\<close>
  | 
| 
61489
 | 
   315  | 
  by blast
  | 
| 
14236
 | 
   316  | 
  | 
| 
60770
 | 
   317  | 
text\<open>43\<close>
  | 
| 
61489
 | 
   318  | 
lemma
  | 
| 
69590
 | 
   319  | 
  \<open>(\<forall>x. \<forall>y. q(x,y) \<longleftrightarrow> (\<forall>z. p(z,x) \<longleftrightarrow> p(z,y)))
  | 
| 
 | 
   320  | 
    \<longrightarrow> (\<forall>x. \<forall>y. q(x,y) \<longleftrightarrow> q(y,x))\<close>
  | 
| 
61489
 | 
   321  | 
  by blast
  | 
| 
14236
 | 
   322  | 
  | 
| 
61489
 | 
   323  | 
text \<open>
  | 
| 
62020
 | 
   324  | 
  Other proofs: Can use \<open>auto\<close>, which cheats by using rewriting!
  | 
| 
 | 
   325  | 
  \<open>Deepen_tac\<close> alone requires 253 secs.  Or
  | 
| 
 | 
   326  | 
  \<open>by (mini_tac 1 THEN Deepen_tac 5 1)\<close>.
  | 
| 
61489
 | 
   327  | 
\<close>
  | 
| 
14236
 | 
   328  | 
  | 
| 
60770
 | 
   329  | 
text\<open>44\<close>
  | 
| 
61489
 | 
   330  | 
lemma
  | 
| 
69590
 | 
   331  | 
  \<open>(\<forall>x. f(x) \<longrightarrow> (\<exists>y. g(y) \<and> h(x,y) \<and> (\<exists>y. g(y) \<and> \<not> h(x,y)))) \<and>
  | 
| 
61489
 | 
   332  | 
    (\<exists>x. j(x) \<and> (\<forall>y. g(y) \<longrightarrow> h(x,y)))
  | 
| 
69590
 | 
   333  | 
  \<longrightarrow> (\<exists>x. j(x) \<and> \<not> f(x))\<close>
  | 
| 
61489
 | 
   334  | 
  by blast
  | 
| 
14236
 | 
   335  | 
  | 
| 
60770
 | 
   336  | 
text\<open>45\<close>
  | 
| 
61489
 | 
   337  | 
lemma
  | 
| 
69590
 | 
   338  | 
  \<open>(\<forall>x. f(x) \<and> (\<forall>y. g(y) \<and> h(x,y) \<longrightarrow> j(x,y))
  | 
| 
61489
 | 
   339  | 
      \<longrightarrow> (\<forall>y. g(y) \<and> h(x,y) \<longrightarrow> k(y))) \<and>
  | 
| 
 | 
   340  | 
      \<not> (\<exists>y. l(y) \<and> k(y)) \<and>
  | 
| 
 | 
   341  | 
      (\<exists>x. f(x) \<and> (\<forall>y. h(x,y) \<longrightarrow> l(y)) \<and> (\<forall>y. g(y) \<and> h(x,y) \<longrightarrow> j(x,y)))
  | 
| 
69590
 | 
   342  | 
      \<longrightarrow> (\<exists>x. f(x) \<and> \<not> (\<exists>y. g(y) \<and> h(x,y)))\<close>
  | 
| 
61489
 | 
   343  | 
  by blast
  | 
| 
14236
 | 
   344  | 
  | 
| 
 | 
   345  | 
  | 
| 
60770
 | 
   346  | 
text\<open>46\<close>
  | 
| 
61489
 | 
   347  | 
lemma
  | 
| 
69590
 | 
   348  | 
  \<open>(\<forall>x. f(x) \<and> (\<forall>y. f(y) \<and> h(y,x) \<longrightarrow> g(y)) \<longrightarrow> g(x)) \<and>
  | 
| 
61489
 | 
   349  | 
      ((\<exists>x. f(x) \<and> \<not> g(x)) \<longrightarrow>
  | 
| 
 | 
   350  | 
       (\<exists>x. f(x) \<and> \<not> g(x) \<and> (\<forall>y. f(y) \<and> \<not> g(y) \<longrightarrow> j(x,y)))) \<and>
  | 
| 
 | 
   351  | 
      (\<forall>x y. f(x) \<and> f(y) \<and> h(x,y) \<longrightarrow> \<not> j(y,x))
  | 
| 
69590
 | 
   352  | 
      \<longrightarrow> (\<forall>x. f(x) \<longrightarrow> g(x))\<close>
  | 
| 
61489
 | 
   353  | 
  by blast
  | 
| 
14236
 | 
   354  | 
  | 
| 
 | 
   355  | 
  | 
| 
61489
 | 
   356  | 
subsection \<open>Problems (mainly) involving equality or functions\<close>
  | 
| 
14236
 | 
   357  | 
  | 
| 
60770
 | 
   358  | 
text\<open>48\<close>
  | 
| 
69590
 | 
   359  | 
lemma \<open>(a = b \<or> c = d) \<and> (a = c \<or> b = d) \<longrightarrow> a = d \<or> b = c\<close>
  | 
| 
61489
 | 
   360  | 
  by blast
  | 
| 
14236
 | 
   361  | 
  | 
| 
61489
 | 
   362  | 
text\<open>49. NOT PROVED AUTOMATICALLY. Hard because it involves substitution for
  | 
| 
 | 
   363  | 
  Vars; the type constraint ensures that x,y,z have the same type as a,b,u.\<close>
  | 
| 
 | 
   364  | 
lemma
  | 
| 
69590
 | 
   365  | 
  \<open>(\<exists>x y::'a. \<forall>z. z = x \<or> z = y) \<and> P(a) \<and> P(b) \<and> a \<noteq> b \<longrightarrow> (\<forall>u::'a. P(u))\<close>
  | 
| 
61489
 | 
   366  | 
  apply safe
  | 
| 
69590
 | 
   367  | 
  apply (rule_tac x = \<open>a\<close> in allE, assumption)
  | 
| 
 | 
   368  | 
  apply (rule_tac x = \<open>b\<close> in allE, assumption)
  | 
| 
62020
 | 
   369  | 
  apply fast  \<comment> \<open>blast's treatment of equality can't do it\<close>
  | 
| 
61489
 | 
   370  | 
  done
  | 
| 
14236
 | 
   371  | 
  | 
| 
61489
 | 
   372  | 
text\<open>50. (What has this to do with equality?)\<close>
  | 
| 
69590
 | 
   373  | 
lemma \<open>(\<forall>x. P(a,x) \<or> (\<forall>y. P(x,y))) \<longrightarrow> (\<exists>x. \<forall>y. P(x,y))\<close>
  | 
| 
61489
 | 
   374  | 
  by blast
  | 
| 
14236
 | 
   375  | 
  | 
| 
60770
 | 
   376  | 
text\<open>51\<close>
  | 
| 
61489
 | 
   377  | 
lemma
  | 
| 
69590
 | 
   378  | 
  \<open>(\<exists>z w. \<forall>x y. P(x,y) \<longleftrightarrow> (x = z \<and> y = w)) \<longrightarrow>
  | 
| 
 | 
   379  | 
    (\<exists>z. \<forall>x. \<exists>w. (\<forall>y. P(x,y) \<longleftrightarrow> y=w) \<longleftrightarrow> x = z)\<close>
  | 
| 
61489
 | 
   380  | 
  by blast
  | 
| 
14236
 | 
   381  | 
  | 
| 
60770
 | 
   382  | 
text\<open>52\<close>
  | 
| 
 | 
   383  | 
text\<open>Almost the same as 51.\<close>
  | 
| 
61489
 | 
   384  | 
lemma
  | 
| 
69590
 | 
   385  | 
  \<open>(\<exists>z w. \<forall>x y. P(x,y) \<longleftrightarrow> (x = z \<and> y = w)) \<longrightarrow>
  | 
| 
 | 
   386  | 
    (\<exists>w. \<forall>y. \<exists>z. (\<forall>x. P(x,y) \<longleftrightarrow> x = z) \<longleftrightarrow> y = w)\<close>
  | 
| 
61489
 | 
   387  | 
  by blast
  | 
| 
14236
 | 
   388  | 
  | 
| 
60770
 | 
   389  | 
text\<open>55\<close>
  | 
| 
 | 
   390  | 
text\<open>Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).
  | 
| 
 | 
   391  | 
  fast DISCOVERS who killed Agatha.\<close>
  | 
| 
61489
 | 
   392  | 
schematic_goal
  | 
| 
69590
 | 
   393  | 
  \<open>lives(agatha) \<and> lives(butler) \<and> lives(charles) \<and>
  | 
| 
61489
 | 
   394  | 
   (killed(agatha,agatha) \<or> killed(butler,agatha) \<or> killed(charles,agatha)) \<and>
  | 
| 
 | 
   395  | 
   (\<forall>x y. killed(x,y) \<longrightarrow> hates(x,y) \<and> \<not> richer(x,y)) \<and>
  | 
| 
 | 
   396  | 
   (\<forall>x. hates(agatha,x) \<longrightarrow> \<not> hates(charles,x)) \<and>
  | 
| 
 | 
   397  | 
   (hates(agatha,agatha) \<and> hates(agatha,charles)) \<and>
  | 
| 
 | 
   398  | 
   (\<forall>x. lives(x) \<and> \<not> richer(x,agatha) \<longrightarrow> hates(butler,x)) \<and>
  | 
| 
 | 
   399  | 
   (\<forall>x. hates(agatha,x) \<longrightarrow> hates(butler,x)) \<and>
  | 
| 
 | 
   400  | 
   (\<forall>x. \<not> hates(x,agatha) \<or> \<not> hates(x,butler) \<or> \<not> hates(x,charles)) \<longrightarrow>
  | 
| 
69590
 | 
   401  | 
    killed(?who,agatha)\<close>
  | 
| 
62020
 | 
   402  | 
  by fast  \<comment> \<open>MUCH faster than blast\<close>
  | 
| 
14236
 | 
   403  | 
  | 
| 
 | 
   404  | 
  | 
| 
60770
 | 
   405  | 
text\<open>56\<close>
  | 
| 
69590
 | 
   406  | 
lemma \<open>(\<forall>x. (\<exists>y. P(y) \<and> x = f(y)) \<longrightarrow> P(x)) \<longleftrightarrow> (\<forall>x. P(x) \<longrightarrow> P(f(x)))\<close>
  | 
| 
61489
 | 
   407  | 
  by blast
  | 
| 
14236
 | 
   408  | 
  | 
| 
60770
 | 
   409  | 
text\<open>57\<close>
  | 
| 
61489
 | 
   410  | 
lemma
  | 
| 
69590
 | 
   411  | 
  \<open>P(f(a,b), f(b,c)) \<and> P(f(b,c), f(a,c)) \<and>
  | 
| 
 | 
   412  | 
    (\<forall>x y z. P(x,y) \<and> P(y,z) \<longrightarrow> P(x,z)) \<longrightarrow> P(f(a,b), f(a,c))\<close>
  | 
| 
61489
 | 
   413  | 
  by blast
  | 
| 
14236
 | 
   414  | 
  | 
| 
60770
 | 
   415  | 
text\<open>58  NOT PROVED AUTOMATICALLY\<close>
  | 
| 
69590
 | 
   416  | 
lemma \<open>(\<forall>x y. f(x) = g(y)) \<longrightarrow> (\<forall>x y. f(f(x)) = f(g(y)))\<close>
  | 
| 
61489
 | 
   417  | 
  by (slow elim: subst_context)
  | 
| 
14236
 | 
   418  | 
  | 
| 
 | 
   419  | 
  | 
| 
60770
 | 
   420  | 
text\<open>59\<close>
  | 
| 
69590
 | 
   421  | 
lemma \<open>(\<forall>x. P(x) \<longleftrightarrow> \<not> P(f(x))) \<longrightarrow> (\<exists>x. P(x) \<and> \<not> P(f(x)))\<close>
  | 
| 
61489
 | 
   422  | 
  by blast
  | 
| 
14236
 | 
   423  | 
  | 
| 
60770
 | 
   424  | 
text\<open>60\<close>
  | 
| 
69590
 | 
   425  | 
lemma \<open>\<forall>x. P(x,f(x)) \<longleftrightarrow> (\<exists>y. (\<forall>z. P(z,y) \<longrightarrow> P(z,f(x))) \<and> P(x,y))\<close>
  | 
| 
61489
 | 
   426  | 
  by blast
  | 
| 
14236
 | 
   427  | 
  | 
| 
60770
 | 
   428  | 
text\<open>62 as corrected in JAR 18 (1997), page 135\<close>
  | 
| 
61489
 | 
   429  | 
lemma
  | 
| 
69590
 | 
   430  | 
  \<open>(\<forall>x. p(a) \<and> (p(x) \<longrightarrow> p(f(x))) \<longrightarrow> p(f(f(x)))) \<longleftrightarrow>
  | 
| 
61489
 | 
   431  | 
    (\<forall>x. (\<not> p(a) \<or> p(x) \<or> p(f(f(x)))) \<and>
  | 
| 
69590
 | 
   432  | 
      (\<not> p(a) \<or> \<not> p(f(x)) \<or> p(f(f(x)))))\<close>
  | 
| 
61489
 | 
   433  | 
  by blast
  | 
| 
14236
 | 
   434  | 
  | 
| 
61489
 | 
   435  | 
text \<open>From Davis, Obvious Logical Inferences, IJCAI-81, 530-531
  | 
| 
60770
 | 
   436  | 
  fast indeed copes!\<close>
  | 
| 
61489
 | 
   437  | 
lemma
  | 
| 
69590
 | 
   438  | 
  \<open>(\<forall>x. F(x) \<and> \<not> G(x) \<longrightarrow> (\<exists>y. H(x,y) \<and> J(y))) \<and>
  | 
| 
61489
 | 
   439  | 
    (\<exists>x. K(x) \<and> F(x) \<and> (\<forall>y. H(x,y) \<longrightarrow> K(y))) \<and>
  | 
| 
69590
 | 
   440  | 
    (\<forall>x. K(x) \<longrightarrow> \<not> G(x)) \<longrightarrow> (\<exists>x. K(x) \<and> J(x))\<close>
  | 
| 
61489
 | 
   441  | 
  by fast
  | 
| 
14236
 | 
   442  | 
  | 
| 
61489
 | 
   443  | 
text \<open>From Rudnicki, Obvious Inferences, JAR 3 (1987), 383-393.
  | 
| 
60770
 | 
   444  | 
  It does seem obvious!\<close>
  | 
| 
61489
 | 
   445  | 
lemma
  | 
| 
69590
 | 
   446  | 
  \<open>(\<forall>x. F(x) \<and> \<not> G(x) \<longrightarrow> (\<exists>y. H(x,y) \<and> J(y))) \<and>
  | 
| 
61489
 | 
   447  | 
    (\<exists>x. K(x) \<and> F(x) \<and> (\<forall>y. H(x,y) \<longrightarrow> K(y))) \<and>
  | 
| 
69590
 | 
   448  | 
    (\<forall>x. K(x) \<longrightarrow> \<not> G(x)) \<longrightarrow> (\<exists>x. K(x) \<longrightarrow> \<not> G(x))\<close>
  | 
| 
61489
 | 
   449  | 
  by fast
  | 
| 
14236
 | 
   450  | 
  | 
| 
61489
 | 
   451  | 
text \<open>Halting problem: Formulation of Li Dafa (AAR Newsletter 27, Oct 1994.)
  | 
| 
 | 
   452  | 
  author U. Egly.\<close>
  | 
| 
 | 
   453  | 
lemma
  | 
| 
69590
 | 
   454  | 
  \<open>((\<exists>x. A(x) \<and> (\<forall>y. C(y) \<longrightarrow> (\<forall>z. D(x,y,z)))) \<longrightarrow>
  | 
| 
61489
 | 
   455  | 
     (\<exists>w. C(w) \<and> (\<forall>y. C(y) \<longrightarrow> (\<forall>z. D(w,y,z)))))
  | 
| 
 | 
   456  | 
    \<and>
  | 
| 
 | 
   457  | 
    (\<forall>w. C(w) \<and> (\<forall>u. C(u) \<longrightarrow> (\<forall>v. D(w,u,v))) \<longrightarrow>
  | 
| 
 | 
   458  | 
          (\<forall>y z.
  | 
| 
 | 
   459  | 
              (C(y) \<and> P(y,z) \<longrightarrow> Q(w,y,z) \<and> OO(w,g)) \<and>
  | 
| 
 | 
   460  | 
              (C(y) \<and> \<not> P(y,z) \<longrightarrow> Q(w,y,z) \<and> OO(w,b))))
  | 
| 
 | 
   461  | 
    \<and>
  | 
| 
 | 
   462  | 
    (\<forall>w. C(w) \<and>
  | 
| 
 | 
   463  | 
      (\<forall>y z.
  | 
| 
 | 
   464  | 
          (C(y) \<and> P(y,z) \<longrightarrow> Q(w,y,z) \<and> OO(w,g)) \<and>
  | 
| 
 | 
   465  | 
          (C(y) \<and> \<not> P(y,z) \<longrightarrow> Q(w,y,z) \<and> OO(w,b))) \<longrightarrow>
  | 
| 
 | 
   466  | 
      (\<exists>v. C(v) \<and>
  | 
| 
 | 
   467  | 
            (\<forall>y. ((C(y) \<and> Q(w,y,y)) \<and> OO(w,g) \<longrightarrow> \<not> P(v,y)) \<and>
  | 
| 
 | 
   468  | 
                    ((C(y) \<and> Q(w,y,y)) \<and> OO(w,b) \<longrightarrow> P(v,y) \<and> OO(v,b)))))
  | 
| 
69590
 | 
   469  | 
     \<longrightarrow> \<not> (\<exists>x. A(x) \<and> (\<forall>y. C(y) \<longrightarrow> (\<forall>z. D(x,y,z))))\<close>
  | 
| 
61489
 | 
   470  | 
  by (blast 12)
  | 
| 
62020
 | 
   471  | 
    \<comment> \<open>Needed because the search for depths below 12 is very slow.\<close>
  | 
| 
14236
 | 
   472  | 
  | 
| 
 | 
   473  | 
  | 
| 
61489
 | 
   474  | 
text \<open>
  | 
| 
 | 
   475  | 
  Halting problem II: credited to M. Bruschi by Li Dafa in JAR 18(1),
  | 
| 
 | 
   476  | 
  p. 105.
  | 
| 
 | 
   477  | 
\<close>
  | 
| 
 | 
   478  | 
lemma
  | 
| 
69590
 | 
   479  | 
  \<open>((\<exists>x. A(x) \<and> (\<forall>y. C(y) \<longrightarrow> (\<forall>z. D(x,y,z)))) \<longrightarrow>
  | 
| 
61489
 | 
   480  | 
     (\<exists>w. C(w) \<and> (\<forall>y. C(y) \<longrightarrow> (\<forall>z. D(w,y,z)))))
  | 
| 
 | 
   481  | 
    \<and>
  | 
| 
 | 
   482  | 
    (\<forall>w. C(w) \<and> (\<forall>u. C(u) \<longrightarrow> (\<forall>v. D(w,u,v))) \<longrightarrow>
  | 
| 
 | 
   483  | 
          (\<forall>y z.
  | 
| 
 | 
   484  | 
              (C(y) \<and> P(y,z) \<longrightarrow> Q(w,y,z) \<and> OO(w,g)) \<and>
  | 
| 
 | 
   485  | 
              (C(y) \<and> \<not> P(y,z) \<longrightarrow> Q(w,y,z) \<and> OO(w,b))))
  | 
| 
 | 
   486  | 
    \<and>
  | 
| 
 | 
   487  | 
    ((\<exists>w. C(w) \<and> (\<forall>y. (C(y) \<and> P(y,y) \<longrightarrow> Q(w,y,y) \<and> OO(w,g)) \<and>
  | 
| 
 | 
   488  | 
                           (C(y) \<and> \<not> P(y,y) \<longrightarrow> Q(w,y,y) \<and> OO(w,b))))
  | 
| 
 | 
   489  | 
     \<longrightarrow>
  | 
| 
 | 
   490  | 
     (\<exists>v. C(v) \<and> (\<forall>y. (C(y) \<and> P(y,y) \<longrightarrow> P(v,y) \<and> OO(v,g)) \<and>
  | 
| 
 | 
   491  | 
                           (C(y) \<and> \<not> P(y,y) \<longrightarrow> P(v,y) \<and> OO(v,b)))))
  | 
| 
 | 
   492  | 
    \<longrightarrow>
  | 
| 
 | 
   493  | 
    ((\<exists>v. C(v) \<and> (\<forall>y. (C(y) \<and> P(y,y) \<longrightarrow> P(v,y) \<and> OO(v,g)) \<and>
  | 
| 
 | 
   494  | 
                           (C(y) \<and> \<not> P(y,y) \<longrightarrow> P(v,y) \<and> OO(v,b))))
  | 
| 
 | 
   495  | 
     \<longrightarrow>
  | 
| 
 | 
   496  | 
     (\<exists>u. C(u) \<and> (\<forall>y. (C(y) \<and> P(y,y) \<longrightarrow> \<not> P(u,y)) \<and>
  | 
| 
 | 
   497  | 
                           (C(y) \<and> \<not> P(y,y) \<longrightarrow> P(u,y) \<and> OO(u,b)))))
  | 
| 
69590
 | 
   498  | 
     \<longrightarrow> \<not> (\<exists>x. A(x) \<and> (\<forall>y. C(y) \<longrightarrow> (\<forall>z. D(x,y,z))))\<close>
  | 
| 
61489
 | 
   499  | 
  by blast
  | 
| 
14236
 | 
   500  | 
  | 
| 
61489
 | 
   501  | 
text \<open>Challenge found on info-hol.\<close>
  | 
| 
69590
 | 
   502  | 
lemma \<open>\<forall>x. \<exists>v w. \<forall>y z. P(x) \<and> Q(y) \<longrightarrow> (P(v) \<or> R(w)) \<and> (R(z) \<longrightarrow> Q(v))\<close>
  | 
| 
61489
 | 
   503  | 
  by blast
  | 
| 
14236
 | 
   504  | 
  | 
| 
61489
 | 
   505  | 
text \<open>
  | 
| 
 | 
   506  | 
  Attributed to Lewis Carroll by S. G. Pulman. The first or last assumption
  | 
| 
 | 
   507  | 
  can be deleted.\<close>
  | 
| 
 | 
   508  | 
lemma
  | 
| 
69590
 | 
   509  | 
  \<open>(\<forall>x. honest(x) \<and> industrious(x) \<longrightarrow> healthy(x)) \<and>
  | 
| 
61489
 | 
   510  | 
    \<not> (\<exists>x. grocer(x) \<and> healthy(x)) \<and>
  | 
| 
 | 
   511  | 
    (\<forall>x. industrious(x) \<and> grocer(x) \<longrightarrow> honest(x)) \<and>
  | 
| 
 | 
   512  | 
    (\<forall>x. cyclist(x) \<longrightarrow> industrious(x)) \<and>
  | 
| 
 | 
   513  | 
    (\<forall>x. \<not> healthy(x) \<and> cyclist(x) \<longrightarrow> \<not> honest(x))
  | 
| 
69590
 | 
   514  | 
    \<longrightarrow> (\<forall>x. grocer(x) \<longrightarrow> \<not> cyclist(x))\<close>
  | 
| 
61489
 | 
   515  | 
  by blast
  | 
| 
14236
 | 
   516  | 
  | 
| 
 | 
   517  | 
  | 
| 
 | 
   518  | 
(*Runtimes for old versions of this file:
  | 
| 
61489
 | 
   519  | 
Thu Jul 23 1992: loaded in 467s using iffE [on SPARC2]
  | 
| 
 | 
   520  | 
Mon Nov 14 1994: loaded in 144s [on SPARC10, with deepen_tac]
  | 
| 
 | 
   521  | 
Wed Nov 16 1994: loaded in 138s [after addition of norm_term_skip]
  | 
| 
 | 
   522  | 
Mon Nov 21 1994: loaded in 131s [DEPTH_FIRST suppressing repetitions]
  | 
| 
14236
 | 
   523  | 
  | 
| 
 | 
   524  | 
Further runtimes on a Sun-4
  | 
| 
61489
 | 
   525  | 
Tue Mar  4 1997: loaded in 93s (version 94-7)
  | 
| 
14236
 | 
   526  | 
Tue Mar  4 1997: loaded in 89s
  | 
| 
 | 
   527  | 
Thu Apr  3 1997: loaded in 44s--using mostly Blast_tac
  | 
| 
 | 
   528  | 
Thu Apr  3 1997: loaded in 96s--addition of two Halting Probs
  | 
| 
 | 
   529  | 
Thu Apr  3 1997: loaded in 98s--using lim-1 for all haz rules
  | 
| 
 | 
   530  | 
Tue Dec  2 1997: loaded in 107s--added 46; new equalSubst
  | 
| 
 | 
   531  | 
Fri Dec 12 1997: loaded in 91s--faster proof reconstruction
  | 
| 
 | 
   532  | 
Thu Dec 18 1997: loaded in 94s--two new "obvious theorems" (??)
  | 
| 
 | 
   533  | 
*)
  | 
| 
 | 
   534  | 
  | 
| 
 | 
   535  | 
end
  |