src/HOL/Probability/Independent_Family.thy
author hoelzl
Tue May 17 11:47:36 2011 +0200 (2011-05-17)
changeset 42861 16375b493b64
child 42981 fe7f5a26e4c6
permissions -rw-r--r--
Add formalization of probabilistic independence for families of sets
hoelzl@42861
     1
(*  Title:      HOL/Probability/Independent_Family.thy
hoelzl@42861
     2
    Author:     Johannes Hölzl, TU München
hoelzl@42861
     3
*)
hoelzl@42861
     4
hoelzl@42861
     5
header {* Independent families of events, event sets, and random variables *}
hoelzl@42861
     6
hoelzl@42861
     7
theory Independent_Family
hoelzl@42861
     8
  imports Probability_Measure
hoelzl@42861
     9
begin
hoelzl@42861
    10
hoelzl@42861
    11
definition (in prob_space)
hoelzl@42861
    12
  "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)))"
hoelzl@42861
    13
hoelzl@42861
    14
definition (in prob_space)
hoelzl@42861
    15
  "indep_sets F I \<longleftrightarrow> (\<forall>i\<in>I. F i \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow>
hoelzl@42861
    16
    (\<forall>A\<in>(\<Pi> j\<in>J. F j). prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))))"
hoelzl@42861
    17
hoelzl@42861
    18
definition (in prob_space)
hoelzl@42861
    19
  "indep_sets2 A B \<longleftrightarrow> indep_sets (bool_case A B) UNIV"
hoelzl@42861
    20
hoelzl@42861
    21
definition (in prob_space)
hoelzl@42861
    22
  "indep_rv M' X I \<longleftrightarrow>
