src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy
changeset 57025 e7fd64f82876
parent 56996 891e992e510f
child 57137 f174712d0a84
equal deleted inserted replaced
57024:c9e98c2498fd 57025:e7fd64f82876
   743   "_nn_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> 'a measure \<Rightarrow> ereal" ("\<integral>\<^sup>+ _. _ \<partial>_" [60,61] 110)
   743   "_nn_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> 'a measure \<Rightarrow> ereal" ("\<integral>\<^sup>+ _. _ \<partial>_" [60,61] 110)
   744 
   744 
   745 translations
   745 translations
   746   "\<integral>\<^sup>+x. f \<partial>M" == "CONST nn_integral M (\<lambda>x. f)"
   746   "\<integral>\<^sup>+x. f \<partial>M" == "CONST nn_integral M (\<lambda>x. f)"
   747 
   747 
   748 lemma nn_integral_nonneg:
   748 lemma nn_integral_nonneg: "0 \<le> integral\<^sup>N M f"
   749   "0 \<le> integral\<^sup>N M f"
       
   750   by (auto intro!: SUP_upper2[of "\<lambda>x. 0"] simp: nn_integral_def le_fun_def)
   749   by (auto intro!: SUP_upper2[of "\<lambda>x. 0"] simp: nn_integral_def le_fun_def)
   751 
   750 
   752 lemma nn_integral_not_MInfty[simp]: "integral\<^sup>N M f \<noteq> -\<infinity>"
   751 lemma nn_integral_not_MInfty[simp]: "integral\<^sup>N M f \<noteq> -\<infinity>"
   753   using nn_integral_nonneg[of M f] by auto
   752   using nn_integral_nonneg[of M f] by auto
   754 
   753 
  1385   qed (insert bounds, auto)
  1384   qed (insert bounds, auto)
  1386   also have "liminf (\<lambda>n. (\<integral>\<^sup>+x. w x \<partial>M) - (\<integral>\<^sup>+x. u n x \<partial>M)) = (\<integral>\<^sup>+x. w x \<partial>M) - limsup (\<lambda>n. \<integral>\<^sup>+x. u n x \<partial>M)"
  1385   also have "liminf (\<lambda>n. (\<integral>\<^sup>+x. w x \<partial>M) - (\<integral>\<^sup>+x. u n x \<partial>M)) = (\<integral>\<^sup>+x. w x \<partial>M) - limsup (\<lambda>n. \<integral>\<^sup>+x. u n x \<partial>M)"
  1387     using w by (intro liminf_ereal_cminus) auto
  1386     using w by (intro liminf_ereal_cminus) auto
  1388   finally show ?thesis
  1387   finally show ?thesis
  1389     by (rule ereal_mono_minus_cancel) (intro w nn_integral_nonneg)+
  1388     by (rule ereal_mono_minus_cancel) (intro w nn_integral_nonneg)+
       
  1389 qed
       
  1390 
       
  1391 lemma nn_integral_LIMSEQ:
       
  1392   assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M" "\<And>n x. 0 \<le> f n x"
       
  1393     and u: "\<And>x. (\<lambda>i. f i x) ----> u x"
       
  1394   shows "(\<lambda>n. integral\<^sup>N M (f n)) ----> integral\<^sup>N M u"
       
  1395 proof -
       
  1396   have "(\<lambda>n. integral\<^sup>N M (f n)) ----> (SUP n. integral\<^sup>N M (f n))"
       
  1397     using f by (intro LIMSEQ_SUP[of "\<lambda>n. integral\<^sup>N M (f n)"] incseq_nn_integral)
       
  1398   also have "(SUP n. integral\<^sup>N M (f n)) = integral\<^sup>N M (\<lambda>x. SUP n. f n x)"
       
  1399     using f by (intro nn_integral_monotone_convergence_SUP[symmetric])
       
  1400   also have "integral\<^sup>N M (\<lambda>x. SUP n. f n x) = integral\<^sup>N M (\<lambda>x. u x)"
       
  1401     using f by (subst SUP_Lim_ereal[OF _ u]) (auto simp: incseq_def le_fun_def)
       
  1402   finally show ?thesis .
  1390 qed
  1403 qed
  1391 
  1404 
  1392 lemma nn_integral_dominated_convergence:
  1405 lemma nn_integral_dominated_convergence:
  1393   assumes [measurable]:
  1406   assumes [measurable]:
  1394        "\<And>i. u i \<in> borel_measurable M" "u' \<in> borel_measurable M" "w \<in> borel_measurable M"
  1407        "\<And>i. u i \<in> borel_measurable M" "u' \<in> borel_measurable M" "w \<in> borel_measurable M"
  1666     finally show "(\<Sum>i. emeasure M (X x) * indicator {from_nat_into I i} x) = emeasure M (X x)" .
  1679     finally show "(\<Sum>i. emeasure M (X x) * indicator {from_nat_into I i} x) = emeasure M (X x)" .
  1667   qed
  1680   qed
  1668   finally show ?thesis .
  1681   finally show ?thesis .
  1669 qed
  1682 qed
  1670 
  1683 
       
  1684 lemma nn_integral_count_space_nat:
       
  1685   fixes f :: "nat \<Rightarrow> ereal"
       
  1686   assumes nonneg: "\<And>i. 0 \<le> f i"
       
  1687   shows "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) = (\<Sum>i. f i)"
       
  1688 proof -
       
  1689   have "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) =
       
  1690     (\<integral>\<^sup>+i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV)"
       
  1691   proof (intro nn_integral_cong)
       
  1692     fix i
       
  1693     have "f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)"
       
  1694       by simp
       
  1695     also have "\<dots> = (\<Sum>j. f j * indicator {j} i)"
       
  1696       by (rule suminf_finite[symmetric]) auto
       
  1697     finally show "f i = (\<Sum>j. f j * indicator {j} i)" .
       
  1698   qed
       
  1699   also have "\<dots> = (\<Sum>j. (\<integral>\<^sup>+i. f j * indicator {j} i \<partial>count_space UNIV))"
       
  1700     by (rule nn_integral_suminf) (auto simp: nonneg)
       
  1701   also have "\<dots> = (\<Sum>j. f j)"
       
  1702     by (simp add: nonneg nn_integral_cmult_indicator one_ereal_def[symmetric])
       
  1703   finally show ?thesis .
       
  1704 qed
       
  1705 
       
  1706 lemma emeasure_countable_singleton:
       
  1707   assumes sets: "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M" and X: "countable X"
       
  1708   shows "emeasure M X = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
       
  1709 proof -
       
  1710   have "emeasure M (\<Union>i\<in>X. {i}) = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
       
  1711     using assms by (intro emeasure_UN_countable) (auto simp: disjoint_family_on_def)
       
  1712   also have "(\<Union>i\<in>X. {i}) = X" by auto
       
  1713   finally show ?thesis .
       
  1714 qed
       
  1715 
       
  1716 lemma measure_eqI_countable:
       
  1717   assumes [simp]: "sets M = Pow A" "sets N = Pow A" and A: "countable A"
       
  1718   assumes eq: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} = emeasure N {a}"
       
  1719   shows "M = N"
       
  1720 proof (rule measure_eqI)
       
  1721   fix X assume "X \<in> sets M"
       
  1722   then have X: "X \<subseteq> A" by auto
       
  1723   moreover with A have "countable X" by (auto dest: countable_subset)
       
  1724   ultimately have
       
  1725     "emeasure M X = (\<integral>\<^sup>+a. emeasure M {a} \<partial>count_space X)"
       
  1726     "emeasure N X = (\<integral>\<^sup>+a. emeasure N {a} \<partial>count_space X)"
       
  1727     by (auto intro!: emeasure_countable_singleton)
       
  1728   moreover have "(\<integral>\<^sup>+a. emeasure M {a} \<partial>count_space X) = (\<integral>\<^sup>+a. emeasure N {a} \<partial>count_space X)"
       
  1729     using X by (intro nn_integral_cong eq) auto
       
  1730   ultimately show "emeasure M X = emeasure N X"
       
  1731     by simp
       
  1732 qed simp
       
  1733 
  1671 subsubsection {* Measures with Restricted Space *}
  1734 subsubsection {* Measures with Restricted Space *}
  1672 
  1735 
  1673 lemma nn_integral_restrict_space:
  1736 lemma nn_integral_restrict_space:
  1674   assumes \<Omega>: "\<Omega> \<in> sets M" and f: "f \<in> borel_measurable M" "\<And>x. 0 \<le> f x" "\<And>x. x \<in> space M - \<Omega> \<Longrightarrow> f x = 0"
  1737   assumes \<Omega>: "\<Omega> \<in> sets M" and f: "f \<in> borel_measurable M" "\<And>x. 0 \<le> f x" "\<And>x. x \<in> space M - \<Omega> \<Longrightarrow> f x = 0"
  1675   shows "nn_integral (restrict_space M \<Omega>) f = nn_integral M f"
  1738   shows "nn_integral (restrict_space M \<Omega>) f = nn_integral M f"