src/HOL/Analysis/Sigma_Algebra.thy
changeset 69554 4d4aedf9e57f
parent 69546 27dae626822b
child 69555 b07ccc6fb13f
equal deleted inserted replaced
69553:2c2e2b3e19b7 69554:4d4aedf9e57f
   800   thus "(\<Union>i::nat. A i) \<in> M" by (simp add: UN_disjointed_eq)
   800   thus "(\<Union>i::nat. A i) \<in> M" by (simp add: UN_disjointed_eq)
   801 qed
   801 qed
   802 
   802 
   803 subsubsection%unimportant \<open>Ring generated by a semiring\<close>
   803 subsubsection%unimportant \<open>Ring generated by a semiring\<close>
   804 
   804 
   805 definition (in semiring_of_sets)
   805 definition (in semiring_of_sets) generated_ring :: "'a set set" where
   806   "generated_ring = { \<Union>C | C. C \<subseteq> M \<and> finite C \<and> disjoint C }"
   806   "generated_ring = { \<Union>C | C. C \<subseteq> M \<and> finite C \<and> disjoint C }"
   807 
   807 
   808 lemma (in semiring_of_sets) generated_ringE[elim?]:
   808 lemma (in semiring_of_sets) generated_ringE[elim?]:
   809   assumes "a \<in> generated_ring"
   809   assumes "a \<in> generated_ring"
   810   obtains C where "finite C" "disjoint C" "C \<subseteq> M" "a = \<Union>C"
   810   obtains C where "finite C" "disjoint C" "C \<subseteq> M" "a = \<Union>C"
   945 lemma UN_binaryset_eq: "(\<Union>i. binaryset A B i) = A \<union> B"
   945 lemma UN_binaryset_eq: "(\<Union>i. binaryset A B i) = A \<union> B"
   946   by (simp add: range_binaryset_eq cong del: SUP_cong_simp)
   946   by (simp add: range_binaryset_eq cong del: SUP_cong_simp)
   947 
   947 
   948 subsubsection \<open>Closed CDI\<close>
   948 subsubsection \<open>Closed CDI\<close>
   949 
   949 
   950 definition%important closed_cdi where
   950 definition%important closed_cdi :: "'a set \<Rightarrow> 'a set set \<Rightarrow> bool" where
   951   "closed_cdi \<Omega> M \<longleftrightarrow>
   951   "closed_cdi \<Omega> M \<longleftrightarrow>
   952    M \<subseteq> Pow \<Omega> &
   952    M \<subseteq> Pow \<Omega> &
   953    (\<forall>s \<in> M. \<Omega> - s \<in> M) &
   953    (\<forall>s \<in> M. \<Omega> - s \<in> M) &
   954    (\<forall>A. (range A \<subseteq> M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
   954    (\<forall>A. (range A \<subseteq> M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
   955         (\<Union>i. A i) \<in> M) &
   955         (\<Union>i. A i) \<in> M) &
  1241   show ?thesis using sets_into_space by (fastforce intro!: dynkin_systemI)
  1241   show ?thesis using sets_into_space by (fastforce intro!: dynkin_systemI)
  1242 qed
  1242 qed
  1243 
  1243 
  1244 subsubsection "Intersection sets systems"
  1244 subsubsection "Intersection sets systems"
  1245 
  1245 
  1246 definition%important "Int_stable M \<longleftrightarrow> (\<forall> a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)"
  1246 definition%important Int_stable :: "'a set set \<Rightarrow> bool" where
       
  1247 "Int_stable M \<longleftrightarrow> (\<forall> a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)"
  1247 
  1248 
  1248 lemma (in algebra) Int_stable: "Int_stable M"
  1249 lemma (in algebra) Int_stable: "Int_stable M"
  1249   unfolding Int_stable_def by auto
  1250   unfolding Int_stable_def by auto
  1250 
  1251 
  1251 lemma Int_stableI_image:
  1252 lemma Int_stableI_image:
  1281   qed auto
  1282   qed auto
  1282 qed
  1283 qed
  1283 
  1284 
  1284 subsubsection "Smallest Dynkin systems"
  1285 subsubsection "Smallest Dynkin systems"
  1285 
  1286 
  1286 definition%important dynkin where
  1287 definition%important dynkin :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set" where
  1287   "dynkin \<Omega> M =  (\<Inter>{D. dynkin_system \<Omega> D \<and> M \<subseteq> D})"
  1288   "dynkin \<Omega> M =  (\<Inter>{D. dynkin_system \<Omega> D \<and> M \<subseteq> D})"
  1288 
  1289 
  1289 lemma dynkin_system_dynkin:
  1290 lemma dynkin_system_dynkin:
  1290   assumes "M \<subseteq> Pow (\<Omega>)"
  1291   assumes "M \<subseteq> Pow (\<Omega>)"
  1291   shows "dynkin_system \<Omega> (dynkin \<Omega> M)"
  1292   shows "dynkin_system \<Omega> (dynkin \<Omega> M)"
  1458 
  1459 
  1459 definition%important positive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
  1460 definition%important positive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
  1460   "positive M \<mu> \<longleftrightarrow> \<mu> {} = 0"
  1461   "positive M \<mu> \<longleftrightarrow> \<mu> {} = 0"
  1461 
  1462 
  1462 definition%important countably_additive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
  1463 definition%important countably_additive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
  1463   "countably_additive M f \<longleftrightarrow> (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow>
  1464 "countably_additive M f \<longleftrightarrow>
       
  1465   (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow>
  1464     (\<Sum>i. f (A i)) = f (\<Union>i. A i))"
  1466     (\<Sum>i. f (A i)) = f (\<Union>i. A i))"
  1465 
  1467 
  1466 definition%important measure_space :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
  1468 definition%important measure_space :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> bool" where
  1467   "measure_space \<Omega> A \<mu> \<longleftrightarrow> sigma_algebra \<Omega> A \<and> positive A \<mu> \<and> countably_additive A \<mu>"
  1469 "measure_space \<Omega> A \<mu> \<longleftrightarrow>
  1468 
  1470   sigma_algebra \<Omega> A \<and> positive A \<mu> \<and> countably_additive A \<mu>"
  1469 typedef%important 'a measure = "{(\<Omega>::'a set, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu> }"
  1471 
       
  1472 typedef%important 'a measure =
       
  1473   "{(\<Omega>::'a set, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu> }"
  1470 proof%unimportant
  1474 proof%unimportant
  1471   have "sigma_algebra UNIV {{}, UNIV}"
  1475   have "sigma_algebra UNIV {{}, UNIV}"
  1472     by (auto simp: sigma_algebra_iff2)
  1476     by (auto simp: sigma_algebra_iff2)
  1473   then show "(UNIV, {{}, UNIV}, \<lambda>A. 0) \<in> {(\<Omega>, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu>} "
  1477   then show "(UNIV, {{}, UNIV}, \<lambda>A. 0) \<in> {(\<Omega>, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu>} "
  1474     by (auto simp: measure_space_def positive_def countably_additive_def)
  1478     by (auto simp: measure_space_def positive_def countably_additive_def)
  1496   by (cases M) (auto simp: space_def sets_def emeasure_def Abs_measure_inverse)
  1500   by (cases M) (auto simp: space_def sets_def emeasure_def Abs_measure_inverse)
  1497 
  1501 
  1498 interpretation sets: sigma_algebra "space M" "sets M" for M :: "'a measure"
  1502 interpretation sets: sigma_algebra "space M" "sets M" for M :: "'a measure"
  1499   using measure_space[of M] by (auto simp: measure_space_def)
  1503   using measure_space[of M] by (auto simp: measure_space_def)
  1500 
  1504 
  1501 definition%important measure_of :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
  1505 definition%important measure_of :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ennreal) \<Rightarrow> 'a measure"
  1502   "measure_of \<Omega> A \<mu> = Abs_measure (\<Omega>, if A \<subseteq> Pow \<Omega> then sigma_sets \<Omega> A else {{}, \<Omega>},
  1506   where
       
  1507 "measure_of \<Omega> A \<mu> =
       
  1508   Abs_measure (\<Omega>, if A \<subseteq> Pow \<Omega> then sigma_sets \<Omega> A else {{}, \<Omega>},
  1503     \<lambda>a. if a \<in> sigma_sets \<Omega> A \<and> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> then \<mu> a else 0)"
  1509     \<lambda>a. if a \<in> sigma_sets \<Omega> A \<and> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> then \<mu> a else 0)"
  1504 
  1510 
  1505 abbreviation "sigma \<Omega> A \<equiv> measure_of \<Omega> A (\<lambda>x. 0)"
  1511 abbreviation "sigma \<Omega> A \<equiv> measure_of \<Omega> A (\<lambda>x. 0)"
  1506 
  1512 
  1507 lemma measure_space_0: "A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)"
  1513 lemma measure_space_0: "A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)"
  1713   shows "sigma \<Omega> M = sigma \<Omega> N"
  1719   shows "sigma \<Omega> M = sigma \<Omega> N"
  1714   by (rule measure_eqI) (simp_all add: emeasure_sigma)
  1720   by (rule measure_eqI) (simp_all add: emeasure_sigma)
  1715 
  1721 
  1716 subsubsection \<open>Measurable functions\<close>
  1722 subsubsection \<open>Measurable functions\<close>
  1717 
  1723 
  1718 definition%important measurable :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) set" (infixr "\<rightarrow>\<^sub>M" 60) where
  1724 definition%important measurable :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) set"
  1719   "measurable A B = {f \<in> space A \<rightarrow> space B. \<forall>y \<in> sets B. f -` y \<inter> space A \<in> sets A}"
  1725   (infixr "\<rightarrow>\<^sub>M" 60) where
       
  1726 "measurable A B = {f \<in> space A \<rightarrow> space B. \<forall>y \<in> sets B. f -` y \<inter> space A \<in> sets A}"
  1720 
  1727 
  1721 lemma measurableI:
  1728 lemma measurableI:
  1722   "(\<And>x. x \<in> space M \<Longrightarrow> f x \<in> space N) \<Longrightarrow> (\<And>A. A \<in> sets N \<Longrightarrow> f -` A \<inter> space M \<in> sets M) \<Longrightarrow>
  1729   "(\<And>x. x \<in> space M \<Longrightarrow> f x \<in> space N) \<Longrightarrow> (\<And>A. A \<in> sets N \<Longrightarrow> f -` A \<inter> space M \<in> sets M) \<Longrightarrow>
  1723     f \<in> measurable M N"
  1730     f \<in> measurable M N"
  1724   by (auto simp: measurable_def)
  1731   by (auto simp: measurable_def)
  1876   using measure_of_subset[of M' \<Omega> M] by (auto simp add: measurable_def)
  1883   using measure_of_subset[of M' \<Omega> M] by (auto simp add: measurable_def)
  1877 
  1884 
  1878 subsubsection \<open>Counting space\<close>
  1885 subsubsection \<open>Counting space\<close>
  1879 
  1886 
  1880 definition%important count_space :: "'a set \<Rightarrow> 'a measure" where
  1887 definition%important count_space :: "'a set \<Rightarrow> 'a measure" where
  1881   "count_space \<Omega> = measure_of \<Omega> (Pow \<Omega>) (\<lambda>A. if finite A then of_nat (card A) else \<infinity>)"
  1888 "count_space \<Omega> = measure_of \<Omega> (Pow \<Omega>) (\<lambda>A. if finite A then of_nat (card A) else \<infinity>)"
  1882 
  1889 
  1883 lemma
  1890 lemma
  1884   shows space_count_space[simp]: "space (count_space \<Omega>) = \<Omega>"
  1891   shows space_count_space[simp]: "space (count_space \<Omega>) = \<Omega>"
  1885     and sets_count_space[simp]: "sets (count_space \<Omega>) = Pow \<Omega>"
  1892     and sets_count_space[simp]: "sets (count_space \<Omega>) = Pow \<Omega>"
  1886   using sigma_sets_into_sp[of "Pow \<Omega>" \<Omega>]
  1893   using sigma_sets_into_sp[of "Pow \<Omega>" \<Omega>]
  1953   "space N = {} \<Longrightarrow> f \<in> measurable M N \<longleftrightarrow> space M = {}"
  1960   "space N = {} \<Longrightarrow> f \<in> measurable M N \<longleftrightarrow> space M = {}"
  1954   by (auto simp add: measurable_def Pi_iff)
  1961   by (auto simp add: measurable_def Pi_iff)
  1955 
  1962 
  1956 subsubsection%unimportant \<open>Extend measure\<close>
  1963 subsubsection%unimportant \<open>Extend measure\<close>
  1957 
  1964 
  1958 definition "extend_measure \<Omega> I G \<mu> =
  1965 definition extend_measure :: "'a set \<Rightarrow> 'b set \<Rightarrow> ('b \<Rightarrow> 'a set) \<Rightarrow> ('b \<Rightarrow> ennreal) \<Rightarrow> 'a measure"
       
  1966   where
       
  1967 "extend_measure \<Omega> I G \<mu> =
  1959   (if (\<exists>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>') \<and> \<not> (\<forall>i\<in>I. \<mu> i = 0)
  1968   (if (\<exists>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>') \<and> \<not> (\<forall>i\<in>I. \<mu> i = 0)
  1960       then measure_of \<Omega> (G`I) (SOME \<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>')
  1969       then measure_of \<Omega> (G`I) (SOME \<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>')
  1961       else measure_of \<Omega> (G`I) (\<lambda>_. 0))"
  1970       else measure_of \<Omega> (G`I) (\<lambda>_. 0))"
  1962 
  1971 
  1963 lemma space_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> space (extend_measure \<Omega> I G \<mu>) = \<Omega>"
  1972 lemma space_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> space (extend_measure \<Omega> I G \<mu>) = \<Omega>"
  2013   using emeasure_extend_measure[OF M _ _ ms(2,3), of "(i,j)"] eq ms(1) \<open>I i j\<close>
  2022   using emeasure_extend_measure[OF M _ _ ms(2,3), of "(i,j)"] eq ms(1) \<open>I i j\<close>
  2014   by (auto simp: subset_eq)
  2023   by (auto simp: subset_eq)
  2015 
  2024 
  2016 subsection \<open>The smallest $\sigma$-algebra regarding a function\<close>
  2025 subsection \<open>The smallest $\sigma$-algebra regarding a function\<close>
  2017 
  2026 
  2018 definition%important
  2027 definition%important vimage_algebra :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b measure \<Rightarrow> 'a measure" where
  2019   "vimage_algebra X f M = sigma X {f -` A \<inter> X | A. A \<in> sets M}"
  2028   "vimage_algebra X f M = sigma X {f -` A \<inter> X | A. A \<in> sets M}"
  2020 
  2029 
  2021 lemma space_vimage_algebra[simp]: "space (vimage_algebra X f M) = X"
  2030 lemma space_vimage_algebra[simp]: "space (vimage_algebra X f M) = X"
  2022   unfolding vimage_algebra_def by (rule space_measure_of) auto
  2031   unfolding vimage_algebra_def by (rule space_measure_of) auto
  2023 
  2032 
  2088     by (simp add: sets_vimage_algebra2 vimage_comp comp_def flip: ex_simps)
  2097     by (simp add: sets_vimage_algebra2 vimage_comp comp_def flip: ex_simps)
  2089 qed (simp add: vimage_algebra_def emeasure_sigma)
  2098 qed (simp add: vimage_algebra_def emeasure_sigma)
  2090 
  2099 
  2091 subsubsection \<open>Restricted Space Sigma Algebra\<close>
  2100 subsubsection \<open>Restricted Space Sigma Algebra\<close>
  2092 
  2101 
  2093 definition restrict_space where
  2102 definition restrict_space :: "'a measure \<Rightarrow> 'a set \<Rightarrow> 'a measure" where
  2094   "restrict_space M \<Omega> = measure_of (\<Omega> \<inter> space M) (((\<inter>) \<Omega>) ` sets M) (emeasure M)"
  2103   "restrict_space M \<Omega> = measure_of (\<Omega> \<inter> space M) (((\<inter>) \<Omega>) ` sets M) (emeasure M)"
  2095 
  2104 
  2096 lemma space_restrict_space: "space (restrict_space M \<Omega>) = \<Omega> \<inter> space M"
  2105 lemma space_restrict_space: "space (restrict_space M \<Omega>) = \<Omega> \<inter> space M"
  2097   using sets.sets_into_space unfolding restrict_space_def by (subst space_measure_of) auto
  2106   using sets.sets_into_space unfolding restrict_space_def by (subst space_measure_of) auto
  2098 
  2107