src/HOL/Probability/Product_Measure.thy
author hoelzl
Thu Sep 02 17:28:00 2010 +0200 (2010-09-02)
changeset 39096 111756225292
parent 39092 98de40859858
parent 39095 f92b7e2877c2
child 39097 943c7b348524
permissions -rw-r--r--
merged
hoelzl@35833
     1
theory Product_Measure
hoelzl@38656
     2
imports Lebesgue_Integration
hoelzl@35833
     3
begin
hoelzl@35833
     4
hoelzl@39082
     5
definition "dynkin M \<longleftrightarrow>
hoelzl@39082
     6
  space M \<in> sets M \<and>
hoelzl@39082
     7
  (\<forall> A \<in> sets M. A \<subseteq> space M) \<and>
hoelzl@39082
     8
  (\<forall> a \<in> sets M. \<forall> b \<in> sets M. b - a \<in> sets M) \<and>
hoelzl@39082
     9
  (\<forall>A. disjoint_family A \<and> range A \<subseteq> sets M \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M)"
hellerar@39080
    10
hellerar@39080
    11
lemma dynkinI:
hellerar@39080
    12
  assumes "\<And> A. A \<in> sets M \<Longrightarrow> A \<subseteq> space M"
hellerar@39094
    13
  assumes "space M \<in> sets M" and "\<forall> b \<in> sets M. \<forall> a \<in> sets M. a \<subseteq> b \<longrightarrow> b - a \<in> sets M"
hellerar@39080
    14
  assumes "\<And> a. (\<And> i j :: nat. i \<noteq> j \<Longrightarrow> a i \<inter> a j = {})
hellerar@39080
    15
          \<Longrightarrow> (\<And> i :: nat. a i \<in> sets M) \<Longrightarrow> UNION UNIV a \<in> sets M"
hellerar@39080
    16
  shows "dynkin M"
hoelzl@39082
    17
using assms unfolding dynkin_def sorry
hellerar@39080
    18
hellerar@39080
    19
lemma dynkin_subset:
hellerar@39080
    20
  assumes "dynkin M"
hellerar@39080
    21
  shows "\<And> A. A \<in> sets M \<Longrightarrow> A \<subseteq> space M"
hellerar@39080
    22
using assms unfolding dynkin_def by auto
hellerar@39080
    23
hellerar@39080
    24
lemma dynkin_space:
hellerar@39080
    25
  assumes "dynkin M"
hellerar@39080
    26
  shows "space M \<in> sets M"
hellerar@39080
    27
using assms unfolding dynkin_def by auto
hellerar@39080
    28
hellerar@39080
    29
lemma dynkin_diff:
hellerar@39080
    30
  assumes "dynkin M"
hellerar@39094
    31
  shows "\<And> a b. \<lbrakk> a \<in> sets M ; b \<in> sets M ; a \<subseteq> b \<rbrakk> \<Longrightarrow> b - a \<in> sets M"
hellerar@39080
    32
using assms unfolding dynkin_def by auto
hellerar@39080
    33
hellerar@39094
    34
lemma dynkin_empty:
hellerar@39094
    35
  assumes "dynkin M"
hellerar@39094
    36
  shows "{} \<in> sets M"
hellerar@39094
    37
using dynkin_diff[OF assms dynkin_space[OF assms] dynkin_space[OF assms]] by auto
hellerar@39094
    38
hellerar@39080
    39
lemma dynkin_UN:
hellerar@39080
    40
  assumes "dynkin M"
hellerar@39080
    41
  assumes "\<And> i j :: nat. i \<noteq> j \<Longrightarrow> a i \<inter> a j = {}"
hellerar@39094
    42
  assumes "\<And> i :: nat. a i \<in> sets M"
hellerar@39080
    43
  shows "UNION UNIV a \<in> sets M"
hoelzl@39082
    44
using assms unfolding dynkin_def sorry
hellerar@39080
    45
hoelzl@39082
    46
definition "Int_stable M \<longleftrightarrow> (\<forall> a \<in> sets M. \<forall> b \<in> sets M. a \<inter> b \<in> sets M)"
hellerar@39080
    47
hellerar@39080
    48
lemma dynkin_trivial:
hellerar@39080
    49
  shows "dynkin \<lparr> space = A, sets = Pow A \<rparr>"
hellerar@39080
    50
by (rule dynkinI) auto
hellerar@39080
    51
hellerar@39094
    52
lemma dynkin_lemma:
hoelzl@39082
    53
  fixes D :: "'a algebra"
hellerar@39080
    54
  assumes stab: "Int_stable E"
hellerar@39080
    55
  and spac: "space E = space D"
hellerar@39080
    56
  and subsED: "sets E \<subseteq> sets D"
hellerar@39080
    57
  and subsDE: "sets D \<subseteq> sigma_sets (space E) (sets E)"
hellerar@39080
    58
  and dyn: "dynkin D"
hellerar@39080
    59
  shows "sigma (space E) (sets E) = D"
hellerar@39080
    60
proof -
hellerar@39080
    61
  def sets_\<delta>E == "\<Inter> {sets d | d :: 'a algebra. dynkin d \<and> space d = space E \<and> sets E \<subseteq> sets d}"
hellerar@39080
    62
  def \<delta>E == "\<lparr> space = space E, sets = sets_\<delta>E \<rparr>"
hellerar@39080
    63
  have "\<lparr> space = space E, sets = Pow (space E) \<rparr> \<in> {d | d. dynkin d \<and> space d = space E \<and> sets E \<subseteq> sets d}"
hellerar@39080
    64
    using dynkin_trivial spac subsED dynkin_subset[OF dyn] by fastsimp
hellerar@39080
    65
  hence not_empty: "{sets (d :: 'a algebra) | d. dynkin d \<and> space d = space E \<and> sets E \<subseteq> sets d} \<noteq> {}"
hellerar@39080
    66
    using exI[of "\<lambda> x. space x = space E \<and> dynkin x \<and> sets E \<subseteq> sets x" "\<lparr> space = space E, sets = Pow (space E) \<rparr>", simplified]
hellerar@39080
    67
    by auto
hellerar@39094
    68
  have \<delta>E_D: "sets_\<delta>E \<subseteq> sets D"
hellerar@39080
    69
    unfolding sets_\<delta>E_def using assms by auto
