# HG changeset patch # User paulson # Date 1672352052 0 # Node ID 25c0d4c0e1105cfeb42bc47b7c819ecde5fc4fc3 # Parent 337c2265d8a238325f7691fa5bb0aeffbf5a6957 More tidying diff -r 337c2265d8a2 -r 25c0d4c0e110 src/HOL/Analysis/Measure_Space.thy --- a/src/HOL/Analysis/Measure_Space.thy Thu Dec 29 16:32:56 2022 +0000 +++ b/src/HOL/Analysis/Measure_Space.thy Thu Dec 29 22:14:12 2022 +0000 @@ -26,9 +26,9 @@ proof (rule SUP_eqI) fix y :: ennreal assume "\n. n \ UNIV \ (if i < n then f i else 0) \ y" from this[of "Suc i"] show "f i \ y" by auto - qed (insert assms, simp) + qed (use assms in simp) ultimately show ?thesis using assms - by (subst suminf_eq_SUP) (auto simp: indicator_def) + by (simp add: suminf_eq_SUP) qed lemma suminf_indicator: @@ -71,11 +71,8 @@ by (induct n) (auto simp add: binaryset_def f) qed moreover - have "... \ f A + f B" by (rule tendsto_const) - ultimately - have "(\n. \i< Suc (Suc n). f (binaryset A B i)) \ f A + f B" - by metis - hence "(\n. \i< n+2. f (binaryset A B i)) \ f A + f B" + have "\ \ f A + f B" by (rule tendsto_const) + ultimately have "(\n. \i< n+2. f (binaryset A B i)) \ f A + f B" by simp thus ?thesis by (rule LIMSEQ_offset [where k=2]) qed @@ -83,7 +80,7 @@ lemma binaryset_sums: assumes f: "f {} = 0" shows "(\n. f (binaryset A B n)) sums (f A + f B)" - by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f] atLeast0LessThan) + using LIMSEQ_binaryset f sums_def by blast lemma suminf_binaryset_eq: fixes f :: "'a set \ 'b::{comm_monoid_add, t2_space}" @@ -148,7 +145,7 @@ by (auto simp add: increasing_def) lemma countably_additiveI[case_names countably]: - "(\A. range A \ M \ disjoint_family A \ (\i. A i) \ M \ (\i. f (A i)) = f (\i. A i)) + "(\A. \range A \ M; disjoint_family A; (\i. A i) \ M\ \ (\i. f(A i)) = f(\i. A i)) \ countably_additive M f" by (simp add: countably_additive_def) @@ -198,9 +195,9 @@ assume xy: "x \ M" "y \ M" "x \ y" then have "y - x \ M" by auto then have "f x + 0 \ f x + f (y-x)" by (intro add_left_mono zero_le) - also have "... = f (x \ (y-x))" using addf - by (auto simp add: additive_def) (metis Diff_disjoint Un_Diff_cancel Diff xy(1,2)) - also have "... = f y" + also have "\ = f (x \ (y-x))" + by (metis addf Diff_disjoint \y - x \ M\ additiveD xy(1)) + also have "\ = f y" by (metis Un_Diff_cancel Un_absorb1 xy(3)) finally show "f x \ f y" by simp qed @@ -222,9 +219,12 @@ also have "\ = f (A x) + f ((\i\F. A i) - A x)" using f(2) by (rule additiveD) (insert in_M, auto) also have "\ \ f (A x) + f (\i\F. A i)" - using additive_increasing[OF f] in_M subs by (auto simp: increasing_def intro: add_left_mono) - also have "\ \ f (A x) + (\i\F. f (A i))" using insert by (auto intro: add_left_mono) - finally show "f (\i\(insert x F). A i) \ (\i\(insert x F). f (A i))" using insert by simp + using additive_increasing[OF f] in_M subs + by (simp add: increasingD) + also have "\ \ f (A x) + (\i\F. f (A i))" + using insert by (auto intro: add_left_mono) + finally show "f (\i\(insert x F). A i) \ (\i\(insert x F). f (A i))" + by (simp add: insert) qed lemma (in ring_of_sets) countably_additive_additive: @@ -239,10 +239,8 @@ hence "range (binaryset x y) \ M \ (\i. binaryset x y i) \ M \ f (\i. binaryset x y i) = (\ n. f (binaryset x y n))" - using ca - by (simp add: countably_additive_def) - hence "{x,y,{}} \ M \ x \ y \ M \ - f (x \ y) = (\n. f (binaryset x y n))" + using ca by (simp add: countably_additive_def) + hence "{x,y,{}} \ M \ x \ y \ M \ f (x \ y) = (\n. f (binaryset x y n))" by (simp add: range_binaryset_eq UN_binaryset_eq) thus "f (x \ y) = f x + f y" using posf x y by (auto simp add: Un suminf_binaryset_eq positive_def) @@ -259,8 +257,8 @@ fix N note disj_N = disjoint_family_on_mono[OF _ disj, of "{..ii\{.. f \" using space_closed A + using A by (intro additive_sum [OF f ad]) (auto simp: disj_N) + also have "\ \ f \" using space_closed A by (intro increasingD[OF inc] finite_UN) auto finally show "(\i f \" by simp qed (insert f A, auto simp: positive_def) @@ -272,16 +270,10 @@ proof (rule countably_additiveI) fix F :: "nat \ 'a set" assume F: "range F \ M" "(\i. F i) \ M" and disj: "disjoint_family F" - have "\i\{i. F i \ {}}. \x. x \ F i" by auto - from bchoice[OF this] obtain f where f: "\i. F i \ {} \ f i \ F i" by auto - - have inj_f: "inj_on f {i. F i \ {}}" - proof (rule inj_onI, simp) - fix i j a b assume *: "f i = f j" "F i \ {}" "F j \ {}" - then have "f i \ F i" "f j \ F j" using f by force+ - with disj * show "i = j" by (auto simp: disjoint_family_on_def) - qed - have "finite (\i. F i)" + have "\i. F i \ {} \ (\x. x \ F i)" by auto + then obtain f where f: "\i. F i \ {} \ f i \ F i" by metis + + have finU: "finite (\i. F i)" by (metis F(2) assms(1) infinite_super sets_into_space) have F_subset: "{i. \ (F i) \ 0} \ {i. F i \ {}}" @@ -290,8 +282,11 @@ proof (rule finite_imageD) from f have "f`{i. F i \ {}} \ (\i. F i)" by auto then show "finite (f`{i. F i \ {}})" - by (rule finite_subset) fact - qed fact + by (simp add: finU finite_subset) + show inj_f: "inj_on f {i. F i \ {}}" + using f disj + by (simp add: inj_on_def disjoint_family_on_def disjoint_iff) metis + qed ultimately have fin_not_0: "finite {i. \ (F i) \ 0}" by (rule finite_subset) @@ -323,8 +318,7 @@ have f_UN: "(\i. f (disjointed A i)) = f (\i. A i)" by (auto simp: UN_disjointed_eq disjoint_family_disjointed) moreover have "(\n. (\i (\i. f (disjointed A i))" - using f(1)[unfolded positive_def] dA - by (auto intro!: summable_LIMSEQ) + by (simp add: summable_LIMSEQ) from LIMSEQ_Suc[OF this] have "(\n. (\i\n. f (disjointed A i))) \ (\i. f (disjointed A i))" unfolding lessThan_Suc_atMost . @@ -332,23 +326,21 @@ using disjointed_additive[OF f A(1,2)] . ultimately show "(\i. f (A i)) \ f (\i. A i)" by simp next - assume cont: "\A. range A \ M \ incseq A \ (\i. A i) \ M \ (\i. f (A i)) \ f (\i. A i)" + assume cont[rule_format]: "\A. range A \ M \ incseq A \ (\i. A i) \ M \ (\i. f (A i)) \ f (\i. A i)" fix A :: "nat \ 'a set" assume A: "range A \ M" "disjoint_family A" "(\i. A i) \ M" have *: "(\n. (\ii. A i)" by auto - have "(\n. f (\i f (\i. A i)" - proof (unfold *[symmetric], intro cont[rule_format]) - show "range (\i. \i M" "(\i. \i M" - using A * by auto - qed (force intro!: incseq_SucI) + have "range (\i. \i M" "(\i. \i M" + using A * by auto + then have "(\n. f (\i f (\i. A i)" + unfolding *[symmetric] by (force intro!: cont incseq_SucI)+ moreover have "\n. f (\iii. f (A i)) sums f (\i. A i)" unfolding sums_def by simp - from sums_unique[OF this] - show "(\i. f (A i)) = f (\i. A i)" by simp + then show "(\i. f (A i)) = f (\i. A i)" + by (metis sums_unique) qed lemma (in ring_of_sets) continuous_from_above_iff_empty_continuous: @@ -357,13 +349,15 @@ shows "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i)) \ (\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0)" proof safe - assume cont: "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i))" - fix A :: "nat \ 'a set" assume A: "range A \ M" "decseq A" "(\i. A i) = {}" "\i. f (A i) \ \" - with cont[THEN spec, of A] show "(\i. f (A i)) \ 0" + assume cont[rule_format]: "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i))" + fix A :: "nat \ 'a set" + assume A: "range A \ M" "decseq A" "(\i. A i) = {}" "\i. f (A i) \ \" + with cont[of A] show "(\i. f (A i)) \ 0" using \positive M f\[unfolded positive_def] by auto next - assume cont: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0" - fix A :: "nat \ 'a set" assume A: "range A \ M" "decseq A" "(\i. A i) \ M" "\i. f (A i) \ \" + assume cont[rule_format]: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0" + fix A :: "nat \ 'a set" + assume A: "range A \ M" "decseq A" "(\i. A i) \ M" "\i. f (A i) \ \" have f_mono: "\a b. a \ M \ b \ M \ a \ b \ f a \ f b" using additive_increasing[OF f] unfolding increasing_def by simp @@ -378,23 +372,19 @@ using A by (auto intro!: f_mono) then have f_Int_fin: "f (\x. A x) \ \" using A by (auto simp: top_unique) - { fix i - have "f (A i - (\i. A i)) \ f (A i)" using A by (auto intro!: f_mono) - then have "f (A i - (\i. A i)) \ \" - using A by (auto simp: top_unique) } - note f_fin = this + have f_fin: "f (A i - (\i. A i)) \ \" for i + using A by (metis Diff Diff_subset f_mono infinity_ennreal_def range_subsetD top_unique) have "(\i. f (A i - (\i. A i))) \ 0" - proof (intro cont[rule_format, OF _ decseq _ f_fin]) + proof (intro cont[ OF _ decseq _ f_fin]) show "range (\i. A i - (\i. A i)) \ M" "(\i. A i - (\i. A i)) = {}" using A by auto qed - from INF_Lim[OF decseq_f this] - have "(INF n. f (A n - (\i. A i))) = 0" . + with INF_Lim decseq_f have "(INF n. f (A n - (\i. A i))) = 0" by metis moreover have "(INF n. f (\i. A i)) = f (\i. A i)" by auto ultimately have "(INF n. f (A n - (\i. A i)) + f (\i. A i)) = 0 + f (\i. A i)" using A(4) f_fin f_Int_fin - by (subst INF_ennreal_add_const) (auto simp: decseq_f) + using INF_ennreal_add_const by presburger moreover { fix n have "f (A n - (\i. A i)) + f (\i. A i) = f ((A n - (\i. A i)) \ (\i. A i))" @@ -424,7 +414,8 @@ also have "((\i. A i) - A i) \ A i = (\i. A i)" by auto finally have "f ((\i. A i) - A i) = f (\i. A i) - f (A i)" - using f(3)[rule_format, of "A i"] A by (auto simp: ennreal_add_diff_cancel subset_eq) } + using assms f by fastforce + } moreover have "\\<^sub>F i in sequentially. f (A i) \ f (\i. A i)" using increasingD[OF additive_increasing[OF f(1, 2)], of "A _" "\i. A i"] A by (auto intro!: always_eventually simp: subset_eq) @@ -502,17 +493,11 @@ by (metis emeasure_mono emeasure_notin_sets sets.sets_into_space sets.top zero_le) lemma emeasure_Diff: - assumes finite: "emeasure M B \ \" - and [measurable]: "A \ sets M" "B \ sets M" and "B \ A" + assumes "emeasure M B \ \" + and "A \ sets M" "B \ sets M" and "B \ A" shows "emeasure M (A - B) = emeasure M A - emeasure M B" -proof - - have "(A - B) \ B = A" using \B \ A\ by auto - then have "emeasure M A = emeasure M ((A - B) \ B)" by simp - also have "\ = emeasure M (A - B) + emeasure M B" - by (subst plus_emeasure[symmetric]) auto - finally show "emeasure M (A - B) = emeasure M A - emeasure M B" - using finite by simp -qed + by (smt (verit, best) add_diff_self_ennreal assms emeasure_Un emeasure_mono + ennreal_add_left_cancel le_iff_sup) lemma emeasure_compl: "s \ sets M \ emeasure M s \ \ \ emeasure M (space M - s) = emeasure M (space M) - emeasure M s" @@ -563,8 +548,7 @@ also have "\ = emeasure M (A 0) - emeasure M (\i. A i)" using A finite * by (simp, subst emeasure_Diff) auto finally show ?thesis - by (rule ennreal_minus_cancel[rotated 3]) - (insert finite A, auto intro: INF_lower emeasure_mono) + by (smt (verit, best) Inf_lower diff_diff_ennreal le_MI finite range_eqI) qed lemma INF_emeasure_decseq': @@ -580,7 +564,7 @@ have "(INF n. emeasure M (A n)) = (INF n. emeasure M (A (n + i)))" proof (rule INF_eq) show "\j\UNIV. emeasure M (A (j + i)) \ emeasure M (A i')" for i' - by (intro bexI[of _ i'] emeasure_mono decseqD[OF \decseq A\] A) auto + by (meson A \decseq A\ decseq_def emeasure_mono iso_tuple_UNIV_I nat_le_iff_add) qed auto also have "\ = emeasure M (INF n. (A (n + i)))" using A \decseq A\ fin by (intro INF_emeasure_decseq) (auto simp: decseq_def less_top) @@ -1118,7 +1102,7 @@ text \The next lemma is convenient to combine with a lemma whose conclusion is of the form \AE x in M. P x = Q x\: for such a lemma, there is no \[symmetric]\ variant, -but using \AE_symmetric[OF...]\ will replace it.\ +but using \AE_symmetric[OF\]\ will replace it.\ (* depricated replace by laws about eventually *) lemma @@ -1645,11 +1629,9 @@ have "emeasure M (A \ B) \ \" using emeasure_subadditive[OF measurable] fin by (auto simp: top_unique) then show "(measure M (A \ B)) \ (measure M A) + (measure M B)" - using emeasure_subadditive[OF measurable] fin - apply simp - apply (subst (asm) (2 3 4) emeasure_eq_ennreal_measure) - apply (auto simp flip: ennreal_plus) - done + unfolding measure_def + by (metis emeasure_subadditive[OF measurable] fin enn2real_mono enn2real_plus + ennreal_add_less_top infinity_ennreal_def less_top) qed lemma measure_subadditive_finite: @@ -1672,13 +1654,13 @@ assumes A: "range A \ sets M" and fin: "(\i. emeasure M (A i)) \ \" shows "measure M (\i. A i) \ (\i. measure M (A i))" proof - - from fin have **: "\i. emeasure M (A i) \ top" - using ennreal_suminf_lessD[of "\i. emeasure M (A i)"] by (simp add: less_top) - { have "emeasure M (\i. A i) \ (\i. emeasure M (A i))" - using emeasure_subadditive_countably[OF A] . - also have "\ < \" - using fin by (simp add: less_top) - finally have "emeasure M (\i. A i) \ top" by simp } + have **: "\i. emeasure M (A i) \ top" + using fin ennreal_suminf_lessD[of "\i. emeasure M (A i)"] by (simp add: less_top) + have ge0: "(\i. Sigma_Algebra.measure M (A i)) \ 0" + using fin emeasure_eq_ennreal_measure[OF **] + by (metis infinity_ennreal_def measure_nonneg suminf_cong suminf_nonneg summable_suminf_not_top) + have "emeasure M (\i. A i) \ top" + by (metis A emeasure_subadditive_countably fin infinity_ennreal_def neq_top_trans) then have "ennreal (measure M (\i. A i)) = emeasure M (\i. A i)" by (rule emeasure_eq_ennreal_measure[symmetric]) also have "\ \ (\i. emeasure M (A i))" @@ -1687,11 +1669,7 @@ using fin unfolding emeasure_eq_ennreal_measure[OF **] by (subst suminf_ennreal) (auto simp: **) finally show ?thesis - apply (rule ennreal_le_iff[THEN iffD1, rotated]) - apply (intro suminf_nonneg allI measure_nonneg summable_suminf_not_top) - using fin - apply (simp add: emeasure_eq_ennreal_measure[OF **]) - done + using ge0 ennreal_le_iff by blast qed lemma measure_Un_null_set: "A \ sets M \ B \ null_sets M \ measure M (A \ B) = measure M A" @@ -2038,11 +2016,11 @@ have "emeasure M (B N) \ (\n\{..n\{.. = (\n\{..n\{.. = ennreal (\n\{.. ennreal (\n. measure M (A n))" + also have "\ \ ennreal (\n. measure M (A n))" using * by (auto simp: ennreal_leI) finally show ?thesis by simp qed @@ -2069,9 +2047,9 @@ have I: "(\k\{n..}. A k) = (\k. A (k+n))" by (auto, metis le_add_diff_inverse2, fastforce) have "emeasure M (limsup A) \ emeasure M (\k\{n..}. A k)" by (rule emeasure_mono, auto simp add: limsup_INF_SUP) - also have "... = emeasure M (\k. A (k+n))" + also have "\ = emeasure M (\k. A (k+n))" using I by auto - also have "... \ (\k. measure M (A (k+n)))" + also have "\ \ (\k. measure M (A (k+n)))" apply (rule emeasure_union_summable) using assms summable_ignore_initial_segment[OF assms(3), of n] by auto finally show ?thesis by simp