hoelzl@42861
    23
    (\<forall>i\<in>I. random_variable (M' i) (X i)) \<and>
hoelzl@42861
    24
    indep_sets (\<lambda>i. sigma_sets (space M) { X i -` A \<inter> space M | A. A \<in> sets (M' i)}) I"
hoelzl@42861
    25
hoelzl@42861
    26
lemma (in prob_space) indep_sets_finite_index_sets:
hoelzl@42861
    27
  "indep_sets F I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J)"
hoelzl@42861
    28
proof (intro iffI allI impI)
hoelzl@42861
    29
  assume *: "\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J"
hoelzl@42861
    30
  show "indep_sets F I" unfolding indep_sets_def
hoelzl@42861
    31
  proof (intro conjI ballI allI impI)
hoelzl@42861
    32
    fix i assume "i \<in> I"
hoelzl@42861
    33
    with *[THEN spec, of "{i}"] show "F i \<subseteq> events"
hoelzl@42861
    34
      by (auto simp: indep_sets_def)
hoelzl@42861
    35
  qed (insert *, auto simp: indep_sets_def)
hoelzl@42861
    36
qed (auto simp: indep_sets_def)
hoelzl@42861
    37
hoelzl@42861
    38
lemma (in prob_space) indep_sets_mono_index:
hoelzl@42861
    39
  "J \<subseteq> I \<Longrightarrow> indep_sets F I \<Longrightarrow> indep_sets F J"
hoelzl@42861
    40
  unfolding indep_sets_def by auto
hoelzl@42861
    41
hoelzl@42861
    42
lemma (in prob_space) indep_sets_mono_sets:
hoelzl@42861
    43
  assumes indep: "indep_sets F I"
hoelzl@42861
    44
  assumes mono: "\<And>i. i\<in>I \<Longrightarrow> G i \<subseteq> F i"
hoelzl@42861
    45
  shows "indep_sets G I"
hoelzl@42861
    46
proof -
hoelzl@42861
    47
  have "(\<forall>i\<in>I. F i \<subseteq> events) \<Longrightarrow> (\<forall>i\<in>I. G i \<subseteq> events)"
hoelzl@42861
    48
    using mono by auto
hoelzl@42861
    49
  moreover have "\<And>A J. J \<subseteq> I \<Longrightarrow> A \<in> (\<Pi> j\<in>J. G j) \<Longrightarrow> A \<in> (\<Pi> j\<in>J. F j)"
hoelzl@42861
    50
    using mono by (auto simp: Pi_iff)
hoelzl@42861
    51
  ultimately show ?thesis
hoelzl@42861
    52
    using indep by (auto simp: indep_sets_def)
hoelzl@42861
    53
qed
hoelzl@42861
    54
hoelzl@42861
    55
lemma (in prob_space) indep_setsI:
hoelzl@42861
    56
  assumes "\<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> events"
hoelzl@42861
    57
    and "\<And>A J. J \<noteq> {} \<Longrightarrow> J \<subseteq> I \<Longrightarrow> finite J \<Longrightarrow> (\<forall>j\<in>J. A j \<in> F j) \<Longrightarrow> prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
hoelzl@42861
    58
  shows "indep_sets F I"
hoelzl@42861
    59
  using assms unfolding indep_sets_def by (auto simp: Pi_iff)
hoelzl@42861
    60
hoelzl@42861
    61
lemma (in prob_space) indep_setsD:
hoelzl@42861
    62
  assumes "indep_sets F I" and "J \<subseteq> I" "J \<noteq> {}" "finite J" "\<forall>j\<in>J. A j \<in> F j"
hoelzl@42861
    63
  shows "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
hoelzl@42861
    64
  using assms unfolding indep_sets_def by auto
hoelzl@42861
    65
hoelzl@42861
    66
lemma dynkin_systemI':
hoelzl@42861
    67
  assumes 1: "\<And> A. A \<in> sets M \<Longrightarrow> A \<subseteq> space M"
hoelzl@42861
    68
  assumes empty: "{} \<in> sets M"
hoelzl@42861
    69
  assumes Diff: "\<And> A. A \<in> sets M \<Longrightarrow> space M - A \<in> sets M"
hoelzl@42861
    70
  assumes 2: "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> sets M
hoelzl@42861
    71
          \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
hoelzl@42861
    72
  shows "dynkin_system M"
hoelzl@42861
    73
proof -
hoelzl@42861
    74
  from Diff[OF empty] have "space M \<in> sets M" by auto
hoelzl@42861
    75
  from 1 this Diff 2 show ?thesis
hoelzl@42861
    76
    by (intro dynkin_systemI) auto
hoelzl@42861
    77
qed
hoelzl@42861
    78
hoelzl@42861
    79
lemma (in prob_space) indep_sets_dynkin:
hoelzl@42861
    80
  assumes indep: "indep_sets F I"
hoelzl@42861
    81
  shows "indep_sets (\<lambda>i. sets (dynkin \<lparr> space = space M, sets = F i \<rparr>)) I"
hoelzl@42861
    82
    (is "indep_sets ?F I")
hoelzl@42861
    83
proof (subst indep_sets_finite_index_sets, intro allI impI ballI)
hoelzl@42861
    84
  fix J assume "finite J" "J \<subseteq> I" "J \<noteq> {}"
hoelzl@42861
    85
  with indep have "indep_sets F J"
hoelzl@42861
    86
    by (subst (asm) indep_sets_finite_index_sets) auto
hoelzl@42861
    87
  { fix J K assume "indep_sets F K"
hoelzl@42861
    88
    let "?G S i" = "if i \<in> S then ?F i else F i"
hoelzl@42861
    89
    assume "finite J" "J \<subseteq> K"
hoelzl@42861
    90
    then have "indep_sets (?G J) K"
hoelzl@42861
    91
    proof induct
hoelzl@42861
    92
      case (insert j J)
hoelzl@42861
    93
      moreover def G \<equiv> "?G J"
hoelzl@42861
    94
      ultimately have G: "indep_sets G K" "\<And>i. i \<in> K \<Longrightarrow> G i \<subseteq> events" and "j \<in> K"
hoelzl@42861
    95
        by (auto simp: indep_sets_def)
hoelzl@42861
    96
      let ?D = "{E\<in>events. indep_sets (G(j := {E})) K }"
hoelzl@42861
    97
      { fix X assume X: "X \<in> events"
hoelzl@42861
    98
        assume indep: "\<And>J A. J \<noteq> {} \<Longrightarrow> J \<subseteq> K \<Longrightarrow> finite J \<Longrightarrow> j \<notin> J \<Longrightarrow> (\<forall>i\<in>J. A i \<in> G i)
hoelzl@42861
    99
          \<Longrightarrow> prob ((\<Inter>i\<in>J. A i) \<inter> X) = prob X * (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   100
        have "indep_sets (G(j := {X})) K"
hoelzl@42861
   101
        proof (rule indep_setsI)
hoelzl@42861
   102
          fix i assume "i \<in> K" then show "(G(j:={X})) i \<subseteq> events"
hoelzl@42861
   103
            using G X by auto
hoelzl@42861
   104
        next
hoelzl@42861
   105
          fix A J assume J: "J \<noteq> {}" "J \<subseteq> K" "finite J" "\<forall>i\<in>J. A i \<in> (G(j := {X})) i"
hoelzl@42861
   106
          show "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
hoelzl@42861
   107
          proof cases
hoelzl@42861
   108
            assume "j \<in> J"
hoelzl@42861
   109
            with J have "A j = X" by auto
hoelzl@42861
   110
            show ?thesis
hoelzl@42861
   111
            proof cases
hoelzl@42861
   112
              assume "J = {j}" then show ?thesis by simp
hoelzl@42861
   113
            next
hoelzl@42861
   114
              assume "J \<noteq> {j}"
hoelzl@42861
   115
              have "prob (\<Inter>i\<in>J. A i) = prob ((\<Inter>i\<in>J-{j}. A i) \<inter> X)"
hoelzl@42861
   116
                using `j \<in> J` `A j = X` by (auto intro!: arg_cong[where f=prob] split: split_if_asm)
hoelzl@42861
   117
              also have "\<dots> = prob X * (\<Prod>i\<in>J-{j}. prob (A i))"
hoelzl@42861
   118
              proof (rule indep)
hoelzl@42861
   119
                show "J - {j} \<noteq> {}" "J - {j} \<subseteq> K" "finite (J - {j})" "j \<notin> J - {j}"
hoelzl@42861
   120
                  using J `J \<noteq> {j}` `j \<in> J` by auto
hoelzl@42861
   121
                show "\<forall>i\<in>J - {j}. A i \<in> G i"
hoelzl@42861
   122
                  using J by auto
hoelzl@42861
   123
              qed
hoelzl@42861
   124
              also have "\<dots> = prob (A j) * (\<Prod>i\<in>J-{j}. prob (A i))"
hoelzl@42861
   125
                using `A j = X` by simp
hoelzl@42861
   126
              also have "\<dots> = (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   127
                unfolding setprod.insert_remove[OF `finite J`, symmetric, of "\<lambda>i. prob  (A i)"]
hoelzl@42861
   128
                using `j \<in> J` by (simp add: insert_absorb)
hoelzl@42861
   129
              finally show ?thesis .
hoelzl@42861
   130
            qed
hoelzl@42861
   131
          next
hoelzl@42861
   132
            assume "j \<notin> J"
hoelzl@42861
   133
            with J have "\<forall>i\<in>J. A i \<in> G i" by (auto split: split_if_asm)
hoelzl@42861
   134
            with J show ?thesis
hoelzl@42861
   135
              by (intro indep_setsD[OF G(1)]) auto
hoelzl@42861
   136
          qed
hoelzl@42861
   137
        qed }
hoelzl@42861
   138
      note indep_sets_insert = this
hoelzl@42861
   139
      have "dynkin_system \<lparr> space = space M, sets = ?D \<rparr>"
hoelzl@42861
   140
      proof (rule dynkin_systemI', simp_all, safe)
hoelzl@42861
   141
        show "indep_sets (G(j := {{}})) K"
hoelzl@42861
   142
          by (rule indep_sets_insert) auto
hoelzl@42861
   143
      next
hoelzl@42861
   144
        fix X assume X: "X \<in> events" and G': "indep_sets (G(j := {X})) K"
hoelzl@42861
   145
        show "indep_sets (G(j := {space M - X})) K"
hoelzl@42861
   146
        proof (rule indep_sets_insert)
hoelzl@42861
   147
          fix J A assume J: "J \<noteq> {}" "J \<subseteq> K" "finite J" "j \<notin> J" and A: "\<forall>i\<in>J. A i \<in> G i"
hoelzl@42861
   148
          then have A_sets: "\<And>i. i\<in>J \<Longrightarrow> A i \<in> events"
hoelzl@42861
   149
            using G by auto
hoelzl@42861
   150
          have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) =
hoelzl@42861
   151
              prob ((\<Inter>j\<in>J. A j) - (\<Inter>i\<in>insert j J. (A(j := X)) i))"
hoelzl@42861
   152
            using A_sets sets_into_space X `J \<noteq> {}`
hoelzl@42861
   153
            by (auto intro!: arg_cong[where f=prob] split: split_if_asm)
hoelzl@42861
   154
          also have "\<dots> = prob (\<Inter>j\<in>J. A j) - prob (\<Inter>i\<in>insert j J. (A(j := X)) i)"
hoelzl@42861
   155
            using J `J \<noteq> {}` `j \<notin> J` A_sets X sets_into_space
hoelzl@42861
   156
            by (auto intro!: finite_measure_Diff finite_INT split: split_if_asm)
hoelzl@42861
   157
          finally have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) =
hoelzl@42861
   158
              prob (\<Inter>j\<in>J. A j) - prob (\<Inter>i\<in>insert j J. (A(j := X)) i)" .
hoelzl@42861
   159
          moreover {
hoelzl@42861
   160
            have "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
hoelzl@42861
   161
              using J A `finite J` by (intro indep_setsD[OF G(1)]) auto
hoelzl@42861
   162
            then have "prob (\<Inter>j\<in>J. A j) = prob (space M) * (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   163
              using prob_space by simp }
hoelzl@42861
   164
          moreover {
hoelzl@42861
   165
            have "prob (\<Inter>i\<in>insert j J. (A(j := X)) i) = (\<Prod>i\<in>insert j J. prob ((A(j := X)) i))"
hoelzl@42861
   166
              using J A `j \<in> K` by (intro indep_setsD[OF G']) auto
hoelzl@42861
   167
            then have "prob (\<Inter>i\<in>insert j J. (A(j := X)) i) = prob X * (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   168
              using `finite J` `j \<notin> J` by (auto intro!: setprod_cong) }
hoelzl@42861
   169
          ultimately have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) = (prob (space M) - prob X) * (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   170
            by (simp add: field_simps)
hoelzl@42861
   171
          also have "\<dots> = prob (space M - X) * (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   172
            using X A by (simp add: finite_measure_compl)
hoelzl@42861
   173
          finally show "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) = prob (space M - X) * (\<Prod>i\<in>J. prob (A i))" .
hoelzl@42861
   174
        qed (insert X, auto)
hoelzl@42861
   175
      next
hoelzl@42861
   176
        fix F :: "nat \<Rightarrow> 'a set" assume disj: "disjoint_family F" and "range F \<subseteq> ?D"
hoelzl@42861
   177
        then have F: "\<And>i. F i \<in> events" "\<And>i. indep_sets (G(j:={F i})) K" by auto
hoelzl@42861
   178
        show "indep_sets (G(j := {\<Union>k. F k})) K"
hoelzl@42861
   179
        proof (rule indep_sets_insert)
hoelzl@42861
   180
          fix J A assume J: "j \<notin> J" "J \<noteq> {}" "J \<subseteq> K" "finite J" and A: "\<forall>i\<in>J. A i \<in> G i"
hoelzl@42861
   181
          then have A_sets: "\<And>i. i\<in>J \<Longrightarrow> A i \<in> events"
hoelzl@42861
   182
            using G by auto
hoelzl@42861
   183
          have "prob ((\<Inter>j\<in>J. A j) \<inter> (\<Union>k. F k)) = prob (\<Union>k. (\<Inter>i\<in>insert j J. (A(j := F k)) i))"
hoelzl@42861
   184
            using `J \<noteq> {}` `j \<notin> J` `j \<in> K` by (auto intro!: arg_cong[where f=prob] split: split_if_asm)
hoelzl@42861
   185
          moreover have "(\<lambda>k. prob (\<Inter>i\<in>insert j J. (A(j := F k)) i)) sums prob (\<Union>k. (\<Inter>i\<in>insert j J. (A(j := F k)) i))"
hoelzl@42861
   186
          proof (rule finite_measure_UNION)
hoelzl@42861
   187
            show "disjoint_family (\<lambda>k. \<Inter>i\<in>insert j J. (A(j := F k)) i)"
hoelzl@42861
   188
              using disj by (rule disjoint_family_on_bisimulation) auto
hoelzl@42861
   189
            show "range (\<lambda>k. \<Inter>i\<in>insert j J. (A(j := F k)) i) \<subseteq> events"
hoelzl@42861
   190
              using A_sets F `finite J` `J \<noteq> {}` `j \<notin> J` by (auto intro!: Int)
hoelzl@42861
   191
          qed
hoelzl@42861
   192
          moreover { fix k
hoelzl@42861
   193
            from J A `j \<in> K` have "prob (\<Inter>i\<in>insert j J. (A(j := F k)) i) = prob (F k) * (\<Prod>i\<in>J. prob (A i))"
hoelzl@42861
   194
              by (subst indep_setsD[OF F(2)]) (auto intro!: setprod_cong split: split_if_asm)
hoelzl@42861
   195
            also have "\<dots> = prob (F k) * prob (\<Inter>i\<in>J. A i)"
hoelzl@42861
   196
              using J A `j \<in> K` by (subst indep_setsD[OF G(1)]) auto
hoelzl@42861
   197
            finally have "prob (\<Inter>i\<in>insert j J. (A(j := F k)) i) = prob (F k) * prob (\<Inter>i\<in>J. A i)" . }
hoelzl@42861
   198
          ultimately have "(\<lambda>k. prob (F k) * prob (\<Inter>i\<in>J. A i)) sums (prob ((\<Inter>j\<in>J. A j) \<inter> (\<Union>k. F k)))"
hoelzl@42861
   199
            by simp
hoelzl@42861
   200
          moreover
hoelzl@42861
   201
          have "(\<lambda>k. prob (F k) * prob (\<Inter>i\<in>J. A i)) sums (prob (\<Union>k. F k) * prob (\<Inter>i\<in>J. A i))"
hoelzl@42861
   202
            using disj F(1) by (intro finite_measure_UNION sums_mult2) auto
hoelzl@42861
   203
          then have "(\<lambda>k. prob (F k) * prob (\<Inter>i\<in>J. A i)) sums (prob (\<Union>k. F k) * (\<Prod>i\<in>J. prob (A i)))"
hoelzl@42861
   204
            using J A `j \<in> K` by (subst indep_setsD[OF G(1), symmetric]) auto
hoelzl@42861
   205
          ultimately
hoelzl@42861
   206
          show "prob ((\<Inter>j\<in>J. A j) \<inter> (\<Union>k. F k)) = prob (\<Union>k. F k) * (\<Prod>j\<in>J. prob (A j))"
hoelzl@42861
   207
            by (auto dest!: sums_unique)
hoelzl@42861
   208
        qed (insert F, auto)
hoelzl@42861
   209
      qed (insert sets_into_space, auto)
hoelzl@42861
   210
      then have mono: "sets (dynkin \<lparr>space = space M, sets = G j\<rparr>) \<subseteq>
hoelzl@42861
   211
        sets \<lparr>space = space M, sets = {E \<in> events. indep_sets (G(j := {E})) K}\<rparr>"
hoelzl@42861
   212
      proof (rule dynkin_system.dynkin_subset, simp_all, safe)
hoelzl@42861
   213
        fix X assume "X \<in> G j"
hoelzl@42861
   214
        then show "X \<in> events" using G `j \<in> K` by auto
hoelzl@42861
   215
        from `indep_sets G K`
hoelzl@42861
   216
        show "indep_sets (G(j := {X})) K"
hoelzl@42861
   217
          by (rule indep_sets_mono_sets) (insert `X \<in> G j`, auto)
hoelzl@42861
   218
      qed
hoelzl@42861
   219
      have "indep_sets (G(j:=?D)) K"
hoelzl@42861
   220
      proof (rule indep_setsI)
hoelzl@42861
   221
        fix i assume "i \<in> K" then show "(G(j := ?D)) i \<subseteq> events"
hoelzl@42861
   222
          using G(2) by auto
hoelzl@42861
   223
      next
hoelzl@42861
   224
        fix A J assume J: "J\<noteq>{}" "J \<subseteq> K" "finite J" and A: "\<forall>i\<in>J. A i \<in> (G(j := ?D)) i"
hoelzl@42861
   225
        show "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
hoelzl@42861
   226
        proof cases
hoelzl@42861
   227
          assume "j \<in> J"
hoelzl@42861
   228
          with A have indep: "indep_sets (G(j := {A j})) K" by auto
hoelzl@42861
   229
          from J A show ?thesis
hoelzl@42861
   230
            by (intro indep_setsD[OF indep]) auto
hoelzl@42861
   231
        next
hoelzl@42861
   232
          assume "j \<notin> J"
hoelzl@42861
   233
          with J A have "\<forall>i\<in>J. A i \<in> G i" by (auto split: split_if_asm)
hoelzl@42861
   234
          with J show ?thesis
hoelzl@42861
   235
            by (intro indep_setsD[OF G(1)]) auto
hoelzl@42861
   236
        qed
hoelzl@42861
   237
      qed
hoelzl@42861
   238
      then have "indep_sets (G(j:=sets (dynkin \<lparr>space = space M, sets = G j\<rparr>))) K"
hoelzl@42861
   239
        by (rule indep_sets_mono_sets) (insert mono, auto)
hoelzl@42861
   240
      then show ?case
hoelzl@42861
   241
        by (rule indep_sets_mono_sets) (insert `j \<in> K` `j \<notin> J`, auto simp: G_def)
hoelzl@42861
   242
    qed (insert `indep_sets F K`, simp) }
hoelzl@42861
   243
  from this[OF `indep_sets F J` `finite J` subset_refl]
hoelzl@42861
   244
  show "indep_sets (\<lambda>i. sets (dynkin \<lparr> space = space M, sets = F i \<rparr>)) J"
hoelzl@42861
   245
    by (rule indep_sets_mono_sets) auto
hoelzl@42861
   246
qed
hoelzl@42861
   247
hoelzl@42861
   248
lemma (in prob_space) indep_sets_sigma:
hoelzl@42861
   249
  assumes indep: "indep_sets F I"
hoelzl@42861
   250
  assumes stable: "\<And>i. i \<in> I \<Longrightarrow> Int_stable \<lparr> space = space M, sets = F i \<rparr>"
hoelzl@42861
   251
  shows "indep_sets (\<lambda>i. sets (sigma \<lparr> space = space M, sets = F i \<rparr>)) I"
hoelzl@42861
   252
proof -
hoelzl@42861
   253
  from indep_sets_dynkin[OF indep]
hoelzl@42861
   254
  show ?thesis
hoelzl@42861
   255
  proof (rule indep_sets_mono_sets, subst sigma_eq_dynkin, simp_all add: stable)
hoelzl@42861
   256
    fix i assume "i \<in> I"
hoelzl@42861
   257
    with indep have "F i \<subseteq> events" by (auto simp: indep_sets_def)
hoelzl@42861
   258
    with sets_into_space show "F i \<subseteq> Pow (space M)" by auto
hoelzl@42861
   259
  qed
hoelzl@42861
   260
qed
hoelzl@42861
   261
hoelzl@42861
   262
lemma (in prob_space) indep_sets_sigma_sets:
hoelzl@42861
   263
  assumes "indep_sets F I"
hoelzl@42861
   264
  assumes "\<And>i. i \<in> I \<Longrightarrow> Int_stable \<lparr> space = space M, sets = F i \<rparr>"
hoelzl@42861
   265
  shows "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I"
hoelzl@42861
   266
  using indep_sets_sigma[OF assms] by (simp add: sets_sigma)
hoelzl@42861
   267
hoelzl@42861
   268
lemma (in prob_space) indep_sets2_eq:
hoelzl@42861
   269
  "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)"
hoelzl@42861
   270
  unfolding indep_sets2_def
hoelzl@42861
   271
proof (intro iffI ballI conjI)
hoelzl@42861
   272
  assume indep: "indep_sets (bool_case A B) UNIV"
hoelzl@42861
   273
  { fix a b assume "a \<in> A" "b \<in> B"
hoelzl@42861
   274
    with indep_setsD[OF indep, of UNIV "bool_case a b"]
hoelzl@42861
   275
    show "prob (a \<inter> b) = prob a * prob b"
hoelzl@42861
   276
      unfolding UNIV_bool by (simp add: ac_simps) }
hoelzl@42861
   277
  from indep show "A \<subseteq> events" "B \<subseteq> events"
hoelzl@42861
   278
    unfolding indep_sets_def UNIV_bool by auto
hoelzl@42861
   279
next
hoelzl@42861
   280
  assume *: "A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
hoelzl@42861
   281
  show "indep_sets (bool_case A B) UNIV"
hoelzl@42861
   282
  proof (rule indep_setsI)
hoelzl@42861
   283
    fix i show "(case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events"
hoelzl@42861
   284
      using * by (auto split: bool.split)
hoelzl@42861
   285
  next
hoelzl@42861
   286
    fix J X assume "J \<noteq> {}" "J \<subseteq> UNIV" and X: "\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)"
hoelzl@42861
   287
    then have "J = {True} \<or> J = {False} \<or> J = {True,False}"
hoelzl@42861
   288
      by (auto simp: UNIV_bool)
hoelzl@42861
   289
    then show "prob (\<Inter>j\<in>J. X j) = (\<Prod>j\<in>J. prob (X j))"
hoelzl@42861
   290
      using X * by auto
hoelzl@42861
   291
  qed
hoelzl@42861
   292
qed
hoelzl@42861
   293
hoelzl@42861
   294
lemma (in prob_space) indep_sets2_sigma_sets:
hoelzl@42861
   295
  assumes "indep_sets2 A B"
hoelzl@42861
   296
  assumes A: "Int_stable \<lparr> space = space M, sets = A \<rparr>"
hoelzl@42861
   297
  assumes B: "Int_stable \<lparr> space = space M, sets = B \<rparr>"
hoelzl@42861
   298
  shows "indep_sets2 (sigma_sets (space M) A) (sigma_sets (space M) B)"
hoelzl@42861
   299
proof -
hoelzl@42861
   300
  have "indep_sets (\<lambda>i. sigma_sets (space M) (case i of True \<Rightarrow> A | False \<Rightarrow> B)) UNIV"
hoelzl@42861
   301
  proof (rule indep_sets_sigma_sets)
hoelzl@42861
   302
    show "indep_sets (bool_case A B) UNIV"
hoelzl@42861
   303
      by (rule `indep_sets2 A B`[unfolded indep_sets2_def])
hoelzl@42861
   304
    fix i show "Int_stable \<lparr>space = space M, sets = case i of True \<Rightarrow> A | False \<Rightarrow> B\<rparr>"
hoelzl@42861
   305
      using A B by (cases i) auto
hoelzl@42861
   306
  qed
hoelzl@42861
   307
  then show ?thesis
hoelzl@42861
   308
    unfolding indep_sets2_def
hoelzl@42861
   309
    by (rule indep_sets_mono_sets) (auto split: bool.split)
hoelzl@42861
   310
qed
hoelzl@42861
   311
hoelzl@42861
   312
end