src/HOL/Probability/Borel_Space.thy
changeset 63040 eb4ddd18d635
parent 62975 1d066f6ab25d
child 63167 0909deb8059b
equal deleted inserted replaced
63039:1a20fd9cf281 63040:eb4ddd18d635
   280 lemma continuous_interval_vimage_Int:
   280 lemma continuous_interval_vimage_Int:
   281   assumes "continuous_on {a::real..b} g" and mono: "\<And>x y. a \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> b \<Longrightarrow> g x \<le> g y"
   281   assumes "continuous_on {a::real..b} g" and mono: "\<And>x y. a \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> b \<Longrightarrow> g x \<le> g y"
   282   assumes "a \<le> b" "(c::real) \<le> d" "{c..d} \<subseteq> {g a..g b}"
   282   assumes "a \<le> b" "(c::real) \<le> d" "{c..d} \<subseteq> {g a..g b}"
   283   obtains c' d' where "{a..b} \<inter> g -` {c..d} = {c'..d'}" "c' \<le> d'" "g c' = c" "g d' = d"
   283   obtains c' d' where "{a..b} \<inter> g -` {c..d} = {c'..d'}" "c' \<le> d'" "g c' = c" "g d' = d"
   284 proof-
   284 proof-
   285     let ?A = "{a..b} \<inter> g -` {c..d}"
   285   let ?A = "{a..b} \<inter> g -` {c..d}"
   286     from IVT'[of g a c b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   286   from IVT'[of g a c b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   287          obtain c'' where c'': "c'' \<in> ?A" "g c'' = c" by auto
   287   obtain c'' where c'': "c'' \<in> ?A" "g c'' = c" by auto
   288     from IVT'[of g a d b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   288   from IVT'[of g a d b, OF _ _ \<open>a \<le> b\<close> assms(1)] assms(4,5)
   289          obtain d'' where d'': "d'' \<in> ?A" "g d'' = d" by auto
   289   obtain d'' where d'': "d'' \<in> ?A" "g d'' = d" by auto
   290     hence [simp]: "?A \<noteq> {}" by blast
   290   hence [simp]: "?A \<noteq> {}" by blast
   291 
   291 
   292     def c' \<equiv> "Inf ?A" and d' \<equiv> "Sup ?A"
   292   define c' where "c' = Inf ?A"
   293     have "?A \<subseteq> {c'..d'}" unfolding c'_def d'_def
   293   define d' where "d' = Sup ?A"
   294         by (intro subsetI) (auto intro: cInf_lower cSup_upper)
   294   have "?A \<subseteq> {c'..d'}" unfolding c'_def d'_def
   295     moreover from assms have "closed ?A"
   295     by (intro subsetI) (auto intro: cInf_lower cSup_upper)
   296         using continuous_on_closed_vimage[of "{a..b}" g] by (subst Int_commute) simp
   296   moreover from assms have "closed ?A"
   297     hence c'd'_in_set: "c' \<in> ?A" "d' \<in> ?A" unfolding c'_def d'_def
   297     using continuous_on_closed_vimage[of "{a..b}" g] by (subst Int_commute) simp
   298         by ((intro closed_contains_Inf closed_contains_Sup, simp_all)[])+
   298   hence c'd'_in_set: "c' \<in> ?A" "d' \<in> ?A" unfolding c'_def d'_def
   299     hence "{c'..d'} \<subseteq> ?A" using assms
   299     by ((intro closed_contains_Inf closed_contains_Sup, simp_all)[])+
   300         by (intro subsetI)
   300   hence "{c'..d'} \<subseteq> ?A" using assms
   301            (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x]
   301     by (intro subsetI)
   302                  intro!: mono)
   302        (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x]
   303     moreover have "c' \<le> d'" using c'd'_in_set(2) unfolding c'_def by (intro cInf_lower) auto
   303              intro!: mono)
   304     moreover have "g c' \<le> c" "g d' \<ge> d"
   304   moreover have "c' \<le> d'" using c'd'_in_set(2) unfolding c'_def by (intro cInf_lower) auto
   305       apply (insert c'' d'' c'd'_in_set)
   305   moreover have "g c' \<le> c" "g d' \<ge> d"
   306       apply (subst c''(2)[symmetric])
   306     apply (insert c'' d'' c'd'_in_set)
   307       apply (auto simp: c'_def intro!: mono cInf_lower c'') []
   307     apply (subst c''(2)[symmetric])
   308       apply (subst d''(2)[symmetric])
   308     apply (auto simp: c'_def intro!: mono cInf_lower c'') []
   309       apply (auto simp: d'_def intro!: mono cSup_upper d'') []
   309     apply (subst d''(2)[symmetric])
   310       done
   310     apply (auto simp: d'_def intro!: mono cSup_upper d'') []
   311     with c'd'_in_set have "g c' = c" "g d' = d" by auto
   311     done
   312     ultimately show ?thesis using that by blast
   312   with c'd'_in_set have "g c' = c" "g d' = d" by auto
       
   313   ultimately show ?thesis using that by blast
   313 qed
   314 qed
   314 
   315 
   315 subsection \<open>Generic Borel spaces\<close>
   316 subsection \<open>Generic Borel spaces\<close>
   316 
   317 
   317 definition (in topological_space) borel :: "'a measure" where
   318 definition (in topological_space) borel :: "'a measure" where
   538     from ex_countable_basis obtain B :: "'a set set" where
   539     from ex_countable_basis obtain B :: "'a set set" where
   539       B:  "\<And>b. b \<in> B \<Longrightarrow> open b" "\<And>X. open X \<Longrightarrow> \<exists>b\<subseteq>B. (\<Union>b) = X" and "countable B"
   540       B:  "\<And>b. b \<in> B \<Longrightarrow> open b" "\<And>X. open X \<Longrightarrow> \<exists>b\<subseteq>B. (\<Union>b) = X" and "countable B"
   540       by (auto simp: topological_basis_def)
   541       by (auto simp: topological_basis_def)
   541     from B(2)[OF K] obtain m where m: "\<And>k. k \<in> K \<Longrightarrow> m k \<subseteq> B" "\<And>k. k \<in> K \<Longrightarrow> (\<Union>m k) = k"
   542     from B(2)[OF K] obtain m where m: "\<And>k. k \<in> K \<Longrightarrow> m k \<subseteq> B" "\<And>k. k \<in> K \<Longrightarrow> (\<Union>m k) = k"
   542       by metis
   543       by metis
   543     def U \<equiv> "(\<Union>k\<in>K. m k)"
   544     define U where "U = (\<Union>k\<in>K. m k)"
   544     with m have "countable U"
   545     with m have "countable U"
   545       by (intro countable_subset[OF _ \<open>countable B\<close>]) auto
   546       by (intro countable_subset[OF _ \<open>countable B\<close>]) auto
   546     have "\<Union>U = (\<Union>A\<in>U. A)" by simp
   547     have "\<Union>U = (\<Union>A\<in>U. A)" by simp
   547     also have "\<dots> = \<Union>K"
   548     also have "\<dots> = \<Union>K"
   548       unfolding U_def UN_simps by (simp add: m)
   549       unfolding U_def UN_simps by (simp add: m)
  1809 lemma borel_measurable_lim_metric[measurable (raw)]:
  1810 lemma borel_measurable_lim_metric[measurable (raw)]:
  1810   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  1811   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  1811   assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M"
  1812   assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M"
  1812   shows "(\<lambda>x. lim (\<lambda>i. f i x)) \<in> borel_measurable M"
  1813   shows "(\<lambda>x. lim (\<lambda>i. f i x)) \<in> borel_measurable M"
  1813 proof -
  1814 proof -
  1814   def u' \<equiv> "\<lambda>x. lim (\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0)"
  1815   define u' where "u' x = lim (\<lambda>i. if Cauchy (\<lambda>i. f i x) then f i x else 0)" for x
  1815   then have *: "\<And>x. lim (\<lambda>i. f i x) = (if Cauchy (\<lambda>i. f i x) then u' x else (THE x. False))"
  1816   then have *: "\<And>x. lim (\<lambda>i. f i x) = (if Cauchy (\<lambda>i. f i x) then u' x else (THE x. False))"
  1816     by (auto simp: lim_def convergent_eq_cauchy[symmetric])
  1817     by (auto simp: lim_def convergent_eq_cauchy[symmetric])
  1817   have "u' \<in> borel_measurable M"
  1818   have "u' \<in> borel_measurable M"
  1818   proof (rule borel_measurable_LIMSEQ_metric)
  1819   proof (rule borel_measurable_LIMSEQ_metric)
  1819     fix x
  1820     fix x