author  hoelzl 
Wed, 10 Oct 2012 12:12:18 +0200  
changeset 49777  6ac97ab9b295 
parent 47757  5e6fe71e2390 
child 49779  1484b4b82855 
permissions  rwrr 
42067  1 
(* Title: HOL/Probability/Lebesgue_Measure.thy 
2 
Author: Johannes Hölzl, TU München 

3 
Author: Robert Himmelmann, TU München 

4 
*) 

5 

38656  6 
header {* Lebsegue measure *} 
42067  7 

38656  8 
theory Lebesgue_Measure 
42146
5b52c6a9c627
split Product_Measure into Binary_Product_Measure and Finite_Product_Measure
hoelzl
parents:
42067
diff
changeset

9 
imports Finite_Product_Measure 
38656  10 
begin 
11 

49777  12 
lemma borel_measurable_indicator': 
13 
"A \<in> sets borel \<Longrightarrow> f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. indicator A (f x)) \<in> borel_measurable M" 

14 
using measurable_comp[OF _ borel_measurable_indicator, of f M borel A] by (auto simp add: comp_def) 

15 

47694  16 
lemma borel_measurable_sets: 
17 
assumes "f \<in> measurable borel M" "A \<in> sets M" 

18 
shows "f ` A \<in> sets borel" 

19 
using measurable_sets[OF assms] by simp 

20 

38656  21 
subsection {* Standard Cubes *} 
22 

40859  23 
definition cube :: "nat \<Rightarrow> 'a::ordered_euclidean_space set" where 
24 
"cube n \<equiv> {\<chi>\<chi> i.  real n .. \<chi>\<chi> i. real n}" 

25 

49777  26 
lemma borel_cube[intro]: "cube n \<in> sets borel" 
27 
unfolding cube_def by auto 

28 

40859  29 
lemma cube_closed[intro]: "closed (cube n)" 
30 
unfolding cube_def by auto 

31 

32 
lemma cube_subset[intro]: "n \<le> N \<Longrightarrow> cube n \<subseteq> cube N" 

44890
22f665a2e91c
new fastforce replacing fastsimp  less confusing name
nipkow
parents:
44666
diff
changeset

33 
by (fastforce simp: eucl_le[where 'a='a] cube_def) 
38656  34 

40859  35 
lemma cube_subset_iff: 
36 
"cube n \<subseteq> cube N \<longleftrightarrow> n \<le> N" 

37 
proof 

38 
assume subset: "cube n \<subseteq> (cube N::'a set)" 

39 
then have "((\<chi>\<chi> i. real n)::'a) \<in> cube N" 

40 
using DIM_positive[where 'a='a] 

44890
22f665a2e91c
new fastforce replacing fastsimp  less confusing name
nipkow
parents:
44666
diff
changeset

41 
by (fastforce simp: cube_def eucl_le[where 'a='a]) 
40859  42 
then show "n \<le> N" 
44890
22f665a2e91c
new fastforce replacing fastsimp  less confusing name
nipkow
parents:
44666
diff
changeset

43 
by (fastforce simp: cube_def eucl_le[where 'a='a]) 
40859  44 
next 
45 
assume "n \<le> N" then show "cube n \<subseteq> (cube N::'a set)" by (rule cube_subset) 

46 
qed 

38656  47 

48 
lemma ball_subset_cube:"ball (0::'a::ordered_euclidean_space) (real n) \<subseteq> cube n" 

49 
unfolding cube_def subset_eq mem_interval apply safe unfolding euclidean_lambda_beta' 

50 
proof fix x::'a and i assume as:"x\<in>ball 0 (real n)" "i<DIM('a)" 

51 
thus " real n \<le> x $$ i" "real n \<ge> x $$ i" 

52 
using component_le_norm[of x i] by(auto simp: dist_norm) 

53 
qed 

54 

55 
lemma mem_big_cube: obtains n where "x \<in> cube n" 

44666  56 
proof from reals_Archimedean2[of "norm x"] guess n .. 
38656  57 
thus ?thesis applyapply(rule that[where n=n]) 
58 
apply(rule ball_subset_cube[unfolded subset_eq,rule_format]) 

59 
by (auto simp add:dist_norm) 

60 
qed 

61 

41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

62 
lemma cube_subset_Suc[intro]: "cube n \<subseteq> cube (Suc n)" 
46905  63 
unfolding cube_def subset_eq apply safe unfolding mem_interval apply auto done 
41654  64 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

65 
subsection {* Lebesgue measure *} 
41706
a207a858d1f6
prefer p2e before e2p; use measure_unique_Int_stable_vimage;
hoelzl
parents:
41704
diff
changeset

66 

47694  67 
definition lebesgue :: "'a::ordered_euclidean_space measure" where 
68 
"lebesgue = measure_of UNIV {A. \<forall>n. (indicator A :: 'a \<Rightarrow> real) integrable_on cube n} 

69 
(\<lambda>A. SUP n. ereal (integral (cube n) (indicator A)))" 

41661  70 

41654  71 
lemma space_lebesgue[simp]: "space lebesgue = UNIV" 
72 
unfolding lebesgue_def by simp 

73 

74 
lemma lebesgueI: "(\<And>n. (indicator A :: _ \<Rightarrow> real) integrable_on cube n) \<Longrightarrow> A \<in> sets lebesgue" 

75 
unfolding lebesgue_def by simp 

76 

77 
lemma absolutely_integrable_on_indicator[simp]: 

78 
fixes A :: "'a::ordered_euclidean_space set" 

79 
shows "((indicator A :: _ \<Rightarrow> real) absolutely_integrable_on X) \<longleftrightarrow> 

80 
(indicator A :: _ \<Rightarrow> real) integrable_on X" 

81 
unfolding absolutely_integrable_on_def by simp 

82 

83 
lemma LIMSEQ_indicator_UN: 

84 
"(\<lambda>k. indicator (\<Union> i<k. A i) x) > (indicator (\<Union>i. A i) x :: real)" 

85 
proof cases 

86 
assume "\<exists>i. x \<in> A i" then guess i .. note i = this 

87 
then have *: "\<And>n. (indicator (\<Union> i<n + Suc i. A i) x :: real) = 1" 

88 
"(indicator (\<Union> i. A i) x :: real) = 1" by (auto simp: indicator_def) 

89 
show ?thesis 

90 
apply (rule LIMSEQ_offset[of _ "Suc i"]) unfolding * by auto 

91 
qed (auto simp: indicator_def) 

38656  92 

41654  93 
lemma indicator_add: 
94 
"A \<inter> B = {} \<Longrightarrow> (indicator A x::_::monoid_add) + indicator B x = indicator (A \<union> B) x" 

95 
unfolding indicator_def by auto 

38656  96 

47694  97 
lemma sigma_algebra_lebesgue: 
98 
defines "leb \<equiv> {A. \<forall>n. (indicator A :: 'a::ordered_euclidean_space \<Rightarrow> real) integrable_on cube n}" 

99 
shows "sigma_algebra UNIV leb" 

100 
proof (safe intro!: sigma_algebra_iff2[THEN iffD2]) 

101 
fix A assume A: "A \<in> leb" 

102 
moreover have "indicator (UNIV  A) = (\<lambda>x. 1  indicator A x :: real)" 

41654  103 
by (auto simp: fun_eq_iff indicator_def) 
47694  104 
ultimately show "UNIV  A \<in> leb" 
105 
using A by (auto intro!: integrable_sub simp: cube_def leb_def) 

41654  106 
next 
47694  107 
fix n show "{} \<in> leb" 
108 
by (auto simp: cube_def indicator_def[abs_def] leb_def) 

41654  109 
next 
47694  110 
fix A :: "nat \<Rightarrow> _" assume A: "range A \<subseteq> leb" 
111 
have "\<forall>n. (indicator (\<Union>i. A i) :: _ \<Rightarrow> real) integrable_on cube n" (is "\<forall>n. ?g integrable_on _") 

112 
proof (intro dominated_convergence[where g="?g"] ballI allI) 

113 
fix k n show "(indicator (\<Union>i<k. A i) :: _ \<Rightarrow> real) integrable_on cube n" 

41654  114 
proof (induct k) 
115 
case (Suc k) 

116 
have *: "(\<Union> i<Suc k. A i) = (\<Union> i<k. A i) \<union> A k" 

117 
unfolding lessThan_Suc UN_insert by auto 

118 
have *: "(\<lambda>x. max (indicator (\<Union> i<k. A i) x) (indicator (A k) x) :: real) = 

119 
indicator (\<Union> i<Suc k. A i)" (is "(\<lambda>x. max (?f x) (?g x)) = _") 

120 
by (auto simp: fun_eq_iff * indicator_def) 

121 
show ?case 

47694  122 
using absolutely_integrable_max[of ?f "cube n" ?g] A Suc 
123 
by (simp add: * leb_def subset_eq) 

41654  124 
qed auto 
125 
qed (auto intro: LIMSEQ_indicator_UN simp: cube_def) 

47694  126 
then show "(\<Union>i. A i) \<in> leb" by (auto simp: leb_def) 
41654  127 
qed simp 
38656  128 

47694  129 
lemma sets_lebesgue: "sets lebesgue = {A. \<forall>n. (indicator A :: _ \<Rightarrow> real) integrable_on cube n}" 
130 
unfolding lebesgue_def sigma_algebra.sets_measure_of_eq[OF sigma_algebra_lebesgue] .. 

131 

132 
lemma lebesgueD: "A \<in> sets lebesgue \<Longrightarrow> (indicator A :: _ \<Rightarrow> real) integrable_on cube n" 

