| author | wenzelm | 
| Wed, 26 Dec 2018 15:28:23 +0100 | |
| changeset 69503 | c2a736883b01 | 
| parent 69420 | 85b0df070afe | 
| child 69597 | ff784d5a5bfb | 
| permissions | -rw-r--r-- | 
| 41959 | 1  | 
(* Title: HOL/ex/Classical.thy  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
2  | 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
3  | 
Copyright 1994 University of Cambridge  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
4  | 
*)  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
5  | 
|
| 61343 | 6  | 
section\<open>Classical Predicate Calculus Problems\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
7  | 
|
| 16417 | 8  | 
theory Classical imports Main begin  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
9  | 
|
| 61343 | 10  | 
subsection\<open>Traditional Classical Reasoner\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
11  | 
|
| 61343 | 12  | 
text\<open>The machine "griffon" mentioned below is a 2.5GHz Power Mac G5.\<close>  | 
| 16011 | 13  | 
|
| 61933 | 14  | 
text\<open>Taken from \<open>FOL/Classical.thy\<close>. When porting examples from  | 
15  | 
first-order logic, beware of the precedence of \<open>=\<close> versus \<open>\<leftrightarrow>\<close>.\<close>  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
16  | 
|
| 69420 | 17  | 
lemma "(P \<longrightarrow> Q \<or> R) \<longrightarrow> (P\<longrightarrow>Q) \<or> (P\<longrightarrow>R)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
18  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
19  | 
|
| 61343 | 20  | 
text\<open>If and only if\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
21  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
22  | 
lemma "(P=Q) = (Q = (P::bool))"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
23  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
24  | 
|
| 69420 | 25  | 
lemma "\<not> (P = (\<not>P))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
26  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
27  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
28  | 
|
| 61343 | 29  | 
text\<open>Sample problems from  | 
| 14249 | 30  | 
F. J. Pelletier,  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
31  | 
Seventy-Five Problems for Testing Automatic Theorem Provers,  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
32  | 
J. Automated Reasoning 2 (1986), 191-216.  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
33  | 
Errata, JAR 4 (1988), 236-236.  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
34  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
35  | 
The hardest problems -- judging by experience with several theorem provers,  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
36  | 
including matrix ones -- are 34 and 43.  | 
| 61343 | 37  | 
\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
38  | 
|
| 61343 | 39  | 
subsubsection\<open>Pelletier's examples\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
40  | 
|
| 61343 | 41  | 
text\<open>1\<close>  | 
| 69420 | 42  | 
lemma "(P\<longrightarrow>Q) = (\<not>Q \<longrightarrow> \<not>P)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
43  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
44  | 
|
| 61343 | 45  | 
text\<open>2\<close>  | 
| 69420 | 46  | 
lemma "(\<not> \<not> P) = P"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
47  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
48  | 
|
| 61343 | 49  | 
text\<open>3\<close>  | 
| 69420 | 50  | 
lemma "\<not>(P\<longrightarrow>Q) \<longrightarrow> (Q\<longrightarrow>P)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
51  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
52  | 
|
| 61343 | 53  | 
text\<open>4\<close>  | 
| 69420 | 54  | 
lemma "(\<not>P\<longrightarrow>Q) = (\<not>Q \<longrightarrow> P)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
55  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
56  | 
|
| 61343 | 57  | 
text\<open>5\<close>  | 
| 69420 | 58  | 
lemma "((P\<or>Q)\<longrightarrow>(P\<or>R)) \<longrightarrow> (P\<or>(Q\<longrightarrow>R))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
59  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
60  | 
|
| 61343 | 61  | 
text\<open>6\<close>  | 
| 69420 | 62  | 
lemma "P \<or> \<not> P"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
63  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
64  | 
|
| 61343 | 65  | 
text\<open>7\<close>  | 
| 69420 | 66  | 
lemma "P \<or> \<not> \<not> \<not> P"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
67  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
68  | 
|
| 61343 | 69  | 
text\<open>8. Peirce's law\<close>  | 
| 69420 | 70  | 
lemma "((P\<longrightarrow>Q) \<longrightarrow> P) \<longrightarrow> P"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
71  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
72  | 
|
| 61343 | 73  | 
text\<open>9\<close>  | 
| 69420 | 74  | 
lemma "((P\<or>Q) \<and> (\<not>P\<or>Q) \<and> (P\<or> \<not>Q)) \<longrightarrow> \<not> (\<not>P \<or> \<not>Q)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
75  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
76  | 
|
| 61343 | 77  | 
text\<open>10\<close>  | 
| 69420 | 78  | 
lemma "(Q\<longrightarrow>R) \<and> (R\<longrightarrow>P\<and>Q) \<and> (P\<longrightarrow>Q\<or>R) \<longrightarrow> (P=Q)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
79  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
80  | 
|
| 61343 | 81  | 
text\<open>11. Proved in each direction (incorrectly, says Pelletier!!)\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
82  | 
lemma "P=(P::bool)"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
83  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
84  | 
|
| 61343 | 85  | 
text\<open>12. "Dijkstra's law"\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
86  | 
lemma "((P = Q) = R) = (P = (Q = R))"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
87  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
88  | 
|
| 61343 | 89  | 
text\<open>13. Distributive law\<close>  | 
| 69420 | 90  | 
lemma "(P \<or> (Q \<and> R)) = ((P \<or> Q) \<and> (P \<or> R))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
91  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
92  | 
|
| 61343 | 93  | 
text\<open>14\<close>  | 
| 69420 | 94  | 
lemma "(P = Q) = ((Q \<or> \<not>P) \<and> (\<not>Q\<or>P))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
95  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
96  | 
|
| 61343 | 97  | 
text\<open>15\<close>  | 
| 69420 | 98  | 
lemma "(P \<longrightarrow> Q) = (\<not>P \<or> Q)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
99  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
100  | 
|
| 61343 | 101  | 
text\<open>16\<close>  | 
| 69420 | 102  | 
lemma "(P\<longrightarrow>Q) \<or> (Q\<longrightarrow>P)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
103  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
104  | 
|
| 61343 | 105  | 
text\<open>17\<close>  | 
| 69420 | 106  | 
lemma "((P \<and> (Q\<longrightarrow>R))\<longrightarrow>S) = ((\<not>P \<or> Q \<or> S) \<and> (\<not>P \<or> \<not>R \<or> S))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
107  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
108  | 
|
| 61343 | 109  | 
subsubsection\<open>Classical Logic: examples with quantifiers\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
110  | 
|
| 69420 | 111  | 
lemma "(\<forall>x. P(x) \<and> Q(x)) = ((\<forall>x. P(x)) \<and> (\<forall>x. Q(x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
112  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
113  | 
|
| 69420 | 114  | 
lemma "(\<exists>x. P\<longrightarrow>Q(x)) = (P \<longrightarrow> (\<exists>x. Q(x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
115  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
116  | 
|
| 69420 | 117  | 
lemma "(\<exists>x. P(x)\<longrightarrow>Q) = ((\<forall>x. P(x)) \<longrightarrow> Q)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
118  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
119  | 
|
| 69420 | 120  | 
lemma "((\<forall>x. P(x)) \<or> Q) = (\<forall>x. P(x) \<or> Q)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
121  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
122  | 
|
| 61343 | 123  | 
text\<open>From Wishnu Prasetya\<close>  | 
| 69420 | 124  | 
lemma "(\<forall>x. Q(x) \<longrightarrow> R(x)) \<and> \<not>R(a) \<and> (\<forall>x. \<not>R(x) \<and> \<not>Q(x) \<longrightarrow> P(b) \<or> Q(b))  | 
125  | 
\<longrightarrow> P(b) \<or> R(b)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
126  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
127  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
128  | 
|
| 61343 | 129  | 
subsubsection\<open>Problems requiring quantifier duplication\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
130  | 
|
| 61343 | 131  | 
text\<open>Theorem B of Peter Andrews, Theorem Proving via General Matings,  | 
132  | 
JACM 28 (1981).\<close>  | 
|
| 69420 | 133  | 
lemma "(\<exists>x. \<forall>y. P(x) = P(y)) \<longrightarrow> ((\<exists>x. P(x)) = (\<forall>y. P(y)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
134  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
135  | 
|
| 61343 | 136  | 
text\<open>Needs multiple instantiation of the quantifier.\<close>  | 
| 69420 | 137  | 
lemma "(\<forall>x. P(x)\<longrightarrow>P(f(x))) \<and> P(d)\<longrightarrow>P(f(f(f(d))))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
138  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
139  | 
|
| 61343 | 140  | 
text\<open>Needs double instantiation of the quantifier\<close>  | 
| 69420 | 141  | 
lemma "\<exists>x. P(x) \<longrightarrow> P(a) \<and> P(b)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
142  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
143  | 
|
| 69420 | 144  | 
lemma "\<exists>z. P(z) \<longrightarrow> (\<forall>x. P(x))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
145  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
146  | 
|
| 69420 | 147  | 
lemma "\<exists>x. (\<exists>y. P(y)) \<longrightarrow> P(x)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
148  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
149  | 
|
| 61343 | 150  | 
subsubsection\<open>Hard examples with quantifiers\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
151  | 
|
| 61343 | 152  | 
text\<open>Problem 18\<close>  | 
| 69420 | 153  | 
lemma "\<exists>y. \<forall>x. P(y)\<longrightarrow>P(x)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
154  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
155  | 
|
| 61343 | 156  | 
text\<open>Problem 19\<close>  | 
| 69420 | 157  | 
lemma "\<exists>x. \<forall>y z. (P(y)\<longrightarrow>Q(z)) \<longrightarrow> (P(x)\<longrightarrow>Q(x))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
158  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
159  | 
|
| 61343 | 160  | 
text\<open>Problem 20\<close>  | 
| 69420 | 161  | 
lemma "(\<forall>x y. \<exists>z. \<forall>w. (P(x)\<and>Q(y)\<longrightarrow>R(z)\<and>S(w)))  | 
162  | 
\<longrightarrow> (\<exists>x y. P(x) \<and> Q(y)) \<longrightarrow> (\<exists>z. R(z))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
163  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
164  | 
|
| 61343 | 165  | 
text\<open>Problem 21\<close>  | 
| 69420 | 166  | 
lemma "(\<exists>x. P\<longrightarrow>Q(x)) \<and> (\<exists>x. Q(x)\<longrightarrow>P) \<longrightarrow> (\<exists>x. P=Q(x))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
167  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
168  | 
|
| 61343 | 169  | 
text\<open>Problem 22\<close>  | 
| 69420 | 170  | 
lemma "(\<forall>x. P = Q(x)) \<longrightarrow> (P = (\<forall>x. Q(x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
171  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
172  | 
|
| 61343 | 173  | 
text\<open>Problem 23\<close>  | 
| 69420 | 174  | 
lemma "(\<forall>x. P \<or> Q(x)) = (P \<or> (\<forall>x. Q(x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
175  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
176  | 
|
| 61343 | 177  | 
text\<open>Problem 24\<close>  | 
| 69420 | 178  | 
lemma "\<not>(\<exists>x. S(x)\<and>Q(x)) \<and> (\<forall>x. P(x) \<longrightarrow> Q(x)\<or>R(x)) \<and>  | 
179  | 
(\<not>(\<exists>x. P(x)) \<longrightarrow> (\<exists>x. Q(x))) \<and> (\<forall>x. Q(x)\<or>R(x) \<longrightarrow> S(x))  | 
|
180  | 
\<longrightarrow> (\<exists>x. P(x)\<and>R(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
181  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
182  | 
|
| 61343 | 183  | 
text\<open>Problem 25\<close>  | 
| 69420 | 184  | 
lemma "(\<exists>x. P(x)) \<and>  | 
185  | 
(\<forall>x. L(x) \<longrightarrow> \<not> (M(x) \<and> R(x))) \<and>  | 
|
186  | 
(\<forall>x. P(x) \<longrightarrow> (M(x) \<and> L(x))) \<and>  | 
|
187  | 
((\<forall>x. P(x)\<longrightarrow>Q(x)) \<or> (\<exists>x. P(x)\<and>R(x)))  | 
|
188  | 
\<longrightarrow> (\<exists>x. Q(x)\<and>P(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
189  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
190  | 
|
| 61343 | 191  | 
text\<open>Problem 26\<close>  | 
| 69420 | 192  | 
lemma "((\<exists>x. p(x)) = (\<exists>x. q(x))) \<and>  | 
193  | 
(\<forall>x. \<forall>y. p(x) \<and> q(y) \<longrightarrow> (r(x) = s(y)))  | 
|
194  | 
\<longrightarrow> ((\<forall>x. p(x)\<longrightarrow>r(x)) = (\<forall>x. q(x)\<longrightarrow>s(x)))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
195  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
196  | 
|
| 61343 | 197  | 
text\<open>Problem 27\<close>  | 
| 69420 | 198  | 
lemma "(\<exists>x. P(x) \<and> \<not>Q(x)) \<and>  | 
199  | 
(\<forall>x. P(x) \<longrightarrow> R(x)) \<and>  | 
|
200  | 
(\<forall>x. M(x) \<and> L(x) \<longrightarrow> P(x)) \<and>  | 
|
201  | 
((\<exists>x. R(x) \<and> \<not> Q(x)) \<longrightarrow> (\<forall>x. L(x) \<longrightarrow> \<not> R(x)))  | 
|
202  | 
\<longrightarrow> (\<forall>x. M(x) \<longrightarrow> \<not>L(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
203  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
204  | 
|
| 61343 | 205  | 
text\<open>Problem 28. AMENDED\<close>  | 
| 69420 | 206  | 
lemma "(\<forall>x. P(x) \<longrightarrow> (\<forall>x. Q(x))) \<and>  | 
207  | 
((\<forall>x. Q(x)\<or>R(x)) \<longrightarrow> (\<exists>x. Q(x)\<and>S(x))) \<and>  | 
|
208  | 
((\<exists>x. S(x)) \<longrightarrow> (\<forall>x. L(x) \<longrightarrow> M(x)))  | 
|
209  | 
\<longrightarrow> (\<forall>x. P(x) \<and> L(x) \<longrightarrow> M(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
210  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
211  | 
|
| 61343 | 212  | 
text\<open>Problem 29. Essentially the same as Principia Mathematica *11.71\<close>  | 
| 69420 | 213  | 
lemma "(\<exists>x. F(x)) \<and> (\<exists>y. G(y))  | 
214  | 
\<longrightarrow> ( ((\<forall>x. F(x)\<longrightarrow>H(x)) \<and> (\<forall>y. G(y)\<longrightarrow>J(y))) =  | 
|
215  | 
(\<forall>x y. F(x) \<and> G(y) \<longrightarrow> H(x) \<and> J(y)))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
216  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
217  | 
|
| 61343 | 218  | 
text\<open>Problem 30\<close>  | 
| 69420 | 219  | 
lemma "(\<forall>x. P(x) \<or> Q(x) \<longrightarrow> \<not> R(x)) \<and>  | 
220  | 
(\<forall>x. (Q(x) \<longrightarrow> \<not> S(x)) \<longrightarrow> P(x) \<and> R(x))  | 
|
221  | 
\<longrightarrow> (\<forall>x. S(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
222  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
223  | 
|
| 61343 | 224  | 
text\<open>Problem 31\<close>  | 
| 69420 | 225  | 
lemma "\<not>(\<exists>x. P(x) \<and> (Q(x) \<or> R(x))) \<and>  | 
226  | 
(\<exists>x. L(x) \<and> P(x)) \<and>  | 
|
227  | 
(\<forall>x. \<not> R(x) \<longrightarrow> M(x))  | 
|
228  | 
\<longrightarrow> (\<exists>x. L(x) \<and> M(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
229  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
230  | 
|
| 61343 | 231  | 
text\<open>Problem 32\<close>  | 
| 69420 | 232  | 
lemma "(\<forall>x. P(x) \<and> (Q(x)\<or>R(x))\<longrightarrow>S(x)) \<and>  | 
233  | 
(\<forall>x. S(x) \<and> R(x) \<longrightarrow> L(x)) \<and>  | 
|
234  | 
(\<forall>x. M(x) \<longrightarrow> R(x))  | 
|
235  | 
\<longrightarrow> (\<forall>x. P(x) \<and> M(x) \<longrightarrow> L(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
236  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
237  | 
|
| 61343 | 238  | 
text\<open>Problem 33\<close>  | 
| 69420 | 239  | 
lemma "(\<forall>x. P(a) \<and> (P(x)\<longrightarrow>P(b))\<longrightarrow>P(c)) =  | 
240  | 
(\<forall>x. (\<not>P(a) \<or> P(x) \<or> P(c)) \<and> (\<not>P(a) \<or> \<not>P(b) \<or> P(c)))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
241  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
242  | 
|
| 61343 | 243  | 
text\<open>Problem 34 AMENDED (TWICE!!)\<close>  | 
244  | 
text\<open>Andrews's challenge\<close>  | 
|
| 14249 | 245  | 
lemma "((\<exists>x. \<forall>y. p(x) = p(y)) =  | 
246  | 
((\<exists>x. q(x)) = (\<forall>y. p(y)))) =  | 
|
247  | 
((\<exists>x. \<forall>y. q(x) = q(y)) =  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
248  | 
((\<exists>x. p(x)) = (\<forall>y. q(y))))"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
249  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
250  | 
|
| 61343 | 251  | 
text\<open>Problem 35\<close>  | 
| 69420 | 252  | 
lemma "\<exists>x y. P x y \<longrightarrow> (\<forall>u v. P u v)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
253  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
254  | 
|
| 61343 | 255  | 
text\<open>Problem 36\<close>  | 
| 69420 | 256  | 
lemma "(\<forall>x. \<exists>y. J x y) \<and>  | 
257  | 
(\<forall>x. \<exists>y. G x y) \<and>  | 
|
258  | 
(\<forall>x y. J x y \<or> G x y \<longrightarrow>  | 
|
259  | 
(\<forall>z. J y z \<or> G y z \<longrightarrow> H x z))  | 
|
260  | 
\<longrightarrow> (\<forall>x. \<exists>y. H x y)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
261  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
262  | 
|
| 61343 | 263  | 
text\<open>Problem 37\<close>  | 
| 14249 | 264  | 
lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.  | 
| 69420 | 265  | 
(P x z \<longrightarrow>P y w) \<and> P y z \<and> (P y w \<longrightarrow> (\<exists>u. Q u w))) \<and>  | 
266  | 
(\<forall>x z. \<not>(P x z) \<longrightarrow> (\<exists>y. Q y z)) \<and>  | 
|
267  | 
((\<exists>x y. Q x y) \<longrightarrow> (\<forall>x. R x x))  | 
|
268  | 
\<longrightarrow> (\<forall>x. \<exists>y. R x y)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
269  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
270  | 
|
| 61343 | 271  | 
text\<open>Problem 38\<close>  | 
| 69420 | 272  | 
lemma "(\<forall>x. p(a) \<and> (p(x) \<longrightarrow> (\<exists>y. p(y) \<and> r x y)) \<longrightarrow>  | 
273  | 
(\<exists>z. \<exists>w. p(z) \<and> r x w \<and> r w z)) =  | 
|
274  | 
(\<forall>x. (\<not>p(a) \<or> p(x) \<or> (\<exists>z. \<exists>w. p(z) \<and> r x w \<and> r w z)) \<and>  | 
|
275  | 
(\<not>p(a) \<or> \<not>(\<exists>y. p(y) \<and> r x y) \<or>  | 
|
276  | 
(\<exists>z. \<exists>w. p(z) \<and> r x w \<and> r w z)))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
277  | 
by blast (*beats fast!*)  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
278  | 
|
| 61343 | 279  | 
text\<open>Problem 39\<close>  | 
| 69420 | 280  | 
lemma "\<not> (\<exists>x. \<forall>y. F y x = (\<not> F y y))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
281  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
282  | 
|
| 61343 | 283  | 
text\<open>Problem 40. AMENDED\<close>  | 
| 14249 | 284  | 
lemma "(\<exists>y. \<forall>x. F x y = F x x)  | 
| 69420 | 285  | 
\<longrightarrow> \<not> (\<forall>x. \<exists>y. \<forall>z. F z y = (\<not> F z x))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
286  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
287  | 
|
| 61343 | 288  | 
text\<open>Problem 41\<close>  | 
| 69420 | 289  | 
lemma "(\<forall>z. \<exists>y. \<forall>x. f x y = (f x z \<and> \<not> f x x))  | 
290  | 
\<longrightarrow> \<not> (\<exists>z. \<forall>x. f x z)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
291  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
292  | 
|
| 61343 | 293  | 
text\<open>Problem 42\<close>  | 
| 69420 | 294  | 
lemma "\<not> (\<exists>y. \<forall>x. p x y = (\<not> (\<exists>z. p x z \<and> p z x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
295  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
296  | 
|
| 61343 | 297  | 
text\<open>Problem 43!!\<close>  | 
| 69420 | 298  | 
lemma "(\<forall>x::'a. \<forall>y::'a. q x y = (\<forall>z. p z x \<longleftrightarrow> (p z y)))  | 
299  | 
\<longrightarrow> (\<forall>x. (\<forall>y. q x y \<longleftrightarrow> (q y x)))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
300  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
301  | 
|
| 61343 | 302  | 
text\<open>Problem 44\<close>  | 
| 69420 | 303  | 
lemma "(\<forall>x. f(x) \<longrightarrow>  | 
304  | 
(\<exists>y. g(y) \<and> h x y \<and> (\<exists>y. g(y) \<and> \<not> h x y))) \<and>  | 
|
305  | 
(\<exists>x. j(x) \<and> (\<forall>y. g(y) \<longrightarrow> h x y))  | 
|
306  | 
\<longrightarrow> (\<exists>x. j(x) \<and> \<not>f(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
307  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
308  | 
|
| 61343 | 309  | 
text\<open>Problem 45\<close>  | 
| 69420 | 310  | 
lemma "(\<forall>x. f(x) \<and> (\<forall>y. g(y) \<and> h x y \<longrightarrow> j x y)  | 
311  | 
\<longrightarrow> (\<forall>y. g(y) \<and> h x y \<longrightarrow> k(y))) \<and>  | 
|
312  | 
\<not> (\<exists>y. l(y) \<and> k(y)) \<and>  | 
|
313  | 
(\<exists>x. f(x) \<and> (\<forall>y. h x y \<longrightarrow> l(y))  | 
|
314  | 
\<and> (\<forall>y. g(y) \<and> h x y \<longrightarrow> j x y))  | 
|
315  | 
\<longrightarrow> (\<exists>x. f(x) \<and> \<not> (\<exists>y. g(y) \<and> h x y))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
316  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
317  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
318  | 
|
| 61343 | 319  | 
subsubsection\<open>Problems (mainly) involving equality or functions\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
320  | 
|
| 61343 | 321  | 
text\<open>Problem 48\<close>  | 
| 69420 | 322  | 
lemma "(a=b \<or> c=d) \<and> (a=c \<or> b=d) \<longrightarrow> a=d \<or> b=c"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
323  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
324  | 
|
| 61343 | 325  | 
text\<open>Problem 49 NOT PROVED AUTOMATICALLY.  | 
| 14249 | 326  | 
Hard because it involves substitution for Vars  | 
| 61343 | 327  | 
the type constraint ensures that x,y,z have the same type as a,b,u.\<close>  | 
| 69420 | 328  | 
lemma "(\<exists>x y::'a. \<forall>z. z=x \<or> z=y) \<and> P(a) \<and> P(b) \<and> (\<not>a=b)  | 
329  | 
\<longrightarrow> (\<forall>u::'a. P(u))"  | 
|
| 23508 | 330  | 
by metis  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
331  | 
|
| 61343 | 332  | 
text\<open>Problem 50. (What has this to do with equality?)\<close>  | 
| 69420 | 333  | 
lemma "(\<forall>x. P a x \<or> (\<forall>y. P x y)) \<longrightarrow> (\<exists>x. \<forall>y. P x y)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
334  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
335  | 
|
| 61343 | 336  | 
text\<open>Problem 51\<close>  | 
| 69420 | 337  | 
lemma "(\<exists>z w. \<forall>x y. P x y = (x=z \<and> y=w)) \<longrightarrow>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
338  | 
(\<exists>z. \<forall>x. \<exists>w. (\<forall>y. P x y = (y=w)) = (x=z))"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
339  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
340  | 
|
| 61343 | 341  | 
text\<open>Problem 52. Almost the same as 51.\<close>  | 
| 69420 | 342  | 
lemma "(\<exists>z w. \<forall>x y. P x y = (x=z \<and> y=w)) \<longrightarrow>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
343  | 
(\<exists>w. \<forall>y. \<exists>z. (\<forall>x. P x y = (x=z)) = (y=w))"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
344  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
345  | 
|
| 61343 | 346  | 
text\<open>Problem 55\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
347  | 
|
| 61343 | 348  | 
text\<open>Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).  | 
349  | 
fast DISCOVERS who killed Agatha.\<close>  | 
|
| 69420 | 350  | 
schematic_goal "lives(agatha) \<and> lives(butler) \<and> lives(charles) \<and>  | 
351  | 
(killed agatha agatha \<or> killed butler agatha \<or> killed charles agatha) \<and>  | 
|
352  | 
(\<forall>x y. killed x y \<longrightarrow> hates x y \<and> \<not>richer x y) \<and>  | 
|
353  | 
(\<forall>x. hates agatha x \<longrightarrow> \<not>hates charles x) \<and>  | 
|
354  | 
(hates agatha agatha \<and> hates agatha charles) \<and>  | 
|
355  | 
(\<forall>x. lives(x) \<and> \<not>richer x agatha \<longrightarrow> hates butler x) \<and>  | 
|
356  | 
(\<forall>x. hates agatha x \<longrightarrow> hates butler x) \<and>  | 
|
357  | 
(\<forall>x. \<not>hates x agatha \<or> \<not>hates x butler \<or> \<not>hates x charles) \<longrightarrow>  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
358  | 
killed ?who agatha"  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
359  | 
by fast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
360  | 
|
| 61343 | 361  | 
text\<open>Problem 56\<close>  | 
| 69420 | 362  | 
lemma "(\<forall>x. (\<exists>y. P(y) \<and> x=f(y)) \<longrightarrow> P(x)) = (\<forall>x. P(x) \<longrightarrow> P(f(x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
363  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
364  | 
|
| 61343 | 365  | 
text\<open>Problem 57\<close>  | 
| 69420 | 366  | 
lemma "P (f a b) (f b c) \<and> P (f b c) (f a c) \<and>  | 
367  | 
(\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z) \<longrightarrow> P (f a b) (f a c)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
368  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
369  | 
|
| 61343 | 370  | 
text\<open>Problem 58 NOT PROVED AUTOMATICALLY\<close>  | 
| 69420 | 371  | 
lemma "(\<forall>x y. f(x)=g(y)) \<longrightarrow> (\<forall>x y. f(f(x))=f(g(y)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
372  | 
by (fast intro: arg_cong [of concl: f])  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
373  | 
|
| 61343 | 374  | 
text\<open>Problem 59\<close>  | 
| 69420 | 375  | 
lemma "(\<forall>x. P(x) = (\<not>P(f(x)))) \<longrightarrow> (\<exists>x. P(x) \<and> \<not>P(f(x)))"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
376  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
377  | 
|
| 61343 | 378  | 
text\<open>Problem 60\<close>  | 
| 69420 | 379  | 
lemma "\<forall>x. P x (f x) = (\<exists>y. (\<forall>z. P z y \<longrightarrow> P z (f x)) \<and> P x y)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
380  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
381  | 
|
| 61343 | 382  | 
text\<open>Problem 62 as corrected in JAR 18 (1997), page 135\<close>  | 
| 69420 | 383  | 
lemma "(\<forall>x. p a \<and> (p x \<longrightarrow> p(f x)) \<longrightarrow> p(f(f x))) =  | 
384  | 
(\<forall>x. (\<not> p a \<or> p x \<or> p(f(f x))) \<and>  | 
|
385  | 
(\<not> p a \<or> \<not> p(f x) \<or> p(f(f x))))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
386  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
387  | 
|
| 61343 | 388  | 
text\<open>From Davis, Obvious Logical Inferences, IJCAI-81, 530-531  | 
389  | 
fast indeed copes!\<close>  | 
|
| 69420 | 390  | 
lemma "(\<forall>x. F(x) \<and> \<not>G(x) \<longrightarrow> (\<exists>y. H(x,y) \<and> J(y))) \<and>  | 
391  | 
(\<exists>x. K(x) \<and> F(x) \<and> (\<forall>y. H(x,y) \<longrightarrow> K(y))) \<and>  | 
|
392  | 
(\<forall>x. K(x) \<longrightarrow> \<not>G(x)) \<longrightarrow> (\<exists>x. K(x) \<and> J(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
393  | 
by fast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
394  | 
|
| 61343 | 395  | 
text\<open>From Rudnicki, Obvious Inferences, JAR 3 (1987), 383-393.  | 
396  | 
It does seem obvious!\<close>  | 
|
| 69420 | 397  | 
lemma "(\<forall>x. F(x) \<and> \<not>G(x) \<longrightarrow> (\<exists>y. H(x,y) \<and> J(y))) \<and>  | 
398  | 
(\<exists>x. K(x) \<and> F(x) \<and> (\<forall>y. H(x,y) \<longrightarrow> K(y))) \<and>  | 
|
399  | 
(\<forall>x. K(x) \<longrightarrow> \<not>G(x)) \<longrightarrow> (\<exists>x. K(x) \<longrightarrow> \<not>G(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
400  | 
by fast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
401  | 
|
| 61343 | 402  | 
text\<open>Attributed to Lewis Carroll by S. G. Pulman. The first or last  | 
403  | 
assumption can be deleted.\<close>  | 
|
| 69420 | 404  | 
lemma "(\<forall>x. honest(x) \<and> industrious(x) \<longrightarrow> healthy(x)) \<and>  | 
405  | 
\<not> (\<exists>x. grocer(x) \<and> healthy(x)) \<and>  | 
|
406  | 
(\<forall>x. industrious(x) \<and> grocer(x) \<longrightarrow> honest(x)) \<and>  | 
|
407  | 
(\<forall>x. cyclist(x) \<longrightarrow> industrious(x)) \<and>  | 
|
408  | 
(\<forall>x. \<not>healthy(x) \<and> cyclist(x) \<longrightarrow> \<not>honest(x))  | 
|
409  | 
\<longrightarrow> (\<forall>x. grocer(x) \<longrightarrow> \<not>cyclist(x))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
410  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
411  | 
|
| 69420 | 412  | 
lemma "(\<forall>x y. R(x,y) \<or> R(y,x)) \<and>  | 
413  | 
(\<forall>x y. S(x,y) \<and> S(y,x) \<longrightarrow> x=y) \<and>  | 
|
414  | 
(\<forall>x y. R(x,y) \<longrightarrow> S(x,y)) \<longrightarrow> (\<forall>x y. S(x,y) \<longrightarrow> R(x,y))"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
415  | 
by blast  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
416  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
417  | 
|
| 61343 | 418  | 
subsection\<open>Model Elimination Prover\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
419  | 
|
| 16563 | 420  | 
|
| 61343 | 421  | 
text\<open>Trying out meson with arguments\<close>  | 
| 69420 | 422  | 
lemma "x < y \<and> y < z \<longrightarrow> \<not> (z < (x::nat))"  | 
| 16563 | 423  | 
by (meson order_less_irrefl order_less_trans)  | 
424  | 
||
| 61343 | 425  | 
text\<open>The "small example" from Bezem, Hendriks and de Nivelle,  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
426  | 
Automatic Proof Construction in Type Theory Using Resolution,  | 
| 61343 | 427  | 
JAR 29: 3-4 (2002), pages 253-275\<close>  | 
| 69420 | 428  | 
lemma "(\<forall>x y z. R(x,y) \<and> R(y,z) \<longrightarrow> R(x,z)) \<and>  | 
429  | 
(\<forall>x. \<exists>y. R(x,y)) \<longrightarrow>  | 
|
430  | 
\<not> (\<forall>x. P x = (\<forall>y. R(x,y) \<longrightarrow> \<not> P y))"  | 
|
| 61343 | 431  | 
by (tactic\<open>Meson.safe_best_meson_tac @{context} 1\<close>)
 | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
432  | 
\<comment> \<open>In contrast, \<open>meson\<close> is SLOW: 7.6s on griffon\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
433  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
434  | 
|
| 61343 | 435  | 
subsubsection\<open>Pelletier's examples\<close>  | 
436  | 
text\<open>1\<close>  | 
|
| 69420 | 437  | 
lemma "(P \<longrightarrow> Q) = (\<not>Q \<longrightarrow> \<not>P)"  | 
| 16011 | 438  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
439  | 
|
| 61343 | 440  | 
text\<open>2\<close>  | 
| 69420 | 441  | 
lemma "(\<not> \<not> P) = P"  | 
| 16011 | 442  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
443  | 
|
| 61343 | 444  | 
text\<open>3\<close>  | 
| 69420 | 445  | 
lemma "\<not>(P\<longrightarrow>Q) \<longrightarrow> (Q\<longrightarrow>P)"  | 
| 16011 | 446  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
447  | 
|
| 61343 | 448  | 
text\<open>4\<close>  | 
| 69420 | 449  | 
lemma "(\<not>P\<longrightarrow>Q) = (\<not>Q \<longrightarrow> P)"  | 
| 16011 | 450  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
451  | 
|
| 61343 | 452  | 
text\<open>5\<close>  | 
| 69420 | 453  | 
lemma "((P\<or>Q)\<longrightarrow>(P\<or>R)) \<longrightarrow> (P\<or>(Q\<longrightarrow>R))"  | 
| 16011 | 454  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
455  | 
|
| 61343 | 456  | 
text\<open>6\<close>  | 
| 69420 | 457  | 
lemma "P \<or> \<not> P"  | 
| 16011 | 458  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
459  | 
|
| 61343 | 460  | 
text\<open>7\<close>  | 
| 69420 | 461  | 
lemma "P \<or> \<not> \<not> \<not> P"  | 
| 16011 | 462  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
463  | 
|
| 61343 | 464  | 
text\<open>8. Peirce's law\<close>  | 
| 69420 | 465  | 
lemma "((P\<longrightarrow>Q) \<longrightarrow> P) \<longrightarrow> P"  | 
| 16011 | 466  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
467  | 
|
| 61343 | 468  | 
text\<open>9\<close>  | 
| 69420 | 469  | 
lemma "((P\<or>Q) \<and> (\<not>P\<or>Q) \<and> (P\<or> \<not>Q)) \<longrightarrow> \<not> (\<not>P \<or> \<not>Q)"  | 
| 16011 | 470  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
471  | 
|
| 61343 | 472  | 
text\<open>10\<close>  | 
| 69420 | 473  | 
lemma "(Q\<longrightarrow>R) \<and> (R\<longrightarrow>P\<and>Q) \<and> (P\<longrightarrow>Q\<or>R) \<longrightarrow> (P=Q)"  | 
| 16011 | 474  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
475  | 
|
| 61343 | 476  | 
text\<open>11. Proved in each direction (incorrectly, says Pelletier!!)\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
477  | 
lemma "P=(P::bool)"  | 
| 16011 | 478  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
479  | 
|
| 61343 | 480  | 
text\<open>12. "Dijkstra's law"\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
481  | 
lemma "((P = Q) = R) = (P = (Q = R))"  | 
| 16011 | 482  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
483  | 
|
| 61343 | 484  | 
text\<open>13. Distributive law\<close>  | 
| 69420 | 485  | 
lemma "(P \<or> (Q \<and> R)) = ((P \<or> Q) \<and> (P \<or> R))"  | 
| 16011 | 486  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
487  | 
|
| 61343 | 488  | 
text\<open>14\<close>  | 
| 69420 | 489  | 
lemma "(P = Q) = ((Q \<or> \<not>P) \<and> (\<not>Q\<or>P))"  | 
| 16011 | 490  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
491  | 
|
| 61343 | 492  | 
text\<open>15\<close>  | 
| 69420 | 493  | 
lemma "(P \<longrightarrow> Q) = (\<not>P \<or> Q)"  | 
| 16011 | 494  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
495  | 
|
| 61343 | 496  | 
text\<open>16\<close>  | 
| 69420 | 497  | 
lemma "(P\<longrightarrow>Q) \<or> (Q\<longrightarrow>P)"  | 
| 16011 | 498  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
499  | 
|
| 61343 | 500  | 
text\<open>17\<close>  | 
| 69420 | 501  | 
lemma "((P \<and> (Q\<longrightarrow>R))\<longrightarrow>S) = ((\<not>P \<or> Q \<or> S) \<and> (\<not>P \<or> \<not>R \<or> S))"  | 
| 16011 | 502  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
503  | 
|
| 61343 | 504  | 
subsubsection\<open>Classical Logic: examples with quantifiers\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
505  | 
|
| 69420 | 506  | 
lemma "(\<forall>x. P x \<and> Q x) = ((\<forall>x. P x) \<and> (\<forall>x. Q x))"  | 
| 16011 | 507  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
508  | 
|
| 69420 | 509  | 
lemma "(\<exists>x. P \<longrightarrow> Q x) = (P \<longrightarrow> (\<exists>x. Q x))"  | 
| 16011 | 510  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
511  | 
|
| 69420 | 512  | 
lemma "(\<exists>x. P x \<longrightarrow> Q) = ((\<forall>x. P x) \<longrightarrow> Q)"  | 
| 16011 | 513  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
514  | 
|
| 69420 | 515  | 
lemma "((\<forall>x. P x) \<or> Q) = (\<forall>x. P x \<or> Q)"  | 
| 16011 | 516  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
517  | 
|
| 69420 | 518  | 
lemma "(\<forall>x. P x \<longrightarrow> P(f x)) \<and> P d \<longrightarrow> P(f(f(f d)))"  | 
| 16011 | 519  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
520  | 
|
| 61343 | 521  | 
text\<open>Needs double instantiation of EXISTS\<close>  | 
| 69420 | 522  | 
lemma "\<exists>x. P x \<longrightarrow> P a \<and> P b"  | 
| 16011 | 523  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
524  | 
|
| 69420 | 525  | 
lemma "\<exists>z. P z \<longrightarrow> (\<forall>x. P x)"  | 
| 16011 | 526  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
527  | 
|
| 61343 | 528  | 
text\<open>From a paper by Claire Quigley\<close>  | 
| 69420 | 529  | 
lemma "\<exists>y. ((P c \<and> Q y) \<or> (\<exists>z. \<not> Q z)) \<or> (\<exists>x. \<not> P x \<and> Q d)"  | 
| 14249 | 530  | 
by fast  | 
531  | 
||
| 61343 | 532  | 
subsubsection\<open>Hard examples with quantifiers\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
533  | 
|
| 61343 | 534  | 
text\<open>Problem 18\<close>  | 
| 69420 | 535  | 
lemma "\<exists>y. \<forall>x. P y \<longrightarrow> P x"  | 
| 16011 | 536  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
537  | 
|
| 61343 | 538  | 
text\<open>Problem 19\<close>  | 
| 69420 | 539  | 
lemma "\<exists>x. \<forall>y z. (P y \<longrightarrow> Q z) \<longrightarrow> (P x \<longrightarrow> Q x)"  | 
| 16011 | 540  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
541  | 
|
| 61343 | 542  | 
text\<open>Problem 20\<close>  | 
| 69420 | 543  | 
lemma "(\<forall>x y. \<exists>z. \<forall>w. (P x \<and> Q y \<longrightarrow> R z \<and> S w))  | 
544  | 
\<longrightarrow> (\<exists>x y. P x \<and> Q y) \<longrightarrow> (\<exists>z. R z)"  | 
|
| 16011 | 545  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
546  | 
|
| 61343 | 547  | 
text\<open>Problem 21\<close>  | 
| 69420 | 548  | 
lemma "(\<exists>x. P \<longrightarrow> Q x) \<and> (\<exists>x. Q x \<longrightarrow> P) \<longrightarrow> (\<exists>x. P=Q x)"  | 
| 16011 | 549  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
550  | 
|
| 61343 | 551  | 
text\<open>Problem 22\<close>  | 
| 69420 | 552  | 
lemma "(\<forall>x. P = Q x) \<longrightarrow> (P = (\<forall>x. Q x))"  | 
| 16011 | 553  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
554  | 
|
| 61343 | 555  | 
text\<open>Problem 23\<close>  | 
| 69420 | 556  | 
lemma "(\<forall>x. P \<or> Q x) = (P \<or> (\<forall>x. Q x))"  | 
| 16011 | 557  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
558  | 
|
| 61343 | 559  | 
text\<open>Problem 24\<close> (*The first goal clause is useless*)  | 
| 69420 | 560  | 
lemma "\<not>(\<exists>x. S x \<and> Q x) \<and> (\<forall>x. P x \<longrightarrow> Q x \<or> R x) \<and>  | 
561  | 
(\<not>(\<exists>x. P x) \<longrightarrow> (\<exists>x. Q x)) \<and> (\<forall>x. Q x \<or> R x \<longrightarrow> S x)  | 
|
562  | 
\<longrightarrow> (\<exists>x. P x \<and> R x)"  | 
|
| 16011 | 563  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
564  | 
|
| 61343 | 565  | 
text\<open>Problem 25\<close>  | 
| 69420 | 566  | 
lemma "(\<exists>x. P x) \<and>  | 
567  | 
(\<forall>x. L x \<longrightarrow> \<not> (M x \<and> R x)) \<and>  | 
|
568  | 
(\<forall>x. P x \<longrightarrow> (M x \<and> L x)) \<and>  | 
|
569  | 
((\<forall>x. P x \<longrightarrow> Q x) \<or> (\<exists>x. P x \<and> R x))  | 
|
570  | 
\<longrightarrow> (\<exists>x. Q x \<and> P x)"  | 
|
| 16011 | 571  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
572  | 
|
| 61343 | 573  | 
text\<open>Problem 26; has 24 Horn clauses\<close>  | 
| 69420 | 574  | 
lemma "((\<exists>x. p x) = (\<exists>x. q x)) \<and>  | 
575  | 
(\<forall>x. \<forall>y. p x \<and> q y \<longrightarrow> (r x = s y))  | 
|
576  | 
\<longrightarrow> ((\<forall>x. p x \<longrightarrow> r x) = (\<forall>x. q x \<longrightarrow> s x))"  | 
|
| 16011 | 577  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
578  | 
|
| 61343 | 579  | 
text\<open>Problem 27; has 13 Horn clauses\<close>  | 
| 69420 | 580  | 
lemma "(\<exists>x. P x \<and> \<not>Q x) \<and>  | 
581  | 
(\<forall>x. P x \<longrightarrow> R x) \<and>  | 
|
582  | 
(\<forall>x. M x \<and> L x \<longrightarrow> P x) \<and>  | 
|
583  | 
((\<exists>x. R x \<and> \<not> Q x) \<longrightarrow> (\<forall>x. L x \<longrightarrow> \<not> R x))  | 
|
584  | 
\<longrightarrow> (\<forall>x. M x \<longrightarrow> \<not>L x)"  | 
|
| 16011 | 585  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
586  | 
|
| 61343 | 587  | 
text\<open>Problem 28. AMENDED; has 14 Horn clauses\<close>  | 
| 69420 | 588  | 
lemma "(\<forall>x. P x \<longrightarrow> (\<forall>x. Q x)) \<and>  | 
589  | 
((\<forall>x. Q x \<or> R x) \<longrightarrow> (\<exists>x. Q x \<and> S x)) \<and>  | 
|
590  | 
((\<exists>x. S x) \<longrightarrow> (\<forall>x. L x \<longrightarrow> M x))  | 
|
591  | 
\<longrightarrow> (\<forall>x. P x \<and> L x \<longrightarrow> M x)"  | 
|
| 16011 | 592  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
593  | 
|
| 61343 | 594  | 
text\<open>Problem 29. Essentially the same as Principia Mathematica *11.71.  | 
595  | 
62 Horn clauses\<close>  | 
|
| 69420 | 596  | 
lemma "(\<exists>x. F x) \<and> (\<exists>y. G y)  | 
597  | 
\<longrightarrow> ( ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>y. G y \<longrightarrow> J y)) =  | 
|
598  | 
(\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y))"  | 
|
| 16011 | 599  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
600  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
601  | 
|
| 61343 | 602  | 
text\<open>Problem 30\<close>  | 
| 69420 | 603  | 
lemma "(\<forall>x. P x \<or> Q x \<longrightarrow> \<not> R x) \<and> (\<forall>x. (Q x \<longrightarrow> \<not> S x) \<longrightarrow> P x \<and> R x)  | 
604  | 
\<longrightarrow> (\<forall>x. S x)"  | 
|
| 16011 | 605  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
606  | 
|
| 61343 | 607  | 
text\<open>Problem 31; has 10 Horn clauses; first negative clauses is useless\<close>  | 
| 69420 | 608  | 
lemma "\<not>(\<exists>x. P x \<and> (Q x \<or> R x)) \<and>  | 
609  | 
(\<exists>x. L x \<and> P x) \<and>  | 
|
610  | 
(\<forall>x. \<not> R x \<longrightarrow> M x)  | 
|
611  | 
\<longrightarrow> (\<exists>x. L x \<and> M x)"  | 
|
| 16011 | 612  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
613  | 
|
| 61343 | 614  | 
text\<open>Problem 32\<close>  | 
| 69420 | 615  | 
lemma "(\<forall>x. P x \<and> (Q x \<or> R x)\<longrightarrow>S x) \<and>  | 
616  | 
(\<forall>x. S x \<and> R x \<longrightarrow> L x) \<and>  | 
|
617  | 
(\<forall>x. M x \<longrightarrow> R x)  | 
|
618  | 
\<longrightarrow> (\<forall>x. P x \<and> M x \<longrightarrow> L x)"  | 
|
| 16011 | 619  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
620  | 
|
| 61343 | 621  | 
text\<open>Problem 33; has 55 Horn clauses\<close>  | 
| 69420 | 622  | 
lemma "(\<forall>x. P a \<and> (P x \<longrightarrow> P b)\<longrightarrow>P c) =  | 
623  | 
(\<forall>x. (\<not>P a \<or> P x \<or> P c) \<and> (\<not>P a \<or> \<not>P b \<or> P c))"  | 
|
| 16011 | 624  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
625  | 
|
| 61343 | 626  | 
text\<open>Problem 34: Andrews's challenge has 924 Horn clauses\<close>  | 
| 14249 | 627  | 
lemma "((\<exists>x. \<forall>y. p x = p y) = ((\<exists>x. q x) = (\<forall>y. p y))) =  | 
628  | 
((\<exists>x. \<forall>y. q x = q y) = ((\<exists>x. p x) = (\<forall>y. q y)))"  | 
|
| 16011 | 629  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
630  | 
|
| 61343 | 631  | 
text\<open>Problem 35\<close>  | 
| 69420 | 632  | 
lemma "\<exists>x y. P x y \<longrightarrow> (\<forall>u v. P u v)"  | 
| 16011 | 633  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
634  | 
|
| 61343 | 635  | 
text\<open>Problem 36; has 15 Horn clauses\<close>  | 
| 69420 | 636  | 
lemma "(\<forall>x. \<exists>y. J x y) \<and> (\<forall>x. \<exists>y. G x y) \<and>  | 
637  | 
(\<forall>x y. J x y \<or> G x y \<longrightarrow> (\<forall>z. J y z \<or> G y z \<longrightarrow> H x z))  | 
|
638  | 
\<longrightarrow> (\<forall>x. \<exists>y. H x y)"  | 
|
| 16011 | 639  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
640  | 
|
| 61343 | 641  | 
text\<open>Problem 37; has 10 Horn clauses\<close>  | 
| 14249 | 642  | 
lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.  | 
| 69420 | 643  | 
(P x z \<longrightarrow> P y w) \<and> P y z \<and> (P y w \<longrightarrow> (\<exists>u. Q u w))) \<and>  | 
644  | 
(\<forall>x z. \<not>P x z \<longrightarrow> (\<exists>y. Q y z)) \<and>  | 
|
645  | 
((\<exists>x y. Q x y) \<longrightarrow> (\<forall>x. R x x))  | 
|
646  | 
\<longrightarrow> (\<forall>x. \<exists>y. R x y)"  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
647  | 
by blast \<comment> \<open>causes unification tracing messages\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
648  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
649  | 
|
| 61343 | 650  | 
text\<open>Problem 38\<close> text\<open>Quite hard: 422 Horn clauses!!\<close>  | 
| 69420 | 651  | 
lemma "(\<forall>x. p a \<and> (p x \<longrightarrow> (\<exists>y. p y \<and> r x y)) \<longrightarrow>  | 
652  | 
(\<exists>z. \<exists>w. p z \<and> r x w \<and> r w z)) =  | 
|
653  | 
(\<forall>x. (\<not>p a \<or> p x \<or> (\<exists>z. \<exists>w. p z \<and> r x w \<and> r w z)) \<and>  | 
|
654  | 
(\<not>p a \<or> \<not>(\<exists>y. p y \<and> r x y) \<or>  | 
|
655  | 
(\<exists>z. \<exists>w. p z \<and> r x w \<and> r w z)))"  | 
|
| 16011 | 656  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
657  | 
|
| 61343 | 658  | 
text\<open>Problem 39\<close>  | 
| 69420 | 659  | 
lemma "\<not> (\<exists>x. \<forall>y. F y x = (\<not>F y y))"  | 
| 16011 | 660  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
661  | 
|
| 61343 | 662  | 
text\<open>Problem 40. AMENDED\<close>  | 
| 14249 | 663  | 
lemma "(\<exists>y. \<forall>x. F x y = F x x)  | 
| 69420 | 664  | 
\<longrightarrow> \<not> (\<forall>x. \<exists>y. \<forall>z. F z y = (\<not>F z x))"  | 
| 16011 | 665  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
666  | 
|
| 61343 | 667  | 
text\<open>Problem 41\<close>  | 
| 69420 | 668  | 
lemma "(\<forall>z. (\<exists>y. (\<forall>x. f x y = (f x z \<and> \<not> f x x))))  | 
669  | 
\<longrightarrow> \<not> (\<exists>z. \<forall>x. f x z)"  | 
|
| 16011 | 670  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
671  | 
|
| 61343 | 672  | 
text\<open>Problem 42\<close>  | 
| 69420 | 673  | 
lemma "\<not> (\<exists>y. \<forall>x. p x y = (\<not> (\<exists>z. p x z \<and> p z x)))"  | 
| 16011 | 674  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
675  | 
|
| 61343 | 676  | 
text\<open>Problem 43 NOW PROVED AUTOMATICALLY!!\<close>  | 
| 14249 | 677  | 
lemma "(\<forall>x. \<forall>y. q x y = (\<forall>z. p z x = (p z y::bool)))  | 
| 69420 | 678  | 
\<longrightarrow> (\<forall>x. (\<forall>y. q x y = (q y x::bool)))"  | 
| 16011 | 679  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
680  | 
|
| 61343 | 681  | 
text\<open>Problem 44: 13 Horn clauses; 7-step proof\<close>  | 
| 69420 | 682  | 
lemma "(\<forall>x. f x \<longrightarrow> (\<exists>y. g y \<and> h x y \<and> (\<exists>y. g y \<and> \<not> h x y))) \<and>  | 
683  | 
(\<exists>x. j x \<and> (\<forall>y. g y \<longrightarrow> h x y))  | 
|
684  | 
\<longrightarrow> (\<exists>x. j x \<and> \<not>f x)"  | 
|
| 16011 | 685  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
686  | 
|
| 61343 | 687  | 
text\<open>Problem 45; has 27 Horn clauses; 54-step proof\<close>  | 
| 69420 | 688  | 
lemma "(\<forall>x. f x \<and> (\<forall>y. g y \<and> h x y \<longrightarrow> j x y)  | 
689  | 
\<longrightarrow> (\<forall>y. g y \<and> h x y \<longrightarrow> k y)) \<and>  | 
|
690  | 
\<not> (\<exists>y. l y \<and> k y) \<and>  | 
|
691  | 
(\<exists>x. f x \<and> (\<forall>y. h x y \<longrightarrow> l y)  | 
|
692  | 
\<and> (\<forall>y. g y \<and> h x y \<longrightarrow> j x y))  | 
|
693  | 
\<longrightarrow> (\<exists>x. f x \<and> \<not> (\<exists>y. g y \<and> h x y))"  | 
|
| 16011 | 694  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
695  | 
|
| 61343 | 696  | 
text\<open>Problem 46; has 26 Horn clauses; 21-step proof\<close>  | 
| 69420 | 697  | 
lemma "(\<forall>x. f x \<and> (\<forall>y. f y \<and> h y x \<longrightarrow> g y) \<longrightarrow> g x) \<and>  | 
698  | 
((\<exists>x. f x \<and> \<not>g x) \<longrightarrow>  | 
|
699  | 
(\<exists>x. f x \<and> \<not>g x \<and> (\<forall>y. f y \<and> \<not>g y \<longrightarrow> j x y))) \<and>  | 
|
700  | 
(\<forall>x y. f x \<and> f y \<and> h x y \<longrightarrow> \<not>j y x)  | 
|
701  | 
\<longrightarrow> (\<forall>x. f x \<longrightarrow> g x)"  | 
|
| 16011 | 702  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
703  | 
|
| 61343 | 704  | 
text\<open>Problem 47. Schubert's Steamroller.  | 
| 16593 | 705  | 
26 clauses; 63 Horn clauses.  | 
| 61343 | 706  | 
87094 inferences so far. Searching to depth 36\<close>  | 
| 69420 | 707  | 
lemma "(\<forall>x. wolf x \<longrightarrow> animal x) \<and> (\<exists>x. wolf x) \<and>  | 
708  | 
(\<forall>x. fox x \<longrightarrow> animal x) \<and> (\<exists>x. fox x) \<and>  | 
|
709  | 
(\<forall>x. bird x \<longrightarrow> animal x) \<and> (\<exists>x. bird x) \<and>  | 
|
710  | 
(\<forall>x. caterpillar x \<longrightarrow> animal x) \<and> (\<exists>x. caterpillar x) \<and>  | 
|
711  | 
(\<forall>x. snail x \<longrightarrow> animal x) \<and> (\<exists>x. snail x) \<and>  | 
|
712  | 
(\<forall>x. grain x \<longrightarrow> plant x) \<and> (\<exists>x. grain x) \<and>  | 
|
| 16593 | 713  | 
(\<forall>x. animal x \<longrightarrow>  | 
714  | 
((\<forall>y. plant y \<longrightarrow> eats x y) \<or>  | 
|
| 69420 | 715  | 
(\<forall>y. animal y \<and> smaller_than y x \<and>  | 
716  | 
(\<exists>z. plant z \<and> eats y z) \<longrightarrow> eats x y))) \<and>  | 
|
717  | 
(\<forall>x y. bird y \<and> (snail x \<or> caterpillar x) \<longrightarrow> smaller_than x y) \<and>  | 
|
718  | 
(\<forall>x y. bird x \<and> fox y \<longrightarrow> smaller_than x y) \<and>  | 
|
719  | 
(\<forall>x y. fox x \<and> wolf y \<longrightarrow> smaller_than x y) \<and>  | 
|
720  | 
(\<forall>x y. wolf x \<and> (fox y \<or> grain y) \<longrightarrow> \<not>eats x y) \<and>  | 
|
721  | 
(\<forall>x y. bird x \<and> caterpillar y \<longrightarrow> eats x y) \<and>  | 
|
722  | 
(\<forall>x y. bird x \<and> snail y \<longrightarrow> \<not>eats x y) \<and>  | 
|
723  | 
(\<forall>x. (caterpillar x \<or> snail x) \<longrightarrow> (\<exists>y. plant y \<and> eats x y))  | 
|
724  | 
\<longrightarrow> (\<exists>x y. animal x \<and> animal y \<and> (\<exists>z. grain z \<and> eats y z \<and> eats x y))"  | 
|
| 61343 | 725  | 
by (tactic\<open>Meson.safe_best_meson_tac @{context} 1\<close>)
 | 
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
726  | 
\<comment> \<open>Nearly twice as fast as \<open>meson\<close>,  | 
| 61343 | 727  | 
which performs iterative deepening rather than best-first search\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
728  | 
|
| 61343 | 729  | 
text\<open>The Los problem. Circulated by John Harrison\<close>  | 
| 69420 | 730  | 
lemma "(\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z) \<and>  | 
731  | 
(\<forall>x y z. Q x y \<and> Q y z \<longrightarrow> Q x z) \<and>  | 
|
732  | 
(\<forall>x y. P x y \<longrightarrow> P y x) \<and>  | 
|
733  | 
(\<forall>x y. P x y \<or> Q x y)  | 
|
734  | 
\<longrightarrow> (\<forall>x y. P x y) \<or> (\<forall>x y. Q x y)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
735  | 
by meson  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
736  | 
|
| 61343 | 737  | 
text\<open>A similar example, suggested by Johannes Schumann and  | 
738  | 
credited to Pelletier\<close>  | 
|
| 69420 | 739  | 
lemma "(\<forall>x y z. P x y \<longrightarrow> P y z \<longrightarrow> P x z) \<longrightarrow>  | 
740  | 
(\<forall>x y z. Q x y \<longrightarrow> Q y z \<longrightarrow> Q x z) \<longrightarrow>  | 
|
741  | 
(\<forall>x y. Q x y \<longrightarrow> Q y x) \<longrightarrow> (\<forall>x y. P x y \<or> Q x y) \<longrightarrow>  | 
|
742  | 
(\<forall>x y. P x y) \<or> (\<forall>x y. Q x y)"  | 
|
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
743  | 
by meson  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
744  | 
|
| 61343 | 745  | 
text\<open>Problem 50. What has this to do with equality?\<close>  | 
| 69420 | 746  | 
lemma "(\<forall>x. P a x \<or> (\<forall>y. P x y)) \<longrightarrow> (\<exists>x. \<forall>y. P x y)"  | 
| 16011 | 747  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
748  | 
|
| 61343 | 749  | 
text\<open>Problem 54: NOT PROVED\<close>  | 
| 69420 | 750  | 
lemma "(\<forall>y::'a. \<exists>z. \<forall>x. F x z = (x=y)) \<longrightarrow>  | 
751  | 
\<not> (\<exists>w. \<forall>x. F x w = (\<forall>u. F x u \<longrightarrow> (\<exists>y. F y u \<and> \<not> (\<exists>z. F z u \<and> F z y))))"  | 
|
| 16011 | 752  | 
oops  | 
| 15151 | 753  | 
|
754  | 
||
| 61343 | 755  | 
text\<open>Problem 55\<close>  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
756  | 
|
| 61343 | 757  | 
text\<open>Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988).  | 
| 61933 | 758  | 
\<open>meson\<close> cannot report who killed Agatha.\<close>  | 
| 69420 | 759  | 
lemma "lives agatha \<and> lives butler \<and> lives charles \<and>  | 
760  | 
(killed agatha agatha \<or> killed butler agatha \<or> killed charles agatha) \<and>  | 
|
761  | 
(\<forall>x y. killed x y \<longrightarrow> hates x y \<and> \<not>richer x y) \<and>  | 
|
762  | 
(\<forall>x. hates agatha x \<longrightarrow> \<not>hates charles x) \<and>  | 
|
763  | 
(hates agatha agatha \<and> hates agatha charles) \<and>  | 
|
764  | 
(\<forall>x. lives x \<and> \<not>richer x agatha \<longrightarrow> hates butler x) \<and>  | 
|
765  | 
(\<forall>x. hates agatha x \<longrightarrow> hates butler x) \<and>  | 
|
766  | 
(\<forall>x. \<not>hates x agatha \<or> \<not>hates x butler \<or> \<not>hates x charles) \<longrightarrow>  | 
|
| 14249 | 767  | 
(\<exists>x. killed x agatha)"  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
768  | 
by meson  | 
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
769  | 
|
| 61343 | 770  | 
text\<open>Problem 57\<close>  | 
| 69420 | 771  | 
lemma "P (f a b) (f b c) \<and> P (f b c) (f a c) \<and>  | 
772  | 
(\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z) \<longrightarrow> P (f a b) (f a c)"  | 
|
| 16011 | 773  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
774  | 
|
| 61343 | 775  | 
text\<open>Problem 58: Challenge found on info-hol\<close>  | 
| 69420 | 776  | 
lemma "\<forall>P Q R x. \<exists>v w. \<forall>y z. P x \<and> Q y \<longrightarrow> (P v \<or> R w) \<and> (R z \<longrightarrow> Q v)"  | 
| 16011 | 777  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
778  | 
|
| 61343 | 779  | 
text\<open>Problem 59\<close>  | 
| 69420 | 780  | 
lemma "(\<forall>x. P x = (\<not>P(f x))) \<longrightarrow> (\<exists>x. P x \<and> \<not>P(f x))"  | 
| 16011 | 781  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
782  | 
|
| 61343 | 783  | 
text\<open>Problem 60\<close>  | 
| 69420 | 784  | 
lemma "\<forall>x. P x (f x) = (\<exists>y. (\<forall>z. P z y \<longrightarrow> P z (f x)) \<and> P x y)"  | 
| 16011 | 785  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
786  | 
|
| 61343 | 787  | 
text\<open>Problem 62 as corrected in JAR 18 (1997), page 135\<close>  | 
| 69420 | 788  | 
lemma "(\<forall>x. p a \<and> (p x \<longrightarrow> p(f x)) \<longrightarrow> p(f(f x))) =  | 
789  | 
(\<forall>x. (\<not> p a \<or> p x \<or> p(f(f x))) \<and>  | 
|
790  | 
(\<not> p a \<or> \<not> p(f x) \<or> p(f(f x))))"  | 
|
| 16011 | 791  | 
by blast  | 
792  | 
||
| 66303 | 793  | 
text\<open>Charles Morgan's problems\<close>  | 
794  | 
context  | 
|
795  | 
fixes T i n  | 
|
796  | 
assumes a: "\<forall>x y. T(i x(i y x))"  | 
|
797  | 
and b: "\<forall>x y z. T(i (i x (i y z)) (i (i x y) (i x z)))"  | 
|
798  | 
and c: "\<forall>x y. T(i (i (n x) (n y)) (i y x))"  | 
|
799  | 
and c': "\<forall>x y. T(i (i y x) (i (n x) (n y)))"  | 
|
| 69420 | 800  | 
and d: "\<forall>x y. T(i x y) \<and> T x \<longrightarrow> T y"  | 
| 66303 | 801  | 
begin  | 
| 16011 | 802  | 
|
| 66303 | 803  | 
lemma "\<forall>x. T(i x x)"  | 
804  | 
using a b d by blast  | 
|
805  | 
||
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
806  | 
lemma "\<forall>x. T(i x (n(n x)))" \<comment> \<open>Problem 66\<close>  | 
| 66303 | 807  | 
using a b c d by metis  | 
808  | 
||
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
809  | 
lemma "\<forall>x. T(i (n(n x)) x)" \<comment> \<open>Problem 67\<close>  | 
| 
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
810  | 
using a b c d by meson \<comment> \<open>4.9s on griffon. 51061 inferences, depth 21\<close>  | 
| 66303 | 811  | 
|
| 
67443
 
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
 
wenzelm 
parents: 
66303 
diff
changeset
 | 
812  | 
lemma "\<forall>x. T(i x (n(n x)))" \<comment> \<open>Problem 68: not proved. Listed as satisfiable in TPTP (LCL078-1)\<close>  | 
| 66303 | 813  | 
using a b c' d oops  | 
814  | 
||
815  | 
end  | 
|
| 16011 | 816  | 
|
| 61343 | 817  | 
text\<open>Problem 71, as found in TPTP (SYN007+1.005)\<close>  | 
| 16011 | 818  | 
lemma "p1 = (p2 = (p3 = (p4 = (p5 = (p1 = (p2 = (p3 = (p4 = p5))))))))"  | 
| 66303 | 819  | 
by blast  | 
| 
14220
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
820  | 
|
| 
 
4dc132902672
Merging of ex/cla.ML and ex/mesontest.ML to ex/Classical.thy
 
paulson 
parents:  
diff
changeset
 | 
821  | 
end  |