src/HOL/Probability/Infinite_Product_Measure.thy
 changeset 50000 cfe8ee8a1371 parent 49804 ace9b5a83e60 child 50003 8c213922ed49
```     1.1 --- a/src/HOL/Probability/Infinite_Product_Measure.thy	Fri Nov 02 14:00:39 2012 +0100
1.2 +++ b/src/HOL/Probability/Infinite_Product_Measure.thy	Fri Nov 02 14:00:39 2012 +0100
1.3 @@ -8,6 +8,9 @@
1.4    imports Probability_Measure Caratheodory
1.5  begin
1.6
1.7 +lemma extensional_UNIV[simp]: "extensional UNIV = UNIV"
1.8 +  by (auto simp: extensional_def)
1.9 +
1.10  lemma restrict_extensional_sub[intro]: "A \<subseteq> B \<Longrightarrow> restrict f A \<in> extensional B"
1.11    unfolding restrict_def extensional_def by auto
1.12
1.13 @@ -386,7 +389,7 @@
1.14    proof (rule G.caratheodory_empty_continuous[OF positive_\<mu>G additive_\<mu>G])
1.15      fix A assume "A \<in> ?G"
1.16      with generatorE guess J X . note JX = this
1.17 -    interpret JK: finite_product_prob_space M J by default fact+
1.18 +    interpret JK: finite_product_prob_space M J by default fact+
1.19      from JX show "\<mu>G A \<noteq> \<infinity>" by simp
1.20    next
1.21      fix A assume A: "range A \<subseteq> ?G" "decseq A" "(\<Inter>i. A i) = {}"
1.22 @@ -671,24 +674,140 @@
1.23      by (subst emeasure_PiM_emb_not_empty) (auto simp: emeasure_PiM)
1.24  qed
1.25
1.26 +lemma (in product_prob_space) emeasure_PiM_Collect:
1.27 +  assumes X: "J \<subseteq> I" "finite J" "\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)"
1.28 +  shows "emeasure (Pi\<^isub>M I M) {x\<in>space (Pi\<^isub>M I M). \<forall>i\<in>J. x i \<in> X i} = (\<Prod> i\<in>J. emeasure (M i) (X i))"
1.29 +proof -
1.30 +  have "{x\<in>space (Pi\<^isub>M I M). \<forall>i\<in>J. x i \<in> X i} = emb I J (Pi\<^isub>E J X)"
1.31 +    unfolding prod_emb_def using assms by (auto simp: space_PiM Pi_iff)
1.32 +  with emeasure_PiM_emb[OF assms] show ?thesis by simp
1.33 +qed
1.34 +
1.35 +lemma (in product_prob_space) emeasure_PiM_Collect_single:
1.36 +  assumes X: "i \<in> I" "A \<in> sets (M i)"
1.37 +  shows "emeasure (Pi\<^isub>M I M) {x\<in>space (Pi\<^isub>M I M). x i \<in> A} = emeasure (M i) A"
1.38 +  using emeasure_PiM_Collect[of "{i}" "\<lambda>i. A"] assms
1.39 +  by simp
1.40 +
1.41  lemma (in product_prob_space) measure_PiM_emb:
1.42    assumes "J \<subseteq> I" "finite J" "\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)"
1.43    shows "measure (PiM I M) (emb I J (Pi\<^isub>E J X)) = (\<Prod> i\<in>J. measure (M i) (X i))"
1.44    using emeasure_PiM_emb[OF assms]
1.45    unfolding emeasure_eq_measure M.emeasure_eq_measure by (simp add: setprod_ereal)
1.46
1.47 +lemma sets_Collect_single':
1.48 +  "i \<in> I \<Longrightarrow> {x\<in>space (M i). P x} \<in> sets (M i) \<Longrightarrow> {x\<in>space (PiM I M). P (x i)} \<in> sets (PiM I M)"
1.49 +  using sets_Collect_single[of i I "{x\<in>space (M i). P x}" M]
1.50 +  by (simp add: space_PiM Pi_iff cong: conj_cong)
1.51 +
1.52  lemma (in finite_product_prob_space) finite_measure_PiM_emb:
1.53    "(\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)) \<Longrightarrow> measure (PiM I M) (Pi\<^isub>E I A) = (\<Prod>i\<in>I. measure (M i) (A i))"
1.54    using measure_PiM_emb[of I A] finite_index prod_emb_PiE_same_index[OF sets_into_space, of I A M]
1.55    by auto
1.56
1.57 +lemma (in product_prob_space) PiM_component:
1.58 +  assumes "i \<in> I"
1.59 +  shows "distr (PiM I M) (M i) (\<lambda>\<omega>. \<omega> i) = M i"
1.60 +proof (rule measure_eqI[symmetric])
1.61 +  fix A assume "A \<in> sets (M i)"
1.62 +  moreover have "((\<lambda>\<omega>. \<omega> i) -` A \<inter> space (PiM I M)) = {x\<in>space (PiM I M). x i \<in> A}"
1.63 +    by auto
1.64 +  ultimately show "emeasure (M i) A = emeasure (distr (PiM I M) (M i) (\<lambda>\<omega>. \<omega> i)) A"
1.65 +    by (auto simp: `i\<in>I` emeasure_distr measurable_component_singleton emeasure_PiM_Collect_single)
1.66 +qed simp
1.67 +
1.68 +lemma (in product_prob_space) PiM_eq:
1.69 +  assumes "I \<noteq> {}"
1.70 +  assumes "sets M' = sets (PiM I M)"
1.71 +  assumes eq: "\<And>J F. finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> (\<And>j. j \<in> J \<Longrightarrow> F j \<in> sets (M j)) \<Longrightarrow>
1.72 +    emeasure M' (prod_emb I M J (\<Pi>\<^isub>E j\<in>J. F j)) = (\<Prod>j\<in>J. emeasure (M j) (F j))"
1.73 +  shows "M' = (PiM I M)"
1.74 +proof (rule measure_eqI_generator_eq[symmetric, OF Int_stable_prod_algebra prod_algebra_sets_into_space])
1.75 +  show "sets (PiM I M) = sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) (prod_algebra I M)"
1.76 +    by (rule sets_PiM)
1.77 +  then show "sets M' = sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) (prod_algebra I M)"
1.78 +    unfolding `sets M' = sets (PiM I M)` by simp
1.79 +
1.80 +  def i \<equiv> "SOME i. i \<in> I"
1.81 +  with `I \<noteq> {}` have i: "i \<in> I"
1.82 +    by (auto intro: someI_ex)
1.83 +
1.84 +  def A \<equiv> "\<lambda>n::nat. prod_emb I M {i} (\<Pi>\<^isub>E j\<in>{i}. space (M i))"
1.85 +  then show "range A \<subseteq> prod_algebra I M"
1.86 +    by (auto intro!: prod_algebraI i)
1.87 +
1.88 +  have A_eq: "\<And>i. A i = space (PiM I M)"
1.89 +    by (auto simp: prod_emb_def space_PiM Pi_iff A_def i)
1.90 +  show "(\<Union>i. A i) = (\<Pi>\<^isub>E i\<in>I. space (M i))"
1.91 +    unfolding A_eq by (auto simp: space_PiM)
1.92 +  show "\<And>i. emeasure (PiM I M) (A i) \<noteq> \<infinity>"
1.93 +    unfolding A_eq P.emeasure_space_1 by simp
1.94 +next
1.95 +  fix X assume X: "X \<in> prod_algebra I M"
1.96 +  then obtain J E where X: "X = prod_emb I M J (PIE j:J. E j)"
1.97 +    and J: "finite J" "J \<subseteq> I" "\<And>j. j \<in> J \<Longrightarrow> E j \<in> sets (M j)"
1.98 +    by (force elim!: prod_algebraE)
1.99 +  from eq[OF J] have "emeasure M' X = (\<Prod>j\<in>J. emeasure (M j) (E j))"
1.100 +    by (simp add: X)
1.101 +  also have "\<dots> = emeasure (PiM I M) X"
1.102 +    unfolding X using J by (intro emeasure_PiM_emb[symmetric]) auto
1.103 +  finally show "emeasure (PiM I M) X = emeasure M' X" ..
1.104 +qed
1.105 +
1.106  subsection {* Sequence space *}
1.107
1.108 -locale sequence_space = product_prob_space M "UNIV :: nat set" for M
1.109 +lemma measurable_nat_case: "(\<lambda>(x, \<omega>). nat_case x \<omega>) \<in> measurable (M \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)) (\<Pi>\<^isub>M i\<in>UNIV. M)"
1.110 +proof (rule measurable_PiM_single)
1.111 +  show "(\<lambda>(x, \<omega>). nat_case x \<omega>) \<in> space (M \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)) \<rightarrow> (UNIV \<rightarrow>\<^isub>E space M)"
1.112 +    by (auto simp: space_pair_measure space_PiM Pi_iff split: nat.split)
1.113 +  fix i :: nat and A assume A: "A \<in> sets M"
1.114 +  then have *: "{\<omega> \<in> space (M \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)). prod_case nat_case \<omega> i \<in> A} =
1.115 +    (case i of 0 \<Rightarrow> A \<times> space (\<Pi>\<^isub>M i\<in>UNIV. M) | Suc n \<Rightarrow> space M \<times> {\<omega>\<in>space (\<Pi>\<^isub>M i\<in>UNIV. M). \<omega> n \<in> A})"
1.116 +    by (auto simp: space_PiM space_pair_measure split: nat.split dest: sets_into_space)
1.117 +  show "{\<omega> \<in> space (M \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)). prod_case nat_case \<omega> i \<in> A} \<in> sets (M \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M))"
1.118 +    unfolding * by (auto simp: A split: nat.split intro!: sets_Collect_single)
1.119 +qed
1.120 +
1.121 +lemma measurable_nat_case':
1.122 +  assumes f: "f \<in> measurable N M" and g: "g \<in> measurable N (\<Pi>\<^isub>M i\<in>UNIV. M)"
1.123 +  shows "(\<lambda>x. nat_case (f x) (g x)) \<in> measurable N (\<Pi>\<^isub>M i\<in>UNIV. M)"
1.124 +  using measurable_compose[OF measurable_Pair[OF f g] measurable_nat_case] by simp
1.125 +
1.126 +definition comb_seq :: "nat \<Rightarrow> (nat \<Rightarrow> 'a) \<Rightarrow> (nat \<Rightarrow> 'a) \<Rightarrow> (nat \<Rightarrow> 'a)" where
1.127 +  "comb_seq i \<omega> \<omega>' j = (if j < i then \<omega> j else \<omega>' (j - i))"
1.128 +
1.129 +lemma split_comb_seq: "P (comb_seq i \<omega> \<omega>' j) \<longleftrightarrow> (j < i \<longrightarrow> P (\<omega> j)) \<and> (\<forall>k. j = i + k \<longrightarrow> P (\<omega>' k))"
1.130 +  by (auto simp: comb_seq_def not_less)
1.131 +
1.132 +lemma split_comb_seq_asm: "P (comb_seq i \<omega> \<omega>' j) \<longleftrightarrow> \<not> ((j < i \<and> \<not> P (\<omega> j)) \<or> (\<exists>k. j = i + k \<and> \<not> P (\<omega>' k)))"
1.133 +  by (auto simp: comb_seq_def)
1.134
1.135 -lemma (in sequence_space) infprod_in_sets[intro]:
1.136 -  fixes E :: "nat \<Rightarrow> 'a set" assumes E: "\<And>i. E i \<in> sets (M i)"
1.137 -  shows "Pi UNIV E \<in> sets (Pi\<^isub>M UNIV M)"
1.138 +lemma measurable_comb_seq: "(\<lambda>(\<omega>, \<omega>'). comb_seq i \<omega> \<omega>') \<in> measurable ((\<Pi>\<^isub>M i\<in>UNIV. M) \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)) (\<Pi>\<^isub>M i\<in>UNIV. M)"
1.139 +proof (rule measurable_PiM_single)
1.140 +  show "(\<lambda>(\<omega>, \<omega>'). comb_seq i \<omega> \<omega>') \<in> space ((\<Pi>\<^isub>M i\<in>UNIV. M) \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)) \<rightarrow> (UNIV \<rightarrow>\<^isub>E space M)"
1.141 +    by (auto simp: space_pair_measure space_PiM Pi_iff split: split_comb_seq)
1.142 +  fix j :: nat and A assume A: "A \<in> sets M"
1.143 +  then have *: "{\<omega> \<in> space ((\<Pi>\<^isub>M i\<in>UNIV. M) \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)). prod_case (comb_seq i) \<omega> j \<in> A} =
1.144 +    (if j < i then {\<omega> \<in> space (\<Pi>\<^isub>M i\<in>UNIV. M). \<omega> j \<in> A} \<times> space (\<Pi>\<^isub>M i\<in>UNIV. M)
1.145 +              else space (\<Pi>\<^isub>M i\<in>UNIV. M) \<times> {\<omega> \<in> space (\<Pi>\<^isub>M i\<in>UNIV. M). \<omega> (j - i) \<in> A})"
1.146 +    by (auto simp: space_PiM space_pair_measure comb_seq_def dest: sets_into_space)
1.147 +  show "{\<omega> \<in> space ((\<Pi>\<^isub>M i\<in>UNIV. M) \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M)). prod_case (comb_seq i) \<omega> j \<in> A} \<in> sets ((\<Pi>\<^isub>M i\<in>UNIV. M) \<Otimes>\<^isub>M (\<Pi>\<^isub>M i\<in>UNIV. M))"
1.148 +    unfolding * by (auto simp: A intro!: sets_Collect_single)
1.149 +qed
1.150 +
1.151 +lemma measurable_comb_seq':
1.152 +  assumes f: "f \<in> measurable N (\<Pi>\<^isub>M i\<in>UNIV. M)" and g: "g \<in> measurable N (\<Pi>\<^isub>M i\<in>UNIV. M)"
1.153 +  shows "(\<lambda>x. comb_seq i (f x) (g x)) \<in> measurable N (\<Pi>\<^isub>M i\<in>UNIV. M)"
1.154 +  using measurable_compose[OF measurable_Pair[OF f g] measurable_comb_seq] by simp
1.155 +
1.156 +locale sequence_space = product_prob_space "\<lambda>i. M" "UNIV :: nat set" for M
1.157 +begin
1.158 +
1.159 +abbreviation "S \<equiv> \<Pi>\<^isub>M i\<in>UNIV::nat set. M"
1.160 +
1.161 +lemma infprod_in_sets[intro]:
1.162 +  fixes E :: "nat \<Rightarrow> 'a set" assumes E: "\<And>i. E i \<in> sets M"
1.163 +  shows "Pi UNIV E \<in> sets S"
1.164  proof -
1.165    have "Pi UNIV E = (\<Inter>i. emb UNIV {..i} (\<Pi>\<^isub>E j\<in>{..i}. E j))"
1.166      using E E[THEN sets_into_space]
1.167 @@ -696,17 +815,17 @@
1.168    with E show ?thesis by auto
1.169  qed
1.170
1.171 -lemma (in sequence_space) measure_PiM_countable:
1.172 -  fixes E :: "nat \<Rightarrow> 'a set" assumes E: "\<And>i. E i \<in> sets (M i)"
1.173 -  shows "(\<lambda>n. \<Prod>i\<le>n. measure (M i) (E i)) ----> measure (Pi\<^isub>M UNIV M) (Pi UNIV E)"
1.174 +lemma measure_PiM_countable:
1.175 +  fixes E :: "nat \<Rightarrow> 'a set" assumes E: "\<And>i. E i \<in> sets M"
1.176 +  shows "(\<lambda>n. \<Prod>i\<le>n. measure M (E i)) ----> measure S (Pi UNIV E)"
1.177  proof -
1.178    let ?E = "\<lambda>n. emb UNIV {..n} (Pi\<^isub>E {.. n} E)"
1.179 -  have "\<And>n. (\<Prod>i\<le>n. measure (M i) (E i)) = measure (Pi\<^isub>M UNIV M) (?E n)"
1.180 +  have "\<And>n. (\<Prod>i\<le>n. measure M (E i)) = measure S (?E n)"
1.181      using E by (simp add: measure_PiM_emb)
1.182    moreover have "Pi UNIV E = (\<Inter>n. ?E n)"
1.183      using E E[THEN sets_into_space]
1.184      by (auto simp: prod_emb_def extensional_def Pi_iff) blast
1.185 -  moreover have "range ?E \<subseteq> sets (Pi\<^isub>M UNIV M)"
1.186 +  moreover have "range ?E \<subseteq> sets S"
1.187      using E by auto
1.188    moreover have "decseq ?E"
1.189      by (auto simp: prod_emb_def Pi_iff decseq_def)
1.190 @@ -714,4 +833,72 @@
1.192  qed
1.193
1.194 +lemma nat_eq_diff_eq:
1.195 +  fixes a b c :: nat
1.196 +  shows "c \<le> b \<Longrightarrow> a = b - c \<longleftrightarrow> a + c = b"
1.197 +  by auto
1.198 +
1.199 +lemma PiM_comb_seq:
1.200 +  "distr (S \<Otimes>\<^isub>M S) S (\<lambda>(\<omega>, \<omega>'). comb_seq i \<omega> \<omega>') = S" (is "?D = _")
1.201 +proof (rule PiM_eq)
1.202 +  let ?I = "UNIV::nat set" and ?M = "\<lambda>n. M"
1.203 +  let "distr _ _ ?f" = "?D"
1.204 +
1.205 +  fix J E assume J: "finite J" "J \<subseteq> ?I" "\<And>j. j \<in> J \<Longrightarrow> E j \<in> sets M"
1.206 +  let ?X = "prod_emb ?I ?M J (\<Pi>\<^isub>E j\<in>J. E j)"
1.207 +  have "\<And>j x. j \<in> J \<Longrightarrow> x \<in> E j \<Longrightarrow> x \<in> space M"
1.208 +    using J(3)[THEN sets_into_space] by (auto simp: space_PiM Pi_iff subset_eq)
1.209 +  with J have "?f -` ?X \<inter> space (S \<Otimes>\<^isub>M S) =
1.210 +    (prod_emb ?I ?M (J \<inter> {..<i}) (PIE j:J \<inter> {..<i}. E j)) \<times>
1.211 +    (prod_emb ?I ?M ((op + i) -` J) (PIE j:(op + i) -` J. E (i + j)))" (is "_ = ?E \<times> ?F")
1.212 +   by (auto simp: space_pair_measure space_PiM prod_emb_def all_conj_distrib Pi_iff
1.213 +               split: split_comb_seq split_comb_seq_asm)
1.214 +  then have "emeasure ?D ?X = emeasure (S \<Otimes>\<^isub>M S) (?E \<times> ?F)"
1.215 +    by (subst emeasure_distr[OF measurable_comb_seq])
1.216 +       (auto intro!: sets_PiM_I simp: split_beta' J)
1.217 +  also have "\<dots> = emeasure S ?E * emeasure S ?F"
1.218 +    using J by (intro P.emeasure_pair_measure_Times)  (auto intro!: sets_PiM_I finite_vimageI simp: inj_on_def)
1.219 +  also have "emeasure S ?F = (\<Prod>j\<in>(op + i) -` J. emeasure M (E (i + j)))"
1.220 +    using J by (intro emeasure_PiM_emb) (simp_all add: finite_vimageI inj_on_def)
1.221 +  also have "\<dots> = (\<Prod>j\<in>J - (J \<inter> {..<i}). emeasure M (E j))"
1.222 +    by (rule strong_setprod_reindex_cong[where f="\<lambda>x. x - i"])
1.223 +       (auto simp: image_iff Bex_def not_less nat_eq_diff_eq ac_simps cong: conj_cong intro!: inj_onI)
1.224 +  also have "emeasure S ?E = (\<Prod>j\<in>J \<inter> {..<i}. emeasure M (E j))"
1.225 +    using J by (intro emeasure_PiM_emb) simp_all
1.226 +  also have "(\<Prod>j\<in>J \<inter> {..<i}. emeasure M (E j)) * (\<Prod>j\<in>J - (J \<inter> {..<i}). emeasure M (E j)) = (\<Prod>j\<in>J. emeasure M (E j))"
1.227 +    by (subst mult_commute) (auto simp: J setprod_subset_diff[symmetric])
1.228 +  finally show "emeasure ?D ?X = (\<Prod>j\<in>J. emeasure M (E j))" .
1.229 +qed simp_all
1.230 +
1.231 +lemma PiM_iter:
1.232 +  "distr (M \<Otimes>\<^isub>M S) S (\<lambda>(s, \<omega>). nat_case s \<omega>) = S" (is "?D = _")
1.233 +proof (rule PiM_eq)
1.234 +  let ?I = "UNIV::nat set" and ?M = "\<lambda>n. M"
1.235 +  let "distr _ _ ?f" = "?D"
1.236 +
1.237 +  fix J E assume J: "finite J" "J \<subseteq> ?I" "\<And>j. j \<in> J \<Longrightarrow> E j \<in> sets M"
1.238 +  let ?X = "prod_emb ?I ?M J (PIE j:J. E j)"
1.239 +  have "\<And>j x. j \<in> J \<Longrightarrow> x \<in> E j \<Longrightarrow> x \<in> space M"
1.240 +    using J(3)[THEN sets_into_space] by (auto simp: space_PiM Pi_iff subset_eq)
1.241 +  with J have "?f -` ?X \<inter> space (M \<Otimes>\<^isub>M S) = (if 0 \<in> J then E 0 else space M) \<times>
1.242 +    (prod_emb ?I ?M (Suc -` J) (PIE j:Suc -` J. E (Suc j)))" (is "_ = ?E \<times> ?F")
1.243 +   by (auto simp: space_pair_measure space_PiM Pi_iff prod_emb_def all_conj_distrib
1.244 +      split: nat.split nat.split_asm)
1.245 +  then have "emeasure ?D ?X = emeasure (M \<Otimes>\<^isub>M S) (?E \<times> ?F)"
1.246 +    by (subst emeasure_distr[OF measurable_nat_case])
1.247 +       (auto intro!: sets_PiM_I simp: split_beta' J)
1.248 +  also have "\<dots> = emeasure M ?E * emeasure S ?F"
1.249 +    using J by (intro P.emeasure_pair_measure_Times) (auto intro!: sets_PiM_I finite_vimageI)
1.250 +  also have "emeasure S ?F = (\<Prod>j\<in>Suc -` J. emeasure M (E (Suc j)))"
1.251 +    using J by (intro emeasure_PiM_emb) (simp_all add: finite_vimageI)
1.252 +  also have "\<dots> = (\<Prod>j\<in>J - {0}. emeasure M (E j))"
1.253 +    by (rule strong_setprod_reindex_cong[where f="\<lambda>x. x - 1"])
1.254 +       (auto simp: image_iff Bex_def not_less nat_eq_diff_eq ac_simps cong: conj_cong intro!: inj_onI)
1.255 +  also have "emeasure M ?E * (\<Prod>j\<in>J - {0}. emeasure M (E j)) = (\<Prod>j\<in>J. emeasure M (E j))"
1.256 +    by (auto simp: M.emeasure_space_1 setprod.remove J)
1.257 +  finally show "emeasure ?D ?X = (\<Prod>j\<in>J. emeasure M (E j))" .
1.258 +qed simp_all
1.259 +
1.260 +end
1.261 +
1.262  end
1.263 \ No newline at end of file
```