# HG changeset patch # User wenzelm # Date 1451155026 -3600 # Node ID c51ce9ed0b1c23eccda5f2cb6751eaf83ba245c6 # Parent 6512e84cc9f5d3d21bb5fc889a72904949bed120 more notation; more examples; diff -r 6512e84cc9f5 -r c51ce9ed0b1c src/HOL/Isar_Examples/Higher_Order_Logic.thy --- a/src/HOL/Isar_Examples/Higher_Order_Logic.thy Sat Dec 26 19:27:46 2015 +0100 +++ b/src/HOL/Isar_Examples/Higher_Order_Logic.thy Sat Dec 26 19:37:06 2015 +0100 @@ -46,9 +46,12 @@ where refl [intro]: "x = x" and subst: "x = y \ P x \ P y" +abbreviation iff :: "o \ o \ o" (infixr "\" 25) + where "A \ B \ A = B" + axiomatization where ext [intro]: "(\x. f x = g x) \ f = g" - and iff [intro]: "(A \ B) \ (B \ A) \ A = B" + and iff [intro]: "(A \ B) \ (B \ A) \ A \ B" theorem sym [sym]: assumes "x = y" @@ -64,10 +67,10 @@ theorem trans [trans]: "x = y \ y = z \ x = z" by (rule subst) -theorem iff1 [elim]: "A = B \ A \ B" +theorem iff1 [elim]: "A \ B \ A \ B" by (rule subst) -theorem iff2 [elim]: "A = B \ B \ A" +theorem iff2 [elim]: "A \ B \ B \ A" by (rule subst) (rule sym) @@ -250,6 +253,39 @@ qed +subsection \Cantor's Theorem\ + +text \ + Cantor's Theorem states that there is no surjection from a set to its + powerset. The subsequent formulation uses elementary \\\-calculus and + predicate logic, with standard introduction and elimination rules. +\ + +lemma iff_contradiction: + assumes *: "\ A \ A" + shows C +proof (rule notE) + show "\ A" + proof + assume A + with * have "\ A" .. + from this and \A\ show \ .. + qed + with * show A .. +qed + +theorem Cantor: "\ (\f :: 'a \ 'a \ o. \A :: 'a \ o. \x :: 'a. A = f x)" +proof + assume "\f :: 'a \ 'a \ o. \A. \x. A = f x" + then obtain f :: "'a \ 'a \ o" where *: "\A. \x. A = f x" .. + let ?D = "\x. \ f x x" + from * have "\x. ?D = f x" .. + then obtain a where "?D = f a" .. + then have "?D a \ f a a" using refl by (rule subst) + then show \ by (rule iff_contradiction) +qed + + subsection \Classical logic\ text \