author hoelzl
Tue Mar 29 14:27:42 2011 +0200 (2011-03-29)
changeset 42148 d596e7bb251f
parent 42147 61d5d50ca74c
child 42166 efd229daeb2c
permissions -rw-r--r--
rename Probability_Space to Probability_Measure
     1 (*  Title:      HOL/Probability/Infinite_Product_Measure.thy
     2     Author:     Johannes Hölzl, TU München
     3 *)
     5 header {*Infinite Product Measure*}
     7 theory Infinite_Product_Measure
     8   imports Probability_Measure
     9 begin
    11 lemma restrict_extensional_sub[intro]: "A \<subseteq> B \<Longrightarrow> restrict f A \<in> extensional B"
    12   unfolding restrict_def extensional_def by auto
    14 lemma restrict_restrict[simp]: "restrict (restrict f A) B = restrict f (A \<inter> B)"
    15   unfolding restrict_def by (simp add: fun_eq_iff)
    17 lemma split_merge: "P (merge I x J y i) \<longleftrightarrow> (i \<in> I \<longrightarrow> P (x i)) \<and> (i \<in> J - I \<longrightarrow> P (y i)) \<and> (i \<notin> I \<union> J \<longrightarrow> P undefined)"
    18   unfolding merge_def by auto
    20 lemma extensional_merge_sub: "I \<union> J \<subseteq> K \<Longrightarrow> merge I x J y \<in> extensional K"
    21   unfolding merge_def extensional_def by auto
    23 lemma injective_vimage_restrict:
    24   assumes J: "J \<subseteq> I"
    25   and sets: "A \<subseteq> (\<Pi>\<^isub>E i\<in>J. S i)" "B \<subseteq> (\<Pi>\<^isub>E i\<in>J. S i)" and ne: "(\<Pi>\<^isub>E i\<in>I. S i) \<noteq> {}"
    26   and eq: "(\<lambda>x. restrict x J) -` A \<inter> (\<Pi>\<^isub>E i\<in>I. S i) = (\<lambda>x. restrict x J) -` B \<inter> (\<Pi>\<^isub>E i\<in>I. S i)"
    27   shows "A = B"
    28 proof  (intro set_eqI)
    29   fix x
    30   from ne obtain y where y: "\<And>i. i \<in> I \<Longrightarrow> y i \<in> S i" by auto
    31   have "J \<inter> (I - J) = {}" by auto
    32   show "x \<in> A \<longleftrightarrow> x \<in> B"
    33   proof cases
    34     assume x: "x \<in> (\<Pi>\<^isub>E i\<in>J. S i)"
    35     have "x \<in> A \<longleftrightarrow> merge J x (I - J) y \<in> (\<lambda>x. restrict x J) -` A \<inter> (\<Pi>\<^isub>E i\<in>I. S i)"
    36       using y x `J \<subseteq> I` by (auto simp add: Pi_iff extensional_restrict extensional_merge_sub split: split_merge)
    37     then show "x \<in> A \<longleftrightarrow> x \<in> B"
    38       using y x `J \<subseteq> I` by (auto simp add: Pi_iff extensional_restrict extensional_merge_sub eq split: split_merge)
    39   next
    40     assume "x \<notin> (\<Pi>\<^isub>E i\<in>J. S i)" with sets show "x \<in> A \<longleftrightarrow> x \<in> B" by auto
    41   qed
    42 qed
    44 locale product_prob_space =
    45   fixes M :: "'i \<Rightarrow> ('a,'b) measure_space_scheme" and I :: "'i set"
    46   assumes prob_spaces: "\<And>i. prob_space (M i)"
    47   and I_not_empty: "I \<noteq> {}"
    49 locale finite_product_prob_space = product_prob_space M I
    50   for M :: "'i \<Rightarrow> ('a,'b) measure_space_scheme" and I :: "'i set" +
    51   assumes finite_index'[intro]: "finite I"
    53 sublocale product_prob_space \<subseteq> M: prob_space "M i" for i
    54   by (rule prob_spaces)
    56 sublocale product_prob_space \<subseteq> product_sigma_finite
    57   by default
    59 sublocale finite_product_prob_space \<subseteq> finite_product_sigma_finite
    60   by default (fact finite_index')
    62 sublocale finite_product_prob_space \<subseteq> prob_space "Pi\<^isub>M I M"
    63 proof
    64   show "measure P (space P) = 1"
    65     by (simp add: measure_times measure_space_1 setprod_1)
    66 qed
    68 lemma (in product_prob_space) measure_preserving_restrict:
    69   assumes "J \<noteq> {}" "J \<subseteq> K" "finite K"
    70   shows "(\<lambda>f. restrict f J) \<in> measure_preserving (\<Pi>\<^isub>M i\<in>K. M i) (\<Pi>\<^isub>M i\<in>J. M i)" (is "?R \<in> _")
    71 proof -
    72   interpret K: finite_product_prob_space M K
    73     by default (insert assms, auto)
    74   have J: "J \<noteq> {}" "finite J" using assms by (auto simp add: finite_subset)
    75   interpret J: finite_product_prob_space M J
    76     by default (insert J, auto)
    77   from J.sigma_finite_pairs guess F .. note F = this
    78   then have [simp,intro]: "\<And>k i. k \<in> J \<Longrightarrow> F k i \<in> sets (M k)"
    79     by auto
    80   let "?F i" = "\<Pi>\<^isub>E k\<in>J. F k i"
    81   let ?J = "product_algebra_generator J M \<lparr> measure := measure (Pi\<^isub>M J M) \<rparr>"
    82   have "?R \<in> measure_preserving (\<Pi>\<^isub>M i\<in>K. M i) (sigma ?J)"
    83   proof (rule K.measure_preserving_Int_stable)
    84     show "Int_stable ?J"
    85       by (auto simp: Int_stable_def product_algebra_generator_def PiE_Int)
    86     show "range ?F \<subseteq> sets ?J" "incseq ?F" "(\<Union>i. ?F i) = space ?J"
    87       using F by auto
    88     show "\<And>i. measure ?J (?F i) \<noteq> \<infinity>"
    89       using F by (simp add: J.measure_times setprod_PInf)
    90     have "measure_space (Pi\<^isub>M J M)" by default
    91     then show "measure_space (sigma ?J)"
    92       by (simp add: product_algebra_def sigma_def)
    93     show "?R \<in> measure_preserving (Pi\<^isub>M K M) ?J"
    94     proof (simp add: measure_preserving_def measurable_def product_algebra_generator_def del: vimage_Int,
    95            safe intro!: restrict_extensional)
    96       fix x k assume "k \<in> J" "x \<in> (\<Pi> i\<in>K. space (M i))"
    97       then show "x k \<in> space (M k)" using `J \<subseteq> K` by auto
    98     next
    99       fix E assume "E \<in> (\<Pi> i\<in>J. sets (M i))"
   100       then have E: "\<And>j. j \<in> J \<Longrightarrow> E j \<in> sets (M j)" by auto
   101       then have *: "?R -` Pi\<^isub>E J E \<inter> (\<Pi>\<^isub>E i\<in>K. space (M i)) = (\<Pi>\<^isub>E i\<in>K. if i \<in> J then E i else space (M i))"
   102         (is "?X = Pi\<^isub>E K ?M")
   103         using `J \<subseteq> K` sets_into_space by (auto simp: Pi_iff split: split_if_asm) blast+
   104       with E show "?X \<in> sets (Pi\<^isub>M K M)"
   105         by (auto intro!: product_algebra_generatorI)
   106       have "measure (Pi\<^isub>M J M) (Pi\<^isub>E J E) = (\<Prod>i\<in>J. measure (M i) (?M i))"
   107         using E by (simp add: J.measure_times)
   108       also have "\<dots> = measure (Pi\<^isub>M K M) ?X"
   109         unfolding * using E `finite K` `J \<subseteq> K`
   110         by (auto simp: K.measure_times M.measure_space_1
   111                  cong del: setprod_cong
   112                  intro!: setprod_mono_one_left)
   113       finally show "measure (Pi\<^isub>M J M) (Pi\<^isub>E J E) = measure (Pi\<^isub>M K M) ?X" .
   114     qed
   115   qed
   116   then show ?thesis
   117     by (simp add: product_algebra_def sigma_def)
   118 qed
   120 lemma (in product_prob_space) measurable_restrict:
   121   assumes *: "J \<noteq> {}" "J \<subseteq> K" "finite K"
   122   shows "(\<lambda>f. restrict f J) \<in> measurable (\<Pi>\<^isub>M i\<in>K. M i) (\<Pi>\<^isub>M i\<in>J. M i)"
   123   using measure_preserving_restrict[OF *]
   124   by (rule measure_preservingD2)
   126 definition (in product_prob_space)
   127   "emb J K X = (\<lambda>x. restrict x K) -` X \<inter> space (Pi\<^isub>M J M)"
   129 lemma (in product_prob_space) emb_trans[simp]:
   130   "J \<subseteq> K \<Longrightarrow> K \<subseteq> L \<Longrightarrow> emb L K (emb K J X) = emb L J X"
   131   by (auto simp add: Int_absorb1 emb_def)
   133 lemma (in product_prob_space) emb_empty[simp]:
   134   "emb K J {} = {}"
   135   by (simp add: emb_def)
   137 lemma (in product_prob_space) emb_Pi:
   138   assumes "X \<in> (\<Pi> j\<in>J. sets (M j))" "J \<subseteq> K"
   139   shows "emb K J (Pi\<^isub>E J X) = (\<Pi>\<^isub>E i\<in>K. if i \<in> J then X i else space (M i))"
   140   using assms space_closed
   141   by (auto simp: emb_def Pi_iff split: split_if_asm) blast+
   143 lemma (in product_prob_space) emb_injective:
   144   assumes "J \<noteq> {}" "J \<subseteq> L" "finite J" and sets: "X \<in> sets (Pi\<^isub>M J M)" "Y \<in> sets (Pi\<^isub>M J M)"
   145   assumes "emb L J X = emb L J Y"
   146   shows "X = Y"
   147 proof -
   148   interpret J: finite_product_sigma_finite M J by default fact
   149   show "X = Y"
   150   proof (rule injective_vimage_restrict)
   151     show "X \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))" "Y \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
   152       using J.sets_into_space sets by auto
   153     have "\<forall>i\<in>L. \<exists>x. x \<in> space (M i)"
   154       using M.not_empty by auto
   155     from bchoice[OF this]
   156     show "(\<Pi>\<^isub>E i\<in>L. space (M i)) \<noteq> {}" by auto
   157     show "(\<lambda>x. restrict x J) -` X \<inter> (\<Pi>\<^isub>E i\<in>L. space (M i)) = (\<lambda>x. restrict x J) -` Y \<inter> (\<Pi>\<^isub>E i\<in>L. space (M i))"
   158       using `emb L J X = emb L J Y` by (simp add: emb_def)
   159   qed fact
   160 qed
   162 lemma (in product_prob_space) emb_id:
   163   "B \<subseteq> (\<Pi>\<^isub>E i\<in>L. space (M i)) \<Longrightarrow> emb L L B = B"
   164   by (auto simp: emb_def Pi_iff subset_eq extensional_restrict)
   166 lemma (in product_prob_space) emb_simps:
   167   shows "emb L K (A \<union> B) = emb L K A \<union> emb L K B"
   168     and "emb L K (A \<inter> B) = emb L K A \<inter> emb L K B"
   169     and "emb L K (A - B) = emb L K A - emb L K B"
   170   by (auto simp: emb_def)
   172 lemma (in product_prob_space) measurable_emb[intro,simp]:
   173   assumes *: "J \<noteq> {}" "J \<subseteq> L" "finite L" "X \<in> sets (Pi\<^isub>M J M)"
   174   shows "emb L J X \<in> sets (Pi\<^isub>M L M)"
   175   using measurable_restrict[THEN measurable_sets, OF *] by (simp add: emb_def)
   177 lemma (in product_prob_space) measure_emb[intro,simp]:
   178   assumes *: "J \<noteq> {}" "J \<subseteq> L" "finite L" "X \<in> sets (Pi\<^isub>M J M)"
   179   shows "measure (Pi\<^isub>M L M) (emb L J X) = measure (Pi\<^isub>M J M) X"
   180   using measure_preserving_restrict[THEN measure_preservingD, OF *]
   181   by (simp add: emb_def)
   183 definition (in product_prob_space) generator :: "('i \<Rightarrow> 'a) measure_space" where
   184   "generator = \<lparr>
   185     space = (\<Pi>\<^isub>E i\<in>I. space (M i)),
   186     sets = (\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` sets (Pi\<^isub>M J M)),
   187     measure = undefined
   188   \<rparr>"
   190 lemma (in product_prob_space) generatorI:
   191   "J \<noteq> {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> X \<in> sets (Pi\<^isub>M J M) \<Longrightarrow> A = emb I J X \<Longrightarrow> A \<in> sets generator"
   192   unfolding generator_def by auto
   194 lemma (in product_prob_space) generatorI':
   195   "J \<noteq> {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> X \<in> sets (Pi\<^isub>M J M) \<Longrightarrow> emb I J X \<in> sets generator"
   196   unfolding generator_def by auto
   198 lemma (in product_sigma_finite)
   199   assumes "I \<inter> J = {}" "finite I" "finite J" and A: "A \<in> sets (Pi\<^isub>M (I \<union> J) M)"
   200   shows measure_fold_integral:
   201     "measure (Pi\<^isub>M (I \<union> J) M) A = (\<integral>\<^isup>+x. measure (Pi\<^isub>M J M) (merge I x J -` A \<inter> space (Pi\<^isub>M J M)) \<partial>Pi\<^isub>M I M)" (is ?I)
   202     and measure_fold_measurable:
   203     "(\<lambda>x. measure (Pi\<^isub>M J M) (merge I x J -` A \<inter> space (Pi\<^isub>M J M))) \<in> borel_measurable (Pi\<^isub>M I M)" (is ?B)
   204 proof -
   205   interpret I: finite_product_sigma_finite M I by default fact
   206   interpret J: finite_product_sigma_finite M J by default fact
   207   interpret IJ: pair_sigma_finite I.P J.P ..
   208   show ?I
   209     unfolding measure_fold[OF assms]
   210     apply (subst IJ.pair_measure_alt)
   211     apply (intro measurable_sets[OF _ A] measurable_merge assms)
   212     apply (auto simp: vimage_compose[symmetric] comp_def space_pair_measure
   213       intro!: I.positive_integral_cong)
   214     done
   216   have "(\<lambda>(x, y). merge I x J y) -` A \<inter> space (I.P \<Otimes>\<^isub>M J.P) \<in> sets (I.P \<Otimes>\<^isub>M J.P)"
   217     by (intro measurable_sets[OF _ A] measurable_merge assms)
   218   from IJ.measure_cut_measurable_fst[OF this]
   219   show ?B
   220     apply (auto simp: vimage_compose[symmetric] comp_def space_pair_measure)
   221     apply (subst (asm) measurable_cong)
   222     apply auto
   223     done
   224 qed
   226 lemma (in prob_space) measure_le_1: "X \<in> sets M \<Longrightarrow> \<mu> X \<le> 1"
   227   unfolding measure_space_1[symmetric]
   228   using sets_into_space
   229   by (intro measure_mono) auto
   231 definition (in product_prob_space)
   232   "\<mu>G A =
   233     (THE x. \<forall>J. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> J \<subseteq> I \<longrightarrow> (\<forall>X\<in>sets (Pi\<^isub>M J M). A = emb I J X \<longrightarrow> x = measure (Pi\<^isub>M J M) X))"
   235 lemma (in product_prob_space) \<mu>G_spec:
   236   assumes J: "J \<noteq> {}" "finite J" "J \<subseteq> I" "A = emb I J X" "X \<in> sets (Pi\<^isub>M J M)"
   237   shows "\<mu>G A = measure (Pi\<^isub>M J M) X"
   238   unfolding \<mu>G_def
   239 proof (intro the_equality allI impI ballI)
   240   fix K Y assume K: "K \<noteq> {}" "finite K" "K \<subseteq> I" "A = emb I K Y" "Y \<in> sets (Pi\<^isub>M K M)"
   241   have "measure (Pi\<^isub>M K M) Y = measure (Pi\<^isub>M (K \<union> J) M) (emb (K \<union> J) K Y)"
   242     using K J by simp
   243   also have "emb (K \<union> J) K Y = emb (K \<union> J) J X"
   244     using K J by (simp add: emb_injective[of "K \<union> J" I])
   245   also have "measure (Pi\<^isub>M (K \<union> J) M) (emb (K \<union> J) J X) = measure (Pi\<^isub>M J M) X"
   246     using K J by simp
   247   finally show "measure (Pi\<^isub>M J M) X = measure (Pi\<^isub>M K M) Y" ..
   248 qed (insert J, force)
   250 lemma (in product_prob_space) \<mu>G_eq:
   251   "J \<noteq> {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> X \<in> sets (Pi\<^isub>M J M) \<Longrightarrow> \<mu>G (emb I J X) = measure (Pi\<^isub>M J M) X"
   252   by (intro \<mu>G_spec) auto
   254 lemma (in product_prob_space) generator_Ex:
   255   assumes *: "A \<in> sets generator"
   256   shows "\<exists>J X. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I \<and> X \<in> sets (Pi\<^isub>M J M) \<and> A = emb I J X \<and> \<mu>G A = measure (Pi\<^isub>M J M) X"
   257 proof -
   258   from * obtain J X where J: "J \<noteq> {}" "finite J" "J \<subseteq> I" "A = emb I J X" "X \<in> sets (Pi\<^isub>M J M)"
   259     unfolding generator_def by auto
   260   with \<mu>G_spec[OF this] show ?thesis by auto
   261 qed
   263 lemma (in product_prob_space) generatorE:
   264   assumes A: "A \<in> sets generator"
   265   obtains J X where "J \<noteq> {}" "finite J" "J \<subseteq> I" "X \<in> sets (Pi\<^isub>M J M)" "emb I J X = A" "\<mu>G A = measure (Pi\<^isub>M J M) X"
   266 proof -
   267   from generator_Ex[OF A] obtain X J where "J \<noteq> {}" "finite J" "J \<subseteq> I" "X \<in> sets (Pi\<^isub>M J M)" "emb I J X = A"
   268     "\<mu>G A = measure (Pi\<^isub>M J M) X" by auto
   269   then show thesis by (intro that) auto
   270 qed
   272 lemma (in product_prob_space) merge_sets:
   273   assumes "finite J" "finite K" "J \<inter> K = {}" and A: "A \<in> sets (Pi\<^isub>M (J \<union> K) M)" and x: "x \<in> space (Pi\<^isub>M J M)"
   274   shows "merge J x K -` A \<inter> space (Pi\<^isub>M K M) \<in> sets (Pi\<^isub>M K M)"
   275 proof -
   276   interpret J: finite_product_sigma_algebra M J by default fact
   277   interpret K: finite_product_sigma_algebra M K by default fact
   278   interpret JK: pair_sigma_algebra J.P K.P ..
   280   from JK.measurable_cut_fst[OF
   281     measurable_merge[THEN measurable_sets, OF `J \<inter> K = {}`], OF A, of x] x
   282   show ?thesis
   283       by (simp add: space_pair_measure comp_def vimage_compose[symmetric])
   284 qed
   286 lemma (in product_prob_space) merge_emb:
   287   assumes "K \<subseteq> I" "J \<subseteq> I" and y: "y \<in> space (Pi\<^isub>M J M)"
   288   shows "(merge J y (I - J) -` emb I K X \<inter> space (Pi\<^isub>M I M)) =
   289     emb I (K - J) (merge J y (K - J) -` emb (J \<union> K) K X \<inter> space (Pi\<^isub>M (K - J) M))"
   290 proof -
   291   have [simp]: "\<And>x J K L. merge J y K (restrict x L) = merge J y (K \<inter> L) x"
   292     by (auto simp: restrict_def merge_def)
   293   have [simp]: "\<And>x J K L. restrict (merge J y K x) L = merge (J \<inter> L) y (K \<inter> L) x"
   294     by (auto simp: restrict_def merge_def)
   295   have [simp]: "(I - J) \<inter> K = K - J" using `K \<subseteq> I` `J \<subseteq> I` by auto
   296   have [simp]: "(K - J) \<inter> (K \<union> J) = K - J" by auto
   297   have [simp]: "(K - J) \<inter> K = K - J" by auto
   298   from y `K \<subseteq> I` `J \<subseteq> I` show ?thesis
   299     by (simp split: split_merge add: emb_def Pi_iff extensional_merge_sub set_eq_iff) auto
   300 qed
   302 definition (in product_prob_space) infprod_algebra :: "('i \<Rightarrow> 'a) measure_space" where
   303   "infprod_algebra = sigma generator \<lparr> measure :=
   304     (SOME \<mu>. (\<forall>s\<in>sets generator. \<mu> s = \<mu>G s) \<and>
   305        measure_space \<lparr>space = space generator, sets = sets (sigma generator), measure = \<mu>\<rparr>)\<rparr>"
   307 syntax
   308   "_PiP"  :: "[pttrn, 'i set, ('b, 'd) measure_space_scheme] => ('i => 'b, 'd) measure_space_scheme"  ("(3PIP _:_./ _)" 10)
   310 syntax (xsymbols)
   311   "_PiP" :: "[pttrn, 'i set, ('b, 'd) measure_space_scheme] => ('i => 'b, 'd) measure_space_scheme"  ("(3\<Pi>\<^isub>P _\<in>_./ _)"   10)
   313 syntax (HTML output)
   314   "_PiP" :: "[pttrn, 'i set, ('b, 'd) measure_space_scheme] => ('i => 'b, 'd) measure_space_scheme"  ("(3\<Pi>\<^isub>P _\<in>_./ _)"   10)
   316 abbreviation
   317   "Pi\<^isub>P I M \<equiv> product_prob_space.infprod_algebra M I"
   319 translations
   320   "PIP x:I. M" == "CONST Pi\<^isub>P I (%x. M)"
   322 sublocale product_prob_space \<subseteq> G: algebra generator
   323 proof
   324   let ?G = generator
   325   show "sets ?G \<subseteq> Pow (space ?G)"
   326     by (auto simp: generator_def emb_def)
   327   from I_not_empty
   328   obtain i where "i \<in> I" by auto
   329   then show "{} \<in> sets ?G"
   330     by (auto intro!: exI[of _ "{i}"] image_eqI[where x="\<lambda>i. {}"]
   331       simp: product_algebra_def sigma_def sigma_sets.Empty generator_def emb_def)
   332   from `i \<in> I` show "space ?G \<in> sets ?G"
   333     by (auto intro!: exI[of _ "{i}"] image_eqI[where x="Pi\<^isub>E {i} (\<lambda>i. space (M i))"]
   334       simp: generator_def emb_def)
   335   fix A assume "A \<in> sets ?G"
   336   then obtain JA XA where XA: "JA \<noteq> {}" "finite JA" "JA \<subseteq> I" "XA \<in> sets (Pi\<^isub>M JA M)" and A: "A = emb I JA XA"
   337     by (auto simp: generator_def)
   338   fix B assume "B \<in> sets ?G"
   339   then obtain JB XB where XB: "JB \<noteq> {}" "finite JB" "JB \<subseteq> I" "XB \<in> sets (Pi\<^isub>M JB M)" and B: "B = emb I JB XB"
   340     by (auto simp: generator_def)
   341   let ?RA = "emb (JA \<union> JB) JA XA"
   342   let ?RB = "emb (JA \<union> JB) JB XB"
   343   interpret JAB: finite_product_sigma_algebra M "JA \<union> JB"
   344     by default (insert XA XB, auto)
   345   have *: "A - B = emb I (JA \<union> JB) (?RA - ?RB)" "A \<union> B = emb I (JA \<union> JB) (?RA \<union> ?RB)"
   346     using XA A XB B by (auto simp: emb_simps)
   347   then show "A - B \<in> sets ?G" "A \<union> B \<in> sets ?G"
   348     using XA XB by (auto intro!: generatorI')
   349 qed
   351 lemma (in product_prob_space) positive_\<mu>G: "positive generator \<mu>G"
   352 proof (intro positive_def[THEN iffD2] conjI ballI)
   353   from generatorE[OF G.empty_sets] guess J X . note this[simp]
   354   interpret J: finite_product_sigma_finite M J by default fact
   355   have "X = {}"
   356     by (rule emb_injective[of J I]) simp_all
   357   then show "\<mu>G {} = 0" by simp
   358 next
   359   fix A assume "A \<in> sets generator"
   360   from generatorE[OF this] guess J X . note this[simp]
   361   interpret J: finite_product_sigma_finite M J by default fact
   362   show "0 \<le> \<mu>G A" by simp
   363 qed
   365 lemma (in product_prob_space) additive_\<mu>G: "additive generator \<mu>G"
   366 proof (intro additive_def[THEN iffD2] ballI impI)
   367   fix A assume "A \<in> sets generator" with generatorE guess J X . note J = this
   368   fix B assume "B \<in> sets generator" with generatorE guess K Y . note K = this
   369   assume "A \<inter> B = {}"
   370   have JK: "J \<union> K \<noteq> {}" "J \<union> K \<subseteq> I" "finite (J \<union> K)"
   371     using J K by auto
   372   interpret JK: finite_product_sigma_finite M "J \<union> K" by default fact
   373   have JK_disj: "emb (J \<union> K) J X \<inter> emb (J \<union> K) K Y = {}"
   374     apply (rule emb_injective[of "J \<union> K" I])
   375     apply (insert `A \<inter> B = {}` JK J K)
   376     apply (simp_all add: JK.Int emb_simps)
   377     done
   378   have AB: "A = emb I (J \<union> K) (emb (J \<union> K) J X)" "B = emb I (J \<union> K) (emb (J \<union> K) K Y)"
   379     using J K by simp_all
   380   then have "\<mu>G (A \<union> B) = \<mu>G (emb I (J \<union> K) (emb (J \<union> K) J X \<union> emb (J \<union> K) K Y))"
   381     by (simp add: emb_simps)
   382   also have "\<dots> = measure (Pi\<^isub>M (J \<union> K) M) (emb (J \<union> K) J X \<union> emb (J \<union> K) K Y)"
   383     using JK J(1, 4) K(1, 4) by (simp add: \<mu>G_eq JK.Un)
   384   also have "\<dots> = \<mu>G A + \<mu>G B"
   385     using J K JK_disj by (simp add: JK.measure_additive[symmetric])
   386   finally show "\<mu>G (A \<union> B) = \<mu>G A + \<mu>G B" .
   387 qed
   389 lemma (in product_prob_space) finite_index_eq_finite_product:
   390   assumes "finite I"
   391   shows "sets (sigma generator) = sets (Pi\<^isub>M I M)"
   392 proof safe
   393   interpret I: finite_product_sigma_algebra M I by default fact
   394   have [simp]: "space generator = space (Pi\<^isub>M I M)"
   395     by (simp add: generator_def product_algebra_def)
   396   { fix A assume "A \<in> sets (sigma generator)"
   397     then show "A \<in> sets I.P" unfolding sets_sigma
   398     proof induct
   399       case (Basic A)
   400       from generatorE[OF this] guess J X . note J = this
   401       with `finite I` have "emb I J X \<in> sets I.P" by auto
   402       with `emb I J X = A` show "A \<in> sets I.P" by simp
   403     qed auto }
   404   { fix A assume "A \<in> sets I.P"
   405     moreover with I.sets_into_space have "emb I I A = A" by (intro emb_id) auto
   406     ultimately show "A \<in> sets (sigma generator)"
   407       using `finite I` I_not_empty unfolding sets_sigma
   408       by (intro sigma_sets.Basic generatorI[of I A]) auto }
   409 qed
   411 lemma (in product_prob_space) extend_\<mu>G:
   412   "\<exists>\<mu>. (\<forall>s\<in>sets generator. \<mu> s = \<mu>G s) \<and>
   413        measure_space \<lparr>space = space generator, sets = sets (sigma generator), measure = \<mu>\<rparr>"
   414 proof cases
   415   assume "finite I"
   416   interpret I: finite_product_sigma_finite M I by default fact
   417   show ?thesis
   418   proof (intro exI[of _ "measure (Pi\<^isub>M I M)"] ballI conjI)
   419     fix A assume "A \<in> sets generator"
   420     from generatorE[OF this] guess J X . note J = this
   421     from J(1-4) `finite I` show "measure I.P A = \<mu>G A"
   422       unfolding J(6)
   423       by (subst J(5)[symmetric]) (simp add: measure_emb)
   424   next
   425     have [simp]: "space generator = space (Pi\<^isub>M I M)"
   426       by (simp add: generator_def product_algebra_def)
   427     have "\<lparr>space = space generator, sets = sets (sigma generator), measure = measure I.P\<rparr>
   428       = I.P" (is "?P = _")
   429       by (auto intro!: measure_space.equality simp: finite_index_eq_finite_product[OF `finite I`])
   430     then show "measure_space ?P" by simp default
   431   qed
   432 next
   433   let ?G = generator
   434   assume "\<not> finite I"
   435   note \<mu>G_mono =
   436     G.additive_increasing[OF positive_\<mu>G additive_\<mu>G, THEN increasingD]
   438   { fix Z J assume J: "J \<noteq> {}" "finite J" "J \<subseteq> I" and Z: "Z \<in> sets ?G"
   440     from `infinite I` `finite J` obtain k where k: "k \<in> I" "k \<notin> J"
   441       by (metis rev_finite_subset subsetI)
   442     moreover from Z guess K' X' by (rule generatorE)
   443     moreover def K \<equiv> "insert k K'"
   444     moreover def X \<equiv> "emb K K' X'"
   445     ultimately have K: "K \<noteq> {}" "finite K" "K \<subseteq> I" "X \<in> sets (Pi\<^isub>M K M)" "Z = emb I K X"
   446       "K - J \<noteq> {}" "K - J \<subseteq> I" "\<mu>G Z = measure (Pi\<^isub>M K M) X"
   447       by (auto simp: subset_insertI)
   449     let "?M y" = "merge J y (K - J) -` emb (J \<union> K) K X \<inter> space (Pi\<^isub>M (K - J) M)"
   450     { fix y assume y: "y \<in> space (Pi\<^isub>M J M)"
   451       note * = merge_emb[OF `K \<subseteq> I` `J \<subseteq> I` y, of X]
   452       moreover
   453       have **: "?M y \<in> sets (Pi\<^isub>M (K - J) M)"
   454         using J K y by (intro merge_sets) auto
   455       ultimately
   456       have ***: "(merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M)) \<in> sets ?G"
   457         using J K by (intro generatorI) auto
   458       have "\<mu>G (merge J y (I - J) -` emb I K X \<inter> space (Pi\<^isub>M I M)) = measure (Pi\<^isub>M (K - J) M) (?M y)"
   459         unfolding * using K J by (subst \<mu>G_eq[OF _ _ _ **]) auto
   460       note * ** *** this }
   461     note merge_in_G = this
   463     have "finite (K - J)" using K by auto
   465     interpret J: finite_product_prob_space M J by default fact+
   466     interpret KmJ: finite_product_prob_space M "K - J" by default fact+
   468     have "\<mu>G Z = measure (Pi\<^isub>M (J \<union> (K - J)) M) (emb (J \<union> (K - J)) K X)"
   469       using K J by simp
   470     also have "\<dots> = (\<integral>\<^isup>+ x. measure (Pi\<^isub>M (K - J) M) (?M x) \<partial>Pi\<^isub>M J M)"
   471       using K J by (subst measure_fold_integral) auto
   472     also have "\<dots> = (\<integral>\<^isup>+ y. \<mu>G (merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M)) \<partial>Pi\<^isub>M J M)"
   473       (is "_ = (\<integral>\<^isup>+x. \<mu>G (?MZ x) \<partial>Pi\<^isub>M J M)")
   474     proof (intro J.positive_integral_cong)
   475       fix x assume x: "x \<in> space (Pi\<^isub>M J M)"
   476       with K merge_in_G(2)[OF this]
   477       show "measure (Pi\<^isub>M (K - J) M) (?M x) = \<mu>G (?MZ x)"
   478         unfolding `Z = emb I K X` merge_in_G(1)[OF x] by (subst \<mu>G_eq) auto
   479     qed
   480     finally have fold: "\<mu>G Z = (\<integral>\<^isup>+x. \<mu>G (?MZ x) \<partial>Pi\<^isub>M J M)" .
   482     { fix x assume x: "x \<in> space (Pi\<^isub>M J M)"
   483       then have "\<mu>G (?MZ x) \<le> 1"
   484         unfolding merge_in_G(4)[OF x] `Z = emb I K X`
   485         by (intro KmJ.measure_le_1 merge_in_G(2)[OF x]) }
   486     note le_1 = this
   488     let "?q y" = "\<mu>G (merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M))"
   489     have "?q \<in> borel_measurable (Pi\<^isub>M J M)"
   490       unfolding `Z = emb I K X` using J K merge_in_G(3)
   491       by (simp add: merge_in_G  \<mu>G_eq measure_fold_measurable
   492                del: space_product_algebra cong: measurable_cong)
   493     note this fold le_1 merge_in_G(3) }
   494   note fold = this
   496   show ?thesis
   497   proof (rule G.caratheodory_empty_continuous[OF positive_\<mu>G additive_\<mu>G])
   498     fix A assume "A \<in> sets ?G"
   499     with generatorE guess J X . note JX = this
   500     interpret JK: finite_product_prob_space M J by default fact+
   501     with JX show "\<mu>G A \<noteq> \<infinity>" by simp
   502   next
   503     fix A assume A: "range A \<subseteq> sets ?G" "decseq A" "(\<Inter>i. A i) = {}"
   504     then have "decseq (\<lambda>i. \<mu>G (A i))"
   505       by (auto intro!: \<mu>G_mono simp: decseq_def)
   506     moreover
   507     have "(INF i. \<mu>G (A i)) = 0"
   508     proof (rule ccontr)
   509       assume "(INF i. \<mu>G (A i)) \<noteq> 0" (is "?a \<noteq> 0")
   510       moreover have "0 \<le> ?a"
   511         using A positive_\<mu>G by (auto intro!: le_INFI simp: positive_def)
   512       ultimately have "0 < ?a" by auto
   514       have "\<forall>n. \<exists>J X. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I \<and> X \<in> sets (Pi\<^isub>M J M) \<and> A n = emb I J X \<and> \<mu>G (A n) = measure (Pi\<^isub>M J M) X"
   515         using A by (intro allI generator_Ex) auto
   516       then obtain J' X' where J': "\<And>n. J' n \<noteq> {}" "\<And>n. finite (J' n)" "\<And>n. J' n \<subseteq> I" "\<And>n. X' n \<in> sets (Pi\<^isub>M (J' n) M)"
   517         and A': "\<And>n. A n = emb I (J' n) (X' n)"
   518         unfolding choice_iff by blast
   519       moreover def J \<equiv> "\<lambda>n. (\<Union>i\<le>n. J' i)"
   520       moreover def X \<equiv> "\<lambda>n. emb (J n) (J' n) (X' n)"
   521       ultimately have J: "\<And>n. J n \<noteq> {}" "\<And>n. finite (J n)" "\<And>n. J n \<subseteq> I" "\<And>n. X n \<in> sets (Pi\<^isub>M (J n) M)"
   522         by auto
   523       with A' have A_eq: "\<And>n. A n = emb I (J n) (X n)" "\<And>n. A n \<in> sets ?G"
   524         unfolding J_def X_def by (subst emb_trans) (insert A, auto)
   526       have J_mono: "\<And>n m. n \<le> m \<Longrightarrow> J n \<subseteq> J m"
   527         unfolding J_def by force
   529       interpret J: finite_product_prob_space M "J i" for i by default fact+
   531       have a_le_1: "?a \<le> 1"
   532         using \<mu>G_spec[of "J 0" "A 0" "X 0"] J A_eq
   533         by (auto intro!: INF_leI2[of 0] J.measure_le_1)
   535       let "?M K Z y" = "merge K y (I - K) -` Z \<inter> space (Pi\<^isub>M I M)"
   537       { fix Z k assume Z: "range Z \<subseteq> sets ?G" "decseq Z" "\<forall>n. ?a / 2^k \<le> \<mu>G (Z n)"
   538         then have Z_sets: "\<And>n. Z n \<in> sets ?G" by auto
   539         fix J' assume J': "J' \<noteq> {}" "finite J'" "J' \<subseteq> I"
   540         interpret J': finite_product_prob_space M J' by default fact+
   542         let "?q n y" = "\<mu>G (?M J' (Z n) y)"
   543         let "?Q n" = "?q n -` {?a / 2^(k+1) ..} \<inter> space (Pi\<^isub>M J' M)"
   544         { fix n
   545           have "?q n \<in> borel_measurable (Pi\<^isub>M J' M)"
   546             using Z J' by (intro fold(1)) auto
   547           then have "?Q n \<in> sets (Pi\<^isub>M J' M)"
   548             by (rule measurable_sets) auto }
   549         note Q_sets = this
   551         have "?a / 2^(k+1) \<le> (INF n. measure (Pi\<^isub>M J' M) (?Q n))"
   552         proof (intro le_INFI)
   553           fix n
   554           have "?a / 2^k \<le> \<mu>G (Z n)" using Z by auto
   555           also have "\<dots> \<le> (\<integral>\<^isup>+ x. indicator (?Q n) x + ?a / 2^(k+1) \<partial>Pi\<^isub>M J' M)"
   556             unfolding fold(2)[OF J' `Z n \<in> sets ?G`]
   557           proof (intro J'.positive_integral_mono)
   558             fix x assume x: "x \<in> space (Pi\<^isub>M J' M)"
   559             then have "?q n x \<le> 1 + 0"
   560               using J' Z fold(3) Z_sets by auto
   561             also have "\<dots> \<le> 1 + ?a / 2^(k+1)"
   562               using `0 < ?a` by (intro add_mono) auto
   563             finally have "?q n x \<le> 1 + ?a / 2^(k+1)" .
   564             with x show "?q n x \<le> indicator (?Q n) x + ?a / 2^(k+1)"
   565               by (auto split: split_indicator simp del: power_Suc)
   566           qed
   567           also have "\<dots> = measure (Pi\<^isub>M J' M) (?Q n) + ?a / 2^(k+1)"
   568             using `0 \<le> ?a` Q_sets J'.measure_space_1
   569             by (subst J'.positive_integral_add) auto
   570           finally show "?a / 2^(k+1) \<le> measure (Pi\<^isub>M J' M) (?Q n)" using `?a \<le> 1`
   571             by (cases rule: extreal2_cases[of ?a "measure (Pi\<^isub>M J' M) (?Q n)"])
   572                (auto simp: field_simps)
   573         qed
   574         also have "\<dots> = measure (Pi\<^isub>M J' M) (\<Inter>n. ?Q n)"
   575         proof (intro J'.continuity_from_above)
   576           show "range ?Q \<subseteq> sets (Pi\<^isub>M J' M)" using Q_sets by auto
   577           show "decseq ?Q"
   578             unfolding decseq_def
   579           proof (safe intro!: vimageI[OF refl])
   580             fix m n :: nat assume "m \<le> n"
   581             fix x assume x: "x \<in> space (Pi\<^isub>M J' M)"
   582             assume "?a / 2^(k+1) \<le> ?q n x"
   583             also have "?q n x \<le> ?q m x"
   584             proof (rule \<mu>G_mono)
   585               from fold(4)[OF J', OF Z_sets x]
   586               show "?M J' (Z n) x \<in> sets ?G" "?M J' (Z m) x \<in> sets ?G" by auto
   587               show "?M J' (Z n) x \<subseteq> ?M J' (Z m) x"
   588                 using `decseq Z`[THEN decseqD, OF `m \<le> n`] by auto
   589             qed
   590             finally show "?a / 2^(k+1) \<le> ?q m x" .
   591           qed
   592         qed (intro J'.finite_measure Q_sets)
   593         finally have "(\<Inter>n. ?Q n) \<noteq> {}"
   594           using `0 < ?a` `?a \<le> 1` by (cases ?a) (auto simp: divide_le_0_iff power_le_zero_eq)
   595         then have "\<exists>w\<in>space (Pi\<^isub>M J' M). \<forall>n. ?a / 2 ^ (k + 1) \<le> ?q n w" by auto }
   596       note Ex_w = this
   598       let "?q k n y" = "\<mu>G (?M (J k) (A n) y)"
   600       have "\<forall>n. ?a / 2 ^ 0 \<le> \<mu>G (A n)" by (auto intro: INF_leI)
   601       from Ex_w[OF A(1,2) this J(1-3), of 0] guess w0 .. note w0 = this
   603       let "?P k wk w" =
   604         "w \<in> space (Pi\<^isub>M (J (Suc k)) M) \<and> restrict w (J k) = wk \<and> (\<forall>n. ?a / 2 ^ (Suc k + 1) \<le> ?q (Suc k) n w)"
   605       def w \<equiv> "nat_rec w0 (\<lambda>k wk. Eps (?P k wk))"
   607       { fix k have w: "w k \<in> space (Pi\<^isub>M (J k) M) \<and>
   608           (\<forall>n. ?a / 2 ^ (k + 1) \<le> ?q k n (w k)) \<and> (k \<noteq> 0 \<longrightarrow> restrict (w k) (J (k - 1)) = w (k - 1))"
   609         proof (induct k)
   610           case 0 with w0 show ?case
   611             unfolding w_def nat_rec_0 by auto
   612         next
   613           case (Suc k)
   614           then have wk: "w k \<in> space (Pi\<^isub>M (J k) M)" by auto
   615           have "\<exists>w'. ?P k (w k) w'"
   616           proof cases
   617             assume [simp]: "J k = J (Suc k)"
   618             show ?thesis
   619             proof (intro exI[of _ "w k"] conjI allI)
   620               fix n
   621               have "?a / 2 ^ (Suc k + 1) \<le> ?a / 2 ^ (k + 1)"
   622                 using `0 < ?a` `?a \<le> 1` by (cases ?a) (auto simp: field_simps)
   623               also have "\<dots> \<le> ?q k n (w k)" using Suc by auto
   624               finally show "?a / 2 ^ (Suc k + 1) \<le> ?q (Suc k) n (w k)" by simp
   625             next
   626               show "w k \<in> space (Pi\<^isub>M (J (Suc k)) M)"
   627                 using Suc by simp
   628               then show "restrict (w k) (J k) = w k"
   629                 by (simp add: extensional_restrict)
   630             qed
   631           next
   632             assume "J k \<noteq> J (Suc k)"
   633             with J_mono[of k "Suc k"] have "J (Suc k) - J k \<noteq> {}" (is "?D \<noteq> {}") by auto
   634             have "range (\<lambda>n. ?M (J k) (A n) (w k)) \<subseteq> sets ?G"
   635               "decseq (\<lambda>n. ?M (J k) (A n) (w k))"
   636               "\<forall>n. ?a / 2 ^ (k + 1) \<le> \<mu>G (?M (J k) (A n) (w k))"
   637               using `decseq A` fold(4)[OF J(1-3) A_eq(2), of "w k" k] Suc
   638               by (auto simp: decseq_def)
   639             from Ex_w[OF this `?D \<noteq> {}`] J[of "Suc k"]
   640             obtain w' where w': "w' \<in> space (Pi\<^isub>M ?D M)"
   641               "\<forall>n. ?a / 2 ^ (Suc k + 1) \<le> \<mu>G (?M ?D (?M (J k) (A n) (w k)) w')" by auto
   642             let ?w = "merge (J k) (w k) ?D w'"
   643             have [simp]: "\<And>x. merge (J k) (w k) (I - J k) (merge ?D w' (I - ?D) x) =
   644               merge (J (Suc k)) ?w (I - (J (Suc k))) x"
   645               using J(3)[of "Suc k"] J(3)[of k] J_mono[of k "Suc k"]
   646               by (auto intro!: ext split: split_merge)
   647             have *: "\<And>n. ?M ?D (?M (J k) (A n) (w k)) w' = ?M (J (Suc k)) (A n) ?w"
   648               using w'(1) J(3)[of "Suc k"]
   649               by (auto split: split_merge intro!: extensional_merge_sub) force+
   650             show ?thesis
   651               apply (rule exI[of _ ?w])
   652               using w' J_mono[of k "Suc k"] wk unfolding *
   653               apply (auto split: split_merge intro!: extensional_merge_sub ext)
   654               apply (force simp: extensional_def)
   655               done
   656           qed
   657           then have "?P k (w k) (w (Suc k))"
   658             unfolding w_def nat_rec_Suc unfolding w_def[symmetric]
   659             by (rule someI_ex)
   660           then show ?case by auto
   661         qed
   662         moreover
   663         then have "w k \<in> space (Pi\<^isub>M (J k) M)" by auto
   664         moreover
   665         from w have "?a / 2 ^ (k + 1) \<le> ?q k k (w k)" by auto
   666         then have "?M (J k) (A k) (w k) \<noteq> {}"
   667           using positive_\<mu>G[unfolded positive_def] `0 < ?a` `?a \<le> 1`
   668           by (cases ?a) (auto simp: divide_le_0_iff power_le_zero_eq)
   669         then obtain x where "x \<in> ?M (J k) (A k) (w k)" by auto
   670         then have "merge (J k) (w k) (I - J k) x \<in> A k" by auto
   671         then have "\<exists>x\<in>A k. restrict x (J k) = w k"
   672           using `w k \<in> space (Pi\<^isub>M (J k) M)`
   673           by (intro rev_bexI) (auto intro!: ext simp: extensional_def)
   674         ultimately have "w k \<in> space (Pi\<^isub>M (J k) M)"
   675           "\<exists>x\<in>A k. restrict x (J k) = w k"
   676           "k \<noteq> 0 \<Longrightarrow> restrict (w k) (J (k - 1)) = w (k - 1)"
   677           by auto }
   678       note w = this
   680       { fix k l i assume "k \<le> l" "i \<in> J k"
   681         { fix l have "w k i = w (k + l) i"
   682           proof (induct l)
   683             case (Suc l)
   684             from `i \<in> J k` J_mono[of k "k + l"] have "i \<in> J (k + l)" by auto
   685             with w(3)[of "k + Suc l"]
   686             have "w (k + l) i = w (k + Suc l) i"
   687               by (auto simp: restrict_def fun_eq_iff split: split_if_asm)
   688             with Suc show ?case by simp
   689           qed simp }
   690         from this[of "l - k"] `k \<le> l` have "w l i = w k i" by simp }
   691       note w_mono = this
   693       def w' \<equiv> "\<lambda>i. if i \<in> (\<Union>k. J k) then w (LEAST k. i \<in> J k) i else if i \<in> I then (SOME x. x \<in> space (M i)) else undefined"
   694       { fix i k assume k: "i \<in> J k"
   695         have "w k i = w (LEAST k. i \<in> J k) i"
   696           by (intro w_mono Least_le k LeastI[of _ k])
   697         then have "w' i = w k i"
   698           unfolding w'_def using k by auto }
   699       note w'_eq = this
   700       have w'_simps1: "\<And>i. i \<notin> I \<Longrightarrow> w' i = undefined"
   701         using J by (auto simp: w'_def)
   702       have w'_simps2: "\<And>i. i \<notin> (\<Union>k. J k) \<Longrightarrow> i \<in> I \<Longrightarrow> w' i \<in> space (M i)"
   703         using J by (auto simp: w'_def intro!: someI_ex[OF M.not_empty[unfolded ex_in_conv[symmetric]]])
   704       { fix i assume "i \<in> I" then have "w' i \<in> space (M i)"
   705           using w(1) by (cases "i \<in> (\<Union>k. J k)") (force simp: w'_simps2 w'_eq)+ }
   706       note w'_simps[simp] = w'_eq w'_simps1 w'_simps2 this
   708       have w': "w' \<in> space (Pi\<^isub>M I M)"
   709         using w(1) by (auto simp add: Pi_iff extensional_def)
   711       { fix n
   712         have "restrict w' (J n) = w n" using w(1)
   713           by (auto simp add: fun_eq_iff restrict_def Pi_iff extensional_def)
   714         with w[of n] obtain x where "x \<in> A n" "restrict x (J n) = restrict w' (J n)" by auto
   715         then have "w' \<in> A n" unfolding A_eq using w' by (auto simp: emb_def) }
   716       then have "w' \<in> (\<Inter>i. A i)" by auto
   717       with `(\<Inter>i. A i) = {}` show False by auto
   718     qed
   719     ultimately show "(\<lambda>i. \<mu>G (A i)) ----> 0"
   720       using LIMSEQ_extreal_INFI[of "\<lambda>i. \<mu>G (A i)"] by simp
   721   qed
   722 qed
   724 lemma (in product_prob_space) infprod_spec:
   725   shows "(\<forall>s\<in>sets generator. measure (Pi\<^isub>P I M) s = \<mu>G s) \<and> measure_space (Pi\<^isub>P I M)"
   726 proof -
   727   let ?P = "\<lambda>\<mu>. (\<forall>A\<in>sets generator. \<mu> A = \<mu>G A) \<and>
   728        measure_space \<lparr>space = space generator, sets = sets (sigma generator), measure = \<mu>\<rparr>"
   729   have **: "measure infprod_algebra = (SOME \<mu>. ?P \<mu>)"
   730     unfolding infprod_algebra_def by simp
   731   have *: "Pi\<^isub>P I M = \<lparr>space = space generator, sets = sets (sigma generator), measure = measure (Pi\<^isub>P I M)\<rparr>"
   732     unfolding infprod_algebra_def by auto
   733   show ?thesis
   734     apply (subst (2) *)
   735     apply (unfold **)
   736     apply (rule someI_ex[where P="?P"])
   737     apply (rule extend_\<mu>G)
   738     done
   739 qed
   741 sublocale product_prob_space \<subseteq> measure_space "Pi\<^isub>P I M"
   742   using infprod_spec by auto
   744 lemma (in product_prob_space) measure_infprod_emb:
   745   assumes "J \<noteq> {}" "finite J" "J \<subseteq> I" "X \<in> sets (Pi\<^isub>M J M)"
   746   shows "measure (Pi\<^isub>P I M) (emb I J X) = measure (Pi\<^isub>M J M) X"
   747 proof -
   748   have "emb I J X \<in> sets generator"
   749     using assms by (rule generatorI')
   750   with \<mu>G_eq[OF assms] infprod_spec show ?thesis by auto
   751 qed
   753 end