# HG changeset patch # User hoelzl # Date 1475150097 -7200 # Node ID 02de4a58e210ec0209b272749de9672dd668d32f # Parent c3da799b1b456d7b07983130082270726143e3e5 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure diff -r c3da799b1b45 -r 02de4a58e210 src/HOL/Analysis/Complete_Measure.thy --- a/src/HOL/Analysis/Complete_Measure.thy Thu Sep 29 13:02:43 2016 +0200 +++ b/src/HOL/Analysis/Complete_Measure.thy Thu Sep 29 13:54:57 2016 +0200 @@ -85,6 +85,9 @@ "A \ sets M \ A \ sets (completion M)" unfolding sets_completion by force +lemma measurable_completion: "f \ M \\<^sub>M N \ f \ completion M \\<^sub>M N" + by (auto simp: measurable_def) + lemma null_sets_completion: assumes "N' \ null_sets M" "N \ N'" shows "N \ sets (completion M)" using assms by (intro sets_completionI[of N "{}" N N']) auto @@ -305,9 +308,6 @@ lemma null_sets_completion_iff: "N \ sets M \ N \ null_sets (completion M) \ N \ null_sets M" by (auto simp: null_sets_def) -lemma AE_completion_iff: "{x\space M. P x} \ sets M \ (AE x in M. P x) \ (AE x in completion M. P x)" - by (simp add: AE_iff_null null_sets_completion_iff) - lemma sets_completion_AE: "(AE x in M. \ P x) \ Measurable.pred (completion M) P" unfolding pred_def sets_completion eventually_ae_filter by auto @@ -339,6 +339,12 @@ "B \ A \ A \ null_sets (completion M) \ B \ null_sets (completion M)" unfolding null_sets_completion_iff2 by auto +interpretation completion: complete_measure "completion M" for M +proof + show "B \ A \ A \ null_sets (completion M) \ B \ sets (completion M)" for B A + using null_sets_completion_subset[of B A M] by (simp add: null_sets_def) +qed + lemma null_sets_restrict_space: "\ \ sets M \ A \ null_sets (restrict_space M \) \ A \ \ \ A \ null_sets M" by (auto simp: null_sets_def emeasure_restrict_space sets_restrict_space) @@ -416,6 +422,16 @@ by (intro bexI[of _ s]) (auto simp: simple_integral_completion simple_function_completion) qed +lemma integrable_completion: + fixes f :: "'a \ 'b::{banach, second_countable_topology}" + shows "f \ M \\<^sub>M borel \ integrable (completion M) f \ integrable M f" + by (rule integrable_subalgebra[symmetric]) auto + +lemma integral_completion: + fixes f :: "'a \ 'b::{banach, second_countable_topology}" + assumes f: "f \ M \\<^sub>M borel" shows "integral\<^sup>L (completion M) f = integral\<^sup>L M f" + by (rule integral_subalgebra[symmetric]) (auto intro: f) + locale semifinite_measure = fixes M :: "'a measure" assumes semifinite: @@ -685,6 +701,260 @@ finally show ?thesis . qed +lemma (in complete_measure) complete_sets_sandwich_fmeasurable: + assumes [measurable]: "A \ fmeasurable M" "C \ fmeasurable M" and subset: "A \ B" "B \ C" + and measure: "measure M A = measure M C" + shows "B \ fmeasurable M" +proof (rule fmeasurableI2) + show "B \ C" "C \ fmeasurable M" by fact+ + show "B \ sets M" + proof (rule complete_sets_sandwich) + show "A \ sets M" "C \ sets M" "A \ B" "B \ C" + using assms by auto + show "emeasure M A < \" + using \A \ fmeasurable M\ by (auto simp: fmeasurable_def) + show "emeasure M A = emeasure M C" + using assms by (simp add: emeasure_eq_measure2) + qed +qed + +lemma AE_completion_iff: "(AE x in completion M. P x) \ (AE x in M. P x)" +proof + assume "AE x in completion M. P x" + then obtain N where "N \ null_sets (completion M)" and P: "{x\space M. \ P x} \ N" + unfolding eventually_ae_filter by auto + then obtain N' where N': "N' \ null_sets M" and "N \ N'" + unfolding null_sets_completion_iff2 by auto + from P \N \ N'\ have "{x\space M. \ P x} \ N'" + by auto + with N' show "AE x in M. P x" + unfolding eventually_ae_filter by auto +qed (rule AE_completion) + +lemma null_part_null_sets: "S \ completion M \ null_part M S \ null_sets (completion M)" + by (auto dest!: null_part intro: null_sets_completionI null_sets_completion_subset) + +lemma AE_notin_null_part: "S \ completion M \ (AE x in M. x \ null_part M S)" + by (auto dest!: null_part_null_sets AE_not_in simp: AE_completion_iff) + +lemma completion_upper: + assumes A: "A \ sets (completion M)" + shows "\A'\sets M. A \ A' \ emeasure (completion M) A = emeasure M A'" +proof - + from AE_notin_null_part[OF A] obtain N where N: "N \ null_sets M" "null_part M A \ N" + unfolding eventually_ae_filter using null_part_null_sets[OF A, THEN null_setsD2, THEN sets.sets_into_space] by auto + show ?thesis + proof (intro bexI conjI) + show "A \ main_part M A \ N" + using \null_part M A \ N\ by (subst main_part_null_part_Un[symmetric, OF A]) auto + show "emeasure (completion M) A = emeasure M (main_part M A \ N)" + using A \N \ null_sets M\ by (simp add: emeasure_Un_null_set) + qed (use A N in auto) +qed + +lemma AE_in_main_part: + assumes A: "A \ completion M" shows "AE x in M. x \ main_part M A \ x \ A" + using AE_notin_null_part[OF A] + by (subst (2) main_part_null_part_Un[symmetric, OF A]) auto + +lemma completion_density_eq: + assumes ae: "AE x in M. 0 < f x" and [measurable]: "f \ M \\<^sub>M borel" + shows "completion (density M f) = density (completion M) f" +proof (intro measure_eqI) + have "N' \ sets M \ (AE x\N' in M. f x = 0) \ N' \ null_sets M" for N' + proof safe + assume N': "N' \ sets M" and ae_N': "AE x\N' in M. f x = 0" + from ae_N' ae have "AE x in M. x \ N'" + by eventually_elim auto + then show "N' \ null_sets M" + using N' by (simp add: AE_iff_null_sets) + next + assume N': "N' \ null_sets M" then show "N' \ sets M" "AE x\N' in M. f x = 0" + using ae AE_not_in[OF N'] by (auto simp: less_le) + qed + then show sets_eq: "sets (completion (density M f)) = sets (density (completion M) f)" + by (simp add: sets_completion null_sets_density_iff) + + fix A assume A: \A \ completion (density M f)\ + moreover + have "A \ completion M" + using A unfolding sets_eq by simp + moreover + have "main_part (density M f) A \ M" + using A main_part_sets[of A "density M f"] unfolding sets_density sets_eq by simp + moreover have "AE x in M. x \ main_part (density M f) A \ x \ A" + using AE_in_main_part[OF \A \ completion (density M f)\] ae by (auto simp add: AE_density) + ultimately show "emeasure (completion (density M f)) A = emeasure (density (completion M) f) A" + by (auto simp add: emeasure_density measurable_completion nn_integral_completion intro!: nn_integral_cong_AE) +qed + +lemma null_sets_subset: "A \ B \ A \ sets M \ B \ null_sets M \ A \ null_sets M" + using emeasure_mono[of A B M] by (simp add: null_sets_def) + +lemma (in complete_measure) complete2: "A \ B \ B \ null_sets M \ A \ null_sets M" + using complete[of A B] null_sets_subset[of A B M] by simp + +lemma (in complete_measure) vimage_null_part_null_sets: + assumes f: "f \ M \\<^sub>M N" and eq: "null_sets N \ null_sets (distr M N f)" + and A: "A \ completion N" + shows "f -` null_part N A \ space M \ null_sets M" +proof - + obtain N' where "N' \ null_sets N" "null_part N A \ N'" + using null_part[OF A] by auto + then have N': "N' \ null_sets (distr M N f)" + using eq by auto + show ?thesis + proof (rule complete2) + show "f -` null_part N A \ space M \ f -` N' \ space M" + using \null_part N A \ N'\ by auto + show "f -` N' \ space M \ null_sets M" + using f N' by (auto simp: null_sets_def emeasure_distr) + qed +qed + +lemma (in complete_measure) vimage_null_part_sets: + "f \ M \\<^sub>M N \ null_sets N \ null_sets (distr M N f) \ A \ completion N \ + f -` null_part N A \ space M \ sets M" + using vimage_null_part_null_sets[of f N A] by auto + +lemma (in complete_measure) measurable_completion2: + assumes f: "f \ M \\<^sub>M N" and null_sets: "null_sets N \ null_sets (distr M N f)" + shows "f \ M \\<^sub>M completion N" +proof (rule measurableI) + show "x \ space M \ f x \ space (completion N)" for x + using f[THEN measurable_space] by auto + fix A assume A: "A \ sets (completion N)" + have "f -` A \ space M = (f -` main_part N A \ space M) \ (f -` null_part N A \ space M)" + using main_part_null_part_Un[OF A] by auto + then show "f -` A \ space M \ sets M" + using f A null_sets by (auto intro: vimage_null_part_sets measurable_sets) +qed + +lemma (in complete_measure) completion_distr_eq: + assumes X: "X \ M \\<^sub>M N" and null_sets: "null_sets (distr M N X) = null_sets N" + shows "completion (distr M N X) = distr M (completion N) X" +proof (rule measure_eqI) + show eq: "sets (completion (distr M N X)) = sets (distr M (completion N) X)" + by (simp add: sets_completion null_sets) + + fix A assume A: "A \ completion (distr M N X)" + moreover have A': "A \ completion N" + using A by (simp add: eq) + moreover have "main_part (distr M N X) A \ sets N" + using main_part_sets[OF A] by simp + moreover have "X -` A \ space M = (X -` main_part (distr M N X) A \ space M) \ (X -` null_part (distr M N X) A \ space M)" + using main_part_null_part_Un[OF A] by auto + moreover have "X -` null_part (distr M N X) A \ space M \ null_sets M" + using X A by (intro vimage_null_part_null_sets) (auto cong: distr_cong) + ultimately show "emeasure (completion (distr M N X)) A = emeasure (distr M (completion N) X) A" + using X by (auto simp: emeasure_distr measurable_completion null_sets measurable_completion2 + intro!: emeasure_Un_null_set[symmetric]) +qed + +lemma distr_completion: "X \ M \\<^sub>M N \ distr (completion M) N X = distr M N X" + by (intro measure_eqI) (auto simp: emeasure_distr measurable_completion) + +proposition (in complete_measure) fmeasurable_inner_outer: + "S \ fmeasurable M \ + (\e>0. \T\fmeasurable M. \U\fmeasurable M. T \ S \ S \ U \ \measure M T - measure M U\ < e)" + (is "_ \ ?approx") +proof safe + let ?\ = "measure M" let ?D = "\T U . \?\ T - ?\ U\" + assume ?approx + have "\A. \n. (fst (A n) \ fmeasurable M \ snd (A n) \ fmeasurable M \ fst (A n) \ S \ S \ snd (A n) \ + ?D (fst (A n)) (snd (A n)) < 1/Suc n) \ (fst (A n) \ fst (A (Suc n)) \ snd (A (Suc n)) \ snd (A n))" + (is "\A. \n. ?P n (A n) \ ?Q (A n) (A (Suc n))") + proof (intro dependent_nat_choice) + show "\A. ?P 0 A" + using \?approx\[THEN spec, of 1] by auto + next + fix A n assume "?P n A" + moreover + from \?approx\[THEN spec, of "1/Suc (Suc n)"] + obtain T U where *: "T \ fmeasurable M" "U \ fmeasurable M" "T \ S" "S \ U" "?D T U < 1 / Suc (Suc n)" + by auto + ultimately have "?\ T \ ?\ (T \ fst A)" "?\ (U \ snd A) \ ?\ U" + "?\ T \ ?\ U" "?\ (T \ fst A) \ ?\ (U \ snd A)" + by (auto intro!: measure_mono_fmeasurable) + then have "?D (T \ fst A) (U \ snd A) \ ?D T U" + by auto + also have "?D T U < 1/Suc (Suc n)" by fact + finally show "\B. ?P (Suc n) B \ ?Q A B" + using \?P n A\ * + by (intro exI[of _ "(T \ fst A, U \ snd A)"] conjI) auto + qed + then obtain A + where lm: "\n. fst (A n) \ fmeasurable M" "\n. snd (A n) \ fmeasurable M" + and set_bound: "\n. fst (A n) \ S" "\n. S \ snd (A n)" + and mono: "\n. fst (A n) \ fst (A (Suc n))" "\n. snd (A (Suc n)) \ snd (A n)" + and bound: "\n. ?D (fst (A n)) (snd (A n)) < 1/Suc n" + by metis + + have INT_sA: "(\n. snd (A n)) \ fmeasurable M" + using lm by (intro fmeasurable_INT[of _ 0]) auto + have UN_fA: "(\n. fst (A n)) \ fmeasurable M" + using lm order_trans[OF set_bound(1) set_bound(2)[of 0]] by (intro fmeasurable_UN[of _ _ "snd (A 0)"]) auto + + have "(\n. ?\ (fst (A n)) - ?\ (snd (A n))) \ 0" + using bound + by (subst tendsto_rabs_zero_iff[symmetric]) + (intro tendsto_sandwich[OF _ _ tendsto_const LIMSEQ_inverse_real_of_nat]; + auto intro!: always_eventually less_imp_le simp: divide_inverse) + moreover + have "(\n. ?\ (fst (A n)) - ?\ (snd (A n))) \ ?\ (\n. fst (A n)) - ?\ (\n. snd (A n))" + proof (intro tendsto_diff Lim_measure_incseq Lim_measure_decseq) + show "range (\i. fst (A i)) \ sets M" "range (\i. snd (A i)) \ sets M" + "incseq (\i. fst (A i))" "decseq (\n. snd (A n))" + using mono lm by (auto simp: incseq_Suc_iff decseq_Suc_iff intro!: measure_mono_fmeasurable) + show "emeasure M (\x. fst (A x)) \ \" "emeasure M (snd (A n)) \ \" for n + using lm(2)[of n] UN_fA by (auto simp: fmeasurable_def) + qed + ultimately have eq: "0 = ?\ (\n. fst (A n)) - ?\ (\n. snd (A n))" + by (rule LIMSEQ_unique) + + show "S \ fmeasurable M" + using UN_fA INT_sA + proof (rule complete_sets_sandwich_fmeasurable) + show "(\n. fst (A n)) \ S" "S \ (\n. snd (A n))" + using set_bound by auto + show "?\ (\n. fst (A n)) = ?\ (\n. snd (A n))" + using eq by auto + qed +qed (auto intro!: bexI[of _ S]) + +lemma (in complete_measure) fmeasurable_measure_inner_outer: + "(S \ fmeasurable M \ m = measure M S) \ + (\e>0. \T\fmeasurable M. T \ S \ m - e < measure M T) \ + (\e>0. \U\fmeasurable M. S \ U \ measure M U < m + e)" + (is "?lhs = ?rhs") +proof + assume RHS: ?rhs + then have T: "\e. 0 < e \ (\T\fmeasurable M. T \ S \ m - e < measure M T)" + and U: "\e. 0 < e \ (\U\fmeasurable M. S \ U \ measure M U < m + e)" + by auto + have "S \ fmeasurable M" + proof (subst fmeasurable_inner_outer, safe) + fix e::real assume "0 < e" + with RHS obtain T U where T: "T \ fmeasurable M" "T \ S" "m - e/2 < measure M T" + and U: "U \ fmeasurable M" "S \ U" "measure M U < m + e/2" + by (meson half_gt_zero)+ + moreover have "measure M U - measure M T < (m + e/2) - (m - e/2)" + by (intro diff_strict_mono) fact+ + moreover have "measure M T \ measure M U" + using T U by (intro measure_mono_fmeasurable) auto + ultimately show "\T\fmeasurable M. \U\fmeasurable M. T \ S \ S \ U \ \measure M T - measure M U\ < e" + apply (rule_tac bexI[OF _ \T \ fmeasurable M\]) + apply (rule_tac bexI[OF _ \U \ fmeasurable M\]) + by auto + qed + moreover have "m = measure M S" + using \S \ fmeasurable M\ U[of "measure M S - m"] T[of "m - measure M S"] + by (cases m "measure M S" rule: linorder_cases) + (auto simp: not_le[symmetric] measure_mono_fmeasurable) + ultimately show ?lhs + by simp +qed (auto intro!: bexI[of _ S]) + lemma (in cld_measure) notin_sets_outer_measure_of_cover: assumes E: "E \ space M" "E \ sets M" shows "\B\sets M. 0 < emeasure M B \ emeasure M B < \ \ diff -r c3da799b1b45 -r 02de4a58e210 src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Thu Sep 29 13:02:43 2016 +0200 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Thu Sep 29 13:54:57 2016 +0200 @@ -22,12 +22,6 @@ by simp qed -abbreviation lebesgue :: "'a::euclidean_space measure" - where "lebesgue \ completion lborel" - -abbreviation lebesgue_on :: "'a set \ 'a::euclidean_space measure" - where "lebesgue_on \ \ restrict_space (completion lborel) \" - lemma has_integral_implies_lebesgue_measurable_cbox: fixes f :: "'a :: euclidean_space \ real" assumes f: "(f has_integral I) (cbox x y)" @@ -779,19 +773,6 @@ end -lemma measurable_completion: "f \ M \\<^sub>M N \ f \ completion M \\<^sub>M N" - by (auto simp: measurable_def) - -lemma integrable_completion: - fixes f :: "'a \ 'b::{banach, second_countable_topology}" - shows "f \ M \\<^sub>M borel \ integrable (completion M) f \ integrable M f" - by (rule integrable_subalgebra[symmetric]) auto - -lemma integral_completion: - fixes f :: "'a \ 'b::{banach, second_countable_topology}" - assumes f: "f \ M \\<^sub>M borel" shows "integral\<^sup>L (completion M) f = integral\<^sup>L M f" - by (rule integral_subalgebra[symmetric]) (auto intro: f) - context begin @@ -917,6 +898,11 @@ shows "f integrable_on S" "LINT x:S | lebesgue. f x = integral S f" using has_integral_set_lebesgue[OF f] by (auto simp: integral_unique integrable_on_def) +lemma lmeasurable_iff_has_integral: + "S \ lmeasurable \ ((indicator S) has_integral measure lebesgue S) UNIV" + by (subst has_integral_iff_nn_integral_lebesgue) + (auto simp: ennreal_indicator emeasure_eq_measure2 borel_measurable_indicator_iff intro!: fmeasurableI) + abbreviation absolutely_integrable_on :: "('a::euclidean_space \ 'b::{banach, second_countable_topology}) \ 'a set \ bool" (infixr "absolutely'_integrable'_on" 46) @@ -948,11 +934,63 @@ qed qed +lemma absolutely_integrable_on_iff_nonneg: + fixes f :: "'a :: euclidean_space \ real" + assumes "\x. 0 \ f x" shows "f absolutely_integrable_on s \ f integrable_on s" +proof - + from assms have "(\x. \f x\) = f" + by (intro ext) auto + then show ?thesis + unfolding absolutely_integrable_on_def by simp +qed + lemma absolutely_integrable_onI: fixes f :: "'a::euclidean_space \ 'b::euclidean_space" shows "f integrable_on s \ (\x. norm (f x)) integrable_on s \ f absolutely_integrable_on s" unfolding absolutely_integrable_on_def by auto +lemma lmeasurable_iff_integrable_on: "S \ lmeasurable \ (\x. 1::real) integrable_on S" + by (subst absolutely_integrable_on_iff_nonneg[symmetric]) + (simp_all add: lmeasurable_iff_integrable) + +lemma lmeasure_integral_UNIV: "S \ lmeasurable \ measure lebesgue S = integral UNIV (indicator S)" + by (simp add: lmeasurable_iff_has_integral integral_unique) + +lemma lmeasure_integral: "S \ lmeasurable \ measure lebesgue S = integral S (\x. 1::real)" + by (auto simp add: lmeasure_integral_UNIV indicator_def[abs_def] lmeasurable_iff_integrable_on) + +text \This should be an abbreviation for negligible.\ +lemma negligible_iff_null_sets: "negligible S \ S \ null_sets lebesgue" +proof + assume "negligible S" + then have "(indicator S has_integral (0::real)) UNIV" + by (auto simp: negligible) + then show "S \ null_sets lebesgue" + by (subst (asm) has_integral_iff_nn_integral_lebesgue) + (auto simp: borel_measurable_indicator_iff nn_integral_0_iff_AE AE_iff_null_sets indicator_eq_0_iff) +next + assume S: "S \ null_sets lebesgue" + show "negligible S" + unfolding negligible_def + proof (safe intro!: has_integral_iff_nn_integral_lebesgue[THEN iffD2] + has_integral_restrict_univ[where s="cbox _ _", THEN iffD1]) + fix a b + show "(\x. if x \ cbox a b then indicator S x else 0) \ lebesgue \\<^sub>M borel" + using S by (auto intro!: measurable_If) + then show "(\\<^sup>+ x. ennreal (if x \ cbox a b then indicator S x else 0) \lebesgue) = ennreal 0" + using S[THEN AE_not_in] by (auto intro!: nn_integral_0_iff_AE[THEN iffD2]) + qed auto +qed + +lemma non_negligible_UNIV [simp]: "\ negligible UNIV" + unfolding negligible_iff_null_sets by (auto simp: null_sets_def emeasure_lborel_UNIV) + +lemma negligible_interval: + "negligible (cbox a b) \ box a b = {}" "negligible (box a b) \ box a b = {}" + by (auto simp: negligible_iff_null_sets null_sets_def setprod_nonneg inner_diff_left box_eq_empty + not_le emeasure_lborel_cbox_eq emeasure_lborel_box_eq + intro: eq_refl antisym less_imp_le) + lemma set_integral_norm_bound: fixes f :: "_ \ 'a :: {banach, second_countable_topology}" shows "set_integrable M k f \ norm (LINT x:k|M. f x) \ LINT x:k|M. norm (f x)" diff -r c3da799b1b45 -r 02de4a58e210 src/HOL/Analysis/Lebesgue_Measure.thy --- a/src/HOL/Analysis/Lebesgue_Measure.thy Thu Sep 29 13:02:43 2016 +0200 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy Thu Sep 29 13:54:57 2016 +0200 @@ -8,7 +8,7 @@ section \Lebesgue measure\ theory Lebesgue_Measure - imports Finite_Product_Measure Bochner_Integration Caratheodory + imports Finite_Product_Measure Bochner_Integration Caratheodory Complete_Measure begin subsection \Every right continuous and nondecreasing function gives rise to a measure\ @@ -356,6 +356,12 @@ definition lborel :: "('a :: euclidean_space) measure" where "lborel = distr (\\<^sub>M b\Basis. interval_measure (\x. x)) borel (\f. \b\Basis. f b *\<^sub>R b)" +abbreviation lebesgue :: "'a::euclidean_space measure" + where "lebesgue \ completion lborel" + +abbreviation lebesgue_on :: "'a set \ 'a::euclidean_space measure" + where "lebesgue_on \ \ restrict_space (completion lborel) \" + lemma shows sets_lborel[simp, measurable_cong]: "sets lborel = sets borel" and space_lborel[simp]: "space lborel = space borel" @@ -659,6 +665,92 @@ by (simp add: lborel_integrable_real_affine_iff not_integrable_integral_eq) qed +lemma + fixes c :: "'a::euclidean_space \ real" and t + assumes c: "\j. j \ Basis \ c j \ 0" + defines "T == (\x. t + (\j\Basis. (c j * (x \ j)) *\<^sub>R j))" + shows lebesgue_affine_euclidean: "lebesgue = density (distr lebesgue lebesgue T) (\_. (\j\Basis. \c j\))" (is "_ = ?D") + and lebesgue_affine_measurable: "T \ lebesgue \\<^sub>M lebesgue" +proof - + have T_borel[measurable]: "T \ borel \\<^sub>M borel" + by (auto simp: T_def[abs_def]) + { fix A :: "'a set" assume A: "A \ sets borel" + then have "emeasure lborel A = 0 \ emeasure (density (distr lborel borel T) (\_. (\j\Basis. \c j\))) A = 0" + unfolding T_def using c by (subst lborel_affine_euclidean[symmetric]) auto + also have "\ \ emeasure (distr lebesgue lborel T) A = 0" + using A c by (simp add: distr_completion emeasure_density nn_integral_cmult setprod_nonneg cong: distr_cong) + finally have "emeasure lborel A = 0 \ emeasure (distr lebesgue lborel T) A = 0" . } + then have eq: "null_sets lborel = null_sets (distr lebesgue lborel T)" + by (auto simp: null_sets_def) + + show "T \ lebesgue \\<^sub>M lebesgue" + by (rule completion.measurable_completion2) (auto simp: eq measurable_completion) + + have "lebesgue = completion (density (distr lborel borel T) (\_. (\j\Basis. \c j\)))" + using c by (subst lborel_affine_euclidean[of c t]) (simp_all add: T_def[abs_def]) + also have "\ = density (completion (distr lebesgue lborel T)) (\_. (\j\Basis. \c j\))" + using c by (auto intro!: always_eventually setprod_pos completion_density_eq simp: distr_completion cong: distr_cong) + also have "\ = density (distr lebesgue lebesgue T) (\_. (\j\Basis. \c j\))" + by (subst completion.completion_distr_eq) (auto simp: eq measurable_completion) + finally show "lebesgue = density (distr lebesgue lebesgue T) (\_. (\j\Basis. \c j\))" . +qed + +lemma + fixes m :: real and \ :: "'a::euclidean_space" + defines "T r d x \ r *\<^sub>R x + d" + shows emeasure_lebesgue_affine: "emeasure lebesgue (T m \ ` S) = \m\ ^ DIM('a) * emeasure lebesgue S" (is ?e) + and measure_lebesgue_affine: "measure lebesgue (T m \ ` S) = \m\ ^ DIM('a) * measure lebesgue S" (is ?m) +proof - + show ?e + proof cases + assume "m = 0" then show ?thesis + by (simp add: image_constant_conv T_def[abs_def]) + next + let ?T = "T m \" and ?T' = "T (1 / m) (- ((1/m) *\<^sub>R \))" + assume "m \ 0" + then have s_comp_s: "?T' \ ?T = id" "?T \ ?T' = id" + by (auto simp: T_def[abs_def] fun_eq_iff scaleR_add_right scaleR_diff_right) + then have "inv ?T' = ?T" "bij ?T'" + by (auto intro: inv_unique_comp o_bij) + then have eq: "T m \ ` S = T (1 / m) ((-1/m) *\<^sub>R \) -` S \ space lebesgue" + using bij_vimage_eq_inv_image[OF \bij ?T'\, of S] by auto + + have trans_eq_T: "(\x. \ + (\j\Basis. (m * (x \ j)) *\<^sub>R j)) = T m \" for m \ + unfolding T_def[abs_def] scaleR_scaleR[symmetric] scaleR_setsum_right[symmetric] + by (auto simp add: euclidean_representation ac_simps) + + have T[measurable]: "T r d \ lebesgue \\<^sub>M lebesgue" for r d + using lebesgue_affine_measurable[of "\_. r" d] + by (cases "r = 0") (auto simp: trans_eq_T T_def[abs_def]) + + show ?thesis + proof cases + assume "S \ sets lebesgue" with \m \ 0\ show ?thesis + unfolding eq + apply (subst lebesgue_affine_euclidean[of "\_. m" \]) + apply (simp_all add: emeasure_density trans_eq_T nn_integral_cmult emeasure_distr + del: space_completion emeasure_completion) + apply (simp add: vimage_comp s_comp_s setprod_constant) + done + next + assume "S \ sets lebesgue" + moreover have "?T ` S \ sets lebesgue" + proof + assume "?T ` S \ sets lebesgue" + then have "?T -` (?T ` S) \ space lebesgue \ sets lebesgue" + by (rule measurable_sets[OF T]) + also have "?T -` (?T ` S) \ space lebesgue = S" + by (simp add: vimage_comp s_comp_s eq) + finally show False using \S \ sets lebesgue\ by auto + qed + ultimately show ?thesis + by (simp add: emeasure_notin_sets) + qed + qed + show ?m + unfolding measure_def \?e\ by (simp add: enn2real_mult setprod_nonneg) +qed + lemma divideR_right: fixes x y :: "'a::real_normed_vector" shows "r \ 0 \ y = x /\<^sub>R r \ r *\<^sub>R y = x" @@ -780,4 +872,16 @@ by (auto simp: mult.commute) qed +abbreviation lmeasurable :: "'a::euclidean_space set set" +where + "lmeasurable \ fmeasurable lebesgue" + +lemma lmeasurable_iff_integrable: + "S \ lmeasurable \ integrable lebesgue (indicator S :: 'a::euclidean_space \ real)" + by (auto simp: fmeasurable_def integrable_iff_bounded borel_measurable_indicator_iff ennreal_indicator) + +lemma lmeasurable_cbox [iff]: "cbox a b \ lmeasurable" + and lmeasurable_box [iff]: "box a b \ lmeasurable" + by (auto simp: fmeasurable_def emeasure_lborel_box_eq emeasure_lborel_cbox_eq) + end diff -r c3da799b1b45 -r 02de4a58e210 src/HOL/Analysis/Measure_Space.thy --- a/src/HOL/Analysis/Measure_Space.thy Thu Sep 29 13:02:43 2016 +0200 +++ b/src/HOL/Analysis/Measure_Space.thy Thu Sep 29 13:54:57 2016 +0200 @@ -965,6 +965,16 @@ translations "AE x in M. P" \ "CONST almost_everywhere M (\x. P)" +abbreviation + "set_almost_everywhere A M P \ AE x in M. x \ A \ P x" + +syntax + "_set_almost_everywhere" :: "pttrn \ 'a set \ 'a \ bool \ bool" + ("AE _\_ in _./ _" [0,0,0,10] 10) + +translations + "AE x\A in M. P" \ "CONST set_almost_everywhere A M (\x. P)" + lemma eventually_ae_filter: "eventually P (ae_filter M) \ (\N\null_sets M. {x \ space M. \ P x} \ N)" unfolding ae_filter_def by (subst eventually_INF_base) (auto simp: eventually_principal subset_eq) @@ -1576,6 +1586,68 @@ using fin A by (auto intro!: Lim_emeasure_decseq) qed auto +subsection \Set of measurable sets with finite measure\ + +definition fmeasurable :: "'a measure \ 'a set set" +where + "fmeasurable M = {A\sets M. emeasure M A < \}" + +lemma fmeasurableD[dest, measurable_dest]: "A \ fmeasurable M \ A \ sets M" + by (auto simp: fmeasurable_def) + +lemma fmeasurableI: "A \ sets M \ emeasure M A < \ \ A \ fmeasurable M" + by (auto simp: fmeasurable_def) + +lemma fmeasurableI_null_sets: "A \ null_sets M \ A \ fmeasurable M" + by (auto simp: fmeasurable_def) + +lemma fmeasurableI2: "A \ fmeasurable M \ B \ A \ B \ sets M \ B \ fmeasurable M" + using emeasure_mono[of B A M] by (auto simp: fmeasurable_def) + +lemma measure_mono_fmeasurable: + "A \ B \ A \ sets M \ B \ fmeasurable M \ measure M A \ measure M B" + by (auto simp: measure_def fmeasurable_def intro!: emeasure_mono enn2real_mono) + +lemma emeasure_eq_measure2: "A \ fmeasurable M \ emeasure M A = measure M A" + by (simp add: emeasure_eq_ennreal_measure fmeasurable_def less_top) + +interpretation fmeasurable: ring_of_sets "space M" "fmeasurable M" +proof (rule ring_of_setsI) + show "fmeasurable M \ Pow (space M)" "{} \ fmeasurable M" + by (auto simp: fmeasurable_def dest: sets.sets_into_space) + fix a b assume *: "a \ fmeasurable M" "b \ fmeasurable M" + then have "emeasure M (a \ b) \ emeasure M a + emeasure M b" + by (intro emeasure_subadditive) auto + also have "\ < top" + using * by (auto simp: fmeasurable_def) + finally show "a \ b \ fmeasurable M" + using * by (auto intro: fmeasurableI) + show "a - b \ fmeasurable M" + using emeasure_mono[of "a - b" a M] * by (auto simp: fmeasurable_def Diff_subset) +qed + +lemma fmeasurable_Diff: "A \ fmeasurable M \ B \ sets M \ A - B \ fmeasurable M" + using fmeasurableI2[of A M "A - B"] by auto + +lemma fmeasurable_UN: + assumes "countable I" "\i. i \ I \ F i \ A" "\i. i \ I \ F i \ sets M" "A \ fmeasurable M" + shows "(\i\I. F i) \ fmeasurable M" +proof (rule fmeasurableI2) + show "A \ fmeasurable M" "(\i\I. F i) \ A" using assms by auto + show "(\i\I. F i) \ sets M" + using assms by (intro sets.countable_UN') auto +qed + +lemma fmeasurable_INT: + assumes "countable I" "i \ I" "\i. i \ I \ F i \ sets M" "F i \ fmeasurable M" + shows "(\i\I. F i) \ fmeasurable M" +proof (rule fmeasurableI2) + show "F i \ fmeasurable M" "(\i\I. F i) \ F i" + using assms by auto + show "(\i\I. F i) \ sets M" + using assms by (intro sets.countable_INT') auto +qed + subsection \Measure spaces with @{term "emeasure M (space M) < \"}\ locale finite_measure = sigma_finite_measure M for M + @@ -1588,6 +1660,9 @@ lemma (in finite_measure) emeasure_finite[simp, intro]: "emeasure M A \ top" using finite_emeasure_space emeasure_space[of M A] by (auto simp: top_unique) +lemma (in finite_measure) fmeasurable_eq_sets: "fmeasurable M = sets M" + by (auto simp: fmeasurable_def less_top[symmetric]) + lemma (in finite_measure) emeasure_eq_measure: "emeasure M A = ennreal (measure M A)" by (intro emeasure_eq_ennreal_measure) simp @@ -3135,7 +3210,7 @@ proof - { fix a m assume "a \ sigma_sets \ m" "m \ M" then have "a \ sigma_sets \ (\M)" - by induction (auto intro: sigma_sets.intros) } + by induction (auto intro: sigma_sets.intros(2-)) } then show "sets (SUP m:M. sigma \ m) = sets (sigma \ (\M))" apply (subst sets_Sup_eq[where X="\"]) apply (auto simp add: M) [] @@ -3317,7 +3392,7 @@ assume "?M \ 0" then have *: "{x. ?m x \ 0} = (\n. {x. ?M / Suc n < ?m x})" using reals_Archimedean[of "?m x / ?M" for x] - by (auto simp: field_simps not_le[symmetric] measure_nonneg divide_le_0_iff measure_le_0_iff) + by (auto simp: field_simps not_le[symmetric] divide_le_0_iff measure_le_0_iff) have **: "\n. finite {x. ?M / Suc n < ?m x}" proof (rule ccontr) fix n assume "infinite {x. ?M / Suc n < ?m x}" (is "infinite ?X") diff -r c3da799b1b45 -r 02de4a58e210 src/HOL/Analysis/Set_Integral.thy --- a/src/HOL/Analysis/Set_Integral.thy Thu Sep 29 13:02:43 2016 +0200 +++ b/src/HOL/Analysis/Set_Integral.thy Thu Sep 29 13:54:57 2016 +0200 @@ -27,16 +27,6 @@ translations "LINT x:A|M. f" == "CONST set_lebesgue_integral M A (\x. f)" -abbreviation - "set_almost_everywhere A M P \ AE x in M. x \ A \ P x" - -syntax - "_set_almost_everywhere" :: "pttrn \ 'a set \ 'a \ bool \ bool" -("AE _\_ in _./ _" [0,0,0,10] 10) - -translations - "AE x\A in M. P" == "CONST set_almost_everywhere A M (\x. P)" - (* Notation for integration wrt lebesgue measure on the reals: diff -r c3da799b1b45 -r 02de4a58e210 src/HOL/Library/Indicator_Function.thy --- a/src/HOL/Library/Indicator_Function.thy Thu Sep 29 13:02:43 2016 +0200 +++ b/src/HOL/Library/Indicator_Function.thy Thu Sep 29 13:54:57 2016 +0200 @@ -28,6 +28,9 @@ lemma indicator_eq_1_iff: "indicator A x = (1::'a::zero_neq_one) \ x \ A" by (auto simp: indicator_def) +lemma indicator_UNIV [simp]: "indicator UNIV = (\x. 1)" + by auto + lemma indicator_leI: "(x \ A \ y \ B) \ (indicator A x :: 'a::linordered_nonzero_semiring) \ indicator B y" by (auto simp: indicator_def)