133 
unfolding sets_lebesgue by simp 

134 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

135 
lemma emeasure_lebesgue: 
47694  136 
assumes "A \<in> sets lebesgue" 
137 
shows "emeasure lebesgue A = (SUP n. ereal (integral (cube n) (indicator A)))" 

138 
(is "_ = ?\<mu> A") 

139 
proof (rule emeasure_measure_of[OF lebesgue_def]) 

41654  140 
have *: "indicator {} = (\<lambda>x. 0 :: real)" by (simp add: fun_eq_iff) 
47694  141 
show "positive (sets lebesgue) ?\<mu>" 
142 
proof (unfold positive_def, intro conjI ballI) 

143 
show "?\<mu> {} = 0" by (simp add: integral_0 *) 

144 
fix A :: "'a set" assume "A \<in> sets lebesgue" then show "0 \<le> ?\<mu> A" 

145 
by (auto intro!: SUP_upper2 Integration.integral_nonneg simp: sets_lebesgue) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

146 
qed 
40859  147 
next 
47694  148 
show "countably_additive (sets lebesgue) ?\<mu>" 
41654  149 
proof (intro countably_additive_def[THEN iffD2] allI impI) 
47694  150 
fix A :: "nat \<Rightarrow> 'a set" assume rA: "range A \<subseteq> sets lebesgue" "disjoint_family A" 
41654  151 
then have A[simp, intro]: "\<And>i n. (indicator (A i) :: _ \<Rightarrow> real) integrable_on cube n" 
152 
by (auto dest: lebesgueD) 

46731  153 
let ?m = "\<lambda>n i. integral (cube n) (indicator (A i) :: _\<Rightarrow>real)" 
154 
let ?M = "\<lambda>n I. integral (cube n) (indicator (\<Union>i\<in>I. A i) :: _\<Rightarrow>real)" 

47694  155 
have nn[simp, intro]: "\<And>i n. 0 \<le> ?m n i" by (auto intro!: Integration.integral_nonneg) 
41654  156 
assume "(\<Union>i. A i) \<in> sets lebesgue" 
157 
then have UN_A[simp, intro]: "\<And>i n. (indicator (\<Union>i. A i) :: _ \<Rightarrow> real) integrable_on cube n" 

47694  158 
by (auto simp: sets_lebesgue) 
159 
show "(\<Sum>n. ?\<mu> (A n)) = ?\<mu> (\<Union>i. A i)" 

49777  160 
proof (subst suminf_SUP_eq, safe intro!: incseq_SucI) 
43920  161 
fix i n show "ereal (?m n i) \<le> ereal (?m (Suc n) i)" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

162 
using cube_subset[of n "Suc n"] by (auto intro!: integral_subset_le incseq_SucI) 
41654  163 
next 
43920  164 
fix i n show "0 \<le> ereal (?m n i)" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

165 
using rA unfolding lebesgue_def 
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44890
diff
changeset

166 
by (auto intro!: SUP_upper2 integral_nonneg) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

167 
next 
43920  168 
show "(SUP n. \<Sum>i. ereal (?m n i)) = (SUP n. ereal (?M n UNIV))" 
169 
proof (intro arg_cong[where f="SUPR UNIV"] ext sums_unique[symmetric] sums_ereal[THEN iffD2] sums_def[THEN iffD2]) 

41654  170 
fix n 
171 
have "\<And>m. (UNION {..<m} A) \<in> sets lebesgue" using rA by auto 

172 
from lebesgueD[OF this] 

173 
have "(\<lambda>m. ?M n {..< m}) > ?M n UNIV" 

174 
(is "(\<lambda>m. integral _ (?A m)) > ?I") 

175 
by (intro dominated_convergence(2)[where f="?A" and h="\<lambda>x. 1::real"]) 

176 
(auto intro: LIMSEQ_indicator_UN simp: cube_def) 

177 
moreover 

178 
{ fix m have *: "(\<Sum>x<m. ?m n x) = ?M n {..< m}" 

179 
proof (induct m) 

180 
case (Suc m) 

181 
have "(\<Union>i<m. A i) \<in> sets lebesgue" using rA by auto 

182 
then have "(indicator (\<Union>i<m. A i) :: _\<Rightarrow>real) integrable_on (cube n)" 

183 
by (auto dest!: lebesgueD) 

184 
moreover 

185 
have "(\<Union>i<m. A i) \<inter> A m = {}" 

186 
using rA(2)[unfolded disjoint_family_on_def, THEN bspec, of m] 

187 
by auto 

188 
then have "\<And>x. indicator (\<Union>i<Suc m. A i) x = 

189 
indicator (\<Union>i<m. A i) x + (indicator (A m) x :: real)" 

190 
by (auto simp: indicator_add lessThan_Suc ac_simps) 

191 
ultimately show ?case 

47694  192 
using Suc A by (simp add: Integration.integral_add[symmetric]) 
41654  193 
qed auto } 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

194 
ultimately show "(\<lambda>m. \<Sum>x = 0..<m. ?m n x) > ?M n UNIV" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

195 
by (simp add: atLeast0LessThan) 
41654  196 
qed 
197 
qed 

198 
qed 

47694  199 
qed (auto, fact) 
40859  200 

41654  201 
lemma has_integral_interval_cube: 
202 
fixes a b :: "'a::ordered_euclidean_space" 

203 
shows "(indicator {a .. b} has_integral 

