src/HOL/Probability/Lebesgue.thy
 author hoelzl Mon May 03 14:35:10 2010 +0200 (2010-05-03) changeset 36624 25153c08655e parent 35977 30d42bfd0174 child 36725 34c36a5cb808 permissions -rw-r--r--
Cleanup information theory
 hoelzl@35582 ` 1` ```header {*Lebesgue Integration*} ``` hoelzl@35582 ` 2` hoelzl@35582 ` 3` ```theory Lebesgue ``` hoelzl@35582 ` 4` ```imports Measure Borel ``` hoelzl@35582 ` 5` ```begin ``` hoelzl@35582 ` 6` hoelzl@35582 ` 7` ```text{*From the HOL4 Hurd/Coble Lebesgue integration, translated by Armin Heller and Johannes Hoelzl.*} ``` hoelzl@35582 ` 8` hoelzl@35582 ` 9` ```definition ``` hoelzl@35582 ` 10` ``` "pos_part f = (\x. max 0 (f x))" ``` hoelzl@35582 ` 11` hoelzl@35582 ` 12` ```definition ``` hoelzl@35582 ` 13` ``` "neg_part f = (\x. - min 0 (f x))" ``` hoelzl@35582 ` 14` hoelzl@35582 ` 15` ```definition ``` hoelzl@35582 ` 16` ``` "nonneg f = (\x. 0 \ f x)" ``` hoelzl@35582 ` 17` hoelzl@35582 ` 18` ```lemma nonneg_pos_part[intro!]: ``` hoelzl@35582 ` 19` ``` fixes f :: "'c \ 'd\{linorder,zero}" ``` hoelzl@35582 ` 20` ``` shows "nonneg (pos_part f)" ``` hoelzl@35582 ` 21` ``` unfolding nonneg_def pos_part_def by auto ``` hoelzl@35582 ` 22` hoelzl@35582 ` 23` ```lemma nonneg_neg_part[intro!]: ``` hoelzl@35582 ` 24` ``` fixes f :: "'c \ 'd\{linorder,ordered_ab_group_add}" ``` hoelzl@35582 ` 25` ``` shows "nonneg (neg_part f)" ``` hoelzl@35582 ` 26` ``` unfolding nonneg_def neg_part_def min_def by auto ``` hoelzl@35582 ` 27` hoelzl@36624 ` 28` ```lemma pos_neg_part_abs: ``` hoelzl@36624 ` 29` ``` fixes f :: "'a \ real" ``` hoelzl@36624 ` 30` ``` shows "pos_part f x + neg_part f x = \f x\" ``` hoelzl@36624 ` 31` ```unfolding real_abs_def pos_part_def neg_part_def by auto ``` hoelzl@36624 ` 32` hoelzl@36624 ` 33` ```lemma pos_part_abs: ``` hoelzl@36624 ` 34` ``` fixes f :: "'a \ real" ``` hoelzl@36624 ` 35` ``` shows "pos_part (\ x. \f x\) y = \f y\" ``` hoelzl@36624 ` 36` ```unfolding pos_part_def real_abs_def by auto ``` hoelzl@36624 ` 37` hoelzl@36624 ` 38` ```lemma neg_part_abs: ``` hoelzl@36624 ` 39` ``` fixes f :: "'a \ real" ``` hoelzl@36624 ` 40` ``` shows "neg_part (\ x. \f x\) y = 0" ``` hoelzl@36624 ` 41` ```unfolding neg_part_def real_abs_def by auto ``` hoelzl@36624 ` 42` hoelzl@35692 ` 43` ```lemma (in measure_space) ``` hoelzl@35692 ` 44` ``` assumes "f \ borel_measurable M" ``` hoelzl@35692 ` 45` ``` shows pos_part_borel_measurable: "pos_part f \ borel_measurable M" ``` hoelzl@35692 ` 46` ``` and neg_part_borel_measurable: "neg_part f \ borel_measurable M" ``` hoelzl@35692 ` 47` ```using assms ``` hoelzl@35692 ` 48` ```proof - ``` hoelzl@35692 ` 49` ``` { fix a :: real ``` hoelzl@35692 ` 50` ``` { assume asm: "0 \ a" ``` hoelzl@35692 ` 51` ``` from asm have pp: "\ w. (pos_part f w \ a) = (f w \ a)" unfolding pos_part_def by auto ``` hoelzl@35692 ` 52` ``` have "{w | w. w \ space M \ f w \ a} \ sets M" ``` hoelzl@35692 ` 53` ``` unfolding pos_part_def using assms borel_measurable_le_iff by auto ``` hoelzl@35692 ` 54` ``` hence "{w . w \ space M \ pos_part f w \ a} \ sets M" using pp by auto } ``` hoelzl@35692 ` 55` ``` moreover have "a < 0 \ {w \ space M. pos_part f w \ a} \ sets M" ``` hoelzl@35692 ` 56` ``` unfolding pos_part_def using empty_sets by auto ``` hoelzl@35692 ` 57` ``` ultimately have "{w . w \ space M \ pos_part f w \ a} \ sets M" ``` hoelzl@35692 ` 58` ``` using le_less_linear by auto ``` hoelzl@35692 ` 59` ``` } hence pos: "pos_part f \ borel_measurable M" using borel_measurable_le_iff by auto ``` hoelzl@35692 ` 60` ``` { fix a :: real ``` hoelzl@35692 ` 61` ``` { assume asm: "0 \ a" ``` hoelzl@35692 ` 62` ``` from asm have pp: "\ w. (neg_part f w \ a) = (f w \ - a)" unfolding neg_part_def by auto ``` hoelzl@35692 ` 63` ``` have "{w | w. w \ space M \ f w \ - a} \ sets M" ``` hoelzl@35692 ` 64` ``` unfolding neg_part_def using assms borel_measurable_ge_iff by auto ``` hoelzl@35692 ` 65` ``` hence "{w . w \ space M \ neg_part f w \ a} \ sets M" using pp by auto } ``` hoelzl@35692 ` 66` ``` moreover have "a < 0 \ {w \ space M. neg_part f w \ a} = {}" unfolding neg_part_def by auto ``` hoelzl@35692 ` 67` ``` moreover hence "a < 0 \ {w \ space M. neg_part f w \ a} \ sets M" by (simp only: empty_sets) ``` hoelzl@35692 ` 68` ``` ultimately have "{w . w \ space M \ neg_part f w \ a} \ sets M" ``` hoelzl@35692 ` 69` ``` using le_less_linear by auto ``` hoelzl@35692 ` 70` ``` } hence neg: "neg_part f \ borel_measurable M" using borel_measurable_le_iff by auto ``` hoelzl@35692 ` 71` ``` from pos neg show "pos_part f \ borel_measurable M" and "neg_part f \ borel_measurable M" by auto ``` hoelzl@35692 ` 72` ```qed ``` hoelzl@35692 ` 73` hoelzl@35692 ` 74` ```lemma (in measure_space) pos_part_neg_part_borel_measurable_iff: ``` hoelzl@35692 ` 75` ``` "f \ borel_measurable M \ ``` hoelzl@35692 ` 76` ``` pos_part f \ borel_measurable M \ neg_part f \ borel_measurable M" ``` hoelzl@35692 ` 77` ```proof - ``` hoelzl@35692 ` 78` ``` { fix x ``` hoelzl@35692 ` 79` ``` have "f x = pos_part f x - neg_part f x" ``` hoelzl@35692 ` 80` ``` unfolding pos_part_def neg_part_def unfolding max_def min_def ``` hoelzl@35692 ` 81` ``` by auto } ``` hoelzl@35692 ` 82` ``` hence "(\ x. f x) = (\ x. pos_part f x - neg_part f x)" by auto ``` hoelzl@35692 ` 83` ``` hence "f = (\ x. pos_part f x - neg_part f x)" by blast ``` hoelzl@35692 ` 84` ``` from pos_part_borel_measurable[of f] neg_part_borel_measurable[of f] ``` hoelzl@35692 ` 85` ``` borel_measurable_diff_borel_measurable[of "pos_part f" "neg_part f"] ``` hoelzl@35692 ` 86` ``` this ``` hoelzl@35692 ` 87` ``` show ?thesis by auto ``` hoelzl@35692 ` 88` ```qed ``` hoelzl@35692 ` 89` hoelzl@35582 ` 90` ```context measure_space ``` hoelzl@35582 ` 91` ```begin ``` hoelzl@35582 ` 92` hoelzl@35692 ` 93` ```section "Simple discrete step function" ``` hoelzl@35692 ` 94` hoelzl@35582 ` 95` ```definition ``` hoelzl@35582 ` 96` ``` "pos_simple f = ``` hoelzl@35582 ` 97` ``` { (s :: nat set, a, x). ``` hoelzl@35582 ` 98` ``` finite s \ nonneg f \ nonneg x \ a ` s \ sets M \ ``` hoelzl@35582 ` 99` ``` (\t \ space M. (\!i\s. t\a i) \ (\i\s. t \ a i \ f t = x i)) }" ``` hoelzl@35582 ` 100` hoelzl@35582 ` 101` ```definition ``` hoelzl@35582 ` 102` ``` "pos_simple_integral \ \(s, a, x). \ i \ s. x i * measure M (a i)" ``` hoelzl@35582 ` 103` hoelzl@35582 ` 104` ```definition ``` hoelzl@35582 ` 105` ``` "psfis f = pos_simple_integral ` (pos_simple f)" ``` hoelzl@35582 ` 106` hoelzl@35582 ` 107` ```lemma pos_simpleE[consumes 1]: ``` hoelzl@35582 ` 108` ``` assumes ps: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 109` ``` obtains "finite s" and "nonneg f" and "nonneg x" ``` hoelzl@35582 ` 110` ``` and "a ` s \ sets M" and "(\i\s. a i) = space M" ``` hoelzl@35582 ` 111` ``` and "disjoint_family_on a s" ``` hoelzl@35582 ` 112` ``` and "\t. t \ space M \ (\!i. i \ s \ t \ a i)" ``` hoelzl@35582 ` 113` ``` and "\t i. \ t \ space M ; i \ s ; t \ a i \ \ f t = x i" ``` hoelzl@35582 ` 114` ```proof ``` hoelzl@35582 ` 115` ``` show "finite s" and "nonneg f" and "nonneg x" ``` hoelzl@35582 ` 116` ``` and as_in_M: "a ` s \ sets M" ``` hoelzl@35582 ` 117` ``` and *: "\t. t \ space M \ (\!i. i \ s \ t \ a i)" ``` hoelzl@35582 ` 118` ``` and **: "\t i. \ t \ space M ; i \ s ; t \ a i \ \ f t = x i" ``` hoelzl@35582 ` 119` ``` using ps unfolding pos_simple_def by auto ``` hoelzl@35582 ` 120` hoelzl@35582 ` 121` ``` thus t: "(\i\s. a i) = space M" ``` hoelzl@35582 ` 122` ``` proof safe ``` hoelzl@35582 ` 123` ``` fix x assume "x \ space M" ``` hoelzl@35582 ` 124` ``` from *[OF this] show "x \ (\i\s. a i)" by auto ``` hoelzl@35582 ` 125` ``` next ``` hoelzl@35582 ` 126` ``` fix t i assume "i \ s" ``` hoelzl@35582 ` 127` ``` hence "a i \ sets M" using as_in_M by auto ``` hoelzl@35582 ` 128` ``` moreover assume "t \ a i" ``` hoelzl@35582 ` 129` ``` ultimately show "t \ space M" using sets_into_space by blast ``` hoelzl@35582 ` 130` ``` qed ``` hoelzl@35582 ` 131` hoelzl@35582 ` 132` ``` show "disjoint_family_on a s" unfolding disjoint_family_on_def ``` hoelzl@35582 ` 133` ``` proof safe ``` hoelzl@35582 ` 134` ``` fix i j and t assume "i \ s" "t \ a i" and "j \ s" "t \ a j" and "i \ j" ``` hoelzl@35582 ` 135` ``` with t * show "t \ {}" by auto ``` hoelzl@35582 ` 136` ``` qed ``` hoelzl@35582 ` 137` ```qed ``` hoelzl@35582 ` 138` hoelzl@35582 ` 139` ```lemma pos_simple_cong: ``` hoelzl@35582 ` 140` ``` assumes "nonneg f" and "nonneg g" and "\t. t \ space M \ f t = g t" ``` hoelzl@35582 ` 141` ``` shows "pos_simple f = pos_simple g" ``` hoelzl@35582 ` 142` ``` unfolding pos_simple_def using assms by auto ``` hoelzl@35582 ` 143` hoelzl@35582 ` 144` ```lemma psfis_cong: ``` hoelzl@35582 ` 145` ``` assumes "nonneg f" and "nonneg g" and "\t. t \ space M \ f t = g t" ``` hoelzl@35582 ` 146` ``` shows "psfis f = psfis g" ``` hoelzl@35582 ` 147` ``` unfolding psfis_def using pos_simple_cong[OF assms] by simp ``` hoelzl@35582 ` 148` hoelzl@35692 ` 149` ```lemma psfis_0: "0 \ psfis (\x. 0)" ``` hoelzl@35692 ` 150` ``` unfolding psfis_def pos_simple_def pos_simple_integral_def ``` hoelzl@35692 ` 151` ``` by (auto simp: nonneg_def ``` hoelzl@35692 ` 152` ``` intro: image_eqI[where x="({0}, (\i. space M), (\i. 0))"]) ``` hoelzl@35692 ` 153` hoelzl@35582 ` 154` ```lemma pos_simple_setsum_indicator_fn: ``` hoelzl@35582 ` 155` ``` assumes ps: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 156` ``` and "t \ space M" ``` hoelzl@35582 ` 157` ``` shows "(\i\s. x i * indicator_fn (a i) t) = f t" ``` hoelzl@35582 ` 158` ```proof - ``` hoelzl@35582 ` 159` ``` from assms obtain i where *: "i \ s" "t \ a i" ``` hoelzl@35582 ` 160` ``` and "finite s" and xi: "x i = f t" by (auto elim!: pos_simpleE) ``` hoelzl@35582 ` 161` hoelzl@35582 ` 162` ``` have **: "(\i\s. x i * indicator_fn (a i) t) = ``` hoelzl@35582 ` 163` ``` (\j\s. if j \ {i} then x i else 0)" ``` hoelzl@35582 ` 164` ``` unfolding indicator_fn_def using assms * ``` hoelzl@35582 ` 165` ``` by (auto intro!: setsum_cong elim!: pos_simpleE) ``` hoelzl@35582 ` 166` ``` show ?thesis unfolding ** setsum_cases[OF `finite s`] xi ``` hoelzl@35582 ` 167` ``` using `i \ s` by simp ``` hoelzl@35582 ` 168` ```qed ``` hoelzl@35582 ` 169` hoelzl@35692 ` 170` ```lemma pos_simple_common_partition: ``` hoelzl@35582 ` 171` ``` assumes psf: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 172` ``` assumes psg: "(s', b, y) \ pos_simple g" ``` hoelzl@35582 ` 173` ``` obtains z z' c k where "(k, c, z) \ pos_simple f" "(k, c, z') \ pos_simple g" ``` hoelzl@35582 ` 174` ```proof - ``` hoelzl@35582 ` 175` ``` (* definitions *) ``` hoelzl@35582 ` 176` hoelzl@35582 ` 177` ``` def k == "{0 ..< card (s \ s')}" ``` hoelzl@35582 ` 178` ``` have fs: "finite s" "finite s'" "finite k" unfolding k_def ``` hoelzl@35582 ` 179` ``` using psf psg unfolding pos_simple_def by auto ``` hoelzl@35582 ` 180` ``` hence "finite (s \ s')" by simp ``` hoelzl@35582 ` 181` ``` then obtain p where p: "p ` k = s \ s'" "inj_on p k" ``` hoelzl@35582 ` 182` ``` using ex_bij_betw_nat_finite[of "s \ s'"] unfolding bij_betw_def k_def by blast ``` hoelzl@35582 ` 183` ``` def c == "\ i. a (fst (p i)) \ b (snd (p i))" ``` hoelzl@35582 ` 184` ``` def z == "\ i. x (fst (p i))" ``` hoelzl@35582 ` 185` ``` def z' == "\ i. y (snd (p i))" ``` hoelzl@35582 ` 186` hoelzl@35582 ` 187` ``` have "finite k" unfolding k_def by simp ``` hoelzl@35582 ` 188` hoelzl@35582 ` 189` ``` have "nonneg z" and "nonneg z'" ``` hoelzl@35582 ` 190` ``` using psf psg unfolding z_def z'_def pos_simple_def nonneg_def by auto ``` hoelzl@35582 ` 191` hoelzl@35582 ` 192` ``` have ck_subset_M: "c ` k \ sets M" ``` hoelzl@35582 ` 193` ``` proof ``` hoelzl@35582 ` 194` ``` fix x assume "x \ c ` k" ``` hoelzl@35582 ` 195` ``` then obtain j where "j \ k" and "x = c j" by auto ``` hoelzl@35582 ` 196` ``` hence "p j \ s \ s'" using p(1) by auto ``` hoelzl@35582 ` 197` ``` hence "a (fst (p j)) \ sets M" (is "?a \ _") ``` hoelzl@35582 ` 198` ``` and "b (snd (p j)) \ sets M" (is "?b \ _") ``` hoelzl@35582 ` 199` ``` using psf psg unfolding pos_simple_def by auto ``` hoelzl@35582 ` 200` ``` thus "x \ sets M" unfolding `x = c j` c_def using Int by simp ``` hoelzl@35582 ` 201` ``` qed ``` hoelzl@35582 ` 202` hoelzl@35582 ` 203` ``` { fix t assume "t \ space M" ``` hoelzl@35582 ` 204` ``` hence ex1s: "\!i\s. t \ a i" and ex1s': "\!i\s'. t \ b i" ``` hoelzl@35582 ` 205` ``` using psf psg unfolding pos_simple_def by auto ``` hoelzl@35582 ` 206` ``` then obtain j j' where j: "j \ s" "t \ a j" and j': "j' \ s'" "t \ b j'" ``` hoelzl@35582 ` 207` ``` by auto ``` hoelzl@35582 ` 208` ``` then obtain i :: nat where i: "(j,j') = p i" and "i \ k" using p by auto ``` hoelzl@35582 ` 209` ``` have "\!i\k. t \ c i" ``` hoelzl@35582 ` 210` ``` proof (rule ex1I[of _ i]) ``` hoelzl@35582 ` 211` ``` show "\x. x \ k \ t \ c x \ x = i" ``` hoelzl@35582 ` 212` ``` proof - ``` hoelzl@35582 ` 213` ``` fix l assume "l \ k" "t \ c l" ``` hoelzl@35582 ` 214` ``` hence "p l \ s \ s'" and t_in: "t \ a (fst (p l))" "t \ b (snd (p l))" ``` hoelzl@35582 ` 215` ``` using p unfolding c_def by auto ``` hoelzl@35582 ` 216` ``` hence "fst (p l) \ s" and "snd (p l) \ s'" by auto ``` hoelzl@35582 ` 217` ``` with t_in j j' ex1s ex1s' have "p l = (j, j')" by (cases "p l", auto) ``` hoelzl@35582 ` 218` ``` thus "l = i" ``` hoelzl@35582 ` 219` ``` using `(j, j') = p i` p(2)[THEN inj_onD] `l \ k` `i \ k` by auto ``` hoelzl@35582 ` 220` ``` qed ``` hoelzl@35582 ` 221` hoelzl@35582 ` 222` ``` show "i \ k \ t \ c i" ``` hoelzl@35582 ` 223` ``` using `i \ k` `t \ a j` `t \ b j'` c_def i[symmetric] by auto ``` hoelzl@35582 ` 224` ``` qed auto ``` hoelzl@35582 ` 225` ``` } note ex1 = this ``` hoelzl@35582 ` 226` hoelzl@35582 ` 227` ``` show thesis ``` hoelzl@35582 ` 228` ``` proof (rule that) ``` hoelzl@35582 ` 229` ``` { fix t i assume "t \ space M" and "i \ k" ``` hoelzl@35582 ` 230` ``` hence "p i \ s \ s'" using p(1) by auto ``` hoelzl@35582 ` 231` ``` hence "fst (p i) \ s" by auto ``` hoelzl@35582 ` 232` ``` moreover ``` hoelzl@35582 ` 233` ``` assume "t \ c i" ``` hoelzl@35582 ` 234` ``` hence "t \ a (fst (p i))" unfolding c_def by auto ``` hoelzl@35582 ` 235` ``` ultimately have "f t = z i" using psf `t \ space M` ``` hoelzl@35582 ` 236` ``` unfolding z_def pos_simple_def by auto ``` hoelzl@35582 ` 237` ``` } ``` hoelzl@35582 ` 238` ``` thus "(k, c, z) \ pos_simple f" ``` hoelzl@35582 ` 239` ``` using psf `finite k` `nonneg z` ck_subset_M ex1 ``` hoelzl@35582 ` 240` ``` unfolding pos_simple_def by auto ``` hoelzl@35582 ` 241` hoelzl@35582 ` 242` ``` { fix t i assume "t \ space M" and "i \ k" ``` hoelzl@35582 ` 243` ``` hence "p i \ s \ s'" using p(1) by auto ``` hoelzl@35582 ` 244` ``` hence "snd (p i) \ s'" by auto ``` hoelzl@35582 ` 245` ``` moreover ``` hoelzl@35582 ` 246` ``` assume "t \ c i" ``` hoelzl@35582 ` 247` ``` hence "t \ b (snd (p i))" unfolding c_def by auto ``` hoelzl@35582 ` 248` ``` ultimately have "g t = z' i" using psg `t \ space M` ``` hoelzl@35582 ` 249` ``` unfolding z'_def pos_simple_def by auto ``` hoelzl@35582 ` 250` ``` } ``` hoelzl@35582 ` 251` ``` thus "(k, c, z') \ pos_simple g" ``` hoelzl@35582 ` 252` ``` using psg `finite k` `nonneg z'` ck_subset_M ex1 ``` hoelzl@35582 ` 253` ``` unfolding pos_simple_def by auto ``` hoelzl@35582 ` 254` ``` qed ``` hoelzl@35582 ` 255` ```qed ``` hoelzl@35582 ` 256` hoelzl@35692 ` 257` ```lemma pos_simple_integral_equal: ``` hoelzl@35582 ` 258` ``` assumes psx: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 259` ``` assumes psy: "(s', b, y) \ pos_simple f" ``` hoelzl@35582 ` 260` ``` shows "pos_simple_integral (s, a, x) = pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 261` ``` unfolding pos_simple_integral_def ``` hoelzl@35582 ` 262` ```proof simp ``` hoelzl@35582 ` 263` ``` have "(\i\s. x i * measure M (a i)) = ``` hoelzl@35582 ` 264` ``` (\i\s. (\j \ s'. x i * measure M (a i \ b j)))" (is "?left = _") ``` hoelzl@35582 ` 265` ``` using psy psx unfolding setsum_right_distrib[symmetric] ``` hoelzl@35582 ` 266` ``` by (auto intro!: setsum_cong measure_setsum_split elim!: pos_simpleE) ``` hoelzl@35582 ` 267` ``` also have "... = (\i\s. (\j \ s'. y j * measure M (a i \ b j)))" ``` hoelzl@35582 ` 268` ``` proof (rule setsum_cong, simp, rule setsum_cong, simp_all) ``` hoelzl@35582 ` 269` ``` fix i j assume i: "i \ s" and j: "j \ s'" ``` hoelzl@35582 ` 270` ``` hence "a i \ sets M" using psx by (auto elim!: pos_simpleE) ``` hoelzl@35582 ` 271` hoelzl@35582 ` 272` ``` show "measure M (a i \ b j) = 0 \ x i = y j" ``` hoelzl@35582 ` 273` ``` proof (cases "a i \ b j = {}") ``` hoelzl@35582 ` 274` ``` case True thus ?thesis using empty_measure by simp ``` hoelzl@35582 ` 275` ``` next ``` hoelzl@35582 ` 276` ``` case False then obtain t where t: "t \ a i" "t \ b j" by auto ``` hoelzl@35582 ` 277` ``` hence "t \ space M" using `a i \ sets M` sets_into_space by auto ``` hoelzl@35582 ` 278` ``` with psx psy t i j have "x i = f t" and "y j = f t" ``` hoelzl@35582 ` 279` ``` unfolding pos_simple_def by auto ``` hoelzl@35582 ` 280` ``` thus ?thesis by simp ``` hoelzl@35582 ` 281` ``` qed ``` hoelzl@35582 ` 282` ``` qed ``` hoelzl@35582 ` 283` ``` also have "... = (\j\s'. (\i\s. y j * measure M (a i \ b j)))" ``` hoelzl@35582 ` 284` ``` by (subst setsum_commute) simp ``` hoelzl@35582 ` 285` ``` also have "... = (\i\s'. y i * measure M (b i))" (is "?sum_sum = ?right") ``` hoelzl@35582 ` 286` ``` proof (rule setsum_cong) ``` hoelzl@35582 ` 287` ``` fix j assume "j \ s'" ``` hoelzl@35582 ` 288` ``` have "y j * measure M (b j) = (\i\s. y j * measure M (b j \ a i))" ``` hoelzl@35582 ` 289` ``` using psx psy `j \ s'` unfolding setsum_right_distrib[symmetric] ``` hoelzl@35582 ` 290` ``` by (auto intro!: measure_setsum_split elim!: pos_simpleE) ``` hoelzl@35582 ` 291` ``` thus "(\i\s. y j * measure M (a i \ b j)) = y j * measure M (b j)" ``` hoelzl@35582 ` 292` ``` by (auto intro!: setsum_cong arg_cong[where f="measure M"]) ``` hoelzl@35582 ` 293` ``` qed simp ``` hoelzl@35582 ` 294` ``` finally show "?left = ?right" . ``` hoelzl@35582 ` 295` ```qed ``` hoelzl@35582 ` 296` hoelzl@35692 ` 297` ```lemma psfis_present: ``` hoelzl@35582 ` 298` ``` assumes "A \ psfis f" ``` hoelzl@35582 ` 299` ``` assumes "B \ psfis g" ``` hoelzl@35582 ` 300` ``` obtains z z' c k where ``` hoelzl@35582 ` 301` ``` "A = pos_simple_integral (k, c, z)" ``` hoelzl@35582 ` 302` ``` "B = pos_simple_integral (k, c, z')" ``` hoelzl@35582 ` 303` ``` "(k, c, z) \ pos_simple f" ``` hoelzl@35582 ` 304` ``` "(k, c, z') \ pos_simple g" ``` hoelzl@35582 ` 305` ```using assms ``` hoelzl@35582 ` 306` ```proof - ``` hoelzl@35582 ` 307` ``` from assms obtain s a x s' b y where ``` hoelzl@35582 ` 308` ``` ps: "(s, a, x) \ pos_simple f" "(s', b, y) \ pos_simple g" and ``` hoelzl@35582 ` 309` ``` A: "A = pos_simple_integral (s, a, x)" and ``` hoelzl@35582 ` 310` ``` B: "B = pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 311` ``` unfolding psfis_def pos_simple_integral_def by auto ``` hoelzl@35582 ` 312` hoelzl@35582 ` 313` ``` guess z z' c k using pos_simple_common_partition[OF ps] . note part = this ``` hoelzl@35582 ` 314` ``` show thesis ``` hoelzl@35582 ` 315` ``` proof (rule that[of k c z z', OF _ _ part]) ``` hoelzl@35582 ` 316` ``` show "A = pos_simple_integral (k, c, z)" ``` hoelzl@35582 ` 317` ``` unfolding A by (rule pos_simple_integral_equal[OF ps(1) part(1)]) ``` hoelzl@35582 ` 318` ``` show "B = pos_simple_integral (k, c, z')" ``` hoelzl@35582 ` 319` ``` unfolding B by (rule pos_simple_integral_equal[OF ps(2) part(2)]) ``` hoelzl@35582 ` 320` ``` qed ``` hoelzl@35582 ` 321` ```qed ``` hoelzl@35582 ` 322` hoelzl@35692 ` 323` ```lemma pos_simple_integral_add: ``` hoelzl@35582 ` 324` ``` assumes "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 325` ``` assumes "(s', b, y) \ pos_simple g" ``` hoelzl@35582 ` 326` ``` obtains s'' c z where ``` hoelzl@35582 ` 327` ``` "(s'', c, z) \ pos_simple (\x. f x + g x)" ``` hoelzl@35582 ` 328` ``` "(pos_simple_integral (s, a, x) + ``` hoelzl@35582 ` 329` ``` pos_simple_integral (s', b, y) = ``` hoelzl@35582 ` 330` ``` pos_simple_integral (s'', c, z))" ``` hoelzl@35582 ` 331` ```using assms ``` hoelzl@35582 ` 332` ```proof - ``` hoelzl@35582 ` 333` ``` guess z z' c k ``` hoelzl@35582 ` 334` ``` by (rule pos_simple_common_partition[OF `(s, a, x) \ pos_simple f ` `(s', b, y) \ pos_simple g`]) ``` hoelzl@35582 ` 335` ``` note kczz' = this ``` hoelzl@35582 ` 336` ``` have x: "pos_simple_integral (s, a, x) = pos_simple_integral (k, c, z)" ``` hoelzl@35582 ` 337` ``` by (rule pos_simple_integral_equal) (fact, fact) ``` hoelzl@35582 ` 338` ``` have y: "pos_simple_integral (s', b, y) = pos_simple_integral (k, c, z')" ``` hoelzl@35582 ` 339` ``` by (rule pos_simple_integral_equal) (fact, fact) ``` hoelzl@35582 ` 340` hoelzl@35582 ` 341` ``` have "pos_simple_integral (k, c, (\ x. z x + z' x)) ``` hoelzl@35582 ` 342` ``` = (\ x \ k. (z x + z' x) * measure M (c x))" ``` hoelzl@35582 ` 343` ``` unfolding pos_simple_integral_def by auto ``` hoelzl@35582 ` 344` ``` also have "\ = (\ x \ k. z x * measure M (c x) + z' x * measure M (c x))" using real_add_mult_distrib by auto ``` hoelzl@35582 ` 345` ``` also have "\ = (\ x \ k. z x * measure M (c x)) + (\ x \ k. z' x * measure M (c x))" using setsum_addf by auto ``` hoelzl@35582 ` 346` ``` also have "\ = pos_simple_integral (k, c, z) + pos_simple_integral (k, c, z')" unfolding pos_simple_integral_def by auto ``` hoelzl@35582 ` 347` ``` finally have ths: "pos_simple_integral (s, a, x) + pos_simple_integral (s', b, y) = ``` hoelzl@35582 ` 348` ``` pos_simple_integral (k, c, (\ x. z x + z' x))" using x y by auto ``` hoelzl@35582 ` 349` ``` show ?thesis ``` hoelzl@35582 ` 350` ``` apply (rule that[of k c "(\ x. z x + z' x)", OF _ ths]) ``` hoelzl@35582 ` 351` ``` using kczz' unfolding pos_simple_def nonneg_def by (auto intro!: add_nonneg_nonneg) ``` hoelzl@35582 ` 352` ```qed ``` hoelzl@35582 ` 353` hoelzl@35582 ` 354` ```lemma psfis_add: ``` hoelzl@35582 ` 355` ``` assumes "a \ psfis f" "b \ psfis g" ``` hoelzl@35582 ` 356` ``` shows "a + b \ psfis (\x. f x + g x)" ``` hoelzl@35582 ` 357` ```using assms pos_simple_integral_add ``` hoelzl@35582 ` 358` ```unfolding psfis_def by auto blast ``` hoelzl@35582 ` 359` hoelzl@35582 ` 360` ```lemma pos_simple_integral_mono_on_mspace: ``` hoelzl@35582 ` 361` ``` assumes f: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 362` ``` assumes g: "(s', b, y) \ pos_simple g" ``` hoelzl@35582 ` 363` ``` assumes mono: "\ x. x \ space M \ f x \ g x" ``` hoelzl@35582 ` 364` ``` shows "pos_simple_integral (s, a, x) \ pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 365` ```using assms ``` hoelzl@35582 ` 366` ```proof - ``` hoelzl@35582 ` 367` ``` guess z z' c k by (rule pos_simple_common_partition[OF f g]) ``` hoelzl@35582 ` 368` ``` note kczz' = this ``` hoelzl@35582 ` 369` ``` (* w = z and w' = z' except where c _ = {} or undef *) ``` hoelzl@35582 ` 370` ``` def w == "\ i. if i \ k \ c i = {} then 0 else z i" ``` hoelzl@35582 ` 371` ``` def w' == "\ i. if i \ k \ c i = {} then 0 else z' i" ``` hoelzl@35582 ` 372` ``` { fix i ``` hoelzl@35582 ` 373` ``` have "w i \ w' i" ``` hoelzl@35582 ` 374` ``` proof (cases "i \ k \ c i = {}") ``` hoelzl@35582 ` 375` ``` case False hence "i \ k" "c i \ {}" by auto ``` hoelzl@35582 ` 376` ``` then obtain v where v: "v \ c i" and "c i \ sets M" ``` hoelzl@35582 ` 377` ``` using kczz'(1) unfolding pos_simple_def by blast ``` hoelzl@35582 ` 378` ``` hence "v \ space M" using sets_into_space by blast ``` hoelzl@35582 ` 379` ``` with mono[OF `v \ space M`] kczz' `i \ k` `v \ c i` ``` hoelzl@35582 ` 380` ``` have "z i \ z' i" unfolding pos_simple_def by simp ``` hoelzl@35582 ` 381` ``` thus ?thesis unfolding w_def w'_def using False by auto ``` hoelzl@35582 ` 382` ``` next ``` hoelzl@35582 ` 383` ``` case True thus ?thesis unfolding w_def w'_def by auto ``` hoelzl@35582 ` 384` ``` qed ``` hoelzl@35582 ` 385` ``` } note w_mn = this ``` hoelzl@35582 ` 386` hoelzl@35582 ` 387` ``` (* some technical stuff for the calculation*) ``` hoelzl@35582 ` 388` ``` have "\ i. i \ k \ c i \ sets M" using kczz' unfolding pos_simple_def by auto ``` hoelzl@35582 ` 389` ``` hence "\ i. i \ k \ measure M (c i) \ 0" using positive by auto ``` hoelzl@35582 ` 390` ``` hence w_mono: "\ i. i \ k \ w i * measure M (c i) \ w' i * measure M (c i)" ``` hoelzl@35582 ` 391` ``` using mult_right_mono w_mn by blast ``` hoelzl@35582 ` 392` hoelzl@35582 ` 393` ``` { fix i have "\i \ k ; z i \ w i\ \ measure M (c i) = 0" ``` hoelzl@35582 ` 394` ``` unfolding w_def by (cases "c i = {}") auto } ``` hoelzl@35582 ` 395` ``` hence zw: "\ i. i \ k \ z i * measure M (c i) = w i * measure M (c i)" by auto ``` hoelzl@35582 ` 396` hoelzl@35582 ` 397` ``` { fix i have "i \ k \ z i * measure M (c i) = w i * measure M (c i)" ``` hoelzl@35582 ` 398` ``` unfolding w_def by (cases "c i = {}") simp_all } ``` hoelzl@35582 ` 399` ``` note zw = this ``` hoelzl@35582 ` 400` hoelzl@35582 ` 401` ``` { fix i have "i \ k \ z' i * measure M (c i) = w' i * measure M (c i)" ``` hoelzl@35582 ` 402` ``` unfolding w'_def by (cases "c i = {}") simp_all } ``` hoelzl@35582 ` 403` ``` note z'w' = this ``` hoelzl@35582 ` 404` hoelzl@35582 ` 405` ``` (* the calculation *) ``` hoelzl@35582 ` 406` ``` have "pos_simple_integral (s, a, x) = pos_simple_integral (k, c, z)" ``` hoelzl@35582 ` 407` ``` using f kczz'(1) by (rule pos_simple_integral_equal) ``` hoelzl@35582 ` 408` ``` also have "\ = (\ i \ k. z i * measure M (c i))" ``` hoelzl@35582 ` 409` ``` unfolding pos_simple_integral_def by auto ``` hoelzl@35582 ` 410` ``` also have "\ = (\ i \ k. w i * measure M (c i))" ``` hoelzl@35582 ` 411` ``` using setsum_cong2[of k, OF zw] by auto ``` hoelzl@35582 ` 412` ``` also have "\ \ (\ i \ k. w' i * measure M (c i))" ``` hoelzl@35582 ` 413` ``` using setsum_mono[OF w_mono, of k] by auto ``` hoelzl@35582 ` 414` ``` also have "\ = (\ i \ k. z' i * measure M (c i))" ``` hoelzl@35582 ` 415` ``` using setsum_cong2[of k, OF z'w'] by auto ``` hoelzl@35582 ` 416` ``` also have "\ = pos_simple_integral (k, c, z')" ``` hoelzl@35582 ` 417` ``` unfolding pos_simple_integral_def by auto ``` hoelzl@35582 ` 418` ``` also have "\ = pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 419` ``` using kczz'(2) g by (rule pos_simple_integral_equal) ``` hoelzl@35582 ` 420` ``` finally show "pos_simple_integral (s, a, x) \ pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 421` ``` by simp ``` hoelzl@35582 ` 422` ```qed ``` hoelzl@35582 ` 423` hoelzl@35582 ` 424` ```lemma pos_simple_integral_mono: ``` hoelzl@35582 ` 425` ``` assumes a: "(s, a, x) \ pos_simple f" "(s', b, y) \ pos_simple g" ``` hoelzl@35582 ` 426` ``` assumes "\ z. f z \ g z" ``` hoelzl@35582 ` 427` ``` shows "pos_simple_integral (s, a, x) \ pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 428` ```using assms pos_simple_integral_mono_on_mspace by auto ``` hoelzl@35582 ` 429` hoelzl@35582 ` 430` ```lemma psfis_mono: ``` hoelzl@35582 ` 431` ``` assumes "a \ psfis f" "b \ psfis g" ``` hoelzl@35582 ` 432` ``` assumes "\ x. x \ space M \ f x \ g x" ``` hoelzl@35582 ` 433` ``` shows "a \ b" ``` hoelzl@35582 ` 434` ```using assms pos_simple_integral_mono_on_mspace unfolding psfis_def by auto ``` hoelzl@35582 ` 435` hoelzl@35582 ` 436` ```lemma pos_simple_fn_integral_unique: ``` hoelzl@35582 ` 437` ``` assumes "(s, a, x) \ pos_simple f" "(s', b, y) \ pos_simple f" ``` hoelzl@35582 ` 438` ``` shows "pos_simple_integral (s, a, x) = pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 439` ```using assms real_le_antisym real_le_refl pos_simple_integral_mono by metis ``` hoelzl@35582 ` 440` hoelzl@35582 ` 441` ```lemma psfis_unique: ``` hoelzl@35582 ` 442` ``` assumes "a \ psfis f" "b \ psfis f" ``` hoelzl@35582 ` 443` ``` shows "a = b" ``` hoelzl@35582 ` 444` ```using assms real_le_antisym real_le_refl psfis_mono by metis ``` hoelzl@35582 ` 445` hoelzl@35582 ` 446` ```lemma pos_simple_integral_indicator: ``` hoelzl@35582 ` 447` ``` assumes "A \ sets M" ``` hoelzl@35582 ` 448` ``` obtains s a x where ``` hoelzl@35582 ` 449` ``` "(s, a, x) \ pos_simple (indicator_fn A)" ``` hoelzl@35582 ` 450` ``` "measure M A = pos_simple_integral (s, a, x)" ``` hoelzl@35582 ` 451` ```using assms ``` hoelzl@35582 ` 452` ```proof - ``` hoelzl@35582 ` 453` ``` def s == "{0, 1} :: nat set" ``` hoelzl@35582 ` 454` ``` def a == "\ i :: nat. if i = 0 then A else space M - A" ``` hoelzl@35582 ` 455` ``` def x == "\ i :: nat. if i = 0 then 1 else (0 :: real)" ``` hoelzl@35582 ` 456` ``` have eq: "pos_simple_integral (s, a, x) = measure M A" ``` hoelzl@35582 ` 457` ``` unfolding s_def a_def x_def pos_simple_integral_def by auto ``` hoelzl@35582 ` 458` ``` have "(s, a, x) \ pos_simple (indicator_fn A)" ``` hoelzl@35582 ` 459` ``` unfolding pos_simple_def indicator_fn_def s_def a_def x_def nonneg_def ``` hoelzl@35582 ` 460` ``` using assms sets_into_space by auto ``` hoelzl@35582 ` 461` ``` from that[OF this] eq show thesis by auto ``` hoelzl@35582 ` 462` ```qed ``` hoelzl@35582 ` 463` hoelzl@35582 ` 464` ```lemma psfis_indicator: ``` hoelzl@35582 ` 465` ``` assumes "A \ sets M" ``` hoelzl@35582 ` 466` ``` shows "measure M A \ psfis (indicator_fn A)" ``` hoelzl@35582 ` 467` ```using pos_simple_integral_indicator[OF assms] ``` hoelzl@35582 ` 468` ``` unfolding psfis_def image_def by auto ``` hoelzl@35582 ` 469` hoelzl@35582 ` 470` ```lemma pos_simple_integral_mult: ``` hoelzl@35582 ` 471` ``` assumes f: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 472` ``` assumes "0 \ z" ``` hoelzl@35582 ` 473` ``` obtains s' b y where ``` hoelzl@35582 ` 474` ``` "(s', b, y) \ pos_simple (\x. z * f x)" ``` hoelzl@35582 ` 475` ``` "pos_simple_integral (s', b, y) = z * pos_simple_integral (s, a, x)" ``` hoelzl@35582 ` 476` ``` using assms that[of s a "\i. z * x i"] ``` hoelzl@35582 ` 477` ``` by (simp add: pos_simple_def pos_simple_integral_def setsum_right_distrib algebra_simps nonneg_def mult_nonneg_nonneg) ``` hoelzl@35582 ` 478` hoelzl@35582 ` 479` ```lemma psfis_mult: ``` hoelzl@35582 ` 480` ``` assumes "r \ psfis f" ``` hoelzl@35582 ` 481` ``` assumes "0 \ z" ``` hoelzl@35582 ` 482` ``` shows "z * r \ psfis (\x. z * f x)" ``` hoelzl@35582 ` 483` ```using assms ``` hoelzl@35582 ` 484` ```proof - ``` hoelzl@35582 ` 485` ``` from assms obtain s a x ``` hoelzl@35582 ` 486` ``` where sax: "(s, a, x) \ pos_simple f" ``` hoelzl@35582 ` 487` ``` and r: "r = pos_simple_integral (s, a, x)" ``` hoelzl@35582 ` 488` ``` unfolding psfis_def image_def by auto ``` hoelzl@35582 ` 489` ``` obtain s' b y where ``` hoelzl@35582 ` 490` ``` "(s', b, y) \ pos_simple (\x. z * f x)" ``` hoelzl@35582 ` 491` ``` "z * pos_simple_integral (s, a, x) = pos_simple_integral (s', b, y)" ``` hoelzl@35582 ` 492` ``` using pos_simple_integral_mult[OF sax `0 \ z`, of thesis] by auto ``` hoelzl@35582 ` 493` ``` thus ?thesis using r unfolding psfis_def image_def by auto ``` hoelzl@35582 ` 494` ```qed ``` hoelzl@35582 ` 495` hoelzl@35582 ` 496` ```lemma psfis_setsum_image: ``` hoelzl@35582 ` 497` ``` assumes "finite P" ``` hoelzl@35582 ` 498` ``` assumes "\i. i \ P \ a i \ psfis (f i)" ``` hoelzl@35582 ` 499` ``` shows "(setsum a P) \ psfis (\t. \i \ P. f i t)" ``` hoelzl@35582 ` 500` ```using assms ``` hoelzl@35582 ` 501` ```proof (induct P) ``` hoelzl@35582 ` 502` ``` case empty ``` hoelzl@35582 ` 503` ``` let ?s = "{0 :: nat}" ``` hoelzl@35582 ` 504` ``` let ?a = "\ i. if i = (0 :: nat) then space M else {}" ``` hoelzl@35582 ` 505` ``` let ?x = "\ (i :: nat). (0 :: real)" ``` hoelzl@35582 ` 506` ``` have "(?s, ?a, ?x) \ pos_simple (\ t. (0 :: real))" ``` hoelzl@35582 ` 507` ``` unfolding pos_simple_def image_def nonneg_def by auto ``` hoelzl@35582 ` 508` ``` moreover have "(\ i \ ?s. ?x i * measure M (?a i)) = 0" by auto ``` hoelzl@35582 ` 509` ``` ultimately have "0 \ psfis (\ t. 0)" ``` hoelzl@35582 ` 510` ``` unfolding psfis_def image_def pos_simple_integral_def nonneg_def ``` hoelzl@35582 ` 511` ``` by (auto intro!:bexI[of _ "(?s, ?a, ?x)"]) ``` hoelzl@35582 ` 512` ``` thus ?case by auto ``` hoelzl@35582 ` 513` ```next ``` hoelzl@35582 ` 514` ``` case (insert x P) note asms = this ``` hoelzl@35582 ` 515` ``` have "finite P" by fact ``` hoelzl@35582 ` 516` ``` have "x \ P" by fact ``` hoelzl@35582 ` 517` ``` have "(\i. i \ P \ a i \ psfis (f i)) \ ``` hoelzl@35582 ` 518` ``` setsum a P \ psfis (\t. \i\P. f i t)" by fact ``` hoelzl@35582 ` 519` ``` have "setsum a (insert x P) = a x + setsum a P" using `finite P` `x \ P` by auto ``` hoelzl@35582 ` 520` ``` also have "\ \ psfis (\ t. f x t + (\ i \ P. f i t))" ``` hoelzl@35582 ` 521` ``` using asms psfis_add by auto ``` hoelzl@35582 ` 522` ``` also have "\ = psfis (\ t. \ i \ insert x P. f i t)" ``` hoelzl@35582 ` 523` ``` using `x \ P` `finite P` by auto ``` hoelzl@35582 ` 524` ``` finally show ?case by simp ``` hoelzl@35582 ` 525` ```qed ``` hoelzl@35582 ` 526` hoelzl@35582 ` 527` ```lemma psfis_intro: ``` hoelzl@35582 ` 528` ``` assumes "a ` P \ sets M" and "nonneg x" and "finite P" ``` hoelzl@35582 ` 529` ``` shows "(\i\P. x i * measure M (a i)) \ psfis (\t. \i\P. x i * indicator_fn (a i) t)" ``` hoelzl@35582 ` 530` ```using assms psfis_mult psfis_indicator ``` hoelzl@35582 ` 531` ```unfolding image_def nonneg_def ``` hoelzl@35582 ` 532` ```by (auto intro!:psfis_setsum_image) ``` hoelzl@35582 ` 533` hoelzl@35582 ` 534` ```lemma psfis_nonneg: "a \ psfis f \ nonneg f" ``` hoelzl@35582 ` 535` ```unfolding psfis_def pos_simple_def by auto ``` hoelzl@35582 ` 536` hoelzl@35582 ` 537` ```lemma pos_psfis: "r \ psfis f \ 0 \ r" ``` hoelzl@35582 ` 538` ```unfolding psfis_def pos_simple_integral_def image_def pos_simple_def nonneg_def ``` hoelzl@35582 ` 539` ```using positive[unfolded positive_def] by (auto intro!:setsum_nonneg mult_nonneg_nonneg) ``` hoelzl@35582 ` 540` hoelzl@35582 ` 541` ```lemma psfis_borel_measurable: ``` hoelzl@35582 ` 542` ``` assumes "a \ psfis f" ``` hoelzl@35582 ` 543` ``` shows "f \ borel_measurable M" ``` hoelzl@35582 ` 544` ```using assms ``` hoelzl@35582 ` 545` ```proof - ``` hoelzl@35582 ` 546` ``` from assms obtain s a' x where sa'x: "(s, a', x) \ pos_simple f" and sa'xa: "pos_simple_integral (s, a', x) = a" ``` hoelzl@35582 ` 547` ``` and fs: "finite s" ``` hoelzl@35582 ` 548` ``` unfolding psfis_def pos_simple_integral_def image_def ``` hoelzl@35582 ` 549` ``` by (auto elim:pos_simpleE) ``` hoelzl@35582 ` 550` ``` { fix w assume "w \ space M" ``` hoelzl@35582 ` 551` ``` hence "(f w \ a) = ((\ i \ s. x i * indicator_fn (a' i) w) \ a)" ``` hoelzl@35582 ` 552` ``` using pos_simple_setsum_indicator_fn[OF sa'x, of w] by simp ``` hoelzl@35582 ` 553` ``` } hence "\ w. (w \ space M \ f w \ a) = (w \ space M \ (\ i \ s. x i * indicator_fn (a' i) w) \ a)" ``` hoelzl@35582 ` 554` ``` by auto ``` hoelzl@35582 ` 555` ``` { fix i assume "i \ s" ``` hoelzl@35582 ` 556` ``` hence "indicator_fn (a' i) \ borel_measurable M" ``` hoelzl@35582 ` 557` ``` using borel_measurable_indicator using sa'x[unfolded pos_simple_def] by auto ``` hoelzl@35582 ` 558` ``` hence "(\ w. x i * indicator_fn (a' i) w) \ borel_measurable M" ``` hoelzl@35582 ` 559` ``` using affine_borel_measurable[of "\ w. indicator_fn (a' i) w" 0 "x i"] ``` hoelzl@35582 ` 560` ``` real_mult_commute by auto } ``` hoelzl@35582 ` 561` ``` from borel_measurable_setsum_borel_measurable[OF fs this] affine_borel_measurable ``` hoelzl@35582 ` 562` ``` have "(\ w. (\ i \ s. x i * indicator_fn (a' i) w)) \ borel_measurable M" by auto ``` hoelzl@35582 ` 563` ``` from borel_measurable_cong[OF pos_simple_setsum_indicator_fn[OF sa'x]] this ``` hoelzl@35582 ` 564` ``` show ?thesis by simp ``` hoelzl@35582 ` 565` ```qed ``` hoelzl@35582 ` 566` hoelzl@35582 ` 567` ```lemma psfis_mono_conv_mono: ``` hoelzl@35582 ` 568` ``` assumes mono: "mono_convergent u f (space M)" ``` hoelzl@35582 ` 569` ``` and ps_u: "\n. x n \ psfis (u n)" ``` hoelzl@35582 ` 570` ``` and "x ----> y" ``` hoelzl@35582 ` 571` ``` and "r \ psfis s" ``` hoelzl@35582 ` 572` ``` and f_upper_bound: "\t. t \ space M \ s t \ f t" ``` hoelzl@35582 ` 573` ``` shows "r <= y" ``` hoelzl@35582 ` 574` ```proof (rule field_le_mult_one_interval) ``` hoelzl@35582 ` 575` ``` fix z :: real assume "0 < z" and "z < 1" ``` hoelzl@35582 ` 576` ``` hence "0 \ z" by auto ``` hoelzl@35582 ` 577` ``` let "?B' n" = "{w \ space M. z * s w <= u n w}" ``` hoelzl@35582 ` 578` hoelzl@35582 ` 579` ``` have "incseq x" unfolding incseq_def ``` hoelzl@35582 ` 580` ``` proof safe ``` hoelzl@35582 ` 581` ``` fix m n :: nat assume "m \ n" ``` hoelzl@35582 ` 582` ``` show "x m \ x n" ``` hoelzl@35582 ` 583` ``` proof (rule psfis_mono[OF `x m \ psfis (u m)` `x n \ psfis (u n)`]) ``` hoelzl@35582 ` 584` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 585` ``` with mono_convergentD[OF mono this] `m \ n` show "u m t \ u n t" ``` hoelzl@35582 ` 586` ``` unfolding incseq_def by auto ``` hoelzl@35582 ` 587` ``` qed ``` hoelzl@35582 ` 588` ``` qed ``` hoelzl@35582 ` 589` hoelzl@35582 ` 590` ``` from `r \ psfis s` ``` hoelzl@35582 ` 591` ``` obtain s' a x' where r: "r = pos_simple_integral (s', a, x')" ``` hoelzl@35582 ` 592` ``` and ps_s: "(s', a, x') \ pos_simple s" ``` hoelzl@35582 ` 593` ``` unfolding psfis_def by auto ``` hoelzl@35582 ` 594` hoelzl@35582 ` 595` ``` { fix t i assume "i \ s'" "t \ a i" ``` hoelzl@35582 ` 596` ``` hence "t \ space M" using ps_s by (auto elim!: pos_simpleE) } ``` hoelzl@35582 ` 597` ``` note t_in_space = this ``` hoelzl@35582 ` 598` hoelzl@35582 ` 599` ``` { fix n ``` hoelzl@35582 ` 600` ``` from psfis_borel_measurable[OF `r \ psfis s`] ``` hoelzl@35582 ` 601` ``` psfis_borel_measurable[OF ps_u] ``` hoelzl@35582 ` 602` ``` have "?B' n \ sets M" ``` hoelzl@35582 ` 603` ``` by (auto intro!: ``` hoelzl@35582 ` 604` ``` borel_measurable_leq_borel_measurable ``` hoelzl@35582 ` 605` ``` borel_measurable_times_borel_measurable ``` hoelzl@35582 ` 606` ``` borel_measurable_const) } ``` hoelzl@35582 ` 607` ``` note B'_in_M = this ``` hoelzl@35582 ` 608` hoelzl@35582 ` 609` ``` { fix n have "(\i. a i \ ?B' n) ` s' \ sets M" using B'_in_M ps_s ``` hoelzl@35582 ` 610` ``` by (auto intro!: Int elim!: pos_simpleE) } ``` hoelzl@35582 ` 611` ``` note B'_inter_a_in_M = this ``` hoelzl@35582 ` 612` hoelzl@35582 ` 613` ``` let "?sum n" = "(\i\s'. x' i * measure M (a i \ ?B' n))" ``` hoelzl@35582 ` 614` ``` { fix n ``` hoelzl@35582 ` 615` ``` have "z * ?sum n \ x n" ``` hoelzl@35582 ` 616` ``` proof (rule psfis_mono[OF _ ps_u]) ``` hoelzl@35582 ` 617` ``` have *: "\i t. indicator_fn (?B' n) t * (x' i * indicator_fn (a i) t) = ``` hoelzl@35582 ` 618` ``` x' i * indicator_fn (a i \ ?B' n) t" unfolding indicator_fn_def by auto ``` hoelzl@35582 ` 619` ``` have ps': "?sum n \ psfis (\t. indicator_fn (?B' n) t * (\i\s'. x' i * indicator_fn (a i) t))" ``` hoelzl@35582 ` 620` ``` unfolding setsum_right_distrib * using B'_in_M ps_s ``` hoelzl@35582 ` 621` ``` by (auto intro!: psfis_intro Int elim!: pos_simpleE) ``` hoelzl@35582 ` 622` ``` also have "... = psfis (\t. indicator_fn (?B' n) t * s t)" (is "psfis ?l = psfis ?r") ``` hoelzl@35582 ` 623` ``` proof (rule psfis_cong) ``` hoelzl@35582 ` 624` ``` show "nonneg ?l" using psfis_nonneg[OF ps'] . ``` hoelzl@35582 ` 625` ``` show "nonneg ?r" using psfis_nonneg[OF `r \ psfis s`] unfolding nonneg_def indicator_fn_def by auto ``` hoelzl@35582 ` 626` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 627` ``` show "?l t = ?r t" unfolding pos_simple_setsum_indicator_fn[OF ps_s `t \ space M`] .. ``` hoelzl@35582 ` 628` ``` qed ``` hoelzl@35582 ` 629` ``` finally show "z * ?sum n \ psfis (\t. z * ?r t)" using psfis_mult[OF _ `0 \ z`] by simp ``` hoelzl@35582 ` 630` ``` next ``` hoelzl@35582 ` 631` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 632` ``` show "z * (indicator_fn (?B' n) t * s t) \ u n t" ``` hoelzl@35582 ` 633` ``` using psfis_nonneg[OF ps_u] unfolding nonneg_def indicator_fn_def by auto ``` hoelzl@35582 ` 634` ``` qed } ``` hoelzl@35582 ` 635` ``` hence *: "\N. \n\N. z * ?sum n \ x n" by (auto intro!: exI[of _ 0]) ``` hoelzl@35582 ` 636` hoelzl@35582 ` 637` ``` show "z * r \ y" unfolding r pos_simple_integral_def ``` hoelzl@35582 ` 638` ``` proof (rule LIMSEQ_le[OF mult_right.LIMSEQ `x ----> y` *], ``` hoelzl@35582 ` 639` ``` simp, rule LIMSEQ_setsum, rule mult_right.LIMSEQ) ``` hoelzl@35582 ` 640` ``` fix i assume "i \ s'" ``` hoelzl@35582 ` 641` ``` from psfis_nonneg[OF `r \ psfis s`, unfolded nonneg_def] ``` hoelzl@35582 ` 642` ``` have "\t. 0 \ s t" by simp ``` hoelzl@35582 ` 643` hoelzl@35582 ` 644` ``` have *: "(\j. a i \ ?B' j) = a i" ``` hoelzl@35582 ` 645` ``` proof (safe, simp, safe) ``` hoelzl@35582 ` 646` ``` fix t assume "t \ a i" ``` hoelzl@35582 ` 647` ``` thus "t \ space M" using t_in_space[OF `i \ s'`] by auto ``` hoelzl@35582 ` 648` ``` show "\j. z * s t \ u j t" ``` hoelzl@35582 ` 649` ``` proof (cases "s t = 0") ``` hoelzl@35582 ` 650` ``` case True thus ?thesis ``` hoelzl@35582 ` 651` ``` using psfis_nonneg[OF ps_u] unfolding nonneg_def by auto ``` hoelzl@35582 ` 652` ``` next ``` hoelzl@35582 ` 653` ``` case False with `0 \ s t` ``` hoelzl@35582 ` 654` ``` have "0 < s t" by auto ``` hoelzl@35582 ` 655` ``` hence "z * s t < 1 * s t" using `0 < z` `z < 1` ``` hoelzl@35582 ` 656` ``` by (auto intro!: mult_strict_right_mono simp del: mult_1_left) ``` hoelzl@35582 ` 657` ``` also have "... \ f t" using f_upper_bound `t \ space M` by auto ``` hoelzl@35582 ` 658` ``` finally obtain b where "\j. b \ j \ z * s t < u j t" using `t \ space M` ``` hoelzl@35582 ` 659` ``` using mono_conv_outgrow[of "\n. u n t" "f t" "z * s t"] ``` hoelzl@35582 ` 660` ``` using mono_convergentD[OF mono] by auto ``` hoelzl@35582 ` 661` ``` from this[of b] show ?thesis by (auto intro!: exI[of _ b]) ``` hoelzl@35582 ` 662` ``` qed ``` hoelzl@35582 ` 663` ``` qed ``` hoelzl@35582 ` 664` hoelzl@35582 ` 665` ``` show "(\n. measure M (a i \ ?B' n)) ----> measure M (a i)" ``` hoelzl@35582 ` 666` ``` proof (safe intro!: ``` hoelzl@35582 ` 667` ``` monotone_convergence[of "\n. a i \ ?B' n", unfolded comp_def *]) ``` hoelzl@35582 ` 668` ``` fix n show "a i \ ?B' n \ sets M" ``` hoelzl@35582 ` 669` ``` using B'_inter_a_in_M[of n] `i \ s'` by auto ``` hoelzl@35582 ` 670` ``` next ``` hoelzl@35582 ` 671` ``` fix j t assume "t \ space M" and "z * s t \ u j t" ``` hoelzl@35582 ` 672` ``` thus "z * s t \ u (Suc j) t" ``` hoelzl@35582 ` 673` ``` using mono_convergentD(1)[OF mono, unfolded incseq_def, ``` hoelzl@35582 ` 674` ``` rule_format, of t j "Suc j"] ``` hoelzl@35582 ` 675` ``` by auto ``` hoelzl@35582 ` 676` ``` qed ``` hoelzl@35582 ` 677` ``` qed ``` hoelzl@35582 ` 678` ```qed ``` hoelzl@35582 ` 679` hoelzl@35692 ` 680` ```section "Continuous posititve integration" ``` hoelzl@35692 ` 681` hoelzl@35692 ` 682` ```definition ``` hoelzl@35692 ` 683` ``` "nnfis f = { y. \u x. mono_convergent u f (space M) \ ``` hoelzl@35692 ` 684` ``` (\n. x n \ psfis (u n)) \ x ----> y }" ``` hoelzl@35692 ` 685` hoelzl@35582 ` 686` ```lemma psfis_nnfis: ``` hoelzl@35582 ` 687` ``` "a \ psfis f \ a \ nnfis f" ``` hoelzl@35582 ` 688` ``` unfolding nnfis_def mono_convergent_def incseq_def ``` hoelzl@35582 ` 689` ``` by (auto intro!: exI[of _ "\n. f"] exI[of _ "\n. a"] LIMSEQ_const) ``` hoelzl@35582 ` 690` hoelzl@35748 ` 691` ```lemma nnfis_0: "0 \ nnfis (\ x. 0)" ``` hoelzl@35748 ` 692` ``` by (rule psfis_nnfis[OF psfis_0]) ``` hoelzl@35748 ` 693` hoelzl@35582 ` 694` ```lemma nnfis_times: ``` hoelzl@35582 ` 695` ``` assumes "a \ nnfis f" and "0 \ z" ``` hoelzl@35582 ` 696` ``` shows "z * a \ nnfis (\t. z * f t)" ``` hoelzl@35582 ` 697` ```proof - ``` hoelzl@35582 ` 698` ``` obtain u x where "mono_convergent u f (space M)" and ``` hoelzl@35582 ` 699` ``` "\n. x n \ psfis (u n)" "x ----> a" ``` hoelzl@35582 ` 700` ``` using `a \ nnfis f` unfolding nnfis_def by auto ``` hoelzl@35582 ` 701` ``` with `0 \ z`show ?thesis unfolding nnfis_def mono_convergent_def incseq_def ``` hoelzl@35582 ` 702` ``` by (auto intro!: exI[of _ "\n w. z * u n w"] exI[of _ "\n. z * x n"] ``` hoelzl@35582 ` 703` ``` LIMSEQ_mult LIMSEQ_const psfis_mult mult_mono1) ``` hoelzl@35582 ` 704` ```qed ``` hoelzl@35582 ` 705` hoelzl@35582 ` 706` ```lemma nnfis_add: ``` hoelzl@35582 ` 707` ``` assumes "a \ nnfis f" and "b \ nnfis g" ``` hoelzl@35582 ` 708` ``` shows "a + b \ nnfis (\t. f t + g t)" ``` hoelzl@35582 ` 709` ```proof - ``` hoelzl@35582 ` 710` ``` obtain u x w y ``` hoelzl@35582 ` 711` ``` where "mono_convergent u f (space M)" and ``` hoelzl@35582 ` 712` ``` "\n. x n \ psfis (u n)" "x ----> a" and ``` hoelzl@35582 ` 713` ``` "mono_convergent w g (space M)" and ``` hoelzl@35582 ` 714` ``` "\n. y n \ psfis (w n)" "y ----> b" ``` hoelzl@35582 ` 715` ``` using `a \ nnfis f` `b \ nnfis g` unfolding nnfis_def by auto ``` hoelzl@35582 ` 716` ``` thus ?thesis unfolding nnfis_def mono_convergent_def incseq_def ``` hoelzl@35582 ` 717` ``` by (auto intro!: exI[of _ "\n a. u n a + w n a"] exI[of _ "\n. x n + y n"] ``` hoelzl@35582 ` 718` ``` LIMSEQ_add LIMSEQ_const psfis_add add_mono) ``` hoelzl@35582 ` 719` ```qed ``` hoelzl@35582 ` 720` hoelzl@35582 ` 721` ```lemma nnfis_mono: ``` hoelzl@35582 ` 722` ``` assumes nnfis: "a \ nnfis f" "b \ nnfis g" ``` hoelzl@35582 ` 723` ``` and mono: "\t. t \ space M \ f t \ g t" ``` hoelzl@35582 ` 724` ``` shows "a \ b" ``` hoelzl@35582 ` 725` ```proof - ``` hoelzl@35582 ` 726` ``` obtain u x w y where ``` hoelzl@35582 ` 727` ``` mc: "mono_convergent u f (space M)" "mono_convergent w g (space M)" and ``` hoelzl@35582 ` 728` ``` psfis: "\n. x n \ psfis (u n)" "\n. y n \ psfis (w n)" and ``` hoelzl@35582 ` 729` ``` limseq: "x ----> a" "y ----> b" using nnfis unfolding nnfis_def by auto ``` hoelzl@35582 ` 730` ``` show ?thesis ``` hoelzl@35582 ` 731` ``` proof (rule LIMSEQ_le_const2[OF limseq(1)], rule exI[of _ 0], safe) ``` hoelzl@35582 ` 732` ``` fix n ``` hoelzl@35582 ` 733` ``` show "x n \ b" ``` hoelzl@35582 ` 734` ``` proof (rule psfis_mono_conv_mono[OF mc(2) psfis(2) limseq(2) psfis(1)]) ``` hoelzl@35582 ` 735` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 736` ``` from mono_convergent_le[OF mc(1) this] mono[OF this] ``` hoelzl@35582 ` 737` ``` show "u n t \ g t" by (rule order_trans) ``` hoelzl@35582 ` 738` ``` qed ``` hoelzl@35582 ` 739` ``` qed ``` hoelzl@35582 ` 740` ```qed ``` hoelzl@35582 ` 741` hoelzl@35582 ` 742` ```lemma nnfis_unique: ``` hoelzl@35582 ` 743` ``` assumes a: "a \ nnfis f" and b: "b \ nnfis f" ``` hoelzl@35582 ` 744` ``` shows "a = b" ``` hoelzl@35582 ` 745` ``` using nnfis_mono[OF a b] nnfis_mono[OF b a] ``` hoelzl@35582 ` 746` ``` by (auto intro!: real_le_antisym[of a b]) ``` hoelzl@35582 ` 747` hoelzl@35582 ` 748` ```lemma psfis_equiv: ``` hoelzl@35582 ` 749` ``` assumes "a \ psfis f" and "nonneg g" ``` hoelzl@35582 ` 750` ``` and "\t. t \ space M \ f t = g t" ``` hoelzl@35582 ` 751` ``` shows "a \ psfis g" ``` hoelzl@35582 ` 752` ``` using assms unfolding psfis_def pos_simple_def by auto ``` hoelzl@35582 ` 753` hoelzl@35582 ` 754` ```lemma psfis_mon_upclose: ``` hoelzl@35582 ` 755` ``` assumes "\m. a m \ psfis (u m)" ``` hoelzl@35582 ` 756` ``` shows "\c. c \ psfis (mon_upclose n u)" ``` hoelzl@35582 ` 757` ```proof (induct n) ``` hoelzl@35582 ` 758` ``` case 0 thus ?case unfolding mon_upclose.simps using assms .. ``` hoelzl@35582 ` 759` ```next ``` hoelzl@35582 ` 760` ``` case (Suc n) ``` hoelzl@35582 ` 761` ``` then obtain sn an xn where ps: "(sn, an, xn) \ pos_simple (mon_upclose n u)" ``` hoelzl@35582 ` 762` ``` unfolding psfis_def by auto ``` hoelzl@35582 ` 763` ``` obtain ss as xs where ps': "(ss, as, xs) \ pos_simple (u (Suc n))" ``` hoelzl@35582 ` 764` ``` using assms[of "Suc n"] unfolding psfis_def by auto ``` hoelzl@35582 ` 765` ``` from pos_simple_common_partition[OF ps ps'] guess x x' a s . ``` hoelzl@35582 ` 766` ``` hence "(s, a, upclose x x') \ pos_simple (mon_upclose (Suc n) u)" ``` hoelzl@35582 ` 767` ``` by (simp add: upclose_def pos_simple_def nonneg_def max_def) ``` hoelzl@35582 ` 768` ``` thus ?case unfolding psfis_def by auto ``` hoelzl@35582 ` 769` ```qed ``` hoelzl@35582 ` 770` hoelzl@35582 ` 771` ```text {* Beppo-Levi monotone convergence theorem *} ``` hoelzl@35582 ` 772` ```lemma nnfis_mon_conv: ``` hoelzl@35582 ` 773` ``` assumes mc: "mono_convergent f h (space M)" ``` hoelzl@35582 ` 774` ``` and nnfis: "\n. x n \ nnfis (f n)" ``` hoelzl@35582 ` 775` ``` and "x ----> z" ``` hoelzl@35582 ` 776` ``` shows "z \ nnfis h" ``` hoelzl@35582 ` 777` ```proof - ``` hoelzl@35582 ` 778` ``` have "\n. \u y. mono_convergent u (f n) (space M) \ (\m. y m \ psfis (u m)) \ ``` hoelzl@35582 ` 779` ``` y ----> x n" ``` hoelzl@35582 ` 780` ``` using nnfis unfolding nnfis_def by auto ``` hoelzl@35582 ` 781` ``` from choice[OF this] guess u .. ``` hoelzl@35582 ` 782` ``` from choice[OF this] guess y .. ``` hoelzl@35582 ` 783` ``` hence mc_u: "\n. mono_convergent (u n) (f n) (space M)" ``` hoelzl@35582 ` 784` ``` and psfis: "\n m. y n m \ psfis (u n m)" and "\n. y n ----> x n" ``` hoelzl@35582 ` 785` ``` by auto ``` hoelzl@35582 ` 786` hoelzl@35582 ` 787` ``` let "?upclose n" = "mon_upclose n (\m. u m n)" ``` hoelzl@35582 ` 788` hoelzl@35582 ` 789` ``` have "\c. \n. c n \ psfis (?upclose n)" ``` hoelzl@35582 ` 790` ``` by (safe intro!: choice psfis_mon_upclose) (rule psfis) ``` hoelzl@35582 ` 791` ``` then guess c .. note c = this[rule_format] ``` hoelzl@35582 ` 792` hoelzl@35582 ` 793` ``` show ?thesis unfolding nnfis_def ``` hoelzl@35582 ` 794` ``` proof (safe intro!: exI) ``` hoelzl@35582 ` 795` ``` show mc_upclose: "mono_convergent ?upclose h (space M)" ``` hoelzl@35582 ` 796` ``` by (rule mon_upclose_mono_convergent[OF mc_u mc]) ``` hoelzl@35582 ` 797` ``` show psfis_upclose: "\n. c n \ psfis (?upclose n)" ``` hoelzl@35582 ` 798` ``` using c . ``` hoelzl@35582 ` 799` hoelzl@35582 ` 800` ``` { fix n m :: nat assume "n \ m" ``` hoelzl@35582 ` 801` ``` hence "c n \ c m" ``` hoelzl@35582 ` 802` ``` using psfis_mono[OF c c] ``` hoelzl@35582 ` 803` ``` using mono_convergentD(1)[OF mc_upclose, unfolded incseq_def] ``` hoelzl@35582 ` 804` ``` by auto } ``` hoelzl@35582 ` 805` ``` hence "incseq c" unfolding incseq_def by auto ``` hoelzl@35582 ` 806` hoelzl@35582 ` 807` ``` { fix n ``` hoelzl@35582 ` 808` ``` have c_nnfis: "c n \ nnfis (?upclose n)" using c by (rule psfis_nnfis) ``` hoelzl@35582 ` 809` ``` from nnfis_mono[OF c_nnfis nnfis] ``` hoelzl@35582 ` 810` ``` mon_upclose_le_mono_convergent[OF mc_u] ``` hoelzl@35582 ` 811` ``` mono_convergentD(1)[OF mc] ``` hoelzl@35582 ` 812` ``` have "c n \ x n" by fast } ``` hoelzl@35582 ` 813` ``` note c_less_x = this ``` hoelzl@35582 ` 814` hoelzl@35582 ` 815` ``` { fix n ``` hoelzl@35582 ` 816` ``` note c_less_x[of n] ``` hoelzl@35582 ` 817` ``` also have "x n \ z" ``` hoelzl@35582 ` 818` ``` proof (rule incseq_le) ``` hoelzl@35582 ` 819` ``` show "x ----> z" by fact ``` hoelzl@35582 ` 820` ``` from mono_convergentD(1)[OF mc] ``` hoelzl@35582 ` 821` ``` show "incseq x" unfolding incseq_def ``` hoelzl@35582 ` 822` ``` by (auto intro!: nnfis_mono[OF nnfis nnfis]) ``` hoelzl@35582 ` 823` ``` qed ``` hoelzl@35582 ` 824` ``` finally have "c n \ z" . } ``` hoelzl@35582 ` 825` ``` note c_less_z = this ``` hoelzl@35582 ` 826` hoelzl@35582 ` 827` ``` have "convergent c" ``` hoelzl@35582 ` 828` ``` proof (rule Bseq_mono_convergent[unfolded incseq_def[symmetric]]) ``` hoelzl@35582 ` 829` ``` show "Bseq c" ``` hoelzl@35582 ` 830` ``` using pos_psfis[OF c] c_less_z ``` hoelzl@35582 ` 831` ``` by (auto intro!: BseqI'[of _ z]) ``` hoelzl@35582 ` 832` ``` show "incseq c" by fact ``` hoelzl@35582 ` 833` ``` qed ``` hoelzl@35582 ` 834` ``` then obtain l where l: "c ----> l" unfolding convergent_def by auto ``` hoelzl@35582 ` 835` hoelzl@35582 ` 836` ``` have "l \ z" using c_less_x l ``` hoelzl@35582 ` 837` ``` by (auto intro!: LIMSEQ_le[OF _ `x ----> z`]) ``` hoelzl@35582 ` 838` ``` moreover have "z \ l" ``` hoelzl@35582 ` 839` ``` proof (rule LIMSEQ_le_const2[OF `x ----> z`], safe intro!: exI[of _ 0]) ``` hoelzl@35582 ` 840` ``` fix n ``` hoelzl@35582 ` 841` ``` have "l \ nnfis h" ``` hoelzl@35582 ` 842` ``` unfolding nnfis_def using l mc_upclose psfis_upclose by auto ``` hoelzl@35582 ` 843` ``` from nnfis this mono_convergent_le[OF mc] ``` hoelzl@35582 ` 844` ``` show "x n \ l" by (rule nnfis_mono) ``` hoelzl@35582 ` 845` ``` qed ``` hoelzl@35582 ` 846` ``` ultimately have "l = z" by (rule real_le_antisym) ``` hoelzl@35582 ` 847` ``` thus "c ----> z" using `c ----> l` by simp ``` hoelzl@35582 ` 848` ``` qed ``` hoelzl@35582 ` 849` ```qed ``` hoelzl@35582 ` 850` hoelzl@35582 ` 851` ```lemma nnfis_pos_on_mspace: ``` hoelzl@35582 ` 852` ``` assumes "a \ nnfis f" and "x \space M" ``` hoelzl@35582 ` 853` ``` shows "0 \ f x" ``` hoelzl@35582 ` 854` ```using assms ``` hoelzl@35582 ` 855` ```proof - ``` hoelzl@35582 ` 856` ``` from assms[unfolded nnfis_def] guess u y by auto note uy = this ``` hoelzl@35748 ` 857` ``` hence "\ n. 0 \ u n x" ``` hoelzl@35582 ` 858` ``` unfolding nnfis_def psfis_def pos_simple_def nonneg_def mono_convergent_def ``` hoelzl@35582 ` 859` ``` by auto ``` hoelzl@35582 ` 860` ``` thus "0 \ f x" using uy[rule_format] ``` hoelzl@35582 ` 861` ``` unfolding nnfis_def psfis_def pos_simple_def nonneg_def mono_convergent_def ``` hoelzl@35582 ` 862` ``` using incseq_le[of "\ n. u n x" "f x"] real_le_trans ``` hoelzl@35582 ` 863` ``` by fast ``` hoelzl@35582 ` 864` ```qed ``` hoelzl@35582 ` 865` hoelzl@35582 ` 866` ```lemma nnfis_borel_measurable: ``` hoelzl@35582 ` 867` ``` assumes "a \ nnfis f" ``` hoelzl@35582 ` 868` ``` shows "f \ borel_measurable M" ``` hoelzl@35582 ` 869` ```using assms unfolding nnfis_def ``` hoelzl@35582 ` 870` ```apply auto ``` hoelzl@35582 ` 871` ```apply (rule mono_convergent_borel_measurable) ``` hoelzl@35582 ` 872` ```using psfis_borel_measurable ``` hoelzl@35582 ` 873` ```by auto ``` hoelzl@35582 ` 874` hoelzl@35582 ` 875` ```lemma borel_measurable_mon_conv_psfis: ``` hoelzl@35582 ` 876` ``` assumes f_borel: "f \ borel_measurable M" ``` hoelzl@35582 ` 877` ``` and nonneg: "\t. t \ space M \ 0 \ f t" ``` hoelzl@35582 ` 878` ``` shows"\u x. mono_convergent u f (space M) \ (\n. x n \ psfis (u n))" ``` hoelzl@35582 ` 879` ```proof (safe intro!: exI) ``` hoelzl@35582 ` 880` ``` let "?I n" = "{0<.. space M" ``` hoelzl@35582 ` 888` ``` have "?u n t = ?w n t" (is "_ = (if _ then real ?i / _ else _)") ``` hoelzl@35582 ` 889` ``` proof (cases "f t < real n") ``` hoelzl@35582 ` 890` ``` case True ``` hoelzl@35582 ` 891` ``` with nonneg t ``` hoelzl@35582 ` 892` ``` have i: "?i < n * 2^n" ``` hoelzl@35582 ` 893` ``` by (auto simp: real_of_nat_power[symmetric] ``` hoelzl@35582 ` 894` ``` intro!: less_natfloor mult_nonneg_nonneg) ``` hoelzl@35582 ` 895` hoelzl@35582 ` 896` ``` hence t_in_A: "t \ ?A n ?i" ``` hoelzl@35582 ` 897` ``` unfolding divide_le_eq less_divide_eq ``` hoelzl@35582 ` 898` ``` using nonneg t True ``` hoelzl@35582 ` 899` ``` by (auto intro!: real_natfloor_le ``` hoelzl@35582 ` 900` ``` real_natfloor_gt_diff_one[unfolded diff_less_eq] ``` hoelzl@35582 ` 901` ``` simp: real_of_nat_Suc zero_le_mult_iff) ``` hoelzl@35582 ` 902` hoelzl@35582 ` 903` ``` hence *: "real ?i / 2^n \ f t" ``` hoelzl@35582 ` 904` ``` "f t < real (?i + 1) / 2^n" by auto ``` hoelzl@35582 ` 905` ``` { fix j assume "t \ ?A n j" ``` hoelzl@35582 ` 906` ``` hence "real j / 2^n \ f t" ``` hoelzl@35582 ` 907` ``` and "f t < real (j + 1) / 2^n" by auto ``` hoelzl@35582 ` 908` ``` with * have "j \ {?i}" unfolding divide_le_eq less_divide_eq ``` hoelzl@35582 ` 909` ``` by auto } ``` hoelzl@35582 ` 910` ``` hence *: "\j. t \ ?A n j \ j \ {?i}" using t_in_A by auto ``` hoelzl@35582 ` 911` hoelzl@35582 ` 912` ``` have "?u n t = real ?i / 2^n" ``` hoelzl@35582 ` 913` ``` unfolding indicator_fn_def if_distrib * ``` hoelzl@35582 ` 914` ``` setsum_cases[OF finite_greaterThanLessThan] ``` hoelzl@35582 ` 915` ``` using i by (cases "?i = 0") simp_all ``` hoelzl@35582 ` 916` ``` thus ?thesis using True by auto ``` hoelzl@35582 ` 917` ``` next ``` hoelzl@35582 ` 918` ``` case False ``` hoelzl@35582 ` 919` ``` have "?u n t = (\i \ {0 <..< n*2^n}. 0)" ``` hoelzl@35582 ` 920` ``` proof (rule setsum_cong) ``` hoelzl@35582 ` 921` ``` fix i assume "i \ {0 <..< n*2^n}" ``` hoelzl@35582 ` 922` ``` hence "i + 1 \ n * 2^n" by simp ``` hoelzl@35582 ` 923` ``` hence "real (i + 1) \ real n * 2^n" ``` hoelzl@35582 ` 924` ``` unfolding real_of_nat_le_iff[symmetric] ``` hoelzl@35582 ` 925` ``` by (auto simp: real_of_nat_power[symmetric]) ``` hoelzl@35582 ` 926` ``` also have "... \ f t * 2^n" ``` hoelzl@35582 ` 927` ``` using False by (auto intro!: mult_nonneg_nonneg) ``` hoelzl@35582 ` 928` ``` finally have "t \ ?A n i" ``` hoelzl@35582 ` 929` ``` by (auto simp: divide_le_eq less_divide_eq) ``` hoelzl@35582 ` 930` ``` thus "real i / 2^n * indicator_fn (?A n i) t = 0" ``` hoelzl@35582 ` 931` ``` unfolding indicator_fn_def by auto ``` hoelzl@35582 ` 932` ``` qed simp ``` hoelzl@35582 ` 933` ``` thus ?thesis using False by auto ``` hoelzl@35582 ` 934` ``` qed } ``` hoelzl@35582 ` 935` ``` note u_at_t = this ``` hoelzl@35582 ` 936` hoelzl@35582 ` 937` ``` show "mono_convergent ?u f (space M)" unfolding mono_convergent_def ``` hoelzl@35582 ` 938` ``` proof safe ``` hoelzl@35582 ` 939` ``` fix t assume t: "t \ space M" ``` hoelzl@35582 ` 940` ``` { fix m n :: nat assume "m \ n" ``` hoelzl@35582 ` 941` ``` hence *: "(2::real)^n = 2^m * 2^(n - m)" unfolding class_semiring.mul_pwr by auto ``` hoelzl@35582 ` 942` ``` have "real (natfloor (f t * 2^m) * natfloor (2^(n-m))) \ real (natfloor (f t * 2 ^ n))" ``` hoelzl@35582 ` 943` ``` apply (subst *) ``` hoelzl@35582 ` 944` ``` apply (subst class_semiring.mul_a) ``` hoelzl@35582 ` 945` ``` apply (subst real_of_nat_le_iff) ``` hoelzl@35582 ` 946` ``` apply (rule le_mult_natfloor) ``` hoelzl@35582 ` 947` ``` using nonneg[OF t] by (auto intro!: mult_nonneg_nonneg) ``` hoelzl@35582 ` 948` ``` hence "real (natfloor (f t * 2^m)) * 2^n \ real (natfloor (f t * 2^n)) * 2^m" ``` hoelzl@35582 ` 949` ``` apply (subst *) ``` hoelzl@35582 ` 950` ``` apply (subst (3) class_semiring.mul_c) ``` hoelzl@35582 ` 951` ``` apply (subst class_semiring.mul_a) ``` hoelzl@35582 ` 952` ``` by (auto intro: mult_right_mono simp: natfloor_power real_of_nat_power[symmetric]) } ``` hoelzl@35582 ` 953` ``` thus "incseq (\n. ?u n t)" unfolding u_at_t[OF t] unfolding incseq_def ``` hoelzl@35582 ` 954` ``` by (auto simp add: le_divide_eq divide_le_eq less_divide_eq) ``` hoelzl@35582 ` 955` hoelzl@35582 ` 956` ``` show "(\i. ?u i t) ----> f t" unfolding u_at_t[OF t] ``` hoelzl@35582 ` 957` ``` proof (rule LIMSEQ_I, safe intro!: exI) ``` hoelzl@35582 ` 958` ``` fix r :: real and n :: nat ``` hoelzl@35582 ` 959` ``` let ?N = "natfloor (1/r) + 1" ``` hoelzl@35582 ` 960` ``` assume "0 < r" and N: "max ?N (natfloor (f t) + 1) \ n" ``` hoelzl@35582 ` 961` ``` hence "?N \ n" by auto ``` hoelzl@35582 ` 962` hoelzl@35582 ` 963` ``` have "1 / r < real (natfloor (1/r) + 1)" using real_natfloor_add_one_gt ``` hoelzl@35582 ` 964` ``` by (simp add: real_of_nat_Suc) ``` hoelzl@35582 ` 965` ``` also have "... < 2^?N" by (rule two_realpow_gt) ``` hoelzl@35582 ` 966` ``` finally have less_r: "1 / 2^?N < r" using `0 < r` ``` hoelzl@35582 ` 967` ``` by (auto simp: less_divide_eq divide_less_eq algebra_simps) ``` hoelzl@35582 ` 968` hoelzl@35582 ` 969` ``` have "f t < real (natfloor (f t) + 1)" using real_natfloor_add_one_gt[of "f t"] by auto ``` hoelzl@35582 ` 970` ``` also have "... \ real n" unfolding real_of_nat_le_iff using N by auto ``` hoelzl@35582 ` 971` ``` finally have "f t < real n" . ``` hoelzl@35582 ` 972` hoelzl@35582 ` 973` ``` have "real (natfloor (f t * 2^n)) \ f t * 2^n" ``` hoelzl@35582 ` 974` ``` using nonneg[OF t] by (auto intro!: real_natfloor_le mult_nonneg_nonneg) ``` hoelzl@35582 ` 975` ``` hence less: "real (natfloor (f t * 2^n)) / 2^n \ f t" unfolding divide_le_eq by auto ``` hoelzl@35582 ` 976` hoelzl@35582 ` 977` ``` have "f t * 2 ^ n - 1 < real (natfloor (f t * 2^n))" using real_natfloor_gt_diff_one . ``` hoelzl@35582 ` 978` ``` hence "f t - real (natfloor (f t * 2^n)) / 2^n < 1 / 2^n" ``` hoelzl@35582 ` 979` ``` by (auto simp: less_divide_eq divide_less_eq algebra_simps) ``` hoelzl@35582 ` 980` ``` also have "... \ 1 / 2^?N" using `?N \ n` ``` hoelzl@35582 ` 981` ``` by (auto intro!: divide_left_mono mult_pos_pos simp del: power_Suc) ``` hoelzl@35582 ` 982` ``` also have "... < r" using less_r . ``` hoelzl@35582 ` 983` ``` finally show "norm (?w n t - f t) < r" using `f t < real n` less by auto ``` hoelzl@35582 ` 984` ``` qed ``` hoelzl@35582 ` 985` ``` qed ``` hoelzl@35582 ` 986` hoelzl@35582 ` 987` ``` fix n ``` hoelzl@35582 ` 988` ``` show "?x n \ psfis (?u n)" ``` hoelzl@35582 ` 989` ``` proof (rule psfis_intro) ``` hoelzl@35582 ` 990` ``` show "?A n ` ?I n \ sets M" ``` hoelzl@35582 ` 991` ``` proof safe ``` hoelzl@35582 ` 992` ``` fix i :: nat ``` hoelzl@35582 ` 993` ``` from Int[OF ``` hoelzl@35582 ` 994` ``` f_borel[unfolded borel_measurable_less_iff, rule_format, of "real (i+1) / 2^n"] ``` hoelzl@35582 ` 995` ``` f_borel[unfolded borel_measurable_ge_iff, rule_format, of "real i / 2^n"]] ``` hoelzl@35582 ` 996` ``` show "?A n i \ sets M" ``` hoelzl@35582 ` 997` ``` by (metis Collect_conj_eq Int_commute Int_left_absorb Int_left_commute) ``` hoelzl@35582 ` 998` ``` qed ``` hoelzl@35582 ` 999` ``` show "nonneg (\i :: nat. real i / 2 ^ n)" ``` hoelzl@35582 ` 1000` ``` unfolding nonneg_def by (auto intro!: divide_nonneg_pos) ``` hoelzl@35582 ` 1001` ``` qed auto ``` hoelzl@35582 ` 1002` ```qed ``` hoelzl@35582 ` 1003` hoelzl@35582 ` 1004` ```lemma nnfis_dom_conv: ``` hoelzl@35582 ` 1005` ``` assumes borel: "f \ borel_measurable M" ``` hoelzl@35582 ` 1006` ``` and nnfis: "b \ nnfis g" ``` hoelzl@35582 ` 1007` ``` and ord: "\t. t \ space M \ f t \ g t" ``` hoelzl@35582 ` 1008` ``` and nonneg: "\t. t \ space M \ 0 \ f t" ``` hoelzl@35582 ` 1009` ``` shows "\a. a \ nnfis f \ a \ b" ``` hoelzl@35582 ` 1010` ```proof - ``` hoelzl@35582 ` 1011` ``` obtain u x where mc_f: "mono_convergent u f (space M)" and ``` hoelzl@35582 ` 1012` ``` psfis: "\n. x n \ psfis (u n)" ``` hoelzl@35582 ` 1013` ``` using borel_measurable_mon_conv_psfis[OF borel nonneg] by auto ``` hoelzl@35582 ` 1014` hoelzl@35582 ` 1015` ``` { fix n ``` hoelzl@35582 ` 1016` ``` { fix t assume t: "t \ space M" ``` hoelzl@35582 ` 1017` ``` note mono_convergent_le[OF mc_f this, of n] ``` hoelzl@35582 ` 1018` ``` also note ord[OF t] ``` hoelzl@35582 ` 1019` ``` finally have "u n t \ g t" . } ``` hoelzl@35582 ` 1020` ``` from nnfis_mono[OF psfis_nnfis[OF psfis] nnfis this] ``` hoelzl@35582 ` 1021` ``` have "x n \ b" by simp } ``` hoelzl@35582 ` 1022` ``` note x_less_b = this ``` hoelzl@35582 ` 1023` hoelzl@35582 ` 1024` ``` have "convergent x" ``` hoelzl@35582 ` 1025` ``` proof (safe intro!: Bseq_mono_convergent) ``` hoelzl@35582 ` 1026` ``` from x_less_b pos_psfis[OF psfis] ``` hoelzl@35582 ` 1027` ``` show "Bseq x" by (auto intro!: BseqI'[of _ b]) ``` hoelzl@35582 ` 1028` hoelzl@35582 ` 1029` ``` fix n m :: nat assume *: "n \ m" ``` hoelzl@35582 ` 1030` ``` show "x n \ x m" ``` hoelzl@35582 ` 1031` ``` proof (rule psfis_mono[OF `x n \ psfis (u n)` `x m \ psfis (u m)`]) ``` hoelzl@35582 ` 1032` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 1033` ``` from mc_f[THEN mono_convergentD(1), unfolded incseq_def, OF this] ``` hoelzl@35582 ` 1034` ``` show "u n t \ u m t" using * by auto ``` hoelzl@35582 ` 1035` ``` qed ``` hoelzl@35582 ` 1036` ``` qed ``` hoelzl@35582 ` 1037` ``` then obtain a where "x ----> a" unfolding convergent_def by auto ``` hoelzl@35582 ` 1038` ``` with LIMSEQ_le_const2[OF `x ----> a`] x_less_b mc_f psfis ``` hoelzl@35582 ` 1039` ``` show ?thesis unfolding nnfis_def by auto ``` hoelzl@35582 ` 1040` ```qed ``` hoelzl@35582 ` 1041` hoelzl@35582 ` 1042` ```lemma the_nnfis[simp]: "a \ nnfis f \ (THE a. a \ nnfis f) = a" ``` hoelzl@35582 ` 1043` ``` by (auto intro: the_equality nnfis_unique) ``` hoelzl@35582 ` 1044` hoelzl@35582 ` 1045` ```lemma nnfis_cong: ``` hoelzl@35582 ` 1046` ``` assumes cong: "\x. x \ space M \ f x = g x" ``` hoelzl@35582 ` 1047` ``` shows "nnfis f = nnfis g" ``` hoelzl@35582 ` 1048` ```proof - ``` hoelzl@35582 ` 1049` ``` { fix f g :: "'a \ real" assume cong: "\x. x \ space M \ f x = g x" ``` hoelzl@35582 ` 1050` ``` fix x assume "x \ nnfis f" ``` hoelzl@35582 ` 1051` ``` then guess u y unfolding nnfis_def by safe note x = this ``` hoelzl@35582 ` 1052` ``` hence "mono_convergent u g (space M)" ``` hoelzl@35582 ` 1053` ``` unfolding mono_convergent_def using cong by auto ``` hoelzl@35582 ` 1054` ``` with x(2,3) have "x \ nnfis g" unfolding nnfis_def by auto } ``` hoelzl@35582 ` 1055` ``` from this[OF cong] this[OF cong[symmetric]] ``` hoelzl@35582 ` 1056` ``` show ?thesis by safe ``` hoelzl@35582 ` 1057` ```qed ``` hoelzl@35582 ` 1058` hoelzl@35692 ` 1059` ```section "Lebesgue Integral" ``` hoelzl@35692 ` 1060` hoelzl@35692 ` 1061` ```definition ``` hoelzl@35692 ` 1062` ``` "integrable f \ (\x. x \ nnfis (pos_part f)) \ (\y. y \ nnfis (neg_part f))" ``` hoelzl@35692 ` 1063` hoelzl@35692 ` 1064` ```definition ``` hoelzl@35692 ` 1065` ``` "integral f = (THE i :: real. i \ nnfis (pos_part f)) - (THE j. j \ nnfis (neg_part f))" ``` hoelzl@35692 ` 1066` hoelzl@35582 ` 1067` ```lemma integral_cong: ``` hoelzl@35582 ` 1068` ``` assumes cong: "\x. x \ space M \ f x = g x" ``` hoelzl@35582 ` 1069` ``` shows "integral f = integral g" ``` hoelzl@35582 ` 1070` ```proof - ``` hoelzl@35582 ` 1071` ``` have "nnfis (pos_part f) = nnfis (pos_part g)" ``` hoelzl@35582 ` 1072` ``` using cong by (auto simp: pos_part_def intro!: nnfis_cong) ``` hoelzl@35582 ` 1073` ``` moreover ``` hoelzl@35582 ` 1074` ``` have "nnfis (neg_part f) = nnfis (neg_part g)" ``` hoelzl@35582 ` 1075` ``` using cong by (auto simp: neg_part_def intro!: nnfis_cong) ``` hoelzl@35582 ` 1076` ``` ultimately show ?thesis ``` hoelzl@35582 ` 1077` ``` unfolding integral_def by auto ``` hoelzl@35582 ` 1078` ```qed ``` hoelzl@35582 ` 1079` hoelzl@35582 ` 1080` ```lemma nnfis_integral: ``` hoelzl@35582 ` 1081` ``` assumes "a \ nnfis f" ``` hoelzl@35582 ` 1082` ``` shows "integrable f" and "integral f = a" ``` hoelzl@35582 ` 1083` ```proof - ``` hoelzl@35582 ` 1084` ``` have a: "a \ nnfis (pos_part f)" ``` hoelzl@35582 ` 1085` ``` using assms nnfis_pos_on_mspace[OF assms] ``` hoelzl@35582 ` 1086` ``` by (auto intro!: nnfis_mon_conv[of "\i. f" _ "\i. a"] ``` hoelzl@35582 ` 1087` ``` LIMSEQ_const simp: mono_convergent_def pos_part_def incseq_def max_def) ``` hoelzl@35582 ` 1088` hoelzl@35582 ` 1089` ``` have "\t. t \ space M \ neg_part f t = 0" ``` hoelzl@35582 ` 1090` ``` unfolding neg_part_def min_def ``` hoelzl@35582 ` 1091` ``` using nnfis_pos_on_mspace[OF assms] by auto ``` hoelzl@35582 ` 1092` ``` hence 0: "0 \ nnfis (neg_part f)" ``` hoelzl@35582 ` 1093` ``` by (auto simp: nnfis_def mono_convergent_def psfis_0 incseq_def ``` hoelzl@35582 ` 1094` ``` intro!: LIMSEQ_const exI[of _ "\ x n. 0"] exI[of _ "\ n. 0"]) ``` hoelzl@35582 ` 1095` hoelzl@35582 ` 1096` ``` from 0 a show "integrable f" "integral f = a" ``` hoelzl@35582 ` 1097` ``` unfolding integrable_def integral_def by auto ``` hoelzl@35582 ` 1098` ```qed ``` hoelzl@35582 ` 1099` hoelzl@35582 ` 1100` ```lemma nnfis_minus_nnfis_integral: ``` hoelzl@35582 ` 1101` ``` assumes "a \ nnfis f" and "b \ nnfis g" ``` hoelzl@35582 ` 1102` ``` shows "integrable (\t. f t - g t)" and "integral (\t. f t - g t) = a - b" ``` hoelzl@35582 ` 1103` ```proof - ``` hoelzl@35582 ` 1104` ``` have borel: "(\t. f t - g t) \ borel_measurable M" using assms ``` hoelzl@35582 ` 1105` ``` by (blast intro: ``` hoelzl@35582 ` 1106` ``` borel_measurable_diff_borel_measurable nnfis_borel_measurable) ``` hoelzl@35582 ` 1107` hoelzl@35582 ` 1108` ``` have "\x. x \ nnfis (pos_part (\t. f t - g t)) \ x \ a + b" ``` hoelzl@35582 ` 1109` ``` (is "\x. x \ nnfis ?pp \ _") ``` hoelzl@35582 ` 1110` ``` proof (rule nnfis_dom_conv) ``` hoelzl@35582 ` 1111` ``` show "?pp \ borel_measurable M" ``` hoelzl@35692 ` 1112` ``` using borel by (rule pos_part_borel_measurable neg_part_borel_measurable) ``` hoelzl@35582 ` 1113` ``` show "a + b \ nnfis (\t. f t + g t)" using assms by (rule nnfis_add) ``` hoelzl@35582 ` 1114` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 1115` ``` with assms nnfis_add assms[THEN nnfis_pos_on_mspace[OF _ this]] ``` hoelzl@35582 ` 1116` ``` show "?pp t \ f t + g t" unfolding pos_part_def by auto ``` hoelzl@35582 ` 1117` ``` show "0 \ ?pp t" using nonneg_pos_part[of "\t. f t - g t"] ``` hoelzl@35582 ` 1118` ``` unfolding nonneg_def by auto ``` hoelzl@35582 ` 1119` ``` qed ``` hoelzl@35582 ` 1120` ``` then obtain x where x: "x \ nnfis ?pp" by auto ``` hoelzl@35582 ` 1121` ``` moreover ``` hoelzl@35582 ` 1122` ``` have "\x. x \ nnfis (neg_part (\t. f t - g t)) \ x \ a + b" ``` hoelzl@35582 ` 1123` ``` (is "\x. x \ nnfis ?np \ _") ``` hoelzl@35582 ` 1124` ``` proof (rule nnfis_dom_conv) ``` hoelzl@35582 ` 1125` ``` show "?np \ borel_measurable M" ``` hoelzl@35692 ` 1126` ``` using borel by (rule pos_part_borel_measurable neg_part_borel_measurable) ``` hoelzl@35582 ` 1127` ``` show "a + b \ nnfis (\t. f t + g t)" using assms by (rule nnfis_add) ``` hoelzl@35582 ` 1128` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 1129` ``` with assms nnfis_add assms[THEN nnfis_pos_on_mspace[OF _ this]] ``` hoelzl@35582 ` 1130` ``` show "?np t \ f t + g t" unfolding neg_part_def by auto ``` hoelzl@35582 ` 1131` ``` show "0 \ ?np t" using nonneg_neg_part[of "\t. f t - g t"] ``` hoelzl@35582 ` 1132` ``` unfolding nonneg_def by auto ``` hoelzl@35582 ` 1133` ``` qed ``` hoelzl@35582 ` 1134` ``` then obtain y where y: "y \ nnfis ?np" by auto ``` hoelzl@35582 ` 1135` ``` ultimately show "integrable (\t. f t - g t)" ``` hoelzl@35582 ` 1136` ``` unfolding integrable_def by auto ``` hoelzl@35582 ` 1137` hoelzl@35582 ` 1138` ``` from x and y ``` hoelzl@35582 ` 1139` ``` have "a + y \ nnfis (\t. f t + ?np t)" ``` hoelzl@35582 ` 1140` ``` and "b + x \ nnfis (\t. g t + ?pp t)" using assms by (auto intro: nnfis_add) ``` hoelzl@35582 ` 1141` ``` moreover ``` hoelzl@35582 ` 1142` ``` have "\t. f t + ?np t = g t + ?pp t" ``` hoelzl@35582 ` 1143` ``` unfolding pos_part_def neg_part_def by auto ``` hoelzl@35582 ` 1144` ``` ultimately have "a - b = x - y" ``` hoelzl@35582 ` 1145` ``` using nnfis_unique by (auto simp: algebra_simps) ``` hoelzl@35582 ` 1146` ``` thus "integral (\t. f t - g t) = a - b" ``` hoelzl@35582 ` 1147` ``` unfolding integral_def ``` hoelzl@35582 ` 1148` ``` using the_nnfis[OF x] the_nnfis[OF y] by simp ``` hoelzl@35582 ` 1149` ```qed ``` hoelzl@35582 ` 1150` hoelzl@35582 ` 1151` ```lemma integral_borel_measurable: ``` hoelzl@35582 ` 1152` ``` "integrable f \ f \ borel_measurable M" ``` hoelzl@35582 ` 1153` ``` unfolding integrable_def ``` hoelzl@35582 ` 1154` ``` by (subst pos_part_neg_part_borel_measurable_iff) ``` hoelzl@35582 ` 1155` ``` (auto intro: nnfis_borel_measurable) ``` hoelzl@35582 ` 1156` hoelzl@35582 ` 1157` ```lemma integral_indicator_fn: ``` hoelzl@35582 ` 1158` ``` assumes "a \ sets M" ``` hoelzl@35582 ` 1159` ``` shows "integral (indicator_fn a) = measure M a" ``` hoelzl@35582 ` 1160` ``` and "integrable (indicator_fn a)" ``` hoelzl@35582 ` 1161` ``` using psfis_indicator[OF assms, THEN psfis_nnfis] ``` hoelzl@35582 ` 1162` ``` by (auto intro!: nnfis_integral) ``` hoelzl@35582 ` 1163` hoelzl@35582 ` 1164` ```lemma integral_add: ``` hoelzl@35582 ` 1165` ``` assumes "integrable f" and "integrable g" ``` hoelzl@35582 ` 1166` ``` shows "integrable (\t. f t + g t)" ``` hoelzl@35582 ` 1167` ``` and "integral (\t. f t + g t) = integral f + integral g" ``` hoelzl@35582 ` 1168` ```proof - ``` hoelzl@35582 ` 1169` ``` { fix t ``` hoelzl@35582 ` 1170` ``` have "pos_part f t + pos_part g t - (neg_part f t + neg_part g t) = ``` hoelzl@35582 ` 1171` ``` f t + g t" ``` hoelzl@35582 ` 1172` ``` unfolding pos_part_def neg_part_def by auto } ``` hoelzl@35582 ` 1173` ``` note part_sum = this ``` hoelzl@35582 ` 1174` hoelzl@35582 ` 1175` ``` from assms obtain a b c d where ``` hoelzl@35582 ` 1176` ``` a: "a \ nnfis (pos_part f)" and b: "b \ nnfis (neg_part f)" and ``` hoelzl@35582 ` 1177` ``` c: "c \ nnfis (pos_part g)" and d: "d \ nnfis (neg_part g)" ``` hoelzl@35582 ` 1178` ``` unfolding integrable_def by auto ``` hoelzl@35582 ` 1179` ``` note sums = nnfis_add[OF a c] nnfis_add[OF b d] ``` hoelzl@35582 ` 1180` ``` note int = nnfis_minus_nnfis_integral[OF sums, unfolded part_sum] ``` hoelzl@35582 ` 1181` hoelzl@35582 ` 1182` ``` show "integrable (\t. f t + g t)" using int(1) . ``` hoelzl@35582 ` 1183` hoelzl@35582 ` 1184` ``` show "integral (\t. f t + g t) = integral f + integral g" ``` hoelzl@35582 ` 1185` ``` using int(2) sums a b c d by (simp add: the_nnfis integral_def) ``` hoelzl@35582 ` 1186` ```qed ``` hoelzl@35582 ` 1187` hoelzl@35582 ` 1188` ```lemma integral_mono: ``` hoelzl@35582 ` 1189` ``` assumes "integrable f" and "integrable g" ``` hoelzl@35582 ` 1190` ``` and mono: "\t. t \ space M \ f t \ g t" ``` hoelzl@35582 ` 1191` ``` shows "integral f \ integral g" ``` hoelzl@35582 ` 1192` ```proof - ``` hoelzl@35582 ` 1193` ``` from assms obtain a b c d where ``` hoelzl@35582 ` 1194` ``` a: "a \ nnfis (pos_part f)" and b: "b \ nnfis (neg_part f)" and ``` hoelzl@35582 ` 1195` ``` c: "c \ nnfis (pos_part g)" and d: "d \ nnfis (neg_part g)" ``` hoelzl@35582 ` 1196` ``` unfolding integrable_def by auto ``` hoelzl@35582 ` 1197` hoelzl@35582 ` 1198` ``` have "a \ c" ``` hoelzl@35582 ` 1199` ``` proof (rule nnfis_mono[OF a c]) ``` hoelzl@35582 ` 1200` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 1201` ``` from mono[OF this] show "pos_part f t \ pos_part g t" ``` hoelzl@35582 ` 1202` ``` unfolding pos_part_def by auto ``` hoelzl@35582 ` 1203` ``` qed ``` hoelzl@35582 ` 1204` ``` moreover have "d \ b" ``` hoelzl@35582 ` 1205` ``` proof (rule nnfis_mono[OF d b]) ``` hoelzl@35582 ` 1206` ``` fix t assume "t \ space M" ``` hoelzl@35582 ` 1207` ``` from mono[OF this] show "neg_part g t \ neg_part f t" ``` hoelzl@35582 ` 1208` ``` unfolding neg_part_def by auto ``` hoelzl@35582 ` 1209` ``` qed ``` hoelzl@35582 ` 1210` ``` ultimately have "a - b \ c - d" by auto ``` hoelzl@35582 ` 1211` ``` thus ?thesis unfolding integral_def ``` hoelzl@35582 ` 1212` ``` using a b c d by (simp add: the_nnfis) ``` hoelzl@35582 ` 1213` ```qed ``` hoelzl@35582 ` 1214` hoelzl@35582 ` 1215` ```lemma integral_uminus: ``` hoelzl@35582 ` 1216` ``` assumes "integrable f" ``` hoelzl@35582 ` 1217` ``` shows "integrable (\t. - f t)" ``` hoelzl@35582 ` 1218` ``` and "integral (\t. - f t) = - integral f" ``` hoelzl@35582 ` 1219` ```proof - ``` hoelzl@35582 ` 1220` ``` have "pos_part f = neg_part (\t.-f t)" and "neg_part f = pos_part (\t.-f t)" ``` hoelzl@35582 ` 1221` ``` unfolding pos_part_def neg_part_def by (auto intro!: ext) ``` hoelzl@35582 ` 1222` ``` with assms show "integrable (\t.-f t)" and "integral (\t.-f t) = -integral f" ``` hoelzl@35582 ` 1223` ``` unfolding integrable_def integral_def by simp_all ``` hoelzl@35582 ` 1224` ```qed ``` hoelzl@35582 ` 1225` hoelzl@35582 ` 1226` ```lemma integral_times_const: ``` hoelzl@35582 ` 1227` ``` assumes "integrable f" ``` hoelzl@35582 ` 1228` ``` shows "integrable (\t. a * f t)" (is "?P a") ``` hoelzl@35582 ` 1229` ``` and "integral (\t. a * f t) = a * integral f" (is "?I a") ``` hoelzl@35582 ` 1230` ```proof - ``` hoelzl@35582 ` 1231` ``` { fix a :: real assume "0 \ a" ``` hoelzl@35582 ` 1232` ``` hence "pos_part (\t. a * f t) = (\t. a * pos_part f t)" ``` hoelzl@35582 ` 1233` ``` and "neg_part (\t. a * f t) = (\t. a * neg_part f t)" ``` hoelzl@35582 ` 1234` ``` unfolding pos_part_def neg_part_def max_def min_def ``` hoelzl@35582 ` 1235` ``` by (auto intro!: ext simp: zero_le_mult_iff) ``` hoelzl@35582 ` 1236` ``` moreover ``` hoelzl@35582 ` 1237` ``` obtain x y where x: "x \ nnfis (pos_part f)" and y: "y \ nnfis (neg_part f)" ``` hoelzl@35582 ` 1238` ``` using assms unfolding integrable_def by auto ``` hoelzl@35582 ` 1239` ``` ultimately ``` hoelzl@35582 ` 1240` ``` have "a * x \ nnfis (pos_part (\t. a * f t))" and ``` hoelzl@35582 ` 1241` ``` "a * y \ nnfis (neg_part (\t. a * f t))" ``` hoelzl@35582 ` 1242` ``` using nnfis_times[OF _ `0 \ a`] by auto ``` hoelzl@35582 ` 1243` ``` with x y have "?P a \ ?I a" ``` hoelzl@35582 ` 1244` ``` unfolding integrable_def integral_def by (auto simp: algebra_simps) } ``` hoelzl@35582 ` 1245` ``` note int = this ``` hoelzl@35582 ` 1246` hoelzl@35582 ` 1247` ``` have "?P a \ ?I a" ``` hoelzl@35582 ` 1248` ``` proof (cases "0 \ a") ``` hoelzl@35582 ` 1249` ``` case True from int[OF this] show ?thesis . ``` hoelzl@35582 ` 1250` ``` next ``` hoelzl@35582 ` 1251` ``` case False with int[of "- a"] integral_uminus[of "\t. - a * f t"] ``` hoelzl@35582 ` 1252` ``` show ?thesis by auto ``` hoelzl@35582 ` 1253` ``` qed ``` hoelzl@35582 ` 1254` ``` thus "integrable (\t. a * f t)" ``` hoelzl@35582 ` 1255` ``` and "integral (\t. a * f t) = a * integral f" by simp_all ``` hoelzl@35582 ` 1256` ```qed ``` hoelzl@35582 ` 1257` hoelzl@35582 ` 1258` ```lemma integral_cmul_indicator: ``` hoelzl@35582 ` 1259` ``` assumes "s \ sets M" ``` hoelzl@35582 ` 1260` ``` shows "integral (\x. c * indicator_fn s x) = c * (measure M s)" ``` hoelzl@35582 ` 1261` ``` and "integrable (\x. c * indicator_fn s x)" ``` hoelzl@35582 ` 1262` ```using assms integral_times_const integral_indicator_fn by auto ``` hoelzl@35582 ` 1263` hoelzl@35582 ` 1264` ```lemma integral_zero: ``` hoelzl@35582 ` 1265` ``` shows "integral (\x. 0) = 0" ``` hoelzl@35582 ` 1266` ``` and "integrable (\x. 0)" ``` hoelzl@35582 ` 1267` ``` using integral_cmul_indicator[OF empty_sets, of 0] ``` hoelzl@35582 ` 1268` ``` unfolding indicator_fn_def by auto ``` hoelzl@35582 ` 1269` hoelzl@35582 ` 1270` ```lemma integral_setsum: ``` hoelzl@35582 ` 1271` ``` assumes "finite S" ``` hoelzl@35582 ` 1272` ``` assumes "\n. n \ S \ integrable (f n)" ``` hoelzl@35582 ` 1273` ``` shows "integral (\x. \ i \ S. f i x) = (\ i \ S. integral (f i))" (is "?int S") ``` hoelzl@35582 ` 1274` ``` and "integrable (\x. \ i \ S. f i x)" (is "?I s") ``` hoelzl@35582 ` 1275` ```proof - ``` hoelzl@35582 ` 1276` ``` from assms have "?int S \ ?I S" ``` hoelzl@35582 ` 1277` ``` proof (induct S) ``` hoelzl@35582 ` 1278` ``` case empty thus ?case by (simp add: integral_zero) ``` hoelzl@35582 ` 1279` ``` next ``` hoelzl@35582 ` 1280` ``` case (insert i S) ``` hoelzl@35582 ` 1281` ``` thus ?case ``` hoelzl@35582 ` 1282` ``` apply simp ``` hoelzl@35582 ` 1283` ``` apply (subst integral_add) ``` hoelzl@35582 ` 1284` ``` using assms apply auto ``` hoelzl@35582 ` 1285` ``` apply (subst integral_add) ``` hoelzl@35582 ` 1286` ``` using assms by auto ``` hoelzl@35582 ` 1287` ``` qed ``` hoelzl@35582 ` 1288` ``` thus "?int S" and "?I S" by auto ``` hoelzl@35582 ` 1289` ```qed ``` hoelzl@35582 ` 1290` hoelzl@36624 ` 1291` ```lemma (in measure_space) integrable_abs: ``` hoelzl@36624 ` 1292` ``` assumes "integrable f" ``` hoelzl@36624 ` 1293` ``` shows "integrable (\ x. \f x\)" ``` hoelzl@36624 ` 1294` ```using assms ``` hoelzl@36624 ` 1295` ```proof - ``` hoelzl@36624 ` 1296` ``` from assms obtain p q where pq: "p \ nnfis (pos_part f)" "q \ nnfis (neg_part f)" ``` hoelzl@36624 ` 1297` ``` unfolding integrable_def by auto ``` hoelzl@36624 ` 1298` ``` hence "p + q \ nnfis (\ x. pos_part f x + neg_part f x)" ``` hoelzl@36624 ` 1299` ``` using nnfis_add by auto ``` hoelzl@36624 ` 1300` ``` hence "p + q \ nnfis (\ x. \f x\)" using pos_neg_part_abs[of f] by simp ``` hoelzl@36624 ` 1301` ``` thus ?thesis unfolding integrable_def ``` hoelzl@36624 ` 1302` ``` using ext[OF pos_part_abs[of f], of "\ y. y"] ``` hoelzl@36624 ` 1303` ``` ext[OF neg_part_abs[of f], of "\ y. y"] ``` hoelzl@36624 ` 1304` ``` using nnfis_0 by auto ``` hoelzl@36624 ` 1305` ```qed ``` hoelzl@36624 ` 1306` hoelzl@35582 ` 1307` ```lemma markov_ineq: ``` hoelzl@35582 ` 1308` ``` assumes "integrable f" "0 < a" "integrable (\x. \f x\^n)" ``` hoelzl@35582 ` 1309` ``` shows "measure M (f -` {a ..} \ space M) \ integral (\x. \f x\^n) / a^n" ``` hoelzl@35582 ` 1310` ```using assms ``` hoelzl@35582 ` 1311` ```proof - ``` hoelzl@35582 ` 1312` ``` from assms have "0 < a ^ n" using real_root_pow_pos by auto ``` hoelzl@35582 ` 1313` ``` from assms have "f \ borel_measurable M" ``` hoelzl@35582 ` 1314` ``` using integral_borel_measurable[OF `integrable f`] by auto ``` hoelzl@35582 ` 1315` ``` hence w: "{w . w \ space M \ a \ f w} \ sets M" ``` hoelzl@35582 ` 1316` ``` using borel_measurable_ge_iff by auto ``` hoelzl@35582 ` 1317` ``` have i: "integrable (indicator_fn {w . w \ space M \ a \ f w})" ``` hoelzl@35582 ` 1318` ``` using integral_indicator_fn[OF w] by simp ``` hoelzl@35582 ` 1319` ``` have v1: "\ t. a ^ n * (indicator_fn {w . w \ space M \ a \ f w}) t ``` hoelzl@35582 ` 1320` ``` \ (f t) ^ n * (indicator_fn {w . w \ space M \ a \ f w}) t" ``` hoelzl@35582 ` 1321` ``` unfolding indicator_fn_def ``` hoelzl@35582 ` 1322` ``` using `0 < a` power_mono[of a] assms by auto ``` hoelzl@35582 ` 1323` ``` have v2: "\ t. (f t) ^ n * (indicator_fn {w . w \ space M \ a \ f w}) t \ \f t\ ^ n" ``` hoelzl@35582 ` 1324` ``` unfolding indicator_fn_def ``` hoelzl@35582 ` 1325` ``` using power_mono[of a _ n] abs_ge_self `a > 0` ``` hoelzl@35582 ` 1326` ``` by auto ``` hoelzl@35582 ` 1327` ``` have "{w \ space M. a \ f w} \ space M = {w . a \ f w} \ space M" ``` hoelzl@35582 ` 1328` ``` using Collect_eq by auto ``` hoelzl@35582 ` 1329` ``` from Int_absorb2[OF sets_into_space[OF w]] `0 < a ^ n` sets_into_space[OF w] w this ``` hoelzl@35582 ` 1330` ``` have "(a ^ n) * (measure M ((f -` {y . a \ y}) \ space M)) = ``` hoelzl@35582 ` 1331` ``` (a ^ n) * measure M {w . w \ space M \ a \ f w}" ``` hoelzl@35582 ` 1332` ``` unfolding vimage_Collect_eq[of f] by simp ``` hoelzl@35582 ` 1333` ``` also have "\ = integral (\ t. a ^ n * (indicator_fn {w . w \ space M \ a \ f w}) t)" ``` hoelzl@35582 ` 1334` ``` using integral_cmul_indicator[OF w] i by auto ``` hoelzl@35582 ` 1335` ``` also have "\ \ integral (\ t. \ f t \ ^ n)" ``` hoelzl@35582 ` 1336` ``` apply (rule integral_mono) ``` hoelzl@35582 ` 1337` ``` using integral_cmul_indicator[OF w] ``` hoelzl@35582 ` 1338` ``` `integrable (\ x. \f x\ ^ n)` real_le_trans[OF v1 v2] by auto ``` hoelzl@35582 ` 1339` ``` finally show "measure M (f -` {a ..} \ space M) \ integral (\x. \f x\^n) / a^n" ``` hoelzl@35582 ` 1340` ``` unfolding atLeast_def ``` hoelzl@35582 ` 1341` ``` by (auto intro!: mult_imp_le_div_pos[OF `0 < a ^ n`], simp add: real_mult_commute) ``` hoelzl@35582 ` 1342` ```qed ``` hoelzl@35582 ` 1343` hoelzl@36624 ` 1344` ```lemma (in measure_space) integral_0: ``` hoelzl@36624 ` 1345` ``` fixes f :: "'a \ real" ``` hoelzl@36624 ` 1346` ``` assumes "integrable f" "integral f = 0" "nonneg f" and borel: "f \ borel_measurable M" ``` hoelzl@36624 ` 1347` ``` shows "measure M ({x. f x \ 0} \ space M) = 0" ``` hoelzl@36624 ` 1348` ```proof - ``` hoelzl@36624 ` 1349` ``` have "{x. f x \ 0} = {x. \f x\ > 0}" by auto ``` hoelzl@36624 ` 1350` ``` moreover ``` hoelzl@36624 ` 1351` ``` { fix y assume "y \ {x. \ f x \ > 0}" ``` hoelzl@36624 ` 1352` ``` hence "\ f y \ > 0" by auto ``` hoelzl@36624 ` 1353` ``` hence "\ n. \f y\ \ inverse (real (Suc n))" ``` hoelzl@36624 ` 1354` ``` using ex_inverse_of_nat_Suc_less[of "\f y\"] less_imp_le unfolding real_of_nat_def by auto ``` hoelzl@36624 ` 1355` ``` hence "y \ (\ n. {x. \f x\ \ inverse (real (Suc n))})" ``` hoelzl@36624 ` 1356` ``` by auto } ``` hoelzl@36624 ` 1357` ``` moreover ``` hoelzl@36624 ` 1358` ``` { fix y assume "y \ (\ n. {x. \f x\ \ inverse (real (Suc n))})" ``` hoelzl@36624 ` 1359` ``` then obtain n where n: "y \ {x. \f x\ \ inverse (real (Suc n))}" by auto ``` hoelzl@36624 ` 1360` ``` hence "\f y\ \ inverse (real (Suc n))" by auto ``` hoelzl@36624 ` 1361` ``` hence "\f y\ > 0" ``` hoelzl@36624 ` 1362` ``` using real_of_nat_Suc_gt_zero ``` hoelzl@36624 ` 1363` ``` positive_imp_inverse_positive[of "real_of_nat (Suc n)"] by fastsimp ``` hoelzl@36624 ` 1364` ``` hence "y \ {x. \f x\ > 0}" by auto } ``` hoelzl@36624 ` 1365` ``` ultimately have fneq0_UN: "{x. f x \ 0} = (\ n. {x. \f x\ \ inverse (real (Suc n))})" ``` hoelzl@36624 ` 1366` ``` by blast ``` hoelzl@36624 ` 1367` ``` { fix n ``` hoelzl@36624 ` 1368` ``` have int_one: "integrable (\ x. \f x\ ^ 1)" using integrable_abs assms by auto ``` hoelzl@36624 ` 1369` ``` have "measure M (f -` {inverse (real (Suc n))..} \ space M) ``` hoelzl@36624 ` 1370` ``` \ integral (\ x. \f x\ ^ 1) / (inverse (real (Suc n)) ^ 1)" ``` hoelzl@36624 ` 1371` ``` using markov_ineq[OF `integrable f` _ int_one] real_of_nat_Suc_gt_zero by auto ``` hoelzl@36624 ` 1372` ``` hence le0: "measure M (f -` {inverse (real (Suc n))..} \ space M) \ 0" ``` hoelzl@36624 ` 1373` ``` using assms unfolding nonneg_def by auto ``` hoelzl@36624 ` 1374` ``` have "{x. f x \ inverse (real (Suc n))} \ space M \ sets M" ``` hoelzl@36624 ` 1375` ``` apply (subst Int_commute) unfolding Int_def ``` hoelzl@36624 ` 1376` ``` using borel[unfolded borel_measurable_ge_iff] by simp ``` hoelzl@36624 ` 1377` ``` hence m0: "measure M ({x. f x \ inverse (real (Suc n))} \ space M) = 0 \ ``` hoelzl@36624 ` 1378` ``` {x. f x \ inverse (real (Suc n))} \ space M \ sets M" ``` hoelzl@36624 ` 1379` ``` using positive le0 unfolding atLeast_def by fastsimp } ``` hoelzl@36624 ` 1380` ``` moreover hence "range (\ n. {x. f x \ inverse (real (Suc n))} \ space M) \ sets M" ``` hoelzl@36624 ` 1381` ``` by auto ``` hoelzl@36624 ` 1382` ``` moreover ``` hoelzl@36624 ` 1383` ``` { fix n ``` hoelzl@36624 ` 1384` ``` have "inverse (real (Suc n)) \ inverse (real (Suc (Suc n)))" ``` hoelzl@36624 ` 1385` ``` using less_imp_inverse_less real_of_nat_Suc_gt_zero[of n] by fastsimp ``` hoelzl@36624 ` 1386` ``` hence "\ x. f x \ inverse (real (Suc n)) \ f x \ inverse (real (Suc (Suc n)))" by (rule order_trans) ``` hoelzl@36624 ` 1387` ``` hence "{x. f x \ inverse (real (Suc n))} \ space M ``` hoelzl@36624 ` 1388` ``` \ {x. f x \ inverse (real (Suc (Suc n)))} \ space M" by auto } ``` hoelzl@36624 ` 1389` ``` ultimately have "(\ x. 0) ----> measure M (\ n. {x. f x \ inverse (real (Suc n))} \ space M)" ``` hoelzl@36624 ` 1390` ``` using monotone_convergence[of "\ n. {x. f x \ inverse (real (Suc n))} \ space M"] ``` hoelzl@36624 ` 1391` ``` unfolding o_def by (simp del: of_nat_Suc) ``` hoelzl@36624 ` 1392` ``` hence "measure M (\ n. {x. f x \ inverse (real (Suc n))} \ space M) = 0" ``` hoelzl@36624 ` 1393` ``` using LIMSEQ_const[of 0] LIMSEQ_unique by simp ``` hoelzl@36624 ` 1394` ``` hence "measure M ((\ n. {x. \f x\ \ inverse (real (Suc n))}) \ space M) = 0" ``` hoelzl@36624 ` 1395` ``` using assms unfolding nonneg_def by auto ``` hoelzl@36624 ` 1396` ``` thus "measure M ({x. f x \ 0} \ space M) = 0" using fneq0_UN by simp ``` hoelzl@36624 ` 1397` ```qed ``` hoelzl@36624 ` 1398` hoelzl@35748 ` 1399` ```section "Lebesgue integration on countable spaces" ``` hoelzl@35748 ` 1400` hoelzl@35748 ` 1401` ```lemma nnfis_on_countable: ``` hoelzl@35748 ` 1402` ``` assumes borel: "f \ borel_measurable M" ``` hoelzl@35748 ` 1403` ``` and bij: "bij_betw enum S (f ` space M - {0})" ``` hoelzl@35748 ` 1404` ``` and enum_zero: "enum ` (-S) \ {0}" ``` hoelzl@35748 ` 1405` ``` and nn_enum: "\n. 0 \ enum n" ``` hoelzl@35748 ` 1406` ``` and sums: "(\r. enum r * measure M (f -` {enum r} \ space M)) sums x" (is "?sum sums x") ``` hoelzl@35748 ` 1407` ``` shows "x \ nnfis f" ``` hoelzl@35748 ` 1408` ```proof - ``` hoelzl@35748 ` 1409` ``` have inj_enum: "inj_on enum S" ``` hoelzl@35748 ` 1410` ``` and range_enum: "enum ` S = f ` space M - {0}" ``` hoelzl@35748 ` 1411` ``` using bij by (auto simp: bij_betw_def) ``` hoelzl@35748 ` 1412` hoelzl@35748 ` 1413` ``` let "?x n z" = "\i = 0.. space M) z" ``` hoelzl@35748 ` 1414` hoelzl@35748 ` 1415` ``` show ?thesis ``` hoelzl@35748 ` 1416` ``` proof (rule nnfis_mon_conv) ``` hoelzl@35748 ` 1417` ``` show "(\n. \i = 0.. x" using sums unfolding sums_def . ``` hoelzl@35748 ` 1418` ``` next ``` hoelzl@35748 ` 1419` ``` fix n ``` hoelzl@35748 ` 1420` ``` show "(\i = 0.. nnfis (?x n)" ``` hoelzl@35748 ` 1421` ``` proof (induct n) ``` hoelzl@35748 ` 1422` ``` case 0 thus ?case by (simp add: nnfis_0) ``` hoelzl@35748 ` 1423` ``` next ``` hoelzl@35748 ` 1424` ``` case (Suc n) thus ?case using nn_enum ``` hoelzl@35748 ` 1425` ``` by (auto intro!: nnfis_add nnfis_times psfis_nnfis[OF psfis_indicator] borel_measurable_vimage[OF borel]) ``` hoelzl@35748 ` 1426` ``` qed ``` hoelzl@35748 ` 1427` ``` next ``` hoelzl@35748 ` 1428` ``` show "mono_convergent ?x f (space M)" ``` hoelzl@35748 ` 1429` ``` proof (rule mono_convergentI) ``` hoelzl@35748 ` 1430` ``` fix x ``` hoelzl@35748 ` 1431` ``` show "incseq (\n. ?x n x)" ``` hoelzl@35748 ` 1432` ``` by (rule incseq_SucI, auto simp: indicator_fn_def nn_enum) ``` hoelzl@35748 ` 1433` hoelzl@35748 ` 1434` ``` have fin: "\n. finite (enum ` ({0.. S))" by auto ``` hoelzl@35748 ` 1435` hoelzl@35748 ` 1436` ``` assume "x \ space M" ``` hoelzl@35748 ` 1437` ``` hence "f x \ enum ` S \ f x = 0" using range_enum by auto ``` hoelzl@35748 ` 1438` ``` thus "(\n. ?x n x) ----> f x" ``` hoelzl@35748 ` 1439` ``` proof (rule disjE) ``` hoelzl@35748 ` 1440` ``` assume "f x \ enum ` S" ``` hoelzl@35748 ` 1441` ``` then obtain i where "i \ S" and "f x = enum i" by auto ``` hoelzl@35748 ` 1442` hoelzl@35748 ` 1443` ``` { fix n ``` hoelzl@35748 ` 1444` ``` have sum_ranges: ``` hoelzl@35748 ` 1445` ``` "i < n \ enum`({0.. S) \ {z. enum i = z \ x\space M} = {enum i}" ``` hoelzl@35748 ` 1446` ``` "\ i < n \ enum`({0.. S) \ {z. enum i = z \ x\space M} = {}" ``` hoelzl@35748 ` 1447` ``` using `x \ space M` `i \ S` inj_enum[THEN inj_on_iff] by auto ``` hoelzl@35748 ` 1448` ``` have "?x n x = ``` hoelzl@35748 ` 1449` ``` (\i \ {0.. S. enum i * indicator_fn (f -` {enum i} \ space M) x)" ``` hoelzl@35748 ` 1450` ``` using enum_zero by (auto intro!: setsum_mono_zero_cong_right) ``` hoelzl@35748 ` 1451` ``` also have "... = ``` hoelzl@35748 ` 1452` ``` (\z \ enum`({0.. S). z * indicator_fn (f -` {z} \ space M) x)" ``` hoelzl@35748 ` 1453` ``` using inj_enum[THEN subset_inj_on] by (auto simp: setsum_reindex) ``` hoelzl@35748 ` 1454` ``` also have "... = (if i < n then f x else 0)" ``` hoelzl@35748 ` 1455` ``` unfolding indicator_fn_def if_distrib[where x=1 and y=0] ``` hoelzl@35748 ` 1456` ``` setsum_cases[OF fin] ``` hoelzl@35748 ` 1457` ``` using sum_ranges `f x = enum i` ``` hoelzl@35748 ` 1458` ``` by auto ``` hoelzl@35748 ` 1459` ``` finally have "?x n x = (if i < n then f x else 0)" . } ``` hoelzl@35748 ` 1460` ``` note sum_equals_if = this ``` hoelzl@35748 ` 1461` hoelzl@35748 ` 1462` ``` show ?thesis unfolding sum_equals_if ``` hoelzl@35748 ` 1463` ``` by (rule LIMSEQ_offset[where k="i + 1"]) (auto intro!: LIMSEQ_const) ``` hoelzl@35748 ` 1464` ``` next ``` hoelzl@35748 ` 1465` ``` assume "f x = 0" ``` hoelzl@35748 ` 1466` ``` { fix n have "?x n x = 0" ``` hoelzl@35748 ` 1467` ``` unfolding indicator_fn_def if_distrib[where x=1 and y=0] ``` hoelzl@35748 ` 1468` ``` setsum_cases[OF finite_atLeastLessThan] ``` hoelzl@35748 ` 1469` ``` using `f x = 0` `x \ space M` ``` hoelzl@35748 ` 1470` ``` by (auto split: split_if) } ``` hoelzl@35748 ` 1471` ``` thus ?thesis using `f x = 0` by (auto intro!: LIMSEQ_const) ``` hoelzl@35748 ` 1472` ``` qed ``` hoelzl@35748 ` 1473` ``` qed ``` hoelzl@35748 ` 1474` ``` qed ``` hoelzl@35748 ` 1475` ```qed ``` hoelzl@35748 ` 1476` hoelzl@35748 ` 1477` ```lemma integral_on_countable: ``` hoelzl@35833 ` 1478` ``` fixes enum :: "nat \ real" ``` hoelzl@35748 ` 1479` ``` assumes borel: "f \ borel_measurable M" ``` hoelzl@35748 ` 1480` ``` and bij: "bij_betw enum S (f ` space M)" ``` hoelzl@35748 ` 1481` ``` and enum_zero: "enum ` (-S) \ {0}" ``` hoelzl@35748 ` 1482` ``` and abs_summable: "summable (\r. \enum r * measure M (f -` {enum r} \ space M)\)" ``` hoelzl@35748 ` 1483` ``` shows "integrable f" ``` hoelzl@35748 ` 1484` ``` and "integral f = (\r. enum r * measure M (f -` {enum r} \ space M))" (is "_ = suminf (?sum f enum)") ``` hoelzl@35748 ` 1485` ```proof - ``` hoelzl@35748 ` 1486` ``` { fix f enum ``` hoelzl@35748 ` 1487` ``` assume borel: "f \ borel_measurable M" ``` hoelzl@35748 ` 1488` ``` and bij: "bij_betw enum S (f ` space M)" ``` hoelzl@35748 ` 1489` ``` and enum_zero: "enum ` (-S) \ {0}" ``` hoelzl@35748 ` 1490` ``` and abs_summable: "summable (\r. \enum r * measure M (f -` {enum r} \ space M)\)" ``` hoelzl@35748 ` 1491` ``` have inj_enum: "inj_on enum S" and range_enum: "f ` space M = enum ` S" ``` hoelzl@35748 ` 1492` ``` using bij unfolding bij_betw_def by auto ``` hoelzl@35748 ` 1493` hoelzl@35748 ` 1494` ``` have [simp, intro]: "\X. 0 \ measure M (f -` {X} \ space M)" ``` hoelzl@35748 ` 1495` ``` by (rule positive, rule borel_measurable_vimage[OF borel]) ``` hoelzl@35748 ` 1496` hoelzl@35748 ` 1497` ``` have "(\r. ?sum (pos_part f) (pos_part enum) r) \ nnfis (pos_part f) \ ``` hoelzl@35748 ` 1498` ``` summable (\r. ?sum (pos_part f) (pos_part enum) r)" ``` hoelzl@35748 ` 1499` ``` proof (rule conjI, rule nnfis_on_countable) ``` hoelzl@35748 ` 1500` ``` have pos_f_image: "pos_part f ` space M - {0} = f ` space M \ {0<..}" ``` hoelzl@35748 ` 1501` ``` unfolding pos_part_def max_def by auto ``` hoelzl@35748 ` 1502` hoelzl@35748 ` 1503` ``` show "bij_betw (pos_part enum) {x \ S. 0 < enum x} (pos_part f ` space M - {0})" ``` hoelzl@35748 ` 1504` ``` unfolding bij_betw_def pos_f_image ``` hoelzl@35748 ` 1505` ``` unfolding pos_part_def max_def range_enum ``` hoelzl@35748 ` 1506` ``` by (auto intro!: inj_onI simp: inj_enum[THEN inj_on_eq_iff]) ``` hoelzl@35748 ` 1507` hoelzl@35748 ` 1508` ``` show "\n. 0 \ pos_part enum n" unfolding pos_part_def max_def by auto ``` hoelzl@35748 ` 1509` hoelzl@35748 ` 1510` ``` show "pos_part f \ borel_measurable M" ``` hoelzl@35748 ` 1511` ``` by (rule pos_part_borel_measurable[OF borel]) ``` hoelzl@35748 ` 1512` hoelzl@35748 ` 1513` ``` show "pos_part enum ` (- {x \ S. 0 < enum x}) \ {0}" ``` hoelzl@35748 ` 1514` ``` unfolding pos_part_def max_def using enum_zero by auto ``` hoelzl@35748 ` 1515` hoelzl@35748 ` 1516` ``` show "summable (\r. ?sum (pos_part f) (pos_part enum) r)" ``` hoelzl@35748 ` 1517` ``` proof (rule summable_comparison_test[OF _ abs_summable], safe intro!: exI[of _ 0]) ``` hoelzl@35748 ` 1518` ``` fix n :: nat ``` hoelzl@35748 ` 1519` ``` have "pos_part enum n \ 0 \ (pos_part f -` {enum n} \ space M) = ``` hoelzl@35748 ` 1520` ``` (if 0 < enum n then (f -` {enum n} \ space M) else {})" ``` hoelzl@35748 ` 1521` ``` unfolding pos_part_def max_def by (auto split: split_if_asm) ``` hoelzl@35748 ` 1522` ``` thus "norm (?sum (pos_part f) (pos_part enum) n) \ \?sum f enum n \" ``` hoelzl@35748 ` 1523` ``` by (cases "pos_part enum n = 0", ``` hoelzl@35748 ` 1524` ``` auto simp: pos_part_def max_def abs_mult not_le split: split_if_asm intro!: mult_nonpos_nonneg) ``` hoelzl@35748 ` 1525` ``` qed ``` hoelzl@35748 ` 1526` ``` thus "(\r. ?sum (pos_part f) (pos_part enum) r) sums (\r. ?sum (pos_part f) (pos_part enum) r)" ``` hoelzl@35748 ` 1527` ``` by (rule summable_sums) ``` hoelzl@35748 ` 1528` ``` qed } ``` hoelzl@35748 ` 1529` ``` note pos = this ``` hoelzl@35748 ` 1530` hoelzl@35748 ` 1531` ``` note pos_part = pos[OF assms(1-4)] ``` hoelzl@35748 ` 1532` ``` moreover ``` hoelzl@35748 ` 1533` ``` have neg_part_to_pos_part: ``` hoelzl@35748 ` 1534` ``` "\f :: _ \ real. neg_part f = pos_part (uminus \ f)" ``` hoelzl@35748 ` 1535` ``` by (auto simp: pos_part_def neg_part_def min_def max_def expand_fun_eq) ``` hoelzl@35748 ` 1536` hoelzl@35748 ` 1537` ``` have neg_part: "(\r. ?sum (neg_part f) (neg_part enum) r) \ nnfis (neg_part f) \ ``` hoelzl@35748 ` 1538` ``` summable (\r. ?sum (neg_part f) (neg_part enum) r)" ``` hoelzl@35748 ` 1539` ``` unfolding neg_part_to_pos_part ``` hoelzl@35748 ` 1540` ``` proof (rule pos) ``` hoelzl@35748 ` 1541` ``` show "uminus \ f \ borel_measurable M" unfolding comp_def ``` hoelzl@35748 ` 1542` ``` by (rule borel_measurable_uminus_borel_measurable[OF borel]) ``` hoelzl@35748 ` 1543` hoelzl@35748 ` 1544` ``` show "bij_betw (uminus \ enum) S ((uminus \ f) ` space M)" ``` hoelzl@35748 ` 1545` ``` using bij unfolding bij_betw_def ``` hoelzl@35748 ` 1546` ``` by (auto intro!: comp_inj_on simp: image_compose) ``` hoelzl@35748 ` 1547` hoelzl@35748 ` 1548` ``` show "(uminus \ enum) ` (- S) \ {0}" ``` hoelzl@35748 ` 1549` ``` using enum_zero by auto ``` hoelzl@35748 ` 1550` hoelzl@35748 ` 1551` ``` have minus_image: "\r. (uminus \ f) -` {(uminus \ enum) r} \ space M = f -` {enum r} \ space M" ``` hoelzl@35748 ` 1552` ``` by auto ``` hoelzl@35748 ` 1553` ``` show "summable (\r. \(uminus \ enum) r * measure_space.measure M ((uminus \ f) -` {(uminus \ enum) r} \ space M)\)" ``` hoelzl@35748 ` 1554` ``` unfolding minus_image using abs_summable by simp ``` hoelzl@35748 ` 1555` ``` qed ``` hoelzl@35748 ` 1556` ``` ultimately show "integrable f" unfolding integrable_def by auto ``` hoelzl@35748 ` 1557` hoelzl@35748 ` 1558` ``` { fix r ``` hoelzl@35748 ` 1559` ``` have "?sum (pos_part f) (pos_part enum) r - ?sum (neg_part f) (neg_part enum) r = ?sum f enum r" ``` hoelzl@35748 ` 1560` ``` proof (cases rule: linorder_cases) ``` hoelzl@35748 ` 1561` ``` assume "0 < enum r" ``` hoelzl@35748 ` 1562` ``` hence "pos_part f -` {enum r} \ space M = f -` {enum r} \ space M" ``` hoelzl@35748 ` 1563` ``` unfolding pos_part_def max_def by (auto split: split_if_asm) ``` hoelzl@35748 ` 1564` ``` with `0 < enum r` show ?thesis unfolding pos_part_def neg_part_def min_def max_def expand_fun_eq ``` hoelzl@35748 ` 1565` ``` by auto ``` hoelzl@35748 ` 1566` ``` next ``` hoelzl@35748 ` 1567` ``` assume "enum r < 0" ``` hoelzl@35748 ` 1568` ``` hence "neg_part f -` {- enum r} \ space M = f -` {enum r} \ space M" ``` hoelzl@35748 ` 1569` ``` unfolding neg_part_def min_def by (auto split: split_if_asm) ``` hoelzl@35748 ` 1570` ``` with `enum r < 0` show ?thesis unfolding pos_part_def neg_part_def min_def max_def expand_fun_eq ``` hoelzl@35748 ` 1571` ``` by auto ``` hoelzl@35748 ` 1572` ``` qed (simp add: neg_part_def pos_part_def) } ``` hoelzl@35748 ` 1573` ``` note sum_diff_eq_sum = this ``` hoelzl@35748 ` 1574` hoelzl@35748 ` 1575` ``` have "(\r. ?sum (pos_part f) (pos_part enum) r) - (\r. ?sum (neg_part f) (neg_part enum) r) ``` hoelzl@35748 ` 1576` ``` = (\r. ?sum (pos_part f) (pos_part enum) r - ?sum (neg_part f) (neg_part enum) r)" ``` hoelzl@35748 ` 1577` ``` using neg_part pos_part by (auto intro: suminf_diff) ``` hoelzl@35748 ` 1578` ``` also have "... = (\r. ?sum f enum r)" unfolding sum_diff_eq_sum .. ``` hoelzl@35748 ` 1579` ``` finally show "integral f = suminf (?sum f enum)" ``` hoelzl@35748 ` 1580` ``` unfolding integral_def using pos_part neg_part ``` hoelzl@35748 ` 1581` ``` by (auto dest: the_nnfis) ``` hoelzl@35748 ` 1582` ```qed ``` hoelzl@35748 ` 1583` hoelzl@35692 ` 1584` ```section "Lebesgue integration on finite space" ``` hoelzl@35692 ` 1585` hoelzl@35582 ` 1586` ```lemma integral_finite_on_sets: ``` hoelzl@35582 ` 1587` ``` assumes "f \ borel_measurable M" and "finite (space M)" and "a \ sets M" ``` hoelzl@35582 ` 1588` ``` shows "integral (\x. f x * indicator_fn a x) = ``` hoelzl@35582 ` 1589` ``` (\ r \ f`a. r * measure M (f -` {r} \ a))" (is "integral ?f = _") ``` hoelzl@35582 ` 1590` ```proof - ``` hoelzl@35582 ` 1591` ``` { fix x assume "x \ a" ``` hoelzl@35582 ` 1592` ``` with assms have "f -` {f x} \ space M \ sets M" ``` hoelzl@35582 ` 1593` ``` by (subst Int_commute) ``` hoelzl@35582 ` 1594` ``` (auto simp: vimage_def Int_def ``` hoelzl@35582 ` 1595` ``` intro!: borel_measurable_const ``` hoelzl@35582 ` 1596` ``` borel_measurable_eq_borel_measurable) ``` hoelzl@35582 ` 1597` ``` from Int[OF this assms(3)] ``` hoelzl@35582 ` 1598` ``` sets_into_space[OF assms(3), THEN Int_absorb1] ``` hoelzl@35582 ` 1599` ``` have "f -` {f x} \ a \ sets M" by (simp add: Int_assoc) } ``` hoelzl@35582 ` 1600` ``` note vimage_f = this ``` hoelzl@35582 ` 1601` hoelzl@35582 ` 1602` ``` have "finite a" ``` hoelzl@35582 ` 1603` ``` using assms(2,3) sets_into_space ``` hoelzl@35582 ` 1604` ``` by (auto intro: finite_subset) ``` hoelzl@35582 ` 1605` hoelzl@35582 ` 1606` ``` have "integral (\x. f x * indicator_fn a x) = ``` hoelzl@35582 ` 1607` ``` integral (\x. \i\f ` a. i * indicator_fn (f -` {i} \ a) x)" ``` hoelzl@35582 ` 1608` ``` (is "_ = integral (\x. setsum (?f x) _)") ``` hoelzl@35582 ` 1609` ``` unfolding indicator_fn_def if_distrib ``` hoelzl@35582 ` 1610` ``` using `finite a` by (auto simp: setsum_cases intro!: integral_cong) ``` hoelzl@35582 ` 1611` ``` also have "\ = (\i\f`a. integral (\x. ?f x i))" ``` hoelzl@35582 ` 1612` ``` proof (rule integral_setsum, safe) ``` hoelzl@35582 ` 1613` ``` fix n x assume "x \ a" ``` hoelzl@35582 ` 1614` ``` thus "integrable (\y. ?f y (f x))" ``` hoelzl@35582 ` 1615` ``` using integral_indicator_fn(2)[OF vimage_f] ``` hoelzl@35582 ` 1616` ``` by (auto intro!: integral_times_const) ``` hoelzl@35582 ` 1617` ``` qed (simp add: `finite a`) ``` hoelzl@35582 ` 1618` ``` also have "\ = (\i\f`a. i * measure M (f -` {i} \ a))" ``` hoelzl@35582 ` 1619` ``` using integral_cmul_indicator[OF vimage_f] ``` hoelzl@35582 ` 1620` ``` by (auto intro!: setsum_cong) ``` hoelzl@35582 ` 1621` ``` finally show ?thesis . ``` hoelzl@35582 ` 1622` ```qed ``` hoelzl@35582 ` 1623` hoelzl@35582 ` 1624` ```lemma integral_finite: ``` hoelzl@35582 ` 1625` ``` assumes "f \ borel_measurable M" and "finite (space M)" ``` hoelzl@35582 ` 1626` ``` shows "integral f = (\ r \ f ` space M. r * measure M (f -` {r} \ space M))" ``` hoelzl@35582 ` 1627` ``` using integral_finite_on_sets[OF assms top] ``` hoelzl@35582 ` 1628` ``` integral_cong[of "\x. f x * indicator_fn (space M) x" f] ``` hoelzl@35582 ` 1629` ``` by (auto simp add: indicator_fn_def) ``` hoelzl@35582 ` 1630` hoelzl@35692 ` 1631` ```section "Radonâ€“Nikodym derivative" ``` hoelzl@35582 ` 1632` hoelzl@35692 ` 1633` ```definition ``` hoelzl@35692 ` 1634` ``` "RN_deriv v \ SOME f. measure_space (M\measure := v\) \ ``` hoelzl@35692 ` 1635` ``` f \ borel_measurable M \ ``` hoelzl@35692 ` 1636` ``` (\a \ sets M. (integral (\x. f x * indicator_fn a x) = v a))" ``` hoelzl@35582 ` 1637` hoelzl@35977 ` 1638` ```end ``` hoelzl@35977 ` 1639` hoelzl@35977 ` 1640` ```lemma sigma_algebra_cong: ``` hoelzl@35977 ` 1641` ``` fixes M :: "('a, 'b) algebra_scheme" and M' :: "('a, 'c) algebra_scheme" ``` hoelzl@35977 ` 1642` ``` assumes *: "sigma_algebra M" ``` hoelzl@35977 ` 1643` ``` and cong: "space M = space M'" "sets M = sets M'" ``` hoelzl@35977 ` 1644` ``` shows "sigma_algebra M'" ``` hoelzl@35977 ` 1645` ```using * unfolding sigma_algebra_def algebra_def sigma_algebra_axioms_def unfolding cong . ``` hoelzl@35977 ` 1646` hoelzl@35977 ` 1647` ```lemma finite_Pow_additivity_sufficient: ``` hoelzl@35977 ` 1648` ``` assumes "finite (space M)" and "sets M = Pow (space M)" ``` hoelzl@35977 ` 1649` ``` and "positive M (measure M)" and "additive M (measure M)" ``` hoelzl@35977 ` 1650` ``` shows "finite_measure_space M" ``` hoelzl@35977 ` 1651` ```proof - ``` hoelzl@35977 ` 1652` ``` have "sigma_algebra M" ``` hoelzl@35977 ` 1653` ``` using assms by (auto intro!: sigma_algebra_cong[OF sigma_algebra_Pow]) ``` hoelzl@35977 ` 1654` hoelzl@35977 ` 1655` ``` have "measure_space M" ``` hoelzl@35977 ` 1656` ``` by (rule Measure.finite_additivity_sufficient) (fact+) ``` hoelzl@35977 ` 1657` ``` thus ?thesis ``` hoelzl@35977 ` 1658` ``` unfolding finite_measure_space_def finite_measure_space_axioms_def ``` hoelzl@35977 ` 1659` ``` using assms by simp ``` hoelzl@35977 ` 1660` ```qed ``` hoelzl@35977 ` 1661` hoelzl@35977 ` 1662` ```lemma finite_measure_spaceI: ``` hoelzl@35977 ` 1663` ``` assumes "measure_space M" and "finite (space M)" and "sets M = Pow (space M)" ``` hoelzl@35977 ` 1664` ``` shows "finite_measure_space M" ``` hoelzl@35977 ` 1665` ``` unfolding finite_measure_space_def finite_measure_space_axioms_def ``` hoelzl@35977 ` 1666` ``` using assms by simp ``` hoelzl@35977 ` 1667` hoelzl@35977 ` 1668` ```lemma (in finite_measure_space) integral_finite_singleton: ``` hoelzl@35977 ` 1669` ``` "integral f = (\x \ space M. f x * measure M {x})" ``` hoelzl@35977 ` 1670` ```proof - ``` hoelzl@35977 ` 1671` ``` have "f \ borel_measurable M" ``` hoelzl@35977 ` 1672` ``` unfolding borel_measurable_le_iff ``` hoelzl@35977 ` 1673` ``` using sets_eq_Pow by auto ``` hoelzl@35977 ` 1674` ``` { fix r let ?x = "f -` {r} \ space M" ``` hoelzl@35977 ` 1675` ``` have "?x \ space M" by auto ``` hoelzl@35977 ` 1676` ``` with finite_space sets_eq_Pow have "measure M ?x = (\i \ ?x. measure M {i})" ``` hoelzl@35977 ` 1677` ``` by (auto intro!: measure_real_sum_image) } ``` hoelzl@35977 ` 1678` ``` note measure_eq_setsum = this ``` hoelzl@35977 ` 1679` ``` show ?thesis ``` hoelzl@35977 ` 1680` ``` unfolding integral_finite[OF `f \ borel_measurable M` finite_space] ``` hoelzl@35977 ` 1681` ``` measure_eq_setsum setsum_right_distrib ``` hoelzl@35977 ` 1682` ``` apply (subst setsum_Sigma) ``` hoelzl@35977 ` 1683` ``` apply (simp add: finite_space) ``` hoelzl@35977 ` 1684` ``` apply (simp add: finite_space) ``` hoelzl@35977 ` 1685` ``` proof (rule setsum_reindex_cong[symmetric]) ``` hoelzl@35977 ` 1686` ``` fix a assume "a \ Sigma (f ` space M) (\x. f -` {x} \ space M)" ``` hoelzl@35977 ` 1687` ``` thus "(\(x, y). x * measure M {y}) a = f (snd a) * measure_space.measure M {snd a}" ``` hoelzl@35977 ` 1688` ``` by auto ``` hoelzl@35977 ` 1689` ``` qed (auto intro!: image_eqI inj_onI) ``` hoelzl@35977 ` 1690` ```qed ``` hoelzl@35977 ` 1691` hoelzl@35977 ` 1692` ```lemma (in finite_measure_space) RN_deriv_finite_singleton: ``` hoelzl@35582 ` 1693` ``` fixes v :: "'a set \ real" ``` hoelzl@35977 ` 1694` ``` assumes ms_v: "measure_space (M\measure := v\)" ``` hoelzl@36624 ` 1695` ``` and eq_0: "\x. \ x \ space M ; measure M {x} = 0 \ \ v {x} = 0" ``` hoelzl@35582 ` 1696` ``` and "x \ space M" and "measure M {x} \ 0" ``` hoelzl@35582 ` 1697` ``` shows "RN_deriv v x = v {x} / (measure M {x})" (is "_ = ?v x") ``` hoelzl@35582 ` 1698` ``` unfolding RN_deriv_def ``` hoelzl@35582 ` 1699` ```proof (rule someI2_ex[where Q = "\f. f x = ?v x"], rule exI[where x = ?v], safe) ``` hoelzl@35582 ` 1700` ``` show "(\a. v {a} / measure_space.measure M {a}) \ borel_measurable M" ``` hoelzl@35977 ` 1701` ``` unfolding borel_measurable_le_iff using sets_eq_Pow by auto ``` hoelzl@35582 ` 1702` ```next ``` hoelzl@35582 ` 1703` ``` fix a assume "a \ sets M" ``` hoelzl@35582 ` 1704` ``` hence "a \ space M" and "finite a" ``` hoelzl@35977 ` 1705` ``` using sets_into_space finite_space by (auto intro: finite_subset) ``` hoelzl@36624 ` 1706` ``` have *: "\x a. x \ space M \ (if measure M {x} = 0 then 0 else v {x} * indicator_fn a x) = ``` hoelzl@35582 ` 1707` ``` v {x} * indicator_fn a x" using eq_0 by auto ``` hoelzl@35582 ` 1708` hoelzl@35582 ` 1709` ``` from measure_space.measure_real_sum_image[OF ms_v, of a] ``` hoelzl@35977 ` 1710` ``` sets_eq_Pow `a \ sets M` sets_into_space `finite a` ``` hoelzl@35582 ` 1711` ``` have "v a = (\x\a. v {x})" by auto ``` hoelzl@35582 ` 1712` ``` thus "integral (\x. v {x} / measure_space.measure M {x} * indicator_fn a x) = v a" ``` hoelzl@35977 ` 1713` ``` apply (simp add: eq_0 integral_finite_singleton) ``` hoelzl@35582 ` 1714` ``` apply (unfold divide_1) ``` hoelzl@35977 ` 1715` ``` by (simp add: * indicator_fn_def if_distrib setsum_cases finite_space `a \ space M` Int_absorb1) ``` hoelzl@35582 ` 1716` ```next ``` hoelzl@35582 ` 1717` ``` fix w assume "w \ borel_measurable M" ``` hoelzl@35582 ` 1718` ``` assume int_eq_v: "\a\sets M. integral (\x. w x * indicator_fn a x) = v a" ``` hoelzl@35977 ` 1719` ``` have "{x} \ sets M" using sets_eq_Pow `x \ space M` by auto ``` hoelzl@35582 ` 1720` hoelzl@35582 ` 1721` ``` have "w x * measure M {x} = ``` hoelzl@35582 ` 1722` ``` (\y\space M. w y * indicator_fn {x} y * measure M {y})" ``` hoelzl@35582 ` 1723` ``` apply (subst (3) mult_commute) ``` hoelzl@35977 ` 1724` ``` unfolding indicator_fn_def if_distrib setsum_cases[OF finite_space] ``` hoelzl@35582 ` 1725` ``` using `x \ space M` by simp ``` hoelzl@35582 ` 1726` ``` also have "... = v {x}" ``` hoelzl@35582 ` 1727` ``` using int_eq_v[rule_format, OF `{x} \ sets M`] ``` hoelzl@35977 ` 1728` ``` by (simp add: integral_finite_singleton) ``` hoelzl@35582 ` 1729` ``` finally show "w x = v {x} / measure M {x}" ``` hoelzl@35582 ` 1730` ``` using `measure M {x} \ 0` by (simp add: eq_divide_eq) ``` hoelzl@35582 ` 1731` ```qed fact ``` hoelzl@35582 ` 1732` hoelzl@35748 ` 1733` ```end ```