diff -r a25e51e2d64d -r b16d99a72dc9 src/HOL/Probability/Measure.thy --- a/src/HOL/Probability/Measure.thy Thu Mar 04 19:50:45 2010 +0100 +++ b/src/HOL/Probability/Measure.thy Thu Mar 04 21:52:26 2010 +0100 @@ -104,7 +104,7 @@ have ra: "range (binaryset A B) \ sets M" by (simp add: range_binaryset_eq empty A B) have di: "disjoint_family (binaryset A B)" using disj - by (simp add: disjoint_family_def binaryset_def Int_commute) + by (simp add: disjoint_family_on_def binaryset_def Int_commute) from closed_cdi_Disj [OF cdi ra di] show ?thesis by (simp add: UN_binaryset_eq) @@ -118,7 +118,7 @@ have ra: "range (binaryset A B) \ Pow (smallest_ccdi_sets M)" by (simp add: range_binaryset_eq A B empty_sets smallest_ccdi_sets.Basic) have di: "disjoint_family (binaryset A B)" using disj - by (simp add: disjoint_family_def binaryset_def Int_commute) + by (simp add: disjoint_family_on_def binaryset_def Int_commute) from Disj [OF ra di] show ?thesis by (simp add: UN_binaryset_eq) @@ -164,7 +164,7 @@ have "range (\i. a \ A i) \ Pow(smallest_ccdi_sets M)" using Disj by blast moreover have "disjoint_family (\i. a \ A i)" using Disj - by (auto simp add: disjoint_family_def) + by (auto simp add: disjoint_family_on_def) ultimately have 2: "(\i. (\i. a \ A i) i) \ smallest_ccdi_sets M" by (rule smallest_ccdi_sets.Disj) show ?case @@ -208,7 +208,7 @@ have "range (\i. A i \ b) \ Pow(smallest_ccdi_sets M)" using Disj by blast moreover have "disjoint_family (\i. A i \ b)" using Disj - by (auto simp add: disjoint_family_def) + by (auto simp add: disjoint_family_on_def) ultimately have 2: "(\i. (\i. A i \ b) i) \ smallest_ccdi_sets M" by (rule smallest_ccdi_sets.Disj) show ?case @@ -355,7 +355,7 @@ hence "!!m n. m < n \ A m \ A n" by (metis add_commute le_add_diff_inverse nat_less_le) thus ?thesis - by (auto simp add: disjoint_family_def) + by (auto simp add: disjoint_family_on_def) (metis insert_absorb insert_subset le_SucE le_antisym not_leE) qed @@ -642,7 +642,7 @@ show "range (\i. f -` A i \ space m1) \ sets m1" using f12 rA2 by (auto simp add: measurable_def) show "disjoint_family (\i. f -` A i \ space m1)" using dA - by (auto simp add: disjoint_family_def) + by (auto simp add: disjoint_family_on_def) show "(\i. f -` A i \ space m1) \ sets m1" proof (rule sigma_algebra.countable_UN [OF sa1]) show "range (\i. f -` A i \ space m1) \ sets m1" using f12 rA2 @@ -820,7 +820,98 @@ thus ?thesis by (metis subset_refl s) qed - + +lemma (in measure_space) measure_finitely_additive': + assumes "f \ ({0 :: nat ..< n} \ sets M)" + assumes "\ a b. \a < n ; b < n ; a \ b\ \ f a \ f b = {}" + assumes "s = \ (f ` {0 ..< n})" + shows "(\ i \ {0 ..< n}. (measure M \ f) i) = measure M s" +proof - + def f' == "\ i. (if i < n then f i else {})" + have rf: "range f' \ sets M" unfolding f'_def + using assms empty_sets by auto + have df: "disjoint_family f'" unfolding f'_def disjoint_family_on_def + using assms by simp + have "\ range f' = (\ i \ {0 ..< n}. f i)" + unfolding f'_def by auto + then have "measure M s = measure M (\ range f')" + using assms by simp + then have part1: "(\ i. measure M (f' i)) sums measure M s" + using df rf ca[unfolded countably_additive_def, rule_format, of f'] + by auto + + have "(\ i. measure M (f' i)) sums (\ i \ {0 ..< n}. measure M (f' i))" + using series_zero[of "n" "\ i. measure M (f' i)", rule_format] + unfolding f'_def by simp + also have "\ = (\ i \ {0 ..< n}. measure M (f i))" + unfolding f'_def by auto + finally have part2: "(\ i. measure M (f' i)) sums (\ i \ {0 ..< n}. measure M (f i))" by simp + show ?thesis + using sums_unique[OF part1] + sums_unique[OF part2] by auto +qed + + +lemma (in measure_space) measure_finitely_additive: + assumes "finite r" + assumes "r \ sets M" + assumes d: "\ a b. \a \ r ; b \ r ; a \ b\ \ a \ b = {}" + shows "(\ i \ r. measure M i) = measure M (\ r)" +using assms +proof - + (* counting the elements in r is enough *) + let ?R = "{0 ..< card r}" + obtain f where f: "f ` ?R = r" "inj_on f ?R" + using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite r`] + by auto + hence f_into_sets: "f \ ?R \ sets M" using assms by auto + have disj: "\ a b. \a \ ?R ; b \ ?R ; a \ b\ \ f a \ f b = {}" + proof - + fix a b assume asm: "a \ ?R" "b \ ?R" "a \ b" + hence neq: "f a \ f b" using f[unfolded inj_on_def, rule_format] by blast + from asm have "f a \ r" "f b \ r" using f by auto + thus "f a \ f b = {}" using d[of "f a" "f b"] f using neq by auto + qed + have "(\ r) = (\ i \ ?R. f i)" + using f by auto + hence "measure M (\ r)= measure M (\ i \ ?R. f i)" by simp + also have "\ = (\ i \ ?R. measure M (f i))" + using measure_finitely_additive'[OF f_into_sets disj] by simp + also have "\ = (\ a \ r. measure M a)" + using f[rule_format] setsum_reindex[of f ?R "\ a. measure M a"] by auto + finally show ?thesis by simp +qed + +lemma (in measure_space) measure_finitely_additive'': + assumes "finite s" + assumes "\ i. i \ s \ a i \ sets M" + assumes d: "disjoint_family_on a s" + shows "(\ i \ s. measure M (a i)) = measure M (\ i \ s. a i)" +using assms +proof - + (* counting the elements in s is enough *) + let ?R = "{0 ..< card s}" + obtain f where f: "f ` ?R = s" "inj_on f ?R" + using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite s`] + by auto + hence f_into_sets: "a \ f \ ?R \ sets M" using assms unfolding o_def by auto + have disj: "\ i j. \i \ ?R ; j \ ?R ; i \ j\ \ (a \ f) i \ (a \ f) j = {}" + proof - + fix i j assume asm: "i \ ?R" "j \ ?R" "i \ j" + hence neq: "f i \ f j" using f[unfolded inj_on_def, rule_format] by blast + from asm have "f i \ s" "f j \ s" using f by auto + thus "(a \ f) i \ (a \ f) j = {}" + using d f neq unfolding disjoint_family_on_def by auto + qed + have "(\ i \ s. a i) = (\ i \ f ` ?R. a i)" using f by auto + hence "(\ i \ s. a i) = (\ i \ ?R. a (f i))" by auto + hence "measure M (\ i \ s. a i) = (\ i \ ?R. measure M (a (f i)))" + using measure_finitely_additive'[OF f_into_sets disj] by simp + also have "\ = (\ i \ s. measure M (a i))" + using f[rule_format] setsum_reindex[of f ?R "\ i. measure M (a i)"] by auto + finally show ?thesis by simp +qed + lemma (in sigma_algebra) sigma_algebra_extend: "sigma_algebra \space = space M, sets = sets M, measure_space.measure = f\" by unfold_locales (auto intro!: space_closed) @@ -845,7 +936,7 @@ hence "finite (A ` I)" by (metis finite_UnionD finite_subset fin) moreover have "inj_on A I" using disj - by (auto simp add: I_def disjoint_family_def inj_on_def) + by (auto simp add: I_def disjoint_family_on_def inj_on_def) ultimately have finI: "finite I" by (metis finite_imageD) hence "\N. \m\N. A m = {}" @@ -873,7 +964,7 @@ have "f (A n \ (\ x i (\ x sets M" using A by (force simp add: Mf_def) show "(\i sets M" @@ -906,5 +997,4 @@ \ measure_space M" by (rule measure_down [OF sigma_algebra.finite_additivity_sufficient], auto) -end - +end \ No newline at end of file