diff -r da8a0e7bcac8 -r 9a60c1759543 src/HOL/Filter.thy --- a/src/HOL/Filter.thy Mon Jan 30 15:24:25 2023 +0000 +++ b/src/HOL/Filter.thy Tue Jan 31 14:05:16 2023 +0000 @@ -65,6 +65,9 @@ lemma eventuallyI: "(\x. P x) \ eventually P F" by (auto intro: always_eventually) +lemma filter_eqI: "(\P. eventually P F \ eventually P G) \ F = G" + by (auto simp: filter_eq_iff) + lemma eventually_mono: "\eventually P F; \x. P x \ Q x\ \ eventually Q F" unfolding eventually_def @@ -105,6 +108,11 @@ shows "eventually (\i. R i) F" using assms by (auto elim!: eventually_rev_mp) +lemma eventually_cong: + assumes "eventually P F" and "\x. P x \ Q x \ R x" + shows "eventually Q F \ eventually R F" + using assms eventually_elim2 by blast + lemma eventually_ball_finite_distrib: "finite A \ (eventually (\x. \y\A. P x y) net) \ (\y\A. eventually (\x. P x y) net)" by (induction A rule: finite_induct) (auto simp: eventually_conj_iff) @@ -209,6 +217,12 @@ "(\\<^sub>Fx in F. P x \ Q x) \ (eventually P F \ frequently Q F)" unfolding imp_conv_disj frequently_disj_iff not_eventually[symmetric] .. +lemma frequently_eventually_conj: + assumes "\\<^sub>Fx in F. P x" + assumes "\\<^sub>Fx in F. Q x" + shows "\\<^sub>Fx in F. Q x \ P x" + using assms eventually_elim2 by (force simp add: frequently_def) + lemma eventually_frequently_const_simps: "(\\<^sub>Fx in F. P x \ C) \ (\\<^sub>Fx in F. P x) \ C" "(\\<^sub>Fx in F. C \ P x) \ C \ (\\<^sub>Fx in F. P x)" @@ -557,6 +571,13 @@ apply (auto elim!: eventually_rev_mp) done +lemma eventually_comp_filtermap: + "eventually (P \ f) F \ eventually P (filtermap f F)" + unfolding comp_def using eventually_filtermap by auto + +lemma filtermap_compose: "filtermap (f \ g) F = filtermap f (filtermap g F)" + unfolding filter_eq_iff by (simp add: eventually_filtermap) + lemma filtermap_ident: "filtermap (\x. x) F = F" by (simp add: filter_eq_iff eventually_filtermap) @@ -585,6 +606,16 @@ lemma filtermap_INF: "filtermap f (\b\B. F b) \ (\b\B. filtermap f (F b))" by (rule INF_greatest, rule filtermap_mono, erule INF_lower) +lemma frequently_cong: + assumes ev: "eventually P F" and QR: "\x. P x \ Q x \ R x" + shows "frequently Q F \ frequently R F" + unfolding frequently_def + using QR by (auto intro!: eventually_cong [OF ev]) + +lemma frequently_filtermap: + "frequently P (filtermap f F) = frequently (\x. P (f x)) F" + by (simp add: frequently_def eventually_filtermap) + subsubsection \Contravariant map function for filters\