204 
content ({\<chi>\<chi> i. max ( real n) (a $$ i) .. \<chi>\<chi> i. min (real n) (b $$ i)} :: 'a set)) (cube n)" 

205 
(is "(?I has_integral content ?R) (cube n)") 

40859  206 
proof  
41654  207 
let "{?N .. ?P}" = ?R 
208 
have [simp]: "(\<lambda>x. if x \<in> cube n then ?I x else 0) = indicator ?R" 

209 
by (auto simp: indicator_def cube_def fun_eq_iff eucl_le[where 'a='a]) 

210 
have "(?I has_integral content ?R) (cube n) \<longleftrightarrow> (indicator ?R has_integral content ?R) UNIV" 

211 
unfolding has_integral_restrict_univ[where s="cube n", symmetric] by simp 

212 
also have "\<dots> \<longleftrightarrow> ((\<lambda>x. 1) has_integral content ?R) ?R" 

46905  213 
unfolding indicator_def [abs_def] has_integral_restrict_univ .. 
41654  214 
finally show ?thesis 
215 
using has_integral_const[of "1::real" "?N" "?P"] by simp 

40859  216 
qed 
38656  217 

41654  218 
lemma lebesgueI_borel[intro, simp]: 
219 
fixes s::"'a::ordered_euclidean_space set" 

40859  220 
assumes "s \<in> sets borel" shows "s \<in> sets lebesgue" 
41654  221 
proof  
47694  222 
have "s \<in> sigma_sets (space lebesgue) (range (\<lambda>(a, b). {a .. (b :: 'a\<Colon>ordered_euclidean_space)}))" 
223 
using assms by (simp add: borel_eq_atLeastAtMost) 

224 
also have "\<dots> \<subseteq> sets lebesgue" 

225 
proof (safe intro!: sigma_sets_subset lebesgueI) 

41654  226 
fix n :: nat and a b :: 'a 
227 
let ?N = "\<chi>\<chi> i. max ( real n) (a $$ i)" 

228 
let ?P = "\<chi>\<chi> i. min (real n) (b $$ i)" 

229 
show "(indicator {a..b} :: 'a\<Rightarrow>real) integrable_on cube n" 

230 
unfolding integrable_on_def 

231 
using has_integral_interval_cube[of a b] by auto 

232 
qed 

47694  233 
finally show ?thesis . 
38656  234 
qed 
235 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

236 
lemma borel_measurable_lebesgueI: 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

237 
"f \<in> borel_measurable borel \<Longrightarrow> f \<in> borel_measurable lebesgue" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

238 
unfolding measurable_def by simp 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

239 

40859  240 
lemma lebesgueI_negligible[dest]: fixes s::"'a::ordered_euclidean_space set" 
241 
assumes "negligible s" shows "s \<in> sets lebesgue" 

41654  242 
using assms by (force simp: cube_def integrable_on_def negligible_def intro!: lebesgueI) 
38656  243 

41654  244 
lemma lmeasure_eq_0: 
47694  245 
fixes S :: "'a::ordered_euclidean_space set" 
246 
assumes "negligible S" shows "emeasure lebesgue S = 0" 

40859  247 
proof  
41654  248 
have "\<And>n. integral (cube n) (indicator S :: 'a\<Rightarrow>real) = 0" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

249 
unfolding lebesgue_integral_def using assms 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

250 
by (intro integral_unique some1_equality ex_ex1I) 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

251 
(auto simp: cube_def negligible_def) 
47694  252 
then show ?thesis 
253 
using assms by (simp add: emeasure_lebesgue lebesgueI_negligible) 

40859  254 
qed 
255 

256 
lemma lmeasure_iff_LIMSEQ: 

47694  257 
assumes A: "A \<in> sets lebesgue" and "0 \<le> m" 
258 
shows "emeasure lebesgue A = ereal m \<longleftrightarrow> (\<lambda>n. integral (cube n) (indicator A :: _ \<Rightarrow> real)) > m" 

259 
proof (subst emeasure_lebesgue[OF A], intro SUP_eq_LIMSEQ) 

41654  260 
show "mono (\<lambda>n. integral (cube n) (indicator A::_=>real))" 
261 
using cube_subset assms by (intro monoI integral_subset_le) (auto dest!: lebesgueD) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

262 
qed 
38656  263 

41654  264 
lemma has_integral_indicator_UNIV: 
265 
fixes s A :: "'a::ordered_euclidean_space set" and x :: real 

266 
shows "((indicator (s \<inter> A) :: 'a\<Rightarrow>real) has_integral x) UNIV = ((indicator s :: _\<Rightarrow>real) has_integral x) A" 

267 
proof  

268 
have "(\<lambda>x. if x \<in> A then indicator s x else 0) = (indicator (s \<inter> A) :: _\<Rightarrow>real)" 

269 
by (auto simp: fun_eq_iff indicator_def) 

270 
then show ?thesis 

271 
unfolding has_integral_restrict_univ[where s=A, symmetric] by simp 

40859  272 
qed 
38656  273 

41654  274 
lemma 
275 
fixes s a :: "'a::ordered_euclidean_space set" 

276 
shows integral_indicator_UNIV: 

277 
"integral UNIV (indicator (s \<inter> A) :: 'a\<Rightarrow>real) = integral A (indicator s :: _\<Rightarrow>real)" 

278 
and integrable_indicator_UNIV: 

279 
"(indicator (s \<inter> A) :: 'a\<Rightarrow>real) integrable_on UNIV \<longleftrightarrow> (indicator s :: 'a\<Rightarrow>real) integrable_on A" 

280 
unfolding integral_def integrable_on_def has_integral_indicator_UNIV by auto 

281 

282 
lemma lmeasure_finite_has_integral: 

283 
fixes s :: "'a::ordered_euclidean_space set" 

49777  284 
assumes "s \<in> sets lebesgue" "emeasure lebesgue s = ereal m" 
41654  285 
shows "(indicator s has_integral m) UNIV" 
286 
proof  

287 
let ?I = "indicator :: 'a set \<Rightarrow> 'a \<Rightarrow> real" 

49777  288 
have "0 \<le> m" 
289 
using emeasure_nonneg[of lebesgue s] `emeasure lebesgue s = ereal m` by simp 

41654  290 
have **: "(?I s) integrable_on UNIV \<and> (\<lambda>k. integral UNIV (?I (s \<inter> cube k))) > integral UNIV (?I s)" 
291 
proof (intro monotone_convergence_increasing allI ballI) 

292 
have LIMSEQ: "(\<lambda>n. integral (cube n) (?I s)) > m" 

49777  293 
using assms(2) unfolding lmeasure_iff_LIMSEQ[OF assms(1) `0 \<le> m`] . 
41654  294 
{ fix n have "integral (cube n) (?I s) \<le> m" 
295 
using cube_subset assms 

296 
by (intro incseq_le[where L=m] LIMSEQ incseq_def[THEN iffD2] integral_subset_le allI impI) 

297 
(auto dest!: lebesgueD) } 

298 
moreover 

299 
{ fix n have "0 \<le> integral (cube n) (?I s)" 

47694  300 
using assms by (auto dest!: lebesgueD intro!: Integration.integral_nonneg) } 
41654  301 
ultimately 
302 
show "bounded {integral UNIV (?I (s \<inter> cube k)) k. True}" 

303 
unfolding bounded_def 

304 
apply (rule_tac exI[of _ 0]) 

305 
apply (rule_tac exI[of _ m]) 

306 
by (auto simp: dist_real_def integral_indicator_UNIV) 

307 
fix k show "?I (s \<inter> cube k) integrable_on UNIV" 

308 
unfolding integrable_indicator_UNIV using assms by (auto dest!: lebesgueD) 

309 
fix x show "?I (s \<inter> cube k) x \<le> ?I (s \<inter> cube (Suc k)) x" 

310 
using cube_subset[of k "Suc k"] by (auto simp: indicator_def) 

311 
next 

312 
fix x :: 'a 

313 
from mem_big_cube obtain k where k: "x \<in> cube k" . 

314 
{ fix n have "?I (s \<inter> cube (n + k)) x = ?I s x" 

315 
using k cube_subset[of k "n + k"] by (auto simp: indicator_def) } 

316 
note * = this 

317 
show "(\<lambda>k. ?I (s \<inter> cube k) x) > ?I s x" 

318 
by (rule LIMSEQ_offset[where k=k]) (auto simp: *) 

319 
qed 

320 
note ** = conjunctD2[OF this] 

321 
have m: "m = integral UNIV (?I s)" 

322 
apply (intro LIMSEQ_unique[OF _ **(2)]) 

49777  323 
using assms(2) unfolding lmeasure_iff_LIMSEQ[OF assms(1) `0 \<le> m`] integral_indicator_UNIV . 
41654  324 
show ?thesis 
325 
unfolding m by (intro integrable_integral **) 

38656  326 
qed 
327 

47694  328 
lemma lmeasure_finite_integrable: assumes s: "s \<in> sets lebesgue" and "emeasure lebesgue s \<noteq> \<infinity>" 
41654  329 
shows "(indicator s :: _ \<Rightarrow> real) integrable_on UNIV" 
47694  330 
proof (cases "emeasure lebesgue s") 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

331 
case (real m) 
47694  332 
with lmeasure_finite_has_integral[OF `s \<in> sets lebesgue` this] emeasure_nonneg[of lebesgue s] 
41654  333 
show ?thesis unfolding integrable_on_def by auto 
47694  334 
qed (insert assms emeasure_nonneg[of lebesgue s], auto) 
38656  335 

41654  336 
lemma has_integral_lebesgue: assumes "((indicator s :: _\<Rightarrow>real) has_integral m) UNIV" 
337 
shows "s \<in> sets lebesgue" 

338 
proof (intro lebesgueI) 

339 
let ?I = "indicator :: 'a set \<Rightarrow> 'a \<Rightarrow> real" 

340 
fix n show "(?I s) integrable_on cube n" unfolding cube_def 

341 
proof (intro integrable_on_subinterval) 

342 
show "(?I s) integrable_on UNIV" 

343 
unfolding integrable_on_def using assms by auto 

344 
qed auto 

38656  345 
qed 
346 

41654  347 
lemma has_integral_lmeasure: assumes "((indicator s :: _\<Rightarrow>real) has_integral m) UNIV" 
47694  348 
shows "emeasure lebesgue s = ereal m" 
41654  349 
proof (intro lmeasure_iff_LIMSEQ[THEN iffD2]) 
350 
let ?I = "indicator :: 'a set \<Rightarrow> 'a \<Rightarrow> real" 

351 
show "s \<in> sets lebesgue" using has_integral_lebesgue[OF assms] . 

352 
show "0 \<le> m" using assms by (rule has_integral_nonneg) auto 

353 
have "(\<lambda>n. integral UNIV (?I (s \<inter> cube n))) > integral UNIV (?I s)" 

354 
proof (intro dominated_convergence(2) ballI) 

355 
show "(?I s) integrable_on UNIV" unfolding integrable_on_def using assms by auto 

356 
fix n show "?I (s \<inter> cube n) integrable_on UNIV" 

357 
unfolding integrable_indicator_UNIV using `s \<in> sets lebesgue` by (auto dest: lebesgueD) 

358 
fix x show "norm (?I (s \<inter> cube n) x) \<le> ?I s x" by (auto simp: indicator_def) 

359 
next 

360 
fix x :: 'a 

361 
from mem_big_cube obtain k where k: "x \<in> cube k" . 

362 
{ fix n have "?I (s \<inter> cube (n + k)) x = ?I s x" 

363 
using k cube_subset[of k "n + k"] by (auto simp: indicator_def) } 

364 
note * = this 

365 
show "(\<lambda>k. ?I (s \<inter> cube k) x) > ?I s x" 

366 
by (rule LIMSEQ_offset[where k=k]) (auto simp: *) 

367 
qed 

368 
then show "(\<lambda>n. integral (cube n) (?I s)) > m" 

369 
unfolding integral_unique[OF assms] integral_indicator_UNIV by simp 

370 
qed 

371 

372 
lemma has_integral_iff_lmeasure: 

49777  373 
"(indicator A has_integral m) UNIV \<longleftrightarrow> (A \<in> sets lebesgue \<and> emeasure lebesgue A = ereal m)" 
40859  374 
proof 
41654  375 
assume "(indicator A has_integral m) UNIV" 
376 
with has_integral_lmeasure[OF this] has_integral_lebesgue[OF this] 

49777  377 
show "A \<in> sets lebesgue \<and> emeasure lebesgue A = ereal m" 
41654  378 
by (auto intro: has_integral_nonneg) 
40859  379 
next 
49777  380 
assume "A \<in> sets lebesgue \<and> emeasure lebesgue A = ereal m" 
41654  381 
then show "(indicator A has_integral m) UNIV" by (intro lmeasure_finite_has_integral) auto 
38656  382 
qed 
383 

41654  384 
lemma lmeasure_eq_integral: assumes "(indicator s::_\<Rightarrow>real) integrable_on UNIV" 
47694  385 
shows "emeasure lebesgue s = ereal (integral UNIV (indicator s))" 
41654  386 
using assms unfolding integrable_on_def 
387 
proof safe 

388 
fix y :: real assume "(indicator s has_integral y) UNIV" 

389 
from this[unfolded has_integral_iff_lmeasure] integral_unique[OF this] 

47694  390 
show "emeasure lebesgue s = ereal (integral UNIV (indicator s))" by simp 
40859  391 
qed 
38656  392 

393 
lemma lebesgue_simple_function_indicator: 

43920  394 
fixes f::"'a::ordered_euclidean_space \<Rightarrow> ereal" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

395 
assumes f:"simple_function lebesgue f" 
38656  396 
shows "f = (\<lambda>x. (\<Sum>y \<in> f ` UNIV. y * indicator (f ` {y}) x))" 
47694  397 
by (rule, subst simple_function_indicator_representation[OF f]) auto 
38656  398 

41654  399 
lemma integral_eq_lmeasure: 
47694  400 
"(indicator s::_\<Rightarrow>real) integrable_on UNIV \<Longrightarrow> integral UNIV (indicator s) = real (emeasure lebesgue s)" 
41654  401 
by (subst lmeasure_eq_integral) (auto intro!: integral_nonneg) 
38656  402 

47694  403 
lemma lmeasure_finite: assumes "(indicator s::_\<Rightarrow>real) integrable_on UNIV" shows "emeasure lebesgue s \<noteq> \<infinity>" 
41654  404 
using lmeasure_eq_integral[OF assms] by auto 
38656  405 

40859  406 
lemma negligible_iff_lebesgue_null_sets: 
47694  407 
"negligible A \<longleftrightarrow> A \<in> null_sets lebesgue" 
40859  408 
proof 
409 
assume "negligible A" 

410 
from this[THEN lebesgueI_negligible] this[THEN lmeasure_eq_0] 

47694  411 
show "A \<in> null_sets lebesgue" by auto 
40859  412 
next 
47694  413 
assume A: "A \<in> null_sets lebesgue" 
414 
then have *:"((indicator A) has_integral (0::real)) UNIV" using lmeasure_finite_has_integral[of A] 

415 
by (auto simp: null_sets_def) 

41654  416 
show "negligible A" unfolding negligible_def 
417 
proof (intro allI) 

418 
fix a b :: 'a 

419 
have integrable: "(indicator A :: _\<Rightarrow>real) integrable_on {a..b}" 

420 
by (intro integrable_on_subinterval has_integral_integrable) (auto intro: *) 

421 
then have "integral {a..b} (indicator A) \<le> (integral UNIV (indicator A) :: real)" 

47694  422 
using * by (auto intro!: integral_subset_le) 
41654  423 
moreover have "(0::real) \<le> integral {a..b} (indicator A)" 
424 
using integrable by (auto intro!: integral_nonneg) 

425 
ultimately have "integral {a..b} (indicator A) = (0::real)" 

426 
using integral_unique[OF *] by auto 

427 
then show "(indicator A has_integral (0::real)) {a..b}" 

428 
using integrable_integral[OF integrable] by simp 

429 
qed 

430 
qed 

431 

432 
lemma integral_const[simp]: 

433 
fixes a b :: "'a::ordered_euclidean_space" 

434 
shows "integral {a .. b} (\<lambda>x. c) = content {a .. b} *\<^sub>R c" 

435 
by (rule integral_unique) (rule has_integral_const) 

436 

47694  437 
lemma lmeasure_UNIV[intro]: "emeasure lebesgue (UNIV::'a::ordered_euclidean_space set) = \<infinity>" 
438 
proof (simp add: emeasure_lebesgue, intro SUP_PInfty bexI) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

439 
fix n :: nat 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

440 
have "indicator UNIV = (\<lambda>x::'a. 1 :: real)" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

441 
moreover 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

442 
{ have "real n \<le> (2 * real n) ^ DIM('a)" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

443 
proof (cases n) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

444 
case 0 then show ?thesis by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

445 
next 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

446 
case (Suc n') 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

447 
have "real n \<le> (2 * real n)^1" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

448 
also have "(2 * real n)^1 \<le> (2 * real n) ^ DIM('a)" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

449 
using Suc DIM_positive[where 'a='a] by (intro power_increasing) (auto simp: real_of_nat_Suc) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

450 
finally show ?thesis . 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

451 
qed } 
43920  452 
ultimately show "ereal (real n) \<le> ereal (integral (cube n) (indicator UNIV::'a\<Rightarrow>real))" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

453 
using integral_const DIM_positive[where 'a='a] 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

454 
by (auto simp: cube_def content_closed_interval_cases setprod_constant) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

455 
qed simp 
40859  456 

49777  457 
lemma lmeasure_complete: "A \<subseteq> B \<Longrightarrow> B \<in> null_sets lebesgue \<Longrightarrow> A \<in> null_sets lebesgue" 
458 
unfolding negligible_iff_lebesgue_null_sets[symmetric] by (auto simp: negligible_subset) 

459 

40859  460 
lemma 
461 
fixes a b ::"'a::ordered_euclidean_space" 

47694  462 
shows lmeasure_atLeastAtMost[simp]: "emeasure lebesgue {a..b} = ereal (content {a..b})" 
41654  463 
proof  
464 
have "(indicator (UNIV \<inter> {a..b})::_\<Rightarrow>real) integrable_on UNIV" 

46905  465 
unfolding integrable_indicator_UNIV by (simp add: integrable_const indicator_def [abs_def]) 
41654  466 
from lmeasure_eq_integral[OF this] show ?thesis unfolding integral_indicator_UNIV 
46905  467 
by (simp add: indicator_def [abs_def]) 
40859  468 
qed 
469 

470 
lemma atLeastAtMost_singleton_euclidean[simp]: 

471 
fixes a :: "'a::ordered_euclidean_space" shows "{a .. a} = {a}" 

472 
by (force simp: eucl_le[where 'a='a] euclidean_eq[where 'a='a]) 

473 

474 
lemma content_singleton[simp]: "content {a} = 0" 

475 
proof  

476 
have "content {a .. a} = 0" 

477 
by (subst content_closed_interval) auto 

478 
then show ?thesis by simp 

479 
qed 

480 

481 
lemma lmeasure_singleton[simp]: 

47694  482 
fixes a :: "'a::ordered_euclidean_space" shows "emeasure lebesgue {a} = 0" 
41654  483 
using lmeasure_atLeastAtMost[of a a] by simp 
40859  484 

49777  485 
lemma AE_lebesgue_singleton: 
486 
fixes a :: "'a::ordered_euclidean_space" shows "AE x in lebesgue. x \<noteq> a" 

487 
by (rule AE_I[where N="{a}"]) auto 

488 

40859  489 
declare content_real[simp] 
490 

491 
lemma 

492 
fixes a b :: real 

493 
shows lmeasure_real_greaterThanAtMost[simp]: 

47694  494 
"emeasure lebesgue {a <.. b} = ereal (if a \<le> b then b  a else 0)" 
49777  495 
proof  
496 
have "emeasure lebesgue {a <.. b} = emeasure lebesgue {a .. b}" 

497 
using AE_lebesgue_singleton[of a] 

498 
by (intro emeasure_eq_AE) auto 

40859  499 
then show ?thesis by auto 
49777  500 
qed 
40859  501 

502 
lemma 

503 
fixes a b :: real 

504 
shows lmeasure_real_atLeastLessThan[simp]: 

47694  505 
"emeasure lebesgue {a ..< b} = ereal (if a \<le> b then b  a else 0)" 
49777  506 
proof  
507 
have "emeasure lebesgue {a ..< b} = emeasure lebesgue {a .. b}" 

508 
using AE_lebesgue_singleton[of b] 

509 
by (intro emeasure_eq_AE) auto 

41654  510 
then show ?thesis by auto 
49777  511 
qed 
41654  512 

513 
lemma 

514 
fixes a b :: real 

515 
shows lmeasure_real_greaterThanLessThan[simp]: 

47694  516 
"emeasure lebesgue {a <..< b} = ereal (if a \<le> b then b  a else 0)" 
49777  517 
proof  
518 
have "emeasure lebesgue {a <..< b} = emeasure lebesgue {a .. b}" 

519 
using AE_lebesgue_singleton[of a] AE_lebesgue_singleton[of b] 

520 
by (intro emeasure_eq_AE) auto 

40859  521 
then show ?thesis by auto 
49777  522 
qed 
40859  523 

41706
a207a858d1f6
prefer p2e before e2p; use measure_unique_Int_stable_vimage;
hoelzl
parents:
41704
diff
changeset

524 
subsection {* LebesgueBorel measure *} 
a207a858d1f6
prefer p2e before e2p; use measure_unique_Int_stable_vimage;
hoelzl
parents:
41704
diff
changeset

525 

47694  526 
definition "lborel = measure_of UNIV (sets borel) (emeasure lebesgue)" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

527 

3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

528 
lemma 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

529 
shows space_lborel[simp]: "space lborel = UNIV" 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

530 
and sets_lborel[simp]: "sets lborel = sets borel" 
47694  531 
and measurable_lborel1[simp]: "measurable lborel = measurable borel" 
532 
and measurable_lborel2[simp]: "measurable A lborel = measurable A borel" 

533 
using sigma_sets_eq[of borel] 

534 
by (auto simp add: lborel_def measurable_def[abs_def]) 

40859  535 

47694  536 
lemma emeasure_lborel[simp]: "A \<in> sets borel \<Longrightarrow> emeasure lborel A = emeasure lebesgue A" 
537 
by (rule emeasure_measure_of[OF lborel_def]) 

538 
(auto simp: positive_def emeasure_nonneg countably_additive_def intro!: suminf_emeasure) 

40859  539 

41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

540 
interpretation lborel: sigma_finite_measure lborel 
47694  541 
proof (default, intro conjI exI[of _ "\<lambda>n. cube n"]) 
542 
show "range cube \<subseteq> sets lborel" by (auto intro: borel_closed) 

543 
{ fix x :: 'a have "\<exists>n. x\<in>cube n" using mem_big_cube by auto } 

544 
then show "(\<Union>i. cube i) = (space lborel :: 'a set)" using mem_big_cube by auto 

545 
show "\<forall>i. emeasure lborel (cube i) \<noteq> \<infinity>" by (simp add: cube_def) 

546 
qed 

41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

547 

3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

548 
interpretation lebesgue: sigma_finite_measure lebesgue 
40859  549 
proof 
47694  550 
from lborel.sigma_finite guess A :: "nat \<Rightarrow> 'a set" .. 
551 
then show "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets lebesgue \<and> (\<Union>i. A i) = space lebesgue \<and> (\<forall>i. emeasure lebesgue (A i) \<noteq> \<infinity>)" 

552 
by (intro exI[of _ A]) (auto simp: subset_eq) 

40859  553 
qed 
554 

49777  555 
lemma Int_stable_atLeastAtMost: 
556 
fixes x::"'a::ordered_euclidean_space" 

557 
shows "Int_stable (range (\<lambda>(a, b::'a). {a..b}))" 

558 
by (auto simp: inter_interval Int_stable_def) 

559 

560 
lemma lborel_eqI: 

561 
fixes M :: "'a::ordered_euclidean_space measure" 

562 
assumes emeasure_eq: "\<And>a b. emeasure M {a .. b} = content {a .. b}" 

563 
assumes sets_eq: "sets M = sets borel" 

564 
shows "lborel = M" 

565 
proof (rule measure_eqI_generator_eq[OF Int_stable_atLeastAtMost]) 

566 
let ?P = "\<Pi>\<^isub>M i\<in>{..<DIM('a::ordered_euclidean_space)}. lborel" 

567 
let ?E = "range (\<lambda>(a, b). {a..b} :: 'a set)" 

568 
show "?E \<subseteq> Pow UNIV" "sets lborel = sigma_sets UNIV ?E" "sets M = sigma_sets UNIV ?E" 

569 
by (simp_all add: borel_eq_atLeastAtMost sets_eq) 

570 

571 
show "range cube \<subseteq> ?E" unfolding cube_def [abs_def] by auto 

572 
show "incseq cube" using cube_subset_Suc by (auto intro!: incseq_SucI) 

573 
{ fix x :: 'a have "\<exists>n. x \<in> cube n" using mem_big_cube[of x] by fastforce } 

574 
then show "(\<Union>i. cube i :: 'a set) = UNIV" by auto 

575 

576 
{ fix i show "emeasure lborel (cube i) \<noteq> \<infinity>" unfolding cube_def by auto } 

577 
{ fix X assume "X \<in> ?E" then show "emeasure lborel X = emeasure M X" 

578 
by (auto simp: emeasure_eq) } 

579 
qed 

580 

581 
lemma lebesgue_real_affine: 

582 
fixes c :: real assumes "c \<noteq> 0" 

583 
shows "lborel = density (distr lborel borel (\<lambda>x. t + c * x)) (\<lambda>_. \<bar>c\<bar>)" (is "_ = ?D") 

584 
proof (rule lborel_eqI) 

585 
fix a b show "emeasure ?D {a..b} = content {a .. b}" 

586 
proof cases 

587 
assume "0 < c" 

588 
then have "(\<lambda>x. t + c * x) ` {a..b} = {(a  t) / c .. (b  t) / c}" 

589 
by (auto simp: field_simps) 

590 
with `0 < c` show ?thesis 

591 
by (cases "a \<le> b") 

592 
(auto simp: field_simps emeasure_density positive_integral_distr positive_integral_cmult 

593 
borel_measurable_indicator' emeasure_distr) 

594 
next 

595 
assume "\<not> 0 < c" with `c \<noteq> 0` have "c < 0" by auto 

596 
then have *: "(\<lambda>x. t + c * x) ` {a..b} = {(b  t) / c .. (a  t) / c}" 

597 
by (auto simp: field_simps) 

598 
with `c < 0` show ?thesis 

599 
by (cases "a \<le> b") 

600 
(auto simp: field_simps emeasure_density positive_integral_distr 

601 
positive_integral_cmult borel_measurable_indicator' emeasure_distr) 

602 
qed 

603 
qed simp 

604 

605 
lemma lebesgue_integral_real_affine: 

606 
fixes c :: real assumes c: "c \<noteq> 0" and f: "f \<in> borel_measurable borel" 

607 
shows "(\<integral> x. f x \<partial> lborel) = \<bar>c\<bar> * (\<integral> x. f (t + c * x) \<partial>lborel)" 

608 
by (subst lebesgue_real_affine[OF c, of t]) 

609 
(simp add: f integral_density integral_distr lebesgue_integral_cmult) 

610 

41706
a207a858d1f6
prefer p2e before e2p; use measure_unique_Int_stable_vimage;
hoelzl
parents:
41704
diff
changeset

611 
subsection {* Lebesgue integrable implies Gauge integrable *} 
a207a858d1f6
prefer p2e before e2p; use measure_unique_Int_stable_vimage;
hoelzl
parents:
41704
diff
changeset

612 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

613 
lemma has_integral_cmult_real: 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

614 
fixes c :: real 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

615 
assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

616 
shows "((\<lambda>x. c * f x) has_integral c * x) A" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

617 
proof cases 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

618 
assume "c \<noteq> 0" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

619 
from has_integral_cmul[OF assms[OF this], of c] show ?thesis 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

620 
unfolding real_scaleR_def . 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

621 
qed simp 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

622 

40859  623 
lemma simple_function_has_integral: 
43920  624 
fixes f::"'a::ordered_euclidean_space \<Rightarrow> ereal" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

625 
assumes f:"simple_function lebesgue f" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

626 
and f':"range f \<subseteq> {0..<\<infinity>}" 
47694  627 
and om:"\<And>x. x \<in> range f \<Longrightarrow> emeasure lebesgue (f ` {x} \<inter> UNIV) = \<infinity> \<Longrightarrow> x = 0" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

628 
shows "((\<lambda>x. real (f x)) has_integral (real (integral\<^isup>S lebesgue f))) UNIV" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

629 
unfolding simple_integral_def space_lebesgue 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

630 
proof (subst lebesgue_simple_function_indicator) 
47694  631 
let ?M = "\<lambda>x. emeasure lebesgue (f ` {x} \<inter> UNIV)" 
46731  632 
let ?F = "\<lambda>x. indicator (f ` {x})" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

633 
{ fix x y assume "y \<in> range f" 
43920  634 
from subsetD[OF f' this] have "y * ?F y x = ereal (real y * ?F y x)" 
635 
by (cases rule: ereal2_cases[of y "?F y x"]) 

636 
(auto simp: indicator_def one_ereal_def split: split_if_asm) } 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

637 
moreover 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

638 
{ fix x assume x: "x\<in>range f" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

639 
have "x * ?M x = real x * real (?M x)" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

640 
proof cases 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

641 
assume "x \<noteq> 0" with om[OF x] have "?M x \<noteq> \<infinity>" by auto 
47694  642 
with subsetD[OF f' x] f[THEN simple_functionD(2)] show ?thesis 
43920  643 
by (cases rule: ereal2_cases[of x "?M x"]) auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

644 
qed simp } 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

645 
ultimately 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

646 
have "((\<lambda>x. real (\<Sum>y\<in>range f. y * ?F y x)) has_integral real (\<Sum>x\<in>range f. x * ?M x)) UNIV \<longleftrightarrow> 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

647 
((\<lambda>x. \<Sum>y\<in>range f. real y * ?F y x) has_integral (\<Sum>x\<in>range f. real x * real (?M x))) UNIV" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

648 
by simp 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

649 
also have \<dots> 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

650 
proof (intro has_integral_setsum has_integral_cmult_real lmeasure_finite_has_integral 
47694  651 
real_of_ereal_pos emeasure_nonneg ballI) 
652 
show *: "finite (range f)" "\<And>y. f ` {y} \<in> sets lebesgue" 

653 
using simple_functionD[OF f] by auto 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

654 
fix y assume "real y \<noteq> 0" "y \<in> range f" 
47694  655 
with * om[OF this(2)] show "emeasure lebesgue (f ` {y}) = ereal (real (?M y))" 
43920  656 
by (auto simp: ereal_real) 
41654  657 
qed 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

658 
finally show "((\<lambda>x. real (\<Sum>y\<in>range f. y * ?F y x)) has_integral real (\<Sum>x\<in>range f. x * ?M x)) UNIV" . 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

659 
qed fact 
40859  660 

661 
lemma bounded_realI: assumes "\<forall>x\<in>s. abs (x::real) \<le> B" shows "bounded s" 

662 
unfolding bounded_def dist_real_def apply(rule_tac x=0 in exI) 

663 
using assms by auto 

664 

665 
lemma simple_function_has_integral': 

43920  666 
fixes f::"'a::ordered_euclidean_space \<Rightarrow> ereal" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

667 
assumes f: "simple_function lebesgue f" "\<And>x. 0 \<le> f x" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

668 
and i: "integral\<^isup>S lebesgue f \<noteq> \<infinity>" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

669 
shows "((\<lambda>x. real (f x)) has_integral (real (integral\<^isup>S lebesgue f))) UNIV" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

670 
proof  
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

671 
let ?f = "\<lambda>x. if x \<in> f ` {\<infinity>} then 0 else f x" 
47694  672 
note f(1)[THEN simple_functionD(2)] 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

673 
then have [simp, intro]: "\<And>X. f ` X \<in> sets lebesgue" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

674 
have f': "simple_function lebesgue ?f" 
47694  675 
using f by (intro simple_function_If_set) auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

676 
have rng: "range ?f \<subseteq> {0..<\<infinity>}" using f by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

677 
have "AE x in lebesgue. f x = ?f x" 
47694  678 
using simple_integral_PInf[OF f i] 
679 
by (intro AE_I[where N="f ` {\<infinity>} \<inter> space lebesgue"]) auto 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

680 
from f(1) f' this have eq: "integral\<^isup>S lebesgue f = integral\<^isup>S lebesgue ?f" 
47694  681 
by (rule simple_integral_cong_AE) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

682 
have real_eq: "\<And>x. real (f x) = real (?f x)" by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

683 

cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

684 
show ?thesis 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

685 
unfolding eq real_eq 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

686 
proof (rule simple_function_has_integral[OF f' rng]) 
47694  687 
fix x assume x: "x \<in> range ?f" and inf: "emeasure lebesgue (?f ` {x} \<inter> UNIV) = \<infinity>" 
688 
have "x * emeasure lebesgue (?f ` {x} \<inter> UNIV) = (\<integral>\<^isup>S y. x * indicator (?f ` {x}) y \<partial>lebesgue)" 

689 
using f'[THEN simple_functionD(2)] 

690 
by (simp add: simple_integral_cmult_indicator) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

691 
also have "\<dots> \<le> integral\<^isup>S lebesgue f" 
47694  692 
using f'[THEN simple_functionD(2)] f 
693 
by (intro simple_integral_mono simple_function_mult simple_function_indicator) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

694 
(auto split: split_indicator) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

695 
finally show "x = 0" unfolding inf using i subsetD[OF rng x] by (auto split: split_if_asm) 
40859  696 
qed 
697 
qed 

698 

699 
lemma positive_integral_has_integral: 

43920  700 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> ereal" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

701 
assumes f: "f \<in> borel_measurable lebesgue" "range f \<subseteq> {0..<\<infinity>}" "integral\<^isup>P lebesgue f \<noteq> \<infinity>" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

702 
shows "((\<lambda>x. real (f x)) has_integral (real (integral\<^isup>P lebesgue f))) UNIV" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

703 
proof  
47694  704 
from borel_measurable_implies_simple_function_sequence'[OF f(1)] 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

705 
guess u . note u = this 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

706 
have SUP_eq: "\<And>x. (SUP i. u i x) = f x" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

707 
using u(4) f(2)[THEN subsetD] by (auto split: split_max) 
46731  708 
let ?u = "\<lambda>i x. real (u i x)" 
47694  709 
note u_eq = positive_integral_eq_simple_integral[OF u(1,5), symmetric] 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

710 
{ fix i 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

711 
note u_eq 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

712 
also have "integral\<^isup>P lebesgue (u i) \<le> (\<integral>\<^isup>+x. max 0 (f x) \<partial>lebesgue)" 
47694  713 
by (intro positive_integral_mono) (auto intro: SUP_upper simp: u(4)[symmetric]) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

714 
finally have "integral\<^isup>S lebesgue (u i) \<noteq> \<infinity>" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

715 
unfolding positive_integral_max_0 using f by auto } 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

716 
note u_fin = this 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

717 
then have u_int: "\<And>i. (?u i has_integral real (integral\<^isup>S lebesgue (u i))) UNIV" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

718 
by (rule simple_function_has_integral'[OF u(1,5)]) 
43920  719 
have "\<forall>x. \<exists>r\<ge>0. f x = ereal r" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

720 
proof 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

721 
fix x from f(2) have "0 \<le> f x" "f x \<noteq> \<infinity>" by (auto simp: subset_eq) 
43920  722 
then show "\<exists>r\<ge>0. f x = ereal r" by (cases "f x") auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

723 
qed 
43920  724 
from choice[OF this] obtain f' where f': "f = (\<lambda>x. ereal (f' x))" "\<And>x. 0 \<le> f' x" by auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

725 

43920  726 
have "\<forall>i. \<exists>r. \<forall>x. 0 \<le> r x \<and> u i x = ereal (r x)" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

727 
proof 
43920  728 
fix i show "\<exists>r. \<forall>x. 0 \<le> r x \<and> u i x = ereal (r x)" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

729 
proof (intro choice allI) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

730 
fix i x have "u i x \<noteq> \<infinity>" using u(3)[of i] by (auto simp: image_iff) metis 
43920  731 
then show "\<exists>r\<ge>0. u i x = ereal r" using u(5)[of i x] by (cases "u i x") auto 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

732 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

733 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

734 
from choice[OF this] obtain u' where 
43920  735 
u': "u = (\<lambda>i x. ereal (u' i x))" "\<And>i x. 0 \<le> u' i x" by (auto simp: fun_eq_iff) 
40859  736 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

737 
have convergent: "f' integrable_on UNIV \<and> 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

738 
(\<lambda>k. integral UNIV (u' k)) > integral UNIV f'" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

739 
proof (intro monotone_convergence_increasing allI ballI) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

740 
show int: "\<And>k. (u' k) integrable_on UNIV" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

741 
using u_int unfolding integrable_on_def u' by auto 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

742 
show "\<And>k x. u' k x \<le> u' (Suc k) x" using u(2,3,5) 
43920  743 
by (auto simp: incseq_Suc_iff le_fun_def image_iff u' intro!: real_of_ereal_positive_mono) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

744 
show "\<And>x. (\<lambda>k. u' k x) > f' x" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

745 
using SUP_eq u(2) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

746 
by (intro SUP_eq_LIMSEQ[THEN iffD1]) (auto simp: u' f' incseq_mono incseq_Suc_iff le_fun_def) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

747 
show "bounded {integral UNIV (u' k)k. True}" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

748 
proof (safe intro!: bounded_realI) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

749 
fix k 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

750 
have "\<bar>integral UNIV (u' k)\<bar> = integral UNIV (u' k)" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

751 
by (intro abs_of_nonneg integral_nonneg int ballI u') 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

752 
also have "\<dots> = real (integral\<^isup>S lebesgue (u k))" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

753 
using u_int[THEN integral_unique] by (simp add: u') 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

754 
also have "\<dots> = real (integral\<^isup>P lebesgue (u k))" 
47694  755 
using positive_integral_eq_simple_integral[OF u(1,5)] by simp 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

756 
also have "\<dots> \<le> real (integral\<^isup>P lebesgue f)" using f 
47694  757 
by (auto intro!: real_of_ereal_positive_mono positive_integral_positive 
758 
positive_integral_mono SUP_upper simp: SUP_eq[symmetric]) 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

759 
finally show "\<bar>integral UNIV (u' k)\<bar> \<le> real (integral\<^isup>P lebesgue f)" . 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

760 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

761 
qed 
40859  762 

43920  763 
have "integral\<^isup>P lebesgue f = ereal (integral UNIV f')" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

764 
proof (rule tendsto_unique[OF trivial_limit_sequentially]) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

765 
have "(\<lambda>i. integral\<^isup>S lebesgue (u i)) > (SUP i. integral\<^isup>P lebesgue (u i))" 
47694  766 
unfolding u_eq by (intro LIMSEQ_ereal_SUPR incseq_positive_integral u) 
767 
also note positive_integral_monotone_convergence_SUP 

768 
[OF u(2) borel_measurable_simple_function[OF u(1)] u(5), symmetric] 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

769 
finally show "(\<lambda>k. integral\<^isup>S lebesgue (u k)) > integral\<^isup>P lebesgue f" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

770 
unfolding SUP_eq . 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

771 

cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

772 
{ fix k 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

773 
have "0 \<le> integral\<^isup>S lebesgue (u k)" 
47694  774 
using u by (auto intro!: simple_integral_positive) 
43920  775 
then have "integral\<^isup>S lebesgue (u k) = ereal (real (integral\<^isup>S lebesgue (u k)))" 
776 
using u_fin by (auto simp: ereal_real) } 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

777 
note * = this 
43920  778 
show "(\<lambda>k. integral\<^isup>S lebesgue (u k)) > ereal (integral UNIV f')" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

779 
using convergent using u_int[THEN integral_unique, symmetric] 
47694  780 
by (subst *) (simp add: u') 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

781 
qed 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

782 
then show ?thesis using convergent by (simp add: f' integrable_integral) 
40859  783 
qed 
784 

785 
lemma lebesgue_integral_has_integral: 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

786 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

787 
assumes f: "integrable lebesgue f" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

788 
shows "(f has_integral (integral\<^isup>L lebesgue f)) UNIV" 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

789 
proof  
43920  790 
let ?n = "\<lambda>x. real (ereal (max 0 ( f x)))" and ?p = "\<lambda>x. real (ereal (max 0 (f x)))" 
791 
have *: "f = (\<lambda>x. ?p x  ?n x)" by (auto simp del: ereal_max) 

47694  792 
{ fix f :: "'a \<Rightarrow> real" have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue) = (\<integral>\<^isup>+ x. ereal (max 0 (f x)) \<partial>lebesgue)" 
793 
by (intro positive_integral_cong_pos) (auto split: split_max) } 

41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

794 
note eq = this 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

795 
show ?thesis 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

796 
unfolding lebesgue_integral_def 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

797 
apply (subst *) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

798 
apply (rule has_integral_sub) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

799 
unfolding eq[of f] eq[of "\<lambda>x.  f x"] 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

800 
apply (safe intro!: positive_integral_has_integral) 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

801 
using integrableD[OF f] 
43920  802 
by (auto simp: zero_ereal_def[symmetric] positive_integral_max_0 split: split_max 
47694  803 
intro!: measurable_If) 
40859  804 
qed 
805 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

806 
lemma lebesgue_simple_integral_eq_borel: 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

807 
assumes f: "f \<in> borel_measurable borel" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

808 
shows "integral\<^isup>S lebesgue f = integral\<^isup>S lborel f" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

809 
using f[THEN measurable_sets] 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

810 
by (auto intro!: setsum_cong arg_cong2[where f="op *"] emeasure_lborel[symmetric] 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

811 
simp: simple_integral_def) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

812 

41546
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

813 
lemma lebesgue_positive_integral_eq_borel: 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

814 
assumes f: "f \<in> borel_measurable borel" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

815 
shows "integral\<^isup>P lebesgue f = integral\<^isup>P lborel f" 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

816 
proof  
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

817 
from f have "integral\<^isup>P lebesgue (\<lambda>x. max 0 (f x)) = integral\<^isup>P lborel (\<lambda>x. max 0 (f x))" 
47694  818 
by (auto intro!: positive_integral_subalgebra[symmetric]) 
41981
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

819 
then show ?thesis unfolding positive_integral_max_0 . 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents:
41831
diff
changeset

820 
qed 
41546
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

821 

2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

822 
lemma lebesgue_integral_eq_borel: 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

823 
assumes "f \<in> borel_measurable borel" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

824 
shows "integrable lebesgue f \<longleftrightarrow> integrable lborel f" (is ?P) 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

825 
and "integral\<^isup>L lebesgue f = integral\<^isup>L lborel f" (is ?I) 
41546
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

826 
proof  
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

827 
have "sets lborel \<subseteq> sets lebesgue" by auto 
47694  828 
from integral_subalgebra[of f lborel, OF _ this _ _] assms 
41546
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

829 
show ?P ?I by auto 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

830 
qed 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

831 

2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

832 
lemma borel_integral_has_integral: 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

833 
fixes f::"'a::ordered_euclidean_space => real" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

834 
assumes f:"integrable lborel f" 
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

835 
shows "(f has_integral (integral\<^isup>L lborel f)) UNIV" 
41546
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

836 
proof  
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

837 
have borel: "f \<in> borel_measurable borel" 
41689
3e39b0e730d6
the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents:
41661
diff
changeset

838 
using f unfolding integrable_def by auto 
41546
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

839 
from f show ?thesis 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

840 
using lebesgue_integral_has_integral[of f] 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

841 
unfolding lebesgue_integral_eq_borel[OF borel] by simp 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

842 
qed 
2a12c23b7a34
integral on lebesgue measure is extension of integral on borel measure
hoelzl
parents:
41097
diff
changeset

843 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

844 
lemma integrable_on_cmult_iff: 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

845 
fixes c :: real assumes "c \<noteq> 0" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

846 
shows "(\<lambda>x. c * f x) integrable_on s \<longleftrightarrow> f integrable_on s" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

847 
using integrable_cmul[of "\<lambda>x. c * f x" s "1 / c"] integrable_cmul[of f s c] `c \<noteq> 0` 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

848 
by auto 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

849 

49777  850 
lemma positive_integral_lebesgue_has_integral: 
47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

851 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real" 
49777  852 
assumes f_borel: "f \<in> borel_measurable lebesgue" and nonneg: "\<And>x. 0 \<le> f x" 
47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

853 
assumes I: "(f has_integral I) UNIV" 
49777  854 
shows "(\<integral>\<^isup>+x. f x \<partial>lebesgue) = I" 
47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

855 
proof  
49777  856 
from f_borel have "(\<lambda>x. ereal (f x)) \<in> borel_measurable lebesgue" by auto 
47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

857 
from borel_measurable_implies_simple_function_sequence'[OF this] guess F . note F = this 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

858 

49777  859 
have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue) = (SUP i. integral\<^isup>S lebesgue (F i))" 
47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

860 
using F 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

861 
by (subst positive_integral_monotone_convergence_simple) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

862 
(simp_all add: positive_integral_max_0 simple_function_def) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

863 
also have "\<dots> \<le> ereal I" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

864 
proof (rule SUP_least) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

865 
fix i :: nat 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

866 

5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

867 
{ fix z 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

868 
from F(4)[of z] have "F i z \<le> ereal (f z)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

869 
by (metis SUP_upper UNIV_I ereal_max_0 min_max.sup_absorb2 nonneg) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

870 
with F(5)[of i z] have "real (F i z) \<le> f z" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

871 
by (cases "F i z") simp_all } 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

872 
note F_bound = this 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

873 

5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

874 
{ fix x :: ereal assume x: "x \<noteq> 0" "x \<in> range (F i)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

875 
with F(3,5)[of i] have [simp]: "real x \<noteq> 0" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

876 
by (metis image_iff order_eq_iff real_of_ereal_le_0) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

877 
let ?s = "(\<lambda>n z. real x * indicator (F i ` {x} \<inter> cube n) z) :: nat \<Rightarrow> 'a \<Rightarrow> real" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

878 
have "(\<lambda>z::'a. real x * indicator (F i ` {x}) z) integrable_on UNIV" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

879 
proof (rule dominated_convergence(1)) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

880 
fix n :: nat 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

881 
have "(\<lambda>z. indicator (F i ` {x} \<inter> cube n) z :: real) integrable_on cube n" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

882 
using x F(1)[of i] 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

883 
by (intro lebesgueD) (auto simp: simple_function_def) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

884 
then have cube: "?s n integrable_on cube n" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

885 
by (simp add: integrable_on_cmult_iff) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

886 
show "?s n integrable_on UNIV" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

887 
by (rule integrable_on_superset[OF _ _ cube]) auto 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

888 
next 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

889 
show "f integrable_on UNIV" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

890 
unfolding integrable_on_def using I by auto 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

891 
next 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

892 
fix n from F_bound show "\<forall>x\<in>UNIV. norm (?s n x) \<le> f x" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

893 
using nonneg F(5) by (auto split: split_indicator) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

894 
next 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

895 
show "\<forall>z\<in>UNIV. (\<lambda>n. ?s n z) > real x * indicator (F i ` {x}) z" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

896 
proof 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

897 
fix z :: 'a 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

898 
from mem_big_cube[of z] guess j . 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

899 
then have x: "eventually (\<lambda>n. ?s n z = real x * indicator (F i ` {x}) z) sequentially" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

900 
by (auto intro!: eventually_sequentiallyI[where c=j] dest!: cube_subset split: split_indicator) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

901 
then show "(\<lambda>n. ?s n z) > real x * indicator (F i ` {x}) z" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

902 
by (rule Lim_eventually) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

903 
qed 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

904 
qed 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

905 
then have "(indicator (F i ` {x}) :: 'a \<Rightarrow> real) integrable_on UNIV" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

906 
by (simp add: integrable_on_cmult_iff) } 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

907 
note F_finite = lmeasure_finite[OF this] 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

908 

5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

909 
have "((\<lambda>x. real (F i x)) has_integral real (integral\<^isup>S lebesgue (F i))) UNIV" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

910 
proof (rule simple_function_has_integral[of "F i"]) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

911 
show "simple_function lebesgue (F i)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

912 
using F(1) by (simp add: simple_function_def) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

913 
show "range (F i) \<subseteq> {0..<\<infinity>}" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

914 
using F(3,5)[of i] by (auto simp: image_iff) metis 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

915 
next 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

916 
fix x assume "x \<in> range (F i)" "emeasure lebesgue (F i ` {x} \<inter> UNIV) = \<infinity>" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

917 
with F_finite[of x] show "x = 0" by auto 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

918 
qed 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

919 
from this I have "real (integral\<^isup>S lebesgue (F i)) \<le> I" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

920 
by (rule has_integral_le) (intro ballI F_bound) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

921 
moreover 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

922 
{ fix x assume x: "x \<in> range (F i)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

923 
with F(3,5)[of i] have "x = 0 \<or> (0 < x \<and> x \<noteq> \<infinity>)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

924 
by (auto simp: image_iff le_less) metis 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

925 
with F_finite[OF _ x] x have "x * emeasure lebesgue (F i ` {x} \<inter> UNIV) \<noteq> \<infinity>" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

926 
by auto } 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

927 
then have "integral\<^isup>S lebesgue (F i) \<noteq> \<infinity>" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

928 
unfolding simple_integral_def setsum_Pinfty space_lebesgue by blast 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

929 
moreover have "0 \<le> integral\<^isup>S lebesgue (F i)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

930 
using F(1,5) by (intro simple_integral_positive) (auto simp: simple_function_def) 
49777  931 
ultimately show "integral\<^isup>S lebesgue (F i) \<le> ereal I" 
932 
by (cases "integral\<^isup>S lebesgue (F i)") auto 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

933 
qed 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

934 
also have "\<dots> < \<infinity>" by simp 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

935 
finally have finite: "(\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue) \<noteq> \<infinity>" by simp 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

936 
have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable lebesgue" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

937 
using f_borel by (auto intro: borel_measurable_lebesgueI) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

938 
from positive_integral_has_integral[OF borel _ finite] 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

939 
have "(f has_integral real (\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue)) UNIV" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

940 
using nonneg by (simp add: subset_eq) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

941 
with I have "I = real (\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue)" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

942 
by (rule has_integral_unique) 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

943 
with finite positive_integral_positive[of _ "\<lambda>x. ereal (f x)"] show ?thesis 
49777  944 
by (cases "\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue") auto 
47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

945 
qed 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

946 

49777  947 
lemma has_integral_iff_positive_integral_lebesgue: 
948 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real" 

949 
assumes f: "f \<in> borel_measurable lebesgue" "\<And>x. 0 \<le> f x" 

950 
shows "(f has_integral I) UNIV \<longleftrightarrow> integral\<^isup>P lebesgue f = I" 

951 
using f positive_integral_lebesgue_has_integral[of f I] positive_integral_has_integral[of f] 

952 
by (auto simp: subset_eq) 

953 

954 
lemma has_integral_iff_positive_integral_lborel: 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

955 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

956 
assumes f: "f \<in> borel_measurable borel" "\<And>x. 0 \<le> f x" 
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

957 
shows "(f has_integral I) UNIV \<longleftrightarrow> integral\<^isup>P lborel f = I" 
49777  958 
using assms 
959 
by (subst has_integral_iff_positive_integral_lebesgue) 

960 
(auto simp: borel_measurable_lebesgueI lebesgue_positive_integral_eq_borel) 

961 

962 
subsection {* Equivalence between product spaces and euclidean spaces *} 

963 

964 
definition e2p :: "'a::ordered_euclidean_space \<Rightarrow> (nat \<Rightarrow> real)" where 

965 
"e2p x = (\<lambda>i\<in>{..<DIM('a)}. x$$i)" 

966 

967 
definition p2e :: "(nat \<Rightarrow> real) \<Rightarrow> 'a::ordered_euclidean_space" where 

968 
"p2e x = (\<chi>\<chi> i. x i)" 

969 

970 
lemma e2p_p2e[simp]: 

971 
"x \<in> extensional {..<DIM('a)} \<Longrightarrow> e2p (p2e x::'a::ordered_euclidean_space) = x" 

972 
by (auto simp: fun_eq_iff extensional_def p2e_def e2p_def) 

973 

974 
lemma p2e_e2p[simp]: 

975 
"p2e (e2p x) = (x::'a::ordered_euclidean_space)" 

976 
by (auto simp: euclidean_eq[where 'a='a] p2e_def e2p_def) 

977 

978 
interpretation lborel_product: product_sigma_finite "\<lambda>x. lborel::real measure" 

979 
by default 

980 

981 
interpretation lborel_space: finite_product_sigma_finite "\<lambda>x. lborel::real measure" "{..<n}" for n :: nat 

982 
by default auto 

983 

984 
lemma bchoice_iff: "(\<forall>x\<in>A. \<exists>y. P x y) \<longleftrightarrow> (\<exists>f. \<forall>x\<in>A. P x (f x))" 

985 
by metis 

986 

987 
lemma sets_product_borel: 

988 
assumes I: "finite I" 

989 
shows "sets (\<Pi>\<^isub>M i\<in>I. lborel) = sigma_sets (\<Pi>\<^isub>E i\<in>I. UNIV) { \<Pi>\<^isub>E i\<in>I. {..< x i :: real}  x. True}" (is "_ = ?G") 

990 
proof (subst sigma_prod_algebra_sigma_eq[where S="\<lambda>_ i::nat. {..<real i}" and E="\<lambda>_. range lessThan", OF I]) 

991 
show "sigma_sets (space (Pi\<^isub>M I (\<lambda>i. lborel))) {Pi\<^isub>E I F F. \<forall>i\<in>I. F i \<in> range lessThan} = ?G" 

992 
by (intro arg_cong2[where f=sigma_sets]) (auto simp: space_PiM image_iff bchoice_iff) 

993 
qed (auto simp: borel_eq_lessThan incseq_def reals_Archimedean2 image_iff intro: real_natceiling_ge) 

994 

995 
lemma measurable_e2p: 

996 
"e2p \<in> measurable (borel::'a::ordered_euclidean_space measure) (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure))" 

997 
proof (rule measurable_sigma_sets[OF sets_product_borel]) 

998 
fix A :: "(nat \<Rightarrow> real) set" assume "A \<in> {\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {..<x i} x. True} " 

999 
then obtain x where "A = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {..<x i})" by auto 

1000 
then have "e2p ` A = {..< (\<chi>\<chi> i. x i) :: 'a}" 

1001 
using DIM_positive by (auto simp add: Pi_iff set_eq_iff e2p_def 

1002 
euclidean_eq[where 'a='a] eucl_less[where 'a='a]) 

1003 
then show "e2p ` A \<inter> space (borel::'a measure) \<in> sets borel" by simp 

1004 
qed (auto simp: e2p_def) 

1005 

1006 
lemma measurable_p2e: 

1007 
"p2e \<in> measurable (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure)) 

1008 
(borel :: 'a::ordered_euclidean_space measure)" 

1009 
(is "p2e \<in> measurable ?P _") 

1010 
proof (safe intro!: borel_measurable_iff_halfspace_le[THEN iffD2]) 

1011 
fix x i 

1012 
let ?A = "{w \<in> space ?P. (p2e w :: 'a) $$ i \<le> x}" 

1013 
assume "i < DIM('a)" 

1014 
then have "?A = (\<Pi>\<^isub>E j\<in>{..<DIM('a)}. if i = j then {.. x} else UNIV)" 

1015 
using DIM_positive by (auto simp: space_PiM p2e_def split: split_if_asm) 

1016 
then show "?A \<in> sets ?P" 

1017 
by auto 

1018 
qed 

1019 

1020 
lemma lborel_eq_lborel_space: 

1021 
"(lborel :: 'a measure) = distr (\<Pi>\<^isub>M i\<in>{..<DIM('a::ordered_euclidean_space)}. lborel) borel p2e" 

1022 
(is "?B = ?D") 

1023 
proof (rule lborel_eqI) 

1024 
show "sets ?D = sets borel" by simp 

1025 
let ?P = "(\<Pi>\<^isub>M i\<in>{..<DIM('a::ordered_euclidean_space)}. lborel)" 

1026 
fix a b :: 'a 

1027 
have *: "p2e ` {a .. b} \<inter> space ?P = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {a $$ i .. b $$ i})" 

1028 
by (auto simp: Pi_iff eucl_le[where 'a='a] p2e_def space_PiM) 

1029 
have "emeasure ?P (p2e ` {a..b} \<inter> space ?P) = content {a..b}" 

1030 
proof cases 

1031 
assume "{a..b} \<noteq> {}" 

1032 
then have "a \<le> b" 

1033 
by (simp add: interval_ne_empty eucl_le[where 'a='a]) 

1034 
then have "emeasure lborel {a..b} = (\<Prod>x<DIM('a). emeasure lborel {a $$ x .. b $$ x})" 

1035 
by (auto simp: content_closed_interval eucl_le[where 'a='a] 

1036 
intro!: setprod_ereal[symmetric]) 

1037 
also have "\<dots> = emeasure ?P (p2e ` {a..b} \<inter> space ?P)" 

1038 
unfolding * by (subst lborel_space.measure_times) auto 

1039 
finally show ?thesis by simp 

1040 
qed simp 

1041 
then show "emeasure ?D {a .. b} = content {a .. b}" 

1042 
by (simp add: emeasure_distr measurable_p2e) 

1043 
qed 

1044 

1045 
lemma borel_fubini_positiv_integral: 

1046 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> ereal" 

1047 
assumes f: "f \<in> borel_measurable borel" 

1048 
shows "integral\<^isup>P lborel f = \<integral>\<^isup>+x. f (p2e x) \<partial>(\<Pi>\<^isub>M i\<in>{..<DIM('a)}. lborel)" 

1049 
by (subst lborel_eq_lborel_space) (simp add: positive_integral_distr measurable_p2e f) 

1050 

1051 
lemma borel_fubini_integrable: 

1052 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real" 

1053 
shows "integrable lborel f \<longleftrightarrow> 

1054 
integrable (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. lborel) (\<lambda>x. f (p2e x))" 

1055 
(is "_ \<longleftrightarrow> integrable ?B ?f") 

1056 
proof 

1057 
assume "integrable lborel f" 

1058 
moreover then have f: "f \<in> borel_measurable borel" 

1059 
by auto 

1060 
moreover with measurable_p2e 

1061 
have "f \<circ> p2e \<in> borel_measurable ?B" 

1062 
by (rule measurable_comp) 

1063 
ultimately show "integrable ?B ?f" 

1064 
by (simp add: comp_def borel_fubini_positiv_integral integrable_def) 

1065 
next 

1066 
assume "integrable ?B ?f" 

1067 
moreover 

1068 
then have "?f \<circ> e2p \<in> borel_measurable (borel::'a measure)" 

1069 
by (auto intro!: measurable_e2p) 

1070 
then have "f \<in> borel_measurable borel" 

1071 
by (simp cong: measurable_cong) 

1072 
ultimately show "integrable lborel f" 

1073 
by (simp add: borel_fubini_positiv_integral integrable_def) 

1074 
qed 

1075 

1076 
lemma borel_fubini: 

1077 
fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real" 

1078 
assumes f: "f \<in> borel_measurable borel" 

1079 
shows "integral\<^isup>L lborel f = \<integral>x. f (p2e x) \<partial>((\<Pi>\<^isub>M i\<in>{..<DIM('a)}. lborel))" 

1080 
using f by (simp add: borel_fubini_positiv_integral lebesgue_integral_def) 

47757
5e6fe71e2390
equate positive Lebesgue integral and MVAnalysis' Gauge integral
hoelzl
parents:
47694
diff
changeset

1081 

38656  1082 
end 