hellerar@39080
    70
  have \<delta>ynkin: "dynkin \<delta>E"
hellerar@39080
    71
  proof (rule dynkinI, safe)
hellerar@39080
    72
    fix A x assume asm: "A \<in> sets \<delta>E" "x \<in> A"
hellerar@39080
    73
    { fix d :: "('a, 'b) algebra_scheme" assume "A \<in> sets d" "dynkin d \<and> space d = space E"
hoelzl@39082
    74
      hence "A \<subseteq> space d" using dynkin_subset by auto }
hoelzl@39082
    75
    show "x \<in> space \<delta>E" using asm unfolding \<delta>E_def sets_\<delta>E_def using not_empty
hoelzl@39082
    76
      by simp (metis dynkin_subset in_mono mem_def)
hellerar@39080
    77
  next
hellerar@39080
    78
    show "space \<delta>E \<in> sets \<delta>E"
hellerar@39080
    79
      unfolding \<delta>E_def sets_\<delta>E_def
hellerar@39080
    80
      using dynkin_space by fastsimp
hellerar@39080
    81
  next
hellerar@39094
    82
    fix a b assume "a \<in> sets \<delta>E" "b \<in> sets \<delta>E" "a \<subseteq> b"
hellerar@39080
    83
    thus "b - a \<in> sets \<delta>E"
hellerar@39080
    84
      unfolding \<delta>E_def sets_\<delta>E_def by (auto intro:dynkin_diff)
hellerar@39080
    85
  next
hellerar@39080
    86
    fix a assume asm: "\<And>i j :: nat. i \<noteq> j \<Longrightarrow> a i \<inter> a j = {}" "\<And>i. a i \<in> sets \<delta>E"
hellerar@39080
    87
    thus "UNION UNIV a \<in> sets \<delta>E"
hellerar@39080
    88
      unfolding \<delta>E_def sets_\<delta>E_def apply (auto intro!:dynkin_UN[OF _ asm(1)])
hellerar@39080
    89
      by blast
hellerar@39080
    90
  qed
hoelzl@39082
    91
hellerar@39080
    92
  def Dy == "\<lambda> d. {A | A. A \<in> sets_\<delta>E \<and> A \<inter> d \<in> sets_\<delta>E}"
hellerar@39080
    93
  { fix d assume dasm: "d \<in> sets_\<delta>E"
hellerar@39080
    94
    have "dynkin \<lparr> space = space E, sets = Dy d \<rparr>"
hoelzl@39082
    95
    proof (rule dynkinI, safe, simp_all)
hellerar@39080
    96
      fix A x assume "A \<in> Dy d" "x \<in> A"
hellerar@39080
    97
      thus "x \<in> space E" unfolding Dy_def sets_\<delta>E_def using not_empty
hoelzl@39082
    98
        by simp (metis dynkin_subset in_mono mem_def)
hellerar@39080
    99
    next
hellerar@39080
   100
      show "space E \<in> Dy d"
hellerar@39080
   101
        unfolding Dy_def \<delta>E_def sets_\<delta>E_def
hellerar@39080
   102
      proof auto
hellerar@39080
   103
        fix d assume asm: "dynkin d" "space d = space E" "sets E \<subseteq> sets d"
hellerar@39080
   104
        hence "space d \<in> sets d" using dynkin_space[OF asm(1)] by auto
hellerar@39080
   105
        thus "space E \<in> sets d" using asm by auto
hellerar@39080
   106
      next
hellerar@39080
   107
        fix da :: "'a algebra" assume asm: "dynkin da" "space da = space E" "sets E \<subseteq> sets da"
hellerar@39080
   108
        have d: "d = space E \<inter> d"
hellerar@39080
   109
          using dasm dynkin_subset[OF asm(1)] asm(2) dynkin_subset[OF \<delta>ynkin]
hellerar@39080
   110
          unfolding \<delta>E_def by auto
hellerar@39080
   111
        hence "space E \<inter> d \<in> sets \<delta>E" unfolding \<delta>E_def
hellerar@39080
   112
          using dasm by auto
hellerar@39080
   113
        have "sets \<delta>E \<subseteq> sets da" unfolding \<delta>E_def sets_\<delta>E_def using asm
hellerar@39080
   114
          by auto
hellerar@39080
   115
        thus "space E \<inter> d \<in> sets da" using dasm asm d dynkin_subset[OF \<delta>ynkin]
hellerar@39080
   116
          unfolding \<delta>E_def by auto
hellerar@39080
   117
      qed
hellerar@39080
   118
    next
hellerar@39094
   119
      fix a b assume absm: "a \<in> Dy d" "b \<in> Dy d" "a \<subseteq> b"
hellerar@39080
   120
      hence "a \<in> sets \<delta>E" "b \<in> sets \<delta>E"
hellerar@39080
   121
        unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   122
      hence *: "b - a \<in> sets \<delta>E"
hellerar@39094
   123
        using dynkin_diff[OF \<delta>ynkin] `a \<subseteq> b` by auto
hellerar@39080
   124
      have "a \<inter> d \<in> sets \<delta>E" "b \<inter> d \<in> sets \<delta>E"
hellerar@39080
   125
        using absm unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   126
      hence "(b \<inter> d) - (a \<inter> d) \<in> sets \<delta>E"
hellerar@39094
   127
        using dynkin_diff[OF \<delta>ynkin] `a \<subseteq> b` by auto
hellerar@39080
   128
      hence **: "(b - a) \<inter> d \<in> sets \<delta>E" by (auto simp add:Diff_Int_distrib2)
hellerar@39080
   129
      thus "b - a \<in> Dy d"
hellerar@39080
   130
        using * ** unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   131
    next
hellerar@39080
   132
      fix a assume aasm: "\<And>i j :: nat. i \<noteq> j \<Longrightarrow> a i \<inter> a j = {}" "\<And>i. a i \<in> Dy d"
hellerar@39094
   133
      hence "\<And> i. a i \<in> sets \<delta>E"
hellerar@39080
   134
        unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   135
      from dynkin_UN[OF \<delta>ynkin aasm(1) this]
hellerar@39080
   136
      have *: "UNION UNIV a \<in> sets \<delta>E" by auto
hellerar@39080
   137
      from aasm
hellerar@39080
   138
      have aE: "\<forall> i. a i \<inter> d \<in> sets \<delta>E"
hellerar@39080
   139
        unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   140
      from aasm
hellerar@39080
   141
      have "\<And>i j :: nat. i \<noteq> j \<Longrightarrow> (a i \<inter> d) \<inter> (a j \<inter> d) = {}" by auto
hellerar@39080
   142
      from dynkin_UN[OF \<delta>ynkin this]
hellerar@39080
   143
      have "UNION UNIV (\<lambda> i. a i \<inter> d) \<in> sets \<delta>E"
hellerar@39080
   144
        using aE by auto
hellerar@39080
   145
      hence **: "UNION UNIV a \<inter> d \<in> sets \<delta>E" by auto
hellerar@39080
   146
      from * ** show "UNION UNIV a \<in> Dy d" unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   147
    qed } note Dy_nkin = this
