| author | wenzelm | 
| Tue, 26 Apr 2016 16:20:28 +0200 | |
| changeset 63056 | 9b95ae9ec671 | 
| parent 63040 | eb4ddd18d635 | 
| child 63092 | a949b2a5f51d | 
| permissions | -rw-r--r-- | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1 | (* Title: HOL/Probability/Nonnegative_Lebesgue_Integration.thy | 
| 42067 | 2 | Author: Johannes Hölzl, TU München | 
| 3 | Author: Armin Heller, TU München | |
| 4 | *) | |
| 38656 | 5 | |
| 61808 | 6 | section \<open>Lebesgue Integration for Nonnegative Functions\<close> | 
| 35582 | 7 | |
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 8 | theory Nonnegative_Lebesgue_Integration | 
| 47694 | 9 | imports Measure_Space Borel_Space | 
| 35582 | 10 | begin | 
| 11 | ||
| 56994 | 12 | subsection "Simple function" | 
| 35582 | 13 | |
| 61808 | 14 | text \<open> | 
| 38656 | 15 | |
| 56996 | 16 | Our simple functions are not restricted to nonnegative real numbers. Instead | 
| 38656 | 17 | they are just functions with a finite range and are measurable when singleton | 
| 18 | sets are measurable. | |
| 35582 | 19 | |
| 61808 | 20 | \<close> | 
| 38656 | 21 | |
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 22 | definition "simple_function M g \<longleftrightarrow> | 
| 38656 | 23 | finite (g ` space M) \<and> | 
| 24 |     (\<forall>x \<in> g ` space M. g -` {x} \<inter> space M \<in> sets M)"
 | |
| 36624 | 25 | |
| 47694 | 26 | lemma simple_functionD: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 27 | assumes "simple_function M g" | 
| 40875 | 28 | shows "finite (g ` space M)" and "g -` X \<inter> space M \<in> sets M" | 
| 40871 | 29 | proof - | 
| 30 | show "finite (g ` space M)" | |
| 31 | using assms unfolding simple_function_def by auto | |
| 40875 | 32 | have "g -` X \<inter> space M = g -` (X \<inter> g`space M) \<inter> space M" by auto | 
| 33 |   also have "\<dots> = (\<Union>x\<in>X \<inter> g`space M. g-`{x} \<inter> space M)" by auto
 | |
| 34 | finally show "g -` X \<inter> space M \<in> sets M" using assms | |
| 50002 
ce0d316b5b44
add measurability prover; add support for Borel sets
 hoelzl parents: 
50001diff
changeset | 35 | by (auto simp del: UN_simps simp: simple_function_def) | 
| 40871 | 36 | qed | 
| 36624 | 37 | |
| 56949 | 38 | lemma measurable_simple_function[measurable_dest]: | 
| 39 | "simple_function M f \<Longrightarrow> f \<in> measurable M (count_space UNIV)" | |
| 40 | unfolding simple_function_def measurable_def | |
| 41 | proof safe | |
| 42 |   fix A assume "finite (f ` space M)" "\<forall>x\<in>f ` space M. f -` {x} \<inter> space M \<in> sets M"
 | |
| 43 |   then have "(\<Union>x\<in>f ` space M. if x \<in> A then f -` {x} \<inter> space M else {}) \<in> sets M"
 | |
| 44 | by (intro sets.finite_UN) auto | |
| 45 |   also have "(\<Union>x\<in>f ` space M. if x \<in> A then f -` {x} \<inter> space M else {}) = f -` A \<inter> space M"
 | |
| 62390 | 46 | by (auto split: if_split_asm) | 
| 56949 | 47 | finally show "f -` A \<inter> space M \<in> sets M" . | 
| 48 | qed simp | |
| 49 | ||
| 50 | lemma borel_measurable_simple_function: | |
| 51 | "simple_function M f \<Longrightarrow> f \<in> borel_measurable M" | |
| 52 | by (auto dest!: measurable_simple_function simp: measurable_def) | |
| 53 | ||
| 47694 | 54 | lemma simple_function_measurable2[intro]: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 55 | assumes "simple_function M f" "simple_function M g" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 56 | shows "f -` A \<inter> g -` B \<inter> space M \<in> sets M" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 57 | proof - | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 58 | have "f -` A \<inter> g -` B \<inter> space M = (f -` A \<inter> space M) \<inter> (g -` B \<inter> space M)" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 59 | by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 60 | then show ?thesis using assms[THEN simple_functionD(2)] by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 61 | qed | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 62 | |
| 47694 | 63 | lemma simple_function_indicator_representation: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 64 | fixes f ::"'a \<Rightarrow> ennreal" | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 65 | assumes f: "simple_function M f" and x: "x \<in> space M" | 
| 38656 | 66 |   shows "f x = (\<Sum>y \<in> f ` space M. y * indicator (f -` {y} \<inter> space M) x)"
 | 
| 67 | (is "?l = ?r") | |
| 68 | proof - | |
| 38705 | 69 | have "?r = (\<Sum>y \<in> f ` space M. | 
| 38656 | 70 |     (if y = f x then y * indicator (f -` {y} \<inter> space M) x else 0))"
 | 
| 57418 | 71 | by (auto intro!: setsum.cong) | 
| 38656 | 72 |   also have "... =  f x *  indicator (f -` {f x} \<inter> space M) x"
 | 
| 57418 | 73 | using assms by (auto dest: simple_functionD simp: setsum.delta) | 
| 38656 | 74 | also have "... = f x" using x by (auto simp: indicator_def) | 
| 75 | finally show ?thesis by auto | |
| 76 | qed | |
| 36624 | 77 | |
| 47694 | 78 | lemma simple_function_notspace: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 79 | "simple_function M (\<lambda>x. h x * indicator (- space M) x::ennreal)" (is "simple_function M ?h") | 
| 35692 | 80 | proof - | 
| 38656 | 81 |   have "?h ` space M \<subseteq> {0}" unfolding indicator_def by auto
 | 
| 82 | hence [simp, intro]: "finite (?h ` space M)" by (auto intro: finite_subset) | |
| 83 |   have "?h -` {0} \<inter> space M = space M" by auto
 | |
| 84 | thus ?thesis unfolding simple_function_def by auto | |
| 85 | qed | |
| 86 | ||
| 47694 | 87 | lemma simple_function_cong: | 
| 38656 | 88 | assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t" | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 89 | shows "simple_function M f \<longleftrightarrow> simple_function M g" | 
| 38656 | 90 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 91 |   have "\<And>x. f -` {x} \<inter> space M = g -` {x} \<inter> space M"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 92 | using assms by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 93 | with assms show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 94 | by (simp add: simple_function_def cong: image_cong) | 
| 38656 | 95 | qed | 
| 96 | ||
| 47694 | 97 | lemma simple_function_cong_algebra: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 98 | assumes "sets N = sets M" "space N = space M" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 99 | shows "simple_function M f \<longleftrightarrow> simple_function N f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 100 | unfolding simple_function_def assms .. | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 101 | |
| 47694 | 102 | lemma simple_function_borel_measurable: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 103 |   fixes f :: "'a \<Rightarrow> 'x::{t2_space}"
 | 
| 38656 | 104 | assumes "f \<in> borel_measurable M" and "finite (f ` space M)" | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 105 | shows "simple_function M f" | 
| 38656 | 106 | using assms unfolding simple_function_def | 
| 107 | by (auto intro: borel_measurable_vimage) | |
| 108 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 109 | lemma simple_function_iff_borel_measurable: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 110 |   fixes f :: "'a \<Rightarrow> 'x::{t2_space}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 111 | shows "simple_function M f \<longleftrightarrow> finite (f ` space M) \<and> f \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 112 | by (metis borel_measurable_simple_function simple_functionD(1) simple_function_borel_measurable) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 113 | |
| 56949 | 114 | lemma simple_function_eq_measurable: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 115 | "simple_function M f \<longleftrightarrow> finite (f`space M) \<and> f \<in> measurable M (count_space UNIV)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 116 | using measurable_simple_function[of M f] by (fastforce simp: simple_function_def) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 117 | |
| 47694 | 118 | lemma simple_function_const[intro, simp]: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 119 | "simple_function M (\<lambda>x. c)" | 
| 38656 | 120 | by (auto intro: finite_subset simp: simple_function_def) | 
| 47694 | 121 | lemma simple_function_compose[intro, simp]: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 122 | assumes "simple_function M f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 123 | shows "simple_function M (g \<circ> f)" | 
| 38656 | 124 | unfolding simple_function_def | 
| 125 | proof safe | |
| 126 | show "finite ((g \<circ> f) ` space M)" | |
| 56154 
f0a927235162
more complete set of lemmas wrt. image and composition
 haftmann parents: 
54611diff
changeset | 127 | using assms unfolding simple_function_def by (auto simp: image_comp [symmetric]) | 
| 38656 | 128 | next | 
| 129 | fix x assume "x \<in> space M" | |
| 130 |   let ?G = "g -` {g (f x)} \<inter> (f`space M)"
 | |
| 131 |   have *: "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M =
 | |
| 132 |     (\<Union>x\<in>?G. f -` {x} \<inter> space M)" by auto
 | |
| 133 |   show "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M \<in> sets M"
 | |
| 134 | using assms unfolding simple_function_def * | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50104diff
changeset | 135 | by (rule_tac sets.finite_UN) auto | 
| 38656 | 136 | qed | 
| 137 | ||
| 47694 | 138 | lemma simple_function_indicator[intro, simp]: | 
| 38656 | 139 | assumes "A \<in> sets M" | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 140 | shows "simple_function M (indicator A)" | 
| 35692 | 141 | proof - | 
| 38656 | 142 |   have "indicator A ` space M \<subseteq> {0, 1}" (is "?S \<subseteq> _")
 | 
| 143 | by (auto simp: indicator_def) | |
| 144 | hence "finite ?S" by (rule finite_subset) simp | |
| 145 | moreover have "- A \<inter> space M = space M - A" by auto | |
| 146 | ultimately show ?thesis unfolding simple_function_def | |
| 46905 | 147 | using assms by (auto simp: indicator_def [abs_def]) | 
| 35692 | 148 | qed | 
| 149 | ||
| 47694 | 150 | lemma simple_function_Pair[intro, simp]: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 151 | assumes "simple_function M f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 152 | assumes "simple_function M g" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 153 | shows "simple_function M (\<lambda>x. (f x, g x))" (is "simple_function M ?p") | 
| 38656 | 154 | unfolding simple_function_def | 
| 155 | proof safe | |
| 156 | show "finite (?p ` space M)" | |
| 157 | using assms unfolding simple_function_def | |
| 158 | by (rule_tac finite_subset[of _ "f`space M \<times> g`space M"]) auto | |
| 159 | next | |
| 160 | fix x assume "x \<in> space M" | |
| 161 |   have "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M =
 | |
| 162 |       (f -` {f x} \<inter> space M) \<inter> (g -` {g x} \<inter> space M)"
 | |
| 163 | by auto | |
| 61808 | 164 |   with \<open>x \<in> space M\<close> show "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M \<in> sets M"
 | 
| 38656 | 165 | using assms unfolding simple_function_def by auto | 
| 166 | qed | |
| 35692 | 167 | |
| 47694 | 168 | lemma simple_function_compose1: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 169 | assumes "simple_function M f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 170 | shows "simple_function M (\<lambda>x. g (f x))" | 
| 38656 | 171 | using simple_function_compose[OF assms, of g] | 
| 172 | by (simp add: comp_def) | |
| 35582 | 173 | |
| 47694 | 174 | lemma simple_function_compose2: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 175 | assumes "simple_function M f" and "simple_function M g" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 176 | shows "simple_function M (\<lambda>x. h (f x) (g x))" | 
| 38656 | 177 | proof - | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 178 | have "simple_function M ((\<lambda>(x, y). h x y) \<circ> (\<lambda>x. (f x, g x)))" | 
| 38656 | 179 | using assms by auto | 
| 180 | thus ?thesis by (simp_all add: comp_def) | |
| 181 | qed | |
| 35582 | 182 | |
| 47694 | 183 | lemmas simple_function_add[intro, simp] = simple_function_compose2[where h="op +"] | 
| 38656 | 184 | and simple_function_diff[intro, simp] = simple_function_compose2[where h="op -"] | 
| 185 | and simple_function_uminus[intro, simp] = simple_function_compose[where g="uminus"] | |
| 186 | and simple_function_mult[intro, simp] = simple_function_compose2[where h="op *"] | |
| 187 | and simple_function_div[intro, simp] = simple_function_compose2[where h="op /"] | |
| 188 | and simple_function_inverse[intro, simp] = simple_function_compose[where g="inverse"] | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 189 | and simple_function_max[intro, simp] = simple_function_compose2[where h=max] | 
| 38656 | 190 | |
| 47694 | 191 | lemma simple_function_setsum[intro, simp]: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 192 | assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 193 | shows "simple_function M (\<lambda>x. \<Sum>i\<in>P. f i x)" | 
| 38656 | 194 | proof cases | 
| 195 | assume "finite P" from this assms show ?thesis by induct auto | |
| 196 | qed auto | |
| 35582 | 197 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 198 | lemma simple_function_ennreal[intro, simp]: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 199 | fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 200 | shows "simple_function M (\<lambda>x. ennreal (f x))" | 
| 59587 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
59452diff
changeset | 201 | by (rule simple_function_compose1[OF sf]) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 202 | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 203 | lemma simple_function_real_of_nat[intro, simp]: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 204 | fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f" | 
| 56949 | 205 | shows "simple_function M (\<lambda>x. real (f x))" | 
| 59587 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
59452diff
changeset | 206 | by (rule simple_function_compose1[OF sf]) | 
| 35582 | 207 | |
| 47694 | 208 | lemma borel_measurable_implies_simple_function_sequence: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 209 | fixes u :: "'a \<Rightarrow> ennreal" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 210 | assumes u[measurable]: "u \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 211 | 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)" | 
| 35582 | 212 | proof - | 
| 63040 | 213 | define f where [abs_def]: | 
| 214 | "f i x = real_of_int (floor (enn2real (min i (u x)) * 2^i)) / 2^i" for i x | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 215 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 216 | have [simp]: "0 \<le> f i x" for i x | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 217 | by (auto simp: f_def intro!: divide_nonneg_nonneg mult_nonneg_nonneg enn2real_nonneg) | 
| 35582 | 218 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 219 | have *: "2^n * real_of_int x = real_of_int (2^n * x)" for n x | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 220 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 221 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 222 | have "real_of_int \<lfloor>real i * 2 ^ i\<rfloor> = real_of_int \<lfloor>i * 2 ^ i\<rfloor>" for i | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 223 | by (intro arg_cong[where f=real_of_int]) simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 224 | then have [simp]: "real_of_int \<lfloor>real i * 2 ^ i\<rfloor> = i * 2 ^ i" for i | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 225 | unfolding floor_of_nat by simp | 
| 35582 | 226 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 227 | have "incseq f" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 228 | proof (intro monoI le_funI) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 229 | fix m n :: nat and x assume "m \<le> n" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 230 | moreover | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 231 |     { fix d :: nat
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 232 | have "\<lfloor>2^d::real\<rfloor> * \<lfloor>2^m * enn2real (min (of_nat m) (u x))\<rfloor> \<le> | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 233 | \<lfloor>2^d * (2^m * enn2real (min (of_nat m) (u x)))\<rfloor>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 234 | by (rule le_mult_floor) (auto simp: enn2real_nonneg) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 235 | also have "\<dots> \<le> \<lfloor>2^d * (2^m * enn2real (min (of_nat d + of_nat m) (u x)))\<rfloor>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 236 | by (intro floor_mono mult_mono enn2real_mono min.mono) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 237 | (auto simp: enn2real_nonneg min_less_iff_disj of_nat_less_top) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 238 | finally have "f m x \<le> f (m + d) x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 239 | unfolding f_def | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 240 | by (auto simp: field_simps power_add * simp del: of_int_mult) } | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 241 | ultimately show "f m x \<le> f n x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 242 | by (auto simp add: le_iff_add) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 243 | qed | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 244 | then have inc_f: "incseq (\<lambda>i. ennreal (f i x))" for x | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 245 | by (auto simp: incseq_def le_fun_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 246 | then have "incseq (\<lambda>i x. ennreal (f i x))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 247 | by (auto simp: incseq_def le_fun_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 248 | moreover | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 249 | have "simple_function M (f i)" for i | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 250 | proof (rule simple_function_borel_measurable) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 251 | have "\<lfloor>enn2real (min (of_nat i) (u x)) * 2 ^ i\<rfloor> \<le> \<lfloor>int i * 2 ^ i\<rfloor>" for x | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 252 | by (cases "u x" rule: ennreal_cases) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 253 | (auto split: split_min intro!: floor_mono) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 254 |     then have "f i ` space M \<subseteq> (\<lambda>n. real_of_int n / 2^i) ` {0 .. of_nat i * 2^i}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 255 | unfolding floor_of_int by (auto simp: f_def enn2real_nonneg intro!: imageI) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 256 | then show "finite (f i ` space M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 257 | by (rule finite_subset) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 258 | show "f i \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 259 | unfolding f_def enn2real_def by measurable | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 260 | qed | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 261 | moreover | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 262 |   { fix x
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 263 | have "(SUP i. ennreal (f i x)) = u x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 264 | proof (cases "u x" rule: ennreal_cases) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 265 | case top then show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 266 | by (simp add: f_def inf_min[symmetric] ennreal_of_nat_eq_real_of_nat[symmetric] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 267 | ennreal_SUP_of_nat_eq_top) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 268 | next | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 269 | case (real r) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 270 | obtain n where "r \<le> of_nat n" using real_arch_simple by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 271 | then have min_eq_r: "\<forall>\<^sub>F x in sequentially. min (real x) r = r" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 272 | by (auto simp: eventually_sequentially intro!: exI[of _ n] split: split_min) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 273 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 274 | have "(\<lambda>i. real_of_int \<lfloor>min (real i) r * 2^i\<rfloor> / 2^i) \<longlonglongrightarrow> r" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 275 | proof (rule tendsto_sandwich) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 276 | show "(\<lambda>n. r - (1/2)^n) \<longlonglongrightarrow> r" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 277 | by (auto intro!: tendsto_eq_intros LIMSEQ_power_zero) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 278 | show "\<forall>\<^sub>F n in sequentially. real_of_int \<lfloor>min (real n) r * 2 ^ n\<rfloor> / 2 ^ n \<le> r" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 279 | using min_eq_r by eventually_elim (auto simp: field_simps) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 280 | have *: "r * (2 ^ n * 2 ^ n) \<le> 2^n + 2^n * real_of_int \<lfloor>r * 2 ^ n\<rfloor>" for n | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 281 | using real_of_int_floor_ge_diff_one[of "r * 2^n", THEN mult_left_mono, of "2^n"] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 282 | by (auto simp: field_simps) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 283 | show "\<forall>\<^sub>F n in sequentially. r - (1/2)^n \<le> real_of_int \<lfloor>min (real n) r * 2 ^ n\<rfloor> / 2 ^ n" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 284 | using min_eq_r by eventually_elim (insert *, auto simp: field_simps) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 285 | qed auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 286 | then have "(\<lambda>i. ennreal (f i x)) \<longlonglongrightarrow> ennreal r" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 287 | by (simp add: real f_def ennreal_of_nat_eq_real_of_nat min_ennreal) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 288 | from LIMSEQ_unique[OF LIMSEQ_SUP[OF inc_f] this] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 289 | show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 290 | by (simp add: real) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 291 | qed } | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 292 | ultimately show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 293 | by (intro exI[of _ "\<lambda>i x. ennreal (f i x)"]) auto | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 294 | qed | 
| 35582 | 295 | |
| 47694 | 296 | lemma borel_measurable_implies_simple_function_sequence': | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 297 | fixes u :: "'a \<Rightarrow> ennreal" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 298 | assumes u: "u \<in> borel_measurable M" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 299 | obtains f where | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 300 | "\<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" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 301 | using borel_measurable_implies_simple_function_sequence[OF u] by (auto simp: fun_eq_iff) blast | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 302 | |
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 303 | lemma simple_function_induct[consumes 1, case_names cong set mult add, induct set: simple_function]: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 304 | fixes u :: "'a \<Rightarrow> ennreal" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 305 | assumes u: "simple_function M u" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 306 | 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" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 307 | assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 308 | assumes mult: "\<And>u c. P u \<Longrightarrow> P (\<lambda>x. c * u x)" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 309 | assumes add: "\<And>u v. P u \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 310 | shows "P u" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 311 | proof (rule cong) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 312 |   from AE_space show "AE x in M. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x"
 | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 313 | proof eventually_elim | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 314 | fix x assume x: "x \<in> space M" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 315 | from simple_function_indicator_representation[OF u x] | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 316 |     show "(\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x" ..
 | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 317 | qed | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 318 | next | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 319 | from u have "finite (u ` space M)" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 320 | unfolding simple_function_def by auto | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 321 |   then show "P (\<lambda>x. \<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x)"
 | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 322 | proof induct | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 323 | case empty show ?case | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 324 |       using set[of "{}"] by (simp add: indicator_def[abs_def])
 | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 325 | qed (auto intro!: add mult set simple_functionD u) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 326 | next | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 327 |   show "simple_function M (\<lambda>x. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x))"
 | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 328 | apply (subst simple_function_cong) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 329 | apply (rule simple_function_indicator_representation[symmetric]) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 330 | apply (auto intro: u) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 331 | done | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 332 | qed fact | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 333 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 334 | lemma simple_function_induct_nn[consumes 1, case_names cong set mult add]: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 335 | fixes u :: "'a \<Rightarrow> ennreal" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 336 | assumes u: "simple_function M u" | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 337 | assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> simple_function M g \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 338 | assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 339 | assumes mult: "\<And>u c. simple_function M u \<Longrightarrow> P u \<Longrightarrow> P (\<lambda>x. c * u x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 340 | assumes add: "\<And>u v. simple_function M u \<Longrightarrow> P u \<Longrightarrow> simple_function M v \<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)" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 341 | shows "P u" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 342 | proof - | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 343 | show ?thesis | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 344 | proof (rule cong) | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 345 | fix x assume x: "x \<in> space M" | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 346 | from simple_function_indicator_representation[OF u x] | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 347 |     show "(\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x" ..
 | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 348 | next | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 349 |     show "simple_function M (\<lambda>x. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x))"
 | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 350 | apply (subst simple_function_cong) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 351 | apply (rule simple_function_indicator_representation[symmetric]) | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 352 | apply (auto intro: u) | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 353 | done | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 354 | next | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 355 | from u have "finite (u ` space M)" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 356 | unfolding simple_function_def by auto | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 357 |     then show "P (\<lambda>x. \<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x)"
 | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 358 | proof induct | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 359 | case empty show ?case | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 360 |         using set[of "{}"] by (simp add: indicator_def[abs_def])
 | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 361 | next | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 362 | case (insert x S) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 363 |       { fix z have "(\<Sum>y\<in>S. y * indicator (u -` {y} \<inter> space M) z) = 0 \<or>
 | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 364 |           x * indicator (u -` {x} \<inter> space M) z = 0"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 365 | using insert by (subst setsum_eq_0_iff) (auto simp: indicator_def) } | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 366 | note disj = this | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 367 | from insert show ?case | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 368 | by (auto intro!: add mult set simple_functionD u simple_function_setsum disj) | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 369 | qed | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 370 | qed fact | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 371 | qed | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 372 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 373 | lemma borel_measurable_induct[consumes 1, case_names cong set mult add seq, induct set: borel_measurable]: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 374 | fixes u :: "'a \<Rightarrow> ennreal" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 375 | assumes u: "u \<in> borel_measurable M" | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 376 | 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" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 377 | assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 378 | 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)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 379 | 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)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 380 | 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)" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 381 | shows "P u" | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 382 | using u | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 383 | proof (induct rule: borel_measurable_implies_simple_function_sequence') | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 384 | 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" | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 385 | have u_eq: "u = (SUP i. U i)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 386 | using u sup by auto | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 387 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 388 | have not_inf: "\<And>x i. x \<in> space M \<Longrightarrow> U i x < top" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 389 | using U by (auto simp: image_iff eq_commute) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 390 | |
| 49797 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 391 | from U have "\<And>i. U i \<in> borel_measurable M" | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 392 | by (simp add: borel_measurable_simple_function) | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 393 | |
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 394 | show "P u" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 395 | unfolding u_eq | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 396 | proof (rule seq) | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 397 | fix i show "P (U i)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 398 | using \<open>simple_function M (U i)\<close> not_inf[of _ i] | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 399 | proof (induct rule: simple_function_induct_nn) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 400 | case (mult u c) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 401 | show ?case | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 402 | proof cases | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 403 |         assume "c = 0 \<or> space M = {} \<or> (\<forall>x\<in>space M. u x = 0)"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 404 | with mult(1) show ?thesis | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 405 |           by (intro cong[of "\<lambda>x. c * u x" "indicator {}"] set)
 | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 406 | (auto dest!: borel_measurable_simple_function) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 407 | next | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 408 |         assume "\<not> (c = 0 \<or> space M = {} \<or> (\<forall>x\<in>space M. u x = 0))"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 409 |         then obtain x where "space M \<noteq> {}" and x: "x \<in> space M" "u x \<noteq> 0" "c \<noteq> 0"
 | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 410 | by auto | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 411 | with mult(3)[of x] have "c < top" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 412 | by (auto simp: ennreal_mult_less_top) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 413 | then have u_fin: "x' \<in> space M \<Longrightarrow> u x' < top" for x' | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 414 | using mult(3)[of x'] \<open>c \<noteq> 0\<close> by (auto simp: ennreal_mult_less_top) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 415 | then have "P u" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 416 | by (rule mult) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 417 | with u_fin \<open>c < top\<close> mult(1) show ?thesis | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 418 | by (intro mult') (auto dest!: borel_measurable_simple_function) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 419 | qed | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 420 | qed (auto intro: cong intro!: set add dest!: borel_measurable_simple_function) | 
| 49797 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 421 | qed fact+ | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 422 | qed | 
| 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 423 | |
| 47694 | 424 | lemma simple_function_If_set: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 425 | assumes sf: "simple_function M f" "simple_function M g" and A: "A \<inter> space M \<in> sets M" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 426 | shows "simple_function M (\<lambda>x. if x \<in> A then f x else g x)" (is "simple_function M ?IF") | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 427 | proof - | 
| 63040 | 428 |   define F where "F x = f -` {x} \<inter> space M" for x
 | 
| 429 |   define G where "G x = g -` {x} \<inter> space M" for x
 | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 430 | show ?thesis unfolding simple_function_def | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 431 | proof safe | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 432 | have "?IF ` space M \<subseteq> f ` space M \<union> g ` space M" by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 433 | from finite_subset[OF this] assms | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 434 | show "finite (?IF ` space M)" unfolding simple_function_def by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 435 | next | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 436 | fix x assume "x \<in> space M" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 437 |     then have *: "?IF -` {?IF x} \<inter> space M = (if x \<in> A
 | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 438 | then ((F (f x) \<inter> (A \<inter> space M)) \<union> (G (f x) - (G (f x) \<inter> (A \<inter> space M)))) | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 439 | else ((F (g x) \<inter> (A \<inter> space M)) \<union> (G (g x) - (G (g x) \<inter> (A \<inter> space M)))))" | 
| 62390 | 440 | using sets.sets_into_space[OF A] by (auto split: if_split_asm simp: G_def F_def) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 441 | have [intro]: "\<And>x. F x \<in> sets M" "\<And>x. G x \<in> sets M" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 442 | unfolding F_def G_def using sf[THEN simple_functionD(2)] by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 443 |     show "?IF -` {?IF x} \<inter> space M \<in> sets M" unfolding * using A by auto
 | 
| 35582 | 444 | qed | 
| 445 | qed | |
| 446 | ||
| 47694 | 447 | lemma simple_function_If: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 448 |   assumes sf: "simple_function M f" "simple_function M g" and P: "{x\<in>space M. P x} \<in> sets M"
 | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 449 | shows "simple_function M (\<lambda>x. if P x then f x else g x)" | 
| 35582 | 450 | proof - | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 451 |   have "{x\<in>space M. P x} = {x. P x} \<inter> space M" by auto
 | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 452 |   with simple_function_If_set[OF sf, of "{x. P x}"] P show ?thesis by simp
 | 
| 38656 | 453 | qed | 
| 454 | ||
| 47694 | 455 | lemma simple_function_subalgebra: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 456 | assumes "simple_function N f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 457 | and N_subalgebra: "sets N \<subseteq> sets M" "space N = space M" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 458 | shows "simple_function M f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 459 | using assms unfolding simple_function_def by auto | 
| 39092 | 460 | |
| 47694 | 461 | lemma simple_function_comp: | 
| 462 | assumes T: "T \<in> measurable M M'" | |
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 463 | and f: "simple_function M' f" | 
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 464 | shows "simple_function M (\<lambda>x. f (T x))" | 
| 41661 | 465 | proof (intro simple_function_def[THEN iffD2] conjI ballI) | 
| 466 | have "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space M'" | |
| 467 | using T unfolding measurable_def by auto | |
| 468 | then show "finite ((\<lambda>x. f (T x)) ` space M)" | |
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 469 | using f unfolding simple_function_def by (auto intro: finite_subset) | 
| 41661 | 470 | fix i assume i: "i \<in> (\<lambda>x. f (T x)) ` space M" | 
| 471 | then have "i \<in> f ` space M'" | |
| 472 | using T unfolding measurable_def by auto | |
| 473 |   then have "f -` {i} \<inter> space M' \<in> sets M'"
 | |
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 474 | using f unfolding simple_function_def by auto | 
| 41661 | 475 |   then have "T -` (f -` {i} \<inter> space M') \<inter> space M \<in> sets M"
 | 
| 476 | using T unfolding measurable_def by auto | |
| 477 |   also have "T -` (f -` {i} \<inter> space M') \<inter> space M = (\<lambda>x. f (T x)) -` {i} \<inter> space M"
 | |
| 478 | using T unfolding measurable_def by auto | |
| 479 |   finally show "(\<lambda>x. f (T x)) -` {i} \<inter> space M \<in> sets M" .
 | |
| 40859 | 480 | qed | 
| 481 | ||
| 56994 | 482 | subsection "Simple integral" | 
| 38656 | 483 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 484 | definition simple_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>S") where
 | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 485 |   "integral\<^sup>S M f = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M))"
 | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 486 | |
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 487 | syntax | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 488 |   "_simple_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>S _. _ \<partial>_" [60,61] 110)
 | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 489 | |
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 490 | translations | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 491 | "\<integral>\<^sup>S x. f \<partial>M" == "CONST simple_integral M (%x. f)" | 
| 35582 | 492 | |
| 47694 | 493 | lemma simple_integral_cong: | 
| 38656 | 494 | assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 495 | shows "integral\<^sup>S M f = integral\<^sup>S M g" | 
| 38656 | 496 | proof - | 
| 497 | have "f ` space M = g ` space M" | |
| 498 |     "\<And>x. f -` {x} \<inter> space M = g -` {x} \<inter> space M"
 | |
| 499 | using assms by (auto intro!: image_eqI) | |
| 500 | thus ?thesis unfolding simple_integral_def by simp | |
| 501 | qed | |
| 502 | ||
| 47694 | 503 | lemma simple_integral_const[simp]: | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 504 | "(\<integral>\<^sup>Sx. c \<partial>M) = c * (emeasure M) (space M)" | 
| 38656 | 505 | proof (cases "space M = {}")
 | 
| 506 | case True thus ?thesis unfolding simple_integral_def by simp | |
| 507 | next | |
| 508 |   case False hence "(\<lambda>x. c) ` space M = {c}" by auto
 | |
| 509 | thus ?thesis unfolding simple_integral_def by simp | |
| 35582 | 510 | qed | 
| 511 | ||
| 47694 | 512 | lemma simple_function_partition: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 513 | assumes f: "simple_function M f" and g: "simple_function M g" | 
| 56949 | 514 | assumes sub: "\<And>x y. x \<in> space M \<Longrightarrow> y \<in> space M \<Longrightarrow> g x = g y \<Longrightarrow> f x = f y" | 
| 515 | assumes v: "\<And>x. x \<in> space M \<Longrightarrow> f x = v (g x)" | |
| 516 |   shows "integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x\<in>space M. g x = y})"
 | |
| 517 | (is "_ = ?r") | |
| 518 | proof - | |
| 519 | from f g have [simp]: "finite (f`space M)" "finite (g`space M)" | |
| 520 | by (auto simp: simple_function_def) | |
| 521 | from f g have [measurable]: "f \<in> measurable M (count_space UNIV)" "g \<in> measurable M (count_space UNIV)" | |
| 522 | by (auto intro: measurable_simple_function) | |
| 35582 | 523 | |
| 56949 | 524 |   { fix y assume "y \<in> space M"
 | 
| 525 |     then have "f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g y = g x} = {v (g y)}"
 | |
| 526 | by (auto cong: sub simp: v[symmetric]) } | |
| 527 | note eq = this | |
| 35582 | 528 | |
| 56949 | 529 | have "integral\<^sup>S M f = | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 530 | (\<Sum>y\<in>f`space M. y * (\<Sum>z\<in>g`space M. | 
| 56949 | 531 |       if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x\<in>space M. g x = z} else 0))"
 | 
| 532 | unfolding simple_integral_def | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 533 | proof (safe intro!: setsum.cong ennreal_mult_left_cong) | 
| 56949 | 534 | fix y assume y: "y \<in> space M" "f y \<noteq> 0" | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 535 |     have [simp]: "g ` space M \<inter> {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} =
 | 
| 56949 | 536 |         {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}"
 | 
| 537 | by auto | |
| 538 |     have eq:"(\<Union>i\<in>{z. \<exists>x\<in>space M. f y = f x \<and> z = g x}. {x \<in> space M. g x = i}) =
 | |
| 539 |         f -` {f y} \<inter> space M"
 | |
| 540 | by (auto simp: eq_commute cong: sub rev_conj_cong) | |
| 541 | have "finite (g`space M)" by simp | |
| 542 |     then have "finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}"
 | |
| 543 | by (rule rev_finite_subset) auto | |
| 544 |     then show "emeasure M (f -` {f y} \<inter> space M) =
 | |
| 545 |       (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)"
 | |
| 57418 | 546 | apply (simp add: setsum.If_cases) | 
| 56949 | 547 | apply (subst setsum_emeasure) | 
| 548 | apply (auto simp: disjoint_family_on_def eq) | |
| 549 | done | |
| 38656 | 550 | qed | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 551 | also have "\<dots> = (\<Sum>y\<in>f`space M. (\<Sum>z\<in>g`space M. | 
| 56949 | 552 |       if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x\<in>space M. g x = z} else 0))"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 553 | by (auto intro!: setsum.cong simp: setsum_right_distrib) | 
| 56949 | 554 | also have "\<dots> = ?r" | 
| 57418 | 555 | by (subst setsum.commute) | 
| 556 | (auto intro!: setsum.cong simp: setsum.If_cases scaleR_setsum_right[symmetric] eq) | |
| 56949 | 557 | finally show "integral\<^sup>S M f = ?r" . | 
| 35582 | 558 | qed | 
| 559 | ||
| 47694 | 560 | lemma simple_integral_add[simp]: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 561 | assumes f: "simple_function M f" and "\<And>x. 0 \<le> f x" and g: "simple_function M g" and "\<And>x. 0 \<le> g x" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 562 | shows "(\<integral>\<^sup>Sx. f x + g x \<partial>M) = integral\<^sup>S M f + integral\<^sup>S M g" | 
| 35582 | 563 | proof - | 
| 56949 | 564 | have "(\<integral>\<^sup>Sx. f x + g x \<partial>M) = | 
| 565 |     (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. (fst y + snd y) * emeasure M {x\<in>space M. (f x, g x) = y})"
 | |
