# HG changeset patch # User wenzelm # Date 1257792153 -3600 # Node ID fd28b7399f2ba3b172b3d30d24b205e1d1b07d88 # Parent b233f48a4d3d8865a79fc813d0ceebc7f9a51427 eliminated hard tabulators; diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/Borel.thy --- a/src/HOL/Probability/Borel.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/Borel.thy Mon Nov 09 19:42:33 2009 +0100 @@ -17,8 +17,8 @@ definition mono_convergent where "mono_convergent u f s \ - (\x m n. m \ n \ x \ s \ u m x \ u n x) \ - (\x \ s. (\i. u i x) ----> f x)" + (\x m n. m \ n \ x \ s \ u m x \ u n x) \ + (\x \ s. (\i. u i x) ----> f x)" lemma in_borel_measurable: "f \ borel_measurable M \ @@ -222,7 +222,7 @@ shows "{w \ space M. f w < g w} \ sets M" proof - have "{w \ space M. f w < g w} = - (\r\\. {w \ space M. f w < r} \ {w \ space M. r < g w })" + (\r\\. {w \ space M. f w < r} \ {w \ space M. r < g w })" by (auto simp add: Rats_dense_in_real) thus ?thesis using f g by (simp add: borel_measurable_less_iff [of f] @@ -247,7 +247,7 @@ shows "{w \ space M. f w = g w} \ sets M" proof - have "{w \ space M. f w = g w} = - {w \ space M. f w \ g w} \ {w \ space M. g w \ f w}" + {w \ space M. f w \ g w} \ {w \ space M. g w \ f w}" by auto thus ?thesis using f g by (simp add: borel_measurable_leq_borel_measurable Int) diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/Caratheodory.thy --- a/src/HOL/Probability/Caratheodory.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/Caratheodory.thy Mon Nov 09 19:42:33 2009 +0100 @@ -2,7 +2,6 @@ theory Caratheodory imports Sigma_Algebra SupInf SeriesPlus - begin text{*From the Hurd/Coble measure theory development, translated by Lawrence Paulson.*} @@ -136,7 +135,7 @@ proof fix n show "(\i\nat = 0\nat.. f A + f B" by (rule LIMSEQ_const) @@ -198,30 +197,30 @@ proof - from xl yl show ?thesis proof (auto simp add: positive_def lambda_system_eq Int) - fix u - assume x: "x \ sets M" and y: "y \ sets M" and u: "u \ sets M" + fix u + assume x: "x \ sets M" and y: "y \ sets M" and u: "u \ sets M" and fx: "\z\sets M. f (z \ x) + f (z - x) = f z" and fy: "\z\sets M. f (z \ y) + f (z - y) = f z" - have "u - x \ y \ sets M" - by (metis Diff Diff_Int Un u x y) - moreover - have "(u - (x \ y)) \ y = u \ y - x" by blast - moreover - have "u - x \ y - y = u - y" by blast - ultimately - have ey: "f (u - x \ y) = f (u \ y - x) + f (u - y)" using fy - by force - have "f (u \ (x \ y)) + f (u - x \ y) + have "u - x \ y \ sets M" + by (metis Diff Diff_Int Un u x y) + moreover + have "(u - (x \ y)) \ y = u \ y - x" by blast + moreover + have "u - x \ y - y = u - y" by blast + ultimately + have ey: "f (u - x \ y) = f (u \ y - x) + f (u - y)" using fy + by force + have "f (u \ (x \ y)) + f (u - x \ y) = (f (u \ (x \ y)) + f (u \ y - x)) + f (u - y)" - by (simp add: ey) - also have "... = (f ((u \ y) \ x) + f (u \ y - x)) + f (u - y)" - by (simp add: Int_ac) - also have "... = f (u \ y) + f (u - y)" - using fx [THEN bspec, of "u \ y"] Int y u - by force - also have "... = f u" - by (metis fy u) - finally show "f (u \ (x \ y)) + f (u - x \ y) = f u" . + by (simp add: ey) + also have "... = (f ((u \ y) \ x) + f (u \ y - x)) + f (u - y)" + by (simp add: Int_ac) + also have "... = f (u \ y) + f (u - y)" + using fx [THEN bspec, of "u \ y"] Int y u + by force + also have "... = f u" + by (metis fy u) + finally show "f (u \ (x \ y)) + f (u - x \ y) = f u" . qed qed @@ -478,11 +477,11 @@ have U_eq: "f (\i. A i) = suminf (f o A)" proof (rule antisym) show "f (\i. A i) \ suminf (f \ A)" - by (rule countably_subadditiveD [OF csa A'' disj U_in sumfA]) + by (rule countably_subadditiveD [OF csa A'' disj U_in sumfA]) show "suminf (f \ A) \ f (\i. A i)" - by (rule suminf_le [OF sumfA]) + by (rule suminf_le [OF sumfA]) (metis algebra.additive_sum [OF alg_ls] pos disj UN_Un Un_UNIV_right - lambda_system_positive lambda_system_additive + lambda_system_positive lambda_system_additive subset_Un_eq increasingD [OF inc] A' A'' UNION_in_sets U_in) qed { @@ -491,58 +490,58 @@ have "f (a \ (\i. A i)) + f (a - (\i. A i)) = f a" proof - have summ: "summable (f \ (\i. a \ i) \ A)" using pos A'' - apply - - apply (rule summable_comparison_test [OF _ sumfA]) - apply (rule_tac x="0" in exI) - apply (simp add: positive_def) - apply (auto simp add: ) - apply (subst abs_of_nonneg) - apply (metis A'' Int UNIV_I a image_subset_iff) - apply (blast intro: increasingD [OF inc] a) - done + apply - + apply (rule summable_comparison_test [OF _ sumfA]) + apply (rule_tac x="0" in exI) + apply (simp add: positive_def) + apply (auto simp add: ) + apply (subst abs_of_nonneg) + apply (metis A'' Int UNIV_I a image_subset_iff) + apply (blast intro: increasingD [OF inc] a) + done show ?thesis proof (rule antisym) - have "range (\i. a \ A i) \ sets M" using A'' - by blast - moreover - have "disjoint_family (\i. a \ A i)" using disj - by (auto simp add: disjoint_family_def) - moreover - have "a \ (\i. A i) \ sets M" - by (metis Int U_in a) - ultimately - have "f (a \ (\i. A i)) \ suminf (f \ (\i. a \ i) \ A)" - using countably_subadditiveD [OF csa, of "(\i. a \ A i)"] summ - by (simp add: o_def) - moreover - have "suminf (f \ (\i. a \ i) \ A) \ f a - f (a - (\i. A i))" - proof (rule suminf_le [OF summ]) - fix n - have UNION_in: "(\i\{0.. sets M" - by (metis A'' UNION_in_sets) - have le_fa: "f (UNION {0.. a) \ f a" using A'' - by (blast intro: increasingD [OF inc] A'' Int UNION_in_sets a) - have ls: "(\i\{0.. lambda_system M f" - using algebra.UNION_in_sets [OF lambda_system_algebra [OF pos]] - by (simp add: A) - hence eq_fa: "f (a \ (\i\{0..i\{0..i. A i)) \ f (a - (\i\{0..i. a \ A i) \ sets M" using A'' + by blast + moreover + have "disjoint_family (\i. a \ A i)" using disj + by (auto simp add: disjoint_family_def) + moreover + have "a \ (\i. A i) \ sets M" + by (metis Int U_in a) + ultimately + have "f (a \ (\i. A i)) \ suminf (f \ (\i. a \ i) \ A)" + using countably_subadditiveD [OF csa, of "(\i. a \ A i)"] summ + by (simp add: o_def) + moreover + have "suminf (f \ (\i. a \ i) \ A) \ f a - f (a - (\i. A i))" + proof (rule suminf_le [OF summ]) + fix n + have UNION_in: "(\i\{0.. sets M" + by (metis A'' UNION_in_sets) + have le_fa: "f (UNION {0.. a) \ f a" using A'' + by (blast intro: increasingD [OF inc] A'' Int UNION_in_sets a) + have ls: "(\i\{0.. lambda_system M f" + using algebra.UNION_in_sets [OF lambda_system_algebra [OF pos]] + by (simp add: A) + hence eq_fa: "f (a \ (\i\{0..i\{0..i. A i)) \ f (a - (\i\{0.. (\i. a \ i) \ A) {0.. f a - f (a - (\i. A i))" - using eq_fa - by (simp add: suminf_le [OF summ] lambda_system_strong_sum pos + thus "setsum (f \ (\i. a \ i) \ A) {0.. f a - f (a - (\i. A i))" + using eq_fa + by (simp add: suminf_le [OF summ] lambda_system_strong_sum pos a A disj) - qed - ultimately show "f (a \ (\i. A i)) + f (a - (\i. A i)) \ f a" - by arith + qed + ultimately show "f (a \ (\i. A i)) + f (a - (\i. A i)) \ f a" + by arith next - have "f a \ f (a \ (\i. A i) \ (a - (\i. A i)))" - by (blast intro: increasingD [OF inc] a U_in) - also have "... \ f (a \ (\i. A i)) + f (a - (\i. A i))" - by (blast intro: subadditiveD [OF sa] Int Diff U_in) - finally show "f a \ f (a \ (\i. A i)) + f (a - (\i. A i))" . + have "f a \ f (a \ (\i. A i) \ (a - (\i. A i)))" + by (blast intro: increasingD [OF inc] a U_in) + also have "... \ f (a \ (\i. A i)) + f (a - (\i. A i))" + by (blast intro: subadditiveD [OF sa] Int Diff U_in) + finally show "f a \ f (a \ (\i. A i)) + f (a - (\i. A i))" . qed qed } @@ -654,20 +653,20 @@ have sums: "(\i. f (A i \ s)) sums f (\i. A i \ s)" proof (rule countably_additiveD [OF ca]) show "range (\n. A n \ s) \ sets M" using A s - by blast + by blast show "disjoint_family (\n. A n \ s)" using disj - by (auto simp add: disjoint_family_def) + by (auto simp add: disjoint_family_def) show "(\i. A i \ s) \ sets M" using A s - by (metis UN_extend_simps(4) s seq) + by (metis UN_extend_simps(4) s seq) qed hence "f s = suminf (\i. f (A i \ s))" by (metis Int_commute UN_simps(4) seq sums_iff) also have "... \ suminf (f \ A)" proof (rule summable_le [OF _ _ sm]) show "\n. f (A n \ s) \ (f \ A) n" using A s - by (force intro: increasingD [OF inc]) + by (force intro: increasingD [OF inc]) show "summable (\i. f (A i \ s))" using sums - by (simp add: sums_iff) + by (simp add: sums_iff) qed also have "... = z" by (rule si) finally show "f s \ z" . @@ -722,9 +721,9 @@ proof (auto) fix n have "\f (disjointed A n)\ = f (disjointed A n)" using posf dA - by (auto simp add: positive_def image_subset_iff) + by (auto simp add: positive_def image_subset_iff) also have "... \ f (A n)" - by (metis increasingD [OF inc] UNIV_I dA image_subset_iff disjointed_subset A) + by (metis increasingD [OF inc] UNIV_I dA image_subset_iff disjointed_subset A) finally show "\f (disjointed A n)\ \ f (A n)" . qed from Series.summable_le2 [OF this sm] @@ -787,32 +786,32 @@ and ll: "!!n. ll n \ Inf (measure_set M f (A n)) + e * (1/2)^(Suc n)" by auto blast have llpos: "!!n. 0 \ ll n" - by (metis BBsums sums_iff o_apply posf positive_imp_pos suminf_ge_zero + by (metis BBsums sums_iff o_apply posf positive_imp_pos suminf_ge_zero range_subsetD BB) have sll: "summable ll & suminf ll \ suminf (\n. Inf (measure_set M f (A n))) + e" proof - - have "(\n. e * (1/2)^(Suc n)) sums (e*1)" - by (rule sums_mult [OF power_half_series]) - hence sum0: "summable (\n. e * (1 / 2) ^ Suc n)" - and eqe: "(\n. e * (1 / 2) ^ n / 2) = e" - by (auto simp add: sums_iff) - have 0: "suminf (\n. Inf (measure_set M f (A n))) + + have "(\n. e * (1/2)^(Suc n)) sums (e*1)" + by (rule sums_mult [OF power_half_series]) + hence sum0: "summable (\n. e * (1 / 2) ^ Suc n)" + and eqe: "(\n. e * (1 / 2) ^ n / 2) = e" + by (auto simp add: sums_iff) + have 0: "suminf (\n. Inf (measure_set M f (A n))) + suminf (\n. e * (1/2)^(Suc n)) = suminf (\n. Inf (measure_set M f (A n)) + e * (1/2)^(Suc n))" - by (rule suminf_add [OF sum1 sum0]) - have 1: "\n. \ll n\ \ Inf (measure_set M f (A n)) + e * (1/2) ^ Suc n" - by (metis ll llpos abs_of_nonneg) - have 2: "summable (\n. Inf (measure_set M f (A n)) + e*(1/2)^(Suc n))" - by (rule summable_add [OF sum1 sum0]) - have "suminf ll \ (\n. Inf (measure_set M f (A n)) + e*(1/2) ^ Suc n)" - using Series.summable_le2 [OF 1 2] by auto - also have "... = (\n. Inf (measure_set M f (A n))) + + by (rule suminf_add [OF sum1 sum0]) + have 1: "\n. \ll n\ \ Inf (measure_set M f (A n)) + e * (1/2) ^ Suc n" + by (metis ll llpos abs_of_nonneg) + have 2: "summable (\n. Inf (measure_set M f (A n)) + e*(1/2)^(Suc n))" + by (rule summable_add [OF sum1 sum0]) + have "suminf ll \ (\n. Inf (measure_set M f (A n)) + e*(1/2) ^ Suc n)" + using Series.summable_le2 [OF 1 2] by auto + also have "... = (\n. Inf (measure_set M f (A n))) + (\n. e * (1 / 2) ^ Suc n)" - by (metis 0) - also have "... = (\n. Inf (measure_set M f (A n))) + e" - by (simp add: eqe) - finally show ?thesis using Series.summable_le2 [OF 1 2] by auto + by (metis 0) + also have "... = (\n. Inf (measure_set M f (A n))) + e" + by (simp add: eqe) + finally show ?thesis using Series.summable_le2 [OF 1 2] by auto qed def C \ "(split BB) o nat_to_nat2" have C: "!!n. C n \ sets M" @@ -822,24 +821,24 @@ done have sbC: "(\i. A i) \ (\i. C i)" proof (auto simp add: C_def) - fix x i - assume x: "x \ A i" - with sbBB [of i] obtain j where "x \ BB i j" - by blast - thus "\i. x \ split BB (nat_to_nat2 i)" - by (metis nat_to_nat2_surj internal_split_def prod.cases + fix x i + assume x: "x \ A i" + with sbBB [of i] obtain j where "x \ BB i j" + by blast + thus "\i. x \ split BB (nat_to_nat2 i)" + by (metis nat_to_nat2_surj internal_split_def prod.cases prod_case_split surj_f_inv_f) qed have "(f \ C) = (f \ (\(x, y). BB x y)) \ nat_to_nat2" by (rule ext) (auto simp add: C_def) also have "... sums suminf ll" proof (rule suminf_2dimen) - show "\m n. 0 \ (f \ (\(x, y). BB x y)) (m, n)" using posf BB - by (force simp add: positive_def) - show "\m. (\n. (f \ (\(x, y). BB x y)) (m, n)) sums ll m"using BBsums BB - by (force simp add: o_def) - show "summable ll" using sll - by auto + show "\m n. 0 \ (f \ (\(x, y). BB x y)) (m, n)" using posf BB + by (force simp add: positive_def) + show "\m. (\n. (f \ (\(x, y). BB x y)) (m, n)) sums ll m"using BBsums BB + by (force simp add: o_def) + show "summable ll" using sll + by auto qed finally have Csums: "(f \ C) sums suminf ll" . have "Inf (measure_set M f (\i. A i)) \ suminf ll" @@ -882,24 +881,24 @@ from inf_measure_close [OF posf e s] obtain A l where A: "range A \ sets M" and disj: "disjoint_family A" and sUN: "s \ (\i. A i)" and fsums: "(f \ A) sums l" - and l: "l \ Inf (measure_set M f s) + e" - by auto + and l: "l \ 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) + 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) + by (subst additiveD [OF add, symmetric]) + (auto simp add: x range_subsetD [OF A] Int_Diff_Un Int_Diff_disjoint) have fsumb: "summable (f \ A)" - by (metis fsums sums_iff) + by (metis fsums sums_iff) { fix u - assume u: "u \ sets M" - have [simp]: "\n. \f (A n \ u)\ \ f (A n)" - by (simp add: positive_imp_pos [OF posf] increasingD [OF inc] + assume u: "u \ sets M" + have [simp]: "\n. \f (A n \ u)\ \ f (A n)" + by (simp add: positive_imp_pos [OF posf] increasingD [OF inc] u Int range_subsetD [OF A]) - have 1: "summable (f o (\z. z\u) o A)" + have 1: "summable (f o (\z. z\u) o A)" by (rule summable_comparison_test [OF _ fsumb]) simp - have 2: "Inf (measure_set M f (s\u)) \ suminf (f o (\z. z\u) o A)" + have 2: "Inf (measure_set M f (s\u)) \ suminf (f o (\z. z\u) o A)" proof (rule Inf_lower) show "suminf (f \ (\z. z \ u) \ A) \ measure_set M f (s \ u)" apply (simp add: measure_set_def) @@ -920,14 +919,14 @@ and sum2: "summable (f o (\z. z \ (space M - x)) o A)" and inf2: "Inf (measure_set M f (s \ (space M - x))) \ suminf (f o (\z. z \ (space M - x)) o A)" - by (metis Diff lesum top x)+ + by (metis Diff lesum top x)+ hence "Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x)) \ suminf (f o (\s. s\x) o A) + suminf (f o (\s. s-x) o A)" - by (simp add: x) + by (simp add: x) also have "... \ suminf (f o A)" using suminf_add [OF sum1 sum2] - by (simp add: x) (simp add: o_def) + by (simp add: x) (simp add: o_def) also have "... \ Inf (measure_set M f s) + e" - by (metis fsums l sums_unique) + by (metis fsums l sums_unique) finally show "Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x)) \ Inf (measure_set M f s) + e" . qed @@ -940,7 +939,7 @@ also have "... \ Inf (measure_set M f (s\x)) + Inf (measure_set M f (s-x))" apply (rule subadditiveD) apply (iprover intro: algebra.countably_subadditive_subadditive algebra_Pow - inf_measure_positive inf_measure_countably_subadditive posf inc) + inf_measure_positive inf_measure_countably_subadditive posf inc) apply (auto simp add: subsetD [OF s]) done finally show ?thesis . diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/Measure.thy --- a/src/HOL/Probability/Measure.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/Measure.thy Mon Nov 09 19:42:33 2009 +0100 @@ -46,8 +46,8 @@ definition measurable where "measurable a b = {f . sigma_algebra a & sigma_algebra b & - f \ (space a -> space b) & - (\y \ sets b. (f -` y) \ (space a) \ sets a)}" + f \ (space a -> space b) & + (\y \ sets b. (f -` y) \ (space a) \ sets a)}" definition measure_preserving where @@ -258,23 +258,23 @@ fix x assume x: "x \ smallest_ccdi_sets M" thus "x \ C" - proof (induct rule: smallest_ccdi_sets.induct) - case (Basic x) - thus ?case - by (metis Basic subsetD sbC) - next - case (Compl x) - thus ?case - by (blast intro: closed_cdi_Compl [OF ccdi, simplified]) - next - case (Inc A) - thus ?case - by (auto intro: closed_cdi_Inc [OF ccdi, simplified]) - next - case (Disj A) - thus ?case - by (auto intro: closed_cdi_Disj [OF ccdi, simplified]) - qed + proof (induct rule: smallest_ccdi_sets.induct) + case (Basic x) + thus ?case + by (metis Basic subsetD sbC) + next + case (Compl x) + thus ?case + by (blast intro: closed_cdi_Compl [OF ccdi, simplified]) + next + case (Inc A) + thus ?case + by (auto intro: closed_cdi_Inc [OF ccdi, simplified]) + next + case (Disj A) + thus ?case + by (auto intro: closed_cdi_Disj [OF ccdi, simplified]) + qed qed finally show ?thesis . qed @@ -292,12 +292,12 @@ have "sigma_sets (space M) (sets M) \ C \ sigma_sets (space M) (sets M)" proof (rule sigma_property_disjoint_lemma) show "sets M \ C \ sigma_sets (space M) (sets M)" - by (metis Int_greatest Set.subsetI sbC sigma_sets.Basic) + by (metis Int_greatest Set.subsetI sbC sigma_sets.Basic) next show "closed_cdi \space = space M, sets = C \ sigma_sets (space M) (sets M)\" - by (simp add: closed_cdi_def compl inc disj) + by (simp add: closed_cdi_def compl inc disj) (metis PowI Set.subsetI le_infI2 sigma_sets_into_sp space_closed - IntE sigma_sets.Compl range_subsetD sigma_sets.Union) + IntE sigma_sets.Compl range_subsetD sigma_sets.Union) qed thus ?thesis by blast @@ -349,7 +349,7 @@ case 0 show ?case by simp next case (Suc m) thus ?case - by (metis Suc_eq_plus1 assms nat_add_commute nat_add_left_commute subset_trans) + by (metis Suc_eq_plus1 assms nat_add_commute nat_add_left_commute subset_trans) qed } hence "!!m n. m < n \ A m \ A n" @@ -371,17 +371,17 @@ have "(measure M \ A) n = setsum (measure M \ (\i. A (Suc i) - A i)) {0.. (A (Suc m) - A m)" - by (metis ASuc Un_Diff_cancel Un_absorb1) - hence "measure M (A (Suc m)) = + case (Suc m) + have "A (Suc m) = A m \ (A (Suc m) - A m)" + by (metis ASuc Un_Diff_cancel Un_absorb1) + hence "measure M (A (Suc m)) = measure M (A m) + measure M (A (Suc m) - A m)" - by (subst measure_additive) + by (subst measure_additive) (auto simp add: measure_additive range_subsetD [OF A]) - with Suc show ?case - by simp + with Suc show ?case + by simp qed } hence Meq: "measure M o A = (\n. setsum (measure M o (\i. A(Suc i) - A i)) {0..i\{0..i\{0..i. A (Suc i) - A i \ sets M" by (metis A Diff range_subsetD) @@ -461,23 +461,23 @@ assume A: "range A \ (vimage f) ` (sets b)" have "(\i. A i) \ (vimage f) ` (sets b)" proof - - def B \ "\i. @v. v \ sets b \ f -` v = A i" - { - fix i - have "A i \ (vimage f) ` (sets b)" using A - by blast - hence "\v. v \ sets b \ f -` v = A i" - by blast - hence "B i \ sets b \ f -` B i = A i" - by (simp add: B_def) (erule someI_ex) - } note B = this - show ?thesis - proof - show "(\i. A i) = f -` (\i. B i)" - by (simp add: vimage_UN B) - show "(\i. B i) \ sets b" using B - by (auto intro: sigma_algebra.countable_UN [OF b]) - qed + def B \ "\i. @v. v \ sets b \ f -` v = A i" + { + fix i + have "A i \ (vimage f) ` (sets b)" using A + by blast + hence "\v. v \ sets b \ f -` v = A i" + by blast + hence "B i \ sets b \ f -` B i = A i" + by (simp add: B_def) (erule someI_ex) + } note B = this + show ?thesis + proof + show "(\i. A i) = f -` (\i. B i)" + by (simp add: vimage_UN B) + show "(\i. B i) \ sets b" using B + by (auto intro: sigma_algebra.countable_UN [OF b]) + qed qed } thus "\A::nat \ 'a set. @@ -496,26 +496,26 @@ fix x assume "x \ sigma_sets X B" thus "f -` x \ space M \ sets M \ x \ X" - proof induct - case (Basic a) - thus ?case - by (auto simp add: ba) (metis B subsetD PowD) + proof induct + case (Basic a) + thus ?case + by (auto simp add: ba) (metis B subsetD PowD) next - case Empty - thus ?case - by auto + case Empty + thus ?case + by auto next - case (Compl a) - have [simp]: "f -` X \ space M = space M" - by (auto simp add: funcset_mem [OF f]) - thus ?case - by (auto simp add: vimage_Diff Diff_Int_distrib2 compl_sets Compl) - next - case (Union a) - thus ?case - by (simp add: vimage_UN, simp only: UN_extend_simps(4)) - (blast intro: countable_UN) - qed + case (Compl a) + have [simp]: "f -` X \ space M = space M" + by (auto simp add: funcset_mem [OF f]) + thus ?case + by (auto simp add: vimage_Diff Diff_Int_distrib2 compl_sets Compl) + next + case (Union a) + thus ?case + by (simp add: vimage_UN, simp only: UN_extend_simps(4)) + (blast intro: countable_UN) + qed qed thus ?thesis by (simp add: measurable_def sigma_algebra_axioms sigma_algebra_sigma B f) @@ -553,122 +553,122 @@ show ?thesis using fmp proof (clarsimp simp add: measure_preserving_def m1 m2) assume fm: "f \ measurable m1 (m a)" - and mam: "measure_space (m a)" - and meq: "\y\a. measure m1 (f -` y \ space m1) = measure m2 y" + and mam: "measure_space (m a)" + and meq: "\y\a. measure m1 (f -` y \ space m1) = measure m2 y" have "f \ measurable m1 (sigma (space (m a)) (sets (m a)))" - by (rule subsetD [OF measurable_subset fm]) + by (rule subsetD [OF measurable_subset fm]) also have "... = measurable m1 m2" - by (rule measurable_eqI) (simp_all add: m_def setsm2 sigma_def) + by (rule measurable_eqI) (simp_all add: m_def setsm2 sigma_def) finally have f12: "f \ measurable m1 m2" . hence ffn: "f \ space m1 \ space m2" - by (simp add: measurable_def) + by (simp add: measurable_def) have "space m1 \ f -` (space m2)" - by auto (metis PiE ffn) + by auto (metis PiE ffn) hence fveq [simp]: "(f -` (space m2)) \ space m1 = space m1" - by blast + by blast { - fix y - assume y: "y \ sets m2" - have ama: "algebra (m a)" using mam - by (simp add: measure_space_def sigma_algebra_iff) - have spa: "space m2 \ a" using algebra.top [OF ama] - by (simp add: m_def) - have "sigma_sets (space m2) a = sigma_sets (space (m a)) (sets (m a))" - by (simp add: m_def) - also have "... \ {s . measure m1 ((f -` s) \ space m1) = measure m2 s}" - proof (rule algebra.sigma_property_disjoint, auto simp add: ama) - fix x - assume x: "x \ a" - thus "measure m1 (f -` x \ space m1) = measure m2 x" - by (simp add: meq) - next - fix s - assume eq: "measure m1 (f -` s \ space m1) = measure m2 s" - and s: "s \ sigma_sets (space m2) a" - hence s2: "s \ sets m2" - by (simp add: setsm2) - thus "measure m1 (f -` (space m2 - s) \ space m1) = + fix y + assume y: "y \ sets m2" + have ama: "algebra (m a)" using mam + by (simp add: measure_space_def sigma_algebra_iff) + have spa: "space m2 \ a" using algebra.top [OF ama] + by (simp add: m_def) + have "sigma_sets (space m2) a = sigma_sets (space (m a)) (sets (m a))" + by (simp add: m_def) + also have "... \ {s . measure m1 ((f -` s) \ space m1) = measure m2 s}" + proof (rule algebra.sigma_property_disjoint, auto simp add: ama) + fix x + assume x: "x \ a" + thus "measure m1 (f -` x \ space m1) = measure m2 x" + by (simp add: meq) + next + fix s + assume eq: "measure m1 (f -` s \ space m1) = measure m2 s" + and s: "s \ sigma_sets (space m2) a" + hence s2: "s \ sets m2" + by (simp add: setsm2) + thus "measure m1 (f -` (space m2 - s) \ space m1) = measure m2 (space m2 - s)" using f12 - by (simp add: vimage_Diff Diff_Int_distrib2 eq m1 m2 - measure_space.measure_compl measurable_def) - (metis fveq meq spa) - next - fix A - assume A0: "A 0 = {}" - and ASuc: "!!n. A n \ A (Suc n)" - and rA1: "range A \ - {s. measure m1 (f -` s \ space m1) = measure m2 s}" - and "range A \ sigma_sets (space m2) a" - hence rA2: "range A \ sets m2" by (metis setsm2) - have eq1: "!!i. measure m1 (f -` A i \ space m1) = measure m2 (A i)" - using rA1 by blast - have "(measure m2 \ A) = measure m1 o (\i. (f -` A i \ space m1))" - by (simp add: o_def eq1) - also have "... ----> measure m1 (\i. f -` A i \ space m1)" - proof (rule measure_space.measure_countable_increasing [OF m1]) - show "range (\i. f -` A i \ space m1) \ sets m1" - using f12 rA2 by (auto simp add: measurable_def) - show "f -` A 0 \ space m1 = {}" using A0 - by blast - show "\n. f -` A n \ space m1 \ f -` A (Suc n) \ space m1" - using ASuc by auto - qed - also have "... = measure m1 (f -` (\i. A i) \ space m1)" - by (simp add: vimage_UN) - finally have "(measure m2 \ A) ----> measure m1 (f -` (\i. A i) \ space m1)" . - moreover - have "(measure m2 \ A) ----> measure m2 (\i. A i)" - by (rule measure_space.measure_countable_increasing - [OF m2 rA2, OF A0 ASuc]) - ultimately - show "measure m1 (f -` (\i. A i) \ space m1) = + by (simp add: vimage_Diff Diff_Int_distrib2 eq m1 m2 + measure_space.measure_compl measurable_def) + (metis fveq meq spa) + next + fix A + assume A0: "A 0 = {}" + and ASuc: "!!n. A n \ A (Suc n)" + and rA1: "range A \ + {s. measure m1 (f -` s \ space m1) = measure m2 s}" + and "range A \ sigma_sets (space m2) a" + hence rA2: "range A \ sets m2" by (metis setsm2) + have eq1: "!!i. measure m1 (f -` A i \ space m1) = measure m2 (A i)" + using rA1 by blast + have "(measure m2 \ A) = measure m1 o (\i. (f -` A i \ space m1))" + by (simp add: o_def eq1) + also have "... ----> measure m1 (\i. f -` A i \ space m1)" + proof (rule measure_space.measure_countable_increasing [OF m1]) + show "range (\i. f -` A i \ space m1) \ sets m1" + using f12 rA2 by (auto simp add: measurable_def) + show "f -` A 0 \ space m1 = {}" using A0 + by blast + show "\n. f -` A n \ space m1 \ f -` A (Suc n) \ space m1" + using ASuc by auto + qed + also have "... = measure m1 (f -` (\i. A i) \ space m1)" + by (simp add: vimage_UN) + finally have "(measure m2 \ A) ----> measure m1 (f -` (\i. A i) \ space m1)" . + moreover + have "(measure m2 \ A) ----> measure m2 (\i. A i)" + by (rule measure_space.measure_countable_increasing + [OF m2 rA2, OF A0 ASuc]) + ultimately + show "measure m1 (f -` (\i. A i) \ space m1) = measure m2 (\i. A i)" - by (rule LIMSEQ_unique) - next - fix A :: "nat => 'a2 set" - assume dA: "disjoint_family A" - and rA1: "range A \ - {s. measure m1 (f -` s \ space m1) = measure m2 s}" - and "range A \ sigma_sets (space m2) a" - hence rA2: "range A \ sets m2" by (metis setsm2) - hence Um2: "(\i. A i) \ sets m2" - by (metis range_subsetD setsm2 sigma_sets.Union) - have "!!i. measure m1 (f -` A i \ space m1) = measure m2 (A i)" - using rA1 by blast - hence "measure m2 o A = measure m1 o (\i. f -` A i \ space m1)" - by (simp add: o_def) - also have "... sums measure m1 (\i. f -` A i \ space m1)" - proof (rule measure_space.measure_countably_additive [OF m1] ) - 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) - 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 - by (auto simp add: measurable_def) - qed - qed - finally have "(measure m2 o A) sums measure m1 (\i. f -` A i \ space m1)" . - with measure_space.measure_countably_additive [OF m2 rA2 dA Um2] - have "measure m1 (\i. f -` A i \ space m1) = measure m2 (\i. A i)" - by (metis sums_unique) + by (rule LIMSEQ_unique) + next + fix A :: "nat => 'a2 set" + assume dA: "disjoint_family A" + and rA1: "range A \ + {s. measure m1 (f -` s \ space m1) = measure m2 s}" + and "range A \ sigma_sets (space m2) a" + hence rA2: "range A \ sets m2" by (metis setsm2) + hence Um2: "(\i. A i) \ sets m2" + by (metis range_subsetD setsm2 sigma_sets.Union) + have "!!i. measure m1 (f -` A i \ space m1) = measure m2 (A i)" + using rA1 by blast + hence "measure m2 o A = measure m1 o (\i. f -` A i \ space m1)" + by (simp add: o_def) + also have "... sums measure m1 (\i. f -` A i \ space m1)" + proof (rule measure_space.measure_countably_additive [OF m1] ) + 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) + 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 + by (auto simp add: measurable_def) + qed + qed + finally have "(measure m2 o A) sums measure m1 (\i. f -` A i \ space m1)" . + with measure_space.measure_countably_additive [OF m2 rA2 dA Um2] + have "measure m1 (\i. f -` A i \ space m1) = measure m2 (\i. A i)" + by (metis sums_unique) - moreover have "measure m1 (f -` (\i. A i) \ space m1) = measure m1 (\i. f -` A i \ space m1)" - by (simp add: vimage_UN) - ultimately show "measure m1 (f -` (\i. A i) \ space m1) = + moreover have "measure m1 (f -` (\i. A i) \ space m1) = measure m1 (\i. f -` A i \ space m1)" + by (simp add: vimage_UN) + ultimately show "measure m1 (f -` (\i. A i) \ space m1) = measure m2 (\i. A i)" - by metis - qed - finally have "sigma_sets (space m2) a + by metis + qed + finally have "sigma_sets (space m2) a \ {s . measure m1 ((f -` s) \ space m1) = measure m2 s}" . - hence "measure m1 (f -` y \ space m1) = measure m2 y" using y - by (force simp add: setsm2) + hence "measure m1 (f -` y \ space m1) = measure m2 y" using y + by (force simp add: setsm2) } thus "f \ measurable m1 m2 \ (\y\sets m2. measure m1 (f -` y \ space m1) = measure m2 y)" - by (blast intro: f12) + by (blast intro: f12) qed qed diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/Probability.thy --- a/src/HOL/Probability/Probability.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/Probability.thy Mon Nov 09 19:42:33 2009 +0100 @@ -1,5 +1,5 @@ -theory Probability imports - Measure +theory Probability +imports Measure begin end diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/ROOT.ML --- a/src/HOL/Probability/ROOT.ML Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/ROOT.ML Mon Nov 09 19:42:33 2009 +0100 @@ -1,6 +1,1 @@ -(* - no_document use_thy "ThisTheory"; - use_thy "ThatTheory"; -*) - use_thy "Probability"; diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/SeriesPlus.thy --- a/src/HOL/Probability/SeriesPlus.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/SeriesPlus.thy Mon Nov 09 19:42:33 2009 +0100 @@ -1,6 +1,5 @@ theory SeriesPlus imports Complex_Main Nat_Int_Bij - begin text{*From the Hurd/Coble measure theory development, translated by Lawrence Paulson.*} @@ -28,9 +27,9 @@ proof - fix m have "0 \ suminf (\n. f (m,n))" - by (rule suminf_0_le, simp add: f_nneg, metis fsums sums_iff) + by (rule suminf_0_le, simp add: f_nneg, metis fsums sums_iff) thus "0 \ g m" using fsums [of m] - by (auto simp add: sums_iff) + by (auto simp add: sums_iff) qed show "(\n. \x = 0.. suminf g" proof (rule increasing_LIMSEQ, simp add: f_nneg) @@ -48,14 +47,14 @@ by (rule setsum_mono2) (auto simp add: ij) also have "... = setsum (\m. setsum (\n. f (m,n)) {0..j}) {0.. setsum g {0.. i" - thus " (\n = 0..j. f (m, n)) \ g m" using fsums [of m] - by (auto simp add: sums_iff) - (metis atLeastLessThanSuc_atLeastAtMost f_nneg series_pos_le f_nneg) + fix m + assume m: "m \ i" + thus " (\n = 0..j. f (m, n)) \ g m" using fsums [of m] + by (auto simp add: sums_iff) + (metis atLeastLessThanSuc_atLeastAtMost f_nneg series_pos_le f_nneg) qed finally have "(\x = 0.. setsum g {0.. suminf g" @@ -73,13 +72,13 @@ { fix m assume m: "mj. \(\n = 0.. < e/(2 * real N)" - using fsums [of m] m + using fsums [of m] m by (force simp add: sums_def LIMSEQ_def dist_real_def) hence "\j. g m < setsum (\n. f (m,n)) {0..jj. \m. m g m < (\n = 0.. "Max (nat_to_nat2 -` IJ)" have IJsb: "IJ \ nat_to_nat2 ` {0..NIJ}" proof (auto simp add: NIJ_def) - fix i j - assume ij:"(i,j) \ IJ" - hence "(i,j) = nat_to_nat2 (inv nat_to_nat2 (i,j))" - by (metis nat_to_nat2_surj surj_f_inv_f) - thus "(i,j) \ nat_to_nat2 ` {0..Max (nat_to_nat2 -` IJ)}" - by (rule image_eqI) - (simp add: ij finite_vimageI [OF finite_IJ nat_to_nat2_inj] + fix i j + assume ij:"(i,j) \ IJ" + hence "(i,j) = nat_to_nat2 (inv nat_to_nat2 (i,j))" + by (metis nat_to_nat2_surj surj_f_inv_f) + thus "(i,j) \ nat_to_nat2 ` {0..Max (nat_to_nat2 -` IJ)}" + by (rule image_eqI) + (simp add: ij finite_vimageI [OF finite_IJ nat_to_nat2_inj] nat_to_nat2_surj surj_f_inv_f) qed have "setsum f IJ \ setsum f (nat_to_nat2 `{0..NIJ})" diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Probability/Sigma_Algebra.thy Mon Nov 09 19:42:33 2009 +0100 @@ -235,4 +235,3 @@ by (simp add: sigma_def sigma_sets_subset) end - diff -r b233f48a4d3d -r fd28b7399f2b src/HOL/Series.thy --- a/src/HOL/Series.thy Mon Nov 09 16:06:08 2009 +0000 +++ b/src/HOL/Series.thy Mon Nov 09 19:42:33 2009 +0100 @@ -293,11 +293,11 @@ have "convergent (\n. setsum f {0..n. setsum f {0..n. setsum f {0..n. x"]) + by (rule f_inc_g_dec_Beq_f [of "(\n. setsum f {0..n. x"]) (auto simp add: le pos) next show "\m n. m \ n \ setsum f {0.. setsum f {0.. L" by (blast dest: convergentD)