# HG changeset patch # User wenzelm # Date 1445288407 -7200 # Node ID b8d375aee0dfa0ebe3c094c0d3f4965d25dfd154 # Parent d40cbf1f37c980e0d811565843af1dfa6c8d6705 more symbols; tunes whitespace; diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Classical.thy --- a/src/FOL/ex/Classical.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Classical.thy Mon Oct 19 23:00:07 2015 +0200 @@ -3,490 +3,526 @@ Copyright 1994 University of Cambridge *) -section\Classical Predicate Calculus Problems\ - -theory Classical imports FOL begin - -lemma "(P --> Q | R) --> (P-->Q) | (P-->R)" -by blast +section \Classical Predicate Calculus Problems\ -text\If and only if\ +theory Classical +imports FOL +begin -lemma "(P<->Q) <-> (Q<->P)" -by blast - -lemma "~ (P <-> ~P)" -by blast +lemma "(P \ Q \ R) \ (P \ Q) \ (P \ R)" + by blast -text\Sample problems from - F. J. Pelletier, - Seventy-Five Problems for Testing Automatic Theorem Provers, - J. Automated Reasoning 2 (1986), 191-216. - Errata, JAR 4 (1988), 236-236. +subsubsection \If and only if\ + +lemma "(P \ Q) \ (Q \ P)" + by blast + +lemma "\ (P \ \ P)" + by blast + + +subsection \Pelletier's examples\ -The hardest problems -- judging by experience with several theorem provers, -including matrix ones -- are 34 and 43. +text \ + Sample problems from + + \<^item> F. J. Pelletier, + Seventy-Five Problems for Testing Automatic Theorem Provers, + J. Automated Reasoning 2 (1986), 191-216. + Errata, JAR 4 (1988), 236-236. + + The hardest problems -- judging by experience with several theorem + provers, including matrix ones -- are 34 and 43. \ -subsection\Pelletier's examples\ - text\1\ -lemma "(P-->Q) <-> (~Q --> ~P)" -by blast +lemma "(P \ Q) \ (\ Q \ \ P)" + by blast text\2\ -lemma "~ ~ P <-> P" -by blast +lemma "\ \ P \ P" + by blast text\3\ -lemma "~(P-->Q) --> (Q-->P)" -by blast +lemma "\ (P \ Q) \ (Q \ P)" + by blast text\4\ -lemma "(~P-->Q) <-> (~Q --> P)" -by blast +lemma "(\ P \ Q) \ (\ Q \ P)" + by blast text\5\ -lemma "((P|Q)-->(P|R)) --> (P|(Q-->R))" -by blast +lemma "((P \ Q) \ (P \ R)) \ (P \ (Q \ R))" + by blast text\6\ -lemma "P | ~ P" -by blast +lemma "P \ \ P" + by blast text\7\ -lemma "P | ~ ~ ~ P" -by blast +lemma "P \ \ \ \ P" + by blast -text\8. Peirce's law\ -lemma "((P-->Q) --> P) --> P" -by blast +text\8. Peirce's law\ +lemma "((P \ Q) \ P) \ P" + by blast text\9\ -lemma "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)" -by blast +lemma "((P \ Q) \ (\ P \ Q) \ (P \ \ Q)) \ \ (\ P \ \ Q)" + by blast text\10\ -lemma "(Q-->R) & (R-->P&Q) & (P-->Q|R) --> (P<->Q)" -by blast +lemma "(Q \ R) \ (R \ P \ Q) \ (P \ Q \ R) \ (P \ Q)" + by blast -text\11. Proved in each direction (incorrectly, says Pelletier!!)\ -lemma "P<->P" -by blast +text\11. Proved in each direction (incorrectly, says Pelletier!!)\ +lemma "P \ P" + by blast -text\12. "Dijkstra's law"\ -lemma "((P <-> Q) <-> R) <-> (P <-> (Q <-> R))" -by blast +text\12. "Dijkstra's law"\ +lemma "((P \ Q) \ R) \ (P \ (Q \ R))" + by blast -text\13. Distributive law\ -lemma "P | (Q & R) <-> (P | Q) & (P | R)" -by blast +text\13. Distributive law\ +lemma "P \ (Q \ R) \ (P \ Q) \ (P \ R)" + by blast text\14\ -lemma "(P <-> Q) <-> ((Q | ~P) & (~Q|P))" -by blast +lemma "(P \ Q) \ ((Q \ \ P) \ (\ Q \ P))" + by blast text\15\ -lemma "(P --> Q) <-> (~P | Q)" -by blast +lemma "(P \ Q) \ (\ P \ Q)" + by blast text\16\ -lemma "(P-->Q) | (Q-->P)" -by blast +lemma "(P \ Q) \ (Q \ P)" + by blast text\17\ -lemma "((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S))" -by blast +lemma "((P \ (Q \ R)) \ S) \ ((\ P \ Q \ S) \ (\ P \ \ R \ S))" + by blast + -subsection\Classical Logic: examples with quantifiers\ +subsection \Classical Logic: examples with quantifiers\ -lemma "(\x. P(x) & Q(x)) <-> (\x. P(x)) & (\x. Q(x))" -by blast +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" + by blast -lemma "(\x. P-->Q(x)) <-> (P --> (\x. Q(x)))" -by blast +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" + by blast -lemma "(\x. P(x)-->Q) <-> (\x. P(x)) --> Q" -by blast +lemma "(\x. P(x) \ Q) \ (\x. P(x)) \ Q" + by blast -lemma "(\x. P(x)) | Q <-> (\x. P(x) | Q)" -by blast +lemma "(\x. P(x)) \ Q \ (\x. P(x) \ Q)" + by blast text\Discussed in Avron, Gentzen-Type Systems, Resolution and Tableaux, JAR 10 (265-281), 1993. Proof is trivial!\ -lemma "~((\x.~P(x)) & ((\x. P(x)) | (\x. P(x) & Q(x))) & ~ (\x. P(x)))" -by blast +lemma "\ ((\x. \ P(x)) \ ((\x. P(x)) \ (\x. P(x) \ Q(x))) \ \ (\x. P(x)))" + by blast -subsection\Problems requiring quantifier duplication\ -text\Theorem B of Peter Andrews, Theorem Proving via General Matings, +subsection \Problems requiring quantifier duplication\ + +text\Theorem B of Peter Andrews, Theorem Proving via General Matings, JACM 28 (1981).\ -lemma "(\x. \y. P(x) <-> P(y)) --> ((\x. P(x)) <-> (\y. P(y)))" -by blast +lemma "(\x. \y. P(x) \ P(y)) \ ((\x. P(x)) \ (\y. P(y)))" + by blast text\Needs multiple instantiation of ALL.\ -lemma "(\x. P(x)-->P(f(x))) & P(d)-->P(f(f(f(d))))" -by blast +lemma "(\x. P(x) \ P(f(x))) \ P(d) \ P(f(f(f(d))))" + by blast text\Needs double instantiation of the quantifier\ -lemma "\x. P(x) --> P(a) & P(b)" -by blast +lemma "\x. P(x) \ P(a) \ P(b)" + by blast -lemma "\z. P(z) --> (\x. P(x))" -by blast +lemma "\z. P(z) \ (\x. P(x))" + by blast -lemma "\x. (\y. P(y)) --> P(x)" -by blast +lemma "\x. (\y. P(y)) \ P(x)" + by blast -text\V. Lifschitz, What Is the Inverse Method?, JAR 5 (1989), 1--23. NOT PROVED\ -lemma "\x x'. \y. \z z'. - (~P(y,y) | P(x,x) | ~S(z,x)) & - (S(x,y) | ~S(y,z) | Q(z',z')) & - (Q(x',y) | ~Q(y,z') | S(x',x'))" -oops +text\V. Lifschitz, What Is the Inverse Method?, JAR 5 (1989), 1--23. NOT PROVED.\ +lemma + "\x x'. \y. \z z'. + (\ P(y,y) \ P(x,x) \ \ S(z,x)) \ + (S(x,y) \ \ S(y,z) \ Q(z',z')) \ + (Q(x',y) \ \ Q(y,z') \ S(x',x'))" + oops - -subsection\Hard examples with quantifiers\ +subsection \Hard examples with quantifiers\ text\18\ -lemma "\y. \x. P(y)-->P(x)" -by blast +lemma "\y. \x. P(y) \ P(x)" + by blast text\19\ -lemma "\x. \y z. (P(y)-->Q(z)) --> (P(x)-->Q(x))" -by blast +lemma "\x. \y z. (P(y) \ Q(z)) \ (P(x) \ Q(x))" + by blast text\20\ -lemma "(\x y. \z. \w. (P(x)&Q(y)-->R(z)&S(w))) - --> (\x y. P(x) & Q(y)) --> (\z. R(z))" -by blast +lemma "(\x y. \z. \w. (P(x) \ Q(y) \ R(z) \ S(w))) + \ (\x y. P(x) \ Q(y)) \ (\z. R(z))" + by blast text\21\ -lemma "(\x. P-->Q(x)) & (\x. Q(x)-->P) --> (\x. P<->Q(x))" -by blast +lemma "(\x. P \ Q(x)) \ (\x. Q(x) \ P) \ (\x. P \ Q(x))" + by blast text\22\ -lemma "(\x. P <-> Q(x)) --> (P <-> (\x. Q(x)))" -by blast +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" + by blast text\23\ -lemma "(\x. P | Q(x)) <-> (P | (\x. Q(x)))" -by blast +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" + by blast text\24\ -lemma "~(\x. S(x)&Q(x)) & (\x. P(x) --> Q(x)|R(x)) & - (~(\x. P(x)) --> (\x. Q(x))) & (\x. Q(x)|R(x) --> S(x)) - --> (\x. P(x)&R(x))" -by blast +lemma + "\ (\x. S(x) \ Q(x)) \ (\x. P(x) \ Q(x) \ R(x)) \ + (\ (\x. P(x)) \ (\x. Q(x))) \ (\x. Q(x) \ R(x) \ S(x)) + \ (\x. P(x) \ R(x))" + by blast text\25\ -lemma "(\x. P(x)) & - (\x. L(x) --> ~ (M(x) & R(x))) & - (\x. P(x) --> (M(x) & L(x))) & - ((\x. P(x)-->Q(x)) | (\x. P(x)&R(x))) - --> (\x. Q(x)&P(x))" -by blast +lemma + "(\x. P(x)) \ + (\x. L(x) \ \ (M(x) \ R(x))) \ + (\x. P(x) \ (M(x) \ L(x))) \ + ((\x. P(x) \ Q(x)) \ (\x. P(x) \ R(x))) + \ (\x. Q(x) \ P(x))" + by blast text\26\ -lemma "((\x. p(x)) <-> (\x. q(x))) & - (\x. \y. p(x) & q(y) --> (r(x) <-> s(y))) - --> ((\x. p(x)-->r(x)) <-> (\x. q(x)-->s(x)))" -by blast +lemma + "((\x. p(x)) \ (\x. q(x))) \ + (\x. \y. p(x) \ q(y) \ (r(x) \ s(y))) + \ ((\x. p(x) \ r(x)) \ (\x. q(x) \ s(x)))" + by blast text\27\ -lemma "(\x. P(x) & ~Q(x)) & - (\x. P(x) --> R(x)) & - (\x. M(x) & L(x) --> P(x)) & - ((\x. R(x) & ~ Q(x)) --> (\x. L(x) --> ~ R(x))) - --> (\x. M(x) --> ~L(x))" -by blast +lemma + "(\x. P(x) \ \ Q(x)) \ + (\x. P(x) \ R(x)) \ + (\x. M(x) \ L(x) \ P(x)) \ + ((\x. R(x) \ \ Q(x)) \ (\x. L(x) \ \ R(x))) + \ (\x. M(x) \ \ L(x))" + by blast -text\28. AMENDED\ -lemma "(\x. P(x) --> (\x. Q(x))) & - ((\x. Q(x)|R(x)) --> (\x. Q(x)&S(x))) & - ((\x. S(x)) --> (\x. L(x) --> M(x))) - --> (\x. P(x) & L(x) --> M(x))" -by blast +text\28. AMENDED\ +lemma + "(\x. P(x) \ (\x. Q(x))) \ + ((\x. Q(x) \ R(x)) \ (\x. Q(x) \ S(x))) \ + ((\x. S(x)) \ (\x. L(x) \ M(x))) + \ (\x. P(x) \ L(x) \ M(x))" + by blast -text\29. Essentially the same as Principia Mathematica *11.71\ -lemma "(\x. P(x)) & (\y. Q(y)) - --> ((\x. P(x)-->R(x)) & (\y. Q(y)-->S(y)) <-> - (\x y. P(x) & Q(y) --> R(x) & S(y)))" -by blast +text\29. Essentially the same as Principia Mathematica *11.71\ +lemma + "(\x. P(x)) \ (\y. Q(y)) + \ ((\x. P(x) \ R(x)) \ (\y. Q(y) \ S(y)) \ + (\x y. P(x) \ Q(y) \ R(x) \ S(y)))" + by blast text\30\ -lemma "(\x. P(x) | Q(x) --> ~ R(x)) & - (\x. (Q(x) --> ~ S(x)) --> P(x) & R(x)) - --> (\x. S(x))" -by blast +lemma + "(\x. P(x) \ Q(x) \ \ R(x)) \ + (\x. (Q(x) \ \ S(x)) \ P(x) \ R(x)) + \ (\x. S(x))" + by blast text\31\ -lemma "~(\x. P(x) & (Q(x) | R(x))) & - (\x. L(x) & P(x)) & - (\x. ~ R(x) --> M(x)) - --> (\x. L(x) & M(x))" -by blast +lemma + "\ (\x. P(x) \ (Q(x) \ R(x))) \ + (\x. L(x) \ P(x)) \ + (\x. \ R(x) \ M(x)) + \ (\x. L(x) \ M(x))" + by blast text\32\ -lemma "(\x. P(x) & (Q(x)|R(x))-->S(x)) & - (\x. S(x) & R(x) --> L(x)) & - (\x. M(x) --> R(x)) - --> (\x. P(x) & M(x) --> L(x))" -by blast +lemma + "(\x. P(x) \ (Q(x) \ R(x)) \ S(x)) \ + (\x. S(x) \ R(x) \ L(x)) \ + (\x. M(x) \ R(x)) + \ (\x. P(x) \ M(x) \ L(x))" + by blast text\33\ -lemma "(\x. P(a) & (P(x)-->P(b))-->P(c)) <-> - (\x. (~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c)))" -by blast +lemma + "(\x. P(a) \ (P(x) \ P(b)) \ P(c)) \ + (\x. (\ P(a) \ P(x) \ P(c)) \ (\ P(a) \ \ P(b) \ P(c)))" + by blast -text\34 AMENDED (TWICE!!). Andrews's challenge\ -lemma "((\x. \y. p(x) <-> p(y)) <-> - ((\x. q(x)) <-> (\y. p(y)))) <-> - ((\x. \y. q(x) <-> q(y)) <-> - ((\x. p(x)) <-> (\y. q(y))))" -by blast +text\34. AMENDED (TWICE!!). Andrews's challenge.\ +lemma + "((\x. \y. p(x) \ p(y)) \ ((\x. q(x)) \ (\y. p(y)))) \ + ((\x. \y. q(x) \ q(y)) \ ((\x. p(x)) \ (\y. q(y))))" + by blast text\35\ -lemma "\x y. P(x,y) --> (\u v. P(u,v))" -by blast +lemma "\x y. P(x,y) \ (\u v. P(u,v))" + by blast text\36\ -lemma "(\x. \y. J(x,y)) & - (\x. \y. G(x,y)) & - (\x y. J(x,y) | G(x,y) --> (\z. J(y,z) | G(y,z) --> H(x,z))) - --> (\x. \y. H(x,y))" -by blast +lemma + "(\x. \y. J(x,y)) \ + (\x. \y. G(x,y)) \ + (\x y. J(x,y) \ G(x,y) \ (\z. J(y,z) \ G(y,z) \ H(x,z))) + \ (\x. \y. H(x,y))" + by blast text\37\ -lemma "(\z. \w. \x. \y. - (P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (\u. Q(u,w)))) & - (\x z. ~P(x,z) --> (\y. Q(y,z))) & - ((\x y. Q(x,y)) --> (\x. R(x,x))) - --> (\x. \y. R(x,y))" -by blast +lemma + "(\z. \w. \x. \y. + (P(x,z) \ P(y,w)) \ P(y,z) \ (P(y,w) \ (\u. Q(u,w)))) \ + (\x z. \ P(x,z) \ (\y. Q(y,z))) \ + ((\x y. Q(x,y)) \ (\x. R(x,x))) + \ (\x. \y. R(x,y))" + by blast text\38\ -lemma "(\x. p(a) & (p(x) --> (\y. p(y) & r(x,y))) --> - (\z. \w. p(z) & r(x,w) & r(w,z))) <-> - (\x. (~p(a) | p(x) | (\z. \w. p(z) & r(x,w) & r(w,z))) & - (~p(a) | ~(\y. p(y) & r(x,y)) | - (\z. \w. p(z) & r(x,w) & r(w,z))))" -by blast +lemma + "(\x. p(a) \ (p(x) \ (\y. p(y) \ r(x,y))) \ + (\z. \w. p(z) \ r(x,w) \ r(w,z))) \ + (\x. (\ p(a) \ p(x) \ (\z. \w. p(z) \ r(x,w) \ r(w,z))) \ + (\ p(a) \ \ (\y. p(y) \ r(x,y)) \ + (\z. \w. p(z) \ r(x,w) \ r(w,z))))" + by blast text\39\ -lemma "~ (\x. \y. F(y,x) <-> ~F(y,y))" -by blast +lemma "\ (\x. \y. F(y,x) \ \ F(y,y))" + by blast -text\40. AMENDED\ -lemma "(\y. \x. F(x,y) <-> F(x,x)) --> - ~(\x. \y. \z. F(z,y) <-> ~ F(z,x))" -by blast +text\40. AMENDED\ +lemma + "(\y. \x. F(x,y) \ F(x,x)) \ + \ (\x. \y. \z. F(z,y) \ \ F(z,x))" + by blast text\41\ -lemma "(\z. \y. \x. f(x,y) <-> f(x,z) & ~ f(x,x)) - --> ~ (\z. \x. f(x,z))" -by blast +lemma + "(\z. \y. \x. f(x,y) \ f(x,z) \ \ f(x,x)) + \ \ (\z. \x. f(x,z))" + by blast text\42\ -lemma "~ (\y. \x. p(x,y) <-> ~ (\z. p(x,z) & p(z,x)))" -by blast +lemma "\ (\y. \x. p(x,y) \ \ (\z. p(x,z) \ p(z,x)))" + by blast text\43\ -lemma "(\x. \y. q(x,y) <-> (\z. p(z,x) <-> p(z,y))) - --> (\x. \y. q(x,y) <-> q(y,x))" -by blast +lemma + "(\x. \y. q(x,y) \ (\z. p(z,x) \ p(z,y))) + \ (\x. \y. q(x,y) \ q(y,x))" + by blast -(*Other proofs: Can use auto, which cheats by using rewriting! +text \ + Other proofs: Can use @{text auto}, which cheats by using rewriting! Deepen_tac alone requires 253 secs. Or - by (mini_tac @{context} 1 THEN Deepen_tac 5 1) *) + by (mini_tac 1 THEN Deepen_tac 5 1) +\ text\44\ -lemma "(\x. f(x) --> (\y. g(y) & h(x,y) & (\y. g(y) & ~ h(x,y)))) & - (\x. j(x) & (\y. g(y) --> h(x,y))) - --> (\x. j(x) & ~f(x))" -by blast +lemma + "(\x. f(x) \ (\y. g(y) \ h(x,y) \ (\y. g(y) \ \ h(x,y)))) \ + (\x. j(x) \ (\y. g(y) \ h(x,y))) + \ (\x. j(x) \ \ f(x))" + by blast text\45\ -lemma "(\x. f(x) & (\y. g(y) & h(x,y) --> j(x,y)) - --> (\y. g(y) & h(x,y) --> k(y))) & - ~ (\y. l(y) & k(y)) & - (\x. f(x) & (\y. h(x,y) --> l(y)) - & (\y. g(y) & h(x,y) --> j(x,y))) - --> (\x. f(x) & ~ (\y. g(y) & h(x,y)))" -by blast +lemma + "(\x. f(x) \ (\y. g(y) \ h(x,y) \ j(x,y)) + \ (\y. g(y) \ h(x,y) \ k(y))) \ + \ (\y. l(y) \ k(y)) \ + (\x. f(x) \ (\y. h(x,y) \ l(y)) \ (\y. g(y) \ h(x,y) \ j(x,y))) + \ (\x. f(x) \ \ (\y. g(y) \ h(x,y)))" + by blast text\46\ -lemma "(\x. f(x) & (\y. f(y) & h(y,x) --> g(y)) --> g(x)) & - ((\x. f(x) & ~g(x)) --> - (\x. f(x) & ~g(x) & (\y. f(y) & ~g(y) --> j(x,y)))) & - (\x y. f(x) & f(y) & h(x,y) --> ~j(y,x)) - --> (\x. f(x) --> g(x))" -by blast +lemma + "(\x. f(x) \ (\y. f(y) \ h(y,x) \ g(y)) \ g(x)) \ + ((\x. f(x) \ \ g(x)) \ + (\x. f(x) \ \ g(x) \ (\y. f(y) \ \ g(y) \ j(x,y)))) \ + (\x y. f(x) \ f(y) \ h(x,y) \ \ j(y,x)) + \ (\x. f(x) \ g(x))" + by blast -subsection\Problems (mainly) involving equality or functions\ +subsection \Problems (mainly) involving equality or functions\ text\48\ -lemma "(a=b | c=d) & (a=c | b=d) --> a=d | b=c" -by blast +lemma "(a = b \ c = d) \ (a = c \ b = d) \ a = d \ b = c" + by blast -text\49 NOT PROVED AUTOMATICALLY. Hard because it involves substitution - for Vars - the type constraint ensures that x,y,z have the same type as a,b,u.\ -lemma "(\x y::'a. \z. z=x | z=y) & P(a) & P(b) & a~=b - --> (\u::'a. P(u))" -apply safe -apply (rule_tac x = a in allE, assumption) -apply (rule_tac x = b in allE, assumption, fast) - --\blast's treatment of equality can't do it\ -done +text\49. NOT PROVED AUTOMATICALLY. Hard because it involves substitution for + Vars; the type constraint ensures that x,y,z have the same type as a,b,u.\ +lemma + "(\x y::'a. \z. z = x \ z = y) \ P(a) \ P(b) \ a \ b \ (\u::'a. P(u))" + apply safe + apply (rule_tac x = a in allE, assumption) + apply (rule_tac x = b in allE, assumption) + apply fast -- \blast's treatment of equality can't do it\ + done -text\50. (What has this to do with equality?)\ -lemma "(\x. P(a,x) | (\y. P(x,y))) --> (\x. \y. P(x,y))" -by blast +text\50. (What has this to do with equality?)\ +lemma "(\x. P(a,x) \ (\y. P(x,y))) \ (\x. \y. P(x,y))" + by blast text\51\ -lemma "(\z w. \x y. P(x,y) <-> (x=z & y=w)) --> - (\z. \x. \w. (\y. P(x,y) <-> y=w) <-> x=z)" -by blast +lemma + "(\z w. \x y. P(x,y) \ (x = z \ y = w)) \ + (\z. \x. \w. (\y. P(x,y) \ y=w) \ x = z)" + by blast text\52\ text\Almost the same as 51.\ -lemma "(\z w. \x y. P(x,y) <-> (x=z & y=w)) --> - (\w. \y. \z. (\x. P(x,y) <-> x=z) <-> y=w)" -by blast +lemma + "(\z w. \x y. P(x,y) \ (x = z \ y = w)) \ + (\w. \y. \z. (\x. P(x,y) \ x = z) \ y = w)" + by blast text\55\ - text\Non-equational version, from Manthey and Bry, CADE-9 (Springer, 1988). fast DISCOVERS who killed Agatha.\ -schematic_goal "lives(agatha) & lives(butler) & lives(charles) & - (killed(agatha,agatha) | killed(butler,agatha) | killed(charles,agatha)) & - (\x y. killed(x,y) --> hates(x,y) & ~richer(x,y)) & - (\x. hates(agatha,x) --> ~hates(charles,x)) & - (hates(agatha,agatha) & hates(agatha,charles)) & - (\x. lives(x) & ~richer(x,agatha) --> hates(butler,x)) & - (\x. hates(agatha,x) --> hates(butler,x)) & - (\x. ~hates(x,agatha) | ~hates(x,butler) | ~hates(x,charles)) --> +schematic_goal + "lives(agatha) \ lives(butler) \ lives(charles) \ + (killed(agatha,agatha) \ killed(butler,agatha) \ killed(charles,agatha)) \ + (\x y. killed(x,y) \ hates(x,y) \ \ richer(x,y)) \ + (\x. hates(agatha,x) \ \ hates(charles,x)) \ + (hates(agatha,agatha) \ hates(agatha,charles)) \ + (\x. lives(x) \ \ richer(x,agatha) \ hates(butler,x)) \ + (\x. hates(agatha,x) \ hates(butler,x)) \ + (\x. \ hates(x,agatha) \ \ hates(x,butler) \ \ hates(x,charles)) \ killed(?who,agatha)" -by fast --\MUCH faster than blast\ + by fast -- \MUCH faster than blast\ text\56\ -lemma "(\x. (\y. P(y) & x=f(y)) --> P(x)) <-> (\x. P(x) --> P(f(x)))" -by blast +lemma "(\x. (\y. P(y) \ x = f(y)) \ P(x)) \ (\x. P(x) \ P(f(x)))" + by blast text\57\ -lemma "P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & - (\x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))" -by blast +lemma + "P(f(a,b), f(b,c)) \ P(f(b,c), f(a,c)) \ + (\x y z. P(x,y) \ P(y,z) \ P(x,z)) \ P(f(a,b), f(a,c))" + by blast text\58 NOT PROVED AUTOMATICALLY\ -lemma "(\x y. f(x)=g(y)) --> (\x y. f(f(x))=f(g(y)))" -by (slow elim: subst_context) +lemma "(\x y. f(x) = g(y)) \ (\x y. f(f(x)) = f(g(y)))" + by (slow elim: subst_context) text\59\ -lemma "(\x. P(x) <-> ~P(f(x))) --> (\x. P(x) & ~P(f(x)))" -by blast +lemma "(\x. P(x) \ \ P(f(x))) \ (\x. P(x) \ \ P(f(x)))" + by blast text\60\ -lemma "\x. P(x,f(x)) <-> (\y. (\z. P(z,y) --> P(z,f(x))) & P(x,y))" -by blast +lemma "\x. P(x,f(x)) \ (\y. (\z. P(z,y) \ P(z,f(x))) \ P(x,y))" + by blast text\62 as corrected in JAR 18 (1997), page 135\ -lemma "(\x. p(a) & (p(x) --> p(f(x))) --> p(f(f(x)))) <-> - (\x. (~p(a) | p(x) | p(f(f(x)))) & - (~p(a) | ~p(f(x)) | p(f(f(x)))))" -by blast +lemma + "(\x. p(a) \ (p(x) \ p(f(x))) \ p(f(f(x)))) \ + (\x. (\ p(a) \ p(x) \ p(f(f(x)))) \ + (\ p(a) \ \ p(f(x)) \ p(f(f(x)))))" + by blast -text\From Davis, Obvious Logical Inferences, IJCAI-81, 530-531 +text \From Davis, Obvious Logical Inferences, IJCAI-81, 530-531 fast indeed copes!\ -lemma "(\x. F(x) & ~G(x) --> (\y. H(x,y) & J(y))) & - (\x. K(x) & F(x) & (\y. H(x,y) --> K(y))) & - (\x. K(x) --> ~G(x)) --> (\x. K(x) & J(x))" -by fast +lemma + "(\x. F(x) \ \ G(x) \ (\y. H(x,y) \ J(y))) \ + (\x. K(x) \ F(x) \ (\y. H(x,y) \ K(y))) \ + (\x. K(x) \ \ G(x)) \ (\x. K(x) \ J(x))" + by fast -text\From Rudnicki, Obvious Inferences, JAR 3 (1987), 383-393. +text \From Rudnicki, Obvious Inferences, JAR 3 (1987), 383-393. It does seem obvious!\ -lemma "(\x. F(x) & ~G(x) --> (\y. H(x,y) & J(y))) & - (\x. K(x) & F(x) & (\y. H(x,y) --> K(y))) & - (\x. K(x) --> ~G(x)) --> (\x. K(x) --> ~G(x))" -by fast +lemma + "(\x. F(x) \ \ G(x) \ (\y. H(x,y) \ J(y))) \ + (\x. K(x) \ F(x) \ (\y. H(x,y) \ K(y))) \ + (\x. K(x) \ \ G(x)) \ (\x. K(x) \ \ G(x))" + by fast -text\Halting problem: Formulation of Li Dafa (AAR Newsletter 27, Oct 1994.) - author U. Egly\ -lemma "((\x. A(x) & (\y. C(y) --> (\z. D(x,y,z)))) --> - (\w. C(w) & (\y. C(y) --> (\z. D(w,y,z))))) - & - (\w. C(w) & (\u. C(u) --> (\v. D(w,u,v))) --> - (\y z. - (C(y) & P(y,z) --> Q(w,y,z) & OO(w,g)) & - (C(y) & ~P(y,z) --> Q(w,y,z) & OO(w,b)))) - & - (\w. C(w) & - (\y z. - (C(y) & P(y,z) --> Q(w,y,z) & OO(w,g)) & - (C(y) & ~P(y,z) --> Q(w,y,z) & OO(w,b))) --> - (\v. C(v) & - (\y. ((C(y) & Q(w,y,y)) & OO(w,g) --> ~P(v,y)) & - ((C(y) & Q(w,y,y)) & OO(w,b) --> P(v,y) & OO(v,b))))) - --> - ~ (\x. A(x) & (\y. C(y) --> (\z. D(x,y,z))))" -by (blast 12) - --\Needed because the search for depths below 12 is very slow\ +text \Halting problem: Formulation of Li Dafa (AAR Newsletter 27, Oct 1994.) + author U. Egly.\ +lemma + "((\x. A(x) \ (\y. C(y) \ (\z. D(x,y,z)))) \ + (\w. C(w) \ (\y. C(y) \ (\z. D(w,y,z))))) + \ + (\w. C(w) \ (\u. C(u) \ (\v. D(w,u,v))) \ + (\y z. + (C(y) \ P(y,z) \ Q(w,y,z) \ OO(w,g)) \ + (C(y) \ \ P(y,z) \ Q(w,y,z) \ OO(w,b)))) + \ + (\w. C(w) \ + (\y z. + (C(y) \ P(y,z) \ Q(w,y,z) \ OO(w,g)) \ + (C(y) \ \ P(y,z) \ Q(w,y,z) \ OO(w,b))) \ + (\v. C(v) \ + (\y. ((C(y) \ Q(w,y,y)) \ OO(w,g) \ \ P(v,y)) \ + ((C(y) \ Q(w,y,y)) \ OO(w,b) \ P(v,y) \ OO(v,b))))) + \ \ (\x. A(x) \ (\y. C(y) \ (\z. D(x,y,z))))" + by (blast 12) + -- \Needed because the search for depths below 12 is very slow.\ -text\Halting problem II: credited to M. Bruschi by Li Dafa in JAR 18(1), p.105\ -lemma "((\x. A(x) & (\y. C(y) --> (\z. D(x,y,z)))) --> - (\w. C(w) & (\y. C(y) --> (\z. D(w,y,z))))) - & - (\w. C(w) & (\u. C(u) --> (\v. D(w,u,v))) --> - (\y z. - (C(y) & P(y,z) --> Q(w,y,z) & OO(w,g)) & - (C(y) & ~P(y,z) --> Q(w,y,z) & OO(w,b)))) - & - ((\w. C(w) & (\y. (C(y) & P(y,y) --> Q(w,y,y) & OO(w,g)) & - (C(y) & ~P(y,y) --> Q(w,y,y) & OO(w,b)))) - --> - (\v. C(v) & (\y. (C(y) & P(y,y) --> P(v,y) & OO(v,g)) & - (C(y) & ~P(y,y) --> P(v,y) & OO(v,b))))) - --> - ((\v. C(v) & (\y. (C(y) & P(y,y) --> P(v,y) & OO(v,g)) & - (C(y) & ~P(y,y) --> P(v,y) & OO(v,b)))) - --> - (\u. C(u) & (\y. (C(y) & P(y,y) --> ~P(u,y)) & - (C(y) & ~P(y,y) --> P(u,y) & OO(u,b))))) - --> - ~ (\x. A(x) & (\y. C(y) --> (\z. D(x,y,z))))" -by blast +text \ + Halting problem II: credited to M. Bruschi by Li Dafa in JAR 18(1), + p. 105. +\ +lemma + "((\x. A(x) \ (\y. C(y) \ (\z. D(x,y,z)))) \ + (\w. C(w) \ (\y. C(y) \ (\z. D(w,y,z))))) + \ + (\w. C(w) \ (\u. C(u) \ (\v. D(w,u,v))) \ + (\y z. + (C(y) \ P(y,z) \ Q(w,y,z) \ OO(w,g)) \ + (C(y) \ \ P(y,z) \ Q(w,y,z) \ OO(w,b)))) + \ + ((\w. C(w) \ (\y. (C(y) \ P(y,y) \ Q(w,y,y) \ OO(w,g)) \ + (C(y) \ \ P(y,y) \ Q(w,y,y) \ OO(w,b)))) + \ + (\v. C(v) \ (\y. (C(y) \ P(y,y) \ P(v,y) \ OO(v,g)) \ + (C(y) \ \ P(y,y) \ P(v,y) \ OO(v,b))))) + \ + ((\v. C(v) \ (\y. (C(y) \ P(y,y) \ P(v,y) \ OO(v,g)) \ + (C(y) \ \ P(y,y) \ P(v,y) \ OO(v,b)))) + \ + (\u. C(u) \ (\y. (C(y) \ P(y,y) \ \ P(u,y)) \ + (C(y) \ \ P(y,y) \ P(u,y) \ OO(u,b))))) + \ \ (\x. A(x) \ (\y. C(y) \ (\z. D(x,y,z))))" + by blast -text\Challenge found on info-hol\ -lemma "\x. \v w. \y z. P(x) & Q(y) --> (P(v) | R(w)) & (R(z) --> Q(v))" -by blast +text \Challenge found on info-hol.\ +lemma "\x. \v w. \y z. P(x) \ Q(y) \ (P(v) \ R(w)) \ (R(z) \ Q(v))" + by blast -text\Attributed to Lewis Carroll by S. G. Pulman. The first or last assumption -can be deleted.\ -lemma "(\x. honest(x) & industrious(x) --> healthy(x)) & - ~ (\x. grocer(x) & healthy(x)) & - (\x. industrious(x) & grocer(x) --> honest(x)) & - (\x. cyclist(x) --> industrious(x)) & - (\x. ~healthy(x) & cyclist(x) --> ~honest(x)) - --> (\x. grocer(x) --> ~cyclist(x))" -by blast +text \ + Attributed to Lewis Carroll by S. G. Pulman. The first or last assumption + can be deleted.\ +lemma + "(\x. honest(x) \ industrious(x) \ healthy(x)) \ + \ (\x. grocer(x) \ healthy(x)) \ + (\x. industrious(x) \ grocer(x) \ honest(x)) \ + (\x. cyclist(x) \ industrious(x)) \ + (\x. \ healthy(x) \ cyclist(x) \ \ honest(x)) + \ (\x. grocer(x) \ \ cyclist(x))" + by blast (*Runtimes for old versions of this file: -Thu Jul 23 1992: loaded in 467s using iffE [on SPARC2] -Mon Nov 14 1994: loaded in 144s [on SPARC10, with deepen_tac] -Wed Nov 16 1994: loaded in 138s [after addition of norm_term_skip] -Mon Nov 21 1994: loaded in 131s [DEPTH_FIRST suppressing repetitions] +Thu Jul 23 1992: loaded in 467s using iffE [on SPARC2] +Mon Nov 14 1994: loaded in 144s [on SPARC10, with deepen_tac] +Wed Nov 16 1994: loaded in 138s [after addition of norm_term_skip] +Mon Nov 21 1994: loaded in 131s [DEPTH_FIRST suppressing repetitions] Further runtimes on a Sun-4 -Tue Mar 4 1997: loaded in 93s (version 94-7) +Tue Mar 4 1997: loaded in 93s (version 94-7) Tue Mar 4 1997: loaded in 89s Thu Apr 3 1997: loaded in 44s--using mostly Blast_tac Thu Apr 3 1997: loaded in 96s--addition of two Halting Probs @@ -497,4 +533,3 @@ *) end - diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Foundation.thy --- a/src/FOL/ex/Foundation.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Foundation.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,7 +9,7 @@ imports IFOL begin -lemma "A&B --> (C-->A&C)" +lemma "A \ B \ (C \ A \ C)" apply (rule impI) apply (rule impI) apply (rule conjI) @@ -20,8 +20,8 @@ text \A form of conj-elimination\ lemma - assumes "A & B" - and "A ==> B ==> C" + assumes "A \ B" + and "A \ B \ C" shows C apply (rule assms) apply (rule conjunct1) @@ -31,26 +31,26 @@ done lemma - assumes "!!A. ~ ~A ==> A" - shows "B | ~B" + assumes "\A. \ \ A \ A" + shows "B \ \ B" apply (rule assms) apply (rule notI) -apply (rule_tac P = "~B" in notE) +apply (rule_tac P = "\ B" in notE) apply (rule_tac [2] notI) -apply (rule_tac [2] P = "B | ~B" in notE) +apply (rule_tac [2] P = "B \ \ B" in notE) prefer 2 apply assumption apply (rule_tac [2] disjI1) prefer 2 apply assumption apply (rule notI) -apply (rule_tac P = "B | ~B" in notE) +apply (rule_tac P = "B \ \ B" in notE) apply assumption apply (rule disjI2) apply assumption done lemma - assumes "!!A. ~ ~A ==> A" - shows "B | ~B" + assumes "\A. \ \ A \ A" + shows "B \ \ B" apply (rule assms) apply (rule notI) apply (rule notE) @@ -64,14 +64,14 @@ lemma - assumes "A | ~A" - and "~ ~A" + assumes "A \ \ A" + and "\ \ A" shows A apply (rule disjE) apply (rule assms) apply assumption apply (rule FalseE) -apply (rule_tac P = "~A" in notE) +apply (rule_tac P = "\ A" in notE) apply (rule assms) apply assumption done @@ -80,27 +80,27 @@ subsection "Examples with quantifiers" lemma - assumes "ALL z. G(z)" - shows "ALL z. G(z)|H(z)" + assumes "\z. G(z)" + shows "\z. G(z) \ H(z)" apply (rule allI) apply (rule disjI1) apply (rule assms [THEN spec]) done -lemma "ALL x. EX y. x=y" +lemma "\x. \y. x = y" apply (rule allI) apply (rule exI) apply (rule refl) done -lemma "EX y. ALL x. x=y" +lemma "\y. \x. x = y" apply (rule exI) apply (rule allI) apply (rule refl)? oops text \Parallel lifting example.\ -lemma "EX u. ALL x. EX v. ALL y. EX w. P(u,x,v,y,w)" +lemma "\u. \x. \v. \y. \w. P(u,x,v,y,w)" apply (rule exI allI) apply (rule exI allI) apply (rule exI allI) @@ -109,8 +109,8 @@ oops lemma - assumes "(EX z. F(z)) & B" - shows "EX z. F(z) & B" + assumes "(\z. F(z)) \ B" + shows "\z. F(z) \ B" apply (rule conjE) apply (rule assms) apply (rule exE) @@ -122,7 +122,7 @@ done text \A bigger demonstration of quantifiers -- not in the paper.\ -lemma "(EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" +lemma "(\y. \x. Q(x,y)) \ (\x. \y. Q(x,y))" apply (rule impI) apply (rule allI) apply (rule exE, assumption) diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/If.thy --- a/src/FOL/ex/If.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/If.thy Mon Oct 19 23:00:07 2015 +0200 @@ -5,57 +5,56 @@ section \First-Order Logic: the 'if' example\ -theory If imports FOL begin - -definition "if" :: "[o,o,o]=>o" where - "if(P,Q,R) == P&Q | ~P&R" +theory If +imports FOL +begin -lemma ifI: - "[| P ==> Q; ~P ==> R |] ==> if(P,Q,R)" -apply (simp add: if_def, blast) -done +definition "if" :: "[o,o,o]=>o" + where "if(P,Q,R) \ P \ Q \ \ P \ R" + +lemma ifI: "\P \ Q; \ P \ R\ \ if(P,Q,R)" + unfolding if_def by blast -lemma ifE: - "[| if(P,Q,R); [| P; Q |] ==> S; [| ~P; R |] ==> S |] ==> S" -apply (simp add: if_def, blast) -done +lemma ifE: "\if(P,Q,R); \P; Q\ \ S; \\ P; R\ \ S\ \ S" + unfolding if_def by blast -lemma if_commute: "if(P, if(Q,A,B), if(Q,C,D)) <-> if(Q, if(P,A,C), if(P,B,D))" -apply (rule iffI) -apply (erule ifE) -apply (erule ifE) -apply (rule ifI) -apply (rule ifI) -oops +lemma if_commute: "if(P, if(Q,A,B), if(Q,C,D)) \ if(Q, if(P,A,C), if(P,B,D))" + apply (rule iffI) + apply (erule ifE) + apply (erule ifE) + apply (rule ifI) + apply (rule ifI) + oops text\Trying again from the beginning in order to use @{text blast}\ declare ifI [intro!] declare ifE [elim!] -lemma if_commute: "if(P, if(Q,A,B), if(Q,C,D)) <-> if(Q, if(P,A,C), if(P,B,D))" -by blast +lemma if_commute: "if(P, if(Q,A,B), if(Q,C,D)) \ if(Q, if(P,A,C), if(P,B,D))" + by blast -lemma "if(if(P,Q,R), A, B) <-> if(P, if(Q,A,B), if(R,A,B))" -by blast +lemma "if(if(P,Q,R), A, B) \ if(P, if(Q,A,B), if(R,A,B))" + by blast text\Trying again from the beginning in order to prove from the definitions\ -lemma "if(if(P,Q,R), A, B) <-> if(P, if(Q,A,B), if(R,A,B))" -by (simp add: if_def, blast) +lemma "if(if(P,Q,R), A, B) \ if(P, if(Q,A,B), if(R,A,B))" + unfolding if_def by blast -text\An invalid formula. High-level rules permit a simpler diagnosis\ -lemma "if(if(P,Q,R), A, B) <-> if(P, if(Q,A,B), if(R,B,A))" -apply auto - -- \The next step will fail unless subgoals remain\ -apply (tactic all_tac) -oops +text \An invalid formula. High-level rules permit a simpler diagnosis.\ +lemma "if(if(P,Q,R), A, B) \ if(P, if(Q,A,B), if(R,B,A))" + apply auto + -- \The next step will fail unless subgoals remain\ + apply (tactic all_tac) + oops -text\Trying again from the beginning in order to prove from the definitions\ -lemma "if(if(P,Q,R), A, B) <-> if(P, if(Q,A,B), if(R,B,A))" -apply (simp add: if_def, auto) - -- \The next step will fail unless subgoals remain\ -apply (tactic all_tac) -oops +text \Trying again from the beginning in order to prove from the definitions.\ +lemma "if(if(P,Q,R), A, B) \ if(P, if(Q,A,B), if(R,B,A))" + unfolding if_def + apply auto + -- \The next step will fail unless subgoals remain\ + apply (tactic all_tac) + oops end diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Intro.thy --- a/src/FOL/ex/Intro.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Intro.thy Mon Oct 19 23:00:07 2015 +0200 @@ -13,7 +13,7 @@ subsubsection \Some simple backward proofs\ -lemma mythm: "P|P --> P" +lemma mythm: "P \ P \ P" apply (rule impI) apply (rule disjE) prefer 3 apply (assumption) @@ -21,7 +21,7 @@ apply assumption done -lemma "(P & Q) | R --> (P | R)" +lemma "(P \ Q) \ R \ (P \ R)" apply (rule impI) apply (erule disjE) apply (drule conjunct1) @@ -30,8 +30,8 @@ apply assumption+ done -(*Correct version, delaying use of "spec" until last*) -lemma "(ALL x y. P(x,y)) --> (ALL z w. P(w,z))" +text \Correct version, delaying use of @{text spec} until last.\ +lemma "(\x y. P(x,y)) \ (\z w. P(w,z))" apply (rule impI) apply (rule allI) apply (rule allI) @@ -43,14 +43,12 @@ subsubsection \Demonstration of @{text "fast"}\ -lemma "(EX y. ALL x. J(y,x) <-> ~J(x,x)) - --> ~ (ALL x. EX y. ALL z. J(z,y) <-> ~ J(z,x))" +lemma "(\y. \x. J(y,x) \ \ J(x,x)) \ \ (\x. \y. \z. J(z,y) \ \ J(z,x))" apply fast done -lemma "ALL x. P(x,f(x)) <-> - (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))" +lemma "\x. P(x,f(x)) \ (\y. (\z. P(z,y) \ P(z,f(x))) \ P(x,y))" apply fast done @@ -58,8 +56,8 @@ subsubsection \Derivation of conjunction elimination rule\ lemma - assumes major: "P&Q" - and minor: "[| P; Q |] ==> R" + assumes major: "P \ Q" + and minor: "\P; Q\ \ R" shows R apply (rule minor) apply (rule major [THEN conjunct1]) @@ -72,8 +70,8 @@ text \Derivation of negation introduction\ lemma - assumes "P ==> False" - shows "~ P" + assumes "P \ False" + shows "\ P" apply (unfold not_def) apply (rule impI) apply (rule assms) @@ -81,7 +79,7 @@ done lemma - assumes major: "~P" + assumes major: "\ P" and minor: P shows R apply (rule FalseE) @@ -92,7 +90,7 @@ text \Alternative proof of the result above\ lemma - assumes major: "~P" + assumes major: "\ P" and minor: P shows R apply (rule minor [THEN major [unfolded not_def, THEN mp, THEN FalseE]]) diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Intuitionistic.thy --- a/src/FOL/ex/Intuitionistic.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Intuitionistic.thy Mon Oct 19 23:00:07 2015 +0200 @@ -36,390 +36,417 @@ intuitionistically provable. Finally, if $P$ is a negation then $\neg\neg P$ is intuitionstically equivalent to $P$. [Andy Pitts]\ -lemma "~~(P&Q) <-> ~~P & ~~Q" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ (P \ Q) \ \ \ P \ \ \ Q" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "~~ ((~P --> Q) --> (~P --> ~Q) --> P)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ ((\ P \ Q) \ (\ P \ \ Q) \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) -text\Double-negation does NOT distribute over disjunction\ +text \Double-negation does NOT distribute over disjunction.\ -lemma "~~(P-->Q) <-> (~~P --> ~~Q)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ (P \ Q) \ (\ \ P \ \ \ Q)" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "~~~P <-> ~P" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ \ P \ \ P" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "~~((P --> Q | R) --> (P-->Q) | (P-->R))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ ((P \ Q \ R) \ (P \ Q) \ (P \ R))" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "(P<->Q) <-> (Q<->P)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(P \ Q) \ (Q \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "((P --> (Q | (Q-->R))) --> R) --> R" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "((P \ (Q \ (Q \ R))) \ R) \ R" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "(((G-->A) --> J) --> D --> E) --> (((H-->B)-->I)-->C-->J) - --> (A-->H) --> F --> G --> (((C-->B)-->I)-->D)-->(A-->C) - --> (((F-->A)-->B) --> I) --> E" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(((G \ A) \ J) \ D \ E) \ (((H \ B) \ I) \ C \ J) + \ (A \ H) \ F \ G \ (((C \ B) \ I) \ D) \ (A \ C) + \ (((F \ A) \ B) \ I) \ E" + by (tactic \IntPr.fast_tac @{context} 1\) -text\Lemmas for the propositional double-negation translation\ +subsection \Lemmas for the propositional double-negation translation\ -lemma "P --> ~~P" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "P \ \ \ P" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "~~(~~P --> P)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ (\ \ P \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) -lemma "~~P & ~~(P --> Q) --> ~~Q" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ \ P \ \ \ (P \ Q) \ \ \ Q" + by (tactic \IntPr.fast_tac @{context} 1\) -text\The following are classically but not constructively valid. - The attempt to prove them terminates quickly!\ -lemma "((P-->Q) --> P) --> P" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) +text \The following are classically but not constructively valid. + The attempt to prove them terminates quickly!\ +lemma "((P \ Q) \ P) \ P" +apply (tactic \IntPr.fast_tac @{context} 1\)? apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ oops -lemma "(P&Q-->R) --> (P-->R) | (Q-->R)" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) +lemma "(P \ Q \ R) \ (P \ R) \ (Q \ R)" +apply (tactic \IntPr.fast_tac @{context} 1\)? apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ oops -subsection\de Bruijn formulae\ +subsection \de Bruijn formulae\ -text\de Bruijn formula with three predicates\ -lemma "((P<->Q) --> P&Q&R) & - ((Q<->R) --> P&Q&R) & - ((R<->P) --> P&Q&R) --> P&Q&R" -by (tactic\IntPr.fast_tac @{context} 1\) +text \de Bruijn formula with three predicates\ +lemma + "((P \ Q) \ P \ Q \ R) \ + ((Q \ R) \ P \ Q \ R) \ + ((R \ P) \ P \ Q \ R) \ P \ Q \ R" + by (tactic \IntPr.fast_tac @{context} 1\) -text\de Bruijn formula with five predicates\ -lemma "((P<->Q) --> P&Q&R&S&T) & - ((Q<->R) --> P&Q&R&S&T) & - ((R<->S) --> P&Q&R&S&T) & - ((S<->T) --> P&Q&R&S&T) & - ((T<->P) --> P&Q&R&S&T) --> P&Q&R&S&T" -by (tactic\IntPr.fast_tac @{context} 1\) +text \de Bruijn formula with five predicates\ +lemma + "((P \ Q) \ P \ Q \ R \ S \ T) \ + ((Q \ R) \ P \ Q \ R \ S \ T) \ + ((R \ S) \ P \ Q \ R \ S \ T) \ + ((S \ T) \ P \ Q \ R \ S \ T) \ + ((T \ P) \ P \ Q \ R \ S \ T) \ P \ Q \ R \ S \ T" + by (tactic \IntPr.fast_tac @{context} 1\) -(*** Problems from of Sahlin, Franzen and Haridi, - An Intuitionistic Predicate Logic Theorem Prover. - J. Logic and Comp. 2 (5), October 1992, 619-656. -***) +text \ + Problems from of Sahlin, Franzen and Haridi, + An Intuitionistic Predicate Logic Theorem Prover. + J. Logic and Comp. 2 (5), October 1992, 619-656. +\ text\Problem 1.1\ -lemma "(ALL x. EX y. ALL z. p(x) & q(y) & r(z)) <-> - (ALL z. EX y. ALL x. p(x) & q(y) & r(z))" -by (tactic\IntPr.best_dup_tac @{context} 1\) --\SLOW\ +lemma + "(\x. \y. \z. p(x) \ q(y) \ r(z)) \ + (\z. \y. \x. p(x) \ q(y) \ r(z))" + by (tactic \IntPr.best_dup_tac @{context} 1\) --\SLOW\ text\Problem 3.1\ -lemma "~ (EX x. ALL y. mem(y,x) <-> ~ mem(x,x))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ (\x. \y. mem(y,x) \ \ mem(x,x))" + by (tactic \IntPr.fast_tac @{context} 1\) text\Problem 4.1: hopeless!\ -lemma "(ALL x. p(x) --> p(h(x)) | p(g(x))) & (EX x. p(x)) & (ALL x. ~p(h(x))) - --> (EX x. p(g(g(g(g(g(x)))))))" -oops +lemma + "(\x. p(x) \ p(h(x)) \ p(g(x))) \ (\x. p(x)) \ (\x. \ p(h(x))) + \ (\x. p(g(g(g(g(g(x)))))))" + oops -subsection\Intuitionistic FOL: propositional problems based on Pelletier.\ +subsection \Intuitionistic FOL: propositional problems based on Pelletier.\ -text\~~1\ -lemma "~~((P-->Q) <-> (~Q --> ~P))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\1\ +lemma "\ \ ((P \ Q) \ (\ Q \ \ P))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~2\ -lemma "~~(~~P <-> P)" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\2\ +lemma "\ \ (\ \ P \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) text\3\ -lemma "~(P-->Q) --> (Q-->P)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ (P \ Q) \ (Q \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~4\ -lemma "~~((~P-->Q) <-> (~Q --> P))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\4\ +lemma "\ \ ((\ P \ Q) \ (\ Q \ P))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~5\ -lemma "~~((P|Q-->P|R) --> P|(Q-->R))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\5\ +lemma "\\((P \ Q \ P \ R) \ P \ (Q \ R))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~6\ -lemma "~~(P | ~P)" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\6\ +lemma "\ \ (P \ \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~7\ -lemma "~~(P | ~~~P)" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\7\ +lemma "\ \ (P \ \ \ \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~8. Peirce's law\ -lemma "~~(((P-->Q) --> P) --> P)" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\8. Peirce's law\ +lemma "\ \ (((P \ Q) \ P) \ P)" + by (tactic \IntPr.fast_tac @{context} 1\) text\9\ -lemma "((P|Q) & (~P|Q) & (P| ~Q)) --> ~ (~P | ~Q)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "((P \ Q) \ (\ P \ Q) \ (P \ \ Q)) \ \ (\ P \ \ Q)" + by (tactic \IntPr.fast_tac @{context} 1\) text\10\ -lemma "(Q-->R) --> (R-->P&Q) --> (P-->(Q|R)) --> (P<->Q)" -by (tactic\IntPr.fast_tac @{context} 1\) - -subsection\11. Proved in each direction (incorrectly, says Pelletier!!)\ -lemma "P<->P" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\~~12. Dijkstra's law\ -lemma "~~(((P <-> Q) <-> R) <-> (P <-> (Q <-> R)))" -by (tactic\IntPr.fast_tac @{context} 1\) - -lemma "((P <-> Q) <-> R) --> ~~(P <-> (Q <-> R))" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\13. Distributive law\ -lemma "P | (Q & R) <-> (P | Q) & (P | R)" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\~~14\ -lemma "~~((P <-> Q) <-> ((Q | ~P) & (~Q|P)))" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\~~15\ -lemma "~~((P --> Q) <-> (~P | Q))" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\~~16\ -lemma "~~((P-->Q) | (Q-->P))" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\~~17\ -lemma "~~(((P & (Q-->R))-->S) <-> ((~P | Q | S) & (~P | ~R | S)))" -by (tactic\IntPr.fast_tac @{context} 1\) - -text\Dijkstra's "Golden Rule"\ -lemma "(P&Q) <-> P <-> Q <-> (P|Q)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(Q \ R) \ (R \ P \ Q) \ (P \ (Q \ R)) \ (P \ Q)" + by (tactic \IntPr.fast_tac @{context} 1\) -subsection\****Examples with quantifiers****\ +subsection\11. Proved in each direction (incorrectly, says Pelletier!!)\ + +lemma "P \ P" + by (tactic \IntPr.fast_tac @{context} 1\) + +text\\\12. Dijkstra's law\ +lemma "\ \ (((P \ Q) \ R) \ (P \ (Q \ R)))" + by (tactic \IntPr.fast_tac @{context} 1\) + +lemma "((P \ Q) \ R) \ \ \ (P \ (Q \ R))" + by (tactic \IntPr.fast_tac @{context} 1\) + +text\13. Distributive law\ +lemma "P \ (Q \ R) \ (P \ Q) \ (P \ R)" + by (tactic \IntPr.fast_tac @{context} 1\) + +text\\\14\ +lemma "\ \ ((P \ Q) \ ((Q \ \ P) \ (\ Q \ P)))" + by (tactic \IntPr.fast_tac @{context} 1\) + +text\\\15\ +lemma "\ \ ((P \ Q) \ (\ P \ Q))" + by (tactic \IntPr.fast_tac @{context} 1\) + +text\\\16\ +lemma "\ \ ((P \ Q) \ (Q \ P))" + by (tactic \IntPr.fast_tac @{context} 1\) + +text\\\17\ +lemma "\ \ (((P \ (Q \ R)) \ S) \ ((\ P \ Q \ S) \ (\ P \ \ R \ S)))" + by (tactic \IntPr.fast_tac @{context} 1\) + +text \Dijkstra's ``Golden Rule''\ +lemma "(P \ Q) \ P \ Q \ (P \ Q)" + by (tactic \IntPr.fast_tac @{context} 1\) + + +section \Examples with quantifiers\ + +subsection \The converse is classical in the following implications \dots\ + +lemma "(\x. P(x) \ Q) \ (\x. P(x)) \ Q" + by (tactic \IntPr.fast_tac @{context} 1\) + +lemma "((\x. P(x)) \ Q) \ \ (\x. P(x) \ \ Q)" + by (tactic \IntPr.fast_tac @{context} 1\) + +lemma "((\x. \ P(x)) \ Q) \ \ (\x. \ (P(x) \ Q))" + by (tactic \IntPr.fast_tac @{context} 1\) + +lemma "(\x. P(x)) \ Q \ (\x. P(x) \ Q)" + by (tactic \IntPr.fast_tac @{context} 1\) + +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" + by (tactic \IntPr.fast_tac @{context} 1\) -subsection\The converse is classical in the following implications...\ +subsection \The following are not constructively valid!\ +text \The attempt to prove them terminates quickly!\ -lemma "(EX x. P(x)-->Q) --> (ALL x. P(x)) --> Q" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "((\x. P(x)) \ Q) \ (\x. P(x) \ Q)" + apply (tactic \IntPr.fast_tac @{context} 1\)? + apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ + oops -lemma "((ALL x. P(x))-->Q) --> ~ (ALL x. P(x) & ~Q)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(P \ (\x. Q(x))) \ (\x. P \ Q(x))" + apply (tactic \IntPr.fast_tac @{context} 1\)? + apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ + oops -lemma "((ALL x. ~P(x))-->Q) --> ~ (ALL x. ~ (P(x)|Q))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(\x. P(x) \ Q) \ ((\x. P(x)) \ Q)" + apply (tactic \IntPr.fast_tac @{context} 1\)? + apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ + oops -lemma "(ALL x. P(x)) | Q --> (ALL x. P(x) | Q)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(\x. \ \ P(x)) \ \ \ (\x. P(x))" + apply (tactic \IntPr.fast_tac @{context} 1\)? + apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ + oops -lemma "(EX x. P --> Q(x)) --> (P --> (EX x. Q(x)))" -by (tactic\IntPr.fast_tac @{context} 1\) - - +text \Classically but not intuitionistically valid. Proved by a bug in 1986!\ +lemma "\x. Q(x) \ (\x. Q(x))" + apply (tactic \IntPr.fast_tac @{context} 1\)? + apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ + oops -subsection\The following are not constructively valid!\ -text\The attempt to prove them terminates quickly!\ - -lemma "((ALL x. P(x))-->Q) --> (EX x. P(x)-->Q)" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) -apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ -oops +subsection \Hard examples with quantifiers\ -lemma "(P --> (EX x. Q(x))) --> (EX x. P-->Q(x))" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) -apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ -oops - -lemma "(ALL x. P(x) | Q) --> ((ALL x. P(x)) | Q)" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) -apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ -oops +text \ + The ones that have not been proved are not known to be valid! Some will + require quantifier duplication -- not currently available. +\ -lemma "(ALL x. ~~P(x)) --> ~~(ALL x. P(x))" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) -apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ -oops - -text\Classically but not intuitionistically valid. Proved by a bug in 1986!\ -lemma "EX x. Q(x) --> (ALL x. Q(x))" -apply (tactic\IntPr.fast_tac @{context} 1\ | -) -apply (rule asm_rl) --\Checks that subgoals remain: proof failed.\ -oops - +text\\\18\ +lemma "\ \ (\y. \x. P(y) \ P(x))" + oops -- \NOT PROVED\ -subsection\Hard examples with quantifiers\ - -text\The ones that have not been proved are not known to be valid! - Some will require quantifier duplication -- not currently available\ - -text\~~18\ -lemma "~~(EX y. ALL x. P(y)-->P(x))" -oops --\NOT PROVED\ - -text\~~19\ -lemma "~~(EX x. ALL y z. (P(y)-->Q(z)) --> (P(x)-->Q(x)))" -oops --\NOT PROVED\ +text\\\19\ +lemma "\ \ (\x. \y z. (P(y) \ Q(z)) \ (P(x) \ Q(x)))" + oops -- \NOT PROVED\ text\20\ -lemma "(ALL x y. EX z. ALL w. (P(x)&Q(y)-->R(z)&S(w))) - --> (EX x y. P(x) & Q(y)) --> (EX z. R(z))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\x y. \z. \w. (P(x) \ Q(y) \ R(z) \ S(w))) + \ (\x y. P(x) \ Q(y)) \ (\z. R(z))" + by (tactic \IntPr.fast_tac @{context} 1\) text\21\ -lemma "(EX x. P-->Q(x)) & (EX x. Q(x)-->P) --> ~~(EX x. P<->Q(x))" -oops --\NOT PROVED; needs quantifier duplication\ +lemma "(\x. P \ Q(x)) \ (\x. Q(x) \ P) \ \ \ (\x. P \ Q(x))" + oops -- \NOT PROVED; needs quantifier duplication\ text\22\ -lemma "(ALL x. P <-> Q(x)) --> (P <-> (ALL x. Q(x)))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~23\ -lemma "~~ ((ALL x. P | Q(x)) <-> (P | (ALL x. Q(x))))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\23\ +lemma "\ \ ((\x. P \ Q(x)) \ (P \ (\x. Q(x))))" + by (tactic \IntPr.fast_tac @{context} 1\) text\24\ -lemma "~(EX x. S(x)&Q(x)) & (ALL x. P(x) --> Q(x)|R(x)) & - (~(EX x. P(x)) --> (EX x. Q(x))) & (ALL x. Q(x)|R(x) --> S(x)) - --> ~~(EX x. P(x)&R(x))" -txt\Not clear why @{text fast_tac}, @{text best_tac}, @{text ASTAR} and - @{text ITER_DEEPEN} all take forever\ -apply (tactic\IntPr.safe_tac @{context}\) -apply (erule impE) -apply (tactic\IntPr.fast_tac @{context} 1\) -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "\ (\x. S(x) \ Q(x)) \ (\x. P(x) \ Q(x) \ R(x)) \ + (\ (\x. P(x)) \ (\x. Q(x))) \ (\x. Q(x) \ R(x) \ S(x)) + \ \ \ (\x. P(x) \ R(x))" +text \ + Not clear why @{text fast_tac}, @{text best_tac}, @{text ASTAR} and + @{text ITER_DEEPEN} all take forever. +\ + apply (tactic \IntPr.safe_tac @{context}\) + apply (erule impE) + apply (tactic \IntPr.fast_tac @{context} 1\) + apply (tactic \IntPr.fast_tac @{context} 1\) + done text\25\ -lemma "(EX x. P(x)) & - (ALL x. L(x) --> ~ (M(x) & R(x))) & - (ALL x. P(x) --> (M(x) & L(x))) & - ((ALL x. P(x)-->Q(x)) | (EX x. P(x)&R(x))) - --> (EX x. Q(x)&P(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\x. P(x)) \ + (\x. L(x) \ \ (M(x) \ R(x))) \ + (\x. P(x) \ (M(x) \ L(x))) \ + ((\x. P(x) \ Q(x)) \ (\x. P(x) \ R(x))) + \ (\x. Q(x) \ P(x))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~26\ -lemma "(~~(EX x. p(x)) <-> ~~(EX x. q(x))) & - (ALL x. ALL y. p(x) & q(y) --> (r(x) <-> s(y))) - --> ((ALL x. p(x)-->r(x)) <-> (ALL x. q(x)-->s(x)))" -oops --\NOT PROVED\ +text\\\26\ +lemma + "(\ \ (\x. p(x)) \ \ \ (\x. q(x))) \ + (\x. \y. p(x) \ q(y) \ (r(x) \ s(y))) + \ ((\x. p(x) \ r(x)) \ (\x. q(x) \ s(x)))" + oops --\NOT PROVED\ text\27\ -lemma "(EX x. P(x) & ~Q(x)) & - (ALL x. P(x) --> R(x)) & - (ALL x. M(x) & L(x) --> P(x)) & - ((EX x. R(x) & ~ Q(x)) --> (ALL x. L(x) --> ~ R(x))) - --> (ALL x. M(x) --> ~L(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\x. P(x) \ \ Q(x)) \ + (\x. P(x) \ R(x)) \ + (\x. M(x) \ L(x) \ P(x)) \ + ((\x. R(x) \ \ Q(x)) \ (\x. L(x) \ \ R(x))) + \ (\x. M(x) \ \ L(x))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~28. AMENDED\ -lemma "(ALL x. P(x) --> (ALL x. Q(x))) & - (~~(ALL x. Q(x)|R(x)) --> (EX x. Q(x)&S(x))) & - (~~(EX x. S(x)) --> (ALL x. L(x) --> M(x))) - --> (ALL x. P(x) & L(x) --> M(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\28. AMENDED\ +lemma + "(\x. P(x) \ (\x. Q(x))) \ + (\ \ (\x. Q(x) \ R(x)) \ (\x. Q(x) \ S(x))) \ + (\ \ (\x. S(x)) \ (\x. L(x) \ M(x))) + \ (\x. P(x) \ L(x) \ M(x))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\29. Essentially the same as Principia Mathematica *11.71\ -lemma "(EX x. P(x)) & (EX y. Q(y)) - --> ((ALL x. P(x)-->R(x)) & (ALL y. Q(y)-->S(y)) <-> - (ALL x y. P(x) & Q(y) --> R(x) & S(y)))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\29. Essentially the same as Principia Mathematica *11.71\ +lemma + "(\x. P(x)) \ (\y. Q(y)) + \ ((\x. P(x) \ R(x)) \ (\y. Q(y) \ S(y)) \ + (\x y. P(x) \ Q(y) \ R(x) \ S(y)))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~30\ -lemma "(ALL x. (P(x) | Q(x)) --> ~ R(x)) & - (ALL x. (Q(x) --> ~ S(x)) --> P(x) & R(x)) - --> (ALL x. ~~S(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\\\30\ +lemma + "(\x. (P(x) \ Q(x)) \ \ R(x)) \ + (\x. (Q(x) \ \ S(x)) \ P(x) \ R(x)) + \ (\x. \ \ S(x))" + by (tactic \IntPr.fast_tac @{context} 1\) text\31\ -lemma "~(EX x. P(x) & (Q(x) | R(x))) & - (EX x. L(x) & P(x)) & - (ALL x. ~ R(x) --> M(x)) - --> (EX x. L(x) & M(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "\ (\x. P(x) \ (Q(x) \ R(x))) \ + (\x. L(x) \ P(x)) \ + (\x. \ R(x) \ M(x)) + \ (\x. L(x) \ M(x))" + by (tactic \IntPr.fast_tac @{context} 1\) text\32\ -lemma "(ALL x. P(x) & (Q(x)|R(x))-->S(x)) & - (ALL x. S(x) & R(x) --> L(x)) & - (ALL x. M(x) --> R(x)) - --> (ALL x. P(x) & M(x) --> L(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\x. P(x) \ (Q(x) \ R(x)) \ S(x)) \ + (\x. S(x) \ R(x) \ L(x)) \ + (\x. M(x) \ R(x)) + \ (\x. P(x) \ M(x) \ L(x))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\~~33\ -lemma "(ALL x. ~~(P(a) & (P(x)-->P(b))-->P(c))) <-> - (ALL x. ~~((~P(a) | P(x) | P(c)) & (~P(a) | ~P(b) | P(c))))" -apply (tactic\IntPr.best_tac @{context} 1\) -done +text\\\33\ +lemma + "(\x. \ \ (P(a) \ (P(x) \ P(b)) \ P(c))) \ + (\x. \ \ ((\ P(a) \ P(x) \ P(c)) \ (\ P(a) \ \ P(b) \ P(c))))" + apply (tactic \IntPr.best_tac @{context} 1\) + done text\36\ -lemma "(ALL x. EX y. J(x,y)) & - (ALL x. EX y. G(x,y)) & - (ALL x y. J(x,y) | G(x,y) --> (ALL z. J(y,z) | G(y,z) --> H(x,z))) - --> (ALL x. EX y. H(x,y))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\x. \y. J(x,y)) \ + (\x. \y. G(x,y)) \ + (\x y. J(x,y) \ G(x,y) \ (\z. J(y,z) \ G(y,z) \ H(x,z))) + \ (\x. \y. H(x,y))" + by (tactic \IntPr.fast_tac @{context} 1\) text\37\ -lemma "(ALL z. EX w. ALL x. EX y. - ~~(P(x,z)-->P(y,w)) & P(y,z) & (P(y,w) --> (EX u. Q(u,w)))) & - (ALL x z. ~P(x,z) --> (EX y. Q(y,z))) & - (~~(EX x y. Q(x,y)) --> (ALL x. R(x,x))) - --> ~~(ALL x. EX y. R(x,y))" -oops --\NOT PROVED\ +lemma + "(\z. \w. \x. \y. + \ \ (P(x,z) \ P(y,w)) \ P(y,z) \ (P(y,w) \ (\u. Q(u,w)))) \ + (\x z. \ P(x,z) \ (\y. Q(y,z))) \ + (\ \ (\x y. Q(x,y)) \ (\x. R(x,x))) + \ \ \ (\x. \y. R(x,y))" + oops --\NOT PROVED\ text\39\ -lemma "~ (EX x. ALL y. F(y,x) <-> ~F(y,y))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\ (\x. \y. F(y,x) \ \ F(y,y))" + by (tactic \IntPr.fast_tac @{context} 1\) -text\40. AMENDED\ -lemma "(EX y. ALL x. F(x,y) <-> F(x,x)) --> - ~(ALL x. EX y. ALL z. F(z,y) <-> ~ F(z,x))" -by (tactic\IntPr.fast_tac @{context} 1\) +text\40. AMENDED\ +lemma + "(\y. \x. F(x,y) \ F(x,x)) \ + \ (\x. \y. \z. F(z,y) \ \ F(z,x))" + by (tactic \IntPr.fast_tac @{context} 1\) text\44\ -lemma "(ALL x. f(x) --> - (EX y. g(y) & h(x,y) & (EX y. g(y) & ~ h(x,y)))) & - (EX x. j(x) & (ALL y. g(y) --> h(x,y))) - --> (EX x. j(x) & ~f(x))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\x. f(x) \ + (\y. g(y) \ h(x,y) \ (\y. g(y) \ \ h(x,y)))) \ + (\x. j(x) \ (\y. g(y) \ h(x,y))) + \ (\x. j(x) \ \ f(x))" + by (tactic \IntPr.fast_tac @{context} 1\) text\48\ -lemma "(a=b | c=d) & (a=c | b=d) --> a=d | b=c" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(a = b \ c = d) \ (a = c \ b = d) \ a = d \ b = c" + by (tactic \IntPr.fast_tac @{context} 1\) text\51\ -lemma "(EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> - (EX z. ALL x. EX w. (ALL y. P(x,y) <-> y=w) <-> x=z)" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "(\z w. \x y. P(x,y) \ (x = z \ y = w)) \ + (\z. \x. \w. (\y. P(x,y) \ y = w) \ x = z)" + by (tactic \IntPr.fast_tac @{context} 1\) text\52\ -text\Almost the same as 51.\ -lemma "(EX z w. ALL x y. P(x,y) <-> (x=z & y=w)) --> - (EX w. ALL y. EX z. (ALL x. P(x,y) <-> x=z) <-> y=w)" -by (tactic\IntPr.fast_tac @{context} 1\) +text \Almost the same as 51.\ +lemma + "(\z w. \x y. P(x,y) \ (x = z \ y = w)) \ + (\w. \y. \z. (\x. P(x,y) \ x = z) \ y = w)" + by (tactic \IntPr.fast_tac @{context} 1\) text\56\ -lemma "(ALL x. (EX y. P(y) & x=f(y)) --> P(x)) <-> (ALL x. P(x) --> P(f(x)))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "(\x. (\y. P(y) \ x = f(y)) \ P(x)) \ (\x. P(x) \ P(f(x)))" + by (tactic \IntPr.fast_tac @{context} 1\) text\57\ -lemma "P(f(a,b), f(b,c)) & P(f(b,c), f(a,c)) & - (ALL x y z. P(x,y) & P(y,z) --> P(x,z)) --> P(f(a,b), f(a,c))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma + "P(f(a,b), f(b,c)) \ P(f(b,c), f(a,c)) \ + (\x y z. P(x,y) \ P(y,z) \ P(x,z)) \ P(f(a,b), f(a,c))" + by (tactic \IntPr.fast_tac @{context} 1\) text\60\ -lemma "ALL x. P(x,f(x)) <-> (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))" -by (tactic\IntPr.fast_tac @{context} 1\) +lemma "\x. P(x,f(x)) \ (\y. (\z. P(z,y) \ P(z,f(x))) \ P(x,y))" + by (tactic \IntPr.fast_tac @{context} 1\) end - diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Locale_Test/Locale_Test.thy --- a/src/FOL/ex/Locale_Test/Locale_Test.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Locale_Test/Locale_Test.thy Mon Oct 19 23:00:07 2015 +0200 @@ -16,9 +16,9 @@ lemmas less_mixin_thy_merge2 = le'.less_def end -lemma "gless(x, y) <-> gle(x, y) & x ~= y" (* mixin from first interpretation applied *) +lemma "gless(x, y) \ gle(x, y) \ x \ y" (* mixin from first interpretation applied *) by (rule le1.less_mixin_thy_merge1) -lemma "gless'(x, y) <-> gle'(x, y) & x ~= y" (* mixin from second interpretation applied *) +lemma "gless'(x, y) \ gle'(x, y) \ x \ y" (* mixin from second interpretation applied *) by (rule le1.less_mixin_thy_merge2) end diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Locale_Test/Locale_Test1.thy --- a/src/FOL/ex/Locale_Test/Locale_Test1.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Locale_Test/Locale_Test1.thy Mon Oct 19 23:00:07 2015 +0200 @@ -114,8 +114,8 @@ and P :: "'a => 'b => o" begin -definition test :: "'a => o" where - "test(x) <-> (ALL b. P(x, b))" +definition test :: "'a => o" + where "test(x) \ (\b. P(x, b))" end @@ -133,8 +133,8 @@ and p2 :: "'b => o" begin -definition d1 :: "'a => o" where "d1(x) <-> ~ p2(p1(x))" -definition d2 :: "'b => o" where "d2(x) <-> ~ p2(x)" +definition d1 :: "'a => o" where "d1(x) \ \ p2(p1(x))" +definition d2 :: "'b => o" where "d2(x) \ \ p2(x)" thm d1_def d2_def @@ -222,10 +222,10 @@ (* A somewhat arcane homomorphism example *) definition semi_hom where - "semi_hom(prod, sum, h) <-> (ALL x y. h(prod(x, y)) = sum(h(x), h(y)))" + "semi_hom(prod, sum, h) \ (\x y. h(prod(x, y)) = sum(h(x), h(y)))" lemma semi_hom_mult: - "semi_hom(prod, sum, h) ==> h(prod(x, y)) = sum(h(x), h(y))" + "semi_hom(prod, sum, h) \ h(prod(x, y)) = sum(h(x), h(y))" by (simp add: semi_hom_def) locale semi_hom_loc = prod: semi prod + sum: semi sum @@ -242,7 +242,7 @@ (* Referring to facts from within a context specification *) lemma - assumes x: "P <-> P" + assumes x: "P \ P" notes y = x shows True .. @@ -250,7 +250,7 @@ section \Theorem statements\ lemma (in lgrp) lcancel: - "x ** y = x ** z <-> y = z" + "x ** y = x ** z \ y = z" proof assume "x ** y = x ** z" then have "inv(x) ** x ** y = inv(x) ** x ** z" by (simp add: assoc) @@ -266,7 +266,7 @@ begin lemma rcancel: - "y ** x = z ** x <-> y = z" + "y ** x = z ** x \ y = z" proof assume "y ** x = z ** x" then have "y ** (x ** inv(x)) = z ** (x ** inv(x))" @@ -322,7 +322,7 @@ (* use of derived theorem *) lemma (in lgrp) - "y ** x = z ** x <-> y = z" + "y ** x = z ** x \ y = z" apply (rule rcancel) done @@ -372,7 +372,7 @@ begin definition greater :: "'a => 'a => o" (infix ">>" 50) where - "x >> y <-> y << x" + "x >> y \ y << x" end @@ -392,7 +392,7 @@ locale A5 = fixes A and B and C and D and E - assumes eq: "A <-> B <-> C <-> D <-> E" + assumes eq: "A \ B \ C \ D \ E" sublocale A5 < 1: A5 _ _ D E C print_facts @@ -415,7 +415,7 @@ locale trivial = fixes P and Q :: o - assumes Q: "P <-> P <-> Q" + assumes Q: "P \ P \ Q" begin lemma Q_triv: "Q" using Q by fast @@ -494,28 +494,28 @@ locale logic_o = fixes land (infixl "&&" 55) and lnot ("-- _" [60] 60) - assumes assoc_o: "(x && y) && z <-> x && (y && z)" - and notnot_o: "-- (-- x) <-> x" + assumes assoc_o: "(x && y) && z \ x && (y && z)" + and notnot_o: "-- (-- x) \ x" begin definition lor_o (infixl "||" 50) where - "x || y <-> --(-- x && -- y)" + "x || y \ --(-- x && -- y)" end -interpretation x: logic_o "op &" "Not" - where bool_logic_o: "x.lor_o(x, y) <-> x | y" +interpretation x: logic_o "op \" "Not" + where bool_logic_o: "x.lor_o(x, y) \ x \ y" proof - - show bool_logic_o: "PROP logic_o(op &, Not)" by unfold_locales fast+ - show "logic_o.lor_o(op &, Not, x, y) <-> x | y" + show bool_logic_o: "PROP logic_o(op \, Not)" by unfold_locales fast+ + show "logic_o.lor_o(op \, Not, x, y) \ x \ y" by (unfold logic_o.lor_o_def [OF bool_logic_o]) fast qed thm x.lor_o_def bool_logic_o -lemma lor_triv: "z <-> z" .. +lemma lor_triv: "z \ z" .. -lemma (in logic_o) lor_triv: "x || y <-> x || y" by fast +lemma (in logic_o) lor_triv: "x || y \ x || y" by fast thm lor_triv [where z = True] (* Check strict prefix. *) x.lor_triv @@ -528,7 +528,7 @@ assumes refl: "x \ x" begin -definition less (infix "\" 50) where "x \ y <-> x \ y & x ~= y" +definition less (infix "\" 50) where "x \ y \ x \ y \ x \ y" end @@ -536,8 +536,8 @@ gle :: "'a => 'a => o" and gless :: "'a => 'a => o" and gle' :: "'a => 'a => o" and gless' :: "'a => 'a => o" where - grefl: "gle(x, x)" and gless_def: "gless(x, y) <-> gle(x, y) & x ~= y" and - grefl': "gle'(x, x)" and gless'_def: "gless'(x, y) <-> gle'(x, y) & x ~= y" + grefl: "gle(x, x)" and gless_def: "gless(x, y) \ gle(x, y) \ x \ y" and + grefl': "gle'(x, x)" and gless'_def: "gless'(x, y) \ gle'(x, y) \ x \ y" text \Setup\ @@ -546,11 +546,11 @@ lemmas less_thm = less_def end -interpretation le: mixin gle where "reflexive.less(gle, x, y) <-> gless(x, y)" +interpretation le: mixin gle where "reflexive.less(gle, x, y) \ gless(x, y)" proof - show "mixin(gle)" by unfold_locales (rule grefl) note reflexive = this[unfolded mixin_def] - show "reflexive.less(gle, x, y) <-> gless(x, y)" + show "reflexive.less(gle, x, y) \ gless(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless_def) qed @@ -565,7 +565,7 @@ by unfold_locales thm le.less_thm2 (* rewrite morphism applied *) -lemma "gless(x, y) <-> gle(x, y) & x ~= y" +lemma "gless(x, y) \ gle(x, y) \ x \ y" by (rule le.less_thm2) text \Rewrite morphism does not leak to a side branch.\ @@ -579,7 +579,7 @@ by unfold_locales thm le.less_thm3 (* rewrite morphism not applied *) -lemma "reflexive.less(gle, x, y) <-> gle(x, y) & x ~= y" by (rule le.less_thm3) +lemma "reflexive.less(gle, x, y) \ gle(x, y) \ x \ y" by (rule le.less_thm3) text \Rewrite morphism only available in original context\ @@ -588,11 +588,11 @@ locale mixin4_mixin = mixin4_base interpretation le: mixin4_mixin gle - where "reflexive.less(gle, x, y) <-> gless(x, y)" + where "reflexive.less(gle, x, y) \ gless(x, y)" proof - show "mixin4_mixin(gle)" by unfold_locales (rule grefl) note reflexive = this[unfolded mixin4_mixin_def mixin4_base_def mixin_def] - show "reflexive.less(gle, x, y) <-> gless(x, y)" + show "reflexive.less(gle, x, y) \ gless(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless_def) qed @@ -610,7 +610,7 @@ by unfold_locales (rule grefl') thm le4.less_thm4' (* rewrite morphism not applied *) -lemma "reflexive.less(gle, x, y) <-> gle(x, y) & x ~= y" +lemma "reflexive.less(gle, x, y) \ gle(x, y) \ x \ y" by (rule le4.less_thm4') text \Inherited rewrite morphism applied to new theorem\ @@ -620,11 +620,11 @@ locale mixin5_inherited = mixin5_base interpretation le5: mixin5_base gle - where "reflexive.less(gle, x, y) <-> gless(x, y)" + where "reflexive.less(gle, x, y) \ gless(x, y)" proof - show "mixin5_base(gle)" by unfold_locales note reflexive = this[unfolded mixin5_base_def mixin_def] - show "reflexive.less(gle, x, y) <-> gless(x, y)" + show "reflexive.less(gle, x, y) \ gless(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless_def) qed @@ -634,7 +634,7 @@ lemmas (in mixin5_inherited) less_thm5 = less_def thm le5.less_thm5 (* rewrite morphism applied *) -lemma "gless(x, y) <-> gle(x, y) & x ~= y" +lemma "gless(x, y) \ gle(x, y) \ x \ y" by (rule le5.less_thm5) text \Rewrite morphism pushed down to existing inherited locale\ @@ -648,18 +648,18 @@ interpretation le6: mixin6_inherited gle by unfold_locales interpretation le6: mixin6_base gle - where "reflexive.less(gle, x, y) <-> gless(x, y)" + where "reflexive.less(gle, x, y) \ gless(x, y)" proof - show "mixin6_base(gle)" by unfold_locales note reflexive = this[unfolded mixin6_base_def mixin_def] - show "reflexive.less(gle, x, y) <-> gless(x, y)" + show "reflexive.less(gle, x, y) \ gless(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless_def) qed lemmas (in mixin6_inherited) less_thm6 = less_def thm le6.less_thm6 (* mixin applied *) -lemma "gless(x, y) <-> gle(x, y) & x ~= y" +lemma "gless(x, y) \ gle(x, y) \ x \ y" by (rule le6.less_thm6) text \Existing rewrite morphism inherited through sublocale relation\ @@ -669,11 +669,11 @@ locale mixin7_inherited = reflexive interpretation le7: mixin7_base gle - where "reflexive.less(gle, x, y) <-> gless(x, y)" + where "reflexive.less(gle, x, y) \ gless(x, y)" proof - show "mixin7_base(gle)" by unfold_locales note reflexive = this[unfolded mixin7_base_def mixin_def] - show "reflexive.less(gle, x, y) <-> gless(x, y)" + show "reflexive.less(gle, x, y) \ gless(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless_def) qed @@ -683,7 +683,7 @@ lemmas (in mixin7_inherited) less_thm7 = less_def thm le7.less_thm7 (* before, rewrite morphism not applied *) -lemma "reflexive.less(gle, x, y) <-> gle(x, y) & x ~= y" +lemma "reflexive.less(gle, x, y) \ gle(x, y) \ x \ y" by (rule le7.less_thm7) sublocale mixin7_inherited < mixin7_base @@ -692,7 +692,7 @@ lemmas (in mixin7_inherited) less_thm7b = less_def thm le7.less_thm7b (* after, mixin applied *) -lemma "gless(x, y) <-> gle(x, y) & x ~= y" +lemma "gless(x, y) \ gle(x, y) \ x \ y" by (rule le7.less_thm7b) @@ -764,11 +764,11 @@ text \Roundup applies rewrite morphisms at declaration level in DFS tree\ -locale roundup = fixes x assumes true: "x <-> True" +locale roundup = fixes x assumes true: "x \ True" -sublocale roundup \ sub: roundup x where "x <-> True & True" +sublocale roundup \ sub: roundup x where "x \ True \ True" apply unfold_locales apply (simp add: true) done -lemma (in roundup) "True & True <-> True" by (rule sub.true) +lemma (in roundup) "True \ True \ True" by (rule sub.true) section \Interpretation in named contexts\ @@ -812,19 +812,19 @@ proof { fix pand and pnot and por - assume passoc: "!!x y z. pand(pand(x, y), z) <-> pand(x, pand(y, z))" - and pnotnot: "!!x. pnot(pnot(x)) <-> x" - and por_def: "!!x y. por(x, y) <-> pnot(pand(pnot(x), pnot(y)))" + assume passoc: "\x y z. pand(pand(x, y), z) \ pand(x, pand(y, z))" + and pnotnot: "\x. pnot(pnot(x)) \ x" + and por_def: "\x y. por(x, y) \ pnot(pand(pnot(x), pnot(y)))" interpret loc: logic_o pand pnot - where por_eq: "!!x y. logic_o.lor_o(pand, pnot, x, y) <-> por(x, y)" (* FIXME *) + where por_eq: "\x y. logic_o.lor_o(pand, pnot, x, y) \ por(x, y)" (* FIXME *) proof - show logic_o: "PROP logic_o(pand, pnot)" using passoc pnotnot by unfold_locales fix x y - show "logic_o.lor_o(pand, pnot, x, y) <-> por(x, y)" + show "logic_o.lor_o(pand, pnot, x, y) \ por(x, y)" by (unfold logic_o.lor_o_def [OF logic_o]) (rule por_def [symmetric]) qed print_interps logic_o - have "!!x y. por(x, y) <-> pnot(pand(pnot(x), pnot(y)))" by (rule loc.lor_o_def) + have "\x y. por(x, y) \ pnot(pand(pnot(x), pnot(y)))" by (rule loc.lor_o_def) } qed diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Locale_Test/Locale_Test2.thy --- a/src/FOL/ex/Locale_Test/Locale_Test2.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Locale_Test/Locale_Test2.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,11 +9,11 @@ begin interpretation le1: mixin_thy_merge gle gle' - where "reflexive.less(gle, x, y) <-> gless(x, y)" + where "reflexive.less(gle, x, y) \ gless(x, y)" proof - show "mixin_thy_merge(gle, gle')" by unfold_locales note reflexive = this[unfolded mixin_thy_merge_def, THEN conjunct1] - show "reflexive.less(gle, x, y) <-> gless(x, y)" + show "reflexive.less(gle, x, y) \ gless(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless_def) qed diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Locale_Test/Locale_Test3.thy --- a/src/FOL/ex/Locale_Test/Locale_Test3.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Locale_Test/Locale_Test3.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,11 +9,11 @@ begin interpretation le2: mixin_thy_merge gle gle' - where "reflexive.less(gle', x, y) <-> gless'(x, y)" + where "reflexive.less(gle', x, y) \ gless'(x, y)" proof - show "mixin_thy_merge(gle, gle')" by unfold_locales note reflexive = this[unfolded mixin_thy_merge_def, THEN conjunct2] - show "reflexive.less(gle', x, y) <-> gless'(x, y)" + show "reflexive.less(gle', x, y) \ gless'(x, y)" by (simp add: reflexive.less_def[OF reflexive] gless'_def) qed diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Miniscope.thy --- a/src/FOL/ex/Miniscope.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Miniscope.thy Mon Oct 19 23:00:07 2015 +0200 @@ -11,7 +11,6 @@ imports FOL begin - lemmas ccontr = FalseE [THEN classical] subsection \Negation Normal Form\ @@ -19,20 +18,20 @@ subsubsection \de Morgan laws\ lemma demorgans: - "~(P&Q) <-> ~P | ~Q" - "~(P|Q) <-> ~P & ~Q" - "~~P <-> P" - "!!P. ~(ALL x. P(x)) <-> (EX x. ~P(x))" - "!!P. ~(EX x. P(x)) <-> (ALL x. ~P(x))" + "\ (P \ Q) \ \ P \ \ Q" + "\ (P \ Q) \ \ P \ \ Q" + "\ \ P \ P" + "\P. \ (\x. P(x)) \ (\x. \ P(x))" + "\P. \ (\x. P(x)) \ (\x. \ P(x))" by blast+ (*** Removal of --> and <-> (positive and negative occurrences) ***) (*Last one is important for computing a compact CNF*) lemma nnf_simps: - "(P-->Q) <-> (~P | Q)" - "~(P-->Q) <-> (P & ~Q)" - "(P<->Q) <-> (~P | Q) & (~Q | P)" - "~(P<->Q) <-> (P | Q) & (~P | ~Q)" + "(P \ Q) \ (\ P \ Q)" + "\ (P \ Q) \ (P \ \ Q)" + "(P \ Q) \ (\ P \ Q) \ (\ Q \ P)" + "\ (P \ Q) \ (P \ Q) \ (\ P \ \ Q)" by blast+ @@ -41,24 +40,24 @@ subsubsection \Pushing in the existential quantifiers\ lemma ex_simps: - "(EX x. P) <-> P" - "!!P Q. (EX x. P(x) & Q) <-> (EX x. P(x)) & Q" - "!!P Q. (EX x. P & Q(x)) <-> P & (EX x. Q(x))" - "!!P Q. (EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" - "!!P Q. (EX x. P(x) | Q) <-> (EX x. P(x)) | Q" - "!!P Q. (EX x. P | Q(x)) <-> P | (EX x. Q(x))" + "(\x. P) \ P" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" + "\P Q. (\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" by blast+ subsubsection \Pushing in the universal quantifiers\ lemma all_simps: - "(ALL x. P) <-> P" - "!!P Q. (ALL x. P(x) & Q(x)) <-> (ALL x. P(x)) & (ALL x. Q(x))" - "!!P Q. (ALL x. P(x) & Q) <-> (ALL x. P(x)) & Q" - "!!P Q. (ALL x. P & Q(x)) <-> P & (ALL x. Q(x))" - "!!P Q. (ALL x. P(x) | Q) <-> (ALL x. P(x)) | Q" - "!!P Q. (ALL x. P | Q(x)) <-> P | (ALL x. Q(x))" + "(\x. P) \ P" + "\P Q. (\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" + "\P Q. (\x. P(x) \ Q) \ (\x. P(x)) \ Q" + "\P Q. (\x. P \ Q(x)) \ P \ (\x. Q(x))" by blast+ lemmas mini_simps = demorgans nnf_simps ex_simps all_simps diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Nat.thy --- a/src/FOL/ex/Nat.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Nat.thy Mon Oct 19 23:00:07 2015 +0200 @@ -29,7 +29,7 @@ subsection \Proofs about the natural numbers\ -lemma Suc_n_not_n: "Suc(k) ~= k" +lemma Suc_n_not_n: "Suc(k) \ k" apply (rule_tac n = k in induct) apply (rule notI) apply (erule Suc_neq_0) diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Prolog.thy --- a/src/FOL/ex/Prolog.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Prolog.thy Mon Oct 19 23:00:07 2015 +0200 @@ -83,7 +83,7 @@ (*?x has 16, ?y has 32; rev(?y,?w) requires 561 (rather large) inferences total inferences = 2 + 1 + 17 + 561 = 581*) -schematic_goal "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:Nil = ?x & app(?x,?x,?y) & rev(?y,?w)" +schematic_goal "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:Nil = ?x \ app(?x,?x,?y) \ rev(?y,?w)" apply (tactic \ DEPTH_SOLVE (resolve_tac @{context} ([@{thm refl}, @{thm conjI}] @ @{thms rules}) 1)\) done diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Propositional_Cla.thy --- a/src/FOL/ex/Propositional_Cla.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Propositional_Cla.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,109 +9,112 @@ imports FOL begin -text \commutative laws of @{text "&"} and @{text "|"}\ +text \commutative laws of @{text "\"} and @{text "\"}\ -lemma "P & Q --> Q & P" +lemma "P \ Q \ Q \ P" by (tactic "IntPr.fast_tac @{context} 1") -lemma "P | Q --> Q | P" +lemma "P \ Q \ Q \ P" by fast -text \associative laws of @{text "&"} and @{text "|"}\ -lemma "(P & Q) & R --> P & (Q & R)" +text \associative laws of @{text "\"} and @{text "\"}\ +lemma "(P \ Q) \ R \ P \ (Q \ R)" by fast -lemma "(P | Q) | R --> P | (Q | R)" +lemma "(P \ Q) \ R \ P \ (Q \ R)" by fast -text \distributive laws of @{text "&"} and @{text "|"}\ -lemma "(P & Q) | R --> (P | R) & (Q | R)" +text \distributive laws of @{text "\"} and @{text "\"}\ +lemma "(P \ Q) \ R \ (P \ R) \ (Q \ R)" by fast -lemma "(P | R) & (Q | R) --> (P & Q) | R" +lemma "(P \ R) \ (Q \ R) \ (P \ Q) \ R" by fast -lemma "(P | Q) & R --> (P & R) | (Q & R)" +lemma "(P \ Q) \ R \ (P \ R) \ (Q \ R)" by fast -lemma "(P & R) | (Q & R) --> (P | Q) & R" +lemma "(P \ R) \ (Q \ R) \ (P \ Q) \ R" by fast text \Laws involving implication\ -lemma "(P-->R) & (Q-->R) <-> (P|Q --> R)" +lemma "(P \ R) \ (Q \ R) \ (P \ Q \ R)" by fast -lemma "(P & Q --> R) <-> (P--> (Q-->R))" +lemma "(P \ Q \ R) \ (P \ (Q \ R))" by fast -lemma "((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R" +lemma "((P \ R) \ R) \ ((Q \ R) \ R) \ (P \ Q \ R) \ R" by fast -lemma "~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)" +lemma "\ (P \ R) \ \ (Q \ R) \ \ (P \ Q \ R)" by fast -lemma "(P --> Q & R) <-> (P-->Q) & (P-->R)" +lemma "(P \ Q \ R) \ (P \ Q) \ (P \ R)" by fast text \Propositions-as-types\ -- \The combinator K\ -lemma "P --> (Q --> P)" +lemma "P \ (Q \ P)" by fast -- \The combinator S\ -lemma "(P-->Q-->R) --> (P-->Q) --> (P-->R)" +lemma "(P \ Q \ R) \ (P \ Q) \ (P \ R)" by fast -- \Converse is classical\ -lemma "(P-->Q) | (P-->R) --> (P --> Q | R)" +lemma "(P \ Q) \ (P \ R) \ (P \ Q \ R)" by fast -lemma "(P-->Q) --> (~Q --> ~P)" +lemma "(P \ Q) \ (\ Q \ \ P)" by fast text \Schwichtenberg's examples (via T. Nipkow)\ -lemma stab_imp: "(((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q" +lemma stab_imp: "(((Q \ R) \ R) \ Q) \ (((P \ Q) \ R) \ R) \ P \ Q" by fast lemma stab_to_peirce: - "(((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) - --> ((P --> Q) --> P) --> P" + "(((P \ R) \ R) \ P) \ (((Q \ R) \ R) \ Q) + \ ((P \ Q) \ P) \ P" by fast -lemma peirce_imp1: "(((Q --> R) --> Q) --> Q) - --> (((P --> Q) --> R) --> P --> Q) --> P --> Q" - by fast - -lemma peirce_imp2: "(((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P" +lemma peirce_imp1: + "(((Q \ R) \ Q) \ Q) + \ (((P \ Q) \ R) \ P \ Q) \ P \ Q" by fast -lemma mints: "((((P --> Q) --> P) --> P) --> Q) --> Q" +lemma peirce_imp2: "(((P \ R) \ P) \ P) \ ((P \ Q \ R) \ P) \ P" + by fast + +lemma mints: "((((P \ Q) \ P) \ P) \ Q) \ Q" by fast -lemma mints_solovev: "(P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R" +lemma mints_solovev: "(P \ (Q \ R) \ Q) \ ((P \ Q) \ R) \ R" by fast -lemma tatsuta: "(((P7 --> P1) --> P10) --> P4 --> P5) - --> (((P8 --> P2) --> P9) --> P3 --> P10) - --> (P1 --> P8) --> P6 --> P7 - --> (((P3 --> P2) --> P9) --> P4) - --> (P1 --> P3) --> (((P6 --> P1) --> P2) --> P9) --> P5" +lemma tatsuta: + "(((P7 \ P1) \ P10) \ P4 \ P5) + \ (((P8 \ P2) \ P9) \ P3 \ P10) + \ (P1 \ P8) \ P6 \ P7 + \ (((P3 \ P2) \ P9) \ P4) + \ (P1 \ P3) \ (((P6 \ P1) \ P2) \ P9) \ P5" by fast -lemma tatsuta1: "(((P8 --> P2) --> P9) --> P3 --> P10) - --> (((P3 --> P2) --> P9) --> P4) - --> (((P6 --> P1) --> P2) --> P9) - --> (((P7 --> P1) --> P10) --> P4 --> P5) - --> (P1 --> P3) --> (P1 --> P8) --> P6 --> P7 --> P5" +lemma tatsuta1: + "(((P8 \ P2) \ P9) \ P3 \ P10) + \ (((P3 \ P2) \ P9) \ P4) + \ (((P6 \ P1) \ P2) \ P9) + \ (((P7 \ P1) \ P10) \ P4 \ P5) + \ (P1 \ P3) \ (P1 \ P8) \ P6 \ P7 \ P5" by fast end diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Propositional_Int.thy --- a/src/FOL/ex/Propositional_Int.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Propositional_Int.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,109 +9,112 @@ imports IFOL begin -text \commutative laws of @{text "&"} and @{text "|"}\ +text \commutative laws of @{text "\"} and @{text "\"}\ -lemma "P & Q --> Q & P" +lemma "P \ Q \ Q \ P" by (tactic "IntPr.fast_tac @{context} 1") -lemma "P | Q --> Q | P" +lemma "P \ Q \ Q \ P" by (tactic "IntPr.fast_tac @{context} 1") -text \associative laws of @{text "&"} and @{text "|"}\ -lemma "(P & Q) & R --> P & (Q & R)" +text \associative laws of @{text "\"} and @{text "\"}\ +lemma "(P \ Q) \ R \ P \ (Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P | Q) | R --> P | (Q | R)" +lemma "(P \ Q) \ R \ P \ (Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -text \distributive laws of @{text "&"} and @{text "|"}\ -lemma "(P & Q) | R --> (P | R) & (Q | R)" +text \distributive laws of @{text "\"} and @{text "\"}\ +lemma "(P \ Q) \ R \ (P \ R) \ (Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P | R) & (Q | R) --> (P & Q) | R" +lemma "(P \ R) \ (Q \ R) \ (P \ Q) \ R" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P | Q) & R --> (P & R) | (Q & R)" +lemma "(P \ Q) \ R \ (P \ R) \ (Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P & R) | (Q & R) --> (P | Q) & R" +lemma "(P \ R) \ (Q \ R) \ (P \ Q) \ R" by (tactic "IntPr.fast_tac @{context} 1") text \Laws involving implication\ -lemma "(P-->R) & (Q-->R) <-> (P|Q --> R)" +lemma "(P \ R) \ (Q \ R) \ (P \ Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P & Q --> R) <-> (P--> (Q-->R))" +lemma "(P \ Q \ R) \ (P \ (Q \ R))" by (tactic "IntPr.fast_tac @{context} 1") -lemma "((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R" +lemma "((P \ R) \ R) \ ((Q \ R) \ R) \ (P \ Q \ R) \ R" by (tactic "IntPr.fast_tac @{context} 1") -lemma "~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)" +lemma "\ (P \ R) \ \ (Q \ R) \ \ (P \ Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P --> Q & R) <-> (P-->Q) & (P-->R)" +lemma "(P \ Q \ R) \ (P \ Q) \ (P \ R)" by (tactic "IntPr.fast_tac @{context} 1") text \Propositions-as-types\ -- \The combinator K\ -lemma "P --> (Q --> P)" +lemma "P \ (Q \ P)" by (tactic "IntPr.fast_tac @{context} 1") -- \The combinator S\ -lemma "(P-->Q-->R) --> (P-->Q) --> (P-->R)" +lemma "(P \ Q \ R) \ (P \ Q) \ (P \ R)" by (tactic "IntPr.fast_tac @{context} 1") -- \Converse is classical\ -lemma "(P-->Q) | (P-->R) --> (P --> Q | R)" +lemma "(P \ Q) \ (P \ R) \ (P \ Q \ R)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(P-->Q) --> (~Q --> ~P)" +lemma "(P \ Q) \ (\ Q \ \ P)" by (tactic "IntPr.fast_tac @{context} 1") text \Schwichtenberg's examples (via T. Nipkow)\ -lemma stab_imp: "(((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q" +lemma stab_imp: "(((Q \ R) \ R) \ Q) \ (((P \ Q) \ R) \ R) \ P \ Q" by (tactic "IntPr.fast_tac @{context} 1") lemma stab_to_peirce: - "(((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) - --> ((P --> Q) --> P) --> P" + "(((P \ R) \ R) \ P) \ (((Q \ R) \ R) \ Q) + \ ((P \ Q) \ P) \ P" by (tactic "IntPr.fast_tac @{context} 1") -lemma peirce_imp1: "(((Q --> R) --> Q) --> Q) - --> (((P --> Q) --> R) --> P --> Q) --> P --> Q" - by (tactic "IntPr.fast_tac @{context} 1") - -lemma peirce_imp2: "(((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P" +lemma peirce_imp1: + "(((Q \ R) \ Q) \ Q) + \ (((P \ Q) \ R) \ P \ Q) \ P \ Q" by (tactic "IntPr.fast_tac @{context} 1") -lemma mints: "((((P --> Q) --> P) --> P) --> Q) --> Q" +lemma peirce_imp2: "(((P \ R) \ P) \ P) \ ((P \ Q \ R) \ P) \ P" + by (tactic "IntPr.fast_tac @{context} 1") + +lemma mints: "((((P \ Q) \ P) \ P) \ Q) \ Q" by (tactic "IntPr.fast_tac @{context} 1") -lemma mints_solovev: "(P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R" +lemma mints_solovev: "(P \ (Q \ R) \ Q) \ ((P \ Q) \ R) \ R" by (tactic "IntPr.fast_tac @{context} 1") -lemma tatsuta: "(((P7 --> P1) --> P10) --> P4 --> P5) - --> (((P8 --> P2) --> P9) --> P3 --> P10) - --> (P1 --> P8) --> P6 --> P7 - --> (((P3 --> P2) --> P9) --> P4) - --> (P1 --> P3) --> (((P6 --> P1) --> P2) --> P9) --> P5" +lemma tatsuta: + "(((P7 \ P1) \ P10) \ P4 \ P5) + \ (((P8 \ P2) \ P9) \ P3 \ P10) + \ (P1 \ P8) \ P6 \ P7 + \ (((P3 \ P2) \ P9) \ P4) + \ (P1 \ P3) \ (((P6 \ P1) \ P2) \ P9) \ P5" by (tactic "IntPr.fast_tac @{context} 1") -lemma tatsuta1: "(((P8 --> P2) --> P9) --> P3 --> P10) - --> (((P3 --> P2) --> P9) --> P4) - --> (((P6 --> P1) --> P2) --> P9) - --> (((P7 --> P1) --> P10) --> P4 --> P5) - --> (P1 --> P3) --> (P1 --> P8) --> P6 --> P7 --> P5" +lemma tatsuta1: + "(((P8 \ P2) \ P9) \ P3 \ P10) + \ (((P3 \ P2) \ P9) \ P4) + \ (((P6 \ P1) \ P2) \ P9) + \ (((P7 \ P1) \ P10) \ P4 \ P5) + \ (P1 \ P3) \ (P1 \ P8) \ P6 \ P7 \ P5" by (tactic "IntPr.fast_tac @{context} 1") end diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Quantifiers_Cla.thy --- a/src/FOL/ex/Quantifiers_Cla.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Quantifiers_Cla.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,92 +9,92 @@ imports FOL begin -lemma "(ALL x y. P(x,y)) --> (ALL y x. P(x,y))" +lemma "(\x y. P(x,y)) \ (\y x. P(x,y))" by fast -lemma "(EX x y. P(x,y)) --> (EX y x. P(x,y))" +lemma "(\x y. P(x,y)) \ (\y x. P(x,y))" by fast --- \Converse is false\ -lemma "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))" +text \Converse is false.\ +lemma "(\x. P(x)) \ (\x. Q(x)) \ (\x. P(x) \ Q(x))" by fast -lemma "(ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))" +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" by fast -lemma "(ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)" +lemma "(\x. P(x) \ Q) \ ((\x. P(x)) \ Q)" by fast -text \Some harder ones\ +text \Some harder ones.\ -lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by fast --- \Converse is false\ -lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x)) & (EX x. Q(x))" +-- \Converse is false.\ +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by fast -text \Basic test of quantifier reasoning\ +text \Basic test of quantifier reasoning.\ -- \TRUE\ -lemma "(EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" +lemma "(\y. \x. Q(x,y)) \ (\x. \y. Q(x,y))" by fast -lemma "(ALL x. Q(x)) --> (EX x. Q(x))" +lemma "(\x. Q(x)) \ (\x. Q(x))" by fast text \The following should fail, as they are false!\ -lemma "(ALL x. EX y. Q(x,y)) --> (EX y. ALL x. Q(x,y))" +lemma "(\x. \y. Q(x,y)) \ (\y. \x. Q(x,y))" apply fast? oops -lemma "(EX x. Q(x)) --> (ALL x. Q(x))" +lemma "(\x. Q(x)) \ (\x. Q(x))" apply fast? oops -schematic_goal "P(?a) --> (ALL x. P(x))" +schematic_goal "P(?a) \ (\x. P(x))" apply fast? oops -schematic_goal "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))" +schematic_goal "(P(?a) \ (\x. Q(x))) \ (\x. P(x) \ Q(x))" apply fast? oops text \Back to things that are provable \dots\ -lemma "(ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))" +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by fast --- \An example of why exI should be delayed as long as possible\ -lemma "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))" +text \An example of why @{text exI} should be delayed as long as possible.\ +lemma "(P \ (\x. Q(x))) \ P \ (\x. Q(x))" by fast -schematic_goal "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)" +schematic_goal "(\x. P(x) \ Q(f(x))) \ (\x. Q(x) \ R(g(x))) \ P(d) \ R(?a)" by fast -lemma "(ALL x. Q(x)) --> (EX x. Q(x))" +lemma "(\x. Q(x)) \ (\x. Q(x))" by fast text \Some slow ones\ --- \Principia Mathematica *11.53\ -lemma "(ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))" +text \Principia Mathematica *11.53\ +lemma "(\x y. P(x) \ Q(y)) \ ((\x. P(x)) \ (\y. Q(y)))" by fast (*Principia Mathematica *11.55 *) -lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))" +lemma "(\x y. P(x) \ Q(x,y)) \ (\x. P(x) \ (\y. Q(x,y)))" by fast (*Principia Mathematica *11.61 *) -lemma "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))" +lemma "(\y. \x. P(x) \ Q(x,y)) \ (\x. P(x) \ (\y. Q(x,y)))" by fast end diff -r d40cbf1f37c9 -r b8d375aee0df src/FOL/ex/Quantifiers_Int.thy --- a/src/FOL/ex/Quantifiers_Int.thy Mon Oct 19 20:31:13 2015 +0200 +++ b/src/FOL/ex/Quantifiers_Int.thy Mon Oct 19 23:00:07 2015 +0200 @@ -9,92 +9,92 @@ imports IFOL begin -lemma "(ALL x y. P(x,y)) --> (ALL y x. P(x,y))" +lemma "(\x y. P(x,y)) \ (\y x. P(x,y))" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(EX x y. P(x,y)) --> (EX y x. P(x,y))" +lemma "(\x y. P(x,y)) \ (\y x. P(x,y))" by (tactic "IntPr.fast_tac @{context} 1") -- \Converse is false\ -lemma "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))" +lemma "(\x. P(x)) \ (\x. Q(x)) \ (\x. P(x) \ Q(x))" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))" +lemma "(\x. P \ Q(x)) \ (P \ (\x. Q(x)))" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)" +lemma "(\x. P(x) \ Q) \ ((\x. P(x)) \ Q)" by (tactic "IntPr.fast_tac @{context} 1") text \Some harder ones\ -lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by (tactic "IntPr.fast_tac @{context} 1") -- \Converse is false\ -lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x)) & (EX x. Q(x))" +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by (tactic "IntPr.fast_tac @{context} 1") text \Basic test of quantifier reasoning\ -- \TRUE\ -lemma "(EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" +lemma "(\y. \x. Q(x,y)) \ (\x. \y. Q(x,y))" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(ALL x. Q(x)) --> (EX x. Q(x))" +lemma "(\x. Q(x)) \ (\x. Q(x))" by (tactic "IntPr.fast_tac @{context} 1") text \The following should fail, as they are false!\ -lemma "(ALL x. EX y. Q(x,y)) --> (EX y. ALL x. Q(x,y))" +lemma "(\x. \y. Q(x,y)) \ (\y. \x. Q(x,y))" apply (tactic "IntPr.fast_tac @{context} 1")? oops -lemma "(EX x. Q(x)) --> (ALL x. Q(x))" +lemma "(\x. Q(x)) \ (\x. Q(x))" apply (tactic "IntPr.fast_tac @{context} 1")? oops -schematic_goal "P(?a) --> (ALL x. P(x))" +schematic_goal "P(?a) \ (\x. P(x))" apply (tactic "IntPr.fast_tac @{context} 1")? oops -schematic_goal "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))" +schematic_goal "(P(?a) \ (\x. Q(x))) \ (\x. P(x) \ Q(x))" apply (tactic "IntPr.fast_tac @{context} 1")? oops text \Back to things that are provable \dots\ -lemma "(ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))" +lemma "(\x. P(x) \ Q(x)) \ (\x. P(x)) \ (\x. Q(x))" by (tactic "IntPr.fast_tac @{context} 1") -- \An example of why exI should be delayed as long as possible\ -lemma "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))" +lemma "(P \ (\x. Q(x))) \ P \ (\x. Q(x))" by (tactic "IntPr.fast_tac @{context} 1") -schematic_goal "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)" +schematic_goal "(\x. P(x) \ Q(f(x))) \ (\x. Q(x) \ R(g(x))) \ P(d) \ R(?a)" by (tactic "IntPr.fast_tac @{context} 1") -lemma "(ALL x. Q(x)) --> (EX x. Q(x))" +lemma "(\x. Q(x)) \ (\x. Q(x))" by (tactic "IntPr.fast_tac @{context} 1") text \Some slow ones\ -- \Principia Mathematica *11.53\ -lemma "(ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))" +lemma "(\x y. P(x) \ Q(y)) \ ((\x. P(x)) \ (\y. Q(y)))" by (tactic "IntPr.fast_tac @{context} 1") (*Principia Mathematica *11.55 *) -lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))" +lemma "(\x y. P(x) \ Q(x,y)) \ (\x. P(x) \ (\y. Q(x,y)))" by (tactic "IntPr.fast_tac @{context} 1") (*Principia Mathematica *11.61 *) -lemma "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))" +lemma "(\y. \x. P(x) \ Q(x,y)) \ (\x. P(x) \ (\y. Q(x,y)))" by (tactic "IntPr.fast_tac @{context} 1") end