# HG changeset patch # User wenzelm # Date 1206567535 -3600 # Node ID 6964c4799f470b25e60d53fd32d3f5cebc9cb5e4 # Parent 562a1d6153364392549ba1423d4aad40bfc6bc2b converted legacy ML scripts; diff -r 562a1d615336 -r 6964c4799f47 src/FOLP/IsaMakefile --- a/src/FOLP/IsaMakefile Wed Mar 26 22:38:17 2008 +0100 +++ b/src/FOLP/IsaMakefile Wed Mar 26 22:38:55 2008 +0100 @@ -26,8 +26,8 @@ Pure: @cd $(SRC)/Pure; $(ISATOOL) make Pure -$(OUT)/FOLP: $(OUT)/Pure FOLP.thy IFOLP.thy ROOT.ML \ - classical.ML hypsubst.ML intprover.ML simp.ML simpdata.ML +$(OUT)/FOLP: $(OUT)/Pure FOLP.thy IFOLP.thy ROOT.ML classical.ML \ + hypsubst.ML intprover.ML simp.ML simpdata.ML @$(ISATOOL) usedir -b $(OUT)/Pure FOLP @@ -35,10 +35,11 @@ FOLP-ex: FOLP $(LOG)/FOLP-ex.gz -$(LOG)/FOLP-ex.gz: $(OUT)/FOLP ex/ROOT.ML ex/Foundation.thy \ - ex/If.thy ex/Intro.thy ex/Nat.thy ex/Intuitionistic.thy \ - ex/Classical.thy \ - ex/Prolog.ML ex/Prolog.thy ex/prop.ML ex/quant.ML +$(LOG)/FOLP-ex.gz: $(OUT)/FOLP ex/ROOT.ML ex/Foundation.thy ex/If.thy \ + ex/Intro.thy ex/Nat.thy ex/Intuitionistic.thy ex/Classical.thy \ + ex/Prolog.ML ex/Prolog.thy ex/Propositional_Int.thy \ + ex/Propositional_Cla.thy ex/Quantifiers_Int.thy \ + ex/Quantifiers_Cla.thy @$(ISATOOL) usedir $(OUT)/FOLP ex diff -r 562a1d615336 -r 6964c4799f47 src/FOLP/ex/Propositional_Cla.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOLP/ex/Propositional_Cla.thy Wed Mar 26 22:38:55 2008 +0100 @@ -0,0 +1,118 @@ +(* Title: FOLP/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 *} + +theory Propositional_Cla +imports FOLP +begin + + +text "commutative laws of & and | " +lemma "?p : P & Q --> Q & P" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : P | Q --> Q | P" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "associative laws of & and | " +lemma "?p : (P & Q) & R --> P & (Q & R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (P | Q) | R --> P | (Q | R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "distributive laws of & and | " +lemma "?p : (P & Q) | R --> (P | R) & (Q | R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (P | R) & (Q | R) --> (P & Q) | R" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (P | Q) & R --> (P & R) | (Q & R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +lemma "?p : (P & R) | (Q & R) --> (P | Q) & R" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "Laws involving implication" + +lemma "?p : (P-->R) & (Q-->R) <-> (P|Q --> R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (P & Q --> R) <-> (P--> (Q-->R))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : ((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : ~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (P --> Q & R) <-> (P-->Q) & (P-->R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "Propositions-as-types" + +(*The combinator K*) +lemma "?p : P --> (Q --> P)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +(*The combinator S*) +lemma "?p : (P-->Q-->R) --> (P-->Q) --> (P-->R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +(*Converse is classical*) +lemma "?p : (P-->Q) | (P-->R) --> (P --> Q | R)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (P-->Q) --> (~Q --> ~P)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "Schwichtenberg's examples (via T. Nipkow)" + +lemma stab_imp: "?p : (((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma stab_to_peirce: "?p : (((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) + --> ((P --> Q) --> P) --> P" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma peirce_imp1: "?p : (((Q --> R) --> Q) --> Q) + --> (((P --> Q) --> R) --> P --> Q) --> P --> Q" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma peirce_imp2: "?p : (((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma mints: "?p : ((((P --> Q) --> P) --> P) --> Q) --> Q" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma mints_solovev: "?p : (P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma tatsuta: "?p : (((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 {* Cla.fast_tac FOLP_cs 1 *}) + +lemma tatsuta1: "?p : (((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 {* Cla.fast_tac FOLP_cs 1 *}) + +end diff -r 562a1d615336 -r 6964c4799f47 src/FOLP/ex/Propositional_Int.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOLP/ex/Propositional_Int.thy Wed Mar 26 22:38:55 2008 +0100 @@ -0,0 +1,118 @@ +(* Title: FOLP/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 *} + +theory Propositional_Int +imports IFOLP +begin + + +text "commutative laws of & and | " +lemma "?p : P & Q --> Q & P" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : P | Q --> Q | P" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "associative laws of & and | " +lemma "?p : (P & Q) & R --> P & (Q & R)" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (P | Q) | R --> P | (Q | R)" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "distributive laws of & and | " +lemma "?p : (P & Q) | R --> (P | R) & (Q | R)" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (P | R) & (Q | R) --> (P & Q) | R" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (P | Q) & R --> (P & R) | (Q & R)" + by (tactic {* IntPr.fast_tac 1 *}) + + +lemma "?p : (P & R) | (Q & R) --> (P | Q) & R" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "Laws involving implication" + +lemma "?p : (P-->R) & (Q-->R) <-> (P|Q --> R)" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (P & Q --> R) <-> (P--> (Q-->R))" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : ((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : ~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (P --> Q & R) <-> (P-->Q) & (P-->R)" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "Propositions-as-types" + +(*The combinator K*) +lemma "?p : P --> (Q --> P)" + by (tactic {* IntPr.fast_tac 1 *}) + +(*The combinator S*) +lemma "?p : (P-->Q-->R) --> (P-->Q) --> (P-->R)" + by (tactic {* IntPr.fast_tac 1 *}) + + +(*Converse is classical*) +lemma "?p : (P-->Q) | (P-->R) --> (P --> Q | R)" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (P-->Q) --> (~Q --> ~P)" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "Schwichtenberg's examples (via T. Nipkow)" + +lemma stab_imp: "?p : (((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma stab_to_peirce: "?p : (((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) + --> ((P --> Q) --> P) --> P" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma peirce_imp1: "?p : (((Q --> R) --> Q) --> Q) + --> (((P --> Q) --> R) --> P --> Q) --> P --> Q" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma peirce_imp2: "?p : (((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma mints: "?p : ((((P --> Q) --> P) --> P) --> Q) --> Q" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma mints_solovev: "?p : (P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma tatsuta: "?p : (((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: "?p : (((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 562a1d615336 -r 6964c4799f47 src/FOLP/ex/Quantifiers_Cla.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOLP/ex/Quantifiers_Cla.thy Wed Mar 26 22:38:55 2008 +0100 @@ -0,0 +1,102 @@ +(* Title: FOLP/ex/Quantifiers_Cla.thy + 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" +*) + +theory Quantifiers_Cla +imports FOLP +begin + +lemma "?p : (ALL x y. P(x,y)) --> (ALL y x. P(x,y))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (EX x y. P(x,y)) --> (EX y x. P(x,y))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +(*Converse is false*) +lemma "?p : (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +lemma "?p : (ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "Some harder ones" + +lemma "?p : (EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +(*Converse is false*) +lemma "?p : (EX x. P(x)&Q(x)) --> (EX x. P(x)) & (EX x. Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "Basic test of quantifier reasoning" +(*TRUE*) +lemma "?p : (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (ALL x. Q(x)) --> (EX x. Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "The following should fail, as they are false!" + +lemma "?p : (ALL x. EX y. Q(x,y)) --> (EX y. ALL x. Q(x,y))" + apply (tactic {* Cla.fast_tac FOLP_cs 1 *})? + oops + +lemma "?p : (EX x. Q(x)) --> (ALL x. Q(x))" + apply (tactic {* Cla.fast_tac FOLP_cs 1 *})? + oops + +lemma "?p : P(?a) --> (ALL x. P(x))" + apply (tactic {* Cla.fast_tac FOLP_cs 1 *})? + oops + +lemma "?p : (P(?a) --> (ALL x. Q(x))) --> (ALL x. P(x) --> Q(x))" + apply (tactic {* Cla.fast_tac FOLP_cs 1 *})? + oops + + +text "Back to things that are provable..." + +lemma "?p : (ALL x. P(x)-->Q(x)) & (EX x. P(x)) --> (EX x. Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +(*An example of why exI should be delayed as long as possible*) +lemma "?p : (P --> (EX x. Q(x))) & P --> (EX x. Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (ALL x. P(x)-->Q(f(x))) & (ALL x. Q(x)-->R(g(x))) & P(d) --> R(?a)" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +lemma "?p : (ALL x. Q(x)) --> (EX x. Q(x))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + + +text "Some slow ones" + +(*Principia Mathematica *11.53 *) +lemma "?p : (ALL x y. P(x) --> Q(y)) <-> ((EX x. P(x)) --> (ALL y. Q(y)))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +(*Principia Mathematica *11.55 *) +lemma "?p : (EX x y. P(x) & Q(x,y)) <-> (EX x. P(x) & (EX y. Q(x,y)))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +(*Principia Mathematica *11.61 *) +lemma "?p : (EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))" + by (tactic {* Cla.fast_tac FOLP_cs 1 *}) + +end diff -r 562a1d615336 -r 6964c4799f47 src/FOLP/ex/Quantifiers_Int.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FOLP/ex/Quantifiers_Int.thy Wed Mar 26 22:38:55 2008 +0100 @@ -0,0 +1,102 @@ +(* Title: FOLP/ex/Quantifiers_Int.thy + 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" +*) + +theory Quantifiers_Int +imports IFOLP +begin + +lemma "?p : (ALL x y. P(x,y)) --> (ALL y x. P(x,y))" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (EX x y. P(x,y)) --> (EX y x. P(x,y))" + by (tactic {* IntPr.fast_tac 1 *}) + + +(*Converse is false*) +lemma "?p : (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))" + by (tactic {* IntPr.fast_tac 1 *}) + + +lemma "?p : (ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "Some harder ones" + +lemma "?p : (EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))" + by (tactic {* IntPr.fast_tac 1 *}) + +(*Converse is false*) +lemma "?p : (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 "?p : (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (ALL x. Q(x)) --> (EX x. Q(x))" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "The following should fail, as they are false!" + +lemma "?p : (ALL x. EX y. Q(x,y)) --> (EX y. ALL x. Q(x,y))" + apply (tactic {* IntPr.fast_tac 1 *})? + oops + +lemma "?p : (EX x. Q(x)) --> (ALL x. Q(x))" + apply (tactic {* IntPr.fast_tac 1 *})? + oops + +lemma "?p : P(?a) --> (ALL x. P(x))" + apply (tactic {* IntPr.fast_tac 1 *})? + oops + +lemma "?p : (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..." + +lemma "?p : (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 : (P --> (EX x. Q(x))) & P --> (EX x. Q(x))" + by (tactic {* IntPr.fast_tac 1 *}) + +lemma "?p : (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 "?p : (ALL x. Q(x)) --> (EX x. Q(x))" + by (tactic {* IntPr.fast_tac 1 *}) + + +text "Some slow ones" + +(*Principia Mathematica *11.53 *) +lemma "?p : (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 "?p : (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 "?p : (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 562a1d615336 -r 6964c4799f47 src/FOLP/ex/ROOT.ML --- a/src/FOLP/ex/ROOT.ML Wed Mar 26 22:38:17 2008 +0100 +++ b/src/FOLP/ex/ROOT.ML Wed Mar 26 22:38:55 2008 +0100 @@ -12,13 +12,9 @@ "Foundation", "If", "Intuitionistic", - "Classical" + "Classical", + "Propositional_Int", + "Quantifiers_Int", + "Propositional_Cla", + "Quantifiers_Cla" ]; - -val thy = theory "IFOLP" and tac = IntPr.fast_tac 1; -time_use "prop.ML"; -time_use "quant.ML"; - -val thy = theory "FOLP" and tac = Cla.fast_tac FOLP_cs 1; -time_use "prop.ML"; -time_use "quant.ML"; diff -r 562a1d615336 -r 6964c4799f47 src/FOLP/ex/prop.ML --- a/src/FOLP/ex/prop.ML Wed Mar 26 22:38:17 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -(* Title: FOLP/ex/prop.ML - 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" -*) - -ML_Context.set_context (SOME (Context.Theory thy)); - - -writeln"commutative laws of & and | "; -Goal "?p : P & Q --> Q & P"; -by tac; -result(); - -Goal "?p : P | Q --> Q | P"; -by tac; -result(); - - -writeln"associative laws of & and | "; -Goal "?p : (P & Q) & R --> P & (Q & R)"; -by tac; -result(); - -Goal "?p : (P | Q) | R --> P | (Q | R)"; -by tac; -result(); - - - -writeln"distributive laws of & and | "; -Goal "?p : (P & Q) | R --> (P | R) & (Q | R)"; -by tac; -result(); - -Goal "?p : (P | R) & (Q | R) --> (P & Q) | R"; -by tac; -result(); - -Goal "?p : (P | Q) & R --> (P & R) | (Q & R)"; -by tac; -result(); - - -Goal "?p : (P & R) | (Q & R) --> (P | Q) & R"; -by tac; -result(); - - -writeln"Laws involving implication"; - -Goal "?p : (P-->R) & (Q-->R) <-> (P|Q --> R)"; -by tac; -result(); - - -Goal "?p : (P & Q --> R) <-> (P--> (Q-->R))"; -by tac; -result(); - - -Goal "?p : ((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R"; -by tac; -result(); - -Goal "?p : ~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)"; -by tac; -result(); - -Goal "?p : (P --> Q & R) <-> (P-->Q) & (P-->R)"; -by tac; -result(); - - -writeln"Propositions-as-types"; - -(*The combinator K*) -Goal "?p : P --> (Q --> P)"; -by tac; -result(); - -(*The combinator S*) -Goal "?p : (P-->Q-->R) --> (P-->Q) --> (P-->R)"; -by tac; -result(); - - -(*Converse is classical*) -Goal "?p : (P-->Q) | (P-->R) --> (P --> Q | R)"; -by tac; -result(); - -Goal "?p : (P-->Q) --> (~Q --> ~P)"; -by tac; -result(); - - -writeln"Schwichtenberg's examples (via T. Nipkow)"; - -(* stab-imp *) -Goal "?p : (((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q"; -by tac; -result(); - -(* stab-to-peirce *) -Goal "?p : (((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) \ -\ --> ((P --> Q) --> P) --> P"; -by tac; -result(); - -(* peirce-imp1 *) -Goal "?p : (((Q --> R) --> Q) --> Q) \ -\ --> (((P --> Q) --> R) --> P --> Q) --> P --> Q"; -by tac; -result(); - -(* peirce-imp2 *) -Goal "?p : (((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P"; -by tac; -result(); - -(* mints *) -Goal "?p : ((((P --> Q) --> P) --> P) --> Q) --> Q"; -by tac; -result(); - -(* mints-solovev *) -Goal "?p : (P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R"; -by tac; -result(); - -(* tatsuta *) -Goal "?p : (((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 "?p : (((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(); diff -r 562a1d615336 -r 6964c4799f47 src/FOLP/ex/quant.ML --- a/src/FOLP/ex/quant.ML Wed Mar 26 22:38:17 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -(* Title: FOLP/ex/quant.ML - 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" -*) - -Goal "?p : (ALL x y. P(x,y)) --> (ALL y x. P(x,y))"; -by tac; -result(); - - -Goal "?p : (EX x y. P(x,y)) --> (EX y x. P(x,y))"; -by tac; -result(); - - -(*Converse is false*) -Goal "?p : (ALL x. P(x)) | (ALL x. Q(x)) --> (ALL x. P(x) | Q(x))"; -by tac; -result(); - -Goal "?p : (ALL x. P-->Q(x)) <-> (P--> (ALL x. Q(x)))"; -by tac; -result(); - - -Goal "?p : (ALL x. P(x)-->Q) <-> ((EX x. P(x)) --> Q)"; -by tac; -result(); - - -writeln"Some harder ones"; - -Goal "?p : (EX x. P(x) | Q(x)) <-> (EX x. P(x)) | (EX x. Q(x))"; -by tac; -result(); -(*6 secs*) - -(*Converse is false*) -Goal "?p : (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 "?p : (EX y. ALL x. Q(x,y)) --> (ALL x. EX y. Q(x,y))"; -by tac; -result(); - - -Goal "?p : (ALL x. Q(x)) --> (EX x. Q(x))"; -by tac; -result(); - - -writeln"The following should fail, as they are false!"; - -Goal "?p : (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 "?p : (EX x. Q(x)) --> (ALL x. Q(x))"; -by tac handle ERROR _ => writeln"Failed, as expected"; -getgoal 1; - -Goal "?p : P(?a) --> (ALL x. P(x))"; -by tac handle ERROR _ => writeln"Failed, as expected"; -(*Check that subgoals remain: proof failed.*) -getgoal 1; - -Goal - "?p : (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 "?p : (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 : (P --> (EX x. Q(x))) & P --> (EX x. Q(x))"; -by tac; -result(); - -Goal "?p : (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 "?p : (ALL x. Q(x)) --> (EX x. Q(x))"; -by tac; -result(); - - -writeln"Some slow ones"; - - -(*Principia Mathematica *11.53 *) -Goal "?p : (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 "?p : (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 "?p : (EX y. ALL x. P(x) --> Q(x,y)) --> (ALL x. P(x) --> (EX y. Q(x,y)))"; -by tac; -result(); -(*3 secs*)