src/HOL/ex/Refute_Examples.thy
changeset 14465 8cc21ed7ef41
parent 14462 e6550f190fe9
child 14489 3676def6b8b9
equal deleted inserted replaced
14464:72ad5f2a3803 14465:8cc21ed7ef41
    20   apply (rule conjI)
    20   apply (rule conjI)
    21   refute 1  -- {* refutes @{term "P"} *}
    21   refute 1  -- {* refutes @{term "P"} *}
    22   refute 2  -- {* refutes @{term "Q"} *}
    22   refute 2  -- {* refutes @{term "Q"} *}
    23   refute    -- {* equivalent to 'refute 1' *}
    23   refute    -- {* equivalent to 'refute 1' *}
    24     -- {* here 'refute 3' would cause an exception, since we only have 2 subgoals *}
    24     -- {* here 'refute 3' would cause an exception, since we only have 2 subgoals *}
    25   refute [maxsize=5]           -- {* we can override parameters \<dots> *}
    25   refute [maxsize=5]           -- {* we can override parameters ... *}
    26   refute [satsolver="dpll"] 2  -- {* \<dots> and specify a subgoal at the same time *}
    26   refute [satsolver="dpll"] 2  -- {* ... and specify a subgoal at the same time *}
    27 oops
    27 oops
    28 
    28 
    29 refute_params
    29 refute_params
    30 
    30 
    31 section {* Examples and Test Cases *}
    31 section {* Examples and Test Cases *}
   173 
   173 
   174 lemma "\<lbrakk> \<forall>x. P x x; \<forall>x y. P x y \<longrightarrow> P y x \<rbrakk> \<Longrightarrow> P x y \<longrightarrow> P y z \<longrightarrow> P x z"
   174 lemma "\<lbrakk> \<forall>x. P x x; \<forall>x y. P x y \<longrightarrow> P y x \<rbrakk> \<Longrightarrow> P x y \<longrightarrow> P y z \<longrightarrow> P x z"
   175   (* refute -- works well with ZChaff, but the internal solver is too slow *)
   175   (* refute -- works well with ZChaff, but the internal solver is too slow *)
   176 oops
   176 oops
   177 
   177 
   178 text {* The "Drinker's theorem" \<dots> *}
   178 text {* The "Drinker's theorem" ... *}
   179 
   179 
   180 lemma "\<exists>x. f x = g x \<longrightarrow> f = g"
   180 lemma "\<exists>x. f x = g x \<longrightarrow> f = g"
   181   refute [maxsize=4]  (* [maxsize=6] works well with ZChaff *)
   181   refute [maxsize=4]  (* [maxsize=6] works well with ZChaff *)
   182   apply (auto simp add: ext)
   182   apply (auto simp add: ext)
   183 done
   183 done
   184 
   184 
   185 text {* \<dots> and an incorrect version of it *}
   185 text {* ... and an incorrect version of it *}
   186 
   186 
   187 lemma "(\<exists>x. f x = g x) \<longrightarrow> f = g"
   187 lemma "(\<exists>x. f x = g x) \<longrightarrow> f = g"
   188   refute
   188   refute
   189 oops
   189 oops
   190 
   190 
   283   refute [maxsize=4]
   283   refute [maxsize=4]
   284   apply (rule_tac x="\<lambda>x. x" in exI)
   284   apply (rule_tac x="\<lambda>x. x" in exI)
   285   apply simp
   285   apply simp
   286 done
   286 done
   287 
   287 
   288 text {* Axiom of Choice: first an incorrect version \<dots> *}
   288 text {* Axiom of Choice: first an incorrect version ... *}
   289 
   289 
   290 lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (EX!f. \<forall>x. P x (f x))"
   290 lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (EX!f. \<forall>x. P x (f x))"
   291   refute
   291   refute
   292 oops
   292 oops
   293 
   293 
   294 text {* \<dots> and now two correct ones *}
   294 text {* ... and now two correct ones *}
   295 
   295 
   296 lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>f. \<forall>x. P x (f x))"
   296 lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>f. \<forall>x. P x (f x))"
   297   refute [maxsize=5]
   297   refute [maxsize=5]
   298   apply (simp add: choice)
   298   apply (simp add: choice)
   299 done
   299 done