theory LiveDemo02 imports Main begin section \Eigenvariable Condition\ lemma "\ y. y = x" proof (rule allI) fix y show "y = x" oops lemma "\ y. y = x" proof (rule allI) fix z show "z = x" (* we can choose a different name than y *) oops text \The upcoming examples just show that it is not possible to cheat. They are definitely not good style!\ lemma "\ y. y = x" proof (rule allI) fix x show "x = x" (* it is not allowed to choose x *) oops lemma "\ y. y = x" proof (rule allI) let ?blue_x = x (* let can be used to abbreviate terms within proofs *) fix x show "x = ?blue_x" (* orange x \ blue x *) using refl[of x] refl[of ?blue_x] oops lemma "\ x y. x = y" proof (rule allI) fix x :: 'a let ?orange_x = x show "\y. x = y" proof (rule allI) fix x show "?orange_x = x" (* automatic renaming *) oops section \The rule method (in introduction mode)\ lemma "x < 5 \ x < 3 \ x < 2" proof (rule conjI) oops lemma "\ y. 5 < y" proof (rule exI) oops section \Equality of Terms\ thm refl (* reflexivity of equality: t = t *) text \\-conversion is implicitly done\ lemma alpha: "(\ x. P x) = (\ y. P y)" by (rule refl) text \\-reduction "(\ x. t) s \\ t [ x / s]" is implicitly done\ lemma beta: "(\ x. P (x + x)) y = P (y + y)" by (rule refl) text \\-expansion "f = (\ x. f x)" if f has function-type is implicitly invoked\ lemma eta: "(\ x. f x) = f" by (rule refl) section \Drinker's paradox\ thm excluded_middle ccontr text \elimination rules\ thm disjE conjE exE allE impE notE thm disjE text \introduction rules\ thm disjI1 disjI2 conjI exI allI impI notI lemma drinkers_paradox: "\ p. drinks p \ (\ x. drinks x)" proof - have "\ (\ p. \ drinks p) \ (\ p. \ drinks p)" by (rule excluded_middle) from this show "\ p. drinks p \ (\ x. drinks x)" proof { assume "\p. \ drinks p" from this show ?thesis proof fix p assume ndp: "\ drinks p" show ?thesis proof (intro allI exI impI) fix x assume "drinks p" from ndp this show "drinks x" .. qed qed } { assume a: "\p. \ drinks p" show ?thesis proof (intro exI impI allI) fix x show "drinks x" proof (rule ccontr) assume "\ drinks x" from this have "\ x. \ drinks x" .. from a this show False .. qed qed } qed qed lemma drinkers_paradox_new: "\ p. drinks p \ (\ x. drinks x)" proof - { fix p assume "\ drinks p" from this have "drinks p \ (\ x. drinks x)" by auto from this have ?thesis by auto } from this have case1: "\ p. \ drinks p \ ?thesis" by auto { assume "\ p. drinks p" from this have ?thesis by auto } from case1 this show ?thesis by auto qed thm drinkers_paradox_new[of "\ x. x < 5"] lemma "\ p. drinks p \ (\ x. drinks x)" by auto (* - there are other proofs with many comments in Demo02.thy - this file just contains the proofs of the drinkers paradox that have been developed during the lecture *) end