src/HOL/Probability/Independent_Family.thy
 changeset 42981 fe7f5a26e4c6 parent 42861 16375b493b64 child 42982 fa0ac7bee9ac
```     1.1 --- a/src/HOL/Probability/Independent_Family.thy	Thu May 26 09:42:04 2011 +0200
1.2 +++ b/src/HOL/Probability/Independent_Family.thy	Thu May 26 14:11:57 2011 +0200
1.3 @@ -9,20 +9,32 @@
1.4  begin
1.5
1.6  definition (in prob_space)
1.7 -  "indep_events A I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j)))"
1.8 +  "indep_events A I \<longleftrightarrow> (A`I \<subseteq> sets M) \<and>
1.9 +    (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j)))"
1.10
1.11  definition (in prob_space)
1.12 -  "indep_sets F I \<longleftrightarrow> (\<forall>i\<in>I. F i \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow>
1.13 -    (\<forall>A\<in>(\<Pi> j\<in>J. F j). prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))))"
1.14 +  "indep_event A B \<longleftrightarrow> indep_events (bool_case A B) UNIV"
1.15
1.16  definition (in prob_space)
1.17 -  "indep_sets2 A B \<longleftrightarrow> indep_sets (bool_case A B) UNIV"
1.18 +  "indep_sets F I \<longleftrightarrow> (\<forall>i\<in>I. F i \<subseteq> sets M) \<and>
1.19 +    (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>Pi J F. prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))))"
1.20 +
1.21 +definition (in prob_space)
1.22 +  "indep_set A B \<longleftrightarrow> indep_sets (bool_case A B) UNIV"
1.23
1.24  definition (in prob_space)
1.25    "indep_rv M' X I \<longleftrightarrow>
1.26      (\<forall>i\<in>I. random_variable (M' i) (X i)) \<and>
1.27      indep_sets (\<lambda>i. sigma_sets (space M) { X i -` A \<inter> space M | A. A \<in> sets (M' i)}) I"
1.28
1.29 +lemma (in prob_space) indep_sets_cong:
1.30 +  "I = J \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i = G i) \<Longrightarrow> indep_sets F I \<longleftrightarrow> indep_sets G J"
1.31 +  by (simp add: indep_sets_def, intro conj_cong all_cong imp_cong ball_cong) blast+
1.32 +
1.33 +lemma (in prob_space) indep_events_finite_index_events:
1.34 +  "indep_events F I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_events F J)"
1.35 +  by (auto simp: indep_events_def)
1.36 +
1.37  lemma (in prob_space) indep_sets_finite_index_sets:
1.38    "indep_sets F I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J)"
1.39  proof (intro iffI allI impI)
1.40 @@ -266,8 +278,8 @@
1.41    using indep_sets_sigma[OF assms] by (simp add: sets_sigma)
1.42
1.43  lemma (in prob_space) indep_sets2_eq:
1.44 -  "indep_sets2 A B \<longleftrightarrow> A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
1.45 -  unfolding indep_sets2_def
1.46 +  "indep_set A B \<longleftrightarrow> A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
1.47 +  unfolding indep_set_def
1.48  proof (intro iffI ballI conjI)
1.49    assume indep: "indep_sets (bool_case A B) UNIV"
1.50    { fix a b assume "a \<in> A" "b \<in> B"
1.51 @@ -291,22 +303,122 @@
1.52    qed
1.53  qed
1.54
1.55 -lemma (in prob_space) indep_sets2_sigma_sets:
1.56 -  assumes "indep_sets2 A B"
1.57 +lemma (in prob_space) indep_set_sigma_sets:
1.58 +  assumes "indep_set A B"
1.59    assumes A: "Int_stable \<lparr> space = space M, sets = A \<rparr>"
1.60    assumes B: "Int_stable \<lparr> space = space M, sets = B \<rparr>"
1.61 -  shows "indep_sets2 (sigma_sets (space M) A) (sigma_sets (space M) B)"
1.62 +  shows "indep_set (sigma_sets (space M) A) (sigma_sets (space M) B)"
1.63  proof -
1.64    have "indep_sets (\<lambda>i. sigma_sets (space M) (case i of True \<Rightarrow> A | False \<Rightarrow> B)) UNIV"
1.65    proof (rule indep_sets_sigma_sets)
1.66      show "indep_sets (bool_case A B) UNIV"
1.67 -      by (rule `indep_sets2 A B`[unfolded indep_sets2_def])
1.68 +      by (rule `indep_set A B`[unfolded indep_set_def])
1.69      fix i show "Int_stable \<lparr>space = space M, sets = case i of True \<Rightarrow> A | False \<Rightarrow> B\<rparr>"
1.70        using A B by (cases i) auto
1.71    qed
1.72    then show ?thesis
1.73 -    unfolding indep_sets2_def
1.74 +    unfolding indep_set_def
1.75      by (rule indep_sets_mono_sets) (auto split: bool.split)
1.76  qed
1.77
1.78 +lemma (in prob_space) indep_sets_collect_sigma:
1.79 +  fixes I :: "'j \<Rightarrow> 'i set" and J :: "'j set" and E :: "'i \<Rightarrow> 'a set set"
1.80 +  assumes indep: "indep_sets E (\<Union>j\<in>J. I j)"
1.81 +  assumes Int_stable: "\<And>i j. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> Int_stable \<lparr>space = space M, sets = E i\<rparr>"
1.82 +  assumes disjoint: "disjoint_family_on I J"
1.83 +  shows "indep_sets (\<lambda>j. sigma_sets (space M) (\<Union>i\<in>I j. E i)) J"
1.84 +proof -
1.85 +  let "?E j" = "{\<Inter>k\<in>K. E' k| E' K. finite K \<and> K \<noteq> {} \<and> K \<subseteq> I j \<and> (\<forall>k\<in>K. E' k \<in> E k) }"
1.86 +
1.87 +  from indep have E: "\<And>j i. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> E i \<subseteq> sets M"
1.88 +    unfolding indep_sets_def by auto
1.89 +  { fix j
1.90 +    let ?S = "sigma \<lparr> space = space M, sets = (\<Union>i\<in>I j. E i) \<rparr>"
1.91 +    assume "j \<in> J"
1.92 +    from E[OF this] interpret S: sigma_algebra ?S
1.93 +      using sets_into_space by (intro sigma_algebra_sigma) auto
1.94 +
1.95 +    have "sigma_sets (space M) (\<Union>i\<in>I j. E i) = sigma_sets (space M) (?E j)"
1.96 +    proof (rule sigma_sets_eqI)
1.97 +      fix A assume "A \<in> (\<Union>i\<in>I j. E i)"
1.98 +      then guess i ..
1.99 +      then show "A \<in> sigma_sets (space M) (?E j)"
1.100 +        by (auto intro!: sigma_sets.intros exI[of _ "{i}"] exI[of _ "\<lambda>i. A"])
1.101 +    next
1.102 +      fix A assume "A \<in> ?E j"
1.103 +      then obtain E' K where "finite K" "K \<noteq> {}" "K \<subseteq> I j" "\<And>k. k \<in> K \<Longrightarrow> E' k \<in> E k"
1.104 +        and A: "A = (\<Inter>k\<in>K. E' k)"
1.105 +        by auto
1.106 +      then have "A \<in> sets ?S" unfolding A
1.107 +        by (safe intro!: S.finite_INT)
1.108 +           (auto simp: sets_sigma intro!: sigma_sets.Basic)
1.109 +      then show "A \<in> sigma_sets (space M) (\<Union>i\<in>I j. E i)"
1.110 +        by (simp add: sets_sigma)
1.111 +    qed }
1.112 +  moreover have "indep_sets (\<lambda>j. sigma_sets (space M) (?E j)) J"
1.113 +  proof (rule indep_sets_sigma_sets)
1.114 +    show "indep_sets ?E J"
1.115 +    proof (intro indep_setsI)
1.116 +      fix j assume "j \<in> J" with E show "?E j \<subseteq> events" by (force  intro!: finite_INT)
1.117 +    next
1.118 +      fix K A assume K: "K \<noteq> {}" "K \<subseteq> J" "finite K"
1.119 +        and "\<forall>j\<in>K. A j \<in> ?E j"
1.120 +      then have "\<forall>j\<in>K. \<exists>E' L. A j = (\<Inter>l\<in>L. E' l) \<and> finite L \<and> L \<noteq> {} \<and> L \<subseteq> I j \<and> (\<forall>l\<in>L. E' l \<in> E l)"
1.121 +        by simp
1.122 +      from bchoice[OF this] guess E' ..
1.123 +      from bchoice[OF this] obtain L
1.124 +        where A: "\<And>j. j\<in>K \<Longrightarrow> A j = (\<Inter>l\<in>L j. E' j l)"
1.125 +        and L: "\<And>j. j\<in>K \<Longrightarrow> finite (L j)" "\<And>j. j\<in>K \<Longrightarrow> L j \<noteq> {}" "\<And>j. j\<in>K \<Longrightarrow> L j \<subseteq> I j"
1.126 +        and E': "\<And>j l. j\<in>K \<Longrightarrow> l \<in> L j \<Longrightarrow> E' j l \<in> E l"
1.127 +        by auto
1.128 +
1.129 +      { fix k l j assume "k \<in> K" "j \<in> K" "l \<in> L j" "l \<in> L k"
1.130 +        have "k = j"
1.131 +        proof (rule ccontr)
1.132 +          assume "k \<noteq> j"
1.133 +          with disjoint `K \<subseteq> J` `k \<in> K` `j \<in> K` have "I k \<inter> I j = {}"
1.134 +            unfolding disjoint_family_on_def by auto
1.135 +          with L(2,3)[OF `j \<in> K`] L(2,3)[OF `k \<in> K`]
1.136 +          show False using `l \<in> L k` `l \<in> L j` by auto
1.137 +        qed }
1.138 +      note L_inj = this
1.139 +
1.140 +      def k \<equiv> "\<lambda>l. (SOME k. k \<in> K \<and> l \<in> L k)"
1.141 +      { fix x j l assume *: "j \<in> K" "l \<in> L j"
1.142 +        have "k l = j" unfolding k_def
1.143 +        proof (rule some_equality)
1.144 +          fix k assume "k \<in> K \<and> l \<in> L k"
1.145 +          with * L_inj show "k = j" by auto
1.146 +        qed (insert *, simp) }
1.147 +      note k_simp[simp] = this
1.148 +      let "?E' l" = "E' (k l) l"
1.149 +      have "prob (\<Inter>j\<in>K. A j) = prob (\<Inter>l\<in>(\<Union>k\<in>K. L k). ?E' l)"
1.150 +        by (auto simp: A intro!: arg_cong[where f=prob])
1.151 +      also have "\<dots> = (\<Prod>l\<in>(\<Union>k\<in>K. L k). prob (?E' l))"
1.152 +        using L K E' by (intro indep_setsD[OF indep]) (simp_all add: UN_mono)
1.153 +      also have "\<dots> = (\<Prod>j\<in>K. \<Prod>l\<in>L j. prob (E' j l))"
1.154 +        using K L L_inj by (subst setprod_UN_disjoint) auto
1.155 +      also have "\<dots> = (\<Prod>j\<in>K. prob (A j))"
1.156 +        using K L E' by (auto simp add: A intro!: setprod_cong indep_setsD[OF indep, symmetric]) blast
1.157 +      finally show "prob (\<Inter>j\<in>K. A j) = (\<Prod>j\<in>K. prob (A j))" .
1.158 +    qed
1.159 +  next
1.160 +    fix j assume "j \<in> J"
1.161 +    show "Int_stable \<lparr> space = space M, sets = ?E j \<rparr>"
1.162 +    proof (rule Int_stableI)
1.163 +      fix a assume "a \<in> ?E j" then obtain Ka Ea
1.164 +        where a: "a = (\<Inter>k\<in>Ka. Ea k)" "finite Ka" "Ka \<noteq> {}" "Ka \<subseteq> I j" "\<And>k. k\<in>Ka \<Longrightarrow> Ea k \<in> E k" by auto
1.165 +      fix b assume "b \<in> ?E j" then obtain Kb Eb
1.166 +        where b: "b = (\<Inter>k\<in>Kb. Eb k)" "finite Kb" "Kb \<noteq> {}" "Kb \<subseteq> I j" "\<And>k. k\<in>Kb \<Longrightarrow> Eb k \<in> E k" by auto
1.167 +      let ?A = "\<lambda>k. (if k \<in> Ka \<inter> Kb then Ea k \<inter> Eb k else if k \<in> Kb then Eb k else if k \<in> Ka then Ea k else {})"
1.168 +      have "a \<inter> b = INTER (Ka \<union> Kb) ?A"
1.169 +        by (simp add: a b set_eq_iff) auto
1.170 +      with a b `j \<in> J` Int_stableD[OF Int_stable] show "a \<inter> b \<in> ?E j"
1.171 +        by (intro CollectI exI[of _ "Ka \<union> Kb"] exI[of _ ?A]) auto
1.172 +    qed
1.173 +  qed
1.174 +  ultimately show ?thesis
1.175 +    by (simp cong: indep_sets_cong)
1.176 +qed
1.177 +
1.178  end
```