src/HOL/Probability/Conditional_Probability.thy
changeset 43920 cedb5cb948fd
parent 43556 0d78c8d31d0d
child 46731 5302e932d1e5
equal deleted inserted replaced
43919:a7e4fb1a0502 43920:cedb5cb948fd
    13 definition (in prob_space)
    13 definition (in prob_space)
    14   "conditional_expectation N X = (SOME Y. Y\<in>borel_measurable N \<and> (\<forall>x. 0 \<le> Y x)
    14   "conditional_expectation N X = (SOME Y. Y\<in>borel_measurable N \<and> (\<forall>x. 0 \<le> Y x)
    15     \<and> (\<forall>C\<in>sets N. (\<integral>\<^isup>+x. Y x * indicator C x\<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x\<partial>M)))"
    15     \<and> (\<forall>C\<in>sets N. (\<integral>\<^isup>+x. Y x * indicator C x\<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x\<partial>M)))"
    16 
    16 
    17 lemma (in prob_space) conditional_expectation_exists:
    17 lemma (in prob_space) conditional_expectation_exists:
    18   fixes X :: "'a \<Rightarrow> extreal" and N :: "('a, 'b) measure_space_scheme"
    18   fixes X :: "'a \<Rightarrow> ereal" and N :: "('a, 'b) measure_space_scheme"
    19   assumes borel: "X \<in> borel_measurable M" "AE x. 0 \<le> X x"
    19   assumes borel: "X \<in> borel_measurable M" "AE x. 0 \<le> X x"
    20   and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A"
    20   and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A"
    21   shows "\<exists>Y\<in>borel_measurable N. (\<forall>x. 0 \<le> Y x) \<and> (\<forall>C\<in>sets N.
    21   shows "\<exists>Y\<in>borel_measurable N. (\<forall>x. 0 \<le> Y x) \<and> (\<forall>C\<in>sets N.
    22       (\<integral>\<^isup>+x. Y x * indicator C x \<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x \<partial>M))"
    22       (\<integral>\<^isup>+x. Y x * indicator C x \<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x \<partial>M))"
    23 proof -
    23 proof -
    50   with N(2) show ?thesis
    50   with N(2) show ?thesis
    51     by (auto intro!: bexI[OF _ Y(1)] simp: positive_integral_subalgebra[OF _ _ N(2,3,4,1)])
    51     by (auto intro!: bexI[OF _ Y(1)] simp: positive_integral_subalgebra[OF _ _ N(2,3,4,1)])
    52 qed
    52 qed
    53 
    53 
    54 lemma (in prob_space)
    54 lemma (in prob_space)
    55   fixes X :: "'a \<Rightarrow> extreal" and N :: "('a, 'b) measure_space_scheme"
    55   fixes X :: "'a \<Rightarrow> ereal" and N :: "('a, 'b) measure_space_scheme"
    56   assumes borel: "X \<in> borel_measurable M" "AE x. 0 \<le> X x"
    56   assumes borel: "X \<in> borel_measurable M" "AE x. 0 \<le> X x"
    57   and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A"
    57   and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A"
    58   shows borel_measurable_conditional_expectation:
    58   shows borel_measurable_conditional_expectation:
    59     "conditional_expectation N X \<in> borel_measurable N"
    59     "conditional_expectation N X \<in> borel_measurable N"
    60   and conditional_expectation: "\<And>C. C \<in> sets N \<Longrightarrow>
    60   and conditional_expectation: "\<And>C. C \<in> sets N \<Longrightarrow>
    69   from CE show "\<And>C. C \<in> sets N \<Longrightarrow> ?eq C"
    69   from CE show "\<And>C. C \<in> sets N \<Longrightarrow> ?eq C"
    70     unfolding conditional_expectation_def by (rule someI2_ex) blast
    70     unfolding conditional_expectation_def by (rule someI2_ex) blast
    71 qed
    71 qed
    72 
    72 
    73 lemma (in sigma_algebra) factorize_measurable_function_pos:
    73 lemma (in sigma_algebra) factorize_measurable_function_pos:
    74   fixes Z :: "'a \<Rightarrow> extreal" and Y :: "'a \<Rightarrow> 'c"
    74   fixes Z :: "'a \<Rightarrow> ereal" and Y :: "'a \<Rightarrow> 'c"
    75   assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M"
    75   assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M"
    76   assumes Z: "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y)"
    76   assumes Z: "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y)"
    77   shows "\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. max 0 (Z x) = g (Y x)"
    77   shows "\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. max 0 (Z x) = g (Y x)"
    78 proof -
    78 proof -
    79   interpret M': sigma_algebra M' by fact
    79   interpret M': sigma_algebra M' by fact
    96     show "\<exists>g. simple_function M' g \<and> (\<forall>x\<in>space M. f i x = g (Y x))"
    96     show "\<exists>g. simple_function M' g \<and> (\<forall>x\<in>space M. f i x = g (Y x))"
    97     proof (intro exI[of _ ?g] conjI ballI)
    97     proof (intro exI[of _ ?g] conjI ballI)
    98       show "simple_function M' ?g" using B by auto
    98       show "simple_function M' ?g" using B by auto
    99 
    99 
   100       fix x assume "x \<in> space M"
   100       fix x assume "x \<in> space M"
   101       then have "\<And>z. z \<in> f i`space M \<Longrightarrow> indicator (B z) (Y x) = (indicator (f i -` {z} \<inter> space M) x::extreal)"
   101       then have "\<And>z. z \<in> f i`space M \<Longrightarrow> indicator (B z) (Y x) = (indicator (f i -` {z} \<inter> space M) x::ereal)"
   102         unfolding indicator_def using B by auto
   102         unfolding indicator_def using B by auto
   103       then show "f i x = ?g (Y x)" using `x \<in> space M` f(1)[of i]
   103       then show "f i x = ?g (Y x)" using `x \<in> space M` f(1)[of i]
   104         by (subst va.simple_function_indicator_representation) auto
   104         by (subst va.simple_function_indicator_representation) auto
   105     qed
   105     qed
   106   qed
   106   qed
   117     finally show "max 0 (Z x) = (SUP i. g i (Y x))" .
   117     finally show "max 0 (Z x) = (SUP i. g i (Y x))" .
   118   qed
   118   qed
   119 qed
   119 qed
   120 
   120 
   121 lemma (in sigma_algebra) factorize_measurable_function:
   121 lemma (in sigma_algebra) factorize_measurable_function:
   122   fixes Z :: "'a \<Rightarrow> extreal" and Y :: "'a \<Rightarrow> 'c"
   122   fixes Z :: "'a \<Rightarrow> ereal" and Y :: "'a \<Rightarrow> 'c"
   123   assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M"
   123   assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M"
   124   shows "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y)
   124   shows "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y)
   125     \<longleftrightarrow> (\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x))"
   125     \<longleftrightarrow> (\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x))"
   126 proof safe
   126 proof safe
   127   interpret M': sigma_algebra M' by fact
   127   interpret M': sigma_algebra M' by fact
   128   have Y: "Y \<in> space M \<rightarrow> space M'" using assms unfolding measurable_def by auto
   128   have Y: "Y \<in> space M \<rightarrow> space M'" using assms unfolding measurable_def by auto
   129   from M'.sigma_algebra_vimage[OF this]
   129   from M'.sigma_algebra_vimage[OF this]
   130   interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" .
   130   interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" .
   131 
   131 
   132   { fix g :: "'c \<Rightarrow> extreal" assume "g \<in> borel_measurable M'"
   132   { fix g :: "'c \<Rightarrow> ereal" assume "g \<in> borel_measurable M'"
   133     with M'.measurable_vimage_algebra[OF Y]
   133     with M'.measurable_vimage_algebra[OF Y]
   134     have "g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
   134     have "g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
   135       by (rule measurable_comp)
   135       by (rule measurable_comp)
   136     moreover assume "\<forall>x\<in>space M. Z x = g (Y x)"
   136     moreover assume "\<forall>x\<in>space M. Z x = g (Y x)"
   137     then have "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y) \<longleftrightarrow>
   137     then have "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y) \<longleftrightarrow>