# HG changeset patch # User hoelzl # Date 1399973747 -7200 # Node ID d1a937cbf8582063ef46dce9093409b3abc50ec0 # Parent 1144d7ec892a26f63c1628f23a9e0e770c6f0e05 clean up Lebesgue integration diff -r 1144d7ec892a -r d1a937cbf858 src/HOL/Probability/Complete_Measure.thy --- a/src/HOL/Probability/Complete_Measure.thy Tue May 13 11:11:51 2014 +0200 +++ b/src/HOL/Probability/Complete_Measure.thy Tue May 13 11:35:47 2014 +0200 @@ -288,7 +288,7 @@ ultimately show "g x = ?f x" by auto qed show "?f \ borel_measurable M" - using sf by (auto intro: borel_measurable_simple_function) + using sf[THEN borel_measurable_simple_function] by auto qed qed diff -r 1144d7ec892a -r d1a937cbf858 src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Tue May 13 11:11:51 2014 +0200 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Tue May 13 11:35:47 2014 +0200 @@ -9,28 +9,9 @@ imports Measure_Space Borel_Space begin -lemma tendsto_real_max: - fixes x y :: real - assumes "(X ---> x) net" - assumes "(Y ---> y) net" - shows "((\x. max (X x) (Y x)) ---> max x y) net" -proof - - have *: "\x y :: real. max x y = y + ((x - y) + norm (x - y)) / 2" - by (auto split: split_max simp: field_simps) - show ?thesis - unfolding * - by (intro tendsto_add assms tendsto_divide tendsto_norm tendsto_diff) auto -qed - -lemma measurable_sets2[intro]: - assumes "f \ measurable M M'" "g \ measurable M M''" - and "A \ sets M'" "B \ sets M''" - shows "f -` A \ g -` B \ space M \ sets M" -proof - - have "f -` A \ g -` B \ space M = (f -` A \ space M) \ (g -` B \ space M)" - by auto - then show ?thesis using assms by (auto intro: measurable_sets) -qed +lemma indicator_less_ereal[simp]: + "indicator A x \ (indicator B x::ereal) \ (x \ A \ x \ B)" + by (simp add: indicator_def not_le) section "Simple function" @@ -58,6 +39,22 @@ by (auto simp del: UN_simps simp: simple_function_def) qed +lemma measurable_simple_function[measurable_dest]: + "simple_function M f \ f \ measurable M (count_space UNIV)" + unfolding simple_function_def measurable_def +proof safe + fix A assume "finite (f ` space M)" "\x\f ` space M. f -` {x} \ space M \ sets M" + then have "(\x\f ` space M. if x \ A then f -` {x} \ space M else {}) \ sets M" + by (intro sets.finite_UN) auto + also have "(\x\f ` space M. if x \ A then f -` {x} \ space M else {}) = f -` A \ space M" + by (auto split: split_if_asm) + finally show "f -` A \ space M \ sets M" . +qed simp + +lemma borel_measurable_simple_function: + "simple_function M f \ f \ borel_measurable M" + by (auto dest!: measurable_simple_function simp: measurable_def) + lemma simple_function_measurable2[intro]: assumes "simple_function M f" "simple_function M g" shows "f -` A \ g -` B \ space M \ sets M" @@ -106,22 +103,6 @@ shows "simple_function M f \ simple_function N f" unfolding simple_function_def assms .. -lemma borel_measurable_simple_function[measurable_dest]: - assumes "simple_function M f" - shows "f \ borel_measurable M" -proof (rule borel_measurableI) - fix S - let ?I = "f ` (f -` S \ space M)" - have *: "(\x\?I. f -` {x} \ space M) = f -` S \ space M" (is "?U = _") by auto - have "finite ?I" - using assms unfolding simple_function_def - using finite_subset[of "f ` (f -` S \ space M)" "f ` space M"] by auto - hence "?U \ sets M" - apply (rule sets.finite_UN) - using assms unfolding simple_function_def by auto - thus "f -` S \ space M \ sets M" unfolding * . -qed - lemma simple_function_borel_measurable: fixes f :: "'a \ 'x::{t2_space}" assumes "f \ borel_measurable M" and "finite (f ` space M)" @@ -129,10 +110,10 @@ using assms unfolding simple_function_def by (auto intro: borel_measurable_vimage) -lemma simple_function_eq_borel_measurable: +lemma simple_function_eq_measurable: fixes f :: "'a \ ereal" - shows "simple_function M f \ finite (f`space M) \ f \ borel_measurable M" - using simple_function_borel_measurable[of f] borel_measurable_simple_function[of M f] + shows "simple_function M f \ finite (f`space M) \ f \ measurable M (count_space UNIV)" + using simple_function_borel_measurable[of f] measurable_simple_function[of M f] by (fastforce simp: simple_function_def) lemma simple_function_const[intro, simp]: @@ -215,14 +196,14 @@ assume "finite P" from this assms show ?thesis by induct auto qed auto -lemma +lemma simple_function_ereal[intro, simp]: fixes f g :: "'a \ real" assumes sf: "simple_function M f" - shows simple_function_ereal[intro, simp]: "simple_function M (\x. ereal (f x))" + shows "simple_function M (\x. ereal (f x))" by (auto intro!: simple_function_compose1[OF sf]) -lemma +lemma simple_function_real_of_nat[intro, simp]: fixes f g :: "'a \ nat" assumes sf: "simple_function M f" - shows simple_function_real_of_nat[intro, simp]: "simple_function M (\x. real (f x))" + shows "simple_function M (\x. real (f x))" by (auto intro!: simple_function_compose1[OF sf]) lemma borel_measurable_implies_simple_function_sequence: @@ -521,68 +502,67 @@ lemma simple_function_partition: assumes f: "simple_function M f" and g: "simple_function M g" - shows "integral\<^sup>S M f = (\A\(\x. f -` {f x} \ g -` {g x} \ space M) ` space M. the_elem (f`A) * (emeasure M) A)" - (is "_ = setsum _ (?p ` space M)") -proof- - let ?sub = "\x. ?p ` (f -` {x} \ space M)" - let ?SIGMA = "Sigma (f`space M) ?sub" + assumes sub: "\x y. x \ space M \ y \ space M \ g x = g y \ f x = f y" + assumes v: "\x. x \ space M \ f x = v (g x)" + shows "integral\<^sup>S M f = (\y\g ` space M. v y * emeasure M {x\space M. g x = y})" + (is "_ = ?r") +proof - + from f g have [simp]: "finite (f`space M)" "finite (g`space M)" + by (auto simp: simple_function_def) + from f g have [measurable]: "f \ measurable M (count_space UNIV)" "g \ measurable M (count_space UNIV)" + by (auto intro: measurable_simple_function) - have [intro]: - "finite (f ` space M)" - "finite (g ` space M)" - using assms unfolding simple_function_def by simp_all - - { fix A - have "?p ` (A \ space M) \ - (\(x,y). f -` {x} \ g -` {y} \ space M) ` (f`space M \ g`space M)" - by auto - hence "finite (?p ` (A \ space M))" - by (rule finite_subset) auto } - note this[intro, simp] - note sets = simple_function_measurable2[OF f g] + { fix y assume "y \ space M" + then have "f ` space M \ {i. \x\space M. i = f x \ g y = g x} = {v (g y)}" + by (auto cong: sub simp: v[symmetric]) } + note eq = this - { fix x assume "x \ space M" - have "\(?sub (f x)) = (f -` {f x} \ space M)" by auto - with sets have "(emeasure M) (f -` {f x} \ space M) = setsum (emeasure M) (?sub (f x))" - by (subst setsum_emeasure) (auto simp: disjoint_family_on_def) } - hence "integral\<^sup>S M f = (\(x,A)\?SIGMA. x * (emeasure M) A)" - unfolding simple_integral_def using f sets - by (subst setsum_Sigma[symmetric]) - (auto intro!: setsum_cong setsum_ereal_right_distrib) - also have "\ = (\A\?p ` space M. the_elem (f`A) * (emeasure M) A)" - proof - - have [simp]: "\x. x \ space M \ f ` ?p x = {f x}" by (auto intro!: imageI) - have "(\A. (the_elem (f ` A), A)) ` ?p ` space M - = (\x. (f x, ?p x)) ` space M" - proof safe - fix x assume "x \ space M" - thus "(f x, ?p x) \ (\A. (the_elem (f`A), A)) ` ?p ` space M" - by (auto intro!: image_eqI[of _ _ "?p x"]) - qed auto - thus ?thesis - apply (auto intro!: setsum_reindex_cong[of "\A. (the_elem (f`A), A)"] inj_onI) - apply (rule_tac x="xa" in image_eqI) - by simp_all + have "integral\<^sup>S M f = + (\y\f`space M. y * (\z\g`space M. + if \x\space M. y = f x \ z = g x then emeasure M {x\space M. g x = z} else 0))" + unfolding simple_integral_def + proof (safe intro!: setsum_cong ereal_left_mult_cong) + fix y assume y: "y \ space M" "f y \ 0" + have [simp]: "g ` space M \ {z. \x\space M. f y = f x \ z = g x} = + {z. \x\space M. f y = f x \ z = g x}" + by auto + have eq:"(\i\{z. \x\space M. f y = f x \ z = g x}. {x \ space M. g x = i}) = + f -` {f y} \ space M" + by (auto simp: eq_commute cong: sub rev_conj_cong) + have "finite (g`space M)" by simp + then have "finite {z. \x\space M. f y = f x \ z = g x}" + by (rule rev_finite_subset) auto + then show "emeasure M (f -` {f y} \ space M) = + (\z\g ` space M. if \x\space M. f y = f x \ z = g x then emeasure M {x \ space M. g x = z} else 0)" + apply (simp add: setsum_cases) + apply (subst setsum_emeasure) + apply (auto simp: disjoint_family_on_def eq) + done qed - finally show ?thesis . + also have "\ = (\y\f`space M. (\z\g`space M. + if \x\space M. y = f x \ z = g x then y * emeasure M {x\space M. g x = z} else 0))" + by (auto intro!: setsum_cong simp: setsum_ereal_right_distrib emeasure_nonneg) + also have "\ = ?r" + by (subst setsum_commute) + (auto intro!: setsum_cong simp: setsum_cases scaleR_setsum_right[symmetric] eq) + finally show "integral\<^sup>S M f = ?r" . qed lemma simple_integral_add[simp]: assumes f: "simple_function M f" and "\x. 0 \ f x" and g: "simple_function M g" and "\x. 0 \ g x" shows "(\\<^sup>Sx. f x + g x \M) = integral\<^sup>S M f + integral\<^sup>S M g" proof - - { fix x let ?S = "g -` {g x} \ f -` {f x} \ space M" - assume "x \ space M" - hence "(\a. f a + g a) ` ?S = {f x + g x}" "f ` ?S = {f x}" "g ` ?S = {g x}" - "(\x. (f x, g x)) -` {(f x, g x)} \ space M = ?S" - by auto } - with assms show ?thesis - unfolding - simple_function_partition[OF simple_function_add[OF f g] simple_function_Pair[OF f g]] - simple_function_partition[OF f g] - simple_function_partition[OF g f] - by (subst (3) Int_commute) - (auto simp add: ereal_left_distrib setsum_addf[symmetric] intro!: setsum_cong) + have "(\\<^sup>Sx. f x + g x \M) = + (\y\(\x. (f x, g x))`space M. (fst y + snd y) * emeasure M {x\space M. (f x, g x) = y})" + by (intro simple_function_partition) (auto intro: f g) + also have "\ = (\y\(\x. (f x, g x))`space M. fst y * emeasure M {x\space M. (f x, g x) = y}) + + (\y\(\x. (f x, g x))`space M. snd y * emeasure M {x\space M. (f x, g x) = y})" + using assms(2,4) by (auto intro!: setsum_cong ereal_left_distrib simp: setsum_addf[symmetric]) + also have "(\y\(\x. (f x, g x))`space M. fst y * emeasure M {x\space M. (f x, g x) = y}) = (\\<^sup>Sx. f x \M)" + by (intro simple_function_partition[symmetric]) (auto intro: f g) + also have "(\y\(\x. (f x, g x))`space M. snd y * emeasure M {x\space M. (f x, g x) = y}) = (\\<^sup>Sx. g x \M)" + by (intro simple_function_partition[symmetric]) (auto intro: f g) + finally show ?thesis . qed lemma simple_integral_setsum[simp]: @@ -599,53 +579,42 @@ assumes f: "simple_function M f" "\x. 0 \ f x" shows "(\\<^sup>Sx. c * f x \M) = c * integral\<^sup>S M f" proof - - note mult = simple_function_mult[OF simple_function_const[of _ c] f(1)] - { fix x let ?S = "f -` {f x} \ (\x. c * f x) -` {c * f x} \ space M" - assume "x \ space M" - hence "(\x. c * f x) ` ?S = {c * f x}" "f ` ?S = {f x}" - by auto } - with assms show ?thesis - unfolding simple_function_partition[OF mult f(1)] - simple_function_partition[OF f(1) mult] - by (subst setsum_ereal_right_distrib) - (auto intro!: ereal_0_le_mult setsum_cong simp: mult_assoc) + have "(\\<^sup>Sx. c * f x \M) = (\y\f ` space M. (c * y) * emeasure M {x\space M. f x = y})" + using f by (intro simple_function_partition) auto + also have "\ = c * integral\<^sup>S M f" + using f unfolding simple_integral_def + by (subst setsum_ereal_right_distrib) (auto simp: emeasure_nonneg mult_assoc Int_def conj_commute) + finally show ?thesis . qed lemma simple_integral_mono_AE: - assumes f: "simple_function M f" and g: "simple_function M g" + assumes f[measurable]: "simple_function M f" and g[measurable]: "simple_function M g" and mono: "AE x in M. f x \ g x" shows "integral\<^sup>S M f \ integral\<^sup>S M g" proof - - let ?S = "\x. (g -` {g x} \ space M) \ (f -` {f x} \ space M)" - have *: "\x. g -` {g x} \ f -` {f x} \ space M = ?S x" - "\x. f -` {f x} \ g -` {g x} \ space M = ?S x" by auto - show ?thesis - unfolding * - simple_function_partition[OF f g] - simple_function_partition[OF g f] - proof (safe intro!: setsum_mono) + let ?\ = "\P. emeasure M {x\space M. P x}" + have "integral\<^sup>S M f = (\y\(\x. (f x, g x))`space M. fst y * ?\ (\x. (f x, g x) = y))" + using f g by (intro simple_function_partition) auto + also have "\ \ (\y\(\x. (f x, g x))`space M. snd y * ?\ (\x. (f x, g x) = y))" + proof (clarsimp intro!: setsum_mono) fix x assume "x \ space M" - then have *: "f ` ?S x = {f x}" "g ` ?S x = {g x}" by auto - show "the_elem (f`?S x) * (emeasure M) (?S x) \ the_elem (g`?S x) * (emeasure M) (?S x)" - proof (cases "f x \ g x") - case True then show ?thesis - using * assms(1,2)[THEN simple_functionD(2)] - by (auto intro!: ereal_mult_right_mono) - next - case False - obtain N where N: "{x\space M. \ f x \ g x} \ N" "N \ sets M" "(emeasure M) N = 0" - using mono by (auto elim!: AE_E) - have "?S x \ N" using N `x \ space M` False by auto - moreover have "?S x \ sets M" using assms - by (rule_tac sets.Int) (auto intro!: simple_functionD) - ultimately have "(emeasure M) (?S x) \ (emeasure M) N" - using `N \ sets M` by (auto intro!: emeasure_mono) - moreover have "0 \ (emeasure M) (?S x)" - using assms(1,2)[THEN simple_functionD(2)] by auto - ultimately have "(emeasure M) (?S x) = 0" using `(emeasure M) N = 0` by auto - then show ?thesis by simp - qed + let ?M = "?\ (\y. f y = f x \ g y = g x)" + show "f x * ?M \ g x * ?M" + proof cases + assume "?M \ 0" + then have "0 < ?M" + by (simp add: less_le emeasure_nonneg) + also have "\ \ ?\ (\y. f x \ g x)" + using mono by (intro emeasure_mono_AE) auto + finally have "\ \ f x \ g x" + by (intro notI) auto + then show ?thesis + by (intro ereal_mult_right_mono) auto + qed simp qed + also have "\ = integral\<^sup>S M g" + using f g by (intro simple_function_partition[symmetric]) auto + finally show ?thesis . qed lemma simple_integral_mono: @@ -671,64 +640,37 @@ qed simp lemma simple_integral_indicator: - assumes "A \ sets M" + assumes A: "A \ sets M" assumes f: "simple_function M f" shows "(\\<^sup>Sx. f x * indicator A x \M) = - (\x \ f ` space M. x * (emeasure M) (f -` {x} \ space M \ A))" -proof (cases "A = space M") - case True - then have "(\\<^sup>Sx. f x * indicator A x \M) = integral\<^sup>S M f" - by (auto intro!: simple_integral_cong) - with True show ?thesis by (simp add: simple_integral_def) -next - assume "A \ space M" - then obtain x where x: "x \ space M" "x \ A" using sets.sets_into_space[OF assms(1)] by auto - have I: "(\x. f x * indicator A x) ` space M = f ` A \ {0}" (is "?I ` _ = _") - proof safe - fix y assume "?I y \ f ` A" hence "y \ A" by auto thus "?I y = 0" by auto - next - fix y assume "y \ A" thus "f y \ ?I ` space M" - using sets.sets_into_space[OF assms(1)] by (auto intro!: image_eqI[of _ _ y]) - next - show "0 \ ?I ` space M" using x by (auto intro!: image_eqI[of _ _ x]) - qed - have *: "(\\<^sup>Sx. f x * indicator A x \M) = - (\x \ f ` space M \ {0}. x * (emeasure M) (f -` {x} \ space M \ A))" - unfolding simple_integral_def I - proof (rule setsum_mono_zero_cong_left) - show "finite (f ` space M \ {0})" - using assms(2) unfolding simple_function_def by auto - show "f ` A \ {0} \ f`space M \ {0}" - using sets.sets_into_space[OF assms(1)] by auto - have "\x. f x \ f ` A \ f -` {f x} \ space M \ A = {}" - by (auto simp: image_iff) - thus "\i\f ` space M \ {0} - (f ` A \ {0}). - i * (emeasure M) (f -` {i} \ space M \ A) = 0" by auto - next - fix x assume "x \ f`A \ {0}" - hence "x \ 0 \ ?I -` {x} \ space M = f -` {x} \ space M \ A" - by (auto simp: indicator_def split: split_if_asm) - thus "x * (emeasure M) (?I -` {x} \ space M) = - x * (emeasure M) (f -` {x} \ space M \ A)" by (cases "x = 0") simp_all - qed - show ?thesis unfolding * - using assms(2) unfolding simple_function_def - by (auto intro!: setsum_mono_zero_cong_right) + (\x \ f ` space M. x * emeasure M (f -` {x} \ space M \ A))" +proof - + have eq: "(\x. (f x, indicator A x)) ` space M \ {x. snd x = 1} = (\x. (f x, 1::ereal))`A" + using A[THEN sets.sets_into_space] by (auto simp: indicator_def image_iff split: split_if_asm) + have eq2: "\x. f x \ f ` A \ f -` {f x} \ space M \ A = {}" + by (auto simp: image_iff) + + have "(\\<^sup>Sx. f x * indicator A x \M) = + (\y\(\x. (f x, indicator A x))`space M. (fst y * snd y) * emeasure M {x\space M. (f x, indicator A x) = y})" + using assms by (intro simple_function_partition) auto + also have "\ = (\y\(\x. (f x, indicator A x::ereal))`space M. + if snd y = 1 then fst y * emeasure M (f -` {fst y} \ space M \ A) else 0)" + by (auto simp: indicator_def split: split_if_asm intro!: arg_cong2[where f="op *"] arg_cong2[where f=emeasure] setsum_cong) + also have "\ = (\y\(\x. (f x, 1::ereal))`A. fst y * emeasure M (f -` {fst y} \ space M \ A))" + using assms by (subst setsum_cases) (auto intro!: simple_functionD(1) simp: eq) + also have "\ = (\y\fst`(\x. (f x, 1::ereal))`A. y * emeasure M (f -` {y} \ space M \ A))" + by (subst setsum_reindex[where f=fst]) (auto simp: inj_on_def) + also have "\ = (\x \ f ` space M. x * emeasure M (f -` {x} \ space M \ A))" + using A[THEN sets.sets_into_space] + by (intro setsum_mono_zero_cong_left simple_functionD f) (auto simp: image_comp comp_def eq2) + finally show ?thesis . qed lemma simple_integral_indicator_only[simp]: assumes "A \ sets M" shows "integral\<^sup>S M (indicator A) = emeasure M A" -proof cases - assume "space M = {}" hence "A = {}" using sets.sets_into_space[OF assms] by auto - thus ?thesis unfolding simple_integral_def using `space M = {}` by auto -next - assume "space M \ {}" hence "(\x. 1) ` space M = {1::ereal}" by auto - thus ?thesis - using simple_integral_indicator[OF assms simple_function_const[of _ 1]] - using sets.sets_into_space[OF assms] - by (auto intro!: arg_cong[where f="(emeasure M)"]) -qed + using simple_integral_indicator[OF assms, of "\x. 1"] sets.sets_into_space[OF assms] + by (simp_all add: image_constant_conv Int_absorb1 split: split_if_asm) lemma simple_integral_null_set: assumes "simple_function M u" "\x. 0 \ u x" and "N \ null_sets M" @@ -748,7 +690,7 @@ lemma simple_integral_cmult_indicator: assumes A: "A \ sets M" - shows "(\\<^sup>Sx. c * indicator A x \M) = c * (emeasure M) A" + shows "(\\<^sup>Sx. c * indicator A x \M) = c * emeasure M A" using simple_integral_mult[OF simple_function_indicator[OF A]] unfolding simple_integral_indicator_only[OF A] by simp @@ -902,7 +844,7 @@ hence "a \ 0" by auto let ?B = "\i. {x \ space M. a * u x \ f i x}" have B: "\i. ?B i \ sets M" - using f `simple_function M u` by auto + using f `simple_function M u`[THEN borel_measurable_simple_function] by auto let ?uB = "\i x. u x * indicator (?B i) x" @@ -1247,6 +1189,42 @@ finally show False using `integral\<^sup>P M g \ \` by auto qed +lemma positive_integral_PInf: + assumes f: "f \ borel_measurable M" + and not_Inf: "integral\<^sup>P M f \ \" + shows "(emeasure M) (f -` {\} \ space M) = 0" +proof - + have "\ * (emeasure M) (f -` {\} \ space M) = (\\<^sup>+ x. \ * indicator (f -` {\} \ space M) x \M)" + using f by (subst positive_integral_cmult_indicator) (auto simp: measurable_sets) + also have "\ \ integral\<^sup>P M (\x. max 0 (f x))" + by (auto intro!: positive_integral_mono simp: indicator_def max_def) + finally have "\ * (emeasure M) (f -` {\} \ space M) \ integral\<^sup>P M f" + by (simp add: positive_integral_max_0) + moreover have "0 \ (emeasure M) (f -` {\} \ space M)" + by (rule emeasure_nonneg) + ultimately show ?thesis + using assms by (auto split: split_if_asm) +qed + +lemma positive_integral_PInf_AE: + assumes "f \ borel_measurable M" "integral\<^sup>P M f \ \" shows "AE x in M. f x \ \" +proof (rule AE_I) + show "(emeasure M) (f -` {\} \ space M) = 0" + by (rule positive_integral_PInf[OF assms]) + show "f -` {\} \ space M \ sets M" + using assms by (auto intro: borel_measurable_vimage) +qed auto + +lemma simple_integral_PInf: + assumes "simple_function M f" "\x. 0 \ f x" + and "integral\<^sup>S M f \ \" + shows "(emeasure M) (f -` {\} \ space M) = 0" +proof (rule positive_integral_PInf) + show "f \ borel_measurable M" using assms by (auto intro: borel_measurable_simple_function) + show "integral\<^sup>P M f \ \" + using assms by (simp add: positive_integral_eq_simple_integral) +qed + lemma positive_integral_diff: assumes f: "f \ borel_measurable M" and g: "g \ borel_measurable M" "AE x in M. 0 \ g x" @@ -1977,42 +1955,6 @@ by (auto simp add: real_of_ereal_eq_0) qed -lemma positive_integral_PInf: - assumes f: "f \ borel_measurable M" - and not_Inf: "integral\<^sup>P M f \ \" - shows "(emeasure M) (f -` {\} \ space M) = 0" -proof - - have "\ * (emeasure M) (f -` {\} \ space M) = (\\<^sup>+ x. \ * indicator (f -` {\} \ space M) x \M)" - using f by (subst positive_integral_cmult_indicator) (auto simp: measurable_sets) - also have "\ \ integral\<^sup>P M (\x. max 0 (f x))" - by (auto intro!: positive_integral_mono simp: indicator_def max_def) - finally have "\ * (emeasure M) (f -` {\} \ space M) \ integral\<^sup>P M f" - by (simp add: positive_integral_max_0) - moreover have "0 \ (emeasure M) (f -` {\} \ space M)" - by (rule emeasure_nonneg) - ultimately show ?thesis - using assms by (auto split: split_if_asm) -qed - -lemma positive_integral_PInf_AE: - assumes "f \ borel_measurable M" "integral\<^sup>P M f \ \" shows "AE x in M. f x \ \" -proof (rule AE_I) - show "(emeasure M) (f -` {\} \ space M) = 0" - by (rule positive_integral_PInf[OF assms]) - show "f -` {\} \ space M \ sets M" - using assms by (auto intro: borel_measurable_vimage) -qed auto - -lemma simple_integral_PInf: - assumes "simple_function M f" "\x. 0 \ f x" - and "integral\<^sup>S M f \ \" - shows "(emeasure M) (f -` {\} \ space M) = 0" -proof (rule positive_integral_PInf) - show "f \ borel_measurable M" using assms by (auto intro: borel_measurable_simple_function) - show "integral\<^sup>P M f \ \" - using assms by (simp add: positive_integral_eq_simple_integral) -qed - lemma integral_real: "AE x in M. \f x\ \ \ \ (\x. real (f x) \M) = real (integral\<^sup>P M f) - real (integral\<^sup>P M (\x. - f x))" using assms unfolding lebesgue_integral_def @@ -2046,10 +1988,6 @@ assumes "AE x in M. \f x\ \ B" and "f \ borel_measurable M" shows "integrable M f" by (auto intro: integrable_bound[where f="\x. B"] lebesgue_integral_const assms) -lemma indicator_less[simp]: - "indicator A x \ (indicator B x::ereal) \ (x \ A \ x \ B)" - by (simp add: indicator_def not_le) - lemma (in finite_measure) integral_less_AE: assumes int: "integrable M X" "integrable M Y" assumes A: "(emeasure M) A \ 0" "A \ sets M" "AE x in M. x \ A \ X x \ Y x" @@ -2158,7 +2096,7 @@ have "(\i. ?diff i x) ----> 2 * w x - \u' x - u' x\" using u' by (safe intro!: tendsto_intros) then show "(\i. max 0 (?diff i x)) ----> max 0 (2 * w x)" - by (auto intro!: tendsto_real_max) + by (auto intro!: tendsto_max) qed (rule trivial_limit_sequentially) qed also have "\ \ liminf (\n. \\<^sup>+ x. max 0 (ereal (?diff n x)) \M)" @@ -2517,13 +2455,6 @@ apply (auto simp: max_def setsum_subtractf[symmetric] intro!: setsum_cong) done -lemma borel_measurable_count_space[simp, intro!]: - "f \ borel_measurable (count_space A)" - by simp - -lemma lessThan_eq_empty_iff: "{..< n::nat} = {} \ n = 0" - by auto - lemma emeasure_UN_countable: assumes sets: "\i. i \ I \ X i \ sets M" and I: "countable I" assumes disj: "disjoint_family_on X I" @@ -2943,9 +2874,6 @@ finally show ?thesis . qed -lemma emeasure_neq_0_sets: "emeasure M A \ 0 \ A \ sets M" - using emeasure_notin_sets[of A M] by blast - lemma measure_uniform_measure[simp]: assumes A: "emeasure M A \ 0" "emeasure M A \ \" and B: "B \ sets M" shows "measure (uniform_measure M A) B = measure M (A \ B) / measure M A" diff -r 1144d7ec892a -r d1a937cbf858 src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Tue May 13 11:11:51 2014 +0200 +++ b/src/HOL/Probability/Sigma_Algebra.thy Tue May 13 11:35:47 2014 +0200 @@ -1266,6 +1266,9 @@ lemma emeasure_notin_sets: "A \ sets M \ emeasure M A = 0" by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def) +lemma emeasure_neq_0_sets: "emeasure M A \ 0 \ A \ sets M" + using emeasure_notin_sets[of A M] by blast + lemma measure_notin_sets: "A \ sets M \ measure M A = 0" by (simp add: measure_def emeasure_notin_sets) diff -r 1144d7ec892a -r d1a937cbf858 src/HOL/Set_Interval.thy --- a/src/HOL/Set_Interval.thy Tue May 13 11:11:51 2014 +0200 +++ b/src/HOL/Set_Interval.thy Tue May 13 11:35:47 2014 +0200 @@ -467,6 +467,12 @@ "{x..y} = UNIV \ (x = bot \ y = top)" by (auto simp: set_eq_iff intro: top_le le_bot) +lemma Iio_eq_empty_iff: "{..< n::'a::{linorder, order_bot}} = {} \ n = bot" + by (auto simp: set_eq_iff not_less le_bot) + +lemma Iio_eq_empty_iff_nat: "{..< n::nat} = {} \ n = 0" + by (simp add: Iio_eq_empty_iff bot_nat_def) + subsection {* Infinite intervals *} diff -r 1144d7ec892a -r d1a937cbf858 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Tue May 13 11:11:51 2014 +0200 +++ b/src/HOL/Topological_Spaces.thy Tue May 13 11:35:47 2014 +0200 @@ -973,6 +973,41 @@ lemma tendsto_bot [simp]: "(f ---> a) bot" unfolding tendsto_def by simp +lemma tendsto_max: + fixes x y :: "'a::linorder_topology" + assumes X: "(X ---> x) net" + assumes Y: "(Y ---> y) net" + shows "((\x. max (X x) (Y x)) ---> max x y) net" +proof (rule order_tendstoI) + fix a assume "a < max x y" + then show "eventually (\x. a < max (X x) (Y x)) net" + using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a] + by (auto simp: less_max_iff_disj elim: eventually_elim1) +next + fix a assume "max x y < a" + then show "eventually (\x. max (X x) (Y x) < a) net" + using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a] + by (auto simp: eventually_conj_iff) +qed + +lemma tendsto_min: + fixes x y :: "'a::linorder_topology" + assumes X: "(X ---> x) net" + assumes Y: "(Y ---> y) net" + shows "((\x. min (X x) (Y x)) ---> min x y) net" +proof (rule order_tendstoI) + fix a assume "a < min x y" + then show "eventually (\x. a < min (X x) (Y x)) net" + using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a] + by (auto simp: eventually_conj_iff) +next + fix a assume "min x y < a" + then show "eventually (\x. min (X x) (Y x) < a) net" + using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a] + by (auto simp: min_less_iff_disj elim: eventually_elim1) +qed + + lemma tendsto_ident_at [tendsto_intros]: "((\x. x) ---> a) (at a within s)" unfolding tendsto_def eventually_at_topological by auto