author | hoelzl |
Mon, 23 Aug 2010 19:35:57 +0200 | |
changeset 38656 | d5d342611edb |
parent 37032 | 58a0757031dd |
child 39089 | df379a447753 |
permissions | -rw-r--r-- |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
1 |
header {*Measures*} |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
2 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
3 |
theory Measure |
38656 | 4 |
imports Caratheodory |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
5 |
begin |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
6 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
7 |
text{*From the Hurd/Coble measure theory development, translated by Lawrence Paulson.*} |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
8 |
|
38656 | 9 |
section {* Equations for the measure function @{text \<mu>} *} |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
10 |
|
38656 | 11 |
lemma (in measure_space) measure_countably_additive: |
12 |
assumes "range A \<subseteq> sets M" "disjoint_family A" |
|
13 |
shows "psuminf (\<lambda>i. \<mu> (A i)) = \<mu> (\<Union>i. A i)" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
14 |
proof - |
38656 | 15 |
have "(\<Union> i. A i) \<in> sets M" using assms(1) by (rule countable_UN) |
16 |
with ca assms show ?thesis by (simp add: countably_additive_def) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
17 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
18 |
|
38656 | 19 |
lemma (in measure_space) measure_space_cong: |
20 |
assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<mu> A" |
|
21 |
shows "measure_space M \<nu>" |
|
22 |
proof |
|
23 |
show "\<nu> {} = 0" using assms by auto |
|
24 |
show "countably_additive M \<nu>" unfolding countably_additive_def |
|
25 |
proof safe |
|
26 |
fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "disjoint_family A" |
|
27 |
then have "\<And>i. A i \<in> sets M" "(UNION UNIV A) \<in> sets M" by auto |
|
28 |
from this[THEN assms] measure_countably_additive[OF A] |
|
29 |
show "(\<Sum>\<^isub>\<infinity>n. \<nu> (A n)) = \<nu> (UNION UNIV A)" by simp |
|
30 |
qed |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
31 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
32 |
|
38656 | 33 |
lemma (in measure_space) additive: "additive M \<mu>" |
34 |
proof (rule algebra.countably_additive_additive [OF _ _ ca]) |
|
35 |
show "algebra M" by default |
|
36 |
show "positive \<mu>" by (simp add: positive_def) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
37 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
38 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
39 |
lemma (in measure_space) measure_additive: |
38656 | 40 |
"a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {} |
41 |
\<Longrightarrow> \<mu> a + \<mu> b = \<mu> (a \<union> b)" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
42 |
by (metis additiveD additive) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
43 |
|
36624 | 44 |
lemma (in measure_space) measure_mono: |
45 |
assumes "a \<subseteq> b" "a \<in> sets M" "b \<in> sets M" |
|
38656 | 46 |
shows "\<mu> a \<le> \<mu> b" |
36624 | 47 |
proof - |
48 |
have "b = a \<union> (b - a)" using assms by auto |
|
49 |
moreover have "{} = a \<inter> (b - a)" by auto |
|
38656 | 50 |
ultimately have "\<mu> b = \<mu> a + \<mu> (b - a)" |
36624 | 51 |
using measure_additive[of a "b - a"] local.Diff[of b a] assms by auto |
38656 | 52 |
moreover have "\<mu> (b - a) \<ge> 0" using assms by auto |
53 |
ultimately show "\<mu> a \<le> \<mu> b" by auto |
|
36624 | 54 |
qed |
55 |
||
38656 | 56 |
lemma (in measure_space) measure_compl: |
57 |
assumes s: "s \<in> sets M" and fin: "\<mu> s \<noteq> \<omega>" |
|
58 |
shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
59 |
proof - |
38656 | 60 |
have s_less_space: "\<mu> s \<le> \<mu> (space M)" |
61 |
using s by (auto intro!: measure_mono sets_into_space) |
|
62 |
||
63 |
have "\<mu> (space M) = \<mu> (s \<union> (space M - s))" using s |
|
64 |
by (metis Un_Diff_cancel Un_absorb1 s sets_into_space) |
|
65 |
also have "... = \<mu> s + \<mu> (space M - s)" |
|
66 |
by (rule additiveD [OF additive]) (auto simp add: s) |
|
67 |
finally have "\<mu> (space M) = \<mu> s + \<mu> (space M - s)" . |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
68 |
thus ?thesis |
38656 | 69 |
unfolding minus_pinfreal_eq2[OF s_less_space fin] |
70 |
by (simp add: ac_simps) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
71 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
72 |
|
38656 | 73 |
lemma (in measure_space) measure_Diff: |
74 |
assumes finite: "\<mu> B \<noteq> \<omega>" |
|
75 |
and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A" |
|
76 |
shows "\<mu> (A - B) = \<mu> A - \<mu> B" |
|
77 |
proof - |
|
78 |
have *: "(A - B) \<union> B = A" using `B \<subseteq> A` by auto |
|
79 |
||
80 |
have "\<mu> ((A - B) \<union> B) = \<mu> (A - B) + \<mu> B" |
|
81 |
using measurable by (rule_tac measure_additive[symmetric]) auto |
|
82 |
thus ?thesis unfolding * using `\<mu> B \<noteq> \<omega>` |
|
83 |
by (simp add: pinfreal_cancel_plus_minus) |
|
84 |
qed |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
85 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
86 |
lemma (in measure_space) measure_countable_increasing: |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
87 |
assumes A: "range A \<subseteq> sets M" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
88 |
and A0: "A 0 = {}" |
38656 | 89 |
and ASuc: "\<And>n. A n \<subseteq> A (Suc n)" |
90 |
shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
91 |
proof - |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
92 |
{ |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
93 |
fix n |
38656 | 94 |
have "\<mu> (A n) = |
95 |
setsum (\<mu> \<circ> (\<lambda>i. A (Suc i) - A i)) {..<n}" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
96 |
proof (induct n) |
37032 | 97 |
case 0 thus ?case by (auto simp add: A0) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
98 |
next |
38656 | 99 |
case (Suc m) |
33536 | 100 |
have "A (Suc m) = A m \<union> (A (Suc m) - A m)" |
101 |
by (metis ASuc Un_Diff_cancel Un_absorb1) |
|
38656 | 102 |
hence "\<mu> (A (Suc m)) = |
103 |
\<mu> (A m) + \<mu> (A (Suc m) - A m)" |
|
104 |
by (subst measure_additive) |
|
105 |
(auto simp add: measure_additive range_subsetD [OF A]) |
|
33536 | 106 |
with Suc show ?case |
107 |
by simp |
|
38656 | 108 |
qed } |
109 |
note Meq = this |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
110 |
have Aeq: "(\<Union>i. A (Suc i) - A i) = (\<Union>i. A i)" |
38656 | 111 |
proof (rule UN_finite2_eq [where k=1], simp) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
112 |
fix i |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
113 |
show "(\<Union>i\<in>{0..<i}. A (Suc i) - A i) = (\<Union>i\<in>{0..<Suc i}. A i)" |
33536 | 114 |
proof (induct i) |
115 |
case 0 thus ?case by (simp add: A0) |
|
116 |
next |
|
38656 | 117 |
case (Suc i) |
33536 | 118 |
thus ?case |
119 |
by (auto simp add: atLeastLessThanSuc intro: subsetD [OF ASuc]) |
|
120 |
qed |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
121 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
122 |
have A1: "\<And>i. A (Suc i) - A i \<in> sets M" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
123 |
by (metis A Diff range_subsetD) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
124 |
have A2: "(\<Union>i. A (Suc i) - A i) \<in> sets M" |
37032 | 125 |
by (blast intro: range_subsetD [OF A]) |
38656 | 126 |
have "psuminf ( (\<lambda>i. \<mu> (A (Suc i) - A i))) = \<mu> (\<Union>i. A (Suc i) - A i)" |
127 |
by (rule measure_countably_additive) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
128 |
(auto simp add: disjoint_family_Suc ASuc A1 A2) |
38656 | 129 |
also have "... = \<mu> (\<Union>i. A i)" |
130 |
by (simp add: Aeq) |
|
131 |
finally have "psuminf (\<lambda>i. \<mu> (A (Suc i) - A i)) = \<mu> (\<Union>i. A i)" . |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
132 |
thus ?thesis |
38656 | 133 |
by (auto simp add: Meq psuminf_def) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
134 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
135 |
|
38656 | 136 |
lemma (in measure_space) continuity_from_below: |
137 |
assumes A: "range A \<subseteq> sets M" |
|
138 |
and ASuc: "!!n. A n \<subseteq> A (Suc n)" |
|
139 |
shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" |
|
140 |
proof - |
|
141 |
have *: "(SUP n. \<mu> (nat_case {} A (Suc n))) = (SUP n. \<mu> (nat_case {} A n))" |
|
142 |
apply (rule Sup_mono_offset_Suc) |
|
143 |
apply (rule measure_mono) |
|
144 |
using assms by (auto split: nat.split) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
145 |
|
38656 | 146 |
have ueq: "(\<Union>i. nat_case {} A i) = (\<Union>i. A i)" |
147 |
by (auto simp add: split: nat.splits) |
|
148 |
have meq: "\<And>n. \<mu> (A n) = (\<mu> \<circ> nat_case {} A) (Suc n)" |
|
149 |
by simp |
|
150 |
have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. nat_case {} A i)" |
|
151 |
by (rule measure_countable_increasing) |
|
152 |
(auto simp add: range_subsetD [OF A] subsetD [OF ASuc] split: nat.splits) |
|
153 |
also have "\<mu> (\<Union>i. nat_case {} A i) = \<mu> (\<Union>i. A i)" |
|
154 |
by (simp add: ueq) |
|
155 |
finally have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. A i)" . |
|
156 |
thus ?thesis unfolding meq * comp_def . |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
157 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
158 |
|
38656 | 159 |
lemma (in measure_space) measure_up: |
160 |
assumes "P \<in> sets M" "\<And>i. B i \<in> sets M" "B \<up> P" |
|
161 |
shows "(\<lambda>i. \<mu> (B i)) \<up> \<mu> P" |
|
162 |
using assms unfolding isoton_def |
|
163 |
by (auto intro!: measure_mono continuity_from_below) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
164 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
165 |
|
38656 | 166 |
lemma (in measure_space) continuity_from_above: |
167 |
assumes A: "range A \<subseteq> sets M" |
|
168 |
and mono_Suc: "\<And>n. A (Suc n) \<subseteq> A n" |
|
169 |
and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>" |
|
170 |
shows "(INF n. \<mu> (A n)) = \<mu> (\<Inter>i. A i)" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
171 |
proof - |
38656 | 172 |
{ fix n have "A n \<subseteq> A 0" using mono_Suc by (induct n) auto } |
173 |
note mono = this |
|
174 |
||
175 |
have le_MI: "\<mu> (\<Inter>i. A i) \<le> \<mu> (A 0)" |
|
176 |
using A by (auto intro!: measure_mono) |
|
177 |
hence *: "\<mu> (\<Inter>i. A i) \<noteq> \<omega>" using finite[of 0] by auto |
|
178 |
||
179 |
have le_IM: "(INF n. \<mu> (A n)) \<le> \<mu> (A 0)" |
|
180 |
by (rule INF_leI) simp |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
181 |
|
38656 | 182 |
have "\<mu> (A 0) - (INF n. \<mu> (A n)) = (SUP n. \<mu> (A 0 - A n))" |
183 |
unfolding pinfreal_SUP_minus[symmetric] |
|
184 |
using mono A finite by (subst measure_Diff) auto |
|
185 |
also have "\<dots> = \<mu> (\<Union>i. A 0 - A i)" |
|
186 |
proof (rule continuity_from_below) |
|
187 |
show "range (\<lambda>n. A 0 - A n) \<subseteq> sets M" |
|
188 |
using A by auto |
|
189 |
show "\<And>n. A 0 - A n \<subseteq> A 0 - A (Suc n)" |
|
190 |
using mono_Suc by auto |
|
191 |
qed |
|
192 |
also have "\<dots> = \<mu> (A 0) - \<mu> (\<Inter>i. A i)" |
|
193 |
using mono A finite * by (simp, subst measure_Diff) auto |
|
194 |
finally show ?thesis |
|
195 |
by (rule pinfreal_diff_eq_diff_imp_eq[OF finite[of 0] le_IM le_MI]) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
196 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
197 |
|
38656 | 198 |
lemma (in measure_space) measure_down: |
199 |
assumes "P \<in> sets M" "\<And>i. B i \<in> sets M" "B \<down> P" |
|
200 |
and finite: "\<And>i. \<mu> (B i) \<noteq> \<omega>" |
|
201 |
shows "(\<lambda>i. \<mu> (B i)) \<down> \<mu> P" |
|
202 |
using assms unfolding antiton_def |
|
203 |
by (auto intro!: measure_mono continuity_from_above) |
|
204 |
lemma (in measure_space) measure_insert: |
|
205 |
assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A" |
|
206 |
shows "\<mu> (insert x A) = \<mu> {x} + \<mu> A" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
207 |
proof - |
38656 | 208 |
have "{x} \<inter> A = {}" using `x \<notin> A` by auto |
209 |
from measure_additive[OF sets this] show ?thesis by simp |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
210 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
211 |
|
38656 | 212 |
lemma (in measure_space) measure_finite_singleton: |
213 |
assumes fin: "finite S" |
|
214 |
and ssets: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M" |
|
215 |
shows "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})" |
|
216 |
using assms proof induct |
|
217 |
case (insert x S) |
|
218 |
have *: "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})" "{x} \<in> sets M" |
|
219 |
using insert.prems by (blast intro!: insert.hyps(3))+ |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
220 |
|
38656 | 221 |
have "(\<Union>x\<in>S. {x}) \<in> sets M" |
222 |
using insert.prems `finite S` by (blast intro!: finite_UN) |
|
223 |
hence "S \<in> sets M" by auto |
|
224 |
from measure_insert[OF `{x} \<in> sets M` this `x \<notin> S`] |
|
225 |
show ?case using `x \<notin> S` `finite S` * by simp |
|
226 |
qed simp |
|
35582 | 227 |
|
228 |
lemma (in measure_space) measure_finitely_additive': |
|
38656 | 229 |
assumes "f \<in> ({..< n :: nat} \<rightarrow> sets M)" |
35582 | 230 |
assumes "\<And> a b. \<lbrakk>a < n ; b < n ; a \<noteq> b\<rbrakk> \<Longrightarrow> f a \<inter> f b = {}" |
38656 | 231 |
assumes "s = \<Union> (f ` {..< n})" |
232 |
shows "(\<Sum>i<n. (\<mu> \<circ> f) i) = \<mu> s" |
|
35582 | 233 |
proof - |
234 |
def f' == "\<lambda> i. (if i < n then f i else {})" |
|
38656 | 235 |
have rf: "range f' \<subseteq> sets M" unfolding f'_def |
35582 | 236 |
using assms empty_sets by auto |
38656 | 237 |
have df: "disjoint_family f'" unfolding f'_def disjoint_family_on_def |
35582 | 238 |
using assms by simp |
38656 | 239 |
have "\<Union> range f' = (\<Union> i \<in> {..< n}. f i)" |
35582 | 240 |
unfolding f'_def by auto |
38656 | 241 |
then have "\<mu> s = \<mu> (\<Union> range f')" |
35582 | 242 |
using assms by simp |
38656 | 243 |
then have part1: "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = \<mu> s" |
35582 | 244 |
using df rf ca[unfolded countably_additive_def, rule_format, of f'] |
245 |
by auto |
|
246 |
||
38656 | 247 |
have "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = (\<Sum> i< n. \<mu> (f' i))" |
248 |
by (rule psuminf_finite) (simp add: f'_def) |
|
249 |
also have "\<dots> = (\<Sum>i<n. \<mu> (f i))" |
|
35582 | 250 |
unfolding f'_def by auto |
38656 | 251 |
finally have part2: "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = (\<Sum>i<n. \<mu> (f i))" by simp |
252 |
show ?thesis using part1 part2 by auto |
|
35582 | 253 |
qed |
254 |
||
255 |
||
256 |
lemma (in measure_space) measure_finitely_additive: |
|
257 |
assumes "finite r" |
|
258 |
assumes "r \<subseteq> sets M" |
|
259 |
assumes d: "\<And> a b. \<lbrakk>a \<in> r ; b \<in> r ; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}" |
|
38656 | 260 |
shows "(\<Sum> i \<in> r. \<mu> i) = \<mu> (\<Union> r)" |
35582 | 261 |
using assms |
262 |
proof - |
|
263 |
(* counting the elements in r is enough *) |
|
38656 | 264 |
let ?R = "{..<card r}" |
35582 | 265 |
obtain f where f: "f ` ?R = r" "inj_on f ?R" |
266 |
using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite r`] |
|
38656 | 267 |
unfolding atLeast0LessThan by auto |
35582 | 268 |
hence f_into_sets: "f \<in> ?R \<rightarrow> sets M" using assms by auto |
269 |
have disj: "\<And> a b. \<lbrakk>a \<in> ?R ; b \<in> ?R ; a \<noteq> b\<rbrakk> \<Longrightarrow> f a \<inter> f b = {}" |
|
270 |
proof - |
|
271 |
fix a b assume asm: "a \<in> ?R" "b \<in> ?R" "a \<noteq> b" |
|
272 |
hence neq: "f a \<noteq> f b" using f[unfolded inj_on_def, rule_format] by blast |
|
273 |
from asm have "f a \<in> r" "f b \<in> r" using f by auto |
|
274 |
thus "f a \<inter> f b = {}" using d[of "f a" "f b"] f using neq by auto |
|
275 |
qed |
|
276 |
have "(\<Union> r) = (\<Union> i \<in> ?R. f i)" |
|
277 |
using f by auto |
|
38656 | 278 |
hence "\<mu> (\<Union> r)= \<mu> (\<Union> i \<in> ?R. f i)" by simp |
279 |
also have "\<dots> = (\<Sum> i \<in> ?R. \<mu> (f i))" |
|
35582 | 280 |
using measure_finitely_additive'[OF f_into_sets disj] by simp |
38656 | 281 |
also have "\<dots> = (\<Sum> a \<in> r. \<mu> a)" |
282 |
using f[rule_format] setsum_reindex[of f ?R "\<lambda> a. \<mu> a"] by auto |
|
35582 | 283 |
finally show ?thesis by simp |
284 |
qed |
|
285 |
||
286 |
lemma (in measure_space) measure_finitely_additive'': |
|
287 |
assumes "finite s" |
|
288 |
assumes "\<And> i. i \<in> s \<Longrightarrow> a i \<in> sets M" |
|
289 |
assumes d: "disjoint_family_on a s" |
|
38656 | 290 |
shows "(\<Sum> i \<in> s. \<mu> (a i)) = \<mu> (\<Union> i \<in> s. a i)" |
35582 | 291 |
using assms |
292 |
proof - |
|
293 |
(* counting the elements in s is enough *) |
|
38656 | 294 |
let ?R = "{..< card s}" |
35582 | 295 |
obtain f where f: "f ` ?R = s" "inj_on f ?R" |
296 |
using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite s`] |
|
38656 | 297 |
unfolding atLeast0LessThan by auto |
35582 | 298 |
hence f_into_sets: "a \<circ> f \<in> ?R \<rightarrow> sets M" using assms unfolding o_def by auto |
299 |
have disj: "\<And> i j. \<lbrakk>i \<in> ?R ; j \<in> ?R ; i \<noteq> j\<rbrakk> \<Longrightarrow> (a \<circ> f) i \<inter> (a \<circ> f) j = {}" |
|
300 |
proof - |
|
301 |
fix i j assume asm: "i \<in> ?R" "j \<in> ?R" "i \<noteq> j" |
|
302 |
hence neq: "f i \<noteq> f j" using f[unfolded inj_on_def, rule_format] by blast |
|
303 |
from asm have "f i \<in> s" "f j \<in> s" using f by auto |
|
304 |
thus "(a \<circ> f) i \<inter> (a \<circ> f) j = {}" |
|
305 |
using d f neq unfolding disjoint_family_on_def by auto |
|
306 |
qed |
|
307 |
have "(\<Union> i \<in> s. a i) = (\<Union> i \<in> f ` ?R. a i)" using f by auto |
|
308 |
hence "(\<Union> i \<in> s. a i) = (\<Union> i \<in> ?R. a (f i))" by auto |
|
38656 | 309 |
hence "\<mu> (\<Union> i \<in> s. a i) = (\<Sum> i \<in> ?R. \<mu> (a (f i)))" |
35582 | 310 |
using measure_finitely_additive'[OF f_into_sets disj] by simp |
38656 | 311 |
also have "\<dots> = (\<Sum> i \<in> s. \<mu> (a i))" |
312 |
using f[rule_format] setsum_reindex[of f ?R "\<lambda> i. \<mu> (a i)"] by auto |
|
35582 | 313 |
finally show ?thesis by simp |
314 |
qed |
|
315 |
||
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
316 |
lemma (in sigma_algebra) finite_additivity_sufficient: |
38656 | 317 |
assumes fin: "finite (space M)" and pos: "positive \<mu>" and add: "additive M \<mu>" |
318 |
shows "measure_space M \<mu>" |
|
319 |
proof |
|
320 |
show [simp]: "\<mu> {} = 0" using pos by (simp add: positive_def) |
|
321 |
show "countably_additive M \<mu>" |
|
322 |
proof (auto simp add: countably_additive_def) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
323 |
fix A :: "nat \<Rightarrow> 'a set" |
38656 | 324 |
assume A: "range A \<subseteq> sets M" |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
325 |
and disj: "disjoint_family A" |
38656 | 326 |
and UnA: "(\<Union>i. A i) \<in> sets M" |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
327 |
def I \<equiv> "{i. A i \<noteq> {}}" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
328 |
have "Union (A ` I) \<subseteq> space M" using A |
38656 | 329 |
by auto (metis range_subsetD subsetD sets_into_space) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
330 |
hence "finite (A ` I)" |
38656 | 331 |
by (metis finite_UnionD finite_subset fin) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
332 |
moreover have "inj_on A I" using disj |
38656 | 333 |
by (auto simp add: I_def disjoint_family_on_def inj_on_def) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
334 |
ultimately have finI: "finite I" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
335 |
by (metis finite_imageD) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
336 |
hence "\<exists>N. \<forall>m\<ge>N. A m = {}" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
337 |
proof (cases "I = {}") |
38656 | 338 |
case True thus ?thesis by (simp add: I_def) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
339 |
next |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
340 |
case False |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
341 |
hence "\<forall>i\<in>I. i < Suc(Max I)" |
38656 | 342 |
by (simp add: Max_less_iff [symmetric] finI) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
343 |
hence "\<forall>m \<ge> Suc(Max I). A m = {}" |
38656 | 344 |
by (simp add: I_def) (metis less_le_not_le) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
345 |
thus ?thesis |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
346 |
by blast |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
347 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
348 |
then obtain N where N: "\<forall>m\<ge>N. A m = {}" by blast |
38656 | 349 |
then have "\<forall>m\<ge>N. \<mu> (A m) = 0" by simp |
350 |
then have "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = setsum (\<lambda>m. \<mu> (A m)) {..<N}" |
|
351 |
by (simp add: psuminf_finite) |
|
352 |
also have "... = \<mu> (\<Union>i<N. A i)" |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
353 |
proof (induct N) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
354 |
case 0 thus ?case by simp |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
355 |
next |
38656 | 356 |
case (Suc n) |
357 |
have "\<mu> (A n \<union> (\<Union> x<n. A x)) = \<mu> (A n) + \<mu> (\<Union> i<n. A i)" |
|
358 |
proof (rule Caratheodory.additiveD [OF add]) |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
359 |
show "A n \<inter> (\<Union> x<n. A x) = {}" using disj |
35582 | 360 |
by (auto simp add: disjoint_family_on_def nat_less_le) blast |
38656 | 361 |
show "A n \<in> sets M" using A |
362 |
by force |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
363 |
show "(\<Union>i<n. A i) \<in> sets M" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
364 |
proof (induct n) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
365 |
case 0 thus ?case by simp |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
366 |
next |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
367 |
case (Suc n) thus ?case using A |
38656 | 368 |
by (simp add: lessThan_Suc Un range_subsetD) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
369 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
370 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
371 |
thus ?case using Suc |
38656 | 372 |
by (simp add: lessThan_Suc) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
373 |
qed |
38656 | 374 |
also have "... = \<mu> (\<Union>i. A i)" |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
375 |
proof - |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
376 |
have "(\<Union> i<N. A i) = (\<Union>i. A i)" using N |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
377 |
by auto (metis Int_absorb N disjoint_iff_not_equal lessThan_iff not_leE) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
378 |
thus ?thesis by simp |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
379 |
qed |
38656 | 380 |
finally show "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" . |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
381 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
382 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
diff
changeset
|
383 |
|
35692 | 384 |
lemma (in measure_space) measure_setsum_split: |
385 |
assumes "finite r" and "a \<in> sets M" and br_in_M: "b ` r \<subseteq> sets M" |
|
386 |
assumes "(\<Union>i \<in> r. b i) = space M" |
|
387 |
assumes "disjoint_family_on b r" |
|
38656 | 388 |
shows "\<mu> a = (\<Sum> i \<in> r. \<mu> (a \<inter> (b i)))" |
35692 | 389 |
proof - |
38656 | 390 |
have *: "\<mu> a = \<mu> (\<Union>i \<in> r. a \<inter> b i)" |
35692 | 391 |
using assms by auto |
392 |
show ?thesis unfolding * |
|
393 |
proof (rule measure_finitely_additive''[symmetric]) |
|
394 |
show "finite r" using `finite r` by auto |
|
395 |
{ fix i assume "i \<in> r" |
|
396 |
hence "b i \<in> sets M" using br_in_M by auto |
|
397 |
thus "a \<inter> b i \<in> sets M" using `a \<in> sets M` by auto |
|
398 |
} |
|
399 |
show "disjoint_family_on (\<lambda>i. a \<inter> b i) r" |
|
400 |
using `disjoint_family_on b r` |
|
401 |
unfolding disjoint_family_on_def by auto |
|
402 |
qed |
|
403 |
qed |
|
404 |
||
38656 | 405 |
lemma (in measure_space) measure_subadditive: |
406 |
assumes measurable: "A \<in> sets M" "B \<in> sets M" |
|
407 |
shows "\<mu> (A \<union> B) \<le> \<mu> A + \<mu> B" |
|
408 |
proof - |
|
409 |
from measure_additive[of A "B - A"] |
|
410 |
have "\<mu> (A \<union> B) = \<mu> A + \<mu> (B - A)" |
|
411 |
using assms by (simp add: Diff) |
|
412 |
also have "\<dots> \<le> \<mu> A + \<mu> B" |
|
413 |
using assms by (auto intro!: add_left_mono measure_mono) |
|
414 |
finally show ?thesis . |
|
415 |
qed |
|
416 |
||
417 |
lemma (in measure_space) measurable_countably_subadditive: |
|
418 |
assumes "range f \<subseteq> sets M" |
|
419 |
shows "\<mu> (\<Union>i. f i) \<le> (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))" |
|
420 |
proof - |
|
421 |
have "\<mu> (\<Union>i. f i) = \<mu> (\<Union>i. disjointed f i)" |
|
422 |
unfolding UN_disjointed_eq .. |
|
423 |
also have "\<dots> = (\<Sum>\<^isub>\<infinity> i. \<mu> (disjointed f i))" |
|
424 |
using range_disjointed_sets[OF assms] measure_countably_additive |
|
425 |
by (simp add: disjoint_family_disjointed comp_def) |
|
426 |
also have "\<dots> \<le> (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))" |
|
427 |
proof (rule psuminf_le, rule measure_mono) |
|
428 |
fix i show "disjointed f i \<subseteq> f i" by (rule disjointed_subset) |
|
429 |
show "f i \<in> sets M" "disjointed f i \<in> sets M" |
|
430 |
using assms range_disjointed_sets[OF assms] by auto |
|
431 |
qed |
|
432 |
finally show ?thesis . |
|
433 |
qed |
|
434 |
||
435 |
lemma (in measure_space) restricted_measure_space: |
|
436 |
assumes "S \<in> sets M" |
|
437 |
shows "measure_space (M\<lparr> space := S, sets := (\<lambda>A. S \<inter> A) ` sets M \<rparr>) \<mu>" |
|
438 |
(is "measure_space ?r \<mu>") |
|
439 |
unfolding measure_space_def measure_space_axioms_def |
|
440 |
proof safe |
|
441 |
show "sigma_algebra ?r" using restricted_sigma_algebra[OF assms] . |
|
442 |
show "\<mu> {} = 0" by simp |
|
443 |
show "countably_additive ?r \<mu>" |
|
444 |
unfolding countably_additive_def |
|
445 |
proof safe |
|
446 |
fix A :: "nat \<Rightarrow> 'a set" |
|
447 |
assume *: "range A \<subseteq> sets ?r" and **: "disjoint_family A" |
|
448 |
from restriction_in_sets[OF assms *[simplified]] ** |
|
449 |
show "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" |
|
450 |
using measure_countably_additive by simp |
|
451 |
qed |
|
452 |
qed |
|
453 |
||
454 |
section "@{text \<sigma>}-finite Measures" |
|
455 |
||
456 |
locale sigma_finite_measure = measure_space + |
|
457 |
assumes sigma_finite: "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)" |
|
458 |
||
459 |
lemma (in sigma_finite_measure) restricted_sigma_finite_measure: |
|
460 |
assumes "S \<in> sets M" |
|
461 |
shows "sigma_finite_measure (M\<lparr> space := S, sets := (\<lambda>A. S \<inter> A) ` sets M \<rparr>) \<mu>" |
|
462 |
(is "sigma_finite_measure ?r _") |
|
463 |
unfolding sigma_finite_measure_def sigma_finite_measure_axioms_def |
|
464 |
proof safe |
|
465 |
show "measure_space ?r \<mu>" using restricted_measure_space[OF assms] . |
|
466 |
next |
|
467 |
obtain A :: "nat \<Rightarrow> 'a set" where |
|
468 |
"range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. \<mu> (A i) \<noteq> \<omega>" |
|
469 |
using sigma_finite by auto |
|
470 |
show "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets ?r \<and> (\<Union>i. A i) = space ?r \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)" |
|
471 |
proof (safe intro!: exI[of _ "\<lambda>i. A i \<inter> S"] del: notI) |
|
472 |
fix i |
|
473 |
show "A i \<inter> S \<in> sets ?r" |
|
474 |
using `range A \<subseteq> sets M` `S \<in> sets M` by auto |
|
475 |
next |
|
476 |
fix x i assume "x \<in> S" thus "x \<in> space ?r" by simp |
|
477 |
next |
|
478 |
fix x assume "x \<in> space ?r" thus "x \<in> (\<Union>i. A i \<inter> S)" |
|
479 |
using `(\<Union>i. A i) = space M` `S \<in> sets M` by auto |
|
480 |
next |
|
481 |
fix i |
|
482 |
have "\<mu> (A i \<inter> S) \<le> \<mu> (A i)" |
|
483 |
using `range A \<subseteq> sets M` `S \<in> sets M` by (auto intro!: measure_mono) |
|
484 |
also have "\<dots> < \<omega>" using `\<mu> (A i) \<noteq> \<omega>` by (auto simp: pinfreal_less_\<omega>) |
|
485 |
finally show "\<mu> (A i \<inter> S) \<noteq> \<omega>" by (auto simp: pinfreal_less_\<omega>) |
|
486 |
qed |
|
487 |
qed |
|
488 |
||
489 |
section "Real measure values" |
|
490 |
||
491 |
lemma (in measure_space) real_measure_Union: |
|
492 |
assumes finite: "\<mu> A \<noteq> \<omega>" "\<mu> B \<noteq> \<omega>" |
|
493 |
and measurable: "A \<in> sets M" "B \<in> sets M" "A \<inter> B = {}" |
|
494 |
shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)" |
|
495 |
unfolding measure_additive[symmetric, OF measurable] |
|
496 |
using finite by (auto simp: real_of_pinfreal_add) |
|
497 |
||
498 |
lemma (in measure_space) real_measure_finite_Union: |
|
499 |
assumes measurable: |
|
500 |
"finite S" "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M" "disjoint_family_on A S" |
|
501 |
assumes finite: "\<And>i. i \<in> S \<Longrightarrow> \<mu> (A i) \<noteq> \<omega>" |
|
502 |
shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))" |
|
503 |
using real_of_pinfreal_setsum[of S, OF finite] |
|
504 |
measure_finitely_additive''[symmetric, OF measurable] |
|
505 |
by simp |
|
506 |
||
507 |
lemma (in measure_space) real_measure_Diff: |
|
508 |
assumes finite: "\<mu> A \<noteq> \<omega>" |
|
509 |
and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A" |
|
510 |
shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)" |
|
511 |
proof - |
|
512 |
have "\<mu> (A - B) \<le> \<mu> A" |
|
513 |
"\<mu> B \<le> \<mu> A" |
|
514 |
using measurable by (auto intro!: measure_mono) |
|
515 |
hence "real (\<mu> ((A - B) \<union> B)) = real (\<mu> (A - B)) + real (\<mu> B)" |
|
516 |
using measurable finite by (rule_tac real_measure_Union) auto |
|
517 |
thus ?thesis using `B \<subseteq> A` by (auto simp: Un_absorb2) |
|
518 |
qed |
|
519 |
||
520 |
lemma (in measure_space) real_measure_UNION: |
|
521 |
assumes measurable: "range A \<subseteq> sets M" "disjoint_family A" |
|
522 |
assumes finite: "\<mu> (\<Union>i. A i) \<noteq> \<omega>" |
|
523 |
shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))" |
|
524 |
proof - |
|
525 |
have *: "(\<Sum>\<^isub>\<infinity> i. \<mu> (A i)) = \<mu> (\<Union>i. A i)" |
|
526 |
using measure_countably_additive[OF measurable] by (simp add: comp_def) |
|
527 |
hence "(\<Sum>\<^isub>\<infinity> i. \<mu> (A i)) \<noteq> \<omega>" using finite by simp |
|
528 |
from psuminf_imp_suminf[OF this] |
|
529 |
show ?thesis using * by simp |
|
530 |
qed |
|
531 |
||
532 |
lemma (in measure_space) real_measure_subadditive: |
|
533 |
assumes measurable: "A \<in> sets M" "B \<in> sets M" |
|
534 |
and fin: "\<mu> A \<noteq> \<omega>" "\<mu> B \<noteq> \<omega>" |
|
535 |
shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)" |
|
536 |
proof - |
|
537 |
have "real (\<mu> (A \<union> B)) \<le> real (\<mu> A + \<mu> B)" |
|
538 |
using measure_subadditive[OF measurable] fin by (auto intro!: real_of_pinfreal_mono) |
|
539 |
also have "\<dots> = real (\<mu> A) + real (\<mu> B)" |
|
540 |
using fin by (simp add: real_of_pinfreal_add) |
|
541 |
finally show ?thesis . |
|
542 |
qed |
|
543 |
||
544 |
lemma (in measure_space) real_measurable_countably_subadditive: |
|
545 |
assumes "range f \<subseteq> sets M" and "(\<Sum>\<^isub>\<infinity> i. \<mu> (f i)) \<noteq> \<omega>" |
|
546 |
shows "real (\<mu> (\<Union>i. f i)) \<le> (\<Sum> i. real (\<mu> (f i)))" |
|
547 |
proof - |
|
548 |
have "real (\<mu> (\<Union>i. f i)) \<le> real (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))" |
|
549 |
using assms by (auto intro!: real_of_pinfreal_mono measurable_countably_subadditive) |
|
550 |
also have "\<dots> = (\<Sum> i. real (\<mu> (f i)))" |
|
551 |
using assms by (auto intro!: sums_unique psuminf_imp_suminf) |
|
552 |
finally show ?thesis . |
|
553 |
qed |
|
554 |
||
555 |
lemma (in measure_space) real_measure_setsum_singleton: |
|
556 |
assumes S: "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M" |
|
557 |
and fin: "\<And>x. x \<in> S \<Longrightarrow> \<mu> {x} \<noteq> \<omega>" |
|
558 |
shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))" |
|
559 |
using measure_finite_singleton[OF S] fin by (simp add: real_of_pinfreal_setsum) |
|
560 |
||
561 |
lemma (in measure_space) real_continuity_from_below: |
|
562 |
assumes A: "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)" and "\<mu> (\<Union>i. A i) \<noteq> \<omega>" |
|
563 |
shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))" |
|
564 |
proof (rule SUP_eq_LIMSEQ[THEN iffD1]) |
|
565 |
{ fix n have "\<mu> (A n) \<le> \<mu> (\<Union>i. A i)" |
|
566 |
using A by (auto intro!: measure_mono) |
|
567 |
hence "\<mu> (A n) \<noteq> \<omega>" using assms by auto } |
|
568 |
note this[simp] |
|
569 |
||
570 |
show "mono (\<lambda>i. real (\<mu> (A i)))" unfolding mono_iff_le_Suc using A |
|
571 |
by (auto intro!: real_of_pinfreal_mono measure_mono) |
|
572 |
||
573 |
show "(SUP n. Real (real (\<mu> (A n)))) = Real (real (\<mu> (\<Union>i. A i)))" |
|
574 |
using continuity_from_below[OF A(1), OF A(2)] |
|
575 |
using assms by (simp add: Real_real) |
|
576 |
qed simp_all |
|
577 |
||
578 |
lemma (in measure_space) real_continuity_from_above: |
|
579 |
assumes A: "range A \<subseteq> sets M" |
|
580 |
and mono_Suc: "\<And>n. A (Suc n) \<subseteq> A n" |
|
581 |
and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>" |
|
582 |
shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))" |
|
583 |
proof (rule INF_eq_LIMSEQ[THEN iffD1]) |
|
584 |
{ fix n have "\<mu> (\<Inter>i. A i) \<le> \<mu> (A n)" |
|
585 |
using A by (auto intro!: measure_mono) |
|
586 |
hence "\<mu> (\<Inter>i. A i) \<noteq> \<omega>" using assms by auto } |
|
587 |
note this[simp] |
|
588 |
||
589 |
show "mono (\<lambda>i. - real (\<mu> (A i)))" unfolding mono_iff_le_Suc using assms |
|
590 |
by (auto intro!: real_of_pinfreal_mono measure_mono) |
|
591 |
||
592 |
show "(INF n. Real (real (\<mu> (A n)))) = |
|
593 |
Real (real (\<mu> (\<Inter>i. A i)))" |
|
594 |
using continuity_from_above[OF A, OF mono_Suc finite] |
|
595 |
using assms by (simp add: Real_real) |
|
596 |
qed simp_all |
|
597 |
||
598 |
locale finite_measure = measure_space + |
|
599 |
assumes finite_measure_of_space: "\<mu> (space M) \<noteq> \<omega>" |
|
600 |
||
601 |
sublocale finite_measure < sigma_finite_measure |
|
602 |
proof |
|
603 |
show "\<exists>A. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)" |
|
604 |
using finite_measure_of_space by (auto intro!: exI[of _ "\<lambda>x. space M"]) |
|
605 |
qed |
|
606 |
||
607 |
lemma (in finite_measure) finite_measure: |
|
608 |
assumes "A \<in> sets M" |
|
609 |
shows "\<mu> A \<noteq> \<omega>" |
|
610 |
proof - |
|
611 |
from `A \<in> sets M` have "A \<subseteq> space M" |
|
612 |
using sets_into_space by blast |
|
613 |
hence "\<mu> A \<le> \<mu> (space M)" |
|
614 |
using assms top by (rule measure_mono) |
|
615 |
also have "\<dots> < \<omega>" |
|
616 |
using finite_measure_of_space unfolding pinfreal_less_\<omega> . |
|
617 |
finally show ?thesis unfolding pinfreal_less_\<omega> . |
|
618 |
qed |
|
619 |
||
620 |
lemma (in finite_measure) restricted_finite_measure: |
|
621 |
assumes "S \<in> sets M" |
|
622 |
shows "finite_measure (M\<lparr> space := S, sets := (\<lambda>A. S \<inter> A) ` sets M \<rparr>) \<mu>" |
|
623 |
(is "finite_measure ?r _") |
|
624 |
unfolding finite_measure_def finite_measure_axioms_def |
|
625 |
proof (safe del: notI) |
|
626 |
show "measure_space ?r \<mu>" using restricted_measure_space[OF assms] . |
|
627 |
next |
|
628 |
show "\<mu> (space ?r) \<noteq> \<omega>" using finite_measure[OF `S \<in> sets M`] by auto |
|
629 |
qed |
|
630 |
||
631 |
lemma (in finite_measure) real_finite_measure_Diff: |
|
632 |
assumes "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A" |
|
633 |
shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)" |
|
634 |
using finite_measure[OF `A \<in> sets M`] by (rule real_measure_Diff[OF _ assms]) |
|
635 |
||
636 |
lemma (in finite_measure) real_finite_measure_Union: |
|
637 |
assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}" |
|
638 |
shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)" |
|
639 |
using sets by (auto intro!: real_measure_Union[OF _ _ assms] finite_measure) |
|
640 |
||
641 |
lemma (in finite_measure) real_finite_measure_finite_Union: |
|
642 |
assumes "finite S" and dis: "disjoint_family_on A S" |
|
643 |
and *: "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M" |
|
644 |
shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))" |
|
645 |
proof (rule real_measure_finite_Union[OF `finite S` _ dis]) |
|
646 |
fix i assume "i \<in> S" from *[OF this] show "A i \<in> sets M" . |
|
647 |
from finite_measure[OF this] show "\<mu> (A i) \<noteq> \<omega>" . |
|
648 |
qed |
|
649 |
||
650 |
lemma (in finite_measure) real_finite_measure_UNION: |
|
651 |
assumes measurable: "range A \<subseteq> sets M" "disjoint_family A" |
|
652 |
shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))" |
|
653 |
proof (rule real_measure_UNION[OF assms]) |
|
654 |
have "(\<Union>i. A i) \<in> sets M" using measurable(1) by (rule countable_UN) |
|
655 |
thus "\<mu> (\<Union>i. A i) \<noteq> \<omega>" by (rule finite_measure) |
|
656 |
qed |
|
657 |
||
658 |
lemma (in finite_measure) real_measure_mono: |
|
659 |
"A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> A \<subseteq> B \<Longrightarrow> real (\<mu> A) \<le> real (\<mu> B)" |
|
660 |
by (auto intro!: measure_mono real_of_pinfreal_mono finite_measure) |
|
661 |
||
662 |
lemma (in finite_measure) real_finite_measure_subadditive: |
|
663 |
assumes measurable: "A \<in> sets M" "B \<in> sets M" |
|
664 |
shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)" |
|
665 |
using measurable measurable[THEN finite_measure] by (rule real_measure_subadditive) |
|
666 |
||
667 |
lemma (in finite_measure) real_finite_measurable_countably_subadditive: |
|
668 |
assumes "range f \<subseteq> sets M" and "summable (\<lambda>i. real (\<mu> (f i)))" |
|
669 |
shows "real (\<mu> (\<Union>i. f i)) \<le> (\<Sum> i. real (\<mu> (f i)))" |
|
670 |
proof (rule real_measurable_countably_subadditive[OF assms(1)]) |
|
671 |
have *: "\<And>i. f i \<in> sets M" using assms by auto |
|
672 |
have "(\<lambda>i. real (\<mu> (f i))) sums (\<Sum>i. real (\<mu> (f i)))" |
|
673 |
using assms(2) by (rule summable_sums) |
|
674 |
from suminf_imp_psuminf[OF this] |
|
675 |
have "(\<Sum>\<^isub>\<infinity>i. \<mu> (f i)) = Real (\<Sum>i. real (\<mu> (f i)))" |
|
676 |
using * by (simp add: Real_real finite_measure) |
|
677 |
thus "(\<Sum>\<^isub>\<infinity>i. \<mu> (f i)) \<noteq> \<omega>" by simp |
|
678 |
qed |
|
679 |
||
680 |
lemma (in finite_measure) real_finite_measure_finite_singelton: |
|
681 |
assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M" |
|
682 |
shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))" |
|
683 |
proof (rule real_measure_setsum_singleton[OF `finite S`]) |
|
684 |
fix x assume "x \<in> S" thus "{x} \<in> sets M" by (rule *) |
|
685 |
with finite_measure show "\<mu> {x} \<noteq> \<omega>" . |
|
686 |
qed |
|
687 |
||
688 |
lemma (in finite_measure) real_finite_continuity_from_below: |
|
689 |
assumes "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)" |
|
690 |
shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))" |
|
691 |
using real_continuity_from_below[OF assms(1), OF assms(2) finite_measure] assms by auto |
|
692 |
||
693 |
lemma (in finite_measure) real_finite_continuity_from_above: |
|
694 |
assumes A: "range A \<subseteq> sets M" |
|
695 |
and mono_Suc: "\<And>n. A (Suc n) \<subseteq> A n" |
|
696 |
shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))" |
|
697 |
using real_continuity_from_above[OF A, OF mono_Suc finite_measure] A |
|
698 |
by auto |
|
699 |
||
700 |
lemma (in finite_measure) real_finite_measure_finite_Union': |
|
701 |
assumes "finite S" "A`S \<subseteq> sets M" "disjoint_family_on A S" |
|
702 |
shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))" |
|
703 |
using assms real_finite_measure_finite_Union[of S A] by auto |
|
704 |
||
705 |
lemma (in finite_measure) finite_measure_compl: |
|
706 |
assumes s: "s \<in> sets M" |
|
707 |
shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s" |
|
708 |
using measure_compl[OF s, OF finite_measure, OF s] . |
|
709 |
||
710 |
section {* Measure preserving *} |
|
711 |
||
712 |
definition "measure_preserving A \<mu> B \<nu> = |
|
713 |
{f \<in> measurable A B. (\<forall>y \<in> sets B. \<mu> (f -` y \<inter> space A) = \<nu> y)}" |
|
714 |
||
715 |
lemma (in finite_measure) measure_preserving_lift: |
|
716 |
fixes f :: "'a \<Rightarrow> 'a2" and A :: "('a2, 'b2) algebra_scheme" |
|
717 |
assumes "algebra A" |
|
718 |
assumes "finite_measure (sigma (space A) (sets A)) \<nu>" (is "finite_measure ?sA _") |
|
719 |
assumes fmp: "f \<in> measure_preserving M \<mu> A \<nu>" |
|
720 |
shows "f \<in> measure_preserving M \<mu> (sigma (space A) (sets A)) \<nu>" |
|
721 |
proof - |
|
722 |
interpret sA: finite_measure ?sA \<nu> by fact |
|
723 |
interpret A: algebra A by fact |
|
724 |
show ?thesis using fmp |
|
725 |
proof (clarsimp simp add: measure_preserving_def) |
|
726 |
assume fm: "f \<in> measurable M A" |
|
727 |
and meq: "\<forall>y\<in>sets A. \<mu> (f -` y \<inter> space M) = \<nu> y" |
|
728 |
have f12: "f \<in> measurable M ?sA" |
|
729 |
using measurable_subset[OF A.sets_into_space] fm by auto |
|
730 |
hence ffn: "f \<in> space M \<rightarrow> space A" |
|
731 |
by (simp add: measurable_def) |
|
732 |
have "space M \<subseteq> f -` (space A)" |
|
733 |
by auto (metis PiE ffn) |
|
734 |
hence fveq [simp]: "(f -` (space A)) \<inter> space M = space M" |
|
735 |
by blast |
|
736 |
{ |
|
737 |
fix y |
|
738 |
assume y: "y \<in> sets ?sA" |
|
739 |
have "sets ?sA = sigma_sets (space A) (sets A)" (is "_ = ?A") by (auto simp: sigma_def) |
|
740 |
also have "\<dots> \<subseteq> {s . \<mu> ((f -` s) \<inter> space M) = \<nu> s}" |
|
741 |
proof (rule A.sigma_property_disjoint, auto) |
|
742 |
fix x assume "x \<in> sets A" then show "\<mu> (f -` x \<inter> space M) = \<nu> x" by (simp add: meq) |
|
743 |
next |
|
744 |
fix s |
|
745 |
assume eq: "\<mu> (f -` s \<inter> space M) = \<nu> s" and s: "s \<in> ?A" |
|
746 |
then have s': "s \<in> sets ?sA" by (simp add: sigma_def) |
|
747 |
show "\<mu> (f -` (space A - s) \<inter> space M) = \<nu> (space A - s)" |
|
748 |
using sA.finite_measure_compl[OF s'] |
|
749 |
using measurable_sets[OF f12 s'] meq[THEN bspec, OF A.top] |
|
750 |
by (simp add: vimage_Diff Diff_Int_distrib2 finite_measure_compl eq) |
|
751 |
next |
|
752 |
fix S |
|
753 |
assume S0: "S 0 = {}" |
|
754 |
and SSuc: "\<And>n. S n \<subseteq> S (Suc n)" |
|
755 |
and rS1: "range S \<subseteq> {s. \<mu> (f -` s \<inter> space M) = \<nu> s}" |
|
756 |
and "range S \<subseteq> ?A" |
|
757 |
hence rS2: "range S \<subseteq> sets ?sA" by (simp add: sigma_def) |
|
758 |
have eq1: "\<And>i. \<mu> (f -` S i \<inter> space M) = \<nu> (S i)" |
|
759 |
using rS1 by blast |
|
760 |
have *: "(\<lambda>n. \<nu> (S n)) = (\<lambda>n. \<mu> (f -` S n \<inter> space M))" |
|
761 |
by (simp add: eq1) |
|
762 |
have "(SUP n. ... n) = \<mu> (\<Union>i. f -` S i \<inter> space M)" |
|
763 |
proof (rule measure_countable_increasing) |
|
764 |
show "range (\<lambda>i. f -` S i \<inter> space M) \<subseteq> sets M" |
|
765 |
using f12 rS2 by (auto simp add: measurable_def) |
|
766 |
show "f -` S 0 \<inter> space M = {}" using S0 |
|
767 |
by blast |
|
768 |
show "\<And>n. f -` S n \<inter> space M \<subseteq> f -` S (Suc n) \<inter> space M" |
|
769 |
using SSuc by auto |
|
770 |
qed |
|
771 |
also have "\<mu> (\<Union>i. f -` S i \<inter> space M) = \<mu> (f -` (\<Union>i. S i) \<inter> space M)" |
|
772 |
by (simp add: vimage_UN) |
|
773 |
finally have "(SUP n. \<nu> (S n)) = \<mu> (f -` (\<Union>i. S i) \<inter> space M)" unfolding * . |
|
774 |
moreover |
|
775 |
have "(SUP n. \<nu> (S n)) = \<nu> (\<Union>i. S i)" |
|
776 |
by (rule sA.measure_countable_increasing[OF rS2, OF S0 SSuc]) |
|
777 |
ultimately |
|
778 |
show "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<nu> (\<Union>i. S i)" by simp |
|
779 |
next |
|
780 |
fix S :: "nat => 'a2 set" |
|
781 |
assume dS: "disjoint_family S" |
|
782 |
and rS1: "range S \<subseteq> {s. \<mu> (f -` s \<inter> space M) = \<nu> s}" |
|
783 |
and "range S \<subseteq> ?A" |
|
784 |
hence rS2: "range S \<subseteq> sets ?sA" by (simp add: sigma_def) |
|
785 |
have "\<And>i. \<mu> (f -` S i \<inter> space M) = \<nu> (S i)" |
|
786 |
using rS1 by blast |
|
787 |
hence *: "(\<lambda>i. \<nu> (S i)) = (\<lambda>n. \<mu> (f -` S n \<inter> space M))" |
|
788 |
by simp |
|
789 |
have "psuminf ... = \<mu> (\<Union>i. f -` S i \<inter> space M)" |
|
790 |
proof (rule measure_countably_additive) |
|
791 |
show "range (\<lambda>i. f -` S i \<inter> space M) \<subseteq> sets M" |
|
792 |
using f12 rS2 by (auto simp add: measurable_def) |
|
793 |
show "disjoint_family (\<lambda>i. f -` S i \<inter> space M)" using dS |
|
794 |
by (auto simp add: disjoint_family_on_def) |
|
795 |
qed |
|
796 |
hence "(\<Sum>\<^isub>\<infinity> i. \<nu> (S i)) = \<mu> (\<Union>i. f -` S i \<inter> space M)" unfolding * . |
|
797 |
with sA.measure_countably_additive [OF rS2 dS] |
|
798 |
have "\<mu> (\<Union>i. f -` S i \<inter> space M) = \<nu> (\<Union>i. S i)" |
|
799 |
by simp |
|
800 |
moreover have "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<mu> (\<Union>i. f -` S i \<inter> space M)" |
|
801 |
by (simp add: vimage_UN) |
|
802 |
ultimately show "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<nu> (\<Union>i. S i)" |
|
803 |
by metis |
|
804 |
qed |
|
805 |
finally have "sets ?sA \<subseteq> {s . \<mu> ((f -` s) \<inter> space M) = \<nu> s}" . |
|
806 |
hence "\<mu> (f -` y \<inter> space M) = \<nu> y" using y by force |
|
807 |
} |
|
808 |
thus "f \<in> measurable M ?sA \<and> (\<forall>y\<in>sets ?sA. \<mu> (f -` y \<inter> space M) = \<nu> y)" |
|
809 |
by (blast intro: f12) |
|
810 |
qed |
|
811 |
qed |
|
812 |
||
813 |
section "Finite spaces" |
|
814 |
||
36624 | 815 |
locale finite_measure_space = measure_space + |
816 |
assumes finite_space: "finite (space M)" |
|
817 |
and sets_eq_Pow: "sets M = Pow (space M)" |
|
38656 | 818 |
and finite_single_measure: "\<And>x. x \<in> space M \<Longrightarrow> \<mu> {x} \<noteq> \<omega>" |
36624 | 819 |
|
38656 | 820 |
lemma (in finite_measure_space) sum_over_space: "(\<Sum>x\<in>space M. \<mu> {x}) = \<mu> (space M)" |
36624 | 821 |
using measure_finitely_additive''[of "space M" "\<lambda>i. {i}"] |
822 |
by (simp add: sets_eq_Pow disjoint_family_on_def finite_space) |
|
823 |
||
38656 | 824 |
sublocale finite_measure_space < finite_measure |
825 |
proof |
|
826 |
show "\<mu> (space M) \<noteq> \<omega>" |
|
827 |
unfolding sum_over_space[symmetric] setsum_\<omega> |
|
828 |
using finite_space finite_single_measure by auto |
|
829 |
qed |
|
830 |
||
831 |
lemma psuminf_cmult_indicator: |
|
832 |
assumes "disjoint_family A" "x \<in> A i" |
|
833 |
shows "(\<Sum>\<^isub>\<infinity> n. f n * indicator (A n) x) = f i" |
|
834 |
proof - |
|
835 |
have **: "\<And>n. f n * indicator (A n) x = (if n = i then f n else 0 :: pinfreal)" |
|
836 |
using `x \<in> A i` assms unfolding disjoint_family_on_def indicator_def by auto |
|
837 |
then have "\<And>n. (\<Sum>j<n. f j * indicator (A j) x) = (if i < n then f i else 0 :: pinfreal)" |
|
838 |
by (auto simp: setsum_cases) |
|
839 |
moreover have "(SUP n. if i < n then f i else 0) = (f i :: pinfreal)" |
|
840 |
proof (rule pinfreal_SUPI) |
|
841 |
fix y :: pinfreal assume "\<And>n. n \<in> UNIV \<Longrightarrow> (if i < n then f i else 0) \<le> y" |
|
842 |
from this[of "Suc i"] show "f i \<le> y" by auto |
|
843 |
qed simp |
|
844 |
ultimately show ?thesis using `x \<in> A i` unfolding psuminf_def by auto |
|
845 |
qed |
|
846 |
||
847 |
lemma psuminf_indicator: |
|
848 |
assumes "disjoint_family A" |
|
849 |
shows "(\<Sum>\<^isub>\<infinity> n. indicator (A n) x) = indicator (\<Union>i. A i) x" |
|
850 |
proof cases |
|
851 |
assume *: "x \<in> (\<Union>i. A i)" |
|
852 |
then obtain i where "x \<in> A i" by auto |
|
853 |
from psuminf_cmult_indicator[OF assms, OF this, of "\<lambda>i. 1"] |
|
854 |
show ?thesis using * by simp |
|
855 |
qed simp |
|
856 |
||
35582 | 857 |
end |