src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy
changeset 70136 f03a01a18c6e
parent 70097 4005298550a6
child 71633 07bec530f02e
equal deleted inserted replaced
70135:ad6d4a14adb5 70136:f03a01a18c6e
     7 
     7 
     8 theory Nonnegative_Lebesgue_Integration
     8 theory Nonnegative_Lebesgue_Integration
     9   imports Measure_Space Borel_Space
     9   imports Measure_Space Borel_Space
    10 begin
    10 begin
    11 
    11 
    12 subsection%unimportant \<open>Approximating functions\<close>
    12 subsection\<^marker>\<open>tag unimportant\<close> \<open>Approximating functions\<close>
    13 
    13 
    14 lemma AE_upper_bound_inf_ennreal:
    14 lemma AE_upper_bound_inf_ennreal:
    15   fixes F G::"'a \<Rightarrow> ennreal"
    15   fixes F G::"'a \<Rightarrow> ennreal"
    16   assumes "\<And>e. (e::real) > 0 \<Longrightarrow> AE x in M. F x \<le> G x + e"
    16   assumes "\<And>e. (e::real) > 0 \<Longrightarrow> AE x in M. F x \<le> G x + e"
    17   shows "AE x in M. F x \<le> G x"
    17   shows "AE x in M. F x \<le> G x"
   113 they are just functions with a finite range and are measurable when singleton
   113 they are just functions with a finite range and are measurable when singleton
   114 sets are measurable.
   114 sets are measurable.
   115 
   115 
   116 \<close>
   116 \<close>
   117 
   117 
   118 definition%important "simple_function M g \<longleftrightarrow>
   118 definition\<^marker>\<open>tag important\<close> "simple_function M g \<longleftrightarrow>
   119     finite (g ` space M) \<and>
   119     finite (g ` space M) \<and>
   120     (\<forall>x \<in> g ` space M. g -` {x} \<inter> space M \<in> sets M)"
   120     (\<forall>x \<in> g ` space M. g -` {x} \<inter> space M \<in> sets M)"
   121 
   121 
   122 lemma simple_functionD:
   122 lemma simple_functionD:
   123   assumes "simple_function M g"
   123   assumes "simple_function M g"
   299 lemma simple_function_real_of_nat[intro, simp]:
   299 lemma simple_function_real_of_nat[intro, simp]:
   300   fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f"
   300   fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f"
   301   shows "simple_function M (\<lambda>x. real (f x))"
   301   shows "simple_function M (\<lambda>x. real (f x))"
   302   by (rule simple_function_compose1[OF sf])
   302   by (rule simple_function_compose1[OF sf])
   303 
   303 
   304 lemma%important borel_measurable_implies_simple_function_sequence:
   304 lemma\<^marker>\<open>tag important\<close> borel_measurable_implies_simple_function_sequence:
   305   fixes u :: "'a \<Rightarrow> ennreal"
   305   fixes u :: "'a \<Rightarrow> ennreal"
   306   assumes u[measurable]: "u \<in> borel_measurable M"
   306   assumes u[measurable]: "u \<in> borel_measurable M"
   307   shows "\<exists>f. incseq f \<and> (\<forall>i. (\<forall>x. f i x < top) \<and> simple_function M (f i)) \<and> u = (SUP i. f i)"
   307   shows "\<exists>f. incseq f \<and> (\<forall>i. (\<forall>x. f i x < top) \<and> simple_function M (f i)) \<and> u = (SUP i. f i)"
   308 proof%unimportant -
   308 proof -
   309   define f where [abs_def]:
   309   define f where [abs_def]:
   310     "f i x = real_of_int (floor (enn2real (min i (u x)) * 2^i)) / 2^i" for i x
   310     "f i x = real_of_int (floor (enn2real (min i (u x)) * 2^i)) / 2^i" for i x
   311 
   311 
   312   have [simp]: "0 \<le> f i x" for i x
   312   have [simp]: "0 \<le> f i x" for i x
   313     by (auto simp: f_def intro!: divide_nonneg_nonneg mult_nonneg_nonneg enn2real_nonneg)
   313     by (auto simp: f_def intro!: divide_nonneg_nonneg mult_nonneg_nonneg enn2real_nonneg)
   395   obtains f where
   395   obtains f where
   396     "\<And>i. simple_function M (f i)" "incseq f" "\<And>i x. f i x < top" "\<And>x. (SUP i. f i x) = u x"
   396     "\<And>i. simple_function M (f i)" "incseq f" "\<And>i x. f i x < top" "\<And>x. (SUP i. f i x) = u x"
   397   using borel_measurable_implies_simple_function_sequence [OF u]
   397   using borel_measurable_implies_simple_function_sequence [OF u]
   398   by (metis SUP_apply)
   398   by (metis SUP_apply)
   399 
   399 
   400 lemma%important simple_function_induct
   400 lemma\<^marker>\<open>tag important\<close> simple_function_induct
   401     [consumes 1, case_names cong set mult add, induct set: simple_function]:
   401     [consumes 1, case_names cong set mult add, induct set: simple_function]:
   402   fixes u :: "'a \<Rightarrow> ennreal"
   402   fixes u :: "'a \<Rightarrow> ennreal"
   403   assumes u: "simple_function M u"
   403   assumes u: "simple_function M u"
   404   assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> simple_function M g \<Longrightarrow> (AE x in M. f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g"
   404   assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> simple_function M g \<Longrightarrow> (AE x in M. f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g"
   405   assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
   405   assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
   406   assumes mult: "\<And>u c. P u \<Longrightarrow> P (\<lambda>x. c * u x)"
   406   assumes mult: "\<And>u c. P u \<Longrightarrow> P (\<lambda>x. c * u x)"
   407   assumes add: "\<And>u v. P u \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
   407   assumes add: "\<And>u v. P u \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
   408   shows "P u"
   408   shows "P u"
   409 proof%unimportant (rule cong)
   409 proof (rule cong)
   410   from AE_space show "AE x in M. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x"
   410   from AE_space show "AE x in M. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x"
   411   proof eventually_elim
   411   proof eventually_elim
   412     fix x assume x: "x \<in> space M"
   412     fix x assume x: "x \<in> space M"
   413     from simple_function_indicator_representation[OF u x]
   413     from simple_function_indicator_representation[OF u x]
   414     show "(\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x" ..
   414     show "(\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x" ..
   466         by (auto intro!: add mult set simple_functionD u simple_function_sum disj)
   466         by (auto intro!: add mult set simple_functionD u simple_function_sum disj)
   467     qed
   467     qed
   468   qed fact
   468   qed fact
   469 qed
   469 qed
   470 
   470 
   471 lemma%important borel_measurable_induct
   471 lemma\<^marker>\<open>tag important\<close> borel_measurable_induct
   472     [consumes 1, case_names cong set mult add seq, induct set: borel_measurable]:
   472     [consumes 1, case_names cong set mult add seq, induct set: borel_measurable]:
   473   fixes u :: "'a \<Rightarrow> ennreal"
   473   fixes u :: "'a \<Rightarrow> ennreal"
   474   assumes u: "u \<in> borel_measurable M"
   474   assumes u: "u \<in> borel_measurable M"
   475   assumes cong: "\<And>f g. f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P g \<Longrightarrow> P f"
   475   assumes cong: "\<And>f g. f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P g \<Longrightarrow> P f"
   476   assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
   476   assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
   477   assumes mult': "\<And>u c. c < top \<Longrightarrow> u \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x < top) \<Longrightarrow> P u \<Longrightarrow> P (\<lambda>x. c * u x)"
   477   assumes mult': "\<And>u c. c < top \<Longrightarrow> u \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x < top) \<Longrightarrow> P u \<Longrightarrow> P (\<lambda>x. c * u x)"
   478   assumes add: "\<And>u v. u \<in> borel_measurable M\<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x < top) \<Longrightarrow> P u \<Longrightarrow> v \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> v x < top) \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x = 0 \<or> v x = 0) \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
   478   assumes add: "\<And>u v. u \<in> borel_measurable M\<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x < top) \<Longrightarrow> P u \<Longrightarrow> v \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> v x < top) \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x = 0 \<or> v x = 0) \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
   479   assumes seq: "\<And>U. (\<And>i. U i \<in> borel_measurable M) \<Longrightarrow> (\<And>i x. x \<in> space M \<Longrightarrow> U i x < top) \<Longrightarrow> (\<And>i. P (U i)) \<Longrightarrow> incseq U \<Longrightarrow> u = (SUP i. U i) \<Longrightarrow> P (SUP i. U i)"
   479   assumes seq: "\<And>U. (\<And>i. U i \<in> borel_measurable M) \<Longrightarrow> (\<And>i x. x \<in> space M \<Longrightarrow> U i x < top) \<Longrightarrow> (\<And>i. P (U i)) \<Longrightarrow> incseq U \<Longrightarrow> u = (SUP i. U i) \<Longrightarrow> P (SUP i. U i)"
   480   shows "P u"
   480   shows "P u"
   481   using%unimportant u
   481   using u
   482 proof%unimportant (induct rule: borel_measurable_implies_simple_function_sequence')
   482 proof (induct rule: borel_measurable_implies_simple_function_sequence')
   483   fix U assume U: "\<And>i. simple_function M (U i)" "incseq U" "\<And>i x. U i x < top" and sup: "\<And>x. (SUP i. U i x) = u x"
   483   fix U assume U: "\<And>i. simple_function M (U i)" "incseq U" "\<And>i x. U i x < top" and sup: "\<And>x. (SUP i. U i x) = u x"
   484   have u_eq: "u = (SUP i. U i)"
   484   have u_eq: "u = (SUP i. U i)"
   485     using u by (auto simp add: image_comp sup)
   485     using u by (auto simp add: image_comp sup)
   486 
   486 
   487   have not_inf: "\<And>x i. x \<in> space M \<Longrightarrow> U i x < top"
   487   have not_inf: "\<And>x i. x \<in> space M \<Longrightarrow> U i x < top"
   578   finally show "(\<lambda>x. f (T x)) -` {i} \<inter> space M \<in> sets M" .
   578   finally show "(\<lambda>x. f (T x)) -` {i} \<inter> space M \<in> sets M" .
   579 qed
   579 qed
   580 
   580 
   581 subsection "Simple integral"
   581 subsection "Simple integral"
   582 
   582 
   583 definition%important simple_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>S") where
   583 definition\<^marker>\<open>tag important\<close> simple_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>S") where
   584   "integral\<^sup>S M f = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M))"
   584   "integral\<^sup>S M f = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M))"
   585 
   585 
   586 syntax
   586 syntax
   587   "_simple_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>S _. _ \<partial>_" [60,61] 110)
   587   "_simple_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>S _. _ \<partial>_" [60,61] 110)
   588 
   588 
   811   then show ?thesis by simp
   811   then show ?thesis by simp
   812 qed
   812 qed
   813 
   813 
   814 subsection \<open>Integral on nonnegative functions\<close>
   814 subsection \<open>Integral on nonnegative functions\<close>
   815 
   815 
   816 definition%important nn_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>N") where
   816 definition\<^marker>\<open>tag important\<close> nn_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>N") where
   817   "integral\<^sup>N M f = (SUP g \<in> {g. simple_function M g \<and> g \<le> f}. integral\<^sup>S M g)"
   817   "integral\<^sup>N M f = (SUP g \<in> {g. simple_function M g \<and> g \<le> f}. integral\<^sup>S M g)"
   818 
   818 
   819 syntax
   819 syntax
   820   "_nn_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>+((2 _./ _)/ \<partial>_)" [60,61] 110)
   820   "_nn_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>+((2 _./ _)/ \<partial>_)" [60,61] 110)
   821 
   821 
  1643 qed
  1643 qed
  1644 
  1644 
  1645 lemma nn_integral_bot[simp]: "nn_integral bot f = 0"
  1645 lemma nn_integral_bot[simp]: "nn_integral bot f = 0"
  1646   by (simp add: nn_integral_empty)
  1646   by (simp add: nn_integral_empty)
  1647 
  1647 
  1648 subsubsection%unimportant \<open>Distributions\<close>
  1648 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Distributions\<close>
  1649 
  1649 
  1650 lemma nn_integral_distr:
  1650 lemma nn_integral_distr:
  1651   assumes T: "T \<in> measurable M M'" and f: "f \<in> borel_measurable (distr M M' T)"
  1651   assumes T: "T \<in> measurable M M'" and f: "f \<in> borel_measurable (distr M M' T)"
  1652   shows "integral\<^sup>N (distr M M' T) f = (\<integral>\<^sup>+ x. f (T x) \<partial>M)"
  1652   shows "integral\<^sup>N (distr M M' T) f = (\<integral>\<^sup>+ x. f (T x) \<partial>M)"
  1653   using f
  1653   using f
  1668     by (subst nn_integral_cong[OF eq])
  1668     by (subst nn_integral_cong[OF eq])
  1669        (auto simp add: emeasure_distr intro!: nn_integral_indicator[symmetric] measurable_sets)
  1669        (auto simp add: emeasure_distr intro!: nn_integral_indicator[symmetric] measurable_sets)
  1670 qed (simp_all add: measurable_compose[OF T] T nn_integral_cmult nn_integral_add
  1670 qed (simp_all add: measurable_compose[OF T] T nn_integral_cmult nn_integral_add
  1671                    nn_integral_monotone_convergence_SUP le_fun_def incseq_def image_comp)
  1671                    nn_integral_monotone_convergence_SUP le_fun_def incseq_def image_comp)
  1672 
  1672 
  1673 subsubsection%unimportant \<open>Counting space\<close>
  1673 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Counting space\<close>
  1674 
  1674 
  1675 lemma simple_function_count_space[simp]:
  1675 lemma simple_function_count_space[simp]:
  1676   "simple_function (count_space A) f \<longleftrightarrow> finite (f ` A)"
  1676   "simple_function (count_space A) f \<longleftrightarrow> finite (f ` A)"
  1677   unfolding simple_function_def by simp
  1677   unfolding simple_function_def by simp
  1678 
  1678 
  2081   finally show ?thesis .
  2081   finally show ?thesis .
  2082 qed
  2082 qed
  2083 
  2083 
  2084 subsubsection \<open>Measure spaces with an associated density\<close>
  2084 subsubsection \<open>Measure spaces with an associated density\<close>
  2085 
  2085 
  2086 definition%important density :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
  2086 definition\<^marker>\<open>tag important\<close> density :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
  2087   "density M f = measure_of (space M) (sets M) (\<lambda>A. \<integral>\<^sup>+ x. f x * indicator A x \<partial>M)"
  2087   "density M f = measure_of (space M) (sets M) (\<lambda>A. \<integral>\<^sup>+ x. f x * indicator A x \<partial>M)"
  2088 
  2088 
  2089 lemma
  2089 lemma
  2090   shows sets_density[simp, measurable_cong]: "sets (density M f) = sets M"
  2090   shows sets_density[simp, measurable_cong]: "sets (density M f) = sets M"
  2091     and space_density[simp]: "space (density M f) = space M"
  2091     and space_density[simp]: "space (density M f) = space M"
  2168     using ae2
  2168     using ae2
  2169     unfolding eventually_ae_filter[of _ "density M f"] Bex_def null_sets_density_iff[OF f]
  2169     unfolding eventually_ae_filter[of _ "density M f"] Bex_def null_sets_density_iff[OF f]
  2170     by (intro exI[of _ "N \<union> {x\<in>space M. f x = 0}"] conjI *) (auto elim: eventually_elim2)
  2170     by (intro exI[of _ "N \<union> {x\<in>space M. f x = 0}"] conjI *) (auto elim: eventually_elim2)
  2171 qed
  2171 qed
  2172 
  2172 
  2173 lemma%important nn_integral_density:
  2173 lemma\<^marker>\<open>tag important\<close> nn_integral_density:
  2174   assumes f: "f \<in> borel_measurable M"
  2174   assumes f: "f \<in> borel_measurable M"
  2175   assumes g: "g \<in> borel_measurable M"
  2175   assumes g: "g \<in> borel_measurable M"
  2176   shows "integral\<^sup>N (density M f) g = (\<integral>\<^sup>+ x. f x * g x \<partial>M)"
  2176   shows "integral\<^sup>N (density M f) g = (\<integral>\<^sup>+ x. f x * g x \<partial>M)"
  2177 using%unimportant g proof%unimportant induct
  2177 using g proof induct
  2178   case (cong u v)
  2178   case (cong u v)
  2179   then show ?case
  2179   then show ?case
  2180     apply (subst nn_integral_cong[OF cong(3)])
  2180     apply (subst nn_integral_cong[OF cong(3)])
  2181     apply (simp_all cong: nn_integral_cong)
  2181     apply (simp_all cong: nn_integral_cong)
  2182     done
  2182     done
  2291   apply (intro nn_integral_cong, simp split: split_indicator)
  2291   apply (intro nn_integral_cong, simp split: split_indicator)
  2292   done
  2292   done
  2293 
  2293 
  2294 subsubsection \<open>Point measure\<close>
  2294 subsubsection \<open>Point measure\<close>
  2295 
  2295 
  2296 definition%important point_measure :: "'a set \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
  2296 definition\<^marker>\<open>tag important\<close> point_measure :: "'a set \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
  2297   "point_measure A f = density (count_space A) f"
  2297   "point_measure A f = density (count_space A) f"
  2298 
  2298 
  2299 lemma
  2299 lemma
  2300   shows space_point_measure: "space (point_measure A f) = A"
  2300   shows space_point_measure: "space (point_measure A f) = A"
  2301     and sets_point_measure: "sets (point_measure A f) = Pow A"
  2301     and sets_point_measure: "sets (point_measure A f) = Pow A"
  2357   "finite A \<Longrightarrow> integral\<^sup>N (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)"
  2357   "finite A \<Longrightarrow> integral\<^sup>N (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)"
  2358   by (subst nn_integral_point_measure) (auto intro!: sum.mono_neutral_left simp: less_le)
  2358   by (subst nn_integral_point_measure) (auto intro!: sum.mono_neutral_left simp: less_le)
  2359 
  2359 
  2360 subsubsection \<open>Uniform measure\<close>
  2360 subsubsection \<open>Uniform measure\<close>
  2361 
  2361 
  2362 definition%important "uniform_measure M A = density M (\<lambda>x. indicator A x / emeasure M A)"
  2362 definition\<^marker>\<open>tag important\<close> "uniform_measure M A = density M (\<lambda>x. indicator A x / emeasure M A)"
  2363 
  2363 
  2364 lemma
  2364 lemma
  2365   shows sets_uniform_measure[simp, measurable_cong]: "sets (uniform_measure M A) = sets M"
  2365   shows sets_uniform_measure[simp, measurable_cong]: "sets (uniform_measure M A) = sets M"
  2366     and space_uniform_measure[simp]: "space (uniform_measure M A) = space M"
  2366     and space_uniform_measure[simp]: "space (uniform_measure M A) = space M"
  2367   by (auto simp: uniform_measure_def)
  2367   by (auto simp: uniform_measure_def)
  2432     by (cases "emeasure M A") (auto split: split_indicator simp: ennreal_zero_less_divide)
  2432     by (cases "emeasure M A") (auto split: split_indicator simp: ennreal_zero_less_divide)
  2433   ultimately show ?thesis
  2433   ultimately show ?thesis
  2434     unfolding uniform_measure_def by (simp add: AE_density)
  2434     unfolding uniform_measure_def by (simp add: AE_density)
  2435 qed
  2435 qed
  2436 
  2436 
  2437 subsubsection%unimportant \<open>Null measure\<close>
  2437 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Null measure\<close>
  2438 
  2438 
  2439 lemma null_measure_eq_density: "null_measure M = density M (\<lambda>_. 0)"
  2439 lemma null_measure_eq_density: "null_measure M = density M (\<lambda>_. 0)"
  2440   by (intro measure_eqI) (simp_all add: emeasure_density)
  2440   by (intro measure_eqI) (simp_all add: emeasure_density)
  2441 
  2441 
  2442 lemma nn_integral_null_measure[simp]: "(\<integral>\<^sup>+x. f x \<partial>null_measure M) = 0"
  2442 lemma nn_integral_null_measure[simp]: "(\<integral>\<^sup>+x. f x \<partial>null_measure M) = 0"
  2449     by (simp add: density_def) (simp only: null_measure_def[symmetric] emeasure_null_measure)
  2449     by (simp add: density_def) (simp only: null_measure_def[symmetric] emeasure_null_measure)
  2450 qed simp
  2450 qed simp
  2451 
  2451 
  2452 subsubsection \<open>Uniform count measure\<close>
  2452 subsubsection \<open>Uniform count measure\<close>
  2453 
  2453 
  2454 definition%important "uniform_count_measure A = point_measure A (\<lambda>x. 1 / card A)"
  2454 definition\<^marker>\<open>tag important\<close> "uniform_count_measure A = point_measure A (\<lambda>x. 1 / card A)"
  2455 
  2455 
  2456 lemma
  2456 lemma
  2457   shows space_uniform_count_measure: "space (uniform_count_measure A) = A"
  2457   shows space_uniform_count_measure: "space (uniform_count_measure A) = A"
  2458     and sets_uniform_count_measure: "sets (uniform_count_measure A) = Pow A"
  2458     and sets_uniform_count_measure: "sets (uniform_count_measure A) = Pow A"
  2459     unfolding uniform_count_measure_def by (auto simp: space_point_measure sets_point_measure)
  2459     unfolding uniform_count_measure_def by (auto simp: space_point_measure sets_point_measure)
  2478 lemma sets_uniform_count_measure_eq_UNIV [simp]:
  2478 lemma sets_uniform_count_measure_eq_UNIV [simp]:
  2479   "sets (uniform_count_measure UNIV) = UNIV \<longleftrightarrow> True"
  2479   "sets (uniform_count_measure UNIV) = UNIV \<longleftrightarrow> True"
  2480   "UNIV = sets (uniform_count_measure UNIV) \<longleftrightarrow> True"
  2480   "UNIV = sets (uniform_count_measure UNIV) \<longleftrightarrow> True"
  2481 by(simp_all add: sets_uniform_count_measure)
  2481 by(simp_all add: sets_uniform_count_measure)
  2482 
  2482 
  2483 subsubsection%unimportant \<open>Scaled measure\<close>
  2483 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Scaled measure\<close>
  2484 
  2484 
  2485 lemma nn_integral_scale_measure:
  2485 lemma nn_integral_scale_measure:
  2486   assumes f: "f \<in> borel_measurable M"
  2486   assumes f: "f \<in> borel_measurable M"
  2487   shows "nn_integral (scale_measure r M) f = r * nn_integral M f"
  2487   shows "nn_integral (scale_measure r M) f = r * nn_integral M f"
  2488   using f
  2488   using f