chapter \Exercise Sheet -- Week 2\ text \Important disclaimer for the whole exercise part of this course: \<^item> Whenever you just got stuck on some sub-proofs, then use sorry for these parts. \<^item> Please still submit these partial solutions, since it may help all students to discuss these potentially common problems. \<^item> It is still fine to tick the check-box of partially solved exercises, as long as you can explain the intended solution and the problem that you ran into. \ theory Exercise02 imports Main begin section \Overview of basic proof rules\ text \various rules\ thm excluded_middle (* LEM *) thm ccontr (* proof by contradiction *) thm arg_cong fun_cong (* function application congruence rules *) text \elimination rules\ thm disjE conjE exE allE impE notE text \introduction rules\ thm disjI1 disjI2 conjI exI allI impI notI section \Overall Setup\ text \There is a well known proof that there is no surjective function from A to the power-set of A via Cantor's diagonalization argument. In this theory file we represent sets as characteristic functions from the carrier to booleans. E.g., the set {1,5,6,7,...} of natural numbers would be represented by @{term "\ n :: nat. n = 1 \ n \ 5"}.\ type_synonym 'a cf_set = "'a \ bool" text \Definition of surjectivity of a function\ definition surjective :: "('a \ 'b) \ bool" where "surjective f = (\ b. \ a. f a = b)" text \The statement we are now interested in is @{prop "\ (\ f :: 'a \ 'a cf_set. surjective f)"}.\ text \The proof roughly works as follows: assume such a function f exists, then define g x = (\ f x x) and show that g is not in the image of f.\ section \Exercise 1.a -- 3 points\ text \Prove the upcoming lemma cantor1. Try to minimize the number of proof-qed blocks. You may find the following elimination rule for surjectivity useful, as well as @{thm fun_cong} and @{thm arg_cong}.\ text \Hint: in the proof you sometimes have to make explicit type constraints explicit, e.g., as in fix f :: "'a \ 'a cf_set" "\ f :: 'a \ 'a cf_set. surjective f" \ lemma surjectiveE: "surjective f \ \ a. f a = b" unfolding surjective_def by auto lemma cantor1: "\ (\ f :: 'a \ 'a cf_set. surjective f)" sorry section \Exercise 1.b -- 2 points\ text \Think about why it was necessary to add type-constraints. What would possible go wrong without these constraints? Is it a problem of Isabelle (in being too restrictive), or are the formulas and statements itself problematic?\ section \Exercise 2 -- 5 points\ text \Prove the same theorem again, but this time you may only apply single proof-steps, i.e., no auto (or other automatic methods). And of course you are not allowed to refer @{thm cantor1}. At a certain step you might find the lemma bool_diffE useful. If you need another very basic proof step on properties of boolean negation and equality, then that proof-step can be done by auto.\ lemma bool_diffE: "b = (\ b) \ P" by auto lemma cantor2: "\ (\ f :: 'a \ 'a cf_set. surjective f)" sorry end