src/HOL/Probability/Lebesgue_Integration.thy
changeset 43339 9ba256ad6781
parent 42991 3fa22920bf86
child 43920 cedb5cb948fd
equal deleted inserted replaced
43338:a150d16bf77c 43339:9ba256ad6781
  1710 lemma (in measure_space) integral_cong_measure:
  1710 lemma (in measure_space) integral_cong_measure:
  1711   assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
  1711   assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
  1712   shows "integral\<^isup>L N f = integral\<^isup>L M f"
  1712   shows "integral\<^isup>L N f = integral\<^isup>L M f"
  1713   by (simp add: positive_integral_cong_measure[OF assms] lebesgue_integral_def)
  1713   by (simp add: positive_integral_cong_measure[OF assms] lebesgue_integral_def)
  1714 
  1714 
       
  1715 lemma (in measure_space) integrable_cong_measure:
       
  1716   assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
       
  1717   shows "integrable N f \<longleftrightarrow> integrable M f"
       
  1718   using assms
       
  1719   by (simp add: positive_integral_cong_measure[OF assms] integrable_def measurable_def)
       
  1720 
  1715 lemma (in measure_space) integral_cong_AE:
  1721 lemma (in measure_space) integral_cong_AE:
  1716   assumes cong: "AE x. f x = g x"
  1722   assumes cong: "AE x. f x = g x"
  1717   shows "integral\<^isup>L M f = integral\<^isup>L M g"
  1723   shows "integral\<^isup>L M f = integral\<^isup>L M g"
  1718 proof -
  1724 proof -
  1719   have *: "AE x. extreal (f x) = extreal (g x)"
  1725   have *: "AE x. extreal (f x) = extreal (g x)"
  1720     "AE x. extreal (- f x) = extreal (- g x)" using cong by auto
  1726     "AE x. extreal (- f x) = extreal (- g x)" using cong by auto
  1721   show ?thesis
  1727   show ?thesis
  1722     unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def ..
  1728     unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def ..
       
  1729 qed
       
  1730 
       
  1731 lemma (in measure_space) integrable_cong_AE:
       
  1732   assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
       
  1733   assumes "AE x. f x = g x"
       
  1734   shows "integrable M f = integrable M g"
       
  1735 proof -
       
  1736   have "(\<integral>\<^isup>+ x. extreal (f x) \<partial>M) = (\<integral>\<^isup>+ x. extreal (g x) \<partial>M)"
       
  1737     "(\<integral>\<^isup>+ x. extreal (- f x) \<partial>M) = (\<integral>\<^isup>+ x. extreal (- g x) \<partial>M)"
       
  1738     using assms by (auto intro!: positive_integral_cong_AE)
       
  1739   with assms show ?thesis
       
  1740     by (auto simp: integrable_def)
  1723 qed
  1741 qed
  1724 
  1742 
  1725 lemma (in measure_space) integrable_cong:
  1743 lemma (in measure_space) integrable_cong:
  1726   "(\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> integrable M f \<longleftrightarrow> integrable M g"
  1744   "(\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> integrable M f \<longleftrightarrow> integrable M g"
  1727   by (simp cong: positive_integral_cong measurable_cong add: integrable_def)
  1745   by (simp cong: positive_integral_cong measurable_cong add: integrable_def)
  1763     and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
  1781     and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
  1764     using f by (auto simp: comp_def)
  1782     using f by (auto simp: comp_def)
  1765   then show ?thesis
  1783   then show ?thesis
  1766     using f unfolding lebesgue_integral_def integrable_def
  1784     using f unfolding lebesgue_integral_def integrable_def
  1767     by (auto simp: borel[THEN positive_integral_vimage[OF T]])
  1785     by (auto simp: borel[THEN positive_integral_vimage[OF T]])
       
  1786 qed
       
  1787 
       
  1788 lemma (in measure_space) integral_translated_density:
       
  1789   assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
       
  1790     and g: "g \<in> borel_measurable M"
       
  1791     and N: "space N = space M" "sets N = sets M"
       
  1792     and density: "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
       
  1793       (is "\<And>A. _ \<Longrightarrow> _ = ?d A")
       
  1794   shows "integral\<^isup>L N g = (\<integral> x. f x * g x \<partial>M)" (is ?integral)
       
  1795     and "integrable N g = integrable M (\<lambda>x. f x * g x)" (is ?integrable)
       
  1796 proof -
       
  1797   from f have ms: "measure_space (M\<lparr>measure := ?d\<rparr>)"
       
  1798     by (intro measure_space_density[where u="\<lambda>x. extreal (f x)"]) auto
       
  1799 
       
  1800   from ms density N have "(\<integral>\<^isup>+ x. g x \<partial>N) =  (\<integral>\<^isup>+ x. max 0 (extreal (g x)) \<partial>M\<lparr>measure := ?d\<rparr>)"
       
  1801     unfolding positive_integral_max_0
       
  1802     by (intro measure_space.positive_integral_cong_measure) auto
       
  1803   also have "\<dots> = (\<integral>\<^isup>+ x. extreal (f x) * max 0 (extreal (g x)) \<partial>M)"
       
  1804     using f g by (intro positive_integral_translated_density) auto
       
  1805   also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (extreal (f x * g x)) \<partial>M)"
       
  1806     using f by (intro positive_integral_cong_AE)
       
  1807                (auto simp: extreal_max_0 zero_le_mult_iff split: split_max)
       
  1808   finally have pos: "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. f x * g x \<partial>M)"
       
  1809     by (simp add: positive_integral_max_0)
       
  1810   
       
  1811   from ms density N have "(\<integral>\<^isup>+ x. - (g x) \<partial>N) =  (\<integral>\<^isup>+ x. max 0 (extreal (- g x)) \<partial>M\<lparr>measure := ?d\<rparr>)"
       
  1812     unfolding positive_integral_max_0
       
  1813     by (intro measure_space.positive_integral_cong_measure) auto
       
  1814   also have "\<dots> = (\<integral>\<^isup>+ x. extreal (f x) * max 0 (extreal (- g x)) \<partial>M)"
       
  1815     using f g by (intro positive_integral_translated_density) auto
       
  1816   also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (extreal (- f x * g x)) \<partial>M)"
       
  1817     using f by (intro positive_integral_cong_AE)
       
  1818                (auto simp: extreal_max_0 mult_le_0_iff split: split_max)
       
  1819   finally have neg: "(\<integral>\<^isup>+ x. - g x \<partial>N) = (\<integral>\<^isup>+ x. - (f x * g x) \<partial>M)"
       
  1820     by (simp add: positive_integral_max_0)
       
  1821 
       
  1822   have g_N: "g \<in> borel_measurable N"
       
  1823     using g N unfolding measurable_def by simp
       
  1824 
       
  1825   show ?integral ?integrable
       
  1826     unfolding lebesgue_integral_def integrable_def
       
  1827     using pos neg f g g_N by auto
  1768 qed
  1828 qed
  1769 
  1829 
  1770 lemma (in measure_space) integral_minus[intro, simp]:
  1830 lemma (in measure_space) integral_minus[intro, simp]:
  1771   assumes "integrable M f"
  1831   assumes "integrable M f"
  1772   shows "integrable M (\<lambda>x. - f x)" "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f"
  1832   shows "integrable M (\<lambda>x. - f x)" "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f"
  2219   qed
  2279   qed
  2220   show "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)"
  2280   show "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)"
  2221     by (simp add: \<mu>'_def lebesgue_integral_def positive_integral_const_If)
  2281     by (simp add: \<mu>'_def lebesgue_integral_def positive_integral_const_If)
  2222 qed
  2282 qed
  2223 
  2283 
       
  2284 lemma indicator_less[simp]:
       
  2285   "indicator A x \<le> (indicator B x::extreal) \<longleftrightarrow> (x \<in> A \<longrightarrow> x \<in> B)"
       
  2286   by (simp add: indicator_def not_le)
       
  2287 
  2224 lemma (in finite_measure) integral_less_AE:
  2288 lemma (in finite_measure) integral_less_AE:
  2225   assumes int: "integrable M X" "integrable M Y"
  2289   assumes int: "integrable M X" "integrable M Y"
  2226   assumes gt: "AE x. X x < Y x" and neq0: "\<mu> (space M) \<noteq> 0"
  2290   assumes A: "\<mu> A \<noteq> 0" "A \<in> sets M" "AE x. x \<in> A \<longrightarrow> X x \<noteq> Y x"
       
  2291   assumes gt: "AE x. X x \<le> Y x"
  2227   shows "integral\<^isup>L M X < integral\<^isup>L M Y"
  2292   shows "integral\<^isup>L M X < integral\<^isup>L M Y"
  2228 proof -
  2293 proof -
  2229   have "integral\<^isup>L M X \<le> integral\<^isup>L M Y"
  2294   have "integral\<^isup>L M X \<le> integral\<^isup>L M Y"
  2230     using gt int by (intro integral_mono_AE) auto
  2295     using gt int by (intro integral_mono_AE) auto
  2231   moreover
  2296   moreover
  2232   have "integral\<^isup>L M X \<noteq> integral\<^isup>L M Y"
  2297   have "integral\<^isup>L M X \<noteq> integral\<^isup>L M Y"
  2233   proof
  2298   proof
  2234     from gt have "AE x. Y x - X x \<noteq> 0"
       
  2235       by auto
       
  2236     then have \<mu>: "\<mu> {x\<in>space M. Y x - X x \<noteq> 0} = \<mu> (space M)"
       
  2237       using int
       
  2238       by (intro AE_measure borel_measurable_neq) (auto simp add: integrable_def)
       
  2239 
       
  2240     assume eq: "integral\<^isup>L M X = integral\<^isup>L M Y"
  2299     assume eq: "integral\<^isup>L M X = integral\<^isup>L M Y"
  2241     have "integral\<^isup>L M (\<lambda>x. \<bar>Y x - X x\<bar>) = integral\<^isup>L M (\<lambda>x. Y x - X x)"
  2300     have "integral\<^isup>L M (\<lambda>x. \<bar>Y x - X x\<bar>) = integral\<^isup>L M (\<lambda>x. Y x - X x)"
  2242       using gt by (intro integral_cong_AE) auto
  2301       using gt by (intro integral_cong_AE) auto
  2243     also have "\<dots> = 0"
  2302     also have "\<dots> = 0"
  2244       using eq int by simp
  2303       using eq int by simp
  2245     finally show False
  2304     finally have "\<mu> {x \<in> space M. Y x - X x \<noteq> 0} = 0"
  2246       using \<mu> int neq0
  2305       using int by (simp add: integral_0_iff)
  2247       by (subst (asm) integral_0_iff) auto
  2306     moreover
       
  2307     have "(\<integral>\<^isup>+x. indicator A x \<partial>M) \<le> (\<integral>\<^isup>+x. indicator {x \<in> space M. Y x - X x \<noteq> 0} x \<partial>M)"
       
  2308       using A by (intro positive_integral_mono_AE) auto
       
  2309     then have "\<mu> A \<le> \<mu> {x \<in> space M. Y x - X x \<noteq> 0}"
       
  2310       using int A by (simp add: integrable_def)
       
  2311     moreover note `\<mu> A \<noteq> 0` positive_measure[OF `A \<in> sets M`]
       
  2312     ultimately show False by auto
  2248   qed
  2313   qed
  2249   ultimately show ?thesis by auto
  2314   ultimately show ?thesis by auto
  2250 qed
  2315 qed
       
  2316 
       
  2317 lemma (in finite_measure) integral_less_AE_space:
       
  2318   assumes int: "integrable M X" "integrable M Y"
       
  2319   assumes gt: "AE x. X x < Y x" "\<mu> (space M) \<noteq> 0"
       
  2320   shows "integral\<^isup>L M X < integral\<^isup>L M Y"
       
  2321   using gt by (intro integral_less_AE[OF int, where A="space M"]) auto
  2251 
  2322 
  2252 lemma (in measure_space) integral_dominated_convergence:
  2323 lemma (in measure_space) integral_dominated_convergence:
  2253   assumes u: "\<And>i. integrable M (u i)" and bound: "\<And>x j. x\<in>space M \<Longrightarrow> \<bar>u j x\<bar> \<le> w x"
  2324   assumes u: "\<And>i. integrable M (u i)" and bound: "\<And>x j. x\<in>space M \<Longrightarrow> \<bar>u j x\<bar> \<le> w x"
  2254   and w: "integrable M w"
  2325   and w: "integrable M w"
  2255   and u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"
  2326   and u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"