# HG changeset patch # User hoelzl # Date 1300816385 -3600 # Node ID 6db76c88907a2737cc04b117def32b955ed4a9e2 # Parent 2b98b4c2e2f1f7da0d4bd5dde0993e7ecc367f06 generalized Caratheodory from algebra to ring_of_sets diff -r 2b98b4c2e2f1 -r 6db76c88907a src/HOL/Probability/Caratheodory.thy --- a/src/HOL/Probability/Caratheodory.thy Tue Mar 22 16:44:57 2011 +0100 +++ b/src/HOL/Probability/Caratheodory.thy Tue Mar 22 18:53:05 2011 +0100 @@ -148,7 +148,7 @@ lemma (in algebra) lambda_system_empty: "positive M f \ {} \ lambda_system M f" - by (auto simp add: positive_def lambda_system_eq algebra_def) + by (auto simp add: positive_def lambda_system_eq) lemma lambda_system_sets: "x \ lambda_system M f \ x \ sets M" @@ -456,7 +456,7 @@ by (simp add: measure_space_def) qed -lemma (in algebra) additive_increasing: +lemma (in ring_of_sets) additive_increasing: assumes posf: "positive M f" and addf: "additive M f" shows "increasing M f" proof (auto simp add: increasing_def) @@ -472,7 +472,7 @@ finally show "f x \ f y" by simp qed -lemma (in algebra) countably_additive_additive: +lemma (in ring_of_sets) countably_additive_additive: assumes posf: "positive M f" and ca: "countably_additive M f" shows "additive M f" proof (auto simp add: additive_def) @@ -506,7 +506,7 @@ simp: measure_set_def disjoint_family_on_def split_if_mem2 comp_def) qed -lemma (in algebra) inf_measure_agrees: +lemma (in ring_of_sets) inf_measure_agrees: assumes posf: "positive M f" and ca: "countably_additive M f" and s: "s \ sets M" shows "Inf (measure_set M f s) = f s" @@ -575,7 +575,7 @@ inf_measure_nonempty[OF posf] subset_refl posf[unfolded positive_def]) qed (rule inf_measure_pos[OF posf]) -lemma (in algebra) inf_measure_positive: +lemma (in ring_of_sets) inf_measure_positive: assumes p: "positive M f" and "{} \ sets M" shows "positive M (\x. Inf (measure_set M f x))" proof (unfold positive_def, intro conjI ballI) @@ -583,7 +583,7 @@ fix A assume "A \ sets M" qed (rule inf_measure_pos[OF p]) -lemma (in algebra) inf_measure_increasing: +lemma (in ring_of_sets) inf_measure_increasing: assumes posf: "positive M f" shows "increasing \ space = space M, sets = Pow (space M) \ (\x. Inf (measure_set M f x))" @@ -593,7 +593,7 @@ apply (clarsimp simp add: measure_set_def, rule_tac x=A in exI, blast) done -lemma (in algebra) inf_measure_le: +lemma (in ring_of_sets) inf_measure_le: assumes posf: "positive M f" and inc: "increasing M f" and x: "x \ {r . \A. range A \ sets M \ s \ (\i. A i) \ (\i. f (A i)) = r}" shows "Inf (measure_set M f s) \ x" @@ -620,73 +620,63 @@ by (blast intro: y order_trans [OF _ ley] posf complete_lattice_class.Inf_lower) qed -lemma (in algebra) inf_measure_close: +lemma (in ring_of_sets) inf_measure_close: fixes e :: extreal - assumes posf: "positive M f" and e: "0 < e" and ss: "s \ (space M)" + assumes posf: "positive M f" and e: "0 < e" and ss: "s \ (space M)" and "Inf (measure_set M f s) \ \" shows "\A. range A \ sets M \ disjoint_family A \ s \ (\i. A i) \ (\i. f (A i)) \ Inf (measure_set M f s) + e" -proof (cases "Inf (measure_set M f s) = \") - case False - then have fin: "\Inf (measure_set M f s)\ \ \" +proof - + from `Inf (measure_set M f s) \ \` have fin: "\Inf (measure_set M f s)\ \ \" using inf_measure_pos[OF posf, of s] by auto obtain l where "l \ measure_set M f s" "l \ Inf (measure_set M f s) + e" using Inf_extreal_close[OF fin e] by auto thus ?thesis by (auto intro!: exI[of _ l] simp: measure_set_def comp_def) -next - case True - have "measure_set M f s \ {}" - by (metis emptyE ss inf_measure_nonempty [of _ f, OF posf top _ empty_sets]) - then obtain l where "l \ measure_set M f s" by auto - moreover from True have "l \ Inf (measure_set M f s) + e" by simp - ultimately show ?thesis - by (auto intro!: exI[of _ l] simp: measure_set_def comp_def) qed -lemma (in algebra) inf_measure_countably_subadditive: +lemma (in ring_of_sets) inf_measure_countably_subadditive: assumes posf: "positive M f" and inc: "increasing M f" shows "countably_subadditive (| space = space M, sets = Pow (space M) |) (\x. Inf (measure_set M f x))" - unfolding countably_subadditive_def o_def -proof (safe, simp, rule extreal_le_epsilon, safe) - fix A :: "nat \ 'a set" and e :: extreal - let "?outer n" = "Inf (measure_set M f (A n))" +proof (simp add: countably_subadditive_def, safe) + fix A :: "nat \ 'a set" + let "?outer B" = "Inf (measure_set M f B)" assume A: "range A \ Pow (space M)" and disj: "disjoint_family A" and sb: "(\i. A i) \ space M" - and e: "0 < e" - hence "\BB. \n. range (BB n) \ sets M \ disjoint_family (BB n) \ - A n \ (\i. BB n i) \ - (\i. f (BB n i)) \ ?outer n + e * (1/2)^(Suc n)" - apply (safe intro!: choice inf_measure_close [of f, OF posf]) - using e sb by (cases e) (auto simp add: not_le mult_pos_pos one_extreal_def) - then obtain BB - where BB: "\n. (range (BB n) \ sets M)" + + { fix e :: extreal assume e: "0 < e" and "\i. ?outer (A i) \ \" + hence "\BB. \n. range (BB n) \ sets M \ disjoint_family (BB n) \ + A n \ (\i. BB n i) \ (\i. f (BB n i)) \ ?outer (A n) + e * (1/2)^(Suc n)" + apply (safe intro!: choice inf_measure_close [of f, OF posf]) + using e sb by (auto simp: extreal_zero_less_0_iff one_extreal_def) + then obtain BB + where BB: "\n. (range (BB n) \ sets M)" and disjBB: "\n. disjoint_family (BB n)" and sbBB: "\n. A n \ (\i. BB n i)" - and BBle: "\n. (\i. f (BB n i)) \ ?outer n + e * (1/2)^(Suc n)" - by auto blast - have sll: "(\n. \i. (f (BB n i))) \ suminf ?outer + e" + and BBle: "\n. (\i. f (BB n i)) \ ?outer (A n) + e * (1/2)^(Suc n)" + by auto blast + have sll: "(\n. \i. (f (BB n i))) \ (\n. ?outer (A n)) + e" proof - have sum_eq_1: "(\n. e*(1/2) ^ Suc n) = e" using suminf_half_series_extreal e by (simp add: extreal_zero_le_0_iff zero_le_divide_extreal suminf_cmult_extreal) have "\n i. 0 \ f (BB n i)" using posf[unfolded positive_def] BB by auto then have "\n. 0 \ (\i. f (BB n i))" by (rule suminf_0_le) - then have "(\n. \i. (f (BB n i))) \ (\n. ?outer n + e*(1/2) ^ Suc n)" + then have "(\n. \i. (f (BB n i))) \ (\n. ?outer (A n) + e*(1/2) ^ Suc n)" by (rule suminf_le_pos[OF BBle]) - also have "... = suminf ?outer + e" + also have "... = (\n. ?outer (A n)) + e" using sum_eq_1 inf_measure_pos[OF posf] e by (subst suminf_add_extreal) (auto simp add: extreal_zero_le_0_iff) finally show ?thesis . qed - def C \ "(split BB) o prod_decode" - have C: "!!n. C n \ sets M" - apply (rule_tac p="prod_decode n" in PairE) - apply (simp add: C_def) - apply (metis BB subsetD rangeI) - done - have sbC: "(\i. A i) \ (\i. C i)" + def C \ "(split BB) o prod_decode" + have C: "!!n. C n \ sets M" + apply (rule_tac p="prod_decode n" in PairE) + apply (simp add: C_def) + apply (metis BB subsetD rangeI) + done + have sbC: "(\i. A i) \ (\i. C i)" proof (auto simp add: C_def) fix x i assume x: "x \ A i" @@ -695,23 +685,39 @@ thus "\i. x \ split BB (prod_decode i)" by (metis prod_encode_inverse prod.cases) qed - have "(f \ C) = (f \ (\(x, y). BB x y)) \ prod_decode" - by (rule ext) (auto simp add: C_def) - moreover have "suminf ... = (\n. \i. f (BB n i))" using BBle - using BB posf[unfolded positive_def] - by (force intro!: suminf_extreal_2dimen simp: o_def) - ultimately have Csums: "(\i. f (C i)) = (\n. \i. f (BB n i))" by (simp add: o_def) - have "Inf (measure_set M f (\i. A i)) \ (\n. \i. f (BB n i))" - apply (rule inf_measure_le [OF posf(1) inc], auto) - apply (rule_tac x="C" in exI) - apply (auto simp add: C sbC Csums) - done - also have "... \ (\n. Inf (measure_set M f (A n))) + e" using sll - by blast - finally show "Inf (measure_set M f (\i. A i)) \ suminf ?outer + e" . + have "(f \ C) = (f \ (\(x, y). BB x y)) \ prod_decode" + by (rule ext) (auto simp add: C_def) + moreover have "suminf ... = (\n. \i. f (BB n i))" using BBle + using BB posf[unfolded positive_def] + by (force intro!: suminf_extreal_2dimen simp: o_def) + ultimately have Csums: "(\i. f (C i)) = (\n. \i. f (BB n i))" by (simp add: o_def) + have "?outer (\i. A i) \ (\n. \i. f (BB n i))" + apply (rule inf_measure_le [OF posf(1) inc], auto) + apply (rule_tac x="C" in exI) + apply (auto simp add: C sbC Csums) + done + also have "... \ (\n. ?outer (A n)) + e" using sll + by blast + finally have "?outer (\i. A i) \ (\n. ?outer (A n)) + e" . } + note for_finite_Inf = this + + show "?outer (\i. A i) \ (\n. ?outer (A n))" + proof cases + assume "\i. ?outer (A i) \ \" + with for_finite_Inf show ?thesis + by (intro extreal_le_epsilon) auto + next + assume "\ (\i. ?outer (A i) \ \)" + then have "\i. ?outer (A i) = \" + by auto + then have "(\n. ?outer (A n)) = \" + using suminf_PInfty[OF inf_measure_pos, OF posf] + by metis + then show ?thesis by simp + qed qed -lemma (in algebra) inf_measure_outer: +lemma (in ring_of_sets) inf_measure_outer: "\ positive M f ; increasing M f \ \ outer_measure_space \ space = space M, sets = Pow (space M) \ (\x. Inf (measure_set M f x))" @@ -719,12 +725,10 @@ by (simp add: outer_measure_space_def inf_measure_empty inf_measure_increasing inf_measure_countably_subadditive positive_def) -(*MOVE UP*) - -lemma (in algebra) algebra_subset_lambda_system: +lemma (in ring_of_sets) algebra_subset_lambda_system: assumes posf: "positive M f" and inc: "increasing M f" and add: "additive M f" - shows "sets M \ lambda_system (| space = space M, sets = Pow (space M) |) + shows "sets M \ lambda_system \ space = space M, sets = Pow (space M) \ (\x. Inf (measure_set M f x))" proof (auto dest: sets_into_space simp add: algebra.lambda_system_eq [OF algebra_Pow]) @@ -735,50 +739,42 @@ by blast have "Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x)) \ Inf (measure_set M f s)" - proof (rule extreal_le_epsilon, intro allI impI) - fix e :: extreal - assume e: "0 < e" - from inf_measure_close [of f, OF posf e s] - obtain A where A: "range A \ sets M" and disj: "disjoint_family A" - and sUN: "s \ (\i. A i)" - and l: "(\i. f (A i)) \ Inf (measure_set M f s) + e" - by auto - have [simp]: "!!x. x \ sets M \ - (f o (\z. z \ (space M - x)) o A) = (f o (\z. z - x) o A)" - by (rule ext, simp, metis A Int_Diff Int_space_eq2 range_subsetD) - have [simp]: "!!n. f (A n \ x) + f (A n - x) = f (A n)" - by (subst additiveD [OF add, symmetric]) - (auto simp add: x range_subsetD [OF A] Int_Diff_Un Int_Diff_disjoint) - { fix u - assume u: "u \ sets M" - have [simp]: "\n. f (A n \ u) \ f (A n)" - by (simp add: increasingD [OF inc] u Int range_subsetD [OF A]) - have 2: "Inf (measure_set M f (s \ u)) \ (\i. f (A i \ u))" - proof (rule complete_lattice_class.Inf_lower) - show "(\i. f (A i \ u)) \ measure_set M f (s \ u)" - apply (simp add: measure_set_def) - apply (rule_tac x="(\z. z \ u) o A" in exI) - apply (auto simp add: disjoint_family_subset [OF disj] o_def) - apply (blast intro: u range_subsetD [OF A]) - apply (blast dest: subsetD [OF sUN]) - done - qed - } note lesum = this - have [simp]: "\i. A i \ (space M - x) = A i - x" using A sets_into_space by auto - have inf1: "Inf (measure_set M f (s\x)) \ (\i. f (A i \ x))" - and inf2: "Inf (measure_set M f (s \ (space M - x))) - \ (\i. f (A i \ (space M - x)))" - by (metis Diff lesum top x)+ - hence "Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x)) - \ (\i. f (A i \ x)) + (\i. f (A i - x))" - by (simp add: add_mono x) - also have "... \ (\i. f (A i))" using posf[unfolded positive_def] A x - by (subst suminf_add_extreal[symmetric]) auto - also have "... \ Inf (measure_set M f s) + e" - by (rule l) - finally show "Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x)) - \ Inf (measure_set M f s) + e" . + proof cases + assume "Inf (measure_set M f s) = \" then show ?thesis by simp + next + assume fin: "Inf (measure_set M f s) \ \" + then have "measure_set M f s \ {}" + by (auto simp: top_extreal_def) + show ?thesis + proof (rule complete_lattice_class.Inf_greatest) + fix r assume "r \ measure_set M f s" + then obtain A where A: "disjoint_family A" "range A \ sets M" "s \ (\i. A i)" + and r: "r = (\i. f (A i))" unfolding measure_set_def by auto + have "Inf (measure_set M f (s \ x)) \ (\i. f (A i \ x))" + unfolding measure_set_def + proof (safe intro!: complete_lattice_class.Inf_lower exI[of _ "\i. A i \ x"]) + from A(1) show "disjoint_family (\i. A i \ x)" + by (rule disjoint_family_on_bisimulation) auto + qed (insert x A, auto) + moreover + have "Inf (measure_set M f (s - x)) \ (\i. f (A i - x))" + unfolding measure_set_def + proof (safe intro!: complete_lattice_class.Inf_lower exI[of _ "\i. A i - x"]) + from A(1) show "disjoint_family (\i. A i - x)" + by (rule disjoint_family_on_bisimulation) auto + qed (insert x A, auto) + ultimately have "Inf (measure_set M f (s \ x)) + Inf (measure_set M f (s - x)) \ + (\i. f (A i \ x)) + (\i. f (A i - x))" by (rule add_mono) + also have "\ = (\i. f (A i \ x) + f (A i - x))" + using A(2) x posf by (subst suminf_add_extreal) (auto simp: positive_def) + also have "\ = (\i. f (A i))" + using A x + by (subst add[THEN additiveD, symmetric]) + (auto intro!: arg_cong[where f=suminf] arg_cong[where f=f]) + finally show "Inf (measure_set M f (s \ x)) + Inf (measure_set M f (s - x)) \ r" + using r by simp qed + qed moreover have "Inf (measure_set M f s) \ Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x))" @@ -805,7 +801,7 @@ countably_additive_def) blast -theorem (in algebra) caratheodory: +theorem (in ring_of_sets) caratheodory: assumes posf: "positive M f" and ca: "countably_additive M f" shows "\\ :: 'a set \ extreal. (\s \ sets M. \ s = f s) \ measure_space \ space = space M, sets = sets (sigma M), measure = \ \" diff -r 2b98b4c2e2f1 -r 6db76c88907a src/HOL/Probability/Measure.thy --- a/src/HOL/Probability/Measure.thy Tue Mar 22 16:44:57 2011 +0100 +++ b/src/HOL/Probability/Measure.thy Tue Mar 22 18:53:05 2011 +0100 @@ -107,10 +107,7 @@ qed lemma (in measure_space) additive: "additive M \" -proof (rule algebra.countably_additive_additive [OF _ _ ca]) - show "algebra M" by default - show "positive M \" by (simp add: positive_def) -qed + using ca by (auto intro!: countably_additive_additive simp: positive_def) lemma (in measure_space) measure_additive: "a \ sets M \ b \ sets M \ a \ b = {}