clasohm@0: (* Title: FOL/ex/int clasohm@0: ID: \$Id\$ clasohm@0: Author: Lawrence C Paulson, Cambridge University Computer Laboratory clasohm@0: Copyright 1991 University of Cambridge clasohm@0: clasohm@0: Intuitionistic First-Order Logic clasohm@0: clasohm@0: Single-step commands: clasohm@0: by (Int.step_tac 1); clasohm@0: by (biresolve_tac safe_brls 1); clasohm@0: by (biresolve_tac haz_brls 1); clasohm@0: by (assume_tac 1); clasohm@0: by (Int.safe_tac 1); clasohm@0: by (Int.mp_tac 1); clasohm@0: by (Int.fast_tac 1); clasohm@0: *) clasohm@0: clasohm@0: writeln"File FOL/ex/int."; clasohm@0: clasohm@0: (*Note: for PROPOSITIONAL formulae... clasohm@0: ~A is classically provable iff it is intuitionistically provable. clasohm@0: Therefore A is classically provable iff ~~A is intuitionistically provable. clasohm@0: clasohm@0: Let Q be the conjuction of the propositions A|~A, one for each atom A in clasohm@0: P. If P is provable classically, then clearly P&Q is provable clasohm@0: intuitionistically, so ~~(P&Q) is also provable intuitionistically. clasohm@0: The latter is intuitionistically equivalent to ~~P&~~Q, hence to ~~P, clasohm@0: since ~~Q is intuitionistically provable. Finally, if P is a negation then clasohm@0: ~~P is intuitionstically equivalent to P. [Andy Pitts] clasohm@0: *) clasohm@0: clasohm@0: goal IFOLP.thy "?p : ~~(P&Q) <-> ~~P & ~~Q"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ~~~P <-> ~P"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ~~((P --> Q | R) --> (P-->Q) | (P-->R))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : (P<->Q) <-> (Q<->P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: clasohm@0: writeln"Lemmas for the propositional double-negation translation"; clasohm@0: clasohm@0: goal IFOLP.thy "?p : P --> ~~P"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ~~(~~P --> P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ~~P & ~~(P --> Q) --> ~~Q"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: clasohm@0: writeln"The following are classically but not constructively valid."; clasohm@0: clasohm@0: (*The attempt to prove them terminates quickly!*) clasohm@0: goal IFOLP.thy "?p : ((P-->Q) --> P) --> P"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: (*Check that subgoals remain: proof failed.*) clasohm@0: getgoal 1; clasohm@0: clasohm@0: goal IFOLP.thy "?p : (P&Q-->R) --> (P-->R) | (Q-->R)"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: getgoal 1; clasohm@0: clasohm@0: clasohm@0: writeln"Intuitionistic FOL: propositional problems based on Pelletier."; clasohm@0: clasohm@0: writeln"Problem ~~1"; clasohm@0: goal IFOLP.thy "?p : ~~((P-->Q) <-> (~Q --> ~P))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: (*5 secs*) clasohm@0: clasohm@0: clasohm@0: writeln"Problem ~~2"; clasohm@0: goal IFOLP.thy "?p : ~~(~~P <-> P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: (*1 secs*) clasohm@0: clasohm@0: clasohm@0: writeln"Problem 3"; clasohm@0: goal IFOLP.thy "?p : ~(P-->Q) --> (Q-->P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~4"; clasohm@0: goal IFOLP.thy "?p : ~~((~P-->Q) <-> (~Q --> P))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: (*9 secs*) clasohm@0: clasohm@0: writeln"Problem ~~5"; clasohm@0: goal IFOLP.thy "?p : ~~((P|Q-->P|R) --> P|(Q-->R))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: (*10 secs*) clasohm@0: clasohm@0: clasohm@0: writeln"Problem ~~6"; clasohm@0: goal IFOLP.thy "?p : ~~(P | ~P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~7"; clasohm@0: goal IFOLP.thy "?p : ~~(P | ~~~P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~8. Peirce's law"; clasohm@0: goal IFOLP.thy "?p : ~~(((P-->Q) --> P) --> P)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 9"; clasohm@0: goal IFOLP.thy "?p : ((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: (*9 secs*) clasohm@0: clasohm@0: clasohm@0: writeln"Problem 10"; clasohm@0: goal IFOLP.thy "?p : (Q-->R) --> (R-->P&Q) --> (P-->(Q|R)) --> (P<->Q)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"11. Proved in each direction (incorrectly, says Pelletier!!) "; clasohm@0: goal IFOLP.thy "?p : P<->P"; clasohm@0: by (Int.fast_tac 1); clasohm@0: clasohm@0: writeln"Problem ~~12. Dijkstra's law "; clasohm@0: goal IFOLP.thy "?p : ~~(((P <-> Q) <-> R) <-> (P <-> (Q <-> R)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ((P <-> Q) <-> R) --> ~~(P <-> (Q <-> R))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 13. Distributive law"; clasohm@0: goal IFOLP.thy "?p : P | (Q & R) <-> (P | Q) & (P | R)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~14"; clasohm@0: goal IFOLP.thy "?p : ~~((P <-> Q) <-> ((Q | ~P) & (~Q|P)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~15"; clasohm@0: goal IFOLP.thy "?p : ~~((P --> Q) <-> (~P | Q))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~16"; clasohm@0: goal IFOLP.thy "?p : ~~((P-->Q) | (Q-->P))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~17"; clasohm@0: goal IFOLP.thy clasohm@0: "?p : ~~(((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: (*over 5 minutes?? -- printing the proof term takes 40 secs!!*) clasohm@0: result(); clasohm@0: clasohm@0: clasohm@0: writeln"** Examples with quantifiers **"; clasohm@0: clasohm@0: writeln"The converse is classical in the following implications..."; clasohm@0: clasohm@0: goal IFOLP.thy "?p : (EX x.P(x)-->Q) --> (ALL x.P(x)) --> Q"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ((ALL x.P(x))-->Q) --> ~ (ALL x. P(x) & ~Q)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : ((ALL x. ~P(x))-->Q) --> ~ (ALL x. ~ (P(x)|Q))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : (ALL x.P(x)) | Q --> (ALL x. P(x) | Q)"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: goal IFOLP.thy "?p : (EX x. P --> Q(x)) --> (P --> (EX x. Q(x)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: clasohm@0: clasohm@0: clasohm@0: writeln"The following are not constructively valid!"; clasohm@0: (*The attempt to prove them terminates quickly!*) clasohm@0: clasohm@0: goal IFOLP.thy "?p : ((ALL x.P(x))-->Q) --> (EX x.P(x)-->Q)"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: getgoal 1; clasohm@0: clasohm@0: goal IFOLP.thy "?p : (P --> (EX x.Q(x))) --> (EX x. P-->Q(x))"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: getgoal 1; clasohm@0: clasohm@0: goal IFOLP.thy "?p : (ALL x. P(x) | Q) --> ((ALL x.P(x)) | Q)"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: getgoal 1; clasohm@0: clasohm@0: goal IFOLP.thy "?p : (ALL x. ~~P(x)) --> ~~(ALL x. P(x))"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: getgoal 1; clasohm@0: clasohm@0: (*Classically but not intuitionistically valid. Proved by a bug in 1986!*) clasohm@0: goal IFOLP.thy "?p : EX x. Q(x) --> (ALL x. Q(x))"; clasohm@0: by (Int.fast_tac 1) handle ERROR => writeln"Failed, as expected"; clasohm@0: getgoal 1; clasohm@0: clasohm@0: clasohm@0: writeln"Hard examples with quantifiers"; clasohm@0: clasohm@0: (*The ones that have not been proved are not known to be valid! clasohm@0: Some will require quantifier duplication -- not currently available*) clasohm@0: clasohm@0: writeln"Problem ~~18"; clasohm@0: goal IFOLP.thy "?p : ~~(EX y. ALL x. P(y)-->P(x))"; clasohm@0: (*NOT PROVED*) clasohm@0: clasohm@0: writeln"Problem ~~19"; clasohm@0: goal IFOLP.thy "?p : ~~(EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x)))"; clasohm@0: (*NOT PROVED*) clasohm@0: clasohm@0: writeln"Problem 20"; clasohm@0: goal IFOLP.thy "?p : (ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w))) \ clasohm@0: \ --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 21"; clasohm@0: goal IFOLP.thy clasohm@0: "?p : (EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> ~~(EX x. P<->Q(x))"; clasohm@0: (*NOT PROVED*) clasohm@0: clasohm@0: writeln"Problem 22"; clasohm@0: goal IFOLP.thy "?p : (ALL x. P <-> Q(x)) --> (P <-> (ALL x. Q(x)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~23"; clasohm@0: goal IFOLP.thy "?p : ~~ ((ALL x. P | Q(x)) <-> (P | (ALL x. Q(x))))"; clasohm@0: by (Int.best_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 24"; clasohm@0: goal IFOLP.thy "?p : ~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) & \ clasohm@0: \ ~(EX x.P(x)) --> (EX x.Q(x)) & (ALL x. Q(x)|R(x) --> S(x)) \ clasohm@0: \ --> (EX x. P(x)&R(x))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 25"; clasohm@0: goal IFOLP.thy "?p : (EX x. P(x)) & \ clasohm@0: \ (ALL x. L(x) --> ~ (M(x) & R(x))) & \ clasohm@0: \ (ALL x. P(x) --> (M(x) & L(x))) & \ clasohm@0: \ ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x))) \ clasohm@0: \ --> (EX x. Q(x)&P(x))"; clasohm@0: by (Int.best_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 29. Essentially the same as Principia Mathematica *11.71"; clasohm@0: goal IFOLP.thy "?p : (EX x. P(x)) & (EX y. Q(y)) \ clasohm@0: \ --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y)) <-> \ clasohm@0: \ (ALL x y. P(x) & Q(y) --> R(x) & S(y)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem ~~30"; clasohm@0: goal IFOLP.thy "?p : (ALL x. (P(x) | Q(x)) --> ~ R(x)) & \ clasohm@0: \ (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x)) \ clasohm@0: \ --> (ALL x. ~~S(x))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 31"; clasohm@0: goal IFOLP.thy "?p : ~(EX x.P(x) & (Q(x) | R(x))) & \ clasohm@0: \ (EX x. L(x) & P(x)) & \ clasohm@0: \ (ALL x. ~ R(x) --> M(x)) \ clasohm@0: \ --> (EX x. L(x) & M(x))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 32"; clasohm@0: goal IFOLP.thy "?p : (ALL x. P(x) & (Q(x)|R(x))-->S(x)) & \ clasohm@0: \ (ALL x. S(x) & R(x) --> L(x)) & \ clasohm@0: \ (ALL x. M(x) --> R(x)) \ clasohm@0: \ --> (ALL x. P(x) & M(x) --> L(x))"; clasohm@0: by (Int.best_tac 1); (*SLOW*) clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 39"; clasohm@0: goal IFOLP.thy "?p : ~ (EX x. ALL y. F(y,x) <-> ~F(y,y))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 40. AMENDED"; clasohm@0: goal IFOLP.thy "?p : (EX y. ALL x. F(x,y) <-> F(x,x)) --> \ clasohm@0: \ ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 44"; clasohm@0: goal IFOLP.thy "?p : (ALL x. f(x) --> \ clasohm@0: \ (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y)))) & \ clasohm@0: \ (EX x. j(x) & (ALL y. g(y) --> h(x,y))) \ clasohm@0: \ --> (EX x. j(x) & ~f(x))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 48"; clasohm@0: goal IFOLP.thy "?p : (a=b | c=d) & (a=c | b=d) --> a=d | b=c"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 51"; clasohm@0: goal IFOLP.thy clasohm@0: "?p : (EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> \ clasohm@0: \ (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)"; clasohm@0: by (Int.best_tac 1); (*60 seconds*) clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 56"; clasohm@0: goal IFOLP.thy clasohm@0: "?p : (ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 57"; clasohm@0: goal IFOLP.thy clasohm@0: "?p : P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & \ clasohm@0: \ (ALL x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Problem 60"; clasohm@0: goal IFOLP.thy clasohm@0: "?p : ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"; clasohm@0: by (Int.fast_tac 1); clasohm@0: result(); clasohm@0: clasohm@0: writeln"Reached end of file.";