| 566 | by (intro simple_function_partition) (auto intro: f g) | |
| 567 |   also have "\<dots> = (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. fst y * emeasure M {x\<in>space M. (f x, g x) = y}) +
 | |
| 568 |     (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. snd y * emeasure M {x\<in>space M. (f x, g x) = y})"
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 569 | using assms(2,4) by (auto intro!: setsum.cong distrib_right simp: setsum.distrib[symmetric]) | 
| 56949 | 570 |   also have "(\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. fst y * emeasure M {x\<in>space M. (f x, g x) = y}) = (\<integral>\<^sup>Sx. f x \<partial>M)"
 | 
| 571 | by (intro simple_function_partition[symmetric]) (auto intro: f g) | |
| 572 |   also have "(\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. snd y * emeasure M {x\<in>space M. (f x, g x) = y}) = (\<integral>\<^sup>Sx. g x \<partial>M)"
 | |
| 573 | by (intro simple_function_partition[symmetric]) (auto intro: f g) | |
| 574 | finally show ?thesis . | |
| 35582 | 575 | qed | 
| 576 | ||
| 47694 | 577 | lemma simple_integral_setsum[simp]: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 578 | assumes "\<And>i x. i \<in> P \<Longrightarrow> 0 \<le> f i x" | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 579 | assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 580 | shows "(\<integral>\<^sup>Sx. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^sup>S M (f i))" | 
| 38656 | 581 | proof cases | 
| 582 | assume "finite P" | |
| 583 | from this assms show ?thesis | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 584 | by induct (auto simp: simple_function_setsum simple_integral_add setsum_nonneg) | 
| 38656 | 585 | qed auto | 
| 586 | ||
| 47694 | 587 | lemma simple_integral_mult[simp]: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 588 | assumes f: "simple_function M f" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 589 | shows "(\<integral>\<^sup>Sx. c * f x \<partial>M) = c * integral\<^sup>S M f" | 
| 38656 | 590 | proof - | 
| 56949 | 591 |   have "(\<integral>\<^sup>Sx. c * f x \<partial>M) = (\<Sum>y\<in>f ` space M. (c * y) * emeasure M {x\<in>space M. f x = y})"
 | 
| 592 | using f by (intro simple_function_partition) auto | |
| 593 | also have "\<dots> = c * integral\<^sup>S M f" | |
| 594 | using f unfolding simple_integral_def | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 595 | by (subst setsum_right_distrib) (auto simp: mult.assoc Int_def conj_commute) | 
| 56949 | 596 | finally show ?thesis . | 
| 40871 | 597 | qed | 
| 598 | ||
| 47694 | 599 | lemma simple_integral_mono_AE: | 
| 56949 | 600 | assumes f[measurable]: "simple_function M f" and g[measurable]: "simple_function M g" | 
| 47694 | 601 | and mono: "AE x in M. f x \<le> g x" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 602 | shows "integral\<^sup>S M f \<le> integral\<^sup>S M g" | 
| 40859 | 603 | proof - | 
| 56949 | 604 |   let ?\<mu> = "\<lambda>P. emeasure M {x\<in>space M. P x}"
 | 
| 605 | have "integral\<^sup>S M f = (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. fst y * ?\<mu> (\<lambda>x. (f x, g x) = y))" | |
| 606 | using f g by (intro simple_function_partition) auto | |
| 607 | also have "\<dots> \<le> (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. snd y * ?\<mu> (\<lambda>x. (f x, g x) = y))" | |
| 608 | proof (clarsimp intro!: setsum_mono) | |
| 40859 | 609 | fix x assume "x \<in> space M" | 
| 56949 | 610 | let ?M = "?\<mu> (\<lambda>y. f y = f x \<and> g y = g x)" | 
| 611 | show "f x * ?M \<le> g x * ?M" | |
| 612 | proof cases | |
| 613 | assume "?M \<noteq> 0" | |
| 614 | then have "0 < ?M" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 615 | by (simp add: less_le) | 
| 56949 | 616 | also have "\<dots> \<le> ?\<mu> (\<lambda>y. f x \<le> g x)" | 
| 617 | using mono by (intro emeasure_mono_AE) auto | |
| 618 | finally have "\<not> \<not> f x \<le> g x" | |
| 619 | by (intro notI) auto | |
| 620 | then show ?thesis | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 621 | by (intro mult_right_mono) auto | 
| 56949 | 622 | qed simp | 
| 40859 | 623 | qed | 
| 56949 | 624 | also have "\<dots> = integral\<^sup>S M g" | 
| 625 | using f g by (intro simple_function_partition[symmetric]) auto | |
| 626 | finally show ?thesis . | |
| 40859 | 627 | qed | 
| 628 | ||
| 47694 | 629 | lemma simple_integral_mono: | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 630 | assumes "simple_function M f" and "simple_function M g" | 
| 38656 | 631 | and mono: "\<And> x. x \<in> space M \<Longrightarrow> f x \<le> g x" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 632 | shows "integral\<^sup>S M f \<le> integral\<^sup>S M g" | 
| 41705 | 633 | using assms by (intro simple_integral_mono_AE) auto | 
| 35582 | 634 | |
| 47694 | 635 | lemma simple_integral_cong_AE: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 636 | assumes "simple_function M f" and "simple_function M g" | 
| 47694 | 637 | and "AE x in M. f x = g x" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 638 | shows "integral\<^sup>S M f = integral\<^sup>S M g" | 
| 40859 | 639 | using assms by (auto simp: eq_iff intro!: simple_integral_mono_AE) | 
| 640 | ||
| 47694 | 641 | lemma simple_integral_cong': | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 642 | assumes sf: "simple_function M f" "simple_function M g" | 
| 47694 | 643 |   and mea: "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0"
 | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 644 | shows "integral\<^sup>S M f = integral\<^sup>S M g" | 
| 40859 | 645 | proof (intro simple_integral_cong_AE sf AE_I) | 
| 47694 | 646 |   show "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0" by fact
 | 
| 40859 | 647 |   show "{x \<in> space M. f x \<noteq> g x} \<in> sets M"
 | 
| 648 | using sf[THEN borel_measurable_simple_function] by auto | |
| 649 | qed simp | |
| 650 | ||
| 47694 | 651 | lemma simple_integral_indicator: | 
| 56949 | 652 | assumes A: "A \<in> sets M" | 
| 49796 
182fa22e7ee8
introduce induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49795diff
changeset | 653 | assumes f: "simple_function M f" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 654 | shows "(\<integral>\<^sup>Sx. f x * indicator A x \<partial>M) = | 
| 56949 | 655 |     (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M \<inter> A))"
 | 
| 656 | proof - | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 657 |   have eq: "(\<lambda>x. (f x, indicator A x)) ` space M \<inter> {x. snd x = 1} = (\<lambda>x. (f x, 1::ennreal))`A"
 | 
| 62390 | 658 | using A[THEN sets.sets_into_space] by (auto simp: indicator_def image_iff split: if_split_asm) | 
| 56949 | 659 |   have eq2: "\<And>x. f x \<notin> f ` A \<Longrightarrow> f -` {f x} \<inter> space M \<inter> A = {}"
 | 
