# HG changeset patch # User haftmann # Date 1617798499 0 # Node ID 5131c388a9b07c8a6e5249d65398b598074cf059 # Parent 0f33c7031ec94db434f6e6d96b4fc7d1f59b376d simplified definition diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Bochner_Integration.thy --- a/src/HOL/Analysis/Bochner_Integration.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Bochner_Integration.thy Wed Apr 07 12:28:19 2021 +0000 @@ -227,7 +227,7 @@ (\y\F. y * indicat_real {x \ space M. U' i x = y} z))" using insert(1-3) by (intro add * sum_nonneg mult_nonneg_nonneg) - (auto simp: nonneg indicator_def sum_nonneg_eq_0_iff) + (auto simp: nonneg indicator_def of_bool_def sum_nonneg_eq_0_iff) thus ?case using insert.hyps by (subst sum.insert) auto qed diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Borel_Space.thy --- a/src/HOL/Analysis/Borel_Space.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Borel_Space.thy Wed Apr 07 12:28:19 2021 +0000 @@ -313,7 +313,7 @@ shows "f \ borel_measurable (restrict_space M \) \ (\x. f x * indicator \ x) \ borel_measurable M" by (subst measurable_restrict_space_iff) - (auto simp: indicator_def if_distrib[where f="\x. a * x" for a] cong del: if_weak_cong) + (auto simp: indicator_def of_bool_def if_distrib[where f="\x. a * x" for a] cong del: if_weak_cong) lemma borel_measurable_restrict_space_iff_ennreal: fixes f :: "'a \ ennreal" @@ -321,7 +321,7 @@ shows "f \ borel_measurable (restrict_space M \) \ (\x. f x * indicator \ x) \ borel_measurable M" by (subst measurable_restrict_space_iff) - (auto simp: indicator_def if_distrib[where f="\x. a * x" for a] cong del: if_weak_cong) + (auto simp: indicator_def of_bool_def if_distrib[where f="\x. a * x" for a] cong del: if_weak_cong) lemma borel_measurable_restrict_space_iff: fixes f :: "'a \ 'b::real_normed_vector" @@ -329,7 +329,7 @@ shows "f \ borel_measurable (restrict_space M \) \ (\x. indicator \ x *\<^sub>R f x) \ borel_measurable M" by (subst measurable_restrict_space_iff) - (auto simp: indicator_def if_distrib[where f="\x. x *\<^sub>R a" for a] ac_simps + (auto simp: indicator_def of_bool_def if_distrib[where f="\x. x *\<^sub>R a" for a] ac_simps cong del: if_weak_cong) lemma cbox_borel[measurable]: "cbox a b \ sets borel" diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Change_Of_Vars.thy --- a/src/HOL/Analysis/Change_Of_Vars.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Change_Of_Vars.thy Wed Apr 07 12:28:19 2021 +0000 @@ -2385,7 +2385,7 @@ ultimately show ?thesis using \y > 0\ integral_restrict_Int [of S "{t. h n (g t) = y}" "\t. \det (matrix (g' t))\ * y"] apply (simp add: integrable_on_indicator integral_indicator) - apply (simp add: indicator_def if_distrib cong: if_cong) + apply (simp add: indicator_def of_bool_def if_distrib cong: if_cong) done qed have hn_int: "h n integrable_on g ` S" @@ -2415,7 +2415,7 @@ fix x assume "x \ S" have "y * indicat_real {x. h n x = y} (g x) \ f (g x)" - by (metis (full_types) \x \ S\ h_le_f indicator_def mem_Collect_eq mult.right_neutral mult_zero_right nonneg_fg) + by (metis \x \ S\ h_le_f indicator_simps(1) indicator_simps(2) mem_Collect_eq mult.commute mult.left_neutral mult_zero_left nonneg_fg) with \y \ 0\ show "norm (?D x * y * indicat_real {x. h n x = y} (g x)) \ ?D x * f(g x)" by (simp add: abs_mult mult.assoc mult_left_mono) qed (use S det_int_fg in auto) @@ -2867,7 +2867,7 @@ = (if x \ T then 1 else 0) * f x" for x by auto show "f absolutely_integrable_on T" - using fa by (simp add: indicator_def set_integrable_def eq) + using fa by (simp add: indicator_def of_bool_def set_integrable_def eq) have [simp]: "{y \ T. f y < 0} \ {y \ T. 0 < f y} = {}" for T and f :: "(real^'n::_) \ real" by auto have "integral T f = integral ({y \ T. f y < 0} \ {y \ T. f y > 0}) f" @@ -2929,7 +2929,7 @@ have "?DP absolutely_integrable_on ({x \ S. f (g x) < 0} \ {x \ S. f (g x) > 0})" by (rule absolutely_integrable_Un [OF aDN aDP]) then show I: "?DP absolutely_integrable_on S" - by (simp add: indicator_def eq set_integrable_def) + by (simp add: indicator_def of_bool_def eq set_integrable_def) have [simp]: "{y \ S. f y < 0} \ {y \ S. 0 < f y} = {}" for S and f :: "(real^'n::_) \ real" by auto have "integral S ?DP = integral ({x \ S. f (g x) < 0} \ {x \ S. f (g x) > 0}) ?DP" diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Wed Apr 07 12:28:19 2021 +0000 @@ -433,7 +433,7 @@ moreover have "(\k. indicator (A \ ?B k) x :: real) \ indicator (\k::nat. A \ ?B k) x" by (intro LIMSEQ_indicator_incseq) (auto simp: incseq_def box_def) ultimately show "(\k. if x \ A \ ?B k then 1 else 0::real) \ 1" - by (simp add: indicator_def UN_box_eq_UNIV) } + by (simp add: indicator_def of_bool_def UN_box_eq_UNIV) } have "(\n. emeasure lborel (A \ ?B n)) \ emeasure lborel (\n::nat. A \ ?B n)" by (intro Lim_emeasure_incseq) (auto simp: incseq_def box_def) @@ -459,7 +459,7 @@ then have "((\x. 1) has_integral measure lborel A) A" by (intro has_integral_measure_lborel) (auto simp: ennreal_indicator) with set show ?case - by (simp add: ennreal_indicator measure_def) (simp add: indicator_def) + by (simp add: ennreal_indicator measure_def) (simp add: indicator_def of_bool_def) next case (mult g c) then have "ennreal c * (\\<^sup>+ x. g x \lborel) = ennreal r" @@ -626,7 +626,7 @@ proof assume int: "(\x. 1::real) integrable_on A" then have "(indicator A::'a \ real) integrable_on UNIV" - unfolding indicator_def[abs_def] integrable_restrict_UNIV . + unfolding indicator_def of_bool_def integrable_restrict_UNIV . then obtain r where "((indicator A::'a\real) has_integral r) UNIV" by auto from nn_integral_has_integral_lborel[OF _ _ this] emeasure_A show False @@ -706,7 +706,7 @@ by (auto dest: completion_ex_borel_measurable_real) from I have "((\x. abs (indicator \ x * f x)) has_integral I) UNIV" - using nonneg by (simp add: indicator_def if_distrib[of "\x. x * f y" for y] cong: if_cong) + using nonneg by (simp add: indicator_def of_bool_def if_distrib[of "\x. x * f y" for y] cong: if_cong) also have "((\x. abs (indicator \ x * f x)) has_integral I) UNIV \ ((\x. abs (f' x)) has_integral I) UNIV" using eq by (intro has_integral_AE) auto finally have "integral\<^sup>N lborel (\x. abs (f' x)) = I" @@ -915,7 +915,8 @@ assumes f: "set_integrable lebesgue S f" shows "(f has_integral (LINT x:S|lebesgue. f x)) S" using has_integral_integral_lebesgue f - by (fastforce simp add: set_integrable_def set_lebesgue_integral_def indicator_def if_distrib[of "\x. x *\<^sub>R f _"] cong: if_cong) + by (fastforce simp add: set_integrable_def set_lebesgue_integral_def indicator_def + of_bool_def if_distrib[of "\x. x *\<^sub>R f _"] cong: if_cong) lemma set_lebesgue_integral_eq_integral: fixes f :: "'a::euclidean_space \ 'b::euclidean_space" @@ -1145,7 +1146,7 @@ by (simp add: lmeasurable_iff_has_integral integral_unique) lemma lmeasure_integral: "S \ lmeasurable \ measure lebesgue S = integral S (\x. 1::real)" - by (fastforce simp add: lmeasure_integral_UNIV indicator_def[abs_def] lmeasurable_iff_integrable_on) + by (fastforce simp add: lmeasure_integral_UNIV indicator_def [abs_def] of_bool_def lmeasurable_iff_integrable_on) lemma integrable_on_const: "S \ lmeasurable \ (\x. c) integrable_on S" unfolding lmeasurable_iff_integrable @@ -1156,7 +1157,7 @@ shows "integral T (indicator S) = measure lebesgue (S \ T)" proof - have "integral UNIV (indicator (S \ T)) = integral UNIV (\a. if a \ S \ T then 1::real else 0)" - by (meson indicator_def) + by (simp add: indicator_def [abs_def] of_bool_def) moreover have "(indicator (S \ T) has_integral measure lebesgue (S \ T)) UNIV" using assms by (simp add: lmeasurable_iff_has_integral) ultimately have "integral UNIV (\x. if x \ S \ T then 1 else 0) = measure lebesgue (S \ T)" @@ -1164,7 +1165,7 @@ moreover have "integral T (\a. if a \ S then 1::real else 0) = integral (S \ T \ UNIV) (\a. 1)" by (simp add: Henstock_Kurzweil_Integration.integral_restrict_Int) moreover have "integral T (indicat_real S) = integral T (\a. if a \ S then 1 else 0)" - by (meson indicator_def) + by (simp add: indicator_def [abs_def] of_bool_def) ultimately show ?thesis by (simp add: assms lmeasure_integral) qed @@ -1563,7 +1564,7 @@ and 1: "(indicat_real (\m\k. S m)) integrable_on UNIV" for k by (auto simp: negligible has_integral_iff) have 2: "\k x. indicat_real (\m\k. S m) x \ (indicat_real (\m\Suc k. S m) x)" - by (simp add: indicator_def) + by (auto simp add: indicator_def) have 3: "\x. (\k. indicat_real (\m\k. S m) x) \ (indicat_real (\n. S n) x)" by (force simp: indicator_def eventually_sequentially intro: tendsto_eventually) have 4: "bounded (range (\k. integral UNIV (indicat_real (\m\k. S m))))" @@ -3832,7 +3833,7 @@ (auto simp: has_field_derivative_iff_has_vector_derivative[symmetric] intro: has_field_derivative_subset[OF f(1)] \a \ b\) then have i: "((\x. f x * indicator {a .. b} x) has_integral F b - F a) UNIV" - unfolding indicator_def if_distrib[where f="\x. a * x" for a] + unfolding indicator_def of_bool_def if_distrib[where f="\x. a * x" for a] by (simp cong del: if_weak_cong del: atLeastAtMost_iff) then have nn: "(\\<^sup>+x. f x * indicator {a .. b} x \lborel) = F b - F a" by (rule nn_integral_has_integral_lborel[OF *]) @@ -3862,7 +3863,7 @@ moreover have "(f has_integral integral\<^sup>L lborel ?f) {a..b}" using has_integral_integral_lborel[OF int] - unfolding indicator_def if_distrib[where f="\x. x *\<^sub>R a" for a] + unfolding indicator_def of_bool_def if_distrib[where f="\x. x *\<^sub>R a" for a] by (simp cong del: if_weak_cong del: atLeastAtMost_iff) ultimately show ?eq by (auto dest: has_integral_unique) diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Equivalence_Measurable_On_Borel.thy --- a/src/HOL/Analysis/Equivalence_Measurable_On_Borel.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Equivalence_Measurable_On_Borel.thy Wed Apr 07 12:28:19 2021 +0000 @@ -881,7 +881,7 @@ finally have le: "emeasure lebesgue (-T \ U) < ennreal (1 / 2^n)" by (simp add: eq) have 1: "continuous_on (T \ -U) (indicat_real S)" - unfolding indicator_def + unfolding indicator_def of_bool_def proof (rule continuous_on_cases [OF \closed T\]) show "closed (- U)" using \open U\ by blast @@ -976,7 +976,7 @@ using nn by (auto simp: inj_on_def intro: sum.cong) finally show ?thesis - by (subst *) (simp add: enn2real_sum indicator_def if_distrib cong: if_cong) + by (subst *) (simp add: enn2real_sum indicator_def of_bool_def if_distrib cong: if_cong) qed lemma\<^marker>\tag important\ simple_function_induct_real diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Wed Apr 07 12:28:19 2021 +0000 @@ -2336,7 +2336,7 @@ and "(indicat_real T has_integral 0) (cbox a b)" for a b proof (subst has_integral_spike_eq[OF T]) show "indicat_real S x = indicat_real (S \ T) x" if "x \ cbox a b - T" for x - by (metis Diff_iff Un_iff indicator_def that) + using that by (simp add: indicator_def) show "(indicat_real S has_integral 0) (cbox a b)" by (simp add: S0) qed diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Measure_Space.thy --- a/src/HOL/Analysis/Measure_Space.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Measure_Space.thy Wed Apr 07 12:28:19 2021 +0000 @@ -49,9 +49,8 @@ have "P \ {i. x \ A i} = {j}" using d \x \ A j\ \j \ P\ unfolding disjoint_family_on_def by auto - thus ?thesis - unfolding indicator_def - by (simp add: if_distrib sum.If_cases[OF \finite P\]) + with \finite P\ show ?thesis + by (simp add: indicator_def) qed text \ diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy --- a/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy Wed Apr 07 12:28:19 2021 +0000 @@ -1809,7 +1809,7 @@ have *: "(\\<^sup>+x. max 0 (f x) \count_space A) = (\\<^sup>+ x. (\a|a\A \ 0 < f a. f a * indicator {a} x) \count_space A)" by (auto intro!: nn_integral_cong - simp add: indicator_def if_distrib sum.If_cases[OF A] max_def le_less) + simp add: indicator_def of_bool_def if_distrib sum.If_cases[OF A] max_def le_less) also have "\ = (\a|a\A \ 0 < f a. \\<^sup>+ x. f a * indicator {a} x \count_space A)" by (subst nn_integral_sum) (simp_all add: AE_count_space less_imp_le) also have "\ = (\a|a\A \ 0 < f a. f a)" @@ -2451,7 +2451,7 @@ have "{a. (a \ X \ a \ A \ 0 < f a) \ a \ X} = {a\X. 0 < f a}" using \X \ A\ by auto with A show ?thesis - by (simp add: emeasure_density nn_integral_count_space point_measure_def indicator_def) + by (simp add: emeasure_density nn_integral_count_space point_measure_def indicator_def of_bool_def) qed lemma emeasure_point_measure_finite: diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Analysis/Set_Integral.thy --- a/src/HOL/Analysis/Set_Integral.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Analysis/Set_Integral.thy Wed Apr 07 12:28:19 2021 +0000 @@ -59,7 +59,7 @@ shows "set_integrable M A f = set_integrable M' A' f'" proof - have "(\x. indicator A x *\<^sub>R f x) = (\x. indicator A' x *\<^sub>R f' x)" - using assms by (auto simp: indicator_def) + using assms by (auto simp: indicator_def of_bool_def) thus ?thesis by (simp add: set_integrable_def assms) qed @@ -652,13 +652,11 @@ assumes "A \ sets M" "B \ sets M" "(A - B) \ (B - A) \ null_sets M" shows "(\\<^sup>+x \ A. f x \M) = (\\<^sup>+x \ B. f x \M)" -proof (rule nn_integral_cong_AE, auto simp add: indicator_def) +proof (rule nn_integral_cong_AE) have *: "AE a in M. a \ (A - B) \ (B - A)" using assms(3) AE_not_in by blast - then show "AE a in M. a \ A \ a \ B \ f a = 0" + then show \AE x in M. f x * indicator A x = f x * indicator B x\ by auto - show "AE x\A in M. x \ B \ f x = 0" - using * by auto qed proposition nn_integral_disjoint_family: diff -r 0f33c7031ec9 -r 5131c388a9b0 src/HOL/Library/Indicator_Function.thy --- a/src/HOL/Library/Indicator_Function.thy Tue Apr 06 18:12:20 2021 +0000 +++ b/src/HOL/Library/Indicator_Function.thy Wed Apr 07 12:28:19 2021 +0000 @@ -8,7 +8,7 @@ imports Complex_Main Disjoint_Sets begin -definition "indicator S x = (if x \ S then 1 else 0)" +definition "indicator S x = of_bool (x \ S)" text\Type constrained version\ abbreviation indicat_real :: "'a set \ 'a \ real" where "indicat_real S \ indicator S" @@ -98,7 +98,7 @@ lemma LIMSEQ_indicator_incseq: assumes "incseq A" - shows "(\i. indicator (A i) x :: 'a::{topological_space,one,zero}) \ indicator (\i. A i) x" + shows "(\i. indicator (A i) x :: 'a::{topological_space,zero_neq_one}) \ indicator (\i. A i) x" proof (cases "\i. x \ A i") case True then obtain i where "x \ A i" @@ -115,7 +115,7 @@ qed lemma LIMSEQ_indicator_UN: - "(\k. indicator (\i indicator (\i. A i) x" + "(\k. indicator (\i indicator (\i. A i) x" proof - have "(\k. indicator (\i indicator (\k. \ii. indicator (A i) x :: 'a::{topological_space,one,zero}) \ indicator (\i. A i) x" + shows "(\i. indicator (A i) x :: 'a::{topological_space,zero_neq_one}) \ indicator (\i. A i) x" proof (cases "\i. x \ A i") case True then obtain i where "x \ A i" @@ -143,7 +143,7 @@ qed lemma LIMSEQ_indicator_INT: - "(\k. indicator (\i indicator (\i. A i) x" + "(\k. indicator (\i indicator (\i. A i) x" proof - have "(\k. indicator (\i indicator (\k. \ix. return_pmf (f x)) = return_pmf (\x. if x \ A then f x else dflt)" - using assms by (intro pmf_eqI) (auto simp: pmf_Pi simp: indicator_def) + using assms by (intro pmf_eqI) (auto simp: pmf_Pi simp: indicator_def split: if_splits) text \ Analogously any componentwise mapping can be pulled outside the product: