# HG changeset patch # User hoelzl # Date 1306425579 -7200 # Node ID 40adeda9a8d2c766f558ab8a2a53d43dfed4d9bc # Parent d8f3fc934ff678a9355354ba019ec5438342305b introduce independence of two random variables diff -r d8f3fc934ff6 -r 40adeda9a8d2 src/HOL/Probability/Independent_Family.thy --- a/src/HOL/Probability/Independent_Family.thy Thu May 26 17:40:01 2011 +0200 +++ b/src/HOL/Probability/Independent_Family.thy Thu May 26 17:59:39 2011 +0200 @@ -37,10 +37,13 @@ "indep_set A B \ indep_sets (bool_case A B) UNIV" definition (in prob_space) - "indep_rv M' X I \ + "indep_vars M' X I \ (\i\I. random_variable (M' i) (X i)) \ indep_sets (\i. sigma_sets (space M) { X i -` A \ space M | A. A \ sets (M' i)}) I" +definition (in prob_space) + "indep_var Ma A Mb B \ indep_vars (bool_case Ma Mb) (bool_case A B) UNIV" + lemma (in prob_space) indep_sets_cong[cong]: "I = J \ (\i. i \ I \ F i = G i) \ indep_sets F I \ indep_sets G J" by (simp add: indep_sets_def, intro conj_cong all_cong imp_cong ball_cong) blast+ @@ -694,13 +697,13 @@ qed qed -lemma (in prob_space) indep_rv_finite: +lemma (in prob_space) indep_vars_finite: fixes I :: "'i set" assumes I: "I \ {}" "finite I" and rv: "\i. i \ I \ random_variable (sigma (M' i)) (X i)" and Int_stable: "\i. i \ I \ Int_stable (M' i)" and space: "\i. i \ I \ space (M' i) \ sets (M' i)" - shows "indep_rv (\i. sigma (M' i)) X I \ + shows "indep_vars (\i. sigma (M' i)) X I \ (\A\(\ i\I. sets (M' i)). prob (\j\I. X j -` A j \ space M) = (\j\I. prob (X j -` A j \ space M)))" proof - from rv have X: "\i. i \ I \ X i \ space M \ space (M' i)" @@ -761,28 +764,28 @@ by simp qed then show ?thesis using `I \ {}` - by (simp add: rv indep_rv_def) + by (simp add: rv indep_vars_def) qed -lemma (in prob_space) indep_rv_compose: - assumes "indep_rv M' X I" +lemma (in prob_space) indep_vars_compose: + assumes "indep_vars M' X I" assumes rv: "\i. i \ I \ sigma_algebra (N i)" "\i. i \ I \ Y i \ measurable (M' i) (N i)" - shows "indep_rv N (\i. Y i \ X i) I" - unfolding indep_rv_def + shows "indep_vars N (\i. Y i \ X i) I" + unfolding indep_vars_def proof - from rv `indep_rv M' X I` + from rv `indep_vars M' X I` show "\i\I. random_variable (N i) (Y i \ X i)" - by (auto intro!: measurable_comp simp: indep_rv_def) + by (auto intro!: measurable_comp simp: indep_vars_def) have "indep_sets (\i. sigma_sets (space M) {X i -` A \ space M |A. A \ sets (M' i)}) I" - using `indep_rv M' X I` by (simp add: indep_rv_def) + using `indep_vars M' X I` by (simp add: indep_vars_def) then show "indep_sets (\i. sigma_sets (space M) {(Y i \ X i) -` A \ space M |A. A \ sets (N i)}) I" proof (rule indep_sets_mono_sets) fix i assume "i \ I" - with `indep_rv M' X I` have X: "X i \ space M \ space (M' i)" - unfolding indep_rv_def measurable_def by auto + with `indep_vars M' X I` have X: "X i \ space M \ space (M' i)" + unfolding indep_vars_def measurable_def by auto { fix A assume "A \ sets (N i)" then have "\B. (Y i \ X i) -` A \ space M = X i -` B \ space M \ B \ sets (M' i)" by (intro exI[of _ "Y i -` A \ space (M' i)"]) @@ -793,13 +796,13 @@ qed qed -lemma (in prob_space) indep_rvD: - assumes X: "indep_rv M' X I" +lemma (in prob_space) indep_varsD: + assumes X: "indep_vars M' X I" assumes I: "I \ {}" "finite I" "\i. i \ I \ A i \ sets (M' i)" shows "prob (\i\I. X i -` A i \ space M) = (\i\I. prob (X i -` A i \ space M))" proof (rule indep_setsD) show "indep_sets (\i. sigma_sets (space M) {X i -` A \ space M |A. A \ sets (M' i)}) I" - using X by (auto simp: indep_rv_def) + using X by (auto simp: indep_vars_def) show "I \ I" "I \ {}" "finite I" using I by auto show "\i\I. X i -` A i \ space M \ sigma_sets (space M) {X i -` A \ space M |A. A \ sets (M' i)}" using I by (auto intro: sigma_sets.Basic) @@ -808,7 +811,7 @@ lemma (in prob_space) indep_distribution_eq_measure: assumes I: "I \ {}" "finite I" assumes rv: "\i. random_variable (M' i) (X i)" - shows "indep_rv M' X I \ + shows "indep_vars M' X I \ (\A\sets (\\<^isub>M i\I. (M' i \ measure := extreal\distribution (X i) \)). distribution (\x. \i\I. X i x) A = finite_measure.\' (\\<^isub>M i\I. (M' i \ measure := extreal\distribution (X i) \)) A)" @@ -827,7 +830,7 @@ show ?thesis proof (intro iffI ballI) - assume "indep_rv M' X I" + assume "indep_vars M' X I" fix A assume "A \ sets P.P" moreover have "D.prob A = P.prob A" @@ -856,7 +859,7 @@ with `I \ {}` have "distribution ?D E = prob (\i\I. X i -` F i \ space M)" using `I \ {}` by (auto intro!: arg_cong[where f=prob] simp: Pi_iff distribution_def) also have "\ = (\i\I. prob (X i -` F i \ space M))" - using `indep_rv M' X I` I F by (rule indep_rvD) + using `indep_vars M' X I` I F by (rule indep_varsD) also have "\ = P.prob E" using F by (simp add: `E = Pi\<^isub>E I F` P.prob_times M'.\'_def distribution_def) finally show "D.prob E = P.prob E" . @@ -867,8 +870,8 @@ assume eq: "\A\sets P.P. distribution ?D A = P.prob A" have [simp]: "\i. sigma (M' i) = M' i" using rv by (intro sigma_algebra.sigma_eq) simp - have "indep_rv (\i. sigma (M' i)) X I" - proof (subst indep_rv_finite[OF I]) + have "indep_vars (\i. sigma (M' i)) X I" + proof (subst indep_vars_finite[OF I]) fix i assume [simp]: "i \ I" show "random_variable (sigma (M' i)) (X i)" using rv[of i] by simp @@ -890,9 +893,32 @@ finally show "prob (\j\I. X j -` A j \ space M) = (\j\I. prob (X j -` A j \ space M))" . qed qed - then show "indep_rv M' X I" + then show "indep_vars M' X I" by simp qed qed +lemma (in prob_space) indep_varD: + assumes indep: "indep_var Ma A Mb B" + assumes sets: "Xa \ sets Ma" "Xb \ sets Mb" + shows "prob ((\x. (A x, B x)) -` (Xa \ Xb) \ space M) = + prob (A -` Xa \ space M) * prob (B -` Xb \ space M)" +proof - + have "prob ((\x. (A x, B x)) -` (Xa \ Xb) \ space M) = + prob (\i\UNIV. (bool_case A B i -` bool_case Xa Xb i \ space M))" + by (auto intro!: arg_cong[where f=prob] simp: UNIV_bool) + also have "\ = (\i\UNIV. prob (bool_case A B i -` bool_case Xa Xb i \ space M))" + using indep unfolding indep_var_def + by (rule indep_varsD) (auto split: bool.split intro: sets) + also have "\ = prob (A -` Xa \ space M) * prob (B -` Xb \ space M)" + unfolding UNIV_bool by simp + finally show ?thesis . +qed + +lemma (in prob_space) indep_var_distributionD: + assumes "indep_var Ma A Mb B" + assumes "Xa \ sets Ma" "Xb \ sets Mb" + shows "joint_distribution A B (Xa \ Xb) = distribution A Xa * distribution B Xb" + unfolding distribution_def using assms by (rule indep_varD) + end