src/HOL/ex/Classical.thy
changeset 67443 3abf6a722518
parent 66303 210dae34b8bc
child 69420 85b0df070afe
equal deleted inserted replaced
67442:f075640b8868 67443:3abf6a722518
   427 JAR 29: 3-4 (2002), pages 253-275\<close>
   427 JAR 29: 3-4 (2002), pages 253-275\<close>
   428 lemma "(\<forall>x y z. R(x,y) & R(y,z) --> R(x,z)) &
   428 lemma "(\<forall>x y z. R(x,y) & R(y,z) --> R(x,z)) &
   429        (\<forall>x. \<exists>y. R(x,y)) -->
   429        (\<forall>x. \<exists>y. R(x,y)) -->
   430        ~ (\<forall>x. P x = (\<forall>y. R(x,y) --> ~ P y))"
   430        ~ (\<forall>x. P x = (\<forall>y. R(x,y) --> ~ P y))"
   431 by (tactic\<open>Meson.safe_best_meson_tac @{context} 1\<close>)
   431 by (tactic\<open>Meson.safe_best_meson_tac @{context} 1\<close>)
   432     \<comment>\<open>In contrast, \<open>meson\<close> is SLOW: 7.6s on griffon\<close>
   432     \<comment> \<open>In contrast, \<open>meson\<close> is SLOW: 7.6s on griffon\<close>
   433 
   433 
   434 
   434 
   435 subsubsection\<open>Pelletier's examples\<close>
   435 subsubsection\<open>Pelletier's examples\<close>
   436 text\<open>1\<close>
   436 text\<open>1\<close>
   437 lemma "(P --> Q)  =  (~Q --> ~P)"
   437 lemma "(P --> Q)  =  (~Q --> ~P)"
   642 lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.
   642 lemma "(\<forall>z. \<exists>w. \<forall>x. \<exists>y.
   643            (P x z --> P y w) & P y z & (P y w --> (\<exists>u. Q u w))) &
   643            (P x z --> P y w) & P y z & (P y w --> (\<exists>u. Q u w))) &
   644       (\<forall>x z. ~P x z --> (\<exists>y. Q y z)) &
   644       (\<forall>x z. ~P x z --> (\<exists>y. Q y z)) &
   645       ((\<exists>x y. Q x y) --> (\<forall>x. R x x))
   645       ((\<exists>x y. Q x y) --> (\<forall>x. R x x))
   646     --> (\<forall>x. \<exists>y. R x y)"
   646     --> (\<forall>x. \<exists>y. R x y)"
   647 by blast \<comment>\<open>causes unification tracing messages\<close>
   647 by blast \<comment> \<open>causes unification tracing messages\<close>
   648 
   648 
   649 
   649 
   650 text\<open>Problem 38\<close>  text\<open>Quite hard: 422 Horn clauses!!\<close>
   650 text\<open>Problem 38\<close>  text\<open>Quite hard: 422 Horn clauses!!\<close>
   651 lemma "(\<forall>x. p a & (p x --> (\<exists>y. p y & r x y)) -->
   651 lemma "(\<forall>x. p a & (p x --> (\<exists>y. p y & r x y)) -->
   652            (\<exists>z. \<exists>w. p z & r x w & r w z))  =
   652            (\<exists>z. \<exists>w. p z & r x w & r w z))  =
   721        (\<forall>x y. bird x & caterpillar y \<longrightarrow> eats x y) &
   721        (\<forall>x y. bird x & caterpillar y \<longrightarrow> eats x y) &
   722        (\<forall>x y. bird x & snail y \<longrightarrow> ~eats x y) &
   722        (\<forall>x y. bird x & snail y \<longrightarrow> ~eats x y) &
   723        (\<forall>x. (caterpillar x \<or> snail x) \<longrightarrow> (\<exists>y. plant y & eats x y))
   723        (\<forall>x. (caterpillar x \<or> snail x) \<longrightarrow> (\<exists>y. plant y & eats x y))
   724        \<longrightarrow> (\<exists>x y. animal x & animal y & (\<exists>z. grain z & eats y z & eats x y))"
   724        \<longrightarrow> (\<exists>x y. animal x & animal y & (\<exists>z. grain z & eats y z & eats x y))"
   725 by (tactic\<open>Meson.safe_best_meson_tac @{context} 1\<close>)
   725 by (tactic\<open>Meson.safe_best_meson_tac @{context} 1\<close>)
   726     \<comment>\<open>Nearly twice as fast as \<open>meson\<close>,
   726     \<comment> \<open>Nearly twice as fast as \<open>meson\<close>,
   727         which performs iterative deepening rather than best-first search\<close>
   727         which performs iterative deepening rather than best-first search\<close>
   728 
   728 
   729 text\<open>The Los problem. Circulated by John Harrison\<close>
   729 text\<open>The Los problem. Circulated by John Harrison\<close>
   730 lemma "(\<forall>x y z. P x y & P y z --> P x z) &
   730 lemma "(\<forall>x y z. P x y & P y z --> P x z) &
   731        (\<forall>x y z. Q x y & Q y z --> Q x z) &
   731        (\<forall>x y z. Q x y & Q y z --> Q x z) &
   801 begin
   801 begin
   802 
   802 
   803 lemma "\<forall>x. T(i x x)"
   803 lemma "\<forall>x. T(i x x)"
   804   using a b d by blast
   804   using a b d by blast
   805 
   805 
   806 lemma "\<forall>x. T(i x (n(n x)))" \<comment>\<open>Problem 66\<close>
   806 lemma "\<forall>x. T(i x (n(n x)))" \<comment> \<open>Problem 66\<close>
   807   using a b c d by metis
   807   using a b c d by metis
   808 
   808 
   809 lemma "\<forall>x. T(i (n(n x)) x)" \<comment>\<open>Problem 67\<close>
   809 lemma "\<forall>x. T(i (n(n x)) x)" \<comment> \<open>Problem 67\<close>
   810   using a b c d by meson \<comment>\<open>4.9s on griffon. 51061 inferences, depth 21\<close>
   810   using a b c d by meson \<comment> \<open>4.9s on griffon. 51061 inferences, depth 21\<close>
   811 
   811 
   812 lemma "\<forall>x. T(i x (n(n x)))" \<comment>\<open>Problem 68: not proved.  Listed as satisfiable in TPTP (LCL078-1)\<close>
   812 lemma "\<forall>x. T(i x (n(n x)))" \<comment> \<open>Problem 68: not proved.  Listed as satisfiable in TPTP (LCL078-1)\<close>
   813   using a b c' d oops
   813   using a b c' d oops
   814 
   814 
   815 end
   815 end
   816 
   816 
   817 text\<open>Problem 71, as found in TPTP (SYN007+1.005)\<close>
   817 text\<open>Problem 71, as found in TPTP (SYN007+1.005)\<close>