| 660 | by (auto simp: image_iff) | |
| 661 | ||
| 662 | have "(\<integral>\<^sup>Sx. f x * indicator A x \<partial>M) = | |
| 663 |     (\<Sum>y\<in>(\<lambda>x. (f x, indicator A x))`space M. (fst y * snd y) * emeasure M {x\<in>space M. (f x, indicator A x) = y})"
 | |
| 664 | using assms by (intro simple_function_partition) auto | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 665 | also have "\<dots> = (\<Sum>y\<in>(\<lambda>x. (f x, indicator A x::ennreal))`space M. | 
| 56949 | 666 |     if snd y = 1 then fst y * emeasure M (f -` {fst y} \<inter> space M \<inter> A) else 0)"
 | 
| 62390 | 667 | by (auto simp: indicator_def split: if_split_asm intro!: arg_cong2[where f="op *"] arg_cong2[where f=emeasure] setsum.cong) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 668 |   also have "\<dots> = (\<Sum>y\<in>(\<lambda>x. (f x, 1::ennreal))`A. fst y * emeasure M (f -` {fst y} \<inter> space M \<inter> A))"
 | 
| 57418 | 669 | using assms by (subst setsum.If_cases) (auto intro!: simple_functionD(1) simp: eq) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 670 |   also have "\<dots> = (\<Sum>y\<in>fst`(\<lambda>x. (f x, 1::ennreal))`A. y * emeasure M (f -` {y} \<inter> space M \<inter> A))"
 | 
| 57418 | 671 | by (subst setsum.reindex [of fst]) (auto simp: inj_on_def) | 
| 56949 | 672 |   also have "\<dots> = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M \<inter> A))"
 | 
| 673 | using A[THEN sets.sets_into_space] | |
| 57418 | 674 | by (intro setsum.mono_neutral_cong_left simple_functionD f) (auto simp: image_comp comp_def eq2) | 
| 56949 | 675 | finally show ?thesis . | 
| 38656 | 676 | qed | 
| 35582 | 677 | |
| 47694 | 678 | lemma simple_integral_indicator_only[simp]: | 
| 38656 | 679 | assumes "A \<in> sets M" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 680 | shows "integral\<^sup>S M (indicator A) = emeasure M A" | 
| 56949 | 681 | using simple_integral_indicator[OF assms, of "\<lambda>x. 1"] sets.sets_into_space[OF assms] | 
| 62390 | 682 | by (simp_all add: image_constant_conv Int_absorb1 split: if_split_asm) | 
| 35582 | 683 | |
| 47694 | 684 | lemma simple_integral_null_set: | 
| 685 | assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets M" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 686 | shows "(\<integral>\<^sup>Sx. u x * indicator N x \<partial>M) = 0" | 
| 38656 | 687 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 688 | have "AE x in M. indicator N x = (0 :: ennreal)" | 
| 61808 | 689 | using \<open>N \<in> null_sets M\<close> by (auto simp: indicator_def intro!: AE_I[of _ _ N]) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 690 | then have "(\<integral>\<^sup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^sup>Sx. 0 \<partial>M)" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 691 | using assms apply (intro simple_integral_cong_AE) by auto | 
| 40859 | 692 | then show ?thesis by simp | 
| 38656 | 693 | qed | 
| 35582 | 694 | |
| 47694 | 695 | lemma simple_integral_cong_AE_mult_indicator: | 
| 696 | assumes sf: "simple_function M f" and eq: "AE x in M. x \<in> S" and "S \<in> sets M" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 697 | shows "integral\<^sup>S M f = (\<integral>\<^sup>Sx. f x * indicator S x \<partial>M)" | 
| 41705 | 698 | using assms by (intro simple_integral_cong_AE) auto | 
| 35582 | 699 | |
| 47694 | 700 | lemma simple_integral_cmult_indicator: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 701 | assumes A: "A \<in> sets M" | 
| 56949 | 702 | shows "(\<integral>\<^sup>Sx. c * indicator A x \<partial>M) = c * emeasure M A" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 703 | using simple_integral_mult[OF simple_function_indicator[OF A]] | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 704 | unfolding simple_integral_indicator_only[OF A] by simp | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 705 | |
| 56996 | 706 | lemma simple_integral_nonneg: | 
| 47694 | 707 | assumes f: "simple_function M f" and ae: "AE x in M. 0 \<le> f x" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 708 | shows "0 \<le> integral\<^sup>S M f" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 709 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 710 | have "integral\<^sup>S M (\<lambda>x. 0) \<le> integral\<^sup>S M f" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 711 | using simple_integral_mono_AE[OF _ f ae] by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 712 | then show ?thesis by simp | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 713 | qed | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 714 | |
| 61808 | 715 | subsection \<open>Integral on nonnegative functions\<close> | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 716 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 717 | definition nn_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>N") where
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 718 |   "integral\<^sup>N M f = (SUP g : {g. simple_function M g \<and> g \<le> f}. integral\<^sup>S M g)"
 | 
| 35692 | 719 | |
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 720 | syntax | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 721 |   "_nn_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>+((2 _./ _)/ \<partial>_)" [60,61] 110)
 | 
| 41689 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 722 | |
| 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
 hoelzl parents: 
41661diff
changeset | 723 | translations | 
| 56996 | 724 | "\<integral>\<^sup>+x. f \<partial>M" == "CONST nn_integral M (\<lambda>x. f)" | 
| 40872 | 725 | |
| 56996 | 726 | lemma nn_integral_def_finite: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 727 |   "integral\<^sup>N M f = (SUP g : {g. simple_function M g \<and> g \<le> f \<and> (\<forall>x. g x < top)}. integral\<^sup>S M g)"
 | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56213diff
