src/HOL/Probability/Projective_Family.thy
 author immler@in.tum.de Fri Nov 09 14:31:26 2012 +0100 (2012-11-09) changeset 50042 6fe18351e9dd parent 50041 afe886a04198 child 50087 635d73673b5e permissions -rw-r--r--
```     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 definition
```
```    13   PiP :: "'i set \<Rightarrow> ('i \<Rightarrow> 'a measure) \<Rightarrow> ('i set \<Rightarrow> ('i \<Rightarrow> 'a) measure) \<Rightarrow> ('i \<Rightarrow> 'a) measure" where
```
```    14   "PiP I M P = extend_measure (\<Pi>\<^isub>E i\<in>I. space (M i))
```
```    15     {(J, X). (J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}
```
```    16     (\<lambda>(J, X). prod_emb I M J (\<Pi>\<^isub>E j\<in>J. X j))
```
```    17     (\<lambda>(J, X). emeasure (P J) (Pi\<^isub>E J X))"
```
```    18
```
```    19 lemma space_PiP[simp]: "space (PiP I M P) = space (PiM I M)"
```
```    20   by (auto simp add: PiP_def space_PiM prod_emb_def intro!: space_extend_measure)
```
```    21
```
```    22 lemma sets_PiP[simp]: "sets (PiP I M P) = sets (PiM I M)"
```
```    23   by (auto simp add: PiP_def sets_PiM prod_algebra_def prod_emb_def intro!: sets_extend_measure)
```
```    24
```
```    25 lemma measurable_PiP1[simp]: "measurable (PiP I M P) M' = measurable (\<Pi>\<^isub>M i\<in>I. M i) M'"
```
```    26   unfolding measurable_def by auto
```
```    27
```
```    28 lemma measurable_PiP2[simp]: "measurable M' (PiP I M P) = measurable M' (\<Pi>\<^isub>M i\<in>I. M i)"
```
```    29   unfolding measurable_def by auto
```
```    30
```
```    31 locale projective_family =
```
```    32   fixes I::"'i set" and P::"'i set \<Rightarrow> ('i \<Rightarrow> 'a) measure" and M::"('i \<Rightarrow> 'a measure)"
```
```    33   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>
```
```    34      (P H) (prod_emb H M J X) = (P J) X"
```
```    35   assumes prob_space: "\<And>J. finite J \<Longrightarrow> prob_space (P J)"
```
```    36   assumes proj_space: "\<And>J. finite J \<Longrightarrow> space (P J) = space (PiM J M)"
```
```    37   assumes proj_sets: "\<And>J. finite J \<Longrightarrow> sets (P J) = sets (PiM J M)"
```
```    38 begin
```
```    39
```
```    40 lemma emeasure_PiP:
```
```    41   assumes "finite J"
```
```    42   assumes "J \<subseteq> I"
```
```    43   assumes A: "\<And>i. i\<in>J \<Longrightarrow> A i \<in> sets (M i)"
```
```    44   shows "emeasure (PiP J M P) (Pi\<^isub>E J A) = emeasure (P J) (Pi\<^isub>E J A)"
```
```    45 proof -
```
```    46   have "Pi\<^isub>E J (restrict A J) \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
```
```    47   proof safe
```
```    48     fix x j assume "x \<in> Pi J (restrict A J)" "j \<in> J"
```
```    49     hence "x j \<in> restrict A J j" by (auto simp: Pi_def)
```
```    50     also have "\<dots> \<subseteq> space (M j)" using sets_into_space A `j \<in> J` by auto
```
```    51     finally show "x j \<in> space (M j)" .
```
```    52   qed
```
```    53   hence "emeasure (PiP J M P) (Pi\<^isub>E J A) =
```
```    54     emeasure (PiP J M P) (prod_emb J M J (Pi\<^isub>E J A))"
```
```    55     using assms(1-3) sets_into_space by (auto simp add: prod_emb_id Pi_def)
```
```    56   also have "\<dots> = emeasure (P J) (Pi\<^isub>E J A)"
```
```    57   proof (rule emeasure_extend_measure_Pair[OF PiP_def])
```
```    58     show "positive (sets (PiP J M P)) (P J)" unfolding positive_def by auto
```
```    59     show "countably_additive (sets (PiP J M P)) (P J)" unfolding countably_additive_def
```
```    60       by (auto simp: suminf_emeasure proj_sets[OF `finite J`])
```
```    61     show "(J \<noteq> {} \<or> J = {}) \<and> finite J \<and> J \<subseteq> J \<and> A \<in> (\<Pi> j\<in>J. sets (M j))"
```
```    62       using assms by auto
```
```    63     fix K and X::"'i \<Rightarrow> 'a set"
```
```    64     show "prod_emb J M K (Pi\<^isub>E K X) \<in> Pow (\<Pi>\<^isub>E i\<in>J. space (M i))"
```
```    65       by (auto simp: prod_emb_def)
```
```    66     assume JX: "(K \<noteq> {} \<or> J = {}) \<and> finite K \<and> K \<subseteq> J \<and> X \<in> (\<Pi> j\<in>K. sets (M j))"
```
```    67     thus "emeasure (P J) (prod_emb J M K (Pi\<^isub>E K X)) = emeasure (P K) (Pi\<^isub>E K X)"
```
```    68       using assms
```
```    69       apply (cases "J = {}")
```
```    70       apply (simp add: prod_emb_id)
```
```    71       apply (fastforce simp add: intro!: projective sets_PiM_I_finite)
```
```    72       done
```
```    73   qed
```
```    74   finally show ?thesis .
```
```    75 qed
```
```    76
```
```    77 lemma PiP_finite:
```
```    78   assumes "finite J"
```
```    79   assumes "J \<subseteq> I"
```
```    80   shows "PiP J M P = P J" (is "?P = _")
```
```    81 proof (rule measure_eqI_generator_eq)
```
```    82   let ?J = "{Pi\<^isub>E J E | E. \<forall>i\<in>J. E i \<in> sets (M i)}"
```
```    83   let ?F = "\<lambda>i. \<Pi>\<^isub>E k\<in>J. space (M k)"
```
```    84   let ?\<Omega> = "(\<Pi>\<^isub>E k\<in>J. space (M k))"
```
```    85   show "Int_stable ?J"
```
```    86     by (rule Int_stable_PiE)
```
```    87   interpret prob_space "P J" using prob_space `finite J` by simp
```
```    88   show "emeasure ?P (?F _) \<noteq> \<infinity>" using assms `finite J` by (auto simp: emeasure_PiP)
```
```    89   show "?J \<subseteq> Pow ?\<Omega>" by (auto simp: Pi_iff dest: sets_into_space)
```
```    90   show "sets (PiP J M P) = sigma_sets ?\<Omega> ?J" "sets (P J) = sigma_sets ?\<Omega> ?J"
```
```    91     using `finite J` proj_sets by (simp_all add: sets_PiM prod_algebra_eq_finite Pi_iff)
```
```    92   fix X assume "X \<in> ?J"
```
```    93   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
```
```    94   with `finite J` have "X \<in> sets (PiP J M P)" by simp
```
```    95   have emb_self: "prod_emb J M J (Pi\<^isub>E J E) = Pi\<^isub>E J E"
```
```    96     using E sets_into_space
```
```    97     by (auto intro!: prod_emb_PiE_same_index)
```
```    98   show "emeasure (PiP J M P) X = emeasure (P J) X"
```
```    99     unfolding X using E
```
```   100     by (intro emeasure_PiP assms) simp
```
```   101 qed (insert `finite J`, auto intro!: prod_algebraI_finite)
```
```   102
```
```   103 lemma emeasure_fun_emb[simp]:
```
```   104   assumes L: "J \<noteq> {}" "J \<subseteq> L" "finite L" "L \<subseteq> I" and X: "X \<in> sets (PiM J M)"
```
```   105   shows "emeasure (PiP L M P) (prod_emb L M J X) = emeasure (PiP J M P) X"
```
```   106   using assms
```
```   107   by (subst PiP_finite) (auto simp: PiP_finite finite_subset projective)
```
```   108
```
```   109 lemma prod_emb_injective:
```
```   110   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)"
```
```   111   assumes "prod_emb L M J X = prod_emb L M J Y"
```
```   112   shows "X = Y"
```
```   113 proof (rule injective_vimage_restrict)
```
```   114   show "X \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))" "Y \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
```
```   115     using sets[THEN sets_into_space] by (auto simp: space_PiM)
```
```   116   have "\<forall>i\<in>L. \<exists>x. x \<in> space (M i)"
```
```   117   proof
```
```   118     fix i assume "i \<in> L"
```
```   119     interpret prob_space "P {i}" using prob_space by simp
```
```   120     from not_empty show "\<exists>x. x \<in> space (M i)" by (auto simp add: proj_space space_PiM)
```
```   121   qed
```
```   122   from bchoice[OF this]
```
```   123   show "(\<Pi>\<^isub>E i\<in>L. space (M i)) \<noteq> {}" by auto
```
```   124   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))"
```
```   125     using `prod_emb L M J X = prod_emb L M J Y` by (simp add: prod_emb_def)
```
```   126 qed fact
```
```   127
```
```   128 abbreviation
```
```   129   "emb L K X \<equiv> prod_emb L M K X"
```
```   130
```
```   131 definition generator :: "('i \<Rightarrow> 'a) set set" where
```
```   132   "generator = (\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` sets (Pi\<^isub>M J M))"
```
```   133
```
```   134 lemma generatorI':
```
```   135   "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"
```
```   136   unfolding generator_def by auto
```
```   137
```
```   138 lemma algebra_generator:
```
```   139   assumes "I \<noteq> {}" shows "algebra (\<Pi>\<^isub>E i\<in>I. space (M i)) generator" (is "algebra ?\<Omega> ?G")
```
```   140   unfolding algebra_def algebra_axioms_def ring_of_sets_iff
```
```   141 proof (intro conjI ballI)
```
```   142   let ?G = generator
```
```   143   show "?G \<subseteq> Pow ?\<Omega>"
```
```   144     by (auto simp: generator_def prod_emb_def)
```
```   145   from `I \<noteq> {}` obtain i where "i \<in> I" by auto
```
```   146   then show "{} \<in> ?G"
```
```   147     by (auto intro!: exI[of _ "{i}"] image_eqI[where x="\<lambda>i. {}"]
```
```   148              simp: sigma_sets.Empty generator_def prod_emb_def)
```
```   149   from `i \<in> I` show "?\<Omega> \<in> ?G"
```
```   150     by (auto intro!: exI[of _ "{i}"] image_eqI[where x="Pi\<^isub>E {i} (\<lambda>i. space (M i))"]
```
```   151              simp: generator_def prod_emb_def)
```
```   152   fix A assume "A \<in> ?G"
```
```   153   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"
```
```   154     by (auto simp: generator_def)
```
```   155   fix B assume "B \<in> ?G"
```
```   156   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"
```
```   157     by (auto simp: generator_def)
```
```   158   let ?RA = "emb (JA \<union> JB) JA XA"
```
```   159   let ?RB = "emb (JA \<union> JB) JB XB"
```
```   160   have *: "A - B = emb I (JA \<union> JB) (?RA - ?RB)" "A \<union> B = emb I (JA \<union> JB) (?RA \<union> ?RB)"
```
```   161     using XA A XB B by auto
```
```   162   show "A - B \<in> ?G" "A \<union> B \<in> ?G"
```
```   163     unfolding * using XA XB by (safe intro!: generatorI') auto
```
```   164 qed
```
```   165
```
```   166 lemma sets_PiM_generator:
```
```   167   "sets (PiM I M) = sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) generator"
```
```   168 proof cases
```
```   169   assume "I = {}" then show ?thesis
```
```   170     unfolding generator_def
```
```   171     by (auto simp: sets_PiM_empty sigma_sets_empty_eq cong: conj_cong)
```
```   172 next
```
```   173   assume "I \<noteq> {}"
```
```   174   show ?thesis
```
```   175   proof
```
```   176     show "sets (Pi\<^isub>M I M) \<subseteq> sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) generator"
```
```   177       unfolding sets_PiM
```
```   178     proof (safe intro!: sigma_sets_subseteq)
```
```   179       fix A assume "A \<in> prod_algebra I M" with `I \<noteq> {}` show "A \<in> generator"
```
```   180         by (auto intro!: generatorI' sets_PiM_I_finite elim!: prod_algebraE)
```
```   181     qed
```
```   182   qed (auto simp: generator_def space_PiM[symmetric] intro!: sigma_sets_subset)
```
```   183 qed
```
```   184
```
```   185 lemma generatorI:
```
```   186   "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"
```
```   187   unfolding generator_def by auto
```
```   188
```
```   189 definition
```
```   190   "\<mu>G A =
```
```   191     (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 (PiP J M P) X))"
```
```   192
```
```   193 lemma \<mu>G_spec:
```
```   194   assumes J: "J \<noteq> {}" "finite J" "J \<subseteq> I" "A = emb I J X" "X \<in> sets (Pi\<^isub>M J M)"
```
```   195   shows "\<mu>G A = emeasure (PiP J M P) X"
```
```   196   unfolding \<mu>G_def
```
```   197 proof (intro the_equality allI impI ballI)
```
```   198   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)"
```
```   199   have "emeasure (PiP K M P) Y = emeasure (PiP (K \<union> J) M P) (emb (K \<union> J) K Y)"
```
```   200     using K J by simp
```
```   201   also have "emb (K \<union> J) K Y = emb (K \<union> J) J X"
```
```   202     using K J by (simp add: prod_emb_injective[of "K \<union> J" I])
```
```   203   also have "emeasure (PiP (K \<union> J) M P) (emb (K \<union> J) J X) = emeasure (PiP J M P) X"
```
```   204     using K J by simp
```
```   205   finally show "emeasure (PiP J M P) X = emeasure (PiP K M P) Y" ..
```
```   206 qed (insert J, force)
```
```   207
```
```   208 lemma \<mu>G_eq:
```
```   209   "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 (PiP J M P) X"
```
```   210   by (intro \<mu>G_spec) auto
```
```   211
```
```   212 lemma generator_Ex:
```
```   213   assumes *: "A \<in> generator"
```
```   214   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 (PiP J M P) X"
```
```   215 proof -
```
```   216   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)"
```
```   217     unfolding generator_def by auto
```
```   218   with \<mu>G_spec[OF this] show ?thesis by auto
```
```   219 qed
```
```   220
```
```   221 lemma generatorE:
```
```   222   assumes A: "A \<in> generator"
```
```   223   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 (PiP J M P) X"
```
```   224 proof -
```
```   225   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"
```
```   226     "\<mu>G A = emeasure (PiP J M P) X" by auto
```
```   227   then show thesis by (intro that) auto
```
```   228 qed
```
```   229
```
```   230 lemma merge_sets:
```
```   231   "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)"
```
```   232   by simp
```
```   233
```
```   234 lemma merge_emb:
```
```   235   assumes "K \<subseteq> I" "J \<subseteq> I" and y: "y \<in> space (Pi\<^isub>M J M)"
```
```   236   shows "((\<lambda>x. merge J (I - J) (y, x)) -` emb I K X \<inter> space (Pi\<^isub>M I M)) =
```
```   237     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))"
```
```   238 proof -
```
```   239   have [simp]: "\<And>x J K L. merge J K (y, restrict x L) = merge J (K \<inter> L) (y, x)"
```
```   240     by (auto simp: restrict_def merge_def)
```
```   241   have [simp]: "\<And>x J K L. restrict (merge J K (y, x)) L = merge (J \<inter> L) (K \<inter> L) (y, x)"
```
```   242     by (auto simp: restrict_def merge_def)
```
```   243   have [simp]: "(I - J) \<inter> K = K - J" using `K \<subseteq> I` `J \<subseteq> I` by auto
```
```   244   have [simp]: "(K - J) \<inter> (K \<union> J) = K - J" by auto
```
```   245   have [simp]: "(K - J) \<inter> K = K - J" by auto
```
```   246   from y `K \<subseteq> I` `J \<subseteq> I` show ?thesis
```
```   247     by (simp split: split_merge add: prod_emb_def Pi_iff extensional_merge_sub set_eq_iff space_PiM)
```
```   248        auto
```
```   249 qed
```
```   250
```
```   251 lemma positive_\<mu>G:
```
```   252   assumes "I \<noteq> {}"
```
```   253   shows "positive generator \<mu>G"
```
```   254 proof -
```
```   255   interpret G!: algebra "\<Pi>\<^isub>E i\<in>I. space (M i)" generator by (rule algebra_generator) fact
```
```   256   show ?thesis
```
```   257   proof (intro positive_def[THEN iffD2] conjI ballI)
```
```   258     from generatorE[OF G.empty_sets] guess J X . note this[simp]
```
```   259     have "X = {}"
```
```   260       by (rule prod_emb_injective[of J I]) simp_all
```
```   261     then show "\<mu>G {} = 0" by simp
```
```   262   next
```
```   263     fix A assume "A \<in> generator"
```
```   264     from generatorE[OF this] guess J X . note this[simp]
```
```   265     show "0 \<le> \<mu>G A" by (simp add: emeasure_nonneg)
```
```   266   qed
```
```   267 qed
```
```   268
```
```   269 lemma additive_\<mu>G:
```
```   270   assumes "I \<noteq> {}"
```
```   271   shows "additive generator \<mu>G"
```
```   272 proof -
```
```   273   interpret G!: algebra "\<Pi>\<^isub>E i\<in>I. space (M i)" generator by (rule algebra_generator) fact
```
```   274   show ?thesis
```
```   275   proof (intro additive_def[THEN iffD2] ballI impI)
```
```   276     fix A assume "A \<in> generator" with generatorE guess J X . note J = this
```
```   277     fix B assume "B \<in> generator" with generatorE guess K Y . note K = this
```
```   278     assume "A \<inter> B = {}"
```
```   279     have JK: "J \<union> K \<noteq> {}" "J \<union> K \<subseteq> I" "finite (J \<union> K)"
```
```   280       using J K by auto
```
```   281     have JK_disj: "emb (J \<union> K) J X \<inter> emb (J \<union> K) K Y = {}"
```
```   282       apply (rule prod_emb_injective[of "J \<union> K" I])
```
```   283       apply (insert `A \<inter> B = {}` JK J K)
```
```   284       apply (simp_all add: Int prod_emb_Int)
```
```   285       done
```
```   286     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)"
```
```   287       using J K by simp_all
```
```   288     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))"
```
```   289       by simp
```
```   290     also have "\<dots> = emeasure (PiP (J \<union> K) M P) (emb (J \<union> K) J X \<union> emb (J \<union> K) K Y)"
```
```   291       using JK J(1, 4) K(1, 4) by (simp add: \<mu>G_eq Un del: prod_emb_Un)
```
```   292     also have "\<dots> = \<mu>G A + \<mu>G B"
```
```   293       using J K JK_disj by (simp add: plus_emeasure[symmetric])
```
```   294     finally show "\<mu>G (A \<union> B) = \<mu>G A + \<mu>G B" .
```
```   295   qed
```
```   296 qed
```
```   297
```
```   298 end
```
```   299
```
```   300 end
```