diff -r 81d34cf268d8 -r 3c5040d5694a src/HOL/Library/Infinite_Set.thy --- a/src/HOL/Library/Infinite_Set.thy Tue Dec 08 20:21:59 2015 +0100 +++ b/src/HOL/Library/Infinite_Set.thy Wed Dec 09 17:35:22 2015 +0000 @@ -8,71 +8,7 @@ imports Main begin -subsection "Infinite Sets" - -text \ - Some elementary facts about infinite sets, mostly by Stephan Merz. - Beware! Because "infinite" merely abbreviates a negation, these - lemmas may not work well with \blast\. -\ - -abbreviation infinite :: "'a set \ bool" - where "infinite S \ \ finite S" - -text \ - Infinite sets are non-empty, and if we remove some elements from an - infinite set, the result is still infinite. -\ - -lemma infinite_imp_nonempty: "infinite S \ S \ {}" - by auto - -lemma infinite_remove: "infinite S \ infinite (S - {a})" - by simp - -lemma Diff_infinite_finite: - assumes T: "finite T" and S: "infinite S" - shows "infinite (S - T)" - using T -proof induct - from S - show "infinite (S - {})" by auto -next - fix T x - assume ih: "infinite (S - T)" - have "S - (insert x T) = (S - T) - {x}" - by (rule Diff_insert) - with ih - show "infinite (S - (insert x T))" - by (simp add: infinite_remove) -qed - -lemma Un_infinite: "infinite S \ infinite (S \ T)" - by simp - -lemma infinite_Un: "infinite (S \ T) \ infinite S \ infinite T" - by simp - -lemma infinite_super: - assumes T: "S \ T" and S: "infinite S" - shows "infinite T" -proof - assume "finite T" - with T have "finite S" by (simp add: finite_subset) - with S show False by simp -qed - -lemma infinite_coinduct [consumes 1, case_names infinite]: - assumes "X A" - and step: "\A. X A \ \x\A. X (A - {x}) \ infinite (A - {x})" - shows "infinite A" -proof - assume "finite A" - then show False using \X A\ - by(induction rule: finite_psubset_induct)(meson Diff_subset card_Diff1_less card_psubset finite_Diff step) -qed - -text \As a concrete example, we prove that the set of natural numbers is infinite.\ +text \The set of natural numbers is infinite.\ lemma infinite_nat_iff_unbounded_le: "infinite (S::nat set) \ (\m. \n\m. n \ S)" using frequently_cofinite[of "\x. x \ S"] @@ -99,8 +35,9 @@ \ lemma unbounded_k_infinite: "\m>k. \n>m. n \ S \ infinite (S::nat set)" - by (metis (full_types) infinite_nat_iff_unbounded_le le_imp_less_Suc not_less - not_less_iff_gr_or_eq sup.bounded_iff) +apply (clarsimp simp add: finite_nat_set_iff_bounded) +apply (drule_tac x="Suc (max m k)" in spec) +using less_Suc_eq by fastforce lemma nat_not_finite: "finite (UNIV::nat set) \ R" by simp @@ -114,45 +51,6 @@ then show False by simp qed -text \ - For any function with infinite domain and finite range there is some - element that is the image of infinitely many domain elements. In - particular, any infinite sequence of elements from a finite set - contains some element that occurs infinitely often. -\ - -lemma inf_img_fin_dom': - assumes img: "finite (f ` A)" and dom: "infinite A" - shows "\y \ f ` A. infinite (f -` {y} \ A)" -proof (rule ccontr) - have "A \ (\y\f ` A. f -` {y} \ A)" by auto - moreover - assume "\ ?thesis" - with img have "finite (\y\f ` A. f -` {y} \ A)" by blast - ultimately have "finite A" by(rule finite_subset) - with dom show False by contradiction -qed - -lemma inf_img_fin_domE': - assumes "finite (f ` A)" and "infinite A" - obtains y where "y \ f`A" and "infinite (f -` {y} \ A)" - using assms by (blast dest: inf_img_fin_dom') - -lemma inf_img_fin_dom: - assumes img: "finite (f`A)" and dom: "infinite A" - shows "\y \ f`A. infinite (f -` {y})" -using inf_img_fin_dom'[OF assms] by auto - -lemma inf_img_fin_domE: - assumes "finite (f`A)" and "infinite A" - obtains y where "y \ f`A" and "infinite (f -` {y})" - using assms by (blast dest: inf_img_fin_dom) - -proposition finite_image_absD: - fixes S :: "'a::linordered_ring set" - shows "finite (abs ` S) \ finite S" - by (rule ccontr) (auto simp: abs_eq_iff vimage_def dest: inf_img_fin_dom) - text \The set of integers is also infinite.\ lemma infinite_int_iff_infinite_nat_abs: "infinite (S::int set) \ infinite ((nat o abs) ` S)" @@ -196,10 +94,10 @@ by (simp only: imp_conv_disj frequently_disj_iff not_eventually) lemma MOST_imp_iff: "MOST x. P x \ (MOST x. P x \ Q x) \ (MOST x. Q x)" - by (auto intro: eventually_rev_mp eventually_elim1) + by (auto intro: eventually_rev_mp eventually_mono) lemma INFM_conjI: "INFM x. P x \ MOST x. Q x \ INFM x. P x \ Q x" - by (rule frequently_rev_mp[of P]) (auto elim: eventually_elim1) + by (rule frequently_rev_mp[of P]) (auto elim: eventually_mono) text \Properties of quantifiers with injective functions.\ @@ -272,7 +170,7 @@ lemma INFM_EX: "(\\<^sub>\x. P x) \ (\x. P x)" by (fact frequently_ex) lemma ALL_MOST: "\x. P x \ \\<^sub>\x. P x" by (fact always_eventually) lemma INFM_mono: "\\<^sub>\x. P x \ (\x. P x \ Q x) \ \\<^sub>\x. Q x" by (fact frequently_elim1) -lemma MOST_mono: "\\<^sub>\x. P x \ (\x. P x \ Q x) \ \\<^sub>\x. Q x" by (fact eventually_elim1) +lemma MOST_mono: "\\<^sub>\x. P x \ (\x. P x \ Q x) \ \\<^sub>\x. Q x" by (fact eventually_mono) lemma INFM_disj_distrib: "(\\<^sub>\x. P x \ Q x) \ (\\<^sub>\x. P x) \ (\\<^sub>\x. Q x)" by (fact frequently_disj_iff) lemma MOST_rev_mp: "\\<^sub>\x. P x \ \\<^sub>\x. P x \ Q x \ \\<^sub>\x. Q x" by (fact eventually_rev_mp) lemma MOST_conj_distrib: "(\\<^sub>\x. P x \ Q x) \ (\\<^sub>\x. P x) \ (\\<^sub>\x. Q x)" by (fact eventually_conj_iff) @@ -331,7 +229,7 @@ lemma le_enumerate: assumes S: "infinite S" shows "n \ enumerate S n" - using S + using S proof (induct n) case 0 then show ?case by simp