hellerar@39080
   148
  have E_\<delta>E: "sets E \<subseteq> sets \<delta>E"
hellerar@39080
   149
    unfolding \<delta>E_def sets_\<delta>E_def by auto
hellerar@39080
   150
  { fix d assume dasm: "d \<in> sets \<delta>E"
hellerar@39080
   151
    { fix e assume easm: "e \<in> sets E"
hellerar@39080
   152
      hence deasm: "e \<in> sets \<delta>E"
hellerar@39080
   153
        unfolding \<delta>E_def sets_\<delta>E_def by auto
hellerar@39080
   154
      have subset: "Dy e \<subseteq> sets \<delta>E"
hellerar@39080
   155
        unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   156
      { fix e' assume e'asm: "e' \<in> sets E"
hellerar@39080
   157
        have "e' \<inter> e \<in> sets E"
hellerar@39080
   158
          using easm e'asm stab unfolding Int_stable_def by auto
hellerar@39080
   159
        hence "e' \<inter> e \<in> sets \<delta>E"
hellerar@39080
   160
          unfolding \<delta>E_def sets_\<delta>E_def by auto
hellerar@39080
   161
        hence "e' \<in> Dy e" using e'asm unfolding Dy_def \<delta>E_def sets_\<delta>E_def by auto }
hellerar@39080
   162
      hence E_Dy: "sets E \<subseteq> Dy e" by auto
hellerar@39080
   163
      have "\<lparr> space = space E, sets = Dy e \<rparr> \<in> {d | d. dynkin d \<and> space d = space E \<and> sets E \<subseteq> sets d}"
hellerar@39080
   164
        using Dy_nkin[OF deasm[unfolded \<delta>E_def, simplified]] E_\<delta>E E_Dy by auto
hellerar@39080
   165
      hence "sets_\<delta>E \<subseteq> Dy e"
hoelzl@39082
   166
        unfolding sets_\<delta>E_def by auto (metis E_Dy simps(1) simps(2) spac)
hellerar@39080
   167
      hence "sets \<delta>E = Dy e" using subset unfolding \<delta>E_def by auto
hellerar@39080
   168
      hence "d \<inter> e \<in> sets \<delta>E"
hellerar@39080
   169
        using dasm easm deasm unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   170
      hence "e \<in> Dy d" using deasm
hellerar@39080
   171
        unfolding Dy_def \<delta>E_def
hellerar@39080
   172
        by (auto simp add:Int_commute) }
hellerar@39080
   173
    hence "sets E \<subseteq> Dy d" by auto
hellerar@39080
   174
    hence "sets \<delta>E \<subseteq> Dy d" using Dy_nkin[OF dasm[unfolded \<delta>E_def, simplified]]
hoelzl@39082
   175
      unfolding \<delta>E_def sets_\<delta>E_def
hoelzl@39082
   176
      by auto (metis `sets E <= Dy d` simps(1) simps(2) spac)
hellerar@39080
   177
    hence *: "sets \<delta>E = Dy d"
hellerar@39080
   178
      unfolding Dy_def \<delta>E_def by auto
hellerar@39080
   179
    fix a assume aasm: "a \<in> sets \<delta>E"
hellerar@39080
   180
    hence "a \<inter> d \<in> sets \<delta>E"
hellerar@39080
   181
      using * dasm unfolding Dy_def \<delta>E_def by auto } note \<delta>E_stab = this
hellerar@39094
   182
  { fix A :: "nat \<Rightarrow> 'a set" assume Asm: "range A \<subseteq> sets \<delta>E" "\<And>A. A \<in> sets \<delta>E \<Longrightarrow> A \<subseteq> space \<delta>E"
hellerar@39094
   183
      "\<And>a. a \<in> sets \<delta>E \<Longrightarrow> space \<delta>E - a \<in> sets \<delta>E"
hellerar@39094
   184
    "{} \<in> sets \<delta>E" "space \<delta>E \<in> sets \<delta>E"
hellerar@39094
   185
    let "?A i" = "A i \<inter> (\<Inter> j \<in> {..< i}. space \<delta>E - A j)"
hellerar@39094
   186
    { fix i :: nat
hellerar@39094
   187
      have *: "(\<Inter> j \<in> {..< i}. space \<delta>E - A j) \<inter> space \<delta>E \<in> sets \<delta>E"
hellerar@39094
   188
        apply (induct i)
hellerar@39094
   189
        using lessThan_Suc Asm \<delta>E_stab apply fastsimp
hellerar@39094
   190
        apply (subst lessThan_Suc)
hellerar@39094
   191
        apply (subst INT_insert)
hellerar@39094
   192
        apply (subst Int_assoc)
hellerar@39094
   193
        apply (subst \<delta>E_stab)
hellerar@39094
   194
        using lessThan_Suc Asm \<delta>E_stab Asm
hellerar@39094
   195
        apply (fastsimp simp add:Int_assoc dynkin_diff[OF \<delta>ynkin])
hellerar@39094
   196
        prefer 2 apply simp
hellerar@39094
   197
        apply (rule dynkin_diff[OF \<delta>ynkin, of _ "space \<delta>E", OF _ dynkin_space[OF \<delta>ynkin]])
hellerar@39094
   198
        using Asm by auto
hellerar@39094
   199
      have **: "\<And> i. A i \<subseteq> space \<delta>E" using Asm by auto
hellerar@39094
   200
      have "(\<Inter> j \<in> {..< i}. space \<delta>E - A j) \<subseteq> space \<delta>E \<or> (\<Inter> j \<in> {..< i}. A j) = UNIV \<and> i = 0"
hellerar@39094
   201
        apply (cases i)
hellerar@39094
   202
        using Asm ** dynkin_subset[OF \<delta>ynkin, of "A (i - 1)"]
hellerar@39094
   203
        by auto
hellerar@39094
   204
      hence Aisets: "?A i \<in> sets \<delta>E"
hellerar@39094
   205
        apply (cases i)
hellerar@39094
   206
        using Asm * apply fastsimp
hellerar@39094
   207
        apply (rule \<delta>E_stab)
hellerar@39094
   208
        using Asm * **
hellerar@39094
   209
        by (auto simp add:Int_absorb2)
hellerar@39094
   210
      have "?A i = disjointed A i" unfolding disjointed_def
hellerar@39094
   211
      atLeast0LessThan using Asm by auto
hellerar@39094
   212
      hence "?A i = disjointed A i" "?A i \<in> sets \<delta>E"
hellerar@39094
   213
        using Aisets by auto
hellerar@39094
   214
    } note Ai = this
hellerar@39094
   215
    from dynkin_UN[OF \<delta>ynkin _ this(2)] this disjoint_family_disjointed[of A]
hellerar@39094
   216
    have "(\<Union> i. ?A i) \<in> sets \<delta>E"
hellerar@39094
   217
      by (auto simp add:disjoint_family_on_def disjointed_def)
hellerar@39094
   218
    hence "(\<Union> i. A i) \<in> sets \<delta>E"
hellerar@39094
   219
      using Ai(1) UN_disjointed_eq[of A] by auto } note \<delta>E_UN = this
hellerar@39094
   220
  { fix a b assume asm: "a \<in> sets \<delta>E" "b \<in> sets \<delta>E"
hellerar@39094
   221
    let ?ab = "\<lambda> i. if (i::nat) = 0 then a else if i = 1 then b else {}"
hellerar@39094
   222
    have *: "(\<Union> i. ?ab i) \<in> sets \<delta>E"
hellerar@39094
   223
      apply (rule \<delta>E_UN)
hellerar@39094
   224
      using asm \<delta>E_UN dynkin_empty[OF \<delta>ynkin] 
hellerar@39094
   225
      dynkin_subset[OF \<delta>ynkin] 
hellerar@39094
   226
      dynkin_space[OF \<delta>ynkin]
hellerar@39094
   227
      dynkin_diff[OF \<delta>ynkin] by auto
hellerar@39094
   228
    have "(\<Union> i. ?ab i) = a \<union> b" apply auto
hellerar@39094
   229
      apply (case_tac "i = 0")
hellerar@39094
   230
      apply auto
hellerar@39094
   231
      apply (case_tac "i = 1")
hellerar@39094
   232
      by auto
hellerar@39094
   233
    hence "a \<union> b \<in> sets \<delta>E" using * by auto} note \<delta>E_Un = this
hellerar@39094
   234
  have "sigma_algebra \<delta>E"
hellerar@39080
   235
    apply unfold_locales
hellerar@39094
   236
    using dynkin_subset[OF \<delta>ynkin]
hellerar@39094
   237
    using dynkin_diff[OF \<delta>ynkin, of _ "space \<delta>E", OF _ dynkin_space[OF \<delta>ynkin]]
hellerar@39094
   238
    using dynkin_diff[OF \<delta>ynkin, of "space \<delta>E" "space \<delta>E", OF dynkin_space[OF \<delta>ynkin] dynkin_space[OF \<delta>ynkin]]
hellerar@39094
   239
    using dynkin_space[OF \<delta>ynkin]
hellerar@39094
   240
    using \<delta>E_UN \<delta>E_Un
hellerar@39094
   241
    by auto
hellerar@39094
   242
  from sigma_algebra.sigma_subset[OF this E_\<delta>E] \<delta>E_D subsDE spac
hellerar@39094
   243
  show ?thesis by (auto simp add:\<delta>E_def sigma_def)
hellerar@39094
   244
qed
hellerar@39094
   245
hellerar@39094
   246
lemma measure_eq:
hoelzl@39096
   247
  assumes fin: "\<mu> (space M) = \<nu> (space M)" "\<nu> (space M) < \<omega>"
hellerar@39094
   248
  assumes E: "M = sigma (space E) (sets E)" "Int_stable E"
hellerar@39094
   249
  assumes eq: "\<And> e. e \<in> sets E \<Longrightarrow> \<mu> e = \<nu> e"
hellerar@39094
   250
  assumes ms: "measure_space M \<mu>" "measure_space M \<nu>"
hellerar@39094
   251
  assumes A: "A \<in> sets M"
hellerar@39094
   252
  shows "\<mu> A = \<nu> A"
hellerar@39094
   253
proof -
hellerar@39094
   254
  interpret M: measure_space M \<mu>
hellerar@39094
   255
    using ms by simp
hellerar@39094
   256
  interpret M': measure_space M \<nu>
hellerar@39094
   257
    using ms by simp
hellerar@39094
   258
hellerar@39094
   259
  let ?D_sets = "{A. A \<in> sets M \<and> \<mu> A = \<nu> A}"
hellerar@39094
   260
  have \<delta>: "dynkin \<lparr> space = space M , sets = ?D_sets \<rparr>"
hellerar@39094
   261
  proof (rule dynkinI, safe, simp_all)
hellerar@39094
   262
    fix A x assume "A \<in> sets M \<and> \<mu> A = \<nu> A" "x \<in> A"
hellerar@39094
   263
    thus "x \<in> space M" using assms M.sets_into_space by auto
hellerar@39094
   264
  next
hellerar@39094
   265
    show "\<mu> (space M) = \<nu> (space M)"
hellerar@39094
   266
      using fin by auto
hellerar@39094
   267
  next
hellerar@39094
   268
    fix a b
hellerar@39094
   269
    assume asm: "a \<in> sets M \<and> \<mu> a = \<nu> a"
hellerar@39094
   270
      "b \<in> sets M \<and> \<mu> b = \<nu> b" "a \<subseteq> b"
hellerar@39094
   271
    hence "a \<subseteq> space M"
hellerar@39094
   272
      using M.sets_into_space by auto
hellerar@39094
   273
    from M.measure_mono[OF this]
hellerar@39094
   274
    have "\<mu> a \<le> \<mu> (space M)"
hellerar@39094
   275
      using asm by auto
hellerar@39094
   276
    hence afin: "\<mu> a < \<omega>"
hellerar@39094
   277
      using fin by auto
hellerar@39094
   278
    have *: "b = b - a \<union> a" using asm by auto
hellerar@39094
   279
    have **: "(b - a) \<inter> a = {}" using asm by auto
hellerar@39094
   280
    have iv: "\<mu> (b - a) + \<mu> a = \<mu> b"
hellerar@39094
   281
      using M.measure_additive[of "b - a" a]
hellerar@39094
   282
        conjunct1[OF asm(1)] conjunct1[OF asm(2)] * **
hellerar@39094
   283
      by auto
hellerar@39094
   284
    have v: "\<nu> (b - a) + \<nu> a = \<nu> b"
hellerar@39094
   285
      using M'.measure_additive[of "b - a" a]
hellerar@39094
   286
        conjunct1[OF asm(1)] conjunct1[OF asm(2)] * **
hellerar@39094
   287
      by auto
hellerar@39094
   288
    from iv v have "\<mu> (b - a) = \<nu> (b - a)" using asm afin
hellerar@39094
   289
      pinfreal_add_cancel_right[of "\<mu> (b - a)" "\<nu> a" "\<nu> (b - a)"]
hellerar@39094
   290
      by auto
hellerar@39094
   291
    thus "b - a \<in> sets M \<and> \<mu> (b - a) = \<nu> (b - a)"
hellerar@39094
   292
      using asm by auto
hellerar@39094
   293
  next
hellerar@39094
   294
    fix a assume "\<And>i j :: nat. i \<noteq> j \<Longrightarrow> a i \<inter> a j = {}"
hellerar@39094
   295
      "\<And>i. a i \<in> sets M \<and> \<mu> (a i) = \<nu> (a i)"
hellerar@39094
   296
    thus "(\<Union>x. a x) \<in> sets M \<and> \<mu> (\<Union>x. a x) = \<nu> (\<Union>x. a x)"
hellerar@39094
   297
      using M.measure_countably_additive
hellerar@39094
   298
        M'.measure_countably_additive
hellerar@39094
   299
        M.countable_UN
hellerar@39094
   300
      apply (auto simp add:disjoint_family_on_def image_def)
hellerar@39094
   301
      apply (subst M.measure_countably_additive[symmetric])
hellerar@39094
   302
      apply (auto simp add:disjoint_family_on_def)
hellerar@39094
   303
      apply (subst M'.measure_countably_additive[symmetric])
hellerar@39094
   304
      by (auto simp add:disjoint_family_on_def)
hellerar@39080
   305
  qed
hellerar@39094
   306
  have *: "sets E \<subseteq> ?D_sets"
hellerar@39094
   307
    using eq E sigma_sets.Basic[of _ "sets E"]
hellerar@39094
   308
    by (auto simp add:sigma_def)
hellerar@39094
   309
  have **: "?D_sets \<subseteq> sets M" by auto
hellerar@39094
   310
  have "M = \<lparr> space = space M , sets = ?D_sets \<rparr>"
hellerar@39094
   311
    unfolding E(1)
hellerar@39094
   312
    apply (rule dynkin_lemma[OF E(2)])
hellerar@39094
   313
    using eq E space_sigma \<delta> sigma_sets.Basic
hellerar@39094
   314
    by (auto simp add:sigma_def)
hellerar@39094
   315
  from subst[OF this, of "\<lambda> M. A \<in> sets M", OF A]
hellerar@39094
   316
  show ?thesis by auto
hellerar@39094
   317
qed
hoelzl@39082
   318
hellerar@39094
   319
lemma
hellerar@39094
   320
  assumes sfin: "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And> i :: nat. \<nu> (A i) < \<omega>"
hellerar@39094
   321
  assumes A: "\<And>  i. \<mu> (A i) = \<nu> (A i)" "\<And> i. A i \<subseteq> A (Suc i)"
hellerar@39094
   322
  assumes E: "M = sigma (space E) (sets E)" "Int_stable E"
hellerar@39094
   323
  assumes eq: "\<And> e. e \<in> sets E \<Longrightarrow> \<mu> e = \<nu> e"
hellerar@39094
   324
  assumes ms: "measure_space (M :: 'a algebra) \<mu>" "measure_space M \<nu>"
hellerar@39094
   325
  assumes B: "B \<in> sets M"
hellerar@39094
   326
  shows "\<mu> B = \<nu> B"
hellerar@39094
   327
proof -
hellerar@39094
   328
  interpret M: measure_space M \<mu> by (rule ms)
hellerar@39094
   329
  interpret M': measure_space M \<nu> by (rule ms)
hellerar@39094
   330
  have *: "M = \<lparr> space = space M, sets = sets M \<rparr>" by auto
hellerar@39094
   331
  { fix i :: nat
hellerar@39094
   332
    have **: "M\<lparr> space := A i, sets := op \<inter> (A i) ` sets M \<rparr> =
hellerar@39094
   333
      \<lparr> space = A i, sets = op \<inter> (A i) ` sets M \<rparr>"
hellerar@39094
   334
      by auto
hellerar@39094
   335
    have mu_i: "measure_space \<lparr> space = A i, sets = op \<inter> (A i) ` sets M \<rparr> \<mu>"
hellerar@39094
   336
      using M.restricted_measure_space[of "A i", simplified **]
hellerar@39094
   337
        sfin by auto
hellerar@39094
   338
    have nu_i: "measure_space \<lparr> space = A i, sets = op \<inter> (A i) ` sets M \<rparr> \<nu>"
hellerar@39094
   339
      using M'.restricted_measure_space[of "A i", simplified **]
hellerar@39094
   340
        sfin by auto
hellerar@39094
   341
    let ?M = "\<lparr> space = A i, sets = op \<inter> (A i) ` sets M \<rparr>"
hellerar@39094
   342
    have "\<mu> (A i \<inter> B) = \<nu> (A i \<inter> B)"
hellerar@39094
   343
      apply (rule measure_eq[of \<mu> ?M \<nu> "\<lparr> space = space E \<inter> A i, sets = op \<inter> (A i) ` sets E\<rparr>" "A i \<inter> B", simplified])
hellerar@39094
   344
      using assms nu_i mu_i
hellerar@39095
   345
      apply (auto simp add:image_def) (* TODO *) sorry
hellerar@39095
   346
    show ?thesis sorry
hellerar@39080
   347
qed
hellerar@39080
   348
hoelzl@38656
   349
definition prod_sets where
hoelzl@38656
   350
  "prod_sets A B = {z. \<exists>x \<in> A. \<exists>y \<in> B. z = x \<times> y}"
hoelzl@38656
   351
hoelzl@35833
   352
definition
hoelzl@39088
   353
  "prod_measure_space M1 M2 = sigma (space M1 \<times> space M2) (prod_sets (sets M1) (sets M2))"
hoelzl@39088
   354
hoelzl@39088
   355
lemma
hoelzl@39088
   356
  fixes M1 :: "'a algebra" and M2 :: "'b algebra"
hoelzl@39088
   357
  assumes "algebra M1" "algebra M2"
hoelzl@39088
   358
  shows measureable_fst[intro!, simp]:
hoelzl@39088
   359
    "fst \<in> measurable (prod_measure_space M1 M2) M1" (is ?fst)
hoelzl@39088
   360
  and measureable_snd[intro!, simp]:
hoelzl@39088
   361
    "snd \<in> measurable (prod_measure_space M1 M2) M2" (is ?snd)
hoelzl@39088
   362
proof -
hoelzl@39088
   363
  interpret M1: algebra M1 by fact
hoelzl@39088
   364
  interpret M2: algebra M2 by fact
hoelzl@39088
   365
hoelzl@39088
   366
  { fix X assume "X \<in> sets M1"
hoelzl@39088
   367
    then have "\<exists>X1\<in>sets M1. \<exists>X2\<in>sets M2. fst -` X \<inter> space M1 \<times> space M2 = X1 \<times> X2"
hoelzl@39088
   368
      apply - apply (rule bexI[of _ X]) apply (rule bexI[of _ "space M2"])
hoelzl@39088
   369
      using M1.sets_into_space by force+ }
hoelzl@39088
   370
  moreover
hoelzl@39088
   371
  { fix X assume "X \<in> sets M2"
hoelzl@39088
   372
    then have "\<exists>X1\<in>sets M1. \<exists>X2\<in>sets M2. snd -` X \<inter> space M1 \<times> space M2 = X1 \<times> X2"
hoelzl@39088
   373
      apply - apply (rule bexI[of _ "space M1"]) apply (rule bexI[of _ X])
hoelzl@39088
   374
      using M2.sets_into_space by force+ }
hoelzl@39088
   375
  ultimately show ?fst ?snd
hoelzl@39088
   376
    by (force intro!: sigma_sets.Basic
hoelzl@39088
   377
              simp: measurable_def prod_measure_space_def prod_sets_def sets_sigma)+
hoelzl@39088
   378
qed
hoelzl@39088
   379
hoelzl@39088
   380
lemma (in sigma_algebra) measureable_prod:
hoelzl@39088
   381
  fixes M1 :: "'a algebra" and M2 :: "'b algebra"
hoelzl@39088
   382
  assumes "algebra M1" "algebra M2"
hoelzl@39088
   383
  shows "f \<in> measurable M (prod_measure_space M1 M2) \<longleftrightarrow>
hoelzl@39088
   384
    (fst \<circ> f) \<in> measurable M M1 \<and> (snd \<circ> f) \<in> measurable M M2"
hoelzl@39088
   385
using assms proof (safe intro!: measurable_comp[where b="prod_measure_space M1 M2"])
hoelzl@39088
   386
  interpret M1: algebra M1 by fact
hoelzl@39088
   387
  interpret M2: algebra M2 by fact
hoelzl@39088
   388
  assume f: "(fst \<circ> f) \<in> measurable M M1" and s: "(snd \<circ> f) \<in> measurable M M2"
hoelzl@39088
   389
hoelzl@39088
   390
  show "f \<in> measurable M (prod_measure_space M1 M2)" unfolding prod_measure_space_def
hoelzl@39088
   391
  proof (rule measurable_sigma)
hoelzl@39088
   392
    show "prod_sets (sets M1) (sets M2) \<subseteq> Pow (space M1 \<times> space M2)"
hoelzl@39088
   393
      unfolding prod_sets_def using M1.sets_into_space M2.sets_into_space by auto
hoelzl@39088
   394
    show "f \<in> space M \<rightarrow> space M1 \<times> space M2"
hoelzl@39088
   395
      using f s by (auto simp: mem_Times_iff measurable_def comp_def)
hoelzl@39088
   396
    fix A assume "A \<in> prod_sets (sets M1) (sets M2)"
hoelzl@39088
   397
    then obtain B C where "B \<in> sets M1" "C \<in> sets M2" "A = B \<times> C"
hoelzl@39088
   398
      unfolding prod_sets_def by auto
hoelzl@39088
   399
    moreover have "(fst \<circ> f) -` B \<inter> space M \<in> sets M"
hoelzl@39088
   400
      using f `B \<in> sets M1` unfolding measurable_def by auto
hoelzl@39088
   401
    moreover have "(snd \<circ> f) -` C \<inter> space M \<in> sets M"
hoelzl@39088
   402
      using s `C \<in> sets M2` unfolding measurable_def by auto
hoelzl@39088
   403
    moreover have "f -` A \<inter> space M = ((fst \<circ> f) -` B \<inter> space M) \<inter> ((snd \<circ> f) -` C \<inter> space M)"
hoelzl@39088
   404
      unfolding `A = B \<times> C` by (auto simp: vimage_Times)
hoelzl@39088
   405
    ultimately show "f -` A \<inter> space M \<in> sets M" by auto
hoelzl@39088
   406
  qed
hoelzl@39088
   407
qed
hoelzl@35833
   408
hoelzl@35833
   409
definition
hoelzl@39088
   410
  "prod_measure M \<mu> N \<nu> = (\<lambda>A. measure_space.positive_integral M \<mu> (\<lambda>s0. \<nu> ((\<lambda>s1. (s0, s1)) -` A)))"
hoelzl@38656
   411
hoelzl@38656
   412
lemma prod_setsI: "x \<in> A \<Longrightarrow> y \<in> B \<Longrightarrow> (x \<times> y) \<in> prod_sets A B"
hoelzl@38656
   413
  by (auto simp add: prod_sets_def)
hoelzl@35833
   414
hoelzl@38656
   415
lemma sigma_prod_sets_finite:
hoelzl@38656
   416
  assumes "finite A" and "finite B"
hoelzl@38656
   417
  shows "sigma_sets (A \<times> B) (prod_sets (Pow A) (Pow B)) = Pow (A \<times> B)"
hoelzl@38656
   418
proof safe
hoelzl@38656
   419
  have fin: "finite (A \<times> B)" using assms by (rule finite_cartesian_product)
hoelzl@35833
   420
hoelzl@38656
   421
  fix x assume subset: "x \<subseteq> A \<times> B"
hoelzl@38656
   422
  hence "finite x" using fin by (rule finite_subset)
hoelzl@38656
   423
  from this subset show "x \<in> sigma_sets (A\<times>B) (prod_sets (Pow A) (Pow B))"
hoelzl@38656
   424
    (is "x \<in> sigma_sets ?prod ?sets")
hoelzl@38656
   425
  proof (induct x)
hoelzl@38656
   426
    case empty show ?case by (rule sigma_sets.Empty)
hoelzl@38656
   427
  next
hoelzl@38656
   428
    case (insert a x)
hoelzl@38656
   429
    hence "{a} \<in> sigma_sets ?prod ?sets" by (auto simp: prod_sets_def intro!: sigma_sets.Basic)
hoelzl@38656
   430
    moreover have "x \<in> sigma_sets ?prod ?sets" using insert by auto
hoelzl@38656
   431
    ultimately show ?case unfolding insert_is_Un[of a x] by (rule sigma_sets_Un)
hoelzl@38656
   432
  qed
hoelzl@38656
   433
next
hoelzl@38656
   434
  fix x a b
hoelzl@38656
   435
  assume "x \<in> sigma_sets (A\<times>B) (prod_sets (Pow A) (Pow B))" and "(a, b) \<in> x"
hoelzl@38656
   436
  from sigma_sets_into_sp[OF _ this(1)] this(2)
hoelzl@38656
   437
  show "a \<in> A" and "b \<in> B"
hoelzl@38656
   438
    by (auto simp: prod_sets_def)
hoelzl@35833
   439
qed
hoelzl@35833
   440
hoelzl@38656
   441
lemma (in sigma_algebra) measurable_prod_sigma:
hoelzl@38656
   442
  assumes sa1: "sigma_algebra a1" and sa2: "sigma_algebra a2"
hoelzl@38656
   443
  assumes 1: "(fst o f) \<in> measurable M a1" and 2: "(snd o f) \<in> measurable M a2"
hoelzl@38656
   444
  shows "f \<in> measurable M (sigma ((space a1) \<times> (space a2))
hoelzl@38656
   445
                          (prod_sets (sets a1) (sets a2)))"
hoelzl@35977
   446
proof -
hoelzl@38656
   447
  from 1 have fn1: "fst \<circ> f \<in> space M \<rightarrow> space a1"
hoelzl@38656
   448
     and q1: "\<forall>y\<in>sets a1. (fst \<circ> f) -` y \<inter> space M \<in> sets M"
hoelzl@38656
   449
    by (auto simp add: measurable_def)
hoelzl@38656
   450
  from 2 have fn2: "snd \<circ> f \<in> space M \<rightarrow> space a2"
hoelzl@38656
   451
     and q2: "\<forall>y\<in>sets a2. (snd \<circ> f) -` y \<inter> space M \<in> sets M"
hoelzl@38656
   452
    by (auto simp add: measurable_def)
hoelzl@38656
   453
  show ?thesis
hoelzl@38656
   454
    proof (rule measurable_sigma)
hoelzl@38656
   455
      show "prod_sets (sets a1) (sets a2) \<subseteq> Pow (space a1 \<times> space a2)" using sa1 sa2
hoelzl@38656
   456
        by (auto simp add: prod_sets_def sigma_algebra_iff dest: algebra.space_closed)
hoelzl@38656
   457
    next
hoelzl@38656
   458
      show "f \<in> space M \<rightarrow> space a1 \<times> space a2"
hoelzl@38656
   459
        by (rule prod_final [OF fn1 fn2])
hoelzl@38656
   460
    next
hoelzl@38656
   461
      fix z
hoelzl@38656
   462
      assume z: "z \<in> prod_sets (sets a1) (sets a2)"
hoelzl@38656
   463
      thus "f -` z \<inter> space M \<in> sets M"
hoelzl@38656
   464
        proof (auto simp add: prod_sets_def vimage_Times)
hoelzl@38656
   465
          fix x y
hoelzl@38656
   466
          assume x: "x \<in> sets a1" and y: "y \<in> sets a2"
hoelzl@38656
   467
          have "(fst \<circ> f) -` x \<inter> (snd \<circ> f) -` y \<inter> space M =
hoelzl@38656
   468
                ((fst \<circ> f) -` x \<inter> space M) \<inter> ((snd \<circ> f) -` y \<inter> space M)"
hoelzl@38656
   469
            by blast
hoelzl@38656
   470
          also have "...  \<in> sets M" using x y q1 q2
hoelzl@38656
   471
            by blast
hoelzl@38656
   472
          finally show "(fst \<circ> f) -` x \<inter> (snd \<circ> f) -` y \<inter> space M \<in> sets M" .
hoelzl@38656
   473
        qed
hoelzl@38656
   474
    qed
hoelzl@35977
   475
qed
hoelzl@35833
   476
hoelzl@38656
   477
lemma (in sigma_finite_measure) prod_measure_times:
hoelzl@38656
   478
  assumes "sigma_finite_measure N \<nu>"
hoelzl@38656
   479
  and "A1 \<in> sets M" "A2 \<in> sets N"
hoelzl@38656
   480
  shows "prod_measure M \<mu> N \<nu> (A1 \<times> A2) = \<mu> A1 * \<nu> A2"
hoelzl@38656
   481
  oops
hoelzl@35833
   482
hoelzl@38656
   483
lemma (in sigma_finite_measure) sigma_finite_prod_measure_space:
hoelzl@38656
   484
  assumes "sigma_finite_measure N \<nu>"
hoelzl@38656
   485
  shows "sigma_finite_measure (prod_measure_space M N) (prod_measure M \<mu> N \<nu>)"
hoelzl@38656
   486
  oops
hoelzl@38656
   487
hoelzl@38656
   488
lemma (in finite_measure_space) finite_prod_measure_times:
hoelzl@38656
   489
  assumes "finite_measure_space N \<nu>"
hoelzl@38656
   490
  and "A1 \<in> sets M" "A2 \<in> sets N"
hoelzl@38656
   491
  shows "prod_measure M \<mu> N \<nu> (A1 \<times> A2) = \<mu> A1 * \<nu> A2"
hoelzl@38656
   492
proof -
hoelzl@38656
   493
  interpret N: finite_measure_space N \<nu> by fact
hoelzl@38656
   494
  have *: "\<And>x. \<nu> (Pair x -` (A1 \<times> A2)) * \<mu> {x} = (if x \<in> A1 then \<nu> A2 * \<mu> {x} else 0)"
hoelzl@38656
   495
    by (auto simp: vimage_Times comp_def)
hoelzl@38656
   496
  have "finite A1"
hoelzl@38656
   497
    using `A1 \<in> sets M` finite_space by (auto simp: sets_eq_Pow intro: finite_subset)
hoelzl@38656
   498
  then have "\<mu> A1 = (\<Sum>x\<in>A1. \<mu> {x})" using `A1 \<in> sets M`
hoelzl@38656
   499
    by (auto intro!: measure_finite_singleton simp: sets_eq_Pow)
hoelzl@38656
   500
  then show ?thesis using `A1 \<in> sets M`
hoelzl@38656
   501
    unfolding prod_measure_def positive_integral_finite_eq_setsum *
hoelzl@38656
   502
    by (auto simp add: sets_eq_Pow setsum_right_distrib[symmetric] mult_commute setsum_cases[OF finite_space])
hoelzl@35833
   503
qed
hoelzl@35833
   504
hoelzl@38656
   505
lemma (in finite_measure_space) finite_prod_measure_space:
hoelzl@38656
   506
  assumes "finite_measure_space N \<nu>"
hoelzl@38656
   507
  shows "prod_measure_space M N = \<lparr> space = space M \<times> space N, sets = Pow (space M \<times> space N) \<rparr>"
hoelzl@35977
   508
proof -
hoelzl@38656
   509
  interpret N: finite_measure_space N \<nu> by fact
hoelzl@38656
   510
  show ?thesis using finite_space N.finite_space
hoelzl@38656
   511
    by (simp add: sigma_def prod_measure_space_def sigma_prod_sets_finite sets_eq_Pow N.sets_eq_Pow)
hoelzl@35833
   512
qed
hoelzl@35833
   513
hoelzl@38656
   514
lemma (in finite_measure_space) finite_measure_space_finite_prod_measure:
hoelzl@38656
   515
  assumes "finite_measure_space N \<nu>"
hoelzl@38656
   516
  shows "finite_measure_space (prod_measure_space M N) (prod_measure M \<mu> N \<nu>)"
hoelzl@38656
   517
  unfolding finite_prod_measure_space[OF assms]
hoelzl@38656
   518
proof (rule finite_measure_spaceI)
hoelzl@38656
   519
  interpret N: finite_measure_space N \<nu> by fact
hoelzl@38656
   520
hoelzl@38656
   521
  let ?P = "\<lparr>space = space M \<times> space N, sets = Pow (space M \<times> space N)\<rparr>"
hoelzl@38656
   522
  show "measure_space ?P (prod_measure M \<mu> N \<nu>)"
hoelzl@38656
   523
  proof (rule sigma_algebra.finite_additivity_sufficient)
hoelzl@38656
   524
    show "sigma_algebra ?P" by (rule sigma_algebra_Pow)
hoelzl@38656
   525
    show "finite (space ?P)" using finite_space N.finite_space by auto
hoelzl@38656
   526
    from finite_prod_measure_times[OF assms, of "{}" "{}"]
hoelzl@38656
   527
    show "positive (prod_measure M \<mu> N \<nu>)"
hoelzl@38656
   528
      unfolding positive_def by simp
hoelzl@38656
   529
hoelzl@38656
   530
    show "additive ?P (prod_measure M \<mu> N \<nu>)"
hoelzl@38656
   531
      unfolding additive_def
hoelzl@38656
   532
      apply (auto simp add: sets_eq_Pow prod_measure_def positive_integral_add[symmetric]
hoelzl@38656
   533
                  intro!: positive_integral_cong)
hoelzl@38656
   534
      apply (subst N.measure_additive[symmetric])
hoelzl@38656
   535
      by (auto simp: N.sets_eq_Pow sets_eq_Pow)
hoelzl@38656
   536
  qed
hoelzl@38656
   537
  show "finite (space ?P)" using finite_space N.finite_space by auto
hoelzl@38656
   538
  show "sets ?P = Pow (space ?P)" by simp
hoelzl@38656
   539
hoelzl@38656
   540
  fix x assume "x \<in> space ?P"
hoelzl@38656
   541
  with finite_prod_measure_times[OF assms, of "{fst x}" "{snd x}"]
hoelzl@38656
   542
    finite_measure[of "{fst x}"] N.finite_measure[of "{snd x}"]
hoelzl@38656
   543
  show "prod_measure M \<mu> N \<nu> {x} \<noteq> \<omega>"
hoelzl@38656
   544
    by (auto simp add: sets_eq_Pow N.sets_eq_Pow elim!: SigmaE)
hoelzl@38656
   545
qed
hoelzl@38656
   546
hoelzl@38656
   547
lemma (in finite_measure_space) finite_measure_space_finite_prod_measure_alterantive:
hoelzl@38656
   548
  assumes N: "finite_measure_space N \<nu>"
hoelzl@38656
   549
  shows "finite_measure_space \<lparr> space = space M \<times> space N, sets = Pow (space M \<times> space N) \<rparr> (prod_measure M \<mu> N \<nu>)"
hoelzl@38656
   550
    (is "finite_measure_space ?M ?m")
hoelzl@38656
   551
  unfolding finite_prod_measure_space[OF N, symmetric]
hoelzl@38656
   552
  using finite_measure_space_finite_prod_measure[OF N] .
hoelzl@38656
   553
hellerar@39095
   554
end