diff -r ca431cbce2a3 -r d55937a8f97e src/HOL/Filter.thy --- a/src/HOL/Filter.thy Sun Apr 12 11:33:44 2015 +0200 +++ b/src/HOL/Filter.thy Sun Apr 12 11:33:50 2015 +0200 @@ -613,6 +613,41 @@ apply auto [] done +subsection \ The cofinite filter \ + +definition "cofinite = Abs_filter (\P. finite {x. \ P x})" + +lemma eventually_cofinite: "eventually P cofinite \ finite {x. \ P x}" + unfolding cofinite_def +proof (rule eventually_Abs_filter, rule is_filter.intro) + fix P Q :: "'a \ bool" assume "finite {x. \ P x}" "finite {x. \ Q x}" + from finite_UnI[OF this] show "finite {x. \ (P x \ Q x)}" + by (rule rev_finite_subset) auto +next + fix P Q :: "'a \ bool" assume P: "finite {x. \ P x}" and *: "\x. P x \ Q x" + from * show "finite {x. \ Q x}" + by (intro finite_subset[OF _ P]) auto +qed simp + +lemma cofinite_bot[simp]: "cofinite = (bot::'a filter) \ finite (UNIV :: 'a set)" + unfolding trivial_limit_def eventually_cofinite by simp + +lemma cofinite_eq_sequentially: "cofinite = sequentially" + unfolding filter_eq_iff eventually_sequentially eventually_cofinite +proof safe + fix P :: "nat \ bool" assume [simp]: "finite {x. \ P x}" + show "\N. \n\N. P n" + proof cases + assume "{x. \ P x} \ {}" then show ?thesis + by (intro exI[of _ "Suc (Max {x. \ P x})"]) (auto simp: Suc_le_eq) + qed auto +next + fix P :: "nat \ bool" and N :: nat assume "\n\N. P n" + then have "{x. \ P x} \ {..< N}" + by (auto simp: not_le) + then show "finite {x. \ P x}" + by (blast intro: finite_subset) +qed subsection {* Limits *}