src/HOL/Probability/Probability_Measure.thy
changeset 50419 3177d0374701
parent 50244 de72bbe42190
child 51475 ebf9d4fd00ba
equal deleted inserted replaced
50418:bd68cf816dd3 50419:3177d0374701
   841     unfolding AE_count_space
   841     unfolding AE_count_space
   842     apply (auto simp add: positive_integral_count_space_finite * intro!: setsum_cong split: split_max)
   842     apply (auto simp add: positive_integral_count_space_finite * intro!: setsum_cong split: split_max)
   843     done
   843     done
   844 qed
   844 qed
   845 
   845 
       
   846 lemma distributedI_real:
       
   847   fixes f :: "'a \<Rightarrow> real"
       
   848   assumes gen: "sets M1 = sigma_sets (space M1) E" and "Int_stable E"
       
   849     and A: "range A \<subseteq> E" "(\<Union>i::nat. A i) = space M1" "\<And>i. emeasure (distr M M1 X) (A i) \<noteq> \<infinity>"
       
   850     and X: "X \<in> measurable M M1"
       
   851     and f: "f \<in> borel_measurable M1" "AE x in M1. 0 \<le> f x"
       
   852     and eq: "\<And>A. A \<in> E \<Longrightarrow> emeasure M (X -` A \<inter> space M) = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M1)"
       
   853   shows "distributed M M1 X f"
       
   854   unfolding distributed_def
       
   855 proof (intro conjI)
       
   856   show "distr M M1 X = density M1 f"
       
   857   proof (rule measure_eqI_generator_eq[where A=A])
       
   858     { fix A assume A: "A \<in> E"
       
   859       then have "A \<in> sigma_sets (space M1) E" by auto
       
   860       then have "A \<in> sets M1"
       
   861         using gen by simp
       
   862       with f A eq[of A] X show "emeasure (distr M M1 X) A = emeasure (density M1 f) A"
       
   863         by (simp add: emeasure_distr emeasure_density borel_measurable_ereal
       
   864                       times_ereal.simps[symmetric] ereal_indicator
       
   865                  del: times_ereal.simps) }
       
   866     note eq_E = this
       
   867     show "Int_stable E" by fact
       
   868     { fix e assume "e \<in> E"
       
   869       then have "e \<in> sigma_sets (space M1) E" by auto
       
   870       then have "e \<in> sets M1" unfolding gen .
       
   871       then have "e \<subseteq> space M1" by (rule sets.sets_into_space) }
       
   872     then show "E \<subseteq> Pow (space M1)" by auto
       
   873     show "sets (distr M M1 X) = sigma_sets (space M1) E"
       
   874       "sets (density M1 (\<lambda>x. ereal (f x))) = sigma_sets (space M1) E"
       
   875       unfolding gen[symmetric] by auto
       
   876   qed fact+
       
   877 qed (insert X f, auto)
       
   878 
       
   879 lemma distributedI_borel_atMost:
       
   880   fixes f :: "real \<Rightarrow> real"
       
   881   assumes [measurable]: "X \<in> borel_measurable M"
       
   882     and [measurable]: "f \<in> borel_measurable borel" and f[simp]: "AE x in lborel. 0 \<le> f x"
       
   883     and g_eq: "\<And>a. (\<integral>\<^isup>+x. f x * indicator {..a} x \<partial>lborel)  = ereal (g a)"
       
   884     and M_eq: "\<And>a. emeasure M {x\<in>space M. X x \<le> a} = ereal (g a)"
       
   885   shows "distributed M lborel X f"
       
   886 proof (rule distributedI_real)
       
   887   show "sets lborel = sigma_sets (space lborel) (range atMost)"
       
   888     by (simp add: borel_eq_atMost)
       
   889   show "Int_stable (range atMost :: real set set)"
       
   890     by (auto simp: Int_stable_def)
       
   891   have vimage_eq: "\<And>a. (X -` {..a} \<inter> space M) = {x\<in>space M. X x \<le> a}" by auto
       
   892   def A \<equiv> "\<lambda>i::nat. {.. real i}"
       
   893   then show "range A \<subseteq> range atMost" "(\<Union>i. A i) = space lborel"
       
   894     "\<And>i. emeasure (distr M lborel X) (A i) \<noteq> \<infinity>"
       
   895     by (auto simp: real_arch_simple emeasure_distr vimage_eq M_eq)
       
   896 
       
   897   fix A :: "real set" assume "A \<in> range atMost"
       
   898   then obtain a where A: "A = {..a}" by auto
       
   899   show "emeasure M (X -` A \<inter> space M) = (\<integral>\<^isup>+x. f x * indicator A x \<partial>lborel)"
       
   900     unfolding vimage_eq A M_eq g_eq ..
       
   901 qed auto
       
   902 
       
   903 lemma (in prob_space) uniform_distributed_params:
       
   904   assumes X: "distributed M MX X (\<lambda>x. indicator A x / measure MX A)"
       
   905   shows "A \<in> sets MX" "measure MX A \<noteq> 0"
       
   906 proof -
       
   907   interpret X: prob_space "distr M MX X"
       
   908     using distributed_measurable[OF X] by (rule prob_space_distr)
       
   909 
       
   910   show "measure MX A \<noteq> 0"
       
   911   proof
       
   912     assume "measure MX A = 0"
       
   913     with X.emeasure_space_1 X.prob_space distributed_distr_eq_density[OF X]
       
   914     show False
       
   915       by (simp add: emeasure_density zero_ereal_def[symmetric])
       
   916   qed
       
   917   with measure_notin_sets[of A MX] show "A \<in> sets MX"
       
   918     by blast
       
   919 qed
       
   920 
   846 lemma prob_space_uniform_measure:
   921 lemma prob_space_uniform_measure:
   847   assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>"
   922   assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>"
   848   shows "prob_space (uniform_measure M A)"
   923   shows "prob_space (uniform_measure M A)"
   849 proof
   924 proof
   850   show "emeasure (uniform_measure M A) (space (uniform_measure M A)) = 1"
   925   show "emeasure (uniform_measure M A) (space (uniform_measure M A)) = 1"