src/HOL/Probability/Lebesgue_Measure.thy
changeset 41023 9118eb4eb8dc
parent 40874 f5a74b17a69e
child 41095 c335d880ff82
equal deleted inserted replaced
41022:81d337539d57 41023:9118eb4eb8dc
   355   note has_gmeasure_lmeasure[OF this]
   355   note has_gmeasure_lmeasure[OF this]
   356   thus ?thesis .
   356   thus ?thesis .
   357 qed
   357 qed
   358 
   358 
   359 lemma lebesgue_simple_function_indicator:
   359 lemma lebesgue_simple_function_indicator:
   360   fixes f::"'a::ordered_euclidean_space \<Rightarrow> pinfreal"
   360   fixes f::"'a::ordered_euclidean_space \<Rightarrow> pextreal"
   361   assumes f:"lebesgue.simple_function f"
   361   assumes f:"lebesgue.simple_function f"
   362   shows "f = (\<lambda>x. (\<Sum>y \<in> f ` UNIV. y * indicator (f -` {y}) x))"
   362   shows "f = (\<lambda>x. (\<Sum>y \<in> f ` UNIV. y * indicator (f -` {y}) x))"
   363   apply(rule,subst lebesgue.simple_function_indicator_representation[OF f]) by auto
   363   apply(rule,subst lebesgue.simple_function_indicator_representation[OF f]) by auto
   364 
   364 
   365 lemma lmeasure_gmeasure:
   365 lemma lmeasure_gmeasure:
   419   then show ?thesis by simp
   419   then show ?thesis by simp
   420 qed
   420 qed
   421 
   421 
   422 lemma lmeasure_singleton[simp]:
   422 lemma lmeasure_singleton[simp]:
   423   fixes a :: "'a::ordered_euclidean_space" shows "lmeasure {a} = 0"
   423   fixes a :: "'a::ordered_euclidean_space" shows "lmeasure {a} = 0"
   424   using has_gmeasure_interval[of a a] unfolding zero_pinfreal_def
   424   using has_gmeasure_interval[of a a] unfolding zero_pextreal_def
   425   by (intro has_gmeasure_lmeasure)
   425   by (intro has_gmeasure_lmeasure)
   426      (simp add: content_closed_interval DIM_positive)
   426      (simp add: content_closed_interval DIM_positive)
   427 
   427 
   428 declare content_real[simp]
   428 declare content_real[simp]
   429 
   429 
   473   ultimately show "\<exists>A::nat \<Rightarrow> 'b set. range A \<subseteq> sets lebesgue \<and> (\<Union>i. A i) = space lebesgue \<and> (\<forall>i. lmeasure (A i) \<noteq> \<omega>)"
   473   ultimately show "\<exists>A::nat \<Rightarrow> 'b set. range A \<subseteq> sets lebesgue \<and> (\<Union>i. A i) = space lebesgue \<and> (\<forall>i. lmeasure (A i) \<noteq> \<omega>)"
   474     by auto
   474     by auto
   475 qed
   475 qed
   476 
   476 
   477 lemma simple_function_has_integral:
   477 lemma simple_function_has_integral:
   478   fixes f::"'a::ordered_euclidean_space \<Rightarrow> pinfreal"
   478   fixes f::"'a::ordered_euclidean_space \<Rightarrow> pextreal"
   479   assumes f:"lebesgue.simple_function f"
   479   assumes f:"lebesgue.simple_function f"
   480   and f':"\<forall>x. f x \<noteq> \<omega>"
   480   and f':"\<forall>x. f x \<noteq> \<omega>"
   481   and om:"\<forall>x\<in>range f. lmeasure (f -` {x} \<inter> UNIV) = \<omega> \<longrightarrow> x = 0"
   481   and om:"\<forall>x\<in>range f. lmeasure (f -` {x} \<inter> UNIV) = \<omega> \<longrightarrow> x = 0"
   482   shows "((\<lambda>x. real (f x)) has_integral (real (lebesgue.simple_integral f))) UNIV"
   482   shows "((\<lambda>x. real (f x)) has_integral (real (lebesgue.simple_integral f))) UNIV"
   483   unfolding lebesgue.simple_integral_def
   483   unfolding lebesgue.simple_integral_def
   484   apply(subst lebesgue_simple_function_indicator[OF f])
   484   apply(subst lebesgue_simple_function_indicator[OF f])
   485 proof- case goal1
   485 proof- case goal1
   486   have *:"\<And>x. \<forall>y\<in>range f. y * indicator (f -` {y}) x \<noteq> \<omega>"
   486   have *:"\<And>x. \<forall>y\<in>range f. y * indicator (f -` {y}) x \<noteq> \<omega>"
   487     "\<forall>x\<in>range f. x * lmeasure (f -` {x} \<inter> UNIV) \<noteq> \<omega>"
   487     "\<forall>x\<in>range f. x * lmeasure (f -` {x} \<inter> UNIV) \<noteq> \<omega>"
   488     using f' om unfolding indicator_def by auto
   488     using f' om unfolding indicator_def by auto
   489   show ?case unfolding space_lebesgue real_of_pinfreal_setsum'[OF *(1),THEN sym]
   489   show ?case unfolding space_lebesgue real_of_pextreal_setsum'[OF *(1),THEN sym]
   490     unfolding real_of_pinfreal_setsum'[OF *(2),THEN sym]
   490     unfolding real_of_pextreal_setsum'[OF *(2),THEN sym]
   491     unfolding real_of_pinfreal_setsum space_lebesgue
   491     unfolding real_of_pextreal_setsum space_lebesgue
   492     apply(rule has_integral_setsum)
   492     apply(rule has_integral_setsum)
   493   proof safe show "finite (range f)" using f by (auto dest: lebesgue.simple_functionD)
   493   proof safe show "finite (range f)" using f by (auto dest: lebesgue.simple_functionD)
   494     fix y::'a show "((\<lambda>x. real (f y * indicator (f -` {f y}) x)) has_integral
   494     fix y::'a show "((\<lambda>x. real (f y * indicator (f -` {f y}) x)) has_integral
   495       real (f y * lmeasure (f -` {f y} \<inter> UNIV))) UNIV"
   495       real (f y * lmeasure (f -` {f y} \<inter> UNIV))) UNIV"
   496     proof(cases "f y = 0") case False
   496     proof(cases "f y = 0") case False
   497       have mea:"gmeasurable (f -` {f y})" apply(rule lmeasure_finite_gmeasurable)
   497       have mea:"gmeasurable (f -` {f y})" apply(rule lmeasure_finite_gmeasurable)
   498         using assms unfolding lebesgue.simple_function_def using False by auto
   498         using assms unfolding lebesgue.simple_function_def using False by auto
   499       have *:"\<And>x. real (indicator (f -` {f y}) x::pinfreal) = (if x \<in> f -` {f y} then 1 else 0)" by auto
   499       have *:"\<And>x. real (indicator (f -` {f y}) x::pextreal) = (if x \<in> f -` {f y} then 1 else 0)" by auto
   500       show ?thesis unfolding real_of_pinfreal_mult[THEN sym]
   500       show ?thesis unfolding real_of_pextreal_mult[THEN sym]
   501         apply(rule has_integral_cmul[where 'b=real, unfolded real_scaleR_def])
   501         apply(rule has_integral_cmul[where 'b=real, unfolded real_scaleR_def])
   502         unfolding Int_UNIV_right lmeasure_gmeasure[OF mea,THEN sym]
   502         unfolding Int_UNIV_right lmeasure_gmeasure[OF mea,THEN sym]
   503         unfolding measure_integral_univ[OF mea] * apply(rule integrable_integral)
   503         unfolding measure_integral_univ[OF mea] * apply(rule integrable_integral)
   504         unfolding gmeasurable_integrable[THEN sym] using mea .
   504         unfolding gmeasurable_integrable[THEN sym] using mea .
   505     qed auto
   505     qed auto
   508 lemma bounded_realI: assumes "\<forall>x\<in>s. abs (x::real) \<le> B" shows "bounded s"
   508 lemma bounded_realI: assumes "\<forall>x\<in>s. abs (x::real) \<le> B" shows "bounded s"
   509   unfolding bounded_def dist_real_def apply(rule_tac x=0 in exI)
   509   unfolding bounded_def dist_real_def apply(rule_tac x=0 in exI)
   510   using assms by auto
   510   using assms by auto
   511 
   511 
   512 lemma simple_function_has_integral':
   512 lemma simple_function_has_integral':
   513   fixes f::"'a::ordered_euclidean_space \<Rightarrow> pinfreal"
   513   fixes f::"'a::ordered_euclidean_space \<Rightarrow> pextreal"
   514   assumes f:"lebesgue.simple_function f"
   514   assumes f:"lebesgue.simple_function f"
   515   and i: "lebesgue.simple_integral f \<noteq> \<omega>"
   515   and i: "lebesgue.simple_integral f \<noteq> \<omega>"
   516   shows "((\<lambda>x. real (f x)) has_integral (real (lebesgue.simple_integral f))) UNIV"
   516   shows "((\<lambda>x. real (f x)) has_integral (real (lebesgue.simple_integral f))) UNIV"
   517 proof- let ?f = "\<lambda>x. if f x = \<omega> then 0 else f x"
   517 proof- let ?f = "\<lambda>x. if f x = \<omega> then 0 else f x"
   518   { fix x have "real (f x) = real (?f x)" by (cases "f x") auto } note * = this
   518   { fix x have "real (f x) = real (?f x)" by (cases "f x") auto } note * = this
   542     qed
   542     qed
   543   qed
   543   qed
   544 qed
   544 qed
   545 
   545 
   546 lemma (in measure_space) positive_integral_monotone_convergence:
   546 lemma (in measure_space) positive_integral_monotone_convergence:
   547   fixes f::"nat \<Rightarrow> 'a \<Rightarrow> pinfreal"
   547   fixes f::"nat \<Rightarrow> 'a \<Rightarrow> pextreal"
   548   assumes i: "\<And>i. f i \<in> borel_measurable M" and mono: "\<And>x. mono (\<lambda>n. f n x)"
   548   assumes i: "\<And>i. f i \<in> borel_measurable M" and mono: "\<And>x. mono (\<lambda>n. f n x)"
   549   and lim: "\<And>x. (\<lambda>i. f i x) ----> u x"
   549   and lim: "\<And>x. (\<lambda>i. f i x) ----> u x"
   550   shows "u \<in> borel_measurable M"
   550   shows "u \<in> borel_measurable M"
   551   and "(\<lambda>i. positive_integral (f i)) ----> positive_integral u" (is ?ilim)
   551   and "(\<lambda>i. positive_integral (f i)) ----> positive_integral u" (is ?ilim)
   552 proof -
   552 proof -
   553   from positive_integral_isoton[unfolded isoton_fun_expand isoton_iff_Lim_mono, of f u]
   553   from positive_integral_isoton[unfolded isoton_fun_expand isoton_iff_Lim_mono, of f u]
   554   show ?ilim using mono lim i by auto
   554   show ?ilim using mono lim i by auto
   555   have "(SUP i. f i) = u" using mono lim SUP_Lim_pinfreal
   555   have "(SUP i. f i) = u" using mono lim SUP_Lim_pextreal
   556     unfolding fun_eq_iff SUPR_fun_expand mono_def by auto
   556     unfolding fun_eq_iff SUPR_fun_expand mono_def by auto
   557   moreover have "(SUP i. f i) \<in> borel_measurable M"
   557   moreover have "(SUP i. f i) \<in> borel_measurable M"
   558     using i by (rule borel_measurable_SUP)
   558     using i by (rule borel_measurable_SUP)
   559   ultimately show "u \<in> borel_measurable M" by simp
   559   ultimately show "u \<in> borel_measurable M" by simp
   560 qed
   560 qed
   561 
   561 
   562 lemma positive_integral_has_integral:
   562 lemma positive_integral_has_integral:
   563   fixes f::"'a::ordered_euclidean_space => pinfreal"
   563   fixes f::"'a::ordered_euclidean_space => pextreal"
   564   assumes f:"f \<in> borel_measurable lebesgue"
   564   assumes f:"f \<in> borel_measurable lebesgue"
   565   and int_om:"lebesgue.positive_integral f \<noteq> \<omega>"
   565   and int_om:"lebesgue.positive_integral f \<noteq> \<omega>"
   566   and f_om:"\<forall>x. f x \<noteq> \<omega>" (* TODO: remove this *)
   566   and f_om:"\<forall>x. f x \<noteq> \<omega>" (* TODO: remove this *)
   567   shows "((\<lambda>x. real (f x)) has_integral (real (lebesgue.positive_integral f))) UNIV"
   567   shows "((\<lambda>x. real (f x)) has_integral (real (lebesgue.positive_integral f))) UNIV"
   568 proof- let ?i = "lebesgue.positive_integral f"
   568 proof- let ?i = "lebesgue.positive_integral f"
   579 
   579 
   580   note u_int = simple_function_has_integral'[OF u(1) this]
   580   note u_int = simple_function_has_integral'[OF u(1) this]
   581   have "(\<lambda>x. real (f x)) integrable_on UNIV \<and>
   581   have "(\<lambda>x. real (f x)) integrable_on UNIV \<and>
   582     (\<lambda>k. Integration.integral UNIV (\<lambda>x. real (u k x))) ----> Integration.integral UNIV (\<lambda>x. real (f x))"
   582     (\<lambda>k. Integration.integral UNIV (\<lambda>x. real (u k x))) ----> Integration.integral UNIV (\<lambda>x. real (f x))"
   583     apply(rule monotone_convergence_increasing) apply(rule,rule,rule u_int)
   583     apply(rule monotone_convergence_increasing) apply(rule,rule,rule u_int)
   584   proof safe case goal1 show ?case apply(rule real_of_pinfreal_mono) using u(2,3) by auto
   584   proof safe case goal1 show ?case apply(rule real_of_pextreal_mono) using u(2,3) by auto
   585   next case goal2 show ?case using u(3) apply(subst lim_Real[THEN sym])
   585   next case goal2 show ?case using u(3) apply(subst lim_Real[THEN sym])
   586       prefer 3 apply(subst Real_real') defer apply(subst Real_real')
   586       prefer 3 apply(subst Real_real') defer apply(subst Real_real')
   587       using isotone_Lim[OF u(3)[unfolded isoton_fun_expand, THEN spec]] using f_om u by auto
   587       using isotone_Lim[OF u(3)[unfolded isoton_fun_expand, THEN spec]] using f_om u by auto
   588   next case goal3
   588   next case goal3
   589     show ?case apply(rule bounded_realI[where B="real (lebesgue.positive_integral f)"])
   589     show ?case apply(rule bounded_realI[where B="real (lebesgue.positive_integral f)"])
   590       apply safe apply(subst abs_of_nonneg) apply(rule integral_nonneg,rule) apply(rule u_int)
   590       apply safe apply(subst abs_of_nonneg) apply(rule integral_nonneg,rule) apply(rule u_int)
   591       unfolding integral_unique[OF u_int] defer apply(rule real_of_pinfreal_mono[OF _ int_u_le])
   591       unfolding integral_unique[OF u_int] defer apply(rule real_of_pextreal_mono[OF _ int_u_le])
   592       using u int_om by auto
   592       using u int_om by auto
   593   qed note int = conjunctD2[OF this]
   593   qed note int = conjunctD2[OF this]
   594 
   594 
   595   have "(\<lambda>i. lebesgue.simple_integral (u i)) ----> ?i" unfolding u_simple
   595   have "(\<lambda>i. lebesgue.simple_integral (u i)) ----> ?i" unfolding u_simple
   596     apply(rule lebesgue.positive_integral_monotone_convergence(2))
   596     apply(rule lebesgue.positive_integral_monotone_convergence(2))
   919   show "\<exists>xa\<in>Chi -` A \<inter> extensional {..<DIM('a)}. x = Chi xa" apply(rule_tac x="?y" in bexI)
   919   show "\<exists>xa\<in>Chi -` A \<inter> extensional {..<DIM('a)}. x = Chi xa" apply(rule_tac x="?y" in bexI)
   920     apply(subst euclidean_eq) unfolding extensional_def using `x\<in>A` by(auto simp: *)
   920     apply(subst euclidean_eq) unfolding extensional_def using `x\<in>A` by(auto simp: *)
   921 qed
   921 qed
   922 
   922 
   923 lemma borel_fubini_positiv_integral:
   923 lemma borel_fubini_positiv_integral:
   924   fixes f :: "'a::ordered_euclidean_space \<Rightarrow> pinfreal"
   924   fixes f :: "'a::ordered_euclidean_space \<Rightarrow> pextreal"
   925   assumes f: "f \<in> borel_measurable borel"
   925   assumes f: "f \<in> borel_measurable borel"
   926   shows "borel.positive_integral f =
   926   shows "borel.positive_integral f =
   927           borel_product.product_positive_integral {..<DIM('a)} (f \<circ> p2e)"
   927           borel_product.product_positive_integral {..<DIM('a)} (f \<circ> p2e)"
   928 proof- def U \<equiv> "(({..<DIM('a)} \<rightarrow> UNIV) \<inter> extensional {..<DIM('a)}):: (nat \<Rightarrow> real) set"
   928 proof- def U \<equiv> "(({..<DIM('a)} \<rightarrow> UNIV) \<inter> extensional {..<DIM('a)}):: (nat \<Rightarrow> real) set"
   929   interpret fprod: finite_product_sigma_finite "\<lambda>x. borel" "\<lambda>x. lmeasure" "{..<DIM('a)}" by default auto
   929   interpret fprod: finite_product_sigma_finite "\<lambda>x. borel" "\<lambda>x. lmeasure" "{..<DIM('a)}" by default auto