equal
deleted
inserted
replaced
26 abbreviation (in prob_space) "events \<equiv> sets M" |
26 abbreviation (in prob_space) "events \<equiv> sets M" |
27 abbreviation (in prob_space) "prob \<equiv> measure M" |
27 abbreviation (in prob_space) "prob \<equiv> measure M" |
28 abbreviation (in prob_space) "random_variable M' X \<equiv> X \<in> measurable M M'" |
28 abbreviation (in prob_space) "random_variable M' X \<equiv> X \<in> measurable M M'" |
29 abbreviation (in prob_space) "expectation \<equiv> integral\<^sup>L M" |
29 abbreviation (in prob_space) "expectation \<equiv> integral\<^sup>L M" |
30 abbreviation (in prob_space) "variance X \<equiv> integral\<^sup>L M (\<lambda>x. (X x - expectation X)\<^sup>2)" |
30 abbreviation (in prob_space) "variance X \<equiv> integral\<^sup>L M (\<lambda>x. (X x - expectation X)\<^sup>2)" |
|
31 |
|
32 lemma (in prob_space) finite_measure [simp]: "finite_measure M" |
|
33 by unfold_locales |
31 |
34 |
32 lemma (in prob_space) prob_space_distr: |
35 lemma (in prob_space) prob_space_distr: |
33 assumes f: "f \<in> measurable M M'" shows "prob_space (distr M M' f)" |
36 assumes f: "f \<in> measurable M M'" shows "prob_space (distr M M' f)" |
34 proof (rule prob_spaceI) |
37 proof (rule prob_spaceI) |
35 have "f -` space M' \<inter> space M = space M" using f by (auto dest: measurable_space) |
38 have "f -` space M' \<inter> space M = space M" using f by (auto dest: measurable_space) |
342 by (simp add: field_simps prob_space power2_diff power2_eq_square[symmetric]) |
345 by (simp add: field_simps prob_space power2_diff power2_eq_square[symmetric]) |
343 |
346 |
344 lemma (in prob_space) variance_positive: "0 \<le> variance (X::'a \<Rightarrow> real)" |
347 lemma (in prob_space) variance_positive: "0 \<le> variance (X::'a \<Rightarrow> real)" |
345 by (intro integral_nonneg_AE) (auto intro!: integral_nonneg_AE) |
348 by (intro integral_nonneg_AE) (auto intro!: integral_nonneg_AE) |
346 |
349 |
|
350 lemma (in prob_space) variance_mean_zero: |
|
351 "expectation X = 0 \<Longrightarrow> variance X = expectation (\<lambda>x. (X x)^2)" |
|
352 by simp |
|
353 |
347 locale pair_prob_space = pair_sigma_finite M1 M2 + M1: prob_space M1 + M2: prob_space M2 for M1 M2 |
354 locale pair_prob_space = pair_sigma_finite M1 M2 + M1: prob_space M1 + M2: prob_space M2 for M1 M2 |
348 |
355 |
349 sublocale pair_prob_space \<subseteq> P: prob_space "M1 \<Otimes>\<^sub>M M2" |
356 sublocale pair_prob_space \<subseteq> P: prob_space "M1 \<Otimes>\<^sub>M M2" |
350 proof |
357 proof |
351 show "emeasure (M1 \<Otimes>\<^sub>M M2) (space (M1 \<Otimes>\<^sub>M M2)) = 1" |
358 show "emeasure (M1 \<Otimes>\<^sub>M M2) (space (M1 \<Otimes>\<^sub>M M2)) = 1" |
986 and [measurable]: "f \<in> borel_measurable borel" and f[simp]: "AE x in lborel. 0 \<le> f x" |
993 and [measurable]: "f \<in> borel_measurable borel" and f[simp]: "AE x in lborel. 0 \<le> f x" |
987 and g_eq: "\<And>a. (\<integral>\<^sup>+x. f x * indicator {..a} x \<partial>lborel) = ereal (g a)" |
994 and g_eq: "\<And>a. (\<integral>\<^sup>+x. f x * indicator {..a} x \<partial>lborel) = ereal (g a)" |
988 and M_eq: "\<And>a. emeasure M {x\<in>space M. X x \<le> a} = ereal (g a)" |
995 and M_eq: "\<And>a. emeasure M {x\<in>space M. X x \<le> a} = ereal (g a)" |
989 shows "distributed M lborel X f" |
996 shows "distributed M lborel X f" |
990 proof (rule distributedI_real) |
997 proof (rule distributedI_real) |
991 show "sets lborel = sigma_sets (space lborel) (range atMost)" |
998 show "sets (lborel::real measure) = sigma_sets (space lborel) (range atMost)" |
992 by (simp add: borel_eq_atMost) |
999 by (simp add: borel_eq_atMost) |
993 show "Int_stable (range atMost :: real set set)" |
1000 show "Int_stable (range atMost :: real set set)" |
994 by (auto simp: Int_stable_def) |
1001 by (auto simp: Int_stable_def) |
995 have vimage_eq: "\<And>a. (X -` {..a} \<inter> space M) = {x\<in>space M. X x \<le> a}" by auto |
1002 have vimage_eq: "\<And>a. (X -` {..a} \<inter> space M) = {x\<in>space M. X x \<le> a}" by auto |
996 def A \<equiv> "\<lambda>i::nat. {.. real i}" |
1003 def A \<equiv> "\<lambda>i::nat. {.. real i}" |