1179 lemma positive_integral_cmult_indicator: |
1179 lemma positive_integral_cmult_indicator: |
1180 "0 \<le> c \<Longrightarrow> A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x \<partial>M) = c * (emeasure M) A" |
1180 "0 \<le> c \<Longrightarrow> A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x \<partial>M) = c * (emeasure M) A" |
1181 by (subst positive_integral_eq_simple_integral) |
1181 by (subst positive_integral_eq_simple_integral) |
1182 (auto simp: simple_function_indicator simple_integral_indicator) |
1182 (auto simp: simple_function_indicator simple_integral_indicator) |
1183 |
1183 |
|
1184 lemma positive_integral_indicator': |
|
1185 assumes [measurable]: "A \<inter> space M \<in> sets M" |
|
1186 shows "(\<integral>\<^isup>+ x. indicator A x \<partial>M) = emeasure M (A \<inter> space M)" |
|
1187 proof - |
|
1188 have "(\<integral>\<^isup>+ x. indicator A x \<partial>M) = (\<integral>\<^isup>+ x. indicator (A \<inter> space M) x \<partial>M)" |
|
1189 by (intro positive_integral_cong) (simp split: split_indicator) |
|
1190 also have "\<dots> = emeasure M (A \<inter> space M)" |
|
1191 by simp |
|
1192 finally show ?thesis . |
|
1193 qed |
|
1194 |
1184 lemma positive_integral_add: |
1195 lemma positive_integral_add: |
1185 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" |
1196 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" |
1186 and g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
1197 and g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
1187 shows "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = integral\<^isup>P M f + integral\<^isup>P M g" |
1198 shows "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = integral\<^isup>P M f + integral\<^isup>P M g" |
1188 proof - |
1199 proof - |
1428 apply (simp_all add: positive_integral_add positive_integral_cmult positive_integral_monotone_convergence_SUP N) |
1439 apply (simp_all add: positive_integral_add positive_integral_cmult positive_integral_monotone_convergence_SUP N) |
1429 apply (auto intro!: positive_integral_cong cong: positive_integral_cong simp: N(2)[symmetric]) |
1440 apply (auto intro!: positive_integral_cong cong: positive_integral_cong simp: N(2)[symmetric]) |
1430 done |
1441 done |
1431 qed |
1442 qed |
1432 |
1443 |
|
1444 lemma positive_integral_nat_function: |
|
1445 fixes f :: "'a \<Rightarrow> nat" |
|
1446 assumes "f \<in> measurable M (count_space UNIV)" |
|
1447 shows "(\<integral>\<^isup>+x. ereal (of_nat (f x)) \<partial>M) = (\<Sum>t. emeasure M {x\<in>space M. t < f x})" |
|
1448 proof - |
|
1449 def F \<equiv> "\<lambda>i. {x\<in>space M. i < f x}" |
|
1450 with assms have [measurable]: "\<And>i. F i \<in> sets M" |
|
1451 by auto |
|
1452 |
|
1453 { fix x assume "x \<in> space M" |
|
1454 have "(\<lambda>i. if i < f x then 1 else 0) sums (of_nat (f x)::real)" |
|
1455 using sums_If_finite[of "\<lambda>i. i < f x" "\<lambda>_. 1::real"] by simp |
|
1456 then have "(\<lambda>i. ereal(if i < f x then 1 else 0)) sums (ereal(of_nat(f x)))" |
|
1457 unfolding sums_ereal . |
|
1458 moreover have "\<And>i. ereal (if i < f x then 1 else 0) = indicator (F i) x" |
|
1459 using `x \<in> space M` by (simp add: one_ereal_def F_def) |
|
1460 ultimately have "ereal(of_nat(f x)) = (\<Sum>i. indicator (F i) x)" |
|
1461 by (simp add: sums_iff) } |
|
1462 then have "(\<integral>\<^isup>+x. ereal (of_nat (f x)) \<partial>M) = (\<integral>\<^isup>+x. (\<Sum>i. indicator (F i) x) \<partial>M)" |
|
1463 by (simp cong: positive_integral_cong) |
|
1464 also have "\<dots> = (\<Sum>i. emeasure M (F i))" |
|
1465 by (simp add: positive_integral_suminf) |
|
1466 finally show ?thesis |
|
1467 by (simp add: F_def) |
|
1468 qed |
|
1469 |
1433 section "Lebesgue Integral" |
1470 section "Lebesgue Integral" |
1434 |
1471 |
1435 definition integrable :: "'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool" where |
1472 definition integrable :: "'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool" where |
1436 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> |
1473 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> |
1437 (\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1474 (\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1637 lemma integral_zero[simp, intro]: |
1674 lemma integral_zero[simp, intro]: |
1638 shows "integrable M (\<lambda>x. 0)" "(\<integral> x.0 \<partial>M) = 0" |
1675 shows "integrable M (\<lambda>x. 0)" "(\<integral> x.0 \<partial>M) = 0" |
1639 unfolding integrable_def lebesgue_integral_def |
1676 unfolding integrable_def lebesgue_integral_def |
1640 by auto |
1677 by auto |
1641 |
1678 |
1642 lemma integral_cmult[simp, intro]: |
1679 lemma lebesgue_integral_uminus: |
1643 assumes "integrable M f" |
1680 "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f" |
1644 shows "integrable M (\<lambda>t. a * f t)" (is ?P) |
1681 unfolding lebesgue_integral_def by simp |
1645 and "(\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" (is ?I) |
|
1646 proof - |
|
1647 have "integrable M (\<lambda>t. a * f t) \<and> (\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" |
|
1648 proof (cases rule: le_cases) |
|
1649 assume "0 \<le> a" show ?thesis |
|
1650 using integral_linear[OF assms integral_zero(1) `0 \<le> a`] |
|
1651 by simp |
|
1652 next |
|
1653 assume "a \<le> 0" hence "0 \<le> - a" by auto |
|
1654 have *: "\<And>t. - a * t + 0 = (-a) * t" by simp |
|
1655 show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`] |
|
1656 integral_minus(1)[of M "\<lambda>t. - a * f t"] |
|
1657 unfolding * integral_zero by simp |
|
1658 qed |
|
1659 thus ?P ?I by auto |
|
1660 qed |
|
1661 |
1682 |
1662 lemma lebesgue_integral_cmult_nonneg: |
1683 lemma lebesgue_integral_cmult_nonneg: |
1663 assumes f: "f \<in> borel_measurable M" and "0 \<le> c" |
1684 assumes f: "f \<in> borel_measurable M" and "0 \<le> c" |
1664 shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f" |
1685 shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f" |
1665 proof - |
1686 proof - |
1680 by (simp add: positive_integral_max_0) } |
1701 by (simp add: positive_integral_max_0) } |
1681 ultimately show ?thesis |
1702 ultimately show ?thesis |
1682 by (simp add: lebesgue_integral_def field_simps) |
1703 by (simp add: lebesgue_integral_def field_simps) |
1683 qed |
1704 qed |
1684 |
1705 |
1685 lemma lebesgue_integral_uminus: |
|
1686 "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f" |
|
1687 unfolding lebesgue_integral_def by simp |
|
1688 |
|
1689 lemma lebesgue_integral_cmult: |
1706 lemma lebesgue_integral_cmult: |
1690 assumes f: "f \<in> borel_measurable M" |
1707 assumes f: "f \<in> borel_measurable M" |
1691 shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f" |
1708 shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f" |
1692 proof (cases rule: linorder_le_cases) |
1709 proof (cases rule: linorder_le_cases) |
1693 assume "0 \<le> c" with f show ?thesis by (rule lebesgue_integral_cmult_nonneg) |
1710 assume "0 \<le> c" with f show ?thesis by (rule lebesgue_integral_cmult_nonneg) |
1696 with lebesgue_integral_cmult_nonneg[OF f, of "-c"] |
1713 with lebesgue_integral_cmult_nonneg[OF f, of "-c"] |
1697 show ?thesis |
1714 show ?thesis |
1698 by (simp add: lebesgue_integral_def) |
1715 by (simp add: lebesgue_integral_def) |
1699 qed |
1716 qed |
1700 |
1717 |
|
1718 lemma lebesgue_integral_multc: |
|
1719 "f \<in> borel_measurable M \<Longrightarrow> (\<integral>x. f x * c \<partial>M) = integral\<^isup>L M f * c" |
|
1720 using lebesgue_integral_cmult[of f M c] by (simp add: ac_simps) |
|
1721 |
1701 lemma integral_multc: |
1722 lemma integral_multc: |
|
1723 "integrable M f \<Longrightarrow> (\<integral> x. f x * c \<partial>M) = integral\<^isup>L M f * c" |
|
1724 by (simp add: lebesgue_integral_multc) |
|
1725 |
|
1726 lemma integral_cmult[simp, intro]: |
1702 assumes "integrable M f" |
1727 assumes "integrable M f" |
1703 shows "(\<integral> x. f x * c \<partial>M) = integral\<^isup>L M f * c" |
1728 shows "integrable M (\<lambda>t. a * f t)" (is ?P) |
1704 unfolding mult_commute[of _ c] integral_cmult[OF assms] .. |
1729 and "(\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" (is ?I) |
|
1730 proof - |
|
1731 have "integrable M (\<lambda>t. a * f t) \<and> (\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" |
|
1732 proof (cases rule: le_cases) |
|
1733 assume "0 \<le> a" show ?thesis |
|
1734 using integral_linear[OF assms integral_zero(1) `0 \<le> a`] |
|
1735 by simp |
|
1736 next |
|
1737 assume "a \<le> 0" hence "0 \<le> - a" by auto |
|
1738 have *: "\<And>t. - a * t + 0 = (-a) * t" by simp |
|
1739 show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`] |
|
1740 integral_minus(1)[of M "\<lambda>t. - a * f t"] |
|
1741 unfolding * integral_zero by simp |
|
1742 qed |
|
1743 thus ?P ?I by auto |
|
1744 qed |
1705 |
1745 |
1706 lemma integral_diff[simp, intro]: |
1746 lemma integral_diff[simp, intro]: |
1707 assumes f: "integrable M f" and g: "integrable M g" |
1747 assumes f: "integrable M f" and g: "integrable M g" |
1708 shows "integrable M (\<lambda>t. f t - g t)" |
1748 shows "integrable M (\<lambda>t. f t - g t)" |
1709 and "(\<integral> t. f t - g t \<partial>M) = integral\<^isup>L M f - integral\<^isup>L M g" |
1749 and "(\<integral> t. f t - g t \<partial>M) = integral\<^isup>L M f - integral\<^isup>L M g" |
1711 unfolding diff_minus integral_minus(2)[OF g] |
1751 unfolding diff_minus integral_minus(2)[OF g] |
1712 by auto |
1752 by auto |
1713 |
1753 |
1714 lemma integral_indicator[simp, intro]: |
1754 lemma integral_indicator[simp, intro]: |
1715 assumes "A \<in> sets M" and "(emeasure M) A \<noteq> \<infinity>" |
1755 assumes "A \<in> sets M" and "(emeasure M) A \<noteq> \<infinity>" |
1716 shows "integral\<^isup>L M (indicator A) = real ((emeasure M) A)" (is ?int) |
1756 shows "integral\<^isup>L M (indicator A) = real (emeasure M A)" (is ?int) |
1717 and "integrable M (indicator A)" (is ?able) |
1757 and "integrable M (indicator A)" (is ?able) |
1718 proof - |
1758 proof - |
1719 from `A \<in> sets M` have *: |
1759 from `A \<in> sets M` have *: |
1720 "\<And>x. ereal (indicator A x) = indicator A x" |
1760 "\<And>x. ereal (indicator A x) = indicator A x" |
1721 "(\<integral>\<^isup>+x. ereal (- indicator A x) \<partial>M) = 0" |
1761 "(\<integral>\<^isup>+x. ereal (- indicator A x) \<partial>M) = 0" |
1846 have "\<bar>integral\<^isup>L M f\<bar> = max (integral\<^isup>L M f) (- integral\<^isup>L M f)" by auto |
1886 have "\<bar>integral\<^isup>L M f\<bar> = max (integral\<^isup>L M f) (- integral\<^isup>L M f)" by auto |
1847 also have "\<dots> \<le> (\<integral>x. \<bar>f x\<bar> \<partial>M)" |
1887 also have "\<dots> \<le> (\<integral>x. \<bar>f x\<bar> \<partial>M)" |
1848 using assms integral_minus(2)[of M f, symmetric] |
1888 using assms integral_minus(2)[of M f, symmetric] |
1849 by (auto intro!: integral_mono integrable_abs simp del: integral_minus) |
1889 by (auto intro!: integral_mono integrable_abs simp del: integral_minus) |
1850 finally show ?thesis . |
1890 finally show ?thesis . |
|
1891 qed |
|
1892 |
|
1893 lemma integrable_nonneg: |
|
1894 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "(\<integral>\<^isup>+ x. f x \<partial>M) \<noteq> \<infinity>" |
|
1895 shows "integrable M f" |
|
1896 unfolding integrable_def |
|
1897 proof (intro conjI f) |
|
1898 have "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) = 0" |
|
1899 using f by (subst positive_integral_0_iff_AE) auto |
|
1900 then show "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" by simp |
1851 qed |
1901 qed |
1852 |
1902 |
1853 lemma integral_positive: |
1903 lemma integral_positive: |
1854 assumes "integrable M f" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" |
1904 assumes "integrable M f" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" |
1855 shows "0 \<le> integral\<^isup>L M f" |
1905 shows "0 \<le> integral\<^isup>L M f" |
1984 using assms unfolding lebesgue_integral_def |
2034 using assms unfolding lebesgue_integral_def |
1985 by (subst (1 2) positive_integral_cong_AE) (auto simp add: ereal_real) |
2035 by (subst (1 2) positive_integral_cong_AE) (auto simp add: ereal_real) |
1986 |
2036 |
1987 lemma (in finite_measure) lebesgue_integral_const[simp]: |
2037 lemma (in finite_measure) lebesgue_integral_const[simp]: |
1988 shows "integrable M (\<lambda>x. a)" |
2038 shows "integrable M (\<lambda>x. a)" |
1989 and "(\<integral>x. a \<partial>M) = a * (measure M) (space M)" |
2039 and "(\<integral>x. a \<partial>M) = a * measure M (space M)" |
1990 proof - |
2040 proof - |
1991 { fix a :: real assume "0 \<le> a" |
2041 { fix a :: real assume "0 \<le> a" |
1992 then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * (emeasure M) (space M)" |
2042 then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * (emeasure M) (space M)" |
1993 by (subst positive_integral_const) auto |
2043 by (subst positive_integral_const) auto |
1994 moreover |
2044 moreover |
2005 from *[OF this] show ?thesis by simp |
2055 from *[OF this] show ?thesis by simp |
2006 qed |
2056 qed |
2007 show "(\<integral>x. a \<partial>M) = a * measure M (space M)" |
2057 show "(\<integral>x. a \<partial>M) = a * measure M (space M)" |
2008 by (simp add: lebesgue_integral_def positive_integral_const_If emeasure_eq_measure) |
2058 by (simp add: lebesgue_integral_def positive_integral_const_If emeasure_eq_measure) |
2009 qed |
2059 qed |
|
2060 |
|
2061 lemma (in finite_measure) integrable_const_bound: |
|
2062 assumes "AE x in M. \<bar>f x\<bar> \<le> B" and "f \<in> borel_measurable M" shows "integrable M f" |
|
2063 by (auto intro: integrable_bound[where f="\<lambda>x. B"] lebesgue_integral_const assms) |
2010 |
2064 |
2011 lemma indicator_less[simp]: |
2065 lemma indicator_less[simp]: |
2012 "indicator A x \<le> (indicator B x::ereal) \<longleftrightarrow> (x \<in> A \<longrightarrow> x \<in> B)" |
2066 "indicator A x \<le> (indicator B x::ereal) \<longleftrightarrow> (x \<in> A \<longrightarrow> x \<in> B)" |
2013 by (simp add: indicator_def not_le) |
2067 by (simp add: indicator_def not_le) |
2014 |
2068 |