# HG changeset patch # User hoelzl # Date 1335374760 -7200 # Node ID dfe747e72fa8739b8a4720aa4bda4caa85e7e717 # Parent b9840d8fca43adaec14bce4bf40e1da871aa9637 moved lemmas to appropriate places diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Library/FuncSet.thy --- a/src/HOL/Library/FuncSet.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Library/FuncSet.thy Wed Apr 25 19:26:00 2012 +0200 @@ -63,6 +63,9 @@ lemma Pi_mem: "[|f: Pi A B; x \ A|] ==> f x \ B x" by (simp add: Pi_def) +lemma Pi_iff: "f \ Pi I X \ (\i\I. f i \ X i)" + unfolding Pi_def by auto + lemma PiE [elim]: "f : Pi A B ==> (f x : B x ==> Q) ==> (x ~: A ==> Q) ==> Q" by(auto simp: Pi_def) diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy --- a/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy Wed Apr 25 19:26:00 2012 +0200 @@ -1129,22 +1129,6 @@ using assms real by (simp add: ereal_le_minus) qed (insert assms, auto) -lemma sums_finite: - assumes "\N\n. f N = 0" - shows "f sums (\NNN 'a::{comm_monoid_add,t2_space}" assumes "\N\n. f N = 0" - shows "suminf f = (\N ereal" assumes "\n. 0 \ f n" shows "(\n (\n. f n)" @@ -1294,4 +1278,13 @@ apply (subst SUP_commute) .. qed +lemma suminf_setsum_ereal: + fixes f :: "_ \ _ \ ereal" + assumes nonneg: "\i a. a \ A \ 0 \ f i a" + shows "(\i. \a\A. f i a) = (\a\A. \i. f i a)" +proof cases + assume "finite A" from this nonneg show ?thesis + by induct (simp_all add: suminf_add_ereal setsum_nonneg) +qed simp + end diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Probability/Borel_Space.thy --- a/src/HOL/Probability/Borel_Space.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Probability/Borel_Space.thy Wed Apr 25 19:26:00 2012 +0200 @@ -943,6 +943,28 @@ using measurable_comp[OF f borel_measurable_borel_log[OF `1 < b`]] by (simp add: comp_def) +lemma borel_measurable_real_floor: + "(\x::real. real \x\) \ borel_measurable borel" + unfolding borel_measurable_iff_ge +proof (intro allI) + fix a :: real + { fix x have "a \ real \x\ \ real \a\ \ x" + using le_floor_eq[of "\a\" x] ceiling_le_iff[of a "\x\"] + unfolding real_eq_of_int by simp } + then have "{w::real \ space borel. a \ real \w\} = {real \a\..}" by auto + then show "{w::real \ space borel. a \ real \w\} \ sets borel" by auto +qed + +lemma borel_measurable_real_natfloor[intro, simp]: + assumes "f \ borel_measurable M" + shows "(\x. real (natfloor (f x))) \ borel_measurable M" +proof - + have "\x. real (natfloor (f x)) = max 0 (real \f x\)" + by (auto simp: max_def natfloor_def) + with borel_measurable_max[OF measurable_comp[OF assms borel_measurable_real_floor] borel_measurable_const] + show ?thesis by (simp add: comp_def) +qed + subsection "Borel space on the extended reals" lemma borel_measurable_ereal_borel: diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Probability/Caratheodory.thy --- a/src/HOL/Probability/Caratheodory.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Probability/Caratheodory.thy Wed Apr 25 19:26:00 2012 +0200 @@ -357,7 +357,7 @@ proof - let ?A = "\i::nat. (if i = 0 then b else {})" have "(\i. f (?A i)) = (\i<1::nat. f (?A i))" - by (rule suminf_finite) (simp add: f[unfolded positive_def]) + by (rule suminf_finite) (simp_all add: f[unfolded positive_def]) also have "... = f b" by simp finally show ?thesis using assms diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Probability/Finite_Product_Measure.thy --- a/src/HOL/Probability/Finite_Product_Measure.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Probability/Finite_Product_Measure.thy Wed Apr 25 19:26:00 2012 +0200 @@ -11,9 +11,6 @@ lemma split_const: "(\(i, j). c) = (\_. c)" by auto -lemma Pi_iff: "f \ Pi I X \ (\i\I. f i \ X i)" - unfolding Pi_def by auto - abbreviation "Pi\<^isub>E A B \ Pi A B \ extensional A" diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Wed Apr 25 19:26:00 2012 +0200 @@ -32,16 +32,6 @@ by (intro tendsto_add assms tendsto_divide tendsto_norm tendsto_diff) auto qed -lemma measure_Union: - assumes "finite S" "S \ sets M" "\A B. A \ S \ B \ S \ A \ B \ A \ B = {}" - shows "setsum (emeasure M) S = (emeasure M) (\S)" -proof - - have "setsum (emeasure M) S = (emeasure M) (\i\S. i)" - using assms by (intro setsum_emeasure[OF _ _ `finite S`]) (auto simp: disjoint_family_on_def) - also have "\ = (emeasure M) (\S)" by (auto intro!: arg_cong[where f="emeasure M"]) - finally show ?thesis . -qed - lemma measurable_sets2[intro]: assumes "f \ measurable M M'" "g \ measurable M M''" and "A \ sets M'" "B \ sets M''" @@ -57,55 +47,6 @@ assume "\n. f n \ f (Suc n)" then show "incseq f" by (auto intro!: incseq_SucI) qed (auto simp: incseq_def) -lemma borel_measurable_real_floor: - "(\x::real. real \x\) \ borel_measurable borel" - unfolding borel_measurable_iff_ge -proof (intro allI) - fix a :: real - { fix x have "a \ real \x\ \ real \a\ \ x" - using le_floor_eq[of "\a\" x] ceiling_le_iff[of a "\x\"] - unfolding real_eq_of_int by simp } - then have "{w::real \ space borel. a \ real \w\} = {real \a\..}" by auto - then show "{w::real \ space borel. a \ real \w\} \ sets borel" by auto -qed - -lemma borel_measurable_real_natfloor[intro, simp]: - assumes "f \ borel_measurable M" - shows "(\x. real (natfloor (f x))) \ borel_measurable M" -proof - - have "\x. real (natfloor (f x)) = max 0 (real \f x\)" - by (auto simp: max_def natfloor_def) - with borel_measurable_max[OF measurable_comp[OF assms borel_measurable_real_floor] borel_measurable_const] - show ?thesis by (simp add: comp_def) -qed - -lemma AE_not_in: - assumes N: "N \ null_sets M" shows "AE x in M. x \ N" - using N by (rule AE_I') auto - -lemma sums_If_finite: - fixes f :: "nat \ 'a::real_normed_vector" - assumes finite: "finite {r. P r}" - shows "(\r. if P r then f r else 0) sums (\r\{r. P r}. f r)" (is "?F sums _") -proof cases - assume "{r. P r} = {}" hence "\r. \ P r" by auto - thus ?thesis by (simp add: sums_zero) -next - assume not_empty: "{r. P r} \ {}" - have "?F sums (\r = 0..< Suc (Max {r. P r}). ?F r)" - by (rule series_zero) - (auto simp add: Max_less_iff[OF finite not_empty] less_eq_Suc_le[symmetric]) - also have "(\r = 0..< Suc (Max {r. P r}). ?F r) = (\r\{r. P r}. f r)" - by (subst setsum_cases) - (auto intro!: setsum_cong simp: Max_ge_iff[OF finite not_empty] less_Suc_eq_le) - finally show ?thesis . -qed - -lemma sums_single: - fixes f :: "nat \ 'a::real_normed_vector" - shows "(\r. if r = i then f r else 0) sums f i" - using sums_If_finite[of "\r. r = i" f] by simp - section "Simple function" text {* @@ -526,7 +467,7 @@ { fix x assume "x \ space M" have "\(?sub (f x)) = (f -` {f x} \ space M)" by auto with sets have "(emeasure M) (f -` {f x} \ space M) = setsum (emeasure M) (?sub (f x))" - by (subst measure_Union) auto } + by (subst setsum_emeasure) (auto simp: disjoint_family_on_def) } hence "integral\<^isup>S M f = (\(x,A)\?SIGMA. x * (emeasure M) A)" unfolding simple_integral_def using f sets by (subst setsum_Sigma[symmetric]) diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Probability/Measure_Space.thy --- a/src/HOL/Probability/Measure_Space.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Probability/Measure_Space.thy Wed Apr 25 19:26:00 2012 +0200 @@ -12,22 +12,6 @@ "~~/src/HOL/Multivariate_Analysis/Extended_Real_Limits" begin -lemma suminf_eq_setsum: - fixes f :: "nat \ 'a::{comm_monoid_add, t2_space}" - assumes "finite {i. f i \ 0}" (is "finite ?P") - shows "(\i. f i) = (\i | f i \ 0. f i)" -proof cases - assume "?P \ {}" - have [dest!]: "\i. Suc (Max ?P) \ i \ f i = 0" - using `finite ?P` `?P \ {}` by (auto simp: Suc_le_eq) - have "(\i. f i) = (\i = (\i | f i \ 0. f i)" - using `finite ?P` `?P \ {}` - by (intro setsum_mono_zero_right) (auto simp: less_Suc_eq_le) - finally show ?thesis . -qed simp - lemma suminf_cmult_indicator: fixes f :: "nat \ ereal" assumes "disjoint_family A" "x \ A i" "\i. 0 \ f i" @@ -246,7 +230,7 @@ using disj by (auto simp: disjoint_family_on_def) from fin_not_0 have "(\i. \ (F i)) = (\i | \ (F i) \ 0. \ (F i))" - by (rule suminf_eq_setsum) + by (rule suminf_finite) auto also have "\ = (\i | F i \ {}. \ (F i))" using fin_not_empty F_subset by (rule setsum_mono_zero_left) auto also have "\ = \ (\i\{i. F i \ {}}. F i)" @@ -791,6 +775,10 @@ using Int_absorb1[OF sets_into_space, of N M] by (subst AE_iff_null) (auto simp: Int_def[symmetric]) +lemma AE_not_in: + "N \ null_sets M \ AE x in M. x \ N" + by (metis AE_iff_null_sets null_setsD2) + lemma AE_iff_measurable: "N \ sets M \ {x\space M. \ P x} = N \ (AE x in M. P x) \ emeasure M N = 0" using AE_iff_null[of _ P] by auto @@ -1357,7 +1345,7 @@ with finite_F have "finite {i. ?M (F i) \ 0} " by (simp add: fin_eq) then have "(\i. ?M (F i)) = (\i | ?M (F i) \ 0. ?M (F i))" - by (rule suminf_eq_setsum) + by (rule suminf_finite) auto also have "\ = ereal (\i | F i \ {}. card (F i))" using finite_F by simp also have "\ = ereal (card (\i \ {i. F i \ {}}. F i))" diff -r b9840d8fca43 -r dfe747e72fa8 src/HOL/Series.thy --- a/src/HOL/Series.thy Wed Apr 25 17:15:10 2012 +0200 +++ b/src/HOL/Series.thy Wed Apr 25 19:26:00 2012 +0200 @@ -120,6 +120,50 @@ shows "f sums x \ summable f \ (suminf f = x)" by (metis summable_sums sums_summable sums_unique) +lemma sums_finite: + assumes [simp]: "finite N" + assumes f: "\n. n \ N \ f n = 0" + shows "f sums (\n\N. f n)" +proof - + { fix n + have "setsum f {..x. 0)" by auto + then show ?thesis by simp + next + assume [simp]: "N \ {}" + show ?thesis + proof (safe intro!: setsum_mono_zero_right f) + fix i assume "i \ N" + then have "i \ Max N" by simp + then show "i < n + Suc (Max N)" by simp + qed + qed } + note eq = this + show ?thesis unfolding sums_def + by (rule LIMSEQ_offset[of _ "Suc (Max N)"]) + (simp add: eq atLeast0LessThan tendsto_const del: add_Suc_right) +qed + +lemma suminf_finite: + fixes f :: "nat \ 'a::{comm_monoid_add,t2_space}" + assumes N: "finite N" and f: "\n. n \ N \ f n = 0" + shows "suminf f = (\n\N. f n)" + using sums_finite[OF assms, THEN sums_unique] by simp + +lemma sums_If_finite_set: + "finite A \ (\r. if r \ A then f r else 0 :: 'a::{comm_monoid_add,t2_space}) sums (\r\A. f r)" + using sums_finite[of A "(\r. if r \ A then f r else 0)"] by simp + +lemma sums_If_finite: + "finite {r. P r} \ (\r. if P r then f r else 0 :: 'a::{comm_monoid_add,t2_space}) sums (\r | P r. f r)" + using sums_If_finite_set[of "{r. P r}" f] by simp + +lemma sums_single: + "(\r. if r = i then f r else 0::'a::{comm_monoid_add,t2_space}) sums f i" + using sums_If_finite[of "\r. r = i" f] by simp + lemma sums_split_initial_segment: fixes f :: "nat \ 'a::real_normed_vector" shows "f sums s ==> (\n. f(n + k)) sums (s - (SUM i = 0..< k. f i))"