src/HOL/Analysis/Lebesgue_Measure.thy
changeset 63958 02de4a58e210
parent 63918 6bf55e6e0b75
child 63959 f77dca1abf1b
equal deleted inserted replaced
63957:c3da799b1b45 63958:02de4a58e210
     6 *)
     6 *)
     7 
     7 
     8 section \<open>Lebesgue measure\<close>
     8 section \<open>Lebesgue measure\<close>
     9 
     9 
    10 theory Lebesgue_Measure
    10 theory Lebesgue_Measure
    11   imports Finite_Product_Measure Bochner_Integration Caratheodory
    11   imports Finite_Product_Measure Bochner_Integration Caratheodory Complete_Measure
    12 begin
    12 begin
    13 
    13 
    14 subsection \<open>Every right continuous and nondecreasing function gives rise to a measure\<close>
    14 subsection \<open>Every right continuous and nondecreasing function gives rise to a measure\<close>
    15 
    15 
    16 definition interval_measure :: "(real \<Rightarrow> real) \<Rightarrow> real measure" where
    16 definition interval_measure :: "(real \<Rightarrow> real) \<Rightarrow> real measure" where
   354 subsection \<open>Lebesgue-Borel measure\<close>
   354 subsection \<open>Lebesgue-Borel measure\<close>
   355 
   355 
   356 definition lborel :: "('a :: euclidean_space) measure" where
   356 definition lborel :: "('a :: euclidean_space) measure" where
   357   "lborel = distr (\<Pi>\<^sub>M b\<in>Basis. interval_measure (\<lambda>x. x)) borel (\<lambda>f. \<Sum>b\<in>Basis. f b *\<^sub>R b)"
   357   "lborel = distr (\<Pi>\<^sub>M b\<in>Basis. interval_measure (\<lambda>x. x)) borel (\<lambda>f. \<Sum>b\<in>Basis. f b *\<^sub>R b)"
   358 
   358 
       
   359 abbreviation lebesgue :: "'a::euclidean_space measure"
       
   360   where "lebesgue \<equiv> completion lborel"
       
   361 
       
   362 abbreviation lebesgue_on :: "'a set \<Rightarrow> 'a::euclidean_space measure"
       
   363   where "lebesgue_on \<Omega> \<equiv> restrict_space (completion lborel) \<Omega>"
       
   364 
   359 lemma
   365 lemma
   360   shows sets_lborel[simp, measurable_cong]: "sets lborel = sets borel"
   366   shows sets_lborel[simp, measurable_cong]: "sets lborel = sets borel"
   361     and space_lborel[simp]: "space lborel = space borel"
   367     and space_lborel[simp]: "space lborel = space borel"
   362     and measurable_lborel1[simp]: "measurable M lborel = measurable M borel"
   368     and measurable_lborel1[simp]: "measurable M lborel = measurable M borel"
   363     and measurable_lborel2[simp]: "measurable lborel M = measurable borel M"
   369     and measurable_lborel2[simp]: "measurable lborel M = measurable borel M"
   657 next
   663 next
   658   assume "\<not> integrable lborel f" with c show ?thesis
   664   assume "\<not> integrable lborel f" with c show ?thesis
   659     by (simp add: lborel_integrable_real_affine_iff not_integrable_integral_eq)
   665     by (simp add: lborel_integrable_real_affine_iff not_integrable_integral_eq)
   660 qed
   666 qed
   661 
   667 
       
   668 lemma
       
   669   fixes c :: "'a::euclidean_space \<Rightarrow> real" and t
       
   670   assumes c: "\<And>j. j \<in> Basis \<Longrightarrow> c j \<noteq> 0"
       
   671   defines "T == (\<lambda>x. t + (\<Sum>j\<in>Basis. (c j * (x \<bullet> j)) *\<^sub>R j))"
       
   672   shows lebesgue_affine_euclidean: "lebesgue = density (distr lebesgue lebesgue T) (\<lambda>_. (\<Prod>j\<in>Basis. \<bar>c j\<bar>))" (is "_ = ?D")
       
   673     and lebesgue_affine_measurable: "T \<in> lebesgue \<rightarrow>\<^sub>M lebesgue"
       
   674 proof -
       
   675   have T_borel[measurable]: "T \<in> borel \<rightarrow>\<^sub>M borel"
       
   676     by (auto simp: T_def[abs_def])
       
   677   { fix A :: "'a set" assume A: "A \<in> sets borel"
       
   678     then have "emeasure lborel A = 0 \<longleftrightarrow> emeasure (density (distr lborel borel T) (\<lambda>_. (\<Prod>j\<in>Basis. \<bar>c j\<bar>))) A = 0"
       
   679       unfolding T_def using c by (subst lborel_affine_euclidean[symmetric]) auto
       
   680     also have "\<dots> \<longleftrightarrow> emeasure (distr lebesgue lborel T) A = 0"
       
   681       using A c by (simp add: distr_completion emeasure_density nn_integral_cmult setprod_nonneg cong: distr_cong)
       
   682     finally have "emeasure lborel A = 0 \<longleftrightarrow> emeasure (distr lebesgue lborel T) A = 0" . }
       
   683   then have eq: "null_sets lborel = null_sets (distr lebesgue lborel T)"
       
   684     by (auto simp: null_sets_def)
       
   685 
       
   686   show "T \<in> lebesgue \<rightarrow>\<^sub>M lebesgue"
       
   687     by (rule completion.measurable_completion2) (auto simp: eq measurable_completion)
       
   688 
       
   689   have "lebesgue = completion (density (distr lborel borel T) (\<lambda>_. (\<Prod>j\<in>Basis. \<bar>c j\<bar>)))"
       
   690     using c by (subst lborel_affine_euclidean[of c t]) (simp_all add: T_def[abs_def])
       
   691   also have "\<dots> = density (completion (distr lebesgue lborel T)) (\<lambda>_. (\<Prod>j\<in>Basis. \<bar>c j\<bar>))"
       
   692     using c by (auto intro!: always_eventually setprod_pos completion_density_eq simp: distr_completion cong: distr_cong)
       
   693   also have "\<dots> = density (distr lebesgue lebesgue T) (\<lambda>_. (\<Prod>j\<in>Basis. \<bar>c j\<bar>))"
       
   694     by (subst completion.completion_distr_eq) (auto simp: eq measurable_completion)
       
   695   finally show "lebesgue = density (distr lebesgue lebesgue T) (\<lambda>_. (\<Prod>j\<in>Basis. \<bar>c j\<bar>))" .
       
   696 qed
       
   697 
       
   698 lemma
       
   699   fixes m :: real and \<delta> :: "'a::euclidean_space"
       
   700   defines "T r d x \<equiv> r *\<^sub>R x + d"
       
   701   shows emeasure_lebesgue_affine: "emeasure lebesgue (T m \<delta> ` S) = \<bar>m\<bar> ^ DIM('a) * emeasure lebesgue S" (is ?e)
       
   702     and measure_lebesgue_affine: "measure lebesgue (T m \<delta> ` S) = \<bar>m\<bar> ^ DIM('a) * measure lebesgue S" (is ?m)
       
   703 proof -
       
   704   show ?e
       
   705   proof cases
       
   706     assume "m = 0" then show ?thesis
       
   707       by (simp add: image_constant_conv T_def[abs_def])
       
   708   next
       
   709     let ?T = "T m \<delta>" and ?T' = "T (1 / m) (- ((1/m) *\<^sub>R \<delta>))"
       
   710     assume "m \<noteq> 0"
       
   711     then have s_comp_s: "?T' \<circ> ?T = id" "?T \<circ> ?T' = id"
       
   712       by (auto simp: T_def[abs_def] fun_eq_iff scaleR_add_right scaleR_diff_right)
       
   713     then have "inv ?T' = ?T" "bij ?T'"
       
   714       by (auto intro: inv_unique_comp o_bij)
       
   715     then have eq: "T m \<delta> ` S = T (1 / m) ((-1/m) *\<^sub>R \<delta>) -` S \<inter> space lebesgue"
       
   716       using bij_vimage_eq_inv_image[OF \<open>bij ?T'\<close>, of S] by auto
       
   717 
       
   718     have trans_eq_T: "(\<lambda>x. \<delta> + (\<Sum>j\<in>Basis. (m * (x \<bullet> j)) *\<^sub>R j)) = T m \<delta>" for m \<delta>
       
   719       unfolding T_def[abs_def] scaleR_scaleR[symmetric] scaleR_setsum_right[symmetric]
       
   720       by (auto simp add: euclidean_representation ac_simps)
       
   721 
       
   722     have T[measurable]: "T r d \<in> lebesgue \<rightarrow>\<^sub>M lebesgue" for r d
       
   723       using lebesgue_affine_measurable[of "\<lambda>_. r" d]
       
   724       by (cases "r = 0") (auto simp: trans_eq_T T_def[abs_def])
       
   725 
       
   726     show ?thesis
       
   727     proof cases
       
   728       assume "S \<in> sets lebesgue" with \<open>m \<noteq> 0\<close> show ?thesis
       
   729         unfolding eq
       
   730         apply (subst lebesgue_affine_euclidean[of "\<lambda>_. m" \<delta>])
       
   731         apply (simp_all add: emeasure_density trans_eq_T nn_integral_cmult emeasure_distr
       
   732                         del: space_completion emeasure_completion)
       
   733         apply (simp add: vimage_comp s_comp_s setprod_constant)
       
   734         done
       
   735     next
       
   736       assume "S \<notin> sets lebesgue"
       
   737       moreover have "?T ` S \<notin> sets lebesgue"
       
   738       proof
       
   739         assume "?T ` S \<in> sets lebesgue"
       
   740         then have "?T -` (?T ` S) \<inter> space lebesgue \<in> sets lebesgue"
       
   741           by (rule measurable_sets[OF T])
       
   742         also have "?T -` (?T ` S) \<inter> space lebesgue = S"
       
   743           by (simp add: vimage_comp s_comp_s eq)
       
   744         finally show False using \<open>S \<notin> sets lebesgue\<close> by auto
       
   745       qed
       
   746       ultimately show ?thesis
       
   747         by (simp add: emeasure_notin_sets)
       
   748     qed
       
   749   qed
       
   750   show ?m
       
   751     unfolding measure_def \<open>?e\<close> by (simp add: enn2real_mult setprod_nonneg)
       
   752 qed
       
   753 
   662 lemma divideR_right:
   754 lemma divideR_right:
   663   fixes x y :: "'a::real_normed_vector"
   755   fixes x y :: "'a::real_normed_vector"
   664   shows "r \<noteq> 0 \<Longrightarrow> y = x /\<^sub>R r \<longleftrightarrow> r *\<^sub>R y = x"
   756   shows "r \<noteq> 0 \<Longrightarrow> y = x /\<^sub>R r \<longleftrightarrow> r *\<^sub>R y = x"
   665   using scaleR_cancel_left[of r y "x /\<^sub>R r"] by simp
   757   using scaleR_cancel_left[of r y "x /\<^sub>R r"] by simp
   666 
   758 
   778   qed simp
   870   qed simp
   779   then show ?thesis
   871   then show ?thesis
   780     by (auto simp: mult.commute)
   872     by (auto simp: mult.commute)
   781 qed
   873 qed
   782 
   874 
       
   875 abbreviation lmeasurable :: "'a::euclidean_space set set"
       
   876 where
       
   877   "lmeasurable \<equiv> fmeasurable lebesgue"
       
   878 
       
   879 lemma lmeasurable_iff_integrable:
       
   880   "S \<in> lmeasurable \<longleftrightarrow> integrable lebesgue (indicator S :: 'a::euclidean_space \<Rightarrow> real)"
       
   881   by (auto simp: fmeasurable_def integrable_iff_bounded borel_measurable_indicator_iff ennreal_indicator)
       
   882 
       
   883 lemma lmeasurable_cbox [iff]: "cbox a b \<in> lmeasurable"
       
   884   and lmeasurable_box [iff]: "box a b \<in> lmeasurable"
       
   885   by (auto simp: fmeasurable_def emeasure_lborel_box_eq emeasure_lborel_cbox_eq)
       
   886 
   783 end
   887 end