changeset | 728 | (is "_ = SUPREMUM ?A ?f") | 
| 56996 | 729 | unfolding nn_integral_def | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44890diff
changeset | 730 | proof (safe intro!: antisym SUP_least) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 731 | fix g assume g[measurable]: "simple_function M g" "g \<le> f" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 732 | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56213diff
changeset | 733 | show "integral\<^sup>S M g \<le> SUPREMUM ?A ?f" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 734 | proof cases | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 735 | assume ae: "AE x in M. g x \<noteq> top" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 736 |     let ?G = "{x \<in> space M. g x \<noteq> top}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 737 | have "integral\<^sup>S M g = integral\<^sup>S M (\<lambda>x. g x * indicator ?G x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 738 | proof (rule simple_integral_cong_AE) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 739 | show "AE x in M. g x = g x * indicator ?G x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 740 | using ae AE_space by eventually_elim auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 741 | qed (insert g, auto) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 742 | also have "\<dots> \<le> SUPREMUM ?A ?f" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 743 | using g by (intro SUP_upper) (auto simp: le_fun_def less_top split: split_indicator) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 744 | finally show ?thesis . | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 745 | next | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 746 | assume nAE: "\<not> (AE x in M. g x \<noteq> top)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 747 |     then have "emeasure M {x\<in>space M. g x = top} \<noteq> 0" (is "emeasure M ?G \<noteq> 0")
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 748 | by (subst (asm) AE_iff_measurable[OF _ refl]) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 749 | then have "top = (SUP n. (\<integral>\<^sup>Sx. of_nat n * indicator ?G x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 750 | by (simp add: ennreal_SUP_of_nat_eq_top ennreal_top_eq_mult_iff SUP_mult_right_ennreal[symmetric]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 751 | also have "\<dots> \<le> SUPREMUM ?A ?f" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 752 | using g | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 753 | by (safe intro!: SUP_least SUP_upper) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 754 | (auto simp: le_fun_def of_nat_less_top top_unique[symmetric] split: split_indicator | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 755 | intro: order_trans[of _ "g x" "f x" for x, OF order_trans[of _ top]]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 756 | finally show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 757 | by (simp add: top_unique del: SUP_eq_top_iff Sup_eq_top_iff) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 758 | qed | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44890diff
changeset | 759 | qed (auto intro: SUP_upper) | 
| 40873 | 760 | |
| 56996 | 761 | lemma nn_integral_mono_AE: | 
| 762 | assumes ae: "AE x in M. u x \<le> v x" shows "integral\<^sup>N M u \<le> integral\<^sup>N M v" | |
| 763 | unfolding nn_integral_def | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 764 | proof (safe intro!: SUP_mono) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 765 | fix n assume n: "simple_function M n" "n \<le> u" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 766 | from ae[THEN AE_E] guess N . note N = this | 
| 47694 | 767 | then have ae_N: "AE x in M. x \<notin> N" by (auto intro: AE_not_in) | 
| 46731 | 768 | let ?n = "\<lambda>x. n x * indicator (space M - N) x" | 
| 47694 | 769 | have "AE x in M. n x \<le> ?n x" "simple_function M ?n" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 770 | using n N ae_N by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 771 | moreover | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 772 |   { fix x have "?n x \<le> v x"
 | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 773 | proof cases | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 774 | assume x: "x \<in> space M - N" | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 775 | with N have "u x \<le> v x" by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 776 | with n(2)[THEN le_funD, of x] x show ?thesis | 
| 62390 | 777 | by (auto simp: max_def split: if_split_asm) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 778 | qed simp } | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 779 | then have "?n \<le> v" by (auto simp: le_funI) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 780 | moreover have "integral\<^sup>S M n \<le> integral\<^sup>S M ?n" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 781 | using ae_N N n by (auto intro!: simple_integral_mono_AE) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 782 |   ultimately show "\<exists>m\<in>{g. simple_function M g \<and> g \<le> v}. integral\<^sup>S M n \<le> integral\<^sup>S M m"
 | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 783 | by force | 
| 38656 | 784 | qed | 
| 785 | ||
| 56996 | 786 | lemma nn_integral_mono: | 
| 787 | "(\<And>x. x \<in> space M \<Longrightarrow> u x \<le> v x) \<Longrightarrow> integral\<^sup>N M u \<le> integral\<^sup>N M v" | |
| 788 | by (auto intro: nn_integral_mono_AE) | |
| 40859 | 789 | |
| 60175 | 790 | lemma mono_nn_integral: "mono F \<Longrightarrow> mono (\<lambda>x. integral\<^sup>N M (F x))" | 
| 791 | by (auto simp add: mono_def le_fun_def intro!: nn_integral_mono) | |
| 792 | ||
| 56996 | 793 | lemma nn_integral_cong_AE: | 
| 794 | "AE x in M. u x = v x \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N M v" | |
| 795 | by (auto simp: eq_iff intro!: nn_integral_mono_AE) | |
| 40859 | 796 | |
| 56996 | 797 | lemma nn_integral_cong: | 
| 798 | "(\<And>x. x \<in> space M \<Longrightarrow> u x = v x) \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N M v" | |
| 799 | by (auto intro: nn_integral_cong_AE) | |
| 40859 | 800 | |
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 801 | lemma nn_integral_cong_simp: | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 802 | "(\<And>x. x \<in> space M =simp=> u x = v x) \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N M v" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 803 | by (auto intro: nn_integral_cong simp: simp_implies_def) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 804 | |
| 56996 | 805 | lemma nn_integral_cong_strong: | 
| 806 | "M = N \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x = v x) \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N N v" | |
| 807 | by (auto intro: nn_integral_cong) | |
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 808 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 809 | lemma incseq_nn_integral: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 810 | assumes "incseq f" shows "incseq (\<lambda>i. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 811 | proof - | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 812 | have "\<And>i x. f i x \<le> f (Suc i) x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 813 | using assms by (auto dest!: incseq_SucD simp: le_fun_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 814 | then show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 815 | by (auto intro!: incseq_SucI nn_integral_mono) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 816 | qed | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 817 | |
| 56996 | 818 | lemma nn_integral_eq_simple_integral: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 819 | assumes f: "simple_function M f" shows "integral\<^sup>N M f = integral\<^sup>S M f" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 820 | proof - | 
| 46731 | 821 | let ?f = "\<lambda>x. f x * indicator (space M) x" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 822 | have f': "simple_function M ?f" using f by auto | 
| 56996 | 823 | have "integral\<^sup>N M ?f \<le> integral\<^sup>S M ?f" using f' | 
| 824 | by (force intro!: SUP_least simple_integral_mono simp: le_fun_def nn_integral_def) | |
| 825 | moreover have "integral\<^sup>S M ?f \<le> integral\<^sup>N M ?f" | |
| 826 | unfolding nn_integral_def | |
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44890diff
changeset | 827 | using f' by (auto intro!: SUP_upper) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 828 | ultimately show ?thesis | 
| 56996 | 829 | by (simp cong: nn_integral_cong simple_integral_cong) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 830 | qed | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 831 | |
| 61808 | 832 | text \<open>Beppo-Levi monotone convergence theorem\<close> | 
| 56996 | 833 | lemma nn_integral_monotone_convergence_SUP: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 834 | assumes f: "incseq f" and [measurable]: "\<And>i. f i \<in> borel_measurable M" | 
| 56996 | 835 | shows "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^sup>N M (f i))" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 836 | proof (rule antisym) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 837 | show "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) \<le> (SUP i. (\<integral>\<^sup>+ x. f i x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 838 | unfolding nn_integral_def_finite[of _ "\<lambda>x. SUP i. f i x"] | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44890diff
changeset | 839 | proof (safe intro!: SUP_least) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 840 | fix u assume sf_u[simp]: "simple_function M u" and | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 841 | u: "u \<le> (\<lambda>x. SUP i. f i x)" and u_range: "\<forall>x. u x < top" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 842 | note sf_u[THEN borel_measurable_simple_function, measurable] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 843 | show "integral\<^sup>S M u \<le> (SUP j. \<integral>\<^sup>+x. f j x \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 844 | proof (rule ennreal_approx_unit) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 845 | fix a :: ennreal assume "a < 1" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 846 | let ?au = "\<lambda>x. a * u x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 847 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 848 |       let ?B = "\<lambda>c i. {x\<in>space M. ?au x = c \<and> c \<le> f i x}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 849 | have "integral\<^sup>S M ?au = (\<Sum>c\<in>?au`space M. c * (SUP i. emeasure M (?B c i)))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 850 | unfolding simple_integral_def | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 851 | proof (intro setsum.cong ennreal_mult_left_cong refl) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 852 | fix c assume "c \<in> ?au ` space M" "c \<noteq> 0" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 853 |         { fix x' assume x': "x' \<in> space M" "?au x' = c"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 854 | with \<open>c \<noteq> 0\<close> u_range have "?au x' < 1 * u x'" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 855 | by (intro ennreal_mult_strict_right_mono \<open>a < 1\<close>) (auto simp: less_le) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 856 | also have "\<dots> \<le> (SUP i. f i x')" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 857 | using u by (auto simp: le_fun_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 858 | finally have "\<exists>i. ?au x' \<le> f i x'" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 859 | by (auto simp: less_SUP_iff intro: less_imp_le) } | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 860 |         then have *: "?au -` {c} \<inter> space M = (\<Union>i. ?B c i)"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 861 | by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 862 |         show "emeasure M (?au -` {c} \<inter> space M) = (SUP i. emeasure M (?B c i))"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 863 | unfolding * using f | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 864 | by (intro SUP_emeasure_incseq[symmetric]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 865 | (auto simp: incseq_def le_fun_def intro: order_trans) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 866 | qed | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 867 | also have "\<dots> = (SUP i. \<Sum>c\<in>?au`space M. c * emeasure M (?B c i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 868 | unfolding SUP_mult_left_ennreal using f | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 869 | by (intro ennreal_SUP_setsum[symmetric]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 870 | (auto intro!: mult_mono emeasure_mono simp: incseq_def le_fun_def intro: order_trans) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 871 | also have "\<dots> \<le> (SUP i. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 872 | proof (intro SUP_subset_mono order_refl) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 873 | fix i | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 874 | have "(\<Sum>c\<in>?au`space M. c * emeasure M (?B c i)) = | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 875 |           (\<integral>\<^sup>Sx. (a * u x) * indicator {x\<in>space M. a * u x \<le> f i x} x \<partial>M)"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 876 | by (subst simple_integral_indicator) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 877 | (auto intro!: setsum.cong ennreal_mult_left_cong arg_cong2[where f=emeasure]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 878 |         also have "\<dots> = (\<integral>\<^sup>+x. (a * u x) * indicator {x\<in>space M. a * u x \<le> f i x} x \<partial>M)"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 879 | by (rule nn_integral_eq_simple_integral[symmetric]) simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 880 | also have "\<dots> \<le> (\<integral>\<^sup>+x. f i x \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 881 | by (intro nn_integral_mono) (auto split: split_indicator) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 882 | finally show "(\<Sum>c\<in>?au`space M. c * emeasure M (?B c i)) \<le> (\<integral>\<^sup>+x. f i x \<partial>M)" . | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 883 | qed | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 884 | finally show "a * integral\<^sup>S M u \<le> (SUP i. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 885 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 886 | qed | 
| 35582 | 887 | qed | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 888 | qed (auto intro!: SUP_least SUP_upper nn_integral_mono) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 889 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 890 | lemma sup_continuous_nn_integral[order_continuous_intros]: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 891 | assumes f: "\<And>y. sup_continuous (f y)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 892 | assumes [measurable]: "\<And>x. (\<lambda>y. f y x) \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 893 | shows "sup_continuous (\<lambda>x. (\<integral>\<^sup>+y. f y x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 894 | unfolding sup_continuous_def | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 895 | proof safe | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 896 | fix C :: "nat \<Rightarrow> 'b" assume C: "incseq C" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 897 | with sup_continuous_mono[OF f] show "(\<integral>\<^sup>+ y. f y (SUPREMUM UNIV C) \<partial>M) = (SUP i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 898 | unfolding sup_continuousD[OF f C] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 899 | by (subst nn_integral_monotone_convergence_SUP) (auto simp: mono_def le_fun_def) | 
| 35582 | 900 | qed | 
| 901 | ||
| 56996 | 902 | lemma nn_integral_monotone_convergence_SUP_AE: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 903 | assumes f: "\<And>i. AE x in M. f i x \<le> f (Suc i) x" "\<And>i. f i \<in> borel_measurable M" | 
| 56996 | 904 | shows "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^sup>N M (f i))" | 
| 40859 | 905 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 906 | from f have "AE x in M. \<forall>i. f i x \<le> f (Suc i) x" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 907 | by (simp add: AE_all_countable) | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 908 | from this[THEN AE_E] guess N . note N = this | 
| 46731 | 909 | let ?f = "\<lambda>i x. if x \<in> space M - N then f i x else 0" | 
| 47694 | 910 | have f_eq: "AE x in M. \<forall>i. ?f i x = f i x" using N by (auto intro!: AE_I[of _ _ N]) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 911 | then have "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) = (\<integral>\<^sup>+ x. (SUP i. ?f i x) \<partial>M)" | 
| 56996 | 912 | by (auto intro!: nn_integral_cong_AE) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 913 | also have "\<dots> = (SUP i. (\<integral>\<^sup>+ x. ?f i x \<partial>M))" | 
| 56996 | 914 | proof (rule nn_integral_monotone_convergence_SUP) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 915 | show "incseq ?f" using N(1) by (force intro!: incseq_SucI le_funI) | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 916 |     { fix i show "(\<lambda>x. if x \<in> space M - N then f i x else 0) \<in> borel_measurable M"
 | 
| 59000 | 917 | using f N(3) by (intro measurable_If_set) auto } | 
| 40859 | 918 | qed | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 919 | also have "\<dots> = (SUP i. (\<integral>\<^sup>+ x. f i x \<partial>M))" | 
| 56996 | 920 | using f_eq by (force intro!: arg_cong[where f="SUPREMUM UNIV"] nn_integral_cong_AE ext) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 921 | finally show ?thesis . | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 922 | qed | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 923 | |
| 56996 | 924 | lemma nn_integral_monotone_convergence_simple: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 925 | "incseq f \<Longrightarrow> (\<And>i. simple_function M (f i)) \<Longrightarrow> (SUP i. \<integral>\<^sup>S x. f i x \<partial>M) = (\<integral>\<^sup>+x. (SUP i. f i x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 926 | using assms nn_integral_monotone_convergence_SUP[of f M] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 927 | by (simp add: nn_integral_eq_simple_integral[symmetric] borel_measurable_simple_function) | 
| 40859 | 928 | |
| 47694 | 929 | lemma SUP_simple_integral_sequences: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 930 | assumes f: "incseq f" "\<And>i. simple_function M (f i)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 931 | and g: "incseq g" "\<And>i. simple_function M (g i)" | 
| 47694 | 932 | and eq: "AE x in M. (SUP i. f i x) = (SUP i. g i x)" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 933 | shows "(SUP i. integral\<^sup>S M (f i)) = (SUP i. integral\<^sup>S M (g i))" | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56213diff
changeset | 934 | (is "SUPREMUM _ ?F = SUPREMUM _ ?G") | 
| 38656 | 935 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 936 | have "(SUP i. integral\<^sup>S M (f i)) = (\<integral>\<^sup>+x. (SUP i. f i x) \<partial>M)" | 
| 56996 | 937 | using f by (rule nn_integral_monotone_convergence_simple) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 938 | also have "\<dots> = (\<integral>\<^sup>+x. (SUP i. g i x) \<partial>M)" | 
| 56996 | 939 | unfolding eq[THEN nn_integral_cong_AE] .. | 
| 38656 | 940 | also have "\<dots> = (SUP i. ?G i)" | 
| 56996 | 941 | using g by (rule nn_integral_monotone_convergence_simple[symmetric]) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 942 | finally show ?thesis by simp | 
| 38656 | 943 | qed | 
| 944 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 945 | lemma nn_integral_const[simp]: "(\<integral>\<^sup>+ x. c \<partial>M) = c * emeasure M (space M)" | 
| 56996 | 946 | by (subst nn_integral_eq_simple_integral) auto | 
| 38656 | 947 | |
| 56996 | 948 | lemma nn_integral_linear: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 949 | assumes f: "f \<in> borel_measurable M" and g: "g \<in> borel_measurable M" | 
| 56996 | 950 | shows "(\<integral>\<^sup>+ x. a * f x + g x \<partial>M) = a * integral\<^sup>N M f + integral\<^sup>N M g" | 
| 951 | (is "integral\<^sup>N M ?L = _") | |
| 35582 | 952 | proof - | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 953 | from borel_measurable_implies_simple_function_sequence'[OF f(1)] guess u . | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 954 | note u = nn_integral_monotone_convergence_simple[OF this(2,1)] this | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 955 | from borel_measurable_implies_simple_function_sequence'[OF g(1)] guess v . | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 956 | note v = nn_integral_monotone_convergence_simple[OF this(2,1)] this | 
| 46731 | 957 | let ?L' = "\<lambda>i x. a * u i x + v i x" | 
| 38656 | 958 | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 959 | have "?L \<in> borel_measurable M" using assms by auto | 
| 38656 | 960 | from borel_measurable_implies_simple_function_sequence'[OF this] guess l . | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 961 | note l = nn_integral_monotone_convergence_simple[OF this(2,1)] this | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 962 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 963 | have inc: "incseq (\<lambda>i. a * integral\<^sup>S M (u i))" "incseq (\<lambda>i. integral\<^sup>S M (v i))" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 964 | using u v by (auto simp: incseq_Suc_iff le_fun_def intro!: add_mono mult_left_mono simple_integral_mono) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 965 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 966 | have l': "(SUP i. integral\<^sup>S M (l i)) = (SUP i. integral\<^sup>S M (?L' i))" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 967 | proof (rule SUP_simple_integral_sequences[OF l(3,2)]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 968 | show "incseq ?L'" "\<And>i. simple_function M (?L' i)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 969 | using u v unfolding incseq_Suc_iff le_fun_def | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 970 | by (auto intro!: add_mono mult_left_mono) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 971 |     { fix x
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 972 | have "(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 973 | using u(3) v(3) u(4)[of _ x] v(4)[of _ x] unfolding SUP_mult_left_ennreal | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 974 | by (auto intro!: ennreal_SUP_add simp: incseq_Suc_iff le_fun_def add_mono mult_left_mono) } | 
| 47694 | 975 | then show "AE x in M. (SUP i. l i x) = (SUP i. ?L' i x)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 976 | unfolding l(5) using u(5) v(5) by (intro AE_I2) auto | 
| 38656 | 977 | qed | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 978 | also have "\<dots> = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 979 | using u(2) v(2) by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 980 | finally show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 981 | unfolding l(5)[symmetric] l(1)[symmetric] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 982 | by (simp add: ennreal_SUP_add[OF inc] v u SUP_mult_left_ennreal[symmetric]) | 
| 38656 | 983 | qed | 
| 984 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 985 | lemma nn_integral_cmult: "f \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. c * f x \<partial>M) = c * integral\<^sup>N M f" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 986 | using nn_integral_linear[of f M "\<lambda>x. 0" c] by simp | 
| 38656 | 987 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 988 | lemma nn_integral_multc: "f \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x * c \<partial>M) = integral\<^sup>N M f * c" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57447diff
changeset | 989 | unfolding mult.commute[of _ c] nn_integral_cmult[OF assms] by simp | 
| 41096 | 990 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 991 | lemma nn_integral_divide: "f \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x / c \<partial>M) = (\<integral>\<^sup>+ x. f x \<partial>M) / c" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 992 | unfolding divide_ennreal_def by (rule nn_integral_multc) | 
| 59000 | 993 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 994 | lemma nn_integral_indicator[simp]: "A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x. indicator A x\<partial>M) = (emeasure M) A" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 995 | by (subst nn_integral_eq_simple_integral) (auto simp: simple_integral_indicator) | 
| 38656 | 996 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 997 | lemma nn_integral_cmult_indicator: "A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x. c * indicator A x \<partial>M) = c * emeasure M A" | 
| 56996 | 998 | by (subst nn_integral_eq_simple_integral) | 
| 41544 | 999 | (auto simp: simple_function_indicator simple_integral_indicator) | 
| 38656 | 1000 | |
| 56996 | 1001 | lemma nn_integral_indicator': | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1002 | assumes [measurable]: "A \<inter> space M \<in> sets M" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1003 | shows "(\<integral>\<^sup>+ x. indicator A x \<partial>M) = emeasure M (A \<inter> space M)" | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1004 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1005 | have "(\<integral>\<^sup>+ x. indicator A x \<partial>M) = (\<integral>\<^sup>+ x. indicator (A \<inter> space M) x \<partial>M)" | 
| 56996 | 1006 | by (intro nn_integral_cong) (simp split: split_indicator) | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1007 | also have "\<dots> = emeasure M (A \<inter> space M)" | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1008 | by simp | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1009 | finally show ?thesis . | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1010 | qed | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1011 | |
| 62083 | 1012 | lemma nn_integral_indicator_singleton[simp]: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1013 |   assumes [measurable]: "{y} \<in> sets M" shows "(\<integral>\<^sup>+x. f x * indicator {y} x \<partial>M) = f y * emeasure M {y}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1014 | proof - | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1015 |   have "(\<integral>\<^sup>+x. f x * indicator {y} x \<partial>M) = (\<integral>\<^sup>+x. f y * indicator {y} x \<partial>M)"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1016 | by (auto intro!: nn_integral_cong split: split_indicator) | 
| 62083 | 1017 | then show ?thesis | 
| 1018 | by (simp add: nn_integral_cmult) | |
| 1019 | qed | |
| 1020 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1021 | lemma nn_integral_set_ennreal: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1022 | "(\<integral>\<^sup>+x. ennreal (f x) * indicator A x \<partial>M) = (\<integral>\<^sup>+x. ennreal (f x * indicator A x) \<partial>M)" | 
| 62083 | 1023 | by (rule nn_integral_cong) (simp split: split_indicator) | 
| 1024 | ||
| 1025 | lemma nn_integral_indicator_singleton'[simp]: | |
| 1026 |   assumes [measurable]: "{y} \<in> sets M"
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1027 |   shows "(\<integral>\<^sup>+x. ennreal (f x * indicator {y} x) \<partial>M) = f y * emeasure M {y}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1028 | by (subst nn_integral_set_ennreal[symmetric]) (simp add: nn_integral_indicator_singleton) | 
| 62083 | 1029 | |
| 56996 | 1030 | lemma nn_integral_add: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1031 | "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x + g x \<partial>M) = integral\<^sup>N M f + integral\<^sup>N M g" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1032 | using nn_integral_linear[of f M g 1] by simp | 
| 38656 | 1033 | |
| 56996 | 1034 | lemma nn_integral_setsum: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1035 | "(\<And>i. i \<in> P \<Longrightarrow> f i \<in> borel_measurable M) \<Longrightarrow> (\<integral>\<^sup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1036 | by (induction P rule: infinite_finite_induct) (auto simp: nn_integral_add) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1037 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1038 | lemma nn_integral_suminf: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1039 | assumes f: "\<And>i. f i \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1040 | shows "(\<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1041 | proof - | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1042 | have all_pos: "AE x in M. \<forall>i. 0 \<le> f i x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1043 | using assms by (auto simp: AE_all_countable) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1044 | have "(\<Sum>i. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1045 | by (rule suminf_eq_SUP) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1046 | also have "\<dots> = (SUP n. \<integral>\<^sup>+x. (\<Sum>i<n. f i x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1047 | unfolding nn_integral_setsum[OF f] .. | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1048 | also have "\<dots> = \<integral>\<^sup>+x. (SUP n. \<Sum>i<n. f i x) \<partial>M" using f all_pos | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1049 | by (intro nn_integral_monotone_convergence_SUP_AE[symmetric]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1050 | (elim AE_mp, auto simp: setsum_nonneg simp del: setsum_lessThan_Suc intro!: AE_I2 setsum_mono3) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1051 | also have "\<dots> = \<integral>\<^sup>+x. (\<Sum>i. f i x) \<partial>M" using all_pos | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1052 | by (intro nn_integral_cong_AE) (auto simp: suminf_eq_SUP) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1053 | finally show ?thesis by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1054 | qed | 
| 38656 | 1055 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1056 | lemma nn_integral_bound_simple_function: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1057 | assumes bnd: "\<And>x. x \<in> space M \<Longrightarrow> f x < \<infinity>" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1058 | assumes f[measurable]: "simple_function M f" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1059 |   assumes supp: "emeasure M {x\<in>space M. f x \<noteq> 0} < \<infinity>"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1060 | shows "nn_integral M f < \<infinity>" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1061 | proof cases | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1062 |   assume "space M = {}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1063 | then have "nn_integral M f = (\<integral>\<^sup>+x. 0 \<partial>M)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1064 | by (intro nn_integral_cong) auto | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1065 | then show ?thesis by simp | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1066 | next | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1067 |   assume "space M \<noteq> {}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1068 | with simple_functionD(1)[OF f] bnd have bnd: "0 \<le> Max (f`space M) \<and> Max (f`space M) < \<infinity>" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1069 | by (subst Max_less_iff) (auto simp: Max_ge_iff) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1070 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1071 |   have "nn_integral M f \<le> (\<integral>\<^sup>+x. Max (f`space M) * indicator {x\<in>space M. f x \<noteq> 0} x \<partial>M)"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1072 | proof (rule nn_integral_mono) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1073 | fix x assume "x \<in> space M" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1074 |     with f show "f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1075 | by (auto split: split_indicator intro!: Max_ge simple_functionD) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1076 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1077 | also have "\<dots> < \<infinity>" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1078 | using bnd supp by (subst nn_integral_cmult) (auto simp: ennreal_mult_less_top) | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1079 | finally show ?thesis . | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1080 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1081 | |
| 56996 | 1082 | lemma nn_integral_Markov_inequality: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1083 | assumes u: "u \<in> borel_measurable M" and "A \<in> sets M" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1084 |   shows "(emeasure M) ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^sup>+ x. u x * indicator A x \<partial>M)"
 | 
| 47694 | 1085 | (is "(emeasure M) ?A \<le> _ * ?PI") | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1086 | proof - | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1087 | have "?A \<in> sets M" | 
| 61808 | 1088 | using \<open>A \<in> sets M\<close> u by auto | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1089 | hence "(emeasure M) ?A = (\<integral>\<^sup>+ x. indicator ?A x \<partial>M)" | 
| 56996 | 1090 | using nn_integral_indicator by simp | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1091 | also have "\<dots> \<le> (\<integral>\<^sup>+ x. c * (u x * indicator A x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1092 | using u by (auto intro!: nn_integral_mono_AE simp: indicator_def) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1093 | also have "\<dots> = c * (\<integral>\<^sup>+ x. u x * indicator A x \<partial>M)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1094 | using assms by (auto intro!: nn_integral_cmult) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1095 | finally show ?thesis . | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1096 | qed | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1097 | |
| 56996 | 1098 | lemma nn_integral_noteq_infinite: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1099 | assumes g: "g \<in> borel_measurable M" and "integral\<^sup>N M g \<noteq> \<infinity>" | 
| 47694 | 1100 | shows "AE x in M. g x \<noteq> \<infinity>" | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1101 | proof (rule ccontr) | 
| 47694 | 1102 | assume c: "\<not> (AE x in M. g x \<noteq> \<infinity>)" | 
| 1103 |   have "(emeasure M) {x\<in>space M. g x = \<infinity>} \<noteq> 0"
 | |
| 1104 | using c g by (auto simp add: AE_iff_null) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1105 |   then have "0 < (emeasure M) {x\<in>space M. g x = \<infinity>}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1106 | by (auto simp: zero_less_iff_neq_zero) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1107 |   then have "\<infinity> = \<infinity> * (emeasure M) {x\<in>space M. g x = \<infinity>}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1108 | by (auto simp: ennreal_top_eq_mult_iff) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1109 |   also have "\<dots> \<le> (\<integral>\<^sup>+x. \<infinity> * indicator {x\<in>space M. g x = \<infinity>} x \<partial>M)"
 | 
| 56996 | 1110 | using g by (subst nn_integral_cmult_indicator) auto | 
| 1111 | also have "\<dots> \<le> integral\<^sup>N M g" | |
| 1112 | using assms by (auto intro!: nn_integral_mono_AE simp: indicator_def) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1113 | finally show False | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1114 | using \<open>integral\<^sup>N M g \<noteq> \<infinity>\<close> by (auto simp: top_unique) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1115 | qed | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1116 | |
| 56996 | 1117 | lemma nn_integral_PInf: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1118 | assumes f: "f \<in> borel_measurable M" and not_Inf: "integral\<^sup>N M f \<noteq> \<infinity>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1119 |   shows "emeasure M (f -` {\<infinity>} \<inter> space M) = 0"
 | 
| 56949 | 1120 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1121 |   have "\<infinity> * emeasure M (f -` {\<infinity>} \<inter> space M) = (\<integral>\<^sup>+ x. \<infinity> * indicator (f -` {\<infinity>} \<inter> space M) x \<partial>M)"
 | 
| 56996 | 1122 | using f by (subst nn_integral_cmult_indicator) (auto simp: measurable_sets) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1123 | also have "\<dots> \<le> integral\<^sup>N M f" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1124 | by (auto intro!: nn_integral_mono simp: indicator_def) | 
| 56996 | 1125 |   finally have "\<infinity> * (emeasure M) (f -` {\<infinity>} \<inter> space M) \<le> integral\<^sup>N M f"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1126 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1127 | then show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1128 | using assms by (auto simp: ennreal_top_mult top_unique split: if_split_asm) | 
| 56949 | 1129 | qed | 
| 1130 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1131 | lemma simple_integral_PInf: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1132 |   "simple_function M f \<Longrightarrow> integral\<^sup>S M f \<noteq> \<infinity> \<Longrightarrow> emeasure M (f -` {\<infinity>} \<inter> space M) = 0"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1133 | by (rule nn_integral_PInf) (auto simp: nn_integral_eq_simple_integral borel_measurable_simple_function) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1134 | |
| 56996 | 1135 | lemma nn_integral_PInf_AE: | 
| 1136 | assumes "f \<in> borel_measurable M" "integral\<^sup>N M f \<noteq> \<infinity>" shows "AE x in M. f x \<noteq> \<infinity>" | |
| 56949 | 1137 | proof (rule AE_I) | 
| 1138 |   show "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0"
 | |
| 56996 | 1139 | by (rule nn_integral_PInf[OF assms]) | 
| 56949 | 1140 |   show "f -` {\<infinity>} \<inter> space M \<in> sets M"
 | 
| 1141 | using assms by (auto intro: borel_measurable_vimage) | |
| 1142 | qed auto | |
| 1143 | ||
| 56996 | 1144 | lemma nn_integral_diff: | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1145 | assumes f: "f \<in> borel_measurable M" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1146 | and g: "g \<in> borel_measurable M" | 
| 56996 | 1147 | and fin: "integral\<^sup>N M g \<noteq> \<infinity>" | 
| 47694 | 1148 | and mono: "AE x in M. g x \<le> f x" | 
| 56996 | 1149 | shows "(\<integral>\<^sup>+ x. f x - g x \<partial>M) = integral\<^sup>N M f - integral\<^sup>N M g" | 
| 38656 | 1150 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1151 | have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1152 | using assms by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1153 | have "AE x in M. f x = f x - g x + g x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1154 | using diff_add_cancel_ennreal mono nn_integral_noteq_infinite[OF g fin] assms by auto | 
| 56996 | 1155 | then have **: "integral\<^sup>N M f = (\<integral>\<^sup>+x. f x - g x \<partial>M) + integral\<^sup>N M g" | 
| 1156 | unfolding nn_integral_add[OF diff g, symmetric] | |
| 1157 | by (rule nn_integral_cong_AE) | |
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1158 | show ?thesis unfolding ** | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1159 | using fin | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1160 | by (cases rule: ennreal2_cases[of "\<integral>\<^sup>+ x. f x - g x \<partial>M" "integral\<^sup>N M g"]) auto | 
| 38656 | 1161 | qed | 
| 1162 | ||
| 56996 | 1163 | lemma nn_integral_mult_bounded_inf: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1164 | assumes f: "f \<in> borel_measurable M" "(\<integral>\<^sup>+x. f x \<partial>M) < \<infinity>" and c: "c \<noteq> \<infinity>" and ae: "AE x in M. g x \<le> c * f x" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1165 | shows "(\<integral>\<^sup>+x. g x \<partial>M) < \<infinity>" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1166 | proof - | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1167 | have "(\<integral>\<^sup>+x. g x \<partial>M) \<le> (\<integral>\<^sup>+x. c * f x \<partial>M)" | 
| 56996 | 1168 | by (intro nn_integral_mono_AE ae) | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1169 | also have "(\<integral>\<^sup>+x. c * f x \<partial>M) < \<infinity>" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1170 | using c f by (subst nn_integral_cmult) (auto simp: ennreal_mult_less_top top_unique not_less) | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1171 | finally show ?thesis . | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1172 | qed | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1173 | |
| 61808 | 1174 | text \<open>Fatou's lemma: convergence theorem on limes inferior\<close> | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1175 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1176 | lemma nn_integral_monotone_convergence_INF_AE': | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1177 | assumes f: "\<And>i. AE x in M. f (Suc i) x \<le> f i x" and [measurable]: "\<And>i. f i \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1178 | and *: "(\<integral>\<^sup>+ x. f 0 x \<partial>M) < \<infinity>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1179 | shows "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (INF i. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1180 | proof (rule ennreal_minus_cancel) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1181 | have "integral\<^sup>N M (f 0) - (\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (\<integral>\<^sup>+x. f 0 x - (INF i. f i x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1182 | proof (rule nn_integral_diff[symmetric]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1183 | have "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) \<le> (\<integral>\<^sup>+ x. f 0 x \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1184 | by (intro nn_integral_mono INF_lower) simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1185 | with * show "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) \<noteq> \<infinity>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1186 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1187 | qed (auto intro: INF_lower) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1188 | also have "\<dots> = (\<integral>\<^sup>+x. (SUP i. f 0 x - f i x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1189 | by (simp add: ennreal_INF_const_minus) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1190 | also have "\<dots> = (SUP i. (\<integral>\<^sup>+x. f 0 x - f i x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1191 | proof (intro nn_integral_monotone_convergence_SUP_AE) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1192 | show "AE x in M. f 0 x - f i x \<le> f 0 x - f (Suc i) x" for i | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1193 | using f[of i] by eventually_elim (auto simp: ennreal_mono_minus) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1194 | qed simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1195 | also have "\<dots> = (SUP i. nn_integral M (f 0) - (\<integral>\<^sup>+x. f i x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1196 | proof (subst nn_integral_diff[symmetric]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1197 | fix i | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1198 | have dec: "AE x in M. \<forall>i. f (Suc i) x \<le> f i x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1199 | unfolding AE_all_countable using f by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1200 | then show "AE x in M. f i x \<le> f 0 x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1201 | using dec by eventually_elim (auto intro: lift_Suc_antimono_le[of "\<lambda>i. f i x" 0 i for x]) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1202 | then have "(\<integral>\<^sup>+ x. f i x \<partial>M) \<le> (\<integral>\<^sup>+ x. f 0 x \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1203 | by (rule nn_integral_mono_AE) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1204 | with * show "(\<integral>\<^sup>+ x. f i x \<partial>M) \<noteq> \<infinity>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1205 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1206 | qed (insert f, auto simp: decseq_def le_fun_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1207 | finally show "integral\<^sup>N M (f 0) - (\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1208 | integral\<^sup>N M (f 0) - (INF i. \<integral>\<^sup>+ x. f i x \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1209 | by (simp add: ennreal_INF_const_minus) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1210 | qed (insert *, auto intro!: nn_integral_mono intro: INF_lower) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1211 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1212 | lemma nn_integral_monotone_convergence_INF_AE: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1213 | fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ennreal" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1214 | assumes f: "\<And>i. AE x in M. f (Suc i) x \<le> f i x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1215 | and [measurable]: "\<And>i. f i \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1216 | and fin: "(\<integral>\<^sup>+ x. f i x \<partial>M) < \<infinity>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1217 | shows "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (INF i. integral\<^sup>N M (f i))" | 
| 38656 | 1218 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1219 |   { fix f :: "nat \<Rightarrow> ennreal" and j assume "decseq f"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1220 | then have "(INF i. f i) = (INF i. f (i + j))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1221 | apply (intro INF_eq) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1222 | apply (rule_tac x="i" in bexI) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1223 | apply (auto simp: decseq_def le_fun_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1224 | done } | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1225 | note INF_shift = this | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1226 | have mono: "AE x in M. \<forall>i. f (Suc i) x \<le> f i x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1227 | using f by (auto simp: AE_all_countable) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1228 | then have "AE x in M. (INF i. f i x) = (INF n. f (n + i) x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1229 | by eventually_elim (auto intro!: decseq_SucI INF_shift) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1230 | then have "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (\<integral>\<^sup>+ x. (INF n. f (n + i) x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1231 | by (rule nn_integral_cong_AE) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1232 | also have "\<dots> = (INF n. (\<integral>\<^sup>+ x. f (n + i) x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1233 | by (rule nn_integral_monotone_convergence_INF_AE') (insert assms, auto) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1234 | also have "\<dots> = (INF n. (\<integral>\<^sup>+ x. f n x \<partial>M))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1235 | by (intro INF_shift[symmetric] decseq_SucI nn_integral_mono_AE f) | 
| 38656 | 1236 | finally show ?thesis . | 
| 35582 | 1237 | qed | 
| 1238 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1239 | lemma nn_integral_monotone_convergence_INF_decseq: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1240 | assumes f: "decseq f" and *: "\<And>i. f i \<in> borel_measurable M" "(\<integral>\<^sup>+ x. f i x \<partial>M) < \<infinity>" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1241 | shows "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (INF i. integral\<^sup>N M (f i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1242 | using nn_integral_monotone_convergence_INF_AE[of f M i, OF _ *] f by (auto simp: decseq_Suc_iff le_fun_def) | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1243 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1244 | lemma nn_integral_liminf: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1245 | fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ennreal" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1246 | assumes u: "\<And>i. u i \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1247 | shows "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1248 | proof - | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1249 |   have "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = (SUP n. \<integral>\<^sup>+ x. (INF i:{n..}. u i x) \<partial>M)"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1250 | unfolding liminf_SUP_INF using u | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1251 | by (intro nn_integral_monotone_convergence_SUP_AE) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1252 | (auto intro!: AE_I2 intro: INF_greatest INF_superset_mono) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1253 | also have "\<dots> \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1254 | by (auto simp: liminf_SUP_INF intro!: SUP_mono INF_greatest nn_integral_mono INF_lower) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1255 | finally show ?thesis . | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1256 | qed | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1257 | |
| 56996 | 1258 | lemma nn_integral_limsup: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1259 | fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ennreal" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1260 | assumes [measurable]: "\<And>i. u i \<in> borel_measurable M" "w \<in> borel_measurable M" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1261 | assumes bounds: "\<And>i. AE x in M. u i x \<le> w x" and w: "(\<integral>\<^sup>+x. w x \<partial>M) < \<infinity>" | 
| 56996 | 1262 | shows "limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> (\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M)" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1263 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1264 | have bnd: "AE x in M. \<forall>i. u i x \<le> w x" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1265 | using bounds by (auto simp: AE_all_countable) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1266 | then have "(\<integral>\<^sup>+ x. (SUP n. u n x) \<partial>M) \<le> (\<integral>\<^sup>+ x. w x \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1267 | by (auto intro!: nn_integral_mono_AE elim: eventually_mono intro: SUP_least) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1268 |   then have "(\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M) = (INF n. \<integral>\<^sup>+ x. (SUP i:{n..}. u i x) \<partial>M)"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1269 | unfolding limsup_INF_SUP using bnd w | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1270 | by (intro nn_integral_monotone_convergence_INF_AE') | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1271 | (auto intro!: AE_I2 intro: SUP_least SUP_subset_mono) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1272 | also have "\<dots> \<ge> limsup (\<lambda>n. integral\<^sup>N M (u n))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1273 | by (auto simp: limsup_INF_SUP intro!: INF_mono SUP_least exI nn_integral_mono SUP_upper) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1274 | finally (xtrans) show ?thesis . | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1275 | qed | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1276 | |
| 57025 | 1277 | lemma nn_integral_LIMSEQ: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1278 | assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M" | 
| 61969 | 1279 | and u: "\<And>x. (\<lambda>i. f i x) \<longlonglongrightarrow> u x" | 
| 1280 | shows "(\<lambda>n. integral\<^sup>N M (f n)) \<longlonglongrightarrow> integral\<^sup>N M u" | |
| 57025 | 1281 | proof - | 
| 61969 | 1282 | have "(\<lambda>n. integral\<^sup>N M (f n)) \<longlonglongrightarrow> (SUP n. integral\<^sup>N M (f n))" | 
| 57025 | 1283 | using f by (intro LIMSEQ_SUP[of "\<lambda>n. integral\<^sup>N M (f n)"] incseq_nn_integral) | 
| 1284 | also have "(SUP n. integral\<^sup>N M (f n)) = integral\<^sup>N M (\<lambda>x. SUP n. f n x)" | |
| 1285 | using f by (intro nn_integral_monotone_convergence_SUP[symmetric]) | |
| 1286 | also have "integral\<^sup>N M (\<lambda>x. SUP n. f n x) = integral\<^sup>N M (\<lambda>x. u x)" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1287 | using f by (subst LIMSEQ_SUP[THEN LIMSEQ_unique, OF _ u]) (auto simp: incseq_def le_fun_def) | 
| 57025 | 1288 | finally show ?thesis . | 
| 1289 | qed | |
| 1290 | ||
| 56996 | 1291 | lemma nn_integral_dominated_convergence: | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1292 | assumes [measurable]: | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1293 | "\<And>i. u i \<in> borel_measurable M" "u' \<in> borel_measurable M" "w \<in> borel_measurable M" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1294 | and bound: "\<And>j. AE x in M. u j x \<le> w x" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1295 | and w: "(\<integral>\<^sup>+x. w x \<partial>M) < \<infinity>" | 
| 61969 | 1296 | and u': "AE x in M. (\<lambda>i. u i x) \<longlonglongrightarrow> u' x" | 
| 1297 | shows "(\<lambda>i. (\<integral>\<^sup>+x. u i x \<partial>M)) \<longlonglongrightarrow> (\<integral>\<^sup>+x. u' x \<partial>M)" | |
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1298 | proof - | 
| 56996 | 1299 | have "limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> (\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M)" | 
| 1300 | by (intro nn_integral_limsup[OF _ _ bound w]) auto | |
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1301 | moreover have "(\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M) = (\<integral>\<^sup>+ x. u' x \<partial>M)" | 
| 56996 | 1302 | using u' by (intro nn_integral_cong_AE, eventually_elim) (metis tendsto_iff_Liminf_eq_Limsup sequentially_bot) | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1303 | moreover have "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = (\<integral>\<^sup>+ x. u' x \<partial>M)" | 
| 56996 | 1304 | using u' by (intro nn_integral_cong_AE, eventually_elim) (metis tendsto_iff_Liminf_eq_Limsup sequentially_bot) | 
| 1305 | moreover have "(\<integral>\<^sup>+x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1306 | by (intro nn_integral_liminf) auto | 
| 56996 | 1307 | moreover have "liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))" | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1308 | by (intro Liminf_le_Limsup sequentially_bot) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1309 | ultimately show ?thesis | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1310 | by (intro Liminf_eq_Limsup) auto | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1311 | qed | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56949diff
changeset | 1312 | |
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1313 | lemma inf_continuous_nn_integral[order_continuous_intros]: | 
| 60175 | 1314 | assumes f: "\<And>y. inf_continuous (f y)" | 
| 60614 
e39e6881985c
generalized inf and sup_continuous; added intro rules
 hoelzl parents: 
60175diff
changeset | 1315 | assumes [measurable]: "\<And>x. (\<lambda>y. f y x) \<in> borel_measurable M" | 
| 
e39e6881985c
generalized inf and sup_continuous; added intro rules
 hoelzl parents: 
60175diff
changeset | 1316 | assumes bnd: "\<And>x. (\<integral>\<^sup>+ y. f y x \<partial>M) \<noteq> \<infinity>" | 
| 
e39e6881985c
generalized inf and sup_continuous; added intro rules
 hoelzl parents: 
60175diff
changeset | 1317 | shows "inf_continuous (\<lambda>x. (\<integral>\<^sup>+y. f y x \<partial>M))" | 
| 60175 | 1318 | unfolding inf_continuous_def | 
| 1319 | proof safe | |
| 60614 
e39e6881985c
generalized inf and sup_continuous; added intro rules
 hoelzl parents: 
60175diff
changeset | 1320 | fix C :: "nat \<Rightarrow> 'b" assume C: "decseq C" | 
| 
e39e6881985c
generalized inf and sup_continuous; added intro rules
 hoelzl parents: 
60175diff
changeset | 1321 | then show "(\<integral>\<^sup>+ y. f y (INFIMUM UNIV C) \<partial>M) = (INF i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1322 | using inf_continuous_mono[OF f] bnd | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1323 | by (auto simp add: inf_continuousD[OF f C] fun_eq_iff antimono_def mono_def le_fun_def less_top | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1324 | intro!: nn_integral_monotone_convergence_INF_decseq) | 
| 60175 | 1325 | qed | 
| 1326 | ||
| 56996 | 1327 | lemma nn_integral_null_set: | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1328 | assumes "N \<in> null_sets M" shows "(\<integral>\<^sup>+ x. u x * indicator N x \<partial>M) = 0" | 
| 38656 | 1329 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1330 | have "(\<integral>\<^sup>+ x. u x * indicator N x \<partial>M) = (\<integral>\<^sup>+ x. 0 \<partial>M)" | 
| 56996 | 1331 | proof (intro nn_integral_cong_AE AE_I) | 
| 40859 | 1332 |     show "{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N"
 | 
| 1333 | by (auto simp: indicator_def) | |
| 47694 | 1334 | show "(emeasure M) N = 0" "N \<in> sets M" | 
| 40859 | 1335 | using assms by auto | 
| 35582 | 1336 | qed | 
| 40859 | 1337 | then show ?thesis by simp | 
| 38656 | 1338 | qed | 
| 35582 | 1339 | |
| 56996 | 1340 | lemma nn_integral_0_iff: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1341 | assumes u: "u \<in> borel_measurable M" | 
| 56996 | 1342 |   shows "integral\<^sup>N M u = 0 \<longleftrightarrow> emeasure M {x\<in>space M. u x \<noteq> 0} = 0"
 | 
| 47694 | 1343 | (is "_ \<longleftrightarrow> (emeasure M) ?A = 0") | 
| 35582 | 1344 | proof - | 
| 56996 | 1345 | have u_eq: "(\<integral>\<^sup>+ x. u x * indicator ?A x \<partial>M) = integral\<^sup>N M u" | 
| 1346 | by (auto intro!: nn_integral_cong simp: indicator_def) | |
| 38656 | 1347 | show ?thesis | 
| 1348 | proof | |
| 47694 | 1349 | assume "(emeasure M) ?A = 0" | 
| 56996 | 1350 | with nn_integral_null_set[of ?A M u] u | 
| 1351 | show "integral\<^sup>N M u = 0" by (simp add: u_eq null_sets_def) | |
| 38656 | 1352 | next | 
| 56996 | 1353 | assume *: "integral\<^sup>N M u = 0" | 
| 46731 | 1354 |     let ?M = "\<lambda>n. {x \<in> space M. 1 \<le> real (n::nat) * u x}"
 | 
| 47694 | 1355 | have "0 = (SUP n. (emeasure M) (?M n \<inter> ?A))" | 
| 38656 | 1356 | proof - | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1357 |       { fix n :: nat
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1358 | from nn_integral_Markov_inequality[OF u, of ?A "of_nat n"] u | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1359 | have "(emeasure M) (?M n \<inter> ?A) \<le> 0" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1360 | by (simp add: ennreal_of_nat_eq_real_of_nat u_eq *) | 
| 47694 | 1361 | moreover have "0 \<le> (emeasure M) (?M n \<inter> ?A)" using u by auto | 
| 1362 | ultimately have "(emeasure M) (?M n \<inter> ?A) = 0" by auto } | |
| 38656 | 1363 | thus ?thesis by simp | 
| 35582 | 1364 | qed | 
| 47694 | 1365 | also have "\<dots> = (emeasure M) (\<Union>n. ?M n \<inter> ?A)" | 
| 1366 | proof (safe intro!: SUP_emeasure_incseq) | |
| 38656 | 1367 | fix n show "?M n \<inter> ?A \<in> sets M" | 
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50104diff
changeset | 1368 | using u by (auto intro!: sets.Int) | 
| 38656 | 1369 | next | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1370 |       show "incseq (\<lambda>n. {x \<in> space M. 1 \<le> real n * u x} \<inter> {x \<in> space M. u x \<noteq> 0})"
 | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1371 | proof (safe intro!: incseq_SucI) | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1372 | fix n :: nat and x | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1373 | assume *: "1 \<le> real n * u x" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1374 | also have "real n * u x \<le> real (Suc n) * u x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1375 | by (auto intro!: mult_right_mono) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1376 | finally show "1 \<le> real (Suc n) * u x" by auto | 
| 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1377 | qed | 
| 38656 | 1378 | qed | 
| 47694 | 1379 |     also have "\<dots> = (emeasure M) {x\<in>space M. 0 < u x}"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1380 | proof (safe intro!: arg_cong[where f="(emeasure M)"]) | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1381 | fix x assume "0 < u x" and [simp, intro]: "x \<in> space M" | 
| 38656 | 1382 | show "x \<in> (\<Union>n. ?M n \<inter> ?A)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1383 | proof (cases "u x" rule: ennreal_cases) | 
| 61808 | 1384 | case (real r) with \<open>0 < u x\<close> have "0 < r" by auto | 
| 41981 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 hoelzl parents: 
41831diff
changeset | 1385 | obtain j :: nat where "1 / r \<le> real j" using real_arch_simple .. | 
| 61808 | 1386 | hence "1 / r * r \<le> real j * r" unfolding mult_le_cancel_right using \<open>0 < r\<close> by auto | 
| 1387 | hence "1 \<le> real j * r" using real \<open>0 < r\<close> by auto | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1388 | thus ?thesis using \<open>0 < r\<close> real | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1389 | by (auto simp: ennreal_of_nat_eq_real_of_nat ennreal_1[symmetric] ennreal_mult[symmetric] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1390 | simp del: ennreal_1) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1391 | qed (insert \<open>0 < u x\<close>, auto simp: ennreal_mult_top) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1392 | qed (auto simp: zero_less_iff_neq_zero) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1393 | finally show "emeasure M ?A = 0" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1394 | by (simp add: zero_less_iff_neq_zero) | 
| 35582 | 1395 | qed | 
| 1396 | qed | |
| 1397 | ||
| 56996 | 1398 | lemma nn_integral_0_iff_AE: | 
| 41705 | 1399 | assumes u: "u \<in> borel_measurable M" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1400 | shows "integral\<^sup>N M u = 0 \<longleftrightarrow> (AE x in M. u x = 0)" | 
| 41705 | 1401 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1402 |   have sets: "{x\<in>space M. u x \<noteq> 0} \<in> sets M"
 | 
| 41705 | 1403 | using u by auto | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1404 | show "integral\<^sup>N M u = 0 \<longleftrightarrow> (AE x in M. u x = 0)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1405 | using nn_integral_0_iff[of u] AE_iff_null[OF sets] u by auto | 
| 41705 | 1406 | qed | 
| 1407 | ||
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1408 | lemma AE_iff_nn_integral: | 
| 56996 | 1409 |   "{x\<in>space M. P x} \<in> sets M \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> integral\<^sup>N M (indicator {x. \<not> P x}) = 0"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1410 | by (subst nn_integral_0_iff_AE) (auto simp: indicator_def[abs_def]) | 
| 50001 
382bd3173584
add syntax and a.e.-rules for (conditional) probability on predicates
 hoelzl parents: 
49800diff
changeset | 1411 | |
| 59000 | 1412 | lemma nn_integral_less: | 
| 1413 | assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1414 | assumes f: "(\<integral>\<^sup>+x. f x \<partial>M) \<noteq> \<infinity>" | 
| 59000 | 1415 | assumes ord: "AE x in M. f x \<le> g x" "\<not> (AE x in M. g x \<le> f x)" | 
| 1416 | shows "(\<integral>\<^sup>+x. f x \<partial>M) < (\<integral>\<^sup>+x. g x \<partial>M)" | |
| 1417 | proof - | |
| 1418 | have "0 < (\<integral>\<^sup>+x. g x - f x \<partial>M)" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1419 | proof (intro order_le_neq_trans notI) | 
| 59000 | 1420 | assume "0 = (\<integral>\<^sup>+x. g x - f x \<partial>M)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1421 | then have "AE x in M. g x - f x = 0" | 
| 59000 | 1422 | using nn_integral_0_iff_AE[of "\<lambda>x. g x - f x" M] by simp | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1423 | with ord(1) have "AE x in M. g x \<le> f x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1424 | by eventually_elim (auto simp: ennreal_minus_eq_0) | 
| 59000 | 1425 | with ord show False | 
| 1426 | by simp | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1427 | qed simp | 
| 59000 | 1428 | also have "\<dots> = (\<integral>\<^sup>+x. g x \<partial>M) - (\<integral>\<^sup>+x. f x \<partial>M)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1429 | using f by (subst nn_integral_diff) (auto simp: ord) | 
| 59000 | 1430 | finally show ?thesis | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1431 | using f by (auto dest!: ennreal_minus_pos_iff[rotated] simp: less_top) | 
| 59000 | 1432 | qed | 
| 1433 | ||
| 56996 | 1434 | lemma nn_integral_subalgebra: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1435 | assumes f: "f \<in> borel_measurable N" | 
| 47694 | 1436 | and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> emeasure N A = emeasure M A" | 
| 56996 | 1437 | shows "integral\<^sup>N N f = integral\<^sup>N M f" | 
| 39092 | 1438 | proof - | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1439 | have [simp]: "\<And>f :: 'a \<Rightarrow> ennreal. f \<in> borel_measurable N \<Longrightarrow> f \<in> borel_measurable M" | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1440 | using N by (auto simp: measurable_def) | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1441 | have [simp]: "\<And>P. (AE x in N. P x) \<Longrightarrow> (AE x in M. P x)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1442 | using N by (auto simp add: eventually_ae_filter null_sets_def subset_eq) | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1443 | have [simp]: "\<And>A. A \<in> sets N \<Longrightarrow> A \<in> sets M" | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1444 | using N by auto | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1445 | from f show ?thesis | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1446 | apply induct | 
| 56996 | 1447 | apply (simp_all add: nn_integral_add nn_integral_cmult nn_integral_monotone_convergence_SUP N) | 
| 1448 | apply (auto intro!: nn_integral_cong cong: nn_integral_cong simp: N(2)[symmetric]) | |
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1449 | done | 
| 39092 | 1450 | qed | 
| 1451 | ||
| 56996 | 1452 | lemma nn_integral_nat_function: | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1453 | fixes f :: "'a \<Rightarrow> nat" | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1454 | assumes "f \<in> measurable M (count_space UNIV)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1455 |   shows "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<Sum>t. emeasure M {x\<in>space M. t < f x})"
 | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1456 | proof - | 
| 63040 | 1457 |   define F where "F i = {x\<in>space M. i < f x}" for i
 | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1458 | with assms have [measurable]: "\<And>i. F i \<in> sets M" | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1459 | by auto | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1460 | |
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1461 |   { fix x assume "x \<in> space M"
 | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1462 | have "(\<lambda>i. if i < f x then 1 else 0) sums (of_nat (f x)::real)" | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1463 | using sums_If_finite[of "\<lambda>i. i < f x" "\<lambda>_. 1::real"] by simp | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1464 | then have "(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat(f x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1465 | unfolding ennreal_of_nat_eq_real_of_nat | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1466 | by (subst sums_ennreal) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1467 | moreover have "\<And>i. ennreal (if i < f x then 1 else 0) = indicator (F i) x" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1468 | using \<open>x \<in> space M\<close> by (simp add: one_ennreal_def F_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1469 | ultimately have "of_nat (f x) = (\<Sum>i. indicator (F i) x :: ennreal)" | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1470 | by (simp add: sums_iff) } | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1471 | then have "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>i. indicator (F i) x) \<partial>M)" | 
| 56996 | 1472 | by (simp cong: nn_integral_cong) | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1473 | also have "\<dots> = (\<Sum>i. emeasure M (F i))" | 
| 56996 | 1474 | by (simp add: nn_integral_suminf) | 
| 50097 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1475 | finally show ?thesis | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1476 | by (simp add: F_def) | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1477 | qed | 
| 
32973da2d4f7
rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
 hoelzl parents: 
50027diff
changeset | 1478 | |
| 60175 | 1479 | lemma nn_integral_lfp: | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1480 | assumes sets[simp]: "\<And>s. sets (M s) = sets N" | 
| 60175 | 1481 | assumes f: "sup_continuous f" | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1482 | assumes g: "sup_continuous g" | 
| 60175 | 1483 | assumes meas: "\<And>F. F \<in> borel_measurable N \<Longrightarrow> f F \<in> borel_measurable N" | 
| 1484 | assumes step: "\<And>F s. F \<in> borel_measurable N \<Longrightarrow> integral\<^sup>N (M s) (f F) = g (\<lambda>s. integral\<^sup>N (M s) F) s" | |
| 1485 | shows "(\<integral>\<^sup>+\<omega>. lfp f \<omega> \<partial>M s) = lfp g s" | |
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1486 | proof (subst lfp_transfer_bounded[where \<alpha>="\<lambda>F s. \<integral>\<^sup>+x. F x \<partial>M s" and g=g and f=f and P="\<lambda>f. f \<in> borel_measurable N", symmetric]) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1487 | fix C :: "nat \<Rightarrow> 'b \<Rightarrow> ennreal" assume "incseq C" "\<And>i. C i \<in> borel_measurable N" | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1488 | then show "(\<lambda>s. \<integral>\<^sup>+x. (SUP i. C i) x \<partial>M s) = (SUP i. (\<lambda>s. \<integral>\<^sup>+x. C i x \<partial>M s))" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1489 | unfolding SUP_apply[abs_def] | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1490 | by (subst nn_integral_monotone_convergence_SUP) | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1491 | (auto simp: mono_def fun_eq_iff intro!: arg_cong2[where f=emeasure] cong: measurable_cong_sets) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1492 | qed (auto simp add: step le_fun_def SUP_apply[abs_def] bot_fun_def bot_ennreal intro!: meas f g) | 
| 60175 | 1493 | |
| 1494 | lemma nn_integral_gfp: | |
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1495 | assumes sets[simp]: "\<And>s. sets (M s) = sets N" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1496 | assumes f: "inf_continuous f" and g: "inf_continuous g" | 
| 60175 | 1497 | assumes meas: "\<And>F. F \<in> borel_measurable N \<Longrightarrow> f F \<in> borel_measurable N" | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1498 | assumes bound: "\<And>F s. F \<in> borel_measurable N \<Longrightarrow> (\<integral>\<^sup>+x. f F x \<partial>M s) < \<infinity>" | 
| 60175 | 1499 | assumes non_zero: "\<And>s. emeasure (M s) (space (M s)) \<noteq> 0" | 
| 1500 | assumes step: "\<And>F s. F \<in> borel_measurable N \<Longrightarrow> integral\<^sup>N (M s) (f F) = g (\<lambda>s. integral\<^sup>N (M s) F) s" | |
| 1501 | shows "(\<integral>\<^sup>+\<omega>. gfp f \<omega> \<partial>M s) = gfp g s" | |
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1502 | proof (subst gfp_transfer_bounded[where \<alpha>="\<lambda>F s. \<integral>\<^sup>+x. F x \<partial>M s" and g=g and f=f | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1503 | and P="\<lambda>F. F \<in> borel_measurable N \<and> (\<forall>s. (\<integral>\<^sup>+x. F x \<partial>M s) < \<infinity>)", symmetric]) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1504 | fix C :: "nat \<Rightarrow> 'b \<Rightarrow> ennreal" assume "decseq C" "\<And>i. C i \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) (C i) < \<infinity>)" | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1505 | then show "(\<lambda>s. \<integral>\<^sup>+x. (INF i. C i) x \<partial>M s) = (INF i. (\<lambda>s. \<integral>\<^sup>+x. C i x \<partial>M s))" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1506 | unfolding INF_apply[abs_def] | 
| 61359 
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
 hoelzl parents: 
61169diff
changeset | 1507 | by (subst nn_integral_monotone_convergence_INF_decseq) | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1508 | (auto simp: mono_def fun_eq_iff intro!: arg_cong2[where f=emeasure] cong: measurable_cong_sets) | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1509 | next | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1510 | show "\<And>x. g x \<le> (\<lambda>s. integral\<^sup>N (M s) (f top))" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1511 | by (subst step) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1512 | (auto simp add: top_fun_def less_le non_zero le_fun_def ennreal_top_mult | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1513 | cong del: if_cong intro!: monoD[OF inf_continuous_mono[OF g], THEN le_funD]) | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1514 | next | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1515 | fix C assume "\<And>i::nat. C i \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) (C i) < \<infinity>)" "decseq C" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1516 | with bound show "INFIMUM UNIV C \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) (INFIMUM UNIV C) < \<infinity>)" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1517 | unfolding INF_apply[abs_def] | 
| 61359 
e985b52c3eb3
cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
 hoelzl parents: 
61169diff
changeset | 1518 | by (subst nn_integral_monotone_convergence_INF_decseq) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1519 | (auto simp: INF_less_iff cong: measurable_cong_sets intro!: borel_measurable_INF) | 
| 60636 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1520 | next | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1521 | show "\<And>x. x \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) x < \<infinity>) \<Longrightarrow> | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1522 | (\<lambda>s. integral\<^sup>N (M s) (f x)) = g (\<lambda>s. integral\<^sup>N (M s) x)" | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1523 | by (subst step) auto | 
| 
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
 hoelzl parents: 
60614diff
changeset | 1524 | qed (insert bound, auto simp add: le_fun_def INF_apply[abs_def] top_fun_def intro!: meas f g) | 
| 60175 | 1525 | |
| 61808 | 1526 | subsection \<open>Integral under concrete measures\<close> | 
| 56994 | 1527 | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1528 | lemma nn_integral_empty: | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1529 |   assumes "space M = {}"
 | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1530 | shows "nn_integral M f = 0" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1531 | proof - | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1532 | have "(\<integral>\<^sup>+ x. f x \<partial>M) = (\<integral>\<^sup>+ x. 0 \<partial>M)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1533 | by(rule nn_integral_cong)(simp add: assms) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1534 | thus ?thesis by simp | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1535 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1536 | |
| 61808 | 1537 | subsubsection \<open>Distributions\<close> | 
| 47694 | 1538 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1539 | lemma nn_integral_distr: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1540 | assumes T: "T \<in> measurable M M'" and f: "f \<in> borel_measurable (distr M M' T)" | 
| 56996 | 1541 | shows "integral\<^sup>N (distr M M' T) f = (\<integral>\<^sup>+ x. f (T x) \<partial>M)" | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1542 | using f | 
| 49797 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1543 | proof induct | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1544 | case (cong f g) | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1545 | with T show ?case | 
| 56996 | 1546 | apply (subst nn_integral_cong[of _ f g]) | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1547 | apply simp | 
| 56996 | 1548 | apply (subst nn_integral_cong[of _ "\<lambda>x. f (T x)" "\<lambda>x. g (T x)"]) | 
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1549 | apply (simp add: measurable_def Pi_iff) | 
| 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 1550 | apply simp | 
| 49797 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1551 | done | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1552 | next | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1553 | case (set A) | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1554 | then have eq: "\<And>x. x \<in> space M \<Longrightarrow> indicator A (T x) = indicator (T -` A \<inter> space M) x" | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1555 | by (auto simp: indicator_def) | 
| 
28066863284c
add induction rules for simple functions and for Borel measurable functions
 hoelzl parents: 
49796diff
changeset | 1556 | from set T show ?case | 
| 56996 | 1557 | by (subst nn_integral_cong[OF eq]) | 
| 1558 | (auto simp add: emeasure_distr intro!: nn_integral_indicator[symmetric] measurable_sets) | |
| 1559 | qed (simp_all add: measurable_compose[OF T] T nn_integral_cmult nn_integral_add | |
| 1560 | nn_integral_monotone_convergence_SUP le_fun_def incseq_def) | |
| 47694 | 1561 | |
| 61808 | 1562 | subsubsection \<open>Counting space\<close> | 
| 47694 | 1563 | |
| 1564 | lemma simple_function_count_space[simp]: | |
| 1565 | "simple_function (count_space A) f \<longleftrightarrow> finite (f ` A)" | |
| 1566 | unfolding simple_function_def by simp | |
| 1567 | ||
| 56996 | 1568 | lemma nn_integral_count_space: | 
| 47694 | 1569 |   assumes A: "finite {a\<in>A. 0 < f a}"
 | 
| 56996 | 1570 | shows "integral\<^sup>N (count_space A) f = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)" | 
| 35582 | 1571 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1572 | have *: "(\<integral>\<^sup>+x. max 0 (f x) \<partial>count_space A) = | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1573 |     (\<integral>\<^sup>+ x. (\<Sum>a|a\<in>A \<and> 0 < f a. f a * indicator {a} x) \<partial>count_space A)"
 | 
| 56996 | 1574 | by (auto intro!: nn_integral_cong | 
| 57418 | 1575 | simp add: indicator_def if_distrib setsum.If_cases[OF A] max_def le_less) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1576 |   also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. \<integral>\<^sup>+ x. f a * indicator {a} x \<partial>count_space A)"
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1577 | by (subst nn_integral_setsum) (simp_all add: AE_count_space less_imp_le) | 
| 47694 | 1578 | also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1579 | by (auto intro!: setsum.cong simp: one_ennreal_def[symmetric] max_def) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1580 | finally show ?thesis by (simp add: max.absorb2) | 
| 47694 | 1581 | qed | 
| 1582 | ||
| 56996 | 1583 | lemma nn_integral_count_space_finite: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1584 | "finite A \<Longrightarrow> (\<integral>\<^sup>+x. f x \<partial>count_space A) = (\<Sum>a\<in>A. f a)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1585 | by (auto intro!: setsum.mono_neutral_left simp: nn_integral_count_space less_le) | 
| 47694 | 1586 | |
| 59000 | 1587 | lemma nn_integral_count_space': | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1588 | assumes "finite A" "\<And>x. x \<in> B \<Longrightarrow> x \<notin> A \<Longrightarrow> f x = 0" "A \<subseteq> B" | 
| 59000 | 1589 | shows "(\<integral>\<^sup>+x. f x \<partial>count_space B) = (\<Sum>x\<in>A. f x)" | 
| 1590 | proof - | |
| 1591 | have "(\<integral>\<^sup>+x. f x \<partial>count_space B) = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)" | |
| 1592 | using assms(2,3) | |
| 61808 | 1593 | by (intro nn_integral_count_space finite_subset[OF _ \<open>finite A\<close>]) (auto simp: less_le) | 
| 59000 | 1594 | also have "\<dots> = (\<Sum>a\<in>A. f a)" | 
| 1595 | using assms by (intro setsum.mono_neutral_cong_left) (auto simp: less_le) | |
| 1596 | finally show ?thesis . | |
| 1597 | qed | |
| 1598 | ||
| 59011 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1599 | lemma nn_integral_bij_count_space: | 
| 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1600 | assumes g: "bij_betw g A B" | 
| 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1601 | shows "(\<integral>\<^sup>+x. f (g x) \<partial>count_space A) = (\<integral>\<^sup>+x. f x \<partial>count_space B)" | 
| 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1602 | using g[THEN bij_betw_imp_funcset] | 
| 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1603 | by (subst distr_bij_count_space[OF g, symmetric]) | 
| 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1604 | (auto intro!: nn_integral_distr[symmetric]) | 
| 
4902a2fec434
add reindex rules for distr and nn_integral on count_space
 hoelzl parents: 
59002diff
changeset | 1605 | |
| 59000 | 1606 | lemma nn_integral_indicator_finite: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1607 | fixes f :: "'a \<Rightarrow> ennreal" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1608 |   assumes f: "finite A" and [measurable]: "\<And>a. a \<in> A \<Longrightarrow> {a} \<in> sets M"
 | 
| 59000 | 1609 |   shows "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = (\<Sum>x\<in>A. f x * emeasure M {x})"
 | 
| 1610 | proof - | |
| 1611 |   from f have "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>a\<in>A. f a * indicator {a} x) \<partial>M)"
 | |
| 1612 | by (intro nn_integral_cong) (auto simp: indicator_def if_distrib[where f="\<lambda>a. x * a" for x] setsum.If_cases) | |
| 1613 |   also have "\<dots> = (\<Sum>a\<in>A. f a * emeasure M {a})"
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1614 | by (subst nn_integral_setsum) auto | 
| 59000 | 1615 | finally show ?thesis . | 
| 1616 | qed | |
| 1617 | ||
| 57025 | 1618 | lemma nn_integral_count_space_nat: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1619 | fixes f :: "nat \<Rightarrow> ennreal" | 
| 57025 | 1620 | shows "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) = (\<Sum>i. f i)" | 
| 1621 | proof - | |
| 1622 | have "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) = | |
| 1623 |     (\<integral>\<^sup>+i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV)"
 | |
| 1624 | proof (intro nn_integral_cong) | |
| 1625 | fix i | |
| 1626 |     have "f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)"
 | |
| 1627 | by simp | |
| 1628 |     also have "\<dots> = (\<Sum>j. f j * indicator {j} i)"
 | |
| 1629 | by (rule suminf_finite[symmetric]) auto | |
| 1630 |     finally show "f i = (\<Sum>j. f j * indicator {j} i)" .
 | |
| 1631 | qed | |
| 1632 |   also have "\<dots> = (\<Sum>j. (\<integral>\<^sup>+i. f j * indicator {j} i \<partial>count_space UNIV))"
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1633 | by (rule nn_integral_suminf) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1634 | finally show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1635 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1636 | qed | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1637 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1638 | lemma nn_integral_enat_function: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1639 | assumes f: "f \<in> measurable M (count_space UNIV)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1640 |   shows "(\<integral>\<^sup>+ x. ennreal_of_enat (f x) \<partial>M) = (\<Sum>t. emeasure M {x \<in> space M. t < f x})"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1641 | proof - | 
| 63040 | 1642 |   define F where "F i = {x\<in>space M. i < f x}" for i :: nat
 | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1643 | with assms have [measurable]: "\<And>i. F i \<in> sets M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1644 | by auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1645 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1646 |   { fix x assume "x \<in> space M"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1647 | have "(\<lambda>i::nat. if i < f x then 1 else 0) sums ennreal_of_enat (f x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1648 | using sums_If_finite[of "\<lambda>r. r < f x" "\<lambda>_. 1 :: ennreal"] | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1649 | by (cases "f x") (simp_all add: sums_def of_nat_tendsto_top_ennreal) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1650 | also have "(\<lambda>i. (if i < f x then 1 else 0)) = (\<lambda>i. indicator (F i) x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1651 | using `x \<in> space M` by (simp add: one_ennreal_def F_def fun_eq_iff) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1652 | finally have "ennreal_of_enat (f x) = (\<Sum>i. indicator (F i) x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1653 | by (simp add: sums_iff) } | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1654 | then have "(\<integral>\<^sup>+x. ennreal_of_enat (f x) \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>i. indicator (F i) x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1655 | by (simp cong: nn_integral_cong) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1656 | also have "\<dots> = (\<Sum>i. emeasure M (F i))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1657 | by (simp add: nn_integral_suminf) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1658 | finally show ?thesis | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1659 | by (simp add: F_def) | 
| 57025 | 1660 | qed | 
| 1661 | ||
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1662 | lemma nn_integral_count_space_nn_integral: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1663 | fixes f :: "'i \<Rightarrow> 'a \<Rightarrow> ennreal" | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1664 | assumes "countable I" and [measurable]: "\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1665 | shows "(\<integral>\<^sup>+x. \<integral>\<^sup>+i. f i x \<partial>count_space I \<partial>M) = (\<integral>\<^sup>+i. \<integral>\<^sup>+x. f i x \<partial>M \<partial>count_space I)" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1666 | proof cases | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1667 | assume "finite I" then show ?thesis | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1668 | by (simp add: nn_integral_count_space_finite nn_integral_setsum) | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1669 | next | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1670 | assume "infinite I" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1671 |   then have [simp]: "I \<noteq> {}"
 | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1672 | by auto | 
| 61808 | 1673 | note * = bij_betw_from_nat_into[OF \<open>countable I\<close> \<open>infinite I\<close>] | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1674 | have **: "\<And>f. (\<And>i. 0 \<le> f i) \<Longrightarrow> (\<integral>\<^sup>+i. f i \<partial>count_space I) = (\<Sum>n. f (from_nat_into I n))" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1675 | by (simp add: nn_integral_bij_count_space[symmetric, OF *] nn_integral_count_space_nat) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1676 | show ?thesis | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1677 | by (simp add: ** nn_integral_suminf from_nat_into) | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1678 | qed | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1679 | |
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1680 | lemma emeasure_UN_countable: | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1681 | assumes sets[measurable]: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> sets M" and I[simp]: "countable I" | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1682 | assumes disj: "disjoint_family_on X I" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1683 | shows "emeasure M (UNION I X) = (\<integral>\<^sup>+i. emeasure M (X i) \<partial>count_space I)" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1684 | proof - | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1685 | have eq: "\<And>x. indicator (UNION I X) x = \<integral>\<^sup>+ i. indicator (X i) x \<partial>count_space I" | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1686 | proof cases | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1687 | fix x assume x: "x \<in> UNION I X" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1688 | then obtain j where j: "x \<in> X j" "j \<in> I" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1689 | by auto | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1690 |     with disj have "\<And>i. i \<in> I \<Longrightarrow> indicator (X i) x = (indicator {j} i::ennreal)"
 | 
| 59426 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1691 | by (auto simp: disjoint_family_on_def split: split_indicator) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1692 | with x j show "?thesis x" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1693 | by (simp cong: nn_integral_cong_simp) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1694 | qed (auto simp: nn_integral_0_iff_AE) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1695 | |
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1696 | note sets.countable_UN'[unfolded subset_eq, measurable] | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1697 | have "emeasure M (UNION I X) = (\<integral>\<^sup>+x. indicator (UNION I X) x \<partial>M)" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1698 | by simp | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1699 | also have "\<dots> = (\<integral>\<^sup>+i. \<integral>\<^sup>+x. indicator (X i) x \<partial>M \<partial>count_space I)" | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1700 | by (simp add: eq nn_integral_count_space_nn_integral) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1701 | finally show ?thesis | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1702 | by (simp cong: nn_integral_cong_simp) | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1703 | qed | 
| 
6fca83e88417
integral of the product of count spaces equals the integral of the count space of the product type
 hoelzl parents: 
59425diff
changeset | 1704 | |
| 57025 | 1705 | lemma emeasure_countable_singleton: | 
| 1706 |   assumes sets: "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M" and X: "countable X"
 | |
| 1707 |   shows "emeasure M X = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
 | |
| 1708 | proof - | |
| 1709 |   have "emeasure M (\<Union>i\<in>X. {i}) = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
 | |
| 1710 | using assms by (intro emeasure_UN_countable) (auto simp: disjoint_family_on_def) | |
| 1711 |   also have "(\<Union>i\<in>X. {i}) = X" by auto
 | |
| 1712 | finally show ?thesis . | |
| 1713 | qed | |
| 1714 | ||
| 1715 | lemma measure_eqI_countable: | |
| 1716 | assumes [simp]: "sets M = Pow A" "sets N = Pow A" and A: "countable A" | |
| 1717 |   assumes eq: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} = emeasure N {a}"
 | |
| 1718 | shows "M = N" | |
| 1719 | proof (rule measure_eqI) | |
| 1720 | fix X assume "X \<in> sets M" | |
| 1721 | then have X: "X \<subseteq> A" by auto | |
| 1722 | moreover with A have "countable X" by (auto dest: countable_subset) | |
| 1723 | ultimately have | |
| 1724 |     "emeasure M X = (\<integral>\<^sup>+a. emeasure M {a} \<partial>count_space X)"
 | |
| 1725 |     "emeasure N X = (\<integral>\<^sup>+a. emeasure N {a} \<partial>count_space X)"
 | |
| 1726 | by (auto intro!: emeasure_countable_singleton) | |
| 1727 |   moreover have "(\<integral>\<^sup>+a. emeasure M {a} \<partial>count_space X) = (\<integral>\<^sup>+a. emeasure N {a} \<partial>count_space X)"
 | |
| 1728 | using X by (intro nn_integral_cong eq) auto | |
| 1729 | ultimately show "emeasure M X = emeasure N X" | |
| 1730 | by simp | |
| 1731 | qed simp | |
| 1732 | ||
| 59000 | 1733 | lemma measure_eqI_countable_AE: | 
| 1734 | assumes [simp]: "sets M = UNIV" "sets N = UNIV" | |
| 1735 | assumes ae: "AE x in M. x \<in> \<Omega>" "AE x in N. x \<in> \<Omega>" and [simp]: "countable \<Omega>" | |
| 1736 |   assumes eq: "\<And>x. x \<in> \<Omega> \<Longrightarrow> emeasure M {x} = emeasure N {x}"
 | |
| 1737 | shows "M = N" | |
| 1738 | proof (rule measure_eqI) | |
| 1739 | fix A | |
| 1740 |   have "emeasure N A = emeasure N {x\<in>\<Omega>. x \<in> A}"
 | |
| 1741 | using ae by (intro emeasure_eq_AE) auto | |
| 1742 |   also have "\<dots> = (\<integral>\<^sup>+x. emeasure N {x} \<partial>count_space {x\<in>\<Omega>. x \<in> A})"
 | |
| 1743 | by (intro emeasure_countable_singleton) auto | |
| 1744 |   also have "\<dots> = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space {x\<in>\<Omega>. x \<in> A})"
 | |
| 1745 | by (intro nn_integral_cong eq[symmetric]) auto | |
| 1746 |   also have "\<dots> = emeasure M {x\<in>\<Omega>. x \<in> A}"
 | |
| 1747 | by (intro emeasure_countable_singleton[symmetric]) auto | |
| 1748 | also have "\<dots> = emeasure M A" | |
| 1749 | using ae by (intro emeasure_eq_AE) auto | |
| 1750 | finally show "emeasure M A = emeasure N A" .. | |
| 1751 | qed simp | |
| 1752 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1753 | lemma nn_integral_monotone_convergence_SUP_nat: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1754 | fixes f :: "'a \<Rightarrow> nat \<Rightarrow> ennreal" | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1755 | assumes chain: "Complete_Partial_Order.chain op \<le> (f ` Y)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1756 |   and nonempty: "Y \<noteq> {}"
 | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1757 | shows "(\<integral>\<^sup>+ x. (SUP i:Y. f i x) \<partial>count_space UNIV) = (SUP i:Y. (\<integral>\<^sup>+ x. f i x \<partial>count_space UNIV))" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1758 | (is "?lhs = ?rhs" is "integral\<^sup>N ?M _ = _") | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1759 | proof (rule order_class.order.antisym) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1760 | show "?rhs \<le> ?lhs" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1761 | by (auto intro!: SUP_least SUP_upper nn_integral_mono) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1762 | next | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1763 | have "\<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i x) ` Y \<and> (SUP i:Y. f i x) = (SUP i. g i)" for x | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1764 | by (rule ennreal_Sup_countable_SUP) (simp add: nonempty) | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1765 | then obtain g where incseq: "\<And>x. incseq (g x)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1766 | and range: "\<And>x. range (g x) \<subseteq> (\<lambda>i. f i x) ` Y" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1767 | and sup: "\<And>x. (SUP i:Y. f i x) = (SUP i. g x i)" by moura | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1768 | from incseq have incseq': "incseq (\<lambda>i x. g x i)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1769 | by(blast intro: incseq_SucI le_funI dest: incseq_SucD) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1770 | |
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1771 | have "?lhs = \<integral>\<^sup>+ x. (SUP i. g x i) \<partial>?M" by(simp add: sup) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1772 | also have "\<dots> = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>?M)" using incseq' | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1773 | by(rule nn_integral_monotone_convergence_SUP) simp | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1774 | also have "\<dots> \<le> (SUP i:Y. \<integral>\<^sup>+ x. f i x \<partial>?M)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1775 | proof(rule SUP_least) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1776 | fix n | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1777 | have "\<And>x. \<exists>i. g x n = f i x \<and> i \<in> Y" using range by blast | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1778 | then obtain I where I: "\<And>x. g x n = f (I x) x" "\<And>x. I x \<in> Y" by moura | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1779 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1780 | have "(\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV) = (\<Sum>x. g x n)" | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1781 | by(rule nn_integral_count_space_nat) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1782 | also have "\<dots> = (SUP m. \<Sum>x<m. g x n)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1783 | by(rule suminf_eq_SUP) | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1784 | also have "\<dots> \<le> (SUP i:Y. \<integral>\<^sup>+ x. f i x \<partial>?M)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1785 | proof(rule SUP_mono) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1786 | fix m | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1787 | show "\<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> (\<integral>\<^sup>+ x. f m' x \<partial>?M)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1788 | proof(cases "m > 0") | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1789 | case False | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1790 | thus ?thesis using nonempty by auto | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1791 | next | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1792 | case True | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1793 |         let ?Y = "I ` {..<m}"
 | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1794 | have "f ` ?Y \<subseteq> f ` Y" using I by auto | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1795 | with chain have chain': "Complete_Partial_Order.chain op \<le> (f ` ?Y)" by(rule chain_subset) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1796 | hence "Sup (f ` ?Y) \<in> f ` ?Y" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1797 | by(rule ccpo_class.in_chain_finite)(auto simp add: True lessThan_empty_iff) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1798 | then obtain m' where "m' < m" and m': "(SUP i:?Y. f i) = f (I m')" by auto | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1799 | have "I m' \<in> Y" using I by blast | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1800 | have "(\<Sum>x<m. g x n) \<le> (\<Sum>x<m. f (I m') x)" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1801 | proof(rule setsum_mono) | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1802 | fix x | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1803 |           assume "x \<in> {..<m}"
 | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1804 | hence "x < m" by simp | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1805 | have "g x n = f (I x) x" by(simp add: I) | 
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 1806 | also have "\<dots> \<le> (SUP i:?Y. f i) x" unfolding Sup_fun_def image_image | 
| 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 1807 |             using \<open>x \<in> {..<m}\<close> by (rule Sup_upper [OF imageI])
 | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1808 | also have "\<dots> = f (I m') x" unfolding m' by simp | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1809 | finally show "g x n \<le> f (I m') x" . | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1810 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1811 | also have "\<dots> \<le> (SUP m. (\<Sum>x<m. f (I m') x))" | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1812 | by(rule SUP_upper) simp | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1813 | also have "\<dots> = (\<Sum>x. f (I m') x)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1814 | by(rule suminf_eq_SUP[symmetric]) | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1815 | also have "\<dots> = (\<integral>\<^sup>+ x. f (I m') x \<partial>?M)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1816 | by(rule nn_integral_count_space_nat[symmetric]) | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1817 | finally show ?thesis using \<open>I m' \<in> Y\<close> by blast | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1818 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1819 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1820 | finally show "(\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV) \<le> \<dots>" . | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1821 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1822 | finally show "?lhs \<le> ?rhs" . | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1823 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1824 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1825 | lemma power_series_tendsto_at_left: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1826 | assumes nonneg: "\<And>i. 0 \<le> f i" and summable: "\<And>z. 0 \<le> z \<Longrightarrow> z < 1 \<Longrightarrow> summable (\<lambda>n. f n * z^n)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1827 | shows "((\<lambda>z. ennreal (\<Sum>n. f n * z^n)) \<longlongrightarrow> (\<Sum>n. ennreal (f n))) (at_left (1::real))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1828 | proof (intro tendsto_at_left_sequentially) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1829 | show "0 < (1::real)" by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1830 | fix S :: "nat \<Rightarrow> real" assume S: "\<And>n. S n < 1" "\<And>n. 0 < S n" "S \<longlonglongrightarrow> 1" "incseq S" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1831 | then have S_nonneg: "\<And>i. 0 \<le> S i" by (auto intro: less_imp_le) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1832 | |
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1833 | have "(\<lambda>i. (\<integral>\<^sup>+n. f n * S i^n \<partial>count_space UNIV)) \<longlonglongrightarrow> (\<integral>\<^sup>+n. ennreal (f n) \<partial>count_space UNIV)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1834 | proof (rule nn_integral_LIMSEQ) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1835 | show "incseq (\<lambda>i n. ennreal (f n * S i^n))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1836 | using S by (auto intro!: mult_mono power_mono nonneg ennreal_leI | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1837 | simp: incseq_def le_fun_def less_imp_le) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1838 | fix n have "(\<lambda>i. ennreal (f n * S i^n)) \<longlonglongrightarrow> ennreal (f n * 1^n)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1839 | by (intro tendsto_intros tendsto_ennrealI S) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1840 | then show "(\<lambda>i. ennreal (f n * S i^n)) \<longlonglongrightarrow> ennreal (f n)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1841 | by simp | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1842 | qed (auto simp: S_nonneg intro!: mult_nonneg_nonneg nonneg) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1843 | also have "(\<lambda>i. (\<integral>\<^sup>+n. f n * S i^n \<partial>count_space UNIV)) = (\<lambda>i. \<Sum>n. f n * S i^n)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1844 | by (subst nn_integral_count_space_nat) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1845 | (intro ext suminf_ennreal2 mult_nonneg_nonneg nonneg S_nonneg | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1846 | zero_le_power summable S)+ | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1847 | also have "(\<integral>\<^sup>+n. ennreal (f n) \<partial>count_space UNIV) = (\<Sum>n. ennreal (f n))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1848 | by (simp add: nn_integral_count_space_nat nonneg) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1849 | finally show "(\<lambda>n. ennreal (\<Sum>na. f na * S n ^ na)) \<longlonglongrightarrow> (\<Sum>n. ennreal (f n))" . | 
| 60064 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1850 | qed | 
| 
63124d48a2ee
add lemma about monotone convergence for countable integrals over arbitrary sequences
 Andreas Lochbihler parents: 
59779diff
changeset | 1851 | |
| 61808 | 1852 | subsubsection \<open>Measures with Restricted Space\<close> | 
| 54417 | 1853 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1854 | lemma simple_function_restrict_space_ennreal: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1855 | fixes f :: "'a \<Rightarrow> ennreal" | 
| 57137 | 1856 | assumes "\<Omega> \<inter> space M \<in> sets M" | 
| 1857 | shows "simple_function (restrict_space M \<Omega>) f \<longleftrightarrow> simple_function M (\<lambda>x. f x * indicator \<Omega> x)" | |
| 1858 | proof - | |
| 1859 |   { assume "finite (f ` space (restrict_space M \<Omega>))"
 | |
| 1860 |     then have "finite (f ` space (restrict_space M \<Omega>) \<union> {0})" by simp
 | |
| 1861 | then have "finite ((\<lambda>x. f x * indicator \<Omega> x) ` space M)" | |
| 1862 | by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) } | |
| 1863 | moreover | |
| 1864 |   { assume "finite ((\<lambda>x. f x * indicator \<Omega> x) ` space M)"
 | |
| 1865 | then have "finite (f ` space (restrict_space M \<Omega>))" | |
| 1866 | by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) } | |
| 1867 | ultimately show ?thesis | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1868 | unfolding | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1869 | simple_function_iff_borel_measurable borel_measurable_restrict_space_iff_ennreal[OF assms] | 
| 57137 | 1870 | by auto | 
| 1871 | qed | |
| 1872 | ||
| 1873 | lemma simple_function_restrict_space: | |
| 1874 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 1875 | assumes "\<Omega> \<inter> space M \<in> sets M" | |
| 1876 | shows "simple_function (restrict_space M \<Omega>) f \<longleftrightarrow> simple_function M (\<lambda>x. indicator \<Omega> x *\<^sub>R f x)" | |
| 1877 | proof - | |
| 1878 |   { assume "finite (f ` space (restrict_space M \<Omega>))"
 | |
| 1879 |     then have "finite (f ` space (restrict_space M \<Omega>) \<union> {0})" by simp
 | |
| 1880 | then have "finite ((\<lambda>x. indicator \<Omega> x *\<^sub>R f x) ` space M)" | |
| 1881 | by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) } | |
| 1882 | moreover | |
| 1883 |   { assume "finite ((\<lambda>x. indicator \<Omega> x *\<^sub>R f x) ` space M)"
 | |
| 1884 | then have "finite (f ` space (restrict_space M \<Omega>))" | |
| 1885 | by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) } | |
| 1886 | ultimately show ?thesis | |
| 1887 | unfolding simple_function_iff_borel_measurable | |
| 1888 | borel_measurable_restrict_space_iff[OF assms] | |
| 1889 | by auto | |
| 1890 | qed | |
| 1891 | ||
| 1892 | lemma simple_integral_restrict_space: | |
| 1893 | assumes \<Omega>: "\<Omega> \<inter> space M \<in> sets M" "simple_function (restrict_space M \<Omega>) f" | |
| 1894 | shows "simple_integral (restrict_space M \<Omega>) f = simple_integral M (\<lambda>x. f x * indicator \<Omega> x)" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1895 | using simple_function_restrict_space_ennreal[THEN iffD1, OF \<Omega>, THEN simple_functionD(1)] | 
| 57137 | 1896 | by (auto simp add: space_restrict_space emeasure_restrict_space[OF \<Omega>(1)] le_infI2 simple_integral_def | 
| 1897 | split: split_indicator split_indicator_asm | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1898 | intro!: setsum.mono_neutral_cong_left ennreal_mult_left_cong arg_cong2[where f=emeasure]) | 
| 57137 | 1899 | |
| 56996 | 1900 | lemma nn_integral_restrict_space: | 
| 57137 | 1901 | assumes \<Omega>[simp]: "\<Omega> \<inter> space M \<in> sets M" | 
| 1902 | shows "nn_integral (restrict_space M \<Omega>) f = nn_integral M (\<lambda>x. f x * indicator \<Omega> x)" | |
| 1903 | proof - | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1904 |   let ?R = "restrict_space M \<Omega>" and ?X = "\<lambda>M f. {s. simple_function M s \<and> s \<le> f \<and> (\<forall>x. s x < top)}"
 | 
| 57137 | 1905 | have "integral\<^sup>S ?R ` ?X ?R f = integral\<^sup>S M ` ?X M (\<lambda>x. f x * indicator \<Omega> x)" | 
| 1906 | proof (safe intro!: image_eqI) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1907 | fix s assume s: "simple_function ?R s" "s \<le> f" "\<forall>x. s x < top" | 
| 57137 | 1908 | from s show "integral\<^sup>S (restrict_space M \<Omega>) s = integral\<^sup>S M (\<lambda>x. s x * indicator \<Omega> x)" | 
| 1909 | by (intro simple_integral_restrict_space) auto | |
| 1910 | from s show "simple_function M (\<lambda>x. s x * indicator \<Omega> x)" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1911 | by (simp add: simple_function_restrict_space_ennreal) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1912 | from s show "(\<lambda>x. s x * indicator \<Omega> x) \<le> (\<lambda>x. f x * indicator \<Omega> x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1913 | "\<And>x. s x * indicator \<Omega> x < top" | 
| 57137 | 1914 | by (auto split: split_indicator simp: le_fun_def image_subset_iff) | 
| 1915 | next | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1916 | fix s assume s: "simple_function M s" "s \<le> (\<lambda>x. f x * indicator \<Omega> x)" "\<forall>x. s x < top" | 
| 57137 | 1917 | then have "simple_function M (\<lambda>x. s x * indicator (\<Omega> \<inter> space M) x)" (is ?s') | 
| 1918 | by (intro simple_function_mult simple_function_indicator) auto | |
| 1919 | also have "?s' \<longleftrightarrow> simple_function M (\<lambda>x. s x * indicator \<Omega> x)" | |
| 1920 | by (rule simple_function_cong) (auto split: split_indicator) | |
| 1921 | finally show sf: "simple_function (restrict_space M \<Omega>) s" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1922 | by (simp add: simple_function_restrict_space_ennreal) | 
| 57137 | 1923 | |
| 1924 | from s have s_eq: "s = (\<lambda>x. s x * indicator \<Omega> x)" | |
| 1925 | by (auto simp add: fun_eq_iff le_fun_def image_subset_iff | |
| 1926 | split: split_indicator split_indicator_asm | |
| 1927 | intro: antisym) | |
| 1928 | ||
| 1929 | show "integral\<^sup>S M s = integral\<^sup>S (restrict_space M \<Omega>) s" | |
| 1930 | by (subst s_eq) (rule simple_integral_restrict_space[symmetric, OF \<Omega> sf]) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1931 | show "\<And>x. s x < top" | 
| 57137 | 1932 | using s by (auto simp: image_subset_iff) | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1933 | from s show "s \<le> f" | 
| 57137 | 1934 | by (subst s_eq) (auto simp: image_subset_iff le_fun_def split: split_indicator split_indicator_asm) | 
| 1935 | qed | |
| 1936 | then show ?thesis | |
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62083diff
changeset | 1937 | unfolding nn_integral_def_finite by (simp cong del: strong_SUP_cong) | 
| 54417 | 1938 | qed | 
| 1939 | ||
| 59000 | 1940 | lemma nn_integral_count_space_indicator: | 
| 59779 | 1941 | assumes "NO_MATCH (UNIV::'a set) (X::'a set)" | 
| 59000 | 1942 | shows "(\<integral>\<^sup>+x. f x \<partial>count_space X) = (\<integral>\<^sup>+x. f x * indicator X x \<partial>count_space UNIV)" | 
| 1943 | by (simp add: nn_integral_restrict_space[symmetric] restrict_count_space) | |
| 1944 | ||
| 59425 | 1945 | lemma nn_integral_count_space_eq: | 
| 1946 | "(\<And>x. x \<in> A - B \<Longrightarrow> f x = 0) \<Longrightarrow> (\<And>x. x \<in> B - A \<Longrightarrow> f x = 0) \<Longrightarrow> | |
| 1947 | (\<integral>\<^sup>+x. f x \<partial>count_space A) = (\<integral>\<^sup>+x. f x \<partial>count_space B)" | |
| 1948 | by (auto simp: nn_integral_count_space_indicator intro!: nn_integral_cong split: split_indicator) | |
| 1949 | ||
| 59023 | 1950 | lemma nn_integral_ge_point: | 
| 1951 | assumes "x \<in> A" | |
| 1952 | shows "p x \<le> \<integral>\<^sup>+ x. p x \<partial>count_space A" | |
| 1953 | proof - | |
| 1954 |   from assms have "p x \<le> \<integral>\<^sup>+ x. p x \<partial>count_space {x}"
 | |
| 1955 | by(auto simp add: nn_integral_count_space_finite max_def) | |
| 1956 |   also have "\<dots> = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A"
 | |
| 1957 | using assms by(auto simp add: nn_integral_count_space_indicator indicator_def intro!: nn_integral_cong) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1958 | also have "\<dots> \<le> \<integral>\<^sup>+ x. p x \<partial>count_space A" | 
| 59023 | 1959 | by(rule nn_integral_mono)(simp add: indicator_def) | 
| 1960 | finally show ?thesis . | |
| 1961 | qed | |
| 1962 | ||
| 61808 | 1963 | subsubsection \<open>Measure spaces with an associated density\<close> | 
| 47694 | 1964 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1965 | definition density :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
 | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1966 | "density M f = measure_of (space M) (sets M) (\<lambda>A. \<integral>\<^sup>+ x. f x * indicator A x \<partial>M)" | 
| 35582 | 1967 | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1968 | lemma | 
| 59048 | 1969 | shows sets_density[simp, measurable_cong]: "sets (density M f) = sets M" | 
| 47694 | 1970 | and space_density[simp]: "space (density M f) = space M" | 
| 1971 | by (auto simp: density_def) | |
| 1972 | ||
| 50003 | 1973 | (* FIXME: add conversion to simplify space, sets and measurable *) | 
| 1974 | lemma space_density_imp[measurable_dest]: | |
| 1975 | "\<And>x M f. x \<in> space (density M f) \<Longrightarrow> x \<in> space M" by auto | |
| 1976 | ||
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 1977 | lemma | 
| 47694 | 1978 | shows measurable_density_eq1[simp]: "g \<in> measurable (density Mg f) Mg' \<longleftrightarrow> g \<in> measurable Mg Mg'" | 
| 1979 | and measurable_density_eq2[simp]: "h \<in> measurable Mh (density Mh' f) \<longleftrightarrow> h \<in> measurable Mh Mh'" | |
| 1980 | and simple_function_density_eq[simp]: "simple_function (density Mu f) u \<longleftrightarrow> simple_function Mu u" | |
| 1981 | unfolding measurable_def simple_function_def by simp_all | |
| 1982 | ||
| 1983 | lemma density_cong: "f \<in> borel_measurable M \<Longrightarrow> f' \<in> borel_measurable M \<Longrightarrow> | |
| 1984 | (AE x in M. f x = f' x) \<Longrightarrow> density M f = density M f'" | |
| 56996 | 1985 | unfolding density_def by (auto intro!: measure_of_eq nn_integral_cong_AE sets.space_closed) | 
| 47694 | 1986 | |
| 1987 | lemma emeasure_density: | |
| 50002 
ce0d316b5b44
add measurability prover; add support for Borel sets
 hoelzl parents: 
50001diff
changeset | 1988 | assumes f[measurable]: "f \<in> borel_measurable M" and A[measurable]: "A \<in> sets M" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 1989 | shows "emeasure (density M f) A = (\<integral>\<^sup>+ x. f x * indicator A x \<partial>M)" | 
| 47694 | 1990 | (is "_ = ?\<mu> A") | 
| 1991 | unfolding density_def | |
| 1992 | proof (rule emeasure_measure_of_sigma) | |
| 1993 | show "sigma_algebra (space M) (sets M)" .. | |
| 1994 | show "positive (sets M) ?\<mu>" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 1995 | using f by (auto simp: positive_def) | 
| 47694 | 1996 | show "countably_additive (sets M) ?\<mu>" | 
| 1997 | proof (intro countably_additiveI) | |
| 1998 | fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M" | |
| 50002 
ce0d316b5b44
add measurability prover; add support for Borel sets
 hoelzl parents: 
50001diff
changeset | 1999 | then have "\<And>i. A i \<in> sets M" by auto | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2000 | then have *: "\<And>i. (\<lambda>x. f x * indicator (A i) x) \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2001 | by auto | 
| 47694 | 2002 | assume disj: "disjoint_family A" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2003 | then have "(\<Sum>n. ?\<mu> (A n)) = (\<integral>\<^sup>+ x. (\<Sum>n. f x * indicator (A n) x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2004 | using f * by (subst nn_integral_suminf) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2005 | also have "(\<integral>\<^sup>+ x. (\<Sum>n. f x * indicator (A n) x) \<partial>M) = (\<integral>\<^sup>+ x. f x * (\<Sum>n. indicator (A n) x) \<partial>M)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2006 | using f by (auto intro!: ennreal_suminf_cmult nn_integral_cong_AE) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2007 | also have "\<dots> = (\<integral>\<^sup>+ x. f x * indicator (\<Union>n. A n) x \<partial>M)" | 
| 47694 | 2008 | unfolding suminf_indicator[OF disj] .. | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2009 | finally show "(\<Sum>i. \<integral>\<^sup>+ x. f x * indicator (A i) x \<partial>M) = \<integral>\<^sup>+ x. f x * indicator (\<Union>i. A i) x \<partial>M" . | 
| 47694 | 2010 | qed | 
| 2011 | qed fact | |
| 38656 | 2012 | |
| 47694 | 2013 | lemma null_sets_density_iff: | 
| 2014 | assumes f: "f \<in> borel_measurable M" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2015 | shows "A \<in> null_sets (density M f) \<longleftrightarrow> A \<in> sets M \<and> (AE x in M. x \<in> A \<longrightarrow> f x = 0)" | 
| 47694 | 2016 | proof - | 
| 2017 |   { assume "A \<in> sets M"
 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2018 |     have "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> emeasure M {x \<in> space M. f x * indicator A x \<noteq> 0} = 0"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2019 | using f \<open>A \<in> sets M\<close> by (intro nn_integral_0_iff) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2020 | also have "\<dots> \<longleftrightarrow> (AE x in M. f x * indicator A x = 0)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2021 | using f \<open>A \<in> sets M\<close> by (intro AE_iff_measurable[OF _ refl, symmetric]) auto | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2022 | also have "(AE x in M. f x * indicator A x = 0) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" | 
| 62390 | 2023 | by (auto simp add: indicator_def max_def split: if_split_asm) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 2024 | finally have "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" . } | 
| 47694 | 2025 | with f show ?thesis | 
| 2026 | by (simp add: null_sets_def emeasure_density cong: conj_cong) | |
| 2027 | qed | |
| 2028 | ||
| 2029 | lemma AE_density: | |
| 2030 | assumes f: "f \<in> borel_measurable M" | |
| 2031 | shows "(AE x in density M f. P x) \<longleftrightarrow> (AE x in M. 0 < f x \<longrightarrow> P x)" | |
| 2032 | proof | |
| 2033 | assume "AE x in density M f. P x" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2034 |   with f obtain N where "{x \<in> space M. \<not> P x} \<subseteq> N" "N \<in> sets M" and ae: "AE x in M. x \<in> N \<longrightarrow> f x = 0"
 | 
| 47694 | 2035 | by (auto simp: eventually_ae_filter null_sets_density_iff) | 
| 2036 | then have "AE x in M. x \<notin> N \<longrightarrow> P x" by auto | |
| 2037 | with ae show "AE x in M. 0 < f x \<longrightarrow> P x" | |
| 2038 | by (rule eventually_elim2) auto | |
| 2039 | next | |
| 2040 | fix N assume ae: "AE x in M. 0 < f x \<longrightarrow> P x" | |
| 2041 |   then obtain N where "{x \<in> space M. \<not> (0 < f x \<longrightarrow> P x)} \<subseteq> N" "N \<in> null_sets M"
 | |
| 2042 | by (auto simp: eventually_ae_filter) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2043 |   then have *: "{x \<in> space (density M f). \<not> P x} \<subseteq> N \<union> {x\<in>space M. f x = 0}"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2044 |     "N \<union> {x\<in>space M. f x = 0} \<in> sets M" and ae2: "AE x in M. x \<notin> N"
 | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2045 | using f by (auto simp: subset_eq zero_less_iff_neq_zero intro!: AE_not_in) | 
| 47694 | 2046 | show "AE x in density M f. P x" | 
| 2047 | using ae2 | |
| 2048 | unfolding eventually_ae_filter[of _ "density M f"] Bex_def null_sets_density_iff[OF f] | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2049 |     by (intro exI[of _ "N \<union> {x\<in>space M. f x = 0}"] conjI *) (auto elim: eventually_elim2)
 | 
| 35582 | 2050 | qed | 
| 2051 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2052 | lemma nn_integral_density: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2053 | assumes f: "f \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2054 | assumes g: "g \<in> borel_measurable M" | 
| 56996 | 2055 | shows "integral\<^sup>N (density M f) g = (\<integral>\<^sup>+ x. f x * g x \<partial>M)" | 
| 49798 | 2056 | using g proof induct | 
| 2057 | case (cong u v) | |
| 49799 
15ea98537c76
strong nonnegativ (instead of ae nn) for induction rule
 hoelzl parents: 
49798diff
changeset | 2058 | then show ?case | 
| 56996 | 2059 | apply (subst nn_integral_cong[OF cong(3)]) | 
| 2060 | apply (simp_all cong: nn_integral_cong) | |
| 49798 | 2061 | done | 
| 2062 | next | |
| 2063 | case (set A) then show ?case | |
| 2064 | by (simp add: emeasure_density f) | |
| 2065 | next | |
| 2066 | case (mult u c) | |
| 2067 | moreover have "\<And>x. f x * (c * u x) = c * (f x * u x)" by (simp add: field_simps) | |
| 2068 | ultimately show ?case | |
| 56996 | 2069 | using f by (simp add: nn_integral_cmult) | 
| 49798 | 2070 | next | 
| 2071 | case (add u v) | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 2072 | then have "\<And>x. f x * (v x + u x) = f x * v x + f x * u x" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2073 | by (simp add: distrib_left) | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 2074 | with add f show ?case | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2075 | by (auto simp add: nn_integral_add intro!: nn_integral_add[symmetric]) | 
| 49798 | 2076 | next | 
| 2077 | case (seq U) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2078 | have eq: "AE x in M. f x * (SUP i. U i x) = (SUP i. f x * U i x)" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2079 | by eventually_elim (simp add: SUP_mult_left_ennreal seq) | 
| 49798 | 2080 | from seq f show ?case | 
| 56996 | 2081 | apply (simp add: nn_integral_monotone_convergence_SUP) | 
| 2082 | apply (subst nn_integral_cong_AE[OF eq]) | |
| 2083 | apply (subst nn_integral_monotone_convergence_SUP_AE) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2084 | apply (auto simp: incseq_def le_fun_def intro!: mult_left_mono) | 
| 49798 | 2085 | done | 
| 47694 | 2086 | qed | 
| 38705 | 2087 | |
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2088 | lemma density_distr: | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2089 | assumes [measurable]: "f \<in> borel_measurable N" "X \<in> measurable M N" | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2090 | shows "density (distr M N X) f = distr (density M (\<lambda>x. f (X x))) N X" | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2091 | by (intro measure_eqI) | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2092 | (auto simp add: emeasure_density nn_integral_distr emeasure_distr | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2093 | split: split_indicator intro!: nn_integral_cong) | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57137diff
changeset | 2094 | |
| 47694 | 2095 | lemma emeasure_restricted: | 
| 2096 | assumes S: "S \<in> sets M" and X: "X \<in> sets M" | |
| 2097 | shows "emeasure (density M (indicator S)) X = emeasure M (S \<inter> X)" | |
| 38705 | 2098 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 2099 | have "emeasure (density M (indicator S)) X = (\<integral>\<^sup>+x. indicator S x * indicator X x \<partial>M)" | 
| 47694 | 2100 | using S X by (simp add: emeasure_density) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 2101 | also have "\<dots> = (\<integral>\<^sup>+x. indicator (S \<inter> X) x \<partial>M)" | 
| 56996 | 2102 | by (auto intro!: nn_integral_cong simp: indicator_def) | 
| 47694 | 2103 | also have "\<dots> = emeasure M (S \<inter> X)" | 
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50104diff
changeset | 2104 | using S X by (simp add: sets.Int) | 
| 47694 | 2105 | finally show ?thesis . | 
| 2106 | qed | |
| 2107 | ||
| 2108 | lemma measure_restricted: | |
| 2109 | "S \<in> sets M \<Longrightarrow> X \<in> sets M \<Longrightarrow> measure (density M (indicator S)) X = measure M (S \<inter> X)" | |
| 2110 | by (simp add: emeasure_restricted measure_def) | |
| 2111 | ||
| 2112 | lemma (in finite_measure) finite_measure_restricted: | |
| 2113 | "S \<in> sets M \<Longrightarrow> finite_measure (density M (indicator S))" | |
| 61169 | 2114 | by standard (simp add: emeasure_restricted) | 
| 47694 | 2115 | |
| 2116 | lemma emeasure_density_const: | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2117 | "A \<in> sets M \<Longrightarrow> emeasure (density M (\<lambda>_. c)) A = c * emeasure M A" | 
| 56996 | 2118 | by (auto simp: nn_integral_cmult_indicator emeasure_density) | 
| 47694 | 2119 | |
| 2120 | lemma measure_density_const: | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2121 | "A \<in> sets M \<Longrightarrow> c \<noteq> \<infinity> \<Longrightarrow> measure (density M (\<lambda>_. c)) A = enn2real c * measure M A" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2122 | by (auto simp: emeasure_density_const measure_def enn2real_mult) | 
| 47694 | 2123 | |
| 2124 | lemma density_density_eq: | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2125 | "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> | 
| 47694 | 2126 | density (density M f) g = density M (\<lambda>x. f x * g x)" | 
| 56996 | 2127 | by (auto intro!: measure_eqI simp: emeasure_density nn_integral_density ac_simps) | 
| 47694 | 2128 | |
| 2129 | lemma distr_density_distr: | |
| 2130 | assumes T: "T \<in> measurable M M'" and T': "T' \<in> measurable M' M" | |
| 2131 | and inv: "\<forall>x\<in>space M. T' (T x) = x" | |
| 2132 | assumes f: "f \<in> borel_measurable M'" | |
| 2133 | shows "distr (density (distr M M' T) f) M T' = density M (f \<circ> T)" (is "?R = ?L") | |
| 2134 | proof (rule measure_eqI) | |
| 2135 | fix A assume A: "A \<in> sets ?R" | |
| 2136 |   { fix x assume "x \<in> space M"
 | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50104diff
changeset | 2137 | with sets.sets_into_space[OF A] | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2138 | have "indicator (T' -` A \<inter> space M') (T x) = (indicator A x :: ennreal)" | 
| 47694 | 2139 | using T inv by (auto simp: indicator_def measurable_space) } | 
| 2140 | with A T T' f show "emeasure ?R A = emeasure ?L A" | |
| 2141 | by (simp add: measurable_comp emeasure_density emeasure_distr | |
| 56996 | 2142 | nn_integral_distr measurable_sets cong: nn_integral_cong) | 
| 47694 | 2143 | qed simp | 
| 2144 | ||
| 2145 | lemma density_density_divide: | |
| 2146 | fixes f g :: "'a \<Rightarrow> real" | |
| 2147 | assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" | |
| 2148 | assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" | |
| 2149 | assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0" | |
| 2150 | shows "density (density M f) (\<lambda>x. g x / f x) = density M g" | |
| 2151 | proof - | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2152 | have "density M g = density M (\<lambda>x. ennreal (f x) * ennreal (g x / f x))" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2153 | using f g ac by (auto intro!: density_cong measurable_If simp: ennreal_mult[symmetric]) | 
| 47694 | 2154 | then show ?thesis | 
| 2155 | using f g by (subst density_density_eq) auto | |
| 38705 | 2156 | qed | 
| 2157 | ||
| 59425 | 2158 | lemma density_1: "density M (\<lambda>_. 1) = M" | 
| 2159 | by (intro measure_eqI) (auto simp: emeasure_density) | |
| 2160 | ||
| 2161 | lemma emeasure_density_add: | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 2162 | assumes X: "X \<in> sets M" | 
| 59425 | 2163 | assumes Mf[measurable]: "f \<in> borel_measurable M" | 
| 2164 | assumes Mg[measurable]: "g \<in> borel_measurable M" | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 2165 | shows "emeasure (density M f) X + emeasure (density M g) X = | 
| 59425 | 2166 | emeasure (density M (\<lambda>x. f x + g x)) X" | 
| 2167 | using assms | |
| 2168 | apply (subst (1 2 3) emeasure_density, simp_all) [] | |
| 2169 | apply (subst nn_integral_add[symmetric], simp_all) [] | |
| 2170 | apply (intro nn_integral_cong, simp split: split_indicator) | |
| 2171 | done | |
| 2172 | ||
| 61808 | 2173 | subsubsection \<open>Point measure\<close> | 
| 47694 | 2174 | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2175 | definition point_measure :: "'a set \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
 | 
| 47694 | 2176 | "point_measure A f = density (count_space A) f" | 
| 2177 | ||
| 2178 | lemma | |
| 2179 | shows space_point_measure: "space (point_measure A f) = A" | |
| 2180 | and sets_point_measure: "sets (point_measure A f) = Pow A" | |
| 2181 | by (auto simp: point_measure_def) | |
| 2182 | ||
| 59048 | 2183 | lemma sets_point_measure_count_space[measurable_cong]: "sets (point_measure A f) = sets (count_space A)" | 
| 2184 | by (simp add: sets_point_measure) | |
| 2185 | ||
| 47694 | 2186 | lemma measurable_point_measure_eq1[simp]: | 
| 2187 | "g \<in> measurable (point_measure A f) M \<longleftrightarrow> g \<in> A \<rightarrow> space M" | |
| 2188 | unfolding point_measure_def by simp | |
| 2189 | ||
| 2190 | lemma measurable_point_measure_eq2_finite[simp]: | |
| 2191 | "finite A \<Longrightarrow> | |
| 2192 | g \<in> measurable M (point_measure A f) \<longleftrightarrow> | |
| 2193 |     (g \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. g -` {a} \<inter> space M \<in> sets M))"
 | |
| 50002 
ce0d316b5b44
add measurability prover; add support for Borel sets
 hoelzl parents: 
50001diff
changeset | 2194 | unfolding point_measure_def by (simp add: measurable_count_space_eq2) | 
| 47694 | 2195 | |
| 2196 | lemma simple_function_point_measure[simp]: | |
| 2197 | "simple_function (point_measure A f) g \<longleftrightarrow> finite (g ` A)" | |
| 2198 | by (simp add: point_measure_def) | |
| 2199 | ||
| 2200 | lemma emeasure_point_measure: | |
| 2201 |   assumes A: "finite {a\<in>X. 0 < f a}" "X \<subseteq> A"
 | |
| 2202 | shows "emeasure (point_measure A f) X = (\<Sum>a|a\<in>X \<and> 0 < f a. f a)" | |
| 35977 | 2203 | proof - | 
| 47694 | 2204 |   have "{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a\<in>X. 0 < f a}"
 | 
| 61808 | 2205 | using \<open>X \<subseteq> A\<close> by auto | 
| 47694 | 2206 | with A show ?thesis | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2207 | by (simp add: emeasure_density nn_integral_count_space point_measure_def indicator_def) | 
| 35977 | 2208 | qed | 
| 2209 | ||
| 47694 | 2210 | lemma emeasure_point_measure_finite: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2211 | "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a\<in>X. f a)" | 
| 57418 | 2212 | by (subst emeasure_point_measure) (auto dest: finite_subset intro!: setsum.mono_neutral_left simp: less_le) | 
| 47694 | 2213 | |
| 49795 | 2214 | lemma emeasure_point_measure_finite2: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2215 | "X \<subseteq> A \<Longrightarrow> finite X \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a\<in>X. f a)" | 
| 49795 | 2216 | by (subst emeasure_point_measure) | 
| 57418 | 2217 | (auto dest: finite_subset intro!: setsum.mono_neutral_left simp: less_le) | 
| 49795 | 2218 | |
| 47694 | 2219 | lemma null_sets_point_measure_iff: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2220 | "X \<in> null_sets (point_measure A f) \<longleftrightarrow> X \<subseteq> A \<and> (\<forall>x\<in>X. f x = 0)" | 
| 47694 | 2221 | by (auto simp: AE_count_space null_sets_density_iff point_measure_def) | 
| 2222 | ||
| 2223 | lemma AE_point_measure: | |
| 2224 | "(AE x in point_measure A f. P x) \<longleftrightarrow> (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)" | |
| 2225 | unfolding point_measure_def | |
| 2226 | by (subst AE_density) (auto simp: AE_density AE_count_space point_measure_def) | |
| 2227 | ||
| 56996 | 2228 | lemma nn_integral_point_measure: | 
| 47694 | 2229 |   "finite {a\<in>A. 0 < f a \<and> 0 < g a} \<Longrightarrow>
 | 
| 56996 | 2230 | integral\<^sup>N (point_measure A f) g = (\<Sum>a|a\<in>A \<and> 0 < f a \<and> 0 < g a. f a * g a)" | 
| 47694 | 2231 | unfolding point_measure_def | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2232 | by (subst nn_integral_density) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2233 | (simp_all add: nn_integral_density nn_integral_count_space ennreal_zero_less_mult_iff) | 
| 47694 | 2234 | |
| 56996 | 2235 | lemma nn_integral_point_measure_finite: | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2236 | "finite A \<Longrightarrow> integral\<^sup>N (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)" | 
| 57418 | 2237 | by (subst nn_integral_point_measure) (auto intro!: setsum.mono_neutral_left simp: less_le) | 
| 47694 | 2238 | |
| 61808 | 2239 | subsubsection \<open>Uniform measure\<close> | 
| 47694 | 2240 | |
| 2241 | definition "uniform_measure M A = density M (\<lambda>x. indicator A x / emeasure M A)" | |
| 2242 | ||
| 2243 | lemma | |
| 59048 | 2244 | shows sets_uniform_measure[simp, measurable_cong]: "sets (uniform_measure M A) = sets M" | 
| 47694 | 2245 | and space_uniform_measure[simp]: "space (uniform_measure M A) = space M" | 
| 2246 | by (auto simp: uniform_measure_def) | |
| 2247 | ||
| 2248 | lemma emeasure_uniform_measure[simp]: | |
| 2249 | assumes A: "A \<in> sets M" and B: "B \<in> sets M" | |
| 2250 | shows "emeasure (uniform_measure M A) B = emeasure M (A \<inter> B) / emeasure M A" | |
| 2251 | proof - | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51340diff
changeset | 2252 | from A B have "emeasure (uniform_measure M A) B = (\<integral>\<^sup>+x. (1 / emeasure M A) * indicator (A \<inter> B) x \<partial>M)" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2253 | by (auto simp add: uniform_measure_def emeasure_density divide_ennreal_def split: split_indicator | 
| 56996 | 2254 | intro!: nn_integral_cong) | 
| 47694 | 2255 | also have "\<dots> = emeasure M (A \<inter> B) / emeasure M A" | 
| 2256 | using A B | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2257 | by (subst nn_integral_cmult_indicator) (simp_all add: sets.Int divide_ennreal_def mult.commute) | 
| 47694 | 2258 | finally show ?thesis . | 
| 2259 | qed | |
| 2260 | ||
| 2261 | lemma measure_uniform_measure[simp]: | |
| 2262 | assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>" and B: "B \<in> sets M" | |
| 2263 | shows "measure (uniform_measure M A) B = measure M (A \<inter> B) / measure M A" | |
| 2264 | using emeasure_uniform_measure[OF emeasure_neq_0_sets[OF A(1)] B] A | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2265 | by (cases "emeasure M A" "emeasure M (A \<inter> B)" rule: ennreal2_cases) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2266 | (simp_all add: measure_def divide_ennreal top_ennreal.rep_eq top_ereal_def ennreal_top_divide) | 
| 47694 | 2267 | |
| 58606 | 2268 | lemma AE_uniform_measureI: | 
| 2269 | "A \<in> sets M \<Longrightarrow> (AE x in M. x \<in> A \<longrightarrow> P x) \<Longrightarrow> (AE x in uniform_measure M A. P x)" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2270 | unfolding uniform_measure_def by (auto simp: AE_density divide_ennreal_def) | 
| 58606 | 2271 | |
| 59000 | 2272 | lemma emeasure_uniform_measure_1: | 
| 2273 | "emeasure M S \<noteq> 0 \<Longrightarrow> emeasure M S \<noteq> \<infinity> \<Longrightarrow> emeasure (uniform_measure M S) S = 1" | |
| 2274 | by (subst emeasure_uniform_measure) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2275 | (simp_all add: emeasure_neq_0_sets emeasure_eq_ennreal_measure divide_ennreal | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2276 | zero_less_iff_neq_zero[symmetric]) | 
| 59000 | 2277 | |
| 2278 | lemma nn_integral_uniform_measure: | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2279 | assumes f[measurable]: "f \<in> borel_measurable M" and S[measurable]: "S \<in> sets M" | 
| 59000 | 2280 | shows "(\<integral>\<^sup>+x. f x \<partial>uniform_measure M S) = (\<integral>\<^sup>+x. f x * indicator S x \<partial>M) / emeasure M S" | 
| 2281 | proof - | |
| 2282 |   { assume "emeasure M S = \<infinity>"
 | |
| 2283 | then have ?thesis | |
| 2284 | by (simp add: uniform_measure_def nn_integral_density f) } | |
| 2285 | moreover | |
| 2286 |   { assume [simp]: "emeasure M S = 0"
 | |
| 2287 | then have ae: "AE x in M. x \<notin> S" | |
| 2288 | using sets.sets_into_space[OF S] | |
| 2289 | by (subst AE_iff_measurable[OF _ refl]) (simp_all add: subset_eq cong: rev_conj_cong) | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2290 | from ae have "(\<integral>\<^sup>+ x. indicator S x / 0 * f x \<partial>M) = 0" | 
| 59000 | 2291 | by (subst nn_integral_0_iff_AE) auto | 
| 2292 | moreover from ae have "(\<integral>\<^sup>+ x. f x * indicator S x \<partial>M) = 0" | |
| 2293 | by (subst nn_integral_0_iff_AE) auto | |
| 2294 | ultimately have ?thesis | |
| 2295 | by (simp add: uniform_measure_def nn_integral_density f) } | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2296 | moreover have "emeasure M S \<noteq> 0 \<Longrightarrow> emeasure M S \<noteq> \<infinity> \<Longrightarrow> ?thesis" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2297 | unfolding uniform_measure_def | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2298 | by (subst nn_integral_density) | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2299 | (auto simp: ennreal_times_divide f nn_integral_divide[symmetric] mult.commute) | 
| 59000 | 2300 | ultimately show ?thesis by blast | 
| 2301 | qed | |
| 2302 | ||
| 2303 | lemma AE_uniform_measure: | |
| 2304 | assumes "emeasure M A \<noteq> 0" "emeasure M A < \<infinity>" | |
| 2305 | shows "(AE x in uniform_measure M A. P x) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> P x)" | |
| 2306 | proof - | |
| 2307 | have "A \<in> sets M" | |
| 61808 | 2308 | using \<open>emeasure M A \<noteq> 0\<close> by (metis emeasure_notin_sets) | 
| 59000 | 2309 | moreover have "\<And>x. 0 < indicator A x / emeasure M A \<longleftrightarrow> x \<in> A" | 
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2310 | using assms | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2311 | by (cases "emeasure M A") (auto split: split_indicator simp: ennreal_zero_less_divide) | 
| 59000 | 2312 | ultimately show ?thesis | 
| 2313 | unfolding uniform_measure_def by (simp add: AE_density) | |
| 2314 | qed | |
| 2315 | ||
| 61808 | 2316 | subsubsection \<open>Null measure\<close> | 
| 59425 | 2317 | |
| 2318 | lemma null_measure_eq_density: "null_measure M = density M (\<lambda>_. 0)" | |
| 2319 | by (intro measure_eqI) (simp_all add: emeasure_density) | |
| 2320 | ||
| 2321 | lemma nn_integral_null_measure[simp]: "(\<integral>\<^sup>+x. f x \<partial>null_measure M) = 0" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2322 | by (auto simp add: nn_integral_def simple_integral_def SUP_constant bot_ennreal_def le_fun_def | 
| 59425 | 2323 | intro!: exI[of _ "\<lambda>x. 0"]) | 
| 2324 | ||
| 2325 | lemma density_null_measure[simp]: "density (null_measure M) f = null_measure M" | |
| 2326 | proof (intro measure_eqI) | |
| 2327 | fix A show "emeasure (density (null_measure M) f) A = emeasure (null_measure M) A" | |
| 2328 | by (simp add: density_def) (simp only: null_measure_def[symmetric] emeasure_null_measure) | |
| 2329 | qed simp | |
| 2330 | ||
| 61808 | 2331 | subsubsection \<open>Uniform count measure\<close> | 
| 47694 | 2332 | |
| 2333 | definition "uniform_count_measure A = point_measure A (\<lambda>x. 1 / card A)" | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 2334 | |
| 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 2335 | lemma | 
| 47694 | 2336 | shows space_uniform_count_measure: "space (uniform_count_measure A) = A" | 
| 2337 | and sets_uniform_count_measure: "sets (uniform_count_measure A) = Pow A" | |
| 2338 | unfolding uniform_count_measure_def by (auto simp: space_point_measure sets_point_measure) | |
| 59048 | 2339 | |
| 2340 | lemma sets_uniform_count_measure_count_space[measurable_cong]: | |
| 2341 | "sets (uniform_count_measure A) = sets (count_space A)" | |
| 2342 | by (simp add: sets_uniform_count_measure) | |
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 2343 | |
| 47694 | 2344 | lemma emeasure_uniform_count_measure: | 
| 2345 | "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (uniform_count_measure A) X = card X / card A" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2346 | by (simp add: emeasure_point_measure_finite uniform_count_measure_def divide_inverse ennreal_mult | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2347 | ennreal_of_nat_eq_real_of_nat) | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61359diff
changeset | 2348 | |
| 47694 | 2349 | lemma measure_uniform_count_measure: | 
| 2350 | "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> measure (uniform_count_measure A) X = card X / card A" | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2351 | by (simp add: emeasure_point_measure_finite uniform_count_measure_def measure_def enn2real_mult) | 
| 47694 | 2352 | |
| 61633 | 2353 | lemma space_uniform_count_measure_empty_iff [simp]: | 
| 2354 |   "space (uniform_count_measure X) = {} \<longleftrightarrow> X = {}"
 | |
| 2355 | by(simp add: space_uniform_count_measure) | |
| 2356 | ||
| 2357 | lemma sets_uniform_count_measure_eq_UNIV [simp]: | |
| 2358 | "sets (uniform_count_measure UNIV) = UNIV \<longleftrightarrow> True" | |
| 2359 | "UNIV = sets (uniform_count_measure UNIV) \<longleftrightarrow> True" | |
| 2360 | by(simp_all add: sets_uniform_count_measure) | |
| 2361 | ||
| 61634 | 2362 | subsubsection \<open>Scaled measure\<close> | 
| 2363 | ||
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2364 | lemma nn_integral_scale_measure: | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2365 | assumes f: "f \<in> borel_measurable M" | 
| 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2366 | shows "nn_integral (scale_measure r M) f = r * nn_integral M f" | 
| 61634 | 2367 | using f | 
| 2368 | proof induction | |
| 2369 | case (cong f g) | |
| 2370 | thus ?case | |
| 2371 | by(simp add: cong.hyps space_scale_measure cong: nn_integral_cong_simp) | |
| 2372 | next | |
| 2373 | case (mult f c) | |
| 2374 | thus ?case | |
| 2375 | by(simp add: nn_integral_cmult max_def mult.assoc mult.left_commute) | |
| 2376 | next | |
| 2377 | case (add f g) | |
| 2378 | thus ?case | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2379 | by(simp add: nn_integral_add distrib_left) | 
| 61634 | 2380 | next | 
| 2381 | case (seq U) | |
| 2382 | thus ?case | |
| 62975 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 hoelzl parents: 
62390diff
changeset | 2383 | by(simp add: nn_integral_monotone_convergence_SUP SUP_mult_left_ennreal) | 
| 61634 | 2384 | qed simp | 
| 2385 | ||
| 35748 | 2386 | end |