# HG changeset patch # User hoelzl # Date 1400606679 -7200 # Node ID e7fd64f828760fb1c717fb5086bf86ed430b0335 # Parent c9e98c2498fdaa4b35426aaf583c6bf4bd7d6387 add various lemmas diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Finite_Set.thy --- a/src/HOL/Finite_Set.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Finite_Set.thy Tue May 20 19:24:39 2014 +0200 @@ -415,10 +415,13 @@ by (auto simp add: finite_conv_nat_seg_image) qed +lemma finite_cartesian_product_iff: + "finite (A \ B) \ (A = {} \ B = {} \ (finite A \ finite B))" + by (auto dest: finite_cartesian_productD1 finite_cartesian_productD2 finite_cartesian_product) + lemma finite_prod: "finite (UNIV :: ('a \ 'b) set) \ finite (UNIV :: 'a set) \ finite (UNIV :: 'b set)" -by(auto simp add: UNIV_Times_UNIV[symmetric] simp del: UNIV_Times_UNIV - dest: finite_cartesian_productD1 finite_cartesian_productD2) + using finite_cartesian_product_iff[of UNIV UNIV] by simp lemma finite_Pow_iff [iff]: "finite (Pow A) \ finite A" diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Library/Countable_Set.thy --- a/src/HOL/Library/Countable_Set.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Library/Countable_Set.thy Tue May 20 19:24:39 2014 +0200 @@ -283,4 +283,17 @@ shows "(\s\S. P s) \ (\n::nat. from_nat_into S n \ S \ P (from_nat_into S n))" using S[THEN subset_range_from_nat_into] by auto +lemma finite_sequence_to_countable_set: + assumes "countable X" obtains F where "\i. F i \ X" "\i. F i \ F (Suc i)" "\i. finite (F i)" "(\i. F i) = X" +proof - show thesis + apply (rule that[of "\i. if X = {} then {} else from_nat_into X ` {..i}"]) + apply (auto simp: image_iff Ball_def intro: from_nat_into split: split_if_asm) + proof - + fix x n assume "x \ X" "\i m. m \ i \ x \ from_nat_into X m" + with from_nat_into_surj[OF `countable X` `x \ X`] + show False + by auto + qed +qed + end diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Library/Extended_Real.thy --- a/src/HOL/Library/Extended_Real.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Library/Extended_Real.thy Tue May 20 19:24:39 2014 +0200 @@ -2168,6 +2168,10 @@ by (auto simp: order_tendsto_iff) qed +lemma tendsto_PInfty_eq_at_top: + "((\z. ereal (f z)) ---> \) F \ (LIM z F. f z :> at_top)" + unfolding tendsto_PInfty filterlim_at_top_dense by simp + lemma tendsto_MInfty: "(f ---> -\) F \ (\r. eventually (\x. f x < ereal r) F)" unfolding tendsto_def proof safe diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Library/Library.thy --- a/src/HOL/Library/Library.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Library/Library.thy Tue May 20 19:24:39 2014 +0200 @@ -39,6 +39,7 @@ Monad_Syntax Multiset Numeral_Type + NthRoot_Limits OptionalSugar Option_ord Order_Continuity diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Library/NthRoot_Limits.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Library/NthRoot_Limits.thy Tue May 20 19:24:39 2014 +0200 @@ -0,0 +1,94 @@ +theory NthRoot_Limits + imports Complex_Main "~~/src/HOL/Number_Theory/Binomial" +begin + +text {* + +This does not fit into @{text Complex_Main}, as it depends on @{text Binomial} + +*} + +lemma LIMSEQ_root: "(\n. root n n) ----> 1" +proof - + def x \ "\n. root n n - 1" + have "x ----> sqrt 0" + proof (rule tendsto_sandwich[OF _ _ tendsto_const]) + show "(\x. sqrt (2 / x)) ----> sqrt 0" + by (intro tendsto_intros tendsto_divide_0[OF tendsto_const] filterlim_mono[OF filterlim_real_sequentially]) + (simp_all add: at_infinity_eq_at_top_bot) + { fix n :: nat assume "2 < n" + have "1 + (real (n - 1) * n) / 2 * x n^2 = 1 + of_nat (n choose 2) * x n^2" + using `2 < n` unfolding gbinomial_def binomial_gbinomial + by (simp add: atLeast0AtMost atMost_Suc field_simps real_of_nat_diff numeral_2_eq_2 real_eq_of_nat[symmetric]) + also have "\ \ (\k\{0, 2}. of_nat (n choose k) * x n^k)" + by (simp add: x_def) + also have "\ \ (\k=0..n. of_nat (n choose k) * x n^k)" + using `2 < n` by (intro setsum_mono2) (auto intro!: mult_nonneg_nonneg zero_le_power simp: x_def le_diff_eq) + also have "\ = (x n + 1) ^ n" + by (simp add: binomial_ring) + also have "\ = n" + using `2 < n` by (simp add: x_def) + finally have "real (n - 1) * (real n / 2 * (x n)\<^sup>2) \ real (n - 1) * 1" + by simp + then have "(x n)\<^sup>2 \ 2 / real n" + using `2 < n` unfolding mult_le_cancel_left by (simp add: field_simps) + from real_sqrt_le_mono[OF this] have "x n \ sqrt (2 / real n)" + by simp } + then show "eventually (\n. x n \ sqrt (2 / real n)) sequentially" + by (auto intro!: exI[of _ 3] simp: eventually_sequentially) + show "eventually (\n. sqrt 0 \ x n) sequentially" + by (auto intro!: exI[of _ 1] simp: eventually_sequentially le_diff_eq x_def) + qed + from tendsto_add[OF this tendsto_const[of 1]] show ?thesis + by (simp add: x_def) +qed + +lemma LIMSEQ_root_const: + assumes "0 < c" + shows "(\n. root n c) ----> 1" +proof - + { fix c :: real assume "1 \ c" + def x \ "\n. root n c - 1" + have "x ----> 0" + proof (rule tendsto_sandwich[OF _ _ tendsto_const]) + show "(\n. c / n) ----> 0" + by (intro tendsto_divide_0[OF tendsto_const] filterlim_mono[OF filterlim_real_sequentially]) + (simp_all add: at_infinity_eq_at_top_bot) + { fix n :: nat assume "1 < n" + have "1 + x n * n = 1 + of_nat (n choose 1) * x n^1" + using `1 < n` unfolding gbinomial_def binomial_gbinomial by (simp add: real_eq_of_nat[symmetric]) + also have "\ \ (\k\{0, 1}. of_nat (n choose k) * x n^k)" + by (simp add: x_def) + also have "\ \ (\k=0..n. of_nat (n choose k) * x n^k)" + using `1 < n` `1 \ c` by (intro setsum_mono2) (auto intro!: mult_nonneg_nonneg zero_le_power simp: x_def le_diff_eq) + also have "\ = (x n + 1) ^ n" + by (simp add: binomial_ring) + also have "\ = c" + using `1 < n` `1 \ c` by (simp add: x_def) + finally have "x n \ c / n" + using `1 \ c` `1 < n` by (simp add: field_simps) } + then show "eventually (\n. x n \ c / n) sequentially" + by (auto intro!: exI[of _ 3] simp: eventually_sequentially) + show "eventually (\n. 0 \ x n) sequentially" + using `1 \ c` by (auto intro!: exI[of _ 1] simp: eventually_sequentially le_diff_eq x_def) + qed + from tendsto_add[OF this tendsto_const[of 1]] have "(\n. root n c) ----> 1" + by (simp add: x_def) } + note ge_1 = this + + show ?thesis + proof cases + assume "1 \ c" with ge_1 show ?thesis by blast + next + assume "\ 1 \ c" + with `0 < c` have "1 \ 1 / c" + by simp + then have "(\n. 1 / root n (1 / c)) ----> 1 / 1" + by (intro tendsto_divide tendsto_const ge_1 `1 \ 1 / c` one_neq_zero) + then show ?thesis + by (rule filterlim_cong[THEN iffD1, rotated 3]) + (auto intro!: exI[of _ 1] simp: eventually_sequentially real_root_divide) + qed +qed + +end diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy --- a/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy Tue May 20 19:24:39 2014 +0200 @@ -1220,6 +1220,39 @@ by (metis INF_absorb centre_in_ball) +lemma suminf_ereal_offset_le: + fixes f :: "nat \ ereal" + assumes f: "\i. 0 \ f i" + shows "(\i. f (i + k)) \ suminf f" +proof - + have "(\n. \i (\i. f (i + k))" + using summable_sums[OF summable_ereal_pos] by (simp add: sums_def atLeast0LessThan f) + moreover have "(\n. \i (\i. f i)" + using summable_sums[OF summable_ereal_pos] by (simp add: sums_def atLeast0LessThan f) + then have "(\n. \i (\i. f i)" + by (rule LIMSEQ_ignore_initial_segment) + ultimately show ?thesis + proof (rule LIMSEQ_le, safe intro!: exI[of _ k]) + fix n assume "k \ n" + have "(\ii (\i. i + k)) i)" + by simp + also have "\ = (\i\(\i. i + k) ` {.. \ setsum f {..i setsum f {.. (\i. ereal (f i)) = ereal x" + by (metis sums_ereal sums_unique) + +lemma suminf_ereal': "summable f \ (\i. ereal (f i)) = ereal (\i. f i)" + by (metis sums_ereal sums_unique summable_def) + +lemma suminf_ereal_finite: "summable f \ (\i. ereal (f i)) \ \" + by (auto simp: sums_ereal[symmetric] summable_def sums_unique[symmetric]) + subsection {* monoset *} definition (in order) mono_set: diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Binary_Product_Measure.thy --- a/src/HOL/Probability/Binary_Product_Measure.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Binary_Product_Measure.thy Tue May 20 19:24:39 2014 +0200 @@ -700,5 +700,41 @@ by simp qed qed + +lemma sets_pair_countable: + assumes "countable S1" "countable S2" + assumes M: "sets M = Pow S1" and N: "sets N = Pow S2" + shows "sets (M \\<^sub>M N) = Pow (S1 \ S2)" +proof auto + fix x a b assume x: "x \ sets (M \\<^sub>M N)" "(a, b) \ x" + from sets.sets_into_space[OF x(1)] x(2) + sets_eq_imp_space_eq[of N "count_space S2"] sets_eq_imp_space_eq[of M "count_space S1"] M N + show "a \ S1" "b \ S2" + by (auto simp: space_pair_measure) +next + fix X assume X: "X \ S1 \ S2" + then have "countable X" + by (metis countable_subset `countable S1` `countable S2` countable_SIGMA) + have "X = (\(a, b)\X. {a} \ {b})" by auto + also have "\ \ sets (M \\<^sub>M N)" + using X + by (safe intro!: sets.countable_UN' `countable X` subsetI pair_measureI) (auto simp: M N) + finally show "X \ sets (M \\<^sub>M N)" . +qed + +lemma pair_measure_countable: + assumes "countable S1" "countable S2" + shows "count_space S1 \\<^sub>M count_space S2 = count_space (S1 \ S2)" +proof (rule pair_measure_eqI) + show "sigma_finite_measure (count_space S1)" "sigma_finite_measure (count_space S2)" + using assms by (auto intro!: sigma_finite_measure_count_space_countable) + show "sets (count_space S1 \\<^sub>M count_space S2) = sets (count_space (S1 \ S2))" + by (subst sets_pair_countable[OF assms]) auto +next + fix A B assume "A \ sets (count_space S1)" "B \ sets (count_space S2)" + then show "emeasure (count_space S1) A * emeasure (count_space S2) B = + emeasure (count_space (S1 \ S2)) (A \ B)" + by (subst (1 2 3) emeasure_count_space) (auto simp: finite_cartesian_product_iff) +qed end \ No newline at end of file diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Bochner_Integration.thy --- a/src/HOL/Probability/Bochner_Integration.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Bochner_Integration.thy Tue May 20 19:24:39 2014 +0200 @@ -1519,6 +1519,39 @@ integral\<^sup>L M f \ integral\<^sup>L M g" by (intro integral_mono_AE) auto +lemma (in finite_measure) integrable_measure: + assumes I: "disjoint_family_on X I" "countable I" + shows "integrable (count_space I) (\i. measure M (X i))" +proof - + have "(\\<^sup>+i. measure M (X i) \count_space I) = (\\<^sup>+i. measure M (if X i \ sets M then X i else {}) \count_space I)" + by (auto intro!: nn_integral_cong measure_notin_sets) + also have "\ = measure M (\i\I. if X i \ sets M then X i else {})" + using I unfolding emeasure_eq_measure[symmetric] + by (subst emeasure_UN_countable) (auto simp: disjoint_family_on_def) + finally show ?thesis + by (auto intro!: integrableI_bounded simp: measure_nonneg) +qed + +lemma integrableI_real_bounded: + assumes f: "f \ borel_measurable M" and ae: "AE x in M. 0 \ f x" and fin: "integral\<^sup>N M f < \" + shows "integrable M f" +proof (rule integrableI_bounded) + have "(\\<^sup>+ x. ereal (norm (f x)) \M) = \\<^sup>+ x. ereal (f x) \M" + using ae by (auto intro: nn_integral_cong_AE) + also note fin + finally show "(\\<^sup>+ x. ereal (norm (f x)) \M) < \" . +qed fact + +lemma integral_real_bounded: + assumes "f \ borel_measurable M" "AE x in M. 0 \ f x" "integral\<^sup>N M f \ ereal r" + shows "integral\<^sup>L M f \ r" +proof - + have "integrable M f" + using assms by (intro integrableI_real_bounded) auto + from nn_integral_eq_integral[OF this] assms show ?thesis + by simp +qed + subsection {* Measure spaces with an associated density *} lemma integrable_density: diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Finite_Product_Measure.thy --- a/src/HOL/Probability/Finite_Product_Measure.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Finite_Product_Measure.thy Tue May 20 19:24:39 2014 +0200 @@ -497,6 +497,10 @@ using A X by (auto intro!: measurable_sets) qed (insert X, auto simp add: PiE_def dest: measurable_space) +lemma measurable_abs_UNIV: + "(\n. (\\. f n \) \ measurable M (N n)) \ (\\ n. f n \) \ measurable M (PiM UNIV N)" + by (intro measurable_PiM_single) (auto dest: measurable_space) + lemma measurable_restrict_subset: "J \ L \ (\f. restrict f J) \ measurable (Pi\<^sub>M L M) (Pi\<^sub>M J M)" by (intro measurable_restrict measurable_component_singleton) auto diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Measurable.thy --- a/src/HOL/Probability/Measurable.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Measurable.thy Tue May 20 19:24:39 2014 +0200 @@ -330,6 +330,31 @@ "s \ S \ A \ sets (count_space S) \ insert s A \ sets (count_space S)" by simp +lemma measurable_card[measurable]: + fixes S :: "'a \ nat set" + assumes [measurable]: "\i. {x\space M. i \ S x} \ sets M" + shows "(\x. card (S x)) \ measurable M (count_space UNIV)" + unfolding measurable_count_space_eq2_countable +proof safe + fix n show "(\x. card (S x)) -` {n} \ space M \ sets M" + proof (cases n) + case 0 + then have "(\x. card (S x)) -` {n} \ space M = {x\space M. infinite (S x) \ (\i. i \ S x)}" + by auto + also have "\ \ sets M" + by measurable + finally show ?thesis . + next + case (Suc i) + then have "(\x. card (S x)) -` {n} \ space M = + (\F\{A\{A. finite A}. card A = n}. {x\space M. (\i. i \ S x \ i \ F)})" + unfolding set_eq_iff[symmetric] Collect_bex_eq[symmetric] by (auto intro: card_ge_0_finite) + also have "\ \ sets M" + by (intro sets.countable_UN' countable_Collect countable_Collect_finite) auto + finally show ?thesis . + qed +qed rule + subsection {* Measurability for (co)inductive predicates *} lemma measurable_lfp: diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Measure_Space.thy --- a/src/HOL/Probability/Measure_Space.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Measure_Space.thy Tue May 20 19:24:39 2014 +0200 @@ -1632,15 +1632,24 @@ lemma AE_count_space: "(AE x in count_space A. P x) \ (\x\A. P x)" unfolding eventually_ae_filter by (auto simp add: null_sets_count_space) -lemma sigma_finite_measure_count_space: - fixes A :: "'a::countable set" +lemma sigma_finite_measure_count_space_countable: + assumes A: "countable A" shows "sigma_finite_measure (count_space A)" proof show "\F::nat \ 'a set. range F \ sets (count_space A) \ (\i. F i) = space (count_space A) \ (\i. emeasure (count_space A) (F i) \ \)" - using surj_from_nat by (intro exI[of _ "\i. {from_nat i} \ A"]) (auto simp del: surj_from_nat) + using A + apply (intro exI[of _ "\i. {from_nat_into A i} \ A"]) + apply auto + apply (rule_tac x="to_nat_on A x" in exI) + apply simp + done qed +lemma sigma_finite_measure_count_space: + fixes A :: "'a::countable set" shows "sigma_finite_measure (count_space A)" + by (rule sigma_finite_measure_count_space_countable) auto + lemma finite_measure_count_space: assumes [simp]: "finite A" shows "finite_measure (count_space A)" @@ -1656,28 +1665,26 @@ subsection {* Measure restricted to space *} lemma emeasure_restrict_space: - assumes "\ \ sets M" "A \ \" + assumes "\ \ space M \ sets M" "A \ \" shows "emeasure (restrict_space M \) A = emeasure M A" proof cases assume "A \ sets M" - - have "emeasure (restrict_space M \) A = emeasure M (A \ \)" + show ?thesis proof (rule emeasure_measure_of[OF restrict_space_def]) - show "op \ \ ` sets M \ Pow \" "A \ sets (restrict_space M \)" - using assms `A \ sets M` by (auto simp: sets_restrict_space sets.sets_into_space) - show "positive (sets (restrict_space M \)) (\A. emeasure M (A \ \))" + show "op \ \ ` sets M \ Pow (\ \ space M)" "A \ sets (restrict_space M \)" + using `A \ \` `A \ sets M` sets.space_closed by (auto simp: sets_restrict_space) + show "positive (sets (restrict_space M \)) (emeasure M)" by (auto simp: positive_def emeasure_nonneg) - show "countably_additive (sets (restrict_space M \)) (\A. emeasure M (A \ \))" + show "countably_additive (sets (restrict_space M \)) (emeasure M)" proof (rule countably_additiveI) fix A :: "nat \ _" assume "range A \ sets (restrict_space M \)" "disjoint_family A" with assms have "\i. A i \ sets M" "\i. A i \ space M" "disjoint_family A" - by (auto simp: sets_restrict_space_iff subset_eq dest: sets.sets_into_space) - with `\ \ sets M` show "(\i. emeasure M (A i \ \)) = emeasure M ((\i. A i) \ \)" + by (fastforce simp: sets_restrict_space_iff[OF assms(1)] image_subset_iff + dest: sets.sets_into_space)+ + then show "(\i. emeasure M (A i)) = emeasure M (\i. A i)" by (subst suminf_emeasure) (auto simp: disjoint_family_subset) qed qed - with `A \ \` show ?thesis - by (simp add: Int_absorb2) next assume "A \ sets M" moreover with assms have "A \ sets (restrict_space M \)" @@ -1686,15 +1693,28 @@ by (simp add: emeasure_notin_sets) qed -lemma restrict_count_space: - assumes "A \ B" shows "restrict_space (count_space B) A = count_space A" +lemma restrict_restrict_space: + assumes "A \ space M \ sets M" "B \ space M \ sets M" + shows "restrict_space (restrict_space M A) B = restrict_space M (A \ B)" (is "?l = ?r") +proof (rule measure_eqI[symmetric]) + show "sets ?r = sets ?l" + unfolding sets_restrict_space image_comp by (intro image_cong) auto +next + fix X assume "X \ sets (restrict_space M (A \ B))" + then obtain Y where "Y \ sets M" "X = Y \ A \ B" + by (auto simp: sets_restrict_space) + with assms sets.Int[OF assms] show "emeasure ?r X = emeasure ?l X" + by (subst (1 2) emeasure_restrict_space) + (auto simp: space_restrict_space sets_restrict_space_iff emeasure_restrict_space ac_simps) +qed + +lemma restrict_count_space: "restrict_space (count_space B) A = count_space (A \ B)" proof (rule measure_eqI) - show "sets (restrict_space (count_space B) A) = sets (count_space A)" - using `A \ B` by (subst sets_restrict_space) auto + show "sets (restrict_space (count_space B) A) = sets (count_space (A \ B))" + by (subst sets_restrict_space) auto moreover fix X assume "X \ sets (restrict_space (count_space B) A)" - moreover note `A \ B` - ultimately have "X \ A" by auto - with `A \ B` show "emeasure (restrict_space (count_space B) A) X = emeasure (count_space A) X" + ultimately have "X \ A \ B" by auto + then show "emeasure (restrict_space (count_space B) A) X = emeasure (count_space (A \ B)) X" by (cases "finite X") (auto simp add: emeasure_restrict_space) qed diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy --- a/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy Tue May 20 19:24:39 2014 +0200 @@ -745,8 +745,7 @@ translations "\\<^sup>+x. f \M" == "CONST nn_integral M (\x. f)" -lemma nn_integral_nonneg: - "0 \ integral\<^sup>N M f" +lemma nn_integral_nonneg: "0 \ integral\<^sup>N M f" by (auto intro!: SUP_upper2[of "\x. 0"] simp: nn_integral_def le_fun_def) lemma nn_integral_not_MInfty[simp]: "integral\<^sup>N M f \ -\" @@ -1389,6 +1388,20 @@ by (rule ereal_mono_minus_cancel) (intro w nn_integral_nonneg)+ qed +lemma nn_integral_LIMSEQ: + assumes f: "incseq f" "\i. f i \ borel_measurable M" "\n x. 0 \ f n x" + and u: "\x. (\i. f i x) ----> u x" + shows "(\n. integral\<^sup>N M (f n)) ----> integral\<^sup>N M u" +proof - + have "(\n. integral\<^sup>N M (f n)) ----> (SUP n. integral\<^sup>N M (f n))" + using f by (intro LIMSEQ_SUP[of "\n. integral\<^sup>N M (f n)"] incseq_nn_integral) + also have "(SUP n. integral\<^sup>N M (f n)) = integral\<^sup>N M (\x. SUP n. f n x)" + using f by (intro nn_integral_monotone_convergence_SUP[symmetric]) + also have "integral\<^sup>N M (\x. SUP n. f n x) = integral\<^sup>N M (\x. u x)" + using f by (subst SUP_Lim_ereal[OF _ u]) (auto simp: incseq_def le_fun_def) + finally show ?thesis . +qed + lemma nn_integral_dominated_convergence: assumes [measurable]: "\i. u i \ borel_measurable M" "u' \ borel_measurable M" "w \ borel_measurable M" @@ -1668,6 +1681,56 @@ finally show ?thesis . qed +lemma nn_integral_count_space_nat: + fixes f :: "nat \ ereal" + assumes nonneg: "\i. 0 \ f i" + shows "(\\<^sup>+i. f i \count_space UNIV) = (\i. f i)" +proof - + have "(\\<^sup>+i. f i \count_space UNIV) = + (\\<^sup>+i. (\j. f j * indicator {j} i) \count_space UNIV)" + proof (intro nn_integral_cong) + fix i + have "f i = (\j\{i}. f j * indicator {j} i)" + by simp + also have "\ = (\j. f j * indicator {j} i)" + by (rule suminf_finite[symmetric]) auto + finally show "f i = (\j. f j * indicator {j} i)" . + qed + also have "\ = (\j. (\\<^sup>+i. f j * indicator {j} i \count_space UNIV))" + by (rule nn_integral_suminf) (auto simp: nonneg) + also have "\ = (\j. f j)" + by (simp add: nonneg nn_integral_cmult_indicator one_ereal_def[symmetric]) + finally show ?thesis . +qed + +lemma emeasure_countable_singleton: + assumes sets: "\x. x \ X \ {x} \ sets M" and X: "countable X" + shows "emeasure M X = (\\<^sup>+x. emeasure M {x} \count_space X)" +proof - + have "emeasure M (\i\X. {i}) = (\\<^sup>+x. emeasure M {x} \count_space X)" + using assms by (intro emeasure_UN_countable) (auto simp: disjoint_family_on_def) + also have "(\i\X. {i}) = X" by auto + finally show ?thesis . +qed + +lemma measure_eqI_countable: + assumes [simp]: "sets M = Pow A" "sets N = Pow A" and A: "countable A" + assumes eq: "\a. a \ A \ emeasure M {a} = emeasure N {a}" + shows "M = N" +proof (rule measure_eqI) + fix X assume "X \ sets M" + then have X: "X \ A" by auto + moreover with A have "countable X" by (auto dest: countable_subset) + ultimately have + "emeasure M X = (\\<^sup>+a. emeasure M {a} \count_space X)" + "emeasure N X = (\\<^sup>+a. emeasure N {a} \count_space X)" + by (auto intro!: emeasure_countable_singleton) + moreover have "(\\<^sup>+a. emeasure M {a} \count_space X) = (\\<^sup>+a. emeasure N {a} \count_space X)" + using X by (intro nn_integral_cong eq) auto + ultimately show "emeasure M X = emeasure N X" + by simp +qed simp + subsubsection {* Measures with Restricted Space *} lemma nn_integral_restrict_space: diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Probability_Measure.thy Tue May 20 19:24:39 2014 +0200 @@ -111,6 +111,26 @@ then show False by auto qed +lemma (in prob_space) integral_ge_const: + fixes c :: real + shows "integrable M f \ (AE x in M. c \ f x) \ c \ (\x. f x \M)" + using integral_mono_AE[of M "\x. c" f] prob_space by simp + +lemma (in prob_space) integral_le_const: + fixes c :: real + shows "integrable M f \ (AE x in M. f x \ c) \ (\x. f x \M) \ c" + using integral_mono_AE[of M f "\x. c"] prob_space by simp + +lemma (in prob_space) nn_integral_ge_const: + "(AE x in M. c \ f x) \ c \ (\\<^sup>+x. f x \M)" + using nn_integral_mono_AE[of "\x. c" f M] emeasure_space_1 + by (simp add: nn_integral_const_If split: split_if_asm) + +lemma (in prob_space) nn_integral_le_const: + "0 \ c \ (AE x in M. f x \ c) \ (\\<^sup>+x. f x \M) \ c" + using nn_integral_mono_AE[of f "\x. c" M] emeasure_space_1 + by (simp add: nn_integral_const_If split: split_if_asm) + lemma (in prob_space) expectation_less: fixes X :: "_ \ real" assumes [simp]: "integrable M X" diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Probability/Sigma_Algebra.thy Tue May 20 19:24:39 2014 +0200 @@ -2299,29 +2299,50 @@ subsubsection {* Restricted Space Sigma Algebra *} -definition "restrict_space M \ = measure_of \ ((op \ \) ` sets M) (\A. emeasure M (A \ \))" +definition restrict_space where + "restrict_space M \ = measure_of (\ \ space M) ((op \ \) ` sets M) (emeasure M)" -lemma space_restrict_space: "space (restrict_space M \) = \" - unfolding restrict_space_def by (subst space_measure_of) auto +lemma space_restrict_space: "space (restrict_space M \) = \ \ space M" + using sets.sets_into_space unfolding restrict_space_def by (subst space_measure_of) auto + +lemma space_restrict_space2: "\ \ sets M \ space (restrict_space M \) = \" + by (simp add: space_restrict_space sets.sets_into_space) -lemma sets_restrict_space: "\ \ space M \ sets (restrict_space M \) = (op \ \) ` sets M" - using sigma_sets_vimage[of "\x. x" \ "space M" "sets M"] - unfolding restrict_space_def - by (subst sets_measure_of) (auto simp: sets.sigma_sets_eq Int_commute[of _ \] sets.space_closed) +lemma sets_restrict_space: "sets (restrict_space M \) = (op \ \) ` sets M" +proof - + have "sigma_sets (\ \ space M) ((\X. X \ (\ \ space M)) ` sets M) = + (\X. X \ (\ \ space M)) ` sets M" + using sigma_sets_vimage[of "\x. x" "\ \ space M" "space M" "sets M"] sets.space_closed[of M] + by (simp add: sets.sigma_sets_eq) + moreover have "(\X. X \ (\ \ space M)) ` sets M = (op \ \) ` sets M" + using sets.sets_into_space by (intro image_cong) auto + ultimately show ?thesis + using sets.sets_into_space[of _ M] unfolding restrict_space_def + by (subst sets_measure_of) fastforce+ +qed lemma sets_restrict_space_iff: - "\ \ sets M \ A \ sets (restrict_space M \) \ (A \ \ \ A \ sets M)" - by (subst sets_restrict_space) (auto dest: sets.sets_into_space) + "\ \ space M \ sets M \ A \ sets (restrict_space M \) \ (A \ \ \ A \ sets M)" +proof (subst sets_restrict_space, safe) + fix A assume "\ \ space M \ sets M" and A: "A \ sets M" + then have "(\ \ space M) \ A \ sets M" + by rule + also have "(\ \ space M) \ A = \ \ A" + using sets.sets_into_space[OF A] by auto + finally show "\ \ A \ sets M" + by auto +qed auto lemma measurable_restrict_space1: - assumes \: "\ \ sets M" and f: "f \ measurable M N" shows "f \ measurable (restrict_space M \) N" + assumes \: "\ \ space M \ sets M" and f: "f \ measurable M N" + shows "f \ measurable (restrict_space M \) N" unfolding measurable_def proof (intro CollectI conjI ballI) show sp: "f \ space (restrict_space M \) \ space N" using measurable_space[OF f] sets.sets_into_space[OF \] by (auto simp: space_restrict_space) fix A assume "A \ sets N" - have "f -` A \ space (restrict_space M \) = (f -` A \ space M) \ \" + have "f -` A \ space (restrict_space M \) = (f -` A \ space M) \ (\ \ space M)" using sets.sets_into_space[OF \] by (auto simp: space_restrict_space) also have "\ \ sets (restrict_space M \)" unfolding sets_restrict_space_iff[OF \] @@ -2330,7 +2351,9 @@ qed lemma measurable_restrict_space2: - "\ \ sets N \ f \ space M \ \ \ f \ measurable M N \ f \ measurable M (restrict_space N \)" + "\ \ sets N \ f \ space M \ \ \ f \ measurable M N \ + f \ measurable M (restrict_space N \)" by (simp add: measurable_def space_restrict_space sets_restrict_space_iff) end + diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Series.thy --- a/src/HOL/Series.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Series.thy Tue May 20 19:24:39 2014 +0200 @@ -316,6 +316,21 @@ end +context + fixes f :: "'i \ nat \ 'a::real_normed_vector" and I :: "'i set" +begin + +lemma sums_setsum: "(\i. i \ I \ (f i) sums (x i)) \ (\n. \i\I. f i n) sums (\i\I. x i)" + by (induct I rule: infinite_finite_induct) (auto intro!: sums_add) + +lemma suminf_setsum: "(\i. i \ I \ summable (f i)) \ (\n. \i\I. f i n) = (\i\I. \n. f i n)" + using sums_unique[OF sums_setsum, OF summable_sums] by simp + +lemma summable_setsum: "(\i. i \ I \ summable (f i)) \ summable (\n. \i\I. f i n)" + using sums_summable[OF sums_setsum[OF summable_sums]] . + +end + lemma (in bounded_linear) sums: "(\n. X n) sums a \ (\n. f (X n)) sums (f a)" unfolding sums_def by (drule tendsto, simp only: setsum) diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Topological_Spaces.thy Tue May 20 19:24:39 2014 +0200 @@ -1230,6 +1230,22 @@ "filterlim f F (at (x::'a::linorder_topology)) \ filterlim f F (at_left x) \ filterlim f F (at_right x)" by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup) +lemma eventually_nhds_top: + fixes P :: "'a :: {order_top, linorder_topology} \ bool" + assumes "(b::'a) < top" + shows "eventually P (nhds top) \ (\bz. b < z \ P z))" + unfolding eventually_nhds +proof safe + fix S :: "'a set" assume "open S" "top \ S" + note open_left[OF this `b < top`] + moreover assume "\s\S. P s" + ultimately show "\bz>b. P z" + by (auto simp: subset_eq Ball_def) +next + fix b assume "b < top" "\z>b. P z" + then show "\S. open S \ top \ S \ (\xa\S. P xa)" + by (intro exI[of _ "{b <..}"]) auto +qed subsection {* Limits on sequences *} @@ -1724,6 +1740,50 @@ (X -- a --> (L::'b::topological_space))" using LIMSEQ_SEQ_conv2 LIMSEQ_SEQ_conv1 .. +lemma sequentially_imp_eventually_at_left: + fixes a :: "'a :: {dense_linorder, linorder_topology, first_countable_topology}" + assumes b[simp]: "b < a" + assumes *: "\f. (\n. b < f n) \ (\n. f n < a) \ incseq f \ f ----> a \ eventually (\n. P (f n)) sequentially" + shows "eventually P (at_left a)" +proof (safe intro!: sequentially_imp_eventually_within) + fix X assume X: "\n. X n \ {.. X n \ a" "X ----> a" + show "eventually (\n. P (X n)) sequentially" + proof (rule ccontr) + assume "\ eventually (\n. P (X n)) sequentially" + from not_eventually_sequentiallyD[OF this] + obtain r where "subseq r" "\n. \ P (X (r n))" + by auto + with X have "(X \ r) ----> a" + by (auto intro: LIMSEQ_subseq_LIMSEQ) + from order_tendstoD(1)[OF this] obtain s' where s': "\b i. b < a \ s' b \ i \ b < X (r i)" + unfolding eventually_sequentially comp_def by metis + def s \ "rec_nat (s' b) (\_ i. max (s' (X (r i))) (Suc i))" + then have [simp]: "s 0 = s' b" "\n. s (Suc n) = max (s' (X (r (s n)))) (Suc (s n))" + by auto + have "eventually (\n. P (((X \ r) \ s) n)) sequentially" + proof (rule *) + from X show inc: "incseq (X \ r \ s)" + unfolding incseq_Suc_iff comp_def by (intro allI s'[THEN less_imp_le]) auto + { fix n show "b < (X \ r \ s) n" + using inc[THEN incseqD, of 0 n] s'[OF b order_refl] by simp } + { fix n show "(X \ r \ s) n < a" + using X by simp } + from `(X \ r) ----> a` show "(X \ r \ s) ----> a" + by (rule LIMSEQ_subseq_LIMSEQ) (auto simp: subseq_Suc_iff) + qed + with `\n. \ P (X (r n))` show False + by auto + qed +qed + +lemma tendsto_at_left_sequentially: + fixes a :: "_ :: {dense_linorder, linorder_topology, first_countable_topology}" + assumes "b < a" + assumes *: "\S. (\n. S n < a) \ (\n. b < S n) \ incseq S \ S ----> a \ (\n. X (S n)) ----> L" + shows "(X ---> L) (at_left a)" + using assms unfolding tendsto_def [where l=L] + by (simp add: sequentially_imp_eventually_at_left) + subsection {* Continuity *} subsubsection {* Continuity on a set *} diff -r c9e98c2498fd -r e7fd64f82876 src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Tue May 20 16:52:59 2014 +0200 +++ b/src/HOL/Transcendental.thy Tue May 20 19:24:39 2014 +0200 @@ -10,6 +10,32 @@ imports Fact Series Deriv NthRoot begin +lemma root_test_convergence: + fixes f :: "nat \ 'a::banach" + assumes f: "(\n. root n (norm (f n))) ----> x" -- "could be weakened to lim sup" + assumes "x < 1" + shows "summable f" +proof - + have "0 \ x" + by (rule LIMSEQ_le[OF tendsto_const f]) (auto intro!: exI[of _ 1]) + from `x < 1` obtain z where z: "x < z" "z < 1" + by (metis dense) + from f `x < z` + have "eventually (\n. root n (norm (f n)) < z) sequentially" + by (rule order_tendstoD) + then have "eventually (\n. norm (f n) \ z^n) sequentially" + using eventually_ge_at_top + proof eventually_elim + fix n assume less: "root n (norm (f n)) < z" and n: "1 \ n" + from power_strict_mono[OF less, of n] n + show "norm (f n) \ z ^ n" + by simp + qed + then show "summable f" + unfolding eventually_sequentially + using z `0 \ x` by (auto intro!: summable_comparison_test[OF _ summable_geometric]) +qed + subsection {* Properties of Power Series *} lemma lemma_realpow_diff: