src/HOL/Probability/Lebesgue_Integration.thy
changeset 50002 ce0d316b5b44
parent 50001 382bd3173584
child 50003 8c213922ed49
equal deleted inserted replaced
50001:382bd3173584 50002:ce0d316b5b44
    68   show "finite (g ` space M)"
    68   show "finite (g ` space M)"
    69     using assms unfolding simple_function_def by auto
    69     using assms unfolding simple_function_def by auto
    70   have "g -` X \<inter> space M = g -` (X \<inter> g`space M) \<inter> space M" by auto
    70   have "g -` X \<inter> space M = g -` (X \<inter> g`space M) \<inter> space M" by auto
    71   also have "\<dots> = (\<Union>x\<in>X \<inter> g`space M. g-`{x} \<inter> space M)" by auto
    71   also have "\<dots> = (\<Union>x\<in>X \<inter> g`space M. g-`{x} \<inter> space M)" by auto
    72   finally show "g -` X \<inter> space M \<in> sets M" using assms
    72   finally show "g -` X \<inter> space M \<in> sets M" using assms
    73     by (auto intro!: finite_UN simp del: UN_simps simp: simple_function_def)
    73     by (auto simp del: UN_simps simp: simple_function_def)
    74 qed
    74 qed
    75 
    75 
    76 lemma simple_function_measurable2[intro]:
    76 lemma simple_function_measurable2[intro]:
    77   assumes "simple_function M f" "simple_function M g"
    77   assumes "simple_function M f" "simple_function M g"
    78   shows "f -` A \<inter> g -` B \<inter> space M \<in> sets M"
    78   shows "f -` A \<inter> g -` B \<inter> space M \<in> sets M"
   165   let ?G = "g -` {g (f x)} \<inter> (f`space M)"
   165   let ?G = "g -` {g (f x)} \<inter> (f`space M)"
   166   have *: "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M =
   166   have *: "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M =
   167     (\<Union>x\<in>?G. f -` {x} \<inter> space M)" by auto
   167     (\<Union>x\<in>?G. f -` {x} \<inter> space M)" by auto
   168   show "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M \<in> sets M"
   168   show "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M \<in> sets M"
   169     using assms unfolding simple_function_def *
   169     using assms unfolding simple_function_def *
   170     by (rule_tac finite_UN) (auto intro!: finite_UN)
   170     by (rule_tac finite_UN) auto
   171 qed
   171 qed
   172 
   172 
   173 lemma simple_function_indicator[intro, simp]:
   173 lemma simple_function_indicator[intro, simp]:
   174   assumes "A \<in> sets M"
   174   assumes "A \<in> sets M"
   175   shows "simple_function M (indicator A)"
   175   shows "simple_function M (indicator A)"
  1208   from f this assms(1) show ?thesis
  1208   from f this assms(1) show ?thesis
  1209   proof induct
  1209   proof induct
  1210     case (insert i P)
  1210     case (insert i P)
  1211     then have "f i \<in> borel_measurable M" "AE x in M. 0 \<le> f i x"
  1211     then have "f i \<in> borel_measurable M" "AE x in M. 0 \<le> f i x"
  1212       "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M" "AE x in M. 0 \<le> (\<Sum>i\<in>P. f i x)"
  1212       "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M" "AE x in M. 0 \<le> (\<Sum>i\<in>P. f i x)"
  1213       by (auto intro!: borel_measurable_ereal_setsum setsum_nonneg)
  1213       by (auto intro!: setsum_nonneg)
  1214     from positive_integral_add[OF this]
  1214     from positive_integral_add[OF this]
  1215     show ?case using insert by auto
  1215     show ?case using insert by auto
  1216   qed simp
  1216   qed simp
  1217 qed simp
  1217 qed simp
  1218 
  1218 
  1228   also have "\<dots> \<le> (\<integral>\<^isup>+ x. c * (u x * indicator A x) \<partial>M)" using u c
  1228   also have "\<dots> \<le> (\<integral>\<^isup>+ x. c * (u x * indicator A x) \<partial>M)" using u c
  1229     by (auto intro!: positive_integral_mono_AE
  1229     by (auto intro!: positive_integral_mono_AE
  1230       simp: indicator_def ereal_zero_le_0_iff)
  1230       simp: indicator_def ereal_zero_le_0_iff)
  1231   also have "\<dots> = c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)"
  1231   also have "\<dots> = c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)"
  1232     using assms
  1232     using assms
  1233     by (auto intro!: positive_integral_cmult borel_measurable_indicator simp: ereal_zero_le_0_iff)
  1233     by (auto intro!: positive_integral_cmult simp: ereal_zero_le_0_iff)
  1234   finally show ?thesis .
  1234   finally show ?thesis .
  1235 qed
  1235 qed
  1236 
  1236 
  1237 lemma positive_integral_noteq_infinite:
  1237 lemma positive_integral_noteq_infinite:
  1238   assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
  1238   assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
  1631   using assms integral_linear[where a=1] by auto
  1631   using assms integral_linear[where a=1] by auto
  1632 
  1632 
  1633 lemma integral_zero[simp, intro]:
  1633 lemma integral_zero[simp, intro]:
  1634   shows "integrable M (\<lambda>x. 0)" "(\<integral> x.0 \<partial>M) = 0"
  1634   shows "integrable M (\<lambda>x. 0)" "(\<integral> x.0 \<partial>M) = 0"
  1635   unfolding integrable_def lebesgue_integral_def
  1635   unfolding integrable_def lebesgue_integral_def
  1636   by (auto simp add: borel_measurable_const)
  1636   by auto
  1637 
  1637 
  1638 lemma integral_cmult[simp, intro]:
  1638 lemma integral_cmult[simp, intro]:
  1639   assumes "integrable M f"
  1639   assumes "integrable M f"
  1640   shows "integrable M (\<lambda>t. a * f t)" (is ?P)
  1640   shows "integrable M (\<lambda>t. a * f t)" (is ?P)
  1641   and "(\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" (is ?I)
  1641   and "(\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" (is ?I)
  1642 proof -
  1642 proof -
  1643   have "integrable M (\<lambda>t. a * f t) \<and> (\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f"
  1643   have "integrable M (\<lambda>t. a * f t) \<and> (\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f"
  1644   proof (cases rule: le_cases)
  1644   proof (cases rule: le_cases)
  1645     assume "0 \<le> a" show ?thesis
  1645     assume "0 \<le> a" show ?thesis
  1646       using integral_linear[OF assms integral_zero(1) `0 \<le> a`]
  1646       using integral_linear[OF assms integral_zero(1) `0 \<le> a`]
  1647       by (simp add: integral_zero)
  1647       by simp
  1648   next
  1648   next
  1649     assume "a \<le> 0" hence "0 \<le> - a" by auto
  1649     assume "a \<le> 0" hence "0 \<le> - a" by auto
  1650     have *: "\<And>t. - a * t + 0 = (-a) * t" by simp
  1650     have *: "\<And>t. - a * t + 0 = (-a) * t" by simp
  1651     show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`]
  1651     show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`]
  1652         integral_minus(1)[of M "\<lambda>t. - a * f t"]
  1652         integral_minus(1)[of M "\<lambda>t. - a * f t"]
  1716     "\<And>x. ereal (indicator A x) = indicator A x"
  1716     "\<And>x. ereal (indicator A x) = indicator A x"
  1717     "(\<integral>\<^isup>+x. ereal (- indicator A x) \<partial>M) = 0"
  1717     "(\<integral>\<^isup>+x. ereal (- indicator A x) \<partial>M) = 0"
  1718     by (auto split: split_indicator simp: positive_integral_0_iff_AE one_ereal_def)
  1718     by (auto split: split_indicator simp: positive_integral_0_iff_AE one_ereal_def)
  1719   show ?int ?able
  1719   show ?int ?able
  1720     using assms unfolding lebesgue_integral_def integrable_def
  1720     using assms unfolding lebesgue_integral_def integrable_def
  1721     by (auto simp: * positive_integral_indicator borel_measurable_indicator)
  1721     by (auto simp: *)
  1722 qed
  1722 qed
  1723 
  1723 
  1724 lemma integral_cmul_indicator:
  1724 lemma integral_cmul_indicator:
  1725   assumes "A \<in> sets M" and "c \<noteq> 0 \<Longrightarrow> (emeasure M) A \<noteq> \<infinity>"
  1725   assumes "A \<in> sets M" and "c \<noteq> 0 \<Longrightarrow> (emeasure M) A \<noteq> \<infinity>"
  1726   shows "integrable M (\<lambda>x. c * indicator A x)" (is ?P)
  1726   shows "integrable M (\<lambda>x. c * indicator A x)" (is ?P)
  1848 
  1848 
  1849 lemma integral_positive:
  1849 lemma integral_positive:
  1850   assumes "integrable M f" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
  1850   assumes "integrable M f" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
  1851   shows "0 \<le> integral\<^isup>L M f"
  1851   shows "0 \<le> integral\<^isup>L M f"
  1852 proof -
  1852 proof -
  1853   have "0 = (\<integral>x. 0 \<partial>M)" by (auto simp: integral_zero)
  1853   have "0 = (\<integral>x. 0 \<partial>M)" by auto
  1854   also have "\<dots> \<le> integral\<^isup>L M f"
  1854   also have "\<dots> \<le> integral\<^isup>L M f"
  1855     using assms by (rule integral_mono[OF integral_zero(1)])
  1855     using assms by (rule integral_mono[OF integral_zero(1)])
  1856   finally show ?thesis .
  1856   finally show ?thesis .
  1857 qed
  1857 qed
  1858 
  1858 
  2204   have 3: "integrable M ?w"
  2204   have 3: "integrable M ?w"
  2205   proof (rule integral_monotone_convergence(1))
  2205   proof (rule integral_monotone_convergence(1))
  2206     let ?F = "\<lambda>n y. (\<Sum>i = 0..<n. \<bar>f i y\<bar>)"
  2206     let ?F = "\<lambda>n y. (\<Sum>i = 0..<n. \<bar>f i y\<bar>)"
  2207     let ?w' = "\<lambda>n y. if y \<in> space M then ?F n y else 0"
  2207     let ?w' = "\<lambda>n y. if y \<in> space M then ?F n y else 0"
  2208     have "\<And>n. integrable M (?F n)"
  2208     have "\<And>n. integrable M (?F n)"
  2209       using borel by (auto intro!: integral_setsum integrable_abs)
  2209       using borel by (auto intro!: integrable_abs)
  2210     thus "\<And>n. integrable M (?w' n)" by (simp cong: integrable_cong)
  2210     thus "\<And>n. integrable M (?w' n)" by (simp cong: integrable_cong)
  2211     show "AE x in M. mono (\<lambda>n. ?w' n x)"
  2211     show "AE x in M. mono (\<lambda>n. ?w' n x)"
  2212       by (auto simp: mono_def le_fun_def intro!: setsum_mono2)
  2212       by (auto simp: mono_def le_fun_def intro!: setsum_mono2)
  2213     show "AE x in M. (\<lambda>n. ?w' n x) ----> ?w x"
  2213     show "AE x in M. (\<lambda>n. ?w' n x) ----> ?w x"
  2214         using w by (simp_all add: tendsto_const sums_def)
  2214         using w by (simp_all add: tendsto_const sums_def)
  2434 
  2434 
  2435 lemma density_ereal_max_0: "density M (\<lambda>x. ereal (f x)) = density M (\<lambda>x. ereal (max 0 (f x)))"
  2435 lemma density_ereal_max_0: "density M (\<lambda>x. ereal (f x)) = density M (\<lambda>x. ereal (max 0 (f x)))"
  2436   by (subst density_max_0) (auto intro!: arg_cong[where f="density M"] split: split_max)
  2436   by (subst density_max_0) (auto intro!: arg_cong[where f="density M"] split: split_max)
  2437 
  2437 
  2438 lemma emeasure_density:
  2438 lemma emeasure_density:
  2439   assumes f: "f \<in> borel_measurable M" and A: "A \<in> sets M"
  2439   assumes f[measurable]: "f \<in> borel_measurable M" and A[measurable]: "A \<in> sets M"
  2440   shows "emeasure (density M f) A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
  2440   shows "emeasure (density M f) A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
  2441     (is "_ = ?\<mu> A")
  2441     (is "_ = ?\<mu> A")
  2442   unfolding density_def
  2442   unfolding density_def
  2443 proof (rule emeasure_measure_of_sigma)
  2443 proof (rule emeasure_measure_of_sigma)
  2444   show "sigma_algebra (space M) (sets M)" ..
  2444   show "sigma_algebra (space M) (sets M)" ..
  2451     done
  2451     done
  2452   show "countably_additive (sets M) ?\<mu>"
  2452   show "countably_additive (sets M) ?\<mu>"
  2453     unfolding \<mu>_eq
  2453     unfolding \<mu>_eq
  2454   proof (intro countably_additiveI)
  2454   proof (intro countably_additiveI)
  2455     fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M"
  2455     fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M"
       
  2456     then have "\<And>i. A i \<in> sets M" by auto
  2456     then have *: "\<And>i. (\<lambda>x. max 0 (f x) * indicator (A i) x) \<in> borel_measurable M"
  2457     then have *: "\<And>i. (\<lambda>x. max 0 (f x) * indicator (A i) x) \<in> borel_measurable M"
  2457       using f by (auto intro!: borel_measurable_ereal_times)
  2458       by (auto simp: set_eq_iff)
  2458     assume disj: "disjoint_family A"
  2459     assume disj: "disjoint_family A"
  2459     have "(\<Sum>n. ?\<mu>' (A n)) = (\<integral>\<^isup>+ x. (\<Sum>n. max 0 (f x) * indicator (A n) x) \<partial>M)"
  2460     have "(\<Sum>n. ?\<mu>' (A n)) = (\<integral>\<^isup>+ x. (\<Sum>n. max 0 (f x) * indicator (A n) x) \<partial>M)"
  2460       using f * by (simp add: positive_integral_suminf)
  2461       using f * by (simp add: positive_integral_suminf)
  2461     also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) * (\<Sum>n. indicator (A n) x) \<partial>M)" using f
  2462     also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) * (\<Sum>n. indicator (A n) x) \<partial>M)" using f
  2462       by (auto intro!: suminf_cmult_ereal positive_integral_cong_AE)
  2463       by (auto intro!: suminf_cmult_ereal positive_integral_cong_AE)
  2481       unfolding eq
  2482       unfolding eq
  2482       using f `A \<in> sets M`
  2483       using f `A \<in> sets M`
  2483       by (intro positive_integral_0_iff) auto
  2484       by (intro positive_integral_0_iff) auto
  2484     also have "\<dots> \<longleftrightarrow> (AE x in M. max 0 (f x) * indicator A x = 0)"
  2485     also have "\<dots> \<longleftrightarrow> (AE x in M. max 0 (f x) * indicator A x = 0)"
  2485       using f `A \<in> sets M`
  2486       using f `A \<in> sets M`
  2486       by (intro AE_iff_measurable[OF _ refl, symmetric])
  2487       by (intro AE_iff_measurable[OF _ refl, symmetric]) auto
  2487          (auto intro!: sets_Collect borel_measurable_ereal_eq)
       
  2488     also have "(AE x in M. max 0 (f x) * indicator A x = 0) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)"
  2488     also have "(AE x in M. max 0 (f x) * indicator A x = 0) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)"
  2489       by (auto simp add: indicator_def max_def split: split_if_asm)
  2489       by (auto simp add: indicator_def max_def split: split_if_asm)
  2490     finally have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" . }
  2490     finally have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" . }
  2491   with f show ?thesis
  2491   with f show ?thesis
  2492     by (simp add: null_sets_def emeasure_density cong: conj_cong)
  2492     by (simp add: null_sets_def emeasure_density cong: conj_cong)
  2647 
  2647 
  2648 lemma measurable_point_measure_eq2_finite[simp]:
  2648 lemma measurable_point_measure_eq2_finite[simp]:
  2649   "finite A \<Longrightarrow>
  2649   "finite A \<Longrightarrow>
  2650    g \<in> measurable M (point_measure A f) \<longleftrightarrow>
  2650    g \<in> measurable M (point_measure A f) \<longleftrightarrow>
  2651     (g \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. g -` {a} \<inter> space M \<in> sets M))"
  2651     (g \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. g -` {a} \<inter> space M \<in> sets M))"
  2652   unfolding point_measure_def by simp
  2652   unfolding point_measure_def by (simp add: measurable_count_space_eq2)
  2653 
  2653 
  2654 lemma simple_function_point_measure[simp]:
  2654 lemma simple_function_point_measure[simp]:
  2655   "simple_function (point_measure A f) g \<longleftrightarrow> finite (g ` A)"
  2655   "simple_function (point_measure A f) g \<longleftrightarrow> finite (g ` A)"
  2656   by (simp add: point_measure_def)
  2656   by (simp add: point_measure_def)
  2657 
  2657