# HG changeset patch # User wenzelm # Date 1185134490 -7200 # Node ID 3e0424305fa41277da467f06e1bf19f27de56deb # Parent fcfacb6670ed9c7a645834711aeda823cc953fbd turned ex/prop.ML, ex/quant.ML into proper theories; diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/IsaMakefile --- a/src/FOL/IsaMakefile Sun Jul 22 21:20:58 2007 +0200 +++ b/src/FOL/IsaMakefile Sun Jul 22 22:01:30 2007 +0200 @@ -50,7 +50,9 @@ ex/If.thy ex/IffOracle.thy ex/LocaleTest.thy \ ex/Nat.thy ex/Natural_Numbers.thy ex/Miniscope.thy \ ex/Prolog.thy ex/ROOT.ML ex/Classical.thy ex/document/root.tex \ - ex/Foundation.thy ex/Intuitionistic.thy ex/Intro.thy ex/prop.ML ex/quant.ML + ex/Foundation.thy ex/Intuitionistic.thy ex/Intro.thy \ + ex/Propositional_Int.thy ex/Propositional_Cla.thy \ + ex/Quantifiers_Int.thy ex/Quantifiers_Cla.thy @$(ISATOOL) usedir $(OUT)/FOL ex diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/Propositional_Cla.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOL/ex/Propositional_Cla.thy Sun Jul 22 22:01:30 2007 +0200 @@ -0,0 +1,118 @@ +(* Title: FOL/ex/Propositional_Cla.thy + ID: $Id$ + Author: Lawrence C Paulson, Cambridge University Computer Laboratory + Copyright 1991 University of Cambridge +*) + +header {* First-Order Logic: propositional examples (classical version) *} + +theory Propositional_Cla +imports FOL +begin + +text {* commutative laws of @{text "&"} and @{text "|"} *} + +lemma "P & Q --> Q & P" + by (tactic "IntPr.fast_tac 1") + +lemma "P | Q --> Q | P" + by fast + + +text {* associative laws of @{text "&"} and @{text "|"} *} +lemma "(P & Q) & R --> P & (Q & R)" + by fast + +lemma "(P | Q) | R --> P | (Q | R)" + by fast + + +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" + by fast + +lemma "(P | Q) & R --> (P & R) | (Q & R)" + by fast + +lemma "(P & R) | (Q & R) --> (P | Q) & R" + by fast + + +text {* Laws involving implication *} + +lemma "(P-->R) & (Q-->R) <-> (P|Q --> R)" + by fast + +lemma "(P & Q --> R) <-> (P--> (Q-->R))" + by fast + +lemma "((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R" + by fast + +lemma "~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)" + by fast + +lemma "(P --> Q & R) <-> (P-->Q) & (P-->R)" + by fast + + +text {* Propositions-as-types *} + +-- {* The combinator K *} +lemma "P --> (Q --> P)" + by fast + +-- {* The combinator S *} +lemma "(P-->Q-->R) --> (P-->Q) --> (P-->R)" + by fast + + +-- {* Converse is classical *} +lemma "(P-->Q) | (P-->R) --> (P --> Q | R)" + by fast + +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" + by fast + +lemma stab_to_peirce: + "(((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" + by fast + +lemma mints: "((((P --> Q) --> P) --> P) --> Q) --> Q" + by fast + +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" + 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" + by fast + +end diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/Propositional_Int.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOL/ex/Propositional_Int.thy Sun Jul 22 22:01:30 2007 +0200 @@ -0,0 +1,118 @@ +(* Title: FOL/ex/Propositional_Int.thy + ID: $Id$ + Author: Lawrence C Paulson, Cambridge University Computer Laboratory + Copyright 1991 University of Cambridge +*) + +header {* First-Order Logic: propositional examples (intuitionistic version) *} + +theory Propositional_Int +imports IFOL +begin + +text {* commutative laws of @{text "&"} and @{text "|"} *} + +lemma "P & Q --> Q & P" + by (tactic "IntPr.fast_tac 1") + +lemma "P | Q --> Q | P" + by (tactic "IntPr.fast_tac 1") + + +text {* associative laws of @{text "&"} and @{text "|"} *} +lemma "(P & Q) & R --> P & (Q & R)" + by (tactic "IntPr.fast_tac 1") + +lemma "(P | Q) | R --> P | (Q | R)" + by (tactic "IntPr.fast_tac 1") + + +text {* distributive laws of @{text "&"} and @{text "|"} *} +lemma "(P & Q) | R --> (P | R) & (Q | R)" + by (tactic "IntPr.fast_tac 1") + +lemma "(P | R) & (Q | R) --> (P & Q) | R" + by (tactic "IntPr.fast_tac 1") + +lemma "(P | Q) & R --> (P & R) | (Q & R)" + by (tactic "IntPr.fast_tac 1") + +lemma "(P & R) | (Q & R) --> (P | Q) & R" + by (tactic "IntPr.fast_tac 1") + + +text {* Laws involving implication *} + +lemma "(P-->R) & (Q-->R) <-> (P|Q --> R)" + by (tactic "IntPr.fast_tac 1") + +lemma "(P & Q --> R) <-> (P--> (Q-->R))" + by (tactic "IntPr.fast_tac 1") + +lemma "((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R" + by (tactic "IntPr.fast_tac 1") + +lemma "~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)" + by (tactic "IntPr.fast_tac 1") + +lemma "(P --> Q & R) <-> (P-->Q) & (P-->R)" + by (tactic "IntPr.fast_tac 1") + + +text {* Propositions-as-types *} + +-- {* The combinator K *} +lemma "P --> (Q --> P)" + by (tactic "IntPr.fast_tac 1") + +-- {* The combinator S *} +lemma "(P-->Q-->R) --> (P-->Q) --> (P-->R)" + by (tactic "IntPr.fast_tac 1") + + +-- {* Converse is classical *} +lemma "(P-->Q) | (P-->R) --> (P --> Q | R)" + by (tactic "IntPr.fast_tac 1") + +lemma "(P-->Q) --> (~Q --> ~P)" + by (tactic "IntPr.fast_tac 1") + + +text {* Schwichtenberg's examples (via T. Nipkow) *} + +lemma stab_imp: "(((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q" + by (tactic "IntPr.fast_tac 1") + +lemma stab_to_peirce: + "(((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) + --> ((P --> Q) --> P) --> P" + by (tactic "IntPr.fast_tac 1") + +lemma peirce_imp1: "(((Q --> R) --> Q) --> Q) + --> (((P --> Q) --> R) --> P --> Q) --> P --> Q" + by (tactic "IntPr.fast_tac 1") + +lemma peirce_imp2: "(((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P" + by (tactic "IntPr.fast_tac 1") + +lemma mints: "((((P --> Q) --> P) --> P) --> Q) --> Q" + by (tactic "IntPr.fast_tac 1") + +lemma mints_solovev: "(P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R" + by (tactic "IntPr.fast_tac 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" + by (tactic "IntPr.fast_tac 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" + by (tactic "IntPr.fast_tac 1") + +end diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/Quantifiers_Cla.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOL/ex/Quantifiers_Cla.thy Sun Jul 22 22:01:30 2007 +0200 @@ -0,0 +1,101 @@ +(* Title: FOL/ex/Quantifiers_Int.thy + ID: $Id$ + Author: Lawrence C Paulson, Cambridge University Computer Laboratory + Copyright 1991 University of Cambridge +*) + +header {* First-Order Logic: quantifier examples (classical version) *} + +theory Quantifiers_Cla +imports FOL +begin + +lemma "(ALL x y. P(x,y)) --> (ALL y x. P(x,y))" + by fast + +lemma "(EX x y. P(x,y)) --> (EX 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))" + by fast + +lemma "(ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))" + by fast + + +lemma "(ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)" + by fast + + +text {* Some harder ones *} + +lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" + by fast + +-- {* Converse is false *} +lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x)) & (EX x. Q(x))" + by fast + + +text {* Basic test of quantifier reasoning *} + +-- {* TRUE *} +lemma "(EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" + by fast + +lemma "(ALL x. Q(x)) --> (EX 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))" + apply fast? + oops + +lemma "(EX x. Q(x)) --> (ALL x. Q(x))" + apply fast? + oops + +lemma "P(?a) --> (ALL x. P(x))" + apply fast? + oops + +lemma "(P(?a) --> (ALL x. Q(x))) --> (ALL 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))" + 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))" + by fast + +lemma "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)" + by fast + +lemma "(ALL x. Q(x)) --> (EX 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)))" + by fast + +(*Principia Mathematica *11.55 *) +lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX 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)))" + by fast + +end diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/Quantifiers_Int.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOL/ex/Quantifiers_Int.thy Sun Jul 22 22:01:30 2007 +0200 @@ -0,0 +1,101 @@ +(* Title: FOL/ex/Quantifiers_Int.thy + ID: $Id$ + Author: Lawrence C Paulson, Cambridge University Computer Laboratory + Copyright 1991 University of Cambridge +*) + +header {* First-Order Logic: quantifier examples (intuitionistic version) *} + +theory Quantifiers_Int +imports IFOL +begin + +lemma "(ALL x y. P(x,y)) --> (ALL y x. P(x,y))" + by (tactic "IntPr.fast_tac 1") + +lemma "(EX x y. P(x,y)) --> (EX y x. P(x,y))" + by (tactic "IntPr.fast_tac 1") + + +-- {* Converse is false *} +lemma "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))" + by (tactic "IntPr.fast_tac 1") + +lemma "(ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))" + by (tactic "IntPr.fast_tac 1") + + +lemma "(ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)" + by (tactic "IntPr.fast_tac 1") + + +text {* Some harder ones *} + +lemma "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" + by (tactic "IntPr.fast_tac 1") + +-- {* Converse is false *} +lemma "(EX x. P(x)&Q(x)) --> (EX x. P(x)) & (EX x. Q(x))" + by (tactic "IntPr.fast_tac 1") + + +text {* Basic test of quantifier reasoning *} + +-- {* TRUE *} +lemma "(EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" + by (tactic "IntPr.fast_tac 1") + +lemma "(ALL x. Q(x)) --> (EX x. Q(x))" + by (tactic "IntPr.fast_tac 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))" + apply (tactic "IntPr.fast_tac 1")? + oops + +lemma "(EX x. Q(x)) --> (ALL x. Q(x))" + apply (tactic "IntPr.fast_tac 1")? + oops + +lemma "P(?a) --> (ALL x. P(x))" + apply (tactic "IntPr.fast_tac 1")? + oops + +lemma "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))" + apply (tactic "IntPr.fast_tac 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))" + by (tactic "IntPr.fast_tac 1") + +-- {* An example of why exI should be delayed as long as possible *} +lemma "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))" + by (tactic "IntPr.fast_tac 1") + +lemma "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)" + by (tactic "IntPr.fast_tac 1") + +lemma "(ALL x. Q(x)) --> (EX x. Q(x))" + by (tactic "IntPr.fast_tac 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)))" + by (tactic "IntPr.fast_tac 1") + +(*Principia Mathematica *11.55 *) +lemma "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))" + by (tactic "IntPr.fast_tac 1") + +(*Principia Mathematica *11.61 *) +lemma "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))" + by (tactic "IntPr.fast_tac 1") + +end diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/ROOT.ML --- a/src/FOL/ex/ROOT.ML Sun Jul 22 21:20:58 2007 +0200 +++ b/src/FOL/ex/ROOT.ML Sun Jul 22 22:01:30 2007 +0200 @@ -6,31 +6,27 @@ Examples for First-Order Logic. *) -time_use_thy "First_Order_Logic"; -time_use_thy "Natural_Numbers"; -time_use_thy "Intro"; -time_use_thy "Nat"; -time_use_thy "Foundation"; -time_use_thy "Prolog"; - -time_use_thy "Intuitionistic"; - -val thy = theory "IFOL" and tac = IntPr.fast_tac 1; -time_use "prop.ML"; -time_use "quant.ML"; +use_thys [ + "First_Order_Logic", + "Natural_Numbers", + "Intro", + "Nat", + "Foundation", + "Prolog", -writeln"\n** Classical examples **\n"; -time_use_thy "Miniscope"; -time_use_thy "Classical"; -time_use_thy "If"; + "Intuitionistic", + "Propositional_Int", + "Quantifiers_Int", -val thy = theory "FOL" and tac = Cla.fast_tac FOL_cs 1; -time_use "prop.ML"; -time_use "quant.ML"; + "Classical", + "Propositional_Cla", + "Quantifiers_Cla", + "Miniscope", + "If", -time_use_thy "NatClass"; - -time_use_thy "IffOracle"; + "NatClass", + "IffOracle" +]; (*regression test for locales -- sets several global flags!*) -time_use_thy "LocaleTest"; +no_document use_thy "LocaleTest"; diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/prop.ML --- a/src/FOL/ex/prop.ML Sun Jul 22 21:20:58 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -(* Title: FOL/ex/prop - ID: $Id$ - Author: Lawrence C Paulson, Cambridge University Computer Laboratory - Copyright 1991 University of Cambridge - -First-Order Logic: propositional examples (intuitionistic and classical) -Needs declarations of the theory "thy" and the tactic "tac" -*) - -writeln"File FOL/ex/prop."; - - -writeln"commutative laws of & and | "; -Goal "P & Q --> Q & P"; -by tac; -result(); - -Goal "P | Q --> Q | P"; -by tac; -result(); - - -writeln"associative laws of & and | "; -Goal "(P & Q) & R --> P & (Q & R)"; -by tac; -result(); - -Goal "(P | Q) | R --> P | (Q | R)"; -by tac; -result(); - - - -writeln"distributive laws of & and | "; -Goal "(P & Q) | R --> (P | R) & (Q | R)"; -by tac; -result(); - -Goal "(P | R) & (Q | R) --> (P & Q) | R"; -by tac; -result(); - -Goal "(P | Q) & R --> (P & R) | (Q & R)"; -by tac; -result(); - - -Goal "(P & R) | (Q & R) --> (P | Q) & R"; -by tac; -result(); - - -writeln"Laws involving implication"; - -Goal "(P-->R) & (Q-->R) <-> (P|Q --> R)"; -by tac; -result(); - - -Goal "(P & Q --> R) <-> (P--> (Q-->R))"; -by tac; -result(); - - -Goal "((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R"; -by tac; -result(); - -Goal "~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)"; -by tac; -result(); - -Goal "(P --> Q & R) <-> (P-->Q) & (P-->R)"; -by tac; -result(); - - -writeln"Propositions-as-types"; - -(*The combinator K*) -Goal "P --> (Q --> P)"; -by tac; -result(); - -(*The combinator S*) -Goal "(P-->Q-->R) --> (P-->Q) --> (P-->R)"; -by tac; -result(); - - -(*Converse is classical*) -Goal "(P-->Q) | (P-->R) --> (P --> Q | R)"; -by tac; -result(); - -Goal "(P-->Q) --> (~Q --> ~P)"; -by tac; -result(); - - -writeln"Schwichtenberg's examples (via T. Nipkow)"; - -(* stab-imp *) -Goal "(((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q"; -by tac; -result(); - -(* stab-to-peirce *) -Goal "(((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) \ -\ --> ((P --> Q) --> P) --> P"; -by tac; -result(); - -(* peirce-imp1 *) -Goal "(((Q --> R) --> Q) --> Q) \ -\ --> (((P --> Q) --> R) --> P --> Q) --> P --> Q"; -by tac; -result(); - -(* peirce-imp2 *) -Goal "(((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P"; -by tac; -result(); - -(* mints *) -Goal "((((P --> Q) --> P) --> P) --> Q) --> Q"; -by tac; -result(); - -(* mints-solovev *) -Goal "(P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R"; -by tac; -result(); - -(* tatsuta *) -Goal "(((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 tac; -result(); - -(* tatsuta1 *) -Goal "(((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 tac; -result(); - -writeln"Reached end of file."; diff -r fcfacb6670ed -r 3e0424305fa4 src/FOL/ex/quant.ML --- a/src/FOL/ex/quant.ML Sun Jul 22 21:20:58 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -(* Title: FOL/ex/quant - ID: $Id$ - Author: Lawrence C Paulson, Cambridge University Computer Laboratory - Copyright 1991 University of Cambridge - -First-Order Logic: quantifier examples (intuitionistic and classical) -Needs declarations of the theory "thy" and the tactic "tac" -*) - -writeln"File FOL/ex/quant."; - -Goal "(ALL x y. P(x,y)) --> (ALL y x. P(x,y))"; -by tac; -result(); - - -Goal "(EX x y. P(x,y)) --> (EX y x. P(x,y))"; -by tac; -result(); - - -(*Converse is false*) -Goal "(ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))"; -by tac; -result(); - -Goal "(ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))"; -by tac; -result(); - - -Goal "(ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)"; -by tac; -result(); - - -writeln"Some harder ones"; - -Goal "(EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))"; -by tac; -result(); -(*6 secs*) - -(*Converse is false*) -Goal "(EX x. P(x)&Q(x)) --> (EX x. P(x)) & (EX x. Q(x))"; -by tac; -result(); - - -writeln"Basic test of quantifier reasoning"; -(*TRUE*) -Goal "(EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))"; -by tac; -result(); - - -Goal "(ALL x. Q(x)) --> (EX x. Q(x))"; -by tac; -result(); - - -writeln"The following should fail, as they are false!"; - -Goal "(ALL x. EX y. Q(x,y)) --> (EX y. ALL x. Q(x,y))"; -by tac handle ERROR _ => writeln"Failed, as expected"; -(*Check that subgoals remain: proof failed.*) -getgoal 1; - -Goal "(EX x. Q(x)) --> (ALL x. Q(x))"; -by tac handle ERROR _ => writeln"Failed, as expected"; -getgoal 1; - -Goal "P(?a) --> (ALL x. P(x))"; -by tac handle ERROR _ => writeln"Failed, as expected"; -(*Check that subgoals remain: proof failed.*) -getgoal 1; - -Goal - "(P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))"; -by tac handle ERROR _ => writeln"Failed, as expected"; -getgoal 1; - - -writeln"Back to things that are provable..."; - -Goal "(ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))"; -by tac; -result(); - - -(*An example of why exI should be delayed as long as possible*) -Goal "(P --> (EX x. Q(x))) & P --> (EX x. Q(x))"; -by tac; -result(); - -Goal "(ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)"; -by tac; -(*Verify that no subgoals remain.*) -uresult(); - - -Goal "(ALL x. Q(x)) --> (EX x. Q(x))"; -by tac; -result(); - - -writeln"Some slow ones"; - - -(*Principia Mathematica *11.53 *) -Goal "(ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))"; -by tac; -result(); -(*6 secs*) - -(*Principia Mathematica *11.55 *) -Goal "(EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))"; -by tac; -result(); -(*9 secs*) - -(*Principia Mathematica *11.61 *) -Goal "(EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"; -by tac; -result(); -(*3 secs*) - -writeln"Reached end of file."; -