src/HOL/Probability/Regularity.thy
changeset 50125 4319691be975
parent 50089 1badf63e5d97
child 50244 de72bbe42190
     1.1 --- a/src/HOL/Probability/Regularity.thy	Mon Nov 19 16:09:11 2012 +0100
     1.2 +++ b/src/HOL/Probability/Regularity.thy	Mon Nov 19 18:01:48 2012 +0100
     1.3 @@ -210,11 +210,9 @@
     1.4      ultimately
     1.5      show "?thesis e " by (auto simp: sU)
     1.6    qed
     1.7 -  have closed_in_D: "\<And>A. closed A \<Longrightarrow> ?inner A \<and> ?outer A"
     1.8 -  proof
     1.9 -    fix A::"'a set" assume "closed A" hence "A \<in> sets borel" by (simp add: compact_imp_closed)
    1.10 +  { fix A::"'a set" assume "closed A" hence "A \<in> sets borel" by (simp add: compact_imp_closed)
    1.11      hence [simp]: "A \<in> sets M" by (simp add: sb)
    1.12 -    show "?inner A"
    1.13 +    have "?inner A"
    1.14      proof (rule approx_inner)
    1.15        fix e::real assume "e > 0"
    1.16        from approx_space[OF this] obtain K where
    1.17 @@ -237,7 +235,7 @@
    1.18        ultimately show "\<exists>K \<subseteq> A. compact K \<and> emeasure M A \<le> emeasure M K + ereal e"
    1.19          by blast
    1.20      qed simp
    1.21 -    show "?outer A"
    1.22 +    have "?outer A"
    1.23      proof cases
    1.24        assume "A \<noteq> {}"
    1.25        let ?G = "\<lambda>d. {x. infdist x A < d}"
    1.26 @@ -288,25 +286,25 @@
    1.27          by (rule INF_greatest) (auto intro!: emeasure_mono simp: sb)
    1.28        ultimately show ?thesis by simp
    1.29      qed (auto intro!: ereal_INFI)
    1.30 -  qed
    1.31 -  let ?D = "{B \<in> sets M. ?inner B \<and> ?outer B}"
    1.32 -  interpret dynkin: dynkin_system "space M" ?D
    1.33 -  proof (rule dynkin_systemI)
    1.34 -    have "{U::'a set. space M \<subseteq> U \<and> open U} = {space M}" by (auto simp add: sU)
    1.35 -    hence "?outer (space M)" by (simp add: min_def INF_def)
    1.36 -    moreover
    1.37 -    have "?inner (space M)"
    1.38 -    proof (rule ereal_approx_SUP)
    1.39 -      fix e::real assume "0 < e"
    1.40 -      thus "\<exists>K\<in>{K. K \<subseteq> space M \<and> compact K}. emeasure M (space M) \<le> emeasure M K + ereal e"
    1.41 -        by (rule approx_space)
    1.42 -    qed (auto intro: emeasure_mono simp: sU sb intro!: exI[where x="{}"])
    1.43 -    ultimately show "space M \<in> ?D" by (simp add: sU sb)
    1.44 +    note `?inner A` `?outer A` }
    1.45 +  note closed_in_D = this
    1.46 +  from `B \<in> sets borel`
    1.47 +  have "Int_stable (Collect closed)" "Collect closed \<subseteq> Pow UNIV" "B \<in> sigma_sets UNIV (Collect closed)" 
    1.48 +    by (auto simp: Int_stable_def borel_eq_closed)
    1.49 +  then show "?inner B" "?outer B"
    1.50 +  proof (induct B rule: sigma_sets_induct_disjoint)
    1.51 +    case empty
    1.52 +    { case 1 show ?case by (intro ereal_SUPI[symmetric]) auto }
    1.53 +    { case 2 show ?case by (intro ereal_INFI[symmetric]) (auto elim!: meta_allE[of _ "{}"]) }
    1.54    next
    1.55 -    fix B assume "B \<in> ?D" thus "B \<subseteq> space M" by (simp add: sU)
    1.56 -    from `B \<in> ?D` have [simp]: "B \<in> sets M" and "?inner B" "?outer B" by auto
    1.57 -    hence inner: "emeasure M B = (SUP K:{K. K \<subseteq> B \<and> compact K}. emeasure M K)"
    1.58 -      and outer: "emeasure M B = (INF U:{U. B \<subseteq> U \<and> open U}. emeasure M U)" by auto
    1.59 +    case (basic B)
    1.60 +    { case 1 from basic closed_in_D show ?case by auto }
    1.61 +    { case 2 from basic closed_in_D show ?case by auto }
    1.62 +  next
    1.63 +    case (compl B)
    1.64 +    note inner = compl(2) and outer = compl(3)
    1.65 +    from compl have [simp]: "B \<in> sets M" by (auto simp: sb borel_eq_closed)
    1.66 +    case 2
    1.67      have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl)
    1.68      also have "\<dots> = (INF K:{K. K \<subseteq> B \<and> compact K}. M (space M) -  M K)"
    1.69        unfolding inner by (subst INFI_ereal_cminus) force+
    1.70 @@ -315,7 +313,7 @@
    1.71      also have "\<dots> \<ge> (INF U:{U. U \<subseteq> B \<and> closed U}. M (space M - U))"
    1.72        by (rule INF_superset_mono) (auto simp add: compact_imp_closed)
    1.73      also have "(INF U:{U. U \<subseteq> B \<and> closed U}. M (space M - U)) =
    1.74 -      (INF U:{U. space M - B \<subseteq> U \<and> open U}. emeasure M U)"
    1.75 +        (INF U:{U. space M - B \<subseteq> U \<and> open U}. emeasure M U)"
    1.76        by (subst INF_image[of "\<lambda>u. space M - u", symmetric])
    1.77           (rule INF_cong, auto simp add: sU intro!: INF_cong)
    1.78      finally have
    1.79 @@ -323,41 +321,39 @@
    1.80      moreover have
    1.81        "(INF U:{U. space M - B \<subseteq> U \<and> open U}. emeasure M U) \<ge> emeasure M (space M - B)"
    1.82        by (auto simp: sb sU intro!: INF_greatest emeasure_mono)
    1.83 -    ultimately have "?outer (space M - B)" by simp
    1.84 -    moreover
    1.85 -    {
    1.86 -      have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl)
    1.87 -      also have "\<dots> = (SUP U: {U. B \<subseteq> U \<and> open U}. M (space M) -  M U)"
    1.88 -        unfolding outer by (subst SUPR_ereal_cminus) auto
    1.89 -      also have "\<dots> = (SUP U:{U. B \<subseteq> U \<and> open U}. M (space M - U))"
    1.90 -        by (rule SUP_cong) (auto simp add: emeasure_compl sb compact_imp_closed)
    1.91 -      also have "\<dots> = (SUP K:{K. K \<subseteq> space M - B \<and> closed K}. emeasure M K)"
    1.92 -        by (subst SUP_image[of "\<lambda>u. space M - u", symmetric])
    1.93 -           (rule SUP_cong, auto simp: sU)
    1.94 -      also have "\<dots> = (SUP K:{K. K \<subseteq> space M - B \<and> compact K}. emeasure M K)"
    1.95 -      proof (safe intro!: antisym SUP_least)
    1.96 -        fix K assume "closed K" "K \<subseteq> space M - B"
    1.97 -        from closed_in_D[OF `closed K`]
    1.98 -        have K_inner: "emeasure M K = (SUP K:{Ka. Ka \<subseteq> K \<and> compact Ka}. emeasure M K)" by simp
    1.99 -        show "emeasure M K \<le> (SUP K:{K. K \<subseteq> space M - B \<and> compact K}. emeasure M K)"
   1.100 -          unfolding K_inner using `K \<subseteq> space M - B`
   1.101 -          by (auto intro!: SUP_upper SUP_least)
   1.102 -      qed (fastforce intro!: SUP_least SUP_upper simp: compact_imp_closed)
   1.103 -      finally have "?inner (space M - B)" .
   1.104 -    } hence "?inner (space M - B)" .
   1.105 -    ultimately show "space M - B \<in> ?D" by auto
   1.106 +    ultimately show ?case by (auto intro!: antisym simp: sets_eq_imp_space_eq[OF sb])
   1.107 +
   1.108 +    case 1
   1.109 +    have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl)
   1.110 +    also have "\<dots> = (SUP U: {U. B \<subseteq> U \<and> open U}. M (space M) -  M U)"
   1.111 +      unfolding outer by (subst SUPR_ereal_cminus) auto
   1.112 +    also have "\<dots> = (SUP U:{U. B \<subseteq> U \<and> open U}. M (space M - U))"
   1.113 +      by (rule SUP_cong) (auto simp add: emeasure_compl sb compact_imp_closed)
   1.114 +    also have "\<dots> = (SUP K:{K. K \<subseteq> space M - B \<and> closed K}. emeasure M K)"
   1.115 +      by (subst SUP_image[of "\<lambda>u. space M - u", symmetric])
   1.116 +         (rule SUP_cong, auto simp: sU)
   1.117 +    also have "\<dots> = (SUP K:{K. K \<subseteq> space M - B \<and> compact K}. emeasure M K)"
   1.118 +    proof (safe intro!: antisym SUP_least)
   1.119 +      fix K assume "closed K" "K \<subseteq> space M - B"
   1.120 +      from closed_in_D[OF `closed K`]
   1.121 +      have K_inner: "emeasure M K = (SUP K:{Ka. Ka \<subseteq> K \<and> compact Ka}. emeasure M K)" by simp
   1.122 +      show "emeasure M K \<le> (SUP K:{K. K \<subseteq> space M - B \<and> compact K}. emeasure M K)"
   1.123 +        unfolding K_inner using `K \<subseteq> space M - B`
   1.124 +        by (auto intro!: SUP_upper SUP_least)
   1.125 +    qed (fastforce intro!: SUP_least SUP_upper simp: compact_imp_closed)
   1.126 +    finally show ?case by (auto intro!: antisym simp: sets_eq_imp_space_eq[OF sb])
   1.127    next
   1.128 -    fix D :: "nat \<Rightarrow> _"
   1.129 -    assume "range D \<subseteq> ?D" hence "range D \<subseteq> sets M" by auto
   1.130 -    moreover assume "disjoint_family D"
   1.131 -    ultimately have M[symmetric]: "(\<Sum>i. M (D i)) = M (\<Union>i. D i)" by (rule suminf_emeasure)
   1.132 +    case (union D)
   1.133 +    then have "range D \<subseteq> sets M" by (auto simp: sb borel_eq_closed)
   1.134 +    with union have M[symmetric]: "(\<Sum>i. M (D i)) = M (\<Union>i. D i)" by (intro suminf_emeasure)
   1.135      also have "(\<lambda>n. \<Sum>i\<in>{0..<n}. M (D i)) ----> (\<Sum>i. M (D i))"
   1.136        by (intro summable_sumr_LIMSEQ_suminf summable_ereal_pos emeasure_nonneg)
   1.137      finally have measure_LIMSEQ: "(\<lambda>n. \<Sum>i = 0..<n. measure M (D i)) ----> measure M (\<Union>i. D i)"
   1.138        by (simp add: emeasure_eq_measure)
   1.139      have "(\<Union>i. D i) \<in> sets M" using `range D \<subseteq> sets M` by auto
   1.140 -    moreover
   1.141 -    hence "?inner (\<Union>i. D i)"
   1.142 +    
   1.143 +    case 1
   1.144 +    show ?case
   1.145      proof (rule approx_inner)
   1.146        fix e::real assume "e > 0"
   1.147        with measure_LIMSEQ
   1.148 @@ -379,7 +375,7 @@
   1.149          fix i
   1.150          from `0 < e` have "0 < e/(2*Suc n0)" by (auto intro: divide_pos_pos)
   1.151          have "emeasure M (D i) = (SUP K:{K. K \<subseteq> (D i) \<and> compact K}. emeasure M K)"
   1.152 -          using `range D \<subseteq> ?D` by blast
   1.153 +          using union by blast
   1.154          from SUP_approx_ereal[OF `0 < e/(2*Suc n0)` this]
   1.155          show "\<exists>K. K \<subseteq> D i \<and> compact K \<and> emeasure M (D i) \<le> emeasure M K + e/(2*Suc n0)"
   1.156            by (auto simp: emeasure_eq_measure)
   1.157 @@ -410,8 +406,9 @@
   1.158        ultimately
   1.159        have "?K\<subseteq>(\<Union>i. D i) \<and> compact ?K \<and> emeasure M (\<Union>i. D i) \<le> emeasure M ?K + ereal e" by simp
   1.160        thus "\<exists>K\<subseteq>\<Union>i. D i. compact K \<and> emeasure M (\<Union>i. D i) \<le> emeasure M K + ereal e" ..
   1.161 -    qed
   1.162 -    moreover have "?outer (\<Union>i. D i)"
   1.163 +    qed fact
   1.164 +    case 2
   1.165 +    show ?case
   1.166      proof (rule approx_outer[OF `(\<Union>i. D i) \<in> sets M`])
   1.167        fix e::real assume "e > 0"
   1.168        have "\<forall>i::nat. \<exists>U. D i \<subseteq> U \<and> open U \<and> e/(2 powr Suc i) > emeasure M U - emeasure M (D i)"
   1.169 @@ -419,7 +416,7 @@
   1.170          fix i::nat
   1.171          from `0 < e` have "0 < e/(2 powr Suc i)" by (auto intro: divide_pos_pos)
   1.172          have "emeasure M (D i) = (INF U:{U. (D i) \<subseteq> U \<and> open U}. emeasure M U)"
   1.173 -          using `range D \<subseteq> ?D` by blast
   1.174 +          using union by blast
   1.175          from INF_approx_ereal[OF `0 < e/(2 powr Suc i)` this]
   1.176          show "\<exists>U. D i \<subseteq> U \<and> open U \<and> e/(2 powr Suc i) > emeasure M U - emeasure M (D i)"
   1.177            by (auto simp: emeasure_eq_measure)
   1.178 @@ -455,20 +452,7 @@
   1.179        have "(\<Union>i. D i) \<subseteq> ?U \<and> open ?U \<and> emeasure M ?U \<le> emeasure M (\<Union>i. D i) + ereal e" by simp
   1.180        thus "\<exists>B. (\<Union>i. D i) \<subseteq> B \<and> open B \<and> emeasure M B \<le> emeasure M (\<Union>i. D i) + ereal e" ..
   1.181      qed
   1.182 -    ultimately show "(\<Union>i. D i) \<in> ?D" by safe
   1.183    qed
   1.184 -  have "sets borel = sigma_sets (space M) (Collect closed)" by (simp add: borel_eq_closed sU)
   1.185 -  also have "\<dots> = dynkin (space M) (Collect closed)"
   1.186 -  proof (rule sigma_eq_dynkin)
   1.187 -    show "Collect closed \<subseteq> Pow (space M)" using Sigma_Algebra.sets_into_space by (auto simp: sU)
   1.188 -    show "Int_stable (Collect closed)" by (auto simp: Int_stable_def)
   1.189 -  qed
   1.190 -  also have "\<dots> \<subseteq> ?D" using closed_in_D
   1.191 -    by (intro dynkin.dynkin_subset) (auto simp add: compact_imp_closed sb)
   1.192 -  finally have "sets borel \<subseteq> ?D" .
   1.193 -  moreover have "?D \<subseteq> sets borel" by (auto simp: sb)
   1.194 -  ultimately have "sets borel = ?D" by simp
   1.195 -  with assms show "?inner B" and "?outer B" by auto
   1.196  qed
   1.197  
   1.198  end