# HG changeset patch # User hoelzl # Date 1351862620 -3600 # Node ID ce0d316b5b44a7370145dcccdf630dbcf7dc0742 # Parent 382bd3173584d4d5fd3a5da7fbd8df00216053f7 add measurability prover; add support for Borel sets diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Binary_Product_Measure.thy --- a/src/HOL/Probability/Binary_Product_Measure.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Binary_Product_Measure.thy Fri Nov 02 14:23:40 2012 +0100 @@ -100,7 +100,9 @@ lemma measurable_pair_iff: "f \ measurable M (M1 \\<^isub>M M2) \ (fst \ f) \ measurable M M1 \ (snd \ f) \ measurable M M2" - using measurable_pair[of f M M1 M2] by auto + using measurable_pair[of f M M1 M2] + using [[simproc del: measurable]] (* the measurable method is nonterminating when using measurable_pair *) + by auto lemma measurable_split_conv: "(\(x, y). f x y) \ measurable A B \ (\x. f (fst x) (snd x)) \ measurable A B" diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Borel_Space.thy --- a/src/HOL/Probability/Borel_Space.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Borel_Space.thy Fri Nov 02 14:23:40 2012 +0100 @@ -30,14 +30,20 @@ lemma space_borel[simp]: "space borel = UNIV" unfolding borel_def by auto -lemma borel_open[simp]: +lemma space_in_borel[measurable]: "UNIV \ sets borel" + unfolding borel_def by auto + +lemma pred_Collect_borel[measurable (raw)]: "Sigma_Algebra.pred borel P \ {x. P x} \ sets borel" + unfolding borel_def pred_def by auto + +lemma borel_open[simp, measurable (raw generic)]: assumes "open A" shows "A \ sets borel" proof - have "A \ {S. open S}" unfolding mem_Collect_eq using assms . thus ?thesis unfolding borel_def by auto qed -lemma borel_closed[simp]: +lemma borel_closed[simp, measurable (raw generic)]: assumes "closed A" shows "A \ sets borel" proof - have "space borel - (- A) \ sets borel" @@ -45,23 +51,18 @@ thus ?thesis by simp qed -lemma borel_comp[intro,simp]: "A \ sets borel \ - A \ sets borel" - unfolding Compl_eq_Diff_UNIV by (intro Diff) auto +lemma borel_insert[measurable]: + "A \ sets borel \ insert x A \ sets (borel :: 'a::t2_space measure)" + unfolding insert_def by (rule Un) auto + +lemma borel_comp[intro, simp, measurable]: "A \ sets borel \ - A \ sets borel" + unfolding Compl_eq_Diff_UNIV by simp lemma borel_measurable_vimage: fixes f :: "'a \ 'x::t2_space" - assumes borel: "f \ borel_measurable M" + assumes borel[measurable]: "f \ borel_measurable M" shows "f -` {x} \ space M \ sets M" -proof (cases "x \ f ` space M") - case True then obtain y where "x = f y" by auto - from closed_singleton[of "f y"] - have "{f y} \ sets borel" by (rule borel_closed) - with assms show ?thesis - unfolding in_borel_measurable_borel `x = f y` by auto -next - case False hence "f -` {x} \ space M = {}" by auto - thus ?thesis by auto -qed + by simp lemma borel_measurableI: fixes f :: "'a \ 'x\topological_space" @@ -81,7 +82,7 @@ using closed_singleton[of x] by (rule borel_closed) qed simp -lemma borel_measurable_const[simp, intro]: +lemma borel_measurable_const[simp, intro, measurable (raw)]: "(\x. c) \ borel_measurable M" by auto @@ -91,7 +92,7 @@ unfolding indicator_def [abs_def] using A by (auto intro!: measurable_If_set) -lemma borel_measurable_indicator': +lemma borel_measurable_indicator'[measurable]: "{x\space M. x \ A} \ sets M \ indicator A \ borel_measurable M" unfolding indicator_def[abs_def] by (auto intro!: measurable_If) @@ -119,115 +120,63 @@ shows "f \ borel_measurable M" using assms unfolding measurable_def by auto +lemma borel_measurable_continuous_on1: + fixes f :: "'a::topological_space \ 'b::topological_space" + assumes "continuous_on UNIV f" + shows "f \ borel_measurable borel" + apply(rule borel_measurableI) + using continuous_open_preimage[OF assms] unfolding vimage_def by auto + section "Borel spaces on euclidean spaces" -lemma lessThan_borel[simp, intro]: - fixes a :: "'a\ordered_euclidean_space" - shows "{..< a} \ sets borel" - by (blast intro: borel_open) - -lemma greaterThan_borel[simp, intro]: - fixes a :: "'a\ordered_euclidean_space" - shows "{a <..} \ sets borel" - by (blast intro: borel_open) - -lemma greaterThanLessThan_borel[simp, intro]: - fixes a b :: "'a\ordered_euclidean_space" - shows "{a<.. sets borel" - by (blast intro: borel_open) +lemma borel_measurable_euclidean_component'[measurable]: + "(\x::'a::euclidean_space. x $$ i) \ borel_measurable borel" + by (intro continuous_on_euclidean_component continuous_on_id borel_measurable_continuous_on1) -lemma atMost_borel[simp, intro]: - fixes a :: "'a\ordered_euclidean_space" - shows "{..a} \ sets borel" - by (blast intro: borel_closed) - -lemma atLeast_borel[simp, intro]: - fixes a :: "'a\ordered_euclidean_space" - shows "{a..} \ sets borel" - by (blast intro: borel_closed) - -lemma atLeastAtMost_borel[simp, intro]: - fixes a b :: "'a\ordered_euclidean_space" - shows "{a..b} \ sets borel" - by (blast intro: borel_closed) +lemma borel_measurable_euclidean_component: + "(f :: 'a \ 'b::euclidean_space) \ borel_measurable M \(\x. f x $$ i) \ borel_measurable M" + by simp -lemma greaterThanAtMost_borel[simp, intro]: - fixes a b :: "'a\ordered_euclidean_space" - shows "{a<..b} \ sets borel" - unfolding greaterThanAtMost_def by blast - -lemma atLeastLessThan_borel[simp, intro]: +lemma [simp, intro, measurable]: fixes a b :: "'a\ordered_euclidean_space" - shows "{a.. sets borel" - unfolding atLeastLessThan_def by blast - -lemma hafspace_less_borel[simp, intro]: - fixes a :: real - shows "{x::'a::euclidean_space. a < x $$ i} \ sets borel" - by (auto intro!: borel_open open_halfspace_component_gt) + shows lessThan_borel: "{..< a} \ sets borel" + and greaterThan_borel: "{a <..} \ sets borel" + and greaterThanLessThan_borel: "{a<.. sets borel" + and atMost_borel: "{..a} \ sets borel" + and atLeast_borel: "{a..} \ sets borel" + and atLeastAtMost_borel: "{a..b} \ sets borel" + 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)+ -lemma hafspace_greater_borel[simp, intro]: - fixes a :: real - shows "{x::'a::euclidean_space. x $$ i < a} \ sets borel" - by (auto intro!: borel_open open_halfspace_component_lt) +lemma + shows hafspace_less_borel[simp, intro]: "{x::'a::euclidean_space. a < x $$ i} \ sets borel" + and hafspace_greater_borel[simp, intro]: "{x::'a::euclidean_space. x $$ i < a} \ sets borel" + and hafspace_less_eq_borel[simp, intro]: "{x::'a::euclidean_space. a \ x $$ i} \ sets borel" + and hafspace_greater_eq_borel[simp, intro]: "{x::'a::euclidean_space. x $$ i \ a} \ sets borel" + by simp_all -lemma hafspace_less_eq_borel[simp, intro]: - fixes a :: real - shows "{x::'a::euclidean_space. a \ x $$ i} \ sets borel" - by (auto intro!: borel_closed closed_halfspace_component_ge) - -lemma hafspace_greater_eq_borel[simp, intro]: - fixes a :: real - shows "{x::'a::euclidean_space. x $$ i \ a} \ sets borel" - by (auto intro!: borel_closed closed_halfspace_component_le) - -lemma borel_measurable_less[simp, intro]: +lemma borel_measurable_less[simp, intro, measurable]: fixes f :: "'a \ real" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" shows "{w \ space M. f w < g w} \ sets M" proof - - have "{w \ space M. f w < g w} = - (\r. (f -` {..< of_rat r} \ space M) \ (g -` {of_rat r <..} \ space M))" + 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) - then show ?thesis using f g - by simp (blast intro: measurable_sets) -qed - -lemma borel_measurable_le[simp, intro]: - fixes f :: "'a \ real" - assumes f: "f \ borel_measurable M" - assumes g: "g \ borel_measurable M" - shows "{w \ space M. f w \ g w} \ sets M" -proof - - have "{w \ space M. f w \ g w} = space M - {w \ space M. g w < f w}" - by auto - thus ?thesis using f g - by simp blast + with f g show ?thesis + by simp qed -lemma borel_measurable_eq[simp, intro]: +lemma [simp, intro]: fixes f :: "'a \ real" - assumes f: "f \ borel_measurable M" - assumes g: "g \ borel_measurable M" - shows "{w \ space M. f w = g w} \ sets M" -proof - - have "{w \ space M. f w = g w} = - {w \ space M. f w \ g w} \ {w \ space M. g w \ f w}" - by auto - thus ?thesis using f g by auto -qed - -lemma borel_measurable_neq[simp, intro]: - fixes f :: "'a \ real" - assumes f: "f \ borel_measurable M" - assumes g: "g \ borel_measurable M" - shows "{w \ space M. f w \ g w} \ sets M" -proof - - have "{w \ space M. f w \ g w} = space M - {w \ space M. f w = g w}" - by auto - thus ?thesis using f g by auto -qed + 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" + and borel_measurable_eq[measurable]: "{w \ space M. f w = g w} \ sets M" + and borel_measurable_neq: "{w \ space M. f w \ g w} \ sets M" + unfolding eq_iff not_less[symmetric] by measurable+ subsection "Borel space equals sigma algebras over intervals" @@ -377,7 +326,7 @@ by (intro sigma_algebra_sigma_sets) simp_all have *: "?set = (\n. UNIV - {x\'a. x $$ i < a + 1 / real (Suc n)})" proof (safe, simp_all add: not_less) - fix x assume "a < x $$ i" + fix x :: 'a assume "a < x $$ i" with reals_Archimedean[of "x $$ i - a"] obtain n where "a + 1 / real (Suc n) < x $$ i" by (auto simp: inverse_eq_divide field_simps) @@ -390,7 +339,7 @@ finally show "a < x" . qed show "?set \ ?SIGMA" unfolding * - by (auto intro!: Diff) + by (auto del: Diff intro!: Diff) qed lemma borel_eq_halfspace_less: @@ -631,27 +580,13 @@ lemma borel_measurable_iff_ge: "(f::'a \ real) \ borel_measurable M = (\a. {w \ space M. a \ f w} \ sets M)" - using borel_measurable_iff_halfspace_ge[where 'c=real] by simp + using borel_measurable_iff_halfspace_ge[where 'c=real] + by simp lemma borel_measurable_iff_greater: "(f::'a \ real) \ borel_measurable M = (\a. {w \ space M. a < f w} \ sets M)" using borel_measurable_iff_halfspace_greater[where 'c=real] by simp -lemma borel_measurable_euclidean_component': - "(\x::'a::euclidean_space. x $$ i) \ borel_measurable borel" -proof (rule borel_measurableI) - fix S::"real set" assume "open S" - from open_vimage_euclidean_component[OF this] - show "(\x. x $$ i) -` S \ space borel \ sets borel" - by (auto intro: borel_open) -qed - -lemma borel_measurable_euclidean_component: - fixes f :: "'a \ 'b::euclidean_space" - assumes f: "f \ borel_measurable M" - shows "(\x. f x $$ i) \ borel_measurable M" - using measurable_comp[OF f borel_measurable_euclidean_component'] by (simp add: comp_def) - lemma borel_measurable_euclidean_space: fixes f :: "'a \ 'c::ordered_euclidean_space" shows "f \ borel_measurable M \ (\ix. f x $$ i) \ borel_measurable M)" @@ -667,13 +602,6 @@ subsection "Borel measurable operators" -lemma borel_measurable_continuous_on1: - fixes f :: "'a::topological_space \ 'b::topological_space" - assumes "continuous_on UNIV f" - shows "f \ borel_measurable borel" - apply(rule borel_measurableI) - using continuous_open_preimage[OF assms] unfolding vimage_def by auto - lemma borel_measurable_continuous_on: fixes f :: "'a::topological_space \ 'b::topological_space" assumes f: "continuous_on UNIV f" and g: "g \ borel_measurable M" @@ -693,7 +621,7 @@ {x\A. f x \ S} \ (if c \ S then space borel - A else {})" by (auto split: split_if_asm) also have "\ \ sets borel" - using * `open A` by (auto simp del: space_borel intro!: Un) + using * `open A` by auto finally show "?f -` S \ space borel \ sets borel" . qed @@ -705,7 +633,7 @@ using measurable_comp[OF g borel_measurable_continuous_on_open'[OF cont], of c] by (simp add: comp_def) -lemma borel_measurable_uminus[simp, intro]: +lemma borel_measurable_uminus[simp, intro, measurable (raw)]: fixes g :: "'a \ real" assumes g: "g \ borel_measurable M" shows "(\x. - g x) \ borel_measurable M" @@ -716,7 +644,7 @@ shows "x $$ i = (if i < DIM('a) then fst x $$ i else snd x $$ (i - DIM('a)))" unfolding euclidean_component_def basis_prod_def inner_prod_def by auto -lemma borel_measurable_Pair[simp, intro]: +lemma borel_measurable_Pair[simp, intro, measurable (raw)]: fixes f :: "'a \ 'b::ordered_euclidean_space" and g :: "'a \ 'c::ordered_euclidean_space" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" @@ -726,7 +654,7 @@ have [simp]: "\P A B C. {w. (P \ A w \ B w) \ (\ P \ A w \ C w)} = {w. A w \ (P \ B w) \ (\ P \ C w)}" by auto from i f g show "{w \ space M. (f w, g w) $$ i \ a} \ sets M" - by (auto simp: euclidean_component_prod intro!: sets_Collect borel_measurable_euclidean_component) + by (auto simp: euclidean_component_prod) qed lemma continuous_on_fst: "continuous_on UNIV fst" @@ -757,7 +685,7 @@ unfolding eq by (rule borel_measurable_continuous_on[OF H]) auto qed -lemma borel_measurable_add[simp, intro]: +lemma borel_measurable_add[simp, intro, measurable (raw)]: fixes f g :: "'a \ 'c::ordered_euclidean_space" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" @@ -766,7 +694,7 @@ by (rule borel_measurable_continuous_Pair) (auto intro: continuous_on_fst continuous_on_snd continuous_on_add) -lemma borel_measurable_setsum[simp, intro]: +lemma borel_measurable_setsum[simp, intro, 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" @@ -775,14 +703,14 @@ thus ?thesis using assms by induct auto qed simp -lemma borel_measurable_diff[simp, intro]: +lemma borel_measurable_diff[simp, intro, measurable (raw)]: fixes f :: "'a \ real" 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 fast -lemma borel_measurable_times[simp, intro]: +lemma borel_measurable_times[simp, intro, measurable (raw)]: fixes f :: "'a \ real" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" @@ -796,7 +724,7 @@ shows "continuous_on A f \ continuous_on A g \ continuous_on A (\x. dist (f x) (g x))" unfolding continuous_on_eq_continuous_within by (auto simp: continuous_dist) -lemma borel_measurable_dist[simp, intro]: +lemma borel_measurable_dist[simp, intro, measurable (raw)]: fixes g f :: "'a \ 'b::ordered_euclidean_space" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" @@ -805,6 +733,14 @@ by (rule borel_measurable_continuous_Pair) (intro continuous_on_dist continuous_on_fst continuous_on_snd) +lemma borel_measurable_scaleR[measurable (raw)]: + fixes g :: "'a \ 'b::ordered_euclidean_space" + 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) + lemma affine_borel_measurable_vector: fixes f :: "'a \ 'x::real_normed_vector" assumes "f \ borel_measurable M" @@ -825,13 +761,15 @@ qed simp qed -lemma affine_borel_measurable: - fixes g :: "'a \ real" - assumes g: "g \ borel_measurable M" - shows "(\x. a + (g x) * b) \ borel_measurable M" - using affine_borel_measurable_vector[OF assms] by (simp add: mult_commute) +lemma borel_measurable_const_scaleR[measurable (raw)]: + "f \ borel_measurable M \ (\x. b *\<^sub>R f x ::'a::real_normed_vector) \ borel_measurable M" + using affine_borel_measurable_vector[of f M 0 b] by simp -lemma borel_measurable_setprod[simp, intro]: +lemma borel_measurable_const_add[measurable (raw)]: + "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[simp, intro, 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" @@ -840,7 +778,7 @@ thus ?thesis using assms by induct auto qed simp -lemma borel_measurable_inverse[simp, intro]: +lemma borel_measurable_inverse[simp, intro, measurable (raw)]: fixes f :: "'a \ real" assumes f: "f \ borel_measurable M" shows "(\x. inverse (f x)) \ borel_measurable M" @@ -853,7 +791,7 @@ done qed -lemma borel_measurable_divide[simp, intro]: +lemma borel_measurable_divide[simp, intro, measurable (raw)]: fixes f :: "'a \ real" assumes "f \ borel_measurable M" and "g \ borel_measurable M" @@ -861,21 +799,21 @@ unfolding field_divide_inverse by (rule borel_measurable_inverse borel_measurable_times assms)+ -lemma borel_measurable_max[intro, simp]: +lemma borel_measurable_max[intro, simp, measurable (raw)]: fixes f g :: "'a \ real" assumes "f \ borel_measurable M" assumes "g \ borel_measurable M" shows "(\x. max (g x) (f x)) \ borel_measurable M" unfolding max_def by (auto intro!: assms measurable_If) -lemma borel_measurable_min[intro, simp]: +lemma borel_measurable_min[intro, simp, measurable (raw)]: fixes f g :: "'a \ real" assumes "f \ borel_measurable M" assumes "g \ borel_measurable M" shows "(\x. min (g x) (f x)) \ borel_measurable M" unfolding min_def by (auto intro!: assms measurable_If) -lemma borel_measurable_abs[simp, intro]: +lemma borel_measurable_abs[simp, intro, measurable (raw)]: assumes "f \ borel_measurable M" shows "(\x. \f x :: real\) \ borel_measurable M" proof - @@ -883,7 +821,7 @@ show ?thesis unfolding * using assms by auto qed -lemma borel_measurable_nth[simp, intro]: +lemma borel_measurable_nth[simp, intro, measurable (raw)]: "(\x::real^'n. x $ i) \ borel_measurable borel" using borel_measurable_euclidean_component' unfolding nth_conv_component by auto @@ -900,12 +838,12 @@ from this q show "continuous_on {a<.. (\x. q (X x)) \ borel_measurable M" + also have "?qX \ (\x. q (X x)) \ borel_measurable M" using X by (intro measurable_cong) auto - ultimately show ?thesis by simp + finally show ?thesis . qed -lemma borel_measurable_ln[simp,intro]: +lemma borel_measurable_ln[simp, intro, measurable (raw)]: assumes f: "f \ borel_measurable M" shows "(\x. ln (f x)) \ borel_measurable M" proof - @@ -926,39 +864,55 @@ finally show ?thesis . qed -lemma borel_measurable_log[simp,intro]: - "f \ borel_measurable M \ (\x. log b (f x)) \ borel_measurable M" +lemma borel_measurable_log[simp, intro, measurable (raw)]: + "f \ borel_measurable M \ g \ borel_measurable M \ (\x. log (g x) (f x)) \ borel_measurable M" unfolding log_def by auto -lemma borel_measurable_real_floor: - "(\x::real. real \x\) \ borel_measurable borel" - unfolding borel_measurable_iff_ge -proof (intro allI) - fix a :: real - { fix x have "a \ real \x\ \ real \a\ \ x" - using le_floor_eq[of "\a\" x] ceiling_le_iff[of a "\x\"] - unfolding real_eq_of_int by simp } - then have "{w::real \ space borel. a \ real \w\} = {real \a\..}" by auto - then show "{w::real \ space borel. a \ real \w\} \ sets borel" by auto +lemma measurable_count_space_eq2_countable: + fixes f :: "'a => 'c::countable" + shows "f \ measurable M (count_space A) \ (f \ space M \ A \ (\a\A. f -` {a} \ space M \ sets M))" +proof - + { fix X assume "X \ A" "f \ space M \ A" + then have "f -` X \ space M = (\a\X. f -` {a} \ space M)" + by auto + moreover assume "\a. a\A \ f -` {a} \ space M \ sets M" + ultimately have "f -` X \ space M \ sets M" + using `X \ A` by (simp add: subset_eq del: UN_simps) } + then show ?thesis + unfolding measurable_def by auto qed -lemma borel_measurable_real_natfloor[intro, simp]: - assumes "f \ borel_measurable M" - shows "(\x. real (natfloor (f x))) \ borel_measurable M" +lemma measurable_real_floor[measurable]: + "(floor :: real \ int) \ measurable borel (count_space UNIV)" proof - - have "\x. real (natfloor (f x)) = max 0 (real \f x\)" - by (auto simp: max_def natfloor_def) - with borel_measurable_max[OF measurable_comp[OF assms borel_measurable_real_floor] borel_measurable_const] - show ?thesis by (simp add: comp_def) + have "\a x. \x\ = a \ (real a \ x \ x < real (a + 1))" + by (auto intro: floor_eq2) + then show ?thesis + by (auto simp: vimage_def measurable_count_space_eq2_countable) qed +lemma measurable_real_natfloor[measurable]: + "(natfloor :: real \ nat) \ measurable borel (count_space UNIV)" + by (simp add: natfloor_def[abs_def]) + +lemma measurable_real_ceiling[measurable]: + "(ceiling :: real \ int) \ measurable borel (count_space UNIV)" + unfolding ceiling_def[abs_def] by simp + +lemma borel_measurable_real_floor: "(\x::real. real \x\) \ borel_measurable borel" + by simp + +lemma borel_measurable_real_natfloor[intro, simp]: + "f \ borel_measurable M \ (\x. real (natfloor (f x))) \ borel_measurable M" + by simp + subsection "Borel space on the extended reals" -lemma borel_measurable_ereal[simp, intro]: +lemma borel_measurable_ereal[simp, intro, measurable (raw)]: assumes f: "f \ borel_measurable M" shows "(\x. ereal (f x)) \ borel_measurable M" using continuous_on_ereal f by (rule borel_measurable_continuous_on) -lemma borel_measurable_real_of_ereal[simp, intro]: +lemma borel_measurable_real_of_ereal[simp, intro, measurable (raw)]: fixes f :: "'a \ ereal" assumes f: "f \ borel_measurable M" shows "(\x. real (f x)) \ borel_measurable M" @@ -977,20 +931,16 @@ assumes H: "(\x. H (ereal (real (f x)))) \ borel_measurable M" shows "(\x. H (f x)) \ borel_measurable M" proof - - let ?F = "\x. if x \ f -` {\} then H \ else if x \ f -` {-\} then H (-\) else H (ereal (real (f x)))" + let ?F = "\x. if f x = \ then H \ else if f x = - \ then H (-\) else H (ereal (real (f x)))" { fix x have "H (f x) = ?F x" by (cases "f x") auto } - moreover - have "?F \ borel_measurable M" - by (intro measurable_If_set f measurable_sets[OF f] H) auto - ultimately - show ?thesis by simp + with f H show ?thesis by simp qed lemma fixes f :: "'a \ ereal" assumes f[simp]: "f \ borel_measurable M" - shows borel_measurable_ereal_abs[intro, simp]: "(\x. \f x\) \ borel_measurable M" - and borel_measurable_ereal_inverse[simp, intro]: "(\x. inverse (f x) :: ereal) \ borel_measurable M" - and borel_measurable_uminus_ereal[intro]: "(\x. - f x :: ereal) \ borel_measurable M" + shows borel_measurable_ereal_abs[intro, simp, measurable(raw)]: "(\x. \f x\) \ borel_measurable M" + and borel_measurable_ereal_inverse[simp, intro, measurable(raw)]: "(\x. inverse (f x) :: ereal) \ borel_measurable M" + and borel_measurable_uminus_ereal[intro, measurable(raw)]: "(\x. - f x :: ereal) \ borel_measurable M" by (auto simp del: abs_real_of_ereal simp: borel_measurable_ereal_cases[OF f] measurable_If) lemma borel_measurable_uminus_eq_ereal[simp]: @@ -999,44 +949,32 @@ assume ?l from borel_measurable_uminus_ereal[OF this] show ?r by simp qed auto -lemma sets_Collect_If_set: - assumes "A \ space M \ sets M" "{x \ space M. P x} \ sets M" "{x \ space M. Q x} \ sets M" - shows "{x \ space M. if x \ A then P x else Q x} \ sets M" -proof - - have *: "{x \ space M. if x \ A then P x else Q x} = - {x \ space M. if x \ A \ space M then P x else Q x}" by auto - show ?thesis unfolding * unfolding if_bool_eq_conj using assms - by (auto intro!: sets_Collect simp: Int_def conj_commute) -qed - lemma set_Collect_ereal2: fixes f g :: "'a \ ereal" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" assumes H: "{x \ space M. H (ereal (real (f x))) (ereal (real (g x)))} \ sets M" - "{x \ space M. H (-\) (ereal (real (g x)))} \ sets M" - "{x \ space M. H (\) (ereal (real (g x)))} \ sets M" - "{x \ space M. H (ereal (real (f x))) (-\)} \ sets M" - "{x \ space M. H (ereal (real (f x))) (\)} \ sets M" + "{x \ space borel. H (-\) (ereal x)} \ sets borel" + "{x \ space borel. H (\) (ereal x)} \ sets borel" + "{x \ space borel. H (ereal x) (-\)} \ sets borel" + "{x \ space borel. H (ereal x) (\)} \ sets borel" shows "{x \ space M. H (f x) (g x)} \ sets M" proof - - let ?G = "\y x. if x \ g -` {\} then H y \ else if x \ g -` {-\} then H y (-\) else H y (ereal (real (g x)))" - let ?F = "\x. if x \ f -` {\} then ?G \ x else if x \ f -` {-\} then ?G (-\) x else ?G (ereal (real (f x))) x" + let ?G = "\y x. if g x = \ then H y \ else if g x = -\ then H y (-\) else H y (ereal (real (g x)))" + let ?F = "\x. if f x = \ then ?G \ x else if f x = -\ then ?G (-\) x else ?G (ereal (real (f x))) x" { fix x have "H (f x) (g x) = ?F x" by (cases "f x" "g x" rule: ereal2_cases) auto } - moreover - have "{x \ space M. ?F x} \ sets M" - by (intro sets_Collect H measurable_sets[OF f] measurable_sets[OF g] sets_Collect_If_set) auto - ultimately - show ?thesis by simp + note * = this + from assms show ?thesis + by (subst *) (simp del: space_borel split del: split_if) qed lemma fixes f g :: "'a \ ereal" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" - shows borel_measurable_ereal_le[intro,simp]: "{x \ space M. f x \ g x} \ sets M" - and borel_measurable_ereal_less[intro,simp]: "{x \ space M. f x < g x} \ sets M" - and borel_measurable_ereal_eq[intro,simp]: "{w \ space M. f w = g w} \ sets M" + shows borel_measurable_ereal_le[intro,simp,measurable(raw)]: "{x \ space M. f x \ g x} \ sets M" + and borel_measurable_ereal_less[intro,simp,measurable(raw)]: "{x \ space M. f x < g x} \ sets M" + and borel_measurable_ereal_eq[intro,simp,measurable(raw)]: "{w \ space M. f w = g w} \ sets M" and borel_measurable_ereal_neq[intro,simp]: "{w \ space M. f w \ g w} \ sets M" using f g by (auto simp: f g set_Collect_ereal2[OF f g] intro!: sets_Collect_neg) @@ -1060,7 +998,7 @@ have "?f \ borel_measurable M" using * ** by (intro measurable_If) auto also have "?f = f" by (auto simp: fun_eq_iff ereal_real) finally show "f \ borel_measurable M" . -qed (auto intro: measurable_sets borel_measurable_real_of_ereal) +qed simp_all lemma borel_measurable_eq_atMost_ereal: fixes f :: "'a \ ereal" @@ -1080,7 +1018,8 @@ qed } then have "f -` {\} \ space M = space M - (\i::nat. f -` {.. real i} \ space M)" by (auto simp: not_le) - then show "f -` {\} \ space M \ sets M" using pos by (auto simp del: UN_simps intro!: Diff) + then show "f -` {\} \ space M \ sets M" using pos + by (auto simp del: UN_simps) moreover have "{-\::ereal} = {..-\}" by auto then show "f -` {-\} \ space M \ sets M" using pos by auto @@ -1150,14 +1089,11 @@ "(\x. H (ereal (real (f x))) (\)) \ borel_measurable M" shows "(\x. H (f x) (g x)) \ borel_measurable M" proof - - let ?G = "\y x. if x \ g -` {\} then H y \ else if x \ g -` {-\} then H y (-\) else H y (ereal (real (g x)))" - let ?F = "\x. if x \ f -` {\} then ?G \ x else if x \ f -` {-\} then ?G (-\) x else ?G (ereal (real (f x))) x" + let ?G = "\y x. if g x = \ then H y \ else if g x = - \ then H y (-\) else H y (ereal (real (g x)))" + let ?F = "\x. if f x = \ then ?G \ x else if f x = - \ then ?G (-\) x else ?G (ereal (real (f x))) x" { fix x have "H (f x) (g x) = ?F x" by (cases "f x" "g x" rule: ereal2_cases) auto } - moreover - have "?F \ borel_measurable M" - by (intro measurable_If_set measurable_sets[OF f] measurable_sets[OF g] H) auto - ultimately - show ?thesis by simp + note * = this + from assms show ?thesis unfolding * by simp qed lemma @@ -1166,29 +1102,24 @@ and borel_measurable_ereal_neq_const: "{x\space M. f x \ c} \ sets M" using f by auto -lemma split_sets: - "{x\space M. P x \ Q x} = {x\space M. P x} \ {x\space M. Q x}" - "{x\space M. P x \ Q x} = {x\space M. P x} \ {x\space M. Q x}" - by auto - -lemma +lemma [intro, simp, measurable(raw)]: fixes f :: "'a \ ereal" assumes [simp]: "f \ borel_measurable M" "g \ borel_measurable M" - shows borel_measurable_ereal_add[intro, simp]: "(\x. f x + g x) \ borel_measurable M" - and borel_measurable_ereal_times[intro, simp]: "(\x. f x * g x) \ borel_measurable M" - and borel_measurable_ereal_min[simp, intro]: "(\x. min (g x) (f x)) \ borel_measurable M" - and borel_measurable_ereal_max[simp, intro]: "(\x. max (g x) (f x)) \ borel_measurable M" + shows borel_measurable_ereal_add: "(\x. f x + g x) \ borel_measurable M" + and borel_measurable_ereal_times: "(\x. f x * g x) \ borel_measurable M" + and borel_measurable_ereal_min: "(\x. min (g x) (f x)) \ borel_measurable M" + and borel_measurable_ereal_max: "(\x. max (g x) (f x)) \ borel_measurable M" by (auto simp add: borel_measurable_ereal2 measurable_If min_def max_def) -lemma +lemma [simp, intro, measurable(raw)]: fixes f g :: "'a \ ereal" assumes "f \ borel_measurable M" assumes "g \ borel_measurable M" - shows borel_measurable_ereal_diff[simp, intro]: "(\x. f x - g x) \ borel_measurable M" - and borel_measurable_ereal_divide[simp, intro]: "(\x. f x / g x) \ borel_measurable M" + shows borel_measurable_ereal_diff: "(\x. f x - g x) \ borel_measurable M" + and borel_measurable_ereal_divide: "(\x. f x / g x) \ borel_measurable M" unfolding minus_ereal_def divide_ereal_def using assms by auto -lemma borel_measurable_ereal_setsum[simp, intro]: +lemma borel_measurable_ereal_setsum[simp, intro,measurable (raw)]: fixes f :: "'c \ 'a \ ereal" assumes "\i. i \ S \ f i \ borel_measurable M" shows "(\x. \i\S. f i x) \ borel_measurable M" @@ -1198,7 +1129,7 @@ by induct auto qed simp -lemma borel_measurable_ereal_setprod[simp, intro]: +lemma borel_measurable_ereal_setprod[simp, intro,measurable (raw)]: fixes f :: "'c \ 'a \ ereal" assumes "\i. i \ S \ f i \ borel_measurable M" shows "(\x. \i\S. f i x) \ borel_measurable M" @@ -1207,7 +1138,7 @@ thus ?thesis using assms by induct auto qed simp -lemma borel_measurable_SUP[simp, intro]: +lemma borel_measurable_SUP[simp, intro,measurable (raw)]: fixes f :: "'d\countable \ 'a \ ereal" assumes "\i. i \ A \ f i \ borel_measurable M" shows "(\x. SUP i : A. f i x) \ borel_measurable M" (is "?sup \ borel_measurable M") @@ -1220,7 +1151,7 @@ using assms by auto qed -lemma borel_measurable_INF[simp, intro]: +lemma borel_measurable_INF[simp, intro,measurable (raw)]: fixes f :: "'d :: countable \ 'a \ ereal" assumes "\i. i \ A \ f i \ borel_measurable M" shows "(\x. INF i : A. f i x) \ borel_measurable M" (is "?inf \ borel_measurable M") @@ -1233,11 +1164,11 @@ using assms by auto qed -lemma +lemma [simp, intro, measurable (raw)]: fixes f :: "nat \ 'a \ ereal" assumes "\i. f i \ borel_measurable M" - shows borel_measurable_liminf[simp, intro]: "(\x. liminf (\i. f i x)) \ borel_measurable M" - and borel_measurable_limsup[simp, intro]: "(\x. limsup (\i. f i x)) \ borel_measurable M" + shows borel_measurable_liminf: "(\x. liminf (\i. f i x)) \ borel_measurable M" + and borel_measurable_limsup: "(\x. limsup (\i. f i x)) \ borel_measurable M" unfolding liminf_SUPR_INFI limsup_INFI_SUPR using assms by auto lemma borel_measurable_ereal_LIMSEQ: @@ -1251,7 +1182,7 @@ then show ?thesis by (simp add: u cong: measurable_cong) qed -lemma borel_measurable_psuminf[simp, intro]: +lemma borel_measurable_psuminf[simp, intro, measurable (raw)]: fixes f :: "nat \ 'a \ ereal" assumes "\i. f i \ borel_measurable M" and pos: "\i x. x \ space M \ 0 \ f i x" shows "(\x. (\i. f i x)) \ borel_measurable M" @@ -1275,38 +1206,38 @@ ultimately show ?thesis by (simp cong: measurable_cong add: borel_measurable_ereal_iff) qed -lemma sets_Collect_Cauchy: +lemma sets_Collect_Cauchy[measurable]: fixes f :: "nat \ 'a => real" - assumes f: "\i. f i \ borel_measurable M" + assumes f[measurable]: "\i. f i \ borel_measurable M" shows "{x\space M. Cauchy (\i. f i x)} \ sets M" - unfolding Cauchy_iff2 using f by (auto intro!: sets_Collect) + unfolding Cauchy_iff2 using f by auto -lemma borel_measurable_lim: +lemma borel_measurable_lim[measurable (raw)]: fixes f :: "nat \ 'a \ real" - assumes f: "\i. f i \ borel_measurable M" + assumes f[measurable]: "\i. f i \ borel_measurable M" shows "(\x. lim (\i. f i x)) \ borel_measurable M" proof - - have *: "\x. lim (\i. f i x) = - (if Cauchy (\i. f i x) then lim (\i. if Cauchy (\i. f i x) then f i x else 0) else (THE x. False))" + def u' \ "\x. lim (\i. if Cauchy (\i. f i x) then f i x else 0)" + then have *: "\x. lim (\i. f i x) = (if Cauchy (\i. f i x) then u' x else (THE x. False))" by (auto simp: lim_def convergent_eq_cauchy[symmetric]) - { fix x have "convergent (\i. if Cauchy (\i. f i x) then f i x else 0)" + have "u' \ borel_measurable M" + proof (rule borel_measurable_LIMSEQ) + fix x + have "convergent (\i. if Cauchy (\i. f i x) then f i x else 0)" by (cases "Cauchy (\i. f i x)") - (auto simp add: convergent_eq_cauchy[symmetric] convergent_def) } - note convergent = this - show ?thesis - unfolding * - apply (intro measurable_If sets_Collect_Cauchy f borel_measurable_const) - apply (rule borel_measurable_LIMSEQ) - apply (rule convergent_LIMSEQ_iff[THEN iffD1, OF convergent]) - apply (intro measurable_If sets_Collect_Cauchy f borel_measurable_const) - done + (auto simp add: convergent_eq_cauchy[symmetric] convergent_def) + then show "(\i. if Cauchy (\i. f i x) then f i x else 0) ----> u' x" + unfolding u'_def + by (rule convergent_LIMSEQ_iff[THEN iffD1]) + qed measurable + then show ?thesis + unfolding * by measurable qed -lemma borel_measurable_suminf: +lemma borel_measurable_suminf[measurable (raw)]: fixes f :: "nat \ 'a \ real" - assumes f: "\i. f i \ borel_measurable M" + assumes f[measurable]: "\i. f i \ borel_measurable M" shows "(\x. suminf (\i. f i x)) \ borel_measurable M" - unfolding suminf_def sums_def[abs_def] lim_def[symmetric] - by (simp add: f borel_measurable_lim) + unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp end diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Information.thy Fri Nov 02 14:23:40 2012 +0100 @@ -446,7 +446,7 @@ shows "integrable T (\x. Py x * log b (Px (f x)))" using assms unfolding finite_entropy_def using distributed_transform_integrable[of M T Y Py S X Px f "\x. log b (Px x)"] - by (auto intro: distributed_real_measurable) + by (auto dest!: distributed_real_measurable) subsection {* Mutual Information *} @@ -1578,7 +1578,7 @@ have "random_variable (count_space (X ` space M)) X" by (simp add: comp_def) then have "simple_function M X" - unfolding simple_function_def by auto + unfolding simple_function_def by (auto simp: measurable_count_space_eq2) then have "simple_distributed M X ?Px" by (rule simple_distributedI) auto then show "distributed M (count_space (X ` space M)) X ?Px" diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Fri Nov 02 14:23:40 2012 +0100 @@ -70,7 +70,7 @@ have "g -` X \ space M = g -` (X \ g`space M) \ space M" by auto also have "\ = (\x\X \ g`space M. g-`{x} \ space M)" by auto finally show "g -` X \ space M \ sets M" using assms - by (auto intro!: finite_UN simp del: UN_simps simp: simple_function_def) + by (auto simp del: UN_simps simp: simple_function_def) qed lemma simple_function_measurable2[intro]: @@ -167,7 +167,7 @@ (\x\?G. f -` {x} \ space M)" by auto show "(g \ f) -` {(g \ f) x} \ space M \ sets M" using assms unfolding simple_function_def * - by (rule_tac finite_UN) (auto intro!: finite_UN) + by (rule_tac finite_UN) auto qed lemma simple_function_indicator[intro, simp]: @@ -1210,7 +1210,7 @@ case (insert i P) then have "f i \ borel_measurable M" "AE x in M. 0 \ f i x" "(\x. \i\P. f i x) \ borel_measurable M" "AE x in M. 0 \ (\i\P. f i x)" - by (auto intro!: borel_measurable_ereal_setsum setsum_nonneg) + by (auto intro!: setsum_nonneg) from positive_integral_add[OF this] show ?case using insert by auto qed simp @@ -1230,7 +1230,7 @@ simp: indicator_def ereal_zero_le_0_iff) also have "\ = c * (\\<^isup>+ x. u x * indicator A x \M)" using assms - by (auto intro!: positive_integral_cmult borel_measurable_indicator simp: ereal_zero_le_0_iff) + by (auto intro!: positive_integral_cmult simp: ereal_zero_le_0_iff) finally show ?thesis . qed @@ -1633,7 +1633,7 @@ lemma integral_zero[simp, intro]: shows "integrable M (\x. 0)" "(\ x.0 \M) = 0" unfolding integrable_def lebesgue_integral_def - by (auto simp add: borel_measurable_const) + by auto lemma integral_cmult[simp, intro]: assumes "integrable M f" @@ -1644,7 +1644,7 @@ proof (cases rule: le_cases) assume "0 \ a" show ?thesis using integral_linear[OF assms integral_zero(1) `0 \ a`] - by (simp add: integral_zero) + by simp next assume "a \ 0" hence "0 \ - a" by auto have *: "\t. - a * t + 0 = (-a) * t" by simp @@ -1718,7 +1718,7 @@ by (auto split: split_indicator simp: positive_integral_0_iff_AE one_ereal_def) show ?int ?able using assms unfolding lebesgue_integral_def integrable_def - by (auto simp: * positive_integral_indicator borel_measurable_indicator) + by (auto simp: *) qed lemma integral_cmul_indicator: @@ -1850,7 +1850,7 @@ assumes "integrable M f" "\x. x \ space M \ 0 \ f x" shows "0 \ integral\<^isup>L M f" proof - - have "0 = (\x. 0 \M)" by (auto simp: integral_zero) + have "0 = (\x. 0 \M)" by auto also have "\ \ integral\<^isup>L M f" using assms by (rule integral_mono[OF integral_zero(1)]) finally show ?thesis . @@ -2206,7 +2206,7 @@ let ?F = "\n y. (\i = 0..f i y\)" let ?w' = "\n y. if y \ space M then ?F n y else 0" have "\n. integrable M (?F n)" - using borel by (auto intro!: integral_setsum integrable_abs) + using borel by (auto intro!: integrable_abs) thus "\n. integrable M (?w' n)" by (simp cong: integrable_cong) show "AE x in M. mono (\n. ?w' n x)" by (auto simp: mono_def le_fun_def intro!: setsum_mono2) @@ -2436,7 +2436,7 @@ by (subst density_max_0) (auto intro!: arg_cong[where f="density M"] split: split_max) lemma emeasure_density: - assumes f: "f \ borel_measurable M" and A: "A \ sets M" + assumes f[measurable]: "f \ borel_measurable M" and A[measurable]: "A \ sets M" shows "emeasure (density M f) A = (\\<^isup>+ x. f x * indicator A x \M)" (is "_ = ?\ A") unfolding density_def @@ -2453,8 +2453,9 @@ unfolding \_eq proof (intro countably_additiveI) fix A :: "nat \ 'a set" assume "range A \ sets M" + then have "\i. A i \ sets M" by auto then have *: "\i. (\x. max 0 (f x) * indicator (A i) x) \ borel_measurable M" - using f by (auto intro!: borel_measurable_ereal_times) + by (auto simp: set_eq_iff) assume disj: "disjoint_family A" have "(\n. ?\' (A n)) = (\\<^isup>+ x. (\n. max 0 (f x) * indicator (A n) x) \M)" using f * by (simp add: positive_integral_suminf) @@ -2483,8 +2484,7 @@ by (intro positive_integral_0_iff) auto also have "\ \ (AE x in M. max 0 (f x) * indicator A x = 0)" using f `A \ sets M` - by (intro AE_iff_measurable[OF _ refl, symmetric]) - (auto intro!: sets_Collect borel_measurable_ereal_eq) + by (intro AE_iff_measurable[OF _ refl, symmetric]) auto also have "(AE x in M. max 0 (f x) * indicator A x = 0) \ (AE x in M. x \ A \ f x \ 0)" by (auto simp add: indicator_def max_def split: split_if_asm) finally have "(\\<^isup>+x. f x * indicator A x \M) = 0 \ (AE x in M. x \ A \ f x \ 0)" . } @@ -2649,7 +2649,7 @@ "finite A \ g \ measurable M (point_measure A f) \ (g \ space M \ A \ (\a\A. g -` {a} \ space M \ sets M))" - unfolding point_measure_def by simp + unfolding point_measure_def by (simp add: measurable_count_space_eq2) lemma simple_function_point_measure[simp]: "simple_function (point_measure A f) g \ finite (g ` A)" diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Measure_Space.thy --- a/src/HOL/Probability/Measure_Space.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Measure_Space.thy Fri Nov 02 14:23:40 2012 +0100 @@ -447,14 +447,14 @@ lemma emeasure_Diff: assumes finite: "emeasure M B \ \" - and measurable: "A \ sets M" "B \ sets M" "B \ A" + and [measurable]: "A \ sets M" "B \ sets M" and "B \ A" shows "emeasure M (A - B) = emeasure M A - emeasure M B" proof - have "0 \ emeasure M B" using assms by auto have "(A - B) \ B = A" using `B \ A` by auto then have "emeasure M A = emeasure M ((A - B) \ B)" by simp also have "\ = emeasure M (A - B) + emeasure M B" - using measurable by (subst plus_emeasure[symmetric]) auto + by (subst plus_emeasure[symmetric]) auto finally show "emeasure M (A - B) = emeasure M A - emeasure M B" unfolding ereal_eq_minus_iff using finite `0 \ emeasure M B` by auto @@ -519,12 +519,11 @@ using INF_emeasure_decseq[OF A fin] by simp lemma emeasure_subadditive: - assumes measurable: "A \ sets M" "B \ sets M" + assumes [measurable]: "A \ sets M" "B \ sets M" shows "emeasure M (A \ B) \ emeasure M A + emeasure M B" proof - from plus_emeasure[of A M "B - A"] - have "emeasure M (A \ B) = emeasure M A + emeasure M (B - A)" - using assms by (simp add: Diff) + have "emeasure M (A \ B) = emeasure M A + emeasure M (B - A)" by simp also have "\ \ emeasure M A + emeasure M B" using assms by (auto intro!: add_left_mono emeasure_mono) finally show ?thesis . @@ -538,7 +537,7 @@ then have "emeasure M (\i\insert i I. A i) = emeasure M (A i \ (\i\I. A i))" by simp also have "\ \ emeasure M (A i) + emeasure M (\i\I. A i)" - using insert by (intro emeasure_subadditive finite_UN) auto + using insert by (intro emeasure_subadditive) auto also have "\ \ emeasure M (A i) + (\i\I. emeasure M (A i))" using insert by (intro add_mono) auto also have "\ = (\i\insert i I. emeasure M (A i))" @@ -688,18 +687,17 @@ by (auto simp: subset_eq) have "disjoint_family ?D" by (auto simp: disjoint_family_disjointed) - moreover - { fix i + moreover + have "(\i. emeasure M (?D i)) = (\i. emeasure N (?D i))" + proof (intro arg_cong[where f=suminf] ext) + fix i have "A i \ ?D i = ?D i" by (auto simp: disjointed_def) - then have "emeasure M (?D i) = emeasure N (?D i)" - using *[of "A i" "?D i", OF _ A(3)] A(1) by auto } - ultimately show "emeasure M F = emeasure N F" - using N M - apply (subst (1 2) F_eq) - apply (subst (1 2) suminf_emeasure[symmetric]) - apply auto - done + then show "emeasure M (?D i) = emeasure N (?D i)" + using *[of "A i" "?D i", OF _ A(3)] A(1) by auto + qed + ultimately show "emeasure M F = emeasure N F" + by (simp add: image_subset_iff `sets M = sets N`[symmetric] F_eq[symmetric] suminf_emeasure) qed qed @@ -1112,32 +1110,23 @@ qed lemma AE_distr_iff: - assumes f: "f \ measurable M N" and P: "{x \ space N. P x} \ sets N" + assumes f[measurable]: "f \ measurable M N" and P[measurable]: "{x \ space N. P x} \ sets N" shows "(AE x in distr M N f. P x) \ (AE x in M. P (f x))" proof (subst (1 2) AE_iff_measurable[OF _ refl]) - from P show "{x \ space (distr M N f). \ P x} \ sets (distr M N f)" - by (auto intro!: sets_Collect_neg) - moreover - have "f -` {x \ space N. P x} \ space M = {x \ space M. P (f x)}" - using f by (auto dest: measurable_space) - then show "{x \ space M. \ P (f x)} \ sets M" - using measurable_sets[OF f P] by (auto intro!: sets_Collect_neg) - moreover have "f -` {x\space N. \ P x} \ space M = {x \ space M. \ P (f x)}" - using f by (auto dest: measurable_space) - ultimately show "(emeasure (distr M N f) {x \ space (distr M N f). \ P x} = 0) = + have "f -` {x\space N. \ P x} \ space M = {x \ space M. \ P (f x)}" + using f[THEN measurable_space] by auto + then show "(emeasure (distr M N f) {x \ space (distr M N f). \ P x} = 0) = (emeasure M {x \ space M. \ P (f x)} = 0)" - using f by (simp add: emeasure_distr) -qed + by (simp add: emeasure_distr) +qed auto lemma null_sets_distr_iff: "f \ measurable M N \ A \ null_sets (distr M N f) \ f -` A \ space M \ null_sets M \ A \ sets N" - by (auto simp add: null_sets_def emeasure_distr measurable_sets) + by (auto simp add: null_sets_def emeasure_distr) lemma distr_distr: - assumes f: "g \ measurable N L" and g: "f \ measurable M N" - shows "distr (distr M N f) L g = distr M L (g \ f)" (is "?L = ?R") - using measurable_comp[OF g f] f g - by (auto simp add: emeasure_distr measurable_sets measurable_space + "g \ measurable N L \ f \ measurable M N \ distr (distr M N f) L g = distr M L (g \ f)" + by (auto simp add: emeasure_distr measurable_space intro!: arg_cong[where f="emeasure M"] measure_eqI) section {* Real measure values *} @@ -1381,33 +1370,6 @@ section {* Counting space *} -definition count_space :: "'a set \ 'a measure" where - "count_space \ = measure_of \ (Pow \) (\A. if finite A then ereal (card A) else \)" - -lemma - shows space_count_space[simp]: "space (count_space \) = \" - and sets_count_space[simp]: "sets (count_space \) = Pow \" - using sigma_sets_into_sp[of "Pow \" \] - by (auto simp: count_space_def) - -lemma measurable_count_space_eq1[simp]: - "f \ measurable (count_space A) M \ f \ A \ space M" - unfolding measurable_def by simp - -lemma measurable_count_space_eq2[simp]: - assumes "finite A" - shows "f \ measurable M (count_space A) \ (f \ space M \ A \ (\a\A. f -` {a} \ space M \ sets M))" -proof - - { fix X assume "X \ A" "f \ space M \ A" - with `finite A` have "f -` X \ space M = (\a\X. f -` {a} \ space M)" "finite X" - by (auto dest: finite_subset) - moreover assume "\a\A. f -` {a} \ space M \ sets M" - ultimately have "f -` X \ space M \ sets M" - using `X \ A` by (auto intro!: finite_UN simp del: UN_simps) } - then show ?thesis - unfolding measurable_def by auto -qed - lemma strict_monoI_Suc: assumes ord [simp]: "(\n. f n < f (Suc n))" shows "strict_mono f" unfolding strict_mono_def diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Probability_Measure.thy Fri Nov 02 14:23:40 2012 +0100 @@ -876,7 +876,7 @@ then have "a \ X`space M \ X -` {a} \ space M = {}" by auto with A a X have "emeasure (distr M S X) {a} = P' a" by (subst emeasure_distr) - (auto simp add: S_def P'_def simple_functionD emeasure_eq_measure + (auto simp add: S_def P'_def simple_functionD emeasure_eq_measure measurable_count_space_eq2 intro!: arg_cong[where f=prob]) also have "\ = (\\<^isup>+x. ereal (P' a) * indicator {a} x \S)" using A X a @@ -934,7 +934,7 @@ lemma simple_distributed_simple_function: "simple_distributed M X Px \ simple_function M X" unfolding simple_distributed_def distributed_def - by (auto simp: simple_function_def) + by (auto simp: simple_function_def measurable_count_space_eq2) lemma simple_distributed_measure: "simple_distributed M X P \ a \ X`space M \ P a = measure M (X -` {a} \ space M)" diff -r 382bd3173584 -r ce0d316b5b44 src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Fri Nov 02 14:00:39 2012 +0100 +++ b/src/HOL/Probability/Sigma_Algebra.thy Fri Nov 02 14:23:40 2012 +0100 @@ -100,7 +100,7 @@ with assms show ?thesis by auto qed -lemma (in semiring_of_sets) sets_Collect_finite_All: +lemma (in semiring_of_sets) sets_Collect_finite_All': assumes "\i. i \ S \ {x\\. P i x} \ M" "finite S" "S \ {}" shows "{x\\. \i\S. P i x} \ M" proof - @@ -1209,6 +1209,15 @@ "f \ measurable M A \ S \ sets A \ f -` S \ space M \ sets M" unfolding measurable_def by auto +lemma measurable_sets_Collect: + assumes f: "f \ measurable M N" and P: "{x\space N. P x} \ sets N" shows "{x\space M. P (f x)} \ sets M" +proof - + have "f -` {x \ space N. P x} \ space M = {x\space M. P (f x)}" + using measurable_space[OF f] by auto + with measurable_sets[OF f P] show ?thesis + by simp +qed + lemma measurable_sigma_sets: assumes B: "sets N = sigma_sets \ A" "A \ Pow \" and f: "f \ space M \ \" @@ -1302,6 +1311,9 @@ lemma measurable_ident[intro, simp]: "id \ measurable M M" by (auto simp add: measurable_def) +lemma measurable_ident'[intro, simp]: "(\x. x) \ measurable M M" + by (auto simp add: measurable_def) + lemma measurable_comp[intro]: fixes f :: "'a \ 'b" and g :: "'b \ 'c" shows "f \ measurable a b \ g \ measurable b c \ (g o f) \ measurable a c" @@ -1314,7 +1326,7 @@ "f \ measurable M N \ g \ measurable N L \ (\x. g (f x)) \ measurable M L" using measurable_comp[of f M N g L] by (simp add: comp_def) -lemma measurable_Least: +lemma sets_Least: assumes meas: "\i::nat. {x\space M. P i x} \ M" shows "(\x. LEAST j. P j x) -` A \ space M \ sets M" proof - @@ -1371,6 +1383,368 @@ measurable (measure_of \ M \) N \ measurable (measure_of \ M' \') N" using measure_of_subset[of M' \ M] by (auto simp add: measurable_def) +section {* Counting space *} + +definition count_space :: "'a set \ 'a measure" where + "count_space \ = measure_of \ (Pow \) (\A. if finite A then ereal (card A) else \)" + +lemma + shows space_count_space[simp]: "space (count_space \) = \" + and sets_count_space[simp]: "sets (count_space \) = Pow \" + using sigma_sets_into_sp[of "Pow \" \] + by (auto simp: count_space_def) + +lemma measurable_count_space_eq1[simp]: + "f \ measurable (count_space A) M \ f \ A \ space M" + unfolding measurable_def by simp + +lemma measurable_count_space_eq2: + assumes "finite A" + shows "f \ measurable M (count_space A) \ (f \ space M \ A \ (\a\A. f -` {a} \ space M \ sets M))" +proof - + { fix X assume "X \ A" "f \ space M \ A" + with `finite A` have "f -` X \ space M = (\a\X. f -` {a} \ space M)" "finite X" + by (auto dest: finite_subset) + moreover assume "\a\A. f -` {a} \ space M \ sets M" + ultimately have "f -` X \ space M \ sets M" + using `X \ A` by (auto intro!: finite_UN simp del: UN_simps) } + then show ?thesis + unfolding measurable_def by auto +qed + +lemma measurable_compose_countable: + assumes f: "\i::'i::countable. (\x. f i x) \ measurable M N" and g: "g \ measurable M (count_space UNIV)" + shows "(\x. f (g x) x) \ measurable M N" + unfolding measurable_def +proof safe + fix x assume "x \ space M" then show "f (g x) x \ space N" + using f[THEN measurable_space] g[THEN measurable_space] by auto +next + fix A assume A: "A \ sets N" + have "(\x. f (g x) x) -` A \ space M = (\i. (g -` {i} \ space M) \ (f i -` A \ space M))" + by auto + also have "\ \ sets M" using f[THEN measurable_sets, OF A] g[THEN measurable_sets] + by (auto intro!: countable_UN measurable_sets) + finally show "(\x. f (g x) x) -` A \ space M \ sets M" . +qed + +subsection {* Measurable method *} + +lemma (in algebra) sets_Collect_finite_All: + assumes "\i. i \ S \ {x\\. P i x} \ M" "finite S" + shows "{x\\. \i\S. P i x} \ M" +proof - + have "{x\\. \i\S. P i x} = (if S = {} then \ else \i\S. {x\\. P i x})" + by auto + with assms show ?thesis by (auto intro!: sets_Collect_finite_All') +qed + +abbreviation "pred M P \ P \ measurable M (count_space (UNIV::bool set))" + +lemma pred_def: "pred M P \ {x\space M. P x} \ sets M" +proof + assume "pred M P" + then have "P -` {True} \ space M \ sets M" + by (auto simp: measurable_count_space_eq2) + also have "P -` {True} \ space M = {x\space M. P x}" by auto + finally show "{x\space M. P x} \ sets M" . +next + assume P: "{x\space M. P x} \ sets M" + moreover + { fix X + have "X \ Pow (UNIV :: bool set)" by simp + then have "P -` X \ space M = {x\space M. ((X = {True} \ P x) \ (X = {False} \ \ P x) \ X \ {})}" + unfolding UNIV_bool Pow_insert Pow_empty by auto + then have "P -` X \ space M \ sets M" + by (auto intro!: sets_Collect_neg sets_Collect_imp sets_Collect_conj sets_Collect_const P) } + then show "pred M P" + by (auto simp: measurable_def) +qed + +lemma pred_sets1: "{x\space M. P x} \ sets M \ f \ measurable N M \ pred N (\x. P (f x))" + by (rule measurable_compose[where f=f and N=M]) (auto simp: pred_def) + +lemma pred_sets2: "A \ sets N \ f \ measurable M N \ pred M (\x. f x \ A)" + by (rule measurable_compose[where f=f and N=N]) (auto simp: pred_def Int_def[symmetric]) + +lemma measurable_count_space_const: + "(\x. c) \ measurable M (count_space UNIV)" + by auto + +lemma measurable_count_space: + "f \ measurable (count_space A) (count_space UNIV)" + by simp + +lemma measurable_compose_rev: + assumes f: "f \ measurable L N" and g: "g \ measurable M L" + shows "(\x. f (g x)) \ measurable M N" + using measurable_compose[OF g f] . + +ML {* + +structure Measurable = +struct + +datatype level = Concrete | Generic; + +structure Data = Generic_Data +( + type T = thm list * thm list; + val empty = ([], []); + val extend = I; + val merge = fn ((a, b), (c, d)) => (a @ c, b @ d); +); + +val debug = + Attrib.setup_config_bool @{binding measurable_debug} (K false) + +val backtrack = + Attrib.setup_config_int @{binding measurable_backtrack} (K 40) + +fun get lv = (case lv of Concrete => fst | Generic => snd) o Data.get o Context.Proof; +fun get_all ctxt = get Concrete ctxt @ get Generic ctxt; + +fun update f lv = Data.map (case lv of Concrete => apfst f | Generic => apsnd f); +fun add thms' = update (fn thms => thms @ thms'); + +fun TRYALL' tacs = fold_rev (curry op APPEND') tacs (K no_tac); + +fun is_too_generic thm = + let + val concl = concl_of thm + val concl' = HOLogic.dest_Trueprop concl handle TERM _ => concl + in is_Var (head_of concl') end + +fun import_theorem thm = if is_too_generic thm then [] else + [thm] @ map_filter (try (fn th' => thm RS th')) + [@{thm measurable_compose_rev}, @{thm pred_sets1}, @{thm pred_sets2}, @{thm sets_into_space}]; + +fun add_thm (raw, lv) thm = add (if raw then [thm] else import_theorem thm) lv; + +fun debug_tac ctxt msg f = if Config.get ctxt debug then K (print_tac (msg ())) THEN' f else f + +fun TAKE n f thm = Seq.take n (f thm) + +fun nth_hol_goal thm i = + HOLogic.dest_Trueprop (Logic.strip_imp_concl (strip_all_body (nth (prems_of thm) (i - 1)))) + +fun dest_measurable_fun t = + (case t of + (Const (@{const_name "Set.member"}, _) $ f $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => f + | _ => raise (TERM ("not a measurability predicate", [t]))) + +fun indep (Bound i) t b = i < b orelse t <= i + | indep (f $ t) top bot = indep f top bot andalso indep t top bot + | indep (Abs (_,_,t)) top bot = indep t (top + 1) (bot + 1) + | indep _ _ _ = true; + +fun cnt_prefixes ctxt (Abs (n, T, t)) = let + fun is_countable t = Type.of_sort (Proof_Context.tsig_of ctxt) (t, @{sort countable}) + fun cnt_walk (Abs (ns, T, t)) Ts = + map (fn (t', t'') => (Abs (ns, T, t'), t'')) (cnt_walk t (T::Ts)) + | cnt_walk (f $ g) Ts = let + val n = length Ts - 1 + in + map (fn (f', t) => (f' $ g, t)) (cnt_walk f Ts) @ + map (fn (g', t) => (f $ g', t)) (cnt_walk g Ts) @ + (if is_countable (fastype_of1 (Ts, g)) andalso loose_bvar1 (g, n) + andalso indep g n 0 andalso g <> Bound n + then [(f $ Bound (n + 1), incr_boundvars (~ n) g)] + else []) + end + | cnt_walk _ _ = [] + in map (fn (t1, t2) => let + val T1 = fastype_of1 ([T], t2) + val T2 = fastype_of1 ([T], t) + in ([SOME (Abs (n, T1, Abs (n, T, t1))), NONE, NONE, SOME (Abs (n, T, t2))], + [SOME T1, SOME T, SOME T2]) + end) (cnt_walk t [T]) + end + | cnt_prefixes _ _ = [] + +val split_fun_tac = + Subgoal.FOCUS (fn {context = ctxt, ...} => SUBGOAL (fn (t, i) => + let + val f = dest_measurable_fun (HOLogic.dest_Trueprop t) + fun cert f = map (Option.map (f (Proof_Context.theory_of ctxt))) + fun inst t (ts, Ts) = Drule.instantiate' (cert ctyp_of Ts) (cert cterm_of ts) t + val cps = cnt_prefixes ctxt f |> map (inst @{thm measurable_compose_countable}) + in if null cps then no_tac else debug_tac ctxt (K "split fun") (resolve_tac cps) i end + handle TERM _ => no_tac) 1) + +fun single_measurable_tac ctxt facts = + debug_tac ctxt (fn () => "single + " ^ Pretty.str_of (Pretty.block (map (Syntax.pretty_term ctxt o prop_of) facts))) + (resolve_tac ((maps (import_theorem o Simplifier.norm_hhf) facts) @ get_all ctxt) + APPEND' (split_fun_tac ctxt)); + +fun is_cond_formlua n thm = if length (prems_of thm) < n then false else + (case nth_hol_goal thm n of + (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "sets"}, _) $ _)) => false + | (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => false + | _ => true) + handle TERM _ => true; + +fun measurable_tac' ctxt ss facts n = + TAKE (Config.get ctxt backtrack) + ((single_measurable_tac ctxt facts THEN' + REPEAT o (single_measurable_tac ctxt facts APPEND' + SOLVED' (fn n => COND (is_cond_formlua n) (debug_tac ctxt (K "simp") (asm_full_simp_tac ss) n) no_tac))) n); + +fun measurable_tac ctxt = measurable_tac' ctxt (simpset_of ctxt); + +val attr_add = Thm.declaration_attribute o add_thm; + +val attr : attribute context_parser = + Scan.lift (Scan.optional (Args.parens (Scan.optional (Args.$$$ "raw" >> K true) false -- + Scan.optional (Args.$$$ "generic" >> K Generic) Concrete)) (false, Concrete) >> attr_add); + +val method : (Proof.context -> Method.method) context_parser = + Scan.lift (Scan.succeed (fn ctxt => METHOD (fn facts => measurable_tac ctxt facts 1))); + +fun simproc ss redex = let + val ctxt = Simplifier.the_context ss; + val t = HOLogic.mk_Trueprop (term_of redex); + fun tac {context = ctxt, ...} = + SOLVE (measurable_tac' ctxt ss (Simplifier.prems_of ss) 1); + in try (fn () => Goal.prove ctxt [] [] t tac RS @{thm Eq_TrueI}) () end; + +end + +*} + +attribute_setup measurable = {* Measurable.attr *} "declaration of measurability theorems" +method_setup measurable = {* Measurable.method *} "measurability prover" +simproc_setup measurable ("A \ sets M" | "f \ measurable M N") = {* K Measurable.simproc *} + +declare + top[measurable] + empty_sets[measurable (raw)] + Un[measurable (raw)] + Diff[measurable (raw)] + +declare + measurable_count_space[measurable (raw)] + measurable_ident[measurable (raw)] + measurable_ident'[measurable (raw)] + measurable_count_space_const[measurable (raw)] + measurable_const[measurable (raw)] + measurable_If[measurable (raw)] + measurable_comp[measurable (raw)] + measurable_sets[measurable (raw)] + +lemma predE[measurable (raw)]: + "pred M P \ {x\space M. P x} \ sets M" + unfolding pred_def . + +lemma pred_intros_imp'[measurable (raw)]: + "(K \ pred M (\x. P x)) \ pred M (\x. K \ P x)" + by (cases K) auto + +lemma pred_intros_conj1'[measurable (raw)]: + "(K \ pred M (\x. P x)) \ pred M (\x. K \ P x)" + by (cases K) auto + +lemma pred_intros_conj2'[measurable (raw)]: + "(K \ pred M (\x. P x)) \ pred M (\x. P x \ K)" + by (cases K) auto + +lemma pred_intros_disj1'[measurable (raw)]: + "(\ K \ pred M (\x. P x)) \ pred M (\x. K \ P x)" + by (cases K) auto + +lemma pred_intros_disj2'[measurable (raw)]: + "(\ K \ pred M (\x. P x)) \ pred M (\x. P x \ K)" + by (cases K) auto + +lemma pred_intros_logic[measurable (raw)]: + "pred M (\x. x \ space M)" + "pred M (\x. P x) \ pred M (\x. \ P x)" + "pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x \ P x)" + "pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x \ P x)" + "pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x \ P x)" + "pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x = P x)" + "pred M (\x. f x \ UNIV)" + "pred M (\x. f x \ {})" + "pred M (\x. f x \ (B x)) \ pred M (\x. f x \ - (B x))" + "pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) - (B x))" + "pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) \ (B x))" + "pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) \ (B x))" + "pred M (\x. g x (f x) \ (X x)) \ pred M (\x. f x \ (g x) -` (X x))" + by (auto intro!: sets_Collect simp: iff_conv_conj_imp pred_def) + +lemma pred_intros_countable[measurable (raw)]: + fixes P :: "'a \ 'i :: countable \ bool" + shows + "(\i. pred M (\x. P x i)) \ pred M (\x. \i. P x i)" + "(\i. pred M (\x. P x i)) \ pred M (\x. \i. P x i)" + by (auto intro!: sets_Collect_countable_All sets_Collect_countable_Ex simp: pred_def) + +lemma pred_intros_countable_bounded[measurable (raw)]: + fixes X :: "'i :: countable set" + shows + "(\i. i \ X \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\X. N x i))" + "(\i. i \ X \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\X. N x i))" + "(\i. i \ X \ pred M (\x. P x i)) \ pred M (\x. \i\X. P x i)" + "(\i. i \ X \ pred M (\x. P x i)) \ pred M (\x. \i\X. P x i)" + by (auto simp: Bex_def Ball_def) + +lemma pred_intros_finite[measurable (raw)]: + "finite I \ (\i. i \ I \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\I. N x i))" + "finite I \ (\i. i \ I \ pred M (\x. x \ N x i)) \ pred M (\x. x \ (\i\I. N x i))" + "finite I \ (\i. i \ I \ pred M (\x. P x i)) \ pred M (\x. \i\I. P x i)" + "finite I \ (\i. i \ I \ pred M (\x. P x i)) \ pred M (\x. \i\I. P x i)" + by (auto intro!: sets_Collect_finite_Ex sets_Collect_finite_All simp: iff_conv_conj_imp pred_def) + +lemma countable_Un_Int[measurable (raw)]: + "(\i :: 'i :: countable. i \ I \ N i \ sets M) \ (\i\I. N i) \ sets M" + "I \ {} \ (\i :: 'i :: countable. i \ I \ N i \ sets M) \ (\i\I. N i) \ sets M" + by auto + +declare + finite_UN[measurable (raw)] + finite_INT[measurable (raw)] + +lemma sets_Int_pred[measurable (raw)]: + assumes space: "A \ B \ space M" and [measurable]: "pred M (\x. x \ A)" "pred M (\x. x \ B)" + shows "A \ B \ sets M" +proof - + have "{x\space M. x \ A \ B} \ sets M" by auto + also have "{x\space M. x \ A \ B} = A \ B" + using space by auto + finally show ?thesis . +qed + +lemma [measurable (raw generic)]: + assumes f: "f \ measurable M N" and c: "{c} \ sets N" + shows pred_eq_const1: "pred M (\x. f x = c)" + and pred_eq_const2: "pred M (\x. c = f x)" + using measurable_sets[OF f c] by (auto simp: Int_def conj_commute eq_commute pred_def) + +lemma pred_le_const[measurable (raw generic)]: + assumes f: "f \ measurable M N" and c: "{.. c} \ sets N" shows "pred M (\x. f x \ c)" + using measurable_sets[OF f c] + by (auto simp: Int_def conj_commute eq_commute pred_def) + +lemma pred_const_le[measurable (raw generic)]: + assumes f: "f \ measurable M N" and c: "{c ..} \ sets N" shows "pred M (\x. c \ f x)" + using measurable_sets[OF f c] + by (auto simp: Int_def conj_commute eq_commute pred_def) + +lemma pred_less_const[measurable (raw generic)]: + assumes f: "f \ measurable M N" and c: "{..< c} \ sets N" shows "pred M (\x. f x < c)" + using measurable_sets[OF f c] + by (auto simp: Int_def conj_commute eq_commute pred_def) + +lemma pred_const_less[measurable (raw generic)]: + assumes f: "f \ measurable M N" and c: "{c <..} \ sets N" shows "pred M (\x. c < f x)" + using measurable_sets[OF f c] + by (auto simp: Int_def conj_commute eq_commute pred_def) + +declare + Int[measurable (raw)] + +hide_const (open) pred + subsection {* Extend measure *} definition "extend_measure \ I G \ =