| author | wenzelm | 
| Sun, 06 Jan 2002 16:51:48 +0100 | |
| changeset 12651 | 930df4604b36 | 
| parent 9205 | f171fa6a0989 | 
| child 15531 | 08c8dad8e399 | 
| permissions | -rw-r--r-- | 
| 9205 | 1  | 
(* Title: FOL/ex/int.ML  | 
| 0 | 2  | 
ID: $Id$  | 
| 1459 | 3  | 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory  | 
| 0 | 4  | 
Copyright 1991 University of Cambridge  | 
5  | 
||
| 9205 | 6  | 
Intuitionistic First-Order Logic.  | 
| 0 | 7  | 
|
8  | 
Single-step commands:  | 
|
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
9  | 
by (IntPr.step_tac 1);  | 
| 0 | 10  | 
by (biresolve_tac safe_brls 1);  | 
11  | 
by (biresolve_tac haz_brls 1);  | 
|
12  | 
by (assume_tac 1);  | 
|
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
13  | 
by (IntPr.safe_tac 1);  | 
| 
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
14  | 
by (IntPr.mp_tac 1);  | 
| 
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
15  | 
by (IntPr.fast_tac 1);  | 
| 0 | 16  | 
*)  | 
17  | 
||
18  | 
||
| 1006 | 19  | 
(*Metatheorem (for PROPOSITIONAL formulae...):  | 
20  | 
P is classically provable iff ~~P is intuitionistically provable.  | 
|
21  | 
Therefore ~P is classically provable iff it is intuitionistically provable.  | 
|
| 0 | 22  | 
|
| 1006 | 23  | 
Proof: Let Q be the conjuction of the propositions A|~A, one for each atom A  | 
24  | 
in P. Now ~~Q is intuitionistically provable because ~~(A|~A) is and because  | 
|
25  | 
~~ distributes over &. If P is provable classically, then clearly Q-->P is  | 
|
26  | 
provable intuitionistically, so ~~(Q-->P) is also provable intuitionistically.  | 
|
27  | 
The latter is intuitionistically equivalent to ~~Q-->~~P, hence to ~~P, since  | 
|
28  | 
~~Q is intuitionistically provable. Finally, if P is a negation then ~~P is  | 
|
29  | 
intuitionstically equivalent to P. [Andy Pitts] *)  | 
|
| 0 | 30  | 
|
| 5203 | 31  | 
Goal "~~(P&Q) <-> ~~P & ~~Q";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
32  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 33  | 
qed "";  | 
| 0 | 34  | 
|
| 8273 | 35  | 
Goal "~~ ((~P --> Q) --> (~P --> ~Q) --> P)";  | 
36  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 37  | 
qed "";  | 
| 8273 | 38  | 
|
| 1006 | 39  | 
(* ~~ does NOT distribute over | *)  | 
40  | 
||
| 5203 | 41  | 
Goal "~~(P-->Q) <-> (~~P --> ~~Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
42  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 43  | 
qed "";  | 
| 1006 | 44  | 
|
| 5203 | 45  | 
Goal "~~~P <-> ~P";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
46  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 47  | 
qed "";  | 
| 0 | 48  | 
|
| 5203 | 49  | 
Goal "~~((P --> Q | R) --> (P-->Q) | (P-->R))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
50  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 51  | 
qed "";  | 
| 0 | 52  | 
|
| 5203 | 53  | 
Goal "(P<->Q) <-> (Q<->P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
54  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 55  | 
qed "";  | 
| 0 | 56  | 
|
| 8273 | 57  | 
Goal "((P --> (Q | (Q-->R))) --> R) --> R";  | 
58  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 59  | 
qed "";  | 
| 8273 | 60  | 
|
61  | 
Goal "(((G-->A) --> J) --> D --> E) --> (((H-->B)-->I)-->C-->J) \  | 
|
62  | 
\ --> (A-->H) --> F --> G --> (((C-->B)-->I)-->D)-->(A-->C) \  | 
|
63  | 
\ --> (((F-->A)-->B) --> I) --> E";  | 
|
64  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 65  | 
qed "";  | 
| 8273 | 66  | 
|
| 0 | 67  | 
|
68  | 
writeln"Lemmas for the propositional double-negation translation";  | 
|
69  | 
||
| 5203 | 70  | 
Goal "P --> ~~P";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
71  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 72  | 
qed "";  | 
| 0 | 73  | 
|
| 5203 | 74  | 
Goal "~~(~~P --> P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
75  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 76  | 
qed "";  | 
| 0 | 77  | 
|
| 5203 | 78  | 
Goal "~~P & ~~(P --> Q) --> ~~Q";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
79  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 80  | 
qed "";  | 
| 0 | 81  | 
|
82  | 
||
83  | 
writeln"The following are classically but not constructively valid.";  | 
|
84  | 
||
85  | 
(*The attempt to prove them terminates quickly!*)  | 
|
| 5203 | 86  | 
Goal "((P-->Q) --> P) --> P";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
87  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 88  | 
(*Check that subgoals remain: proof failed.*)  | 
89  | 
getgoal 1;  | 
|
90  | 
||
| 5203 | 91  | 
Goal "(P&Q-->R) --> (P-->R) | (Q-->R)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
92  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 93  | 
getgoal 1;  | 
94  | 
||
95  | 
||
| 2687 | 96  | 
writeln"de Bruijn formulae";  | 
97  | 
||
98  | 
(*de Bruijn formula with three predicates*)  | 
|
| 5203 | 99  | 
Goal "((P<->Q) --> P&Q&R) & \  | 
| 2687 | 100  | 
\ ((Q<->R) --> P&Q&R) & \  | 
101  | 
\ ((R<->P) --> P&Q&R) --> P&Q&R";  | 
|
102  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 103  | 
qed "";  | 
| 2687 | 104  | 
|
105  | 
||
106  | 
(*de Bruijn formula with five predicates*)  | 
|
| 5203 | 107  | 
Goal "((P<->Q) --> P&Q&R&S&T) & \  | 
| 2687 | 108  | 
\ ((Q<->R) --> P&Q&R&S&T) & \  | 
109  | 
\ ((R<->S) --> P&Q&R&S&T) & \  | 
|
110  | 
\ ((S<->T) --> P&Q&R&S&T) & \  | 
|
111  | 
\ ((T<->P) --> P&Q&R&S&T) --> P&Q&R&S&T";  | 
|
112  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 113  | 
qed "";  | 
| 2687 | 114  | 
|
115  | 
||
| 5203 | 116  | 
(*** Problems from of Sahlin, Franzen and Haridi,  | 
| 8319 | 117  | 
An Intuitionistic Predicate Logic Theorem Prover.  | 
118  | 
J. Logic and Comp. 2 (5), October 1992, 619-656.  | 
|
| 5203 | 119  | 
***)  | 
120  | 
||
121  | 
(*Problem 1.1*)  | 
|
122  | 
Goal "(ALL x. EX y. ALL z. p(x) & q(y) & r(z)) <-> \  | 
|
123  | 
\ (ALL z. EX y. ALL x. p(x) & q(y) & r(z))";  | 
|
124  | 
(*  | 
|
| 8273 | 125  | 
by (IntPr.best_dup_tac 1); (*65 seconds on a Pentium III! Is it worth it?*)  | 
| 5203 | 126  | 
*)  | 
127  | 
||
128  | 
(*Problem 3.1*)  | 
|
129  | 
Goal "~ (EX x. ALL y. mem(y,x) <-> ~ mem(x,x))";  | 
|
130  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 131  | 
qed "";  | 
| 5203 | 132  | 
|
133  | 
(*Problem 4.1: hopeless!*)  | 
|
134  | 
Goal "(ALL x. p(x) --> p(h(x)) | p(g(x))) & (EX x. p(x)) & (ALL x. ~p(h(x))) \  | 
|
135  | 
\ --> (EX x. p(g(g(g(g(g(x)))))))";  | 
|
136  | 
||
137  | 
||
| 0 | 138  | 
writeln"Intuitionistic FOL: propositional problems based on Pelletier.";  | 
139  | 
||
140  | 
writeln"Problem ~~1";  | 
|
| 5203 | 141  | 
Goal "~~((P-->Q) <-> (~Q --> ~P))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
142  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 143  | 
qed "";  | 
| 0 | 144  | 
|
145  | 
||
146  | 
writeln"Problem ~~2";  | 
|
| 5203 | 147  | 
Goal "~~(~~P <-> P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
148  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 149  | 
qed "";  | 
| 0 | 150  | 
(*1 secs*)  | 
151  | 
||
152  | 
||
153  | 
writeln"Problem 3";  | 
|
| 5203 | 154  | 
Goal "~(P-->Q) --> (Q-->P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
155  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 156  | 
qed "";  | 
| 0 | 157  | 
|
158  | 
writeln"Problem ~~4";  | 
|
| 5203 | 159  | 
Goal "~~((~P-->Q) <-> (~Q --> P))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
160  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 161  | 
qed "";  | 
| 0 | 162  | 
(*9 secs*)  | 
163  | 
||
164  | 
writeln"Problem ~~5";  | 
|
| 5203 | 165  | 
Goal "~~((P|Q-->P|R) --> P|(Q-->R))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
166  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 167  | 
qed "";  | 
| 0 | 168  | 
(*10 secs*)  | 
169  | 
||
170  | 
||
171  | 
writeln"Problem ~~6";  | 
|
| 5203 | 172  | 
Goal "~~(P | ~P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
173  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 174  | 
qed "";  | 
| 0 | 175  | 
|
176  | 
writeln"Problem ~~7";  | 
|
| 5203 | 177  | 
Goal "~~(P | ~~~P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
178  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 179  | 
qed "";  | 
| 0 | 180  | 
|
181  | 
writeln"Problem ~~8. Peirce's law";  | 
|
| 5203 | 182  | 
Goal "~~(((P-->Q) --> P) --> P)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
183  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 184  | 
qed "";  | 
| 0 | 185  | 
|
186  | 
writeln"Problem 9";  | 
|
| 5203 | 187  | 
Goal "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
188  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 189  | 
qed "";  | 
| 0 | 190  | 
(*9 secs*)  | 
191  | 
||
192  | 
||
193  | 
writeln"Problem 10";  | 
|
| 5203 | 194  | 
Goal "(Q-->R) --> (R-->P&Q) --> (P-->(Q|R)) --> (P<->Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
195  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 196  | 
qed "";  | 
| 0 | 197  | 
|
198  | 
writeln"11. Proved in each direction (incorrectly, says Pelletier!!) ";  | 
|
| 5203 | 199  | 
Goal "P<->P";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
200  | 
by (IntPr.fast_tac 1);  | 
| 0 | 201  | 
|
202  | 
writeln"Problem ~~12. Dijkstra's law ";  | 
|
| 5203 | 203  | 
Goal "~~(((P <-> Q) <-> R) <-> (P <-> (Q <-> R)))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
204  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 205  | 
qed "";  | 
| 0 | 206  | 
|
| 5203 | 207  | 
Goal "((P <-> Q) <-> R) --> ~~(P <-> (Q <-> R))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
208  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 209  | 
qed "";  | 
| 0 | 210  | 
|
211  | 
writeln"Problem 13. Distributive law";  | 
|
| 5203 | 212  | 
Goal "P | (Q & R) <-> (P | Q) & (P | R)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
213  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 214  | 
qed "";  | 
| 0 | 215  | 
|
216  | 
writeln"Problem ~~14";  | 
|
| 5203 | 217  | 
Goal "~~((P <-> Q) <-> ((Q | ~P) & (~Q|P)))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
218  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 219  | 
qed "";  | 
| 0 | 220  | 
|
221  | 
writeln"Problem ~~15";  | 
|
| 5203 | 222  | 
Goal "~~((P --> Q) <-> (~P | Q))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
223  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 224  | 
qed "";  | 
| 0 | 225  | 
|
226  | 
writeln"Problem ~~16";  | 
|
| 5203 | 227  | 
Goal "~~((P-->Q) | (Q-->P))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
228  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 229  | 
qed "";  | 
| 0 | 230  | 
|
231  | 
writeln"Problem ~~17";  | 
|
| 5203 | 232  | 
Goal  | 
| 0 | 233  | 
"~~(((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S)))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
234  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 235  | 
qed "";  | 
| 0 | 236  | 
|
237  | 
(*Dijkstra's "Golden Rule"*)  | 
|
| 5203 | 238  | 
Goal "(P&Q) <-> P <-> Q <-> (P|Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
239  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 240  | 
qed "";  | 
| 0 | 241  | 
|
242  | 
||
| 232 | 243  | 
writeln"****Examples with quantifiers****";  | 
| 0 | 244  | 
|
245  | 
||
246  | 
writeln"The converse is classical in the following implications...";  | 
|
247  | 
||
| 5203 | 248  | 
Goal "(EX x. P(x)-->Q) --> (ALL x. P(x)) --> Q";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
249  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 250  | 
qed "";  | 
| 0 | 251  | 
|
| 5203 | 252  | 
Goal "((ALL x. P(x))-->Q) --> ~ (ALL x. P(x) & ~Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
253  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 254  | 
qed "";  | 
| 0 | 255  | 
|
| 5203 | 256  | 
Goal "((ALL x. ~P(x))-->Q) --> ~ (ALL x. ~ (P(x)|Q))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
257  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 258  | 
qed "";  | 
| 0 | 259  | 
|
| 5203 | 260  | 
Goal "(ALL x. P(x)) | Q --> (ALL x. P(x) | Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
261  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 262  | 
qed "";  | 
| 0 | 263  | 
|
| 5203 | 264  | 
Goal "(EX x. P --> Q(x)) --> (P --> (EX x. Q(x)))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
265  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 266  | 
qed "";  | 
| 0 | 267  | 
|
268  | 
||
269  | 
||
270  | 
||
271  | 
writeln"The following are not constructively valid!";  | 
|
272  | 
(*The attempt to prove them terminates quickly!*)  | 
|
273  | 
||
| 5203 | 274  | 
Goal "((ALL x. P(x))-->Q) --> (EX x. P(x)-->Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
275  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 276  | 
getgoal 1;  | 
277  | 
||
| 5203 | 278  | 
Goal "(P --> (EX x. Q(x))) --> (EX x. P-->Q(x))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
279  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 280  | 
getgoal 1;  | 
281  | 
||
| 5203 | 282  | 
Goal "(ALL x. P(x) | Q) --> ((ALL x. P(x)) | Q)";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
283  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 284  | 
getgoal 1;  | 
285  | 
||
| 5203 | 286  | 
Goal "(ALL x. ~~P(x)) --> ~~(ALL x. P(x))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
287  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 288  | 
getgoal 1;  | 
289  | 
||
290  | 
(*Classically but not intuitionistically valid. Proved by a bug in 1986!*)  | 
|
| 5203 | 291  | 
Goal "EX x. Q(x) --> (ALL x. Q(x))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
292  | 
by (IntPr.fast_tac 1) handle ERROR => writeln"Failed, as expected";  | 
| 0 | 293  | 
getgoal 1;  | 
294  | 
||
295  | 
||
296  | 
writeln"Hard examples with quantifiers";  | 
|
297  | 
||
298  | 
(*The ones that have not been proved are not known to be valid!  | 
|
299  | 
Some will require quantifier duplication -- not currently available*)  | 
|
300  | 
||
301  | 
writeln"Problem ~~18";  | 
|
| 5203 | 302  | 
Goal "~~(EX y. ALL x. P(y)-->P(x))";  | 
| 0 | 303  | 
(*NOT PROVED*)  | 
304  | 
||
305  | 
writeln"Problem ~~19";  | 
|
| 5203 | 306  | 
Goal "~~(EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x)))";  | 
| 0 | 307  | 
(*NOT PROVED*)  | 
308  | 
||
309  | 
writeln"Problem 20";  | 
|
| 5203 | 310  | 
Goal "(ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w))) \  | 
| 0 | 311  | 
\ --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
312  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 313  | 
qed "";  | 
| 0 | 314  | 
|
315  | 
writeln"Problem 21";  | 
|
| 5203 | 316  | 
Goal "(EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> ~~(EX x. P<->Q(x))";  | 
| 
2573
 
f3e04805895a
Correction to Problem 24 (with unsatisfactory proof)
 
paulson 
parents: 
1459 
diff
changeset
 | 
317  | 
(*NOT PROVED; needs quantifier duplication*)  | 
| 0 | 318  | 
|
319  | 
writeln"Problem 22";  | 
|
| 5203 | 320  | 
Goal "(ALL x. P <-> Q(x)) --> (P <-> (ALL x. Q(x)))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
321  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 322  | 
qed "";  | 
| 0 | 323  | 
|
324  | 
writeln"Problem ~~23";  | 
|
| 5203 | 325  | 
Goal "~~ ((ALL x. P | Q(x)) <-> (P | (ALL x. Q(x))))";  | 
326  | 
by (IntPr.fast_tac 1);  | 
|
| 9205 | 327  | 
qed "";  | 
| 0 | 328  | 
|
329  | 
writeln"Problem 24";  | 
|
| 5203 | 330  | 
Goal "~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) & \  | 
| 3835 | 331  | 
\ (~(EX x. P(x)) --> (EX x. Q(x))) & (ALL x. Q(x)|R(x) --> S(x)) \  | 
| 
2573
 
f3e04805895a
Correction to Problem 24 (with unsatisfactory proof)
 
paulson 
parents: 
1459 
diff
changeset
 | 
332  | 
\ --> ~~(EX x. P(x)&R(x))";  | 
| 
 
f3e04805895a
Correction to Problem 24 (with unsatisfactory proof)
 
paulson 
parents: 
1459 
diff
changeset
 | 
333  | 
(*Not clear why fast_tac, best_tac, ASTAR and ITER_DEEPEN all take forever*)  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
334  | 
by IntPr.safe_tac;  | 
| 
2573
 
f3e04805895a
Correction to Problem 24 (with unsatisfactory proof)
 
paulson 
parents: 
1459 
diff
changeset
 | 
335  | 
by (etac impE 1);  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
336  | 
by (IntPr.fast_tac 1);  | 
| 
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
337  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 338  | 
qed "";  | 
| 0 | 339  | 
|
340  | 
writeln"Problem 25";  | 
|
| 5203 | 341  | 
Goal "(EX x. P(x)) & \  | 
| 0 | 342  | 
\ (ALL x. L(x) --> ~ (M(x) & R(x))) & \  | 
343  | 
\ (ALL x. P(x) --> (M(x) & L(x))) & \  | 
|
344  | 
\ ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x))) \  | 
|
345  | 
\ --> (EX x. Q(x)&P(x))";  | 
|
| 5203 | 346  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 347  | 
qed "";  | 
| 0 | 348  | 
|
349  | 
writeln"Problem ~~26";  | 
|
| 5203 | 350  | 
Goal "(~~(EX x. p(x)) <-> ~~(EX x. q(x))) & \  | 
| 1459 | 351  | 
\ (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y))) \  | 
| 0 | 352  | 
\ --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))";  | 
353  | 
(*NOT PROVED*)  | 
|
354  | 
||
355  | 
writeln"Problem 27";  | 
|
| 5203 | 356  | 
Goal "(EX x. P(x) & ~Q(x)) & \  | 
| 0 | 357  | 
\ (ALL x. P(x) --> R(x)) & \  | 
358  | 
\ (ALL x. M(x) & L(x) --> P(x)) & \  | 
|
359  | 
\ ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x))) \  | 
|
360  | 
\ --> (ALL x. M(x) --> ~L(x))";  | 
|
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
361  | 
by (IntPr.fast_tac 1); (*21 secs*)  | 
| 9205 | 362  | 
qed "";  | 
| 0 | 363  | 
|
364  | 
writeln"Problem ~~28. AMENDED";  | 
|
| 5203 | 365  | 
Goal "(ALL x. P(x) --> (ALL x. Q(x))) & \  | 
| 0 | 366  | 
\ (~~(ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) & \  | 
| 3835 | 367  | 
\ (~~(EX x. S(x)) --> (ALL x. L(x) --> M(x))) \  | 
| 0 | 368  | 
\ --> (ALL x. P(x) & L(x) --> M(x))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
369  | 
by (IntPr.fast_tac 1); (*48 secs*)  | 
| 9205 | 370  | 
qed "";  | 
| 0 | 371  | 
|
372  | 
writeln"Problem 29. Essentially the same as Principia Mathematica *11.71";  | 
|
| 5203 | 373  | 
Goal "(EX x. P(x)) & (EX y. Q(y)) \  | 
| 0 | 374  | 
\ --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y)) <-> \  | 
375  | 
\ (ALL x y. P(x) & Q(y) --> R(x) & S(y)))";  | 
|
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
376  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 377  | 
qed "";  | 
| 0 | 378  | 
|
379  | 
writeln"Problem ~~30";  | 
|
| 5203 | 380  | 
Goal "(ALL x. (P(x) | Q(x)) --> ~ R(x)) & \  | 
| 0 | 381  | 
\ (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x)) \  | 
382  | 
\ --> (ALL x. ~~S(x))";  | 
|
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
383  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 384  | 
qed "";  | 
| 0 | 385  | 
|
386  | 
writeln"Problem 31";  | 
|
| 5203 | 387  | 
Goal "~(EX x. P(x) & (Q(x) | R(x))) & \  | 
| 0 | 388  | 
\ (EX x. L(x) & P(x)) & \  | 
389  | 
\ (ALL x. ~ R(x) --> M(x)) \  | 
|
390  | 
\ --> (EX x. L(x) & M(x))";  | 
|
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
391  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 392  | 
qed "";  | 
| 0 | 393  | 
|
394  | 
writeln"Problem 32";  | 
|
| 5203 | 395  | 
Goal "(ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \  | 
| 0 | 396  | 
\ (ALL x. S(x) & R(x) --> L(x)) & \  | 
397  | 
\ (ALL x. M(x) --> R(x)) \  | 
|
398  | 
\ --> (ALL x. P(x) & M(x) --> L(x))";  | 
|
| 5203 | 399  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 400  | 
qed "";  | 
| 0 | 401  | 
|
402  | 
writeln"Problem ~~33";  | 
|
| 5203 | 403  | 
Goal "(ALL x. ~~(P(a) & (P(x)-->P(b))-->P(c))) <-> \  | 
404  | 
\ (ALL x. ~~((~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c))))";  | 
|
405  | 
by (IntPr.best_tac 1); (*1.67s*)  | 
|
| 9205 | 406  | 
qed "";  | 
| 0 | 407  | 
|
408  | 
||
409  | 
writeln"Problem 36";  | 
|
| 5203 | 410  | 
Goal  | 
| 0 | 411  | 
"(ALL x. EX y. J(x,y)) & \  | 
412  | 
\ (ALL x. EX y. G(x,y)) & \  | 
|
413  | 
\ (ALL x y. J(x,y) | G(x,y) --> (ALL z. J(y,z) | G(y,z) --> H(x,z))) \  | 
|
414  | 
\ --> (ALL x. EX y. H(x,y))";  | 
|
| 5203 | 415  | 
by (IntPr.fast_tac 1); (*5 secs*)  | 
| 9205 | 416  | 
qed "";  | 
| 0 | 417  | 
|
418  | 
writeln"Problem 37";  | 
|
| 5203 | 419  | 
Goal  | 
| 0 | 420  | 
"(ALL z. EX w. ALL x. EX y. \  | 
| 3835 | 421  | 
\ ~~(P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u. Q(u,w)))) & \  | 
| 0 | 422  | 
\ (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) & \  | 
423  | 
\ (~~(EX x y. Q(x,y)) --> (ALL x. R(x,x))) \  | 
|
424  | 
\ --> ~~(ALL x. EX y. R(x,y))";  | 
|
425  | 
(*NOT PROVED*)  | 
|
426  | 
||
427  | 
writeln"Problem 39";  | 
|
| 5203 | 428  | 
Goal "~ (EX x. ALL y. F(y,x) <-> ~F(y,y))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
429  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 430  | 
qed "";  | 
| 0 | 431  | 
|
432  | 
writeln"Problem 40. AMENDED";  | 
|
| 5203 | 433  | 
Goal "(EX y. ALL x. F(x,y) <-> F(x,x)) --> \  | 
| 0 | 434  | 
\ ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
435  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 436  | 
qed "";  | 
| 0 | 437  | 
|
438  | 
writeln"Problem 44";  | 
|
| 5203 | 439  | 
Goal "(ALL x. f(x) --> \  | 
| 1459 | 440  | 
\ (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y)))) & \  | 
441  | 
\ (EX x. j(x) & (ALL y. g(y) --> h(x,y))) \  | 
|
| 0 | 442  | 
\ --> (EX x. j(x) & ~f(x))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
443  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 444  | 
qed "";  | 
| 0 | 445  | 
|
446  | 
writeln"Problem 48";  | 
|
| 5203 | 447  | 
Goal "(a=b | c=d) & (a=c | b=d) --> a=d | b=c";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
448  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 449  | 
qed "";  | 
| 0 | 450  | 
|
451  | 
writeln"Problem 51";  | 
|
| 5203 | 452  | 
Goal "(EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> \  | 
| 0 | 453  | 
\ (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)";  | 
| 5203 | 454  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 455  | 
qed "";  | 
| 0 | 456  | 
|
457  | 
writeln"Problem 52";  | 
|
458  | 
(*Almost the same as 51. *)  | 
|
| 5203 | 459  | 
Goal "(EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> \  | 
| 0 | 460  | 
\ (EX w. ALL y. EX z. (ALL x. P(x,y) <-> x=z) <-> y=w)";  | 
| 5203 | 461  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 462  | 
qed "";  | 
| 0 | 463  | 
|
464  | 
writeln"Problem 56";  | 
|
| 5203 | 465  | 
Goal "(ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
466  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 467  | 
qed "";  | 
| 0 | 468  | 
|
469  | 
writeln"Problem 57";  | 
|
| 5203 | 470  | 
Goal "P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \  | 
| 0 | 471  | 
\ (ALL x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
472  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 473  | 
qed "";  | 
| 0 | 474  | 
|
475  | 
writeln"Problem 60";  | 
|
| 5203 | 476  | 
Goal "ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))";  | 
| 
2601
 
b301958c465d
Renamed structure Int (intuitionistic prover) to IntPr to prevent clash
 
paulson 
parents: 
2573 
diff
changeset
 | 
477  | 
by (IntPr.fast_tac 1);  | 
| 9205 | 478  | 
qed "";  |