src/HOL/Isar_examples/Drinker.thy
author haftmann
Mon, 29 Sep 2008 12:31:58 +0200
changeset 28401 d5f39173444c
parent 16531 9b442d0e5c0c
child 31758 3edd5f813f01
permissions -rw-r--r--
separate HOL-Main image

(*  Title:      HOL/Isar_examples/Drinker.thy
    ID:         $Id$
    Author:     Makarius
*)

header {* The Drinker's Principle *}

theory Drinker imports Main begin

text {*
  Here is another example of classical reasoning: the Drinker's
  Principle says that for some person, if he is drunk, everybody else
  is drunk!

  We first prove a classical part of de-Morgan's law.
*}

lemma deMorgan:
  assumes "\<not> (\<forall>x. P x)"
  shows "\<exists>x. \<not> P x"
  using prems
proof (rule contrapos_np)
  assume a: "\<not> (\<exists>x. \<not> P x)"
  show "\<forall>x. P x"
  proof
    fix x
    show "P x"
    proof (rule classical)
      assume "\<not> P x"
      then have "\<exists>x. \<not> P x" ..
      with a show ?thesis by contradiction
    qed
  qed
qed

theorem Drinker's_Principle: "\<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)"
proof cases
  fix a assume "\<forall>x. drunk x"
  then have "drunk a \<longrightarrow> (\<forall>x. drunk x)" ..
  then show ?thesis ..
next
  assume "\<not> (\<forall>x. drunk x)"
  then have "\<exists>x. \<not> drunk x" by (rule deMorgan)
  then obtain a where a: "\<not> drunk a" ..
  have "drunk a \<longrightarrow> (\<forall>x. drunk x)"
  proof
    assume "drunk a"
    with a show "\<forall>x. drunk x" by (contradiction)
  qed
  then show ?thesis ..
qed

end