src/HOL/Probability/Projective_Family.thy
author immler
Fri Nov 16 11:34:34 2012 +0100 (2012-11-16)
changeset 50095 94d7dfa9f404
parent 50087 635d73673b5e
child 50101 a3bede207a04
permissions -rw-r--r--
renamed to more appropriate lim_P for projective limit
     1 (*  Title:      HOL/Probability/Projective_Family.thy
     2     Author:     Fabian Immler, TU München
     3     Author:     Johannes Hölzl, TU München
     4 *)
     5 
     6 header {*Projective Family*}
     7 
     8 theory Projective_Family
     9 imports Finite_Product_Measure Probability_Measure
    10 begin
    11 
    12 lemma (in product_prob_space) distr_restrict:
    13   assumes "J \<noteq> {}" "J \<subseteq> K" "finite K"
    14   shows "(\<Pi>\<^isub>M i\<in>J. M i) = distr (\<Pi>\<^isub>M i\<in>K. M i) (\<Pi>\<^isub>M i\<in>J. M i) (\<lambda>f. restrict f J)" (is "?P = ?D")
    15 proof (rule measure_eqI_generator_eq)
    16   have "finite J" using `J \<subseteq> K` `finite K` by (auto simp add: finite_subset)
    17   interpret J: finite_product_prob_space M J proof qed fact
    18   interpret K: finite_product_prob_space M K proof qed fact
    19 
    20   let ?J = "{Pi\<^isub>E J E | E. \<forall>i\<in>J. E i \<in> sets (M i)}"
    21   let ?F = "\<lambda>i. \<Pi>\<^isub>E k\<in>J. space (M k)"
    22   let ?\<Omega> = "(\<Pi>\<^isub>E k\<in>J. space (M k))"
    23   show "Int_stable ?J"
    24     by (rule Int_stable_PiE)
    25   show "range ?F \<subseteq> ?J" "(\<Union>i. ?F i) = ?\<Omega>"
    26     using `finite J` by (auto intro!: prod_algebraI_finite)
    27   { fix i show "emeasure ?P (?F i) \<noteq> \<infinity>" by simp }
    28   show "?J \<subseteq> Pow ?\<Omega>" by (auto simp: Pi_iff dest: sets_into_space)
    29   show "sets (\<Pi>\<^isub>M i\<in>J. M i) = sigma_sets ?\<Omega> ?J" "sets ?D = sigma_sets ?\<Omega> ?J"
    30     using `finite J` by (simp_all add: sets_PiM prod_algebra_eq_finite Pi_iff)
    31 
    32   fix X assume "X \<in> ?J"
    33   then obtain E where [simp]: "X = Pi\<^isub>E J E" and E: "\<forall>i\<in>J. E i \<in> sets (M i)" by auto
    34   with `finite J` have X: "X \<in> sets (Pi\<^isub>M J M)"
    35     by simp
    36 
    37   have "emeasure ?P X = (\<Prod> i\<in>J. emeasure (M i) (E i))"
    38     using E by (simp add: J.measure_times)
    39   also have "\<dots> = (\<Prod> i\<in>J. emeasure (M i) (if i \<in> J then E i else space (M i)))"
    40     by simp
    41   also have "\<dots> = (\<Prod> i\<in>K. emeasure (M i) (if i \<in> J then E i else space (M i)))"
    42     using `finite K` `J \<subseteq> K`
    43     by (intro setprod_mono_one_left) (auto simp: M.emeasure_space_1)
    44   also have "\<dots> = emeasure (Pi\<^isub>M K M) (\<Pi>\<^isub>E i\<in>K. if i \<in> J then E i else space (M i))"
    45     using E by (simp add: K.measure_times)
    46   also have "(\<Pi>\<^isub>E i\<in>K. if i \<in> J then E i else space (M i)) = (\<lambda>f. restrict f J) -` Pi\<^isub>E J E \<inter> (\<Pi>\<^isub>E i\<in>K. space (M i))"
    47     using `J \<subseteq> K` sets_into_space E by (force simp:  Pi_iff split: split_if_asm)
    48   finally show "emeasure (Pi\<^isub>M J M) X = emeasure ?D X"
    49     using X `J \<subseteq> K` apply (subst emeasure_distr)
    50     by (auto intro!: measurable_restrict_subset simp: space_PiM)
    51 qed
    52 
    53 lemma (in product_prob_space) emeasure_prod_emb[simp]:
    54   assumes L: "J \<noteq> {}" "J \<subseteq> L" "finite L" and X: "X \<in> sets (Pi\<^isub>M J M)"
    55   shows "emeasure (Pi\<^isub>M L M) (prod_emb L M J X) = emeasure (Pi\<^isub>M J M) X"
    56   by (subst distr_restrict[OF L])
    57      (simp add: prod_emb_def space_PiM emeasure_distr measurable_restrict_subset L X)
    58 
    59 definition
    60   limP :: "'i set \<Rightarrow> ('i \<Rightarrow> 'a measure) \<Rightarrow> ('i set \<Rightarrow> ('i \<Rightarrow> 'a) measure) \<Rightarrow> ('i \<Rightarrow> 'a) measure" where
    61   "limP I M P = extend_measure (\<Pi>\<^isub>E i\<in>I. space (M i))
    62     {(J, X). (J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}
    63     (\<lambda>(J, X). prod_emb I M J (\<Pi>\<^isub>E j\<in>J. X j))
    64     (\<lambda>(J, X). emeasure (P J) (Pi\<^isub>E J X))"
    65 
    66 abbreviation "lim\<^isub>P \<equiv> limP"
    67 
    68 lemma space_limP[simp]: "space (limP I M P) = space (PiM I M)"
    69   by (auto simp add: limP_def space_PiM prod_emb_def intro!: space_extend_measure)
    70 
    71 lemma sets_limP[simp]: "sets (limP I M P) = sets (PiM I M)"
    72   by (auto simp add: limP_def sets_PiM prod_algebra_def prod_emb_def intro!: sets_extend_measure)
    73 
    74 lemma measurable_limP1[simp]: "measurable (limP I M P) M' = measurable (\<Pi>\<^isub>M i\<in>I. M i) M'"
    75   unfolding measurable_def by auto
    76 
    77 lemma measurable_limP2[simp]: "measurable M' (limP I M P) = measurable M' (\<Pi>\<^isub>M i\<in>I. M i)"
    78   unfolding measurable_def by auto
    79 
    80 locale projective_family =
    81   fixes I::"'i set" and P::"'i set \<Rightarrow> ('i \<Rightarrow> 'a) measure" and M::"('i \<Rightarrow> 'a measure)"
    82   assumes projective: "\<And>J H X. J \<noteq> {} \<Longrightarrow> J \<subseteq> H \<Longrightarrow> H \<subseteq> I \<Longrightarrow> finite H \<Longrightarrow> X \<in> sets (PiM J M) \<Longrightarrow>
    83      (P H) (prod_emb H M J X) = (P J) X"
    84   assumes prob_space: "\<And>J. finite J \<Longrightarrow> prob_space (P J)"
    85   assumes proj_space: "\<And>J. finite J \<Longrightarrow> space (P J) = space (PiM J M)"
    86   assumes proj_sets: "\<And>J. finite J \<Longrightarrow> sets (P J) = sets (PiM J M)"
    87 begin
    88 
    89 lemma emeasure_limP:
    90   assumes "finite J"
    91   assumes "J \<subseteq> I"
    92   assumes A: "\<And>i. i\<in>J \<Longrightarrow> A i \<in> sets (M i)"
    93   shows "emeasure (limP J M P) (Pi\<^isub>E J A) = emeasure (P J) (Pi\<^isub>E J A)"
    94 proof -
    95   have "Pi\<^isub>E J (restrict A J) \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
    96   proof safe
    97     fix x j assume "x \<in> Pi J (restrict A J)" "j \<in> J"
    98     hence "x j \<in> restrict A J j" by (auto simp: Pi_def)
    99     also have "\<dots> \<subseteq> space (M j)" using sets_into_space A `j \<in> J` by auto
   100     finally show "x j \<in> space (M j)" .
   101   qed
   102   hence "emeasure (limP J M P) (Pi\<^isub>E J A) =
   103     emeasure (limP J M P) (prod_emb J M J (Pi\<^isub>E J A))"
   104     using assms(1-3) sets_into_space by (auto simp add: prod_emb_id Pi_def)
   105   also have "\<dots> = emeasure (P J) (Pi\<^isub>E J A)"
   106   proof (rule emeasure_extend_measure_Pair[OF limP_def])
   107     show "positive (sets (limP J M P)) (P J)" unfolding positive_def by auto
   108     show "countably_additive (sets (limP J M P)) (P J)" unfolding countably_additive_def
   109       by (auto simp: suminf_emeasure proj_sets[OF `finite J`])
   110     show "(J \<noteq> {} \<or> J = {}) \<and> finite J \<and> J \<subseteq> J \<and> A \<in> (\<Pi> j\<in>J. sets (M j))"
   111       using assms by auto
   112     fix K and X::"'i \<Rightarrow> 'a set"
   113     show "prod_emb J M K (Pi\<^isub>E K X) \<in> Pow (\<Pi>\<^isub>E i\<in>J. space (M i))"
   114       by (auto simp: prod_emb_def)
   115     assume JX: "(K \<noteq> {} \<or> J = {}) \<and> finite K \<and> K \<subseteq> J \<and> X \<in> (\<Pi> j\<in>K. sets (M j))"
   116     thus "emeasure (P J) (prod_emb J M K (Pi\<^isub>E K X)) = emeasure (P K) (Pi\<^isub>E K X)"
   117       using assms
   118       apply (cases "J = {}")
   119       apply (simp add: prod_emb_id)
   120       apply (fastforce simp add: intro!: projective sets_PiM_I_finite)
   121       done
   122   qed
   123   finally show ?thesis .
   124 qed
   125 
   126 lemma limP_finite:
   127   assumes "finite J"
   128   assumes "J \<subseteq> I"
   129   shows "limP J M P = P J" (is "?P = _")
   130 proof (rule measure_eqI_generator_eq)
   131   let ?J = "{Pi\<^isub>E J E | E. \<forall>i\<in>J. E i \<in> sets (M i)}"
   132   let ?F = "\<lambda>i. \<Pi>\<^isub>E k\<in>J. space (M k)"
   133   let ?\<Omega> = "(\<Pi>\<^isub>E k\<in>J. space (M k))"
   134   show "Int_stable ?J"
   135     by (rule Int_stable_PiE)
   136   interpret prob_space "P J" using prob_space `finite J` by simp
   137   show "emeasure ?P (?F _) \<noteq> \<infinity>" using assms `finite J` by (auto simp: emeasure_limP)
   138   show "?J \<subseteq> Pow ?\<Omega>" by (auto simp: Pi_iff dest: sets_into_space)
   139   show "sets (limP J M P) = sigma_sets ?\<Omega> ?J" "sets (P J) = sigma_sets ?\<Omega> ?J"
   140     using `finite J` proj_sets by (simp_all add: sets_PiM prod_algebra_eq_finite Pi_iff)
   141   fix X assume "X \<in> ?J"
   142   then obtain E where X: "X = Pi\<^isub>E J E" and E: "\<forall>i\<in>J. E i \<in> sets (M i)" by auto
   143   with `finite J` have "X \<in> sets (limP J M P)" by simp
   144   have emb_self: "prod_emb J M J (Pi\<^isub>E J E) = Pi\<^isub>E J E"
   145     using E sets_into_space
   146     by (auto intro!: prod_emb_PiE_same_index)
   147   show "emeasure (limP J M P) X = emeasure (P J) X"
   148     unfolding X using E
   149     by (intro emeasure_limP assms) simp
   150 qed (insert `finite J`, auto intro!: prod_algebraI_finite)
   151 
   152 lemma emeasure_fun_emb[simp]:
   153   assumes L: "J \<noteq> {}" "J \<subseteq> L" "finite L" "L \<subseteq> I" and X: "X \<in> sets (PiM J M)"
   154   shows "emeasure (limP L M P) (prod_emb L M J X) = emeasure (limP J M P) X"
   155   using assms
   156   by (subst limP_finite) (auto simp: limP_finite finite_subset projective)
   157 
   158 lemma prod_emb_injective:
   159   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)"
   160   assumes "prod_emb L M J X = prod_emb L M J Y"
   161   shows "X = Y"
   162 proof (rule injective_vimage_restrict)
   163   show "X \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))" "Y \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
   164     using sets[THEN sets_into_space] by (auto simp: space_PiM)
   165   have "\<forall>i\<in>L. \<exists>x. x \<in> space (M i)"
   166   proof
   167     fix i assume "i \<in> L"
   168     interpret prob_space "P {i}" using prob_space by simp
   169     from not_empty show "\<exists>x. x \<in> space (M i)" by (auto simp add: proj_space space_PiM)
   170   qed
   171   from bchoice[OF this]
   172   show "(\<Pi>\<^isub>E i\<in>L. space (M i)) \<noteq> {}" by auto
   173   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))"
   174     using `prod_emb L M J X = prod_emb L M J Y` by (simp add: prod_emb_def)
   175 qed fact
   176 
   177 abbreviation
   178   "emb L K X \<equiv> prod_emb L M K X"
   179 
   180 definition generator :: "('i \<Rightarrow> 'a) set set" where
   181   "generator = (\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` sets (Pi\<^isub>M J M))"
   182 
   183 lemma generatorI':
   184   "J \<noteq> {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> X \<in> sets (Pi\<^isub>M J M) \<Longrightarrow> emb I J X \<in> generator"
   185   unfolding generator_def by auto
   186 
   187 lemma algebra_generator:
   188   assumes "I \<noteq> {}" shows "algebra (\<Pi>\<^isub>E i\<in>I. space (M i)) generator" (is "algebra ?\<Omega> ?G")
   189   unfolding algebra_def algebra_axioms_def ring_of_sets_iff
   190 proof (intro conjI ballI)
   191   let ?G = generator
   192   show "?G \<subseteq> Pow ?\<Omega>"
   193     by (auto simp: generator_def prod_emb_def)
   194   from `I \<noteq> {}` obtain i where "i \<in> I" by auto
   195   then show "{} \<in> ?G"
   196     by (auto intro!: exI[of _ "{i}"] image_eqI[where x="\<lambda>i. {}"]
   197              simp: sigma_sets.Empty generator_def prod_emb_def)
   198   from `i \<in> I` show "?\<Omega> \<in> ?G"
   199     by (auto intro!: exI[of _ "{i}"] image_eqI[where x="Pi\<^isub>E {i} (\<lambda>i. space (M i))"]
   200              simp: generator_def prod_emb_def)
   201   fix A assume "A \<in> ?G"
   202   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"
   203     by (auto simp: generator_def)
   204   fix B assume "B \<in> ?G"
   205   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"
   206     by (auto simp: generator_def)
   207   let ?RA = "emb (JA \<union> JB) JA XA"
   208   let ?RB = "emb (JA \<union> JB) JB XB"
   209   have *: "A - B = emb I (JA \<union> JB) (?RA - ?RB)" "A \<union> B = emb I (JA \<union> JB) (?RA \<union> ?RB)"
   210     using XA A XB B by auto
   211   show "A - B \<in> ?G" "A \<union> B \<in> ?G"
   212     unfolding * using XA XB by (safe intro!: generatorI') auto
   213 qed
   214 
   215 lemma sets_PiM_generator:
   216   "sets (PiM I M) = sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) generator"
   217 proof cases
   218   assume "I = {}" then show ?thesis
   219     unfolding generator_def
   220     by (auto simp: sets_PiM_empty sigma_sets_empty_eq cong: conj_cong)
   221 next
   222   assume "I \<noteq> {}"
   223   show ?thesis
   224   proof
   225     show "sets (Pi\<^isub>M I M) \<subseteq> sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) generator"
   226       unfolding sets_PiM
   227     proof (safe intro!: sigma_sets_subseteq)
   228       fix A assume "A \<in> prod_algebra I M" with `I \<noteq> {}` show "A \<in> generator"
   229         by (auto intro!: generatorI' sets_PiM_I_finite elim!: prod_algebraE)
   230     qed
   231   qed (auto simp: generator_def space_PiM[symmetric] intro!: sigma_sets_subset)
   232 qed
   233 
   234 lemma generatorI:
   235   "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> generator"
   236   unfolding generator_def by auto
   237 
   238 definition
   239   "\<mu>G A =
   240     (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 = emeasure (limP J M P) X))"
   241 
   242 lemma \<mu>G_spec:
   243   assumes J: "J \<noteq> {}" "finite J" "J \<subseteq> I" "A = emb I J X" "X \<in> sets (Pi\<^isub>M J M)"
   244   shows "\<mu>G A = emeasure (limP J M P) X"
   245   unfolding \<mu>G_def
   246 proof (intro the_equality allI impI ballI)
   247   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)"
   248   have "emeasure (limP K M P) Y = emeasure (limP (K \<union> J) M P) (emb (K \<union> J) K Y)"
   249     using K J by simp
   250   also have "emb (K \<union> J) K Y = emb (K \<union> J) J X"
   251     using K J by (simp add: prod_emb_injective[of "K \<union> J" I])
   252   also have "emeasure (limP (K \<union> J) M P) (emb (K \<union> J) J X) = emeasure (limP J M P) X"
   253     using K J by simp
   254   finally show "emeasure (limP J M P) X = emeasure (limP K M P) Y" ..
   255 qed (insert J, force)
   256 
   257 lemma \<mu>G_eq:
   258   "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) = emeasure (limP J M P) X"
   259   by (intro \<mu>G_spec) auto
   260 
   261 lemma generator_Ex:
   262   assumes *: "A \<in> generator"
   263   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 = emeasure (limP J M P) X"
   264 proof -
   265   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)"
   266     unfolding generator_def by auto
   267   with \<mu>G_spec[OF this] show ?thesis by auto
   268 qed
   269 
   270 lemma generatorE:
   271   assumes A: "A \<in> generator"
   272   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 = emeasure (limP J M P) X"
   273 proof -
   274   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"
   275     "\<mu>G A = emeasure (limP J M P) X" by auto
   276   then show thesis by (intro that) auto
   277 qed
   278 
   279 lemma merge_sets:
   280   "J \<inter> K = {} \<Longrightarrow> A \<in> sets (Pi\<^isub>M (J \<union> K) M) \<Longrightarrow> x \<in> space (Pi\<^isub>M J M) \<Longrightarrow> (\<lambda>y. merge J K (x,y)) -` A \<inter> space (Pi\<^isub>M K M) \<in> sets (Pi\<^isub>M K M)"
   281   by simp
   282 
   283 lemma merge_emb:
   284   assumes "K \<subseteq> I" "J \<subseteq> I" and y: "y \<in> space (Pi\<^isub>M J M)"
   285   shows "((\<lambda>x. merge J (I - J) (y, x)) -` emb I K X \<inter> space (Pi\<^isub>M I M)) =
   286     emb I (K - J) ((\<lambda>x. merge J (K - J) (y, x)) -` emb (J \<union> K) K X \<inter> space (Pi\<^isub>M (K - J) M))"
   287 proof -
   288   have [simp]: "\<And>x J K L. merge J K (y, restrict x L) = merge J (K \<inter> L) (y, x)"
   289     by (auto simp: restrict_def merge_def)
   290   have [simp]: "\<And>x J K L. restrict (merge J K (y, x)) L = merge (J \<inter> L) (K \<inter> L) (y, x)"
   291     by (auto simp: restrict_def merge_def)
   292   have [simp]: "(I - J) \<inter> K = K - J" using `K \<subseteq> I` `J \<subseteq> I` by auto
   293   have [simp]: "(K - J) \<inter> (K \<union> J) = K - J" by auto
   294   have [simp]: "(K - J) \<inter> K = K - J" by auto
   295   from y `K \<subseteq> I` `J \<subseteq> I` show ?thesis
   296     by (simp split: split_merge add: prod_emb_def Pi_iff extensional_merge_sub set_eq_iff space_PiM)
   297        auto
   298 qed
   299 
   300 lemma positive_\<mu>G:
   301   assumes "I \<noteq> {}"
   302   shows "positive generator \<mu>G"
   303 proof -
   304   interpret G!: algebra "\<Pi>\<^isub>E i\<in>I. space (M i)" generator by (rule algebra_generator) fact
   305   show ?thesis
   306   proof (intro positive_def[THEN iffD2] conjI ballI)
   307     from generatorE[OF G.empty_sets] guess J X . note this[simp]
   308     have "X = {}"
   309       by (rule prod_emb_injective[of J I]) simp_all
   310     then show "\<mu>G {} = 0" by simp
   311   next
   312     fix A assume "A \<in> generator"
   313     from generatorE[OF this] guess J X . note this[simp]
   314     show "0 \<le> \<mu>G A" by (simp add: emeasure_nonneg)
   315   qed
   316 qed
   317 
   318 lemma additive_\<mu>G:
   319   assumes "I \<noteq> {}"
   320   shows "additive generator \<mu>G"
   321 proof -
   322   interpret G!: algebra "\<Pi>\<^isub>E i\<in>I. space (M i)" generator by (rule algebra_generator) fact
   323   show ?thesis
   324   proof (intro additive_def[THEN iffD2] ballI impI)
   325     fix A assume "A \<in> generator" with generatorE guess J X . note J = this
   326     fix B assume "B \<in> generator" with generatorE guess K Y . note K = this
   327     assume "A \<inter> B = {}"
   328     have JK: "J \<union> K \<noteq> {}" "J \<union> K \<subseteq> I" "finite (J \<union> K)"
   329       using J K by auto
   330     have JK_disj: "emb (J \<union> K) J X \<inter> emb (J \<union> K) K Y = {}"
   331       apply (rule prod_emb_injective[of "J \<union> K" I])
   332       apply (insert `A \<inter> B = {}` JK J K)
   333       apply (simp_all add: Int prod_emb_Int)
   334       done
   335     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)"
   336       using J K by simp_all
   337     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))"
   338       by simp
   339     also have "\<dots> = emeasure (limP (J \<union> K) M P) (emb (J \<union> K) J X \<union> emb (J \<union> K) K Y)"
   340       using JK J(1, 4) K(1, 4) by (simp add: \<mu>G_eq Un del: prod_emb_Un)
   341     also have "\<dots> = \<mu>G A + \<mu>G B"
   342       using J K JK_disj by (simp add: plus_emeasure[symmetric])
   343     finally show "\<mu>G (A \<union> B) = \<mu>G A + \<mu>G B" .
   344   qed
   345 qed
   346 
   347 end
   348 
   349 sublocale product_prob_space \<subseteq> projective_family I "\<lambda>J. PiM J M" M
   350 proof
   351   fix J::"'i set" assume "finite J"
   352   interpret f: finite_product_prob_space M J proof qed fact
   353   show "emeasure (Pi\<^isub>M J M) (space (Pi\<^isub>M J M)) \<noteq> \<infinity>" by simp
   354   show "\<exists>A. range A \<subseteq> sets (Pi\<^isub>M J M) \<and>
   355             (\<Union>i. A i) = space (Pi\<^isub>M J M) \<and>
   356             (\<forall>i. emeasure (Pi\<^isub>M J M) (A i) \<noteq> \<infinity>)" using sigma_finite[OF `finite J`]
   357     by (auto simp add: sigma_finite_measure_def)
   358   show "emeasure (Pi\<^isub>M J M) (space (Pi\<^isub>M J M)) = 1" by (rule f.emeasure_space_1)
   359 qed simp_all
   360 
   361 lemma (in product_prob_space) limP_PiM_finite[simp]:
   362   assumes "J \<noteq> {}" "finite J" "J \<subseteq> I" shows "limP J M (\<lambda>J. PiM J M) = PiM J M"
   363   using assms by (simp add: limP_finite)
   364 
   365 end