diff -r bdaa1582dc8b -r baefa3b461c2 src/HOL/Probability/Borel_Space.thy --- a/src/HOL/Probability/Borel_Space.thy Wed Apr 10 17:49:16 2013 +0200 +++ b/src/HOL/Probability/Borel_Space.thy Wed Apr 10 18:51:21 2013 +0200 @@ -136,13 +136,8 @@ interpret countable_basis using assms by unfold_locales fix X::"'a set" assume "open X" from open_countable_basisE[OF this] guess B' . note B' = this - show "X \ sigma_sets UNIV B" - proof cases - assume "B' \ {}" - thus "X \ sigma_sets UNIV B" using assms B' - by (metis from_nat_into Union_image_eq countable_subset range_from_nat_into - in_mono sigma_sets.Basic sigma_sets.Union) - qed (simp add: sigma_sets.Empty B') + then show "X \ sigma_sets UNIV B" + by (blast intro: sigma_sets_UNION `countable B` countable_subset) next fix b assume "b \ B" hence "open b" by (rule topological_basis_open[OF assms(2)]) @@ -206,22 +201,6 @@ using measurable_comp[OF g borel_measurable_continuous_on_open'[OF cont], of c] by (simp add: comp_def) -lemma continuous_on_fst: "continuous_on UNIV fst" -proof - - have [simp]: "range fst = UNIV" by (auto simp: image_iff) - show ?thesis - using closed_vimage_fst - by (auto simp: continuous_on_closed closed_closedin vimage_def) -qed - -lemma continuous_on_snd: "continuous_on UNIV snd" -proof - - have [simp]: "range snd = UNIV" by (auto simp: image_iff) - show ?thesis - using closed_vimage_snd - by (auto simp: continuous_on_closed closed_closedin vimage_def) -qed - lemma borel_measurable_continuous_Pair: fixes f :: "'a \ 'b::second_countable_topology" and g :: "'a \ 'c::second_countable_topology" assumes [measurable]: "f \ borel_measurable M" @@ -242,11 +221,10 @@ assumes "g \ borel_measurable M" shows "(\x. f x \ g x) \ borel_measurable M" using assms - by (rule borel_measurable_continuous_Pair) - (intro continuous_on_inner continuous_on_snd continuous_on_fst) + by (rule borel_measurable_continuous_Pair) (intro continuous_on_intros) lemma [measurable]: - fixes a b :: "'a\ordered_euclidean_space" + fixes a b :: "'a\linorder_topology" shows lessThan_borel: "{..< a} \ sets borel" and greaterThan_borel: "{a <..} \ sets borel" and greaterThanLessThan_borel: "{a<.. sets borel" @@ -256,22 +234,58 @@ and greaterThanAtMost_borel: "{a<..b} \ sets borel" and atLeastLessThan_borel: "{a.. sets borel" unfolding greaterThanAtMost_def atLeastLessThan_def + by (blast intro: borel_open borel_closed open_lessThan open_greaterThan open_greaterThanLessThan + closed_atMost closed_atLeast closed_atLeastAtMost)+ + +lemma eucl_ivals[measurable]: + fixes a b :: "'a\ordered_euclidean_space" + shows "{..< a} \ sets borel" + and "{a <..} \ sets borel" + and "{a<.. sets borel" + and "{..a} \ sets borel" + and "{a..} \ sets borel" + and "{a..b} \ sets borel" + and "{a<..b} \ sets borel" + and "{a.. sets borel" + unfolding greaterThanAtMost_def atLeastLessThan_def by (blast intro: borel_open borel_closed)+ +lemma open_Collect_less: + fixes f g :: "'i::topological_space \ 'a :: {inner_dense_linorder, linorder_topology}" + assumes "continuous_on UNIV f" + assumes "continuous_on UNIV g" + shows "open {x. f x < g x}" +proof - + have "open (\y. {x \ UNIV. f x \ {..< y}} \ {x \ UNIV. g x \ {y <..}})" (is "open ?X") + by (intro open_UN ballI open_Int continuous_open_preimage assms) auto + also have "?X = {x. f x < g x}" + by (auto intro: dense) + finally show ?thesis . +qed + +lemma closed_Collect_le: + fixes f g :: "'i::topological_space \ 'a :: {inner_dense_linorder, linorder_topology}" + assumes f: "continuous_on UNIV f" + assumes g: "continuous_on UNIV g" + shows "closed {x. f x \ g x}" + using open_Collect_less[OF g f] unfolding not_less[symmetric] Collect_neg_eq open_closed . + lemma borel_measurable_less[measurable]: - fixes f :: "'a \ real" - assumes f: "f \ borel_measurable M" - assumes g: "g \ borel_measurable M" + fixes f :: "'a \ 'b::{second_countable_topology, inner_dense_linorder, linorder_topology}" + assumes "f \ borel_measurable M" + assumes "g \ borel_measurable M" shows "{w \ space M. f w < g w} \ sets M" proof - - have "{w \ space M. f w < g w} = {x \ space M. \r. f x < of_rat r \ of_rat r < g x}" - using Rats_dense_in_real by (auto simp add: Rats_def) - with f g show ?thesis - by simp + have "{w \ space M. f w < g w} = (\x. (f x, g x)) -` {x. fst x < snd x} \ space M" + by auto + also have "\ \ sets M" + by (intro measurable_sets[OF borel_measurable_Pair borel_open, OF assms open_Collect_less] + continuous_on_intros) + finally show ?thesis . qed lemma - fixes f :: "'a \ real" + fixes f :: "'a \ 'b::{second_countable_topology, inner_dense_linorder, linorder_topology}" assumes f[measurable]: "f \ borel_measurable M" assumes g[measurable]: "g \ borel_measurable M" shows borel_measurable_le[measurable]: "{w \ space M. f w \ g w} \ sets M" @@ -281,10 +295,11 @@ by measurable lemma - shows hafspace_less_borel: "{x::'a::euclidean_space. a < x \ i} \ sets borel" - and hafspace_greater_borel: "{x::'a::euclidean_space. x \ i < a} \ sets borel" - and hafspace_less_eq_borel: "{x::'a::euclidean_space. a \ x \ i} \ sets borel" - and hafspace_greater_eq_borel: "{x::'a::euclidean_space. x \ i \ a} \ sets borel" + fixes i :: "'a::{second_countable_topology, real_inner}" + shows hafspace_less_borel: "{x. a < x \ i} \ sets borel" + and hafspace_greater_borel: "{x. x \ i < a} \ sets borel" + and hafspace_less_eq_borel: "{x. a \ x \ i} \ sets borel" + and hafspace_greater_eq_borel: "{x. x \ i \ a} \ sets borel" by simp_all subsection "Borel space equals sigma algebras over intervals" @@ -636,22 +651,20 @@ subsection "Borel measurable operators" lemma borel_measurable_uminus[measurable (raw)]: - fixes g :: "'a \ real" + fixes g :: "'a \ 'b::{second_countable_topology, real_normed_vector}" assumes g: "g \ borel_measurable M" shows "(\x. - g x) \ borel_measurable M" - by (rule borel_measurable_continuous_on[OF _ g]) (auto intro: continuous_on_minus continuous_on_id) + by (rule borel_measurable_continuous_on[OF _ g]) (intro continuous_on_intros) lemma borel_measurable_add[measurable (raw)]: - fixes f g :: "'a \ 'c::ordered_euclidean_space" + fixes f g :: "'a \ 'b::{second_countable_topology, real_normed_vector}" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" shows "(\x. f x + g x) \ borel_measurable M" - using f g - by (rule borel_measurable_continuous_Pair) - (auto intro: continuous_on_fst continuous_on_snd continuous_on_add) + using f g by (rule borel_measurable_continuous_Pair) (intro continuous_on_intros) lemma borel_measurable_setsum[measurable (raw)]: - fixes f :: "'c \ 'a \ real" + fixes f :: "'c \ 'a \ 'b::{second_countable_topology, real_normed_vector}" assumes "\i. i \ S \ f i \ borel_measurable M" shows "(\x. \i\S. f i x) \ borel_measurable M" proof cases @@ -660,37 +673,41 @@ qed simp lemma borel_measurable_diff[measurable (raw)]: - fixes f :: "'a \ real" + fixes f :: "'a \ 'b::{second_countable_topology, real_normed_vector}" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" shows "(\x. f x - g x) \ borel_measurable M" unfolding diff_minus using assms by simp lemma borel_measurable_times[measurable (raw)]: - fixes f :: "'a \ real" + fixes f :: "'a \ 'b::{second_countable_topology, real_normed_algebra}" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" shows "(\x. f x * g x) \ borel_measurable M" - using f g - by (rule borel_measurable_continuous_Pair) - (auto intro: continuous_on_fst continuous_on_snd continuous_on_mult) + using f g by (rule borel_measurable_continuous_Pair) (intro continuous_on_intros) + +lemma borel_measurable_setprod[measurable (raw)]: + fixes f :: "'c \ 'a \ 'b::{second_countable_topology, real_normed_field}" + assumes "\i. i \ S \ f i \ borel_measurable M" + shows "(\x. \i\S. f i x) \ borel_measurable M" +proof cases + assume "finite S" + thus ?thesis using assms by induct auto +qed simp lemma borel_measurable_dist[measurable (raw)]: - fixes g f :: "'a \ 'b::ordered_euclidean_space" + fixes g f :: "'a \ 'b::{second_countable_topology, metric_space}" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" shows "(\x. dist (f x) (g x)) \ borel_measurable M" - using f g - by (rule borel_measurable_continuous_Pair) - (intro continuous_on_dist continuous_on_fst continuous_on_snd) + using f g by (rule borel_measurable_continuous_Pair) (intro continuous_on_intros) lemma borel_measurable_scaleR[measurable (raw)]: - fixes g :: "'a \ 'b::ordered_euclidean_space" + fixes g :: "'a \ 'b::{second_countable_topology, real_normed_vector}" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" shows "(\x. f x *\<^sub>R g x) \ borel_measurable M" - by (rule borel_measurable_continuous_Pair[OF f g]) - (auto intro!: continuous_on_scaleR continuous_on_fst continuous_on_snd) + using f g by (rule borel_measurable_continuous_Pair) (intro continuous_on_intros) lemma affine_borel_measurable_vector: fixes f :: "'a \ 'x::real_normed_vector" @@ -720,36 +737,29 @@ "f \ borel_measurable M \ (\x. a + f x ::'a::real_normed_vector) \ borel_measurable M" using affine_borel_measurable_vector[of f M a 1] by simp -lemma borel_measurable_setprod[measurable (raw)]: - fixes f :: "'c \ 'a \ real" - assumes "\i. i \ S \ f i \ borel_measurable M" - shows "(\x. \i\S. f i x) \ borel_measurable M" -proof cases - assume "finite S" - thus ?thesis using assms by induct auto -qed simp - lemma borel_measurable_inverse[measurable (raw)]: - fixes f :: "'a \ real" + fixes f :: "'a \ 'b::{second_countable_topology, real_normed_div_algebra}" assumes f: "f \ borel_measurable M" shows "(\x. inverse (f x)) \ borel_measurable M" proof - - have "(\x::real. if x \ UNIV - {0} then inverse x else 0) \ borel_measurable borel" - by (intro borel_measurable_continuous_on_open' continuous_on_inverse continuous_on_id) auto - also have "(\x::real. if x \ UNIV - {0} then inverse x else 0) = inverse" by (intro ext) auto + have "(\x::'b. if x \ UNIV - {0} then inverse x else inverse 0) \ borel_measurable borel" + by (intro borel_measurable_continuous_on_open' continuous_on_intros) auto + also have "(\x::'b. if x \ UNIV - {0} then inverse x else inverse 0) = inverse" + by (intro ext) auto finally show ?thesis using f by simp qed lemma borel_measurable_divide[measurable (raw)]: - "f \ borel_measurable M \ g \ borel_measurable M \ (\x. f x / g x::real) \ borel_measurable M" + "f \ borel_measurable M \ g \ borel_measurable M \ + (\x. f x / g x::'b::{second_countable_topology, real_normed_field}) \ borel_measurable M" by (simp add: field_divide_inverse) lemma borel_measurable_max[measurable (raw)]: - "f \ borel_measurable M \ g \ borel_measurable M \ (\x. max (g x) (f x) :: real) \ borel_measurable M" + "f \ borel_measurable M \ g \ borel_measurable M \ (\x. max (g x) (f x) :: 'b::{second_countable_topology, inner_dense_linorder, linorder_topology}) \ borel_measurable M" by (simp add: max_def) lemma borel_measurable_min[measurable (raw)]: - "f \ borel_measurable M \ g \ borel_measurable M \ (\x. min (g x) (f x) :: real) \ borel_measurable M" + "f \ borel_measurable M \ g \ borel_measurable M \ (\x. min (g x) (f x) :: 'b::{second_countable_topology, inner_dense_linorder, linorder_topology}) \ borel_measurable M" by (simp add: min_def) lemma borel_measurable_abs[measurable (raw)]: @@ -761,15 +771,15 @@ by (simp add: cart_eq_inner_axis) lemma convex_measurable: - fixes a b :: real - assumes X: "X \ borel_measurable M" "X ` space M \ { a <..< b}" - assumes q: "convex_on { a <..< b} q" + fixes A :: "'a :: ordered_euclidean_space set" + assumes X: "X \ borel_measurable M" "X ` space M \ A" "open A" + assumes q: "convex_on A q" shows "(\x. q (X x)) \ borel_measurable M" proof - - have "(\x. if X x \ {a <..< b} then q (X x) else 0) \ borel_measurable M" (is "?qX") + have "(\x. if X x \ A then q (X x) else 0) \ borel_measurable M" (is "?qX") proof (rule borel_measurable_continuous_on_open[OF _ _ X(1)]) - show "open {a<.. (\x. q (X x)) \ borel_measurable M" @@ -904,19 +914,6 @@ by (subst *) (simp del: space_borel split del: split_if) qed -lemma [measurable]: - fixes f g :: "'a \ ereal" - assumes f: "f \ borel_measurable M" - assumes g: "g \ borel_measurable M" - shows borel_measurable_ereal_le: "{x \ space M. f x \ g x} \ sets M" - and borel_measurable_ereal_less: "{x \ space M. f x < g x} \ sets M" - and borel_measurable_ereal_eq: "{w \ space M. f w = g w} \ sets M" - using f g by (simp_all add: set_Collect_ereal2) - -lemma borel_measurable_ereal_neq: - "f \ borel_measurable M \ g \ borel_measurable M \ {w \ space M. f w \ (g w :: ereal)} \ sets M" - by simp - lemma borel_measurable_ereal_iff: shows "(\x. ereal (f x)) \ borel_measurable M \ f \ borel_measurable M" proof @@ -1197,4 +1194,4 @@ shows "(\x. suminf (\i. f i x)) \ borel_measurable M" unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp -end +end