1.1 --- a/NEWS Mon Apr 23 12:23:23 2012 +0100
1.2 +++ b/NEWS Mon Apr 23 12:14:35 2012 +0200
1.3 @@ -647,6 +647,180 @@
1.4
1.5 DERIV_nonneg_imp_nonincreasing ~> DERIV_nonneg_imp_nondecreasing
1.6
1.7 +* Theory Library/Multiset: Improved code generation of multisets.
1.8 +
1.9 +* Session HOL-Probability: Introduced the type "'a measure" to represent
1.10 +measures, this replaces the records 'a algebra and 'a measure_space. The
1.11 +locales based on subset_class now have two locale-parameters the space
1.12 +\<Omega> and the set of measurables sets M. The product of probability spaces
1.13 +uses now the same constant as the finite product of sigma-finite measure
1.14 +spaces "PiM :: ('i => 'a) measure". Most constants are defined now
1.15 +outside of locales and gain an additional parameter, like null_sets,
1.16 +almost_eventually or \<mu>'. Measure space constructions for distributions
1.17 +and densities now got their own constants distr and density. Instead of
1.18 +using locales to describe measure spaces with a finite space, the
1.19 +measure count_space and point_measure is introduced. INCOMPATIBILITY.
1.20 +
1.21 + Renamed constants:
1.22 + measure -> emeasure
1.23 + finite_measure.\<mu>' -> measure
1.24 + product_algebra_generator -> prod_algebra
1.25 + product_prob_space.emb -> prod_emb
1.26 + product_prob_space.infprod_algebra -> PiM
1.27 +
1.28 + Removed locales:
1.29 + completeable_measure_space
1.30 + finite_measure_space
1.31 + finite_prob_space
1.32 + finite_product_finite_prob_space
1.33 + finite_product_sigma_algebra
1.34 + finite_sigma_algebra
1.35 + measure_space
1.36 + pair_finite_prob_space
1.37 + pair_finite_sigma_algebra
1.38 + pair_finite_space
1.39 + pair_sigma_algebra
1.40 + product_sigma_algebra
1.41 +
1.42 + Removed constants:
1.43 + distribution -> use distr measure, or distributed predicate
1.44 + joint_distribution -> use distr measure, or distributed predicate
1.45 + product_prob_space.infprod_algebra -> use PiM
1.46 + subvimage
1.47 + image_space
1.48 + conditional_space
1.49 + pair_measure_generator
1.50 +
1.51 + Replacement theorems:
1.52 + sigma_algebra.measurable_sigma -> measurable_measure_of
1.53 + measure_space.additive -> emeasure_additive
1.54 + measure_space.measure_additive -> plus_emeasure
1.55 + measure_space.measure_mono -> emeasure_mono
1.56 + measure_space.measure_top -> emeasure_space
1.57 + measure_space.measure_compl -> emeasure_compl
1.58 + measure_space.measure_Diff -> emeasure_Diff
1.59 + measure_space.measure_countable_increasing -> emeasure_countable_increasing
1.60 + measure_space.continuity_from_below -> SUP_emeasure_incseq
1.61 + measure_space.measure_incseq -> incseq_emeasure
1.62 + measure_space.continuity_from_below_Lim -> Lim_emeasure_incseq
1.63 + measure_space.measure_decseq -> decseq_emeasure
1.64 + measure_space.continuity_from_above -> INF_emeasure_decseq
1.65 + measure_space.measure_insert -> emeasure_insert
1.66 + measure_space.measure_setsum -> setsum_emeasure
1.67 + measure_space.measure_finite_singleton -> emeasure_eq_setsum_singleton
1.68 + finite_additivity_sufficient -> ring_of_sets.countably_additiveI_finite
1.69 + measure_space.measure_setsum_split -> setsum_emeasure_cover
1.70 + measure_space.measure_subadditive -> subadditive
1.71 + measure_space.measure_subadditive_finite -> emeasure_subadditive_finite
1.72 + measure_space.measure_eq_0 -> emeasure_eq_0
1.73 + measure_space.measure_finitely_subadditive -> emeasure_subadditive_finite
1.74 + measure_space.measure_countably_subadditive -> emeasure_subadditive_countably
1.75 + measure_space.measure_UN_eq_0 -> emeasure_UN_eq_0
1.76 + measure_unique_Int_stable -> measure_eqI_generator_eq
1.77 + measure_space.measure_Diff_null_set -> emeasure_Diff_null_set
1.78 + measure_space.measure_Un_null_set -> emeasure_Un_null_set
1.79 + measure_space.almost_everywhere_def -> eventually_ae_filter
1.80 + measure_space.almost_everywhere_vimage -> AE_distrD
1.81 + measure_space.measure_space_vimage -> emeasure_distr
1.82 + measure_space.AE_iff_null_set -> AE_iff_null
1.83 + measure_space.real_measure_Union -> measure_Union
1.84 + measure_space.real_measure_finite_Union -> measure_finite_Union
1.85 + measure_space.real_measure_Diff -> measure_Diff
1.86 + measure_space.real_measure_UNION -> measure_UNION
1.87 + measure_space.real_measure_subadditive -> measure_subadditive
1.88 + measure_space.real_measure_setsum_singleton -> measure_eq_setsum_singleton
1.89 + measure_space.real_continuity_from_below -> Lim_measure_incseq
1.90 + measure_space.continuity_from_above_Lim -> Lim_emeasure_decseq
1.91 + measure_space.real_continuity_from_above -> Lim_measure_decseq
1.92 + measure_space.real_measure_countably_subadditive -> measure_subadditive_countably
1.93 + finite_measure.finite_measure -> finite_measure.emeasure_finite
1.94 + finite_measure.finite_measure_eq -> finite_measure.emeasure_eq_measure
1.95 + finite_measure.positive_measure' -> measure_nonneg
1.96 + finite_measure.real_measure -> finite_measure.emeasure_real
1.97 + finite_measure.empty_measure -> measure_empty
1.98 + finite_measure.finite_measure_countably_subadditive -> finite_measure.finite_measure_subadditive_countably
1.99 + finite_measure.finite_measure_finite_singleton -> finite_measure.finite_measure_eq_setsum_singleton
1.100 + finite_measure.finite_continuity_from_below -> finite_measure.finite_Lim_measure_incseq
1.101 + finite_measure.finite_continuity_from_above -> finite_measure.finite_Lim_measure_decseq
1.102 + measure_space.simple_integral_vimage -> simple_integral_distr
1.103 + measure_space.integrable_vimage -> integrable_distr
1.104 + measure_space.positive_integral_translated_density -> positive_integral_density
1.105 + measure_space.integral_translated_density -> integral_density
1.106 + measure_space.integral_vimage -> integral_distr
1.107 + measure_space_density -> emeasure_density
1.108 + measure_space.positive_integral_vimage -> positive_integral_distr
1.109 + measure_space.simple_function_vimage -> simple_function_comp
1.110 + measure_space.simple_integral_vimage -> simple_integral_distr
1.111 + pair_sigma_algebra.measurable_cut_fst -> sets_Pair1
1.112 + pair_sigma_algebra.measurable_cut_snd -> sets_Pair2
1.113 + pair_sigma_algebra.measurable_pair_image_fst -> measurable_Pair1
1.114 + pair_sigma_algebra.measurable_pair_image_snd -> measurable_Pair2
1.115 + pair_sigma_algebra.measurable_product_swap -> measurable_pair_swap_iff
1.116 + pair_sigma_finite.measure_cut_measurable_fst -> pair_sigma_finite.measurable_emeasure_Pair1
1.117 + pair_sigma_finite.measure_cut_measurable_snd -> pair_sigma_finite.measurable_emeasure_Pair2
1.118 + measure_space.measure_not_negative -> emeasure_not_MInf
1.119 + pair_sigma_finite.measure_preserving_swap -> pair_sigma_finite.distr_pair_swap
1.120 + pair_sigma_finite.pair_measure_alt -> pair_sigma_finite.emeasure_pair_measure_alt
1.121 + pair_sigma_finite.pair_measure_alt2 -> pair_sigma_finite.emeasure_pair_measure_alt2
1.122 + pair_sigma_finite.pair_measure_times -> pair_sigma_finite.emeasure_pair_measure_Times
1.123 + pair_sigma_algebra.pair_sigma_algebra_measurable -> measurable_pair_swap
1.124 + pair_sigma_algebra.pair_sigma_algebra_swap_measurable -> measurable_pair_swap'
1.125 + pair_sigma_algebra.sets_swap -> sets_pair_swap
1.126 + finite_product_sigma_algebra.in_P -> sets_PiM_I_finite
1.127 + Int_stable_product_algebra_generator -> positive_integral
1.128 + product_sigma_finite.measure_fold -> product_sigma_finite.distr_merge
1.129 + product_sigma_finite.measure_preserving_component_singelton -> product_sigma_finite.distr_singleton
1.130 + product_sigma_finite.measure_preserving_merge -> product_sigma_finite.distr_merge
1.131 + finite_product_sigma_algebra.P_empty -> space_PiM_empty, sets_PiM_empty
1.132 + product_algebra_generator_der -> prod_algebra_eq_finite
1.133 + product_algebra_generator_into_space -> prod_algebra_sets_into_space
1.134 + product_sigma_algebra.product_algebra_into_space -> space_closed
1.135 + product_algebraE -> prod_algebraE_all
1.136 + product_algebraI -> sets_PiM_I_finite
1.137 + product_measure_exists -> product_sigma_finite.sigma_finite
1.138 + sets_product_algebra -> sets_PiM
1.139 + sigma_product_algebra_sigma_eq -> sigma_prod_algebra_sigma_eq
1.140 + space_product_algebra -> space_PiM
1.141 + Int_stable_cuboids -> Int_stable_atLeastAtMost
1.142 + measure_space.density_is_absolutely_continuous -> absolutely_continuousI_density
1.143 + sigma_finite_measure.RN_deriv_vimage -> sigma_finite_measure.RN_deriv_distr
1.144 + prob_space_unique_Int_stable -> measure_eqI_prob_space
1.145 + sigma_finite_measure.disjoint_sigma_finite -> sigma_finite_disjoint
1.146 + prob_space.measure_space_1 -> prob_space.emeasure_space_1
1.147 + prob_space.prob_space_vimage -> prob_space_distr
1.148 + prob_space.random_variable_restrict -> measurable_restrict
1.149 + measure_preserving -> equality "distr M N f = N" "f : measurable M N"
1.150 + measure_unique_Int_stable_vimage -> measure_eqI_generator_eq
1.151 + measure_space.measure_preserving_Int_stable -> measure_eqI_generator_eq
1.152 + product_prob_space.finite_index_eq_finite_product -> product_prob_space.sets_PiM_generator
1.153 + product_prob_space.finite_measure_infprod_emb_Pi -> product_prob_space.measure_PiM_emb
1.154 + finite_product_prob_space.finite_measure_times -> finite_product_prob_space.finite_measure_PiM_emb
1.155 + product_prob_space.infprod_spec -> product_prob_space.emeasure_PiM_emb_not_empty
1.156 + product_prob_space.measurable_component -> measurable_component_singleton
1.157 + product_prob_space.measurable_emb -> measurable_prod_emb
1.158 + product_prob_space.measurable_into_infprod_algebra -> measurable_PiM_single
1.159 + product_prob_space.measurable_singleton_infprod -> measurable_component_singleton
1.160 + product_prob_space.measure_emb -> emeasure_prod_emb
1.161 + sequence_space.measure_infprod -> sequence_space.measure_PiM_countable
1.162 + product_prob_space.measure_preserving_restrict -> product_prob_space.distr_restrict
1.163 + prob_space.indep_distribution_eq_measure -> prob_space.indep_vars_iff_distr_eq_PiM
1.164 + prob_space.indep_var_distributionD -> prob_space.indep_var_distribution_eq
1.165 + conditional_entropy_positive -> conditional_entropy_nonneg_simple
1.166 + conditional_entropy_eq -> conditional_entropy_simple_distributed
1.167 + conditional_mutual_information_eq_mutual_information -> conditional_mutual_information_eq_mutual_information_simple
1.168 + conditional_mutual_information_generic_positive -> conditional_mutual_information_nonneg_simple
1.169 + conditional_mutual_information_positive -> conditional_mutual_information_nonneg_simple
1.170 + entropy_commute -> entropy_commute_simple
1.171 + entropy_eq -> entropy_simple_distributed
1.172 + entropy_generic_eq -> entropy_simple_distributed
1.173 + entropy_positive -> entropy_nonneg_simple
1.174 + entropy_uniform_max -> entropy_uniform
1.175 + KL_eq_0 -> KL_same_eq_0
1.176 + KL_eq_0_imp -> KL_eq_0_iff_eq
1.177 + KL_ge_0 -> KL_nonneg
1.178 + mutual_information_eq -> mutual_information_simple_distributed
1.179 + mutual_information_positive -> mutual_information_nonneg_simple
1.180 +
1.181 * New "case_product" attribute to generate a case rule doing multiple
1.182 case distinctions at the same time. E.g.
1.183
1.184 @@ -655,8 +829,6 @@
1.185 produces a rule which can be used to perform case distinction on both
1.186 a list and a nat.
1.187
1.188 -* Theory Library/Multiset: Improved code generation of multisets.
1.189 -
1.190 * New Transfer package:
1.191
1.192 - transfer_rule attribute: Maintains a collection of transfer rules,
2.1 --- a/src/HOL/IsaMakefile Mon Apr 23 12:23:23 2012 +0100
2.2 +++ b/src/HOL/IsaMakefile Mon Apr 23 12:14:35 2012 +0200
2.3 @@ -1198,14 +1198,13 @@
2.4 $(OUT)/HOL-Probability: $(OUT)/HOL-Multivariate_Analysis \
2.5 Probability/Binary_Product_Measure.thy Probability/Borel_Space.thy \
2.6 Probability/Caratheodory.thy Probability/Complete_Measure.thy \
2.7 - Probability/Conditional_Probability.thy \
2.8 Probability/ex/Dining_Cryptographers.thy \
2.9 Probability/ex/Koepf_Duermuth_Countermeasure.thy \
2.10 Probability/Finite_Product_Measure.thy \
2.11 Probability/Independent_Family.thy \
2.12 Probability/Infinite_Product_Measure.thy Probability/Information.thy \
2.13 Probability/Lebesgue_Integration.thy Probability/Lebesgue_Measure.thy \
2.14 - Probability/Measure.thy Probability/Probability_Measure.thy \
2.15 + Probability/Measure_Space.thy Probability/Probability_Measure.thy \
2.16 Probability/Probability.thy Probability/Radon_Nikodym.thy \
2.17 Probability/ROOT.ML Probability/Sigma_Algebra.thy \
2.18 Library/Countable.thy Library/FuncSet.thy Library/Nat_Bijection.thy
3.1 --- a/src/HOL/Probability/Binary_Product_Measure.thy Mon Apr 23 12:23:23 2012 +0100
3.2 +++ b/src/HOL/Probability/Binary_Product_Measure.thy Mon Apr 23 12:14:35 2012 +0200
3.3 @@ -28,413 +28,317 @@
3.4
3.5 section "Binary products"
3.6
3.7 -definition
3.8 - "pair_measure_generator A B =
3.9 - \<lparr> space = space A \<times> space B,
3.10 - sets = {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B},
3.11 - measure = \<lambda>X. \<integral>\<^isup>+x. (\<integral>\<^isup>+y. indicator X (x,y) \<partial>B) \<partial>A \<rparr>"
3.12 +definition pair_measure (infixr "\<Otimes>\<^isub>M" 80) where
3.13 + "A \<Otimes>\<^isub>M B = measure_of (space A \<times> space B)
3.14 + {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B}
3.15 + (\<lambda>X. \<integral>\<^isup>+x. (\<integral>\<^isup>+y. indicator X (x,y) \<partial>B) \<partial>A)"
3.16
3.17 -definition pair_measure (infixr "\<Otimes>\<^isub>M" 80) where
3.18 - "A \<Otimes>\<^isub>M B = sigma (pair_measure_generator A B)"
3.19 +lemma space_pair_measure:
3.20 + "space (A \<Otimes>\<^isub>M B) = space A \<times> space B"
3.21 + unfolding pair_measure_def using space_closed[of A] space_closed[of B]
3.22 + by (intro space_measure_of) auto
3.23
3.24 -locale pair_sigma_algebra = M1: sigma_algebra M1 + M2: sigma_algebra M2
3.25 - for M1 :: "('a, 'c) measure_space_scheme" and M2 :: "('b, 'd) measure_space_scheme"
3.26 -
3.27 -abbreviation (in pair_sigma_algebra)
3.28 - "E \<equiv> pair_measure_generator M1 M2"
3.29 -
3.30 -abbreviation (in pair_sigma_algebra)
3.31 - "P \<equiv> M1 \<Otimes>\<^isub>M M2"
3.32 -
3.33 -lemma sigma_algebra_pair_measure:
3.34 - "sets M1 \<subseteq> Pow (space M1) \<Longrightarrow> sets M2 \<subseteq> Pow (space M2) \<Longrightarrow> sigma_algebra (pair_measure M1 M2)"
3.35 - by (force simp: pair_measure_def pair_measure_generator_def intro!: sigma_algebra_sigma)
3.36 -
3.37 -sublocale pair_sigma_algebra \<subseteq> sigma_algebra P
3.38 - using M1.space_closed M2.space_closed
3.39 - by (rule sigma_algebra_pair_measure)
3.40 -
3.41 -lemma pair_measure_generatorI[intro, simp]:
3.42 - "x \<in> sets A \<Longrightarrow> y \<in> sets B \<Longrightarrow> x \<times> y \<in> sets (pair_measure_generator A B)"
3.43 - by (auto simp add: pair_measure_generator_def)
3.44 +lemma sets_pair_measure:
3.45 + "sets (A \<Otimes>\<^isub>M B) = sigma_sets (space A \<times> space B) {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B}"
3.46 + unfolding pair_measure_def using space_closed[of A] space_closed[of B]
3.47 + by (intro sets_measure_of) auto
3.48
3.49 lemma pair_measureI[intro, simp]:
3.50 "x \<in> sets A \<Longrightarrow> y \<in> sets B \<Longrightarrow> x \<times> y \<in> sets (A \<Otimes>\<^isub>M B)"
3.51 - by (auto simp add: pair_measure_def)
3.52 + by (auto simp: sets_pair_measure)
3.53
3.54 -lemma space_pair_measure:
3.55 - "space (A \<Otimes>\<^isub>M B) = space A \<times> space B"
3.56 - by (simp add: pair_measure_def pair_measure_generator_def)
3.57 +lemma measurable_pair_measureI:
3.58 + assumes 1: "f \<in> space M \<rightarrow> space M1 \<times> space M2"
3.59 + assumes 2: "\<And>A B. A \<in> sets M1 \<Longrightarrow> B \<in> sets M2 \<Longrightarrow> f -` (A \<times> B) \<inter> space M \<in> sets M"
3.60 + shows "f \<in> measurable M (M1 \<Otimes>\<^isub>M M2)"
3.61 + unfolding pair_measure_def using 1 2
3.62 + by (intro measurable_measure_of) (auto dest: sets_into_space)
3.63
3.64 -lemma sets_pair_measure_generator:
3.65 - "sets (pair_measure_generator N M) = (\<lambda>(x, y). x \<times> y) ` (sets N \<times> sets M)"
3.66 - unfolding pair_measure_generator_def by auto
3.67 +lemma measurable_fst[intro!, simp]: "fst \<in> measurable (M1 \<Otimes>\<^isub>M M2) M1"
3.68 + unfolding measurable_def
3.69 +proof safe
3.70 + fix A assume A: "A \<in> sets M1"
3.71 + from this[THEN sets_into_space] have "fst -` A \<inter> space M1 \<times> space M2 = A \<times> space M2" by auto
3.72 + with A show "fst -` A \<inter> space (M1 \<Otimes>\<^isub>M M2) \<in> sets (M1 \<Otimes>\<^isub>M M2)" by (simp add: space_pair_measure)
3.73 +qed (simp add: space_pair_measure)
3.74
3.75 -lemma pair_measure_generator_sets_into_space:
3.76 - assumes "sets M \<subseteq> Pow (space M)" "sets N \<subseteq> Pow (space N)"
3.77 - shows "sets (pair_measure_generator M N) \<subseteq> Pow (space (pair_measure_generator M N))"
3.78 - using assms by (auto simp: pair_measure_generator_def)
3.79 +lemma measurable_snd[intro!, simp]: "snd \<in> measurable (M1 \<Otimes>\<^isub>M M2) M2"
3.80 + unfolding measurable_def
3.81 +proof safe
3.82 + fix A assume A: "A \<in> sets M2"
3.83 + from this[THEN sets_into_space] have "snd -` A \<inter> space M1 \<times> space M2 = space M1 \<times> A" by auto
3.84 + with A show "snd -` A \<inter> space (M1 \<Otimes>\<^isub>M M2) \<in> sets (M1 \<Otimes>\<^isub>M M2)" by (simp add: space_pair_measure)
3.85 +qed (simp add: space_pair_measure)
3.86
3.87 -lemma pair_measure_generator_Int_snd:
3.88 - assumes "sets S1 \<subseteq> Pow (space S1)"
3.89 - shows "sets (pair_measure_generator S1 (algebra.restricted_space S2 A)) =
3.90 - sets (algebra.restricted_space (pair_measure_generator S1 S2) (space S1 \<times> A))"
3.91 - (is "?L = ?R")
3.92 - apply (auto simp: pair_measure_generator_def image_iff)
3.93 - using assms
3.94 - apply (rule_tac x="a \<times> xa" in exI)
3.95 - apply force
3.96 - using assms
3.97 - apply (rule_tac x="a" in exI)
3.98 - apply (rule_tac x="b \<inter> A" in exI)
3.99 - apply auto
3.100 - done
3.101 +lemma measurable_fst': "f \<in> measurable M (N \<Otimes>\<^isub>M P) \<Longrightarrow> (\<lambda>x. fst (f x)) \<in> measurable M N"
3.102 + using measurable_comp[OF _ measurable_fst] by (auto simp: comp_def)
3.103
3.104 -lemma (in pair_sigma_algebra)
3.105 - shows measurable_fst[intro!, simp]:
3.106 - "fst \<in> measurable P M1" (is ?fst)
3.107 - and measurable_snd[intro!, simp]:
3.108 - "snd \<in> measurable P M2" (is ?snd)
3.109 +lemma measurable_snd': "f \<in> measurable M (N \<Otimes>\<^isub>M P) \<Longrightarrow> (\<lambda>x. snd (f x)) \<in> measurable M P"
3.110 + using measurable_comp[OF _ measurable_snd] by (auto simp: comp_def)
3.111 +
3.112 +lemma measurable_fst'': "f \<in> measurable M N \<Longrightarrow> (\<lambda>x. f (fst x)) \<in> measurable (M \<Otimes>\<^isub>M P) N"
3.113 + using measurable_comp[OF measurable_fst _] by (auto simp: comp_def)
3.114 +
3.115 +lemma measurable_snd'': "f \<in> measurable M N \<Longrightarrow> (\<lambda>x. f (snd x)) \<in> measurable (P \<Otimes>\<^isub>M M) N"
3.116 + using measurable_comp[OF measurable_snd _] by (auto simp: comp_def)
3.117 +
3.118 +lemma measurable_pair_iff:
3.119 + "f \<in> measurable M (M1 \<Otimes>\<^isub>M M2) \<longleftrightarrow> (fst \<circ> f) \<in> measurable M M1 \<and> (snd \<circ> f) \<in> measurable M M2"
3.120 +proof safe
3.121 + assume f: "(fst \<circ> f) \<in> measurable M M1" and s: "(snd \<circ> f) \<in> measurable M M2"
3.122 + show "f \<in> measurable M (M1 \<Otimes>\<^isub>M M2)"
3.123 + proof (rule measurable_pair_measureI)
3.124 + show "f \<in> space M \<rightarrow> space M1 \<times> space M2"
3.125 + using f s by (auto simp: mem_Times_iff measurable_def comp_def)
3.126 + fix A B assume "A \<in> sets M1" "B \<in> sets M2"
3.127 + moreover have "(fst \<circ> f) -` A \<inter> space M \<in> sets M" "(snd \<circ> f) -` B \<inter> space M \<in> sets M"
3.128 + using f `A \<in> sets M1` s `B \<in> sets M2` by (auto simp: measurable_sets)
3.129 + moreover have "f -` (A \<times> B) \<inter> space M = ((fst \<circ> f) -` A \<inter> space M) \<inter> ((snd \<circ> f) -` B \<inter> space M)"
3.130 + by (auto simp: vimage_Times)
3.131 + ultimately show "f -` (A \<times> B) \<inter> space M \<in> sets M" by auto
3.132 + qed
3.133 +qed auto
3.134 +
3.135 +lemma measurable_pair:
3.136 + "(fst \<circ> f) \<in> measurable M M1 \<Longrightarrow> (snd \<circ> f) \<in> measurable M M2 \<Longrightarrow> f \<in> measurable M (M1 \<Otimes>\<^isub>M M2)"
3.137 + unfolding measurable_pair_iff by simp
3.138 +
3.139 +lemma measurable_pair_swap': "(\<lambda>(x,y). (y, x)) \<in> measurable (M1 \<Otimes>\<^isub>M M2) (M2 \<Otimes>\<^isub>M M1)"
3.140 +proof (rule measurable_pair_measureI)
3.141 + fix A B assume "A \<in> sets M2" "B \<in> sets M1"
3.142 + moreover then have "(\<lambda>(x, y). (y, x)) -` (A \<times> B) \<inter> space (M1 \<Otimes>\<^isub>M M2) = B \<times> A"
3.143 + by (auto dest: sets_into_space simp: space_pair_measure)
3.144 + ultimately show "(\<lambda>(x, y). (y, x)) -` (A \<times> B) \<inter> space (M1 \<Otimes>\<^isub>M M2) \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.145 + by auto
3.146 +qed (auto simp add: space_pair_measure)
3.147 +
3.148 +lemma measurable_pair_swap:
3.149 + assumes f: "f \<in> measurable (M1 \<Otimes>\<^isub>M M2) M" shows "(\<lambda>(x,y). f (y, x)) \<in> measurable (M2 \<Otimes>\<^isub>M M1) M"
3.150 proof -
3.151 - { fix X assume "X \<in> sets M1"
3.152 - then have "\<exists>X1\<in>sets M1. \<exists>X2\<in>sets M2. fst -` X \<inter> space M1 \<times> space M2 = X1 \<times> X2"
3.153 - apply - apply (rule bexI[of _ X]) apply (rule bexI[of _ "space M2"])
3.154 - using M1.sets_into_space by force+ }
3.155 - moreover
3.156 - { fix X assume "X \<in> sets M2"
3.157 - then have "\<exists>X1\<in>sets M1. \<exists>X2\<in>sets M2. snd -` X \<inter> space M1 \<times> space M2 = X1 \<times> X2"
3.158 - apply - apply (rule bexI[of _ "space M1"]) apply (rule bexI[of _ X])
3.159 - using M2.sets_into_space by force+ }
3.160 - ultimately have "?fst \<and> ?snd"
3.161 - by (fastforce simp: measurable_def sets_sigma space_pair_measure
3.162 - intro!: sigma_sets.Basic)
3.163 - then show ?fst ?snd by auto
3.164 + have "(\<lambda>x. f (case x of (x, y) \<Rightarrow> (y, x))) = (\<lambda>(x, y). f (y, x))" by auto
3.165 + then show ?thesis
3.166 + using measurable_comp[OF measurable_pair_swap' f] by (simp add: comp_def)
3.167 qed
3.168
3.169 -lemma (in pair_sigma_algebra) measurable_pair_iff:
3.170 - assumes "sigma_algebra M"
3.171 - shows "f \<in> measurable M P \<longleftrightarrow>
3.172 - (fst \<circ> f) \<in> measurable M M1 \<and> (snd \<circ> f) \<in> measurable M M2"
3.173 +lemma measurable_pair_swap_iff:
3.174 + "f \<in> measurable (M2 \<Otimes>\<^isub>M M1) M \<longleftrightarrow> (\<lambda>(x,y). f (y,x)) \<in> measurable (M1 \<Otimes>\<^isub>M M2) M"
3.175 + using measurable_pair_swap[of "\<lambda>(x,y). f (y, x)"]
3.176 + by (auto intro!: measurable_pair_swap)
3.177 +
3.178 +lemma measurable_Pair1': "x \<in> space M1 \<Longrightarrow> Pair x \<in> measurable M2 (M1 \<Otimes>\<^isub>M M2)"
3.179 +proof (rule measurable_pair_measureI)
3.180 + fix A B assume "A \<in> sets M1" "B \<in> sets M2"
3.181 + moreover then have "Pair x -` (A \<times> B) \<inter> space M2 = (if x \<in> A then B else {})"
3.182 + by (auto dest: sets_into_space simp: space_pair_measure)
3.183 + ultimately show "Pair x -` (A \<times> B) \<inter> space M2 \<in> sets M2"
3.184 + by auto
3.185 +qed (auto simp add: space_pair_measure)
3.186 +
3.187 +lemma sets_Pair1: assumes A: "A \<in> sets (M1 \<Otimes>\<^isub>M M2)" shows "Pair x -` A \<in> sets M2"
3.188 proof -
3.189 - interpret M: sigma_algebra M by fact
3.190 - from assms show ?thesis
3.191 - proof (safe intro!: measurable_comp[where b=P])
3.192 - assume f: "(fst \<circ> f) \<in> measurable M M1" and s: "(snd \<circ> f) \<in> measurable M M2"
3.193 - show "f \<in> measurable M P" unfolding pair_measure_def
3.194 - proof (rule M.measurable_sigma)
3.195 - show "sets (pair_measure_generator M1 M2) \<subseteq> Pow (space E)"
3.196 - unfolding pair_measure_generator_def using M1.sets_into_space M2.sets_into_space by auto
3.197 - show "f \<in> space M \<rightarrow> space E"
3.198 - using f s by (auto simp: mem_Times_iff measurable_def comp_def space_sigma pair_measure_generator_def)
3.199 - fix A assume "A \<in> sets E"
3.200 - then obtain B C where "B \<in> sets M1" "C \<in> sets M2" "A = B \<times> C"
3.201 - unfolding pair_measure_generator_def by auto
3.202 - moreover have "(fst \<circ> f) -` B \<inter> space M \<in> sets M"
3.203 - using f `B \<in> sets M1` unfolding measurable_def by auto
3.204 - moreover have "(snd \<circ> f) -` C \<inter> space M \<in> sets M"
3.205 - using s `C \<in> sets M2` unfolding measurable_def by auto
3.206 - moreover have "f -` A \<inter> space M = ((fst \<circ> f) -` B \<inter> space M) \<inter> ((snd \<circ> f) -` C \<inter> space M)"
3.207 - unfolding `A = B \<times> C` by (auto simp: vimage_Times)
3.208 - ultimately show "f -` A \<inter> space M \<in> sets M" by auto
3.209 - qed
3.210 - qed
3.211 + have "Pair x -` A = (if x \<in> space M1 then Pair x -` A \<inter> space M2 else {})"
3.212 + using A[THEN sets_into_space] by (auto simp: space_pair_measure)
3.213 + also have "\<dots> \<in> sets M2"
3.214 + using A by (auto simp add: measurable_Pair1' intro!: measurable_sets split: split_if_asm)
3.215 + finally show ?thesis .
3.216 qed
3.217
3.218 -lemma (in pair_sigma_algebra) measurable_pair:
3.219 - assumes "sigma_algebra M"
3.220 - assumes "(fst \<circ> f) \<in> measurable M M1" "(snd \<circ> f) \<in> measurable M M2"
3.221 - shows "f \<in> measurable M P"
3.222 - unfolding measurable_pair_iff[OF assms(1)] using assms(2,3) by simp
3.223 +lemma measurable_Pair2': "y \<in> space M2 \<Longrightarrow> (\<lambda>x. (x, y)) \<in> measurable M1 (M1 \<Otimes>\<^isub>M M2)"
3.224 + using measurable_comp[OF measurable_Pair1' measurable_pair_swap', of y M2 M1]
3.225 + by (simp add: comp_def)
3.226
3.227 -lemma pair_measure_generatorE:
3.228 - assumes "X \<in> sets (pair_measure_generator M1 M2)"
3.229 - obtains A B where "X = A \<times> B" "A \<in> sets M1" "B \<in> sets M2"
3.230 - using assms unfolding pair_measure_generator_def by auto
3.231 -
3.232 -lemma (in pair_sigma_algebra) pair_measure_generator_swap:
3.233 - "(\<lambda>X. (\<lambda>(x,y). (y,x)) -` X \<inter> space M2 \<times> space M1) ` sets E = sets (pair_measure_generator M2 M1)"
3.234 -proof (safe elim!: pair_measure_generatorE)
3.235 - fix A B assume "A \<in> sets M1" "B \<in> sets M2"
3.236 - moreover then have "(\<lambda>(x, y). (y, x)) -` (A \<times> B) \<inter> space M2 \<times> space M1 = B \<times> A"
3.237 - using M1.sets_into_space M2.sets_into_space by auto
3.238 - ultimately show "(\<lambda>(x, y). (y, x)) -` (A \<times> B) \<inter> space M2 \<times> space M1 \<in> sets (pair_measure_generator M2 M1)"
3.239 - by (auto intro: pair_measure_generatorI)
3.240 -next
3.241 - fix A B assume "A \<in> sets M1" "B \<in> sets M2"
3.242 - then show "B \<times> A \<in> (\<lambda>X. (\<lambda>(x, y). (y, x)) -` X \<inter> space M2 \<times> space M1) ` sets E"
3.243 - using M1.sets_into_space M2.sets_into_space
3.244 - by (auto intro!: image_eqI[where x="A \<times> B"] pair_measure_generatorI)
3.245 +lemma sets_Pair2: assumes A: "A \<in> sets (M1 \<Otimes>\<^isub>M M2)" shows "(\<lambda>x. (x, y)) -` A \<in> sets M1"
3.246 +proof -
3.247 + have "(\<lambda>x. (x, y)) -` A = (if y \<in> space M2 then (\<lambda>x. (x, y)) -` A \<inter> space M1 else {})"
3.248 + using A[THEN sets_into_space] by (auto simp: space_pair_measure)
3.249 + also have "\<dots> \<in> sets M1"
3.250 + using A by (auto simp add: measurable_Pair2' intro!: measurable_sets split: split_if_asm)
3.251 + finally show ?thesis .
3.252 qed
3.253
3.254 -lemma (in pair_sigma_algebra) sets_pair_sigma_algebra_swap:
3.255 - assumes Q: "Q \<in> sets P"
3.256 - shows "(\<lambda>(x,y). (y, x)) -` Q \<in> sets (M2 \<Otimes>\<^isub>M M1)" (is "_ \<in> sets ?Q")
3.257 -proof -
3.258 - let ?f = "\<lambda>Q. (\<lambda>(x,y). (y, x)) -` Q \<inter> space M2 \<times> space M1"
3.259 - have *: "(\<lambda>(x,y). (y, x)) -` Q = ?f Q"
3.260 - using sets_into_space[OF Q] by (auto simp: space_pair_measure)
3.261 - have "sets (M2 \<Otimes>\<^isub>M M1) = sets (sigma (pair_measure_generator M2 M1))"
3.262 - unfolding pair_measure_def ..
3.263 - also have "\<dots> = sigma_sets (space M2 \<times> space M1) (?f ` sets E)"
3.264 - unfolding sigma_def pair_measure_generator_swap[symmetric]
3.265 - by (simp add: pair_measure_generator_def)
3.266 - also have "\<dots> = ?f ` sigma_sets (space M1 \<times> space M2) (sets E)"
3.267 - using M1.sets_into_space M2.sets_into_space
3.268 - by (intro sigma_sets_vimage) (auto simp: pair_measure_generator_def)
3.269 - also have "\<dots> = ?f ` sets P"
3.270 - unfolding pair_measure_def pair_measure_generator_def sigma_def by simp
3.271 - finally show ?thesis
3.272 - using Q by (subst *) auto
3.273 -qed
3.274 +lemma measurable_Pair2:
3.275 + assumes f: "f \<in> measurable (M1 \<Otimes>\<^isub>M M2) M" and x: "x \<in> space M1"
3.276 + shows "(\<lambda>y. f (x, y)) \<in> measurable M2 M"
3.277 + using measurable_comp[OF measurable_Pair1' f, OF x]
3.278 + by (simp add: comp_def)
3.279 +
3.280 +lemma measurable_Pair1:
3.281 + assumes f: "f \<in> measurable (M1 \<Otimes>\<^isub>M M2) M" and y: "y \<in> space M2"
3.282 + shows "(\<lambda>x. f (x, y)) \<in> measurable M1 M"
3.283 + using measurable_comp[OF measurable_Pair2' f, OF y]
3.284 + by (simp add: comp_def)
3.285
3.286 -lemma (in pair_sigma_algebra) pair_sigma_algebra_swap_measurable:
3.287 - shows "(\<lambda>(x,y). (y, x)) \<in> measurable P (M2 \<Otimes>\<^isub>M M1)"
3.288 - (is "?f \<in> measurable ?P ?Q")
3.289 - unfolding measurable_def
3.290 -proof (intro CollectI conjI Pi_I ballI)
3.291 - fix x assume "x \<in> space ?P" then show "(case x of (x, y) \<Rightarrow> (y, x)) \<in> space ?Q"
3.292 - unfolding pair_measure_generator_def pair_measure_def by auto
3.293 -next
3.294 - fix A assume "A \<in> sets (M2 \<Otimes>\<^isub>M M1)"
3.295 - interpret Q: pair_sigma_algebra M2 M1 by default
3.296 - from Q.sets_pair_sigma_algebra_swap[OF `A \<in> sets (M2 \<Otimes>\<^isub>M M1)`]
3.297 - show "?f -` A \<inter> space ?P \<in> sets ?P" by simp
3.298 -qed
3.299 -
3.300 -lemma (in pair_sigma_algebra) measurable_cut_fst[simp,intro]:
3.301 - assumes "Q \<in> sets P" shows "Pair x -` Q \<in> sets M2"
3.302 -proof -
3.303 - let ?Q' = "{Q. Q \<subseteq> space P \<and> Pair x -` Q \<in> sets M2}"
3.304 - let ?Q = "\<lparr> space = space P, sets = ?Q' \<rparr>"
3.305 - interpret Q: sigma_algebra ?Q
3.306 - proof qed (auto simp: vimage_UN vimage_Diff space_pair_measure)
3.307 - have "sets E \<subseteq> sets ?Q"
3.308 - using M1.sets_into_space M2.sets_into_space
3.309 - by (auto simp: pair_measure_generator_def space_pair_measure)
3.310 - then have "sets P \<subseteq> sets ?Q"
3.311 - apply (subst pair_measure_def, intro Q.sets_sigma_subset)
3.312 - by (simp add: pair_measure_def)
3.313 - with assms show ?thesis by auto
3.314 -qed
3.315 -
3.316 -lemma (in pair_sigma_algebra) measurable_cut_snd:
3.317 - assumes Q: "Q \<in> sets P" shows "(\<lambda>x. (x, y)) -` Q \<in> sets M1" (is "?cut Q \<in> sets M1")
3.318 -proof -
3.319 - interpret Q: pair_sigma_algebra M2 M1 by default
3.320 - from Q.measurable_cut_fst[OF sets_pair_sigma_algebra_swap[OF Q], of y]
3.321 - show ?thesis by (simp add: vimage_compose[symmetric] comp_def)
3.322 -qed
3.323 -
3.324 -lemma (in pair_sigma_algebra) measurable_pair_image_snd:
3.325 - assumes m: "f \<in> measurable P M" and "x \<in> space M1"
3.326 - shows "(\<lambda>y. f (x, y)) \<in> measurable M2 M"
3.327 - unfolding measurable_def
3.328 -proof (intro CollectI conjI Pi_I ballI)
3.329 - fix y assume "y \<in> space M2" with `f \<in> measurable P M` `x \<in> space M1`
3.330 - show "f (x, y) \<in> space M"
3.331 - unfolding measurable_def pair_measure_generator_def pair_measure_def by auto
3.332 -next
3.333 - fix A assume "A \<in> sets M"
3.334 - then have "Pair x -` (f -` A \<inter> space P) \<in> sets M2" (is "?C \<in> _")
3.335 - using `f \<in> measurable P M`
3.336 - by (intro measurable_cut_fst) (auto simp: measurable_def)
3.337 - also have "?C = (\<lambda>y. f (x, y)) -` A \<inter> space M2"
3.338 - using `x \<in> space M1` by (auto simp: pair_measure_generator_def pair_measure_def)
3.339 - finally show "(\<lambda>y. f (x, y)) -` A \<inter> space M2 \<in> sets M2" .
3.340 -qed
3.341 -
3.342 -lemma (in pair_sigma_algebra) measurable_pair_image_fst:
3.343 - assumes m: "f \<in> measurable P M" and "y \<in> space M2"
3.344 - shows "(\<lambda>x. f (x, y)) \<in> measurable M1 M"
3.345 -proof -
3.346 - interpret Q: pair_sigma_algebra M2 M1 by default
3.347 - from Q.measurable_pair_image_snd[OF measurable_comp `y \<in> space M2`,
3.348 - OF Q.pair_sigma_algebra_swap_measurable m]
3.349 - show ?thesis by simp
3.350 -qed
3.351 -
3.352 -lemma (in pair_sigma_algebra) Int_stable_pair_measure_generator: "Int_stable E"
3.353 +lemma Int_stable_pair_measure_generator: "Int_stable {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B}"
3.354 unfolding Int_stable_def
3.355 -proof (intro ballI)
3.356 - fix A B assume "A \<in> sets E" "B \<in> sets E"
3.357 - then obtain A1 A2 B1 B2 where "A = A1 \<times> A2" "B = B1 \<times> B2"
3.358 - "A1 \<in> sets M1" "A2 \<in> sets M2" "B1 \<in> sets M1" "B2 \<in> sets M2"
3.359 - unfolding pair_measure_generator_def by auto
3.360 - then show "A \<inter> B \<in> sets E"
3.361 - by (auto simp add: times_Int_times pair_measure_generator_def)
3.362 -qed
3.363 + by safe (auto simp add: times_Int_times)
3.364
3.365 lemma finite_measure_cut_measurable:
3.366 - fixes M1 :: "('a, 'c) measure_space_scheme" and M2 :: "('b, 'd) measure_space_scheme"
3.367 assumes "sigma_finite_measure M1" "finite_measure M2"
3.368 assumes "Q \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.369 - shows "(\<lambda>x. measure M2 (Pair x -` Q)) \<in> borel_measurable M1"
3.370 + shows "(\<lambda>x. emeasure M2 (Pair x -` Q)) \<in> borel_measurable M1"
3.371 (is "?s Q \<in> _")
3.372 proof -
3.373 interpret M1: sigma_finite_measure M1 by fact
3.374 interpret M2: finite_measure M2 by fact
3.375 - interpret pair_sigma_algebra M1 M2 by default
3.376 - have [intro]: "sigma_algebra M1" by fact
3.377 - have [intro]: "sigma_algebra M2" by fact
3.378 - let ?D = "\<lparr> space = space P, sets = {A\<in>sets P. ?s A \<in> borel_measurable M1} \<rparr>"
3.379 + let ?\<Omega> = "space M1 \<times> space M2" and ?D = "{A\<in>sets (M1 \<Otimes>\<^isub>M M2). ?s A \<in> borel_measurable M1}"
3.380 note space_pair_measure[simp]
3.381 - interpret dynkin_system ?D
3.382 + interpret dynkin_system ?\<Omega> ?D
3.383 proof (intro dynkin_systemI)
3.384 - fix A assume "A \<in> sets ?D" then show "A \<subseteq> space ?D"
3.385 - using sets_into_space by simp
3.386 + fix A assume "A \<in> ?D" then show "A \<subseteq> ?\<Omega>"
3.387 + using sets_into_space[of A "M1 \<Otimes>\<^isub>M M2"] by simp
3.388 next
3.389 - from top show "space ?D \<in> sets ?D"
3.390 - by (auto simp add: if_distrib intro!: M1.measurable_If)
3.391 + from top show "?\<Omega> \<in> ?D"
3.392 + by (auto simp add: if_distrib intro!: measurable_If)
3.393 next
3.394 - fix A assume "A \<in> sets ?D"
3.395 - with sets_into_space have "\<And>x. measure M2 (Pair x -` (space M1 \<times> space M2 - A)) =
3.396 - (if x \<in> space M1 then measure M2 (space M2) - ?s A x else 0)"
3.397 - by (auto intro!: M2.measure_compl simp: vimage_Diff)
3.398 - with `A \<in> sets ?D` top show "space ?D - A \<in> sets ?D"
3.399 - by (auto intro!: Diff M1.measurable_If M1.borel_measurable_ereal_diff)
3.400 + fix A assume "A \<in> ?D"
3.401 + with sets_into_space have "\<And>x. emeasure M2 (Pair x -` (?\<Omega> - A)) =
3.402 + (if x \<in> space M1 then emeasure M2 (space M2) - ?s A x else 0)"
3.403 + by (auto intro!: emeasure_compl simp: vimage_Diff sets_Pair1)
3.404 + with `A \<in> ?D` top show "?\<Omega> - A \<in> ?D"
3.405 + by (auto intro!: measurable_If)
3.406 next
3.407 - fix F :: "nat \<Rightarrow> ('a\<times>'b) set" assume "disjoint_family F" "range F \<subseteq> sets ?D"
3.408 - moreover then have "\<And>x. measure M2 (\<Union>i. Pair x -` F i) = (\<Sum>i. ?s (F i) x)"
3.409 - by (intro M2.measure_countably_additive[symmetric])
3.410 - (auto simp: disjoint_family_on_def)
3.411 - ultimately show "(\<Union>i. F i) \<in> sets ?D"
3.412 - by (auto simp: vimage_UN intro!: M1.borel_measurable_psuminf)
3.413 + fix F :: "nat \<Rightarrow> ('a\<times>'b) set" assume "disjoint_family F" "range F \<subseteq> ?D"
3.414 + moreover then have "\<And>x. emeasure M2 (\<Union>i. Pair x -` F i) = (\<Sum>i. ?s (F i) x)"
3.415 + by (intro suminf_emeasure[symmetric]) (auto simp: disjoint_family_on_def sets_Pair1)
3.416 + ultimately show "(\<Union>i. F i) \<in> ?D"
3.417 + by (auto simp: vimage_UN intro!: borel_measurable_psuminf)
3.418 qed
3.419 - have "sets P = sets ?D" apply (subst pair_measure_def)
3.420 - proof (intro dynkin_lemma)
3.421 - show "Int_stable E" by (rule Int_stable_pair_measure_generator)
3.422 - from M1.sets_into_space have "\<And>A. A \<in> sets M1 \<Longrightarrow> {x \<in> space M1. x \<in> A} = A"
3.423 - by auto
3.424 - then show "sets E \<subseteq> sets ?D"
3.425 - by (auto simp: pair_measure_generator_def sets_sigma if_distrib
3.426 - intro: sigma_sets.Basic intro!: M1.measurable_If)
3.427 - qed (auto simp: pair_measure_def)
3.428 - with `Q \<in> sets P` have "Q \<in> sets ?D" by simp
3.429 + let ?G = "{a \<times> b | a b. a \<in> sets M1 \<and> b \<in> sets M2}"
3.430 + have "sigma_sets ?\<Omega> ?G = ?D"
3.431 + proof (rule dynkin_lemma)
3.432 + show "?G \<subseteq> ?D"
3.433 + by (auto simp: if_distrib Int_def[symmetric] intro!: measurable_If)
3.434 + qed (auto simp: sets_pair_measure Int_stable_pair_measure_generator)
3.435 + with `Q \<in> sets (M1 \<Otimes>\<^isub>M M2)` have "Q \<in> ?D"
3.436 + by (simp add: sets_pair_measure[symmetric])
3.437 then show "?s Q \<in> borel_measurable M1" by simp
3.438 qed
3.439
3.440 -subsection {* Binary products of $\sigma$-finite measure spaces *}
3.441 +subsection {* Binary products of $\sigma$-finite emeasure spaces *}
3.442
3.443 -locale pair_sigma_finite = pair_sigma_algebra M1 M2 + M1: sigma_finite_measure M1 + M2: sigma_finite_measure M2
3.444 - for M1 :: "('a, 'c) measure_space_scheme" and M2 :: "('b, 'd) measure_space_scheme"
3.445 +locale pair_sigma_finite = M1: sigma_finite_measure M1 + M2: sigma_finite_measure M2
3.446 + for M1 :: "'a measure" and M2 :: "'b measure"
3.447
3.448 -lemma (in pair_sigma_finite) measure_cut_measurable_fst:
3.449 - assumes "Q \<in> sets P" shows "(\<lambda>x. measure M2 (Pair x -` Q)) \<in> borel_measurable M1" (is "?s Q \<in> _")
3.450 +lemma sets_pair_measure_cong[cong]:
3.451 + "sets M1 = sets M1' \<Longrightarrow> sets M2 = sets M2' \<Longrightarrow> sets (M1 \<Otimes>\<^isub>M M2) = sets (M1' \<Otimes>\<^isub>M M2')"
3.452 + unfolding sets_pair_measure by (simp cong: sets_eq_imp_space_eq)
3.453 +
3.454 +lemma (in pair_sigma_finite) measurable_emeasure_Pair1:
3.455 + assumes Q: "Q \<in> sets (M1 \<Otimes>\<^isub>M M2)" shows "(\<lambda>x. emeasure M2 (Pair x -` Q)) \<in> borel_measurable M1" (is "?s Q \<in> _")
3.456 proof -
3.457 - have [intro]: "sigma_algebra M1" and [intro]: "sigma_algebra M2" by default+
3.458 - have M1: "sigma_finite_measure M1" by default
3.459 - from M2.disjoint_sigma_finite guess F .. note F = this
3.460 + from M2.sigma_finite_disjoint guess F . note F = this
3.461 then have F_sets: "\<And>i. F i \<in> sets M2" by auto
3.462 + have M1: "sigma_finite_measure M1" ..
3.463 let ?C = "\<lambda>x i. F i \<inter> Pair x -` Q"
3.464 { fix i
3.465 - let ?R = "M2.restricted_space (F i)"
3.466 have [simp]: "space M1 \<times> F i \<inter> space M1 \<times> space M2 = space M1 \<times> F i"
3.467 - using F M2.sets_into_space by auto
3.468 - let ?R2 = "M2.restricted_space (F i)"
3.469 - have "(\<lambda>x. measure ?R2 (Pair x -` (space M1 \<times> space ?R2 \<inter> Q))) \<in> borel_measurable M1"
3.470 + using F sets_into_space by auto
3.471 + let ?R = "density M2 (indicator (F i))"
3.472 + have "(\<lambda>x. emeasure ?R (Pair x -` (space M1 \<times> space ?R \<inter> Q))) \<in> borel_measurable M1"
3.473 proof (intro finite_measure_cut_measurable[OF M1])
3.474 - show "finite_measure ?R2"
3.475 - using F by (intro M2.restricted_to_finite_measure) auto
3.476 - have "(space M1 \<times> space ?R2) \<inter> Q \<in> (op \<inter> (space M1 \<times> F i)) ` sets P"
3.477 - using `Q \<in> sets P` by (auto simp: image_iff)
3.478 - also have "\<dots> = sigma_sets (space M1 \<times> F i) ((op \<inter> (space M1 \<times> F i)) ` sets E)"
3.479 - unfolding pair_measure_def pair_measure_generator_def sigma_def
3.480 - using `F i \<in> sets M2` M2.sets_into_space
3.481 - by (auto intro!: sigma_sets_Int sigma_sets.Basic)
3.482 - also have "\<dots> \<subseteq> sets (M1 \<Otimes>\<^isub>M ?R2)"
3.483 - using M1.sets_into_space
3.484 - apply (auto simp: times_Int_times pair_measure_def pair_measure_generator_def sigma_def
3.485 - intro!: sigma_sets_subseteq)
3.486 - apply (rule_tac x="a" in exI)
3.487 - apply (rule_tac x="b \<inter> F i" in exI)
3.488 - by auto
3.489 - finally show "(space M1 \<times> space ?R2) \<inter> Q \<in> sets (M1 \<Otimes>\<^isub>M ?R2)" .
3.490 + show "finite_measure ?R"
3.491 + using F by (intro finite_measureI) (auto simp: emeasure_restricted subset_eq)
3.492 + show "(space M1 \<times> space ?R) \<inter> Q \<in> sets (M1 \<Otimes>\<^isub>M ?R)"
3.493 + using Q by (simp add: Int)
3.494 qed
3.495 - moreover have "\<And>x. Pair x -` (space M1 \<times> F i \<inter> Q) = ?C x i"
3.496 - using `Q \<in> sets P` sets_into_space by (auto simp: space_pair_measure)
3.497 - ultimately have "(\<lambda>x. measure M2 (?C x i)) \<in> borel_measurable M1"
3.498 + moreover have "\<And>x. emeasure ?R (Pair x -` (space M1 \<times> space ?R \<inter> Q))
3.499 + = emeasure M2 (F i \<inter> Pair x -` (space M1 \<times> space ?R \<inter> Q))"
3.500 + using Q F_sets by (intro emeasure_restricted) (auto intro: sets_Pair1)
3.501 + moreover have "\<And>x. F i \<inter> Pair x -` (space M1 \<times> space ?R \<inter> Q) = ?C x i"
3.502 + using sets_into_space[OF Q] by (auto simp: space_pair_measure)
3.503 + ultimately have "(\<lambda>x. emeasure M2 (?C x i)) \<in> borel_measurable M1"
3.504 by simp }
3.505 moreover
3.506 { fix x
3.507 - have "(\<Sum>i. measure M2 (?C x i)) = measure M2 (\<Union>i. ?C x i)"
3.508 - proof (intro M2.measure_countably_additive)
3.509 + have "(\<Sum>i. emeasure M2 (?C x i)) = emeasure M2 (\<Union>i. ?C x i)"
3.510 + proof (intro suminf_emeasure)
3.511 show "range (?C x) \<subseteq> sets M2"
3.512 - using F `Q \<in> sets P` by (auto intro!: M2.Int)
3.513 + using F `Q \<in> sets (M1 \<Otimes>\<^isub>M M2)` by (auto intro!: sets_Pair1)
3.514 have "disjoint_family F" using F by auto
3.515 show "disjoint_family (?C x)"
3.516 by (rule disjoint_family_on_bisimulation[OF `disjoint_family F`]) auto
3.517 qed
3.518 also have "(\<Union>i. ?C x i) = Pair x -` Q"
3.519 - using F sets_into_space `Q \<in> sets P`
3.520 + using F sets_into_space[OF `Q \<in> sets (M1 \<Otimes>\<^isub>M M2)`]
3.521 by (auto simp: space_pair_measure)
3.522 - finally have "measure M2 (Pair x -` Q) = (\<Sum>i. measure M2 (?C x i))"
3.523 + finally have "emeasure M2 (Pair x -` Q) = (\<Sum>i. emeasure M2 (?C x i))"
3.524 by simp }
3.525 - ultimately show ?thesis using `Q \<in> sets P` F_sets
3.526 - by (auto intro!: M1.borel_measurable_psuminf M2.Int)
3.527 + ultimately show ?thesis using `Q \<in> sets (M1 \<Otimes>\<^isub>M M2)` F_sets
3.528 + by auto
3.529 qed
3.530
3.531 -lemma (in pair_sigma_finite) measure_cut_measurable_snd:
3.532 - assumes "Q \<in> sets P" shows "(\<lambda>y. M1.\<mu> ((\<lambda>x. (x, y)) -` Q)) \<in> borel_measurable M2"
3.533 +lemma (in pair_sigma_finite) measurable_emeasure_Pair2:
3.534 + assumes Q: "Q \<in> sets (M1 \<Otimes>\<^isub>M M2)" shows "(\<lambda>y. emeasure M1 ((\<lambda>x. (x, y)) -` Q)) \<in> borel_measurable M2"
3.535 proof -
3.536 interpret Q: pair_sigma_finite M2 M1 by default
3.537 - note sets_pair_sigma_algebra_swap[OF assms]
3.538 - from Q.measure_cut_measurable_fst[OF this]
3.539 - show ?thesis by (simp add: vimage_compose[symmetric] comp_def)
3.540 + have "(\<lambda>(x, y). (y, x)) -` Q \<inter> space (M2 \<Otimes>\<^isub>M M1) \<in> sets (M2 \<Otimes>\<^isub>M M1)"
3.541 + using Q measurable_pair_swap' by (auto intro: measurable_sets)
3.542 + note Q.measurable_emeasure_Pair1[OF this]
3.543 + moreover have "\<And>y. Pair y -` ((\<lambda>(x, y). (y, x)) -` Q \<inter> space (M2 \<Otimes>\<^isub>M M1)) = (\<lambda>x. (x, y)) -` Q"
3.544 + using Q[THEN sets_into_space] by (auto simp: space_pair_measure)
3.545 + ultimately show ?thesis by simp
3.546 qed
3.547
3.548 -lemma (in pair_sigma_algebra) pair_sigma_algebra_measurable:
3.549 - assumes "f \<in> measurable P M" shows "(\<lambda>(x,y). f (y, x)) \<in> measurable (M2 \<Otimes>\<^isub>M M1) M"
3.550 +lemma (in pair_sigma_finite) emeasure_pair_measure:
3.551 + assumes "X \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.552 + shows "emeasure (M1 \<Otimes>\<^isub>M M2) X = (\<integral>\<^isup>+ x. \<integral>\<^isup>+ y. indicator X (x, y) \<partial>M2 \<partial>M1)" (is "_ = ?\<mu> X")
3.553 +proof (rule emeasure_measure_of[OF pair_measure_def])
3.554 + show "positive (sets (M1 \<Otimes>\<^isub>M M2)) ?\<mu>"
3.555 + by (auto simp: positive_def positive_integral_positive)
3.556 + have eq[simp]: "\<And>A x y. indicator A (x, y) = indicator (Pair x -` A) y"
3.557 + by (auto simp: indicator_def)
3.558 + show "countably_additive (sets (M1 \<Otimes>\<^isub>M M2)) ?\<mu>"
3.559 + proof (rule countably_additiveI)
3.560 + fix F :: "nat \<Rightarrow> ('a \<times> 'b) set" assume F: "range F \<subseteq> sets (M1 \<Otimes>\<^isub>M M2)" "disjoint_family F"
3.561 + from F have *: "\<And>i. F i \<in> sets (M1 \<Otimes>\<^isub>M M2)" "(\<Union>i. F i) \<in> sets (M1 \<Otimes>\<^isub>M M2)" by auto
3.562 + moreover from F have "\<And>i. (\<lambda>x. emeasure M2 (Pair x -` F i)) \<in> borel_measurable M1"
3.563 + by (intro measurable_emeasure_Pair1) auto
3.564 + moreover have "\<And>x. disjoint_family (\<lambda>i. Pair x -` F i)"
3.565 + by (intro disjoint_family_on_bisimulation[OF F(2)]) auto
3.566 + moreover have "\<And>x. range (\<lambda>i. Pair x -` F i) \<subseteq> sets M2"
3.567 + using F by (auto simp: sets_Pair1)
3.568 + ultimately show "(\<Sum>n. ?\<mu> (F n)) = ?\<mu> (\<Union>i. F i)"
3.569 + by (auto simp add: vimage_UN positive_integral_suminf[symmetric] suminf_emeasure subset_eq emeasure_nonneg sets_Pair1
3.570 + intro!: positive_integral_cong positive_integral_indicator[symmetric])
3.571 + qed
3.572 + show "{a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2} \<subseteq> Pow (space M1 \<times> space M2)"
3.573 + using space_closed[of M1] space_closed[of M2] by auto
3.574 +qed fact
3.575 +
3.576 +lemma (in pair_sigma_finite) emeasure_pair_measure_alt:
3.577 + assumes X: "X \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.578 + shows "emeasure (M1 \<Otimes>\<^isub>M M2) X = (\<integral>\<^isup>+x. emeasure M2 (Pair x -` X) \<partial>M1)"
3.579 proof -
3.580 - interpret Q: pair_sigma_algebra M2 M1 by default
3.581 - have *: "(\<lambda>(x,y). f (y, x)) = f \<circ> (\<lambda>(x,y). (y, x))" by (simp add: fun_eq_iff)
3.582 + have [simp]: "\<And>x y. indicator X (x, y) = indicator (Pair x -` X) y"
3.583 + by (auto simp: indicator_def)
3.584 show ?thesis
3.585 - using Q.pair_sigma_algebra_swap_measurable assms
3.586 - unfolding * by (rule measurable_comp)
3.587 + using X by (auto intro!: positive_integral_cong simp: emeasure_pair_measure sets_Pair1)
3.588 qed
3.589
3.590 -lemma (in pair_sigma_finite) pair_measure_alt:
3.591 - assumes "A \<in> sets P"
3.592 - shows "measure (M1 \<Otimes>\<^isub>M M2) A = (\<integral>\<^isup>+ x. measure M2 (Pair x -` A) \<partial>M1)"
3.593 - apply (simp add: pair_measure_def pair_measure_generator_def)
3.594 -proof (rule M1.positive_integral_cong)
3.595 - fix x assume "x \<in> space M1"
3.596 - have *: "\<And>y. indicator A (x, y) = (indicator (Pair x -` A) y :: ereal)"
3.597 - unfolding indicator_def by auto
3.598 - show "(\<integral>\<^isup>+ y. indicator A (x, y) \<partial>M2) = measure M2 (Pair x -` A)"
3.599 - unfolding *
3.600 - apply (subst M2.positive_integral_indicator)
3.601 - apply (rule measurable_cut_fst[OF assms])
3.602 - by simp
3.603 +lemma (in pair_sigma_finite) emeasure_pair_measure_Times:
3.604 + assumes A: "A \<in> sets M1" and B: "B \<in> sets M2"
3.605 + shows "emeasure (M1 \<Otimes>\<^isub>M M2) (A \<times> B) = emeasure M1 A * emeasure M2 B"
3.606 +proof -
3.607 + have "emeasure (M1 \<Otimes>\<^isub>M M2) (A \<times> B) = (\<integral>\<^isup>+x. emeasure M2 B * indicator A x \<partial>M1)"
3.608 + using A B by (auto intro!: positive_integral_cong simp: emeasure_pair_measure_alt)
3.609 + also have "\<dots> = emeasure M2 B * emeasure M1 A"
3.610 + using A by (simp add: emeasure_nonneg positive_integral_cmult_indicator)
3.611 + finally show ?thesis
3.612 + by (simp add: ac_simps)
3.613 qed
3.614
3.615 -lemma (in pair_sigma_finite) pair_measure_times:
3.616 - assumes A: "A \<in> sets M1" and "B \<in> sets M2"
3.617 - shows "measure (M1 \<Otimes>\<^isub>M M2) (A \<times> B) = M1.\<mu> A * measure M2 B"
3.618 +lemma (in pair_sigma_finite) sigma_finite_up_in_pair_measure_generator:
3.619 + defines "E \<equiv> {A \<times> B | A B. A \<in> sets M1 \<and> B \<in> sets M2}"
3.620 + shows "\<exists>F::nat \<Rightarrow> ('a \<times> 'b) set. range F \<subseteq> E \<and> incseq F \<and> (\<Union>i. F i) = space M1 \<times> space M2 \<and>
3.621 + (\<forall>i. emeasure (M1 \<Otimes>\<^isub>M M2) (F i) \<noteq> \<infinity>)"
3.622 proof -
3.623 - have "measure (M1 \<Otimes>\<^isub>M M2) (A \<times> B) = (\<integral>\<^isup>+ x. measure M2 B * indicator A x \<partial>M1)"
3.624 - using assms by (auto intro!: M1.positive_integral_cong simp: pair_measure_alt)
3.625 - with assms show ?thesis
3.626 - by (simp add: M1.positive_integral_cmult_indicator ac_simps)
3.627 -qed
3.628 -
3.629 -lemma (in measure_space) measure_not_negative[simp,intro]:
3.630 - assumes A: "A \<in> sets M" shows "\<mu> A \<noteq> - \<infinity>"
3.631 - using positive_measure[OF A] by auto
3.632 -
3.633 -lemma (in pair_sigma_finite) sigma_finite_up_in_pair_measure_generator:
3.634 - "\<exists>F::nat \<Rightarrow> ('a \<times> 'b) set. range F \<subseteq> sets E \<and> incseq F \<and> (\<Union>i. F i) = space E \<and>
3.635 - (\<forall>i. measure (M1 \<Otimes>\<^isub>M M2) (F i) \<noteq> \<infinity>)"
3.636 -proof -
3.637 - obtain F1 :: "nat \<Rightarrow> 'a set" and F2 :: "nat \<Rightarrow> 'b set" where
3.638 - F1: "range F1 \<subseteq> sets M1" "incseq F1" "(\<Union>i. F1 i) = space M1" "\<And>i. M1.\<mu> (F1 i) \<noteq> \<infinity>" and
3.639 - F2: "range F2 \<subseteq> sets M2" "incseq F2" "(\<Union>i. F2 i) = space M2" "\<And>i. M2.\<mu> (F2 i) \<noteq> \<infinity>"
3.640 - using M1.sigma_finite_up M2.sigma_finite_up by auto
3.641 - then have space: "space M1 = (\<Union>i. F1 i)" "space M2 = (\<Union>i. F2 i)" by auto
3.642 + from M1.sigma_finite_incseq guess F1 . note F1 = this
3.643 + from M2.sigma_finite_incseq guess F2 . note F2 = this
3.644 + from F1 F2 have space: "space M1 = (\<Union>i. F1 i)" "space M2 = (\<Union>i. F2 i)" by auto
3.645 let ?F = "\<lambda>i. F1 i \<times> F2 i"
3.646 - show ?thesis unfolding space_pair_measure
3.647 + show ?thesis
3.648 proof (intro exI[of _ ?F] conjI allI)
3.649 - show "range ?F \<subseteq> sets E" using F1 F2
3.650 - by (fastforce intro!: pair_measure_generatorI)
3.651 + show "range ?F \<subseteq> E" using F1 F2 by (auto simp: E_def) (metis range_subsetD)
3.652 next
3.653 have "space M1 \<times> space M2 \<subseteq> (\<Union>i. ?F i)"
3.654 proof (intro subsetI)
3.655 @@ -448,353 +352,315 @@
3.656 by (intro SigmaI) (auto simp add: min_max.sup_commute)
3.657 then show "x \<in> (\<Union>i. ?F i)" by auto
3.658 qed
3.659 - then show "(\<Union>i. ?F i) = space E"
3.660 - using space by (auto simp: space pair_measure_generator_def)
3.661 + then show "(\<Union>i. ?F i) = space M1 \<times> space M2"
3.662 + using space by (auto simp: space)
3.663 next
3.664 fix i show "incseq (\<lambda>i. F1 i \<times> F2 i)"
3.665 using `incseq F1` `incseq F2` unfolding incseq_Suc_iff by auto
3.666 next
3.667 fix i
3.668 from F1 F2 have "F1 i \<in> sets M1" "F2 i \<in> sets M2" by auto
3.669 - with F1 F2 M1.positive_measure[OF this(1)] M2.positive_measure[OF this(2)]
3.670 - show "measure P (F1 i \<times> F2 i) \<noteq> \<infinity>"
3.671 - by (simp add: pair_measure_times)
3.672 + with F1 F2 emeasure_nonneg[of M1 "F1 i"] emeasure_nonneg[of M2 "F2 i"]
3.673 + show "emeasure (M1 \<Otimes>\<^isub>M M2) (F1 i \<times> F2 i) \<noteq> \<infinity>"
3.674 + by (auto simp add: emeasure_pair_measure_Times)
3.675 qed
3.676 qed
3.677
3.678 -sublocale pair_sigma_finite \<subseteq> sigma_finite_measure P
3.679 +sublocale pair_sigma_finite \<subseteq> sigma_finite_measure "M1 \<Otimes>\<^isub>M M2"
3.680 proof
3.681 - show "positive P (measure P)"
3.682 - unfolding pair_measure_def pair_measure_generator_def sigma_def positive_def
3.683 - by (auto intro: M1.positive_integral_positive M2.positive_integral_positive)
3.684 -
3.685 - show "countably_additive P (measure P)"
3.686 - unfolding countably_additive_def
3.687 - proof (intro allI impI)
3.688 - fix F :: "nat \<Rightarrow> ('a \<times> 'b) set"
3.689 - assume F: "range F \<subseteq> sets P" "disjoint_family F"
3.690 - from F have *: "\<And>i. F i \<in> sets P" "(\<Union>i. F i) \<in> sets P" by auto
3.691 - moreover from F have "\<And>i. (\<lambda>x. measure M2 (Pair x -` F i)) \<in> borel_measurable M1"
3.692 - by (intro measure_cut_measurable_fst) auto
3.693 - moreover have "\<And>x. disjoint_family (\<lambda>i. Pair x -` F i)"
3.694 - by (intro disjoint_family_on_bisimulation[OF F(2)]) auto
3.695 - moreover have "\<And>x. x \<in> space M1 \<Longrightarrow> range (\<lambda>i. Pair x -` F i) \<subseteq> sets M2"
3.696 - using F by auto
3.697 - ultimately show "(\<Sum>n. measure P (F n)) = measure P (\<Union>i. F i)"
3.698 - by (simp add: pair_measure_alt vimage_UN M1.positive_integral_suminf[symmetric]
3.699 - M2.measure_countably_additive
3.700 - cong: M1.positive_integral_cong)
3.701 - qed
3.702 -
3.703 from sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('a \<times> 'b) set" .. note F = this
3.704 - show "\<exists>F::nat \<Rightarrow> ('a \<times> 'b) set. range F \<subseteq> sets P \<and> (\<Union>i. F i) = space P \<and> (\<forall>i. measure P (F i) \<noteq> \<infinity>)"
3.705 + show "\<exists>F::nat \<Rightarrow> ('a \<times> 'b) set. range F \<subseteq> sets (M1 \<Otimes>\<^isub>M M2) \<and> (\<Union>i. F i) = space (M1 \<Otimes>\<^isub>M M2) \<and> (\<forall>i. emeasure (M1 \<Otimes>\<^isub>M M2) (F i) \<noteq> \<infinity>)"
3.706 proof (rule exI[of _ F], intro conjI)
3.707 - show "range F \<subseteq> sets P" using F by (auto simp: pair_measure_def)
3.708 - show "(\<Union>i. F i) = space P"
3.709 - using F by (auto simp: pair_measure_def pair_measure_generator_def)
3.710 - show "\<forall>i. measure P (F i) \<noteq> \<infinity>" using F by auto
3.711 + show "range F \<subseteq> sets (M1 \<Otimes>\<^isub>M M2)" using F by (auto simp: pair_measure_def)
3.712 + show "(\<Union>i. F i) = space (M1 \<Otimes>\<^isub>M M2)"
3.713 + using F by (auto simp: space_pair_measure)
3.714 + show "\<forall>i. emeasure (M1 \<Otimes>\<^isub>M M2) (F i) \<noteq> \<infinity>" using F by auto
3.715 qed
3.716 qed
3.717
3.718 -lemma (in pair_sigma_algebra) sets_swap:
3.719 - assumes "A \<in> sets P"
3.720 - shows "(\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^isub>M M1) \<in> sets (M2 \<Otimes>\<^isub>M M1)"
3.721 - (is "_ -` A \<inter> space ?Q \<in> sets ?Q")
3.722 +lemma sigma_finite_pair_measure:
3.723 + assumes A: "sigma_finite_measure A" and B: "sigma_finite_measure B"
3.724 + shows "sigma_finite_measure (A \<Otimes>\<^isub>M B)"
3.725 proof -
3.726 - have *: "(\<lambda>(x, y). (y, x)) -` A \<inter> space ?Q = (\<lambda>(x, y). (y, x)) -` A"
3.727 - using `A \<in> sets P` sets_into_space by (auto simp: space_pair_measure)
3.728 - show ?thesis
3.729 - unfolding * using assms by (rule sets_pair_sigma_algebra_swap)
3.730 + interpret A: sigma_finite_measure A by fact
3.731 + interpret B: sigma_finite_measure B by fact
3.732 + interpret AB: pair_sigma_finite A B ..
3.733 + show ?thesis ..
3.734 qed
3.735
3.736 -lemma (in pair_sigma_finite) pair_measure_alt2:
3.737 - assumes A: "A \<in> sets P"
3.738 - shows "\<mu> A = (\<integral>\<^isup>+y. M1.\<mu> ((\<lambda>x. (x, y)) -` A) \<partial>M2)"
3.739 +lemma sets_pair_swap:
3.740 + assumes "A \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.741 + shows "(\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^isub>M M1) \<in> sets (M2 \<Otimes>\<^isub>M M1)"
3.742 + using measurable_pair_swap' assms by (rule measurable_sets)
3.743 +
3.744 +lemma (in pair_sigma_finite) distr_pair_swap:
3.745 + "M1 \<Otimes>\<^isub>M M2 = distr (M2 \<Otimes>\<^isub>M M1) (M1 \<Otimes>\<^isub>M M2) (\<lambda>(x, y). (y, x))" (is "?P = ?D")
3.746 +proof -
3.747 + interpret Q: pair_sigma_finite M2 M1 by default
3.748 + from sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('a \<times> 'b) set" .. note F = this
3.749 + let ?E = "{a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2}"
3.750 + show ?thesis
3.751 + proof (rule measure_eqI_generator_eq[OF Int_stable_pair_measure_generator[of M1 M2]])
3.752 + show "?E \<subseteq> Pow (space ?P)"
3.753 + using space_closed[of M1] space_closed[of M2] by (auto simp: space_pair_measure)
3.754 + show "sets ?P = sigma_sets (space ?P) ?E"
3.755 + by (simp add: sets_pair_measure space_pair_measure)
3.756 + then show "sets ?D = sigma_sets (space ?P) ?E"
3.757 + by simp
3.758 + next
3.759 + show "range F \<subseteq> ?E" "incseq F" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?P (F i) \<noteq> \<infinity>"
3.760 + using F by (auto simp: space_pair_measure)
3.761 + next
3.762 + fix X assume "X \<in> ?E"
3.763 + then obtain A B where X[simp]: "X = A \<times> B" and A: "A \<in> sets M1" and B: "B \<in> sets M2" by auto
3.764 + have "(\<lambda>(y, x). (x, y)) -` X \<inter> space (M2 \<Otimes>\<^isub>M M1) = B \<times> A"
3.765 + using sets_into_space[OF A] sets_into_space[OF B] by (auto simp: space_pair_measure)
3.766 + with A B show "emeasure (M1 \<Otimes>\<^isub>M M2) X = emeasure ?D X"
3.767 + by (simp add: emeasure_pair_measure_Times Q.emeasure_pair_measure_Times emeasure_distr
3.768 + measurable_pair_swap' ac_simps)
3.769 + qed
3.770 +qed
3.771 +
3.772 +lemma (in pair_sigma_finite) emeasure_pair_measure_alt2:
3.773 + assumes A: "A \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.774 + shows "emeasure (M1 \<Otimes>\<^isub>M M2) A = (\<integral>\<^isup>+y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2)"
3.775 (is "_ = ?\<nu> A")
3.776 proof -
3.777 interpret Q: pair_sigma_finite M2 M1 by default
3.778 - from sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('a \<times> 'b) set" .. note F = this
3.779 - have [simp]: "\<And>m. \<lparr> space = space E, sets = sets (sigma E), measure = m \<rparr> = P\<lparr> measure := m \<rparr>"
3.780 - unfolding pair_measure_def by simp
3.781 -
3.782 - have "\<mu> A = Q.\<mu> ((\<lambda>(y, x). (x, y)) -` A \<inter> space Q.P)"
3.783 - proof (rule measure_unique_Int_stable_vimage[OF Int_stable_pair_measure_generator])
3.784 - show "measure_space P" "measure_space Q.P" by default
3.785 - show "(\<lambda>(y, x). (x, y)) \<in> measurable Q.P P" by (rule Q.pair_sigma_algebra_swap_measurable)
3.786 - show "sets (sigma E) = sets P" "space E = space P" "A \<in> sets (sigma E)"
3.787 - using assms unfolding pair_measure_def by auto
3.788 - show "range F \<subseteq> sets E" "incseq F" "(\<Union>i. F i) = space E" "\<And>i. \<mu> (F i) \<noteq> \<infinity>"
3.789 - using F `A \<in> sets P` by (auto simp: pair_measure_def)
3.790 - fix X assume "X \<in> sets E"
3.791 - then obtain A B where X[simp]: "X = A \<times> B" and AB: "A \<in> sets M1" "B \<in> sets M2"
3.792 - unfolding pair_measure_def pair_measure_generator_def by auto
3.793 - then have "(\<lambda>(y, x). (x, y)) -` X \<inter> space Q.P = B \<times> A"
3.794 - using M1.sets_into_space M2.sets_into_space by (auto simp: space_pair_measure)
3.795 - then show "\<mu> X = Q.\<mu> ((\<lambda>(y, x). (x, y)) -` X \<inter> space Q.P)"
3.796 - using AB by (simp add: pair_measure_times Q.pair_measure_times ac_simps)
3.797 - qed
3.798 - then show ?thesis
3.799 - using sets_into_space[OF A] Q.pair_measure_alt[OF sets_swap[OF A]]
3.800 - by (auto simp add: Q.pair_measure_alt space_pair_measure
3.801 - intro!: M2.positive_integral_cong arg_cong[where f="M1.\<mu>"])
3.802 -qed
3.803 -
3.804 -lemma pair_sigma_algebra_sigma:
3.805 - assumes 1: "incseq S1" "(\<Union>i. S1 i) = space E1" "range S1 \<subseteq> sets E1" and E1: "sets E1 \<subseteq> Pow (space E1)"
3.806 - assumes 2: "decseq S2" "(\<Union>i. S2 i) = space E2" "range S2 \<subseteq> sets E2" and E2: "sets E2 \<subseteq> Pow (space E2)"
3.807 - shows "sets (sigma (pair_measure_generator (sigma E1) (sigma E2))) = sets (sigma (pair_measure_generator E1 E2))"
3.808 - (is "sets ?S = sets ?E")
3.809 -proof -
3.810 - interpret M1: sigma_algebra "sigma E1" using E1 by (rule sigma_algebra_sigma)
3.811 - interpret M2: sigma_algebra "sigma E2" using E2 by (rule sigma_algebra_sigma)
3.812 - have P: "sets (pair_measure_generator E1 E2) \<subseteq> Pow (space E1 \<times> space E2)"
3.813 - using E1 E2 by (auto simp add: pair_measure_generator_def)
3.814 - interpret E: sigma_algebra ?E unfolding pair_measure_generator_def
3.815 - using E1 E2 by (intro sigma_algebra_sigma) auto
3.816 - { fix A assume "A \<in> sets E1"
3.817 - then have "fst -` A \<inter> space ?E = A \<times> (\<Union>i. S2 i)"
3.818 - using E1 2 unfolding pair_measure_generator_def by auto
3.819 - also have "\<dots> = (\<Union>i. A \<times> S2 i)" by auto
3.820 - also have "\<dots> \<in> sets ?E" unfolding pair_measure_generator_def sets_sigma
3.821 - using 2 `A \<in> sets E1`
3.822 - by (intro sigma_sets.Union)
3.823 - (force simp: image_subset_iff intro!: sigma_sets.Basic)
3.824 - finally have "fst -` A \<inter> space ?E \<in> sets ?E" . }
3.825 - moreover
3.826 - { fix B assume "B \<in> sets E2"
3.827 - then have "snd -` B \<inter> space ?E = (\<Union>i. S1 i) \<times> B"
3.828 - using E2 1 unfolding pair_measure_generator_def by auto
3.829 - also have "\<dots> = (\<Union>i. S1 i \<times> B)" by auto
3.830 - also have "\<dots> \<in> sets ?E"
3.831 - using 1 `B \<in> sets E2` unfolding pair_measure_generator_def sets_sigma
3.832 - by (intro sigma_sets.Union)
3.833 - (force simp: image_subset_iff intro!: sigma_sets.Basic)
3.834 - finally have "snd -` B \<inter> space ?E \<in> sets ?E" . }
3.835 - ultimately have proj:
3.836 - "fst \<in> measurable ?E (sigma E1) \<and> snd \<in> measurable ?E (sigma E2)"
3.837 - using E1 E2 by (subst (1 2) E.measurable_iff_sigma)
3.838 - (auto simp: pair_measure_generator_def sets_sigma)
3.839 - { fix A B assume A: "A \<in> sets (sigma E1)" and B: "B \<in> sets (sigma E2)"
3.840 - with proj have "fst -` A \<inter> space ?E \<in> sets ?E" "snd -` B \<inter> space ?E \<in> sets ?E"
3.841 - unfolding measurable_def by simp_all
3.842 - moreover have "A \<times> B = (fst -` A \<inter> space ?E) \<inter> (snd -` B \<inter> space ?E)"
3.843 - using A B M1.sets_into_space M2.sets_into_space
3.844 - by (auto simp: pair_measure_generator_def)
3.845 - ultimately have "A \<times> B \<in> sets ?E" by auto }
3.846 - then have "sigma_sets (space ?E) (sets (pair_measure_generator (sigma E1) (sigma E2))) \<subseteq> sets ?E"
3.847 - by (intro E.sigma_sets_subset) (auto simp add: pair_measure_generator_def sets_sigma)
3.848 - then have subset: "sets ?S \<subseteq> sets ?E"
3.849 - by (simp add: sets_sigma pair_measure_generator_def)
3.850 - show "sets ?S = sets ?E"
3.851 - proof (intro set_eqI iffI)
3.852 - fix A assume "A \<in> sets ?E" then show "A \<in> sets ?S"
3.853 - unfolding sets_sigma
3.854 - proof induct
3.855 - case (Basic A) then show ?case
3.856 - by (auto simp: pair_measure_generator_def sets_sigma intro: sigma_sets.Basic)
3.857 - qed (auto intro: sigma_sets.intros simp: pair_measure_generator_def)
3.858 - next
3.859 - fix A assume "A \<in> sets ?S" then show "A \<in> sets ?E" using subset by auto
3.860 - qed
3.861 + have [simp]: "\<And>y. (Pair y -` ((\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^isub>M M1))) = (\<lambda>x. (x, y)) -` A"
3.862 + using sets_into_space[OF A] by (auto simp: space_pair_measure)
3.863 + show ?thesis using A
3.864 + by (subst distr_pair_swap)
3.865 + (simp_all del: vimage_Int add: measurable_sets[OF measurable_pair_swap']
3.866 + Q.emeasure_pair_measure_alt emeasure_distr[OF measurable_pair_swap' A])
3.867 qed
3.868
3.869 section "Fubinis theorem"
3.870
3.871 lemma (in pair_sigma_finite) simple_function_cut:
3.872 - assumes f: "simple_function P f" "\<And>x. 0 \<le> f x"
3.873 + assumes f: "simple_function (M1 \<Otimes>\<^isub>M M2) f" "\<And>x. 0 \<le> f x"
3.874 shows "(\<lambda>x. \<integral>\<^isup>+y. f (x, y) \<partial>M2) \<in> borel_measurable M1"
3.875 - and "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P P f"
3.876 + and "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) f"
3.877 proof -
3.878 - have f_borel: "f \<in> borel_measurable P"
3.879 + have f_borel: "f \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.880 using f(1) by (rule borel_measurable_simple_function)
3.881 - let ?F = "\<lambda>z. f -` {z} \<inter> space P"
3.882 + let ?F = "\<lambda>z. f -` {z} \<inter> space (M1 \<Otimes>\<^isub>M M2)"
3.883 let ?F' = "\<lambda>x z. Pair x -` ?F z"
3.884 { fix x assume "x \<in> space M1"
3.885 have [simp]: "\<And>z y. indicator (?F z) (x, y) = indicator (?F' x z) y"
3.886 by (auto simp: indicator_def)
3.887 - have "\<And>y. y \<in> space M2 \<Longrightarrow> (x, y) \<in> space P" using `x \<in> space M1`
3.888 + have "\<And>y. y \<in> space M2 \<Longrightarrow> (x, y) \<in> space (M1 \<Otimes>\<^isub>M M2)" using `x \<in> space M1`
3.889 by (simp add: space_pair_measure)
3.890 moreover have "\<And>x z. ?F' x z \<in> sets M2" using f_borel
3.891 - by (intro borel_measurable_vimage measurable_cut_fst)
3.892 + by (rule sets_Pair1[OF measurable_sets]) auto
3.893 ultimately have "simple_function M2 (\<lambda> y. f (x, y))"
3.894 - apply (rule_tac M2.simple_function_cong[THEN iffD2, OF _])
3.895 + apply (rule_tac simple_function_cong[THEN iffD2, OF _])
3.896 apply (rule simple_function_indicator_representation[OF f(1)])
3.897 - using `x \<in> space M1` by (auto simp del: space_sigma) }
3.898 + using `x \<in> space M1` by auto }
3.899 note M2_sf = this
3.900 { fix x assume x: "x \<in> space M1"
3.901 - then have "(\<integral>\<^isup>+y. f (x, y) \<partial>M2) = (\<Sum>z\<in>f ` space P. z * M2.\<mu> (?F' x z))"
3.902 - unfolding M2.positive_integral_eq_simple_integral[OF M2_sf[OF x] f(2)]
3.903 + then have "(\<integral>\<^isup>+y. f (x, y) \<partial>M2) = (\<Sum>z\<in>f ` space (M1 \<Otimes>\<^isub>M M2). z * emeasure M2 (?F' x z))"
3.904 + unfolding positive_integral_eq_simple_integral[OF M2_sf[OF x] f(2)]
3.905 unfolding simple_integral_def
3.906 proof (safe intro!: setsum_mono_zero_cong_left)
3.907 - from f(1) show "finite (f ` space P)" by (rule simple_functionD)
3.908 + from f(1) show "finite (f ` space (M1 \<Otimes>\<^isub>M M2))" by (rule simple_functionD)
3.909 next
3.910 - fix y assume "y \<in> space M2" then show "f (x, y) \<in> f ` space P"
3.911 + fix y assume "y \<in> space M2" then show "f (x, y) \<in> f ` space (M1 \<Otimes>\<^isub>M M2)"
3.912 using `x \<in> space M1` by (auto simp: space_pair_measure)
3.913 next
3.914 - fix x' y assume "(x', y) \<in> space P"
3.915 + fix x' y assume "(x', y) \<in> space (M1 \<Otimes>\<^isub>M M2)"
3.916 "f (x', y) \<notin> (\<lambda>y. f (x, y)) ` space M2"
3.917 then have *: "?F' x (f (x', y)) = {}"
3.918 by (force simp: space_pair_measure)
3.919 - show "f (x', y) * M2.\<mu> (?F' x (f (x', y))) = 0"
3.920 + show "f (x', y) * emeasure M2 (?F' x (f (x', y))) = 0"
3.921 unfolding * by simp
3.922 qed (simp add: vimage_compose[symmetric] comp_def
3.923 space_pair_measure) }
3.924 note eq = this
3.925 - moreover have "\<And>z. ?F z \<in> sets P"
3.926 - by (auto intro!: f_borel borel_measurable_vimage simp del: space_sigma)
3.927 - moreover then have "\<And>z. (\<lambda>x. M2.\<mu> (?F' x z)) \<in> borel_measurable M1"
3.928 - by (auto intro!: measure_cut_measurable_fst simp del: vimage_Int)
3.929 - moreover have *: "\<And>i x. 0 \<le> M2.\<mu> (Pair x -` (f -` {i} \<inter> space P))"
3.930 - using f(1)[THEN simple_functionD(2)] f(2) by (intro M2.positive_measure measurable_cut_fst)
3.931 - moreover { fix i assume "i \<in> f`space P"
3.932 - with * have "\<And>x. 0 \<le> i * M2.\<mu> (Pair x -` (f -` {i} \<inter> space P))"
3.933 + moreover have "\<And>z. ?F z \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.934 + by (auto intro!: f_borel borel_measurable_vimage)
3.935 + moreover then have "\<And>z. (\<lambda>x. emeasure M2 (?F' x z)) \<in> borel_measurable M1"
3.936 + by (auto intro!: measurable_emeasure_Pair1 simp del: vimage_Int)
3.937 + moreover have *: "\<And>i x. 0 \<le> emeasure M2 (Pair x -` (f -` {i} \<inter> space (M1 \<Otimes>\<^isub>M M2)))"
3.938 + using f(1)[THEN simple_functionD(2)] f(2) by (intro emeasure_nonneg)
3.939 + moreover { fix i assume "i \<in> f`space (M1 \<Otimes>\<^isub>M M2)"
3.940 + with * have "\<And>x. 0 \<le> i * emeasure M2 (Pair x -` (f -` {i} \<inter> space (M1 \<Otimes>\<^isub>M M2)))"
3.941 using f(2) by auto }
3.942 ultimately
3.943 show "(\<lambda>x. \<integral>\<^isup>+y. f (x, y) \<partial>M2) \<in> borel_measurable M1"
3.944 - and "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P P f" using f(2)
3.945 - by (auto simp del: vimage_Int cong: measurable_cong
3.946 - intro!: M1.borel_measurable_ereal_setsum setsum_cong
3.947 - simp add: M1.positive_integral_setsum simple_integral_def
3.948 - M1.positive_integral_cmult
3.949 - M1.positive_integral_cong[OF eq]
3.950 + and "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) f" using f(2)
3.951 + by (auto simp del: vimage_Int cong: measurable_cong intro!: setsum_cong
3.952 + simp add: positive_integral_setsum simple_integral_def
3.953 + positive_integral_cmult
3.954 + positive_integral_cong[OF eq]
3.955 positive_integral_eq_simple_integral[OF f]
3.956 - pair_measure_alt[symmetric])
3.957 + emeasure_pair_measure_alt[symmetric])
3.958 qed
3.959
3.960 lemma (in pair_sigma_finite) positive_integral_fst_measurable:
3.961 - assumes f: "f \<in> borel_measurable P"
3.962 + assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.963 shows "(\<lambda>x. \<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<in> borel_measurable M1"
3.964 (is "?C f \<in> borel_measurable M1")
3.965 - and "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P P f"
3.966 + and "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) f"
3.967 proof -
3.968 from borel_measurable_implies_simple_function_sequence'[OF f] guess F . note F = this
3.969 - then have F_borel: "\<And>i. F i \<in> borel_measurable P"
3.970 + then have F_borel: "\<And>i. F i \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.971 by (auto intro: borel_measurable_simple_function)
3.972 note sf = simple_function_cut[OF F(1,5)]
3.973 then have "(\<lambda>x. SUP i. ?C (F i) x) \<in> borel_measurable M1"
3.974 using F(1) by auto
3.975 moreover
3.976 { fix x assume "x \<in> space M1"
3.977 - from F measurable_pair_image_snd[OF F_borel`x \<in> space M1`]
3.978 + from F measurable_Pair2[OF F_borel `x \<in> space M1`]
3.979 have "(\<integral>\<^isup>+y. (SUP i. F i (x, y)) \<partial>M2) = (SUP i. ?C (F i) x)"
3.980 - by (intro M2.positive_integral_monotone_convergence_SUP)
3.981 + by (intro positive_integral_monotone_convergence_SUP)
3.982 (auto simp: incseq_Suc_iff le_fun_def)
3.983 then have "(SUP i. ?C (F i) x) = ?C f x"
3.984 unfolding F(4) positive_integral_max_0 by simp }
3.985 note SUPR_C = this
3.986 ultimately show "?C f \<in> borel_measurable M1"
3.987 by (simp cong: measurable_cong)
3.988 - have "(\<integral>\<^isup>+x. (SUP i. F i x) \<partial>P) = (SUP i. integral\<^isup>P P (F i))"
3.989 + have "(\<integral>\<^isup>+x. (SUP i. F i x) \<partial>(M1 \<Otimes>\<^isub>M M2)) = (SUP i. integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) (F i))"
3.990 using F_borel F
3.991 by (intro positive_integral_monotone_convergence_SUP) auto
3.992 - also have "(SUP i. integral\<^isup>P P (F i)) = (SUP i. \<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. F i (x, y) \<partial>M2) \<partial>M1)"
3.993 + also have "(SUP i. integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) (F i)) = (SUP i. \<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. F i (x, y) \<partial>M2) \<partial>M1)"
3.994 unfolding sf(2) by simp
3.995 also have "\<dots> = \<integral>\<^isup>+ x. (SUP i. \<integral>\<^isup>+ y. F i (x, y) \<partial>M2) \<partial>M1" using F sf(1)
3.996 - by (intro M1.positive_integral_monotone_convergence_SUP[symmetric])
3.997 - (auto intro!: M2.positive_integral_mono M2.positive_integral_positive
3.998 - simp: incseq_Suc_iff le_fun_def)
3.999 + by (intro positive_integral_monotone_convergence_SUP[symmetric])
3.1000 + (auto intro!: positive_integral_mono positive_integral_positive
3.1001 + simp: incseq_Suc_iff le_fun_def)
3.1002 also have "\<dots> = \<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. (SUP i. F i (x, y)) \<partial>M2) \<partial>M1"
3.1003 using F_borel F(2,5)
3.1004 - by (auto intro!: M1.positive_integral_cong M2.positive_integral_monotone_convergence_SUP[symmetric]
3.1005 - simp: incseq_Suc_iff le_fun_def measurable_pair_image_snd)
3.1006 - finally show "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P P f"
3.1007 + by (auto intro!: positive_integral_cong positive_integral_monotone_convergence_SUP[symmetric] measurable_Pair2
3.1008 + simp: incseq_Suc_iff le_fun_def)
3.1009 + finally show "(\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) f"
3.1010 using F by (simp add: positive_integral_max_0)
3.1011 qed
3.1012
3.1013 -lemma (in pair_sigma_finite) measure_preserving_swap:
3.1014 - "(\<lambda>(x,y). (y, x)) \<in> measure_preserving (M1 \<Otimes>\<^isub>M M2) (M2 \<Otimes>\<^isub>M M1)"
3.1015 -proof
3.1016 - interpret Q: pair_sigma_finite M2 M1 by default
3.1017 - show *: "(\<lambda>(x,y). (y, x)) \<in> measurable (M1 \<Otimes>\<^isub>M M2) (M2 \<Otimes>\<^isub>M M1)"
3.1018 - using pair_sigma_algebra_swap_measurable .
3.1019 - fix X assume "X \<in> sets (M2 \<Otimes>\<^isub>M M1)"
3.1020 - from measurable_sets[OF * this] this Q.sets_into_space[OF this]
3.1021 - show "measure (M1 \<Otimes>\<^isub>M M2) ((\<lambda>(x, y). (y, x)) -` X \<inter> space P) = measure (M2 \<Otimes>\<^isub>M M1) X"
3.1022 - by (auto intro!: M1.positive_integral_cong arg_cong[where f="M2.\<mu>"]
3.1023 - simp: pair_measure_alt Q.pair_measure_alt2 space_pair_measure)
3.1024 -qed
3.1025 -
3.1026 -lemma (in pair_sigma_finite) positive_integral_product_swap:
3.1027 - assumes f: "f \<in> borel_measurable P"
3.1028 - shows "(\<integral>\<^isup>+x. f (case x of (x,y)\<Rightarrow>(y,x)) \<partial>(M2 \<Otimes>\<^isub>M M1)) = integral\<^isup>P P f"
3.1029 +lemma (in pair_sigma_finite) positive_integral_snd_measurable:
3.1030 + assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1031 + shows "(\<integral>\<^isup>+ y. (\<integral>\<^isup>+ x. f (x, y) \<partial>M1) \<partial>M2) = integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) f"
3.1032 proof -
3.1033 interpret Q: pair_sigma_finite M2 M1 by default
3.1034 - have "sigma_algebra P" by default
3.1035 - with f show ?thesis
3.1036 - by (subst Q.positive_integral_vimage[OF _ Q.measure_preserving_swap]) auto
3.1037 -qed
3.1038 -
3.1039 -lemma (in pair_sigma_finite) positive_integral_snd_measurable:
3.1040 - assumes f: "f \<in> borel_measurable P"
3.1041 - shows "(\<integral>\<^isup>+ y. (\<integral>\<^isup>+ x. f (x, y) \<partial>M1) \<partial>M2) = integral\<^isup>P P f"
3.1042 -proof -
3.1043 - interpret Q: pair_sigma_finite M2 M1 by default
3.1044 - note pair_sigma_algebra_measurable[OF f]
3.1045 + note measurable_pair_swap[OF f]
3.1046 from Q.positive_integral_fst_measurable[OF this]
3.1047 - have "(\<integral>\<^isup>+ y. (\<integral>\<^isup>+ x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>\<^isup>+ (x, y). f (y, x) \<partial>Q.P)"
3.1048 + have "(\<integral>\<^isup>+ y. (\<integral>\<^isup>+ x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>\<^isup>+ (x, y). f (y, x) \<partial>(M2 \<Otimes>\<^isub>M M1))"
3.1049 by simp
3.1050 - also have "(\<integral>\<^isup>+ (x, y). f (y, x) \<partial>Q.P) = integral\<^isup>P P f"
3.1051 - unfolding positive_integral_product_swap[OF f, symmetric]
3.1052 - by (auto intro!: Q.positive_integral_cong)
3.1053 + also have "(\<integral>\<^isup>+ (x, y). f (y, x) \<partial>(M2 \<Otimes>\<^isub>M M1)) = integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) f"
3.1054 + by (subst distr_pair_swap)
3.1055 + (auto simp: positive_integral_distr[OF measurable_pair_swap' f] intro!: positive_integral_cong)
3.1056 finally show ?thesis .
3.1057 qed
3.1058
3.1059 lemma (in pair_sigma_finite) Fubini:
3.1060 - assumes f: "f \<in> borel_measurable P"
3.1061 + assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1062 shows "(\<integral>\<^isup>+ y. (\<integral>\<^isup>+ x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (x, y) \<partial>M2) \<partial>M1)"
3.1063 unfolding positive_integral_snd_measurable[OF assms]
3.1064 unfolding positive_integral_fst_measurable[OF assms] ..
3.1065
3.1066 lemma (in pair_sigma_finite) AE_pair:
3.1067 - assumes "AE x in P. Q x"
3.1068 + assumes "AE x in (M1 \<Otimes>\<^isub>M M2). Q x"
3.1069 shows "AE x in M1. (AE y in M2. Q (x, y))"
3.1070 proof -
3.1071 - obtain N where N: "N \<in> sets P" "\<mu> N = 0" "{x\<in>space P. \<not> Q x} \<subseteq> N"
3.1072 - using assms unfolding almost_everywhere_def by auto
3.1073 + obtain N where N: "N \<in> sets (M1 \<Otimes>\<^isub>M M2)" "emeasure (M1 \<Otimes>\<^isub>M M2) N = 0" "{x\<in>space (M1 \<Otimes>\<^isub>M M2). \<not> Q x} \<subseteq> N"
3.1074 + using assms unfolding eventually_ae_filter by auto
3.1075 show ?thesis
3.1076 - proof (rule M1.AE_I)
3.1077 - from N measure_cut_measurable_fst[OF `N \<in> sets P`]
3.1078 - show "M1.\<mu> {x\<in>space M1. M2.\<mu> (Pair x -` N) \<noteq> 0} = 0"
3.1079 - by (auto simp: pair_measure_alt M1.positive_integral_0_iff)
3.1080 - show "{x \<in> space M1. M2.\<mu> (Pair x -` N) \<noteq> 0} \<in> sets M1"
3.1081 - by (intro M1.borel_measurable_ereal_neq_const measure_cut_measurable_fst N)
3.1082 - { fix x assume "x \<in> space M1" "M2.\<mu> (Pair x -` N) = 0"
3.1083 - have "M2.almost_everywhere (\<lambda>y. Q (x, y))"
3.1084 - proof (rule M2.AE_I)
3.1085 - show "M2.\<mu> (Pair x -` N) = 0" by fact
3.1086 - show "Pair x -` N \<in> sets M2" by (intro measurable_cut_fst N)
3.1087 + proof (rule AE_I)
3.1088 + from N measurable_emeasure_Pair1[OF `N \<in> sets (M1 \<Otimes>\<^isub>M M2)`]
3.1089 + show "emeasure M1 {x\<in>space M1. emeasure M2 (Pair x -` N) \<noteq> 0} = 0"
3.1090 + by (auto simp: emeasure_pair_measure_alt positive_integral_0_iff emeasure_nonneg)
3.1091 + show "{x \<in> space M1. emeasure M2 (Pair x -` N) \<noteq> 0} \<in> sets M1"
3.1092 + by (intro borel_measurable_ereal_neq_const measurable_emeasure_Pair1 N)
3.1093 + { fix x assume "x \<in> space M1" "emeasure M2 (Pair x -` N) = 0"
3.1094 + have "AE y in M2. Q (x, y)"
3.1095 + proof (rule AE_I)
3.1096 + show "emeasure M2 (Pair x -` N) = 0" by fact
3.1097 + show "Pair x -` N \<in> sets M2" using N(1) by (rule sets_Pair1)
3.1098 show "{y \<in> space M2. \<not> Q (x, y)} \<subseteq> Pair x -` N"
3.1099 - using N `x \<in> space M1` unfolding space_sigma space_pair_measure by auto
3.1100 + using N `x \<in> space M1` unfolding space_pair_measure by auto
3.1101 qed }
3.1102 - then show "{x \<in> space M1. \<not> M2.almost_everywhere (\<lambda>y. Q (x, y))} \<subseteq> {x \<in> space M1. M2.\<mu> (Pair x -` N) \<noteq> 0}"
3.1103 + then show "{x \<in> space M1. \<not> (AE y in M2. Q (x, y))} \<subseteq> {x \<in> space M1. emeasure M2 (Pair x -` N) \<noteq> 0}"
3.1104 by auto
3.1105 qed
3.1106 qed
3.1107
3.1108 -lemma (in pair_sigma_algebra) measurable_product_swap:
3.1109 - "f \<in> measurable (M2 \<Otimes>\<^isub>M M1) M \<longleftrightarrow> (\<lambda>(x,y). f (y,x)) \<in> measurable P M"
3.1110 +lemma (in pair_sigma_finite) AE_pair_measure:
3.1111 + assumes "{x\<in>space (M1 \<Otimes>\<^isub>M M2). P x} \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.1112 + assumes ae: "AE x in M1. AE y in M2. P (x, y)"
3.1113 + shows "AE x in M1 \<Otimes>\<^isub>M M2. P x"
3.1114 +proof (subst AE_iff_measurable[OF _ refl])
3.1115 + show "{x\<in>space (M1 \<Otimes>\<^isub>M M2). \<not> P x} \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.1116 + by (rule sets_Collect) fact
3.1117 + then have "emeasure (M1 \<Otimes>\<^isub>M M2) {x \<in> space (M1 \<Otimes>\<^isub>M M2). \<not> P x} =
3.1118 + (\<integral>\<^isup>+ x. \<integral>\<^isup>+ y. indicator {x \<in> space (M1 \<Otimes>\<^isub>M M2). \<not> P x} (x, y) \<partial>M2 \<partial>M1)"
3.1119 + by (simp add: emeasure_pair_measure)
3.1120 + also have "\<dots> = (\<integral>\<^isup>+ x. \<integral>\<^isup>+ y. 0 \<partial>M2 \<partial>M1)"
3.1121 + using ae
3.1122 + apply (safe intro!: positive_integral_cong_AE)
3.1123 + apply (intro AE_I2)
3.1124 + apply (safe intro!: positive_integral_cong_AE)
3.1125 + apply auto
3.1126 + done
3.1127 + finally show "emeasure (M1 \<Otimes>\<^isub>M M2) {x \<in> space (M1 \<Otimes>\<^isub>M M2). \<not> P x} = 0" by simp
3.1128 +qed
3.1129 +
3.1130 +lemma (in pair_sigma_finite) AE_pair_iff:
3.1131 + "{x\<in>space (M1 \<Otimes>\<^isub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^isub>M M2) \<Longrightarrow>
3.1132 + (AE x in M1. AE y in M2. P x y) \<longleftrightarrow> (AE x in (M1 \<Otimes>\<^isub>M M2). P (fst x) (snd x))"
3.1133 + using AE_pair[of "\<lambda>x. P (fst x) (snd x)"] AE_pair_measure[of "\<lambda>x. P (fst x) (snd x)"] by auto
3.1134 +
3.1135 +lemma AE_distr_iff:
3.1136 + assumes f: "f \<in> measurable M N" and P: "{x \<in> space N. P x} \<in> sets N"
3.1137 + shows "(AE x in distr M N f. P x) \<longleftrightarrow> (AE x in M. P (f x))"
3.1138 +proof (subst (1 2) AE_iff_measurable[OF _ refl])
3.1139 + from P show "{x \<in> space (distr M N f). \<not> P x} \<in> sets (distr M N f)"
3.1140 + by (auto intro!: sets_Collect_neg)
3.1141 + moreover
3.1142 + have "f -` {x \<in> space N. P x} \<inter> space M = {x \<in> space M. P (f x)}"
3.1143 + using f by (auto dest: measurable_space)
3.1144 + then show "{x \<in> space M. \<not> P (f x)} \<in> sets M"
3.1145 + using measurable_sets[OF f P] by (auto intro!: sets_Collect_neg)
3.1146 + moreover have "f -` {x\<in>space N. \<not> P x} \<inter> space M = {x \<in> space M. \<not> P (f x)}"
3.1147 + using f by (auto dest: measurable_space)
3.1148 + ultimately show "(emeasure (distr M N f) {x \<in> space (distr M N f). \<not> P x} = 0) =
3.1149 + (emeasure M {x \<in> space M. \<not> P (f x)} = 0)"
3.1150 + using f by (simp add: emeasure_distr)
3.1151 +qed
3.1152 +
3.1153 +lemma (in pair_sigma_finite) AE_commute:
3.1154 + assumes P: "{x\<in>space (M1 \<Otimes>\<^isub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^isub>M M2)"
3.1155 + shows "(AE x in M1. AE y in M2. P x y) \<longleftrightarrow> (AE y in M2. AE x in M1. P x y)"
3.1156 proof -
3.1157 - interpret Q: pair_sigma_algebra M2 M1 by default
3.1158 - show ?thesis
3.1159 - using pair_sigma_algebra_measurable[of "\<lambda>(x,y). f (y, x)"]
3.1160 - by (auto intro!: pair_sigma_algebra_measurable Q.pair_sigma_algebra_measurable iffI)
3.1161 + interpret Q: pair_sigma_finite M2 M1 ..
3.1162 + have [simp]: "\<And>x. (fst (case x of (x, y) \<Rightarrow> (y, x))) = snd x" "\<And>x. (snd (case x of (x, y) \<Rightarrow> (y, x))) = fst x"
3.1163 + by auto
3.1164 + have "{x \<in> space (M2 \<Otimes>\<^isub>M M1). P (snd x) (fst x)} =
3.1165 + (\<lambda>(x, y). (y, x)) -` {x \<in> space (M1 \<Otimes>\<^isub>M M2). P (fst x) (snd x)} \<inter> space (M2 \<Otimes>\<^isub>M M1)"
3.1166 + by (auto simp: space_pair_measure)
3.1167 + also have "\<dots> \<in> sets (M2 \<Otimes>\<^isub>M M1)"
3.1168 + by (intro sets_pair_swap P)
3.1169 + finally show ?thesis
3.1170 + apply (subst AE_pair_iff[OF P])
3.1171 + apply (subst distr_pair_swap)
3.1172 + apply (subst AE_distr_iff[OF measurable_pair_swap' P])
3.1173 + apply (subst Q.AE_pair_iff)
3.1174 + apply simp_all
3.1175 + done
3.1176 qed
3.1177
3.1178 lemma (in pair_sigma_finite) integrable_product_swap:
3.1179 - assumes "integrable P f"
3.1180 + assumes "integrable (M1 \<Otimes>\<^isub>M M2) f"
3.1181 shows "integrable (M2 \<Otimes>\<^isub>M M1) (\<lambda>(x,y). f (y,x))"
3.1182 proof -
3.1183 interpret Q: pair_sigma_finite M2 M1 by default
3.1184 have *: "(\<lambda>(x,y). f (y,x)) = (\<lambda>x. f (case x of (x,y)\<Rightarrow>(y,x)))" by (auto simp: fun_eq_iff)
3.1185 show ?thesis unfolding *
3.1186 - using assms unfolding integrable_def
3.1187 - apply (subst (1 2) positive_integral_product_swap)
3.1188 - using `integrable P f` unfolding integrable_def
3.1189 - by (auto simp: *[symmetric] Q.measurable_product_swap[symmetric])
3.1190 + by (rule integrable_distr[OF measurable_pair_swap'])
3.1191 + (simp add: distr_pair_swap[symmetric] assms)
3.1192 qed
3.1193
3.1194 lemma (in pair_sigma_finite) integrable_product_swap_iff:
3.1195 - "integrable (M2 \<Otimes>\<^isub>M M1) (\<lambda>(x,y). f (y,x)) \<longleftrightarrow> integrable P f"
3.1196 + "integrable (M2 \<Otimes>\<^isub>M M1) (\<lambda>(x,y). f (y,x)) \<longleftrightarrow> integrable (M1 \<Otimes>\<^isub>M M2) f"
3.1197 proof -
3.1198 interpret Q: pair_sigma_finite M2 M1 by default
3.1199 from Q.integrable_product_swap[of "\<lambda>(x,y). f (y,x)"] integrable_product_swap[of f]
3.1200 @@ -802,27 +668,25 @@
3.1201 qed
3.1202
3.1203 lemma (in pair_sigma_finite) integral_product_swap:
3.1204 - assumes "integrable P f"
3.1205 - shows "(\<integral>(x,y). f (y,x) \<partial>(M2 \<Otimes>\<^isub>M M1)) = integral\<^isup>L P f"
3.1206 + assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1207 + shows "(\<integral>(x,y). f (y,x) \<partial>(M2 \<Otimes>\<^isub>M M1)) = integral\<^isup>L (M1 \<Otimes>\<^isub>M M2) f"
3.1208 proof -
3.1209 - interpret Q: pair_sigma_finite M2 M1 by default
3.1210 have *: "(\<lambda>(x,y). f (y,x)) = (\<lambda>x. f (case x of (x,y)\<Rightarrow>(y,x)))" by (auto simp: fun_eq_iff)
3.1211 - show ?thesis
3.1212 - unfolding lebesgue_integral_def *
3.1213 - apply (subst (1 2) positive_integral_product_swap)
3.1214 - using `integrable P f` unfolding integrable_def
3.1215 - by (auto simp: *[symmetric] Q.measurable_product_swap[symmetric])
3.1216 + show ?thesis unfolding *
3.1217 + by (simp add: integral_distr[symmetric, OF measurable_pair_swap' f] distr_pair_swap[symmetric])
3.1218 qed
3.1219
3.1220 lemma (in pair_sigma_finite) integrable_fst_measurable:
3.1221 - assumes f: "integrable P f"
3.1222 - shows "M1.almost_everywhere (\<lambda>x. integrable M2 (\<lambda> y. f (x, y)))" (is "?AE")
3.1223 - and "(\<integral>x. (\<integral>y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>L P f" (is "?INT")
3.1224 + assumes f: "integrable (M1 \<Otimes>\<^isub>M M2) f"
3.1225 + shows "AE x in M1. integrable M2 (\<lambda> y. f (x, y))" (is "?AE")
3.1226 + and "(\<integral>x. (\<integral>y. f (x, y) \<partial>M2) \<partial>M1) = integral\<^isup>L (M1 \<Otimes>\<^isub>M M2) f" (is "?INT")
3.1227 proof -
3.1228 + have f_borel: "f \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1229 + using f by auto
3.1230 let ?pf = "\<lambda>x. ereal (f x)" and ?nf = "\<lambda>x. ereal (- f x)"
3.1231 have
3.1232 - borel: "?nf \<in> borel_measurable P""?pf \<in> borel_measurable P" and
3.1233 - int: "integral\<^isup>P P ?nf \<noteq> \<infinity>" "integral\<^isup>P P ?pf \<noteq> \<infinity>"
3.1234 + borel: "?nf \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)""?pf \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)" and
3.1235 + int: "integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) ?nf \<noteq> \<infinity>" "integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) ?pf \<noteq> \<infinity>"
3.1236 using assms by auto
3.1237 have "(\<integral>\<^isup>+x. (\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2) \<partial>M1) \<noteq> \<infinity>"
3.1238 "(\<integral>\<^isup>+x. (\<integral>\<^isup>+y. ereal (- f (x, y)) \<partial>M2) \<partial>M1) \<noteq> \<infinity>"
3.1239 @@ -831,69 +695,92 @@
3.1240 with borel[THEN positive_integral_fst_measurable(1)]
3.1241 have AE_pos: "AE x in M1. (\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2) \<noteq> \<infinity>"
3.1242 "AE x in M1. (\<integral>\<^isup>+y. ereal (- f (x, y)) \<partial>M2) \<noteq> \<infinity>"
3.1243 - by (auto intro!: M1.positive_integral_PInf_AE )
3.1244 + by (auto intro!: positive_integral_PInf_AE )
3.1245 then have AE: "AE x in M1. \<bar>\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2\<bar> \<noteq> \<infinity>"
3.1246 "AE x in M1. \<bar>\<integral>\<^isup>+y. ereal (- f (x, y)) \<partial>M2\<bar> \<noteq> \<infinity>"
3.1247 - by (auto simp: M2.positive_integral_positive)
3.1248 + by (auto simp: positive_integral_positive)
3.1249 from AE_pos show ?AE using assms
3.1250 - by (simp add: measurable_pair_image_snd integrable_def)
3.1251 + by (simp add: measurable_Pair2[OF f_borel] integrable_def)
3.1252 { fix f have "(\<integral>\<^isup>+ x. - \<integral>\<^isup>+ y. ereal (f x y) \<partial>M2 \<partial>M1) = (\<integral>\<^isup>+x. 0 \<partial>M1)"
3.1253 - using M2.positive_integral_positive
3.1254 - by (intro M1.positive_integral_cong_pos) (auto simp: ereal_uminus_le_reorder)
3.1255 + using positive_integral_positive
3.1256 + by (intro positive_integral_cong_pos) (auto simp: ereal_uminus_le_reorder)
3.1257 then have "(\<integral>\<^isup>+ x. - \<integral>\<^isup>+ y. ereal (f x y) \<partial>M2 \<partial>M1) = 0" by simp }
3.1258 note this[simp]
3.1259 - { fix f assume borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable P"
3.1260 - and int: "integral\<^isup>P P (\<lambda>x. ereal (f x)) \<noteq> \<infinity>"
3.1261 - and AE: "M1.almost_everywhere (\<lambda>x. (\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2) \<noteq> \<infinity>)"
3.1262 + { fix f assume borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1263 + and int: "integral\<^isup>P (M1 \<Otimes>\<^isub>M M2) (\<lambda>x. ereal (f x)) \<noteq> \<infinity>"
3.1264 + and AE: "AE x in M1. (\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2) \<noteq> \<infinity>"
3.1265 have "integrable M1 (\<lambda>x. real (\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2))" (is "integrable M1 ?f")
3.1266 proof (intro integrable_def[THEN iffD2] conjI)
3.1267 show "?f \<in> borel_measurable M1"
3.1268 - using borel by (auto intro!: M1.borel_measurable_real_of_ereal positive_integral_fst_measurable)
3.1269 + using borel by (auto intro!: positive_integral_fst_measurable)
3.1270 have "(\<integral>\<^isup>+x. ereal (?f x) \<partial>M1) = (\<integral>\<^isup>+x. (\<integral>\<^isup>+y. ereal (f (x, y)) \<partial>M2) \<partial>M1)"
3.1271 - using AE M2.positive_integral_positive
3.1272 - by (auto intro!: M1.positive_integral_cong_AE simp: ereal_real)
3.1273 + using AE positive_integral_positive[of M2]
3.1274 + by (auto intro!: positive_integral_cong_AE simp: ereal_real)
3.1275 then show "(\<integral>\<^isup>+x. ereal (?f x) \<partial>M1) \<noteq> \<infinity>"
3.1276 using positive_integral_fst_measurable[OF borel] int by simp
3.1277 have "(\<integral>\<^isup>+x. ereal (- ?f x) \<partial>M1) = (\<integral>\<^isup>+x. 0 \<partial>M1)"
3.1278 - by (intro M1.positive_integral_cong_pos)
3.1279 - (simp add: M2.positive_integral_positive real_of_ereal_pos)
3.1280 + by (intro positive_integral_cong_pos)
3.1281 + (simp add: positive_integral_positive real_of_ereal_pos)
3.1282 then show "(\<integral>\<^isup>+x. ereal (- ?f x) \<partial>M1) \<noteq> \<infinity>" by simp
3.1283 qed }
3.1284 with this[OF borel(1) int(1) AE_pos(2)] this[OF borel(2) int(2) AE_pos(1)]
3.1285 show ?INT
3.1286 - unfolding lebesgue_integral_def[of P] lebesgue_integral_def[of M2]
3.1287 + unfolding lebesgue_integral_def[of "M1 \<Otimes>\<^isub>M M2"] lebesgue_integral_def[of M2]
3.1288 borel[THEN positive_integral_fst_measurable(2), symmetric]
3.1289 - using AE[THEN M1.integral_real]
3.1290 + using AE[THEN integral_real]
3.1291 by simp
3.1292 qed
3.1293
3.1294 lemma (in pair_sigma_finite) integrable_snd_measurable:
3.1295 - assumes f: "integrable P f"
3.1296 - shows "M2.almost_everywhere (\<lambda>y. integrable M1 (\<lambda>x. f (x, y)))" (is "?AE")
3.1297 - and "(\<integral>y. (\<integral>x. f (x, y) \<partial>M1) \<partial>M2) = integral\<^isup>L P f" (is "?INT")
3.1298 + assumes f: "integrable (M1 \<Otimes>\<^isub>M M2) f"
3.1299 + shows "AE y in M2. integrable M1 (\<lambda>x. f (x, y))" (is "?AE")
3.1300 + and "(\<integral>y. (\<integral>x. f (x, y) \<partial>M1) \<partial>M2) = integral\<^isup>L (M1 \<Otimes>\<^isub>M M2) f" (is "?INT")
3.1301 proof -
3.1302 interpret Q: pair_sigma_finite M2 M1 by default
3.1303 - have Q_int: "integrable Q.P (\<lambda>(x, y). f (y, x))"
3.1304 + have Q_int: "integrable (M2 \<Otimes>\<^isub>M M1) (\<lambda>(x, y). f (y, x))"
3.1305 using f unfolding integrable_product_swap_iff .
3.1306 show ?INT
3.1307 using Q.integrable_fst_measurable(2)[OF Q_int]
3.1308 - using integral_product_swap[OF f] by simp
3.1309 + using integral_product_swap[of f] f by auto
3.1310 show ?AE
3.1311 using Q.integrable_fst_measurable(1)[OF Q_int]
3.1312 by simp
3.1313 qed
3.1314
3.1315 +lemma (in pair_sigma_finite) positive_integral_fst_measurable':
3.1316 + assumes f: "(\<lambda>x. f (fst x) (snd x)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1317 + shows "(\<lambda>x. \<integral>\<^isup>+ y. f x y \<partial>M2) \<in> borel_measurable M1"
3.1318 + using positive_integral_fst_measurable(1)[OF f] by simp
3.1319 +
3.1320 +lemma (in pair_sigma_finite) integral_fst_measurable:
3.1321 + "(\<lambda>x. f (fst x) (snd x)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2) \<Longrightarrow> (\<lambda>x. \<integral> y. f x y \<partial>M2) \<in> borel_measurable M1"
3.1322 + by (auto simp: lebesgue_integral_def intro!: borel_measurable_diff positive_integral_fst_measurable')
3.1323 +
3.1324 +lemma (in pair_sigma_finite) positive_integral_snd_measurable':
3.1325 + assumes f: "(\<lambda>x. f (fst x) (snd x)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1326 + shows "(\<lambda>y. \<integral>\<^isup>+ x. f x y \<partial>M1) \<in> borel_measurable M2"
3.1327 +proof -
3.1328 + interpret Q: pair_sigma_finite M2 M1 ..
3.1329 + show ?thesis
3.1330 + using measurable_pair_swap[OF f]
3.1331 + by (intro Q.positive_integral_fst_measurable') (simp add: split_beta')
3.1332 +qed
3.1333 +
3.1334 +lemma (in pair_sigma_finite) integral_snd_measurable:
3.1335 + "(\<lambda>x. f (fst x) (snd x)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2) \<Longrightarrow> (\<lambda>y. \<integral> x. f x y \<partial>M1) \<in> borel_measurable M2"
3.1336 + by (auto simp: lebesgue_integral_def intro!: borel_measurable_diff positive_integral_snd_measurable')
3.1337 +
3.1338 lemma (in pair_sigma_finite) Fubini_integral:
3.1339 - assumes f: "integrable P f"
3.1340 + assumes f: "integrable (M1 \<Otimes>\<^isub>M M2) f"
3.1341 shows "(\<integral>y. (\<integral>x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>x. (\<integral>y. f (x, y) \<partial>M2) \<partial>M1)"
3.1342 unfolding integrable_snd_measurable[OF assms]
3.1343 unfolding integrable_fst_measurable[OF assms] ..
3.1344
3.1345 -section "Products on finite spaces"
3.1346 +section {* Products on counting spaces, densities and distributions *}
3.1347
3.1348 lemma sigma_sets_pair_measure_generator_finite:
3.1349 assumes "finite A" and "finite B"
3.1350 - shows "sigma_sets (A \<times> B) { a \<times> b | a b. a \<in> Pow A \<and> b \<in> Pow B} = Pow (A \<times> B)"
3.1351 + shows "sigma_sets (A \<times> B) { a \<times> b | a b. a \<subseteq> A \<and> b \<subseteq> B} = Pow (A \<times> B)"
3.1352 (is "sigma_sets ?prod ?sets = _")
3.1353 proof safe
3.1354 have fin: "finite (A \<times> B)" using assms by (rule finite_cartesian_product)
3.1355 @@ -904,8 +791,7 @@
3.1356 case empty show ?case by (rule sigma_sets.Empty)
3.1357 next
3.1358 case (insert a x)
3.1359 - hence "{a} \<in> sigma_sets ?prod ?sets"
3.1360 - by (auto simp: pair_measure_generator_def intro!: sigma_sets.Basic)
3.1361 + hence "{a} \<in> sigma_sets ?prod ?sets" by auto
3.1362 moreover have "x \<in> sigma_sets ?prod ?sets" using insert by auto
3.1363 ultimately show ?case unfolding insert_is_Un[of a x] by (rule sigma_sets_Un)
3.1364 qed
3.1365 @@ -916,48 +802,142 @@
3.1366 show "a \<in> A" and "b \<in> B" by auto
3.1367 qed
3.1368
3.1369 -locale pair_finite_sigma_algebra = pair_sigma_algebra M1 M2 + M1: finite_sigma_algebra M1 + M2: finite_sigma_algebra M2 for M1 M2
3.1370 -
3.1371 -lemma (in pair_finite_sigma_algebra) finite_pair_sigma_algebra:
3.1372 - shows "P = \<lparr> space = space M1 \<times> space M2, sets = Pow (space M1 \<times> space M2), \<dots> = algebra.more P \<rparr>"
3.1373 -proof -
3.1374 - show ?thesis
3.1375 - using sigma_sets_pair_measure_generator_finite[OF M1.finite_space M2.finite_space]
3.1376 - by (intro algebra.equality) (simp_all add: pair_measure_def pair_measure_generator_def sigma_def)
3.1377 +lemma pair_measure_count_space:
3.1378 + assumes A: "finite A" and B: "finite B"
3.1379 + shows "count_space A \<Otimes>\<^isub>M count_space B = count_space (A \<times> B)" (is "?P = ?C")
3.1380 +proof (rule measure_eqI)
3.1381 + interpret A: finite_measure "count_space A" by (rule finite_measure_count_space) fact
3.1382 + interpret B: finite_measure "count_space B" by (rule finite_measure_count_space) fact
3.1383 + interpret P: pair_sigma_finite "count_space A" "count_space B" by default
3.1384 + show eq: "sets ?P = sets ?C"
3.1385 + by (simp add: sets_pair_measure sigma_sets_pair_measure_generator_finite A B)
3.1386 + fix X assume X: "X \<in> sets ?P"
3.1387 + with eq have X_subset: "X \<subseteq> A \<times> B" by simp
3.1388 + with A B have fin_Pair: "\<And>x. finite (Pair x -` X)"
3.1389 + by (intro finite_subset[OF _ B]) auto
3.1390 + have fin_X: "finite X" using X_subset by (rule finite_subset) (auto simp: A B)
3.1391 + show "emeasure ?P X = emeasure ?C X"
3.1392 + apply (subst P.emeasure_pair_measure_alt[OF X])
3.1393 + apply (subst emeasure_count_space)
3.1394 + using X_subset apply auto []
3.1395 + apply (simp add: fin_Pair emeasure_count_space X_subset fin_X)
3.1396 + apply (subst positive_integral_count_space)
3.1397 + using A apply simp
3.1398 + apply (simp del: real_of_nat_setsum add: real_of_nat_setsum[symmetric])
3.1399 + apply (subst card_gt_0_iff)
3.1400 + apply (simp add: fin_Pair)
3.1401 + apply (subst card_SigmaI[symmetric])
3.1402 + using A apply simp
3.1403 + using fin_Pair apply simp
3.1404 + using X_subset apply (auto intro!: arg_cong[where f=card])
3.1405 + done
3.1406 qed
3.1407
3.1408 -sublocale pair_finite_sigma_algebra \<subseteq> finite_sigma_algebra P
3.1409 -proof
3.1410 - show "finite (space P)"
3.1411 - using M1.finite_space M2.finite_space
3.1412 - by (subst finite_pair_sigma_algebra) simp
3.1413 - show "sets P = Pow (space P)"
3.1414 - by (subst (1 2) finite_pair_sigma_algebra) simp
3.1415 +lemma pair_measure_density:
3.1416 + assumes f: "f \<in> borel_measurable M1" "AE x in M1. 0 \<le> f x"
3.1417 + assumes g: "g \<in> borel_measurable M2" "AE x in M2. 0 \<le> g x"
3.1418 + assumes "sigma_finite_measure M1" "sigma_finite_measure M2"
3.1419 + assumes "sigma_finite_measure (density M1 f)" "sigma_finite_measure (density M2 g)"
3.1420 + shows "density M1 f \<Otimes>\<^isub>M density M2 g = density (M1 \<Otimes>\<^isub>M M2) (\<lambda>(x,y). f x * g y)" (is "?L = ?R")
3.1421 +proof (rule measure_eqI)
3.1422 + interpret M1: sigma_finite_measure M1 by fact
3.1423 + interpret M2: sigma_finite_measure M2 by fact
3.1424 + interpret D1: sigma_finite_measure "density M1 f" by fact
3.1425 + interpret D2: sigma_finite_measure "density M2 g" by fact
3.1426 + interpret L: pair_sigma_finite "density M1 f" "density M2 g" ..
3.1427 + interpret R: pair_sigma_finite M1 M2 ..
3.1428 +
3.1429 + fix A assume A: "A \<in> sets ?L"
3.1430 + then have indicator_eq: "\<And>x y. indicator A (x, y) = indicator (Pair x -` A) y"
3.1431 + and Pair_A: "\<And>x. Pair x -` A \<in> sets M2"
3.1432 + by (auto simp: indicator_def sets_Pair1)
3.1433 + have f_fst: "(\<lambda>p. f (fst p)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1434 + using measurable_comp[OF measurable_fst f(1)] by (simp add: comp_def)
3.1435 + have g_snd: "(\<lambda>p. g (snd p)) \<in> borel_measurable (M1 \<Otimes>\<^isub>M M2)"
3.1436 + using measurable_comp[OF measurable_snd g(1)] by (simp add: comp_def)
3.1437 + have "(\<lambda>x. \<integral>\<^isup>+ y. g (snd (x, y)) * indicator A (x, y) \<partial>M2) \<in> borel_measurable M1"
3.1438 + using g_snd Pair_A A by (intro R.positive_integral_fst_measurable) auto
3.1439 + then have int_g: "(\<lambda>x. \<integral>\<^isup>+ y. g y * indicator A (x, y) \<partial>M2) \<in> borel_measurable M1"
3.1440 + by simp
3.1441 +
3.1442 + show "emeasure ?L A = emeasure ?R A"
3.1443 + apply (subst L.emeasure_pair_measure[OF A])
3.1444 + apply (subst emeasure_density)
3.1445 + using f_fst g_snd apply (simp add: split_beta')
3.1446 + using A apply simp
3.1447 + apply (subst positive_integral_density[OF g])
3.1448 + apply (simp add: indicator_eq Pair_A)
3.1449 + apply (subst positive_integral_density[OF f])
3.1450 + apply (rule int_g)
3.1451 + apply (subst R.positive_integral_fst_measurable(2)[symmetric])
3.1452 + using f g A Pair_A f_fst g_snd
3.1453 + apply (auto intro!: positive_integral_cong_AE R.measurable_emeasure_Pair1
3.1454 + simp: positive_integral_cmult indicator_eq split_beta')
3.1455 + apply (intro AE_I2 impI)
3.1456 + apply (subst mult_assoc)
3.1457 + apply (subst positive_integral_cmult)
3.1458 + apply auto
3.1459 + done
3.1460 +qed simp
3.1461 +
3.1462 +lemma sigma_finite_measure_distr:
3.1463 + assumes "sigma_finite_measure (distr M N f)" and f: "f \<in> measurable M N"
3.1464 + shows "sigma_finite_measure M"
3.1465 +proof -
3.1466 + interpret sigma_finite_measure "distr M N f" by fact
3.1467 + from sigma_finite_disjoint guess A . note A = this
3.1468 + show ?thesis
3.1469 + proof (unfold_locales, intro conjI exI allI)
3.1470 + show "range (\<lambda>i. f -` A i \<inter> space M) \<subseteq> sets M"
3.1471 + using A f by (auto intro!: measurable_sets)
3.1472 + show "(\<Union>i. f -` A i \<inter> space M) = space M"
3.1473 + using A(1) A(2)[symmetric] f by (auto simp: measurable_def Pi_def)
3.1474 + fix i show "emeasure M (f -` A i \<inter> space M) \<noteq> \<infinity>"
3.1475 + using f A(1,2) A(3)[of i] by (simp add: emeasure_distr subset_eq)
3.1476 + qed
3.1477 qed
3.1478
3.1479 -locale pair_finite_space = pair_sigma_finite M1 M2 + pair_finite_sigma_algebra M1 M2 +
3.1480 - M1: finite_measure_space M1 + M2: finite_measure_space M2 for M1 M2
3.1481 +lemma measurable_cong':
3.1482 + assumes sets: "sets M = sets M'" "sets N = sets N'"
3.1483 + shows "measurable M N = measurable M' N'"
3.1484 + using sets[THEN sets_eq_imp_space_eq] sets by (simp add: measurable_def)
3.1485
3.1486 -lemma (in pair_finite_space) pair_measure_Pair[simp]:
3.1487 - assumes "a \<in> space M1" "b \<in> space M2"
3.1488 - shows "\<mu> {(a, b)} = M1.\<mu> {a} * M2.\<mu> {b}"
3.1489 -proof -
3.1490 - have "\<mu> ({a}\<times>{b}) = M1.\<mu> {a} * M2.\<mu> {b}"
3.1491 - using M1.sets_eq_Pow M2.sets_eq_Pow assms
3.1492 - by (subst pair_measure_times) auto
3.1493 - then show ?thesis by simp
3.1494 -qed
3.1495 -
3.1496 -lemma (in pair_finite_space) pair_measure_singleton[simp]:
3.1497 - assumes "x \<in> space M1 \<times> space M2"
3.1498 - shows "\<mu> {x} = M1.\<mu> {fst x} * M2.\<mu> {snd x}"
3.1499 - using pair_measure_Pair assms by (cases x) auto
3.1500 -
3.1501 -sublocale pair_finite_space \<subseteq> finite_measure_space P
3.1502 -proof unfold_locales
3.1503 - show "measure P (space P) \<noteq> \<infinity>"
3.1504 - by (subst (2) finite_pair_sigma_algebra)
3.1505 - (simp add: pair_measure_times)
3.1506 +lemma pair_measure_distr:
3.1507 + assumes f: "f \<in> measurable M S" and g: "g \<in> measurable N T"
3.1508 + assumes "sigma_finite_measure (distr M S f)" "sigma_finite_measure (distr N T g)"
3.1509 + shows "distr M S f \<Otimes>\<^isub>M distr N T g = distr (M \<Otimes>\<^isub>M N) (S \<Otimes>\<^isub>M T) (\<lambda>(x, y). (f x, g y))" (is "?P = ?D")
3.1510 +proof (rule measure_eqI)
3.1511 + show "sets ?P = sets ?D"
3.1512 + by simp
3.1513 + interpret S: sigma_finite_measure "distr M S f" by fact
3.1514 + interpret T: sigma_finite_measure "distr N T g" by fact
3.1515 + interpret ST: pair_sigma_finite "distr M S f" "distr N T g" ..
3.1516 + interpret M: sigma_finite_measure M by (rule sigma_finite_measure_distr) fact+
3.1517 + interpret N: sigma_finite_measure N by (rule sigma_finite_measure_distr) fact+
3.1518 + interpret MN: pair_sigma_finite M N ..
3.1519 + interpret SN: pair_sigma_finite "distr M S f" N ..
3.1520 + have [simp]:
3.1521 + "\<And>f g. fst \<circ> (\<lambda>(x, y). (f x, g y)) = f \<circ> fst" "\<And>f g. snd \<circ> (\<lambda>(x, y). (f x, g y)) = g \<circ> snd"
3.1522 + by auto
3.1523 + then have fg: "(\<lambda>(x, y). (f x, g y)) \<in> measurable (M \<Otimes>\<^isub>M N) (S \<Otimes>\<^isub>M T)"
3.1524 + using measurable_comp[OF measurable_fst f] measurable_comp[OF measurable_snd g]
3.1525 + by (auto simp: measurable_pair_iff)
3.1526 + fix A assume A: "A \<in> sets ?P"
3.1527 + then have "emeasure ?P A = (\<integral>\<^isup>+x. emeasure (distr N T g) (Pair x -` A) \<partial>distr M S f)"
3.1528 + by (rule ST.emeasure_pair_measure_alt)
3.1529 + also have "\<dots> = (\<integral>\<^isup>+x. emeasure N (g -` (Pair x -` A) \<inter> space N) \<partial>distr M S f)"
3.1530 + using g A by (simp add: sets_Pair1 emeasure_distr)
3.1531 + also have "\<dots> = (\<integral>\<^isup>+x. emeasure N (g -` (Pair (f x) -` A) \<inter> space N) \<partial>M)"
3.1532 + using f g A ST.measurable_emeasure_Pair1[OF A]
3.1533 + by (intro positive_integral_distr) (auto simp add: sets_Pair1 emeasure_distr)
3.1534 + also have "\<dots> = (\<integral>\<^isup>+x. emeasure N (Pair x -` ((\<lambda>(x, y). (f x, g y)) -` A \<inter> space (M \<Otimes>\<^isub>M N))) \<partial>M)"
3.1535 + by (intro positive_integral_cong arg_cong2[where f=emeasure]) (auto simp: space_pair_measure)
3.1536 + also have "\<dots> = emeasure (M \<Otimes>\<^isub>M N) ((\<lambda>(x, y). (f x, g y)) -` A \<inter> space (M \<Otimes>\<^isub>M N))"
3.1537 + using fg by (intro MN.emeasure_pair_measure_alt[symmetric] measurable_sets[OF _ A])
3.1538 + (auto cong: measurable_cong')
3.1539 + also have "\<dots> = emeasure ?D A"
3.1540 + using fg A by (subst emeasure_distr) auto
3.1541 + finally show "emeasure ?P A = emeasure ?D A" .
3.1542 qed
3.1543
3.1544 end
3.1545 \ No newline at end of file
4.1 --- a/src/HOL/Probability/Borel_Space.thy Mon Apr 23 12:23:23 2012 +0100
4.2 +++ b/src/HOL/Probability/Borel_Space.thy Mon Apr 23 12:14:35 2012 +0200
4.3 @@ -11,16 +11,14 @@
4.4
4.5 section "Generic Borel spaces"
4.6
4.7 -definition "borel = sigma \<lparr> space = UNIV::'a::topological_space set, sets = {S. open S}\<rparr>"
4.8 +definition borel :: "'a::topological_space measure" where
4.9 + "borel = sigma UNIV {S. open S}"
4.10 +
4.11 abbreviation "borel_measurable M \<equiv> measurable M borel"
4.12
4.13 -interpretation borel: sigma_algebra borel
4.14 - by (auto simp: borel_def intro!: sigma_algebra_sigma)
4.15 -
4.16 lemma in_borel_measurable:
4.17 "f \<in> borel_measurable M \<longleftrightarrow>
4.18 - (\<forall>S \<in> sets (sigma \<lparr> space = UNIV, sets = {S. open S}\<rparr>).
4.19 - f -` S \<inter> space M \<in> sets M)"
4.20 + (\<forall>S \<in> sigma_sets UNIV {S. open S}. f -` S \<inter> space M \<in> sets M)"
4.21 by (auto simp add: measurable_def borel_def)
4.22
4.23 lemma in_borel_measurable_borel:
4.24 @@ -36,7 +34,7 @@
4.25 assumes "open A" shows "A \<in> sets borel"
4.26 proof -
4.27 have "A \<in> {S. open S}" unfolding mem_Collect_eq using assms .
4.28 - thus ?thesis unfolding borel_def sigma_def by (auto intro!: sigma_sets.Basic)
4.29 + thus ?thesis unfolding borel_def by auto
4.30 qed
4.31
4.32 lemma borel_closed[simp]:
4.33 @@ -48,9 +46,9 @@
4.34 qed
4.35
4.36 lemma borel_comp[intro,simp]: "A \<in> sets borel \<Longrightarrow> - A \<in> sets borel"
4.37 - unfolding Compl_eq_Diff_UNIV by (intro borel.Diff) auto
4.38 + unfolding Compl_eq_Diff_UNIV by (intro Diff) auto
4.39
4.40 -lemma (in sigma_algebra) borel_measurable_vimage:
4.41 +lemma borel_measurable_vimage:
4.42 fixes f :: "'a \<Rightarrow> 'x::t2_space"
4.43 assumes borel: "f \<in> borel_measurable M"
4.44 shows "f -` {x} \<inter> space M \<in> sets M"
4.45 @@ -65,12 +63,12 @@
4.46 thus ?thesis by auto
4.47 qed
4.48
4.49 -lemma (in sigma_algebra) borel_measurableI:
4.50 +lemma borel_measurableI:
4.51 fixes f :: "'a \<Rightarrow> 'x\<Colon>topological_space"
4.52 assumes "\<And>S. open S \<Longrightarrow> f -` S \<inter> space M \<in> sets M"
4.53 shows "f \<in> borel_measurable M"
4.54 unfolding borel_def
4.55 -proof (rule measurable_sigma, simp_all)
4.56 +proof (rule measurable_measure_of, simp_all)
4.57 fix S :: "'x set" assume "open S" thus "f -` S \<inter> space M \<in> sets M"
4.58 using assms[of S] by simp
4.59 qed
4.60 @@ -78,22 +76,22 @@
4.61 lemma borel_singleton[simp, intro]:
4.62 fixes x :: "'a::t1_space"
4.63 shows "A \<in> sets borel \<Longrightarrow> insert x A \<in> sets borel"
4.64 - proof (rule borel.insert_in_sets)
4.65 + proof (rule insert_in_sets)
4.66 show "{x} \<in> sets borel"
4.67 using closed_singleton[of x] by (rule borel_closed)
4.68 qed simp
4.69
4.70 -lemma (in sigma_algebra) borel_measurable_const[simp, intro]:
4.71 +lemma borel_measurable_const[simp, intro]:
4.72 "(\<lambda>x. c) \<in> borel_measurable M"
4.73 - by (auto intro!: measurable_const)
4.74 + by auto
4.75
4.76 -lemma (in sigma_algebra) borel_measurable_indicator[simp, intro!]:
4.77 +lemma borel_measurable_indicator[simp, intro!]:
4.78 assumes A: "A \<in> sets M"
4.79 shows "indicator A \<in> borel_measurable M"
4.80 unfolding indicator_def [abs_def] using A
4.81 - by (auto intro!: measurable_If_set borel_measurable_const)
4.82 + by (auto intro!: measurable_If_set)
4.83
4.84 -lemma (in sigma_algebra) borel_measurable_indicator_iff:
4.85 +lemma borel_measurable_indicator_iff:
4.86 "(indicator A :: 'a \<Rightarrow> 'x::{t1_space, zero_neq_one}) \<in> borel_measurable M \<longleftrightarrow> A \<inter> space M \<in> sets M"
4.87 (is "?I \<in> borel_measurable M \<longleftrightarrow> _")
4.88 proof
4.89 @@ -111,49 +109,7 @@
4.90 ultimately show "?I \<in> borel_measurable M" by auto
4.91 qed
4.92
4.93 -lemma (in sigma_algebra) borel_measurable_restricted:
4.94 - fixes f :: "'a \<Rightarrow> ereal" assumes "A \<in> sets M"
4.95 - shows "f \<in> borel_measurable (restricted_space A) \<longleftrightarrow>
4.96 - (\<lambda>x. f x * indicator A x) \<in> borel_measurable M"
4.97 - (is "f \<in> borel_measurable ?R \<longleftrightarrow> ?f \<in> borel_measurable M")
4.98 -proof -
4.99 - interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \<in> sets M`])
4.100 - have *: "f \<in> borel_measurable ?R \<longleftrightarrow> ?f \<in> borel_measurable ?R"
4.101 - by (auto intro!: measurable_cong)
4.102 - show ?thesis unfolding *
4.103 - unfolding in_borel_measurable_borel
4.104 - proof (simp, safe)
4.105 - fix S :: "ereal set" assume "S \<in> sets borel"
4.106 - "\<forall>S\<in>sets borel. ?f -` S \<inter> A \<in> op \<inter> A ` sets M"
4.107 - then have "?f -` S \<inter> A \<in> op \<inter> A ` sets M" by auto
4.108 - then have f: "?f -` S \<inter> A \<in> sets M"
4.109 - using `A \<in> sets M` sets_into_space by fastforce
4.110 - show "?f -` S \<inter> space M \<in> sets M"
4.111 - proof cases
4.112 - assume "0 \<in> S"
4.113 - then have "?f -` S \<inter> space M = ?f -` S \<inter> A \<union> (space M - A)"
4.114 - using `A \<in> sets M` sets_into_space by auto
4.115 - then show ?thesis using f `A \<in> sets M` by (auto intro!: Un Diff)
4.116 - next
4.117 - assume "0 \<notin> S"
4.118 - then have "?f -` S \<inter> space M = ?f -` S \<inter> A"
4.119 - using `A \<in> sets M` sets_into_space
4.120 - by (auto simp: indicator_def split: split_if_asm)
4.121 - then show ?thesis using f by auto
4.122 - qed
4.123 - next
4.124 - fix S :: "ereal set" assume "S \<in> sets borel"
4.125 - "\<forall>S\<in>sets borel. ?f -` S \<inter> space M \<in> sets M"
4.126 - then have f: "?f -` S \<inter> space M \<in> sets M" by auto
4.127 - then show "?f -` S \<inter> A \<in> op \<inter> A ` sets M"
4.128 - using `A \<in> sets M` sets_into_space
4.129 - apply (simp add: image_iff)
4.130 - apply (rule bexI[OF _ f])
4.131 - by auto
4.132 - qed
4.133 -qed
4.134 -
4.135 -lemma (in sigma_algebra) borel_measurable_subalgebra:
4.136 +lemma borel_measurable_subalgebra:
4.137 assumes "sets N \<subseteq> sets M" "space N = space M" "f \<in> borel_measurable N"
4.138 shows "f \<in> borel_measurable M"
4.139 using assms unfolding measurable_def by auto
4.140 @@ -220,7 +176,7 @@
4.141 shows "{x::'a::euclidean_space. x $$ i \<le> a} \<in> sets borel"
4.142 by (auto intro!: borel_closed closed_halfspace_component_le)
4.143
4.144 -lemma (in sigma_algebra) borel_measurable_less[simp, intro]:
4.145 +lemma borel_measurable_less[simp, intro]:
4.146 fixes f :: "'a \<Rightarrow> real"
4.147 assumes f: "f \<in> borel_measurable M"
4.148 assumes g: "g \<in> borel_measurable M"
4.149 @@ -233,7 +189,7 @@
4.150 by simp (blast intro: measurable_sets)
4.151 qed
4.152
4.153 -lemma (in sigma_algebra) borel_measurable_le[simp, intro]:
4.154 +lemma borel_measurable_le[simp, intro]:
4.155 fixes f :: "'a \<Rightarrow> real"
4.156 assumes f: "f \<in> borel_measurable M"
4.157 assumes g: "g \<in> borel_measurable M"
4.158 @@ -245,7 +201,7 @@
4.159 by simp blast
4.160 qed
4.161
4.162 -lemma (in sigma_algebra) borel_measurable_eq[simp, intro]:
4.163 +lemma borel_measurable_eq[simp, intro]:
4.164 fixes f :: "'a \<Rightarrow> real"
4.165 assumes f: "f \<in> borel_measurable M"
4.166 assumes g: "g \<in> borel_measurable M"
4.167 @@ -257,7 +213,7 @@
4.168 thus ?thesis using f g by auto
4.169 qed
4.170
4.171 -lemma (in sigma_algebra) borel_measurable_neq[simp, intro]:
4.172 +lemma borel_measurable_neq[simp, intro]:
4.173 fixes f :: "'a \<Rightarrow> real"
4.174 assumes f: "f \<in> borel_measurable M"
4.175 assumes g: "g \<in> borel_measurable M"
4.176 @@ -351,23 +307,70 @@
4.177 thus "x \<in> UNION ?idx ?box" using ab e p q exI[of _ p] exI[of _ q] by auto
4.178 qed auto
4.179
4.180 -lemma halfspace_span_open:
4.181 - "sigma_sets UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a}))
4.182 - \<subseteq> sets borel"
4.183 - by (auto intro!: borel.sigma_sets_subset[simplified] borel_open
4.184 - open_halfspace_component_lt)
4.185 +lemma borel_sigma_sets_subset:
4.186 + "A \<subseteq> sets borel \<Longrightarrow> sigma_sets UNIV A \<subseteq> sets borel"
4.187 + using sigma_sets_subset[of A borel] by simp
4.188
4.189 -lemma halfspace_lt_in_halfspace:
4.190 - "{x\<Colon>'a. x $$ i < a} \<in> sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})\<rparr>)"
4.191 - by (auto intro!: sigma_sets.Basic simp: sets_sigma)
4.192 +lemma borel_eq_sigmaI1:
4.193 + fixes F :: "'i \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set"
4.194 + assumes borel_eq: "borel = sigma UNIV X"
4.195 + assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV (range F))"
4.196 + assumes F: "\<And>i. F i \<in> sets borel"
4.197 + shows "borel = sigma UNIV (range F)"
4.198 + unfolding borel_def
4.199 +proof (intro sigma_eqI antisym)
4.200 + have borel_rev_eq: "sigma_sets UNIV {S::'a set. open S} = sets borel"
4.201 + unfolding borel_def by simp
4.202 + also have "\<dots> = sigma_sets UNIV X"
4.203 + unfolding borel_eq by simp
4.204 + also have "\<dots> \<subseteq> sigma_sets UNIV (range F)"
4.205 + using X by (intro sigma_algebra.sigma_sets_subset[OF sigma_algebra_sigma_sets]) auto
4.206 + finally show "sigma_sets UNIV {S. open S} \<subseteq> sigma_sets UNIV (range F)" .
4.207 + show "sigma_sets UNIV (range F) \<subseteq> sigma_sets UNIV {S. open S}"
4.208 + unfolding borel_rev_eq using F by (intro borel_sigma_sets_subset) auto
4.209 +qed auto
4.210 +
4.211 +lemma borel_eq_sigmaI2:
4.212 + fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set"
4.213 + and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set"
4.214 + assumes borel_eq: "borel = sigma UNIV (range (\<lambda>(i, j). G i j))"
4.215 + assumes X: "\<And>i j. G i j \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))"
4.216 + assumes F: "\<And>i j. F i j \<in> sets borel"
4.217 + shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))"
4.218 + using assms by (intro borel_eq_sigmaI1[where X="range (\<lambda>(i, j). G i j)" and F="(\<lambda>(i, j). F i j)"]) auto
4.219 +
4.220 +lemma borel_eq_sigmaI3:
4.221 + fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set"
4.222 + assumes borel_eq: "borel = sigma UNIV X"
4.223 + assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))"
4.224 + assumes F: "\<And>i j. F i j \<in> sets borel"
4.225 + shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))"
4.226 + using assms by (intro borel_eq_sigmaI1[where X=X and F="(\<lambda>(i, j). F i j)"]) auto
4.227 +
4.228 +lemma borel_eq_sigmaI4:
4.229 + fixes F :: "'i \<Rightarrow> 'a::topological_space set"
4.230 + and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set"
4.231 + assumes borel_eq: "borel = sigma UNIV (range (\<lambda>(i, j). G i j))"
4.232 + assumes X: "\<And>i j. G i j \<in> sets (sigma UNIV (range F))"
4.233 + assumes F: "\<And>i. F i \<in> sets borel"
4.234 + shows "borel = sigma UNIV (range F)"
4.235 + using assms by (intro borel_eq_sigmaI1[where X="range (\<lambda>(i, j). G i j)" and F=F]) auto
4.236 +
4.237 +lemma borel_eq_sigmaI5:
4.238 + fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and G :: "'l \<Rightarrow> 'a::topological_space set"
4.239 + assumes borel_eq: "borel = sigma UNIV (range G)"
4.240 + assumes X: "\<And>i. G i \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))"
4.241 + assumes F: "\<And>i j. F i j \<in> sets borel"
4.242 + shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))"
4.243 + using assms by (intro borel_eq_sigmaI1[where X="range G" and F="(\<lambda>(i, j). F i j)"]) auto
4.244
4.245 lemma halfspace_gt_in_halfspace:
4.246 - "{x\<Colon>'a. a < x $$ i} \<in> sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})\<rparr>)"
4.247 - (is "?set \<in> sets ?SIGMA")
4.248 + "{x\<Colon>'a. a < x $$ i} \<in> sigma_sets UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a}))"
4.249 + (is "?set \<in> ?SIGMA")
4.250 proof -
4.251 - interpret sigma_algebra "?SIGMA"
4.252 - by (intro sigma_algebra_sigma_sets) (simp_all add: sets_sigma)
4.253 - have *: "?set = (\<Union>n. space ?SIGMA - {x\<Colon>'a. x $$ i < a + 1 / real (Suc n)})"
4.254 + interpret sigma_algebra UNIV ?SIGMA
4.255 + by (intro sigma_algebra_sigma_sets) simp_all
4.256 + have *: "?set = (\<Union>n. UNIV - {x\<Colon>'a. x $$ i < a + 1 / real (Suc n)})"
4.257 proof (safe, simp_all add: not_less)
4.258 fix x assume "a < x $$ i"
4.259 with reals_Archimedean[of "x $$ i - a"]
4.260 @@ -381,100 +384,78 @@
4.261 also assume "\<dots> \<le> x"
4.262 finally show "a < x" .
4.263 qed
4.264 - show "?set \<in> sets ?SIGMA" unfolding *
4.265 - by (safe intro!: countable_UN Diff halfspace_lt_in_halfspace)
4.266 + show "?set \<in> ?SIGMA" unfolding *
4.267 + by (auto intro!: Diff)
4.268 qed
4.269
4.270 -lemma open_span_halfspace:
4.271 - "sets borel \<subseteq> sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x $$ i < a})\<rparr>)"
4.272 - (is "_ \<subseteq> sets ?SIGMA")
4.273 -proof -
4.274 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) simp
4.275 - then interpret sigma_algebra ?SIGMA .
4.276 - { fix S :: "'a set" assume "S \<in> {S. open S}"
4.277 - then have "open S" unfolding mem_Collect_eq .
4.278 - from open_UNION[OF this]
4.279 - obtain I where *: "S =
4.280 - (\<Union>(a, b)\<in>I.
4.281 - (\<Inter> i<DIM('a). {x. (Chi (real_of_rat \<circ> op ! a)::'a) $$ i < x $$ i}) \<inter>
4.282 - (\<Inter> i<DIM('a). {x. x $$ i < (Chi (real_of_rat \<circ> op ! b)::'a) $$ i}))"
4.283 - unfolding greaterThanLessThan_def
4.284 - unfolding eucl_greaterThan_eq_halfspaces[where 'a='a]
4.285 - unfolding eucl_lessThan_eq_halfspaces[where 'a='a]
4.286 - by blast
4.287 - have "S \<in> sets ?SIGMA"
4.288 - unfolding *
4.289 - by (auto intro!: countable_UN Int countable_INT halfspace_lt_in_halfspace halfspace_gt_in_halfspace) }
4.290 - then show ?thesis unfolding borel_def
4.291 - by (intro sets_sigma_subset) auto
4.292 -qed
4.293 +lemma borel_eq_halfspace_less:
4.294 + "borel = sigma UNIV (range (\<lambda>(a, i). {x::'a::ordered_euclidean_space. x $$ i < a}))"
4.295 + (is "_ = ?SIGMA")
4.296 +proof (rule borel_eq_sigmaI3[OF borel_def])
4.297 + fix S :: "'a set" assume "S \<in> {S. open S}"
4.298 + then have "open S" by simp
4.299 + from open_UNION[OF this]
4.300 + obtain I where *: "S =
4.301 + (\<Union>(a, b)\<in>I.
4.302 + (\<Inter> i<DIM('a). {x. (Chi (real_of_rat \<circ> op ! a)::'a) $$ i < x $$ i}) \<inter>
4.303 + (\<Inter> i<DIM('a). {x. x $$ i < (Chi (real_of_rat \<circ> op ! b)::'a) $$ i}))"
4.304 + unfolding greaterThanLessThan_def
4.305 + unfolding eucl_greaterThan_eq_halfspaces[where 'a='a]
4.306 + unfolding eucl_lessThan_eq_halfspaces[where 'a='a]
4.307 + by blast
4.308 + show "S \<in> ?SIGMA"
4.309 + unfolding *
4.310 + by (safe intro!: countable_UN Int countable_INT) (auto intro!: halfspace_gt_in_halfspace)
4.311 +qed auto
4.312
4.313 -lemma halfspace_span_halfspace_le:
4.314 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})\<rparr>) \<subseteq>
4.315 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x. x $$ i \<le> a})\<rparr>)"
4.316 - (is "_ \<subseteq> sets ?SIGMA")
4.317 -proof -
4.318 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.319 - then interpret sigma_algebra ?SIGMA .
4.320 - { fix a i
4.321 - have *: "{x::'a. x$$i < a} = (\<Union>n. {x. x$$i \<le> a - 1/real (Suc n)})"
4.322 - proof (safe, simp_all)
4.323 - fix x::'a assume *: "x$$i < a"
4.324 - with reals_Archimedean[of "a - x$$i"]
4.325 - obtain n where "x $$ i < a - 1 / (real (Suc n))"
4.326 - by (auto simp: field_simps inverse_eq_divide)
4.327 - then show "\<exists>n. x $$ i \<le> a - 1 / (real (Suc n))"
4.328 - by (blast intro: less_imp_le)
4.329 - next
4.330 - fix x::'a and n
4.331 - assume "x$$i \<le> a - 1 / real (Suc n)"
4.332 - also have "\<dots> < a" by auto
4.333 - finally show "x$$i < a" .
4.334 - qed
4.335 - have "{x. x$$i < a} \<in> sets ?SIGMA" unfolding *
4.336 - by (safe intro!: countable_UN)
4.337 - (auto simp: sets_sigma intro!: sigma_sets.Basic) }
4.338 - then show ?thesis by (intro sets_sigma_subset) auto
4.339 -qed
4.340 +lemma borel_eq_halfspace_le:
4.341 + "borel = sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x $$ i \<le> a}))"
4.342 + (is "_ = ?SIGMA")
4.343 +proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less])
4.344 + fix a i
4.345 + have *: "{x::'a. x$$i < a} = (\<Union>n. {x. x$$i \<le> a - 1/real (Suc n)})"
4.346 + proof (safe, simp_all)
4.347 + fix x::'a assume *: "x$$i < a"
4.348 + with reals_Archimedean[of "a - x$$i"]
4.349 + obtain n where "x $$ i < a - 1 / (real (Suc n))"
4.350 + by (auto simp: field_simps inverse_eq_divide)
4.351 + then show "\<exists>n. x $$ i \<le> a - 1 / (real (Suc n))"
4.352 + by (blast intro: less_imp_le)
4.353 + next
4.354 + fix x::'a and n
4.355 + assume "x$$i \<le> a - 1 / real (Suc n)"
4.356 + also have "\<dots> < a" by auto
4.357 + finally show "x$$i < a" .
4.358 + qed
4.359 + show "{x. x$$i < a} \<in> ?SIGMA" unfolding *
4.360 + by (safe intro!: countable_UN) auto
4.361 +qed auto
4.362
4.363 -lemma halfspace_span_halfspace_ge:
4.364 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})\<rparr>) \<subseteq>
4.365 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x. a \<le> x $$ i})\<rparr>)"
4.366 - (is "_ \<subseteq> sets ?SIGMA")
4.367 -proof -
4.368 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.369 - then interpret sigma_algebra ?SIGMA .
4.370 - { fix a i have *: "{x::'a. x$$i < a} = space ?SIGMA - {x::'a. a \<le> x$$i}" by auto
4.371 - have "{x. x$$i < a} \<in> sets ?SIGMA" unfolding *
4.372 - by (safe intro!: Diff)
4.373 - (auto simp: sets_sigma intro!: sigma_sets.Basic) }
4.374 - then show ?thesis by (intro sets_sigma_subset) auto
4.375 -qed
4.376 +lemma borel_eq_halfspace_ge:
4.377 + "borel = sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. a \<le> x $$ i}))"
4.378 + (is "_ = ?SIGMA")
4.379 +proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less])
4.380 + fix a i have *: "{x::'a. x$$i < a} = space ?SIGMA - {x::'a. a \<le> x$$i}" by auto
4.381 + show "{x. x$$i < a} \<in> ?SIGMA" unfolding *
4.382 + by (safe intro!: compl_sets) auto
4.383 +qed auto
4.384
4.385 -lemma halfspace_le_span_halfspace_gt:
4.386 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i \<le> a})\<rparr>) \<subseteq>
4.387 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x. a < x $$ i})\<rparr>)"
4.388 - (is "_ \<subseteq> sets ?SIGMA")
4.389 -proof -
4.390 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.391 - then interpret sigma_algebra ?SIGMA .
4.392 - { fix a i have *: "{x::'a. x$$i \<le> a} = space ?SIGMA - {x::'a. a < x$$i}" by auto
4.393 - have "{x. x$$i \<le> a} \<in> sets ?SIGMA" unfolding *
4.394 - by (safe intro!: Diff)
4.395 - (auto simp: sets_sigma intro!: sigma_sets.Basic) }
4.396 - then show ?thesis by (intro sets_sigma_subset) auto
4.397 -qed
4.398 +lemma borel_eq_halfspace_greater:
4.399 + "borel = sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. a < x $$ i}))"
4.400 + (is "_ = ?SIGMA")
4.401 +proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_le])
4.402 + fix a i have *: "{x::'a. x$$i \<le> a} = space ?SIGMA - {x::'a. a < x$$i}" by auto
4.403 + show "{x. x$$i \<le> a} \<in> ?SIGMA" unfolding *
4.404 + by (safe intro!: compl_sets) auto
4.405 +qed auto
4.406
4.407 -lemma halfspace_le_span_atMost:
4.408 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i \<le> a})\<rparr>) \<subseteq>
4.409 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda>a. {..a\<Colon>'a\<Colon>ordered_euclidean_space})\<rparr>)"
4.410 - (is "_ \<subseteq> sets ?SIGMA")
4.411 -proof -
4.412 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.413 - then interpret sigma_algebra ?SIGMA .
4.414 - have "\<And>a i. {x. x$$i \<le> a} \<in> sets ?SIGMA"
4.415 +lemma borel_eq_atMost:
4.416 + "borel = sigma UNIV (range (\<lambda>a. {..a\<Colon>'a\<Colon>ordered_euclidean_space}))"
4.417 + (is "_ = ?SIGMA")
4.418 +proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_le])
4.419 + fix a i show "{x. x$$i \<le> a} \<in> ?SIGMA"
4.420 proof cases
4.421 - fix a i assume "i < DIM('a)"
4.422 + assume "i < DIM('a)"
4.423 then have *: "{x::'a. x$$i \<le> a} = (\<Union>k::nat. {.. (\<chi>\<chi> n. if n = i then a else real k)})"
4.424 proof (safe, simp_all add: eucl_le[where 'a='a] split: split_if_asm)
4.425 fix x
4.426 @@ -484,28 +465,19 @@
4.427 then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> x $$ ia \<le> real k"
4.428 by (auto intro!: exI[of _ k])
4.429 qed
4.430 - show "{x. x$$i \<le> a} \<in> sets ?SIGMA" unfolding *
4.431 - by (safe intro!: countable_UN)
4.432 - (auto simp: sets_sigma intro!: sigma_sets.Basic)
4.433 - next
4.434 - fix a i assume "\<not> i < DIM('a)"
4.435 - then show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
4.436 - using top by auto
4.437 - qed
4.438 - then show ?thesis by (intro sets_sigma_subset) auto
4.439 -qed
4.440 + show "{x. x$$i \<le> a} \<in> ?SIGMA" unfolding *
4.441 + by (safe intro!: countable_UN) auto
4.442 + qed (auto intro: sigma_sets_top sigma_sets.Empty)
4.443 +qed auto
4.444
4.445 -lemma halfspace_le_span_greaterThan:
4.446 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i \<le> a})\<rparr>) \<subseteq>
4.447 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda>a. {a<..})\<rparr>)"
4.448 - (is "_ \<subseteq> sets ?SIGMA")
4.449 -proof -
4.450 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.451 - then interpret sigma_algebra ?SIGMA .
4.452 - have "\<And>a i. {x. x$$i \<le> a} \<in> sets ?SIGMA"
4.453 +lemma borel_eq_greaterThan:
4.454 + "borel = sigma UNIV (range (\<lambda>a\<Colon>'a\<Colon>ordered_euclidean_space. {a<..}))"
4.455 + (is "_ = ?SIGMA")
4.456 +proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_le])
4.457 + fix a i show "{x. x$$i \<le> a} \<in> ?SIGMA"
4.458 proof cases
4.459 - fix a i assume "i < DIM('a)"
4.460 - have "{x::'a. x$$i \<le> a} = space ?SIGMA - {x::'a. a < x$$i}" by auto
4.461 + assume "i < DIM('a)"
4.462 + have "{x::'a. x$$i \<le> a} = UNIV - {x::'a. a < x$$i}" by auto
4.463 also have *: "{x::'a. a < x$$i} = (\<Union>k::nat. {(\<chi>\<chi> n. if n = i then a else -real k) <..})" using `i <DIM('a)`
4.464 proof (safe, simp_all add: eucl_less[where 'a='a] split: split_if_asm)
4.465 fix x
4.466 @@ -518,30 +490,22 @@
4.467 then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> -real k < x $$ ia"
4.468 by (auto intro!: exI[of _ k])
4.469 qed
4.470 - finally show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
4.471 + finally show "{x. x$$i \<le> a} \<in> ?SIGMA"
4.472 apply (simp only:)
4.473 apply (safe intro!: countable_UN Diff)
4.474 - apply (auto simp: sets_sigma intro!: sigma_sets.Basic)
4.475 + apply (auto intro: sigma_sets_top)
4.476 done
4.477 - next
4.478 - fix a i assume "\<not> i < DIM('a)"
4.479 - then show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
4.480 - using top by auto
4.481 - qed
4.482 - then show ?thesis by (intro sets_sigma_subset) auto
4.483 -qed
4.484 + qed (auto intro: sigma_sets_top sigma_sets.Empty)
4.485 +qed auto
4.486
4.487 -lemma halfspace_le_span_lessThan:
4.488 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. a \<le> x $$ i})\<rparr>) \<subseteq>
4.489 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda>a. {..<a})\<rparr>)"
4.490 - (is "_ \<subseteq> sets ?SIGMA")
4.491 -proof -
4.492 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.493 - then interpret sigma_algebra ?SIGMA .
4.494 - have "\<And>a i. {x. a \<le> x$$i} \<in> sets ?SIGMA"
4.495 +lemma borel_eq_lessThan:
4.496 + "borel = sigma UNIV (range (\<lambda>a\<Colon>'a\<Colon>ordered_euclidean_space. {..<a}))"
4.497 + (is "_ = ?SIGMA")
4.498 +proof (rule borel_eq_sigmaI4[OF borel_eq_halfspace_ge])
4.499 + fix a i show "{x. a \<le> x$$i} \<in> ?SIGMA"
4.500 proof cases
4.501 fix a i assume "i < DIM('a)"
4.502 - have "{x::'a. a \<le> x$$i} = space ?SIGMA - {x::'a. x$$i < a}" by auto
4.503 + have "{x::'a. a \<le> x$$i} = UNIV - {x::'a. x$$i < a}" by auto
4.504 also have *: "{x::'a. x$$i < a} = (\<Union>k::nat. {..< (\<chi>\<chi> n. if n = i then a else real k)})" using `i <DIM('a)`
4.505 proof (safe, simp_all add: eucl_less[where 'a='a] split: split_if_asm)
4.506 fix x
4.507 @@ -554,184 +518,70 @@
4.508 then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> x $$ ia < real k"
4.509 by (auto intro!: exI[of _ k])
4.510 qed
4.511 - finally show "{x. a \<le> x$$i} \<in> sets ?SIGMA"
4.512 + finally show "{x. a \<le> x$$i} \<in> ?SIGMA"
4.513 apply (simp only:)
4.514 apply (safe intro!: countable_UN Diff)
4.515 - apply (auto simp: sets_sigma intro!: sigma_sets.Basic)
4.516 + apply (auto intro: sigma_sets_top)
4.517 done
4.518 - next
4.519 - fix a i assume "\<not> i < DIM('a)"
4.520 - then show "{x. a \<le> x$$i} \<in> sets ?SIGMA"
4.521 - using top by auto
4.522 - qed
4.523 - then show ?thesis by (intro sets_sigma_subset) auto
4.524 -qed
4.525 -
4.526 -lemma atMost_span_atLeastAtMost:
4.527 - "sets (sigma \<lparr>space=UNIV, sets=range (\<lambda>a. {..a\<Colon>'a\<Colon>ordered_euclidean_space})\<rparr>) \<subseteq>
4.528 - sets (sigma \<lparr>space=UNIV, sets=range (\<lambda>(a,b). {a..b})\<rparr>)"
4.529 - (is "_ \<subseteq> sets ?SIGMA")
4.530 -proof -
4.531 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.532 - then interpret sigma_algebra ?SIGMA .
4.533 - { fix a::'a
4.534 - have *: "{..a} = (\<Union>n::nat. {- real n *\<^sub>R One .. a})"
4.535 - proof (safe, simp_all add: eucl_le[where 'a='a])
4.536 - fix x
4.537 - from real_arch_simple[of "Max ((\<lambda>i. - x$$i)`{..<DIM('a)})"]
4.538 - guess k::nat .. note k = this
4.539 - { fix i assume "i < DIM('a)"
4.540 - with k have "- x$$i \<le> real k"
4.541 - by (subst (asm) Max_le_iff) (auto simp: field_simps)
4.542 - then have "- real k \<le> x$$i" by simp }
4.543 - then show "\<exists>n::nat. \<forall>i<DIM('a). - real n \<le> x $$ i"
4.544 - by (auto intro!: exI[of _ k])
4.545 - qed
4.546 - have "{..a} \<in> sets ?SIGMA" unfolding *
4.547 - by (safe intro!: countable_UN)
4.548 - (auto simp: sets_sigma intro!: sigma_sets.Basic) }
4.549 - then show ?thesis by (intro sets_sigma_subset) auto
4.550 -qed
4.551 -
4.552 -lemma borel_eq_atMost:
4.553 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> a. {.. a::'a\<Colon>ordered_euclidean_space})\<rparr>)"
4.554 - (is "_ = ?SIGMA")
4.555 -proof (intro algebra.equality antisym)
4.556 - show "sets borel \<subseteq> sets ?SIGMA"
4.557 - using halfspace_le_span_atMost halfspace_span_halfspace_le open_span_halfspace
4.558 - by auto
4.559 - show "sets ?SIGMA \<subseteq> sets borel"
4.560 - by (rule borel.sets_sigma_subset) auto
4.561 + qed (auto intro: sigma_sets_top sigma_sets.Empty)
4.562 qed auto
4.563
4.564 lemma borel_eq_atLeastAtMost:
4.565 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a :: 'a\<Colon>ordered_euclidean_space, b). {a .. b})\<rparr>)"
4.566 - (is "_ = ?SIGMA")
4.567 -proof (intro algebra.equality antisym)
4.568 - show "sets borel \<subseteq> sets ?SIGMA"
4.569 - using atMost_span_atLeastAtMost halfspace_le_span_atMost
4.570 - halfspace_span_halfspace_le open_span_halfspace
4.571 - by auto
4.572 - show "sets ?SIGMA \<subseteq> sets borel"
4.573 - by (rule borel.sets_sigma_subset) auto
4.574 -qed auto
4.575 -
4.576 -lemma borel_eq_greaterThan:
4.577 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a :: 'a\<Colon>ordered_euclidean_space). {a <..})\<rparr>)"
4.578 - (is "_ = ?SIGMA")
4.579 -proof (intro algebra.equality antisym)
4.580 - show "sets borel \<subseteq> sets ?SIGMA"
4.581 - using halfspace_le_span_greaterThan
4.582 - halfspace_span_halfspace_le open_span_halfspace
4.583 - by auto
4.584 - show "sets ?SIGMA \<subseteq> sets borel"
4.585 - by (rule borel.sets_sigma_subset) auto
4.586 -qed auto
4.587 -
4.588 -lemma borel_eq_lessThan:
4.589 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a :: 'a\<Colon>ordered_euclidean_space). {..< a})\<rparr>)"
4.590 - (is "_ = ?SIGMA")
4.591 -proof (intro algebra.equality antisym)
4.592 - show "sets borel \<subseteq> sets ?SIGMA"
4.593 - using halfspace_le_span_lessThan
4.594 - halfspace_span_halfspace_ge open_span_halfspace
4.595 - by auto
4.596 - show "sets ?SIGMA \<subseteq> sets borel"
4.597 - by (rule borel.sets_sigma_subset) auto
4.598 + "borel = sigma UNIV (range (\<lambda>(a,b). {a..b} \<Colon>'a\<Colon>ordered_euclidean_space set))"
4.599 + (is "_ = ?SIGMA")
4.600 +proof (rule borel_eq_sigmaI5[OF borel_eq_atMost])
4.601 + fix a::'a
4.602 + have *: "{..a} = (\<Union>n::nat. {- real n *\<^sub>R One .. a})"
4.603 + proof (safe, simp_all add: eucl_le[where 'a='a])
4.604 + fix x
4.605 + from real_arch_simple[of "Max ((\<lambda>i. - x$$i)`{..<DIM('a)})"]
4.606 + guess k::nat .. note k = this
4.607 + { fix i assume "i < DIM('a)"
4.608 + with k have "- x$$i \<le> real k"
4.609 + by (subst (asm) Max_le_iff) (auto simp: field_simps)
4.610 + then have "- real k \<le> x$$i" by simp }
4.611 + then show "\<exists>n::nat. \<forall>i<DIM('a). - real n \<le> x $$ i"
4.612 + by (auto intro!: exI[of _ k])
4.613 + qed
4.614 + show "{..a} \<in> ?SIGMA" unfolding *
4.615 + by (safe intro!: countable_UN)
4.616 + (auto intro!: sigma_sets_top)
4.617 qed auto
4.618
4.619 lemma borel_eq_greaterThanLessThan:
4.620 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, b). {a <..< (b :: 'a \<Colon> ordered_euclidean_space)})\<rparr>)"
4.621 + "borel = sigma UNIV (range (\<lambda> (a, b). {a <..< b} :: 'a \<Colon> ordered_euclidean_space set))"
4.622 (is "_ = ?SIGMA")
4.623 -proof (intro algebra.equality antisym)
4.624 - show "sets ?SIGMA \<subseteq> sets borel"
4.625 - by (rule borel.sets_sigma_subset) auto
4.626 - show "sets borel \<subseteq> sets ?SIGMA"
4.627 - proof -
4.628 - have "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
4.629 - then interpret sigma_algebra ?SIGMA .
4.630 - { fix M :: "'a set" assume "M \<in> {S. open S}"
4.631 - then have "open M" by simp
4.632 - have "M \<in> sets ?SIGMA"
4.633 - apply (subst open_UNION[OF `open M`])
4.634 - apply (safe intro!: countable_UN)
4.635 - apply (auto simp add: sigma_def intro!: sigma_sets.Basic)
4.636 - done }
4.637 - then show ?thesis
4.638 - unfolding borel_def by (intro sets_sigma_subset) auto
4.639 - qed
4.640 +proof (rule borel_eq_sigmaI1[OF borel_def])
4.641 + fix M :: "'a set" assume "M \<in> {S. open S}"
4.642 + then have "open M" by simp
4.643 + show "M \<in> ?SIGMA"
4.644 + apply (subst open_UNION[OF `open M`])
4.645 + apply (safe intro!: countable_UN)
4.646 + apply auto
4.647 + done
4.648 qed auto
4.649
4.650 lemma borel_eq_atLeastLessThan:
4.651 - "borel = sigma \<lparr>space=UNIV, sets=range (\<lambda>(a, b). {a ..< b :: real})\<rparr>" (is "_ = ?S")
4.652 -proof (intro algebra.equality antisym)
4.653 - interpret sigma_algebra ?S
4.654 - by (rule sigma_algebra_sigma) auto
4.655 - show "sets borel \<subseteq> sets ?S"
4.656 - unfolding borel_eq_lessThan
4.657 - proof (intro sets_sigma_subset subsetI)
4.658 - have move_uminus: "\<And>x y::real. -x \<le> y \<longleftrightarrow> -y \<le> x" by auto
4.659 - fix A :: "real set" assume "A \<in> sets \<lparr>space = UNIV, sets = range lessThan\<rparr>"
4.660 - then obtain x where "A = {..< x}" by auto
4.661 - then have "A = (\<Union>i::nat. {-real i ..< x})"
4.662 - by (auto simp: move_uminus real_arch_simple)
4.663 - then show "A \<in> sets ?S"
4.664 - by (auto simp: sets_sigma intro!: sigma_sets.intros)
4.665 - qed simp
4.666 - show "sets ?S \<subseteq> sets borel"
4.667 - by (intro borel.sets_sigma_subset) auto
4.668 -qed simp_all
4.669 -
4.670 -lemma borel_eq_halfspace_le:
4.671 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x$$i \<le> a})\<rparr>)"
4.672 - (is "_ = ?SIGMA")
4.673 -proof (intro algebra.equality antisym)
4.674 - show "sets borel \<subseteq> sets ?SIGMA"
4.675 - using open_span_halfspace halfspace_span_halfspace_le by auto
4.676 - show "sets ?SIGMA \<subseteq> sets borel"
4.677 - by (rule borel.sets_sigma_subset) auto
4.678 + "borel = sigma UNIV (range (\<lambda>(a, b). {a ..< b :: real}))" (is "_ = ?SIGMA")
4.679 +proof (rule borel_eq_sigmaI5[OF borel_eq_lessThan])
4.680 + have move_uminus: "\<And>x y::real. -x \<le> y \<longleftrightarrow> -y \<le> x" by auto
4.681 + fix x :: real
4.682 + have "{..<x} = (\<Union>i::nat. {-real i ..< x})"
4.683 + by (auto simp: move_uminus real_arch_simple)
4.684 + then show "{..< x} \<in> ?SIGMA"
4.685 + by (auto intro: sigma_sets.intros)
4.686 qed auto
4.687
4.688 -lemma borel_eq_halfspace_less:
4.689 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x$$i < a})\<rparr>)"
4.690 - (is "_ = ?SIGMA")
4.691 -proof (intro algebra.equality antisym)
4.692 - show "sets borel \<subseteq> sets ?SIGMA"
4.693 - using open_span_halfspace .
4.694 - show "sets ?SIGMA \<subseteq> sets borel"
4.695 - by (rule borel.sets_sigma_subset) auto
4.696 -qed auto
4.697 -
4.698 -lemma borel_eq_halfspace_gt:
4.699 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. a < x$$i})\<rparr>)"
4.700 - (is "_ = ?SIGMA")
4.701 -proof (intro algebra.equality antisym)
4.702 - show "sets borel \<subseteq> sets ?SIGMA"
4.703 - using halfspace_le_span_halfspace_gt open_span_halfspace halfspace_span_halfspace_le by auto
4.704 - show "sets ?SIGMA \<subseteq> sets borel"
4.705 - by (rule borel.sets_sigma_subset) auto
4.706 -qed auto
4.707 -
4.708 -lemma borel_eq_halfspace_ge:
4.709 - "borel = (sigma \<lparr>space=UNIV, sets=range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. a \<le> x$$i})\<rparr>)"
4.710 - (is "_ = ?SIGMA")
4.711 -proof (intro algebra.equality antisym)
4.712 - show "sets borel \<subseteq> sets ?SIGMA"
4.713 - using halfspace_span_halfspace_ge open_span_halfspace by auto
4.714 - show "sets ?SIGMA \<subseteq> sets borel"
4.715 - by (rule borel.sets_sigma_subset) auto
4.716 -qed auto
4.717 -
4.718 -lemma (in sigma_algebra) borel_measurable_halfspacesI:
4.719 +lemma borel_measurable_halfspacesI:
4.720 fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
4.721 - assumes "borel = (sigma \<lparr>space=UNIV, sets=range F\<rparr>)"
4.722 - and "\<And>a i. S a i = f -` F (a,i) \<inter> space M"
4.723 - and "\<And>a i. \<not> i < DIM('c) \<Longrightarrow> S a i \<in> sets M"
4.724 + assumes F: "borel = sigma UNIV (range F)"
4.725 + and S_eq: "\<And>a i. S a i = f -` F (a,i) \<inter> space M"
4.726 + and S: "\<And>a i. \<not> i < DIM('c) \<Longrightarrow> S a i \<in> sets M"
4.727 shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a::real. S a i \<in> sets M)"
4.728 proof safe
4.729 fix a :: real and i assume i: "i < DIM('c)" and f: "f \<in> borel_measurable M"
4.730 then show "S a i \<in> sets M" unfolding assms
4.731 - by (auto intro!: measurable_sets sigma_sets.Basic simp: assms(1) sigma_def)
4.732 + by (auto intro!: measurable_sets sigma_sets.Basic simp: assms(1))
4.733 next
4.734 assume a: "\<forall>i<DIM('c). \<forall>a. S a i \<in> sets M"
4.735 { fix a i have "S a i \<in> sets M"
4.736 @@ -740,61 +590,58 @@
4.737 with a show ?thesis unfolding assms(2) by simp
4.738 next
4.739 assume "\<not> i < DIM('c)"
4.740 - from assms(3)[OF this] show ?thesis .
4.741 + from S[OF this] show ?thesis .
4.742 qed }
4.743 - then have "f \<in> measurable M (sigma \<lparr>space=UNIV, sets=range F\<rparr>)"
4.744 - by (auto intro!: measurable_sigma simp: assms(2))
4.745 - then show "f \<in> borel_measurable M" unfolding measurable_def
4.746 - unfolding assms(1) by simp
4.747 + then show "f \<in> borel_measurable M"
4.748 + by (auto intro!: measurable_measure_of simp: S_eq F)
4.749 qed
4.750
4.751 -lemma (in sigma_algebra) borel_measurable_iff_halfspace_le:
4.752 +lemma borel_measurable_iff_halfspace_le:
4.753 fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
4.754 shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. f w $$ i \<le> a} \<in> sets M)"
4.755 by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_le]) auto
4.756
4.757 -lemma (in sigma_algebra) borel_measurable_iff_halfspace_less:
4.758 +lemma borel_measurable_iff_halfspace_less:
4.759 fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
4.760 shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. f w $$ i < a} \<in> sets M)"
4.761 by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_less]) auto
4.762
4.763 -lemma (in sigma_algebra) borel_measurable_iff_halfspace_ge:
4.764 +lemma borel_measurable_iff_halfspace_ge:
4.765 fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
4.766 shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. a \<le> f w $$ i} \<in> sets M)"
4.767 by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_ge]) auto
4.768
4.769 -lemma (in sigma_algebra) borel_measurable_iff_halfspace_greater:
4.770 +lemma borel_measurable_iff_halfspace_greater:
4.771 fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
4.772 shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. a < f w $$ i} \<in> sets M)"
4.773 - by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_gt]) auto
4.774 + by (rule borel_measurable_halfspacesI[OF borel_eq_halfspace_greater]) auto
4.775
4.776 -lemma (in sigma_algebra) borel_measurable_iff_le:
4.777 +lemma borel_measurable_iff_le:
4.778 "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w \<le> a} \<in> sets M)"
4.779 using borel_measurable_iff_halfspace_le[where 'c=real] by simp
4.780
4.781 -lemma (in sigma_algebra) borel_measurable_iff_less:
4.782 +lemma borel_measurable_iff_less:
4.783 "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)"
4.784 using borel_measurable_iff_halfspace_less[where 'c=real] by simp
4.785
4.786 -lemma (in sigma_algebra) borel_measurable_iff_ge:
4.787 +lemma borel_measurable_iff_ge:
4.788 "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a \<le> f w} \<in> sets M)"
4.789 using borel_measurable_iff_halfspace_ge[where 'c=real] by simp
4.790
4.791 -lemma (in sigma_algebra) borel_measurable_iff_greater:
4.792 +lemma borel_measurable_iff_greater:
4.793 "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a < f w} \<in> sets M)"
4.794 using borel_measurable_iff_halfspace_greater[where 'c=real] by simp
4.795
4.796 lemma borel_measurable_euclidean_component:
4.797 "(\<lambda>x::'a::euclidean_space. x $$ i) \<in> borel_measurable borel"
4.798 - unfolding borel_def[where 'a=real]
4.799 -proof (rule borel.measurable_sigma, simp_all)
4.800 +proof (rule borel_measurableI)
4.801 fix S::"real set" assume "open S"
4.802 from open_vimage_euclidean_component[OF this]
4.803 - show "(\<lambda>x. x $$ i) -` S \<in> sets borel"
4.804 + show "(\<lambda>x. x $$ i) -` S \<inter> space borel \<in> sets borel"
4.805 by (auto intro: borel_open)
4.806 qed
4.807
4.808 -lemma (in sigma_algebra) borel_measurable_euclidean_space:
4.809 +lemma borel_measurable_euclidean_space:
4.810 fixes f :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
4.811 shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). (\<lambda>x. f x $$ i) \<in> borel_measurable M)"
4.812 proof safe
4.813 @@ -810,7 +657,7 @@
4.814
4.815 subsection "Borel measurable operators"
4.816
4.817 -lemma (in sigma_algebra) affine_borel_measurable_vector:
4.818 +lemma affine_borel_measurable_vector:
4.819 fixes f :: "'a \<Rightarrow> 'x::real_normed_vector"
4.820 assumes "f \<in> borel_measurable M"
4.821 shows "(\<lambda>x. a + b *\<^sub>R f x) \<in> borel_measurable M"
4.822 @@ -821,8 +668,7 @@
4.823 assume "b \<noteq> 0"
4.824 with `open S` have "open ((\<lambda>x. (- a + x) /\<^sub>R b) ` S)" (is "open ?S")
4.825 by (auto intro!: open_affinity simp: scaleR_add_right)
4.826 - hence "?S \<in> sets borel"
4.827 - unfolding borel_def by (auto simp: sigma_def intro!: sigma_sets.Basic)
4.828 + hence "?S \<in> sets borel" by auto
4.829 moreover
4.830 from `b \<noteq> 0` have "(\<lambda>x. a + b *\<^sub>R f x) -` S = f -` ?S"
4.831 apply auto by (rule_tac x="a + b *\<^sub>R f x" in image_eqI, simp_all)
4.832 @@ -831,13 +677,13 @@
4.833 qed simp
4.834 qed
4.835
4.836 -lemma (in sigma_algebra) affine_borel_measurable:
4.837 +lemma affine_borel_measurable:
4.838 fixes g :: "'a \<Rightarrow> real"
4.839 assumes g: "g \<in> borel_measurable M"
4.840 shows "(\<lambda>x. a + (g x) * b) \<in> borel_measurable M"
4.841 using affine_borel_measurable_vector[OF assms] by (simp add: mult_commute)
4.842
4.843 -lemma (in sigma_algebra) borel_measurable_add[simp, intro]:
4.844 +lemma borel_measurable_add[simp, intro]:
4.845 fixes f :: "'a \<Rightarrow> real"
4.846 assumes f: "f \<in> borel_measurable M"
4.847 assumes g: "g \<in> borel_measurable M"
4.848 @@ -855,7 +701,7 @@
4.849 by (simp add: borel_measurable_iff_ge)
4.850 qed
4.851
4.852 -lemma (in sigma_algebra) borel_measurable_setsum[simp, intro]:
4.853 +lemma borel_measurable_setsum[simp, intro]:
4.854 fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
4.855 assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
4.856 shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
4.857 @@ -864,7 +710,7 @@
4.858 thus ?thesis using assms by induct auto
4.859 qed simp
4.860
4.861 -lemma (in sigma_algebra) borel_measurable_square:
4.862 +lemma borel_measurable_square:
4.863 fixes f :: "'a \<Rightarrow> real"
4.864 assumes f: "f \<in> borel_measurable M"
4.865 shows "(\<lambda>x. (f x)^2) \<in> borel_measurable M"
4.866 @@ -916,7 +762,7 @@
4.867 shows"x*y = ((x+y)^2)/4 - ((x-y)^ 2)/4"
4.868 by (simp add: power2_eq_square ring_distribs diff_divide_distrib [symmetric])
4.869
4.870 -lemma (in sigma_algebra) borel_measurable_uminus[simp, intro]:
4.871 +lemma borel_measurable_uminus[simp, intro]:
4.872 fixes g :: "'a \<Rightarrow> real"
4.873 assumes g: "g \<in> borel_measurable M"
4.874 shows "(\<lambda>x. - g x) \<in> borel_measurable M"
4.875 @@ -928,7 +774,7 @@
4.876 finally show ?thesis .
4.877 qed
4.878
4.879 -lemma (in sigma_algebra) borel_measurable_times[simp, intro]:
4.880 +lemma borel_measurable_times[simp, intro]:
4.881 fixes f :: "'a \<Rightarrow> real"
4.882 assumes f: "f \<in> borel_measurable M"
4.883 assumes g: "g \<in> borel_measurable M"
4.884 @@ -947,7 +793,7 @@
4.885 using 1 2 by simp
4.886 qed
4.887
4.888 -lemma (in sigma_algebra) borel_measurable_setprod[simp, intro]:
4.889 +lemma borel_measurable_setprod[simp, intro]:
4.890 fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
4.891 assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
4.892 shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M"
4.893 @@ -956,14 +802,14 @@
4.894 thus ?thesis using assms by induct auto
4.895 qed simp
4.896
4.897 -lemma (in sigma_algebra) borel_measurable_diff[simp, intro]:
4.898 +lemma borel_measurable_diff[simp, intro]:
4.899 fixes f :: "'a \<Rightarrow> real"
4.900 assumes f: "f \<in> borel_measurable M"
4.901 assumes g: "g \<in> borel_measurable M"
4.902 shows "(\<lambda>x. f x - g x) \<in> borel_measurable M"
4.903 unfolding diff_minus using assms by fast
4.904
4.905 -lemma (in sigma_algebra) borel_measurable_inverse[simp, intro]:
4.906 +lemma borel_measurable_inverse[simp, intro]:
4.907 fixes f :: "'a \<Rightarrow> real"
4.908 assumes "f \<in> borel_measurable M"
4.909 shows "(\<lambda>x. inverse (f x)) \<in> borel_measurable M"
4.910 @@ -978,7 +824,7 @@
4.911 by (auto intro!: Int Un)
4.912 qed
4.913
4.914 -lemma (in sigma_algebra) borel_measurable_divide[simp, intro]:
4.915 +lemma borel_measurable_divide[simp, intro]:
4.916 fixes f :: "'a \<Rightarrow> real"
4.917 assumes "f \<in> borel_measurable M"
4.918 and "g \<in> borel_measurable M"
4.919 @@ -986,7 +832,7 @@
4.920 unfolding field_divide_inverse
4.921 by (rule borel_measurable_inverse borel_measurable_times assms)+
4.922
4.923 -lemma (in sigma_algebra) borel_measurable_max[intro, simp]:
4.924 +lemma borel_measurable_max[intro, simp]:
4.925 fixes f g :: "'a \<Rightarrow> real"
4.926 assumes "f \<in> borel_measurable M"
4.927 assumes "g \<in> borel_measurable M"
4.928 @@ -1001,7 +847,7 @@
4.929 by (auto intro!: Int)
4.930 qed
4.931
4.932 -lemma (in sigma_algebra) borel_measurable_min[intro, simp]:
4.933 +lemma borel_measurable_min[intro, simp]:
4.934 fixes f g :: "'a \<Rightarrow> real"
4.935 assumes "f \<in> borel_measurable M"
4.936 assumes "g \<in> borel_measurable M"
4.937 @@ -1016,7 +862,7 @@
4.938 by (auto intro!: Int)
4.939 qed
4.940
4.941 -lemma (in sigma_algebra) borel_measurable_abs[simp, intro]:
4.942 +lemma borel_measurable_abs[simp, intro]:
4.943 assumes "f \<in> borel_measurable M"
4.944 shows "(\<lambda>x. \<bar>f x :: real\<bar>) \<in> borel_measurable M"
4.945 proof -
4.946 @@ -1033,14 +879,14 @@
4.947 fixes f :: "'a::topological_space \<Rightarrow> 'b::t1_space"
4.948 assumes "continuous_on UNIV f"
4.949 shows "f \<in> borel_measurable borel"
4.950 - apply(rule borel.borel_measurableI)
4.951 + apply(rule borel_measurableI)
4.952 using continuous_open_preimage[OF assms] unfolding vimage_def by auto
4.953
4.954 lemma borel_measurable_continuous_on:
4.955 fixes f :: "'a::topological_space \<Rightarrow> 'b::t1_space"
4.956 assumes cont: "continuous_on A f" "open A"
4.957 shows "(\<lambda>x. if x \<in> A then f x else c) \<in> borel_measurable borel" (is "?f \<in> _")
4.958 -proof (rule borel.borel_measurableI)
4.959 +proof (rule borel_measurableI)
4.960 fix S :: "'b set" assume "open S"
4.961 then have "open {x\<in>A. f x \<in> S}"
4.962 by (intro continuous_open_preimage[OF cont]) auto
4.963 @@ -1049,11 +895,11 @@
4.964 {x\<in>A. f x \<in> S} \<union> (if c \<in> S then space borel - A else {})"
4.965 by (auto split: split_if_asm)
4.966 also have "\<dots> \<in> sets borel"
4.967 - using * `open A` by (auto simp del: space_borel intro!: borel.Un)
4.968 + using * `open A` by (auto simp del: space_borel intro!: Un)
4.969 finally show "?f -` S \<inter> space borel \<in> sets borel" .
4.970 qed
4.971
4.972 -lemma (in sigma_algebra) convex_measurable:
4.973 +lemma convex_measurable:
4.974 fixes a b :: real
4.975 assumes X: "X \<in> borel_measurable M" "X ` space M \<subseteq> { a <..< b}"
4.976 assumes q: "convex_on { a <..< b} q"
4.977 @@ -1091,7 +937,7 @@
4.978 finally show ?thesis .
4.979 qed
4.980
4.981 -lemma (in sigma_algebra) borel_measurable_log[simp,intro]:
4.982 +lemma borel_measurable_log[simp,intro]:
4.983 assumes f: "f \<in> borel_measurable M" and "1 < b"
4.984 shows "(\<lambda>x. log b (f x)) \<in> borel_measurable M"
4.985 using measurable_comp[OF f borel_measurable_borel_log[OF `1 < b`]]
4.986 @@ -1101,25 +947,21 @@
4.987
4.988 lemma borel_measurable_ereal_borel:
4.989 "ereal \<in> borel_measurable borel"
4.990 - unfolding borel_def[where 'a=ereal]
4.991 -proof (rule borel.measurable_sigma)
4.992 - fix X :: "ereal set" assume "X \<in> sets \<lparr>space = UNIV, sets = {S. open S} \<rparr>"
4.993 - then have "open X" by simp
4.994 +proof (rule borel_measurableI)
4.995 + fix X :: "ereal set" assume "open X"
4.996 then have "open (ereal -` X \<inter> space borel)"
4.997 by (simp add: open_ereal_vimage)
4.998 then show "ereal -` X \<inter> space borel \<in> sets borel" by auto
4.999 -qed auto
4.1000 +qed
4.1001
4.1002 -lemma (in sigma_algebra) borel_measurable_ereal[simp, intro]:
4.1003 +lemma borel_measurable_ereal[simp, intro]:
4.1004 assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
4.1005 using measurable_comp[OF f borel_measurable_ereal_borel] unfolding comp_def .
4.1006
4.1007 lemma borel_measurable_real_of_ereal_borel:
4.1008 "(real :: ereal \<Rightarrow> real) \<in> borel_measurable borel"
4.1009 - unfolding borel_def[where 'a=real]
4.1010 -proof (rule borel.measurable_sigma)
4.1011 - fix B :: "real set" assume "B \<in> sets \<lparr>space = UNIV, sets = {S. open S} \<rparr>"
4.1012 - then have "open B" by simp
4.1013 +proof (rule borel_measurableI)
4.1014 + fix B :: "real set" assume "open B"
4.1015 have *: "ereal -` real -` (B - {0}) = B - {0}" by auto
4.1016 have open_real: "open (real -` (B - {0}) :: ereal set)"
4.1017 unfolding open_ereal_def * using `open B` by auto
4.1018 @@ -1137,13 +979,13 @@
4.1019 then show "(real -` B :: ereal set) \<inter> space borel \<in> sets borel"
4.1020 using open_real by auto
4.1021 qed
4.1022 -qed auto
4.1023 +qed
4.1024
4.1025 -lemma (in sigma_algebra) borel_measurable_real_of_ereal[simp, intro]:
4.1026 +lemma borel_measurable_real_of_ereal[simp, intro]:
4.1027 assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. real (f x :: ereal)) \<in> borel_measurable M"
4.1028 using measurable_comp[OF f borel_measurable_real_of_ereal_borel] unfolding comp_def .
4.1029
4.1030 -lemma (in sigma_algebra) borel_measurable_ereal_iff:
4.1031 +lemma borel_measurable_ereal_iff:
4.1032 shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M"
4.1033 proof
4.1034 assume "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
4.1035 @@ -1151,7 +993,7 @@
4.1036 show "f \<in> borel_measurable M" by auto
4.1037 qed auto
4.1038
4.1039 -lemma (in sigma_algebra) borel_measurable_ereal_iff_real:
4.1040 +lemma borel_measurable_ereal_iff_real:
4.1041 fixes f :: "'a \<Rightarrow> ereal"
4.1042 shows "f \<in> borel_measurable M \<longleftrightarrow>
4.1043 ((\<lambda>x. real (f x)) \<in> borel_measurable M \<and> f -` {\<infinity>} \<inter> space M \<in> sets M \<and> f -` {-\<infinity>} \<inter> space M \<in> sets M)"
4.1044 @@ -1165,7 +1007,7 @@
4.1045 finally show "f \<in> borel_measurable M" .
4.1046 qed (auto intro: measurable_sets borel_measurable_real_of_ereal)
4.1047
4.1048 -lemma (in sigma_algebra) less_eq_ge_measurable:
4.1049 +lemma less_eq_ge_measurable:
4.1050 fixes f :: "'a \<Rightarrow> 'c::linorder"
4.1051 shows "f -` {a <..} \<inter> space M \<in> sets M \<longleftrightarrow> f -` {..a} \<inter> space M \<in> sets M"
4.1052 proof
4.1053 @@ -1178,7 +1020,7 @@
4.1054 ultimately show "f -` {a <..} \<inter> space M \<in> sets M" by auto
4.1055 qed
4.1056
4.1057 -lemma (in sigma_algebra) greater_eq_le_measurable:
4.1058 +lemma greater_eq_le_measurable:
4.1059 fixes f :: "'a \<Rightarrow> 'c::linorder"
4.1060 shows "f -` {..< a} \<inter> space M \<in> sets M \<longleftrightarrow> f -` {a ..} \<inter> space M \<in> sets M"
4.1061 proof
4.1062 @@ -1191,28 +1033,27 @@
4.1063 ultimately show "f -` {a ..} \<inter> space M \<in> sets M" by auto
4.1064 qed
4.1065
4.1066 -lemma (in sigma_algebra) borel_measurable_uminus_borel_ereal:
4.1067 +lemma borel_measurable_uminus_borel_ereal:
4.1068 "(uminus :: ereal \<Rightarrow> ereal) \<in> borel_measurable borel"
4.1069 -proof (subst borel_def, rule borel.measurable_sigma)
4.1070 - fix X :: "ereal set" assume "X \<in> sets \<lparr>space = UNIV, sets = {S. open S}\<rparr>"
4.1071 - then have "open X" by simp
4.1072 +proof (rule borel_measurableI)
4.1073 + fix X :: "ereal set" assume "open X"
4.1074 have "uminus -` X = uminus ` X" by (force simp: image_iff)
4.1075 then have "open (uminus -` X)" using `open X` ereal_open_uminus by auto
4.1076 then show "uminus -` X \<inter> space borel \<in> sets borel" by auto
4.1077 -qed auto
4.1078 +qed
4.1079
4.1080 -lemma (in sigma_algebra) borel_measurable_uminus_ereal[intro]:
4.1081 +lemma borel_measurable_uminus_ereal[intro]:
4.1082 assumes "f \<in> borel_measurable M"
4.1083 shows "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M"
4.1084 using measurable_comp[OF assms borel_measurable_uminus_borel_ereal] by (simp add: comp_def)
4.1085
4.1086 -lemma (in sigma_algebra) borel_measurable_uminus_eq_ereal[simp]:
4.1087 +lemma borel_measurable_uminus_eq_ereal[simp]:
4.1088 "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" (is "?l = ?r")
4.1089 proof
4.1090 assume ?l from borel_measurable_uminus_ereal[OF this] show ?r by simp
4.1091 qed auto
4.1092
4.1093 -lemma (in sigma_algebra) borel_measurable_eq_atMost_ereal:
4.1094 +lemma borel_measurable_eq_atMost_ereal:
4.1095 fixes f :: "'a \<Rightarrow> ereal"
4.1096 shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {..a} \<inter> space M \<in> sets M)"
4.1097 proof (intro iffI allI)
4.1098 @@ -1244,7 +1085,7 @@
4.1099 qed
4.1100 qed (simp add: measurable_sets)
4.1101
4.1102 -lemma (in sigma_algebra) borel_measurable_eq_atLeast_ereal:
4.1103 +lemma borel_measurable_eq_atLeast_ereal:
4.1104 "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {a..} \<inter> space M \<in> sets M)"
4.1105 proof
4.1106 assume pos: "\<forall>a. f -` {a..} \<inter> space M \<in> sets M"
4.1107 @@ -1255,15 +1096,15 @@
4.1108 then show "f \<in> borel_measurable M" by simp
4.1109 qed (simp add: measurable_sets)
4.1110
4.1111 -lemma (in sigma_algebra) borel_measurable_ereal_iff_less:
4.1112 +lemma borel_measurable_ereal_iff_less:
4.1113 "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {..< a} \<inter> space M \<in> sets M)"
4.1114 unfolding borel_measurable_eq_atLeast_ereal greater_eq_le_measurable ..
4.1115
4.1116 -lemma (in sigma_algebra) borel_measurable_ereal_iff_ge:
4.1117 +lemma borel_measurable_ereal_iff_ge:
4.1118 "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {a <..} \<inter> space M \<in> sets M)"
4.1119 unfolding borel_measurable_eq_atMost_ereal less_eq_ge_measurable ..
4.1120
4.1121 -lemma (in sigma_algebra) borel_measurable_ereal_eq_const:
4.1122 +lemma borel_measurable_ereal_eq_const:
4.1123 fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M"
4.1124 shows "{x\<in>space M. f x = c} \<in> sets M"
4.1125 proof -
4.1126 @@ -1271,7 +1112,7 @@
4.1127 then show ?thesis using assms by (auto intro!: measurable_sets)
4.1128 qed
4.1129
4.1130 -lemma (in sigma_algebra) borel_measurable_ereal_neq_const:
4.1131 +lemma borel_measurable_ereal_neq_const:
4.1132 fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M"
4.1133 shows "{x\<in>space M. f x \<noteq> c} \<in> sets M"
4.1134 proof -
4.1135 @@ -1279,7 +1120,7 @@
4.1136 then show ?thesis using assms by (auto intro!: measurable_sets)
4.1137 qed
4.1138
4.1139 -lemma (in sigma_algebra) borel_measurable_ereal_le[intro,simp]:
4.1140 +lemma borel_measurable_ereal_le[intro,simp]:
4.1141 fixes f g :: "'a \<Rightarrow> ereal"
4.1142 assumes f: "f \<in> borel_measurable M"
4.1143 assumes g: "g \<in> borel_measurable M"
4.1144 @@ -1294,7 +1135,7 @@
4.1145 with f g show ?thesis by (auto intro!: Un simp: measurable_sets)
4.1146 qed
4.1147
4.1148 -lemma (in sigma_algebra) borel_measurable_ereal_less[intro,simp]:
4.1149 +lemma borel_measurable_ereal_less[intro,simp]:
4.1150 fixes f :: "'a \<Rightarrow> ereal"
4.1151 assumes f: "f \<in> borel_measurable M"
4.1152 assumes g: "g \<in> borel_measurable M"
4.1153 @@ -1304,7 +1145,7 @@
4.1154 then show ?thesis using g f by auto
4.1155 qed
4.1156
4.1157 -lemma (in sigma_algebra) borel_measurable_ereal_eq[intro,simp]:
4.1158 +lemma borel_measurable_ereal_eq[intro,simp]:
4.1159 fixes f :: "'a \<Rightarrow> ereal"
4.1160 assumes f: "f \<in> borel_measurable M"
4.1161 assumes g: "g \<in> borel_measurable M"
4.1162 @@ -1314,7 +1155,7 @@
4.1163 then show ?thesis using g f by auto
4.1164 qed
4.1165
4.1166 -lemma (in sigma_algebra) borel_measurable_ereal_neq[intro,simp]:
4.1167 +lemma borel_measurable_ereal_neq[intro,simp]:
4.1168 fixes f :: "'a \<Rightarrow> ereal"
4.1169 assumes f: "f \<in> borel_measurable M"
4.1170 assumes g: "g \<in> borel_measurable M"
4.1171 @@ -1324,12 +1165,12 @@
4.1172 thus ?thesis using f g by auto
4.1173 qed
4.1174
4.1175 -lemma (in sigma_algebra) split_sets:
4.1176 +lemma split_sets:
4.1177 "{x\<in>space M. P x \<or> Q x} = {x\<in>space M. P x} \<union> {x\<in>space M. Q x}"
4.1178 "{x\<in>space M. P x \<and> Q x} = {x\<in>space M. P x} \<inter> {x\<in>space M. Q x}"
4.1179 by auto
4.1180
4.1181 -lemma (in sigma_algebra) borel_measurable_ereal_add[intro, simp]:
4.1182 +lemma borel_measurable_ereal_add[intro, simp]:
4.1183 fixes f :: "'a \<Rightarrow> ereal"
4.1184 assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
4.1185 shows "(\<lambda>x. f x + g x) \<in> borel_measurable M"
4.1186 @@ -1344,7 +1185,7 @@
4.1187 intro!: Un measurable_If measurable_sets)
4.1188 qed
4.1189
4.1190 -lemma (in sigma_algebra) borel_measurable_ereal_setsum[simp, intro]:
4.1191 +lemma borel_measurable_ereal_setsum[simp, intro]:
4.1192 fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal"
4.1193 assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
4.1194 shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
4.1195 @@ -1354,7 +1195,7 @@
4.1196 by induct auto
4.1197 qed (simp add: borel_measurable_const)
4.1198
4.1199 -lemma (in sigma_algebra) borel_measurable_ereal_abs[intro, simp]:
4.1200 +lemma borel_measurable_ereal_abs[intro, simp]:
4.1201 fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M"
4.1202 shows "(\<lambda>x. \<bar>f x\<bar>) \<in> borel_measurable M"
4.1203 proof -
4.1204 @@ -1362,7 +1203,7 @@
4.1205 then show ?thesis using assms by (auto intro!: measurable_If)
4.1206 qed
4.1207
4.1208 -lemma (in sigma_algebra) borel_measurable_ereal_times[intro, simp]:
4.1209 +lemma borel_measurable_ereal_times[intro, simp]:
4.1210 fixes f :: "'a \<Rightarrow> ereal" assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
4.1211 shows "(\<lambda>x. f x * g x) \<in> borel_measurable M"
4.1212 proof -
4.1213 @@ -1386,7 +1227,7 @@
4.1214 (auto simp: split_sets intro!: Int)
4.1215 qed
4.1216
4.1217 -lemma (in sigma_algebra) borel_measurable_ereal_setprod[simp, intro]:
4.1218 +lemma borel_measurable_ereal_setprod[simp, intro]:
4.1219 fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal"
4.1220 assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
4.1221 shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M"
4.1222 @@ -1395,21 +1236,21 @@
4.1223 thus ?thesis using assms by induct auto
4.1224 qed simp
4.1225
4.1226 -lemma (in sigma_algebra) borel_measurable_ereal_min[simp, intro]:
4.1227 +lemma borel_measurable_ereal_min[simp, intro]:
4.1228 fixes f g :: "'a \<Rightarrow> ereal"
4.1229 assumes "f \<in> borel_measurable M"
4.1230 assumes "g \<in> borel_measurable M"
4.1231 shows "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M"
4.1232 using assms unfolding min_def by (auto intro!: measurable_If)
4.1233
4.1234 -lemma (in sigma_algebra) borel_measurable_ereal_max[simp, intro]:
4.1235 +lemma borel_measurable_ereal_max[simp, intro]:
4.1236 fixes f g :: "'a \<Rightarrow> ereal"
4.1237 assumes "f \<in> borel_measurable M"
4.1238 and "g \<in> borel_measurable M"
4.1239 shows "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M"
4.1240 using assms unfolding max_def by (auto intro!: measurable_If)
4.1241
4.1242 -lemma (in sigma_algebra) borel_measurable_SUP[simp, intro]:
4.1243 +lemma borel_measurable_SUP[simp, intro]:
4.1244 fixes f :: "'d\<Colon>countable \<Rightarrow> 'a \<Rightarrow> ereal"
4.1245 assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
4.1246 shows "(\<lambda>x. SUP i : A. f i x) \<in> borel_measurable M" (is "?sup \<in> borel_measurable M")
4.1247 @@ -1422,7 +1263,7 @@
4.1248 using assms by auto
4.1249 qed
4.1250
4.1251 -lemma (in sigma_algebra) borel_measurable_INF[simp, intro]:
4.1252 +lemma borel_measurable_INF[simp, intro]:
4.1253 fixes f :: "'d :: countable \<Rightarrow> 'a \<Rightarrow> ereal"
4.1254 assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
4.1255 shows "(\<lambda>x. INF i : A. f i x) \<in> borel_measurable M" (is "?inf \<in> borel_measurable M")
4.1256 @@ -1435,26 +1276,39 @@
4.1257 using assms by auto
4.1258 qed
4.1259
4.1260 -lemma (in sigma_algebra) borel_measurable_liminf[simp, intro]:
4.1261 +lemma borel_measurable_liminf[simp, intro]:
4.1262 fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
4.1263 assumes "\<And>i. f i \<in> borel_measurable M"
4.1264 shows "(\<lambda>x. liminf (\<lambda>i. f i x)) \<in> borel_measurable M"
4.1265 unfolding liminf_SUPR_INFI using assms by auto
4.1266
4.1267 -lemma (in sigma_algebra) borel_measurable_limsup[simp, intro]:
4.1268 +lemma borel_measurable_limsup[simp, intro]:
4.1269 fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
4.1270 assumes "\<And>i. f i \<in> borel_measurable M"
4.1271 shows "(\<lambda>x. limsup (\<lambda>i. f i x)) \<in> borel_measurable M"
4.1272 unfolding limsup_INFI_SUPR using assms by auto
4.1273
4.1274 -lemma (in sigma_algebra) borel_measurable_ereal_diff[simp, intro]:
4.1275 +lemma borel_measurable_ereal_diff[simp, intro]:
4.1276 fixes f g :: "'a \<Rightarrow> ereal"
4.1277 assumes "f \<in> borel_measurable M"
4.1278 assumes "g \<in> borel_measurable M"
4.1279 shows "(\<lambda>x. f x - g x) \<in> borel_measurable M"
4.1280 unfolding minus_ereal_def using assms by auto
4.1281
4.1282 -lemma (in sigma_algebra) borel_measurable_psuminf[simp, intro]:
4.1283 +lemma borel_measurable_ereal_inverse[simp, intro]:
4.1284 + assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. inverse (f x) :: ereal) \<in> borel_measurable M"
4.1285 +proof -
4.1286 + { fix x have "inverse (f x) = (if f x = 0 then \<infinity> else ereal (inverse (real (f x))))"
4.1287 + by (cases "f x") auto }
4.1288 + with f show ?thesis
4.1289 + by (auto intro!: measurable_If)
4.1290 +qed
4.1291 +
4.1292 +lemma borel_measurable_ereal_divide[simp, intro]:
4.1293 + "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. f x / g x :: ereal) \<in> borel_measurable M"
4.1294 + unfolding divide_ereal_def by auto
4.1295 +
4.1296 +lemma borel_measurable_psuminf[simp, intro]:
4.1297 fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
4.1298 assumes "\<And>i. f i \<in> borel_measurable M" and pos: "\<And>i x. x \<in> space M \<Longrightarrow> 0 \<le> f i x"
4.1299 shows "(\<lambda>x. (\<Sum>i. f i x)) \<in> borel_measurable M"
4.1300 @@ -1465,7 +1319,7 @@
4.1301
4.1302 section "LIMSEQ is borel measurable"
4.1303
4.1304 -lemma (in sigma_algebra) borel_measurable_LIMSEQ:
4.1305 +lemma borel_measurable_LIMSEQ:
4.1306 fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> real"
4.1307 assumes u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"
4.1308 and u: "\<And>i. u i \<in> borel_measurable M"
5.1 --- a/src/HOL/Probability/Caratheodory.thy Mon Apr 23 12:23:23 2012 +0100
5.2 +++ b/src/HOL/Probability/Caratheodory.thy Mon Apr 23 12:14:35 2012 +0200
5.3 @@ -6,7 +6,7 @@
5.4 header {*Caratheodory Extension Theorem*}
5.5
5.6 theory Caratheodory
5.7 -imports Sigma_Algebra "~~/src/HOL/Multivariate_Analysis/Extended_Real_Limits"
5.8 + imports Measure_Space
5.9 begin
5.10
5.11 lemma sums_def2:
5.12 @@ -53,128 +53,53 @@
5.13
5.14 subsection {* Measure Spaces *}
5.15
5.16 -record 'a measure_space = "'a algebra" +
5.17 - measure :: "'a set \<Rightarrow> ereal"
5.18 -
5.19 -definition positive where "positive M f \<longleftrightarrow> f {} = (0::ereal) \<and> (\<forall>A\<in>sets M. 0 \<le> f A)"
5.20 -
5.21 -definition additive where "additive M f \<longleftrightarrow>
5.22 - (\<forall>x \<in> sets M. \<forall>y \<in> sets M. x \<inter> y = {} \<longrightarrow> f (x \<union> y) = f x + f y)"
5.23 -
5.24 -definition countably_additive :: "('a, 'b) algebra_scheme \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
5.25 - "countably_additive M f \<longleftrightarrow> (\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> sets M \<longrightarrow>
5.26 - (\<Sum>i. f (A i)) = f (\<Union>i. A i))"
5.27 -
5.28 -definition increasing where "increasing M f \<longleftrightarrow>
5.29 - (\<forall>x \<in> sets M. \<forall>y \<in> sets M. x \<subseteq> y \<longrightarrow> f x \<le> f y)"
5.30 -
5.31 definition subadditive where "subadditive M f \<longleftrightarrow>
5.32 - (\<forall>x \<in> sets M. \<forall>y \<in> sets M. x \<inter> y = {} \<longrightarrow> f (x \<union> y) \<le> f x + f y)"
5.33 + (\<forall>x\<in>M. \<forall>y\<in>M. x \<inter> y = {} \<longrightarrow> f (x \<union> y) \<le> f x + f y)"
5.34
5.35 definition countably_subadditive where "countably_subadditive M f \<longleftrightarrow>
5.36 - (\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> sets M \<longrightarrow>
5.37 + (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow>
5.38 (f (\<Union>i. A i) \<le> (\<Sum>i. f (A i))))"
5.39
5.40 -definition lambda_system where "lambda_system M f = {l \<in> sets M.
5.41 - \<forall>x \<in> sets M. f (l \<inter> x) + f ((space M - l) \<inter> x) = f x}"
5.42 +definition lambda_system where "lambda_system \<Omega> M f = {l \<in> M.
5.43 + \<forall>x \<in> M. f (l \<inter> x) + f ((\<Omega> - l) \<inter> x) = f x}"
5.44
5.45 definition outer_measure_space where "outer_measure_space M f \<longleftrightarrow>
5.46 positive M f \<and> increasing M f \<and> countably_subadditive M f"
5.47
5.48 definition measure_set where "measure_set M f X = {r.
5.49 - \<exists>A. range A \<subseteq> sets M \<and> disjoint_family A \<and> X \<subseteq> (\<Union>i. A i) \<and> (\<Sum>i. f (A i)) = r}"
5.50 -
5.51 -locale measure_space = sigma_algebra M for M :: "('a, 'b) measure_space_scheme" +
5.52 - assumes measure_positive: "positive M (measure M)"
5.53 - and ca: "countably_additive M (measure M)"
5.54 -
5.55 -abbreviation (in measure_space) "\<mu> \<equiv> measure M"
5.56 -
5.57 -lemma (in measure_space)
5.58 - shows empty_measure[simp, intro]: "\<mu> {} = 0"
5.59 - and positive_measure[simp, intro!]: "\<And>A. A \<in> sets M \<Longrightarrow> 0 \<le> \<mu> A"
5.60 - using measure_positive unfolding positive_def by auto
5.61 -
5.62 -lemma increasingD:
5.63 - "increasing M f \<Longrightarrow> x \<subseteq> y \<Longrightarrow> x\<in>sets M \<Longrightarrow> y\<in>sets M \<Longrightarrow> f x \<le> f y"
5.64 - by (auto simp add: increasing_def)
5.65 + \<exists>A. range A \<subseteq> M \<and> disjoint_family A \<and> X \<subseteq> (\<Union>i. A i) \<and> (\<Sum>i. f (A i)) = r}"
5.66
5.67 lemma subadditiveD:
5.68 - "subadditive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x \<in> sets M \<Longrightarrow> y \<in> sets M
5.69 - \<Longrightarrow> f (x \<union> y) \<le> f x + f y"
5.70 + "subadditive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x \<in> M \<Longrightarrow> y \<in> M \<Longrightarrow> f (x \<union> y) \<le> f x + f y"
5.71 by (auto simp add: subadditive_def)
5.72
5.73 -lemma additiveD:
5.74 - "additive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x \<in> sets M \<Longrightarrow> y \<in> sets M
5.75 - \<Longrightarrow> f (x \<union> y) = f x + f y"
5.76 - by (auto simp add: additive_def)
5.77 -
5.78 -lemma countably_additiveI:
5.79 - assumes "\<And>A x. range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i. A i) \<in> sets M
5.80 - \<Longrightarrow> (\<Sum>i. f (A i)) = f (\<Union>i. A i)"
5.81 - shows "countably_additive M f"
5.82 - using assms by (simp add: countably_additive_def)
5.83 -
5.84 -section "Extend binary sets"
5.85 -
5.86 -lemma LIMSEQ_binaryset:
5.87 - assumes f: "f {} = 0"
5.88 - shows "(\<lambda>n. \<Sum>i<n. f (binaryset A B i)) ----> f A + f B"
5.89 -proof -
5.90 - have "(\<lambda>n. \<Sum>i < Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)"
5.91 - proof
5.92 - fix n
5.93 - show "(\<Sum>i < Suc (Suc n). f (binaryset A B i)) = f A + f B"
5.94 - by (induct n) (auto simp add: binaryset_def f)
5.95 - qed
5.96 - moreover
5.97 - have "... ----> f A + f B" by (rule tendsto_const)
5.98 - ultimately
5.99 - have "(\<lambda>n. \<Sum>i< Suc (Suc n). f (binaryset A B i)) ----> f A + f B"
5.100 - by metis
5.101 - hence "(\<lambda>n. \<Sum>i< n+2. f (binaryset A B i)) ----> f A + f B"
5.102 - by simp
5.103 - thus ?thesis by (rule LIMSEQ_offset [where k=2])
5.104 -qed
5.105 -
5.106 -lemma binaryset_sums:
5.107 - assumes f: "f {} = 0"
5.108 - shows "(\<lambda>n. f (binaryset A B n)) sums (f A + f B)"
5.109 - by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f] atLeast0LessThan)
5.110 -
5.111 -lemma suminf_binaryset_eq:
5.112 - fixes f :: "'a set \<Rightarrow> 'b::{comm_monoid_add, t2_space}"
5.113 - shows "f {} = 0 \<Longrightarrow> (\<Sum>n. f (binaryset A B n)) = f A + f B"
5.114 - by (metis binaryset_sums sums_unique)
5.115 -
5.116 subsection {* Lambda Systems *}
5.117
5.118 lemma (in algebra) lambda_system_eq:
5.119 - shows "lambda_system M f = {l \<in> sets M.
5.120 - \<forall>x \<in> sets M. f (x \<inter> l) + f (x - l) = f x}"
5.121 + shows "lambda_system \<Omega> M f = {l \<in> M. \<forall>x \<in> M. f (x \<inter> l) + f (x - l) = f x}"
5.122 proof -
5.123 - have [simp]: "!!l x. l \<in> sets M \<Longrightarrow> x \<in> sets M \<Longrightarrow> (space M - l) \<inter> x = x - l"
5.124 + have [simp]: "!!l x. l \<in> M \<Longrightarrow> x \<in> M \<Longrightarrow> (\<Omega> - l) \<inter> x = x - l"
5.125 by (metis Int_Diff Int_absorb1 Int_commute sets_into_space)
5.126 show ?thesis
5.127 by (auto simp add: lambda_system_def) (metis Int_commute)+
5.128 qed
5.129
5.130 lemma (in algebra) lambda_system_empty:
5.131 - "positive M f \<Longrightarrow> {} \<in> lambda_system M f"
5.132 + "positive M f \<Longrightarrow> {} \<in> lambda_system \<Omega> M f"
5.133 by (auto simp add: positive_def lambda_system_eq)
5.134
5.135 lemma lambda_system_sets:
5.136 - "x \<in> lambda_system M f \<Longrightarrow> x \<in> sets M"
5.137 + "x \<in> lambda_system \<Omega> M f \<Longrightarrow> x \<in> M"
5.138 by (simp add: lambda_system_def)
5.139
5.140 lemma (in algebra) lambda_system_Compl:
5.141 fixes f:: "'a set \<Rightarrow> ereal"
5.142 - assumes x: "x \<in> lambda_system M f"
5.143 - shows "space M - x \<in> lambda_system M f"
5.144 + assumes x: "x \<in> lambda_system \<Omega> M f"
5.145 + shows "\<Omega> - x \<in> lambda_system \<Omega> M f"
5.146 proof -
5.147 - have "x \<subseteq> space M"
5.148 + have "x \<subseteq> \<Omega>"
5.149 by (metis sets_into_space lambda_system_sets x)
5.150 - hence "space M - (space M - x) = x"
5.151 + hence "\<Omega> - (\<Omega> - x) = x"
5.152 by (metis double_diff equalityE)
5.153 with x show ?thesis
5.154 by (force simp add: lambda_system_def ac_simps)
5.155 @@ -182,16 +107,16 @@
5.156
5.157 lemma (in algebra) lambda_system_Int:
5.158 fixes f:: "'a set \<Rightarrow> ereal"
5.159 - assumes xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
5.160 - shows "x \<inter> y \<in> lambda_system M f"
5.161 + assumes xl: "x \<in> lambda_system \<Omega> M f" and yl: "y \<in> lambda_system \<Omega> M f"
5.162 + shows "x \<inter> y \<in> lambda_system \<Omega> M f"
5.163 proof -
5.164 from xl yl show ?thesis
5.165 proof (auto simp add: positive_def lambda_system_eq Int)
5.166 fix u
5.167 - assume x: "x \<in> sets M" and y: "y \<in> sets M" and u: "u \<in> sets M"
5.168 - and fx: "\<forall>z\<in>sets M. f (z \<inter> x) + f (z - x) = f z"
5.169 - and fy: "\<forall>z\<in>sets M. f (z \<inter> y) + f (z - y) = f z"
5.170 - have "u - x \<inter> y \<in> sets M"
5.171 + assume x: "x \<in> M" and y: "y \<in> M" and u: "u \<in> M"
5.172 + and fx: "\<forall>z\<in>M. f (z \<inter> x) + f (z - x) = f z"
5.173 + and fy: "\<forall>z\<in>M. f (z \<inter> y) + f (z - y) = f z"
5.174 + have "u - x \<inter> y \<in> M"
5.175 by (metis Diff Diff_Int Un u x y)
5.176 moreover
5.177 have "(u - (x \<inter> y)) \<inter> y = u \<inter> y - x" by blast
5.178 @@ -216,20 +141,20 @@
5.179
5.180 lemma (in algebra) lambda_system_Un:
5.181 fixes f:: "'a set \<Rightarrow> ereal"
5.182 - assumes xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
5.183 - shows "x \<union> y \<in> lambda_system M f"
5.184 + assumes xl: "x \<in> lambda_system \<Omega> M f" and yl: "y \<in> lambda_system \<Omega> M f"
5.185 + shows "x \<union> y \<in> lambda_system \<Omega> M f"
5.186 proof -
5.187 - have "(space M - x) \<inter> (space M - y) \<in> sets M"
5.188 + have "(\<Omega> - x) \<inter> (\<Omega> - y) \<in> M"
5.189 by (metis Diff_Un Un compl_sets lambda_system_sets xl yl)
5.190 moreover
5.191 - have "x \<union> y = space M - ((space M - x) \<inter> (space M - y))"
5.192 + have "x \<union> y = \<Omega> - ((\<Omega> - x) \<inter> (\<Omega> - y))"
5.193 by auto (metis subsetD lambda_system_sets sets_into_space xl yl)+
5.194 ultimately show ?thesis
5.195 by (metis lambda_system_Compl lambda_system_Int xl yl)
5.196 qed
5.197
5.198 lemma (in algebra) lambda_system_algebra:
5.199 - "positive M f \<Longrightarrow> algebra (M\<lparr>sets := lambda_system M f\<rparr>)"
5.200 + "positive M f \<Longrightarrow> algebra \<Omega> (lambda_system \<Omega> M f)"
5.201 apply (auto simp add: algebra_iff_Un)
5.202 apply (metis lambda_system_sets set_mp sets_into_space)
5.203 apply (metis lambda_system_empty)
5.204 @@ -238,117 +163,62 @@
5.205 done
5.206
5.207 lemma (in algebra) lambda_system_strong_additive:
5.208 - assumes z: "z \<in> sets M" and disj: "x \<inter> y = {}"
5.209 - and xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
5.210 + assumes z: "z \<in> M" and disj: "x \<inter> y = {}"
5.211 + and xl: "x \<in> lambda_system \<Omega> M f" and yl: "y \<in> lambda_system \<Omega> M f"
5.212 shows "f (z \<inter> (x \<union> y)) = f (z \<inter> x) + f (z \<inter> y)"
5.213 proof -
5.214 have "z \<inter> x = (z \<inter> (x \<union> y)) \<inter> x" using disj by blast
5.215 moreover
5.216 have "z \<inter> y = (z \<inter> (x \<union> y)) - x" using disj by blast
5.217 moreover
5.218 - have "(z \<inter> (x \<union> y)) \<in> sets M"
5.219 + have "(z \<inter> (x \<union> y)) \<in> M"
5.220 by (metis Int Un lambda_system_sets xl yl z)
5.221 ultimately show ?thesis using xl yl
5.222 by (simp add: lambda_system_eq)
5.223 qed
5.224
5.225 -lemma (in algebra) lambda_system_additive:
5.226 - "additive (M (|sets := lambda_system M f|)) f"
5.227 +lemma (in algebra) lambda_system_additive: "additive (lambda_system \<Omega> M f) f"
5.228 proof (auto simp add: additive_def)
5.229 fix x and y
5.230 assume disj: "x \<inter> y = {}"
5.231 - and xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
5.232 - hence "x \<in> sets M" "y \<in> sets M" by (blast intro: lambda_system_sets)+
5.233 + and xl: "x \<in> lambda_system \<Omega> M f" and yl: "y \<in> lambda_system \<Omega> M f"
5.234 + hence "x \<in> M" "y \<in> M" by (blast intro: lambda_system_sets)+
5.235 thus "f (x \<union> y) = f x + f y"
5.236 using lambda_system_strong_additive [OF top disj xl yl]
5.237 by (simp add: Un)
5.238 qed
5.239
5.240 -lemma (in ring_of_sets) disjointed_additive:
5.241 - assumes f: "positive M f" "additive M f" and A: "range A \<subseteq> sets M" "incseq A"
5.242 - shows "(\<Sum>i\<le>n. f (disjointed A i)) = f (A n)"
5.243 -proof (induct n)
5.244 - case (Suc n)
5.245 - then have "(\<Sum>i\<le>Suc n. f (disjointed A i)) = f (A n) + f (disjointed A (Suc n))"
5.246 - by simp
5.247 - also have "\<dots> = f (A n \<union> disjointed A (Suc n))"
5.248 - using A by (subst f(2)[THEN additiveD]) (auto simp: disjointed_incseq)
5.249 - also have "A n \<union> disjointed A (Suc n) = A (Suc n)"
5.250 - using `incseq A` by (auto dest: incseq_SucD simp: disjointed_incseq)
5.251 - finally show ?case .
5.252 -qed simp
5.253 -
5.254 lemma (in ring_of_sets) countably_subadditive_subadditive:
5.255 assumes f: "positive M f" and cs: "countably_subadditive M f"
5.256 shows "subadditive M f"
5.257 proof (auto simp add: subadditive_def)
5.258 fix x y
5.259 - assume x: "x \<in> sets M" and y: "y \<in> sets M" and "x \<inter> y = {}"
5.260 + assume x: "x \<in> M" and y: "y \<in> M" and "x \<inter> y = {}"
5.261 hence "disjoint_family (binaryset x y)"
5.262 by (auto simp add: disjoint_family_on_def binaryset_def)
5.263 - hence "range (binaryset x y) \<subseteq> sets M \<longrightarrow>
5.264 - (\<Union>i. binaryset x y i) \<in> sets M \<longrightarrow>
5.265 + hence "range (binaryset x y) \<subseteq> M \<longrightarrow>
5.266 + (\<Union>i. binaryset x y i) \<in> M \<longrightarrow>
5.267 f (\<Union>i. binaryset x y i) \<le> (\<Sum> n. f (binaryset x y n))"
5.268 using cs by (auto simp add: countably_subadditive_def)
5.269 - hence "{x,y,{}} \<subseteq> sets M \<longrightarrow> x \<union> y \<in> sets M \<longrightarrow>
5.270 + hence "{x,y,{}} \<subseteq> M \<longrightarrow> x \<union> y \<in> M \<longrightarrow>
5.271 f (x \<union> y) \<le> (\<Sum> n. f (binaryset x y n))"
5.272 by (simp add: range_binaryset_eq UN_binaryset_eq)
5.273 thus "f (x \<union> y) \<le> f x + f y" using f x y
5.274 by (auto simp add: Un o_def suminf_binaryset_eq positive_def)
5.275 qed
5.276
5.277 -lemma (in ring_of_sets) additive_sum:
5.278 - fixes A:: "nat \<Rightarrow> 'a set"
5.279 - assumes f: "positive M f" and ad: "additive M f" and "finite S"
5.280 - and A: "range A \<subseteq> sets M"
5.281 - and disj: "disjoint_family_on A S"
5.282 - shows "(\<Sum>i\<in>S. f (A i)) = f (\<Union>i\<in>S. A i)"
5.283 -using `finite S` disj proof induct
5.284 - case empty show ?case using f by (simp add: positive_def)
5.285 -next
5.286 - case (insert s S)
5.287 - then have "A s \<inter> (\<Union>i\<in>S. A i) = {}"
5.288 - by (auto simp add: disjoint_family_on_def neq_iff)
5.289 - moreover
5.290 - have "A s \<in> sets M" using A by blast
5.291 - moreover have "(\<Union>i\<in>S. A i) \<in> sets M"
5.292 - using A `finite S` by auto
5.293 - moreover
5.294 - ultimately have "f (A s \<union> (\<Union>i\<in>S. A i)) = f (A s) + f(\<Union>i\<in>S. A i)"
5.295 - using ad UNION_in_sets A by (auto simp add: additive_def)
5.296 - with insert show ?case using ad disjoint_family_on_mono[of S "insert s S" A]
5.297 - by (auto simp add: additive_def subset_insertI)
5.298 -qed
5.299 -
5.300 -lemma (in algebra) increasing_additive_bound:
5.301 - fixes A:: "nat \<Rightarrow> 'a set" and f :: "'a set \<Rightarrow> ereal"
5.302 - assumes f: "positive M f" and ad: "additive M f"
5.303 - and inc: "increasing M f"
5.304 - and A: "range A \<subseteq> sets M"
5.305 - and disj: "disjoint_family A"
5.306 - shows "(\<Sum>i. f (A i)) \<le> f (space M)"
5.307 -proof (safe intro!: suminf_bound)
5.308 - fix N
5.309 - note disj_N = disjoint_family_on_mono[OF _ disj, of "{..<N}"]
5.310 - have "(\<Sum>i<N. f (A i)) = f (\<Union>i\<in>{..<N}. A i)"
5.311 - by (rule additive_sum [OF f ad _ A]) (auto simp: disj_N)
5.312 - also have "... \<le> f (space M)" using space_closed A
5.313 - by (intro increasingD[OF inc] finite_UN) auto
5.314 - finally show "(\<Sum>i<N. f (A i)) \<le> f (space M)" by simp
5.315 -qed (insert f A, auto simp: positive_def)
5.316 -
5.317 lemma lambda_system_increasing:
5.318 - "increasing M f \<Longrightarrow> increasing (M (|sets := lambda_system M f|)) f"
5.319 + "increasing M f \<Longrightarrow> increasing (lambda_system \<Omega> M f) f"
5.320 by (simp add: increasing_def lambda_system_def)
5.321
5.322 lemma lambda_system_positive:
5.323 - "positive M f \<Longrightarrow> positive (M (|sets := lambda_system M f|)) f"
5.324 + "positive M f \<Longrightarrow> positive (lambda_system \<Omega> M f) f"
5.325 by (simp add: positive_def lambda_system_def)
5.326
5.327 lemma (in algebra) lambda_system_strong_sum:
5.328 fixes A:: "nat \<Rightarrow> 'a set" and f :: "'a set \<Rightarrow> ereal"
5.329 - assumes f: "positive M f" and a: "a \<in> sets M"
5.330 - and A: "range A \<subseteq> lambda_system M f"
5.331 + assumes f: "positive M f" and a: "a \<in> M"
5.332 + and A: "range A \<subseteq> lambda_system \<Omega> M f"
5.333 and disj: "disjoint_family A"
5.334 shows "(\<Sum>i = 0..<n. f (a \<inter>A i)) = f (a \<inter> (\<Union>i\<in>{0..<n}. A i))"
5.335 proof (induct n)
5.336 @@ -357,11 +227,11 @@
5.337 case (Suc n)
5.338 have 2: "A n \<inter> UNION {0..<n} A = {}" using disj
5.339 by (force simp add: disjoint_family_on_def neq_iff)
5.340 - have 3: "A n \<in> lambda_system M f" using A
5.341 + have 3: "A n \<in> lambda_system \<Omega> M f" using A
5.342 by blast
5.343 - interpret l: algebra "M\<lparr>sets := lambda_system M f\<rparr>"
5.344 + interpret l: algebra \<Omega> "lambda_system \<Omega> M f"
5.345 using f by (rule lambda_system_algebra)
5.346 - have 4: "UNION {0..<n} A \<in> lambda_system M f"
5.347 + have 4: "UNION {0..<n} A \<in> lambda_system \<Omega> M f"
5.348 using A l.UNION_in_sets by simp
5.349 from Suc.hyps show ?case
5.350 by (simp add: atLeastLessThanSuc lambda_system_strong_additive [OF a 2 3 4])
5.351 @@ -369,23 +239,23 @@
5.352
5.353 lemma (in sigma_algebra) lambda_system_caratheodory:
5.354 assumes oms: "outer_measure_space M f"
5.355 - and A: "range A \<subseteq> lambda_system M f"
5.356 + and A: "range A \<subseteq> lambda_system \<Omega> M f"
5.357 and disj: "disjoint_family A"
5.358 - shows "(\<Union>i. A i) \<in> lambda_system M f \<and> (\<Sum>i. f (A i)) = f (\<Union>i. A i)"
5.359 + shows "(\<Union>i. A i) \<in> lambda_system \<Omega> M f \<and> (\<Sum>i. f (A i)) = f (\<Union>i. A i)"
5.360 proof -
5.361 have pos: "positive M f" and inc: "increasing M f"
5.362 and csa: "countably_subadditive M f"
5.363 by (metis oms outer_measure_space_def)+
5.364 have sa: "subadditive M f"
5.365 by (metis countably_subadditive_subadditive csa pos)
5.366 - have A': "range A \<subseteq> sets (M(|sets := lambda_system M f|))" using A
5.367 - by simp
5.368 - interpret ls: algebra "M\<lparr>sets := lambda_system M f\<rparr>"
5.369 + have A': "\<And>S. A`S \<subseteq> (lambda_system \<Omega> M f)" using A
5.370 + by auto
5.371 + interpret ls: algebra \<Omega> "lambda_system \<Omega> M f"
5.372 using pos by (rule lambda_system_algebra)
5.373 - have A'': "range A \<subseteq> sets M"
5.374 + have A'': "range A \<subseteq> M"
5.375 by (metis A image_subset_iff lambda_system_sets)
5.376
5.377 - have U_in: "(\<Union>i. A i) \<in> sets M"
5.378 + have U_in: "(\<Union>i. A i) \<in> M"
5.379 by (metis A'' countable_UN)
5.380 have U_eq: "f (\<Union>i. A i) = (\<Sum>i. f (A i))"
5.381 proof (rule antisym)
5.382 @@ -396,22 +266,22 @@
5.383 show "(\<Sum>i. f (A i)) \<le> f (\<Union>i. A i)"
5.384 using ls.additive_sum [OF lambda_system_positive[OF pos] lambda_system_additive _ A' dis]
5.385 using A''
5.386 - by (intro suminf_bound[OF _ *]) (auto intro!: increasingD[OF inc] allI countable_UN)
5.387 + by (intro suminf_bound[OF _ *]) (auto intro!: increasingD[OF inc] countable_UN)
5.388 qed
5.389 {
5.390 fix a
5.391 - assume a [iff]: "a \<in> sets M"
5.392 + assume a [iff]: "a \<in> M"
5.393 have "f (a \<inter> (\<Union>i. A i)) + f (a - (\<Union>i. A i)) = f a"
5.394 proof -
5.395 show ?thesis
5.396 proof (rule antisym)
5.397 - have "range (\<lambda>i. a \<inter> A i) \<subseteq> sets M" using A''
5.398 + have "range (\<lambda>i. a \<inter> A i) \<subseteq> M" using A''
5.399 by blast
5.400 moreover
5.401 have "disjoint_family (\<lambda>i. a \<inter> A i)" using disj
5.402 by (auto simp add: disjoint_family_on_def)
5.403 moreover
5.404 - have "a \<inter> (\<Union>i. A i) \<in> sets M"
5.405 + have "a \<inter> (\<Union>i. A i) \<in> M"
5.406 by (metis Int U_in a)
5.407 ultimately
5.408 have "f (a \<inter> (\<Union>i. A i)) \<le> (\<Sum>i. f (a \<inter> A i))"
5.409 @@ -424,11 +294,11 @@
5.410 have "(\<Sum>i. f (a \<inter> A i)) + f (a - (\<Union>i. A i)) \<le> f a"
5.411 proof (intro suminf_bound_add allI)
5.412 fix n
5.413 - have UNION_in: "(\<Union>i\<in>{0..<n}. A i) \<in> sets M"
5.414 + have UNION_in: "(\<Union>i\<in>{0..<n}. A i) \<in> M"
5.415 by (metis A'' UNION_in_sets)
5.416 have le_fa: "f (UNION {0..<n} A \<inter> a) \<le> f a" using A''
5.417 by (blast intro: increasingD [OF inc] A'' UNION_in_sets)
5.418 - have ls: "(\<Union>i\<in>{0..<n}. A i) \<in> lambda_system M f"
5.419 + have ls: "(\<Union>i\<in>{0..<n}. A i) \<in> lambda_system \<Omega> M f"
5.420 using ls.UNION_in_sets by (simp add: A)
5.421 hence eq_fa: "f a = f (a \<inter> (\<Union>i\<in>{0..<n}. A i)) + f (a - (\<Union>i\<in>{0..<n}. A i))"
5.422 by (simp add: lambda_system_eq UNION_in)
5.423 @@ -437,9 +307,9 @@
5.424 thus "(\<Sum>i<n. f (a \<inter> A i)) + f (a - (\<Union>i. A i)) \<le> f a"
5.425 by (simp add: lambda_system_strong_sum pos A disj eq_fa add_left_mono atLeast0LessThan[symmetric])
5.426 next
5.427 - have "\<And>i. a \<inter> A i \<in> sets M" using A'' by auto
5.428 + have "\<And>i. a \<inter> A i \<in> M" using A'' by auto
5.429 then show "\<And>i. 0 \<le> f (a \<inter> A i)" using pos[unfolded positive_def] by auto
5.430 - have "\<And>i. a - (\<Union>i. A i) \<in> sets M" using A'' by auto
5.431 + have "\<And>i. a - (\<Union>i. A i) \<in> M" using A'' by auto
5.432 then have "\<And>i. 0 \<le> f (a - (\<Union>i. A i))" using pos[unfolded positive_def] by auto
5.433 then show "f (a - (\<Union>i. A i)) \<noteq> -\<infinity>" by auto
5.434 qed
5.435 @@ -460,66 +330,29 @@
5.436
5.437 lemma (in sigma_algebra) caratheodory_lemma:
5.438 assumes oms: "outer_measure_space M f"
5.439 - shows "measure_space \<lparr> space = space M, sets = lambda_system M f, measure = f \<rparr>"
5.440 - (is "measure_space ?M")
5.441 + defines "L \<equiv> lambda_system \<Omega> M f"
5.442 + shows "measure_space \<Omega> L f"
5.443 proof -
5.444 have pos: "positive M f"
5.445 by (metis oms outer_measure_space_def)
5.446 - have alg: "algebra ?M"
5.447 + have alg: "algebra \<Omega> L"
5.448 using lambda_system_algebra [of f, OF pos]
5.449 - by (simp add: algebra_iff_Un)
5.450 + by (simp add: algebra_iff_Un L_def)
5.451 then
5.452 - have "sigma_algebra ?M"
5.453 + have "sigma_algebra \<Omega> L"
5.454 using lambda_system_caratheodory [OF oms]
5.455 - by (simp add: sigma_algebra_disjoint_iff)
5.456 + by (simp add: sigma_algebra_disjoint_iff L_def)
5.457 moreover
5.458 - have "measure_space_axioms ?M"
5.459 + have "countably_additive L f" "positive L f"
5.460 using pos lambda_system_caratheodory [OF oms]
5.461 - by (simp add: measure_space_axioms_def positive_def lambda_system_sets
5.462 - countably_additive_def o_def)
5.463 + by (auto simp add: lambda_system_sets L_def countably_additive_def positive_def)
5.464 ultimately
5.465 show ?thesis
5.466 - by (simp add: measure_space_def)
5.467 -qed
5.468 -
5.469 -lemma (in ring_of_sets) additive_increasing:
5.470 - assumes posf: "positive M f" and addf: "additive M f"
5.471 - shows "increasing M f"
5.472 -proof (auto simp add: increasing_def)
5.473 - fix x y
5.474 - assume xy: "x \<in> sets M" "y \<in> sets M" "x \<subseteq> y"
5.475 - then have "y - x \<in> sets M" by auto
5.476 - then have "0 \<le> f (y-x)" using posf[unfolded positive_def] by auto
5.477 - then have "f x + 0 \<le> f x + f (y-x)" by (intro add_left_mono) auto
5.478 - also have "... = f (x \<union> (y-x))" using addf
5.479 - by (auto simp add: additive_def) (metis Diff_disjoint Un_Diff_cancel Diff xy(1,2))
5.480 - also have "... = f y"
5.481 - by (metis Un_Diff_cancel Un_absorb1 xy(3))
5.482 - finally show "f x \<le> f y" by simp
5.483 -qed
5.484 -
5.485 -lemma (in ring_of_sets) countably_additive_additive:
5.486 - assumes posf: "positive M f" and ca: "countably_additive M f"
5.487 - shows "additive M f"
5.488 -proof (auto simp add: additive_def)
5.489 - fix x y
5.490 - assume x: "x \<in> sets M" and y: "y \<in> sets M" and "x \<inter> y = {}"
5.491 - hence "disjoint_family (binaryset x y)"
5.492 - by (auto simp add: disjoint_family_on_def binaryset_def)
5.493 - hence "range (binaryset x y) \<subseteq> sets M \<longrightarrow>
5.494 - (\<Union>i. binaryset x y i) \<in> sets M \<longrightarrow>
5.495 - f (\<Union>i. binaryset x y i) = (\<Sum> n. f (binaryset x y n))"
5.496 - using ca
5.497 - by (simp add: countably_additive_def)
5.498 - hence "{x,y,{}} \<subseteq> sets M \<longrightarrow> x \<union> y \<in> sets M \<longrightarrow>
5.499 - f (x \<union> y) = (\<Sum>n. f (binaryset x y n))"
5.500 - by (simp add: range_binaryset_eq UN_binaryset_eq)
5.501 - thus "f (x \<union> y) = f x + f y" using posf x y
5.502 - by (auto simp add: Un suminf_binaryset_eq positive_def)
5.503 + using pos by (simp add: measure_space_def)
5.504 qed
5.505
5.506 lemma inf_measure_nonempty:
5.507 - assumes f: "positive M f" and b: "b \<in> sets M" and a: "a \<subseteq> b" "{} \<in> sets M"
5.508 + assumes f: "positive M f" and b: "b \<in> M" and a: "a \<subseteq> b" "{} \<in> M"
5.509 shows "f b \<in> measure_set M f a"
5.510 proof -
5.511 let ?A = "\<lambda>i::nat. (if i = 0 then b else {})"
5.512 @@ -534,14 +367,14 @@
5.513
5.514 lemma (in ring_of_sets) inf_measure_agrees:
5.515 assumes posf: "positive M f" and ca: "countably_additive M f"
5.516 - and s: "s \<in> sets M"
5.517 + and s: "s \<in> M"
5.518 shows "Inf (measure_set M f s) = f s"
5.519 unfolding Inf_ereal_def
5.520 proof (safe intro!: Greatest_equality)
5.521 fix z
5.522 assume z: "z \<in> measure_set M f s"
5.523 from this obtain A where
5.524 - A: "range A \<subseteq> sets M" and disj: "disjoint_family A"
5.525 + A: "range A \<subseteq> M" and disj: "disjoint_family A"
5.526 and "s \<subseteq> (\<Union>x. A x)" and si: "(\<Sum>i. f (A i)) = z"
5.527 by (auto simp add: measure_set_def comp_def)
5.528 hence seq: "s = (\<Union>i. A i \<inter> s)" by blast
5.529 @@ -549,11 +382,11 @@
5.530 by (metis additive_increasing ca countably_additive_additive posf)
5.531 have sums: "(\<Sum>i. f (A i \<inter> s)) = f (\<Union>i. A i \<inter> s)"
5.532 proof (rule ca[unfolded countably_additive_def, rule_format])
5.533 - show "range (\<lambda>n. A n \<inter> s) \<subseteq> sets M" using A s
5.534 + show "range (\<lambda>n. A n \<inter> s) \<subseteq> M" using A s
5.535 by blast
5.536 show "disjoint_family (\<lambda>n. A n \<inter> s)" using disj
5.537 by (auto simp add: disjoint_family_on_def)
5.538 - show "(\<Union>i. A i \<inter> s) \<in> sets M" using A s
5.539 + show "(\<Union>i. A i \<inter> s) \<in> M" using A s
5.540 by (metis UN_extend_simps(4) s seq)
5.541 qed
5.542 hence "f s = (\<Sum>i. f (A i \<inter> s))"
5.543 @@ -562,7 +395,7 @@
5.544 proof (rule suminf_le_pos)
5.545 fix n show "f (A n \<inter> s) \<le> f (A n)" using A s
5.546 by (force intro: increasingD [OF inc])
5.547 - fix N have "A N \<inter> s \<in> sets M" using A s by auto
5.548 + fix N have "A N \<inter> s \<in> M" using A s by auto
5.549 then show "0 \<le> f (A N \<inter> s)" using posf unfolding positive_def by auto
5.550 qed
5.551 also have "... = z" by (rule si)
5.552 @@ -578,7 +411,7 @@
5.553 assumes posf: "positive M f" "r \<in> measure_set M f X"
5.554 shows "0 \<le> r"
5.555 proof -
5.556 - obtain A where "range A \<subseteq> sets M" and r: "r = (\<Sum>i. f (A i))"
5.557 + obtain A where "range A \<subseteq> M" and r: "r = (\<Sum>i. f (A i))"
5.558 using `r \<in> measure_set M f X` unfolding measure_set_def by auto
5.559 then show "0 \<le> r" using posf unfolding r positive_def
5.560 by (intro suminf_0_le) auto
5.561 @@ -593,26 +426,25 @@
5.562 qed
5.563
5.564 lemma inf_measure_empty:
5.565 - assumes posf: "positive M f" and "{} \<in> sets M"
5.566 + assumes posf: "positive M f" and "{} \<in> M"
5.567 shows "Inf (measure_set M f {}) = 0"
5.568 proof (rule antisym)
5.569 show "Inf (measure_set M f {}) \<le> 0"
5.570 - by (metis complete_lattice_class.Inf_lower `{} \<in> sets M`
5.571 + by (metis complete_lattice_class.Inf_lower `{} \<in> M`
5.572 inf_measure_nonempty[OF posf] subset_refl posf[unfolded positive_def])
5.573 qed (rule inf_measure_pos[OF posf])
5.574
5.575 lemma (in ring_of_sets) inf_measure_positive:
5.576 - assumes p: "positive M f" and "{} \<in> sets M"
5.577 + assumes p: "positive M f" and "{} \<in> M"
5.578 shows "positive M (\<lambda>x. Inf (measure_set M f x))"
5.579 proof (unfold positive_def, intro conjI ballI)
5.580 show "Inf (measure_set M f {}) = 0" using inf_measure_empty[OF assms] by auto
5.581 - fix A assume "A \<in> sets M"
5.582 + fix A assume "A \<in> M"
5.583 qed (rule inf_measure_pos[OF p])
5.584
5.585 lemma (in ring_of_sets) inf_measure_increasing:
5.586 assumes posf: "positive M f"
5.587 - shows "increasing \<lparr> space = space M, sets = Pow (space M) \<rparr>
5.588 - (\<lambda>x. Inf (measure_set M f x))"
5.589 + shows "increasing (Pow \<Omega>) (\<lambda>x. Inf (measure_set M f x))"
5.590 apply (clarsimp simp add: increasing_def)
5.591 apply (rule complete_lattice_class.Inf_greatest)
5.592 apply (rule complete_lattice_class.Inf_lower)
5.593 @@ -621,13 +453,13 @@
5.594
5.595 lemma (in ring_of_sets) inf_measure_le:
5.596 assumes posf: "positive M f" and inc: "increasing M f"
5.597 - and x: "x \<in> {r . \<exists>A. range A \<subseteq> sets M \<and> s \<subseteq> (\<Union>i. A i) \<and> (\<Sum>i. f (A i)) = r}"
5.598 + and x: "x \<in> {r . \<exists>A. range A \<subseteq> M \<and> s \<subseteq> (\<Union>i. A i) \<and> (\<Sum>i. f (A i)) = r}"
5.599 shows "Inf (measure_set M f s) \<le> x"
5.600 proof -
5.601 - obtain A where A: "range A \<subseteq> sets M" and ss: "s \<subseteq> (\<Union>i. A i)"
5.602 + obtain A where A: "range A \<subseteq> M" and ss: "s \<subseteq> (\<Union>i. A i)"
5.603 and xeq: "(\<Sum>i. f (A i)) = x"
5.604 using x by auto
5.605 - have dA: "range (disjointed A) \<subseteq> sets M"
5.606 + have dA: "range (disjointed A) \<subseteq> M"
5.607 by (metis A range_disjointed_sets)
5.608 have "\<forall>n. f (disjointed A n) \<le> f (A n)"
5.609 by (metis increasingD [OF inc] UNIV_I dA image_subset_iff disjointed_subset A comp_def)
5.610 @@ -648,8 +480,8 @@
5.611
5.612 lemma (in ring_of_sets) inf_measure_close:
5.613 fixes e :: ereal
5.614 - assumes posf: "positive M f" and e: "0 < e" and ss: "s \<subseteq> (space M)" and "Inf (measure_set M f s) \<noteq> \<infinity>"
5.615 - shows "\<exists>A. range A \<subseteq> sets M \<and> disjoint_family A \<and> s \<subseteq> (\<Union>i. A i) \<and>
5.616 + assumes posf: "positive M f" and e: "0 < e" and ss: "s \<subseteq> (\<Omega>)" and "Inf (measure_set M f s) \<noteq> \<infinity>"
5.617 + shows "\<exists>A. range A \<subseteq> M \<and> disjoint_family A \<and> s \<subseteq> (\<Union>i. A i) \<and>
5.618 (\<Sum>i. f (A i)) \<le> Inf (measure_set M f s) + e"
5.619 proof -
5.620 from `Inf (measure_set M f s) \<noteq> \<infinity>` have fin: "\<bar>Inf (measure_set M f s)\<bar> \<noteq> \<infinity>"
5.621 @@ -662,22 +494,21 @@
5.622
5.623 lemma (in ring_of_sets) inf_measure_countably_subadditive:
5.624 assumes posf: "positive M f" and inc: "increasing M f"
5.625 - shows "countably_subadditive (| space = space M, sets = Pow (space M) |)
5.626 - (\<lambda>x. Inf (measure_set M f x))"
5.627 + shows "countably_subadditive (Pow \<Omega>) (\<lambda>x. Inf (measure_set M f x))"
5.628 proof (simp add: countably_subadditive_def, safe)
5.629 fix A :: "nat \<Rightarrow> 'a set"
5.630 let ?outer = "\<lambda>B. Inf (measure_set M f B)"
5.631 - assume A: "range A \<subseteq> Pow (space M)"
5.632 + assume A: "range A \<subseteq> Pow (\<Omega>)"
5.633 and disj: "disjoint_family A"
5.634 - and sb: "(\<Union>i. A i) \<subseteq> space M"
5.635 + and sb: "(\<Union>i. A i) \<subseteq> \<Omega>"
5.636
5.637 { fix e :: ereal assume e: "0 < e" and "\<forall>i. ?outer (A i) \<noteq> \<infinity>"
5.638 - hence "\<exists>BB. \<forall>n. range (BB n) \<subseteq> sets M \<and> disjoint_family (BB n) \<and>
5.639 + hence "\<exists>BB. \<forall>n. range (BB n) \<subseteq> M \<and> disjoint_family (BB n) \<and>
5.640 A n \<subseteq> (\<Union>i. BB n i) \<and> (\<Sum>i. f (BB n i)) \<le> ?outer (A n) + e * (1/2)^(Suc n)"
5.641 apply (safe intro!: choice inf_measure_close [of f, OF posf])
5.642 using e sb by (auto simp: ereal_zero_less_0_iff one_ereal_def)
5.643 then obtain BB
5.644 - where BB: "\<And>n. (range (BB n) \<subseteq> sets M)"
5.645 + where BB: "\<And>n. (range (BB n) \<subseteq> M)"
5.646 and disjBB: "\<And>n. disjoint_family (BB n)"
5.647 and sbBB: "\<And>n. A n \<subseteq> (\<Union>i. BB n i)"
5.648 and BBle: "\<And>n. (\<Sum>i. f (BB n i)) \<le> ?outer (A n) + e * (1/2)^(Suc n)"
5.649 @@ -697,7 +528,7 @@
5.650 finally show ?thesis .
5.651 qed
5.652 def C \<equiv> "(split BB) o prod_decode"
5.653 - have C: "!!n. C n \<in> sets M"
5.654 + have C: "!!n. C n \<in> M"
5.655 apply (rule_tac p="prod_decode n" in PairE)
5.656 apply (simp add: C_def)
5.657 apply (metis BB subsetD rangeI)
5.658 @@ -744,9 +575,8 @@
5.659 qed
5.660
5.661 lemma (in ring_of_sets) inf_measure_outer:
5.662 - "\<lbrakk> positive M f ; increasing M f \<rbrakk>
5.663 - \<Longrightarrow> outer_measure_space \<lparr> space = space M, sets = Pow (space M) \<rparr>
5.664 - (\<lambda>x. Inf (measure_set M f x))"
5.665 + "\<lbrakk> positive M f ; increasing M f \<rbrakk> \<Longrightarrow>
5.666 + outer_measure_space (Pow \<Omega>) (\<lambda>x. Inf (measure_set M f x))"
5.667 using inf_measure_pos[of M f]
5.668 by (simp add: outer_measure_space_def inf_measure_empty
5.669 inf_measure_increasing inf_measure_countably_subadditive positive_def)
5.670 @@ -754,14 +584,13 @@
5.671 lemma (in ring_of_sets) algebra_subset_lambda_system:
5.672 assumes posf: "positive M f" and inc: "increasing M f"
5.673 and add: "additive M f"
5.674 - shows "sets M \<subseteq> lambda_system \<lparr> space = space M, sets = Pow (space M) \<rparr>
5.675 - (\<lambda>x. Inf (measure_set M f x))"
5.676 + shows "M \<subseteq> lambda_system \<Omega> (Pow \<Omega>) (\<lambda>x. Inf (measure_set M f x))"
5.677 proof (auto dest: sets_into_space
5.678 simp add: algebra.lambda_system_eq [OF algebra_Pow])
5.679 fix x s
5.680 - assume x: "x \<in> sets M"
5.681 - and s: "s \<subseteq> space M"
5.682 - have [simp]: "!!x. x \<in> sets M \<Longrightarrow> s \<inter> (space M - x) = s-x" using s
5.683 + assume x: "x \<in> M"
5.684 + and s: "s \<subseteq> \<Omega>"
5.685 + have [simp]: "!!x. x \<in> M \<Longrightarrow> s \<inter> (\<Omega> - x) = s-x" using s
5.686 by blast
5.687 have "Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))
5.688 \<le> Inf (measure_set M f s)"
5.689 @@ -774,7 +603,7 @@
5.690 show ?thesis
5.691 proof (rule complete_lattice_class.Inf_greatest)
5.692 fix r assume "r \<in> measure_set M f s"
5.693 - then obtain A where A: "disjoint_family A" "range A \<subseteq> sets M" "s \<subseteq> (\<Union>i. A i)"
5.694 + then obtain A where A: "disjoint_family A" "range A \<subseteq> M" "s \<subseteq> (\<Union>i. A i)"
5.695 and r: "r = (\<Sum>i. f (A i))" unfolding measure_set_def by auto
5.696 have "Inf (measure_set M f (s \<inter> x)) \<le> (\<Sum>i. f (A i \<inter> x))"
5.697 unfolding measure_set_def
5.698 @@ -822,34 +651,31 @@
5.699 qed
5.700
5.701 lemma measure_down:
5.702 - "measure_space N \<Longrightarrow> sigma_algebra M \<Longrightarrow> sets M \<subseteq> sets N \<Longrightarrow> measure N = measure M \<Longrightarrow> measure_space M"
5.703 - by (simp add: measure_space_def measure_space_axioms_def positive_def
5.704 - countably_additive_def)
5.705 + "measure_space \<Omega> N \<mu> \<Longrightarrow> sigma_algebra \<Omega> M \<Longrightarrow> M \<subseteq> N \<Longrightarrow> measure_space \<Omega> M \<mu>"
5.706 + by (simp add: measure_space_def positive_def countably_additive_def)
5.707 blast
5.708
5.709 theorem (in ring_of_sets) caratheodory:
5.710 assumes posf: "positive M f" and ca: "countably_additive M f"
5.711 - shows "\<exists>\<mu> :: 'a set \<Rightarrow> ereal. (\<forall>s \<in> sets M. \<mu> s = f s) \<and>
5.712 - measure_space \<lparr> space = space M, sets = sets (sigma M), measure = \<mu> \<rparr>"
5.713 + shows "\<exists>\<mu> :: 'a set \<Rightarrow> ereal. (\<forall>s \<in> M. \<mu> s = f s) \<and> measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>"
5.714 proof -
5.715 have inc: "increasing M f"
5.716 by (metis additive_increasing ca countably_additive_additive posf)
5.717 let ?infm = "(\<lambda>x. Inf (measure_set M f x))"
5.718 - def ls \<equiv> "lambda_system (|space = space M, sets = Pow (space M)|) ?infm"
5.719 - have mls: "measure_space \<lparr>space = space M, sets = ls, measure = ?infm\<rparr>"
5.720 + def ls \<equiv> "lambda_system \<Omega> (Pow \<Omega>) ?infm"
5.721 + have mls: "measure_space \<Omega> ls ?infm"
5.722 using sigma_algebra.caratheodory_lemma
5.723 [OF sigma_algebra_Pow inf_measure_outer [OF posf inc]]
5.724 by (simp add: ls_def)
5.725 - hence sls: "sigma_algebra (|space = space M, sets = ls, measure = ?infm|)"
5.726 + hence sls: "sigma_algebra \<Omega> ls"
5.727 by (simp add: measure_space_def)
5.728 - have "sets M \<subseteq> ls"
5.729 + have "M \<subseteq> ls"
5.730 by (simp add: ls_def)
5.731 (metis ca posf inc countably_additive_additive algebra_subset_lambda_system)
5.732 - hence sgs_sb: "sigma_sets (space M) (sets M) \<subseteq> ls"
5.733 - using sigma_algebra.sigma_sets_subset [OF sls, of "sets M"]
5.734 + hence sgs_sb: "sigma_sets (\<Omega>) (M) \<subseteq> ls"
5.735 + using sigma_algebra.sigma_sets_subset [OF sls, of "M"]
5.736 by simp
5.737 - have "measure_space \<lparr> space = space M, sets = sets (sigma M), measure = ?infm \<rparr>"
5.738 - unfolding sigma_def
5.739 + have "measure_space \<Omega> (sigma_sets \<Omega> M) ?infm"
5.740 by (rule measure_down [OF mls], rule sigma_algebra_sigma_sets)
5.741 (simp_all add: sgs_sb space_closed)
5.742 thus ?thesis using inf_measure_agrees [OF posf ca]
5.743 @@ -861,12 +687,12 @@
5.744 lemma (in ring_of_sets) countably_additive_iff_continuous_from_below:
5.745 assumes f: "positive M f" "additive M f"
5.746 shows "countably_additive M f \<longleftrightarrow>
5.747 - (\<forall>A. range A \<subseteq> sets M \<longrightarrow> incseq A \<longrightarrow> (\<Union>i. A i) \<in> sets M \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Union>i. A i))"
5.748 + (\<forall>A. range A \<subseteq> M \<longrightarrow> incseq A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Union>i. A i))"
5.749 unfolding countably_additive_def
5.750 proof safe
5.751 - assume count_sum: "\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow> UNION UNIV A \<in> sets M \<longrightarrow> (\<Sum>i. f (A i)) = f (UNION UNIV A)"
5.752 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "incseq A" "(\<Union>i. A i) \<in> sets M"
5.753 - then have dA: "range (disjointed A) \<subseteq> sets M" by (auto simp: range_disjointed_sets)
5.754 + assume count_sum: "\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> UNION UNIV A \<in> M \<longrightarrow> (\<Sum>i. f (A i)) = f (UNION UNIV A)"
5.755 + fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> M" "incseq A" "(\<Union>i. A i) \<in> M"
5.756 + then have dA: "range (disjointed A) \<subseteq> M" by (auto simp: range_disjointed_sets)
5.757 with count_sum[THEN spec, of "disjointed A"] A(3)
5.758 have f_UN: "(\<Sum>i. f (disjointed A i)) = f (\<Union>i. A i)"
5.759 by (auto simp: UN_disjointed_eq disjoint_family_disjointed)
5.760 @@ -880,12 +706,12 @@
5.761 using disjointed_additive[OF f A(1,2)] .
5.762 ultimately show "(\<lambda>i. f (A i)) ----> f (\<Union>i. A i)" by simp
5.763 next
5.764 - assume cont: "\<forall>A. range A \<subseteq> sets M \<longrightarrow> incseq A \<longrightarrow> (\<Union>i. A i) \<in> sets M \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Union>i. A i)"
5.765 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "disjoint_family A" "(\<Union>i. A i) \<in> sets M"
5.766 + assume cont: "\<forall>A. range A \<subseteq> M \<longrightarrow> incseq A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Union>i. A i)"
5.767 + fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> M" "disjoint_family A" "(\<Union>i. A i) \<in> M"
5.768 have *: "(\<Union>n. (\<Union>i\<le>n. A i)) = (\<Union>i. A i)" by auto
5.769 have "(\<lambda>n. f (\<Union>i\<le>n. A i)) ----> f (\<Union>i. A i)"
5.770 proof (unfold *[symmetric], intro cont[rule_format])
5.771 - show "range (\<lambda>i. \<Union> i\<le>i. A i) \<subseteq> sets M" "(\<Union>i. \<Union> i\<le>i. A i) \<in> sets M"
5.772 + show "range (\<lambda>i. \<Union> i\<le>i. A i) \<subseteq> M" "(\<Union>i. \<Union> i\<le>i. A i) \<in> M"
5.773 using A * by auto
5.774 qed (force intro!: incseq_SucI)
5.775 moreover have "\<And>n. f (\<Union>i\<le>n. A i) = (\<Sum>i\<le>n. f (A i))"
5.776 @@ -901,18 +727,18 @@
5.777
5.778 lemma (in ring_of_sets) continuous_from_above_iff_empty_continuous:
5.779 assumes f: "positive M f" "additive M f"
5.780 - shows "(\<forall>A. range A \<subseteq> sets M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) \<in> sets M \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Inter>i. A i))
5.781 - \<longleftrightarrow> (\<forall>A. range A \<subseteq> sets M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> 0)"
5.782 + shows "(\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) \<in> M \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Inter>i. A i))
5.783 + \<longleftrightarrow> (\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> 0)"
5.784 proof safe
5.785 - assume cont: "(\<forall>A. range A \<subseteq> sets M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) \<in> sets M \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Inter>i. A i))"
5.786 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "decseq A" "(\<Inter>i. A i) = {}" "\<forall>i. f (A i) \<noteq> \<infinity>"
5.787 + assume cont: "(\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) \<in> M \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> f (\<Inter>i. A i))"
5.788 + fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> M" "decseq A" "(\<Inter>i. A i) = {}" "\<forall>i. f (A i) \<noteq> \<infinity>"
5.789 with cont[THEN spec, of A] show "(\<lambda>i. f (A i)) ----> 0"
5.790 using `positive M f`[unfolded positive_def] by auto
5.791 next
5.792 - assume cont: "\<forall>A. range A \<subseteq> sets M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.793 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "decseq A" "(\<Inter>i. A i) \<in> sets M" "\<forall>i. f (A i) \<noteq> \<infinity>"
5.794 + assume cont: "\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.795 + fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> M" "decseq A" "(\<Inter>i. A i) \<in> M" "\<forall>i. f (A i) \<noteq> \<infinity>"
5.796
5.797 - have f_mono: "\<And>a b. a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<subseteq> b \<Longrightarrow> f a \<le> f b"
5.798 + have f_mono: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<subseteq> b \<Longrightarrow> f a \<le> f b"
5.799 using additive_increasing[OF f] unfolding increasing_def by simp
5.800
5.801 have decseq_fA: "decseq (\<lambda>i. f (A i))"
5.802 @@ -932,7 +758,7 @@
5.803 note f_fin = this
5.804 have "(\<lambda>i. f (A i - (\<Inter>i. A i))) ----> 0"
5.805 proof (intro cont[rule_format, OF _ decseq _ f_fin])
5.806 - show "range (\<lambda>i. A i - (\<Inter>i. A i)) \<subseteq> sets M" "(\<Inter>i. A i - (\<Inter>i. A i)) = {}"
5.807 + show "range (\<lambda>i. A i - (\<Inter>i. A i)) \<subseteq> M" "(\<Inter>i. A i - (\<Inter>i. A i)) = {}"
5.808 using A by auto
5.809 qed
5.810 from INF_Lim_ereal[OF decseq_f this]
5.811 @@ -956,17 +782,17 @@
5.812 qed
5.813
5.814 lemma positiveD1: "positive M f \<Longrightarrow> f {} = 0" by (auto simp: positive_def)
5.815 -lemma positiveD2: "positive M f \<Longrightarrow> A \<in> sets M \<Longrightarrow> 0 \<le> f A" by (auto simp: positive_def)
5.816 +lemma positiveD2: "positive M f \<Longrightarrow> A \<in> M \<Longrightarrow> 0 \<le> f A" by (auto simp: positive_def)
5.817
5.818 lemma (in ring_of_sets) empty_continuous_imp_continuous_from_below:
5.819 - assumes f: "positive M f" "additive M f" "\<forall>A\<in>sets M. f A \<noteq> \<infinity>"
5.820 - assumes cont: "\<forall>A. range A \<subseteq> sets M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.821 - assumes A: "range A \<subseteq> sets M" "incseq A" "(\<Union>i. A i) \<in> sets M"
5.822 + assumes f: "positive M f" "additive M f" "\<forall>A\<in>M. f A \<noteq> \<infinity>"
5.823 + assumes cont: "\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.824 + assumes A: "range A \<subseteq> M" "incseq A" "(\<Union>i. A i) \<in> M"
5.825 shows "(\<lambda>i. f (A i)) ----> f (\<Union>i. A i)"
5.826 proof -
5.827 - have "\<forall>A\<in>sets M. \<exists>x. f A = ereal x"
5.828 + have "\<forall>A\<in>M. \<exists>x. f A = ereal x"
5.829 proof
5.830 - fix A assume "A \<in> sets M" with f show "\<exists>x. f A = ereal x"
5.831 + fix A assume "A \<in> M" with f show "\<exists>x. f A = ereal x"
5.832 unfolding positive_def by (cases "f A") auto
5.833 qed
5.834 from bchoice[OF this] guess f' .. note f' = this[rule_format]
5.835 @@ -991,20 +817,19 @@
5.836 qed
5.837
5.838 lemma (in ring_of_sets) empty_continuous_imp_countably_additive:
5.839 - assumes f: "positive M f" "additive M f" and fin: "\<forall>A\<in>sets M. f A \<noteq> \<infinity>"
5.840 - assumes cont: "\<And>A. range A \<subseteq> sets M \<Longrightarrow> decseq A \<Longrightarrow> (\<Inter>i. A i) = {} \<Longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.841 + assumes f: "positive M f" "additive M f" and fin: "\<forall>A\<in>M. f A \<noteq> \<infinity>"
5.842 + assumes cont: "\<And>A. range A \<subseteq> M \<Longrightarrow> decseq A \<Longrightarrow> (\<Inter>i. A i) = {} \<Longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.843 shows "countably_additive M f"
5.844 using countably_additive_iff_continuous_from_below[OF f]
5.845 using empty_continuous_imp_continuous_from_below[OF f fin] cont
5.846 by blast
5.847
5.848 lemma (in ring_of_sets) caratheodory_empty_continuous:
5.849 - assumes f: "positive M f" "additive M f" and fin: "\<And>A. A \<in> sets M \<Longrightarrow> f A \<noteq> \<infinity>"
5.850 - assumes cont: "\<And>A. range A \<subseteq> sets M \<Longrightarrow> decseq A \<Longrightarrow> (\<Inter>i. A i) = {} \<Longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.851 - shows "\<exists>\<mu> :: 'a set \<Rightarrow> ereal. (\<forall>s \<in> sets M. \<mu> s = f s) \<and>
5.852 - measure_space \<lparr> space = space M, sets = sets (sigma M), measure = \<mu> \<rparr>"
5.853 + assumes f: "positive M f" "additive M f" and fin: "\<And>A. A \<in> M \<Longrightarrow> f A \<noteq> \<infinity>"
5.854 + assumes cont: "\<And>A. range A \<subseteq> M \<Longrightarrow> decseq A \<Longrightarrow> (\<Inter>i. A i) = {} \<Longrightarrow> (\<lambda>i. f (A i)) ----> 0"
5.855 + shows "\<exists>\<mu> :: 'a set \<Rightarrow> ereal. (\<forall>s \<in> M. \<mu> s = f s) \<and> measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>"
5.856 proof (intro caratheodory empty_continuous_imp_countably_additive f)
5.857 - show "\<forall>A\<in>sets M. f A \<noteq> \<infinity>" using fin by auto
5.858 + show "\<forall>A\<in>M. f A \<noteq> \<infinity>" using fin by auto
5.859 qed (rule cont)
5.860
5.861 end
6.1 --- a/src/HOL/Probability/Complete_Measure.thy Mon Apr 23 12:23:23 2012 +0100
6.2 +++ b/src/HOL/Probability/Complete_Measure.thy Mon Apr 23 12:14:35 2012 +0200
6.3 @@ -6,218 +6,231 @@
6.4 imports Lebesgue_Integration
6.5 begin
6.6
6.7 -locale completeable_measure_space = measure_space
6.8 +definition
6.9 + "split_completion M A p = (if A \<in> sets M then p = (A, {}) else
6.10 + \<exists>N'. A = fst p \<union> snd p \<and> fst p \<inter> snd p = {} \<and> fst p \<in> sets M \<and> snd p \<subseteq> N' \<and> N' \<in> null_sets M)"
6.11
6.12 -definition (in completeable_measure_space)
6.13 - "split_completion A p = (\<exists>N'. A = fst p \<union> snd p \<and> fst p \<inter> snd p = {} \<and>
6.14 - fst p \<in> sets M \<and> snd p \<subseteq> N' \<and> N' \<in> null_sets)"
6.15 +definition
6.16 + "main_part M A = fst (Eps (split_completion M A))"
6.17
6.18 -definition (in completeable_measure_space)
6.19 - "main_part A = fst (Eps (split_completion A))"
6.20 +definition
6.21 + "null_part M A = snd (Eps (split_completion M A))"
6.22
6.23 -definition (in completeable_measure_space)
6.24 - "null_part A = snd (Eps (split_completion A))"
6.25 +definition completion :: "'a measure \<Rightarrow> 'a measure" where
6.26 + "completion M = measure_of (space M) { S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N' }
6.27 + (emeasure M \<circ> main_part M)"
6.28
6.29 -abbreviation (in completeable_measure_space) "\<mu>' A \<equiv> \<mu> (main_part A)"
6.30 +lemma completion_into_space:
6.31 + "{ S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N' } \<subseteq> Pow (space M)"
6.32 + using sets_into_space by auto
6.33
6.34 -definition (in completeable_measure_space) completion :: "('a, 'b) measure_space_scheme" where
6.35 - "completion = \<lparr> space = space M,
6.36 - sets = { S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets \<and> N \<subseteq> N' },
6.37 - measure = \<mu>',
6.38 - \<dots> = more M \<rparr>"
6.39 +lemma space_completion[simp]: "space (completion M) = space M"
6.40 + unfolding completion_def using space_measure_of[OF completion_into_space] by simp
6.41
6.42 -
6.43 -lemma (in completeable_measure_space) space_completion[simp]:
6.44 - "space completion = space M" unfolding completion_def by simp
6.45 -
6.46 -lemma (in completeable_measure_space) sets_completionE:
6.47 - assumes "A \<in> sets completion"
6.48 - obtains S N N' where "A = S \<union> N" "N \<subseteq> N'" "N' \<in> null_sets" "S \<in> sets M"
6.49 - using assms unfolding completion_def by auto
6.50 -
6.51 -lemma (in completeable_measure_space) sets_completionI:
6.52 - assumes "A = S \<union> N" "N \<subseteq> N'" "N' \<in> null_sets" "S \<in> sets M"
6.53 - shows "A \<in> sets completion"
6.54 - using assms unfolding completion_def by auto
6.55 -
6.56 -lemma (in completeable_measure_space) sets_completionI_sets[intro]:
6.57 - "A \<in> sets M \<Longrightarrow> A \<in> sets completion"
6.58 - unfolding completion_def by force
6.59 -
6.60 -lemma (in completeable_measure_space) null_sets_completion:
6.61 - assumes "N' \<in> null_sets" "N \<subseteq> N'" shows "N \<in> sets completion"
6.62 - apply(rule sets_completionI[of N "{}" N N'])
6.63 +lemma completionI:
6.64 + assumes "A = S \<union> N" "N \<subseteq> N'" "N' \<in> null_sets M" "S \<in> sets M"
6.65 + shows "A \<in> { S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N' }"
6.66 using assms by auto
6.67
6.68 -sublocale completeable_measure_space \<subseteq> completion!: sigma_algebra completion
6.69 -proof (unfold sigma_algebra_iff2, safe)
6.70 - fix A x assume "A \<in> sets completion" "x \<in> A"
6.71 - with sets_into_space show "x \<in> space completion"
6.72 - by (auto elim!: sets_completionE)
6.73 +lemma completionE:
6.74 + assumes "A \<in> { S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N' }"
6.75 + obtains S N N' where "A = S \<union> N" "N \<subseteq> N'" "N' \<in> null_sets M" "S \<in> sets M"
6.76 + using assms by auto
6.77 +
6.78 +lemma sigma_algebra_completion:
6.79 + "sigma_algebra (space M) { S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N' }"
6.80 + (is "sigma_algebra _ ?A")
6.81 + unfolding sigma_algebra_iff2
6.82 +proof (intro conjI ballI allI impI)
6.83 + show "?A \<subseteq> Pow (space M)"
6.84 + using sets_into_space by auto
6.85 next
6.86 - fix A assume "A \<in> sets completion"
6.87 - from this[THEN sets_completionE] guess S N N' . note A = this
6.88 - let ?C = "space completion"
6.89 - show "?C - A \<in> sets completion" using A
6.90 - by (intro sets_completionI[of _ "(?C - S) \<inter> (?C - N')" "(?C - S) \<inter> N' \<inter> (?C - N)"])
6.91 - auto
6.92 + show "{} \<in> ?A" by auto
6.93 next
6.94 - fix A ::"nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets completion"
6.95 - then have "\<forall>n. \<exists>S N N'. A n = S \<union> N \<and> S \<in> sets M \<and> N' \<in> null_sets \<and> N \<subseteq> N'"
6.96 - unfolding completion_def by (auto simp: image_subset_iff)
6.97 + let ?C = "space M"
6.98 + fix A assume "A \<in> ?A" from completionE[OF this] guess S N N' .
6.99 + then show "space M - A \<in> ?A"
6.100 + by (intro completionI[of _ "(?C - S) \<inter> (?C - N')" "(?C - S) \<inter> N' \<inter> (?C - N)"]) auto
6.101 +next
6.102 + fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> ?A"
6.103 + then have "\<forall>n. \<exists>S N N'. A n = S \<union> N \<and> S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N'"
6.104 + by (auto simp: image_subset_iff)
6.105 from choice[OF this] guess S ..
6.106 from choice[OF this] guess N ..
6.107 from choice[OF this] guess N' ..
6.108 - then show "UNION UNIV A \<in> sets completion"
6.109 + then show "UNION UNIV A \<in> ?A"
6.110 using null_sets_UN[of N']
6.111 - by (intro sets_completionI[of _ "UNION UNIV S" "UNION UNIV N" "UNION UNIV N'"])
6.112 - auto
6.113 -qed auto
6.114 + by (intro completionI[of _ "UNION UNIV S" "UNION UNIV N" "UNION UNIV N'"]) auto
6.115 +qed
6.116
6.117 -lemma (in completeable_measure_space) split_completion:
6.118 - assumes "A \<in> sets completion"
6.119 - shows "split_completion A (main_part A, null_part A)"
6.120 - unfolding main_part_def null_part_def
6.121 -proof (rule someI2_ex)
6.122 - from assms[THEN sets_completionE] guess S N N' . note A = this
6.123 - let ?P = "(S, N - S)"
6.124 - show "\<exists>p. split_completion A p"
6.125 - unfolding split_completion_def using A
6.126 - proof (intro exI conjI)
6.127 - show "A = fst ?P \<union> snd ?P" using A by auto
6.128 - show "snd ?P \<subseteq> N'" using A by auto
6.129 +lemma sets_completion:
6.130 + "sets (completion M) = { S \<union> N |S N N'. S \<in> sets M \<and> N' \<in> null_sets M \<and> N \<subseteq> N' }"
6.131 + using sigma_algebra.sets_measure_of_eq[OF sigma_algebra_completion] by (simp add: completion_def)
6.132 +
6.133 +lemma sets_completionE:
6.134 + assumes "A \<in> sets (completion M)"
6.135 + obtains S N N' where "A = S \<union> N" "N \<subseteq> N'" "N' \<in> null_sets M" "S \<in> sets M"
6.136 + using assms unfolding sets_completion by auto
6.137 +
6.138 +lemma sets_completionI:
6.139 + assumes "A = S \<union> N" "N \<subseteq> N'" "N' \<in> null_sets M" "S \<in> sets M"
6.140 + shows "A \<in> sets (completion M)"
6.141 + using assms unfolding sets_completion by auto
6.142 +
6.143 +lemma sets_completionI_sets[intro, simp]:
6.144 + "A \<in> sets M \<Longrightarrow> A \<in> sets (completion M)"
6.145 + unfolding sets_completion by force
6.146 +
6.147 +lemma null_sets_completion:
6.148 + assumes "N' \<in> null_sets M" "N \<subseteq> N'" shows "N \<in> sets (completion M)"
6.149 + using assms by (intro sets_completionI[of N "{}" N N']) auto
6.150 +
6.151 +lemma split_completion:
6.152 + assumes "A \<in> sets (completion M)"
6.153 + shows "split_completion M A (main_part M A, null_part M A)"
6.154 +proof cases
6.155 + assume "A \<in> sets M" then show ?thesis
6.156 + by (simp add: split_completion_def[abs_def] main_part_def null_part_def)
6.157 +next
6.158 + assume nA: "A \<notin> sets M"
6.159 + show ?thesis
6.160 + unfolding main_part_def null_part_def if_not_P[OF nA]
6.161 + proof (rule someI2_ex)
6.162 + from assms[THEN sets_completionE] guess S N N' . note A = this
6.163 + let ?P = "(S, N - S)"
6.164 + show "\<exists>p. split_completion M A p"
6.165 + unfolding split_completion_def if_not_P[OF nA] using A
6.166 + proof (intro exI conjI)
6.167 + show "A = fst ?P \<union> snd ?P" using A by auto
6.168 + show "snd ?P \<subseteq> N'" using A by auto
6.169 + qed auto
6.170 qed auto
6.171 -qed auto
6.172 +qed
6.173
6.174 -lemma (in completeable_measure_space)
6.175 - assumes "S \<in> sets completion"
6.176 - shows main_part_sets[intro, simp]: "main_part S \<in> sets M"
6.177 - and main_part_null_part_Un[simp]: "main_part S \<union> null_part S = S"
6.178 - and main_part_null_part_Int[simp]: "main_part S \<inter> null_part S = {}"
6.179 - using split_completion[OF assms] by (auto simp: split_completion_def)
6.180 +lemma
6.181 + assumes "S \<in> sets (completion M)"
6.182 + shows main_part_sets[intro, simp]: "main_part M S \<in> sets M"
6.183 + and main_part_null_part_Un[simp]: "main_part M S \<union> null_part M S = S"
6.184 + and main_part_null_part_Int[simp]: "main_part M S \<inter> null_part M S = {}"
6.185 + using split_completion[OF assms]
6.186 + by (auto simp: split_completion_def split: split_if_asm)
6.187
6.188 -lemma (in completeable_measure_space) null_part:
6.189 - assumes "S \<in> sets completion" shows "\<exists>N. N\<in>null_sets \<and> null_part S \<subseteq> N"
6.190 - using split_completion[OF assms] by (auto simp: split_completion_def)
6.191 +lemma main_part[simp]: "S \<in> sets M \<Longrightarrow> main_part M S = S"
6.192 + using split_completion[of S M]
6.193 + by (auto simp: split_completion_def split: split_if_asm)
6.194
6.195 -lemma (in completeable_measure_space) null_part_sets[intro, simp]:
6.196 - assumes "S \<in> sets M" shows "null_part S \<in> sets M" "\<mu> (null_part S) = 0"
6.197 +lemma null_part:
6.198 + assumes "S \<in> sets (completion M)" shows "\<exists>N. N\<in>null_sets M \<and> null_part M S \<subseteq> N"
6.199 + using split_completion[OF assms] by (auto simp: split_completion_def split: split_if_asm)
6.200 +
6.201 +lemma null_part_sets[intro, simp]:
6.202 + assumes "S \<in> sets M" shows "null_part M S \<in> sets M" "emeasure M (null_part M S) = 0"
6.203 proof -
6.204 - have S: "S \<in> sets completion" using assms by auto
6.205 - have "S - main_part S \<in> sets M" using assms by auto
6.206 + have S: "S \<in> sets (completion M)" using assms by auto
6.207 + have "S - main_part M S \<in> sets M" using assms by auto
6.208 moreover
6.209 from main_part_null_part_Un[OF S] main_part_null_part_Int[OF S]
6.210 - have "S - main_part S = null_part S" by auto
6.211 - ultimately show sets: "null_part S \<in> sets M" by auto
6.212 + have "S - main_part M S = null_part M S" by auto
6.213 + ultimately show sets: "null_part M S \<in> sets M" by auto
6.214 from null_part[OF S] guess N ..
6.215 - with measure_eq_0[of N "null_part S"] sets
6.216 - show "\<mu> (null_part S) = 0" by auto
6.217 + with emeasure_eq_0[of N _ "null_part M S"] sets
6.218 + show "emeasure M (null_part M S) = 0" by auto
6.219 qed
6.220
6.221 -lemma (in completeable_measure_space) \<mu>'_set[simp]:
6.222 - assumes "S \<in> sets M" shows "\<mu>' S = \<mu> S"
6.223 +lemma emeasure_main_part_UN:
6.224 + fixes S :: "nat \<Rightarrow> 'a set"
6.225 + assumes "range S \<subseteq> sets (completion M)"
6.226 + shows "emeasure M (main_part M (\<Union>i. (S i))) = emeasure M (\<Union>i. main_part M (S i))"
6.227 proof -
6.228 - have S: "S \<in> sets completion" using assms by auto
6.229 - then have "\<mu> S = \<mu> (main_part S \<union> null_part S)" by simp
6.230 - also have "\<dots> = \<mu>' S"
6.231 - using S assms measure_additive[of "main_part S" "null_part S"]
6.232 - by (auto simp: measure_additive)
6.233 - finally show ?thesis by simp
6.234 -qed
6.235 -
6.236 -lemma (in completeable_measure_space) sets_completionI_sub:
6.237 - assumes N: "N' \<in> null_sets" "N \<subseteq> N'"
6.238 - shows "N \<in> sets completion"
6.239 - using assms by (intro sets_completionI[of _ "{}" N N']) auto
6.240 -
6.241 -lemma (in completeable_measure_space) \<mu>_main_part_UN:
6.242 - fixes S :: "nat \<Rightarrow> 'a set"
6.243 - assumes "range S \<subseteq> sets completion"
6.244 - shows "\<mu>' (\<Union>i. (S i)) = \<mu> (\<Union>i. main_part (S i))"
6.245 -proof -
6.246 - have S: "\<And>i. S i \<in> sets completion" using assms by auto
6.247 - then have UN: "(\<Union>i. S i) \<in> sets completion" by auto
6.248 - have "\<forall>i. \<exists>N. N \<in> null_sets \<and> null_part (S i) \<subseteq> N"
6.249 + have S: "\<And>i. S i \<in> sets (completion M)" using assms by auto
6.250 + then have UN: "(\<Union>i. S i) \<in> sets (completion M)" by auto
6.251 + have "\<forall>i. \<exists>N. N \<in> null_sets M \<and> null_part M (S i) \<subseteq> N"
6.252 using null_part[OF S] by auto
6.253 from choice[OF this] guess N .. note N = this
6.254 - then have UN_N: "(\<Union>i. N i) \<in> null_sets" by (intro null_sets_UN) auto
6.255 - have "(\<Union>i. S i) \<in> sets completion" using S by auto
6.256 + then have UN_N: "(\<Union>i. N i) \<in> null_sets M" by (intro null_sets_UN) auto
6.257 + have "(\<Union>i. S i) \<in> sets (completion M)" using S by auto
6.258 from null_part[OF this] guess N' .. note N' = this
6.259 let ?N = "(\<Union>i. N i) \<union> N'"
6.260 - have null_set: "?N \<in> null_sets" using N' UN_N by (intro nullsets.Un) auto
6.261 - have "main_part (\<Union>i. S i) \<union> ?N = (main_part (\<Union>i. S i) \<union> null_part (\<Union>i. S i)) \<union> ?N"
6.262 + have null_set: "?N \<in> null_sets M" using N' UN_N by (intro null_sets.Un) auto
6.263 + have "main_part M (\<Union>i. S i) \<union> ?N = (main_part M (\<Union>i. S i) \<union> null_part M (\<Union>i. S i)) \<union> ?N"
6.264 using N' by auto
6.265 - also have "\<dots> = (\<Union>i. main_part (S i) \<union> null_part (S i)) \<union> ?N"
6.266 + also have "\<dots> = (\<Union>i. main_part M (S i) \<union> null_part M (S i)) \<union> ?N"
6.267 unfolding main_part_null_part_Un[OF S] main_part_null_part_Un[OF UN] by auto
6.268 - also have "\<dots> = (\<Union>i. main_part (S i)) \<union> ?N"
6.269 + also have "\<dots> = (\<Union>i. main_part M (S i)) \<union> ?N"
6.270 using N by auto
6.271 - finally have *: "main_part (\<Union>i. S i) \<union> ?N = (\<Union>i. main_part (S i)) \<union> ?N" .
6.272 - have "\<mu> (main_part (\<Union>i. S i)) = \<mu> (main_part (\<Union>i. S i) \<union> ?N)"
6.273 - using null_set UN by (intro measure_Un_null_set[symmetric]) auto
6.274 - also have "\<dots> = \<mu> ((\<Union>i. main_part (S i)) \<union> ?N)"
6.275 + finally have *: "main_part M (\<Union>i. S i) \<union> ?N = (\<Union>i. main_part M (S i)) \<union> ?N" .
6.276 + have "emeasure M (main_part M (\<Union>i. S i)) = emeasure M (main_part M (\<Union>i. S i) \<union> ?N)"
6.277 + using null_set UN by (intro emeasure_Un_null_set[symmetric]) auto
6.278 + also have "\<dots> = emeasure M ((\<Union>i. main_part M (S i)) \<union> ?N)"
6.279 unfolding * ..
6.280 - also have "\<dots> = \<mu> (\<Union>i. main_part (S i))"
6.281 - using null_set S by (intro measure_Un_null_set) auto
6.282 + also have "\<dots> = emeasure M (\<Union>i. main_part M (S i))"
6.283 + using null_set S by (intro emeasure_Un_null_set) auto
6.284 finally show ?thesis .
6.285 qed
6.286
6.287 -lemma (in completeable_measure_space) \<mu>_main_part_Un:
6.288 - assumes S: "S \<in> sets completion" and T: "T \<in> sets completion"
6.289 - shows "\<mu>' (S \<union> T) = \<mu> (main_part S \<union> main_part T)"
6.290 -proof -
6.291 - have UN: "(\<Union>i. binary (main_part S) (main_part T) i) = (\<Union>i. main_part (binary S T i))"
6.292 - unfolding binary_def by (auto split: split_if_asm)
6.293 - show ?thesis
6.294 - using \<mu>_main_part_UN[of "binary S T"] assms
6.295 - unfolding range_binary_eq Un_range_binary UN by auto
6.296 +lemma emeasure_completion[simp]:
6.297 + assumes S: "S \<in> sets (completion M)" shows "emeasure (completion M) S = emeasure M (main_part M S)"
6.298 +proof (subst emeasure_measure_of[OF completion_def completion_into_space])
6.299 + let ?\<mu> = "emeasure M \<circ> main_part M"
6.300 + show "S \<in> sets (completion M)" "?\<mu> S = emeasure M (main_part M S) " using S by simp_all
6.301 + show "positive (sets (completion M)) ?\<mu>"
6.302 + by (simp add: positive_def emeasure_nonneg)
6.303 + show "countably_additive (sets (completion M)) ?\<mu>"
6.304 + proof (intro countably_additiveI)
6.305 + fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets (completion M)" "disjoint_family A"
6.306 + have "disjoint_family (\<lambda>i. main_part M (A i))"
6.307 + proof (intro disjoint_family_on_bisimulation[OF A(2)])
6.308 + fix n m assume "A n \<inter> A m = {}"
6.309 + then have "(main_part M (A n) \<union> null_part M (A n)) \<inter> (main_part M (A m) \<union> null_part M (A m)) = {}"
6.310 + using A by (subst (1 2) main_part_null_part_Un) auto
6.311 + then show "main_part M (A n) \<inter> main_part M (A m) = {}" by auto
6.312 + qed
6.313 + then have "(\<Sum>n. emeasure M (main_part M (A n))) = emeasure M (\<Union>i. main_part M (A i))"
6.314 + using A by (auto intro!: suminf_emeasure)
6.315 + then show "(\<Sum>n. ?\<mu> (A n)) = ?\<mu> (UNION UNIV A)"
6.316 + by (simp add: completion_def emeasure_main_part_UN[OF A(1)])
6.317 + qed
6.318 qed
6.319
6.320 -sublocale completeable_measure_space \<subseteq> completion!: measure_space completion
6.321 - where "measure completion = \<mu>'"
6.322 -proof -
6.323 - show "measure_space completion"
6.324 - proof
6.325 - show "positive completion (measure completion)"
6.326 - by (auto simp: completion_def positive_def)
6.327 - next
6.328 - show "countably_additive completion (measure completion)"
6.329 - proof (intro countably_additiveI)
6.330 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets completion" "disjoint_family A"
6.331 - have "disjoint_family (\<lambda>i. main_part (A i))"
6.332 - proof (intro disjoint_family_on_bisimulation[OF A(2)])
6.333 - fix n m assume "A n \<inter> A m = {}"
6.334 - then have "(main_part (A n) \<union> null_part (A n)) \<inter> (main_part (A m) \<union> null_part (A m)) = {}"
6.335 - using A by (subst (1 2) main_part_null_part_Un) auto
6.336 - then show "main_part (A n) \<inter> main_part (A m) = {}" by auto
6.337 - qed
6.338 - then have "(\<Sum>n. measure completion (A n)) = \<mu> (\<Union>i. main_part (A i))"
6.339 - unfolding completion_def using A by (auto intro!: measure_countably_additive)
6.340 - then show "(\<Sum>n. measure completion (A n)) = measure completion (UNION UNIV A)"
6.341 - by (simp add: completion_def \<mu>_main_part_UN[OF A(1)])
6.342 - qed
6.343 - qed
6.344 - show "measure completion = \<mu>'" unfolding completion_def by simp
6.345 -qed
6.346 +lemma emeasure_completion_UN:
6.347 + "range S \<subseteq> sets (completion M) \<Longrightarrow>
6.348 + emeasure (completion M) (\<Union>i::nat. (S i)) = emeasure M (\<Union>i. main_part M (S i))"
6.349 + by (subst emeasure_completion) (auto simp add: emeasure_main_part_UN)
6.350
6.351 -lemma (in completeable_measure_space) completion_ex_simple_function:
6.352 - assumes f: "simple_function completion f"
6.353 - shows "\<exists>f'. simple_function M f' \<and> (AE x. f x = f' x)"
6.354 +lemma emeasure_completion_Un:
6.355 + assumes S: "S \<in> sets (completion M)" and T: "T \<in> sets (completion M)"
6.356 + shows "emeasure (completion M) (S \<union> T) = emeasure M (main_part M S \<union> main_part M T)"
6.357 +proof (subst emeasure_completion)
6.358 + have UN: "(\<Union>i. binary (main_part M S) (main_part M T) i) = (\<Union>i. main_part M (binary S T i))"
6.359 + unfolding binary_def by (auto split: split_if_asm)
6.360 + show "emeasure M (main_part M (S \<union> T)) = emeasure M (main_part M S \<union> main_part M T)"
6.361 + using emeasure_main_part_UN[of "binary S T" M] assms
6.362 + unfolding range_binary_eq Un_range_binary UN by auto
6.363 +qed (auto intro: S T)
6.364 +
6.365 +lemma sets_completionI_sub:
6.366 + assumes N: "N' \<in> null_sets M" "N \<subseteq> N'"
6.367 + shows "N \<in> sets (completion M)"
6.368 + using assms by (intro sets_completionI[of _ "{}" N N']) auto
6.369 +
6.370 +lemma completion_ex_simple_function:
6.371 + assumes f: "simple_function (completion M) f"
6.372 + shows "\<exists>f'. simple_function M f' \<and> (AE x in M. f x = f' x)"
6.373 proof -
6.374 let ?F = "\<lambda>x. f -` {x} \<inter> space M"
6.375 - have F: "\<And>x. ?F x \<in> sets completion" and fin: "finite (f`space M)"
6.376 - using completion.simple_functionD[OF f]
6.377 - completion.simple_functionD[OF f] by simp_all
6.378 - have "\<forall>x. \<exists>N. N \<in> null_sets \<and> null_part (?F x) \<subseteq> N"
6.379 + have F: "\<And>x. ?F x \<in> sets (completion M)" and fin: "finite (f`space M)"
6.380 + using simple_functionD[OF f] simple_functionD[OF f] by simp_all
6.381 + have "\<forall>x. \<exists>N. N \<in> null_sets M \<and> null_part M (?F x) \<subseteq> N"
6.382 using F null_part by auto
6.383 from choice[OF this] obtain N where
6.384 - N: "\<And>x. null_part (?F x) \<subseteq> N x" "\<And>x. N x \<in> null_sets" by auto
6.385 + N: "\<And>x. null_part M (?F x) \<subseteq> N x" "\<And>x. N x \<in> null_sets M" by auto
6.386 let ?N = "\<Union>x\<in>f`space M. N x"
6.387 let ?f' = "\<lambda>x. if x \<in> ?N then undefined else f x"
6.388 - have sets: "?N \<in> null_sets" using N fin by (intro nullsets.finite_UN) auto
6.389 + have sets: "?N \<in> null_sets M" using N fin by (intro null_sets.finite_UN) auto
6.390 show ?thesis unfolding simple_function_def
6.391 proof (safe intro!: exI[of _ ?f'])
6.392 have "?f' ` space M \<subseteq> f`space M \<union> {undefined}" by auto
6.393 - from finite_subset[OF this] completion.simple_functionD(1)[OF f]
6.394 + from finite_subset[OF this] simple_functionD(1)[OF f]
6.395 show "finite (?f' ` space M)" by auto
6.396 next
6.397 fix x assume "x \<in> space M"
6.398 @@ -225,13 +238,13 @@
6.399 (if x \<in> ?N then ?F undefined \<union> ?N
6.400 else if f x = undefined then ?F (f x) \<union> ?N
6.401 else ?F (f x) - ?N)"
6.402 - using N(2) sets_into_space by (auto split: split_if_asm)
6.403 + using N(2) sets_into_space by (auto split: split_if_asm simp: null_sets_def)
6.404 moreover { fix y have "?F y \<union> ?N \<in> sets M"
6.405 proof cases
6.406 assume y: "y \<in> f`space M"
6.407 - have "?F y \<union> ?N = (main_part (?F y) \<union> null_part (?F y)) \<union> ?N"
6.408 + have "?F y \<union> ?N = (main_part M (?F y) \<union> null_part M (?F y)) \<union> ?N"
6.409 using main_part_null_part_Un[OF F] by auto
6.410 - also have "\<dots> = main_part (?F y) \<union> ?N"
6.411 + also have "\<dots> = main_part M (?F y) \<union> ?N"
6.412 using y N by auto
6.413 finally show ?thesis
6.414 using F sets by auto
6.415 @@ -240,34 +253,34 @@
6.416 then show ?thesis using sets by auto
6.417 qed }
6.418 moreover {
6.419 - have "?F (f x) - ?N = main_part (?F (f x)) \<union> null_part (?F (f x)) - ?N"
6.420 + have "?F (f x) - ?N = main_part M (?F (f x)) \<union> null_part M (?F (f x)) - ?N"
6.421 using main_part_null_part_Un[OF F] by auto
6.422 - also have "\<dots> = main_part (?F (f x)) - ?N"
6.423 + also have "\<dots> = main_part M (?F (f x)) - ?N"
6.424 using N `x \<in> space M` by auto
6.425 finally have "?F (f x) - ?N \<in> sets M"
6.426 using F sets by auto }
6.427 ultimately show "?f' -` {?f' x} \<inter> space M \<in> sets M" by auto
6.428 next
6.429 - show "AE x. f x = ?f' x"
6.430 + show "AE x in M. f x = ?f' x"
6.431 by (rule AE_I', rule sets) auto
6.432 qed
6.433 qed
6.434
6.435 -lemma (in completeable_measure_space) completion_ex_borel_measurable_pos:
6.436 +lemma completion_ex_borel_measurable_pos:
6.437 fixes g :: "'a \<Rightarrow> ereal"
6.438 - assumes g: "g \<in> borel_measurable completion" and "\<And>x. 0 \<le> g x"
6.439 - shows "\<exists>g'\<in>borel_measurable M. (AE x. g x = g' x)"
6.440 + assumes g: "g \<in> borel_measurable (completion M)" and "\<And>x. 0 \<le> g x"
6.441 + shows "\<exists>g'\<in>borel_measurable M. (AE x in M. g x = g' x)"
6.442 proof -
6.443 - from g[THEN completion.borel_measurable_implies_simple_function_sequence'] guess f . note f = this
6.444 + from g[THEN borel_measurable_implies_simple_function_sequence'] guess f . note f = this
6.445 from this(1)[THEN completion_ex_simple_function]
6.446 - have "\<forall>i. \<exists>f'. simple_function M f' \<and> (AE x. f i x = f' x)" ..
6.447 + have "\<forall>i. \<exists>f'. simple_function M f' \<and> (AE x in M. f i x = f' x)" ..
6.448 from this[THEN choice] obtain f' where
6.449 sf: "\<And>i. simple_function M (f' i)" and
6.450 - AE: "\<forall>i. AE x. f i x = f' i x" by auto
6.451 + AE: "\<forall>i. AE x in M. f i x = f' i x" by auto
6.452 show ?thesis
6.453 proof (intro bexI)
6.454 from AE[unfolded AE_all_countable[symmetric]]
6.455 - show "AE x. g x = (SUP i. f' i x)" (is "AE x. g x = ?f x")
6.456 + show "AE x in M. g x = (SUP i. f' i x)" (is "AE x in M. g x = ?f x")
6.457 proof (elim AE_mp, safe intro!: AE_I2)
6.458 fix x assume eq: "\<forall>i. f i x = f' i x"
6.459 moreover have "g x = (SUP i. f i x)"
6.460 @@ -279,20 +292,20 @@
6.461 qed
6.462 qed
6.463
6.464 -lemma (in completeable_measure_space) completion_ex_borel_measurable:
6.465 +lemma completion_ex_borel_measurable:
6.466 fixes g :: "'a \<Rightarrow> ereal"
6.467 - assumes g: "g \<in> borel_measurable completion"
6.468 - shows "\<exists>g'\<in>borel_measurable M. (AE x. g x = g' x)"
6.469 + assumes g: "g \<in> borel_measurable (completion M)"
6.470 + shows "\<exists>g'\<in>borel_measurable M. (AE x in M. g x = g' x)"
6.471 proof -
6.472 - have "(\<lambda>x. max 0 (g x)) \<in> borel_measurable completion" "\<And>x. 0 \<le> max 0 (g x)" using g by auto
6.473 + have "(\<lambda>x. max 0 (g x)) \<in> borel_measurable (completion M)" "\<And>x. 0 \<le> max 0 (g x)" using g by auto
6.474 from completion_ex_borel_measurable_pos[OF this] guess g_pos ..
6.475 moreover
6.476 - have "(\<lambda>x. max 0 (- g x)) \<in> borel_measurable completion" "\<And>x. 0 \<le> max 0 (- g x)" using g by auto
6.477 + have "(\<lambda>x. max 0 (- g x)) \<in> borel_measurable (completion M)" "\<And>x. 0 \<le> max 0 (- g x)" using g by auto
6.478 from completion_ex_borel_measurable_pos[OF this] guess g_neg ..
6.479 ultimately
6.480 show ?thesis
6.481 proof (safe intro!: bexI[of _ "\<lambda>x. g_pos x - g_neg x"])
6.482 - show "AE x. max 0 (- g x) = g_neg x \<longrightarrow> max 0 (g x) = g_pos x \<longrightarrow> g x = g_pos x - g_neg x"
6.483 + show "AE x in M. max 0 (- g x) = g_neg x \<longrightarrow> max 0 (g x) = g_pos x \<longrightarrow> g x = g_pos x - g_neg x"
6.484 proof (intro AE_I2 impI)
6.485 fix x assume g: "max 0 (- g x) = g_neg x" "max 0 (g x) = g_pos x"
6.486 show "g x = g_pos x - g_neg x" unfolding g[symmetric]
7.1 --- a/src/HOL/Probability/Conditional_Probability.thy Mon Apr 23 12:23:23 2012 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,161 +0,0 @@
7.4 -(* Title: HOL/Probability/Conditional_Probability.thy
7.5 - Author: Johannes Hölzl, TU München
7.6 -*)
7.7 -
7.8 -header {*Conditional probability*}
7.9 -
7.10 -theory Conditional_Probability
7.11 -imports Probability_Measure Radon_Nikodym
7.12 -begin
7.13 -
7.14 -section "Conditional Expectation and Probability"
7.15 -
7.16 -definition (in prob_space)
7.17 - "conditional_expectation N X = (SOME Y. Y\<in>borel_measurable N \<and> (\<forall>x. 0 \<le> Y x)
7.18 - \<and> (\<forall>C\<in>sets N. (\<integral>\<^isup>+x. Y x * indicator C x\<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x\<partial>M)))"
7.19 -
7.20 -lemma (in prob_space) conditional_expectation_exists:
7.21 - fixes X :: "'a \<Rightarrow> ereal" and N :: "('a, 'b) measure_space_scheme"
7.22 - assumes borel: "X \<in> borel_measurable M" "AE x. 0 \<le> X x"
7.23 - and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A"
7.24 - shows "\<exists>Y\<in>borel_measurable N. (\<forall>x. 0 \<le> Y x) \<and> (\<forall>C\<in>sets N.
7.25 - (\<integral>\<^isup>+x. Y x * indicator C x \<partial>M) = (\<integral>\<^isup>+x. X x * indicator C x \<partial>M))"
7.26 -proof -
7.27 - note N(4)[simp]
7.28 - interpret P: prob_space N
7.29 - using prob_space_subalgebra[OF N] .
7.30 -
7.31 - let ?f = "\<lambda>A x. X x * indicator A x"
7.32 - let ?Q = "\<lambda>A. integral\<^isup>P M (?f A)"
7.33 -
7.34 - from measure_space_density[OF borel]
7.35 - have Q: "measure_space (N\<lparr> measure := ?Q \<rparr>)"
7.36 - apply (rule measure_space.measure_space_subalgebra[of "M\<lparr> measure := ?Q \<rparr>"])
7.37 - using N by (auto intro!: P.sigma_algebra_cong)
7.38 - then interpret Q: measure_space "N\<lparr> measure := ?Q \<rparr>" .
7.39 -
7.40 - have "P.absolutely_continuous ?Q"
7.41 - unfolding P.absolutely_continuous_def
7.42 - proof safe
7.43 - fix A assume "A \<in> sets N" "P.\<mu> A = 0"
7.44 - then have f_borel: "?f A \<in> borel_measurable M" "AE x. x \<notin> A"
7.45 - using borel N by (auto intro!: borel_measurable_indicator AE_not_in)
7.46 - then show "?Q A = 0"
7.47 - by (auto simp add: positive_integral_0_iff_AE)
7.48 - qed
7.49 - from P.Radon_Nikodym[OF Q this]
7.50 - obtain Y where Y: "Y \<in> borel_measurable N" "\<And>x. 0 \<le> Y x"
7.51 - "\<And>A. A \<in> sets N \<Longrightarrow> ?Q A =(\<integral>\<^isup>+x. Y x * indicator A x \<partial>N)"
7.52 - by blast
7.53 - with N(2) show ?thesis
7.54 - by (auto intro!: bexI[OF _ Y(1)] simp: positive_integral_subalgebra[OF _ _ N(2,3,4,1)])
7.55 -qed
7.56 -
7.57 -lemma (in prob_space)
7.58 - fixes X :: "'a \<Rightarrow> ereal" and N :: "('a, 'b) measure_space_scheme"
7.59 - assumes borel: "X \<in> borel_measurable M" "AE x. 0 \<le> X x"
7.60 - and N: "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M" "\<And>A. measure N A = \<mu> A"
7.61 - shows borel_measurable_conditional_expectation:
7.62 - "conditional_expectation N X \<in> borel_measurable N"
7.63 - and conditional_expectation: "\<And>C. C \<in> sets N \<Longrightarrow>
7.64 - (\<integral>\<^isup>+x. conditional_expectation N X x * indicator C x \<partial>M) =
7.65 - (\<integral>\<^isup>+x. X x * indicator C x \<partial>M)"
7.66 - (is "\<And>C. C \<in> sets N \<Longrightarrow> ?eq C")
7.67 -proof -
7.68 - note CE = conditional_expectation_exists[OF assms, unfolded Bex_def]
7.69 - then show "conditional_expectation N X \<in> borel_measurable N"
7.70 - unfolding conditional_expectation_def by (rule someI2_ex) blast
7.71 -
7.72 - from CE show "\<And>C. C \<in> sets N \<Longrightarrow> ?eq C"
7.73 - unfolding conditional_expectation_def by (rule someI2_ex) blast
7.74 -qed
7.75 -
7.76 -lemma (in sigma_algebra) factorize_measurable_function_pos:
7.77 - fixes Z :: "'a \<Rightarrow> ereal" and Y :: "'a \<Rightarrow> 'c"
7.78 - assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M"
7.79 - assumes Z: "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y)"
7.80 - shows "\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. max 0 (Z x) = g (Y x)"
7.81 -proof -
7.82 - interpret M': sigma_algebra M' by fact
7.83 - have Y: "Y \<in> space M \<rightarrow> space M'" using assms unfolding measurable_def by auto
7.84 - from M'.sigma_algebra_vimage[OF this]
7.85 - interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" .
7.86 -
7.87 - from va.borel_measurable_implies_simple_function_sequence'[OF Z] guess f . note f = this
7.88 -
7.89 - have "\<forall>i. \<exists>g. simple_function M' g \<and> (\<forall>x\<in>space M. f i x = g (Y x))"
7.90 - proof
7.91 - fix i
7.92 - from f(1)[of i] have "finite (f i`space M)" and B_ex:
7.93 - "\<forall>z\<in>(f i)`space M. \<exists>B. B \<in> sets M' \<and> (f i) -` {z} \<inter> space M = Y -` B \<inter> space M"
7.94 - unfolding simple_function_def by auto
7.95 - from B_ex[THEN bchoice] guess B .. note B = this
7.96 -
7.97 - let ?g = "\<lambda>x. \<Sum>z\<in>f i`space M. z * indicator (B z) x"
7.98 -
7.99 - show "\<exists>g. simple_function M' g \<and> (\<forall>x\<in>space M. f i x = g (Y x))"
7.100 - proof (intro exI[of _ ?g] conjI ballI)
7.101 - show "simple_function M' ?g" using B by auto
7.102 -
7.103 - fix x assume "x \<in> space M"
7.104 - then have "\<And>z. z \<in> f i`space M \<Longrightarrow> indicator (B z) (Y x) = (indicator (f i -` {z} \<inter> space M) x::ereal)"
7.105 - unfolding indicator_def using B by auto
7.106 - then show "f i x = ?g (Y x)" using `x \<in> space M` f(1)[of i]
7.107 - by (subst va.simple_function_indicator_representation) auto
7.108 - qed
7.109 - qed
7.110 - from choice[OF this] guess g .. note g = this
7.111 -
7.112 - show ?thesis
7.113 - proof (intro ballI bexI)
7.114 - show "(\<lambda>x. SUP i. g i x) \<in> borel_measurable M'"
7.115 - using g by (auto intro: M'.borel_measurable_simple_function)
7.116 - fix x assume "x \<in> space M"
7.117 - have "max 0 (Z x) = (SUP i. f i x)" using f by simp
7.118 - also have "\<dots> = (SUP i. g i (Y x))"
7.119 - using g `x \<in> space M` by simp
7.120 - finally show "max 0 (Z x) = (SUP i. g i (Y x))" .
7.121 - qed
7.122 -qed
7.123 -
7.124 -lemma (in sigma_algebra) factorize_measurable_function:
7.125 - fixes Z :: "'a \<Rightarrow> ereal" and Y :: "'a \<Rightarrow> 'c"
7.126 - assumes "sigma_algebra M'" and "Y \<in> measurable M M'" "Z \<in> borel_measurable M"
7.127 - shows "Z \<in> borel_measurable (sigma_algebra.vimage_algebra M' (space M) Y)
7.128 - \<longleftrightarrow> (\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x))"
7.129 -proof safe
7.130 - interpret M': sigma_algebra M' by fact
7.131 - have Y: "Y \<in> space M \<rightarrow> space M'" using assms unfolding measurable_def by auto
7.132 - from M'.sigma_algebra_vimage[OF this]
7.133 - interpret va: sigma_algebra "M'.vimage_algebra (space M) Y" .
7.134 -
7.135 - { fix g :: "'c \<Rightarrow> ereal" assume "g \<in> borel_measurable M'"
7.136 - with M'.measurable_vimage_algebra[OF Y]
7.137 - have "g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
7.138 - by (rule measurable_comp)
7.139 - moreover assume "\<forall>x\<in>space M. Z x = g (Y x)"
7.140 - then have "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y) \<longleftrightarrow>
7.141 - g \<circ> Y \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
7.142 - by (auto intro!: measurable_cong)
7.143 - ultimately show "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
7.144 - by simp }
7.145 -
7.146 - assume Z: "Z \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
7.147 - with assms have "(\<lambda>x. - Z x) \<in> borel_measurable M"
7.148 - "(\<lambda>x. - Z x) \<in> borel_measurable (M'.vimage_algebra (space M) Y)"
7.149 - by auto
7.150 - from factorize_measurable_function_pos[OF assms(1,2) this] guess n .. note n = this
7.151 - from factorize_measurable_function_pos[OF assms Z] guess p .. note p = this
7.152 - let ?g = "\<lambda>x. p x - n x"
7.153 - show "\<exists>g\<in>borel_measurable M'. \<forall>x\<in>space M. Z x = g (Y x)"
7.154 - proof (intro bexI ballI)
7.155 - show "?g \<in> borel_measurable M'" using p n by auto
7.156 - fix x assume "x \<in> space M"
7.157 - then have "p (Y x) = max 0 (Z x)" "n (Y x) = max 0 (- Z x)"
7.158 - using p n by auto
7.159 - then show "Z x = ?g (Y x)"
7.160 - by (auto split: split_max)
7.161 - qed
7.162 -qed
7.163 -
7.164 -end
7.165 \ No newline at end of file
8.1 --- a/src/HOL/Probability/Finite_Product_Measure.thy Mon Apr 23 12:23:23 2012 +0100
8.2 +++ b/src/HOL/Probability/Finite_Product_Measure.thy Mon Apr 23 12:14:35 2012 +0200
8.3 @@ -8,6 +8,9 @@
8.4 imports Binary_Product_Measure
8.5 begin
8.6
8.7 +lemma split_const: "(\<lambda>(i, j). c) = (\<lambda>_. c)"
8.8 + by auto
8.9 +
8.10 lemma Pi_iff: "f \<in> Pi I X \<longleftrightarrow> (\<forall>i\<in>I. f i \<in> X i)"
8.11 unfolding Pi_def by auto
8.12
8.13 @@ -34,9 +37,6 @@
8.14 notation (xsymbols)
8.15 funcset_extensional (infixr "\<rightarrow>\<^isub>E" 60)
8.16
8.17 -lemma extensional_empty[simp]: "extensional {} = {\<lambda>x. undefined}"
8.18 - by safe (auto simp add: extensional_def fun_eq_iff)
8.19 -
8.20 lemma extensional_insert[intro, simp]:
8.21 assumes "a \<in> extensional (insert i I)"
8.22 shows "a(i := b) \<in> extensional (insert i I)"
8.23 @@ -86,7 +86,7 @@
8.24 "I \<inter> J = {} \<Longrightarrow> restrict (merge I x J y) J = restrict y J"
8.25 "J \<inter> I = {} \<Longrightarrow> restrict (merge I x J y) I = restrict x I"
8.26 "J \<inter> I = {} \<Longrightarrow> restrict (merge I x J y) J = restrict y J"
8.27 - by (auto simp: restrict_def intro!: ext)
8.28 + by (auto simp: restrict_def)
8.29
8.30 lemma extensional_insert_undefined[intro, simp]:
8.31 assumes "a \<in> extensional (insert i I)"
8.32 @@ -130,16 +130,16 @@
8.33 using assms by (auto simp: restrict_Pi_cancel)
8.34
8.35 lemma restrict_fupd[simp]: "i \<notin> I \<Longrightarrow> restrict (f (i := x)) I = restrict f I"
8.36 - by (auto simp: restrict_def intro!: ext)
8.37 + by (auto simp: restrict_def)
8.38
8.39 lemma merge_restrict[simp]:
8.40 "merge I (restrict x I) J y = merge I x J y"
8.41 "merge I x J (restrict y J) = merge I x J y"
8.42 - unfolding merge_def by (auto intro!: ext)
8.43 + unfolding merge_def by auto
8.44
8.45 lemma merge_x_x_eq_restrict[simp]:
8.46 "merge I x J x = restrict x (I \<union> J)"
8.47 - unfolding merge_def by (auto intro!: ext)
8.48 + unfolding merge_def by auto
8.49
8.50 lemma Pi_fupd_iff: "i \<in> I \<Longrightarrow> f \<in> Pi I (B(i := A)) \<longleftrightarrow> f \<in> Pi (I - {i}) B \<and> f i \<in> A"
8.51 apply auto
8.52 @@ -233,339 +233,355 @@
8.53
8.54 section "Products"
8.55
8.56 -locale product_sigma_algebra =
8.57 - fixes M :: "'i \<Rightarrow> ('a, 'b) measure_space_scheme"
8.58 - assumes sigma_algebras: "\<And>i. sigma_algebra (M i)"
8.59 +definition prod_emb where
8.60 + "prod_emb I M K X = (\<lambda>x. restrict x K) -` X \<inter> (PIE i:I. space (M i))"
8.61
8.62 -locale finite_product_sigma_algebra = product_sigma_algebra M
8.63 - for M :: "'i \<Rightarrow> ('a, 'b) measure_space_scheme" +
8.64 - fixes I :: "'i set"
8.65 - assumes finite_index[simp, intro]: "finite I"
8.66 +lemma prod_emb_iff:
8.67 + "f \<in> prod_emb I M K X \<longleftrightarrow> f \<in> extensional I \<and> (restrict f K \<in> X) \<and> (\<forall>i\<in>I. f i \<in> space (M i))"
8.68 + unfolding prod_emb_def by auto
8.69
8.70 -definition
8.71 - "product_algebra_generator I M = \<lparr> space = (\<Pi>\<^isub>E i \<in> I. space (M i)),
8.72 - sets = Pi\<^isub>E I ` (\<Pi> i \<in> I. sets (M i)),
8.73 - measure = \<lambda>A. (\<Prod>i\<in>I. measure (M i) ((SOME F. A = Pi\<^isub>E I F) i)) \<rparr>"
8.74 +lemma
8.75 + shows prod_emb_empty[simp]: "prod_emb M L K {} = {}"
8.76 + and prod_emb_Un[simp]: "prod_emb M L K (A \<union> B) = prod_emb M L K A \<union> prod_emb M L K B"
8.77 + and prod_emb_Int: "prod_emb M L K (A \<inter> B) = prod_emb M L K A \<inter> prod_emb M L K B"
8.78 + and prod_emb_UN[simp]: "prod_emb M L K (\<Union>i\<in>I. F i) = (\<Union>i\<in>I. prod_emb M L K (F i))"
8.79 + and prod_emb_INT[simp]: "I \<noteq> {} \<Longrightarrow> prod_emb M L K (\<Inter>i\<in>I. F i) = (\<Inter>i\<in>I. prod_emb M L K (F i))"
8.80 + and prod_emb_Diff[simp]: "prod_emb M L K (A - B) = prod_emb M L K A - prod_emb M L K B"
8.81 + by (auto simp: prod_emb_def)
8.82
8.83 -definition product_algebra_def:
8.84 - "Pi\<^isub>M I M = sigma (product_algebra_generator I M)
8.85 - \<lparr> measure := (SOME \<mu>. sigma_finite_measure (sigma (product_algebra_generator I M) \<lparr> measure := \<mu> \<rparr>) \<and>
8.86 - (\<forall>A\<in>\<Pi> i\<in>I. sets (M i). \<mu> (Pi\<^isub>E I A) = (\<Prod>i\<in>I. measure (M i) (A i))))\<rparr>"
8.87 +lemma prod_emb_PiE: "J \<subseteq> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> E i \<subseteq> space (M i)) \<Longrightarrow>
8.88 + prod_emb I M J (\<Pi>\<^isub>E i\<in>J. E i) = (\<Pi>\<^isub>E i\<in>I. if i \<in> J then E i else space (M i))"
8.89 + by (force simp: prod_emb_def Pi_iff split_if_mem2)
8.90 +
8.91 +lemma prod_emb_PiE_same_index[simp]: "(\<And>i. i \<in> I \<Longrightarrow> E i \<subseteq> space (M i)) \<Longrightarrow> prod_emb I M I (Pi\<^isub>E I E) = Pi\<^isub>E I E"
8.92 + by (auto simp: prod_emb_def Pi_iff)
8.93 +
8.94 +definition PiM :: "'i set \<Rightarrow> ('i \<Rightarrow> 'a measure) \<Rightarrow> ('i \<Rightarrow> 'a) measure" where
8.95 + "PiM I M = extend_measure (\<Pi>\<^isub>E i\<in>I. space (M i))
8.96 + {(J, X). (J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}
8.97 + (\<lambda>(J, X). prod_emb I M J (\<Pi>\<^isub>E j\<in>J. X j))
8.98 + (\<lambda>(J, X). \<Prod>j\<in>J \<union> {i\<in>I. emeasure (M i) (space (M i)) \<noteq> 1}. if j \<in> J then emeasure (M j) (X j) else emeasure (M j) (space (M j)))"
8.99 +
8.100 +definition prod_algebra :: "'i set \<Rightarrow> ('i \<Rightarrow> 'a measure) \<Rightarrow> ('i \<Rightarrow> 'a) set set" where
8.101 + "prod_algebra I M = (\<lambda>(J, X). prod_emb I M J (\<Pi>\<^isub>E j\<in>J. X j)) `
8.102 + {(J, X). (J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}"
8.103 +
8.104 +abbreviation
8.105 + "Pi\<^isub>M I M \<equiv> PiM I M"
8.106
8.107 syntax
8.108 - "_PiM" :: "[pttrn, 'i set, ('a, 'b) measure_space_scheme] =>
8.109 - ('i => 'a, 'b) measure_space_scheme" ("(3PIM _:_./ _)" 10)
8.110 + "_PiM" :: "pttrn \<Rightarrow> 'i set \<Rightarrow> 'a measure \<Rightarrow> ('i => 'a) measure" ("(3PIM _:_./ _)" 10)
8.111
8.112 syntax (xsymbols)
8.113 - "_PiM" :: "[pttrn, 'i set, ('a, 'b) measure_space_scheme] =>
8.114 - ('i => 'a, 'b) measure_space_scheme" ("(3\<Pi>\<^isub>M _\<in>_./ _)" 10)
8.115 + "_PiM" :: "pttrn \<Rightarrow> 'i set \<Rightarrow> 'a measure \<Rightarrow> ('i => 'a) measure" ("(3\<Pi>\<^isub>M _\<in>_./ _)" 10)
8.116
8.117 syntax (HTML output)
8.118 - "_PiM" :: "[pttrn, 'i set, ('a, 'b) measure_space_scheme] =>
8.119 - ('i => 'a, 'b) measure_space_scheme" ("(3\<Pi>\<^isub>M _\<in>_./ _)" 10)
8.120 + "_PiM" :: "pttrn \<Rightarrow> 'i set \<Rightarrow> 'a measure \<Rightarrow> ('i => 'a) measure" ("(3\<Pi>\<^isub>M _\<in>_./ _)" 10)
8.121
8.122 translations
8.123 - "PIM x:I. M" == "CONST Pi\<^isub>M I (%x. M)"
8.124 + "PIM x:I. M" == "CONST PiM I (%x. M)"
8.125
8.126 -abbreviation (in finite_product_sigma_algebra) "G \<equiv> product_algebra_generator I M"
8.127 -abbreviation (in finite_product_sigma_algebra) "P \<equiv> Pi\<^isub>M I M"
8.128 +lemma prod_algebra_sets_into_space:
8.129 + "prod_algebra I M \<subseteq> Pow (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.130 + using assms by (auto simp: prod_emb_def prod_algebra_def)
8.131
8.132 -sublocale product_sigma_algebra \<subseteq> M: sigma_algebra "M i" for i by (rule sigma_algebras)
8.133 -
8.134 -lemma sigma_into_space:
8.135 - assumes "sets M \<subseteq> Pow (space M)"
8.136 - shows "sets (sigma M) \<subseteq> Pow (space M)"
8.137 - using sigma_sets_into_sp[OF assms] unfolding sigma_def by auto
8.138 -
8.139 -lemma (in product_sigma_algebra) product_algebra_generator_into_space:
8.140 - "sets (product_algebra_generator I M) \<subseteq> Pow (space (product_algebra_generator I M))"
8.141 - using M.sets_into_space unfolding product_algebra_generator_def
8.142 - by auto blast
8.143 -
8.144 -lemma (in product_sigma_algebra) product_algebra_into_space:
8.145 - "sets (Pi\<^isub>M I M) \<subseteq> Pow (space (Pi\<^isub>M I M))"
8.146 - using product_algebra_generator_into_space
8.147 - by (auto intro!: sigma_into_space simp add: product_algebra_def)
8.148 -
8.149 -lemma (in product_sigma_algebra) sigma_algebra_product_algebra: "sigma_algebra (Pi\<^isub>M I M)"
8.150 - using product_algebra_generator_into_space unfolding product_algebra_def
8.151 - by (rule sigma_algebra.sigma_algebra_cong[OF sigma_algebra_sigma]) simp_all
8.152 -
8.153 -sublocale finite_product_sigma_algebra \<subseteq> sigma_algebra P
8.154 - using sigma_algebra_product_algebra .
8.155 -
8.156 -lemma product_algebraE:
8.157 - assumes "A \<in> sets (product_algebra_generator I M)"
8.158 - obtains E where "A = Pi\<^isub>E I E" "E \<in> (\<Pi> i\<in>I. sets (M i))"
8.159 - using assms unfolding product_algebra_generator_def by auto
8.160 -
8.161 -lemma product_algebra_generatorI[intro]:
8.162 - assumes "E \<in> (\<Pi> i\<in>I. sets (M i))"
8.163 - shows "Pi\<^isub>E I E \<in> sets (product_algebra_generator I M)"
8.164 - using assms unfolding product_algebra_generator_def by auto
8.165 -
8.166 -lemma space_product_algebra_generator[simp]:
8.167 - "space (product_algebra_generator I M) = Pi\<^isub>E I (\<lambda>i. space (M i))"
8.168 - unfolding product_algebra_generator_def by simp
8.169 -
8.170 -lemma space_product_algebra[simp]:
8.171 - "space (Pi\<^isub>M I M) = (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.172 - unfolding product_algebra_def product_algebra_generator_def by simp
8.173 -
8.174 -lemma sets_product_algebra:
8.175 - "sets (Pi\<^isub>M I M) = sets (sigma (product_algebra_generator I M))"
8.176 - unfolding product_algebra_def sigma_def by simp
8.177 -
8.178 -lemma product_algebra_generator_sets_into_space:
8.179 - assumes "\<And>i. i\<in>I \<Longrightarrow> sets (M i) \<subseteq> Pow (space (M i))"
8.180 - shows "sets (product_algebra_generator I M) \<subseteq> Pow (space (product_algebra_generator I M))"
8.181 - using assms by (auto simp: product_algebra_generator_def) blast
8.182 -
8.183 -lemma (in finite_product_sigma_algebra) in_P[simp, intro]:
8.184 - "\<lbrakk> \<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i) \<rbrakk> \<Longrightarrow> Pi\<^isub>E I A \<in> sets P"
8.185 - by (auto simp: sets_product_algebra)
8.186 -
8.187 -lemma Int_stable_product_algebra_generator:
8.188 - "(\<And>i. i \<in> I \<Longrightarrow> Int_stable (M i)) \<Longrightarrow> Int_stable (product_algebra_generator I M)"
8.189 - by (auto simp add: product_algebra_generator_def Int_stable_def PiE_Int Pi_iff)
8.190 -
8.191 -section "Generating set generates also product algebra"
8.192 -
8.193 -lemma sigma_product_algebra_sigma_eq:
8.194 - assumes "finite I"
8.195 - assumes mono: "\<And>i. i \<in> I \<Longrightarrow> incseq (S i)"
8.196 - assumes union: "\<And>i. i \<in> I \<Longrightarrow> (\<Union>j. S i j) = space (E i)"
8.197 - assumes sets_into: "\<And>i. i \<in> I \<Longrightarrow> range (S i) \<subseteq> sets (E i)"
8.198 - and E: "\<And>i. sets (E i) \<subseteq> Pow (space (E i))"
8.199 - shows "sets (\<Pi>\<^isub>M i\<in>I. sigma (E i)) = sets (\<Pi>\<^isub>M i\<in>I. E i)"
8.200 - (is "sets ?S = sets ?E")
8.201 -proof cases
8.202 - assume "I = {}" then show ?thesis
8.203 - by (simp add: product_algebra_def product_algebra_generator_def)
8.204 +lemma prod_algebra_eq_finite:
8.205 + assumes I: "finite I"
8.206 + shows "prod_algebra I M = {(\<Pi>\<^isub>E i\<in>I. X i) |X. X \<in> (\<Pi> j\<in>I. sets (M j))}" (is "?L = ?R")
8.207 +proof (intro iffI set_eqI)
8.208 + fix A assume "A \<in> ?L"
8.209 + then obtain J E where J: "J \<noteq> {} \<or> I = {}" "finite J" "J \<subseteq> I" "\<forall>i\<in>J. E i \<in> sets (M i)"
8.210 + and A: "A = prod_emb I M J (PIE j:J. E j)"
8.211 + by (auto simp: prod_algebra_def)
8.212 + let ?A = "\<Pi>\<^isub>E i\<in>I. if i \<in> J then E i else space (M i)"
8.213 + have A: "A = ?A"
8.214 + unfolding A using J by (intro prod_emb_PiE sets_into_space) auto
8.215 + show "A \<in> ?R" unfolding A using J top
8.216 + by (intro CollectI exI[of _ "\<lambda>i. if i \<in> J then E i else space (M i)"]) simp
8.217 next
8.218 - assume "I \<noteq> {}"
8.219 - interpret E: sigma_algebra "sigma (E i)" for i
8.220 - using E by (rule sigma_algebra_sigma)
8.221 - have into_space[intro]: "\<And>i x A. A \<in> sets (E i) \<Longrightarrow> x i \<in> A \<Longrightarrow> x i \<in> space (E i)"
8.222 - using E by auto
8.223 - interpret G: sigma_algebra ?E
8.224 - unfolding product_algebra_def product_algebra_generator_def using E
8.225 - by (intro sigma_algebra.sigma_algebra_cong[OF sigma_algebra_sigma]) (auto dest: Pi_mem)
8.226 - { fix A i assume "i \<in> I" and A: "A \<in> sets (E i)"
8.227 - then have "(\<lambda>x. x i) -` A \<inter> space ?E = (\<Pi>\<^isub>E j\<in>I. if j = i then A else \<Union>n. S j n) \<inter> space ?E"
8.228 - using mono union unfolding incseq_Suc_iff space_product_algebra
8.229 - by (auto dest: Pi_mem)
8.230 - also have "\<dots> = (\<Union>n. (\<Pi>\<^isub>E j\<in>I. if j = i then A else S j n))"
8.231 - unfolding space_product_algebra
8.232 - apply simp
8.233 - apply (subst Pi_UN[OF `finite I`])
8.234 - using mono[THEN incseqD] apply simp
8.235 - apply (simp add: PiE_Int)
8.236 - apply (intro PiE_cong)
8.237 - using A sets_into by (auto intro!: into_space)
8.238 - also have "\<dots> \<in> sets ?E"
8.239 - using sets_into `A \<in> sets (E i)`
8.240 - unfolding sets_product_algebra sets_sigma
8.241 - by (intro sigma_sets.Union)
8.242 - (auto simp: image_subset_iff intro!: sigma_sets.Basic)
8.243 - finally have "(\<lambda>x. x i) -` A \<inter> space ?E \<in> sets ?E" . }
8.244 - then have proj:
8.245 - "\<And>i. i\<in>I \<Longrightarrow> (\<lambda>x. x i) \<in> measurable ?E (sigma (E i))"
8.246 - using E by (subst G.measurable_iff_sigma)
8.247 - (auto simp: sets_product_algebra sets_sigma)
8.248 - { fix A assume A: "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (sigma (E i))"
8.249 - with proj have basic: "\<And>i. i \<in> I \<Longrightarrow> (\<lambda>x. x i) -` (A i) \<inter> space ?E \<in> sets ?E"
8.250 - unfolding measurable_def by simp
8.251 - have "Pi\<^isub>E I A = (\<Inter>i\<in>I. (\<lambda>x. x i) -` (A i) \<inter> space ?E)"
8.252 - using A E.sets_into_space `I \<noteq> {}` unfolding product_algebra_def by auto blast
8.253 - then have "Pi\<^isub>E I A \<in> sets ?E"
8.254 - using G.finite_INT[OF `finite I` `I \<noteq> {}` basic, of "\<lambda>i. i"] by simp }
8.255 - then have "sigma_sets (space ?E) (sets (product_algebra_generator I (\<lambda>i. sigma (E i)))) \<subseteq> sets ?E"
8.256 - by (intro G.sigma_sets_subset) (auto simp add: product_algebra_generator_def)
8.257 - then have subset: "sets ?S \<subseteq> sets ?E"
8.258 - by (simp add: sets_sigma sets_product_algebra)
8.259 - show "sets ?S = sets ?E"
8.260 - proof (intro set_eqI iffI)
8.261 - fix A assume "A \<in> sets ?E" then show "A \<in> sets ?S"
8.262 - unfolding sets_sigma sets_product_algebra
8.263 - proof induct
8.264 - case (Basic A) then show ?case
8.265 - by (auto simp: sets_sigma product_algebra_generator_def intro: sigma_sets.Basic)
8.266 - qed (auto intro: sigma_sets.intros simp: product_algebra_generator_def)
8.267 - next
8.268 - fix A assume "A \<in> sets ?S" then show "A \<in> sets ?E" using subset by auto
8.269 - qed
8.270 + fix A assume "A \<in> ?R"
8.271 + then obtain X where "A = (\<Pi>\<^isub>E i\<in>I. X i)" and X: "X \<in> (\<Pi> j\<in>I. sets (M j))" by auto
8.272 + then have A: "A = prod_emb I M I (\<Pi>\<^isub>E i\<in>I. X i)"
8.273 + using sets_into_space by (force simp: prod_emb_def Pi_iff)
8.274 + from X I show "A \<in> ?L" unfolding A
8.275 + by (auto simp: prod_algebra_def)
8.276 qed
8.277
8.278 -lemma product_algebraI[intro]:
8.279 - "E \<in> (\<Pi> i\<in>I. sets (M i)) \<Longrightarrow> Pi\<^isub>E I E \<in> sets (Pi\<^isub>M I M)"
8.280 - using assms unfolding product_algebra_def by (auto intro: product_algebra_generatorI)
8.281 +lemma prod_algebraI:
8.282 + "finite J \<Longrightarrow> (J \<noteq> {} \<or> I = {}) \<Longrightarrow> J \<subseteq> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> E i \<in> sets (M i))
8.283 + \<Longrightarrow> prod_emb I M J (PIE j:J. E j) \<in> prod_algebra I M"
8.284 + by (auto simp: prod_algebra_def Pi_iff)
8.285
8.286 -lemma (in product_sigma_algebra) measurable_component_update:
8.287 +lemma prod_algebraE:
8.288 + assumes A: "A \<in> prod_algebra I M"
8.289 + obtains J E where "A = prod_emb I M J (PIE j:J. E j)"
8.290 + "finite J" "J \<noteq> {} \<or> I = {}" "J \<subseteq> I" "\<And>i. i \<in> J \<Longrightarrow> E i \<in> sets (M i)"
8.291 + using A by (auto simp: prod_algebra_def)
8.292 +
8.293 +lemma prod_algebraE_all:
8.294 + assumes A: "A \<in> prod_algebra I M"
8.295 + obtains E where "A = Pi\<^isub>E I E" "E \<in> (\<Pi> i\<in>I. sets (M i))"
8.296 +proof -
8.297 + from A obtain E J where A: "A = prod_emb I M J (Pi\<^isub>E J E)"
8.298 + and J: "J \<subseteq> I" and E: "E \<in> (\<Pi> i\<in>J. sets (M i))"
8.299 + by (auto simp: prod_algebra_def)
8.300 + from E have "\<And>i. i \<in> J \<Longrightarrow> E i \<subseteq> space (M i)"
8.301 + using sets_into_space by auto
8.302 + then have "A = (\<Pi>\<^isub>E i\<in>I. if i\<in>J then E i else space (M i))"
8.303 + using A J by (auto simp: prod_emb_PiE)
8.304 + moreover then have "(\<lambda>i. if i\<in>J then E i else space (M i)) \<in> (\<Pi> i\<in>I. sets (M i))"
8.305 + using top E by auto
8.306 + ultimately show ?thesis using that by auto
8.307 +qed
8.308 +
8.309 +lemma Int_stable_prod_algebra: "Int_stable (prod_algebra I M)"
8.310 +proof (unfold Int_stable_def, safe)
8.311 + fix A assume "A \<in> prod_algebra I M"
8.312 + from prod_algebraE[OF this] guess J E . note A = this
8.313 + fix B assume "B \<in> prod_algebra I M"
8.314 + from prod_algebraE[OF this] guess K F . note B = this
8.315 + have "A \<inter> B = prod_emb I M (J \<union> K) (\<Pi>\<^isub>E i\<in>J \<union> K. (if i \<in> J then E i else space (M i)) \<inter>
8.316 + (if i \<in> K then F i else space (M i)))"
8.317 + unfolding A B using A(2,3,4) A(5)[THEN sets_into_space] B(2,3,4) B(5)[THEN sets_into_space]
8.318 + apply (subst (1 2 3) prod_emb_PiE)
8.319 + apply (simp_all add: subset_eq PiE_Int)
8.320 + apply blast
8.321 + apply (intro PiE_cong)
8.322 + apply auto
8.323 + done
8.324 + also have "\<dots> \<in> prod_algebra I M"
8.325 + using A B by (auto intro!: prod_algebraI)
8.326 + finally show "A \<inter> B \<in> prod_algebra I M" .
8.327 +qed
8.328 +
8.329 +lemma prod_algebra_mono:
8.330 + assumes space: "\<And>i. i \<in> I \<Longrightarrow> space (E i) = space (F i)"
8.331 + assumes sets: "\<And>i. i \<in> I \<Longrightarrow> sets (E i) \<subseteq> sets (F i)"
8.332 + shows "prod_algebra I E \<subseteq> prod_algebra I F"
8.333 +proof
8.334 + fix A assume "A \<in> prod_algebra I E"
8.335 + then obtain J G where J: "J \<noteq> {} \<or> I = {}" "finite J" "J \<subseteq> I"
8.336 + and A: "A = prod_emb I E J (\<Pi>\<^isub>E i\<in>J. G i)"
8.337 + and G: "\<And>i. i \<in> J \<Longrightarrow> G i \<in> sets (E i)"
8.338 + by (auto simp: prod_algebra_def)
8.339 + moreover
8.340 + from space have "(\<Pi>\<^isub>E i\<in>I. space (E i)) = (\<Pi>\<^isub>E i\<in>I. space (F i))"
8.341 + by (rule PiE_cong)
8.342 + with A have "A = prod_emb I F J (\<Pi>\<^isub>E i\<in>J. G i)"
8.343 + by (simp add: prod_emb_def)
8.344 + moreover
8.345 + from sets G J have "\<And>i. i \<in> J \<Longrightarrow> G i \<in> sets (F i)"
8.346 + by auto
8.347 + ultimately show "A \<in> prod_algebra I F"
8.348 + apply (simp add: prod_algebra_def image_iff)
8.349 + apply (intro exI[of _ J] exI[of _ G] conjI)
8.350 + apply auto
8.351 + done
8.352 +qed
8.353 +
8.354 +lemma space_PiM: "space (\<Pi>\<^isub>M i\<in>I. M i) = (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.355 + using prod_algebra_sets_into_space unfolding PiM_def prod_algebra_def by (intro space_extend_measure) simp
8.356 +
8.357 +lemma sets_PiM: "sets (\<Pi>\<^isub>M i\<in>I. M i) = sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) (prod_algebra I M)"
8.358 + using prod_algebra_sets_into_space unfolding PiM_def prod_algebra_def by (intro sets_extend_measure) simp
8.359 +
8.360 +lemma sets_PiM_single: "sets (PiM I M) =
8.361 + sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) {{f\<in>\<Pi>\<^isub>E i\<in>I. space (M i). f i \<in> A} | i A. i \<in> I \<and> A \<in> sets (M i)}"
8.362 + (is "_ = sigma_sets ?\<Omega> ?R")
8.363 + unfolding sets_PiM
8.364 +proof (rule sigma_sets_eqI)
8.365 + interpret R: sigma_algebra ?\<Omega> "sigma_sets ?\<Omega> ?R" by (rule sigma_algebra_sigma_sets) auto
8.366 + fix A assume "A \<in> prod_algebra I M"
8.367 + from prod_algebraE[OF this] guess J X . note X = this
8.368 + show "A \<in> sigma_sets ?\<Omega> ?R"
8.369 + proof cases
8.370 + assume "I = {}"
8.371 + with X have "A = {\<lambda>x. undefined}" by (auto simp: prod_emb_def)
8.372 + with `I = {}` show ?thesis by (auto intro!: sigma_sets_top)
8.373 + next
8.374 + assume "I \<noteq> {}"
8.375 + with X have "A = (\<Inter>j\<in>J. {f\<in>(\<Pi>\<^isub>E i\<in>I. space (M i)). f j \<in> X j})"
8.376 + using sets_into_space[OF X(5)]
8.377 + by (auto simp: prod_emb_PiE[OF _ sets_into_space] Pi_iff split: split_if_asm) blast
8.378 + also have "\<dots> \<in> sigma_sets ?\<Omega> ?R"
8.379 + using X `I \<noteq> {}` by (intro R.finite_INT sigma_sets.Basic) auto
8.380 + finally show "A \<in> sigma_sets ?\<Omega> ?R" .
8.381 + qed
8.382 +next
8.383 + fix A assume "A \<in> ?R"
8.384 + then obtain i B where A: "A = {f\<in>\<Pi>\<^isub>E i\<in>I. space (M i). f i \<in> B}" "i \<in> I" "B \<in> sets (M i)"
8.385 + by auto
8.386 + then have "A = prod_emb I M {i} (\<Pi>\<^isub>E i\<in>{i}. B)"
8.387 + using sets_into_space[OF A(3)]
8.388 + apply (subst prod_emb_PiE)
8.389 + apply (auto simp: Pi_iff split: split_if_asm)
8.390 + apply blast
8.391 + done
8.392 + also have "\<dots> \<in> sigma_sets ?\<Omega> (prod_algebra I M)"
8.393 + using A by (intro sigma_sets.Basic prod_algebraI) auto
8.394 + finally show "A \<in> sigma_sets ?\<Omega> (prod_algebra I M)" .
8.395 +qed
8.396 +
8.397 +lemma sets_PiM_I:
8.398 + assumes "finite J" "J \<subseteq> I" "\<forall>i\<in>J. E i \<in> sets (M i)"
8.399 + shows "prod_emb I M J (PIE j:J. E j) \<in> sets (PIM i:I. M i)"
8.400 +proof cases
8.401 + assume "J = {}"
8.402 + then have "prod_emb I M J (PIE j:J. E j) = (PIE j:I. space (M j))"
8.403 + by (auto simp: prod_emb_def)
8.404 + then show ?thesis
8.405 + by (auto simp add: sets_PiM intro!: sigma_sets_top)
8.406 +next
8.407 + assume "J \<noteq> {}" with assms show ?thesis
8.408 + by (auto simp add: sets_PiM prod_algebra_def intro!: sigma_sets.Basic)
8.409 +qed
8.410 +
8.411 +lemma measurable_PiM:
8.412 + assumes space: "f \<in> space N \<rightarrow> (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.413 + assumes sets: "\<And>X J. J \<noteq> {} \<or> I = {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)) \<Longrightarrow>
8.414 + f -` prod_emb I M J (Pi\<^isub>E J X) \<inter> space N \<in> sets N"
8.415 + shows "f \<in> measurable N (PiM I M)"
8.416 + using sets_PiM prod_algebra_sets_into_space space
8.417 +proof (rule measurable_sigma_sets)
8.418 + fix A assume "A \<in> prod_algebra I M"
8.419 + from prod_algebraE[OF this] guess J X .
8.420 + with sets[of J X] show "f -` A \<inter> space N \<in> sets N" by auto
8.421 +qed
8.422 +
8.423 +lemma measurable_PiM_Collect:
8.424 + assumes space: "f \<in> space N \<rightarrow> (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.425 + assumes sets: "\<And>X J. J \<noteq> {} \<or> I = {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)) \<Longrightarrow>
8.426 + {\<omega>\<in>space N. \<forall>i\<in>J. f \<omega> i \<in> X i} \<in> sets N"
8.427 + shows "f \<in> measurable N (PiM I M)"
8.428 + using sets_PiM prod_algebra_sets_into_space space
8.429 +proof (rule measurable_sigma_sets)
8.430 + fix A assume "A \<in> prod_algebra I M"
8.431 + from prod_algebraE[OF this] guess J X . note X = this
8.432 + have "f -` A \<inter> space N = {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i}"
8.433 + using sets_into_space[OF X(5)] X(2-) space unfolding X(1)
8.434 + by (subst prod_emb_PiE) (auto simp: Pi_iff split: split_if_asm)
8.435 + also have "\<dots> \<in> sets N" using X(3,2,4,5) by (rule sets)
8.436 + finally show "f -` A \<inter> space N \<in> sets N" .
8.437 +qed
8.438 +
8.439 +lemma measurable_PiM_single:
8.440 + assumes space: "f \<in> space N \<rightarrow> (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.441 + assumes sets: "\<And>A i. i \<in> I \<Longrightarrow> A \<in> sets (M i) \<Longrightarrow> {\<omega> \<in> space N. f \<omega> i \<in> A} \<in> sets N"
8.442 + shows "f \<in> measurable N (PiM I M)"
8.443 + using sets_PiM_single
8.444 +proof (rule measurable_sigma_sets)
8.445 + fix A assume "A \<in> {{f \<in> \<Pi>\<^isub>E i\<in>I. space (M i). f i \<in> A} |i A. i \<in> I \<and> A \<in> sets (M i)}"
8.446 + then obtain B i where "A = {f \<in> \<Pi>\<^isub>E i\<in>I. space (M i). f i \<in> B}" and B: "i \<in> I" "B \<in> sets (M i)"
8.447 + by auto
8.448 + with space have "f -` A \<inter> space N = {\<omega> \<in> space N. f \<omega> i \<in> B}" by auto
8.449 + also have "\<dots> \<in> sets N" using B by (rule sets)
8.450 + finally show "f -` A \<inter> space N \<in> sets N" .
8.451 +qed (auto simp: space)
8.452 +
8.453 +lemma sets_PiM_I_finite[simp, intro]:
8.454 + assumes "finite I" and sets: "(\<And>i. i \<in> I \<Longrightarrow> E i \<in> sets (M i))"
8.455 + shows "(PIE j:I. E j) \<in> sets (PIM i:I. M i)"
8.456 + using sets_PiM_I[of I I E M] sets_into_space[OF sets] `finite I` sets by auto
8.457 +
8.458 +lemma measurable_component_update:
8.459 assumes "x \<in> space (Pi\<^isub>M I M)" and "i \<notin> I"
8.460 shows "(\<lambda>v. x(i := v)) \<in> measurable (M i) (Pi\<^isub>M (insert i I) M)" (is "?f \<in> _")
8.461 - unfolding product_algebra_def apply simp
8.462 -proof (intro measurable_sigma)
8.463 - let ?G = "product_algebra_generator (insert i I) M"
8.464 - show "sets ?G \<subseteq> Pow (space ?G)" using product_algebra_generator_into_space .
8.465 - show "?f \<in> space (M i) \<rightarrow> space ?G"
8.466 - using M.sets_into_space assms by auto
8.467 - fix A assume "A \<in> sets ?G"
8.468 - from product_algebraE[OF this] guess E . note E = this
8.469 - then have "?f -` A \<inter> space (M i) = E i \<or> ?f -` A \<inter> space (M i) = {}"
8.470 - using M.sets_into_space assms by auto
8.471 - then show "?f -` A \<inter> space (M i) \<in> sets (M i)"
8.472 - using E by (auto intro!: product_algebraI)
8.473 -qed
8.474 +proof (intro measurable_PiM_single)
8.475 + fix j A assume "j \<in> insert i I" "A \<in> sets (M j)"
8.476 + moreover have "{\<omega> \<in> space (M i). (x(i := \<omega>)) j \<in> A} =
8.477 + (if i = j then space (M i) \<inter> A else if x j \<in> A then space (M i) else {})"
8.478 + by auto
8.479 + ultimately show "{\<omega> \<in> space (M i). (x(i := \<omega>)) j \<in> A} \<in> sets (M i)"
8.480 + by auto
8.481 +qed (insert sets_into_space assms, auto simp: space_PiM)
8.482
8.483 -lemma (in product_sigma_algebra) measurable_add_dim:
8.484 - assumes "i \<notin> I"
8.485 - shows "(\<lambda>(f, y). f(i := y)) \<in> measurable (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) (Pi\<^isub>M (insert i I) M)"
8.486 -proof -
8.487 - let ?f = "(\<lambda>(f, y). f(i := y))" and ?G = "product_algebra_generator (insert i I) M"
8.488 - interpret Ii: pair_sigma_algebra "Pi\<^isub>M I M" "M i"
8.489 - unfolding pair_sigma_algebra_def
8.490 - by (intro sigma_algebra_product_algebra sigma_algebras conjI)
8.491 - have "?f \<in> measurable Ii.P (sigma ?G)"
8.492 - proof (rule Ii.measurable_sigma)
8.493 - show "sets ?G \<subseteq> Pow (space ?G)"
8.494 - using product_algebra_generator_into_space .
8.495 - show "?f \<in> space (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) \<rightarrow> space ?G"
8.496 - by (auto simp: space_pair_measure)
8.497 - next
8.498 - fix A assume "A \<in> sets ?G"
8.499 - then obtain F where "A = Pi\<^isub>E (insert i I) F"
8.500 - and F: "\<And>j. j \<in> I \<Longrightarrow> F j \<in> sets (M j)" "F i \<in> sets (M i)"
8.501 - by (auto elim!: product_algebraE)
8.502 - then have "?f -` A \<inter> space (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) = Pi\<^isub>E I F \<times> (F i)"
8.503 - using sets_into_space `i \<notin> I`
8.504 - by (auto simp add: space_pair_measure) blast+
8.505 - then show "?f -` A \<inter> space (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) \<in> sets (Pi\<^isub>M I M \<Otimes>\<^isub>M M i)"
8.506 - using F by (auto intro!: pair_measureI)
8.507 - qed
8.508 - then show ?thesis
8.509 - by (simp add: product_algebra_def)
8.510 -qed
8.511 -
8.512 -lemma (in product_sigma_algebra) measurable_merge:
8.513 - assumes [simp]: "I \<inter> J = {}"
8.514 - shows "(\<lambda>(x, y). merge I x J y) \<in> measurable (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) (Pi\<^isub>M (I \<union> J) M)"
8.515 -proof -
8.516 - let ?I = "Pi\<^isub>M I M" and ?J = "Pi\<^isub>M J M"
8.517 - interpret P: sigma_algebra "?I \<Otimes>\<^isub>M ?J"
8.518 - by (intro sigma_algebra_pair_measure product_algebra_into_space)
8.519 - let ?f = "\<lambda>(x, y). merge I x J y"
8.520 - let ?G = "product_algebra_generator (I \<union> J) M"
8.521 - have "?f \<in> measurable (?I \<Otimes>\<^isub>M ?J) (sigma ?G)"
8.522 - proof (rule P.measurable_sigma)
8.523 - fix A assume "A \<in> sets ?G"
8.524 - from product_algebraE[OF this]
8.525 - obtain E where E: "A = Pi\<^isub>E (I \<union> J) E" "E \<in> (\<Pi> i\<in>I \<union> J. sets (M i))" .
8.526 - then have *: "?f -` A \<inter> space (?I \<Otimes>\<^isub>M ?J) = Pi\<^isub>E I E \<times> Pi\<^isub>E J E"
8.527 - using sets_into_space `I \<inter> J = {}`
8.528 - by (auto simp add: space_pair_measure) fast+
8.529 - then show "?f -` A \<inter> space (?I \<Otimes>\<^isub>M ?J) \<in> sets (?I \<Otimes>\<^isub>M ?J)"
8.530 - using E unfolding * by (auto intro!: pair_measureI in_sigma product_algebra_generatorI
8.531 - simp: product_algebra_def)
8.532 - qed (insert product_algebra_generator_into_space, auto simp: space_pair_measure)
8.533 - then show "?f \<in> measurable (?I \<Otimes>\<^isub>M ?J) (Pi\<^isub>M (I \<union> J) M)"
8.534 - unfolding product_algebra_def[of "I \<union> J"] by simp
8.535 -qed
8.536 -
8.537 -lemma (in product_sigma_algebra) measurable_component_singleton:
8.538 +lemma measurable_component_singleton:
8.539 assumes "i \<in> I" shows "(\<lambda>x. x i) \<in> measurable (Pi\<^isub>M I M) (M i)"
8.540 proof (unfold measurable_def, intro CollectI conjI ballI)
8.541 fix A assume "A \<in> sets (M i)"
8.542 - then have "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>M I M) = (\<Pi>\<^isub>E j\<in>I. if i = j then A else space (M j))"
8.543 - using M.sets_into_space `i \<in> I` by (fastforce dest: Pi_mem split: split_if_asm)
8.544 + then have "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>M I M) = prod_emb I M {i} (\<Pi>\<^isub>E j\<in>{i}. A)"
8.545 + using sets_into_space `i \<in> I`
8.546 + by (fastforce dest: Pi_mem simp: prod_emb_def space_PiM split: split_if_asm)
8.547 then show "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>M I M) \<in> sets (Pi\<^isub>M I M)"
8.548 - using `A \<in> sets (M i)` by (auto intro!: product_algebraI)
8.549 -qed (insert `i \<in> I`, auto)
8.550 + using `A \<in> sets (M i)` `i \<in> I` by (auto intro!: sets_PiM_I)
8.551 +qed (insert `i \<in> I`, auto simp: space_PiM)
8.552
8.553 -lemma (in sigma_algebra) measurable_restrict:
8.554 - assumes I: "finite I"
8.555 - assumes "\<And>i. i \<in> I \<Longrightarrow> sets (N i) \<subseteq> Pow (space (N i))"
8.556 - assumes X: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> measurable M (N i)"
8.557 - shows "(\<lambda>x. \<lambda>i\<in>I. X i x) \<in> measurable M (Pi\<^isub>M I N)"
8.558 - unfolding product_algebra_def
8.559 -proof (simp, rule measurable_sigma)
8.560 - show "sets (product_algebra_generator I N) \<subseteq> Pow (space (product_algebra_generator I N))"
8.561 - by (rule product_algebra_generator_sets_into_space) fact
8.562 - show "(\<lambda>x. \<lambda>i\<in>I. X i x) \<in> space M \<rightarrow> space (product_algebra_generator I N)"
8.563 - using X by (auto simp: measurable_def)
8.564 - fix E assume "E \<in> sets (product_algebra_generator I N)"
8.565 - then obtain F where "E = Pi\<^isub>E I F" and F: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets (N i)"
8.566 - by (auto simp: product_algebra_generator_def)
8.567 - then have "(\<lambda>x. \<lambda>i\<in>I. X i x) -` E \<inter> space M = (\<Inter>i\<in>I. X i -` F i \<inter> space M) \<inter> space M"
8.568 - by (auto simp: Pi_iff)
8.569 - also have "\<dots> \<in> sets M"
8.570 - proof cases
8.571 - assume "I = {}" then show ?thesis by simp
8.572 - next
8.573 - assume "I \<noteq> {}" with X F I show ?thesis
8.574 - by (intro finite_INT measurable_sets Int) auto
8.575 - qed
8.576 - finally show "(\<lambda>x. \<lambda>i\<in>I. X i x) -` E \<inter> space M \<in> sets M" .
8.577 -qed
8.578 +lemma measurable_add_dim:
8.579 + assumes "i \<notin> I"
8.580 + shows "(\<lambda>(f, y). f(i := y)) \<in> measurable (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) (Pi\<^isub>M (insert i I) M)"
8.581 + (is "?f \<in> measurable ?P ?I")
8.582 +proof (rule measurable_PiM_single)
8.583 + fix j A assume j: "j \<in> insert i I" and A: "A \<in> sets (M j)"
8.584 + have "{\<omega> \<in> space ?P. (\<lambda>(f, x). fun_upd f i x) \<omega> j \<in> A} =
8.585 + (if j = i then space (Pi\<^isub>M I M) \<times> A else ((\<lambda>x. x j) \<circ> fst) -` A \<inter> space ?P)"
8.586 + using sets_into_space[OF A] by (auto simp add: space_pair_measure space_PiM)
8.587 + also have "\<dots> \<in> sets ?P"
8.588 + using A j
8.589 + by (auto intro!: measurable_sets[OF measurable_comp, OF _ measurable_component_singleton])
8.590 + finally show "{\<omega> \<in> space ?P. prod_case (\<lambda>f. fun_upd f i) \<omega> j \<in> A} \<in> sets ?P" .
8.591 +qed (auto simp: space_pair_measure space_PiM)
8.592
8.593 -locale product_sigma_finite = product_sigma_algebra M
8.594 - for M :: "'i \<Rightarrow> ('a,'b) measure_space_scheme" +
8.595 +lemma measurable_merge:
8.596 + assumes "I \<inter> J = {}"
8.597 + shows "(\<lambda>(x, y). merge I x J y) \<in> measurable (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) (Pi\<^isub>M (I \<union> J) M)"
8.598 + (is "?f \<in> measurable ?P ?U")
8.599 +proof (rule measurable_PiM_single)
8.600 + fix i A assume A: "A \<in> sets (M i)" "i \<in> I \<union> J"
8.601 + then have "{\<omega> \<in> space ?P. prod_case (\<lambda>x. merge I x J) \<omega> i \<in> A} =
8.602 + (if i \<in> I then ((\<lambda>x. x i) \<circ> fst) -` A \<inter> space ?P else ((\<lambda>x. x i) \<circ> snd) -` A \<inter> space ?P)"
8.603 + using `I \<inter> J = {}` by auto
8.604 + also have "\<dots> \<in> sets ?P"
8.605 + using A
8.606 + by (auto intro!: measurable_sets[OF measurable_comp, OF _ measurable_component_singleton])
8.607 + finally show "{\<omega> \<in> space ?P. prod_case (\<lambda>x. merge I x J) \<omega> i \<in> A} \<in> sets ?P" .
8.608 +qed (insert assms, auto simp: space_pair_measure space_PiM)
8.609 +
8.610 +lemma measurable_restrict:
8.611 + assumes X: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> measurable N (M i)"
8.612 + shows "(\<lambda>x. \<lambda>i\<in>I. X i x) \<in> measurable N (Pi\<^isub>M I M)"
8.613 +proof (rule measurable_PiM_single)
8.614 + fix A i assume A: "i \<in> I" "A \<in> sets (M i)"
8.615 + then have "{\<omega> \<in> space N. (\<lambda>i\<in>I. X i \<omega>) i \<in> A} = X i -` A \<inter> space N"
8.616 + by auto
8.617 + then show "{\<omega> \<in> space N. (\<lambda>i\<in>I. X i \<omega>) i \<in> A} \<in> sets N"
8.618 + using A X by (auto intro!: measurable_sets)
8.619 +qed (insert X, auto dest: measurable_space)
8.620 +
8.621 +locale product_sigma_finite =
8.622 + fixes M :: "'i \<Rightarrow> 'a measure"
8.623 assumes sigma_finite_measures: "\<And>i. sigma_finite_measure (M i)"
8.624
8.625 sublocale product_sigma_finite \<subseteq> M: sigma_finite_measure "M i" for i
8.626 by (rule sigma_finite_measures)
8.627
8.628 -locale finite_product_sigma_finite = finite_product_sigma_algebra M I + product_sigma_finite M
8.629 - for M :: "'i \<Rightarrow> ('a,'b) measure_space_scheme" and I :: "'i set"
8.630 -
8.631 -lemma (in finite_product_sigma_finite) product_algebra_generator_measure:
8.632 - assumes "Pi\<^isub>E I F \<in> sets G"
8.633 - shows "measure G (Pi\<^isub>E I F) = (\<Prod>i\<in>I. M.\<mu> i (F i))"
8.634 -proof cases
8.635 - assume ne: "\<forall>i\<in>I. F i \<noteq> {}"
8.636 - have "\<forall>i\<in>I. (SOME F'. Pi\<^isub>E I F = Pi\<^isub>E I F') i = F i"
8.637 - by (rule someI2[where P="\<lambda>F'. Pi\<^isub>E I F = Pi\<^isub>E I F'"])
8.638 - (insert ne, auto simp: Pi_eq_iff)
8.639 - then show ?thesis
8.640 - unfolding product_algebra_generator_def by simp
8.641 -next
8.642 - assume empty: "\<not> (\<forall>j\<in>I. F j \<noteq> {})"
8.643 - then have "(\<Prod>j\<in>I. M.\<mu> j (F j)) = 0"
8.644 - by (auto simp: setprod_ereal_0 intro!: bexI)
8.645 - moreover
8.646 - have "\<exists>j\<in>I. (SOME F'. Pi\<^isub>E I F = Pi\<^isub>E I F') j = {}"
8.647 - by (rule someI2[where P="\<lambda>F'. Pi\<^isub>E I F = Pi\<^isub>E I F'"])
8.648 - (insert empty, auto simp: Pi_eq_empty_iff[symmetric])
8.649 - then have "(\<Prod>j\<in>I. M.\<mu> j ((SOME F'. Pi\<^isub>E I F = Pi\<^isub>E I F') j)) = 0"
8.650 - by (auto simp: setprod_ereal_0 intro!: bexI)
8.651 - ultimately show ?thesis
8.652 - unfolding product_algebra_generator_def by simp
8.653 -qed
8.654 +locale finite_product_sigma_finite = product_sigma_finite M for M :: "'i \<Rightarrow> 'a measure" +
8.655 + fixes I :: "'i set"
8.656 + assumes finite_index: "finite I"
8.657
8.658 lemma (in finite_product_sigma_finite) sigma_finite_pairs:
8.659 "\<exists>F::'i \<Rightarrow> nat \<Rightarrow> 'a set.
8.660 (\<forall>i\<in>I. range (F i) \<subseteq> sets (M i)) \<and>
8.661 - (\<forall>k. \<forall>i\<in>I. \<mu> i (F i k) \<noteq> \<infinity>) \<and> incseq (\<lambda>k. \<Pi>\<^isub>E i\<in>I. F i k) \<and>
8.662 - (\<Union>k. \<Pi>\<^isub>E i\<in>I. F i k) = space G"
8.663 + (\<forall>k. \<forall>i\<in>I. emeasure (M i) (F i k) \<noteq> \<infinity>) \<and> incseq (\<lambda>k. \<Pi>\<^isub>E i\<in>I. F i k) \<and>
8.664 + (\<Union>k. \<Pi>\<^isub>E i\<in>I. F i k) = space (PiM I M)"
8.665 proof -
8.666 - have "\<forall>i::'i. \<exists>F::nat \<Rightarrow> 'a set. range F \<subseteq> sets (M i) \<and> incseq F \<and> (\<Union>i. F i) = space (M i) \<and> (\<forall>k. \<mu> i (F k) \<noteq> \<infinity>)"
8.667 - using M.sigma_finite_up by simp
8.668 + have "\<forall>i::'i. \<exists>F::nat \<Rightarrow> 'a set. range F \<subseteq> sets (M i) \<and> incseq F \<and> (\<Union>i. F i) = space (M i) \<and> (\<forall>k. emeasure (M i) (F k) \<noteq> \<infinity>)"
8.669 + using M.sigma_finite_incseq by metis
8.670 from choice[OF this] guess F :: "'i \<Rightarrow> nat \<Rightarrow> 'a set" ..
8.671 - then have F: "\<And>i. range (F i) \<subseteq> sets (M i)" "\<And>i. incseq (F i)" "\<And>i. (\<Union>j. F i j) = space (M i)" "\<And>i k. \<mu> i (F i k) \<noteq> \<infinity>"
8.672 + then have F: "\<And>i. range (F i) \<subseteq> sets (M i)" "\<And>i. incseq (F i)" "\<And>i. (\<Union>j. F i j) = space (M i)" "\<And>i k. emeasure (M i) (F i k) \<noteq> \<infinity>"
8.673 by auto
8.674 let ?F = "\<lambda>k. \<Pi>\<^isub>E i\<in>I. F i k"
8.675 - note space_product_algebra[simp]
8.676 + note space_PiM[simp]
8.677 show ?thesis
8.678 proof (intro exI[of _ F] conjI allI incseq_SucI set_eqI iffI ballI)
8.679 fix i show "range (F i) \<subseteq> sets (M i)" by fact
8.680 next
8.681 - fix i k show "\<mu> i (F i k) \<noteq> \<infinity>" by fact
8.682 + fix i k show "emeasure (M i) (F i k) \<noteq> \<infinity>" by fact
8.683 next
8.684 - fix A assume "A \<in> (\<Union>i. ?F i)" then show "A \<in> space G"
8.685 - using `\<And>i. range (F i) \<subseteq> sets (M i)` M.sets_into_space
8.686 - by (force simp: image_subset_iff)
8.687 + fix A assume "A \<in> (\<Union>i. ?F i)" then show "A \<in> space (PiM I M)"
8.688 + using `\<And>i. range (F i) \<subseteq> sets (M i)` sets_into_space
8.689 + by auto blast
8.690 next
8.691 - fix f assume "f \<in> space G"
8.692 + fix f assume "f \<in> space (PiM I M)"
8.693 with Pi_UN[OF finite_index, of "\<lambda>k i. F i k"] F
8.694 show "f \<in> (\<Union>i. ?F i)" by (auto simp: incseq_def)
8.695 next
8.696 @@ -574,140 +590,144 @@
8.697 qed
8.698 qed
8.699
8.700 -lemma sets_pair_cancel_measure[simp]:
8.701 - "sets (M1\<lparr>measure := m1\<rparr> \<Otimes>\<^isub>M M2) = sets (M1 \<Otimes>\<^isub>M M2)"
8.702 - "sets (M1 \<Otimes>\<^isub>M M2\<lparr>measure := m2\<rparr>) = sets (M1 \<Otimes>\<^isub>M M2)"
8.703 - unfolding pair_measure_def pair_measure_generator_def sets_sigma
8.704 - by simp_all
8.705 -
8.706 -lemma measurable_pair_cancel_measure[simp]:
8.707 - "measurable (M1\<lparr>measure := m1\<rparr> \<Otimes>\<^isub>M M2) M = measurable (M1 \<Otimes>\<^isub>M M2) M"
8.708 - "measurable (M1 \<Otimes>\<^isub>M M2\<lparr>measure := m2\<rparr>) M = measurable (M1 \<Otimes>\<^isub>M M2) M"
8.709 - "measurable M (M1\<lparr>measure := m3\<rparr> \<Otimes>\<^isub>M M2) = measurable M (M1 \<Otimes>\<^isub>M M2)"
8.710 - "measurable M (M1 \<Otimes>\<^isub>M M2\<lparr>measure := m4\<rparr>) = measurable M (M1 \<Otimes>\<^isub>M M2)"
8.711 - unfolding measurable_def by (auto simp add: space_pair_measure)
8.712 -
8.713 -lemma (in product_sigma_finite) product_measure_exists:
8.714 +lemma (in product_sigma_finite)
8.715 assumes "finite I"
8.716 - shows "\<exists>\<nu>. sigma_finite_measure (sigma (product_algebra_generator I M) \<lparr> measure := \<nu> \<rparr>) \<and>
8.717 - (\<forall>A\<in>\<Pi> i\<in>I. sets (M i). \<nu> (Pi\<^isub>E I A) = (\<Prod>i\<in>I. M.\<mu> i (A i)))"
8.718 + shows sigma_finite: "sigma_finite_measure (PiM I M)"
8.719 + and emeasure_PiM:
8.720 + "\<And>A. (\<And>i. i\<in>I \<Longrightarrow> A i \<in> sets (M i)) \<Longrightarrow> emeasure (PiM I M) (Pi\<^isub>E I A) = (\<Prod>i\<in>I. emeasure (M i) (A i))"
8.721 using `finite I` proof induct
8.722 case empty
8.723 - interpret finite_product_sigma_finite M "{}" by default simp
8.724 - let ?\<nu> = "(\<lambda>A. if A = {} then 0 else 1) :: 'd set \<Rightarrow> ereal"
8.725 - show ?case
8.726 - proof (intro exI conjI ballI)
8.727 - have "sigma_algebra (sigma G \<lparr>measure := ?\<nu>\<rparr>)"
8.728 - by (rule sigma_algebra_cong) (simp_all add: product_algebra_def)
8.729 - then have "measure_space (sigma G\<lparr>measure := ?\<nu>\<rparr>)"
8.730 - by (rule finite_additivity_sufficient)
8.731 - (simp_all add: positive_def additive_def sets_sigma
8.732 - product_algebra_generator_def image_constant)
8.733 - then show "sigma_finite_measure (sigma G\<lparr>measure := ?\<nu>\<rparr>)"
8.734 - by (auto intro!: exI[of _ "\<lambda>i. {\<lambda>_. undefined}"]
8.735 - simp: sigma_finite_measure_def sigma_finite_measure_axioms_def
8.736 - product_algebra_generator_def)
8.737 - qed auto
8.738 + let ?\<mu> = "\<lambda>A. if A = {} then 0 else (1::ereal)"
8.739 + have "prod_algebra {} M = {{\<lambda>_. undefined}}"
8.740 + by (auto simp: prod_algebra_def prod_emb_def intro!: image_eqI)
8.741 + then have sets_empty: "sets (PiM {} M) = {{}, {\<lambda>_. undefined}}"
8.742 + by (simp add: sets_PiM)
8.743 + have "emeasure (Pi\<^isub>M {} M) (prod_emb {} M {} (\<Pi>\<^isub>E i\<in>{}. {})) = 1"
8.744 + proof (subst emeasure_extend_measure_Pair[OF PiM_def])
8.745 + have "finite (space (PiM {} M))"
8.746 + by (simp add: space_PiM)
8.747 + moreover show "positive (PiM {} M) ?\<mu>"
8.748 + by (auto simp: positive_def)
8.749 + ultimately show "countably_additive (PiM {} M) ?\<mu>"
8.750 + by (rule countably_additiveI_finite) (auto simp: additive_def space_PiM sets_empty)
8.751 + qed (auto simp: prod_emb_def)
8.752 + also have *: "(prod_emb {} M {} (\<Pi>\<^isub>E i\<in>{}. {})) = {\<lambda>_. undefined}"
8.753 + by (auto simp: prod_emb_def)
8.754 + finally have emeasure_eq: "emeasure (Pi\<^isub>M {} M) {\<lambda>_. undefined} = 1" .
8.755 +
8.756 + interpret finite_measure "PiM {} M"
8.757 + by default (simp add: space_PiM emeasure_eq)
8.758 + case 1 show ?case ..
8.759 +
8.760 + case 2 show ?case
8.761 + using emeasure_eq * by simp
8.762 next
8.763 case (insert i I)
8.764 interpret finite_product_sigma_finite M I by default fact
8.765 have "finite (insert i I)" using `finite I` by auto
8.766 interpret I': finite_product_sigma_finite M "insert i I" by default fact
8.767 - from insert obtain \<nu> where
8.768 - prod: "\<And>A. A \<in> (\<Pi> i\<in>I. sets (M i)) \<Longrightarrow> \<nu> (Pi\<^isub>E I A) = (\<Prod>i\<in>I. M.\<mu> i (A i))" and
8.769 - "sigma_finite_measure (sigma G\<lparr> measure := \<nu> \<rparr>)" by auto
8.770 - then interpret I: sigma_finite_measure "P\<lparr> measure := \<nu>\<rparr>" unfolding product_algebra_def by simp
8.771 - interpret P: pair_sigma_finite "P\<lparr> measure := \<nu>\<rparr>" "M i" ..
8.772 + interpret I: sigma_finite_measure "PiM I M" by fact
8.773 + interpret P: pair_sigma_finite "PiM I M" "M i" ..
8.774 let ?h = "(\<lambda>(f, y). f(i := y))"
8.775 - let ?\<nu> = "\<lambda>A. P.\<mu> (?h -` A \<inter> space P.P)"
8.776 - have I': "sigma_algebra (I'.P\<lparr> measure := ?\<nu> \<rparr>)"
8.777 - by (rule I'.sigma_algebra_cong) simp_all
8.778 - interpret I'': measure_space "I'.P\<lparr> measure := ?\<nu> \<rparr>"
8.779 - using measurable_add_dim[OF `i \<notin> I`]
8.780 - by (intro P.measure_space_vimage[OF I']) (auto simp add: measure_preserving_def)
8.781 - show ?case
8.782 - proof (intro exI[of _ ?\<nu>] conjI ballI)
8.783 - let ?m = "\<lambda>A. measure (Pi\<^isub>M I M\<lparr>measure := \<nu>\<rparr> \<Otimes>\<^isub>M M i) (?h -` A \<inter> space P.P)"
8.784 - { fix A assume A: "A \<in> (\<Pi> i\<in>insert i I. sets (M i))"
8.785 - then have *: "?h -` Pi\<^isub>E (insert i I) A \<inter> space P.P = Pi\<^isub>E I A \<times> A i"
8.786 - using `i \<notin> I` M.sets_into_space by (auto simp: space_pair_measure space_product_algebra) blast
8.787 - show "?m (Pi\<^isub>E (insert i I) A) = (\<Prod>i\<in>insert i I. M.\<mu> i (A i))"
8.788 - unfolding * using A
8.789 - apply (subst P.pair_measure_times)
8.790 - using A apply fastforce
8.791 - using A apply fastforce
8.792 - using `i \<notin> I` `finite I` prod[of A] A by (auto simp: ac_simps) }
8.793 - note product = this
8.794 - have *: "sigma I'.G\<lparr> measure := ?\<nu> \<rparr> = I'.P\<lparr> measure := ?\<nu> \<rparr>"
8.795 - by (simp add: product_algebra_def)
8.796 - show "sigma_finite_measure (sigma I'.G\<lparr> measure := ?\<nu> \<rparr>)"
8.797 - proof (unfold *, default, simp)
8.798 - from I'.sigma_finite_pairs guess F :: "'i \<Rightarrow> nat \<Rightarrow> 'a set" ..
8.799 - then have F: "\<And>j. j \<in> insert i I \<Longrightarrow> range (F j) \<subseteq> sets (M j)"
8.800 - "incseq (\<lambda>k. \<Pi>\<^isub>E j \<in> insert i I. F j k)"
8.801 - "(\<Union>k. \<Pi>\<^isub>E j \<in> insert i I. F j k) = space I'.G"
8.802 - "\<And>k. \<And>j. j \<in> insert i I \<Longrightarrow> \<mu> j (F j k) \<noteq> \<infinity>"
8.803 - by blast+
8.804 - let ?F = "\<lambda>k. \<Pi>\<^isub>E j \<in> insert i I. F j k"
8.805 - show "\<exists>F::nat \<Rightarrow> ('i \<Rightarrow> 'a) set. range F \<subseteq> sets I'.P \<and>
8.806 - (\<Union>i. F i) = (\<Pi>\<^isub>E i\<in>insert i I. space (M i)) \<and> (\<forall>i. ?m (F i) \<noteq> \<infinity>)"
8.807 - proof (intro exI[of _ ?F] conjI allI)
8.808 - show "range ?F \<subseteq> sets I'.P" using F(1) by auto
8.809 - next
8.810 - from F(3) show "(\<Union>i. ?F i) = (\<Pi>\<^isub>E i\<in>insert i I. space (M i))" by simp
8.811 - next
8.812 - fix j
8.813 - have "\<And>k. k \<in> insert i I \<Longrightarrow> 0 \<le> measure (M k) (F k j)"
8.814 - using F(1) by auto
8.815 - with F `finite I` setprod_PInf[of "insert i I", OF this] show "?\<nu> (?F j) \<noteq> \<infinity>"
8.816 - by (subst product) auto
8.817 - qed
8.818 - qed
8.819 +
8.820 + let ?P = "distr (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) (Pi\<^isub>M (insert i I) M) ?h"
8.821 + let ?\<mu> = "emeasure ?P"
8.822 + let ?I = "{j \<in> insert i I. emeasure (M j) (space (M j)) \<noteq> 1}"
8.823 + let ?f = "\<lambda>J E j. if j \<in> J then emeasure (M j) (E j) else emeasure (M j) (space (M j))"
8.824 +
8.825 + { case 2
8.826 + have "emeasure (Pi\<^isub>M (insert i I) M) (prod_emb (insert i I) M (insert i I) (Pi\<^isub>E (insert i I) A)) =
8.827 + (\<Prod>i\<in>insert i I. emeasure (M i) (A i))"
8.828 + proof (subst emeasure_extend_measure_Pair[OF PiM_def])
8.829 + fix J E assume "(J \<noteq> {} \<or> insert i I = {}) \<and> finite J \<and> J \<subseteq> insert i I \<and> E \<in> (\<Pi> j\<in>J. sets (M j))"
8.830 + then have J: "J \<noteq> {}" "finite J" "J \<subseteq> insert i I" and E: "\<forall>j\<in>J. E j \<in> sets (M j)" by auto
8.831 + let ?p = "prod_emb (insert i I) M J (Pi\<^isub>E J E)"
8.832 + let ?p' = "prod_emb I M (J - {i}) (\<Pi>\<^isub>E j\<in>J-{i}. E j)"
8.833 + have "?\<mu> ?p =
8.834 + emeasure (Pi\<^isub>M I M \<Otimes>\<^isub>M (M i)) (?h -` ?p \<inter> space (Pi\<^isub>M I M \<Otimes>\<^isub>M M i))"
8.835 + by (intro emeasure_distr measurable_add_dim sets_PiM_I) fact+
8.836 + also have "?h -` ?p \<inter> space (Pi\<^isub>M I M \<Otimes>\<^isub>M M i) = ?p' \<times> (if i \<in> J then E i else space (M i))"
8.837 + using J E[rule_format, THEN sets_into_space]
8.838 + by (force simp: space_pair_measure space_PiM Pi_iff prod_emb_iff split: split_if_asm)
8.839 + also have "emeasure (Pi\<^isub>M I M \<Otimes>\<^isub>M (M i)) (?p' \<times> (if i \<in> J then E i else space (M i))) =
8.840 + emeasure (Pi\<^isub>M I M) ?p' * emeasure (M i) (if i \<in> J then (E i) else space (M i))"
8.841 + using J E by (intro P.emeasure_pair_measure_Times sets_PiM_I) auto
8.842 + also have "?p' = (\<Pi>\<^isub>E j\<in>I. if j \<in> J-{i} then E j else space (M j))"
8.843 + using J E[rule_format, THEN sets_into_space]
8.844 + by (auto simp: prod_emb_iff Pi_iff split: split_if_asm) blast+
8.845 + also have "emeasure (Pi\<^isub>M I M) (\<Pi>\<^isub>E j\<in>I. if j \<in> J-{i} then E j else space (M j)) =
8.846 + (\<Prod> j\<in>I. if j \<in> J-{i} then emeasure (M j) (E j) else emeasure (M j) (space (M j)))"
8.847 + using E by (subst insert) (auto intro!: setprod_cong)
8.848 + also have "(\<Prod>j\<in>I. if j \<in> J - {i} then emeasure (M j) (E j) else emeasure (M j) (space (M j))) *
8.849 + emeasure (M i) (if i \<in> J then E i else space (M i)) = (\<Prod>j\<in>insert i I. ?f J E j)"
8.850 + using insert by (auto simp: mult_commute intro!: arg_cong2[where f="op *"] setprod_cong)
8.851 + also have "\<dots> = (\<Prod>j\<in>J \<union> ?I. ?f J E j)"
8.852 + using insert(1,2) J E by (intro setprod_mono_one_right) auto
8.853 + finally show "?\<mu> ?p = \<dots>" .
8.854 +
8.855 + show "prod_emb (insert i I) M J (Pi\<^isub>E J E) \<in> Pow (\<Pi>\<^isub>E i\<in>insert i I. space (M i))"
8.856 + using J E[rule_format, THEN sets_into_space] by (auto simp: prod_emb_iff)
8.857 + next
8.858 + show "positive (sets (Pi\<^isub>M (insert i I) M)) ?\<mu>" "countably_additive (sets (Pi\<^isub>M (insert i I) M)) ?\<mu>"
8.859 + using emeasure_positive[of ?P] emeasure_countably_additive[of ?P] by simp_all
8.860 + next
8.861 + show "(insert i I \<noteq> {} \<or> insert i I = {}) \<and> finite (insert i I) \<and>
8.862 + insert i I \<subseteq> insert i I \<and> A \<in> (\<Pi> j\<in>insert i I. sets (M j))"
8.863 + using insert(1,2) 2 by auto
8.864 + qed (auto intro!: setprod_cong)
8.865 + with 2[THEN sets_into_space] show ?case by (subst (asm) prod_emb_PiE_same_index) auto }
8.866 + note product = this
8.867 +
8.868 + from I'.sigma_finite_pairs guess F :: "'i \<Rightarrow> nat \<Rightarrow> 'a set" ..
8.869 + then have F: "\<And>j. j \<in> insert i I \<Longrightarrow> range (F j) \<subseteq> sets (M j)"
8.870 + "incseq (\<lambda>k. \<Pi>\<^isub>E j \<in> insert i I. F j k)"
8.871 + "(\<Union>k. \<Pi>\<^isub>E j \<in> insert i I. F j k) = space (Pi\<^isub>M (insert i I) M)"
8.872 + "\<And>k. \<And>j. j \<in> insert i I \<Longrightarrow> emeasure (M j) (F j k) \<noteq> \<infinity>"
8.873 + by blast+
8.874 + let ?F = "\<lambda>k. \<Pi>\<^isub>E j \<in> insert i I. F j k"
8.875 +
8.876 + case 1 show ?case
8.877 + proof (unfold_locales, intro exI[of _ ?F] conjI allI)
8.878 + show "range ?F \<subseteq> sets (Pi\<^isub>M (insert i I) M)" using F(1) insert(1,2) by auto
8.879 + next
8.880 + from F(3) show "(\<Union>i. ?F i) = space (Pi\<^isub>M (insert i I) M)" by simp
8.881 + next
8.882 + fix j
8.883 + from F `finite I` setprod_PInf[of "insert i I", OF emeasure_nonneg, of M]
8.884 + show "emeasure (\<Pi>\<^isub>M i\<in>insert i I. M i) (?F j) \<noteq> \<infinity>"
8.885 + by (subst product) auto
8.886 qed
8.887 qed
8.888
8.889 -sublocale finite_product_sigma_finite \<subseteq> sigma_finite_measure P
8.890 - unfolding product_algebra_def
8.891 - using product_measure_exists[OF finite_index]
8.892 - by (rule someI2_ex) auto
8.893 +sublocale finite_product_sigma_finite \<subseteq> sigma_finite_measure "Pi\<^isub>M I M"
8.894 + using sigma_finite[OF finite_index] .
8.895
8.896 lemma (in finite_product_sigma_finite) measure_times:
8.897 - assumes "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)"
8.898 - shows "\<mu> (Pi\<^isub>E I A) = (\<Prod>i\<in>I. M.\<mu> i (A i))"
8.899 - unfolding product_algebra_def
8.900 - using product_measure_exists[OF finite_index]
8.901 - proof (rule someI2_ex, elim conjE)
8.902 - fix \<nu> assume *: "\<forall>A\<in>\<Pi> i\<in>I. sets (M i). \<nu> (Pi\<^isub>E I A) = (\<Prod>i\<in>I. M.\<mu> i (A i))"
8.903 - have "Pi\<^isub>E I A = Pi\<^isub>E I (\<lambda>i\<in>I. A i)" by (auto dest: Pi_mem)
8.904 - then have "\<nu> (Pi\<^isub>E I A) = \<nu> (Pi\<^isub>E I (\<lambda>i\<in>I. A i))" by simp
8.905 - also have "\<dots> = (\<Prod>i\<in>I. M.\<mu> i ((\<lambda>i\<in>I. A i) i))" using assms * by auto
8.906 - finally show "measure (sigma G\<lparr>measure := \<nu>\<rparr>) (Pi\<^isub>E I A) = (\<Prod>i\<in>I. M.\<mu> i (A i))"
8.907 - by (simp add: sigma_def)
8.908 - qed
8.909 + "(\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)) \<Longrightarrow> emeasure (Pi\<^isub>M I M) (Pi\<^isub>E I A) = (\<Prod>i\<in>I. emeasure (M i) (A i))"
8.910 + using emeasure_PiM[OF finite_index] by auto
8.911
8.912 lemma (in product_sigma_finite) product_measure_empty[simp]:
8.913 - "measure (Pi\<^isub>M {} M) {\<lambda>x. undefined} = 1"
8.914 + "emeasure (Pi\<^isub>M {} M) {\<lambda>x. undefined} = 1"
8.915 proof -
8.916 interpret finite_product_sigma_finite M "{}" by default auto
8.917 from measure_times[of "\<lambda>x. {}"] show ?thesis by simp
8.918 qed
8.919
8.920 -lemma (in finite_product_sigma_algebra) P_empty:
8.921 - assumes "I = {}"
8.922 - shows "space P = {\<lambda>k. undefined}" "sets P = { {}, {\<lambda>k. undefined} }"
8.923 - unfolding product_algebra_def product_algebra_generator_def `I = {}`
8.924 - by (simp_all add: sigma_def image_constant)
8.925 +lemma
8.926 + shows space_PiM_empty: "space (Pi\<^isub>M {} M) = {\<lambda>k. undefined}"
8.927 + and sets_PiM_empty: "sets (Pi\<^isub>M {} M) = { {}, {\<lambda>k. undefined} }"
8.928 + by (simp_all add: space_PiM sets_PiM_single image_constant sigma_sets_empty_eq)
8.929
8.930 lemma (in product_sigma_finite) positive_integral_empty:
8.931 assumes pos: "0 \<le> f (\<lambda>k. undefined)"
8.932 shows "integral\<^isup>P (Pi\<^isub>M {} M) f = f (\<lambda>k. undefined)"
8.933 proof -
8.934 interpret finite_product_sigma_finite M "{}" by default (fact finite.emptyI)
8.935 - have "\<And>A. measure (Pi\<^isub>M {} M) (Pi\<^isub>E {} A) = 1"
8.936 + have "\<And>A. emeasure (Pi\<^isub>M {} M) (Pi\<^isub>E {} A) = 1"
8.937 using assms by (subst measure_times) auto
8.938 then show ?thesis
8.939 - unfolding positive_integral_def simple_function_def simple_integral_def [abs_def]
8.940 - proof (simp add: P_empty, intro antisym)
8.941 + unfolding positive_integral_def simple_function_def simple_integral_def[abs_def]
8.942 + proof (simp add: space_PiM_empty sets_PiM_empty, intro antisym)
8.943 show "f (\<lambda>k. undefined) \<le> (SUP f:{g. g \<le> max 0 \<circ> f}. f (\<lambda>k. undefined))"
8.944 by (intro SUP_upper) (auto simp: le_fun_def split: split_max)
8.945 show "(SUP f:{g. g \<le> max 0 \<circ> f}. f (\<lambda>k. undefined)) \<le> f (\<lambda>k. undefined)" using pos
8.946 @@ -715,71 +735,72 @@
8.947 qed
8.948 qed
8.949
8.950 -lemma (in product_sigma_finite) measure_fold:
8.951 +lemma (in product_sigma_finite) distr_merge:
8.952 assumes IJ[simp]: "I \<inter> J = {}" and fin: "finite I" "finite J"
8.953 - assumes A: "A \<in> sets (Pi\<^isub>M (I \<union> J) M)"
8.954 - shows "measure (Pi\<^isub>M (I \<union> J) M) A =
8.955 - measure (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) ((\<lambda>(x,y). merge I x J y) -` A \<inter> space (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M))"
8.956 + shows "distr (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) (Pi\<^isub>M (I \<union> J) M) (\<lambda>(x,y). merge I x J y) = Pi\<^isub>M (I \<union> J) M"
8.957 + (is "?D = ?P")
8.958 proof -
8.959 interpret I: finite_product_sigma_finite M I by default fact
8.960 interpret J: finite_product_sigma_finite M J by default fact
8.961 have "finite (I \<union> J)" using fin by auto
8.962 interpret IJ: finite_product_sigma_finite M "I \<union> J" by default fact
8.963 - interpret P: pair_sigma_finite I.P J.P by default
8.964 + interpret P: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" by default
8.965 let ?g = "\<lambda>(x,y). merge I x J y"
8.966 - let ?X = "\<lambda>S. ?g -` S \<inter> space P.P"
8.967 +
8.968 from IJ.sigma_finite_pairs obtain F where
8.969 F: "\<And>i. i\<in> I \<union> J \<Longrightarrow> range (F i) \<subseteq> sets (M i)"
8.970 "incseq (\<lambda>k. \<Pi>\<^isub>E i\<in>I \<union> J. F i k)"
8.971 - "(\<Union>k. \<Pi>\<^isub>E i\<in>I \<union> J. F i k) = space IJ.G"
8.972 - "\<And>k. \<forall>i\<in>I\<union>J. \<mu> i (F i k) \<noteq> \<infinity>"
8.973 + "(\<Union>k. \<Pi>\<^isub>E i\<in>I \<union> J. F i k) = space ?P"
8.974 + "\<And>k. \<forall>i\<in>I\<union>J. emeasure (M i) (F i k) \<noteq> \<infinity>"
8.975 by auto
8.976 let ?F = "\<lambda>k. \<Pi>\<^isub>E i\<in>I \<union> J. F i k"
8.977 - show "IJ.\<mu> A = P.\<mu> (?X A)"
8.978 - proof (rule measure_unique_Int_stable_vimage)
8.979 - show "measure_space IJ.P" "measure_space P.P" by default
8.980 - show "sets (sigma IJ.G) = sets IJ.P" "space IJ.G = space IJ.P" "A \<in> sets (sigma IJ.G)"
8.981 - using A unfolding product_algebra_def by auto
8.982 - next
8.983 - show "Int_stable IJ.G"
8.984 - by (rule Int_stable_product_algebra_generator)
8.985 - (auto simp: Int_stable_def)
8.986 - show "range ?F \<subseteq> sets IJ.G" using F
8.987 - by (simp add: image_subset_iff product_algebra_def
8.988 - product_algebra_generator_def)
8.989 - show "incseq ?F" "(\<Union>i. ?F i) = space IJ.G " by fact+
8.990 +
8.991 + show ?thesis
8.992 + proof (rule measure_eqI_generator_eq[symmetric])
8.993 + show "Int_stable (prod_algebra (I \<union> J) M)"
8.994 + by (rule Int_stable_prod_algebra)
8.995 + show "prod_algebra (I \<union> J) M \<subseteq> Pow (\<Pi>\<^isub>E i \<in> I \<union> J. space (M i))"
8.996 + by (rule prod_algebra_sets_into_space)
8.997 + show "sets ?P = sigma_sets (\<Pi>\<^isub>E i\<in>I \<union> J. space (M i)) (prod_algebra (I \<union> J) M)"
8.998 + by (rule sets_PiM)
8.999 + then show "sets ?D = sigma_sets (\<Pi>\<^isub>E i\<in>I \<union> J. space (M i)) (prod_algebra (I \<union> J) M)"
8.1000 + by simp
8.1001 +
8.1002 + show "range ?F \<subseteq> prod_algebra (I \<union> J) M" using F
8.1003 + using fin by (auto simp: prod_algebra_eq_finite)
8.1004 + show "incseq ?F" by fact
8.1005 + show "(\<Union>i. \<Pi>\<^isub>E ia\<in>I \<union> J. F ia i) = (\<Pi>\<^isub>E i\<in>I \<union> J. space (M i))"
8.1006 + using F(3) by (simp add: space_PiM)
8.1007 next
8.1008 fix k
8.1009 - have "\<And>j. j \<in> I \<union> J \<Longrightarrow> 0 \<le> measure (M j) (F j k)"
8.1010 - using F(1) by auto
8.1011 - with F `finite I` setprod_PInf[of "I \<union> J", OF this]
8.1012 - show "IJ.\<mu> (?F k) \<noteq> \<infinity>" by (subst IJ.measure_times) auto
8.1013 + from F `finite I` setprod_PInf[of "I \<union> J", OF emeasure_nonneg, of M]
8.1014 + show "emeasure ?P (?F k) \<noteq> \<infinity>" by (subst IJ.measure_times) auto
8.1015 next
8.1016 - fix A assume "A \<in> sets IJ.G"
8.1017 - then obtain F where A: "A = Pi\<^isub>E (I \<union> J) F"
8.1018 - and F: "\<And>i. i \<in> I \<union> J \<Longrightarrow> F i \<in> sets (M i)"
8.1019 - by (auto simp: product_algebra_generator_def)
8.1020 - then have X: "?X A = (Pi\<^isub>E I F \<times> Pi\<^isub>E J F)"
8.1021 - using sets_into_space by (auto simp: space_pair_measure) blast+
8.1022 - then have "P.\<mu> (?X A) = (\<Prod>i\<in>I. \<mu> i (F i)) * (\<Prod>i\<in>J. \<mu> i (F i))"
8.1023 - using `finite J` `finite I` F
8.1024 - by (simp add: P.pair_measure_times I.measure_times J.measure_times)
8.1025 - also have "\<dots> = (\<Prod>i\<in>I \<union> J. \<mu> i (F i))"
8.1026 + fix A assume A: "A \<in> prod_algebra (I \<union> J) M"
8.1027 + with fin obtain F where A_eq: "A = (Pi\<^isub>E (I \<union> J) F)" and F: "\<forall>i\<in>I \<union> J. F i \<in> sets (M i)"
8.1028 + by (auto simp add: prod_algebra_eq_finite)
8.1029 + let ?B = "Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M"
8.1030 + let ?X = "?g -` A \<inter> space ?B"
8.1031 + have "Pi\<^isub>E I F \<subseteq> space (Pi\<^isub>M I M)" "Pi\<^isub>E J F \<subseteq> space (Pi\<^isub>M J M)"
8.1032 + using F[rule_format, THEN sets_into_space] by (auto simp: space_PiM)
8.1033 + then have X: "?X = (Pi\<^isub>E I F \<times> Pi\<^isub>E J F)"
8.1034 + unfolding A_eq by (subst merge_vimage) (auto simp: space_pair_measure space_PiM)
8.1035 + have "emeasure ?D A = emeasure ?B ?X"
8.1036 + using A by (intro emeasure_distr measurable_merge) (auto simp: sets_PiM)
8.1037 + also have "emeasure ?B ?X = (\<Prod>i\<in>I. emeasure (M i) (F i)) * (\<Prod>i\<in>J. emeasure (M i) (F i))"
8.1038 + using `finite J` `finite I` F X
8.1039 + by (simp add: P.emeasure_pair_measure_Times I.measure_times J.measure_times Pi_iff)
8.1040 + also have "\<dots> = (\<Prod>i\<in>I \<union> J. emeasure (M i) (F i))"
8.1041 using `finite J` `finite I` `I \<inter> J = {}` by (simp add: setprod_Un_one)
8.1042 - also have "\<dots> = IJ.\<mu> A"
8.1043 + also have "\<dots> = emeasure ?P (Pi\<^isub>E (I \<union> J) F)"
8.1044 using `finite J` `finite I` F unfolding A
8.1045 by (intro IJ.measure_times[symmetric]) auto
8.1046 - finally show "IJ.\<mu> A = P.\<mu> (?X A)" by (rule sym)
8.1047 - qed (rule measurable_merge[OF IJ])
8.1048 + finally show "emeasure ?P A = emeasure ?D A" using A_eq by simp
8.1049 + qed
8.1050 qed
8.1051
8.1052 -lemma (in product_sigma_finite) measure_preserving_merge:
8.1053 - assumes IJ: "I \<inter> J = {}" and "finite I" "finite J"
8.1054 - shows "(\<lambda>(x,y). merge I x J y) \<in> measure_preserving (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) (Pi\<^isub>M (I \<union> J) M)"
8.1055 - by (intro measure_preservingI measurable_merge[OF IJ] measure_fold[symmetric] assms)
8.1056 -
8.1057 lemma (in product_sigma_finite) product_positive_integral_fold:
8.1058 - assumes IJ[simp]: "I \<inter> J = {}" "finite I" "finite J"
8.1059 + assumes IJ: "I \<inter> J = {}" "finite I" "finite J"
8.1060 and f: "f \<in> borel_measurable (Pi\<^isub>M (I \<union> J) M)"
8.1061 shows "integral\<^isup>P (Pi\<^isub>M (I \<union> J) M) f =
8.1062 (\<integral>\<^isup>+ x. (\<integral>\<^isup>+ y. f (merge I x J y) \<partial>(Pi\<^isub>M J M)) \<partial>(Pi\<^isub>M I M))"
8.1063 @@ -787,42 +808,38 @@
8.1064 interpret I: finite_product_sigma_finite M I by default fact
8.1065 interpret J: finite_product_sigma_finite M J by default fact
8.1066 interpret P: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" by default
8.1067 - interpret IJ: finite_product_sigma_finite M "I \<union> J" by default simp
8.1068 - have P_borel: "(\<lambda>x. f (case x of (x, y) \<Rightarrow> merge I x J y)) \<in> borel_measurable P.P"
8.1069 + have P_borel: "(\<lambda>x. f (case x of (x, y) \<Rightarrow> merge I x J y)) \<in> borel_measurable (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M)"
8.1070 using measurable_comp[OF measurable_merge[OF IJ(1)] f] by (simp add: comp_def)
8.1071 show ?thesis
8.1072 - unfolding P.positive_integral_fst_measurable[OF P_borel, simplified]
8.1073 - proof (rule P.positive_integral_vimage)
8.1074 - show "sigma_algebra IJ.P" by default
8.1075 - show "(\<lambda>(x, y). merge I x J y) \<in> measure_preserving P.P IJ.P"
8.1076 - using IJ by (rule measure_preserving_merge)
8.1077 - show "f \<in> borel_measurable IJ.P" using f by simp
8.1078 - qed
8.1079 + apply (subst distr_merge[OF IJ, symmetric])
8.1080 + apply (subst positive_integral_distr[OF measurable_merge f, OF IJ(1)])
8.1081 + apply (subst P.positive_integral_fst_measurable(2)[symmetric, OF P_borel])
8.1082 + apply simp
8.1083 + done
8.1084 qed
8.1085
8.1086 -lemma (in product_sigma_finite) measure_preserving_component_singelton:
8.1087 - "(\<lambda>x. x i) \<in> measure_preserving (Pi\<^isub>M {i} M) (M i)"
8.1088 -proof (intro measure_preservingI measurable_component_singleton)
8.1089 +lemma (in product_sigma_finite) distr_singleton:
8.1090 + "distr (Pi\<^isub>M {i} M) (M i) (\<lambda>x. x i) = M i" (is "?D = _")
8.1091 +proof (intro measure_eqI[symmetric])
8.1092 interpret I: finite_product_sigma_finite M "{i}" by default simp
8.1093 - fix A let ?P = "(\<lambda>x. x i) -` A \<inter> space I.P"
8.1094 - assume A: "A \<in> sets (M i)"
8.1095 - then have *: "?P = {i} \<rightarrow>\<^isub>E A" using sets_into_space by auto
8.1096 - show "I.\<mu> ?P = M.\<mu> i A" unfolding *
8.1097 - using A I.measure_times[of "\<lambda>_. A"] by auto
8.1098 -qed auto
8.1099 + fix A assume A: "A \<in> sets (M i)"
8.1100 + moreover then have "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>M {i} M) = (\<Pi>\<^isub>E i\<in>{i}. A)"
8.1101 + using sets_into_space by (auto simp: space_PiM)
8.1102 + ultimately show "emeasure (M i) A = emeasure ?D A"
8.1103 + using A I.measure_times[of "\<lambda>_. A"]
8.1104 + by (simp add: emeasure_distr measurable_component_singleton)
8.1105 +qed simp
8.1106
8.1107 lemma (in product_sigma_finite) product_positive_integral_singleton:
8.1108 assumes f: "f \<in> borel_measurable (M i)"
8.1109 shows "integral\<^isup>P (Pi\<^isub>M {i} M) (\<lambda>x. f (x i)) = integral\<^isup>P (M i) f"
8.1110 proof -
8.1111 interpret I: finite_product_sigma_finite M "{i}" by default simp
8.1112 - show ?thesis
8.1113 - proof (rule I.positive_integral_vimage[symmetric])
8.1114 - show "sigma_algebra (M i)" by (rule sigma_algebras)
8.1115 - show "(\<lambda>x. x i) \<in> measure_preserving (Pi\<^isub>M {i} M) (M i)"
8.1116 - by (rule measure_preserving_component_singelton)
8.1117 - show "f \<in> borel_measurable (M i)" by fact
8.1118 - qed
8.1119 + from f show ?thesis
8.1120 + apply (subst distr_singleton[symmetric])
8.1121 + apply (subst positive_integral_distr[OF measurable_component_singleton])
8.1122 + apply simp_all
8.1123 + done
8.1124 qed
8.1125
8.1126 lemma (in product_sigma_finite) product_positive_integral_insert:
8.1127 @@ -832,19 +849,18 @@
8.1128 proof -
8.1129 interpret I: finite_product_sigma_finite M I by default auto
8.1130 interpret i: finite_product_sigma_finite M "{i}" by default auto
8.1131 - interpret P: pair_sigma_algebra I.P i.P ..
8.1132 have IJ: "I \<inter> {i} = {}" and insert: "I \<union> {i} = insert i I"
8.1133 using f by auto
8.1134 show ?thesis
8.1135 unfolding product_positive_integral_fold[OF IJ, unfolded insert, simplified, OF f]
8.1136 - proof (rule I.positive_integral_cong, subst product_positive_integral_singleton)
8.1137 - fix x assume x: "x \<in> space I.P"
8.1138 + proof (rule positive_integral_cong, subst product_positive_integral_singleton)
8.1139 + fix x assume x: "x \<in> space (Pi\<^isub>M I M)"
8.1140 let ?f = "\<lambda>y. f (restrict (x(i := y)) (insert i I))"
8.1141 have f'_eq: "\<And>y. ?f y = f (x(i := y))"
8.1142 - using x by (auto intro!: arg_cong[where f=f] simp: fun_eq_iff extensional_def)
8.1143 + using x by (auto intro!: arg_cong[where f=f] simp: fun_eq_iff extensional_def space_PiM)
8.1144 show "?f \<in> borel_measurable (M i)" unfolding f'_eq
8.1145 - using measurable_comp[OF measurable_component_update f] x `i \<notin> I`
8.1146 - by (simp add: comp_def)
8.1147 + using measurable_comp[OF measurable_component_update f, OF x `i \<notin> I`]
8.1148 + unfolding comp_def .
8.1149 show "integral\<^isup>P (M i) ?f = \<integral>\<^isup>+ y. f (x(i:=y)) \<partial>M i"
8.1150 unfolding f'_eq by simp
8.1151 qed
8.1152 @@ -856,10 +872,6 @@
8.1153 and pos: "\<And>i x. i \<in> I \<Longrightarrow> 0 \<le> f i x"
8.1154 shows "(\<integral>\<^isup>+ x. (\<Prod>i\<in>I. f i (x i)) \<partial>Pi\<^isub>M I M) = (\<Prod>i\<in>I. integral\<^isup>P (M i) (f i))"
8.1155 using assms proof induct
8.1156 - case empty
8.1157 - interpret finite_product_sigma_finite M "{}" by default auto
8.1158 - show ?case by simp
8.1159 -next
8.1160 case (insert i I)
8.1161 note `finite I`[intro, simp]
8.1162 interpret I: finite_product_sigma_finite M I by default auto
8.1163 @@ -867,16 +879,16 @@
8.1164 using insert by (auto intro!: setprod_cong)
8.1165 have prod: "\<And>J. J \<subseteq> insert i I \<Longrightarrow> (\<lambda>x. (\<Prod>i\<in>J. f i (x i))) \<in> borel_measurable (Pi\<^isub>M J M)"
8.1166 using sets_into_space insert
8.1167 - by (intro sigma_algebra.borel_measurable_ereal_setprod sigma_algebra_product_algebra
8.1168 + by (intro borel_measurable_ereal_setprod
8.1169 measurable_comp[OF measurable_component_singleton, unfolded comp_def])
8.1170 auto
8.1171 then show ?case
8.1172 apply (simp add: product_positive_integral_insert[OF insert(1,2) prod])
8.1173 - apply (simp add: insert * pos borel setprod_ereal_pos M.positive_integral_multc)
8.1174 - apply (subst I.positive_integral_cmult)
8.1175 - apply (auto simp add: pos borel insert setprod_ereal_pos positive_integral_positive)
8.1176 + apply (simp add: insert(2-) * pos borel setprod_ereal_pos positive_integral_multc)
8.1177 + apply (subst positive_integral_cmult)
8.1178 + apply (auto simp add: pos borel insert(2-) setprod_ereal_pos positive_integral_positive)
8.1179 done
8.1180 -qed
8.1181 +qed (simp add: space_PiM)
8.1182
8.1183 lemma (in product_sigma_finite) product_integral_singleton:
8.1184 assumes f: "f \<in> borel_measurable (M i)"
8.1185 @@ -899,48 +911,44 @@
8.1186 interpret J: finite_product_sigma_finite M J by default fact
8.1187 have "finite (I \<union> J)" using fin by auto
8.1188 interpret IJ: finite_product_sigma_finite M "I \<union> J" by default fact
8.1189 - interpret P: pair_sigma_finite I.P J.P by default
8.1190 + interpret P: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" by default
8.1191 let ?M = "\<lambda>(x, y). merge I x J y"
8.1192 let ?f = "\<lambda>x. f (?M x)"
8.1193 + from f have f_borel: "f \<in> borel_measurable (Pi\<^isub>M (I \<union> J) M)"
8.1194 + by auto
8.1195 + have P_borel: "(\<lambda>x. f (case x of (x, y) \<Rightarrow> merge I x J y)) \<in> borel_measurable (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M)"
8.1196 + using measurable_comp[OF measurable_merge[OF IJ(1)] f_borel] by (simp add: comp_def)
8.1197 + have f_int: "integrable (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) ?f"
8.1198 + by (rule integrable_distr[OF measurable_merge[OF IJ]]) (simp add: distr_merge[OF IJ fin] f)
8.1199 show ?thesis
8.1200 - proof (subst P.integrable_fst_measurable(2)[of ?f, simplified])
8.1201 - have 1: "sigma_algebra IJ.P" by default
8.1202 - have 2: "?M \<in> measure_preserving P.P IJ.P" using measure_preserving_merge[OF assms(1,2,3)] .
8.1203 - have 3: "integrable (Pi\<^isub>M (I \<union> J) M) f" by fact
8.1204 - then have 4: "f \<in> borel_measurable (Pi\<^isub>M (I \<union> J) M)"
8.1205 - by (simp add: integrable_def)
8.1206 - show "integrable P.P ?f"
8.1207 - by (rule P.integrable_vimage[where f=f, OF 1 2 3])
8.1208 - show "integral\<^isup>L IJ.P f = integral\<^isup>L P.P ?f"
8.1209 - by (rule P.integral_vimage[where f=f, OF 1 2 4])
8.1210 - qed
8.1211 + apply (subst distr_merge[symmetric, OF IJ fin])
8.1212 + apply (subst integral_distr[OF measurable_merge[OF IJ] f_borel])
8.1213 + apply (subst P.integrable_fst_measurable(2)[symmetric, OF f_int])
8.1214 + apply simp
8.1215 + done
8.1216 qed
8.1217
8.1218 lemma (in product_sigma_finite) product_integral_insert:
8.1219 - assumes [simp]: "finite I" "i \<notin> I"
8.1220 + assumes I: "finite I" "i \<notin> I"
8.1221 and f: "integrable (Pi\<^isub>M (insert i I) M) f"
8.1222 shows "integral\<^isup>L (Pi\<^isub>M (insert i I) M) f = (\<integral>x. (\<integral>y. f (x(i:=y)) \<partial>M i) \<partial>Pi\<^isub>M I M)"
8.1223 proof -
8.1224 - interpret I: finite_product_sigma_finite M I by default auto
8.1225 - interpret I': finite_product_sigma_finite M "insert i I" by default auto
8.1226 - interpret i: finite_product_sigma_finite M "{i}" by default auto
8.1227 - interpret P: pair_sigma_finite I.P i.P ..
8.1228 - have IJ: "I \<inter> {i} = {}" by auto
8.1229 - show ?thesis
8.1230 - unfolding product_integral_fold[OF IJ, simplified, OF f]
8.1231 - proof (rule I.integral_cong, subst product_integral_singleton)
8.1232 - fix x assume x: "x \<in> space I.P"
8.1233 - let ?f = "\<lambda>y. f (restrict (x(i := y)) (insert i I))"
8.1234 - have f'_eq: "\<And>y. ?f y = f (x(i := y))"
8.1235 - using x by (auto intro!: arg_cong[where f=f] simp: fun_eq_iff extensional_def)
8.1236 - have f: "f \<in> borel_measurable I'.P" using f unfolding integrable_def by auto
8.1237 - show "?f \<in> borel_measurable (M i)"
8.1238 - unfolding measurable_cong[OF f'_eq]
8.1239 - using measurable_comp[OF measurable_component_update f] x `i \<notin> I`
8.1240 - by (simp add: comp_def)
8.1241 - show "integral\<^isup>L (M i) ?f = integral\<^isup>L (M i) (\<lambda>y. f (x(i := y)))"
8.1242 - unfolding f'_eq by simp
8.1243 + have "integral\<^isup>L (Pi\<^isub>M (insert i I) M) f = integral\<^isup>L (Pi\<^isub>M (I \<union> {i}) M) f"
8.1244 + by simp
8.1245 + also have "\<dots> = (\<integral>x. (\<integral>y. f (merge I x {i} y) \<partial>Pi\<^isub>M {i} M) \<partial>Pi\<^isub>M I M)"
8.1246 + using f I by (intro product_integral_fold) auto
8.1247 + also have "\<dots> = (\<integral>x. (\<integral>y. f (x(i := y)) \<partial>M i) \<partial>Pi\<^isub>M I M)"
8.1248 + proof (rule integral_cong, subst product_integral_singleton[symmetric])
8.1249 + fix x assume x: "x \<in> space (Pi\<^isub>M I M)"
8.1250 + have f_borel: "f \<in> borel_measurable (Pi\<^isub>M (insert i I) M)"
8.1251 + using f by auto
8.1252 + show "(\<lambda>y. f (x(i := y))) \<in> borel_measurable (M i)"
8.1253 + using measurable_comp[OF measurable_component_update f_borel, OF x `i \<notin> I`]
8.1254 + unfolding comp_def .
8.1255 + from x I show "(\<integral> y. f (merge I x {i} y) \<partial>Pi\<^isub>M {i} M) = (\<integral> xa. f (x(i := xa i)) \<partial>Pi\<^isub>M {i} M)"
8.1256 + by (auto intro!: integral_cong arg_cong[where f=f] simp: merge_def space_PiM extensional_def)
8.1257 qed
8.1258 + finally show ?thesis .
8.1259 qed
8.1260
8.1261 lemma (in product_sigma_finite) product_integrable_setprod:
8.1262 @@ -951,24 +959,23 @@
8.1263 interpret finite_product_sigma_finite M I by default fact
8.1264 have f: "\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable (M i)"
8.1265 using integrable unfolding integrable_def by auto
8.1266 - then have borel: "?f \<in> borel_measurable P"
8.1267 - using measurable_comp[OF measurable_component_singleton f]
8.1268 - by (auto intro!: borel_measurable_setprod simp: comp_def)
8.1269 + have borel: "?f \<in> borel_measurable (Pi\<^isub>M I M)"
8.1270 + using measurable_comp[OF measurable_component_singleton[of _ I M] f] by (auto simp: comp_def)
8.1271 moreover have "integrable (Pi\<^isub>M I M) (\<lambda>x. \<bar>\<Prod>i\<in>I. f i (x i)\<bar>)"
8.1272 proof (unfold integrable_def, intro conjI)
8.1273 - show "(\<lambda>x. abs (?f x)) \<in> borel_measurable P"
8.1274 + show "(\<lambda>x. abs (?f x)) \<in> borel_measurable (Pi\<^isub>M I M)"
8.1275 using borel by auto
8.1276 - have "(\<integral>\<^isup>+x. ereal (abs (?f x)) \<partial>P) = (\<integral>\<^isup>+x. (\<Prod>i\<in>I. ereal (abs (f i (x i)))) \<partial>P)"
8.1277 + have "(\<integral>\<^isup>+x. ereal (abs (?f x)) \<partial>Pi\<^isub>M I M) = (\<integral>\<^isup>+x. (\<Prod>i\<in>I. ereal (abs (f i (x i)))) \<partial>Pi\<^isub>M I M)"
8.1278 by (simp add: setprod_ereal abs_setprod)
8.1279 also have "\<dots> = (\<Prod>i\<in>I. (\<integral>\<^isup>+x. ereal (abs (f i x)) \<partial>M i))"
8.1280 using f by (subst product_positive_integral_setprod) auto
8.1281 also have "\<dots> < \<infinity>"
8.1282 - using integrable[THEN M.integrable_abs]
8.1283 - by (simp add: setprod_PInf integrable_def M.positive_integral_positive)
8.1284 - finally show "(\<integral>\<^isup>+x. ereal (abs (?f x)) \<partial>P) \<noteq> \<infinity>" by auto
8.1285 - have "(\<integral>\<^isup>+x. ereal (- abs (?f x)) \<partial>P) = (\<integral>\<^isup>+x. 0 \<partial>P)"
8.1286 + using integrable[THEN integrable_abs]
8.1287 + by (simp add: setprod_PInf integrable_def positive_integral_positive)
8.1288 + finally show "(\<integral>\<^isup>+x. ereal (abs (?f x)) \<partial>(Pi\<^isub>M I M)) \<noteq> \<infinity>" by auto
8.1289 + have "(\<integral>\<^isup>+x. ereal (- abs (?f x)) \<partial>(Pi\<^isub>M I M)) = (\<integral>\<^isup>+x. 0 \<partial>(Pi\<^isub>M I M))"
8.1290 by (intro positive_integral_cong_pos) auto
8.1291 - then show "(\<integral>\<^isup>+x. ereal (- abs (?f x)) \<partial>P) \<noteq> \<infinity>" by simp
8.1292 + then show "(\<integral>\<^isup>+x. ereal (- abs (?f x)) \<partial>(Pi\<^isub>M I M)) \<noteq> \<infinity>" by simp
8.1293 qed
8.1294 ultimately show ?thesis
8.1295 by (rule integrable_abs_iff[THEN iffD1])
8.1296 @@ -992,7 +999,69 @@
8.1297 using `i \<notin> I` by (auto intro!: setprod_cong)
8.1298 show ?case
8.1299 unfolding product_integral_insert[OF insert(1,3) prod[OF subset_refl]]
8.1300 - by (simp add: * insert integral_multc I.integral_cmult[OF prod] subset_insertI)
8.1301 + by (simp add: * insert integral_multc integral_cmult[OF prod] subset_insertI)
8.1302 qed
8.1303
8.1304 -end
8.1305 \ No newline at end of file
8.1306 +lemma sigma_prod_algebra_sigma_eq:
8.1307 + fixes E :: "'i \<Rightarrow> 'a set set"
8.1308 + assumes "finite I"
8.1309 + assumes S_mono: "\<And>i. i \<in> I \<Longrightarrow> incseq (S i)"
8.1310 + and S_union: "\<And>i. i \<in> I \<Longrightarrow> (\<Union>j. S i j) = space (M i)"
8.1311 + and S_in_E: "\<And>i. i \<in> I \<Longrightarrow> range (S i) \<subseteq> E i"
8.1312 + assumes E_closed: "\<And>i. i \<in> I \<Longrightarrow> E i \<subseteq> Pow (space (M i))"
8.1313 + and E_generates: "\<And>i. i \<in> I \<Longrightarrow> sets (M i) = sigma_sets (space (M i)) (E i)"
8.1314 + defines "P == { Pi\<^isub>E I F | F. \<forall>i\<in>I. F i \<in> E i }"
8.1315 + shows "sets (PiM I M) = sigma_sets (space (PiM I M)) P"
8.1316 +proof
8.1317 + let ?P = "sigma (space (Pi\<^isub>M I M)) P"
8.1318 + have P_closed: "P \<subseteq> Pow (space (Pi\<^isub>M I M))"
8.1319 + using E_closed by (auto simp: space_PiM P_def Pi_iff subset_eq)
8.1320 + then have space_P: "space ?P = (\<Pi>\<^isub>E i\<in>I. space (M i))"
8.1321 + by (simp add: space_PiM)
8.1322 + have "sets (PiM I M) =
8.1323 + sigma_sets (space ?P) {{f \<in> \<Pi>\<^isub>E i\<in>I. space (M i). f i \<in> A} |i A. i \<in> I \<and> A \<in> sets (M i)}"
8.1324 + using sets_PiM_single[of I M] by (simp add: space_P)
8.1325 + also have "\<dots> \<subseteq> sets (sigma (space (PiM I M)) P)"
8.1326 + proof (safe intro!: sigma_sets_subset)
8.1327 + fix i A assume "i \<in> I" and A: "A \<in> sets (M i)"
8.1328 + have "(\<lambda>x. x i) \<in> measurable ?P (sigma (space (M i)) (E i))"
8.1329 + proof (subst measurable_iff_measure_of)
8.1330 + show "E i \<subseteq> Pow (space (M i))" using `i \<in> I` by fact
8.1331 + from space_P `i \<in> I` show "(\<lambda>x. x i) \<in> space ?P \<rightarrow> space (M i)"
8.1332 + by (auto simp: Pi_iff)
8.1333 + show "\<forall>A\<in>E i. (\<lambda>x. x i) -` A \<inter> space ?P \<in> sets ?P"
8.1334 + proof
8.1335 + fix A assume A: "A \<in> E i"
8.1336 + then have "(\<lambda>x. x i) -` A \<inter> space ?P = (\<Pi>\<^isub>E j\<in>I. if i = j then A else space (M j))"
8.1337 + using E_closed `i \<in> I` by (auto simp: space_P Pi_iff subset_eq split: split_if_asm)
8.1338 + also have "\<dots> = (\<Pi>\<^isub>E j\<in>I. \<Union>n. if i = j then A else S j n)"
8.1339 + by (intro PiE_cong) (simp add: S_union)
8.1340 + also have "\<dots> = (\<Union>n. \<Pi>\<^isub>E j\<in>I. if i = j then A else S j n)"
8.1341 + using S_mono
8.1342 + by (subst Pi_UN[symmetric, OF `finite I`]) (auto simp: incseq_def)
8.1343 + also have "\<dots> \<in> sets ?P"
8.1344 + proof (safe intro!: countable_UN)
8.1345 + fix n show "(\<Pi>\<^isub>E j\<in>I. if i = j then A else S j n) \<in> sets ?P"
8.1346 + using A S_in_E
8.1347 + by (simp add: P_closed)
8.1348 + (auto simp: P_def subset_eq intro!: exI[of _ "\<lambda>j. if i = j then A else S j n"])
8.1349 + qed
8.1350 + finally show "(\<lambda>x. x i) -` A \<inter> space ?P \<in> sets ?P"
8.1351 + using P_closed by simp
8.1352 + qed
8.1353 + qed
8.1354 + from measurable_sets[OF this, of A] A `i \<in> I` E_closed
8.1355 + have "(\<lambda>x. x i) -` A \<inter> space ?P \<in> sets ?P"
8.1356 + by (simp add: E_generates)
8.1357 + also have "(\<lambda>x. x i) -` A \<inter> space ?P = {f \<in> \<Pi>\<^isub>E i\<in>I. space (M i). f i \<in> A}"
8.1358 + using P_closed by (auto simp: space_PiM)
8.1359 + finally show "\<dots> \<in> sets ?P" .
8.1360 + qed
8.1361 + finally show "sets (PiM I M) \<subseteq> sigma_sets (space (PiM I M)) P"
8.1362 + by (simp add: P_closed)
8.1363 + show "sigma_sets (space (PiM I M)) P \<subseteq> sets (PiM I M)"
8.1364 + using `finite I`
8.1365 + by (auto intro!: sigma_sets_subset simp: E_generates P_def)
8.1366 +qed
8.1367 +
8.1368 +end
9.1 --- a/src/HOL/Probability/Independent_Family.thy Mon Apr 23 12:23:23 2012 +0100
9.2 +++ b/src/HOL/Probability/Independent_Family.thy Mon Apr 23 12:14:35 2012 +0200
9.3 @@ -5,7 +5,7 @@
9.4 header {* Independent families of events, event sets, and random variables *}
9.5
9.6 theory Independent_Family
9.7 - imports Probability_Measure
9.8 + imports Probability_Measure Infinite_Product_Measure
9.9 begin
9.10
9.11 lemma INT_decseq_offset:
9.12 @@ -44,7 +44,7 @@
9.13 definition (in prob_space)
9.14 "indep_var Ma A Mb B \<longleftrightarrow> indep_vars (bool_case Ma Mb) (bool_case A B) UNIV"
9.15
9.16 -lemma (in prob_space) indep_sets_cong[cong]:
9.17 +lemma (in prob_space) indep_sets_cong:
9.18 "I = J \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i = G i) \<Longrightarrow> indep_sets F I \<longleftrightarrow> indep_sets G J"
9.19 by (simp add: indep_sets_def, intro conj_cong all_cong imp_cong ball_cong) blast+
9.20
9.21 @@ -135,7 +135,7 @@
9.22
9.23 lemma (in prob_space) indep_sets_dynkin:
9.24 assumes indep: "indep_sets F I"
9.25 - shows "indep_sets (\<lambda>i. sets (dynkin \<lparr> space = space M, sets = F i \<rparr>)) I"
9.26 + shows "indep_sets (\<lambda>i. dynkin (space M) (F i)) I"
9.27 (is "indep_sets ?F I")
9.28 proof (subst indep_sets_finite_index_sets, intro allI impI ballI)
9.29 fix J assume "finite J" "J \<subseteq> I" "J \<noteq> {}"
9.30 @@ -193,7 +193,7 @@
9.31 qed
9.32 qed }
9.33 note indep_sets_insert = this
9.34 - have "dynkin_system \<lparr> space = space M, sets = ?D \<rparr>"
9.35 + have "dynkin_system (space M) ?D"
9.36 proof (rule dynkin_systemI', simp_all cong del: indep_sets_cong, safe)
9.37 show "indep_sets (G(j := {{}})) K"
9.38 by (rule indep_sets_insert) auto
9.39 @@ -206,7 +206,7 @@
9.40 using G by auto
9.41 have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) =
9.42 prob ((\<Inter>j\<in>J. A j) - (\<Inter>i\<in>insert j J. (A(j := X)) i))"
9.43 - using A_sets sets_into_space X `J \<noteq> {}`
9.44 + using A_sets sets_into_space[of _ M] X `J \<noteq> {}`
9.45 by (auto intro!: arg_cong[where f=prob] split: split_if_asm)
9.46 also have "\<dots> = prob (\<Inter>j\<in>J. A j) - prob (\<Inter>i\<in>insert j J. (A(j := X)) i)"
9.47 using J `J \<noteq> {}` `j \<notin> J` A_sets X sets_into_space
9.48 @@ -264,9 +264,8 @@
9.49 by (auto dest!: sums_unique)
9.50 qed (insert F, auto)
9.51 qed (insert sets_into_space, auto)
9.52 - then have mono: "sets (dynkin \<lparr>space = space M, sets = G j\<rparr>) \<subseteq>
9.53 - sets \<lparr>space = space M, sets = {E \<in> events. indep_sets (G(j := {E})) K}\<rparr>"
9.54 - proof (rule dynkin_system.dynkin_subset, simp_all cong del: indep_sets_cong, safe)
9.55 + then have mono: "dynkin (space M) (G j) \<subseteq> {E \<in> events. indep_sets (G(j := {E})) K}"
9.56 + proof (rule dynkin_system.dynkin_subset, safe)
9.57 fix X assume "X \<in> G j"
9.58 then show "X \<in> events" using G `j \<in> K` by auto
9.59 from `indep_sets G K`
9.60 @@ -292,20 +291,20 @@
9.61 by (intro indep_setsD[OF G(1)]) auto
9.62 qed
9.63 qed
9.64 - then have "indep_sets (G(j:=sets (dynkin \<lparr>space = space M, sets = G j\<rparr>))) K"
9.65 + then have "indep_sets (G(j := dynkin (space M) (G j))) K"
9.66 by (rule indep_sets_mono_sets) (insert mono, auto)
9.67 then show ?case
9.68 by (rule indep_sets_mono_sets) (insert `j \<in> K` `j \<notin> J`, auto simp: G_def)
9.69 qed (insert `indep_sets F K`, simp) }
9.70 from this[OF `indep_sets F J` `finite J` subset_refl]
9.71 - show "indep_sets (\<lambda>i. sets (dynkin \<lparr> space = space M, sets = F i \<rparr>)) J"
9.72 + show "indep_sets ?F J"
9.73 by (rule indep_sets_mono_sets) auto
9.74 qed
9.75
9.76 lemma (in prob_space) indep_sets_sigma:
9.77 assumes indep: "indep_sets F I"
9.78 - assumes stable: "\<And>i. i \<in> I \<Longrightarrow> Int_stable \<lparr> space = space M, sets = F i \<rparr>"
9.79 - shows "indep_sets (\<lambda>i. sets (sigma \<lparr> space = space M, sets = F i \<rparr>)) I"
9.80 + assumes stable: "\<And>i. i \<in> I \<Longrightarrow> Int_stable (F i)"
9.81 + shows "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I"
9.82 proof -
9.83 from indep_sets_dynkin[OF indep]
9.84 show ?thesis
9.85 @@ -316,18 +315,12 @@
9.86 qed
9.87 qed
9.88
9.89 -lemma (in prob_space) indep_sets_sigma_sets:
9.90 - assumes "indep_sets F I"
9.91 - assumes "\<And>i. i \<in> I \<Longrightarrow> Int_stable \<lparr> space = space M, sets = F i \<rparr>"
9.92 - shows "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I"
9.93 - using indep_sets_sigma[OF assms] by (simp add: sets_sigma)
9.94 -
9.95 lemma (in prob_space) indep_sets_sigma_sets_iff:
9.96 - assumes "\<And>i. i \<in> I \<Longrightarrow> Int_stable \<lparr> space = space M, sets = F i \<rparr>"
9.97 + assumes "\<And>i. i \<in> I \<Longrightarrow> Int_stable (F i)"
9.98 shows "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I \<longleftrightarrow> indep_sets F I"
9.99 proof
9.100 assume "indep_sets F I" then show "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I"
9.101 - by (rule indep_sets_sigma_sets) fact
9.102 + by (rule indep_sets_sigma) fact
9.103 next
9.104 assume "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I" then show "indep_sets F I"
9.105 by (rule indep_sets_mono_sets) (intro subsetI sigma_sets.Basic)
9.106 @@ -361,15 +354,14 @@
9.107
9.108 lemma (in prob_space) indep_set_sigma_sets:
9.109 assumes "indep_set A B"
9.110 - assumes A: "Int_stable \<lparr> space = space M, sets = A \<rparr>"
9.111 - assumes B: "Int_stable \<lparr> space = space M, sets = B \<rparr>"
9.112 + assumes A: "Int_stable A" and B: "Int_stable B"
9.113 shows "indep_set (sigma_sets (space M) A) (sigma_sets (space M) B)"
9.114 proof -
9.115 have "indep_sets (\<lambda>i. sigma_sets (space M) (case i of True \<Rightarrow> A | False \<Rightarrow> B)) UNIV"
9.116 - proof (rule indep_sets_sigma_sets)
9.117 + proof (rule indep_sets_sigma)
9.118 show "indep_sets (bool_case A B) UNIV"
9.119 by (rule `indep_set A B`[unfolded indep_set_def])
9.120 - fix i show "Int_stable \<lparr>space = space M, sets = case i of True \<Rightarrow> A | False \<Rightarrow> B\<rparr>"
9.121 + fix i show "Int_stable (case i of True \<Rightarrow> A | False \<Rightarrow> B)"
9.122 using A B by (cases i) auto
9.123 qed
9.124 then show ?thesis
9.125 @@ -380,7 +372,7 @@
9.126 lemma (in prob_space) indep_sets_collect_sigma:
9.127 fixes I :: "'j \<Rightarrow> 'i set" and J :: "'j set" and E :: "'i \<Rightarrow> 'a set set"
9.128 assumes indep: "indep_sets E (\<Union>j\<in>J. I j)"
9.129 - assumes Int_stable: "\<And>i j. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> Int_stable \<lparr>space = space M, sets = E i\<rparr>"
9.130 + assumes Int_stable: "\<And>i j. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> Int_stable (E i)"
9.131 assumes disjoint: "disjoint_family_on I J"
9.132 shows "indep_sets (\<lambda>j. sigma_sets (space M) (\<Union>i\<in>I j. E i)) J"
9.133 proof -
9.134 @@ -389,30 +381,29 @@
9.135 from indep have E: "\<And>j i. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> E i \<subseteq> events"
9.136 unfolding indep_sets_def by auto
9.137 { fix j
9.138 - let ?S = "sigma \<lparr> space = space M, sets = (\<Union>i\<in>I j. E i) \<rparr>"
9.139 + let ?S = "sigma_sets (space M) (\<Union>i\<in>I j. E i)"
9.140 assume "j \<in> J"
9.141 - from E[OF this] interpret S: sigma_algebra ?S
9.142 - using sets_into_space by (intro sigma_algebra_sigma) auto
9.143 + from E[OF this] interpret S: sigma_algebra "space M" ?S
9.144 + using sets_into_space[of _ M] by (intro sigma_algebra_sigma_sets) auto
9.145
9.146 have "sigma_sets (space M) (\<Union>i\<in>I j. E i) = sigma_sets (space M) (?E j)"
9.147 proof (rule sigma_sets_eqI)
9.148 fix A assume "A \<in> (\<Union>i\<in>I j. E i)"
9.149 then guess i ..
9.150 then show "A \<in> sigma_sets (space M) (?E j)"
9.151 - by (auto intro!: sigma_sets.intros exI[of _ "{i}"] exI[of _ "\<lambda>i. A"])
9.152 + by (auto intro!: sigma_sets.intros(2-) exI[of _ "{i}"] exI[of _ "\<lambda>i. A"])
9.153 next
9.154 fix A assume "A \<in> ?E j"
9.155 then obtain E' K where "finite K" "K \<noteq> {}" "K \<subseteq> I j" "\<And>k. k \<in> K \<Longrightarrow> E' k \<in> E k"
9.156 and A: "A = (\<Inter>k\<in>K. E' k)"
9.157 by auto
9.158 - then have "A \<in> sets ?S" unfolding A
9.159 - by (safe intro!: S.finite_INT)
9.160 - (auto simp: sets_sigma intro!: sigma_sets.Basic)
9.161 + then have "A \<in> ?S" unfolding A
9.162 + by (safe intro!: S.finite_INT) auto
9.163 then show "A \<in> sigma_sets (space M) (\<Union>i\<in>I j. E i)"
9.164 - by (simp add: sets_sigma)
9.165 + by simp
9.166 qed }
9.167 moreover have "indep_sets (\<lambda>j. sigma_sets (space M) (?E j)) J"
9.168 - proof (rule indep_sets_sigma_sets)
9.169 + proof (rule indep_sets_sigma)
9.170 show "indep_sets ?E J"
9.171 proof (intro indep_setsI)
9.172 fix j assume "j \<in> J" with E show "?E j \<subseteq> events" by (force intro!: finite_INT)
9.173 @@ -460,7 +451,7 @@
9.174 qed
9.175 next
9.176 fix j assume "j \<in> J"
9.177 - show "Int_stable \<lparr> space = space M, sets = ?E j \<rparr>"
9.178 + show "Int_stable (?E j)"
9.179 proof (rule Int_stableI)
9.180 fix a assume "a \<in> ?E j" then obtain Ka Ea
9.181 where a: "a = (\<Inter>k\<in>Ka. Ea k)" "finite Ka" "Ka \<noteq> {}" "Ka \<subseteq> I j" "\<And>k. k\<in>Ka \<Longrightarrow> Ea k \<in> E k" by auto
9.182 @@ -482,12 +473,12 @@
9.183
9.184 lemma (in prob_space) terminal_events_sets:
9.185 assumes A: "\<And>i. A i \<subseteq> events"
9.186 - assumes "\<And>i::nat. sigma_algebra \<lparr>space = space M, sets = A i\<rparr>"
9.187 + assumes "\<And>i::nat. sigma_algebra (space M) (A i)"
9.188 assumes X: "X \<in> terminal_events A"
9.189 shows "X \<in> events"
9.190 proof -
9.191 let ?A = "(\<Inter>n. sigma_sets (space M) (UNION {n..} A))"
9.192 - interpret A: sigma_algebra "\<lparr>space = space M, sets = A i\<rparr>" for i by fact
9.193 + interpret A: sigma_algebra "space M" "A i" for i by fact
9.194 from X have "\<And>n. X \<in> sigma_sets (space M) (UNION {n..} A)" by (auto simp: terminal_events_def)
9.195 from this[of 0] have "X \<in> sigma_sets (space M) (UNION UNIV A)" by simp
9.196 then show "X \<in> events"
9.197 @@ -495,12 +486,12 @@
9.198 qed
9.199
9.200 lemma (in prob_space) sigma_algebra_terminal_events:
9.201 - assumes "\<And>i::nat. sigma_algebra \<lparr>space = space M, sets = A i\<rparr>"
9.202 - shows "sigma_algebra \<lparr> space = space M, sets = terminal_events A \<rparr>"
9.203 + assumes "\<And>i::nat. sigma_algebra (space M) (A i)"
9.204 + shows "sigma_algebra (space M) (terminal_events A)"
9.205 unfolding terminal_events_def
9.206 proof (simp add: sigma_algebra_iff2, safe)
9.207 let ?A = "(\<Inter>n. sigma_sets (space M) (UNION {n..} A))"
9.208 - interpret A: sigma_algebra "\<lparr>space = space M, sets = A i\<rparr>" for i by fact
9.209 + interpret A: sigma_algebra "space M" "A i" for i by fact
9.210 { fix X x assume "X \<in> ?A" "x \<in> X"
9.211 then have "\<And>n. X \<in> sigma_sets (space M) (UNION {n..} A)" by auto
9.212 from this[of 0] have "X \<in> sigma_sets (space M) (UNION UNIV A)" by simp
9.213 @@ -515,29 +506,29 @@
9.214 lemma (in prob_space) kolmogorov_0_1_law:
9.215 fixes A :: "nat \<Rightarrow> 'a set set"
9.216 assumes A: "\<And>i. A i \<subseteq> events"
9.217 - assumes "\<And>i::nat. sigma_algebra \<lparr>space = space M, sets = A i\<rparr>"
9.218 + assumes "\<And>i::nat. sigma_algebra (space M) (A i)"
9.219 assumes indep: "indep_sets A UNIV"
9.220 and X: "X \<in> terminal_events A"
9.221 shows "prob X = 0 \<or> prob X = 1"
9.222 proof -
9.223 - let ?D = "\<lparr> space = space M, sets = {D \<in> events. prob (X \<inter> D) = prob X * prob D} \<rparr>"
9.224 - interpret A: sigma_algebra "\<lparr>space = space M, sets = A i\<rparr>" for i by fact
9.225 - interpret T: sigma_algebra "\<lparr> space = space M, sets = terminal_events A \<rparr>"
9.226 + let ?D = "{D \<in> events. prob (X \<inter> D) = prob X * prob D}"
9.227 + interpret A: sigma_algebra "space M" "A i" for i by fact
9.228 + interpret T: sigma_algebra "space M" "terminal_events A"
9.229 by (rule sigma_algebra_terminal_events) fact
9.230 have "X \<subseteq> space M" using T.space_closed X by auto
9.231
9.232 have X_in: "X \<in> events"
9.233 by (rule terminal_events_sets) fact+
9.234
9.235 - interpret D: dynkin_system ?D
9.236 + interpret D: dynkin_system "space M" ?D
9.237 proof (rule dynkin_systemI)
9.238 - fix D assume "D \<in> sets ?D" then show "D \<subseteq> space ?D"
9.239 + fix D assume "D \<in> ?D" then show "D \<subseteq> space M"
9.240 using sets_into_space by auto
9.241 next
9.242 - show "space ?D \<in> sets ?D"
9.243 + show "space M \<in> ?D"
9.244 using prob_space `X \<subseteq> space M` by (simp add: Int_absorb2)
9.245 next
9.246 - fix A assume A: "A \<in> sets ?D"
9.247 + fix A assume A: "A \<in> ?D"
9.248 have "prob (X \<inter> (space M - A)) = prob (X - (X \<inter> A))"
9.249 using `X \<subseteq> space M` by (auto intro!: arg_cong[where f=prob])
9.250 also have "\<dots> = prob X - prob (X \<inter> A)"
9.251 @@ -547,10 +538,10 @@
9.252 also have "\<dots> = prob X * prob (space M - A)"
9.253 using X_in A sets_into_space
9.254 by (subst finite_measure_Diff) (auto simp: field_simps)
9.255 - finally show "space ?D - A \<in> sets ?D"
9.256 + finally show "space M - A \<in> ?D"
9.257 using A `X \<subseteq> space M` by auto
9.258 next
9.259 - fix F :: "nat \<Rightarrow> 'a set" assume dis: "disjoint_family F" and "range F \<subseteq> sets ?D"
9.260 + fix F :: "nat \<Rightarrow> 'a set" assume dis: "disjoint_family F" and "range F \<subseteq> ?D"
9.261 then have F: "range F \<subseteq> events" "\<And>i. prob (X \<inter> F i) = prob X * prob (F i)"
9.262 by auto
9.263 have "(\<lambda>i. prob (X \<inter> F i)) sums prob (\<Union>i. X \<inter> F i)"
9.264 @@ -566,7 +557,7 @@
9.265 by (intro sums_mult finite_measure_UNION F dis)
9.266 ultimately have "prob (X \<inter> (\<Union>i. F i)) = prob X * prob (\<Union>i. F i)"
9.267 by (auto dest!: sums_unique)
9.268 - with F show "(\<Union>i. F i) \<in> sets ?D"
9.269 + with F show "(\<Union>i. F i) \<in> ?D"
9.270 by auto
9.271 qed
9.272
9.273 @@ -579,7 +570,7 @@
9.274 show "disjoint_family (bool_case {..n} {Suc n..})"
9.275 unfolding disjoint_family_on_def by (auto split: bool.split)
9.276 fix m
9.277 - show "Int_stable \<lparr>space = space M, sets = A m\<rparr>"
9.278 + show "Int_stable (A m)"
9.279 unfolding Int_stable_def using A.Int by auto
9.280 qed
9.281 also have "(\<lambda>b. sigma_sets (space M) (\<Union>m\<in>bool_case {..n} {Suc n..} b. A m)) =
9.282 @@ -588,7 +579,7 @@
9.283 finally have indep: "indep_set (sigma_sets (space M) (\<Union>m\<in>{..n}. A m)) (sigma_sets (space M) (\<Union>m\<in>{Suc n..}. A m))"
9.284 unfolding indep_set_def by simp
9.285
9.286 - have "sigma_sets (space M) (\<Union>m\<in>{..n}. A m) \<subseteq> sets ?D"
9.287 + have "sigma_sets (space M) (\<Union>m\<in>{..n}. A m) \<subseteq> ?D"
9.288 proof (simp add: subset_eq, rule)
9.289 fix D assume D: "D \<in> sigma_sets (space M) (\<Union>m\<in>{..n}. A m)"
9.290 have "X \<in> sigma_sets (space M) (\<Union>m\<in>{Suc n..}. A m)"
9.291 @@ -597,22 +588,27 @@
9.292 show "D \<in> events \<and> prob (X \<inter> D) = prob X * prob D"
9.293 by (auto simp add: ac_simps)
9.294 qed }
9.295 - then have "(\<Union>n. sigma_sets (space M) (\<Union>m\<in>{..n}. A m)) \<subseteq> sets ?D" (is "?A \<subseteq> _")
9.296 + then have "(\<Union>n. sigma_sets (space M) (\<Union>m\<in>{..n}. A m)) \<subseteq> ?D" (is "?A \<subseteq> _")
9.297 by auto
9.298
9.299 - have "sigma \<lparr> space = space M, sets = ?A \<rparr> =
9.300 - dynkin \<lparr> space = space M, sets = ?A \<rparr>" (is "sigma ?UA = dynkin ?UA")
9.301 + note `X \<in> terminal_events A`
9.302 + also {
9.303 + have "\<And>n. sigma_sets (space M) (\<Union>i\<in>{n..}. A i) \<subseteq> sigma_sets (space M) ?A"
9.304 + by (intro sigma_sets_subseteq UN_mono) auto
9.305 + then have "terminal_events A \<subseteq> sigma_sets (space M) ?A"
9.306 + unfolding terminal_events_def by auto }
9.307 + also have "sigma_sets (space M) ?A = dynkin (space M) ?A"
9.308 proof (rule sigma_eq_dynkin)
9.309 { fix B n assume "B \<in> sigma_sets (space M) (\<Union>m\<in>{..n}. A m)"
9.310 then have "B \<subseteq> space M"
9.311 - by induct (insert A sets_into_space, auto) }
9.312 - then show "sets ?UA \<subseteq> Pow (space ?UA)" by auto
9.313 - show "Int_stable ?UA"
9.314 + by induct (insert A sets_into_space[of _ M], auto) }
9.315 + then show "?A \<subseteq> Pow (space M)" by auto
9.316 + show "Int_stable ?A"
9.317 proof (rule Int_stableI)
9.318 fix a assume "a \<in> ?A" then guess n .. note a = this
9.319 fix b assume "b \<in> ?A" then guess m .. note b = this
9.320 - interpret Amn: sigma_algebra "sigma \<lparr>space = space M, sets = (\<Union>i\<in>{..max m n}. A i)\<rparr>"
9.321 - using A sets_into_space by (intro sigma_algebra_sigma) auto
9.322 + interpret Amn: sigma_algebra "space M" "sigma_sets (space M) (\<Union>i\<in>{..max m n}. A i)"
9.323 + using A sets_into_space[of _ M] by (intro sigma_algebra_sigma_sets) auto
9.324 have "sigma_sets (space M) (\<Union>i\<in>{..n}. A i) \<subseteq> sigma_sets (space M) (\<Union>i\<in>{..max m n}. A i)"
9.325 by (intro sigma_sets_subseteq UN_mono) auto
9.326 with a have "a \<in> sigma_sets (space M) (\<Union>i\<in>{..max m n}. A i)" by auto
9.327 @@ -621,23 +617,13 @@
9.328 by (intro sigma_sets_subseteq UN_mono) auto
9.329 with b have "b \<in> sigma_sets (space M) (\<Union>i\<in>{..max m n}. A i)" by auto
9.330 ultimately have "a \<inter> b \<in> sigma_sets (space M) (\<Union>i\<in>{..max m n}. A i)"
9.331 - using Amn.Int[of a b] by (simp add: sets_sigma)
9.332 + using Amn.Int[of a b] by simp
9.333 then show "a \<inter> b \<in> (\<Union>n. sigma_sets (space M) (\<Union>i\<in>{..n}. A i))" by auto
9.334 qed
9.335 qed
9.336 - moreover have "sets (dynkin ?UA) \<subseteq> sets ?D"
9.337 - proof (rule D.dynkin_subset)
9.338 - show "sets ?UA \<subseteq> sets ?D" using `?A \<subseteq> sets ?D` by auto
9.339 - qed simp
9.340 - ultimately have "sets (sigma ?UA) \<subseteq> sets ?D" by simp
9.341 - moreover
9.342 - have "\<And>n. sigma_sets (space M) (\<Union>i\<in>{n..}. A i) \<subseteq> sigma_sets (space M) ?A"
9.343 - by (intro sigma_sets_subseteq UN_mono) (auto intro: sigma_sets.Basic)
9.344 - then have "terminal_events A \<subseteq> sets (sigma ?UA)"
9.345 - unfolding sets_sigma terminal_events_def by auto
9.346 - moreover note `X \<in> terminal_events A`
9.347 - ultimately have "X \<in> sets ?D" by auto
9.348 - then show ?thesis by auto
9.349 + also have "dynkin (space M) ?A \<subseteq> ?D"
9.350 + using `?A \<subseteq> ?D` by (auto intro!: D.dynkin_subset)
9.351 + finally show ?thesis by auto
9.352 qed
9.353
9.354 lemma (in prob_space) borel_0_1_law:
9.355 @@ -648,14 +634,14 @@
9.356 show "\<And>i. sigma_sets (space M) {F i} \<subseteq> events"
9.357 using F(1) sets_into_space
9.358 by (subst sigma_sets_singleton) auto
9.359 - { fix i show "sigma_algebra \<lparr>space = space M, sets = sigma_sets (space M) {F i}\<rparr>"
9.360 - using sigma_algebra_sigma[of "\<lparr>space = space M, sets = {F i}\<rparr>"] F sets_into_space
9.361 - by (auto simp add: sigma_def) }
9.362 + { fix i show "sigma_algebra (space M) (sigma_sets (space M) {F i})"
9.363 + using sigma_algebra_sigma_sets[of "{F i}" "space M"] F sets_into_space
9.364 + by auto }
9.365 show "indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV"
9.366 - proof (rule indep_sets_sigma_sets)
9.367 + proof (rule indep_sets_sigma)
9.368 show "indep_sets (\<lambda>i. {F i}) UNIV"
9.369 unfolding indep_sets_singleton_iff_indep_events by fact
9.370 - fix i show "Int_stable \<lparr>space = space M, sets = {F i}\<rparr>"
9.371 + fix i show "Int_stable {F i}"
9.372 unfolding Int_stable_def by simp
9.373 qed
9.374 let ?Q = "\<lambda>n. \<Union>i\<in>{n..}. F i"
9.375 @@ -663,17 +649,17 @@
9.376 unfolding terminal_events_def
9.377 proof
9.378 fix j
9.379 - interpret S: sigma_algebra "sigma \<lparr> space = space M, sets = (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})\<rparr>"
9.380 + interpret S: sigma_algebra "space M" "sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})"
9.381 using order_trans[OF F(1) space_closed]
9.382 - by (intro sigma_algebra_sigma) (simp add: sigma_sets_singleton subset_eq)
9.383 + by (intro sigma_algebra_sigma_sets) (simp add: sigma_sets_singleton subset_eq)
9.384 have "(\<Inter>n. ?Q n) = (\<Inter>n\<in>{j..}. ?Q n)"
9.385 by (intro decseq_SucI INT_decseq_offset UN_mono) auto
9.386 - also have "\<dots> \<in> sets (sigma \<lparr> space = space M, sets = (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})\<rparr>)"
9.387 + also have "\<dots> \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})"
9.388 using order_trans[OF F(1) space_closed]
9.389 by (safe intro!: S.countable_INT S.countable_UN)
9.390 - (auto simp: sets_sigma sigma_sets_singleton intro!: sigma_sets.Basic bexI)
9.391 + (auto simp: sigma_sets_singleton intro!: sigma_sets.Basic bexI)
9.392 finally show "(\<Inter>n. ?Q n) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})"
9.393 - by (simp add: sets_sigma)
9.394 + by simp
9.395 qed
9.396 qed
9.397
9.398 @@ -710,84 +696,84 @@
9.399 lemma (in prob_space) indep_vars_finite:
9.400 fixes I :: "'i set"
9.401 assumes I: "I \<noteq> {}" "finite I"
9.402 - and rv: "\<And>i. i \<in> I \<Longrightarrow> random_variable (sigma (M' i)) (X i)"
9.403 - and Int_stable: "\<And>i. i \<in> I \<Longrightarrow> Int_stable (M' i)"
9.404 - and space: "\<And>i. i \<in> I \<Longrightarrow> space (M' i) \<in> sets (M' i)"
9.405 - shows "indep_vars (\<lambda>i. sigma (M' i)) X I \<longleftrightarrow>
9.406 - (\<forall>A\<in>(\<Pi> i\<in>I. sets (M' i)). prob (\<Inter>j\<in>I. X j -` A j \<inter> space M) = (\<Prod>j\<in>I. prob (X j -` A j \<inter> space M)))"
9.407 + and M': "\<And>i. i \<in> I \<Longrightarrow> sets (M' i) = sigma_sets (space (M' i)) (E i)"
9.408 + and rv: "\<And>i. i \<in> I \<Longrightarrow> random_variable (M' i) (X i)"
9.409 + and Int_stable: "\<And>i. i \<in> I \<Longrightarrow> Int_stable (E i)"
9.410 + and space: "\<And>i. i \<in> I \<Longrightarrow> space (M' i) \<in> E i" and closed: "\<And>i. i \<in> I \<Longrightarrow> E i \<subseteq> Pow (space (M' i))"
9.411 + shows "indep_vars M' X I \<longleftrightarrow>
9.412 + (\<forall>A\<in>(\<Pi> i\<in>I. E i). prob (\<Inter>j\<in>I. X j -` A j \<inter> space M) = (\<Prod>j\<in>I. prob (X j -` A j \<inter> space M)))"
9.413 proof -
9.414 from rv have X: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> space M \<rightarrow> space (M' i)"
9.415 unfolding measurable_def by simp
9.416
9.417 { fix i assume "i\<in>I"
9.418 - have "sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (sigma (M' i))}
9.419 - = sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.420 - unfolding sigma_sets_vimage_commute[OF X, OF `i \<in> I`]
9.421 + from closed[OF `i \<in> I`]
9.422 + have "sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}
9.423 + = sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> E i}"
9.424 + unfolding sigma_sets_vimage_commute[OF X, OF `i \<in> I`, symmetric] M'[OF `i \<in> I`]
9.425 by (subst sigma_sets_sigma_sets_eq) auto }
9.426 - note this[simp]
9.427 + note sigma_sets_X = this
9.428
9.429 { fix i assume "i\<in>I"
9.430 - have "Int_stable \<lparr>space = space M, sets = {X i -` A \<inter> space M |A. A \<in> sets (M' i)}\<rparr>"
9.431 + have "Int_stable {X i -` A \<inter> space M |A. A \<in> E i}"
9.432 proof (rule Int_stableI)
9.433 - fix a assume "a \<in> {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.434 - then obtain A where "a = X i -` A \<inter> space M" "A \<in> sets (M' i)" by auto
9.435 + fix a assume "a \<in> {X i -` A \<inter> space M |A. A \<in> E i}"
9.436 + then obtain A where "a = X i -` A \<inter> space M" "A \<in> E i" by auto
9.437 moreover
9.438 - fix b assume "b \<in> {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.439 - then obtain B where "b = X i -` B \<inter> space M" "B \<in> sets (M' i)" by auto
9.440 + fix b assume "b \<in> {X i -` A \<inter> space M |A. A \<in> E i}"
9.441 + then obtain B where "b = X i -` B \<inter> space M" "B \<in> E i" by auto
9.442 moreover
9.443 have "(X i -` A \<inter> space M) \<inter> (X i -` B \<inter> space M) = X i -` (A \<inter> B) \<inter> space M" by auto
9.444 moreover note Int_stable[OF `i \<in> I`]
9.445 ultimately
9.446 - show "a \<inter> b \<in> {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.447 + show "a \<inter> b \<in> {X i -` A \<inter> space M |A. A \<in> E i}"
9.448 by (auto simp del: vimage_Int intro!: exI[of _ "A \<inter> B"] dest: Int_stableD)
9.449 qed }
9.450 - note indep_sets_sigma_sets_iff[OF this, simp]
9.451 + note indep_sets_X = indep_sets_sigma_sets_iff[OF this]
9.452
9.453 { fix i assume "i \<in> I"
9.454 - { fix A assume "A \<in> sets (M' i)"
9.455 - then have "A \<in> sets (sigma (M' i))" by (auto simp: sets_sigma intro: sigma_sets.Basic)
9.456 + { fix A assume "A \<in> E i"
9.457 + with M'[OF `i \<in> I`] have "A \<in> sets (M' i)" by auto
9.458 moreover
9.459 - from rv[OF `i\<in>I`] have "X i \<in> measurable M (sigma (M' i))" by auto
9.460 + from rv[OF `i\<in>I`] have "X i \<in> measurable M (M' i)" by auto
9.461 ultimately
9.462 have "X i -` A \<inter> space M \<in> sets M" by (auto intro: measurable_sets) }
9.463 with X[OF `i\<in>I`] space[OF `i\<in>I`]
9.464 - have "{X i -` A \<inter> space M |A. A \<in> sets (M' i)} \<subseteq> events"
9.465 - "space M \<in> {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.466 + have "{X i -` A \<inter> space M |A. A \<in> E i} \<subseteq> events"
9.467 + "space M \<in> {X i -` A \<inter> space M |A. A \<in> E i}"
9.468 by (auto intro!: exI[of _ "space (M' i)"]) }
9.469 - note indep_sets_finite[OF I this, simp]
9.470 + note indep_sets_finite_X = indep_sets_finite[OF I this]
9.471
9.472 - have "(\<forall>A\<in>\<Pi> i\<in>I. {X i -` A \<inter> space M |A. A \<in> sets (M' i)}. prob (INTER I A) = (\<Prod>j\<in>I. prob (A j))) =
9.473 - (\<forall>A\<in>\<Pi> i\<in>I. sets (M' i). prob ((\<Inter>j\<in>I. X j -` A j) \<inter> space M) = (\<Prod>x\<in>I. prob (X x -` A x \<inter> space M)))"
9.474 + have "(\<forall>A\<in>\<Pi> i\<in>I. {X i -` A \<inter> space M |A. A \<in> E i}. prob (INTER I A) = (\<Prod>j\<in>I. prob (A j))) =
9.475 + (\<forall>A\<in>\<Pi> i\<in>I. E i. prob ((\<Inter>j\<in>I. X j -` A j) \<inter> space M) = (\<Prod>x\<in>I. prob (X x -` A x \<inter> space M)))"
9.476 (is "?L = ?R")
9.477 proof safe
9.478 - fix A assume ?L and A: "A \<in> (\<Pi> i\<in>I. sets (M' i))"
9.479 + fix A assume ?L and A: "A \<in> (\<Pi> i\<in>I. E i)"
9.480 from `?L`[THEN bspec, of "\<lambda>i. X i -` A i \<inter> space M"] A `I \<noteq> {}`
9.481 show "prob ((\<Inter>j\<in>I. X j -` A j) \<inter> space M) = (\<Prod>x\<in>I. prob (X x -` A x \<inter> space M))"
9.482 by (auto simp add: Pi_iff)
9.483 next
9.484 - fix A assume ?R and A: "A \<in> (\<Pi> i\<in>I. {X i -` A \<inter> space M |A. A \<in> sets (M' i)})"
9.485 - from A have "\<forall>i\<in>I. \<exists>B. A i = X i -` B \<inter> space M \<and> B \<in> sets (M' i)" by auto
9.486 + fix A assume ?R and A: "A \<in> (\<Pi> i\<in>I. {X i -` A \<inter> space M |A. A \<in> E i})"
9.487 + from A have "\<forall>i\<in>I. \<exists>B. A i = X i -` B \<inter> space M \<and> B \<in> E i" by auto
9.488 from bchoice[OF this] obtain B where B: "\<forall>i\<in>I. A i = X i -` B i \<inter> space M"
9.489 - "B \<in> (\<Pi> i\<in>I. sets (M' i))" by auto
9.490 + "B \<in> (\<Pi> i\<in>I. E i)" by auto
9.491 from `?R`[THEN bspec, OF B(2)] B(1) `I \<noteq> {}`
9.492 show "prob (INTER I A) = (\<Prod>j\<in>I. prob (A j))"
9.493 by simp
9.494 qed
9.495 then show ?thesis using `I \<noteq> {}`
9.496 - by (simp add: rv indep_vars_def)
9.497 + by (simp add: rv indep_vars_def indep_sets_X sigma_sets_X indep_sets_finite_X cong: indep_sets_cong)
9.498 qed
9.499
9.500 lemma (in prob_space) indep_vars_compose:
9.501 assumes "indep_vars M' X I"
9.502 - assumes rv:
9.503 - "\<And>i. i \<in> I \<Longrightarrow> sigma_algebra (N i)"
9.504 - "\<And>i. i \<in> I \<Longrightarrow> Y i \<in> measurable (M' i) (N i)"
9.505 + assumes rv: "\<And>i. i \<in> I \<Longrightarrow> Y i \<in> measurable (M' i) (N i)"
9.506 shows "indep_vars N (\<lambda>i. Y i \<circ> X i) I"
9.507 unfolding indep_vars_def
9.508 proof
9.509 from rv `indep_vars M' X I`
9.510 show "\<forall>i\<in>I. random_variable (N i) (Y i \<circ> X i)"
9.511 - by (auto intro!: measurable_comp simp: indep_vars_def)
9.512 + by (auto simp: indep_vars_def)
9.513
9.514 have "indep_sets (\<lambda>i. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I"
9.515 using `indep_vars M' X I` by (simp add: indep_vars_def)
9.516 @@ -806,7 +792,7 @@
9.517 qed
9.518 qed
9.519
9.520 -lemma (in prob_space) indep_varsD:
9.521 +lemma (in prob_space) indep_varsD_finite:
9.522 assumes X: "indep_vars M' X I"
9.523 assumes I: "I \<noteq> {}" "finite I" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M' i)"
9.524 shows "prob (\<Inter>i\<in>I. X i -` A i \<inter> space M) = (\<Prod>i\<in>I. prob (X i -` A i \<inter> space M))"
9.525 @@ -815,96 +801,134 @@
9.526 using X by (auto simp: indep_vars_def)
9.527 show "I \<subseteq> I" "I \<noteq> {}" "finite I" using I by auto
9.528 show "\<forall>i\<in>I. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.529 - using I by (auto intro: sigma_sets.Basic)
9.530 + using I by auto
9.531 qed
9.532
9.533 -lemma (in prob_space) indep_distribution_eq_measure:
9.534 - assumes I: "I \<noteq> {}" "finite I"
9.535 +lemma (in prob_space) indep_varsD:
9.536 + assumes X: "indep_vars M' X I"
9.537 + assumes I: "J \<noteq> {}" "finite J" "J \<subseteq> I" "\<And>i. i \<in> J \<Longrightarrow> A i \<in> sets (M' i)"
9.538 + shows "prob (\<Inter>i\<in>J. X i -` A i \<inter> space M) = (\<Prod>i\<in>J. prob (X i -` A i \<inter> space M))"
9.539 +proof (rule indep_setsD)
9.540 + show "indep_sets (\<lambda>i. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I"
9.541 + using X by (auto simp: indep_vars_def)
9.542 + show "\<forall>i\<in>J. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
9.543 + using I by auto
9.544 +qed fact+
9.545 +
9.546 +lemma prod_algebra_cong:
9.547 + assumes "I = J" and sets: "(\<And>i. i \<in> I \<Longrightarrow> sets (M i) = sets (N i))"
9.548 + shows "prod_algebra I M = prod_algebra J N"
9.549 +proof -
9.550 + have space: "\<And>i. i \<in> I \<Longrightarrow> space (M i) = space (N i)"
9.551 + using sets_eq_imp_space_eq[OF sets] by auto
9.552 + with sets show ?thesis unfolding `I = J`
9.553 + by (intro antisym prod_algebra_mono) auto
9.554 +qed
9.555 +
9.556 +lemma space_in_prod_algebra:
9.557 + "(\<Pi>\<^isub>E i\<in>I. space (M i)) \<in> prod_algebra I M"
9.558 +proof cases
9.559 + assume "I = {}" then show ?thesis
9.560 + by (auto simp add: prod_algebra_def image_iff prod_emb_def)
9.561 +next
9.562 + assume "I \<noteq> {}"
9.563 + then obtain i where "i \<in> I" by auto
9.564 + then have "(\<Pi>\<^isub>E i\<in>I. space (M i)) = prod_emb I M {i} (\<Pi>\<^isub>E i\<in>{i}. space (M i))"
9.565 + by (auto simp: prod_emb_def Pi_iff)
9.566 + also have "\<dots> \<in> prod_algebra I M"
9.567 + using `i \<in> I` by (intro prod_algebraI) auto
9.568 + finally show ?thesis .
9.569 +qed
9.570 +
9.571 +lemma (in prob_space) indep_vars_iff_distr_eq_PiM:
9.572 + fixes I :: "'i set" and X :: "'i \<Rightarrow> 'a \<Rightarrow> 'b"
9.573 + assumes "I \<noteq> {}"
9.574 assumes rv: "\<And>i. random_variable (M' i) (X i)"
9.575 shows "indep_vars M' X I \<longleftrightarrow>
9.576 - (\<forall>A\<in>sets (\<Pi>\<^isub>M i\<in>I. (M' i \<lparr> measure := ereal\<circ>distribution (X i) \<rparr>)).
9.577 - distribution (\<lambda>x. \<lambda>i\<in>I. X i x) A =
9.578 - finite_measure.\<mu>' (\<Pi>\<^isub>M i\<in>I. (M' i \<lparr> measure := ereal\<circ>distribution (X i) \<rparr>)) A)"
9.579 - (is "_ \<longleftrightarrow> (\<forall>X\<in>_. distribution ?D X = finite_measure.\<mu>' (Pi\<^isub>M I ?M) X)")
9.580 + distr M (\<Pi>\<^isub>M i\<in>I. M' i) (\<lambda>x. \<lambda>i\<in>I. X i x) = (\<Pi>\<^isub>M i\<in>I. distr M (M' i) (X i))"
9.581 proof -
9.582 - interpret M': prob_space "?M i" for i
9.583 - using rv by (rule distribution_prob_space)
9.584 - interpret P: finite_product_prob_space ?M I
9.585 - proof qed fact
9.586 + let ?P = "\<Pi>\<^isub>M i\<in>I. M' i"
9.587 + let ?X = "\<lambda>x. \<lambda>i\<in>I. X i x"
9.588 + let ?D = "distr M ?P ?X"
9.589 + have X: "random_variable ?P ?X" by (intro measurable_restrict rv)
9.590 + interpret D: prob_space ?D by (intro prob_space_distr X)
9.591
9.592 - let ?D' = "(Pi\<^isub>M I ?M) \<lparr> measure := ereal \<circ> distribution ?D \<rparr>"
9.593 - have "random_variable P.P ?D"
9.594 - using `finite I` rv by (intro random_variable_restrict) auto
9.595 - then interpret D: prob_space ?D'
9.596 - by (rule distribution_prob_space)
9.597 + let ?D' = "\<lambda>i. distr M (M' i) (X i)"
9.598 + let ?P' = "\<Pi>\<^isub>M i\<in>I. distr M (M' i) (X i)"
9.599 + interpret D': prob_space "?D' i" for i by (intro prob_space_distr rv)
9.600 + interpret P: product_prob_space ?D' I ..
9.601 +
9.602 + show ?thesis
9.603 + proof
9.604 + assume "indep_vars M' X I"
9.605 + show "?D = ?P'"
9.606 + proof (rule measure_eqI_generator_eq)
9.607 + show "Int_stable (prod_algebra I M')"
9.608 + by (rule Int_stable_prod_algebra)
9.609 + show "prod_algebra I M' \<subseteq> Pow (space ?P)"
9.610 + using prod_algebra_sets_into_space by (simp add: space_PiM)
9.611 + show "sets ?D = sigma_sets (space ?P) (prod_algebra I M')"
9.612 + by (simp add: sets_PiM space_PiM)
9.613 + show "sets ?P' = sigma_sets (space ?P) (prod_algebra I M')"
9.614 + by (simp add: sets_PiM space_PiM cong: prod_algebra_cong)
9.615 + let ?A = "\<lambda>i. \<Pi>\<^isub>E i\<in>I. space (M' i)"
9.616 + show "range ?A \<subseteq> prod_algebra I M'" "incseq ?A" "(\<Union>i. ?A i) = space (Pi\<^isub>M I M')"
9.617 + by (auto simp: space_PiM intro!: space_in_prod_algebra cong: prod_algebra_cong)
9.618 + { fix i show "emeasure ?D (\<Pi>\<^isub>E i\<in>I. space (M' i)) \<noteq> \<infinity>" by auto }
9.619 + next
9.620 + fix E assume E: "E \<in> prod_algebra I M'"
9.621 + from prod_algebraE[OF E] guess J Y . note J = this
9.622
9.623 - show ?thesis
9.624 - proof (intro iffI ballI)
9.625 - assume "indep_vars M' X I"
9.626 - fix A assume "A \<in> sets P.P"
9.627 - moreover
9.628 - have "D.prob A = P.prob A"
9.629 - proof (rule prob_space_unique_Int_stable)
9.630 - show "prob_space ?D'" by unfold_locales
9.631 - show "prob_space (Pi\<^isub>M I ?M)" by unfold_locales
9.632 - show "Int_stable P.G" using M'.Int
9.633 - by (intro Int_stable_product_algebra_generator) (simp add: Int_stable_def)
9.634 - show "space P.G \<in> sets P.G"
9.635 - using M'.top by (simp add: product_algebra_generator_def)
9.636 - show "space ?D' = space P.G" "sets ?D' = sets (sigma P.G)"
9.637 - by (simp_all add: product_algebra_def product_algebra_generator_def sets_sigma)
9.638 - show "space P.P = space P.G" "sets P.P = sets (sigma P.G)"
9.639 - by (simp_all add: product_algebra_def)
9.640 - show "A \<in> sets (sigma P.G)"
9.641 - using `A \<in> sets P.P` by (simp add: product_algebra_def)
9.642 -
9.643 - fix E assume E: "E \<in> sets P.G"
9.644 - then have "E \<in> sets P.P"
9.645 - by (simp add: sets_sigma sigma_sets.Basic product_algebra_def)
9.646 - then have "D.prob E = distribution ?D E"
9.647 - unfolding D.\<mu>'_def by simp
9.648 - also
9.649 - from E obtain F where "E = Pi\<^isub>E I F" and F: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets (M' i)"
9.650 - by (auto simp: product_algebra_generator_def)
9.651 - with `I \<noteq> {}` have "distribution ?D E = prob (\<Inter>i\<in>I. X i -` F i \<inter> space M)"
9.652 - using `I \<noteq> {}` by (auto intro!: arg_cong[where f=prob] simp: Pi_iff distribution_def)
9.653 - also have "\<dots> = (\<Prod>i\<in>I. prob (X i -` F i \<inter> space M))"
9.654 - using `indep_vars M' X I` I F by (rule indep_varsD)
9.655 - also have "\<dots> = P.prob E"
9.656 - using F by (simp add: `E = Pi\<^isub>E I F` P.prob_times M'.\<mu>'_def distribution_def)
9.657 - finally show "D.prob E = P.prob E" .
9.658 + from E have "E \<in> sets ?P" by (auto simp: sets_PiM)
9.659 + then have "emeasure ?D E = emeasure M (?X -` E \<inter> space M)"
9.660 + by (simp add: emeasure_distr X)
9.661 + also have "?X -` E \<inter> space M = (\<Inter>i\<in>J. X i -` Y i \<inter> space M)"
9.662 + using J `I \<noteq> {}` measurable_space[OF rv] by (auto simp: prod_emb_def Pi_iff split: split_if_asm)
9.663 + also have "emeasure M (\<Inter>i\<in>J. X i -` Y i \<inter> space M) = (\<Prod> i\<in>J. emeasure M (X i -` Y i \<inter> space M))"
9.664 + using `indep_vars M' X I` J `I \<noteq> {}` using indep_varsD[of M' X I J]
9.665 + by (auto simp: emeasure_eq_measure setprod_ereal)
9.666 + also have "\<dots> = (\<Prod> i\<in>J. emeasure (?D' i) (Y i))"
9.667 + using rv J by (simp add: emeasure_distr)
9.668 + also have "\<dots> = emeasure ?P' E"
9.669 + using P.emeasure_PiM_emb[of J Y] J by (simp add: prod_emb_def)
9.670 + finally show "emeasure ?D E = emeasure ?P' E" .
9.671 qed
9.672 - ultimately show "distribution ?D A = P.prob A"
9.673 - by (simp add: D.\<mu>'_def)
9.674 next
9.675 - assume eq: "\<forall>A\<in>sets P.P. distribution ?D A = P.prob A"
9.676 - have [simp]: "\<And>i. sigma (M' i) = M' i"
9.677 - using rv by (intro sigma_algebra.sigma_eq) simp
9.678 - have "indep_vars (\<lambda>i. sigma (M' i)) X I"
9.679 - proof (subst indep_vars_finite[OF I])
9.680 - fix i assume [simp]: "i \<in> I"
9.681 - show "random_variable (sigma (M' i)) (X i)"
9.682 - using rv[of i] by simp
9.683 - show "Int_stable (M' i)" "space (M' i) \<in> sets (M' i)"
9.684 - using M'.Int[of _ i] M'.top by (auto simp: Int_stable_def)
9.685 + assume "?D = ?P'"
9.686 + show "indep_vars M' X I" unfolding indep_vars_def
9.687 + proof (intro conjI indep_setsI ballI rv)
9.688 + fix i show "sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)} \<subseteq> events"
9.689 + by (auto intro!: sigma_sets_subset measurable_sets rv)
9.690 next
9.691 - show "\<forall>A\<in>\<Pi> i\<in>I. sets (M' i). prob (\<Inter>j\<in>I. X j -` A j \<inter> space M) = (\<Prod>j\<in>I. prob (X j -` A j \<inter> space M))"
9.692 + fix J Y' assume J: "J \<noteq> {}" "J \<subseteq> I" "finite J"
9.693 + assume Y': "\<forall>j\<in>J. Y' j \<in> sigma_sets (space M) {X j -` A \<inter> space M |A. A \<in> sets (M' j)}"
9.694 + have "\<forall>j\<in>J. \<exists>Y. Y' j = X j -` Y \<inter> space M \<and> Y \<in> sets (M' j)"
9.695 proof
9.696 - fix A assume A: "A \<in> (\<Pi> i\<in>I. sets (M' i))"
9.697 - then have A_in_P: "(Pi\<^isub>E I A) \<in> sets P.P"
9.698 - by (auto intro!: product_algebraI)
9.699 - have "prob (\<Inter>j\<in>I. X j -` A j \<inter> space M) = distribution ?D (Pi\<^isub>E I A)"
9.700 - using `I \<noteq> {}`by (auto intro!: arg_cong[where f=prob] simp: Pi_iff distribution_def)
9.701 - also have "\<dots> = P.prob (Pi\<^isub>E I A)" using A_in_P eq by simp
9.702 - also have "\<dots> = (\<Prod>i\<in>I. M'.prob i (A i))"
9.703 - using A by (intro P.prob_times) auto
9.704 - also have "\<dots> = (\<Prod>i\<in>I. prob (X i -` A i \<inter> space M))"
9.705 - using A by (auto intro!: setprod_cong simp: M'.\<mu>'_def Pi_iff distribution_def)
9.706 - finally show "prob (\<Inter>j\<in>I. X j -` A j \<inter> space M) = (\<Prod>j\<in>I. prob (X j -` A j \<inter> space M))" .
9.707 + fix j assume "j \<in> J"
9.708 + from Y'[rule_format, OF this] rv[of j]
9.709 + show "\<exists>Y. Y' j = X j -` Y \<inter> space M \<and> Y \<in> sets (M' j)"
9.710 + by (subst (asm) sigma_sets_vimage_commute[symmetric, of _ _ "space (M' j)"])
9.711 + (auto dest: measurable_space simp: sigma_sets_eq)
9.712 qed
9.713 + from bchoice[OF this] obtain Y where
9.714 + Y: "\<And>j. j \<in> J \<Longrightarrow> Y' j = X j -` Y j \<inter> space M" "\<And>j. j \<in> J \<Longrightarrow> Y j \<in> sets (M' j)" by auto
9.715 + let ?E = "prod_emb I M' J (Pi\<^isub>E J Y)"
9.716 + from Y have "(\<Inter>j\<in>J. Y' j) = ?X -` ?E \<inter> space M"
9.717 + using J `I \<noteq> {}` measurable_space[OF rv] by (auto simp: prod_emb_def Pi_iff split: split_if_asm)
9.718 + then have "emeasure M (\<Inter>j\<in>J. Y' j) = emeasure M (?X -` ?E \<inter> space M)"
9.719 + by simp
9.720 + also have "\<dots> = emeasure ?D ?E"
9.721 + using Y J by (intro emeasure_distr[symmetric] X sets_PiM_I) auto
9.722 + also have "\<dots> = emeasure ?P' ?E"
9.723 + using `?D = ?P'` by simp
9.724 + also have "\<dots> = (\<Prod> i\<in>J. emeasure (?D' i) (Y i))"
9.725 + using P.emeasure_PiM_emb[of J Y] J Y by (simp add: prod_emb_def)
9.726 + also have "\<dots> = (\<Prod> i\<in>J. emeasure M (Y' i))"
9.727 + using rv J Y by (simp add: emeasure_distr)
9.728 + finally have "emeasure M (\<Inter>j\<in>J. Y' j) = (\<Prod> i\<in>J. emeasure M (Y' i))" .
9.729 + then show "prob (\<Inter>j\<in>J. Y' j) = (\<Prod> i\<in>J. prob (Y' i))"
9.730 + by (auto simp: emeasure_eq_measure setprod_ereal)
9.731 qed
9.732 - then show "indep_vars M' X I"
9.733 - by simp
9.734 qed
9.735 qed
9.736
9.737 @@ -936,56 +960,188 @@
9.738 unfolding UNIV_bool by auto
9.739 qed
9.740
9.741 -lemma (in prob_space) indep_var_distributionD:
9.742 - assumes indep: "indep_var S X T Y"
9.743 - defines "P \<equiv> S\<lparr>measure := ereal\<circ>distribution X\<rparr> \<Otimes>\<^isub>M T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
9.744 - assumes "A \<in> sets P"
9.745 - shows "joint_distribution X Y A = finite_measure.\<mu>' P A"
9.746 +lemma measurable_bool_case[simp, intro]:
9.747 + "(\<lambda>(x, y). bool_case x y) \<in> measurable (M \<Otimes>\<^isub>M N) (Pi\<^isub>M UNIV (bool_case M N))"
9.748 + (is "?f \<in> measurable ?B ?P")
9.749 +proof (rule measurable_PiM_single)
9.750 + show "?f \<in> space ?B \<rightarrow> (\<Pi>\<^isub>E i\<in>UNIV. space (bool_case M N i))"
9.751 + by (auto simp: space_pair_measure extensional_def split: bool.split)
9.752 + fix i A assume "A \<in> sets (case i of True \<Rightarrow> M | False \<Rightarrow> N)"
9.753 + moreover then have "{\<omega> \<in> space (M \<Otimes>\<^isub>M N). prod_case bool_case \<omega> i \<in> A}
9.754 + = (case i of True \<Rightarrow> A \<times> space N | False \<Rightarrow> space M \<times> A)"
9.755 + by (auto simp: space_pair_measure split: bool.split dest!: sets_into_space)
9.756 + ultimately show "{\<omega> \<in> space (M \<Otimes>\<^isub>M N). prod_case bool_case \<omega> i \<in> A} \<in> sets ?B"
9.757 + by (auto split: bool.split)
9.758 +qed
9.759 +
9.760 +lemma borel_measurable_indicator':
9.761 + "A \<in> sets N \<Longrightarrow> f \<in> measurable M N \<Longrightarrow> (\<lambda>x. indicator A (f x)) \<in> borel_measurable M"
9.762 + using measurable_comp[OF _ borel_measurable_indicator, of f M N A] by (auto simp add: comp_def)
9.763 +
9.764 +lemma (in product_sigma_finite) distr_component:
9.765 + "distr (M i) (Pi\<^isub>M {i} M) (\<lambda>x. \<lambda>i\<in>{i}. x) = Pi\<^isub>M {i} M" (is "?D = ?P")
9.766 +proof (intro measure_eqI[symmetric])
9.767 + interpret I: finite_product_sigma_finite M "{i}" by default simp
9.768 +
9.769 + have eq: "\<And>x. x \<in> extensional {i} \<Longrightarrow> (\<lambda>j\<in>{i}. x i) = x"
9.770 + by (auto simp: extensional_def restrict_def)
9.771 +
9.772 + fix A assume A: "A \<in> sets ?P"
9.773 + then have "emeasure ?P A = (\<integral>\<^isup>+x. indicator A x \<partial>?P)"
9.774 + by simp
9.775 + also have "\<dots> = (\<integral>\<^isup>+x. indicator ((\<lambda>x. \<lambda>i\<in>{i}. x) -` A \<inter> space (M i)) x \<partial>M i)"
9.776 + apply (subst product_positive_integral_singleton[symmetric])
9.777 + apply (force intro!: measurable_restrict measurable_sets A)
9.778 + apply (auto intro!: positive_integral_cong simp: space_PiM indicator_def simp: eq)
9.779 + done
9.780 + also have "\<dots> = emeasure (M i) ((\<lambda>x. \<lambda>i\<in>{i}. x) -` A \<inter> space (M i))"
9.781 + by (force intro!: measurable_restrict measurable_sets A positive_integral_indicator)
9.782 + also have "\<dots> = emeasure ?D A"
9.783 + using A by (auto intro!: emeasure_distr[symmetric] measurable_restrict)
9.784 + finally show "emeasure (Pi\<^isub>M {i} M) A = emeasure ?D A" .
9.785 +qed simp
9.786 +
9.787 +lemma pair_measure_eqI:
9.788 + assumes "sigma_finite_measure M1" "sigma_finite_measure M2"
9.789 + assumes sets: "sets (M1 \<Otimes>\<^isub>M M2) = sets M"
9.790 + assumes emeasure: "\<And>A B. A \<in> sets M1 \<Longrightarrow> B \<in> sets M2 \<Longrightarrow> emeasure M1 A * emeasure M2 B = emeasure M (A \<times> B)"
9.791 + shows "M1 \<Otimes>\<^isub>M M2 = M"
9.792 proof -
9.793 - from indep have rvs: "random_variable S X" "random_variable T Y"
9.794 + interpret M1: sigma_finite_measure M1 by fact
9.795 + interpret M2: sigma_finite_measure M2 by fact
9.796 + interpret pair_sigma_finite M1 M2 by default
9.797 + from sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('a \<times> 'b) set" .. note F = this
9.798 + let ?E = "{a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2}"
9.799 + let ?P = "M1 \<Otimes>\<^isub>M M2"
9.800 + show ?thesis
9.801 + proof (rule measure_eqI_generator_eq[OF Int_stable_pair_measure_generator[of M1 M2]])
9.802 + show "?E \<subseteq> Pow (space ?P)"
9.803 + using space_closed[of M1] space_closed[of M2] by (auto simp: space_pair_measure)
9.804 + show "sets ?P = sigma_sets (space ?P) ?E"
9.805 + by (simp add: sets_pair_measure space_pair_measure)
9.806 + then show "sets M = sigma_sets (space ?P) ?E"
9.807 + using sets[symmetric] by simp
9.808 + next
9.809 + show "range F \<subseteq> ?E" "incseq F" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?P (F i) \<noteq> \<infinity>"
9.810 + using F by (auto simp: space_pair_measure)
9.811 + next
9.812 + fix X assume "X \<in> ?E"
9.813 + then obtain A B where X[simp]: "X = A \<times> B" and A: "A \<in> sets M1" and B: "B \<in> sets M2" by auto
9.814 + then have "emeasure ?P X = emeasure M1 A * emeasure M2 B"
9.815 + by (simp add: emeasure_pair_measure_Times)
9.816 + also have "\<dots> = emeasure M (A \<times> B)"
9.817 + using A B emeasure by auto
9.818 + finally show "emeasure ?P X = emeasure M X"
9.819 + by simp
9.820 + qed
9.821 +qed
9.822 +
9.823 +lemma pair_measure_eq_distr_PiM:
9.824 + fixes M1 :: "'a measure" and M2 :: "'a measure"
9.825 + assumes "sigma_finite_measure M1" "sigma_finite_measure M2"
9.826 + shows "(M1 \<Otimes>\<^isub>M M2) = distr (Pi\<^isub>M UNIV (bool_case M1 M2)) (M1 \<Otimes>\<^isub>M M2) (\<lambda>x. (x True, x False))"
9.827 + (is "?P = ?D")
9.828 +proof (rule pair_measure_eqI[OF assms])
9.829 + interpret B: product_sigma_finite "bool_case M1 M2"
9.830 + unfolding product_sigma_finite_def using assms by (auto split: bool.split)
9.831 + let ?B = "Pi\<^isub>M UNIV (bool_case M1 M2)"
9.832 +
9.833 + have [simp]: "fst \<circ> (\<lambda>x. (x True, x False)) = (\<lambda>x. x True)" "snd \<circ> (\<lambda>x. (x True, x False)) = (\<lambda>x. x False)"
9.834 + by auto
9.835 + fix A B assume A: "A \<in> sets M1" and B: "B \<in> sets M2"
9.836 + have "emeasure M1 A * emeasure M2 B = (\<Prod> i\<in>UNIV. emeasure (bool_case M1 M2 i) (bool_case A B i))"
9.837 + by (simp add: UNIV_bool ac_simps)
9.838 + also have "\<dots> = emeasure ?B (Pi\<^isub>E UNIV (bool_case A B))"
9.839 + using A B by (subst B.emeasure_PiM) (auto split: bool.split)
9.840 + also have "Pi\<^isub>E UNIV (bool_case A B) = (\<lambda>x. (x True, x False)) -` (A \<times> B) \<inter> space ?B"
9.841 + using A[THEN sets_into_space] B[THEN sets_into_space]
9.842 + by (auto simp: Pi_iff all_bool_eq space_PiM split: bool.split)
9.843 + finally show "emeasure M1 A * emeasure M2 B = emeasure ?D (A \<times> B)"
9.844 + using A B
9.845 + measurable_component_singleton[of True UNIV "bool_case M1 M2"]
9.846 + measurable_component_singleton[of False UNIV "bool_case M1 M2"]
9.847 + by (subst emeasure_distr) (auto simp: measurable_pair_iff)
9.848 +qed simp
9.849 +
9.850 +lemma measurable_Pair:
9.851 + assumes rvs: "X \<in> measurable M S" "Y \<in> measurable M T"
9.852 + shows "(\<lambda>x. (X x, Y x)) \<in> measurable M (S \<Otimes>\<^isub>M T)"
9.853 +proof -
9.854 + have [simp]: "fst \<circ> (\<lambda>x. (X x, Y x)) = (\<lambda>x. X x)" "snd \<circ> (\<lambda>x. (X x, Y x)) = (\<lambda>x. Y x)"
9.855 + by auto
9.856 + show " (\<lambda>x. (X x, Y x)) \<in> measurable M (S \<Otimes>\<^isub>M T)"
9.857 + by (auto simp: measurable_pair_iff rvs)
9.858 +qed
9.859 +
9.860 +lemma (in prob_space) indep_var_distribution_eq:
9.861 + "indep_var S X T Y \<longleftrightarrow> random_variable S X \<and> random_variable T Y \<and>
9.862 + distr M S X \<Otimes>\<^isub>M distr M T Y = distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" (is "_ \<longleftrightarrow> _ \<and> _ \<and> ?S \<Otimes>\<^isub>M ?T = ?J")
9.863 +proof safe
9.864 + assume "indep_var S X T Y"
9.865 + then show rvs: "random_variable S X" "random_variable T Y"
9.866 by (blast dest: indep_var_rv1 indep_var_rv2)+
9.867 + then have XY: "random_variable (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
9.868 + by (rule measurable_Pair)
9.869
9.870 - let ?S = "S\<lparr>measure := ereal\<circ>distribution X\<rparr>"
9.871 - let ?T = "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
9.872 - interpret X: prob_space ?S by (rule distribution_prob_space) fact
9.873 - interpret Y: prob_space ?T by (rule distribution_prob_space) fact
9.874 - interpret XY: pair_prob_space ?S ?T by default
9.875 + interpret X: prob_space ?S by (rule prob_space_distr) fact
9.876 + interpret Y: prob_space ?T by (rule prob_space_distr) fact
9.877 + interpret XY: pair_prob_space ?S ?T ..
9.878 + show "?S \<Otimes>\<^isub>M ?T = ?J"
9.879 + proof (rule pair_measure_eqI)
9.880 + show "sigma_finite_measure ?S" ..
9.881 + show "sigma_finite_measure ?T" ..
9.882
9.883 - let ?J = "XY.P\<lparr> measure := ereal \<circ> joint_distribution X Y \<rparr>"
9.884 - interpret J: prob_space ?J
9.885 - by (rule joint_distribution_prob_space) (simp_all add: rvs)
9.886 + fix A B assume A: "A \<in> sets ?S" and B: "B \<in> sets ?T"
9.887 + have "emeasure ?J (A \<times> B) = emeasure M ((\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M)"
9.888 + using A B by (intro emeasure_distr[OF XY]) auto
9.889 + also have "\<dots> = emeasure M (X -` A \<inter> space M) * emeasure M (Y -` B \<inter> space M)"
9.890 + using indep_varD[OF `indep_var S X T Y`, of A B] A B by (simp add: emeasure_eq_measure)
9.891 + also have "\<dots> = emeasure ?S A * emeasure ?T B"
9.892 + using rvs A B by (simp add: emeasure_distr)
9.893 + finally show "emeasure ?S A * emeasure ?T B = emeasure ?J (A \<times> B)" by simp
9.894 + qed simp
9.895 +next
9.896 + assume rvs: "random_variable S X" "random_variable T Y"
9.897 + then have XY: "random_variable (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
9.898 + by (rule measurable_Pair)
9.899
9.900 - have "finite_measure.\<mu>' (XY.P\<lparr> measure := ereal \<circ> joint_distribution X Y \<rparr>) A = XY.\<mu>' A"
9.901 - proof (rule prob_space_unique_Int_stable)
9.902 - show "Int_stable (pair_measure_generator ?S ?T)" (is "Int_stable ?P")
9.903 - by fact
9.904 - show "space ?P \<in> sets ?P"
9.905 - unfolding space_pair_measure[simplified pair_measure_def space_sigma]
9.906 - using X.top Y.top by (auto intro!: pair_measure_generatorI)
9.907 + let ?S = "distr M S X" and ?T = "distr M T Y"
9.908 + interpret X: prob_space ?S by (rule prob_space_distr) fact
9.909 + interpret Y: prob_space ?T by (rule prob_space_distr) fact
9.910 + interpret XY: pair_prob_space ?S ?T ..
9.911
9.912 - show "prob_space ?J" by unfold_locales
9.913 - show "space ?J = space ?P"
9.914 - by (simp add: pair_measure_generator_def space_pair_measure)
9.915 - show "sets ?J = sets (sigma ?P)"
9.916 - by (simp add: pair_measure_def)
9.917 + assume "?S \<Otimes>\<^isub>M ?T = ?J"
9.918
9.919 - show "prob_space XY.P" by unfold_locales
9.920 - show "space XY.P = space ?P" "sets XY.P = sets (sigma ?P)"
9.921 - by (simp_all add: pair_measure_generator_def pair_measure_def)
9.922 + { fix S and X
9.923 + have "Int_stable {X -` A \<inter> space M |A. A \<in> sets S}"
9.924 + proof (safe intro!: Int_stableI)
9.925 + fix A B assume "A \<in> sets S" "B \<in> sets S"
9.926 + then show "\<exists>C. (X -` A \<inter> space M) \<inter> (X -` B \<inter> space M) = (X -` C \<inter> space M) \<and> C \<in> sets S"
9.927 + by (intro exI[of _ "A \<inter> B"]) auto
9.928 + qed }
9.929 + note Int_stable = this
9.930
9.931 - show "A \<in> sets (sigma ?P)"
9.932 - using `A \<in> sets P` unfolding P_def pair_measure_def by simp
9.933 -
9.934 - fix X assume "X \<in> sets ?P"
9.935 - then obtain A B where "A \<in> sets S" "B \<in> sets T" "X = A \<times> B"
9.936 - by (auto simp: sets_pair_measure_generator)
9.937 - then show "J.\<mu>' X = XY.\<mu>' X"
9.938 - unfolding J.\<mu>'_def XY.\<mu>'_def using indep
9.939 - by (simp add: XY.pair_measure_times)
9.940 - (simp add: distribution_def indep_varD)
9.941 + show "indep_var S X T Y" unfolding indep_var_eq
9.942 + proof (intro conjI indep_set_sigma_sets Int_stable rvs)
9.943 + show "indep_set {X -` A \<inter> space M |A. A \<in> sets S} {Y -` A \<inter> space M |A. A \<in> sets T}"
9.944 + proof (safe intro!: indep_setI)
9.945 + { fix A assume "A \<in> sets S" then show "X -` A \<inter> space M \<in> sets M"
9.946 + using `X \<in> measurable M S` by (auto intro: measurable_sets) }
9.947 + { fix A assume "A \<in> sets T" then show "Y -` A \<inter> space M \<in> sets M"
9.948 + using `Y \<in> measurable M T` by (auto intro: measurable_sets) }
9.949 + next
9.950 + fix A B assume ab: "A \<in> sets S" "B \<in> sets T"
9.951 + then have "ereal (prob ((X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M))) = emeasure ?J (A \<times> B)"
9.952 + using XY by (auto simp add: emeasure_distr emeasure_eq_measure intro!: arg_cong[where f="prob"])
9.953 + also have "\<dots> = emeasure (?S \<Otimes>\<^isub>M ?T) (A \<times> B)"
9.954 + unfolding `?S \<Otimes>\<^isub>M ?T = ?J` ..
9.955 + also have "\<dots> = emeasure ?S A * emeasure ?T B"
9.956 + using ab by (simp add: XY.emeasure_pair_measure_Times)
9.957 + finally show "prob ((X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M)) =
9.958 + prob (X -` A \<inter> space M) * prob (Y -` B \<inter> space M)"
9.959 + using rvs ab by (simp add: emeasure_eq_measure emeasure_distr)
9.960 + qed
9.961 qed
9.962 - then show ?thesis
9.963 - using `A \<in> sets P` unfolding P_def J.\<mu>'_def XY.\<mu>'_def by simp
9.964 qed
9.965
9.966 end
10.1 --- a/src/HOL/Probability/Infinite_Product_Measure.thy Mon Apr 23 12:23:23 2012 +0100
10.2 +++ b/src/HOL/Probability/Infinite_Product_Measure.thy Mon Apr 23 12:14:35 2012 +0200
10.3 @@ -5,9 +5,49 @@
10.4 header {*Infinite Product Measure*}
10.5
10.6 theory Infinite_Product_Measure
10.7 - imports Probability_Measure
10.8 + imports Probability_Measure Caratheodory
10.9 begin
10.10
10.11 +lemma sigma_sets_mono: assumes "A \<subseteq> sigma_sets X B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
10.12 +proof
10.13 + fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
10.14 + by induct (insert `A \<subseteq> sigma_sets X B`, auto intro: sigma_sets.intros)
10.15 +qed
10.16 +
10.17 +lemma sigma_sets_mono': assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
10.18 +proof
10.19 + fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
10.20 + by induct (insert `A \<subseteq> B`, auto intro: sigma_sets.intros)
10.21 +qed
10.22 +
10.23 +lemma sigma_sets_superset_generator: "A \<subseteq> sigma_sets X A"
10.24 + by (auto intro: sigma_sets.Basic)
10.25 +
10.26 +lemma (in product_sigma_finite)
10.27 + assumes IJ: "I \<inter> J = {}" "finite I" "finite J" and A: "A \<in> sets (Pi\<^isub>M (I \<union> J) M)"
10.28 + shows emeasure_fold_integral:
10.29 + "emeasure (Pi\<^isub>M (I \<union> J) M) A = (\<integral>\<^isup>+x. emeasure (Pi\<^isub>M J M) (merge I x J -` A \<inter> space (Pi\<^isub>M J M)) \<partial>Pi\<^isub>M I M)" (is ?I)
10.30 + and emeasure_fold_measurable:
10.31 + "(\<lambda>x. emeasure (Pi\<^isub>M J M) (merge I x J -` A \<inter> space (Pi\<^isub>M J M))) \<in> borel_measurable (Pi\<^isub>M I M)" (is ?B)
10.32 +proof -
10.33 + interpret I: finite_product_sigma_finite M I by default fact
10.34 + interpret J: finite_product_sigma_finite M J by default fact
10.35 + interpret IJ: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" ..
10.36 + have merge: "(\<lambda>(x, y). merge I x J y) -` A \<inter> space (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M) \<in> sets (Pi\<^isub>M I M \<Otimes>\<^isub>M Pi\<^isub>M J M)"
10.37 + by (intro measurable_sets[OF _ A] measurable_merge assms)
10.38 +
10.39 + show ?I
10.40 + apply (subst distr_merge[symmetric, OF IJ])
10.41 + apply (subst emeasure_distr[OF measurable_merge[OF IJ(1)] A])
10.42 + apply (subst IJ.emeasure_pair_measure_alt[OF merge])
10.43 + apply (auto intro!: positive_integral_cong arg_cong2[where f=emeasure] simp: space_pair_measure)
10.44 + done
10.45 +
10.46 + show ?B
10.47 + using IJ.measurable_emeasure_Pair1[OF merge]
10.48 + by (simp add: vimage_compose[symmetric] comp_def space_pair_measure cong: measurable_cong)
10.49 +qed
10.50 +
10.51 lemma restrict_extensional_sub[intro]: "A \<subseteq> B \<Longrightarrow> restrict f A \<in> extensional B"
10.52 unfolding restrict_def extensional_def by auto
10.53
10.54 @@ -41,189 +81,178 @@
10.55 qed
10.56 qed
10.57
10.58 -lemma (in product_prob_space) measure_preserving_restrict:
10.59 - assumes "J \<noteq> {}" "J \<subseteq> K" "finite K"
10.60 - shows "(\<lambda>f. restrict f J) \<in> measure_preserving (\<Pi>\<^isub>M i\<in>K. M i) (\<Pi>\<^isub>M i\<in>J. M i)" (is "?R \<in> _")
10.61 -proof -
10.62 - interpret K: finite_product_prob_space M K by default fact
10.63 - have J: "J \<noteq> {}" "finite J" using assms by (auto simp add: finite_subset)
10.64 - interpret J: finite_product_prob_space M J
10.65 - by default (insert J, auto)
10.66 - from J.sigma_finite_pairs guess F .. note F = this
10.67 - then have [simp,intro]: "\<And>k i. k \<in> J \<Longrightarrow> F k i \<in> sets (M k)"
10.68 - by auto
10.69 - let ?F = "\<lambda>i. \<Pi>\<^isub>E k\<in>J. F k i"
10.70 - let ?J = "product_algebra_generator J M \<lparr> measure := measure (Pi\<^isub>M J M) \<rparr>"
10.71 - have "?R \<in> measure_preserving (\<Pi>\<^isub>M i\<in>K. M i) (sigma ?J)"
10.72 - proof (rule K.measure_preserving_Int_stable)
10.73 - show "Int_stable ?J"
10.74 - by (auto simp: Int_stable_def product_algebra_generator_def PiE_Int)
10.75 - show "range ?F \<subseteq> sets ?J" "incseq ?F" "(\<Union>i. ?F i) = space ?J"
10.76 - using F by auto
10.77 - show "\<And>i. measure ?J (?F i) \<noteq> \<infinity>"
10.78 - using F by (simp add: J.measure_times setprod_PInf)
10.79 - have "measure_space (Pi\<^isub>M J M)" by default
10.80 - then show "measure_space (sigma ?J)"
10.81 - by (simp add: product_algebra_def sigma_def)
10.82 - show "?R \<in> measure_preserving (Pi\<^isub>M K M) ?J"
10.83 - proof (simp add: measure_preserving_def measurable_def product_algebra_generator_def del: vimage_Int,
10.84 - safe intro!: restrict_extensional)
10.85 - fix x k assume "k \<in> J" "x \<in> (\<Pi> i\<in>K. space (M i))"
10.86 - then show "x k \<in> space (M k)" using `J \<subseteq> K` by auto
10.87 - next
10.88 - fix E assume "E \<in> (\<Pi> i\<in>J. sets (M i))"
10.89 - then have E: "\<And>j. j \<in> J \<Longrightarrow> E j \<in> sets (M j)" by auto
10.90 - then have *: "?R -` Pi\<^isub>E J E \<inter> (\<Pi>\<^isub>E i\<in>K. space (M i)) = (\<Pi>\<^isub>E i\<in>K. if i \<in> J then E i else space (M i))"
10.91 - (is "?X = Pi\<^isub>E K ?M")
10.92 - using `J \<subseteq> K` sets_into_space by (auto simp: Pi_iff split: split_if_asm) blast+
10.93 - with E show "?X \<in> sets (Pi\<^isub>M K M)"
10.94 - by (auto intro!: product_algebra_generatorI)
10.95 - have "measure (Pi\<^isub>M J M) (Pi\<^isub>E J E) = (\<Prod>i\<in>J. measure (M i) (?M i))"
10.96 - using E by (simp add: J.measure_times)
10.97 - also have "\<dots> = measure (Pi\<^isub>M K M) ?X"
10.98 - unfolding * using E `finite K` `J \<subseteq> K`
10.99 - by (auto simp: K.measure_times M.measure_space_1
10.100 - cong del: setprod_cong
10.101 - intro!: setprod_mono_one_left)
10.102 - finally show "measure (Pi\<^isub>M J M) (Pi\<^isub>E J E) = measure (Pi\<^isub>M K M) ?X" .
10.103 - qed
10.104 - qed
10.105 - then show ?thesis
10.106 - by (simp add: product_algebra_def sigma_def)
10.107 +lemma prod_algebraI_finite:
10.108 + "finite I \<Longrightarrow> (\<forall>i\<in>I. E i \<in> sets (M i)) \<Longrightarrow> (Pi\<^isub>E I E) \<in> prod_algebra I M"
10.109 + using prod_algebraI[of I I E M] prod_emb_PiE_same_index[of I E M, OF sets_into_space] by simp
10.110 +
10.111 +lemma Int_stable_PiE: "Int_stable {Pi\<^isub>E J E | E. \<forall>i\<in>I. E i \<in> sets (M i)}"
10.112 +proof (safe intro!: Int_stableI)
10.113 + fix E F assume "\<forall>i\<in>I. E i \<in> sets (M i)" "\<forall>i\<in>I. F i \<in> sets (M i)"
10.114 + then show "\<exists>G. Pi\<^isub>E J E \<inter> Pi\<^isub>E J F = Pi\<^isub>E J G \<and> (\<forall>i\<in>I. G i \<in> sets (M i))"
10.115 + by (auto intro!: exI[of _ "\<lambda>i. E i \<inter> F i"])
10.116 qed
10.117
10.118 -lemma (in product_prob_space) measurable_restrict:
10.119 - assumes *: "J \<noteq> {}" "J \<subseteq> K" "finite K"
10.120 - shows "(\<lambda>f. restrict f J) \<in> measurable (\<Pi>\<^isub>M i\<in>K. M i) (\<Pi>\<^isub>M i\<in>J. M i)"
10.121 - using measure_preserving_restrict[OF *]
10.122 - by (rule measure_preservingD2)
10.123 +lemma prod_emb_trans[simp]:
10.124 + "J \<subseteq> K \<Longrightarrow> K \<subseteq> L \<Longrightarrow> prod_emb L M K (prod_emb K M J X) = prod_emb L M J X"
10.125 + by (auto simp add: Int_absorb1 prod_emb_def)
10.126
10.127 -definition (in product_prob_space)
10.128 - "emb J K X = (\<lambda>x. restrict x K) -` X \<inter> space (Pi\<^isub>M J M)"
10.129 +lemma prod_emb_Pi:
10.130 + assumes "X \<in> (\<Pi> j\<in>J. sets (M j))" "J \<subseteq> K"
10.131 + shows "prod_emb K M J (Pi\<^isub>E J X) = (\<Pi>\<^isub>E i\<in>K. if i \<in> J then X i else space (M i))"
10.132 + using assms space_closed
10.133 + by (auto simp: prod_emb_def Pi_iff split: split_if_asm) blast+
10.134
10.135 -lemma (in product_prob_space) emb_trans[simp]:
10.136 - "J \<subseteq> K \<Longrightarrow> K \<subseteq> L \<Longrightarrow> emb L K (emb K J X) = emb L J X"
10.137 - by (auto simp add: Int_absorb1 emb_def)
10.138 +lemma prod_emb_id:
10.139 + "B \<subseteq> (\<Pi>\<^isub>E i\<in>L. space (M i)) \<Longrightarrow> prod_emb L M L B = B"
10.140 + by (auto simp: prod_emb_def Pi_iff subset_eq extensional_restrict)
10.141
10.142 -lemma (in product_prob_space) emb_empty[simp]:
10.143 - "emb K J {} = {}"
10.144 - by (simp add: emb_def)
10.145 +lemma measurable_prod_emb[intro, simp]:
10.146 + "J \<subseteq> L \<Longrightarrow> X \<in> sets (Pi\<^isub>M J M) \<Longrightarrow> prod_emb L M J X \<in> sets (Pi\<^isub>M L M)"
10.147 + unfolding prod_emb_def space_PiM[symmetric]
10.148 + by (auto intro!: measurable_sets measurable_restrict measurable_component_singleton)
10.149
10.150 -lemma (in product_prob_space) emb_Pi:
10.151 - assumes "X \<in> (\<Pi> j\<in>J. sets (M j))" "J \<subseteq> K"
10.152 - shows "emb K J (Pi\<^isub>E J X) = (\<Pi>\<^isub>E i\<in>K. if i \<in> J then X i else space (M i))"
10.153 - using assms space_closed
10.154 - by (auto simp: emb_def Pi_iff split: split_if_asm) blast+
10.155 +lemma measurable_restrict_subset: "J \<subseteq> L \<Longrightarrow> (\<lambda>f. restrict f J) \<in> measurable (Pi\<^isub>M L M) (Pi\<^isub>M J M)"
10.156 + by (intro measurable_restrict measurable_component_singleton) auto
10.157
10.158 -lemma (in product_prob_space) emb_injective:
10.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)"
10.160 - assumes "emb L J X = emb L J Y"
10.161 - shows "X = Y"
10.162 -proof -
10.163 - interpret J: finite_product_sigma_finite M J by default fact
10.164 - show "X = Y"
10.165 - proof (rule injective_vimage_restrict)
10.166 - show "X \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))" "Y \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
10.167 - using J.sets_into_space sets by auto
10.168 - have "\<forall>i\<in>L. \<exists>x. x \<in> space (M i)"
10.169 - using M.not_empty by auto
10.170 - from bchoice[OF this]
10.171 - show "(\<Pi>\<^isub>E i\<in>L. space (M i)) \<noteq> {}" by auto
10.172 - 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))"
10.173 - using `emb L J X = emb L J Y` by (simp add: emb_def)
10.174 - qed fact
10.175 +lemma (in product_prob_space) distr_restrict:
10.176 + assumes "J \<noteq> {}" "J \<subseteq> K" "finite K"
10.177 + 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")
10.178 +proof (rule measure_eqI_generator_eq)
10.179 + have "finite J" using `J \<subseteq> K` `finite K` by (auto simp add: finite_subset)
10.180 + interpret J: finite_product_prob_space M J proof qed fact
10.181 + interpret K: finite_product_prob_space M K proof qed fact
10.182 +
10.183 + let ?J = "{Pi\<^isub>E J E | E. \<forall>i\<in>J. E i \<in> sets (M i)}"
10.184 + let ?F = "\<lambda>i. \<Pi>\<^isub>E k\<in>J. space (M k)"
10.185 + let ?\<Omega> = "(\<Pi>\<^isub>E k\<in>J. space (M k))"
10.186 + show "Int_stable ?J"
10.187 + by (rule Int_stable_PiE)
10.188 + show "range ?F \<subseteq> ?J" "incseq ?F" "(\<Union>i. ?F i) = ?\<Omega>"
10.189 + using `finite J` by (auto intro!: prod_algebraI_finite)
10.190 + { fix i show "emeasure ?P (?F i) \<noteq> \<infinity>" by simp }
10.191 + show "?J \<subseteq> Pow ?\<Omega>" by (auto simp: Pi_iff dest: sets_into_space)
10.192 + show "sets (\<Pi>\<^isub>M i\<in>J. M i) = sigma_sets ?\<Omega> ?J" "sets ?D = sigma_sets ?\<Omega> ?J"
10.193 + using `finite J` by (simp_all add: sets_PiM prod_algebra_eq_finite Pi_iff)
10.194 +
10.195 + fix X assume "X \<in> ?J"
10.196 + 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
10.197 + with `finite J` have X: "X \<in> sets (Pi\<^isub>M J M)" by auto
10.198 +
10.199 + have "emeasure ?P X = (\<Prod> i\<in>J. emeasure (M i) (E i))"
10.200 + using E by (simp add: J.measure_times)
10.201 + also have "\<dots> = (\<Prod> i\<in>J. emeasure (M i) (if i \<in> J then E i else space (M i)))"
10.202 + by simp
10.203 + also have "\<dots> = (\<Prod> i\<in>K. emeasure (M i) (if i \<in> J then E i else space (M i)))"
10.204 + using `finite K` `J \<subseteq> K`
10.205 + by (intro setprod_mono_one_left) (auto simp: M.emeasure_space_1)
10.206 + 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))"
10.207 + using E by (simp add: K.measure_times)
10.208 + 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))"
10.209 + using `J \<subseteq> K` sets_into_space E by (force simp: Pi_iff split: split_if_asm)
10.210 + finally show "emeasure (Pi\<^isub>M J M) X = emeasure ?D X"
10.211 + using X `J \<subseteq> K` apply (subst emeasure_distr)
10.212 + by (auto intro!: measurable_restrict_subset simp: space_PiM)
10.213 qed
10.214
10.215 -lemma (in product_prob_space) emb_id:
10.216 - "B \<subseteq> (\<Pi>\<^isub>E i\<in>L. space (M i)) \<Longrightarrow> emb L L B = B"
10.217 - by (auto simp: emb_def Pi_iff subset_eq extensional_restrict)
10.218 +abbreviation (in product_prob_space)
10.219 + "emb L K X \<equiv> prod_emb L M K X"
10.220
10.221 -lemma (in product_prob_space) emb_simps:
10.222 - shows "emb L K (A \<union> B) = emb L K A \<union> emb L K B"
10.223 - and "emb L K (A \<inter> B) = emb L K A \<inter> emb L K B"
10.224 - and "emb L K (A - B) = emb L K A - emb L K B"
10.225 - by (auto simp: emb_def)
10.226 +lemma (in product_prob_space) emeasure_prod_emb[simp]:
10.227 + assumes L: "J \<noteq> {}" "J \<subseteq> L" "finite L" and X: "X \<in> sets (Pi\<^isub>M J M)"
10.228 + shows "emeasure (Pi\<^isub>M L M) (emb L J X) = emeasure (Pi\<^isub>M J M) X"
10.229 + by (subst distr_restrict[OF L])
10.230 + (simp add: prod_emb_def space_PiM emeasure_distr measurable_restrict_subset L X)
10.231
10.232 -lemma (in product_prob_space) measurable_emb[intro,simp]:
10.233 - assumes *: "J \<noteq> {}" "J \<subseteq> L" "finite L" "X \<in> sets (Pi\<^isub>M J M)"
10.234 - shows "emb L J X \<in> sets (Pi\<^isub>M L M)"
10.235 - using measurable_restrict[THEN measurable_sets, OF *] by (simp add: emb_def)
10.236 +lemma (in product_prob_space) prod_emb_injective:
10.237 + 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)"
10.238 + assumes "prod_emb L M J X = prod_emb L M J Y"
10.239 + shows "X = Y"
10.240 +proof (rule injective_vimage_restrict)
10.241 + show "X \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))" "Y \<subseteq> (\<Pi>\<^isub>E i\<in>J. space (M i))"
10.242 + using sets[THEN sets_into_space] by (auto simp: space_PiM)
10.243 + have "\<forall>i\<in>L. \<exists>x. x \<in> space (M i)"
10.244 + using M.not_empty by auto
10.245 + from bchoice[OF this]
10.246 + show "(\<Pi>\<^isub>E i\<in>L. space (M i)) \<noteq> {}" by auto
10.247 + 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))"
10.248 + using `prod_emb L M J X = prod_emb L M J Y` by (simp add: prod_emb_def)
10.249 +qed fact
10.250
10.251 -lemma (in product_prob_space) measure_emb[intro,simp]:
10.252 - assumes *: "J \<noteq> {}" "J \<subseteq> L" "finite L" "X \<in> sets (Pi\<^isub>M J M)"
10.253 - shows "measure (Pi\<^isub>M L M) (emb L J X) = measure (Pi\<^isub>M J M) X"
10.254 - using measure_preserving_restrict[THEN measure_preservingD, OF *]
10.255 - by (simp add: emb_def)
10.256 +definition (in product_prob_space) generator :: "('i \<Rightarrow> 'a) set set" where
10.257 + "generator = (\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` sets (Pi\<^isub>M J M))"
10.258
10.259 -definition (in product_prob_space) generator :: "('i \<Rightarrow> 'a) measure_space" where
10.260 - "generator = \<lparr>
10.261 - space = (\<Pi>\<^isub>E i\<in>I. space (M i)),
10.262 - sets = (\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` sets (Pi\<^isub>M J M)),
10.263 - measure = undefined
10.264 - \<rparr>"
10.265 +lemma (in product_prob_space) generatorI':
10.266 + "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"
10.267 + unfolding generator_def by auto
10.268 +
10.269 +lemma (in product_prob_space) algebra_generator:
10.270 + assumes "I \<noteq> {}" shows "algebra (\<Pi>\<^isub>E i\<in>I. space (M i)) generator" (is "algebra ?\<Omega> ?G")
10.271 +proof
10.272 + let ?G = generator
10.273 + show "?G \<subseteq> Pow ?\<Omega>"
10.274 + by (auto simp: generator_def prod_emb_def)
10.275 + from `I \<noteq> {}` obtain i where "i \<in> I" by auto
10.276 + then show "{} \<in> ?G"
10.277 + by (auto intro!: exI[of _ "{i}"] image_eqI[where x="\<lambda>i. {}"]
10.278 + simp: sigma_sets.Empty generator_def prod_emb_def)
10.279 + from `i \<in> I` show "?\<Omega> \<in> ?G"
10.280 + by (auto intro!: exI[of _ "{i}"] image_eqI[where x="Pi\<^isub>E {i} (\<lambda>i. space (M i))"]
10.281 + simp: generator_def prod_emb_def)
10.282 + fix A assume "A \<in> ?G"
10.283 + 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"
10.284 + by (auto simp: generator_def)
10.285 + fix B assume "B \<in> ?G"
10.286 + 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"
10.287 + by (auto simp: generator_def)
10.288 + let ?RA = "emb (JA \<union> JB) JA XA"
10.289 + let ?RB = "emb (JA \<union> JB) JB XB"
10.290 + have *: "A - B = emb I (JA \<union> JB) (?RA - ?RB)" "A \<union> B = emb I (JA \<union> JB) (?RA \<union> ?RB)"
10.291 + using XA A XB B by auto
10.292 + show "A - B \<in> ?G" "A \<union> B \<in> ?G"
10.293 + unfolding * using XA XB by (safe intro!: generatorI') auto
10.294 +qed
10.295 +
10.296 +lemma (in product_prob_space) sets_PiM_generator:
10.297 + assumes "I \<noteq> {}" shows "sets (PiM I M) = sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) generator"
10.298 +proof
10.299 + show "sets (Pi\<^isub>M I M) \<subseteq> sigma_sets (\<Pi>\<^isub>E i\<in>I. space (M i)) generator"
10.300 + unfolding sets_PiM
10.301 + proof (safe intro!: sigma_sets_subseteq)
10.302 + fix A assume "A \<in> prod_algebra I M" with `I \<noteq> {}` show "A \<in> generator"
10.303 + by (auto intro!: generatorI' elim!: prod_algebraE)
10.304 + qed
10.305 +qed (auto simp: generator_def space_PiM[symmetric] intro!: sigma_sets_subset)
10.306
10.307 lemma (in product_prob_space) generatorI:
10.308 - "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> sets generator"
10.309 + "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"
10.310 unfolding generator_def by auto
10.311
10.312 -lemma (in product_prob_space) generatorI':
10.313 - "J \<noteq> {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> X \<in> sets (Pi\<^isub>M J M) \<Longrightarrow> emb I J X \<in> sets generator"
10.314 - unfolding generator_def by auto
10.315 -
10.316 -lemma (in product_sigma_finite)
10.317 - assumes "I \<inter> J = {}" "finite I" "finite J" and A: "A \<in> sets (Pi\<^isub>M (I \<union> J) M)"
10.318 - shows measure_fold_integral:
10.319 - "measure (Pi\<^isub>M (I \<union> J) M) A = (\<integral>\<^isup>+x. measure (Pi\<^isub>M J M) (merge I x J -` A \<inter> space (Pi\<^isub>M J M)) \<partial>Pi\<^isub>M I M)" (is ?I)
10.320 - and measure_fold_measurable:
10.321 - "(\<lambda>x. measure (Pi\<^isub>M J M) (merge I x J -` A \<inter> space (Pi\<^isub>M J M))) \<in> borel_measurable (Pi\<^isub>M I M)" (is ?B)
10.322 -proof -
10.323 - interpret I: finite_product_sigma_finite M I by default fact
10.324 - interpret J: finite_product_sigma_finite M J by default fact
10.325 - interpret IJ: pair_sigma_finite I.P J.P ..
10.326 - show ?I
10.327 - unfolding measure_fold[OF assms]
10.328 - apply (subst IJ.pair_measure_alt)
10.329 - apply (intro measurable_sets[OF _ A] measurable_merge assms)
10.330 - apply (auto simp: vimage_compose[symmetric] comp_def space_pair_measure
10.331 - intro!: I.positive_integral_cong)
10.332 - done
10.333 -
10.334 - have "(\<lambda>(x, y). merge I x J y) -` A \<inter> space (I.P \<Otimes>\<^isub>M J.P) \<in> sets (I.P \<Otimes>\<^isub>M J.P)"
10.335 - by (intro measurable_sets[OF _ A] measurable_merge assms)
10.336 - from IJ.measure_cut_measurable_fst[OF this]
10.337 - show ?B
10.338 - apply (auto simp: vimage_compose[symmetric] comp_def space_pair_measure)
10.339 - apply (subst (asm) measurable_cong)
10.340 - apply auto
10.341 - done
10.342 -qed
10.343 -
10.344 definition (in product_prob_space)
10.345 "\<mu>G A =
10.346 - (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 = measure (Pi\<^isub>M J M) X))"
10.347 + (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 (Pi\<^isub>M J M) X))"
10.348
10.349 lemma (in product_prob_space) \<mu>G_spec:
10.350 assumes J: "J \<noteq> {}" "finite J" "J \<subseteq> I" "A = emb I J X" "X \<in> sets (Pi\<^isub>M J M)"
10.351 - shows "\<mu>G A = measure (Pi\<^isub>M J M) X"
10.352 + shows "\<mu>G A = emeasure (Pi\<^isub>M J M) X"
10.353 unfolding \<mu>G_def
10.354 proof (intro the_equality allI impI ballI)
10.355 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)"
10.356 - have "measure (Pi\<^isub>M K M) Y = measure (Pi\<^isub>M (K \<union> J) M) (emb (K \<union> J) K Y)"
10.357 + have "emeasure (Pi\<^isub>M K M) Y = emeasure (Pi\<^isub>M (K \<union> J) M) (emb (K \<union> J) K Y)"
10.358 using K J by simp
10.359 also have "emb (K \<union> J) K Y = emb (K \<union> J) J X"
10.360 - using K J by (simp add: emb_injective[of "K \<union> J" I])
10.361 - also have "measure (Pi\<^isub>M (K \<union> J) M) (emb (K \<union> J) J X) = measure (Pi\<^isub>M J M) X"
10.362 + using K J by (simp add: prod_emb_injective[of "K \<union> J" I])
10.363 + also have "emeasure (Pi\<^isub>M (K \<union> J) M) (emb (K \<union> J) J X) = emeasure (Pi\<^isub>M J M) X"
10.364 using K J by simp
10.365 - finally show "measure (Pi\<^isub>M J M) X = measure (Pi\<^isub>M K M) Y" ..
10.366 + finally show "emeasure (Pi\<^isub>M J M) X = emeasure (Pi\<^isub>M K M) Y" ..
10.367 qed (insert J, force)
10.368
10.369 lemma (in product_prob_space) \<mu>G_eq:
10.370 - "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) = measure (Pi\<^isub>M J M) X"
10.371 + "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 (Pi\<^isub>M J M) X"
10.372 by (intro \<mu>G_spec) auto
10.373
10.374 lemma (in product_prob_space) generator_Ex:
10.375 - assumes *: "A \<in> sets generator"
10.376 - 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 = measure (Pi\<^isub>M J M) X"
10.377 + assumes *: "A \<in> generator"
10.378 + 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 (Pi\<^isub>M J M) X"
10.379 proof -
10.380 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)"
10.381 unfolding generator_def by auto
10.382 @@ -231,11 +260,11 @@
10.383 qed
10.384
10.385 lemma (in product_prob_space) generatorE:
10.386 - assumes A: "A \<in> sets generator"
10.387 - 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 = measure (Pi\<^isub>M J M) X"
10.388 + assumes A: "A \<in> generator"
10.389 + 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 (Pi\<^isub>M J M) X"
10.390 proof -
10.391 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"
10.392 - "\<mu>G A = measure (Pi\<^isub>M J M) X" by auto
10.393 + "\<mu>G A = emeasure (Pi\<^isub>M J M) X" by auto
10.394 then show thesis by (intro that) auto
10.395 qed
10.396
10.397 @@ -243,11 +272,7 @@
10.398 assumes "finite J" "finite K" "J \<inter> K = {}" and A: "A \<in> sets (Pi\<^isub>M (J \<union> K) M)" and x: "x \<in> space (Pi\<^isub>M J M)"
10.399 shows "merge J x K -` A \<inter> space (Pi\<^isub>M K M) \<in> sets (Pi\<^isub>M K M)"
10.400 proof -
10.401 - interpret J: finite_product_sigma_algebra M J by default fact
10.402 - interpret K: finite_product_sigma_algebra M K by default fact
10.403 - interpret JK: pair_sigma_algebra J.P K.P ..
10.404 -
10.405 - from JK.measurable_cut_fst[OF
10.406 + from sets_Pair1[OF
10.407 measurable_merge[THEN measurable_sets, OF `J \<inter> K = {}`], OF A, of x] x
10.408 show ?thesis
10.409 by (simp add: space_pair_measure comp_def vimage_compose[symmetric])
10.410 @@ -266,75 +291,27 @@
10.411 have [simp]: "(K - J) \<inter> (K \<union> J) = K - J" by auto
10.412 have [simp]: "(K - J) \<inter> K = K - J" by auto
10.413 from y `K \<subseteq> I` `J \<subseteq> I` show ?thesis
10.414 - by (simp split: split_merge add: emb_def Pi_iff extensional_merge_sub set_eq_iff) auto
10.415 -qed
10.416 -
10.417 -definition (in product_prob_space) infprod_algebra :: "('i \<Rightarrow> 'a) measure_space" where
10.418 - "infprod_algebra = sigma generator \<lparr> measure :=
10.419 - (SOME \<mu>. (\<forall>s\<in>sets generator. \<mu> s = \<mu>G s) \<and>
10.420 - prob_space \<lparr>space = space generator, sets = sets (sigma generator), measure = \<mu>\<rparr>)\<rparr>"
10.421 -
10.422 -syntax
10.423 - "_PiP" :: "[pttrn, 'i set, ('b, 'd) measure_space_scheme] => ('i => 'b, 'd) measure_space_scheme" ("(3PIP _:_./ _)" 10)
10.424 -
10.425 -syntax (xsymbols)
10.426 - "_PiP" :: "[pttrn, 'i set, ('b, 'd) measure_space_scheme] => ('i => 'b, 'd) measure_space_scheme" ("(3\<Pi>\<^isub>P _\<in>_./ _)" 10)
10.427 -
10.428 -syntax (HTML output)
10.429 - "_PiP" :: "[pttrn, 'i set, ('b, 'd) measure_space_scheme] => ('i => 'b, 'd) measure_space_scheme" ("(3\<Pi>\<^isub>P _\<in>_./ _)" 10)
10.430 -
10.431 -abbreviation
10.432 - "Pi\<^isub>P I M \<equiv> product_prob_space.infprod_algebra M I"
10.433 -
10.434 -translations
10.435 - "PIP x:I. M" == "CONST Pi\<^isub>P I (%x. M)"
10.436 -
10.437 -lemma (in product_prob_space) algebra_generator:
10.438 - assumes "I \<noteq> {}" shows "algebra generator"
10.439 -proof
10.440 - let ?G = generator
10.441 - show "sets ?G \<subseteq> Pow (space ?G)"
10.442 - by (auto simp: generator_def emb_def)
10.443 - from `I \<noteq> {}` obtain i where "i \<in> I" by auto
10.444 - then show "{} \<in> sets ?G"
10.445 - by (auto intro!: exI[of _ "{i}"] image_eqI[where x="\<lambda>i. {}"]
10.446 - simp: product_algebra_def sigma_def sigma_sets.Empty generator_def emb_def)
10.447 - from `i \<in> I` show "space ?G \<in> sets ?G"
10.448 - by (auto intro!: exI[of _ "{i}"] image_eqI[where x="Pi\<^isub>E {i} (\<lambda>i. space (M i))"]
10.449 - simp: generator_def emb_def)
10.450 - fix A assume "A \<in> sets ?G"
10.451 - 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"
10.452 - by (auto simp: generator_def)
10.453 - fix B assume "B \<in> sets ?G"
10.454 - 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"
10.455 - by (auto simp: generator_def)
10.456 - let ?RA = "emb (JA \<union> JB) JA XA"
10.457 - let ?RB = "emb (JA \<union> JB) JB XB"
10.458 - interpret JAB: finite_product_sigma_algebra M "JA \<union> JB"
10.459 - by default (insert XA XB, auto)
10.460 - have *: "A - B = emb I (JA \<union> JB) (?RA - ?RB)" "A \<union> B = emb I (JA \<union> JB) (?RA \<union> ?RB)"
10.461 - using XA A XB B by (auto simp: emb_simps)
10.462 - then show "A - B \<in> sets ?G" "A \<union> B \<in> sets ?G"
10.463 - using XA XB by (auto intro!: generatorI')
10.464 + by (simp split: split_merge add: prod_emb_def Pi_iff extensional_merge_sub set_eq_iff space_PiM)
10.465 + auto
10.466 qed
10.467
10.468 lemma (in product_prob_space) positive_\<mu>G:
10.469 assumes "I \<noteq> {}"
10.470 shows "positive generator \<mu>G"
10.471 proof -
10.472 - interpret G!: algebra generator by (rule algebra_generator) fact
10.473 + interpret G!: algebra "\<Pi>\<^isub>E i\<in>I. space (M i)" generator by (rule algebra_generator) fact
10.474 show ?thesis
10.475 proof (intro positive_def[THEN iffD2] conjI ballI)
10.476 from generatorE[OF G.empty_sets] guess J X . note this[simp]
10.477 interpret J: finite_product_sigma_finite M J by default fact
10.478 have "X = {}"
10.479 - by (rule emb_injective[of J I]) simp_all
10.480 + by (rule prod_emb_injective[of J I]) simp_all
10.481 then show "\<mu>G {} = 0" by simp
10.482 next
10.483 - fix A assume "A \<in> sets generator"
10.484 + fix A assume "A \<in> generator"
10.485 from generatorE[OF this] guess J X . note this[simp]
10.486 interpret J: finite_product_sigma_finite M J by default fact
10.487 - show "0 \<le> \<mu>G A" by simp
10.488 + show "0 \<le> \<mu>G A" by (simp add: emeasure_nonneg)
10.489 qed
10.490 qed
10.491
10.492 @@ -342,102 +319,47 @@
10.493 assumes "I \<noteq> {}"
10.494 shows "additive generator \<mu>G"
10.495 proof -
10.496 - interpret G!: algebra generator by (rule algebra_generator) fact
10.497 + interpret G!: algebra "\<Pi>\<^isub>E i\<in>I. space (M i)" generator by (rule algebra_generator) fact
10.498 show ?thesis
10.499 proof (intro additive_def[THEN iffD2] ballI impI)
10.500 - fix A assume "A \<in> sets generator" with generatorE guess J X . note J = this
10.501 - fix B assume "B \<in> sets generator" with generatorE guess K Y . note K = this
10.502 + fix A assume "A \<in> generator" with generatorE guess J X . note J = this
10.503 + fix B assume "B \<in> generator" with generatorE guess K Y . note K = this
10.504 assume "A \<inter> B = {}"
10.505 have JK: "J \<union> K \<noteq> {}" "J \<union> K \<subseteq> I" "finite (J \<union> K)"
10.506 using J K by auto
10.507 interpret JK: finite_product_sigma_finite M "J \<union> K" by default fact
10.508 have JK_disj: "emb (J \<union> K) J X \<inter> emb (J \<union> K) K Y = {}"
10.509 - apply (rule emb_injective[of "J \<union> K" I])
10.510 + apply (rule prod_emb_injective[of "J \<union> K" I])
10.511 apply (insert `A \<inter> B = {}` JK J K)
10.512 - apply (simp_all add: JK.Int emb_simps)
10.513 + apply (simp_all add: Int prod_emb_Int)
10.514 done
10.515 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)"
10.516 using J K by simp_all
10.517 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))"
10.518 - by (simp add: emb_simps)
10.519 - also have "\<dots> = measure (Pi\<^isub>M (J \<union> K) M) (emb (J \<union> K) J X \<union> emb (J \<union> K) K Y)"
10.520 - using JK J(1, 4) K(1, 4) by (simp add: \<mu>G_eq JK.Un)
10.521 + by simp
10.522 + also have "\<dots> = emeasure (Pi\<^isub>M (J \<union> K) M) (emb (J \<union> K) J X \<union> emb (J \<union> K) K Y)"
10.523 + using JK J(1, 4) K(1, 4) by (simp add: \<mu>G_eq Un del: prod_emb_Un)
10.524 also have "\<dots> = \<mu>G A + \<mu>G B"
10.525 - using J K JK_disj by (simp add: JK.measure_additive[symmetric])
10.526 + using J K JK_disj by (simp add: plus_emeasure[symmetric])
10.527 finally show "\<mu>G (A \<union> B) = \<mu>G A + \<mu>G B" .
10.528 qed
10.529 qed
10.530
10.531 -lemma (in product_prob_space) finite_index_eq_finite_product:
10.532 - assumes "finite I"
10.533 - shows "sets (sigma generator) = sets (Pi\<^isub>M I M)"
10.534 -proof safe
10.535 - interpret I: finite_product_sigma_algebra M I by default fact
10.536 - have space_generator[simp]: "space generator = space (Pi\<^isub>M I M)"
10.537 - by (simp add: generator_def product_algebra_def)
10.538 - { fix A assume "A \<in> sets (sigma generator)"
10.539 - then show "A \<in> sets I.P" unfolding sets_sigma
10.540 - proof induct
10.541 - case (Basic A)
10.542 - from generatorE[OF this] guess J X . note J = this
10.543 - with `finite I` have "emb I J X \<in> sets I.P" by auto
10.544 - with `emb I J X = A` show "A \<in> sets I.P" by simp
10.545 - qed auto }
10.546 - { fix A assume A: "A \<in> sets I.P"
10.547 - show "A \<in> sets (sigma generator)"
10.548 - proof cases
10.549 - assume "I = {}"
10.550 - with I.P_empty[OF this] A
10.551 - have "A = space generator \<or> A = {}"
10.552 - unfolding space_generator by auto
10.553 - then show ?thesis
10.554 - by (auto simp: sets_sigma simp del: space_generator
10.555 - intro: sigma_sets.Empty sigma_sets_top)
10.556 - next
10.557 - assume "I \<noteq> {}"
10.558 - note A this
10.559 - moreover with I.sets_into_space have "emb I I A = A" by (intro emb_id) auto
10.560 - ultimately show "A \<in> sets (sigma generator)"
10.561 - using `finite I` unfolding sets_sigma
10.562 - by (intro sigma_sets.Basic generatorI[of I A]) auto
10.563 - qed }
10.564 -qed
10.565 -
10.566 -lemma (in product_prob_space) extend_\<mu>G:
10.567 - "\<exists>\<mu>. (\<forall>s\<in>sets generator. \<mu> s = \<mu>G s) \<and>
10.568 - prob_space \<lparr>space = space generator, sets = sets (sigma generator), measure = \<mu>\<rparr>"
10.569 +lemma (in product_prob_space) emeasure_PiM_emb_not_empty:
10.570 + assumes X: "J \<noteq> {}" "J \<subseteq> I" "finite J" "\<forall>i\<in>J. X i \<in> sets (M i)"
10.571 + shows "emeasure (Pi\<^isub>M I M) (emb I J (Pi\<^isub>E J X)) = emeasure (Pi\<^isub>M J M) (Pi\<^isub>E J X)"
10.572 proof cases
10.573 - assume "finite I"
10.574 - interpret I: finite_product_prob_space M I by default fact
10.575 - show ?thesis
10.576 - proof (intro exI[of _ "measure (Pi\<^isub>M I M)"] ballI conjI)
10.577 - fix A assume "A \<in> sets generator"
10.578 - from generatorE[OF this] guess J X . note J = this
10.579 - from J(1-4) `finite I` show "measure I.P A = \<mu>G A"
10.580 - unfolding J(6)
10.581 - by (subst J(5)[symmetric]) (simp add: measure_emb)
10.582 - next
10.583 - have [simp]: "space generator = space (Pi\<^isub>M I M)"
10.584 - by (simp add: generator_def product_algebra_def)
10.585 - have "\<lparr>space = space generator, sets = sets (sigma generator), measure = measure I.P\<rparr>
10.586 - = I.P" (is "?P = _")
10.587 - by (auto intro!: measure_space.equality simp: finite_index_eq_finite_product[OF `finite I`])
10.588 - show "prob_space ?P"
10.589 - proof
10.590 - show "measure_space ?P" using `?P = I.P` by simp default
10.591 - show "measure ?P (space ?P) = 1"
10.592 - using I.measure_space_1 by simp
10.593 - qed
10.594 - qed
10.595 + assume "finite I" with X show ?thesis by simp
10.596 next
10.597 + let ?\<Omega> = "\<Pi>\<^isub>E i\<in>I. space (M i)"
10.598 let ?G = generator
10.599 assume "\<not> finite I"
10.600 then have I_not_empty: "I \<noteq> {}" by auto
10.601 - interpret G!: algebra generator by (rule algebra_generator) fact
10.602 + interpret G!: algebra ?\<Omega> generator by (rule algebra_generator) fact
10.603 note \<mu>G_mono =
10.604 G.additive_increasing[OF positive_\<mu>G[OF I_not_empty] additive_\<mu>G[OF I_not_empty], THEN increasingD]
10.605
10.606 - { fix Z J assume J: "J \<noteq> {}" "finite J" "J \<subseteq> I" and Z: "Z \<in> sets ?G"
10.607 + { fix Z J assume J: "J \<noteq> {}" "finite J" "J \<subseteq> I" and Z: "Z \<in> ?G"
10.608
10.609 from `infinite I` `finite J` obtain k where k: "k \<in> I" "k \<notin> J"
10.610 by (metis rev_finite_subset subsetI)
10.611 @@ -445,7 +367,7 @@
10.612 moreover def K \<equiv> "insert k K'"
10.613 moreover def X \<equiv> "emb K K' X'"
10.614 ultimately have K: "K \<noteq> {}" "finite K" "K \<subseteq> I" "X \<in> sets (Pi\<^isub>M K M)" "Z = emb I K X"
10.615 - "K - J \<noteq> {}" "K - J \<subseteq> I" "\<mu>G Z = measure (Pi\<^isub>M K M) X"
10.616 + "K - J \<noteq> {}" "K - J \<subseteq> I" "\<mu>G Z = emeasure (Pi\<^isub>M K M) X"
10.617 by (auto simp: subset_insertI)
10.618
10.619 let ?M = "\<lambda>y. merge J y (K - J) -` emb (J \<union> K) K X \<inter> space (Pi\<^isub>M (K - J) M)"
10.620 @@ -455,9 +377,9 @@
10.621 have **: "?M y \<in> sets (Pi\<^isub>M (K - J) M)"
10.622 using J K y by (intro merge_sets) auto
10.623 ultimately
10.624 - have ***: "(merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M)) \<in> sets ?G"
10.625 + have ***: "(merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M)) \<in> ?G"
10.626 using J K by (intro generatorI) auto
10.627 - have "\<mu>G (merge J y (I - J) -` emb I K X \<inter> space (Pi\<^isub>M I M)) = measure (Pi\<^isub>M (K - J) M) (?M y)"
10.628 + have "\<mu>G (merge J y (I - J) -` emb I K X \<inter> space (Pi\<^isub>M I M)) = emeasure (Pi\<^isub>M (K - J) M) (?M y)"
10.629 unfolding * using K J by (subst \<mu>G_eq[OF _ _ _ **]) auto
10.630 note * ** *** this }
10.631 note merge_in_G = this
10.632 @@ -467,16 +389,16 @@
10.633 interpret J: finite_product_prob_space M J by default fact+
10.634 interpret KmJ: finite_product_prob_space M "K - J" by default fact+
10.635
10.636 - have "\<mu>G Z = measure (Pi\<^isub>M (J \<union> (K - J)) M) (emb (J \<union> (K - J)) K X)"
10.637 + have "\<mu>G Z = emeasure (Pi\<^isub>M (J \<union> (K - J)) M) (emb (J \<union> (K - J)) K X)"
10.638 using K J by simp
10.639 - also have "\<dots> = (\<integral>\<^isup>+ x. measure (Pi\<^isub>M (K - J) M) (?M x) \<partial>Pi\<^isub>M J M)"
10.640 - using K J by (subst measure_fold_integral) auto
10.641 + also have "\<dots> = (\<integral>\<^isup>+ x. emeasure (Pi\<^isub>M (K - J) M) (?M x) \<partial>Pi\<^isub>M J M)"
10.642 + using K J by (subst emeasure_fold_integral) auto
10.643 also have "\<dots> = (\<integral>\<^isup>+ y. \<mu>G (merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M)) \<partial>Pi\<^isub>M J M)"
10.644 (is "_ = (\<integral>\<^isup>+x. \<mu>G (?MZ x) \<partial>Pi\<^isub>M J M)")
10.645 - proof (intro J.positive_integral_cong)
10.646 + proof (intro positive_integral_cong)
10.647 fix x assume x: "x \<in> space (Pi\<^isub>M J M)"
10.648 with K merge_in_G(2)[OF this]
10.649 - show "measure (Pi\<^isub>M (K - J) M) (?M x) = \<mu>G (?MZ x)"
10.650 + show "emeasure (Pi\<^isub>M (K - J) M) (?M x) = \<mu>G (?MZ x)"
10.651 unfolding `Z = emb I K X` merge_in_G(1)[OF x] by (subst \<mu>G_eq) auto
10.652 qed
10.653 finally have fold: "\<mu>G Z = (\<integral>\<^isup>+x. \<mu>G (?MZ x) \<partial>Pi\<^isub>M J M)" .
10.654 @@ -490,21 +412,18 @@
10.655 let ?q = "\<lambda>y. \<mu>G (merge J y (I - J) -` Z \<inter> space (Pi\<^isub>M I M))"
10.656 have "?q \<in> borel_measurable (Pi\<^isub>M J M)"
10.657 unfolding `Z = emb I K X` using J K merge_in_G(3)
10.658 - by (simp add: merge_in_G \<mu>G_eq measure_fold_measurable
10.659 - del: space_product_algebra cong: measurable_cong)
10.660 + by (simp add: merge_in_G \<mu>G_eq emeasure_fold_measurable cong: measurable_cong)
10.661 note this fold le_1 merge_in_G(3) }
10.662 note fold = this
10.663
10.664 - have "\<exists>\<mu>. (\<forall>s\<in>sets ?G. \<mu> s = \<mu>G s) \<and>
10.665 - measure_space \<lparr>space = space ?G, sets = sets (sigma ?G), measure = \<mu>\<rparr>"
10.666 - (is "\<exists>\<mu>. _ \<and> measure_space (?ms \<mu>)")
10.667 + have "\<exists>\<mu>. (\<forall>s\<in>?G. \<mu> s = \<mu>G s) \<and> measure_space ?\<Omega> (sigma_sets ?\<Omega> ?G) \<mu>"
10.668 proof (rule G.caratheodory_empty_continuous[OF positive_\<mu>G additive_\<mu>G])
10.669 - fix A assume "A \<in> sets ?G"
10.670 + fix A assume "A \<in> ?G"
10.671 with generatorE guess J X . note JX = this
10.672 interpret JK: finite_product_prob_space M J by default fact+
10.673 from JX show "\<mu>G A \<noteq> \<infinity>" by simp
10.674 next
10.675 - fix A assume A: "range A \<subseteq> sets ?G" "decseq A" "(\<Inter>i. A i) = {}"
10.676 + fix A assume A: "range A \<subseteq> ?G" "decseq A" "(\<Inter>i. A i) = {}"
10.677 then have "decseq (\<lambda>i. \<mu>G (A i))"
10.678 by (auto intro!: \<mu>G_mono simp: decseq_def)
10.679 moreover
10.680 @@ -515,7 +434,7 @@
10.681 using A positive_\<mu>G[OF I_not_empty] by (auto intro!: INF_greatest simp: positive_def)
10.682 ultimately have "0 < ?a" by auto
10.683
10.684 - have "\<forall>n. \<exists>J X. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I \<and> X \<in> sets (Pi\<^isub>M J M) \<and> A n = emb I J X \<and> \<mu>G (A n) = measure (Pi\<^isub>M J M) X"
10.685 + have "\<forall>n. \<exists>J X. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I \<and> X \<in> sets (Pi\<^isub>M J M) \<and> A n = emb I J X \<and> \<mu>G (A n) = emeasure (Pi\<^isub>M J M) X"
10.686 using A by (intro allI generator_Ex) auto
10.687 then obtain J' X' where J': "\<And>n. J' n \<noteq> {}" "\<And>n. finite (J' n)" "\<And>n. J' n \<subseteq> I" "\<And>n. X' n \<in> sets (Pi\<^isub>M (J' n) M)"
10.688 and A': "\<And>n. A n = emb I (J' n) (X' n)"
10.689 @@ -524,8 +443,8 @@
10.690 moreover def X \<equiv> "\<lambda>n. emb (J n) (J' n) (X' n)"
10.691 ultimately have J: "\<And>n. J n \<noteq> {}" "\<And>n. finite (J n)" "\<And>n. J n \<subseteq> I" "\<And>n. X n \<in> sets (Pi\<^isub>M (J n) M)"
10.692 by auto
10.693 - with A' have A_eq: "\<And>n. A n = emb I (J n) (X n)" "\<And>n. A n \<in> sets ?G"
10.694 - unfolding J_def X_def by (subst emb_trans) (insert A, auto)
10.695 + with A' have A_eq: "\<And>n. A n = emb I (J n) (X n)" "\<And>n. A n \<in> ?G"
10.696 + unfolding J_def X_def by (subst prod_emb_trans) (insert A, auto)
10.697
10.698 have J_mono: "\<And>n m. n \<le> m \<Longrightarrow> J n \<subseteq> J m"
10.699 unfolding J_def by force
10.700 @@ -538,8 +457,8 @@
10.701
10.702 let ?M = "\<lambda>K Z y. merge K y (I - K) -` Z \<inter> space (Pi\<^isub>M I M)"
10.703
10.704 - { fix Z k assume Z: "range Z \<subseteq> sets ?G" "decseq Z" "\<forall>n. ?a / 2^k \<le> \<mu>G (Z n)"
10.705 - then have Z_sets: "\<And>n. Z n \<in> sets ?G" by auto
10.706 + { fix Z k assume Z: "range Z \<subseteq> ?G" "decseq Z" "\<forall>n. ?a / 2^k \<le> \<mu>G (Z n)"
10.707 + then have Z_sets: "\<And>n. Z n \<in> ?G" by auto
10.708 fix J' assume J': "J' \<noteq> {}" "finite J'" "J' \<subseteq> I"
10.709 interpret J': finite_product_prob_space M J' by default fact+
10.710
10.711 @@ -552,13 +471,13 @@
10.712 by (rule measurable_sets) auto }
10.713 note Q_sets = this
10.714
10.715 - have "?a / 2^(k+1) \<le> (INF n. measure (Pi\<^isub>M J' M) (?Q n))"
10.716 + have "?a / 2^(k+1) \<le> (INF n. emeasure (Pi\<^isub>M J' M) (?Q n))"
10.717 proof (intro INF_greatest)
10.718 fix n
10.719 have "?a / 2^k \<le> \<mu>G (Z n)" using Z by auto
10.720 also have "\<dots> \<le> (\<integral>\<^isup>+ x. indicator (?Q n) x + ?a / 2^(k+1) \<partial>Pi\<^isub>M J' M)"
10.721 - unfolding fold(2)[OF J' `Z n \<in> sets ?G`]
10.722 - proof (intro J'.positive_integral_mono)
10.723 + unfolding fold(2)[OF J' `Z n \<in> ?G`]
10.724 + proof (intro positive_integral_mono)
10.725 fix x assume x: "x \<in> space (Pi\<^isub>M J' M)"
10.726 then have "?q n x \<le> 1 + 0"
10.727 using J' Z fold(3) Z_sets by auto
10.728 @@ -568,15 +487,15 @@
10.729 with x show "?q n x \<le> indicator (?Q n) x + ?a / 2^(k+1)"
10.730 by (auto split: split_indicator simp del: power_Suc)
10.731 qed
10.732 - also have "\<dots> = measure (Pi\<^isub>M J' M) (?Q n) + ?a / 2^(k+1)"
10.733 - using `0 \<le> ?a` Q_sets J'.measure_space_1
10.734 - by (subst J'.positive_integral_add) auto
10.735 - finally show "?a / 2^(k+1) \<le> measure (Pi\<^isub>M J' M) (?Q n)" using `?a \<le> 1`
10.736 - by (cases rule: ereal2_cases[of ?a "measure (Pi\<^isub>M J' M) (?Q n)"])
10.737 + also have "\<dots> = emeasure (Pi\<^isub>M J' M) (?Q n) + ?a / 2^(k+1)"
10.738 + using `0 \<le> ?a` Q_sets J'.emeasure_space_1
10.739 + by (subst positive_integral_add) auto
10.740 + finally show "?a / 2^(k+1) \<le> emeasure (Pi\<^isub>M J' M) (?Q n)" using `?a \<le> 1`
10.741 + by (cases rule: ereal2_cases[of ?a "emeasure (Pi\<^isub>M J' M) (?Q n)"])
10.742 (auto simp: field_simps)
10.743 qed
10.744 - also have "\<dots> = measure (Pi\<^isub>M J' M) (\<Inter>n. ?Q n)"
10.745 - proof (intro J'.continuity_from_above)
10.746 + also have "\<dots> = emeasure (Pi\<^isub>M J' M) (\<Inter>n. ?Q n)"
10.747 + proof (intro INF_emeasure_decseq)
10.748 show "range ?Q \<subseteq> sets (Pi\<^isub>M J' M)" using Q_sets by auto
10.749 show "decseq ?Q"
10.750 unfolding decseq_def
10.751 @@ -587,13 +506,13 @@
10.752 also have "?q n x \<le> ?q m x"
10.753 proof (rule \<mu>G_mono)
10.754 from fold(4)[OF J', OF Z_sets x]
10.755 - show "?M J' (Z n) x \<in> sets ?G" "?M J' (Z m) x \<in> sets ?G" by auto
10.756 + show "?M J' (Z n) x \<in> ?G" "?M J' (Z m) x \<in> ?G" by auto
10.757 show "?M J' (Z n) x \<subseteq> ?M J' (Z m) x"
10.758 using `decseq Z`[THEN decseqD, OF `m \<le> n`] by auto
10.759 qed
10.760 finally show "?a / 2^(k+1) \<le> ?q m x" .
10.761 qed
10.762 - qed (intro J'.finite_measure Q_sets)
10.763 + qed simp
10.764 finally have "(\<Inter>n. ?Q n) \<noteq> {}"
10.765 using `0 < ?a` `?a \<le> 1` by (cases ?a) (auto simp: divide_le_0_iff power_le_zero_eq)
10.766 then have "\<exists>w\<in>space (Pi\<^isub>M J' M). \<forall>n. ?a / 2 ^ (k + 1) \<le> ?q n w" by auto }
10.767 @@ -631,12 +550,12 @@
10.768 show "w k \<in> space (Pi\<^isub>M (J (Suc k)) M)"
10.769 using Suc by simp
10.770 then show "restrict (w k) (J k) = w k"
10.771 - by (simp add: extensional_restrict)
10.772 + by (simp add: extensional_restrict space_PiM)
10.773 qed
10.774 next
10.775 assume "J k \<noteq> J (Suc k)"
10.776 with J_mono[of k "Suc k"] have "J (Suc k) - J k \<noteq> {}" (is "?D \<noteq> {}") by auto
10.777 - have "range (\<lambda>n. ?M (J k) (A n) (w k)) \<subseteq> sets ?G"
10.778 + have "range (\<lambda>n. ?M (J k) (A n) (w k)) \<subseteq> ?G"
10.779 "decseq (\<lambda>n. ?M (J k) (A n) (w k))"
10.780 "\<forall>n. ?a / 2 ^ (k + 1) \<le> \<mu>G (?M (J k) (A n) (w k))"
10.781 using `decseq A` fold(4)[OF J(1-3) A_eq(2), of "w k" k] Suc
10.782 @@ -651,11 +570,11 @@
10.783 by (auto intro!: ext split: split_merge)
10.784 have *: "\<And>n. ?M ?D (?M (J k) (A n) (w k)) w' = ?M (J (Suc k)) (A n) ?w"
10.785 using w'(1) J(3)[of "Suc k"]
10.786 - by (auto split: split_merge intro!: extensional_merge_sub) force+
10.787 + by (auto simp: space_PiM split: split_merge intro!: extensional_merge_sub) force+
10.788 show ?thesis
10.789 apply (rule exI[of _ ?w])
10.790 using w' J_mono[of k "Suc k"] wk unfolding *
10.791 - apply (auto split: split_merge intro!: extensional_merge_sub ext)
10.792 + apply (auto split: split_merge intro!: extensional_merge_sub ext simp: space_PiM)
10.793 apply (force simp: extensional_def)
10.794 done
10.795 qed
10.796 @@ -675,7 +594,7 @@
10.797 then have "merge (J k) (w k) (I - J k) x \<in> A k" by auto
10.798 then have "\<exists>x\<in>A k. restrict x (J k) = w k"
10.799 using `w k \<in> space (Pi\<^isub>M (J k) M)`
10.800 - by (intro rev_bexI) (auto intro!: ext simp: extensional_def)
10.801 + by (intro rev_bexI) (auto intro!: ext simp: extensional_def space_PiM)
10.802 ultimately have "w k \<in> space (Pi\<^isub>M (J k) M)"
10.803 "\<exists>x\<in>A k. restrict x (J k) = w k"
10.804 "k \<noteq> 0 \<Longrightarrow> restrict (w k) (J (k - 1)) = w (k - 1)"
10.805 @@ -707,17 +626,17 @@
10.806 have w'_simps2: "\<And>i. i \<notin> (\<Union>k. J k) \<Longrightarrow> i \<in> I \<Longrightarrow> w' i \<in> space (M i)"
10.807 using J by (auto simp: w'_def intro!: someI_ex[OF M.not_empty[unfolded ex_in_conv[symmetric]]])
10.808 { fix i assume "i \<in> I" then have "w' i \<in> space (M i)"
10.809 - using w(1) by (cases "i \<in> (\<Union>k. J k)") (force simp: w'_simps2 w'_eq)+ }
10.810 + using w(1) by (cases "i \<in> (\<Union>k. J k)") (force simp: w'_simps2 w'_eq space_PiM)+ }
10.811 note w'_simps[simp] = w'_eq w'_simps1 w'_simps2 this
10.812
10.813 have w': "w' \<in> space (Pi\<^isub>M I M)"
10.814 - using w(1) by (auto simp add: Pi_iff extensional_def)
10.815 + using w(1) by (auto simp add: Pi_iff extensional_def space_PiM)
10.816
10.817 { fix n
10.818 have "restrict w' (J n) = w n" using w(1)
10.819 - by (auto simp add: fun_eq_iff restrict_def Pi_iff extensional_def)
10.820 + by (auto simp add: fun_eq_iff restrict_def Pi_iff extensional_def space_PiM)
10.821 with w[of n] obtain x where "x \<in> A n" "restrict x (J n) = restrict w' (J n)" by auto
10.822 - then have "w' \<in> A n" unfolding A_eq using w' by (auto simp: emb_def) }
10.823 + then have "w' \<in> A n" unfolding A_eq using w' by (auto simp: prod_emb_def space_PiM) }
10.824 then have "w' \<in> (\<Inter>i. A i)" by auto
10.825 with `(\<Inter>i. A i) = {}` show False by auto
10.826 qed
10.827 @@ -726,276 +645,76 @@
10.828 qed fact+
10.829 then guess \<mu> .. note \<mu> = this
10.830 show ?thesis
10.831 - proof (intro exI[of _ \<mu>] conjI)
10.832 - show "\<forall>S\<in>sets ?G. \<mu> S = \<mu>G S" using \<mu> by simp
10.833 - show "prob_space (?ms \<mu>)"
10.834 - proof
10.835 - show "measure_space (?ms \<mu>)" using \<mu> by simp
10.836 - obtain i where "i \<in> I" using I_not_empty by auto
10.837 - interpret i: finite_product_sigma_finite M "{i}" by default auto
10.838 - let ?X = "\<Pi>\<^isub>E i\<in>{i}. space (M i)"
10.839 - have X: "?X \<in> sets (Pi\<^isub>M {i} M)"
10.840 - by auto
10.841 - with `i \<in> I` have "emb I {i} ?X \<in> sets generator"
10.842 - by (intro generatorI') auto
10.843 - with \<mu> have "\<mu> (emb I {i} ?X) = \<mu>G (emb I {i} ?X)" by auto
10.844 - with \<mu>G_eq[OF _ _ _ X] `i \<in> I`
10.845 - have "\<mu> (emb I {i} ?X) = measure (M i) (space (M i))"
10.846 - by (simp add: i.measure_times)
10.847 - also have "emb I {i} ?X = space (Pi\<^isub>P I M)"
10.848 - using `i \<in> I` by (auto simp: emb_def infprod_algebra_def generator_def)
10.849 - finally show "measure (?ms \<mu>) (space (?ms \<mu>)) = 1"
10.850 - using M.measure_space_1 by (simp add: infprod_algebra_def)
10.851 - qed
10.852 + proof (subst emeasure_extend_measure_Pair[OF PiM_def, of I M \<mu> J X])
10.853 + from assms show "(J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))"
10.854 + by (simp add: Pi_iff)
10.855 + next
10.856 + fix J X assume J: "(J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))"
10.857 + then show "emb I J (Pi\<^isub>E J X) \<in> Pow (\<Pi>\<^isub>E i\<in>I. space (M i))"
10.858 + by (auto simp: Pi_iff prod_emb_def dest: sets_into_space)
10.859 + have "emb I J (Pi\<^isub>E J X) \<in> generator"
10.860 + using J `I \<noteq> {}` by (intro generatorI') auto
10.861 + then have "\<mu> (emb I J (Pi\<^isub>E J X)) = \<mu>G (emb I J (Pi\<^isub>E J X))"
10.862 + using \<mu> by simp
10.863 + also have "\<dots> = (\<Prod> j\<in>J. if j \<in> J then emeasure (M j) (X j) else emeasure (M j) (space (M j)))"
10.864 + using J `I \<noteq> {}` by (subst \<mu>G_spec[OF _ _ _ refl]) (auto simp: emeasure_PiM Pi_iff)
10.865 + also have "\<dots> = (\<Prod>j\<in>J \<union> {i \<in> I. emeasure (M i) (space (M i)) \<noteq> 1}.
10.866 + if j \<in> J then emeasure (M j) (X j) else emeasure (M j) (space (M j)))"
10.867 + using J `I \<noteq> {}` by (intro setprod_mono_one_right) (auto simp: M.emeasure_space_1)
10.868 + finally show "\<mu> (emb I J (Pi\<^isub>E J X)) = \<dots>" .
10.869 + next
10.870 + let ?F = "\<lambda>j. if j \<in> J then emeasure (M j) (X j) else emeasure (M j) (space (M j))"
10.871 + have "(\<Prod>j\<in>J \<union> {i \<in> I. emeasure (M i) (space (M i)) \<noteq> 1}. ?F j) = (\<Prod>j\<in>J. ?F j)"
10.872 + using X `I \<noteq> {}` by (intro setprod_mono_one_right) (auto simp: M.emeasure_space_1)
10.873 + then show "(\<Prod>j\<in>J \<union> {i \<in> I. emeasure (M i) (space (M i)) \<noteq> 1}. ?F j) =
10.874 + emeasure (Pi\<^isub>M J M) (Pi\<^isub>E J X)"
10.875 + using X by (auto simp add: emeasure_PiM)
10.876 + next
10.877 + show "positive (sets (Pi\<^isub>M I M)) \<mu>" "countably_additive (sets (Pi\<^isub>M I M)) \<mu>"
10.878 + using \<mu> unfolding sets_PiM_generator[OF `I \<noteq> {}`] by (auto simp: measure_space_def)
10.879 qed
10.880 qed
10.881
10.882 -lemma (in product_prob_space) infprod_spec:
10.883 - "(\<forall>s\<in>sets generator. measure (Pi\<^isub>P I M) s = \<mu>G s) \<and> prob_space (Pi\<^isub>P I M)"
10.884 - (is "?Q infprod_algebra")
10.885 - unfolding infprod_algebra_def
10.886 - by (rule someI2_ex[OF extend_\<mu>G])
10.887 - (auto simp: sigma_def generator_def)
10.888 -
10.889 -sublocale product_prob_space \<subseteq> P: prob_space "Pi\<^isub>P I M"
10.890 - using infprod_spec by simp
10.891 -
10.892 -lemma (in product_prob_space) measure_infprod_emb:
10.893 - assumes "J \<noteq> {}" "finite J" "J \<subseteq> I" "X \<in> sets (Pi\<^isub>M J M)"
10.894 - shows "\<mu> (emb I J X) = measure (Pi\<^isub>M J M) X"
10.895 -proof -
10.896 - have "emb I J X \<in> sets generator"
10.897 - using assms by (rule generatorI')
10.898 - with \<mu>G_eq[OF assms] infprod_spec show ?thesis by auto
10.899 +sublocale product_prob_space \<subseteq> P: prob_space "Pi\<^isub>M I M"
10.900 +proof
10.901 + show "emeasure (Pi\<^isub>M I M) (space (Pi\<^isub>M I M)) = 1"
10.902 + proof cases
10.903 + assume "I = {}" then show ?thesis by (simp add: space_PiM_empty)
10.904 + next
10.905 + assume "I \<noteq> {}"
10.906 + then obtain i where "i \<in> I" by auto
10.907 + moreover then have "emb I {i} (\<Pi>\<^isub>E i\<in>{i}. space (M i)) = (space (Pi\<^isub>M I M))"
10.908 + by (auto simp: prod_emb_def space_PiM)
10.909 + ultimately show ?thesis
10.910 + using emeasure_PiM_emb_not_empty[of "{i}" "\<lambda>i. space (M i)"]
10.911 + by (simp add: emeasure_PiM emeasure_space_1)
10.912 + qed
10.913 qed
10.914
10.915 -lemma (in product_prob_space) measurable_component:
10.916 - assumes "i \<in> I"
10.917 - shows "(\<lambda>x. x i) \<in> measurable (Pi\<^isub>P I M) (M i)"
10.918 -proof (unfold measurable_def, safe)
10.919 - fix x assume "x \<in> space (Pi\<^isub>P I M)"
10.920 - then show "x i \<in> space (M i)"
10.921 - using `i \<in> I` by (auto simp: infprod_algebra_def generator_def)
10.922 +lemma (in product_prob_space) emeasure_PiM_emb:
10.923 + assumes X: "J \<subseteq> I" "finite J" "\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)"
10.924 + shows "emeasure (Pi\<^isub>M I M) (emb I J (Pi\<^isub>E J X)) = (\<Prod> i\<in>J. emeasure (M i) (X i))"
10.925 +proof cases
10.926 + assume "J = {}"
10.927 + moreover have "emb I {} {\<lambda>x. undefined} = space (Pi\<^isub>M I M)"
10.928 + by (auto simp: space_PiM prod_emb_def)
10.929 + ultimately show ?thesis
10.930 + by (simp add: space_PiM_empty P.emeasure_space_1)
10.931 next
10.932 - fix A assume "A \<in> sets (M i)"
10.933 - with `i \<in> I` have
10.934 - "(\<Pi>\<^isub>E x \<in> {i}. A) \<in> sets (Pi\<^isub>M {i} M)"
10.935 - "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M) = emb I {i} (\<Pi>\<^isub>E x \<in> {i}. A)"
10.936 - by (auto simp: infprod_algebra_def generator_def emb_def)
10.937 - from generatorI[OF _ _ _ this] `i \<in> I`
10.938 - show "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M) \<in> sets (Pi\<^isub>P I M)"
10.939 - unfolding infprod_algebra_def by auto
10.940 + assume "J \<noteq> {}" with X show ?thesis
10.941 + by (subst emeasure_PiM_emb_not_empty) (auto simp: emeasure_PiM)
10.942 qed
10.943
10.944 -lemma (in product_prob_space) emb_in_infprod_algebra[intro]:
10.945 - fixes J assumes J: "finite J" "J \<subseteq> I" and X: "X \<in> sets (Pi\<^isub>M J M)"
10.946 - shows "emb I J X \<in> sets (\<Pi>\<^isub>P i\<in>I. M i)"
10.947 -proof cases
10.948 - assume "J = {}"
10.949 - with X have "emb I J X = space (\<Pi>\<^isub>P i\<in>I. M i) \<or> emb I J X = {}"
10.950 - by (auto simp: emb_def infprod_algebra_def generator_def
10.951 - product_algebra_def product_algebra_generator_def image_constant sigma_def)
10.952 - then show ?thesis by auto
10.953 -next
10.954 - assume "J \<noteq> {}"
10.955 - show ?thesis unfolding infprod_algebra_def
10.956 - by simp (intro in_sigma generatorI' `J \<noteq> {}` J X)
10.957 -qed
10.958 +lemma (in product_prob_space) measure_PiM_emb:
10.959 + assumes "J \<subseteq> I" "finite J" "\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)"
10.960 + shows "measure (PiM I M) (emb I J (Pi\<^isub>E J X)) = (\<Prod> i\<in>J. measure (M i) (X i))"
10.961 + using emeasure_PiM_emb[OF assms]
10.962 + unfolding emeasure_eq_measure M.emeasure_eq_measure by (simp add: setprod_ereal)
10.963
10.964 -lemma (in product_prob_space) finite_measure_infprod_emb:
10.965 - assumes "J \<noteq> {}" "finite J" "J \<subseteq> I" "X \<in> sets (Pi\<^isub>M J M)"
10.966 - shows "\<mu>' (emb I J X) = finite_measure.\<mu>' (Pi\<^isub>M J M) X"
10.967 -proof -
10.968 - interpret J: finite_product_prob_space M J by default fact+
10.969 - from assms have "emb I J X \<in> sets (Pi\<^isub>P I M)" by auto
10.970 - with assms show "\<mu>' (emb I J X) = J.\<mu>' X"
10.971 - unfolding \<mu>'_def J.\<mu>'_def
10.972 - unfolding measure_infprod_emb[OF assms]
10.973 - by auto
10.974 -qed
10.975 -
10.976 -lemma (in finite_product_prob_space) finite_measure_times:
10.977 - assumes "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)"
10.978 - shows "\<mu>' (Pi\<^isub>E I A) = (\<Prod>i\<in>I. M.\<mu>' i (A i))"
10.979 - using assms
10.980 - unfolding \<mu>'_def M.\<mu>'_def
10.981 - by (subst measure_times[OF assms])
10.982 - (auto simp: finite_measure_eq M.finite_measure_eq setprod_ereal)
10.983 -
10.984 -lemma (in product_prob_space) finite_measure_infprod_emb_Pi:
10.985 - assumes J: "finite J" "J \<subseteq> I" "\<And>j. j \<in> J \<Longrightarrow> X j \<in> sets (M j)"
10.986 - shows "\<mu>' (emb I J (Pi\<^isub>E J X)) = (\<Prod>j\<in>J. M.\<mu>' j (X j))"
10.987 -proof cases
10.988 - assume "J = {}"
10.989 - then have "emb I J (Pi\<^isub>E J X) = space infprod_algebra"
10.990 - by (auto simp: infprod_algebra_def generator_def sigma_def emb_def)
10.991 - then show ?thesis using `J = {}` P.prob_space
10.992 - by simp
10.993 -next
10.994 - assume "J \<noteq> {}"
10.995 - interpret J: finite_product_prob_space M J by default fact+
10.996 - have "(\<Prod>i\<in>J. M.\<mu>' i (X i)) = J.\<mu>' (Pi\<^isub>E J X)"
10.997 - using J `J \<noteq> {}` by (subst J.finite_measure_times) auto
10.998 - also have "\<dots> = \<mu>' (emb I J (Pi\<^isub>E J X))"
10.999 - using J `J \<noteq> {}` by (intro finite_measure_infprod_emb[symmetric]) auto
10.1000 - finally show ?thesis by simp
10.1001 -qed
10.1002 -
10.1003 -lemma sigma_sets_mono: assumes "A \<subseteq> sigma_sets X B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
10.1004 -proof
10.1005 - fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
10.1006 - by induct (insert `A \<subseteq> sigma_sets X B`, auto intro: sigma_sets.intros)
10.1007 -qed
10.1008 -
10.1009 -lemma sigma_sets_mono': assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
10.1010 -proof
10.1011 - fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
10.1012 - by induct (insert `A \<subseteq> B`, auto intro: sigma_sets.intros)
10.1013 -qed
10.1014 -
10.1015 -lemma sigma_sets_superset_generator: "A \<subseteq> sigma_sets X A"
10.1016 - by (auto intro: sigma_sets.Basic)
10.1017 -
10.1018 -lemma (in product_prob_space) infprod_algebra_alt:
10.1019 - "Pi\<^isub>P I M = sigma \<lparr> space = space (Pi\<^isub>P I M),
10.1020 - sets = (\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` Pi\<^isub>E J ` (\<Pi> i \<in> J. sets (M i))),
10.1021 - measure = measure (Pi\<^isub>P I M) \<rparr>"
10.1022 - (is "_ = sigma \<lparr> space = ?O, sets = ?M, measure = ?m \<rparr>")
10.1023 -proof (rule measure_space.equality)
10.1024 - let ?G = "\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` sets (Pi\<^isub>M J M)"
10.1025 - have "sigma_sets ?O ?M = sigma_sets ?O ?G"
10.1026 - proof (intro equalityI sigma_sets_mono UN_least)
10.1027 - fix J assume J: "J \<in> {J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}"
10.1028 - have "emb I J ` Pi\<^isub>E J ` (\<Pi> i\<in>J. sets (M i)) \<subseteq> emb I J ` sets (Pi\<^isub>M J M)" by auto
10.1029 - also have "\<dots> \<subseteq> ?G" using J by (rule UN_upper)
10.1030 - also have "\<dots> \<subseteq> sigma_sets ?O ?G" by (rule sigma_sets_superset_generator)
10.1031 - finally show "emb I J ` Pi\<^isub>E J ` (\<Pi> i\<in>J. sets (M i)) \<subseteq> sigma_sets ?O ?G" .
10.1032 - have "emb I J ` sets (Pi\<^isub>M J M) = emb I J ` sigma_sets (space (Pi\<^isub>M J M)) (Pi\<^isub>E J ` (\<Pi> i \<in> J. sets (M i)))"
10.1033 - by (simp add: sets_sigma product_algebra_generator_def product_algebra_def)
10.1034 - also have "\<dots> = sigma_sets (space (Pi\<^isub>M I M)) (emb I J ` Pi\<^isub>E J ` (\<Pi> i \<in> J. sets (M i)))"
10.1035 - using J M.sets_into_space
10.1036 - by (auto simp: emb_def [abs_def] intro!: sigma_sets_vimage[symmetric]) blast
10.1037 - also have "\<dots> \<subseteq> sigma_sets (space (Pi\<^isub>M I M)) ?M"
10.1038 - using J by (intro sigma_sets_mono') auto
10.1039 - finally show "emb I J ` sets (Pi\<^isub>M J M) \<subseteq> sigma_sets ?O ?M"
10.1040 - by (simp add: infprod_algebra_def generator_def)
10.1041 - qed
10.1042 - then show "sets (Pi\<^isub>P I M) = sets (sigma \<lparr> space = ?O, sets = ?M, measure = ?m \<rparr>)"
10.1043 - by (simp_all add: infprod_algebra_def generator_def sets_sigma)
10.1044 -qed simp_all
10.1045 -
10.1046 -lemma (in product_prob_space) infprod_algebra_alt2:
10.1047 - "Pi\<^isub>P I M = sigma \<lparr> space = space (Pi\<^isub>P I M),
10.1048 - sets = (\<Union>i\<in>I. (\<lambda>A. (\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M)) ` sets (M i)),
10.1049 - measure = measure (Pi\<^isub>P I M) \<rparr>"
10.1050 - (is "_ = ?S")
10.1051 -proof (rule measure_space.equality)
10.1052 - let "sigma \<lparr> space = ?O, sets = ?A, \<dots> = _ \<rparr>" = ?S
10.1053 - let ?G = "(\<Union>J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emb I J ` Pi\<^isub>E J ` (\<Pi> i \<in> J. sets (M i)))"
10.1054 - have "sets (Pi\<^isub>P I M) = sigma_sets ?O ?G"
10.1055 - by (subst infprod_algebra_alt) (simp add: sets_sigma)
10.1056 - also have "\<dots> = sigma_sets ?O ?A"
10.1057 - proof (intro equalityI sigma_sets_mono subsetI)
10.1058 - interpret A: sigma_algebra ?S
10.1059 - by (rule sigma_algebra_sigma) auto
10.1060 - fix A assume "A \<in> ?G"
10.1061 - then obtain J B where "finite J" "J \<noteq> {}" "J \<subseteq> I" "A = emb I J (Pi\<^isub>E J B)"
10.1062 - and B: "\<And>i. i \<in> J \<Longrightarrow> B i \<in> sets (M i)"
10.1063 - by auto
10.1064 - then have A: "A = (\<Inter>j\<in>J. (\<lambda>x. x j) -` (B j) \<inter> space (Pi\<^isub>P I M))"
10.1065 - by (auto simp: emb_def infprod_algebra_def generator_def Pi_iff)
10.1066 - { fix j assume "j\<in>J"
10.1067 - with `J \<subseteq> I` have "j \<in> I" by auto
10.1068 - with `j \<in> J` B have "(\<lambda>x. x j) -` (B j) \<inter> space (Pi\<^isub>P I M) \<in> sets ?S"
10.1069 - by (auto simp: sets_sigma intro: sigma_sets.Basic) }
10.1070 - with `finite J` `J \<noteq> {}` have "A \<in> sets ?S"
10.1071 - unfolding A by (intro A.finite_INT) auto
10.1072 - then show "A \<in> sigma_sets ?O ?A" by (simp add: sets_sigma)
10.1073 - next
10.1074 - fix A assume "A \<in> ?A"
10.1075 - then obtain i B where i: "i \<in> I" "B \<in> sets (M i)"
10.1076 - and "A = (\<lambda>x. x i) -` B \<inter> space (Pi\<^isub>P I M)"
10.1077 - by auto
10.1078 - then have "A = emb I {i} (Pi\<^isub>E {i} (\<lambda>_. B))"
10.1079 - by (auto simp: emb_def infprod_algebra_def generator_def Pi_iff)
10.1080 - with i show "A \<in> sigma_sets ?O ?G"
10.1081 - by (intro sigma_sets.Basic UN_I[where a="{i}"]) auto
10.1082 - qed
10.1083 - also have "\<dots> = sets ?S"
10.1084 - by (simp add: sets_sigma)
10.1085 - finally show "sets (Pi\<^isub>P I M) = sets ?S" .
10.1086 -qed simp_all
10.1087 -
10.1088 -lemma (in product_prob_space) measurable_into_infprod_algebra:
10.1089 - assumes "sigma_algebra N"
10.1090 - assumes f: "\<And>i. i \<in> I \<Longrightarrow> (\<lambda>x. f x i) \<in> measurable N (M i)"
10.1091 - assumes ext: "\<And>x. x \<in> space N \<Longrightarrow> f x \<in> extensional I"
10.1092 - shows "f \<in> measurable N (Pi\<^isub>P I M)"
10.1093 -proof -
10.1094 - interpret N: sigma_algebra N by fact
10.1095 - have f_in: "\<And>i. i \<in> I \<Longrightarrow> (\<lambda>x. f x i) \<in> space N \<rightarrow> space (M i)"
10.1096 - using f by (auto simp: measurable_def)
10.1097 - { fix i A assume i: "i \<in> I" "A \<in> sets (M i)"
10.1098 - then have "f -` (\<lambda>x. x i) -` A \<inter> f -` space infprod_algebra \<inter> space N = (\<lambda>x. f x i) -` A \<inter> space N"
10.1099 - using f_in ext by (auto simp: infprod_algebra_def generator_def)
10.1100 - also have "\<dots> \<in> sets N"
10.1101 - by (rule measurable_sets f i)+
10.1102 - finally have "f -` (\<lambda>x. x i) -` A \<inter> f -` space infprod_algebra \<inter> space N \<in> sets N" . }
10.1103 - with f_in ext show ?thesis
10.1104 - by (subst infprod_algebra_alt2)
10.1105 - (auto intro!: N.measurable_sigma simp: Pi_iff infprod_algebra_def generator_def)
10.1106 -qed
10.1107 -
10.1108 -lemma (in product_prob_space) measurable_singleton_infprod:
10.1109 - assumes "i \<in> I"
10.1110 - shows "(\<lambda>x. x i) \<in> measurable (Pi\<^isub>P I M) (M i)"
10.1111 -proof (unfold measurable_def, intro CollectI conjI ballI)
10.1112 - show "(\<lambda>x. x i) \<in> space (Pi\<^isub>P I M) \<rightarrow> space (M i)"
10.1113 - using M.sets_into_space `i \<in> I`
10.1114 - by (auto simp: infprod_algebra_def generator_def)
10.1115 - fix A assume "A \<in> sets (M i)"
10.1116 - have "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M) = emb I {i} (\<Pi>\<^isub>E _\<in>{i}. A)"
10.1117 - by (auto simp: infprod_algebra_def generator_def emb_def)
10.1118 - also have "\<dots> \<in> sets (Pi\<^isub>P I M)"
10.1119 - using `i \<in> I` `A \<in> sets (M i)`
10.1120 - by (intro emb_in_infprod_algebra product_algebraI) auto
10.1121 - finally show "(\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M) \<in> sets (Pi\<^isub>P I M)" .
10.1122 -qed
10.1123 -
10.1124 -lemma (in product_prob_space) sigma_product_algebra_sigma_eq:
10.1125 - assumes M: "\<And>i. i \<in> I \<Longrightarrow> M i = sigma (E i)"
10.1126 - shows "sets (Pi\<^isub>P I M) = sigma_sets (space (Pi\<^isub>P I M)) (\<Union>i\<in>I. (\<lambda>A. (\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M)) ` sets (E i))"
10.1127 -proof -
10.1128 - let ?E = "(\<Union>i\<in>I. (\<lambda>A. (\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M)) ` sets (E i))"
10.1129 - let ?M = "(\<Union>i\<in>I. (\<lambda>A. (\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M)) ` sets (M i))"
10.1130 - { fix i A assume "i\<in>I" "A \<in> sets (E i)"
10.1131 - then have "A \<in> sets (M i)" using M by auto
10.1132 - then have "A \<in> Pow (space (M i))" using M.sets_into_space by auto
10.1133 - then have "A \<in> Pow (space (E i))" using M[OF `i \<in> I`] by auto }
10.1134 - moreover
10.1135 - have "\<And>i. i \<in> I \<Longrightarrow> (\<lambda>x. x i) \<in> space infprod_algebra \<rightarrow> space (E i)"
10.1136 - by (auto simp: M infprod_algebra_def generator_def Pi_iff)
10.1137 - ultimately have "sigma_sets (space (Pi\<^isub>P I M)) ?M \<subseteq> sigma_sets (space (Pi\<^isub>P I M)) ?E"
10.1138 - apply (intro sigma_sets_mono UN_least)
10.1139 - apply (simp add: sets_sigma M)
10.1140 - apply (subst sigma_sets_vimage[symmetric])
10.1141 - apply (auto intro!: sigma_sets_mono')
10.1142 - done
10.1143 - moreover have "sigma_sets (space (Pi\<^isub>P I M)) ?E \<subseteq> sigma_sets (space (Pi\<^isub>P I M)) ?M"
10.1144 - by (intro sigma_sets_mono') (auto simp: M)
10.1145 - ultimately show ?thesis
10.1146 - by (subst infprod_algebra_alt2) (auto simp: sets_sigma)
10.1147 -qed
10.1148 -
10.1149 -lemma (in product_prob_space) Int_proj_eq_emb:
10.1150 - assumes "J \<noteq> {}" "J \<subseteq> I"
10.1151 - shows "(\<Inter>i\<in>J. (\<lambda>x. x i) -` A i \<inter> space (Pi\<^isub>P I M)) = emb I J (Pi\<^isub>E J A)"
10.1152 - using assms by (auto simp: infprod_algebra_def generator_def emb_def Pi_iff)
10.1153 -
10.1154 -lemma (in product_prob_space) emb_insert:
10.1155 - "i \<notin> J \<Longrightarrow> emb I J (Pi\<^isub>E J f) \<inter> ((\<lambda>x. x i) -` A \<inter> space (Pi\<^isub>P I M)) =
10.1156 - emb I (insert i J) (Pi\<^isub>E (insert i J) (f(i := A)))"
10.1157 - by (auto simp: emb_def Pi_iff infprod_algebra_def generator_def split: split_if_asm)
10.1158 +lemma (in finite_product_prob_space) finite_measure_PiM_emb:
10.1159 + "(\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)) \<Longrightarrow> measure (PiM I M) (Pi\<^isub>E I A) = (\<Prod>i\<in>I. measure (M i) (A i))"
10.1160 + using measure_PiM_emb[of I A] finite_index prod_emb_PiE_same_index[OF sets_into_space, of I A M]
10.1161 + by auto
10.1162
10.1163 subsection {* Sequence space *}
10.1164
10.1165 @@ -1003,36 +722,30 @@
10.1166
10.1167 lemma (in sequence_space) infprod_in_sets[intro]:
10.1168 fixes E :: "nat \<Rightarrow> 'a set" assumes E: "\<And>i. E i \<in> sets (M i)"
10.1169 - shows "Pi UNIV E \<in> sets (Pi\<^isub>P UNIV M)"
10.1170 + shows "Pi UNIV E \<in> sets (Pi\<^isub>M UNIV M)"
10.1171 proof -
10.1172 have "Pi UNIV E = (\<Inter>i. emb UNIV {..i} (\<Pi>\<^isub>E j\<in>{..i}. E j))"
10.1173 - using E E[THEN M.sets_into_space]
10.1174 - by (auto simp: emb_def Pi_iff extensional_def) blast
10.1175 - with E show ?thesis
10.1176 - by (auto intro: emb_in_infprod_algebra)
10.1177 + using E E[THEN sets_into_space]
10.1178 + by (auto simp: prod_emb_def Pi_iff extensional_def) blast
10.1179 + with E show ?thesis by auto
10.1180 qed
10.1181
10.1182 -lemma (in sequence_space) measure_infprod:
10.1183 +lemma (in sequence_space) measure_PiM_countable:
10.1184 fixes E :: "nat \<Rightarrow> 'a set" assumes E: "\<And>i. E i \<in> sets (M i)"
10.1185 - shows "(\<lambda>n. \<Prod>i\<le>n. M.\<mu>' i (E i)) ----> \<mu>' (Pi UNIV E)"
10.1186 + shows "(\<lambda>n. \<Prod>i\<le>n. measure (M i) (E i)) ----> measure (Pi\<^isub>M UNIV M) (Pi UNIV E)"
10.1187 proof -
10.1188 let ?E = "\<lambda>n. emb UNIV {..n} (Pi\<^isub>E {.. n} E)"
10.1189 - { fix n :: nat
10.1190 - interpret n: finite_product_prob_space M "{..n}" by default auto
10.1191 - have "(\<Prod>i\<le>n. M.\<mu>' i (E i)) = n.\<mu>' (Pi\<^isub>E {.. n} E)"
10.1192 - using E by (subst n.finite_measure_times) auto
10.1193 - also have "\<dots> = \<mu>' (?E n)"
10.1194 - using E by (intro finite_measure_infprod_emb[symmetric]) auto
10.1195 - finally have "(\<Prod>i\<le>n. M.\<mu>' i (E i)) = \<mu>' (?E n)" . }
10.1196 + have "\<And>n. (\<Prod>i\<le>n. measure (M i) (E i)) = measure (Pi\<^isub>M UNIV M) (?E n)"
10.1197 + using E by (simp add: measure_PiM_emb)
10.1198 moreover have "Pi UNIV E = (\<Inter>n. ?E n)"
10.1199 - using E E[THEN M.sets_into_space]
10.1200 - by (auto simp: emb_def extensional_def Pi_iff) blast
10.1201 - moreover have "range ?E \<subseteq> sets (Pi\<^isub>P UNIV M)"
10.1202 + using E E[THEN sets_into_space]
10.1203 + by (auto simp: prod_emb_def extensional_def Pi_iff) blast
10.1204 + moreover have "range ?E \<subseteq> sets (Pi\<^isub>M UNIV M)"
10.1205 using E by auto
10.1206 moreover have "decseq ?E"
10.1207 - by (auto simp: emb_def Pi_iff decseq_def)
10.1208 + by (auto simp: prod_emb_def Pi_iff decseq_def)
10.1209 ultimately show ?thesis
10.1210 - by (simp add: finite_continuity_from_above)
10.1211 + by (simp add: finite_Lim_measure_decseq)
10.1212 qed
10.1213
10.1214 end
10.1215 \ No newline at end of file
11.1 --- a/src/HOL/Probability/Information.thy Mon Apr 23 12:23:23 2012 +0100
11.2 +++ b/src/HOL/Probability/Information.thy Mon Apr 23 12:14:35 2012 +0200
11.3 @@ -172,147 +172,152 @@
11.4 Kullback$-$Leibler distance. *}
11.5
11.6 definition
11.7 - "entropy_density b M \<nu> = log b \<circ> real \<circ> RN_deriv M \<nu>"
11.8 + "entropy_density b M N = log b \<circ> real \<circ> RN_deriv M N"
11.9
11.10 definition
11.11 - "KL_divergence b M \<nu> = integral\<^isup>L (M\<lparr>measure := \<nu>\<rparr>) (entropy_density b M \<nu>)"
11.12 + "KL_divergence b M N = integral\<^isup>L N (entropy_density b M N)"
11.13
11.14 lemma (in information_space) measurable_entropy_density:
11.15 - assumes ps: "prob_space (M\<lparr>measure := \<nu>\<rparr>)"
11.16 - assumes ac: "absolutely_continuous \<nu>"
11.17 - shows "entropy_density b M \<nu> \<in> borel_measurable M"
11.18 + assumes ac: "absolutely_continuous M N" "sets N = events"
11.19 + shows "entropy_density b M N \<in> borel_measurable M"
11.20 proof -
11.21 - interpret \<nu>: prob_space "M\<lparr>measure := \<nu>\<rparr>" by fact
11.22 - have "measure_space (M\<lparr>measure := \<nu>\<rparr>)" by fact
11.23 - from RN_deriv[OF this ac] b_gt_1 show ?thesis
11.24 + from borel_measurable_RN_deriv[OF ac] b_gt_1 show ?thesis
11.25 unfolding entropy_density_def
11.26 by (intro measurable_comp) auto
11.27 qed
11.28
11.29 +lemma (in sigma_finite_measure) KL_density:
11.30 + fixes f :: "'a \<Rightarrow> real"
11.31 + assumes "1 < b"
11.32 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
11.33 + shows "KL_divergence b M (density M f) = (\<integral>x. f x * log b (f x) \<partial>M)"
11.34 + unfolding KL_divergence_def
11.35 +proof (subst integral_density)
11.36 + show "entropy_density b M (density M (\<lambda>x. ereal (f x))) \<in> borel_measurable M"
11.37 + using f `1 < b`
11.38 + by (auto simp: comp_def entropy_density_def intro!: borel_measurable_log borel_measurable_RN_deriv_density)
11.39 + have "density M (RN_deriv M (density M f)) = density M f"
11.40 + using f by (intro density_RN_deriv_density) auto
11.41 + then have eq: "AE x in M. RN_deriv M (density M f) x = f x"
11.42 + using f
11.43 + by (intro density_unique)
11.44 + (auto intro!: borel_measurable_log borel_measurable_RN_deriv_density simp: RN_deriv_density_nonneg)
11.45 + show "(\<integral>x. f x * entropy_density b M (density M (\<lambda>x. ereal (f x))) x \<partial>M) = (\<integral>x. f x * log b (f x) \<partial>M)"
11.46 + apply (intro integral_cong_AE)
11.47 + using eq
11.48 + apply eventually_elim
11.49 + apply (auto simp: entropy_density_def)
11.50 + done
11.51 +qed fact+
11.52 +
11.53 +lemma (in sigma_finite_measure) KL_density_density:
11.54 + fixes f g :: "'a \<Rightarrow> real"
11.55 + assumes "1 < b"
11.56 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
11.57 + assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
11.58 + assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0"
11.59 + shows "KL_divergence b (density M f) (density M g) = (\<integral>x. g x * log b (g x / f x) \<partial>M)"
11.60 +proof -
11.61 + interpret Mf: sigma_finite_measure "density M f"
11.62 + using f by (subst sigma_finite_iff_density_finite) auto
11.63 + have "KL_divergence b (density M f) (density M g) =
11.64 + KL_divergence b (density M f) (density (density M f) (\<lambda>x. g x / f x))"
11.65 + using f g ac by (subst density_density_divide) simp_all
11.66 + also have "\<dots> = (\<integral>x. (g x / f x) * log b (g x / f x) \<partial>density M f)"
11.67 + using f g `1 < b` by (intro Mf.KL_density) (auto simp: AE_density divide_nonneg_nonneg)
11.68 + also have "\<dots> = (\<integral>x. g x * log b (g x / f x) \<partial>M)"
11.69 + using ac f g `1 < b` by (subst integral_density) (auto intro!: integral_cong_AE)
11.70 + finally show ?thesis .
11.71 +qed
11.72 +
11.73 lemma (in information_space) KL_gt_0:
11.74 - assumes ps: "prob_space (M\<lparr>measure := \<nu>\<rparr>)"
11.75 - assumes ac: "absolutely_continuous \<nu>"
11.76 - assumes int: "integrable (M\<lparr> measure := \<nu> \<rparr>) (entropy_density b M \<nu>)"
11.77 - assumes A: "A \<in> sets M" "\<nu> A \<noteq> \<mu> A"
11.78 - shows "0 < KL_divergence b M \<nu>"
11.79 + fixes D :: "'a \<Rightarrow> real"
11.80 + assumes "prob_space (density M D)"
11.81 + assumes D: "D \<in> borel_measurable M" "AE x in M. 0 \<le> D x"
11.82 + assumes int: "integrable M (\<lambda>x. D x * log b (D x))"
11.83 + assumes A: "density M D \<noteq> M"
11.84 + shows "0 < KL_divergence b M (density M D)"
11.85 proof -
11.86 - interpret \<nu>: prob_space "M\<lparr>measure := \<nu>\<rparr>" by fact
11.87 - have ms: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" by default
11.88 - have fms: "finite_measure (M\<lparr>measure := \<nu>\<rparr>)" by unfold_locales
11.89 - note RN = RN_deriv[OF ms ac]
11.90 + interpret N: prob_space "density M D" by fact
11.91
11.92 - from real_RN_deriv[OF fms ac] guess D . note D = this
11.93 - with absolutely_continuous_AE[OF ms] ac
11.94 - have D\<nu>: "AE x in M\<lparr>measure := \<nu>\<rparr>. RN_deriv M \<nu> x = ereal (D x)"
11.95 - by auto
11.96 + obtain A where "A \<in> sets M" "emeasure (density M D) A \<noteq> emeasure M A"
11.97 + using measure_eqI[of "density M D" M] `density M D \<noteq> M` by auto
11.98
11.99 - def f \<equiv> "\<lambda>x. if D x = 0 then 1 else 1 / D x"
11.100 - with D have f_borel: "f \<in> borel_measurable M"
11.101 - by (auto intro!: measurable_If)
11.102 -
11.103 - have "KL_divergence b M \<nu> = 1 / ln b * (\<integral> x. ln b * entropy_density b M \<nu> x \<partial>M\<lparr>measure := \<nu>\<rparr>)"
11.104 - unfolding KL_divergence_def using int b_gt_1
11.105 - by (simp add: integral_cmult)
11.106 -
11.107 - { fix A assume "A \<in> sets M"
11.108 - with RN D have "\<nu>.\<mu> A = (\<integral>\<^isup>+ x. ereal (D x) * indicator A x \<partial>M)"
11.109 - by (auto intro!: positive_integral_cong_AE) }
11.110 - note D_density = this
11.111 -
11.112 - have ln_entropy: "(\<lambda>x. ln b * entropy_density b M \<nu> x) \<in> borel_measurable M"
11.113 - using measurable_entropy_density[OF ps ac] by auto
11.114 -
11.115 - have "integrable (M\<lparr>measure := \<nu>\<rparr>) (\<lambda>x. ln b * entropy_density b M \<nu> x)"
11.116 - using int by auto
11.117 - moreover have "integrable (M\<lparr>measure := \<nu>\<rparr>) (\<lambda>x. ln b * entropy_density b M \<nu> x) \<longleftrightarrow>
11.118 - integrable M (\<lambda>x. D x * (ln b * entropy_density b M \<nu> x))"
11.119 - using D D_density ln_entropy
11.120 - by (intro integral_translated_density) auto
11.121 - ultimately have M_int: "integrable M (\<lambda>x. D x * (ln b * entropy_density b M \<nu> x))"
11.122 - by simp
11.123 + let ?D_set = "{x\<in>space M. D x \<noteq> 0}"
11.124 + have [simp, intro]: "?D_set \<in> sets M"
11.125 + using D by auto
11.126
11.127 have D_neg: "(\<integral>\<^isup>+ x. ereal (- D x) \<partial>M) = 0"
11.128 using D by (subst positive_integral_0_iff_AE) auto
11.129
11.130 - have "(\<integral>\<^isup>+ x. ereal (D x) \<partial>M) = \<nu> (space M)"
11.131 - using RN D by (auto intro!: positive_integral_cong_AE)
11.132 + have "(\<integral>\<^isup>+ x. ereal (D x) \<partial>M) = emeasure (density M D) (space M)"
11.133 + using D by (simp add: emeasure_density cong: positive_integral_cong)
11.134 then have D_pos: "(\<integral>\<^isup>+ x. ereal (D x) \<partial>M) = 1"
11.135 - using \<nu>.measure_space_1 by simp
11.136 + using N.emeasure_space_1 by simp
11.137
11.138 - have "integrable M D"
11.139 - using D_pos D_neg D by (auto simp: integrable_def)
11.140 + have "integrable M D" "integral\<^isup>L M D = 1"
11.141 + using D D_pos D_neg unfolding integrable_def lebesgue_integral_def by simp_all
11.142
11.143 - have "integral\<^isup>L M D = 1"
11.144 - using D_pos D_neg by (auto simp: lebesgue_integral_def)
11.145 -
11.146 - let ?D_set = "{x\<in>space M. D x \<noteq> 0}"
11.147 - have [simp, intro]: "?D_set \<in> sets M"
11.148 - using D by (auto intro: sets_Collect)
11.149 -
11.150 - have "0 \<le> 1 - \<mu>' ?D_set"
11.151 + have "0 \<le> 1 - measure M ?D_set"
11.152 using prob_le_1 by (auto simp: field_simps)
11.153 also have "\<dots> = (\<integral> x. D x - indicator ?D_set x \<partial>M)"
11.154 using `integrable M D` `integral\<^isup>L M D = 1`
11.155 - by (simp add: \<mu>'_def)
11.156 - also have "\<dots> < (\<integral> x. D x * (ln b * entropy_density b M \<nu> x) \<partial>M)"
11.157 + by (simp add: emeasure_eq_measure)
11.158 + also have "\<dots> < (\<integral> x. D x * (ln b * log b (D x)) \<partial>M)"
11.159 proof (rule integral_less_AE)
11.160 show "integrable M (\<lambda>x. D x - indicator ?D_set x)"
11.161 using `integrable M D`
11.162 by (intro integral_diff integral_indicator) auto
11.163 next
11.164 - show "integrable M (\<lambda>x. D x * (ln b * entropy_density b M \<nu> x))"
11.165 - by fact
11.166 + from integral_cmult(1)[OF int, of "ln b"]
11.167 + show "integrable M (\<lambda>x. D x * (ln b * log b (D x)))"
11.168 + by (simp add: ac_simps)
11.169 next
11.170 - show "\<mu> {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<noteq> 0"
11.171 + show "emeasure M {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<noteq> 0"
11.172 proof
11.173 - assume eq_0: "\<mu> {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} = 0"
11.174 - then have disj: "AE x. D x = 1 \<or> D x = 0"
11.175 + assume eq_0: "emeasure M {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} = 0"
11.176 + then have disj: "AE x in M. D x = 1 \<or> D x = 0"
11.177 using D(1) by (auto intro!: AE_I[OF subset_refl] sets_Collect)
11.178
11.179 - have "\<mu> {x\<in>space M. D x = 1} = (\<integral>\<^isup>+ x. indicator {x\<in>space M. D x = 1} x \<partial>M)"
11.180 + have "emeasure M {x\<in>space M. D x = 1} = (\<integral>\<^isup>+ x. indicator {x\<in>space M. D x = 1} x \<partial>M)"
11.181 using D(1) by auto
11.182 - also have "\<dots> = (\<integral>\<^isup>+ x. ereal (D x) * indicator {x\<in>space M. D x \<noteq> 0} x \<partial>M)"
11.183 + also have "\<dots> = (\<integral>\<^isup>+ x. ereal (D x) \<partial>M)"
11.184 using disj by (auto intro!: positive_integral_cong_AE simp: indicator_def one_ereal_def)
11.185 - also have "\<dots> = \<nu> {x\<in>space M. D x \<noteq> 0}"
11.186 - using D(1) D_density by auto
11.187 - also have "\<dots> = \<nu> (space M)"
11.188 - using D_density D(1) by (auto intro!: positive_integral_cong simp: indicator_def)
11.189 - finally have "AE x. D x = 1"
11.190 - using D(1) \<nu>.measure_space_1 by (intro AE_I_eq_1) auto
11.191 + finally have "AE x in M. D x = 1"
11.192 + using D D_pos by (intro AE_I_eq_1) auto
11.193 then have "(\<integral>\<^isup>+x. indicator A x\<partial>M) = (\<integral>\<^isup>+x. ereal (D x) * indicator A x\<partial>M)"
11.194 by (intro positive_integral_cong_AE) (auto simp: one_ereal_def[symmetric])
11.195 - also have "\<dots> = \<nu> A"
11.196 - using `A \<in> sets M` D_density by simp
11.197 - finally show False using `A \<in> sets M` `\<nu> A \<noteq> \<mu> A` by simp
11.198 + also have "\<dots> = density M D A"
11.199 + using `A \<in> sets M` D by (simp add: emeasure_density)
11.200 + finally show False using `A \<in> sets M` `emeasure (density M D) A \<noteq> emeasure M A` by simp
11.201 qed
11.202 show "{x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<in> sets M"
11.203 - using D(1) by (auto intro: sets_Collect)
11.204 + using D(1) by (auto intro: sets_Collect_conj)
11.205
11.206 - show "AE t. t \<in> {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<longrightarrow>
11.207 - D t - indicator ?D_set t \<noteq> D t * (ln b * entropy_density b M \<nu> t)"
11.208 + show "AE t in M. t \<in> {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<longrightarrow>
11.209 + D t - indicator ?D_set t \<noteq> D t * (ln b * log b (D t))"
11.210 using D(2)
11.211 - proof (elim AE_mp, safe intro!: AE_I2)
11.212 - fix t assume Dt: "t \<in> space M" "D t \<noteq> 1" "D t \<noteq> 0"
11.213 - and RN: "RN_deriv M \<nu> t = ereal (D t)"
11.214 - and eq: "D t - indicator ?D_set t = D t * (ln b * entropy_density b M \<nu> t)"
11.215 + proof (eventually_elim, safe)
11.216 + fix t assume Dt: "t \<in> space M" "D t \<noteq> 1" "D t \<noteq> 0" "0 \<le> D t"
11.217 + and eq: "D t - indicator ?D_set t = D t * (ln b * log b (D t))"
11.218
11.219 have "D t - 1 = D t - indicator ?D_set t"
11.220 using Dt by simp
11.221 also note eq
11.222 - also have "D t * (ln b * entropy_density b M \<nu> t) = - D t * ln (1 / D t)"
11.223 - using RN b_gt_1 `D t \<noteq> 0` `0 \<le> D t`
11.224 - by (simp add: entropy_density_def log_def ln_div less_le)
11.225 + also have "D t * (ln b * log b (D t)) = - D t * ln (1 / D t)"
11.226 + using b_gt_1 `D t \<noteq> 0` `0 \<le> D t`
11.227 + by (simp add: log_def ln_div less_le)
11.228 finally have "ln (1 / D t) = 1 / D t - 1"
11.229 using `D t \<noteq> 0` by (auto simp: field_simps)
11.230 from ln_eq_minus_one[OF _ this] `D t \<noteq> 0` `0 \<le> D t` `D t \<noteq> 1`
11.231 show False by auto
11.232 qed
11.233
11.234 - show "AE t. D t - indicator ?D_set t \<le> D t * (ln b * entropy_density b M \<nu> t)"
11.235 - using D(2)
11.236 - proof (elim AE_mp, intro AE_I2 impI)
11.237 - fix t assume "t \<in> space M" and RN: "RN_deriv M \<nu> t = ereal (D t)"
11.238 - show "D t - indicator ?D_set t \<le> D t * (ln b * entropy_density b M \<nu> t)"
11.239 + show "AE t in M. D t - indicator ?D_set t \<le> D t * (ln b * log b (D t))"
11.240 + using D(2) AE_space
11.241 + proof eventually_elim
11.242 + fix t assume "t \<in> space M" "0 \<le> D t"
11.243 + show "D t - indicator ?D_set t \<le> D t * (ln b * log b (D t))"
11.244 proof cases
11.245 assume asm: "D t \<noteq> 0"
11.246 then have "0 < D t" using `0 \<le> D t` by auto
11.247 @@ -321,592 +326,425 @@
11.248 using asm `t \<in> space M` by (simp add: field_simps)
11.249 also have "- D t * (1 / D t - 1) \<le> - D t * ln (1 / D t)"
11.250 using ln_le_minus_one `0 < 1 / D t` by (intro mult_left_mono_neg) auto
11.251 - also have "\<dots> = D t * (ln b * entropy_density b M \<nu> t)"
11.252 - using `0 < D t` RN b_gt_1
11.253 - by (simp_all add: log_def ln_div entropy_density_def)
11.254 + also have "\<dots> = D t * (ln b * log b (D t))"
11.255 + using `0 < D t` b_gt_1
11.256 + by (simp_all add: log_def ln_div)
11.257 finally show ?thesis by simp
11.258 qed simp
11.259 qed
11.260 qed
11.261 - also have "\<dots> = (\<integral> x. ln b * entropy_density b M \<nu> x \<partial>M\<lparr>measure := \<nu>\<rparr>)"
11.262 - using D D_density ln_entropy
11.263 - by (intro integral_translated_density[symmetric]) auto
11.264 - also have "\<dots> = ln b * (\<integral> x. entropy_density b M \<nu> x \<partial>M\<lparr>measure := \<nu>\<rparr>)"
11.265 - using int by (rule \<nu>.integral_cmult)
11.266 - finally show "0 < KL_divergence b M \<nu>"
11.267 - using b_gt_1 by (auto simp: KL_divergence_def zero_less_mult_iff)
11.268 + also have "\<dots> = (\<integral> x. ln b * (D x * log b (D x)) \<partial>M)"
11.269 + by (simp add: ac_simps)
11.270 + also have "\<dots> = ln b * (\<integral> x. D x * log b (D x) \<partial>M)"
11.271 + using int by (rule integral_cmult)
11.272 + finally show ?thesis
11.273 + using b_gt_1 D by (subst KL_density) (auto simp: zero_less_mult_iff)
11.274 qed
11.275
11.276 -lemma (in sigma_finite_measure) KL_eq_0:
11.277 - assumes eq: "\<forall>A\<in>sets M. \<nu> A = measure M A"
11.278 - shows "KL_divergence b M \<nu> = 0"
11.279 +lemma (in sigma_finite_measure) KL_same_eq_0: "KL_divergence b M M = 0"
11.280 proof -
11.281 - have "AE x. 1 = RN_deriv M \<nu> x"
11.282 + have "AE x in M. 1 = RN_deriv M M x"
11.283 proof (rule RN_deriv_unique)
11.284 - show "measure_space (M\<lparr>measure := \<nu>\<rparr>)"
11.285 - using eq by (intro measure_space_cong) auto
11.286 - show "absolutely_continuous \<nu>"
11.287 - unfolding absolutely_continuous_def using eq by auto
11.288 - show "(\<lambda>x. 1) \<in> borel_measurable M" "AE x. 0 \<le> (1 :: ereal)" by auto
11.289 - fix A assume "A \<in> sets M"
11.290 - with eq show "\<nu> A = \<integral>\<^isup>+ x. 1 * indicator A x \<partial>M" by simp
11.291 + show "(\<lambda>x. 1) \<in> borel_measurable M" "AE x in M. 0 \<le> (1 :: ereal)" by auto
11.292 + show "density M (\<lambda>x. 1) = M"
11.293 + apply (auto intro!: measure_eqI emeasure_density)
11.294 + apply (subst emeasure_density)
11.295 + apply auto
11.296 + done
11.297 qed
11.298 - then have "AE x. log b (real (RN_deriv M \<nu> x)) = 0"
11.299 + then have "AE x in M. log b (real (RN_deriv M M x)) = 0"
11.300 by (elim AE_mp) simp
11.301 from integral_cong_AE[OF this]
11.302 - have "integral\<^isup>L M (entropy_density b M \<nu>) = 0"
11.303 + have "integral\<^isup>L M (entropy_density b M M) = 0"
11.304 by (simp add: entropy_density_def comp_def)
11.305 - with eq show "KL_divergence b M \<nu> = 0"
11.306 + then show "KL_divergence b M M = 0"
11.307 unfolding KL_divergence_def
11.308 - by (subst integral_cong_measure) auto
11.309 + by auto
11.310 qed
11.311
11.312 -lemma (in information_space) KL_eq_0_imp:
11.313 - assumes ps: "prob_space (M\<lparr>measure := \<nu>\<rparr>)"
11.314 - assumes ac: "absolutely_continuous \<nu>"
11.315 - assumes int: "integrable (M\<lparr> measure := \<nu> \<rparr>) (entropy_density b M \<nu>)"
11.316 - assumes KL: "KL_divergence b M \<nu> = 0"
11.317 - shows "\<forall>A\<in>sets M. \<nu> A = \<mu> A"
11.318 - by (metis less_imp_neq KL_gt_0 assms)
11.319 +lemma (in information_space) KL_eq_0_iff_eq:
11.320 + fixes D :: "'a \<Rightarrow> real"
11.321 + assumes "prob_space (density M D)"
11.322 + assumes D: "D \<in> borel_measurable M" "AE x in M. 0 \<le> D x"
11.323 + assumes int: "integrable M (\<lambda>x. D x * log b (D x))"
11.324 + shows "KL_divergence b M (density M D) = 0 \<longleftrightarrow> density M D = M"
11.325 + using KL_same_eq_0[of b] KL_gt_0[OF assms]
11.326 + by (auto simp: less_le)
11.327
11.328 -lemma (in information_space) KL_ge_0:
11.329 - assumes ps: "prob_space (M\<lparr>measure := \<nu>\<rparr>)"
11.330 - assumes ac: "absolutely_continuous \<nu>"
11.331 - assumes int: "integrable (M\<lparr> measure := \<nu> \<rparr>) (entropy_density b M \<nu>)"
11.332 - shows "0 \<le> KL_divergence b M \<nu>"
11.333 - using KL_eq_0 KL_gt_0[OF ps ac int]
11.334 - by (cases "\<forall>A\<in>sets M. \<nu> A = measure M A") (auto simp: le_less)
11.335 +lemma (in information_space) KL_eq_0_iff_eq_ac:
11.336 + fixes D :: "'a \<Rightarrow> real"
11.337 + assumes "prob_space N"
11.338 + assumes ac: "absolutely_continuous M N" "sets N = sets M"
11.339 + assumes int: "integrable N (entropy_density b M N)"
11.340 + shows "KL_divergence b M N = 0 \<longleftrightarrow> N = M"
11.341 +proof -
11.342 + interpret N: prob_space N by fact
11.343 + have "finite_measure N" by unfold_locales
11.344 + from real_RN_deriv[OF this ac] guess D . note D = this
11.345 +
11.346 + have "N = density M (RN_deriv M N)"
11.347 + using ac by (rule density_RN_deriv[symmetric])
11.348 + also have "\<dots> = density M D"
11.349 + using borel_measurable_RN_deriv[OF ac] D by (auto intro!: density_cong)
11.350 + finally have N: "N = density M D" .
11.351
11.352 -
11.353 -lemma (in sigma_finite_measure) KL_divergence_vimage:
11.354 - assumes T: "T \<in> measure_preserving M M'"
11.355 - and T': "T' \<in> measure_preserving (M'\<lparr> measure := \<nu>' \<rparr>) (M\<lparr> measure := \<nu> \<rparr>)"
11.356 - and inv: "\<And>x. x \<in> space M \<Longrightarrow> T' (T x) = x"
11.357 - and inv': "\<And>x. x \<in> space M' \<Longrightarrow> T (T' x) = x"
11.358 - and \<nu>': "measure_space (M'\<lparr>measure := \<nu>'\<rparr>)" "measure_space.absolutely_continuous M' \<nu>'"
11.359 - and "1 < b"
11.360 - shows "KL_divergence b M' \<nu>' = KL_divergence b M \<nu>"
11.361 -proof -
11.362 - interpret \<nu>': measure_space "M'\<lparr>measure := \<nu>'\<rparr>" by fact
11.363 - have M: "measure_space (M\<lparr> measure := \<nu>\<rparr>)"
11.364 - by (rule \<nu>'.measure_space_vimage[OF _ T'], simp) default
11.365 - have "sigma_algebra (M'\<lparr> measure := \<nu>'\<rparr>)" by default
11.366 - then have saM': "sigma_algebra M'" by simp
11.367 - then interpret M': measure_space M' by (rule measure_space_vimage) fact
11.368 - have ac: "absolutely_continuous \<nu>" unfolding absolutely_continuous_def
11.369 - proof safe
11.370 - fix N assume N: "N \<in> sets M" and N_0: "\<mu> N = 0"
11.371 - then have N': "T' -` N \<inter> space M' \<in> sets M'"
11.372 - using T' by (auto simp: measurable_def measure_preserving_def)
11.373 - have "T -` (T' -` N \<inter> space M') \<inter> space M = N"
11.374 - using inv T N sets_into_space[OF N] by (auto simp: measurable_def measure_preserving_def)
11.375 - then have "measure M' (T' -` N \<inter> space M') = 0"
11.376 - using measure_preservingD[OF T N'] N_0 by auto
11.377 - with \<nu>'(2) N' show "\<nu> N = 0" using measure_preservingD[OF T', of N] N
11.378 - unfolding M'.absolutely_continuous_def measurable_def by auto
11.379 - qed
11.380 -
11.381 - have sa: "sigma_algebra (M\<lparr>measure := \<nu>\<rparr>)" by simp default
11.382 - have AE: "AE x. RN_deriv M' \<nu>' (T x) = RN_deriv M \<nu> x"
11.383 - by (rule RN_deriv_vimage[OF T T' inv \<nu>'])
11.384 - show ?thesis
11.385 - unfolding KL_divergence_def entropy_density_def comp_def
11.386 - proof (subst \<nu>'.integral_vimage[OF sa T'])
11.387 - show "(\<lambda>x. log b (real (RN_deriv M \<nu> x))) \<in> borel_measurable (M\<lparr>measure := \<nu>\<rparr>)"
11.388 - by (auto intro!: RN_deriv[OF M ac] borel_measurable_log[OF _ `1 < b`])
11.389 - have "(\<integral> x. log b (real (RN_deriv M' \<nu>' x)) \<partial>M'\<lparr>measure := \<nu>'\<rparr>) =
11.390 - (\<integral> x. log b (real (RN_deriv M' \<nu>' (T (T' x)))) \<partial>M'\<lparr>measure := \<nu>'\<rparr>)" (is "?l = _")
11.391 - using inv' by (auto intro!: \<nu>'.integral_cong)
11.392 - also have "\<dots> = (\<integral> x. log b (real (RN_deriv M \<nu> (T' x))) \<partial>M'\<lparr>measure := \<nu>'\<rparr>)" (is "_ = ?r")
11.393 - using M ac AE
11.394 - by (intro \<nu>'.integral_cong_AE \<nu>'.almost_everywhere_vimage[OF sa T'] absolutely_continuous_AE[OF M])
11.395 - (auto elim!: AE_mp)
11.396 - finally show "?l = ?r" .
11.397 - qed
11.398 + from absolutely_continuous_AE[OF ac(2,1) D(2)] D b_gt_1 ac measurable_entropy_density
11.399 + have "integrable N (\<lambda>x. log b (D x))"
11.400 + by (intro integrable_cong_AE[THEN iffD2, OF _ _ _ int])
11.401 + (auto simp: N entropy_density_def)
11.402 + with D b_gt_1 have "integrable M (\<lambda>x. D x * log b (D x))"
11.403 + by (subst integral_density(2)[symmetric]) (auto simp: N[symmetric] comp_def)
11.404 + with `prob_space N` D show ?thesis
11.405 + unfolding N
11.406 + by (intro KL_eq_0_iff_eq) auto
11.407 qed
11.408
11.409 -lemma (in sigma_finite_measure) KL_divergence_cong:
11.410 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)" (is "measure_space ?\<nu>")
11.411 - assumes [simp]: "sets N = sets M" "space N = space M"
11.412 - "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A"
11.413 - "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<nu>' A"
11.414 - shows "KL_divergence b M \<nu> = KL_divergence b N \<nu>'"
11.415 +lemma (in information_space) KL_nonneg:
11.416 + assumes "prob_space (density M D)"
11.417 + assumes D: "D \<in> borel_measurable M" "AE x in M. 0 \<le> D x"
11.418 + assumes int: "integrable M (\<lambda>x. D x * log b (D x))"
11.419 + shows "0 \<le> KL_divergence b M (density M D)"
11.420 + using KL_gt_0[OF assms] by (cases "density M D = M") (auto simp: KL_same_eq_0)
11.421 +
11.422 +lemma (in sigma_finite_measure) KL_density_density_nonneg:
11.423 + fixes f g :: "'a \<Rightarrow> real"
11.424 + assumes "1 < b"
11.425 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "prob_space (density M f)"
11.426 + assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" "prob_space (density M g)"
11.427 + assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0"
11.428 + assumes int: "integrable M (\<lambda>x. g x * log b (g x / f x))"
11.429 + shows "0 \<le> KL_divergence b (density M f) (density M g)"
11.430 proof -
11.431 - interpret \<nu>: measure_space ?\<nu> by fact
11.432 - have "KL_divergence b M \<nu> = \<integral>x. log b (real (RN_deriv N \<nu>' x)) \<partial>?\<nu>"
11.433 - by (simp cong: RN_deriv_cong \<nu>.integral_cong add: KL_divergence_def entropy_density_def)
11.434 - also have "\<dots> = KL_divergence b N \<nu>'"
11.435 - by (auto intro!: \<nu>.integral_cong_measure[symmetric] simp: KL_divergence_def entropy_density_def comp_def)
11.436 + interpret Mf: prob_space "density M f" by fact
11.437 + interpret Mf: information_space "density M f" b by default fact
11.438 + have eq: "density (density M f) (\<lambda>x. g x / f x) = density M g" (is "?DD = _")
11.439 + using f g ac by (subst density_density_divide) simp_all
11.440 +
11.441 + have "0 \<le> KL_divergence b (density M f) (density (density M f) (\<lambda>x. g x / f x))"
11.442 + proof (rule Mf.KL_nonneg)
11.443 + show "prob_space ?DD" unfolding eq by fact
11.444 + from f g show "(\<lambda>x. g x / f x) \<in> borel_measurable (density M f)"
11.445 + by auto
11.446 + show "AE x in density M f. 0 \<le> g x / f x"
11.447 + using f g by (auto simp: AE_density divide_nonneg_nonneg)
11.448 + show "integrable (density M f) (\<lambda>x. g x / f x * log b (g x / f x))"
11.449 + using `1 < b` f g ac
11.450 + by (subst integral_density)
11.451 + (auto intro!: integrable_cong_AE[THEN iffD2, OF _ _ _ int] measurable_If)
11.452 + qed
11.453 + also have "\<dots> = KL_divergence b (density M f) (density M g)"
11.454 + using f g ac by (subst density_density_divide) simp_all
11.455 finally show ?thesis .
11.456 qed
11.457
11.458 -lemma (in finite_measure_space) KL_divergence_eq_finite:
11.459 - assumes v: "finite_measure_space (M\<lparr>measure := \<nu>\<rparr>)"
11.460 - assumes ac: "absolutely_continuous \<nu>"
11.461 - shows "KL_divergence b M \<nu> = (\<Sum>x\<in>space M. real (\<nu> {x}) * log b (real (\<nu> {x}) / real (\<mu> {x})))" (is "_ = ?sum")
11.462 -proof (simp add: KL_divergence_def finite_measure_space.integral_finite_singleton[OF v] entropy_density_def)
11.463 - interpret v: finite_measure_space "M\<lparr>measure := \<nu>\<rparr>" by fact
11.464 - have ms: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" by default
11.465 - show "(\<Sum>x \<in> space M. log b (real (RN_deriv M \<nu> x)) * real (\<nu> {x})) = ?sum"
11.466 - using RN_deriv_finite_measure[OF ms ac]
11.467 - by (auto intro!: setsum_cong simp: field_simps)
11.468 -qed
11.469 -
11.470 -lemma (in finite_prob_space) KL_divergence_positive_finite:
11.471 - assumes v: "finite_prob_space (M\<lparr>measure := \<nu>\<rparr>)"
11.472 - assumes ac: "absolutely_continuous \<nu>"
11.473 - and "1 < b"
11.474 - shows "0 \<le> KL_divergence b M \<nu>"
11.475 -proof -
11.476 - interpret information_space M by default fact
11.477 - interpret v: finite_prob_space "M\<lparr>measure := \<nu>\<rparr>" by fact
11.478 - have ps: "prob_space (M\<lparr>measure := \<nu>\<rparr>)" by unfold_locales
11.479 - from KL_ge_0[OF this ac v.integral_finite_singleton(1)] show ?thesis .
11.480 -qed
11.481 -
11.482 subsection {* Mutual Information *}
11.483
11.484 definition (in prob_space)
11.485 "mutual_information b S T X Y =
11.486 - KL_divergence b (S\<lparr>measure := ereal\<circ>distribution X\<rparr> \<Otimes>\<^isub>M T\<lparr>measure := ereal\<circ>distribution Y\<rparr>)
11.487 - (ereal\<circ>joint_distribution X Y)"
11.488 + KL_divergence b (distr M S X \<Otimes>\<^isub>M distr M T Y) (distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)))"
11.489
11.490 -lemma (in information_space)
11.491 +lemma (in information_space) mutual_information_indep_vars:
11.492 fixes S T X Y
11.493 - defines "P \<equiv> S\<lparr>measure := ereal\<circ>distribution X\<rparr> \<Otimes>\<^isub>M T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
11.494 + defines "P \<equiv> distr M S X \<Otimes>\<^isub>M distr M T Y"
11.495 + defines "Q \<equiv> distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
11.496 shows "indep_var S X T Y \<longleftrightarrow>
11.497 (random_variable S X \<and> random_variable T Y \<and>
11.498 - measure_space.absolutely_continuous P (ereal\<circ>joint_distribution X Y) \<and>
11.499 - integrable (P\<lparr>measure := (ereal\<circ>joint_distribution X Y)\<rparr>)
11.500 - (entropy_density b P (ereal\<circ>joint_distribution X Y)) \<and>
11.501 - mutual_information b S T X Y = 0)"
11.502 + absolutely_continuous P Q \<and> integrable Q (entropy_density b P Q) \<and>
11.503 + mutual_information b S T X Y = 0)"
11.504 + unfolding indep_var_distribution_eq
11.505 proof safe
11.506 - assume indep: "indep_var S X T Y"
11.507 - then have "random_variable S X" "random_variable T Y"
11.508 - by (blast dest: indep_var_rv1 indep_var_rv2)+
11.509 - then show "sigma_algebra S" "X \<in> measurable M S" "sigma_algebra T" "Y \<in> measurable M T"
11.510 - by blast+
11.511 + assume rv: "random_variable S X" "random_variable T Y"
11.512
11.513 - interpret X: prob_space "S\<lparr>measure := ereal\<circ>distribution X\<rparr>"
11.514 - by (rule distribution_prob_space) fact
11.515 - interpret Y: prob_space "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
11.516 - by (rule distribution_prob_space) fact
11.517 - interpret XY: pair_prob_space "S\<lparr>measure := ereal\<circ>distribution X\<rparr>" "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>" by default
11.518 - interpret XY: information_space XY.P b by default (rule b_gt_1)
11.519 + interpret X: prob_space "distr M S X"
11.520 + by (rule prob_space_distr) fact
11.521 + interpret Y: prob_space "distr M T Y"
11.522 + by (rule prob_space_distr) fact
11.523 + interpret XY: pair_prob_space "distr M S X" "distr M T Y" by default
11.524 + interpret P: information_space P b unfolding P_def by default (rule b_gt_1)
11.525
11.526 - let ?J = "XY.P\<lparr> measure := (ereal\<circ>joint_distribution X Y) \<rparr>"
11.527 - { fix A assume "A \<in> sets XY.P"
11.528 - then have "ereal (joint_distribution X Y A) = XY.\<mu> A"
11.529 - using indep_var_distributionD[OF indep]
11.530 - by (simp add: XY.P.finite_measure_eq) }
11.531 - note j_eq = this
11.532 + interpret Q: prob_space Q unfolding Q_def
11.533 + by (rule prob_space_distr) (simp add: comp_def measurable_pair_iff rv)
11.534
11.535 - interpret J: prob_space ?J
11.536 - using j_eq by (intro XY.prob_space_cong) auto
11.537 + { assume "distr M S X \<Otimes>\<^isub>M distr M T Y = distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
11.538 + then have [simp]: "Q = P" unfolding Q_def P_def by simp
11.539
11.540 - have ac: "XY.absolutely_continuous (ereal\<circ>joint_distribution X Y)"
11.541 - by (simp add: XY.absolutely_continuous_def j_eq)
11.542 - then show "measure_space.absolutely_continuous P (ereal\<circ>joint_distribution X Y)"
11.543 - unfolding P_def .
11.544 + show ac: "absolutely_continuous P Q" by (simp add: absolutely_continuous_def)
11.545 + then have ed: "entropy_density b P Q \<in> borel_measurable P"
11.546 + by (rule P.measurable_entropy_density) simp
11.547
11.548 - have ed: "entropy_density b XY.P (ereal\<circ>joint_distribution X Y) \<in> borel_measurable XY.P"
11.549 - by (rule XY.measurable_entropy_density) (default | fact)+
11.550 + have "AE x in P. 1 = RN_deriv P Q x"
11.551 + proof (rule P.RN_deriv_unique)
11.552 + show "density P (\<lambda>x. 1) = Q"
11.553 + unfolding `Q = P` by (intro measure_eqI) (auto simp: emeasure_density)
11.554 + qed auto
11.555 + then have ae_0: "AE x in P. entropy_density b P Q x = 0"
11.556 + by eventually_elim (auto simp: entropy_density_def)
11.557 + then have "integrable P (entropy_density b P Q) \<longleftrightarrow> integrable Q (\<lambda>x. 0)"
11.558 + using ed unfolding `Q = P` by (intro integrable_cong_AE) auto
11.559 + then show "integrable Q (entropy_density b P Q)" by simp
11.560
11.561 - have "AE x in XY.P. 1 = RN_deriv XY.P (ereal\<circ>joint_distribution X Y) x"
11.562 - proof (rule XY.RN_deriv_unique[OF _ ac])
11.563 - show "measure_space ?J" by default
11.564 - fix A assume "A \<in> sets XY.P"
11.565 - then show "(ereal\<circ>joint_distribution X Y) A = (\<integral>\<^isup>+ x. 1 * indicator A x \<partial>XY.P)"
11.566 - by (simp add: j_eq)
11.567 - qed (insert XY.measurable_const[of 1 borel], auto)
11.568 - then have ae_XY: "AE x in XY.P. entropy_density b XY.P (ereal\<circ>joint_distribution X Y) x = 0"
11.569 - by (elim XY.AE_mp) (simp add: entropy_density_def)
11.570 - have ae_J: "AE x in ?J. entropy_density b XY.P (ereal\<circ>joint_distribution X Y) x = 0"
11.571 - proof (rule XY.absolutely_continuous_AE)
11.572 - show "measure_space ?J" by default
11.573 - show "XY.absolutely_continuous (measure ?J)"
11.574 - using ac by simp
11.575 - qed (insert ae_XY, simp_all)
11.576 - then show "integrable (P\<lparr>measure := (ereal\<circ>joint_distribution X Y)\<rparr>)
11.577 - (entropy_density b P (ereal\<circ>joint_distribution X Y))"
11.578 - unfolding P_def
11.579 - using ed XY.measurable_const[of 0 borel]
11.580 - by (subst J.integrable_cong_AE) auto
11.581 + show "mutual_information b S T X Y = 0"
11.582 + unfolding mutual_information_def KL_divergence_def P_def[symmetric] Q_def[symmetric] `Q = P`
11.583 + using ae_0 by (simp cong: integral_cong_AE) }
11.584
11.585 - show "mutual_information b S T X Y = 0"
11.586 - unfolding mutual_information_def KL_divergence_def P_def
11.587 - by (subst J.integral_cong_AE[OF ae_J]) simp
11.588 -next
11.589 - assume "sigma_algebra S" "X \<in> measurable M S" "sigma_algebra T" "Y \<in> measurable M T"
11.590 - then have rvs: "random_variable S X" "random_variable T Y" by blast+
11.591 + { assume ac: "absolutely_continuous P Q"
11.592 + assume int: "integrable Q (entropy_density b P Q)"
11.593 + assume I_eq_0: "mutual_information b S T X Y = 0"
11.594
11.595 - interpret X: prob_space "S\<lparr>measure := ereal\<circ>distribution X\<rparr>"
11.596 - by (rule distribution_prob_space) fact
11.597 - interpret Y: prob_space "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
11.598 - by (rule distribution_prob_space) fact
11.599 - interpret XY: pair_prob_space "S\<lparr>measure := ereal\<circ>distribution X\<rparr>" "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>" by default
11.600 - interpret XY: information_space XY.P b by default (rule b_gt_1)
11.601 -
11.602 - let ?J = "XY.P\<lparr> measure := (ereal\<circ>joint_distribution X Y) \<rparr>"
11.603 - interpret J: prob_space ?J
11.604 - using rvs by (intro joint_distribution_prob_space) auto
11.605 -
11.606 - assume ac: "measure_space.absolutely_continuous P (ereal\<circ>joint_distribution X Y)"
11.607 - assume int: "integrable (P\<lparr>measure := (ereal\<circ>joint_distribution X Y)\<rparr>)
11.608 - (entropy_density b P (ereal\<circ>joint_distribution X Y))"
11.609 - assume I_eq_0: "mutual_information b S T X Y = 0"
11.610 -
11.611 - have eq: "\<forall>A\<in>sets XY.P. (ereal \<circ> joint_distribution X Y) A = XY.\<mu> A"
11.612 - proof (rule XY.KL_eq_0_imp)
11.613 - show "prob_space ?J" by unfold_locales
11.614 - show "XY.absolutely_continuous (ereal\<circ>joint_distribution X Y)"
11.615 - using ac by (simp add: P_def)
11.616 - show "integrable ?J (entropy_density b XY.P (ereal\<circ>joint_distribution X Y))"
11.617 - using int by (simp add: P_def)
11.618 - show "KL_divergence b XY.P (ereal\<circ>joint_distribution X Y) = 0"
11.619 - using I_eq_0 unfolding mutual_information_def by (simp add: P_def)
11.620 - qed
11.621 -
11.622 - { fix S X assume "sigma_algebra S"
11.623 - interpret S: sigma_algebra S by fact
11.624 - have "Int_stable \<lparr>space = space M, sets = {X -` A \<inter> space M |A. A \<in> sets S}\<rparr>"
11.625 - proof (safe intro!: Int_stableI)
11.626 - fix A B assume "A \<in> sets S" "B \<in> sets S"
11.627 - then show "\<exists>C. (X -` A \<inter> space M) \<inter> (X -` B \<inter> space M) = (X -` C \<inter> space M) \<and> C \<in> sets S"
11.628 - by (intro exI[of _ "A \<inter> B"]) auto
11.629 - qed }
11.630 - note Int_stable = this
11.631 -
11.632 - show "indep_var S X T Y" unfolding indep_var_eq
11.633 - proof (intro conjI indep_set_sigma_sets Int_stable)
11.634 - show "indep_set {X -` A \<inter> space M |A. A \<in> sets S} {Y -` A \<inter> space M |A. A \<in> sets T}"
11.635 - proof (safe intro!: indep_setI)
11.636 - { fix A assume "A \<in> sets S" then show "X -` A \<inter> space M \<in> sets M"
11.637 - using `X \<in> measurable M S` by (auto intro: measurable_sets) }
11.638 - { fix A assume "A \<in> sets T" then show "Y -` A \<inter> space M \<in> sets M"
11.639 - using `Y \<in> measurable M T` by (auto intro: measurable_sets) }
11.640 - next
11.641 - fix A B assume ab: "A \<in> sets S" "B \<in> sets T"
11.642 - have "ereal (prob ((X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M))) =
11.643 - ereal (joint_distribution X Y (A \<times> B))"
11.644 - unfolding distribution_def
11.645 - by (intro arg_cong[where f="\<lambda>C. ereal (prob C)"]) auto
11.646 - also have "\<dots> = XY.\<mu> (A \<times> B)"
11.647 - using ab eq by (auto simp: XY.finite_measure_eq)
11.648 - also have "\<dots> = ereal (distribution X A) * ereal (distribution Y B)"
11.649 - using ab by (simp add: XY.pair_measure_times)
11.650 - finally show "prob ((X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M)) =
11.651 - prob (X -` A \<inter> space M) * prob (Y -` B \<inter> space M)"
11.652 - unfolding distribution_def by simp
11.653 + have eq: "Q = P"
11.654 + proof (rule P.KL_eq_0_iff_eq_ac[THEN iffD1])
11.655 + show "prob_space Q" by unfold_locales
11.656 + show "absolutely_continuous P Q" by fact
11.657 + show "integrable Q (entropy_density b P Q)" by fact
11.658 + show "sets Q = sets P" by (simp add: P_def Q_def sets_pair_measure)
11.659 + show "KL_divergence b P Q = 0"
11.660 + using I_eq_0 unfolding mutual_information_def by (simp add: P_def Q_def)
11.661 qed
11.662 - qed fact+
11.663 + then show "distr M S X \<Otimes>\<^isub>M distr M T Y = distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
11.664 + unfolding P_def Q_def .. }
11.665 qed
11.666
11.667 -lemma (in information_space) mutual_information_commute_generic:
11.668 - assumes X: "random_variable S X" and Y: "random_variable T Y"
11.669 - assumes ac: "measure_space.absolutely_continuous
11.670 - (S\<lparr>measure := ereal\<circ>distribution X\<rparr> \<Otimes>\<^isub>M T\<lparr>measure := ereal\<circ>distribution Y\<rparr>) (ereal\<circ>joint_distribution X Y)"
11.671 - shows "mutual_information b S T X Y = mutual_information b T S Y X"
11.672 -proof -
11.673 - let ?S = "S\<lparr>measure := ereal\<circ>distribution X\<rparr>" and ?T = "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
11.674 - interpret S: prob_space ?S using X by (rule distribution_prob_space)
11.675 - interpret T: prob_space ?T using Y by (rule distribution_prob_space)
11.676 - interpret P: pair_prob_space ?S ?T ..
11.677 - interpret Q: pair_prob_space ?T ?S ..
11.678 - show ?thesis
11.679 - unfolding mutual_information_def
11.680 - proof (intro Q.KL_divergence_vimage[OF Q.measure_preserving_swap _ _ _ _ ac b_gt_1])
11.681 - show "(\<lambda>(x,y). (y,x)) \<in> measure_preserving
11.682 - (P.P \<lparr> measure := ereal\<circ>joint_distribution X Y\<rparr>) (Q.P \<lparr> measure := ereal\<circ>joint_distribution Y X\<rparr>)"
11.683 - using X Y unfolding measurable_def
11.684 - unfolding measure_preserving_def using P.pair_sigma_algebra_swap_measurable
11.685 - by (auto simp add: space_pair_measure distribution_def intro!: arg_cong[where f=\<mu>'])
11.686 - have "prob_space (P.P\<lparr> measure := ereal\<circ>joint_distribution X Y\<rparr>)"
11.687 - using X Y by (auto intro!: distribution_prob_space random_variable_pairI)
11.688 - then show "measure_space (P.P\<lparr> measure := ereal\<circ>joint_distribution X Y\<rparr>)"
11.689 - unfolding prob_space_def finite_measure_def sigma_finite_measure_def by simp
11.690 - qed auto
11.691 -qed
11.692 -
11.693 -definition (in prob_space)
11.694 - "entropy b s X = mutual_information b s s X X"
11.695 -
11.696 abbreviation (in information_space)
11.697 mutual_information_Pow ("\<I>'(_ ; _')") where
11.698 - "\<I>(X ; Y) \<equiv> mutual_information b
11.699 - \<lparr> space = X`space M, sets = Pow (X`space M), measure = ereal\<circ>distribution X \<rparr>
11.700 - \<lparr> space = Y`space M, sets = Pow (Y`space M), measure = ereal\<circ>distribution Y \<rparr> X Y"
11.701 + "\<I>(X ; Y) \<equiv> mutual_information b (count_space (X`space M)) (count_space (Y`space M)) X Y"
11.702
11.703 -lemma (in prob_space) finite_variables_absolutely_continuous:
11.704 - assumes X: "finite_random_variable S X" and Y: "finite_random_variable T Y"
11.705 - shows "measure_space.absolutely_continuous
11.706 - (S\<lparr>measure := ereal\<circ>distribution X\<rparr> \<Otimes>\<^isub>M T\<lparr>measure := ereal\<circ>distribution Y\<rparr>)
11.707 - (ereal\<circ>joint_distribution X Y)"
11.708 +lemma (in information_space)
11.709 + fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"
11.710 + assumes "sigma_finite_measure S" "sigma_finite_measure T"
11.711 + assumes Px: "distributed M S X Px" and Py: "distributed M T Y Py"
11.712 + assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy"
11.713 + defines "f \<equiv> \<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))"
11.714 + shows mutual_information_distr: "mutual_information b S T X Y = integral\<^isup>L (S \<Otimes>\<^isub>M T) f" (is "?M = ?R")
11.715 + and mutual_information_nonneg: "integrable (S \<Otimes>\<^isub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y"
11.716 proof -
11.717 - interpret X: finite_prob_space "S\<lparr>measure := ereal\<circ>distribution X\<rparr>"
11.718 - using X by (rule distribution_finite_prob_space)
11.719 - interpret Y: finite_prob_space "T\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
11.720 - using Y by (rule distribution_finite_prob_space)
11.721 - interpret XY: pair_finite_prob_space
11.722 - "S\<lparr>measure := ereal\<circ>distribution X\<rparr>" "T\<lparr> measure := ereal\<circ>distribution Y\<rparr>" by default
11.723 - interpret P: finite_prob_space "XY.P\<lparr> measure := ereal\<circ>joint_distribution X Y\<rparr>"
11.724 - using assms by (auto intro!: joint_distribution_finite_prob_space)
11.725 - note rv = assms[THEN finite_random_variableD]
11.726 - show "XY.absolutely_continuous (ereal\<circ>joint_distribution X Y)"
11.727 - proof (rule XY.absolutely_continuousI)
11.728 - show "finite_measure_space (XY.P\<lparr> measure := ereal\<circ>joint_distribution X Y\<rparr>)" by unfold_locales
11.729 - fix x assume "x \<in> space XY.P" and "XY.\<mu> {x} = 0"
11.730 - then obtain a b where "x = (a, b)"
11.731 - and "distribution X {a} = 0 \<or> distribution Y {b} = 0"
11.732 - by (cases x) (auto simp: space_pair_measure)
11.733 - with finite_distribution_order(5,6)[OF X Y]
11.734 - show "(ereal \<circ> joint_distribution X Y) {x} = 0" by auto
11.735 + have X: "random_variable S X"
11.736 + using Px by (auto simp: distributed_def)
11.737 + have Y: "random_variable T Y"
11.738 + using Py by (auto simp: distributed_def)
11.739 + interpret S: sigma_finite_measure S by fact
11.740 + interpret T: sigma_finite_measure T by fact
11.741 + interpret ST: pair_sigma_finite S T ..
11.742 + interpret X: prob_space "distr M S X" using X by (rule prob_space_distr)
11.743 + interpret Y: prob_space "distr M T Y" using Y by (rule prob_space_distr)
11.744 + interpret XY: pair_prob_space "distr M S X" "distr M T Y" ..
11.745 + let ?P = "S \<Otimes>\<^isub>M T"
11.746 + let ?D = "distr M ?P (\<lambda>x. (X x, Y x))"
11.747 +
11.748 + { fix A assume "A \<in> sets S"
11.749 + with X Y have "emeasure (distr M S X) A = emeasure ?D (A \<times> space T)"
11.750 + by (auto simp: emeasure_distr measurable_Pair measurable_space
11.751 + intro!: arg_cong[where f="emeasure M"]) }
11.752 + note marginal_eq1 = this
11.753 + { fix A assume "A \<in> sets T"
11.754 + with X Y have "emeasure (distr M T Y) A = emeasure ?D (space S \<times> A)"
11.755 + by (auto simp: emeasure_distr measurable_Pair measurable_space
11.756 + intro!: arg_cong[where f="emeasure M"]) }
11.757 + note marginal_eq2 = this
11.758 +
11.759 + have eq: "(\<lambda>x. ereal (Px (fst x) * Py (snd x))) = (\<lambda>(x, y). ereal (Px x) * ereal (Py y))"
11.760 + by auto
11.761 +
11.762 + have distr_eq: "distr M S X \<Otimes>\<^isub>M distr M T Y = density ?P (\<lambda>x. ereal (Px (fst x) * Py (snd x)))"
11.763 + unfolding Px(1)[THEN distributed_distr_eq_density] Py(1)[THEN distributed_distr_eq_density] eq
11.764 + proof (subst pair_measure_density)
11.765 + show "(\<lambda>x. ereal (Px x)) \<in> borel_measurable S" "(\<lambda>y. ereal (Py y)) \<in> borel_measurable T"
11.766 + "AE x in S. 0 \<le> ereal (Px x)" "AE y in T. 0 \<le> ereal (Py y)"
11.767 + using Px Py by (auto simp: distributed_def)
11.768 + show "sigma_finite_measure (density S Px)" unfolding Px(1)[THEN distributed_distr_eq_density, symmetric] ..
11.769 + show "sigma_finite_measure (density T Py)" unfolding Py(1)[THEN distributed_distr_eq_density, symmetric] ..
11.770 + qed (fact | simp)+
11.771 +
11.772 + have M: "?M = KL_divergence b (density ?P (\<lambda>x. ereal (Px (fst x) * Py (snd x)))) (density ?P (\<lambda>x. ereal (Pxy x)))"
11.773 + unfolding mutual_information_def distr_eq Pxy(1)[THEN distributed_distr_eq_density] ..
11.774 +
11.775 + from Px Py have f: "(\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable ?P"
11.776 + by (intro borel_measurable_times) (auto intro: distributed_real_measurable measurable_fst'' measurable_snd'')
11.777 + have PxPy_nonneg: "AE x in ?P. 0 \<le> Px (fst x) * Py (snd x)"
11.778 + proof (rule ST.AE_pair_measure)
11.779 + show "{x \<in> space ?P. 0 \<le> Px (fst x) * Py (snd x)} \<in> sets ?P"
11.780 + using f by auto
11.781 + show "AE x in S. AE y in T. 0 \<le> Px (fst (x, y)) * Py (snd (x, y))"
11.782 + using Px Py by (auto simp: zero_le_mult_iff dest!: distributed_real_AE)
11.783 + qed
11.784 +
11.785 + have "(AE x in ?P. Px (fst x) = 0 \<longrightarrow> Pxy x = 0)"
11.786 + by (rule subdensity_real[OF measurable_fst Pxy Px]) auto
11.787 + moreover
11.788 + have "(AE x in ?P. Py (snd x) = 0 \<longrightarrow> Pxy x = 0)"
11.789 + by (rule subdensity_real[OF measurable_snd Pxy Py]) auto
11.790 + ultimately have ac: "AE x in ?P. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0"
11.791 + by eventually_elim auto
11.792 +
11.793 + show "?M = ?R"
11.794 + unfolding M f_def
11.795 + using b_gt_1 f PxPy_nonneg Pxy[THEN distributed_real_measurable] Pxy[THEN distributed_real_AE] ac
11.796 + by (rule ST.KL_density_density)
11.797 +
11.798 + assume int: "integrable (S \<Otimes>\<^isub>M T) f"
11.799 + show "0 \<le> ?M" unfolding M
11.800 + proof (rule ST.KL_density_density_nonneg
11.801 + [OF b_gt_1 f PxPy_nonneg _ Pxy[THEN distributed_real_measurable] Pxy[THEN distributed_real_AE] _ ac int[unfolded f_def]])
11.802 + show "prob_space (density (S \<Otimes>\<^isub>M T) (\<lambda>x. ereal (Pxy x))) "
11.803 + unfolding distributed_distr_eq_density[OF Pxy, symmetric]
11.804 + using distributed_measurable[OF Pxy] by (rule prob_space_distr)
11.805 + show "prob_space (density (S \<Otimes>\<^isub>M T) (\<lambda>x. ereal (Px (fst x) * Py (snd x))))"
11.806 + unfolding distr_eq[symmetric] by unfold_locales
11.807 qed
11.808 qed
11.809
11.810 lemma (in information_space)
11.811 - assumes MX: "finite_random_variable MX X"
11.812 - assumes MY: "finite_random_variable MY Y"
11.813 - shows mutual_information_generic_eq:
11.814 - "mutual_information b MX MY X Y = (\<Sum> (x,y) \<in> space MX \<times> space MY.
11.815 - joint_distribution X Y {(x,y)} *
11.816 - log b (joint_distribution X Y {(x,y)} /
11.817 - (distribution X {x} * distribution Y {y})))"
11.818 - (is ?sum)
11.819 - and mutual_information_positive_generic:
11.820 - "0 \<le> mutual_information b MX MY X Y" (is ?positive)
11.821 + fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"
11.822 + assumes "sigma_finite_measure S" "sigma_finite_measure T"
11.823 + assumes Px: "distributed M S X Px" and Py: "distributed M T Y Py"
11.824 + assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy"
11.825 + assumes ae: "AE x in S. AE y in T. Pxy (x, y) = Px x * Py y"
11.826 + shows mutual_information_eq_0: "mutual_information b S T X Y = 0"
11.827 proof -
11.828 - interpret X: finite_prob_space "MX\<lparr>measure := ereal\<circ>distribution X\<rparr>"
11.829 - using MX by (rule distribution_finite_prob_space)
11.830 - interpret Y: finite_prob_space "MY\<lparr>measure := ereal\<circ>distribution Y\<rparr>"
11.831 - using MY by (rule distribution_finite_prob_space)
11.832 - interpret XY: pair_finite_prob_space "MX\<lparr>measure := ereal\<circ>distribution X\<rparr>" "MY\<lparr>measure := ereal\<circ>distribution Y\<rparr>" by default
11.833 - interpret P: finite_prob_space "XY.P\<lparr>measure := ereal\<circ>joint_distribution X Y\<rparr>"
11.834 - using assms by (auto intro!: joint_distribution_finite_prob_space)
11.835 + interpret S: sigma_finite_measure S by fact
11.836 + interpret T: sigma_finite_measure T by fact
11.837 + interpret ST: pair_sigma_finite S T ..
11.838
11.839 - have P_ms: "finite_measure_space (XY.P\<lparr>measure := ereal\<circ>joint_distribution X Y\<rparr>)" by unfold_locales
11.840 - have P_ps: "finite_prob_space (XY.P\<lparr>measure := ereal\<circ>joint_distribution X Y\<rparr>)" by unfold_locales
11.841 -
11.842 - show ?sum
11.843 - unfolding Let_def mutual_information_def
11.844 - by (subst XY.KL_divergence_eq_finite[OF P_ms finite_variables_absolutely_continuous[OF MX MY]])
11.845 - (auto simp add: space_pair_measure setsum_cartesian_product')
11.846 -
11.847 - show ?positive
11.848 - using XY.KL_divergence_positive_finite[OF P_ps finite_variables_absolutely_continuous[OF MX MY] b_gt_1]
11.849 - unfolding mutual_information_def .
11.850 + have "AE x in S \<Otimes>\<^isub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0"
11.851 + by (rule subdensity_real[OF measurable_fst Pxy Px]) auto
11.852 + moreover
11.853 + have "AE x in S \<Otimes>\<^isub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0"
11.854 + by (rule subdensity_real[OF measurable_snd Pxy Py]) auto
11.855 + moreover
11.856 + have "AE x in S \<Otimes>\<^isub>M T. Pxy x = Px (fst x) * Py (snd x)"
11.857 + using distributed_real_measurable[OF Px] distributed_real_measurable[OF Py] distributed_real_measurable[OF Pxy]
11.858 + by (intro ST.AE_pair_measure) (auto simp: ae intro!: measurable_snd'' measurable_fst'')
11.859 + ultimately have "AE x in S \<Otimes>\<^isub>M T. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))) = 0"
11.860 + by eventually_elim simp
11.861 + then have "(\<integral>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))) \<partial>(S \<Otimes>\<^isub>M T)) = (\<integral>x. 0 \<partial>(S \<Otimes>\<^isub>M T))"
11.862 + by (rule integral_cong_AE)
11.863 + then show ?thesis
11.864 + by (subst mutual_information_distr[OF assms(1-5)]) simp
11.865 qed
11.866
11.867 -lemma (in information_space) mutual_information_commute:
11.868 - assumes X: "finite_random_variable S X" and Y: "finite_random_variable T Y"
11.869 - shows "mutual_information b S T X Y = mutual_information b T S Y X"
11.870 - unfolding mutual_information_generic_eq[OF X Y] mutual_information_generic_eq[OF Y X]
11.871 - unfolding joint_distribution_commute_singleton[of X Y]
11.872 - by (auto simp add: ac_simps intro!: setsum_reindex_cong[OF swap_inj_on])
11.873 +lemma (in information_space) mutual_information_simple_distributed:
11.874 + assumes X: "simple_distributed M X Px" and Y: "simple_distributed M Y Py"
11.875 + assumes XY: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"
11.876 + shows "\<I>(X ; Y) = (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x))`space M. Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y)))"
11.877 +proof (subst mutual_information_distr[OF _ _ simple_distributed[OF X] simple_distributed[OF Y] simple_distributed_joint[OF XY]])
11.878 + note fin = simple_distributed_joint_finite[OF XY, simp]
11.879 + show "sigma_finite_measure (count_space (X ` space M))"
11.880 + by (simp add: sigma_finite_measure_count_space_finite)
11.881 + show "sigma_finite_measure (count_space (Y ` space M))"
11.882 + by (simp add: sigma_finite_measure_count_space_finite)
11.883 + let ?Pxy = "\<lambda>x. (if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x else 0)"
11.884 + let ?f = "\<lambda>x. ?Pxy x * log b (?Pxy x / (Px (fst x) * Py (snd x)))"
11.885 + have "\<And>x. ?f x = (if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))) else 0)"
11.886 + by auto
11.887 + with fin show "(\<integral> x. ?f x \<partial>(count_space (X ` space M) \<Otimes>\<^isub>M count_space (Y ` space M))) =
11.888 + (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y)))"
11.889 + by (auto simp add: pair_measure_count_space lebesgue_integral_count_space_finite setsum_cases split_beta'
11.890 + intro!: setsum_cong)
11.891 +qed
11.892
11.893 -lemma (in information_space) mutual_information_commute_simple:
11.894 - assumes X: "simple_function M X" and Y: "simple_function M Y"
11.895 - shows "\<I>(X;Y) = \<I>(Y;X)"
11.896 - by (intro mutual_information_commute X Y simple_function_imp_finite_random_variable)
11.897 -
11.898 -lemma (in information_space) mutual_information_eq:
11.899 - assumes "simple_function M X" "simple_function M Y"
11.900 - shows "\<I>(X;Y) = (\<Sum> (x,y) \<in> X ` space M \<times> Y ` space M.
11.901 - distribution (\<lambda>x. (X x, Y x)) {(x,y)} * log b (distribution (\<lambda>x. (X x, Y x)) {(x,y)} /
11.902 - (distribution X {x} * distribution Y {y})))"
11.903 - using assms by (simp add: mutual_information_generic_eq)
11.904 -
11.905 -lemma (in information_space) mutual_information_generic_cong:
11.906 - assumes X: "\<And>x. x \<in> space M \<Longrightarrow> X x = X' x"
11.907 - assumes Y: "\<And>x. x \<in> space M \<Longrightarrow> Y x = Y' x"
11.908 - shows "mutual_information b MX MY X Y = mutual_information b MX MY X' Y'"
11.909 - unfolding mutual_information_def using X Y
11.910 - by (simp cong: distribution_cong)
11.911 -
11.912 -lemma (in information_space) mutual_information_cong:
11.913 - assumes X: "\<And>x. x \<in> space M \<Longrightarrow> X x = X' x"
11.914 - assumes Y: "\<And>x. x \<in> space M \<Longrightarrow> Y x = Y' x"
11.915 - shows "\<I>(X; Y) = \<I>(X'; Y')"
11.916 - unfolding mutual_information_def using X Y
11.917 - by (simp cong: distribution_cong image_cong)
11.918 -
11.919 -lemma (in information_space) mutual_information_positive:
11.920 - assumes "simple_function M X" "simple_function M Y"
11.921 - shows "0 \<le> \<I>(X;Y)"
11.922 - using assms by (simp add: mutual_information_positive_generic)
11.923 +lemma (in information_space)
11.924 + fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"
11.925 + assumes Px: "simple_distributed M X Px" and Py: "simple_distributed M Y Py"
11.926 + assumes Pxy: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"
11.927 + assumes ae: "\<forall>x\<in>space M. Pxy (X x, Y x) = Px (X x) * Py (Y x)"
11.928 + shows mutual_information_eq_0_simple: "\<I>(X ; Y) = 0"
11.929 +proof (subst mutual_information_simple_distributed[OF Px Py Pxy])
11.930 + have "(\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y))) =
11.931 + (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. 0)"
11.932 + by (intro setsum_cong) (auto simp: ae)
11.933 + then show "(\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M.
11.934 + Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y))) = 0" by simp
11.935 +qed
11.936
11.937 subsection {* Entropy *}
11.938
11.939 +definition (in prob_space) entropy :: "real \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> real" where
11.940 + "entropy b S X = - KL_divergence b S (distr M S X)"
11.941 +
11.942 abbreviation (in information_space)
11.943 entropy_Pow ("\<H>'(_')") where
11.944 - "\<H>(X) \<equiv> entropy b \<lparr> space = X`space M, sets = Pow (X`space M), measure = ereal\<circ>distribution X \<rparr> X"
11.945 + "\<H>(X) \<equiv> entropy b (count_space (X`space M)) X"
11.946
11.947 -lemma (in information_space) entropy_generic_eq:
11.948 - fixes X :: "'a \<Rightarrow> 'c"
11.949 - assumes MX: "finite_random_variable MX X"
11.950 - shows "entropy b MX X = -(\<Sum> x \<in> space MX. distribution X {x} * log b (distribution X {x}))"
11.951 +lemma (in information_space) entropy_distr:
11.952 + fixes X :: "'a \<Rightarrow> 'b"
11.953 + assumes "sigma_finite_measure MX" and X: "distributed M MX X f"
11.954 + shows "entropy b MX X = - (\<integral>x. f x * log b (f x) \<partial>MX)"
11.955 proof -
11.956 - interpret MX: finite_prob_space "MX\<lparr>measure := ereal\<circ>distribution X\<rparr>"
11.957 - using MX by (rule distribution_finite_prob_space)
11.958 - let ?X = "\<lambda>x. distribution X {x}"
11.959 - let ?XX = "\<lambda>x y. joint_distribution X X {(x, y)}"
11.960 -
11.961 - { fix x y :: 'c
11.962 - { assume "x \<noteq> y"
11.963 - then have "(\<lambda>x. (X x, X x)) -` {(x,y)} \<inter> space M = {}" by auto
11.964 - then have "joint_distribution X X {(x, y)} = 0" by (simp add: distribution_def) }
11.965 - then have "?XX x y * log b (?XX x y / (?X x * ?X y)) =
11.966 - (if x = y then - ?X y * log b (?X y) else 0)"
11.967 - by (auto simp: log_simps zero_less_mult_iff) }
11.968 - note remove_XX = this
11.969 -
11.970 - show ?thesis
11.971 - unfolding entropy_def mutual_information_generic_eq[OF MX MX]
11.972 - unfolding setsum_cartesian_product[symmetric] setsum_negf[symmetric] remove_XX
11.973 - using MX.finite_space by (auto simp: setsum_cases)
11.974 + interpret MX: sigma_finite_measure MX by fact
11.975 + from X show ?thesis
11.976 + unfolding entropy_def X[THEN distributed_distr_eq_density]
11.977 + by (subst MX.KL_density[OF b_gt_1]) (simp_all add: distributed_real_AE distributed_real_measurable)
11.978 qed
11.979
11.980 -lemma (in information_space) entropy_eq:
11.981 - assumes "simple_function M X"
11.982 - shows "\<H>(X) = -(\<Sum> x \<in> X ` space M. distribution X {x} * log b (distribution X {x}))"
11.983 - using assms by (simp add: entropy_generic_eq)
11.984 +lemma (in information_space) entropy_uniform:
11.985 + assumes "sigma_finite_measure MX"
11.986 + assumes A: "A \<in> sets MX" "emeasure MX A \<noteq> 0" "emeasure MX A \<noteq> \<infinity>"
11.987 + assumes X: "distributed M MX X (\<lambda>x. 1 / measure MX A * indicator A x)"
11.988 + shows "entropy b MX X = log b (measure MX A)"
11.989 +proof (subst entropy_distr[OF _ X])
11.990 + let ?f = "\<lambda>x. 1 / measure MX A * indicator A x"
11.991 + have "- (\<integral>x. ?f x * log b (?f x) \<partial>MX) =
11.992 + - (\<integral>x. (log b (1 / measure MX A) / measure MX A) * indicator A x \<partial>MX)"
11.993 + by (auto intro!: integral_cong simp: indicator_def)
11.994 + also have "\<dots> = - log b (inverse (measure MX A))"
11.995 + using A by (subst integral_cmult(2))
11.996 + (simp_all add: measure_def real_of_ereal_eq_0 integral_cmult inverse_eq_divide)
11.997 + also have "\<dots> = log b (measure MX A)"
11.998 + using b_gt_1 A by (subst log_inverse) (auto simp add: measure_def less_le real_of_ereal_eq_0
11.999 + emeasure_nonneg real_of_ereal_pos)
11.1000 + finally show "- (\<integral>x. ?f x * log b (?f x) \<partial>MX) = log b (measure MX A)" by simp
11.1001 +qed fact+
11.1002
11.1003 -lemma (in information_space) entropy_positive:
11.1004 - "simple_function M X \<Longrightarrow> 0 \<le> \<H>(X)"
11.1005 - unfolding entropy_def by (simp add: mutual_information_positive)
11.1006 -
11.1007 -lemma (in information_space) entropy_certainty_eq_0:
11.1008 - assumes X: "simple_function M X" and "x \<in> X ` space M" and "distribution X {x} = 1"
11.1009 - shows "\<H>(X) = 0"
11.1010 -proof -
11.1011 - let ?X = "\<lparr> space = X ` space M, sets = Pow (X ` space M), measure = ereal\<circ>distribution X\<rparr>"
11.1012 - note simple_function_imp_finite_random_variable[OF `simple_function M X`]
11.1013 - from distribution_finite_prob_space[OF this, of "\<lparr> measure = ereal\<circ>distribution X \<rparr>"]
11.1014 - interpret X: finite_prob_space ?X by simp
11.1015 - have "distribution X (X ` space M - {x}) = distribution X (X ` space M) - distribution X {x}"
11.1016 - using X.measure_compl[of "{x}"] assms by auto
11.1017 - also have "\<dots> = 0" using X.prob_space assms by auto
11.1018 - finally have X0: "distribution X (X ` space M - {x}) = 0" by auto
11.1019 - { fix y assume *: "y \<in> X ` space M"
11.1020 - { assume asm: "y \<noteq> x"
11.1021 - with * have "{y} \<subseteq> X ` space M - {x}" by auto
11.1022 - from X.measure_mono[OF this] X0 asm *
11.1023 - have "distribution X {y} = 0" by (auto intro: antisym) }
11.1024 - then have "distribution X {y} = (if x = y then 1 else 0)"
11.1025 - using assms by auto }
11.1026 - note fi = this
11.1027 - have y: "\<And>y. (if x = y then 1 else 0) * log b (if x = y then 1 else 0) = 0" by simp
11.1028 - show ?thesis unfolding entropy_eq[OF `simple_function M X`] by (auto simp: y fi)
11.1029 +lemma (in information_space) entropy_simple_distributed:
11.1030 + fixes X :: "'a \<Rightarrow> 'b"
11.1031 + assumes X: "simple_distributed M X f"
11.1032 + shows "\<H>(X) = - (\<Sum>x\<in>X`space M. f x * log b (f x))"
11.1033 +proof (subst entropy_distr[OF _ simple_distributed[OF X]])
11.1034 + show "sigma_finite_measure (count_space (X ` space M))"
11.1035 + using X by (simp add: sigma_finite_measure_count_space_finite simple_distributed_def)
11.1036 + show "- (\<integral>x. f x * log b (f x) \<partial>(count_space (X`space M))) = - (\<Sum>x\<in>X ` space M. f x * log b (f x))"
11.1037 + using X by (auto simp add: lebesgue_integral_count_space_finite)
11.1038 qed
11.1039
11.1040 lemma (in information_space) entropy_le_card_not_0:
11.1041 - assumes X: "simple_function M X"
11.1042 - shows "\<H>(X) \<le> log b (card (X ` space M \<inter> {x. distribution X {x} \<noteq> 0}))"
11.1043 + assumes X: "simple_distributed M X f"
11.1044 + shows "\<H>(X) \<le> log b (card (X ` space M \<inter> {x. f x \<noteq> 0}))"
11.1045 proof -
11.1046 - let ?p = "\<lambda>x. distribution X {x}"
11.1047 - have "\<H>(X) = (\<Sum>x\<in>X`space M. ?p x * log b (1 / ?p x))"
11.1048 - unfolding entropy_eq[OF X] setsum_negf[symmetric]
11.1049 - by (auto intro!: setsum_cong simp: log_simps)
11.1050 - also have "\<dots> \<le> log b (\<Sum>x\<in>X`space M. ?p x * (1 / ?p x))"
11.1051 - using not_empty b_gt_1 `simple_function M X` sum_over_space_real_distribution[OF X]
11.1052 - by (intro log_setsum') (auto simp: simple_function_def)
11.1053 - also have "\<dots> = log b (\<Sum>x\<in>X`space M. if ?p x \<noteq> 0 then 1 else 0)"
11.1054 + have "\<H>(X) = (\<Sum>x\<in>X`space M. f x * log b (1 / f x))"
11.1055 + unfolding entropy_simple_distributed[OF X] setsum_negf[symmetric]
11.1056 + using X by (auto dest: simple_distributed_nonneg intro!: setsum_cong simp: log_simps less_le)
11.1057 + also have "\<dots> \<le> log b (\<Sum>x\<in>X`space M. f x * (1 / f x))"
11.1058 + using not_empty b_gt_1 `simple_distributed M X f`
11.1059 + by (intro log_setsum') (auto simp: simple_distributed_nonneg simple_distributed_setsum_space)
11.1060 + also have "\<dots> = log b (\<Sum>x\<in>X`space M. if f x \<noteq> 0 then 1 else 0)"
11.1061 by (intro arg_cong[where f="\<lambda>X. log b X"] setsum_cong) auto
11.1062 finally show ?thesis
11.1063 - using `simple_function M X` by (auto simp: setsum_cases real_eq_of_nat simple_function_def)
11.1064 -qed
11.1065 -
11.1066 -lemma (in prob_space) measure'_translate:
11.1067 - assumes X: "random_variable S X" and A: "A \<in> sets S"
11.1068 - shows "finite_measure.\<mu>' (S\<lparr> measure := ereal\<circ>distribution X \<rparr>) A = distribution X A"
11.1069 -proof -
11.1070 - interpret S: prob_space "S\<lparr> measure := ereal\<circ>distribution X \<rparr>"
11.1071 - using distribution_prob_space[OF X] .
11.1072 - from A show "S.\<mu>' A = distribution X A"
11.1073 - unfolding S.\<mu>'_def by (simp add: distribution_def [abs_def] \<mu>'_def)
11.1074 -qed
11.1075 -
11.1076 -lemma (in information_space) entropy_uniform_max:
11.1077 - assumes X: "simple_function M X"
11.1078 - assumes "\<And>x y. \<lbrakk> x \<in> X ` space M ; y \<in> X ` space M \<rbrakk> \<Longrightarrow> distribution X {x} = distribution X {y}"
11.1079 - shows "\<H>(X) = log b (real (card (X ` space M)))"
11.1080 -proof -
11.1081 - let ?X = "\<lparr> space = X ` space M, sets = Pow (X ` space M), measure = undefined\<rparr>\<lparr> measure := ereal\<circ>distribution X\<rparr>"
11.1082 - note frv = simple_function_imp_finite_random_variable[OF X]
11.1083 - from distribution_finite_prob_space[OF this, of "\<lparr> measure = ereal\<circ>distribution X \<rparr>"]
11.1084 - interpret X: finite_prob_space ?X by simp
11.1085 - note rv = finite_random_variableD[OF frv]
11.1086 - have card_gt0: "0 < card (X ` space M)" unfolding card_gt_0_iff
11.1087 - using `simple_function M X` not_empty by (auto simp: simple_function_def)
11.1088 - { fix x assume "x \<in> space ?X"
11.1089 - moreover then have "X.\<mu>' {x} = 1 / card (space ?X)"
11.1090 - proof (rule X.uniform_prob)
11.1091 - fix x y assume "x \<in> space ?X" "y \<in> space ?X"
11.1092 - with assms(2)[of x y] show "X.\<mu>' {x} = X.\<mu>' {y}"
11.1093 - by (subst (1 2) measure'_translate[OF rv]) auto
11.1094 - qed
11.1095 - ultimately have "distribution X {x} = 1 / card (space ?X)"
11.1096 - by (subst (asm) measure'_translate[OF rv]) auto }
11.1097 - thus ?thesis
11.1098 - using not_empty X.finite_space b_gt_1 card_gt0
11.1099 - by (simp add: entropy_eq[OF `simple_function M X`] real_eq_of_nat[symmetric] log_simps)
11.1100 + using `simple_distributed M X f` by (auto simp: setsum_cases real_eq_of_nat)
11.1101 qed
11.1102
11.1103 lemma (in information_space) entropy_le_card:
11.1104 - assumes "simple_function M X"
11.1105 + assumes "simple_distributed M X f"
11.1106 shows "\<H>(X) \<le> log b (real (card (X ` space M)))"
11.1107 proof cases
11.1108 - assume "X ` space M \<inter> {x. distribution X {x} \<noteq> 0} = {}"
11.1109 - then have "\<And>x. x\<in>X`space M \<Longrightarrow> distribution X {x} = 0" by auto
11.1110 + assume "X ` space M \<inter> {x. f x \<noteq> 0} = {}"
11.1111 + then have "\<And>x. x\<in>X`space M \<Longrightarrow> f x = 0" by auto
11.1112 moreover
11.1113 have "0 < card (X`space M)"
11.1114 - using `simple_function M X` not_empty
11.1115 - by (auto simp: card_gt_0_iff simple_function_def)
11.1116 + using `simple_distributed M X f` not_empty by (auto simp: card_gt_0_iff)
11.1117 then have "log b 1 \<le> log b (real (card (X`space M)))"
11.1118 using b_gt_1 by (intro log_le) auto
11.1119 - ultimately show ?thesis using assms by (simp add: entropy_eq)
11.1120 + ultimately show ?thesis using assms by (simp add: entropy_simple_distributed)
11.1121 next
11.1122 - assume False: "X ` space M \<inter> {x. distribution X {x} \<noteq> 0} \<noteq> {}"
11.1123 - have "card (X ` space M \<inter> {x. distribution X {x} \<noteq> 0}) \<le> card (X ` space M)"
11.1124 - (is "?A \<le> ?B") using assms not_empty by (auto intro!: card_mono simp: simple_function_def)
11.1125 + assume False: "X ` space M \<inter> {x. f x \<noteq> 0} \<noteq> {}"
11.1126 + have "card (X ` space M \<inter> {x. f x \<noteq> 0}) \<le> card (X ` space M)"
11.1127 + (is "?A \<le> ?B") using assms not_empty
11.1128 + by (auto intro!: card_mono simp: simple_function_def simple_distributed_def)
11.1129 note entropy_le_card_not_0[OF assms]
11.1130 also have "log b (real ?A) \<le> log b (real ?B)"
11.1131 using b_gt_1 False not_empty `?A \<le> ?B` assms
11.1132 - by (auto intro!: log_le simp: card_gt_0_iff simp: simple_function_def)
11.1133 + by (auto intro!: log_le simp: card_gt_0_iff simp: simple_distributed_def)
11.1134 finally show ?thesis .
11.1135 qed
11.1136
11.1137 -lemma (in information_space) entropy_commute:
11.1138 - assumes "simple_function M X" "simple_function M Y"
11.1139 - shows "\<H>(\<lambda>x. (X x, Y x)) = \<H>(\<lambda>x. (Y x, X x))"
11.1140 -proof -
11.1141 - have sf: "simple_function M (\<lambda>x. (X x, Y x))" "simple_function M (\<lambda>x. (Y x, X x))"
11.1142 - using assms by (auto intro: simple_function_Pair)
11.1143 - have *: "(\<lambda>x. (Y x, X x))`space M = (\<lambda>(a,b). (b,a))`(\<lambda>x. (X x, Y x))`space M"
11.1144 - by auto
11.1145 - have inj: "\<And>X. inj_on (\<lambda>(a,b). (b,a)) X"
11.1146 - by (auto intro!: inj_onI)
11.1147 - show ?thesis
11.1148 - unfolding sf[THEN entropy_eq] unfolding * setsum_reindex[OF inj]
11.1149 - by (simp add: joint_distribution_commute[of Y X] split_beta)
11.1150 -qed
11.1151 -
11.1152 -lemma (in information_space) entropy_eq_cartesian_product:
11.1153 - assumes "simple_function M X" "simple_function M Y"
11.1154 - shows "\<H>(\<lambda>x. (X x, Y x)) = -(\<Sum>x\<in>X`space M. \<Sum>y\<in>Y`space M.
11.1155 - joint_distribution X Y {(x,y)} * log b (joint_distribution X Y {(x,y)}))"
11.1156 -proof -
11.1157 - have sf: "simple_function M (\<lambda>x. (X x, Y x))"
11.1158 - using assms by (auto intro: simple_function_Pair)
11.1159 - { fix x assume "x\<notin>(\<lambda>x. (X x, Y x))`space M"
11.1160 - then have "(\<lambda>x. (X x, Y x)) -` {x} \<inter> space M = {}" by auto
11.1161 - then have "joint_distribution X Y {x} = 0"
11.1162 - unfolding distribution_def by auto }
11.1163 - then show ?thesis using sf assms
11.1164 - unfolding entropy_eq[OF sf] neg_equal_iff_equal setsum_cartesian_product
11.1165 - by (auto intro!: setsum_mono_zero_cong_left simp: simple_function_def)
11.1166 -qed
11.1167 -
11.1168 subsection {* Conditional Mutual Information *}
11.1169
11.1170 definition (in prob_space)
11.1171 @@ -917,489 +755,553 @@
11.1172 abbreviation (in information_space)
11.1173 conditional_mutual_information_Pow ("\<I>'( _ ; _ | _ ')") where
11.1174 "\<I>(X ; Y | Z) \<equiv> conditional_mutual_information b
11.1175 - \<lparr> space = X`space M, sets = Pow (X`space M), measure = ereal\<circ>distribution X \<rparr>
11.1176 - \<lparr> space = Y`space M, sets = Pow (Y`space M), measure = ereal\<circ>distribution Y \<rparr>
11.1177 - \<lparr> space = Z`space M, sets = Pow (Z`space M), measure = ereal\<circ>distribution Z \<rparr>
11.1178 - X Y Z"
11.1179 + (count_space (X ` space M)) (count_space (Y ` space M)) (count_space (Z ` space M)) X Y Z"
11.1180
11.1181 lemma (in information_space) conditional_mutual_information_generic_eq:
11.1182 - assumes MX: "finite_random_variable MX X"
11.1183 - and MY: "finite_random_variable MY Y"
11.1184 - and MZ: "finite_random_variable MZ Z"
11.1185 - shows "conditional_mutual_information b MX MY MZ X Y Z = (\<Sum>(x, y, z) \<in> space MX \<times> space MY \<times> space MZ.
11.1186 - distribution (\<lambda>x. (X x, Y x, Z x)) {(x, y, z)} *
11.1187 - log b (distribution (\<lambda>x. (X x, Y x, Z x)) {(x, y, z)} /
11.1188 - (joint_distribution X Z {(x, z)} * (joint_distribution Y Z {(y,z)} / distribution Z {z}))))"
11.1189 - (is "_ = (\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * log b (?XYZ x y z / (?XZ x z * (?YZ y z / ?Z z))))")
11.1190 + assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" and P: "sigma_finite_measure P"
11.1191 + assumes Px: "distributed M S X Px"
11.1192 + assumes Pz: "distributed M P Z Pz"
11.1193 + assumes Pyz: "distributed M (T \<Otimes>\<^isub>M P) (\<lambda>x. (Y x, Z x)) Pyz"
11.1194 + assumes Pxz: "distributed M (S \<Otimes>\<^isub>M P) (\<lambda>x. (X x, Z x)) Pxz"
11.1195 + assumes Pxyz: "distributed M (S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P) (\<lambda>x. (X x, Y x, Z x)) Pxyz"
11.1196 + assumes I1: "integrable (S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Px x * Pyz (y, z))))"
11.1197 + assumes I2: "integrable (S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxz (x, z) / (Px x * Pz z)))"
11.1198 + shows "conditional_mutual_information b S T P X Y Z
11.1199 + = (\<integral>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))) \<partial>(S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P))"
11.1200 proof -
11.1201 - let ?X = "\<lambda>x. distribution X {x}"
11.1202 - note finite_var = MX MY MZ
11.1203 - note YZ = finite_random_variable_pairI[OF finite_var(2,3)]
11.1204 - note XYZ = finite_random_variable_pairI[OF MX YZ]
11.1205 - note XZ = finite_random_variable_pairI[OF finite_var(1,3)]
11.1206 - note ZX = finite_random_variable_pairI[OF finite_var(3,1)]
11.1207 - note YZX = finite_random_variable_pairI[OF finite_var(2) ZX]
11.1208 - note order1 =
11.1209 - finite_distribution_order(5,6)[OF finite_var(1) YZ]
11.1210 - finite_distribution_order(5,6)[OF finite_var(1,3)]
11.1211 + interpret S: sigma_finite_measure S by fact
11.1212 + interpret T: sigma_finite_measure T by fact
11.1213 + interpret P: sigma_finite_measure P by fact
11.1214 + interpret TP: pair_sigma_finite T P ..
11.1215 + interpret SP: pair_sigma_finite S P ..
11.1216 + interpret SPT: pair_sigma_finite "S \<Otimes>\<^isub>M P" T ..
11.1217 + interpret STP: pair_sigma_finite S "T \<Otimes>\<^isub>M P" ..
11.1218 + have TP: "sigma_finite_measure (T \<Otimes>\<^isub>M P)" ..
11.1219 + have SP: "sigma_finite_measure (S \<Otimes>\<^isub>M P)" ..
11.1220 + have YZ: "random_variable (T \<Otimes>\<^isub>M P) (\<lambda>x. (Y x, Z x))"
11.1221 + using Pyz by (simp add: distributed_measurable)
11.1222
11.1223 - note random_var = finite_var[THEN finite_random_variableD]
11.1224 - note finite = finite_var(1) YZ finite_var(3) XZ YZX
11.1225 + have Pxyz_f: "\<And>M f. f \<in> measurable M (S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P) \<Longrightarrow> (\<lambda>x. Pxyz (f x)) \<in> borel_measurable M"
11.1226 + using measurable_comp[OF _ Pxyz[THEN distributed_real_measurable]] by (auto simp: comp_def)
11.1227
11.1228 - have order2: "\<And>x y z. \<lbrakk>x \<in> space MX; y \<in> space MY; z \<in> space MZ; joint_distribution X Z {(x, z)} = 0\<rbrakk>
11.1229 - \<Longrightarrow> joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)} = 0"
11.1230 - unfolding joint_distribution_commute_singleton[of X]
11.1231 - unfolding joint_distribution_assoc_singleton[symmetric]
11.1232 - using finite_distribution_order(6)[OF finite_var(2) ZX]
11.1233 - by auto
11.1234 + { fix f g h M
11.1235 + assume f: "f \<in> measurable M S" and g: "g \<in> measurable M P" and h: "h \<in> measurable M (S \<Otimes>\<^isub>M P)"
11.1236 + from measurable_comp[OF h Pxz[THEN distributed_real_measurable]]
11.1237 + measurable_comp[OF f Px[THEN distributed_real_measurable]]
11.1238 + measurable_comp[OF g Pz[THEN distributed_real_measurable]]
11.1239 + have "(\<lambda>x. log b (Pxz (h x) / (Px (f x) * Pz (g x)))) \<in> borel_measurable M"
11.1240 + by (simp add: comp_def b_gt_1) }
11.1241 + note borel_log = this
11.1242
11.1243 - have "(\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * log b (?XYZ x y z / (?XZ x z * (?YZ y z / ?Z z)))) =
11.1244 - (\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * (log b (?XYZ x y z / (?X x * ?YZ y z)) - log b (?XZ x z / (?X x * ?Z z))))"
11.1245 - (is "(\<Sum>(x, y, z)\<in>?S. ?L x y z) = (\<Sum>(x, y, z)\<in>?S. ?R x y z)")
11.1246 - proof (safe intro!: setsum_cong)
11.1247 - fix x y z assume space: "x \<in> space MX" "y \<in> space MY" "z \<in> space MZ"
11.1248 - show "?L x y z = ?R x y z"
11.1249 + have measurable_cut: "(\<lambda>(x, y, z). (x, z)) \<in> measurable (S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P) (S \<Otimes>\<^isub>M P)"
11.1250 + by (auto simp add: split_beta' comp_def intro!: measurable_Pair measurable_snd')
11.1251 +
11.1252 + from Pxz Pxyz have distr_eq: "distr M (S \<Otimes>\<^isub>M P) (\<lambda>x. (X x, Z x)) =
11.1253 + distr (distr M (S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P) (\<lambda>x. (X x, Y x, Z x))) (S \<Otimes>\<^isub>M P) (\<lambda>(x, y, z). (x, z))"
11.1254 + by (subst distr_distr[OF measurable_cut]) (auto dest: distributed_measurable simp: comp_def)
11.1255 +
11.1256 + have "mutual_information b S P X Z =
11.1257 + (\<integral>x. Pxz x * log b (Pxz x / (Px (fst x) * Pz (snd x))) \<partial>(S \<Otimes>\<^isub>M P))"
11.1258 + by (rule mutual_information_distr[OF S P Px Pz Pxz])
11.1259 + also have "\<dots> = (\<integral>(x,y,z). Pxyz (x,y,z) * log b (Pxz (x,z) / (Px x * Pz z)) \<partial>(S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P))"
11.1260 + using b_gt_1 Pxz Px Pz
11.1261 + by (subst distributed_transform_integral[OF Pxyz Pxz, where T="\<lambda>(x, y, z). (x, z)"])
11.1262 + (auto simp: split_beta' intro!: measurable_Pair measurable_snd' measurable_snd'' measurable_fst'' borel_measurable_times
11.1263 + dest!: distributed_real_measurable)
11.1264 + finally have mi_eq:
11.1265 + "mutual_information b S P X Z = (\<integral>(x,y,z). Pxyz (x,y,z) * log b (Pxz (x,z) / (Px x * Pz z)) \<partial>(S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P))" .
11.1266 +
11.1267 + have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. Px (fst x) = 0 \<longrightarrow> Pxyz x = 0"
11.1268 + by (intro subdensity_real[of fst, OF _ Pxyz Px]) auto
11.1269 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. Pz (snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"
11.1270 + by (intro subdensity_real[of "\<lambda>x. snd (snd x)", OF _ Pxyz Pz]) (auto intro: measurable_snd')
11.1271 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. Pxz (fst x, snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"
11.1272 + by (intro subdensity_real[of "\<lambda>x. (fst x, snd (snd x))", OF _ Pxyz Pxz]) (auto intro: measurable_Pair measurable_snd')
11.1273 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. Pyz (snd x) = 0 \<longrightarrow> Pxyz x = 0"
11.1274 + by (intro subdensity_real[of snd, OF _ Pxyz Pyz]) (auto intro: measurable_Pair)
11.1275 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. 0 \<le> Px (fst x)"
11.1276 + using Px by (intro STP.AE_pair_measure) (auto simp: comp_def intro!: measurable_fst'' dest: distributed_real_AE distributed_real_measurable)
11.1277 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. 0 \<le> Pyz (snd x)"
11.1278 + using Pyz by (intro STP.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'' dest: distributed_real_AE distributed_real_measurable)
11.1279 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. 0 \<le> Pz (snd (snd x))"
11.1280 + using Pz Pz[THEN distributed_real_measurable] by (auto intro!: measurable_snd'' TP.AE_pair_measure STP.AE_pair_measure AE_I2[of S] dest: distributed_real_AE)
11.1281 + moreover have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P. 0 \<le> Pxz (fst x, snd (snd x))"
11.1282 + using Pxz[THEN distributed_real_AE, THEN SP.AE_pair]
11.1283 + using measurable_comp[OF measurable_Pair[OF measurable_fst measurable_comp[OF measurable_snd measurable_snd]] Pxz[THEN distributed_real_measurable], of T]
11.1284 + using measurable_comp[OF measurable_snd measurable_Pair2[OF Pxz[THEN distributed_real_measurable]], of _ T]
11.1285 + by (auto intro!: TP.AE_pair_measure STP.AE_pair_measure simp: comp_def)
11.1286 + moreover note Pxyz[THEN distributed_real_AE]
11.1287 + ultimately have "AE x in S \<Otimes>\<^isub>M T \<Otimes>\<^isub>M P.
11.1288 + Pxyz x * log b (Pxyz x / (Px (fst x) * Pyz (snd x))) -
11.1289 + Pxyz x * log b (Pxz (fst x, snd (snd x)) / (Px (fst x) * Pz (snd (snd x)))) =
11.1290 + Pxyz x * log b (Pxyz x * Pz (snd (snd x)) / (Pxz (fst x, snd (snd x)) * Pyz (snd x))) "
11.1291 + proof eventually_elim
11.1292 + case (goal1 x)
11.1293 + show ?case
11.1294 proof cases
11.1295 - assume "?XYZ x y z \<noteq> 0"
11.1296 - with space have "0 < ?X x" "0 < ?Z z" "0 < ?XZ x z" "0 < ?YZ y z" "0 < ?XYZ x y z"
11.1297 - using order1 order2 by (auto simp: less_le)
11.1298 - with b_gt_1 show ?thesis
11.1299 - by (simp add: log_mult log_divide zero_less_mult_iff zero_less_divide_iff)
11.1300 + assume "Pxyz x \<noteq> 0"
11.1301 + with goal1 have "0 < Px (fst x)" "0 < Pz (snd (snd x))" "0 < Pxz (fst x, snd (snd x))" "0 < Pyz (snd x)" "0 < Pxyz x"
11.1302 + by auto
11.1303 + then show ?thesis
11.1304 + using b_gt_1 by (simp add: log_simps mult_pos_pos less_imp_le field_simps)
11.1305 qed simp
11.1306 qed
11.1307 - also have "\<dots> = (\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * log b (?XYZ x y z / (?X x * ?YZ y z))) -
11.1308 - (\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * log b (?XZ x z / (?X x * ?Z z)))"
11.1309 - by (auto simp add: setsum_subtractf[symmetric] field_simps intro!: setsum_cong)
11.1310 - also have "(\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * log b (?XZ x z / (?X x * ?Z z))) =
11.1311 - (\<Sum>(x, z)\<in>space MX \<times> space MZ. ?XZ x z * log b (?XZ x z / (?X x * ?Z z)))"
11.1312 - unfolding setsum_cartesian_product[symmetric] setsum_commute[of _ _ "space MY"]
11.1313 - setsum_left_distrib[symmetric]
11.1314 - unfolding joint_distribution_commute_singleton[of X]
11.1315 - unfolding joint_distribution_assoc_singleton[symmetric]
11.1316 - using setsum_joint_distribution_singleton[OF finite_var(2) ZX]
11.1317 - by (intro setsum_cong refl) (simp add: space_pair_measure)
11.1318 - also have "(\<Sum>(x, y, z)\<in>?S. ?XYZ x y z * log b (?XYZ x y z / (?X x * ?YZ y z))) -
11.1319 - (\<Sum>(x, z)\<in>space MX \<times> space MZ. ?XZ x z * log b (?XZ x z / (?X x * ?Z z))) =
11.1320 - conditional_mutual_information b MX MY MZ X Y Z"
11.1321 + with I1 I2 show ?thesis
11.1322 unfolding conditional_mutual_information_def
11.1323 - unfolding mutual_information_generic_eq[OF finite_var(1,3)]
11.1324 - unfolding mutual_information_generic_eq[OF finite_var(1) YZ]
11.1325 - by (simp add: space_sigma space_pair_measure setsum_cartesian_product')
11.1326 - finally show ?thesis by simp
11.1327 + apply (subst mi_eq)
11.1328 + apply (subst mutual_information_distr[OF S TP Px Pyz Pxyz])
11.1329 + apply (subst integral_diff(2)[symmetric])
11.1330 + apply (auto intro!: integral_cong_AE simp: split_beta' simp del: integral_diff)
11.1331 + done
11.1332 qed
11.1333
11.1334 lemma (in information_space) conditional_mutual_information_eq:
11.1335 - assumes "simple_function M X" "simple_function M Y" "simple_function M Z"
11.1336 - shows "\<I>(X;Y|Z) = (\<Sum>(x, y, z) \<in> X`space M \<times> Y`space M \<times> Z`space M.
11.1337 - distribution (\<lambda>x. (X x, Y x, Z x)) {(x, y, z)} *
11.1338 - log b (distribution (\<lambda>x. (X x, Y x, Z x)) {(x, y, z)} /
11.1339 - (joint_distribution X Z {(x, z)} * joint_distribution Y Z {(y,z)} / distribution Z {z})))"
11.1340 - by (subst conditional_mutual_information_generic_eq[OF assms[THEN simple_function_imp_finite_random_variable]])
11.1341 - simp
11.1342 + assumes Pz: "simple_distributed M Z Pz"
11.1343 + assumes Pyz: "simple_distributed M (\<lambda>x. (Y x, Z x)) Pyz"
11.1344 + assumes Pxz: "simple_distributed M (\<lambda>x. (X x, Z x)) Pxz"
11.1345 + assumes Pxyz: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Pxyz"
11.1346 + shows "\<I>(X ; Y | Z) =
11.1347 + (\<Sum>(x, y, z)\<in>(\<lambda>x. (X x, Y x, Z x))`space M. Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))"
11.1348 +proof (subst conditional_mutual_information_generic_eq[OF _ _ _ _
11.1349 + simple_distributed[OF Pz] simple_distributed_joint[OF Pyz] simple_distributed_joint[OF Pxz]
11.1350 + simple_distributed_joint2[OF Pxyz]])
11.1351 + note simple_distributed_joint2_finite[OF Pxyz, simp]
11.1352 + show "sigma_finite_measure (count_space (X ` space M))"
11.1353 + by (simp add: sigma_finite_measure_count_space_finite)
11.1354 + show "sigma_finite_measure (count_space (Y ` space M))"
11.1355 + by (simp add: sigma_finite_measure_count_space_finite)
11.1356 + show "sigma_finite_measure (count_space (Z ` space M))"
11.1357 + by (simp add: sigma_finite_measure_count_space_finite)
11.1358 + have "count_space (X ` space M) \<Otimes>\<^isub>M count_space (Y ` space M) \<Otimes>\<^isub>M count_space (Z ` space M) =
11.1359 + count_space (X`space M \<times> Y`space M \<times> Z`space M)"
11.1360 + (is "?P = ?C")
11.1361 + by (simp add: pair_measure_count_space)
11.1362
11.1363 -lemma (in information_space) conditional_mutual_information_eq_mutual_information:
11.1364 - assumes X: "simple_function M X" and Y: "simple_function M Y"
11.1365 - shows "\<I>(X ; Y) = \<I>(X ; Y | (\<lambda>x. ()))"
11.1366 -proof -
11.1367 - have [simp]: "(\<lambda>x. ()) ` space M = {()}" using not_empty by auto
11.1368 - have C: "simple_function M (\<lambda>x. ())" by auto
11.1369 - show ?thesis
11.1370 - unfolding conditional_mutual_information_eq[OF X Y C]
11.1371 - unfolding mutual_information_eq[OF X Y]
11.1372 - by (simp add: setsum_cartesian_product' distribution_remove_const)
11.1373 + let ?Px = "\<lambda>x. measure M (X -` {x} \<inter> space M)"
11.1374 + have "(\<lambda>x. (X x, Z x)) \<in> measurable M (count_space (X ` space M) \<Otimes>\<^isub>M count_space (Z ` space M))"
11.1375 + using simple_distributed_joint[OF Pxz] by (rule distributed_measurable)
11.1376 + from measurable_comp[OF this measurable_fst]
11.1377 + have "random_variable (count_space (X ` space M)) X"
11.1378 + by (simp add: comp_def)
11.1379 + then have "simple_function M X"
11.1380 + unfolding simple_function_def by auto
11.1381 + then have "simple_distributed M X ?Px"
11.1382 + by (rule simple_distributedI) auto
11.1383 + then show "distributed M (count_space (X ` space M)) X ?Px"
11.1384 + by (rule simple_distributed)
11.1385 +
11.1386 + let ?f = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x)) ` space M then Pxyz x else 0)"
11.1387 + let ?g = "(\<lambda>x. if x \<in> (\<lambda>x. (Y x, Z x)) ` space M then Pyz x else 0)"
11.1388 + let ?h = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Z x)) ` space M then Pxz x else 0)"
11.1389 + show
11.1390 + "integrable ?P (\<lambda>(x, y, z). ?f (x, y, z) * log b (?f (x, y, z) / (?Px x * ?g (y, z))))"
11.1391 + "integrable ?P (\<lambda>(x, y, z). ?f (x, y, z) * log b (?h (x, z) / (?Px x * Pz z)))"
11.1392 + by (auto intro!: integrable_count_space simp: pair_measure_count_space)
11.1393 + let ?i = "\<lambda>x y z. ?f (x, y, z) * log b (?f (x, y, z) / (?h (x, z) * (?g (y, z) / Pz z)))"
11.1394 + let ?j = "\<lambda>x y z. Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z)))"
11.1395 + have "(\<lambda>(x, y, z). ?i x y z) = (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x)) ` space M then ?j (fst x) (fst (snd x)) (snd (snd x)) else 0)"
11.1396 + by (auto intro!: ext)
11.1397 + then show "(\<integral> (x, y, z). ?i x y z \<partial>?P) = (\<Sum>(x, y, z)\<in>(\<lambda>x. (X x, Y x, Z x)) ` space M. ?j x y z)"
11.1398 + by (auto intro!: setsum_cong simp add: `?P = ?C` lebesgue_integral_count_space_finite simple_distributed_finite setsum_cases split_beta')
11.1399 qed
11.1400
11.1401 -lemma (in information_space) conditional_mutual_information_generic_positive:
11.1402 - assumes X: "finite_random_variable MX X" and Y: "finite_random_variable MY Y" and Z: "finite_random_variable MZ Z"
11.1403 - shows "0 \<le> conditional_mutual_information b MX MY MZ X Y Z"
11.1404 -proof (cases "space MX \<times> space MY \<times> space MZ = {}")
11.1405 - case True show ?thesis
11.1406 - unfolding conditional_mutual_information_generic_eq[OF assms] True
11.1407 - by simp
11.1408 -next
11.1409 - case False
11.1410 - let ?dXYZ = "distribution (\<lambda>x. (X x, Y x, Z x))"
11.1411 - let ?dXZ = "joint_distribution X Z"
11.1412 - let ?dYZ = "joint_distribution Y Z"
11.1413 - let ?dX = "distribution X"
11.1414 - let ?dZ = "distribution Z"
11.1415 - let ?M = "space MX \<times> space MY \<times> space MZ"
11.1416 +lemma (in information_space) conditional_mutual_information_nonneg:
11.1417 + assumes X: "simple_function M X" and Y: "simple_function M Y" and Z: "simple_function M Z"
11.1418 + shows "0 \<le> \<I>(X ; Y | Z)"
11.1419 +proof -
11.1420 + def Pz \<equiv> "\<lambda>x. if x \<in> Z`space M then measure M (Z -` {x} \<inter> space M) else 0"
11.1421 + def Pxz \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (X x, Z x))`space M then measure M ((\<lambda>x. (X x, Z x)) -` {x} \<inter> space M) else 0"
11.1422 + def Pyz \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (Y x, Z x))`space M then measure M ((\<lambda>x. (Y x, Z x)) -` {x} \<inter> space M) else 0"
11.1423 + def Pxyz \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x))`space M then measure M ((\<lambda>x. (X x, Y x, Z x)) -` {x} \<inter> space M) else 0"
11.1424 + let ?M = "X`space M \<times> Y`space M \<times> Z`space M"
11.1425
11.1426 - note YZ = finite_random_variable_pairI[OF Y Z]
11.1427 - note XZ = finite_random_variable_pairI[OF X Z]
11.1428 - note ZX = finite_random_variable_pairI[OF Z X]
11.1429 - note YZ = finite_random_variable_pairI[OF Y Z]
11.1430 - note XYZ = finite_random_variable_pairI[OF X YZ]
11.1431 - note finite = Z YZ XZ XYZ
11.1432 - have order: "\<And>x y z. \<lbrakk>x \<in> space MX; y \<in> space MY; z \<in> space MZ; joint_distribution X Z {(x, z)} = 0\<rbrakk>
11.1433 - \<Longrightarrow> joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)} = 0"
11.1434 - unfolding joint_distribution_commute_singleton[of X]
11.1435 - unfolding joint_distribution_assoc_singleton[symmetric]
11.1436 - using finite_distribution_order(6)[OF Y ZX]
11.1437 - by auto
11.1438 + note XZ = simple_function_Pair[OF X Z]
11.1439 + note YZ = simple_function_Pair[OF Y Z]
11.1440 + note XYZ = simple_function_Pair[OF X simple_function_Pair[OF Y Z]]
11.1441 + have Pz: "simple_distributed M Z Pz"
11.1442 + using Z by (rule simple_distributedI) (auto simp: Pz_def)
11.1443 + have Pxz: "simple_distributed M (\<lambda>x. (X x, Z x)) Pxz"
11.1444 + using XZ by (rule simple_distributedI) (auto simp: Pxz_def)
11.1445 + have Pyz: "simple_distributed M (\<lambda>x. (Y x, Z x)) Pyz"
11.1446 + using YZ by (rule simple_distributedI) (auto simp: Pyz_def)
11.1447 + have Pxyz: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Pxyz"
11.1448 + using XYZ by (rule simple_distributedI) (auto simp: Pxyz_def)
11.1449
11.1450 - note order = order
11.1451 - finite_distribution_order(5,6)[OF X YZ]
11.1452 - finite_distribution_order(5,6)[OF Y Z]
11.1453 + { fix z assume z: "z \<in> Z ` space M" then have "(\<Sum>x\<in>X ` space M. Pxz (x, z)) = Pz z"
11.1454 + using distributed_marginal_eq_joint_simple[OF X Pz Pxz z]
11.1455 + by (auto intro!: setsum_cong simp: Pxz_def) }
11.1456 + note marginal1 = this
11.1457
11.1458 - have "- conditional_mutual_information b MX MY MZ X Y Z = - (\<Sum>(x, y, z) \<in> ?M. ?dXYZ {(x, y, z)} *
11.1459 - log b (?dXYZ {(x, y, z)} / (?dXZ {(x, z)} * ?dYZ {(y,z)} / ?dZ {z})))"
11.1460 - unfolding conditional_mutual_information_generic_eq[OF assms] neg_equal_iff_equal by auto
11.1461 - also have "\<dots> \<le> log b (\<Sum>(x, y, z) \<in> ?M. ?dXZ {(x, z)} * ?dYZ {(y,z)} / ?dZ {z})"
11.1462 + { fix z assume z: "z \<in> Z ` space M" then have "(\<Sum>y\<in>Y ` space M. Pyz (y, z)) = Pz z"
11.1463 + using distributed_marginal_eq_joint_simple[OF Y Pz Pyz z]
11.1464 + by (auto intro!: setsum_cong simp: Pyz_def) }
11.1465 + note marginal2 = this
11.1466 +
11.1467 + have "- \<I>(X ; Y | Z) = - (\<Sum>(x, y, z) \<in> ?M. Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))"
11.1468 + unfolding conditional_mutual_information_eq[OF Pz Pyz Pxz Pxyz]
11.1469 + using X Y Z by (auto intro!: setsum_mono_zero_left simp: Pxyz_def simple_functionD)
11.1470 + also have "\<dots> \<le> log b (\<Sum>(x, y, z) \<in> ?M. Pxz (x, z) * (Pyz (y,z) / Pz z))"
11.1471 unfolding split_beta'
11.1472 proof (rule log_setsum_divide)
11.1473 - show "?M \<noteq> {}" using False by simp
11.1474 + show "?M \<noteq> {}" using not_empty by simp
11.1475 show "1 < b" using b_gt_1 .
11.1476
11.1477 - show "finite ?M" using assms
11.1478 - unfolding finite_sigma_algebra_def finite_sigma_algebra_axioms_def by auto
11.1479 + show "finite ?M" using X Y Z by (auto simp: simple_functionD)
11.1480
11.1481 - show "(\<Sum>x\<in>?M. ?dXYZ {(fst x, fst (snd x), snd (snd x))}) = 1"
11.1482 - unfolding setsum_cartesian_product'
11.1483 - unfolding setsum_commute[of _ "space MY"]
11.1484 - unfolding setsum_commute[of _ "space MZ"]
11.1485 - by (simp_all add: space_pair_measure
11.1486 - setsum_joint_distribution_singleton[OF X YZ]
11.1487 - setsum_joint_distribution_singleton[OF Y Z]
11.1488 - setsum_distribution[OF Z])
11.1489 -
11.1490 - fix x assume "x \<in> ?M"
11.1491 - let ?x = "(fst x, fst (snd x), snd (snd x))"
11.1492 -
11.1493 - show "0 \<le> ?dXYZ {?x}"
11.1494 - "0 \<le> ?dXZ {(fst x, snd (snd x))} * ?dYZ {(fst (snd x), snd (snd x))} / ?dZ {snd (snd x)}"
11.1495 - by (simp_all add: mult_nonneg_nonneg divide_nonneg_nonneg)
11.1496 -
11.1497 - assume *: "0 < ?dXYZ {?x}"
11.1498 - with `x \<in> ?M` finite order show "0 < ?dXZ {(fst x, snd (snd x))} * ?dYZ {(fst (snd x), snd (snd x))} / ?dZ {snd (snd x)}"
11.1499 - by (cases x) (auto simp add: zero_le_mult_iff zero_le_divide_iff less_le)
11.1500 + then show "(\<Sum>x\<in>?M. Pxyz (fst x, fst (snd x), snd (snd x))) = 1"
11.1501 + apply (subst Pxyz[THEN simple_distributed_setsum_space, symmetric])
11.1502 + apply simp
11.1503 + apply (intro setsum_mono_zero_right)
11.1504 + apply (auto simp: Pxyz_def)
11.1505 + done
11.1506 + let ?N = "(\<lambda>x. (X x, Y x, Z x)) ` space M"
11.1507 + fix x assume x: "x \<in> ?M"
11.1508 + let ?Q = "Pxyz (fst x, fst (snd x), snd (snd x))"
11.1509 + let ?P = "Pxz (fst x, snd (snd x)) * (Pyz (fst (snd x), snd (snd x)) / Pz (snd (snd x)))"
11.1510 + from x show "0 \<le> ?Q" "0 \<le> ?P"
11.1511 + using Pxyz[THEN simple_distributed, THEN distributed_real_AE]
11.1512 + using Pxz[THEN simple_distributed, THEN distributed_real_AE]
11.1513 + using Pyz[THEN simple_distributed, THEN distributed_real_AE]
11.1514 + using Pz[THEN simple_distributed, THEN distributed_real_AE]
11.1515 + by (auto intro!: mult_nonneg_nonneg divide_nonneg_nonneg simp: AE_count_space Pxyz_def Pxz_def Pyz_def Pz_def)
11.1516 + moreover assume "0 < ?Q"
11.1517 + moreover have "AE x in count_space ?N. Pz (snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"
11.1518 + by (intro subdensity_real[of "\<lambda>x. snd (snd x)", OF _ Pxyz[THEN simple_distributed] Pz[THEN simple_distributed]]) (auto intro: measurable_snd')
11.1519 + then have "\<And>x. Pz (snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"
11.1520 + by (auto simp: Pz_def Pxyz_def AE_count_space)
11.1521 + moreover have "AE x in count_space ?N. Pxz (fst x, snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"
11.1522 + by (intro subdensity_real[of "\<lambda>x. (fst x, snd (snd x))", OF _ Pxyz[THEN simple_distributed] Pxz[THEN simple_distributed]]) (auto intro: measurable_Pair measurable_snd')
11.1523 + then have "\<And>x. Pxz (fst x, snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"
11.1524 + by (auto simp: Pz_def Pxyz_def AE_count_space)
11.1525 + moreover have "AE x in count_space ?N. Pyz (snd x) = 0 \<longrightarrow> Pxyz x = 0"
11.1526 + by (intro subdensity_real[of snd, OF _ Pxyz[THEN simple_distributed] Pyz[THEN simple_distributed]]) (auto intro: measurable_Pair)
11.1527 + then have "\<And>x. Pyz (snd x) = 0 \<longrightarrow> Pxyz x = 0"
11.1528 + by (auto simp: Pz_def Pxyz_def AE_count_space)
11.1529 + ultimately show "0 < ?P" using x by (auto intro!: divide_pos_pos mult_pos_pos simp: less_le)
11.1530 qed
11.1531 - also have "(\<Sum>(x, y, z) \<in> ?M. ?dXZ {(x, z)} * ?dYZ {(y,z)} / ?dZ {z}) = (\<Sum>z\<in>space MZ. ?dZ {z})"
11.1532 + also have "(\<Sum>(x, y, z) \<in> ?M. Pxz (x, z) * (Pyz (y,z) / Pz z)) = (\<Sum>z\<in>Z`space M. Pz z)"
11.1533 apply (simp add: setsum_cartesian_product')
11.1534 apply (subst setsum_commute)
11.1535 apply (subst (2) setsum_commute)
11.1536 - by (auto simp: setsum_divide_distrib[symmetric] setsum_product[symmetric]
11.1537 - setsum_joint_distribution_singleton[OF X Z]
11.1538 - setsum_joint_distribution_singleton[OF Y Z]
11.1539 + apply (auto simp: setsum_divide_distrib[symmetric] setsum_product[symmetric] marginal1 marginal2
11.1540 intro!: setsum_cong)
11.1541 - also have "log b (\<Sum>z\<in>space MZ. ?dZ {z}) = 0"
11.1542 - unfolding setsum_distribution[OF Z] by simp
11.1543 + done
11.1544 + also have "log b (\<Sum>z\<in>Z`space M. Pz z) = 0"
11.1545 + using Pz[THEN simple_distributed_setsum_space] by simp
11.1546 finally show ?thesis by simp
11.1547 qed
11.1548
11.1549 -lemma (in information_space) conditional_mutual_information_positive:
11.1550 - assumes "simple_function M X" and "simple_function M Y" and "simple_function M Z"
11.1551 - shows "0 \<le> \<I>(X;Y|Z)"
11.1552 - by (rule conditional_mutual_information_generic_positive[OF assms[THEN simple_function_imp_finite_random_variable]])
11.1553 -
11.1554 subsection {* Conditional Entropy *}
11.1555
11.1556 definition (in prob_space)
11.1557 - "conditional_entropy b S T X Y = conditional_mutual_information b S S T X X Y"
11.1558 + "conditional_entropy b S T X Y = entropy b (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) - entropy b T Y"
11.1559
11.1560 abbreviation (in information_space)
11.1561 conditional_entropy_Pow ("\<H>'(_ | _')") where
11.1562 - "\<H>(X | Y) \<equiv> conditional_entropy b
11.1563 - \<lparr> space = X`space M, sets = Pow (X`space M), measure = ereal\<circ>distribution X \<rparr>
11.1564 - \<lparr> space = Y`space M, sets = Pow (Y`space M), measure = ereal\<circ>distribution Y \<rparr> X Y"
11.1565 -
11.1566 -lemma (in information_space) conditional_entropy_positive:
11.1567 - "simple_function M X \<Longrightarrow> simple_function M Y \<Longrightarrow> 0 \<le> \<H>(X | Y)"
11.1568 - unfolding conditional_entropy_def by (auto intro!: conditional_mutual_information_positive)
11.1569 + "\<H>(X | Y) \<equiv> conditional_entropy b (count_space (X`space M)) (count_space (Y`space M)) X Y"
11.1570
11.1571 lemma (in information_space) conditional_entropy_generic_eq:
11.1572 - fixes MX :: "('c, 'd) measure_space_scheme" and MY :: "('e, 'f) measure_space_scheme"
11.1573 - assumes MX: "finite_random_variable MX X"
11.1574 - assumes MZ: "finite_random_variable MZ Z"
11.1575 - shows "conditional_entropy b MX MZ X Z =
11.1576 - - (\<Sum>(x, z)\<in>space MX \<times> space MZ.
11.1577 - joint_distribution X Z {(x, z)} * log b (joint_distribution X Z {(x, z)} / distribution Z {z}))"
11.1578 + fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"
11.1579 + assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"
11.1580 + assumes Px: "distributed M S X Px"
11.1581 + assumes Py: "distributed M T Y Py"
11.1582 + assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy"
11.1583 + assumes I1: "integrable (S \<Otimes>\<^isub>M T) (\<lambda>x. Pxy x * log b (Pxy x))"
11.1584 + assumes I2: "integrable (S \<Otimes>\<^isub>M T) (\<lambda>x. Pxy x * log b (Py (snd x)))"
11.1585 + shows "conditional_entropy b S T X Y = - (\<integral>(x, y). Pxy (x, y) * log b (Pxy (x, y) / Py y) \<partial>(S \<Otimes>\<^isub>M T))"
11.1586 proof -
11.1587 - interpret MX: finite_sigma_algebra MX using MX by simp
11.1588 - interpret MZ: finite_sigma_algebra MZ using MZ by simp
11.1589 - let ?XXZ = "\<lambda>x y z. joint_distribution X (\<lambda>x. (X x, Z x)) {(x, y, z)}"
11.1590 - let ?XZ = "\<lambda>x z. joint_distribution X Z {(x, z)}"
11.1591 - let ?Z = "\<lambda>z. distribution Z {z}"
11.1592 - let ?f = "\<lambda>x y z. log b (?XXZ x y z * ?Z z / (?XZ x z * ?XZ y z))"
11.1593 - { fix x z have "?XXZ x x z = ?XZ x z"
11.1594 - unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>']) }
11.1595 - note this[simp]
11.1596 - { fix x x' :: 'c and z assume "x' \<noteq> x"
11.1597 - then have "?XXZ x x' z = 0"
11.1598 - by (auto simp: distribution_def empty_measure'[symmetric]
11.1599 - simp del: empty_measure' intro!: arg_cong[where f=\<mu>']) }
11.1600 - note this[simp]
11.1601 - { fix x x' z assume *: "x \<in> space MX" "z \<in> space MZ"
11.1602 - then have "(\<Sum>x'\<in>space MX. ?XXZ x x' z * ?f x x' z)
11.1603 - = (\<Sum>x'\<in>space MX. if x = x' then ?XZ x z * ?f x x z else 0)"
11.1604 - by (auto intro!: setsum_cong)
11.1605 - also have "\<dots> = ?XZ x z * ?f x x z"
11.1606 - using `x \<in> space MX` by (simp add: setsum_cases[OF MX.finite_space])
11.1607 - also have "\<dots> = ?XZ x z * log b (?Z z / ?XZ x z)" by auto
11.1608 - also have "\<dots> = - ?XZ x z * log b (?XZ x z / ?Z z)"
11.1609 - using finite_distribution_order(6)[OF MX MZ]
11.1610 - by (auto simp: log_simps field_simps zero_less_mult_iff)
11.1611 - finally have "(\<Sum>x'\<in>space MX. ?XXZ x x' z * ?f x x' z) = - ?XZ x z * log b (?XZ x z / ?Z z)" . }
11.1612 - note * = this
11.1613 - show ?thesis
11.1614 + interpret S: sigma_finite_measure S by fact
11.1615 + interpret T: sigma_finite_measure T by fact
11.1616 + interpret ST: pair_sigma_finite S T ..
11.1617 + have ST: "sigma_finite_measure (S \<Otimes>\<^isub>M T)" ..
11.1618 +
11.1619 + interpret Pxy: prob_space "density (S \<Otimes>\<^isub>M T) Pxy"
11.1620 + unfolding Pxy[THEN distributed_distr_eq_density, symmetric]
11.1621 + using Pxy[THEN distributed_measurable] by (rule prob_space_distr)
11.1622 +
11.1623 + from Py Pxy have distr_eq: "distr M T Y =
11.1624 + distr (distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))) T snd"
11.1625 + by (subst distr_distr[OF measurable_snd]) (auto dest: distributed_measurable simp: comp_def)
11.1626 +
11.1627 + have "entropy b T Y = - (\<integral>y. Py y * log b (Py y) \<partial>T)"
11.1628 + by (rule entropy_distr[OF T Py])
11.1629 + also have "\<dots> = - (\<integral>(x,y). Pxy (x,y) * log b (Py y) \<partial>(S \<Otimes>\<^isub>M T))"
11.1630 + using b_gt_1 Py[THEN distributed_real_measurable]
11.1631 + by (subst distributed_transform_integral[OF Pxy Py, where T=snd]) (auto intro!: integral_cong)
11.1632 + finally have e_eq: "entropy b T Y = - (\<integral>(x,y). Pxy (x,y) * log b (Py y) \<partial>(S \<Otimes>\<^isub>M T))" .
11.1633 +
11.1634 + have "AE x in S \<Otimes>\<^isub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0"
11.1635 + by (intro subdensity_real[of fst, OF _ Pxy Px]) (auto intro: measurable_Pair)
11.1636 + moreover have "AE x in S \<Otimes>\<^isub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0"
11.1637 + by (intro subdensity_real[of snd, OF _ Pxy Py]) (auto intro: measurable_Pair)
11.1638 + moreover have "AE x in S \<Otimes>\<^isub>M T. 0 \<le> Px (fst x)"
11.1639 + using Px by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_fst'' dest: distributed_real_AE distributed_real_measurable)
11.1640 + moreover have "AE x in S \<Otimes>\<^isub>M T. 0 \<le> Py (snd x)"
11.1641 + using Py by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'' dest: distributed_real_AE distributed_real_measurable)
11.1642 + moreover note Pxy[THEN distributed_real_AE]
11.1643 + ultimately have pos: "AE x in S \<Otimes>\<^isub>M T. 0 \<le> Pxy x \<and> 0 \<le> Px (fst x) \<and> 0 \<le> Py (snd x) \<and>
11.1644 + (Pxy x = 0 \<or> (Pxy x \<noteq> 0 \<longrightarrow> 0 < Pxy x \<and> 0 < Px (fst x) \<and> 0 < Py (snd x)))"
11.1645 + by eventually_elim auto
11.1646 +
11.1647 + from pos have "AE x in S \<Otimes>\<^isub>M T.
11.1648 + Pxy x * log b (Pxy x) - Pxy x * log b (Py (snd x)) = Pxy x * log b (Pxy x / Py (snd x))"
11.1649 + by eventually_elim (auto simp: log_simps mult_pos_pos field_simps b_gt_1)
11.1650 + with I1 I2 show ?thesis
11.1651 unfolding conditional_entropy_def
11.1652 - unfolding conditional_mutual_information_generic_eq[OF MX MX MZ]
11.1653 - by (auto simp: setsum_cartesian_product' setsum_negf[symmetric]
11.1654 - setsum_commute[of _ "space MZ"] *
11.1655 - intro!: setsum_cong)
11.1656 + apply (subst e_eq)
11.1657 + apply (subst entropy_distr[OF ST Pxy])
11.1658 + unfolding minus_diff_minus
11.1659 + apply (subst integral_diff(2)[symmetric])
11.1660 + apply (auto intro!: integral_cong_AE simp: split_beta' simp del: integral_diff)
11.1661 + done
11.1662 qed
11.1663
11.1664 lemma (in information_space) conditional_entropy_eq:
11.1665 - assumes "simple_function M X" "simple_function M Z"
11.1666 - shows "\<H>(X | Z) =
11.1667 - - (\<Sum>(x, z)\<in>X ` space M \<times> Z ` space M.
11.1668 - joint_distribution X Z {(x, z)} *
11.1669 - log b (joint_distribution X Z {(x, z)} / distribution Z {z}))"
11.1670 - by (subst conditional_entropy_generic_eq[OF assms[THEN simple_function_imp_finite_random_variable]])
11.1671 - simp
11.1672 + assumes Y: "simple_distributed M Y Py" and X: "simple_function M X"
11.1673 + assumes XY: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"
11.1674 + shows "\<H>(X | Y) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))"
11.1675 +proof (subst conditional_entropy_generic_eq[OF _ _
11.1676 + simple_distributed[OF simple_distributedI[OF X refl]] simple_distributed[OF Y] simple_distributed_joint[OF XY]])
11.1677 + have [simp]: "finite (X`space M)" using X by (simp add: simple_function_def)
11.1678 + note Y[THEN simple_distributed_finite, simp]
11.1679 + show "sigma_finite_measure (count_space (X ` space M))"
11.1680 + by (simp add: sigma_finite_measure_count_space_finite)
11.1681 + show "sigma_finite_measure (count_space (Y ` space M))"
11.1682 + by (simp add: sigma_finite_measure_count_space_finite)
11.1683 + let ?f = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x else 0)"
11.1684 + have "count_space (X ` space M) \<Otimes>\<^isub>M count_space (Y ` space M) = count_space (X`space M \<times> Y`space M)"
11.1685 + (is "?P = ?C")
11.1686 + using X Y by (simp add: simple_distributed_finite pair_measure_count_space)
11.1687 + with X Y show
11.1688 + "integrable ?P (\<lambda>x. ?f x * log b (?f x))"
11.1689 + "integrable ?P (\<lambda>x. ?f x * log b (Py (snd x)))"
11.1690 + by (auto intro!: integrable_count_space simp: simple_distributed_finite)
11.1691 + have eq: "(\<lambda>(x, y). ?f (x, y) * log b (?f (x, y) / Py y)) =
11.1692 + (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / Py (snd x)) else 0)"
11.1693 + by auto
11.1694 + from X Y show "- (\<integral> (x, y). ?f (x, y) * log b (?f (x, y) / Py y) \<partial>?P) =
11.1695 + - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))"
11.1696 + by (auto intro!: setsum_cong simp add: `?P = ?C` lebesgue_integral_count_space_finite simple_distributed_finite eq setsum_cases split_beta')
11.1697 +qed
11.1698
11.1699 -lemma (in information_space) conditional_entropy_eq_ce_with_hypothesis:
11.1700 +lemma (in information_space) conditional_mutual_information_eq_conditional_entropy:
11.1701 assumes X: "simple_function M X" and Y: "simple_function M Y"
11.1702 - shows "\<H>(X | Y) =
11.1703 - -(\<Sum>y\<in>Y`space M. distribution Y {y} *
11.1704 - (\<Sum>x\<in>X`space M. joint_distribution X Y {(x,y)} / distribution Y {(y)} *
11.1705 - log b (joint_distribution X Y {(x,y)} / distribution Y {(y)})))"
11.1706 - unfolding conditional_entropy_eq[OF assms]
11.1707 - using finite_distribution_order(5,6)[OF assms[THEN simple_function_imp_finite_random_variable]]
11.1708 - by (auto simp: setsum_cartesian_product' setsum_commute[of _ "Y`space M"] setsum_right_distrib
11.1709 - intro!: setsum_cong)
11.1710 + shows "\<I>(X ; X | Y) = \<H>(X | Y)"
11.1711 +proof -
11.1712 + def Py \<equiv> "\<lambda>x. if x \<in> Y`space M then measure M (Y -` {x} \<inter> space M) else 0"
11.1713 + def Pxy \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x))`space M then measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M) else 0"
11.1714 + def Pxxy \<equiv> "\<lambda>x. if x \<in> (\<lambda>x. (X x, X x, Y x))`space M then measure M ((\<lambda>x. (X x, X x, Y x)) -` {x} \<inter> space M) else 0"
11.1715 + let ?M = "X`space M \<times> X`space M \<times> Y`space M"
11.1716
11.1717 -lemma (in information_space) conditional_entropy_eq_cartesian_product:
11.1718 - assumes "simple_function M X" "simple_function M Y"
11.1719 - shows "\<H>(X | Y) = -(\<Sum>x\<in>X`space M. \<Sum>y\<in>Y`space M.
11.1720 - joint_distribution X Y {(x,y)} *
11.1721 - log b (joint_distribution X Y {(x,y)} / distribution Y {y}))"
11.1722 - unfolding conditional_entropy_eq[OF assms]
11.1723 - by (auto intro!: setsum_cong simp: setsum_cartesian_product')
11.1724 + note XY = simple_function_Pair[OF X Y]
11.1725 + note XXY = simple_function_Pair[OF X XY]
11.1726 + have Py: "simple_distributed M Y Py"
11.1727 + using Y by (rule simple_distributedI) (auto simp: Py_def)
11.1728 + have Pxy: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"
11.1729 + using XY by (rule simple_distributedI) (auto simp: Pxy_def)
11.1730 + have Pxxy: "simple_distributed M (\<lambda>x. (X x, X x, Y x)) Pxxy"
11.1731 + using XXY by (rule simple_distributedI) (auto simp: Pxxy_def)
11.1732 + have eq: "(\<lambda>x. (X x, X x, Y x)) ` space M = (\<lambda>(x, y). (x, x, y)) ` (\<lambda>x. (X x, Y x)) ` space M"
11.1733 + by auto
11.1734 + have inj: "\<And>A. inj_on (\<lambda>(x, y). (x, x, y)) A"
11.1735 + by (auto simp: inj_on_def)
11.1736 + have Pxxy_eq: "\<And>x y. Pxxy (x, x, y) = Pxy (x, y)"
11.1737 + by (auto simp: Pxxy_def Pxy_def intro!: arg_cong[where f=prob])
11.1738 + have "AE x in count_space ((\<lambda>x. (X x, Y x))`space M). Py (snd x) = 0 \<longrightarrow> Pxy x = 0"
11.1739 + by (intro subdensity_real[of snd, OF _ Pxy[THEN simple_distributed] Py[THEN simple_distributed]]) (auto intro: measurable_Pair)
11.1740 + then show ?thesis
11.1741 + apply (subst conditional_mutual_information_eq[OF Py Pxy Pxy Pxxy])
11.1742 + apply (subst conditional_entropy_eq[OF Py X Pxy])
11.1743 + apply (auto intro!: setsum_cong simp: Pxxy_eq setsum_negf[symmetric] eq setsum_reindex[OF inj]
11.1744 + log_simps zero_less_mult_iff zero_le_mult_iff field_simps mult_less_0_iff AE_count_space)
11.1745 + using Py[THEN simple_distributed, THEN distributed_real_AE] Pxy[THEN simple_distributed, THEN distributed_real_AE]
11.1746 + apply (auto simp add: not_le[symmetric] AE_count_space)
11.1747 + done
11.1748 +qed
11.1749 +
11.1750 +lemma (in information_space) conditional_entropy_nonneg:
11.1751 + assumes X: "simple_function M X" and Y: "simple_function M Y" shows "0 \<le> \<H>(X | Y)"
11.1752 + using conditional_mutual_information_eq_conditional_entropy[OF X Y] conditional_mutual_information_nonneg[OF X X Y]
11.1753 + by simp
11.1754
11.1755 subsection {* Equalities *}
11.1756
11.1757 +lemma (in information_space) mutual_information_eq_entropy_conditional_entropy_distr:
11.1758 + fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real" and Pxy :: "('b \<times> 'c) \<Rightarrow> real"
11.1759 + assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"
11.1760 + assumes Px: "distributed M S X Px" and Py: "distributed M T Y Py"
11.1761 + assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy"
11.1762 + assumes Ix: "integrable(S \<Otimes>\<^isub>M T) (\<lambda>x. Pxy x * log b (Px (fst x)))"
11.1763 + assumes Iy: "integrable(S \<Otimes>\<^isub>M T) (\<lambda>x. Pxy x * log b (Py (snd x)))"
11.1764 + assumes Ixy: "integrable(S \<Otimes>\<^isub>M T) (\<lambda>x. Pxy x * log b (Pxy x))"
11.1765 + shows "mutual_information b S T X Y = entropy b S X + entropy b T Y - entropy b (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
11.1766 +proof -
11.1767 + have X: "entropy b S X = - (\<integral>x. Pxy x * log b (Px (fst x)) \<partial>(S \<Otimes>\<^isub>M T))"
11.1768 + using b_gt_1 Px[THEN distributed_real_measurable]
11.1769 + apply (subst entropy_distr[OF S Px])
11.1770 + apply (subst distributed_transform_integral[OF Pxy Px, where T=fst])
11.1771 + apply (auto intro!: integral_cong)
11.1772 + done
11.1773 +
11.1774 + have Y: "entropy b T Y = - (\<integral>x. Pxy x * log b (Py (snd x)) \<partial>(S \<Otimes>\<^isub>M T))"
11.1775 + using b_gt_1 Py[THEN distributed_real_measurable]
11.1776 + apply (subst entropy_distr[OF T Py])
11.1777 + apply (subst distributed_transform_integral[OF Pxy Py, where T=snd])
11.1778 + apply (auto intro!: integral_cong)
11.1779 + done
11.1780 +
11.1781 + interpret S: sigma_finite_measure S by fact
11.1782 + interpret T: sigma_finite_measure T by fact
11.1783 + interpret ST: pair_sigma_finite S T ..
11.1784 + have ST: "sigma_finite_measure (S \<Otimes>\<^isub>M T)" ..
11.1785 +
11.1786 + have XY: "entropy b (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) = - (\<integral>x. Pxy x * log b (Pxy x) \<partial>(S \<Otimes>\<^isub>M T))"
11.1787 + by (subst entropy_distr[OF ST Pxy]) (auto intro!: integral_cong)
11.1788 +
11.1789 + have "AE x in S \<Otimes>\<^isub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0"
11.1790 + by (intro subdensity_real[of fst, OF _ Pxy Px]) (auto intro: measurable_Pair)
11.1791 + moreover have "AE x in S \<Otimes>\<^isub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0"
11.1792 + by (intro subdensity_real[of snd, OF _ Pxy Py]) (auto intro: measurable_Pair)
11.1793 + moreover have "AE x in S \<Otimes>\<^isub>M T. 0 \<le> Px (fst x)"
11.1794 + using Px by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_fst'' dest: distributed_real_AE distributed_real_measurable)
11.1795 + moreover have "AE x in S \<Otimes>\<^isub>M T. 0 \<le> Py (snd x)"
11.1796 + using Py by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'' dest: distributed_real_AE distributed_real_measurable)
11.1797 + moreover note Pxy[THEN distributed_real_AE]
11.1798 + ultimately have "AE x in S \<Otimes>\<^isub>M T. Pxy x * log b (Pxy x) - Pxy x * log b (Px (fst x)) - Pxy x * log b (Py (snd x)) =
11.1799 + Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))"
11.1800 + (is "AE x in _. ?f x = ?g x")
11.1801 + proof eventually_elim
11.1802 + case (goal1 x)
11.1803 + show ?case
11.1804 + proof cases
11.1805 + assume "Pxy x \<noteq> 0"
11.1806 + with goal1 have "0 < Px (fst x)" "0 < Py (snd x)" "0 < Pxy x"
11.1807 + by auto
11.1808 + then show ?thesis
11.1809 + using b_gt_1 by (simp add: log_simps mult_pos_pos less_imp_le field_simps)
11.1810 + qed simp
11.1811 + qed
11.1812 +
11.1813 + have "entropy b S X + entropy b T Y - entropy b (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) = integral\<^isup>L (S \<Otimes>\<^isub>M T) ?f"
11.1814 + unfolding X Y XY
11.1815 + apply (subst integral_diff)
11.1816 + apply (intro integral_diff Ixy Ix Iy)+
11.1817 + apply (subst integral_diff)
11.1818 + apply (intro integral_diff Ixy Ix Iy)+
11.1819 + apply (simp add: field_simps)
11.1820 + done
11.1821 + also have "\<dots> = integral\<^isup>L (S \<Otimes>\<^isub>M T) ?g"
11.1822 + using `AE x in _. ?f x = ?g x` by (rule integral_cong_AE)
11.1823 + also have "\<dots> = mutual_information b S T X Y"
11.1824 + by (rule mutual_information_distr[OF S T Px Py Pxy, symmetric])
11.1825 + finally show ?thesis ..
11.1826 +qed
11.1827 +
11.1828 lemma (in information_space) mutual_information_eq_entropy_conditional_entropy:
11.1829 - assumes X: "simple_function M X" and Z: "simple_function M Z"
11.1830 - shows "\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)"
11.1831 + assumes sf_X: "simple_function M X" and sf_Y: "simple_function M Y"
11.1832 + shows "\<I>(X ; Y) = \<H>(X) - \<H>(X | Y)"
11.1833 proof -
11.1834 - let ?XZ = "\<lambda>x z. joint_distribution X Z {(x, z)}"
11.1835 - let ?Z = "\<lambda>z. distribution Z {z}"
11.1836 - let ?X = "\<lambda>x. distribution X {x}"
11.1837 - note fX = X[THEN simple_function_imp_finite_random_variable]
11.1838 - note fZ = Z[THEN simple_function_imp_finite_random_variable]
11.1839 - note finite_distribution_order[OF fX fZ, simp]
11.1840 - { fix x z assume "x \<in> X`space M" "z \<in> Z`space M"
11.1841 - have "?XZ x z * log b (?XZ x z / (?X x * ?Z z)) =
11.1842 - ?XZ x z * log b (?XZ x z / ?Z z) - ?XZ x z * log b (?X x)"
11.1843 - by (auto simp: log_simps zero_le_mult_iff field_simps less_le) }
11.1844 - note * = this
11.1845 + have X: "simple_distributed M X (\<lambda>x. measure M (X -` {x} \<inter> space M))"
11.1846 + using sf_X by (rule simple_distributedI) auto
11.1847 + have Y: "simple_distributed M Y (\<lambda>x. measure M (Y -` {x} \<inter> space M))"
11.1848 + using sf_Y by (rule simple_distributedI) auto
11.1849 + have sf_XY: "simple_function M (\<lambda>x. (X x, Y x))"
11.1850 + using sf_X sf_Y by (rule simple_function_Pair)
11.1851 + then have XY: "simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))"
11.1852 + by (rule simple_distributedI) auto
11.1853 + from simple_distributed_joint_finite[OF this, simp]
11.1854 + have eq: "count_space (X ` space M) \<Otimes>\<^isub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)"
11.1855 + by (simp add: pair_measure_count_space)
11.1856 +
11.1857 + have "\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X`space M) \<Otimes>\<^isub>M count_space (Y`space M)) (\<lambda>x. (X x, Y x))"
11.1858 + using sigma_finite_measure_count_space_finite sigma_finite_measure_count_space_finite simple_distributed[OF X] simple_distributed[OF Y] simple_distributed_joint[OF XY]
11.1859 + by (rule mutual_information_eq_entropy_conditional_entropy_distr) (auto simp: eq integrable_count_space)
11.1860 + then show ?thesis
11.1861 + unfolding conditional_entropy_def by simp
11.1862 +qed
11.1863 +
11.1864 +lemma (in information_space) mutual_information_nonneg_simple:
11.1865 + assumes sf_X: "simple_function M X" and sf_Y: "simple_function M Y"
11.1866 + shows "0 \<le> \<I>(X ; Y)"
11.1867 +proof -
11.1868 + have X: "simple_distributed M X (\<lambda>x. measure M (X -` {x} \<inter> space M))"
11.1869 + using sf_X by (rule simple_distributedI) auto
11.1870 + have Y: "simple_distributed M Y (\<lambda>x. measure M (Y -` {x} \<inter> space M))"
11.1871 + using sf_Y by (rule simple_distributedI) auto
11.1872 +
11.1873 + have sf_XY: "simple_function M (\<lambda>x. (X x, Y x))"
11.1874 + using sf_X sf_Y by (rule simple_function_Pair)
11.1875 + then have XY: "simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))"
11.1876 + by (rule simple_distributedI) auto
11.1877 +
11.1878 + from simple_distributed_joint_finite[OF this, simp]
11.1879 + have eq: "count_space (X ` space M) \<Otimes>\<^isub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)"
11.1880 + by (simp add: pair_measure_count_space)
11.1881 +
11.1882 show ?thesis
11.1883 - unfolding entropy_eq[OF X] conditional_entropy_eq[OF X Z] mutual_information_eq[OF X Z]
11.1884 - using setsum_joint_distribution_singleton[OF fZ fX, unfolded joint_distribution_commute_singleton[of Z X]]
11.1885 - by (simp add: * setsum_cartesian_product' setsum_subtractf setsum_left_distrib[symmetric]
11.1886 - setsum_distribution)
11.1887 + by (rule mutual_information_nonneg[OF _ _ simple_distributed[OF X] simple_distributed[OF Y] simple_distributed_joint[OF XY]])
11.1888 + (simp_all add: eq integrable_count_space sigma_finite_measure_count_space_finite)
11.1889 qed
11.1890
11.1891 lemma (in information_space) conditional_entropy_less_eq_entropy:
11.1892 assumes X: "simple_function M X" and Z: "simple_function M Z"
11.1893 shows "\<H>(X | Z) \<le> \<H>(X)"
11.1894 proof -
11.1895 - have "\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)" using mutual_information_eq_entropy_conditional_entropy[OF assms] .
11.1896 - with mutual_information_positive[OF X Z] entropy_positive[OF X]
11.1897 - show ?thesis by auto
11.1898 + have "0 \<le> \<I>(X ; Z)" using X Z by (rule mutual_information_nonneg_simple)
11.1899 + also have "\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)" using mutual_information_eq_entropy_conditional_entropy[OF assms] .
11.1900 + finally show ?thesis by auto
11.1901 qed
11.1902
11.1903 lemma (in information_space) entropy_chain_rule:
11.1904 assumes X: "simple_function M X" and Y: "simple_function M Y"
11.1905 shows "\<H>(\<lambda>x. (X x, Y x)) = \<H>(X) + \<H>(Y|X)"
11.1906 proof -
11.1907 - let ?XY = "\<lambda>x y. joint_distribution X Y {(x, y)}"
11.1908 - let ?Y = "\<lambda>y. distribution Y {y}"
11.1909 - let ?X = "\<lambda>x. distribution X {x}"
11.1910 - note fX = X[THEN simple_function_imp_finite_random_variable]
11.1911 - note fY = Y[THEN simple_function_imp_finite_random_variable]
11.1912 - note finite_distribution_order[OF fX fY, simp]
11.1913 - { fix x y assume "x \<in> X`space M" "y \<in> Y`space M"
11.1914 - have "?XY x y * log b (?XY x y / ?X x) =
11.1915 - ?XY x y * log b (?XY x y) - ?XY x y * log b (?X x)"
11.1916 - by (auto simp: log_simps zero_le_mult_iff field_simps less_le) }
11.1917 - note * = this
11.1918 - show ?thesis
11.1919 - using setsum_joint_distribution_singleton[OF fY fX]
11.1920 - unfolding entropy_eq[OF X] conditional_entropy_eq_cartesian_product[OF Y X] entropy_eq_cartesian_product[OF X Y]
11.1921 - unfolding joint_distribution_commute_singleton[of Y X] setsum_commute[of _ "X`space M"]
11.1922 - by (simp add: * setsum_subtractf setsum_left_distrib[symmetric])
11.1923 -qed
11.1924 -
11.1925 -section {* Partitioning *}
11.1926 -
11.1927 -definition "subvimage A f g \<longleftrightarrow> (\<forall>x \<in> A. f -` {f x} \<inter> A \<subseteq> g -` {g x} \<inter> A)"
11.1928 -
11.1929 -lemma subvimageI:
11.1930 - assumes "\<And>x y. \<lbrakk> x \<in> A ; y \<in> A ; f x = f y \<rbrakk> \<Longrightarrow> g x = g y"
11.1931 - shows "subvimage A f g"
11.1932 - using assms unfolding subvimage_def by blast
11.1933 -
11.1934 -lemma subvimageE[consumes 1]:
11.1935 - assumes "subvimage A f g"
11.1936 - obtains "\<And>x y. \<lbrakk> x \<in> A ; y \<in> A ; f x = f y \<rbrakk> \<Longrightarrow> g x = g y"
11.1937 - using assms unfolding subvimage_def by blast
11.1938 -
11.1939 -lemma subvimageD:
11.1940 - "\<lbrakk> subvimage A f g ; x \<in> A ; y \<in> A ; f x = f y \<rbrakk> \<Longrightarrow> g x = g y"
11.1941 - using assms unfolding subvimage_def by blast
11.1942 -
11.1943 -lemma subvimage_subset:
11.1944 - "\<lbrakk> subvimage B f g ; A \<subseteq> B \<rbrakk> \<Longrightarrow> subvimage A f g"
11.1945 - unfolding subvimage_def by auto
11.1946 -
11.1947 -lemma subvimage_idem[intro]: "subvimage A g g"
11.1948 - by (safe intro!: subvimageI)
11.1949 -
11.1950 -lemma subvimage_comp_finer[intro]:
11.1951 - assumes svi: "subvimage A g h"
11.1952 - shows "subvimage A g (f \<circ> h)"
11.1953 -proof (rule subvimageI, simp)
11.1954 - fix x y assume "x \<in> A" "y \<in> A" "g x = g y"
11.1955 - from svi[THEN subvimageD, OF this]
11.1956 - show "f (h x) = f (h y)" by simp
11.1957 -qed
11.1958 -
11.1959 -lemma subvimage_comp_gran:
11.1960 - assumes svi: "subvimage A g h"
11.1961 - assumes inj: "inj_on f (g ` A)"
11.1962 - shows "subvimage A (f \<circ> g) h"
11.1963 - by (rule subvimageI) (auto intro!: subvimageD[OF svi] simp: inj_on_iff[OF inj])
11.1964 -
11.1965 -lemma subvimage_comp:
11.1966 - assumes svi: "subvimage (f ` A) g h"
11.1967 - shows "subvimage A (g \<circ> f) (h \<circ> f)"
11.1968 - by (rule subvimageI) (auto intro!: svi[THEN subvimageD])
11.1969 -
11.1970 -lemma subvimage_trans:
11.1971 - assumes fg: "subvimage A f g"
11.1972 - assumes gh: "subvimage A g h"
11.1973 - shows "subvimage A f h"
11.1974 - by (rule subvimageI) (auto intro!: fg[THEN subvimageD] gh[THEN subvimageD])
11.1975 -
11.1976 -lemma subvimage_translator:
11.1977 - assumes svi: "subvimage A f g"
11.1978 - shows "\<exists>h. \<forall>x \<in> A. h (f x) = g x"
11.1979 -proof (safe intro!: exI[of _ "\<lambda>x. (THE z. z \<in> (g ` (f -` {x} \<inter> A)))"])
11.1980 - fix x assume "x \<in> A"
11.1981 - show "(THE x'. x' \<in> (g ` (f -` {f x} \<inter> A))) = g x"
11.1982 - by (rule theI2[of _ "g x"])
11.1983 - (insert `x \<in> A`, auto intro!: svi[THEN subvimageD])
11.1984 -qed
11.1985 -
11.1986 -lemma subvimage_translator_image:
11.1987 - assumes svi: "subvimage A f g"
11.1988 - shows "\<exists>h. h ` f ` A = g ` A"
11.1989 -proof -
11.1990 - from subvimage_translator[OF svi]
11.1991 - obtain h where "\<And>x. x \<in> A \<Longrightarrow> h (f x) = g x" by auto
11.1992 - thus ?thesis
11.1993 - by (auto intro!: exI[of _ h]
11.1994 - simp: image_compose[symmetric] comp_def cong: image_cong)
11.1995 -qed
11.1996 -
11.1997 -lemma subvimage_finite:
11.1998 - assumes svi: "subvimage A f g" and fin: "finite (f`A)"
11.1999 - shows "finite (g`A)"
11.2000 -proof -
11.2001 - from subvimage_translator_image[OF svi]
11.2002 - obtain h where "g`A = h`f`A" by fastforce
11.2003 - with fin show "finite (g`A)" by simp
11.2004 -qed
11.2005 -
11.2006 -lemma subvimage_disj:
11.2007 - assumes svi: "subvimage A f g"
11.2008 - shows "f -` {x} \<inter> A \<subseteq> g -` {y} \<inter> A \<or>
11.2009 - f -` {x} \<inter> g -` {y} \<inter> A = {}" (is "?sub \<or> ?dist")
11.2010 -proof (rule disjCI)
11.2011 - assume "\<not> ?dist"
11.2012 - then obtain z where "z \<in> A" and "x = f z" and "y = g z" by auto
11.2013 - thus "?sub" using svi unfolding subvimage_def by auto
11.2014 -qed
11.2015 -
11.2016 -lemma setsum_image_split:
11.2017 - assumes svi: "subvimage A f g" and fin: "finite (f ` A)"
11.2018 - shows "(\<Sum>x\<in>f`A. h x) = (\<Sum>y\<in>g`A. \<Sum>x\<in>f`(g -` {y} \<inter> A). h x)"
11.2019 - (is "?lhs = ?rhs")
11.2020 -proof -
11.2021 - have "f ` A =
11.2022 - snd ` (SIGMA x : g ` A. f ` (g -` {x} \<inter> A))"
11.2023 - (is "_ = snd ` ?SIGMA")
11.2024 - unfolding image_split_eq_Sigma[symmetric]
11.2025 - by (simp add: image_compose[symmetric] comp_def)
11.2026 - moreover
11.2027 - have snd_inj: "inj_on snd ?SIGMA"
11.2028 - unfolding image_split_eq_Sigma[symmetric]
11.2029 - by (auto intro!: inj_onI subvimageD[OF svi])
11.2030 - ultimately
11.2031 - have "(\<Sum>x\<in>f`A. h x) = (\<Sum>(x,y)\<in>?SIGMA. h y)"
11.2032 - by (auto simp: setsum_reindex intro: setsum_cong)
11.2033 - also have "... = ?rhs"
11.2034 - using subvimage_finite[OF svi fin] fin
11.2035 - apply (subst setsum_Sigma[symmetric])
11.2036 - by (auto intro!: finite_subset[of _ "f`A"])
11.2037 - finally show ?thesis .
11.2038 + note XY = simple_distributedI[OF simple_function_Pair[OF X Y] refl]
11.2039 + note YX = simple_distributedI[OF simple_function_Pair[OF Y X] refl]
11.2040 + note simple_distributed_joint_finite[OF this, simp]
11.2041 + let ?f = "\<lambda>x. prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M)"
11.2042 + let ?g = "\<lambda>x. prob ((\<lambda>x. (Y x, X x)) -` {x} \<inter> space M)"
11.2043 + let ?h = "\<lambda>x. if x \<in> (\<lambda>x. (Y x, X x)) ` space M then prob ((\<lambda>x. (Y x, X x)) -` {x} \<inter> space M) else 0"
11.2044 + have "\<H>(\<lambda>x. (X x, Y x)) = - (\<Sum>x\<in>(\<lambda>x. (X x, Y x)) ` space M. ?f x * log b (?f x))"
11.2045 + using XY by (rule entropy_simple_distributed)
11.2046 + also have "\<dots> = - (\<Sum>x\<in>(\<lambda>(x, y). (y, x)) ` (\<lambda>x. (X x, Y x)) ` space M. ?g x * log b (?g x))"
11.2047 + by (subst (2) setsum_reindex) (auto simp: inj_on_def intro!: setsum_cong arg_cong[where f="\<lambda>A. prob A * log b (prob A)"])
11.2048 + also have "\<dots> = - (\<Sum>x\<in>(\<lambda>x. (Y x, X x)) ` space M. ?h x * log b (?h x))"
11.2049 + by (auto intro!: setsum_cong)
11.2050 + also have "\<dots> = entropy b (count_space (Y ` space M) \<Otimes>\<^isub>M count_space (X ` space M)) (\<lambda>x. (Y x, X x))"
11.2051 + by (subst entropy_distr[OF _ simple_distributed_joint[OF YX]])
11.2052 + (auto simp: pair_measure_count_space sigma_finite_measure_count_space_finite lebesgue_integral_count_space_finite
11.2053 + cong del: setsum_cong intro!: setsum_mono_zero_left)
11.2054 + finally have "\<H>(\<lambda>x. (X x, Y x)) = entropy b (count_space (Y ` space M) \<Otimes>\<^isub>M count_space (X ` space M)) (\<lambda>x. (Y x, X x))" .
11.2055 + then show ?thesis
11.2056 + unfolding conditional_entropy_def by simp
11.2057 qed
11.2058
11.2059 lemma (in information_space) entropy_partition:
11.2060 - assumes sf: "simple_function M X" "simple_function M P"
11.2061 - assumes svi: "subvimage (space M) X P"
11.2062 - shows "\<H>(X) = \<H>(P) + \<H>(X|P)"
11.2063 + assumes X: "simple_function M X"
11.2064 + shows "\<H>(X) = \<H>(f \<circ> X) + \<H>(X|f \<circ> X)"
11.2065 proof -
11.2066 - let ?XP = "\<lambda>x p. joint_distribution X P {(x, p)}"
11.2067 - let ?X = "\<lambda>x. distribution X {x}"
11.2068 - let ?P = "\<lambda>p. distribution P {p}"
11.2069 - note fX = sf(1)[THEN simple_function_imp_finite_random_variable]
11.2070 - note fP = sf(2)[THEN simple_function_imp_finite_random_variable]
11.2071 - note finite_distribution_order[OF fX fP, simp]
11.2072 - have "(\<Sum>x\<in>X ` space M. ?X x * log b (?X x)) =
11.2073 - (\<Sum>y\<in>P `space M. \<Sum>x\<in>X ` space M. ?XP x y * log b (?XP x y))"
11.2074 - proof (subst setsum_image_split[OF svi],
11.2075 - safe intro!: setsum_mono_zero_cong_left imageI)
11.2076 - show "finite (X ` space M)" "finite (X ` space M)" "finite (P ` space M)"
11.2077 - using sf unfolding simple_function_def by auto
11.2078 - next
11.2079 - fix p x assume in_space: "p \<in> space M" "x \<in> space M"
11.2080 - assume "?XP (X x) (P p) * log b (?XP (X x) (P p)) \<noteq> 0"
11.2081 - hence "(\<lambda>x. (X x, P x)) -` {(X x, P p)} \<inter> space M \<noteq> {}" by (auto simp: distribution_def)
11.2082 - with svi[unfolded subvimage_def, rule_format, OF `x \<in> space M`]
11.2083 - show "x \<in> P -` {P p}" by auto
11.2084 - next
11.2085 - fix p x assume in_space: "p \<in> space M" "x \<in> space M"
11.2086 - assume "P x = P p"
11.2087 - from this[symmetric] svi[unfolded subvimage_def, rule_format, OF `x \<in> space M`]
11.2088 - have "X -` {X x} \<inter> space M \<subseteq> P -` {P p} \<inter> space M"
11.2089 - by auto
11.2090 - hence "(\<lambda>x. (X x, P x)) -` {(X x, P p)} \<inter> space M = X -` {X x} \<inter> space M"
11.2091 - by auto
11.2092 - thus "?X (X x) * log b (?X (X x)) = ?XP (X x) (P p) * log b (?XP (X x) (P p))"
11.2093 - by (auto simp: distribution_def)
11.2094 - qed
11.2095 - moreover have "\<And>x y. ?XP x y * log b (?XP x y / ?P y) =
11.2096 - ?XP x y * log b (?XP x y) - ?XP x y * log b (?P y)"
11.2097 - by (auto simp add: log_simps zero_less_mult_iff field_simps)
11.2098 - ultimately show ?thesis
11.2099 - unfolding sf[THEN entropy_eq] conditional_entropy_eq[OF sf]
11.2100 - using setsum_joint_distribution_singleton[OF fX fP]
11.2101 - by (simp add: setsum_cartesian_product' setsum_subtractf setsum_distribution
11.2102 - setsum_left_distrib[symmetric] setsum_commute[where B="P`space M"])
11.2103 + note fX = simple_function_compose[OF X, of f]
11.2104 + have eq: "(\<lambda>x. ((f \<circ> X) x, X x)) ` space M = (\<lambda>x. (f x, x)) ` X ` space M" by auto
11.2105 + have inj: "\<And>A. inj_on (\<lambda>x. (f x, x)) A"
11.2106 + by (auto simp: inj_on_def)
11.2107 + show ?thesis
11.2108 + apply (subst entropy_chain_rule[symmetric, OF fX X])
11.2109 + apply (subst entropy_simple_distributed[OF simple_distributedI[OF simple_function_Pair[OF fX X] refl]])
11.2110 + apply (subst entropy_simple_distributed[OF simple_distributedI[OF X refl]])
11.2111 + unfolding eq
11.2112 + apply (subst setsum_reindex[OF inj])
11.2113 + apply (auto intro!: setsum_cong arg_cong[where f="\<lambda>A. prob A * log b (prob A)"])
11.2114 + done
11.2115 qed
11.2116
11.2117 corollary (in information_space) entropy_data_processing:
11.2118 assumes X: "simple_function M X" shows "\<H>(f \<circ> X) \<le> \<H>(X)"
11.2119 proof -
11.2120 - note X
11.2121 - moreover have fX: "simple_function M (f \<circ> X)" using X by auto
11.2122 - moreover have "subvimage (space M) X (f \<circ> X)" by auto
11.2123 - ultimately have "\<H>(X) = \<H>(f\<circ>X) + \<H>(X|f\<circ>X)" by (rule entropy_partition)
11.2124 + note fX = simple_function_compose[OF X, of f]
11.2125 + from X have "\<H>(X) = \<H>(f\<circ>X) + \<H>(X|f\<circ>X)" by (rule entropy_partition)
11.2126 then show "\<H>(f \<circ> X) \<le> \<H>(X)"
11.2127 - by (auto intro: conditional_entropy_positive[OF X fX])
11.2128 + by (auto intro: conditional_entropy_nonneg[OF X fX])
11.2129 qed
11.2130
11.2131 corollary (in information_space) entropy_of_inj:
11.2132 @@ -1411,7 +1313,11 @@
11.2133 have sf: "simple_function M (f \<circ> X)"
11.2134 using X by auto
11.2135 have "\<H>(X) = \<H>(the_inv_into (X`space M) f \<circ> (f \<circ> X))"
11.2136 - by (auto intro!: mutual_information_cong simp: entropy_def the_inv_into_f_f[OF inj])
11.2137 + unfolding o_assoc
11.2138 + apply (subst entropy_simple_distributed[OF simple_distributedI[OF X refl]])
11.2139 + apply (subst entropy_simple_distributed[OF simple_distributedI[OF simple_function_compose[OF X]], where f="\<lambda>x. prob (X -` {x} \<inter> space M)"])
11.2140 + apply (auto intro!: setsum_cong arg_cong[where f=prob] image_eqI simp: the_inv_into_f_f[OF inj] comp_def)
11.2141 + done
11.2142 also have "... \<le> \<H>(f \<circ> X)"
11.2143 using entropy_data_processing[OF sf] .
11.2144 finally show "\<H>(X) \<le> \<H>(f \<circ> X)" .
12.1 --- a/src/HOL/Probability/Lebesgue_Integration.thy Mon Apr 23 12:23:23 2012 +0100
12.2 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Mon Apr 23 12:14:35 2012 +0200
12.3 @@ -6,9 +6,13 @@
12.4 header {*Lebesgue Integration*}
12.5
12.6 theory Lebesgue_Integration
12.7 - imports Measure Borel_Space
12.8 + imports Measure_Space Borel_Space
12.9 begin
12.10
12.11 +lemma ereal_minus_eq_PInfty_iff:
12.12 + fixes x y :: ereal shows "x - y = \<infinity> \<longleftrightarrow> y = -\<infinity> \<or> x = \<infinity>"
12.13 + by (cases x y rule: ereal2_cases) simp_all
12.14 +
12.15 lemma real_ereal_1[simp]: "real (1::ereal) = 1"
12.16 unfolding one_ereal_def by simp
12.17
12.18 @@ -28,17 +32,17 @@
12.19 by (intro tendsto_add assms tendsto_divide tendsto_norm tendsto_diff) auto
12.20 qed
12.21
12.22 -lemma (in measure_space) measure_Union:
12.23 +lemma measure_Union:
12.24 assumes "finite S" "S \<subseteq> sets M" "\<And>A B. A \<in> S \<Longrightarrow> B \<in> S \<Longrightarrow> A \<noteq> B \<Longrightarrow> A \<inter> B = {}"
12.25 - shows "setsum \<mu> S = \<mu> (\<Union>S)"
12.26 + shows "setsum (emeasure M) S = (emeasure M) (\<Union>S)"
12.27 proof -
12.28 - have "setsum \<mu> S = \<mu> (\<Union>i\<in>S. i)"
12.29 - using assms by (intro measure_setsum[OF `finite S`]) (auto simp: disjoint_family_on_def)
12.30 - also have "\<dots> = \<mu> (\<Union>S)" by (auto intro!: arg_cong[where f=\<mu>])
12.31 + have "setsum (emeasure M) S = (emeasure M) (\<Union>i\<in>S. i)"
12.32 + using assms by (intro setsum_emeasure[OF _ _ `finite S`]) (auto simp: disjoint_family_on_def)
12.33 + also have "\<dots> = (emeasure M) (\<Union>S)" by (auto intro!: arg_cong[where f="emeasure M"])
12.34 finally show ?thesis .
12.35 qed
12.36
12.37 -lemma (in sigma_algebra) measurable_sets2[intro]:
12.38 +lemma measurable_sets2[intro]:
12.39 assumes "f \<in> measurable M M'" "g \<in> measurable M M''"
12.40 and "A \<in> sets M'" "B \<in> sets M''"
12.41 shows "f -` A \<inter> g -` B \<inter> space M \<in> sets M"
12.42 @@ -55,7 +59,7 @@
12.43
12.44 lemma borel_measurable_real_floor:
12.45 "(\<lambda>x::real. real \<lfloor>x\<rfloor>) \<in> borel_measurable borel"
12.46 - unfolding borel.borel_measurable_iff_ge
12.47 + unfolding borel_measurable_iff_ge
12.48 proof (intro allI)
12.49 fix a :: real
12.50 { fix x have "a \<le> real \<lfloor>x\<rfloor> \<longleftrightarrow> real \<lceil>a\<rceil> \<le> x"
12.51 @@ -65,19 +69,7 @@
12.52 then show "{w::real \<in> space borel. a \<le> real \<lfloor>w\<rfloor>} \<in> sets borel" by auto
12.53 qed
12.54
12.55 -lemma measure_preservingD2:
12.56 - "f \<in> measure_preserving A B \<Longrightarrow> f \<in> measurable A B"
12.57 - unfolding measure_preserving_def by auto
12.58 -
12.59 -lemma measure_preservingD3:
12.60 - "f \<in> measure_preserving A B \<Longrightarrow> f \<in> space A \<rightarrow> space B"
12.61 - unfolding measure_preserving_def measurable_def by auto
12.62 -
12.63 -lemma measure_preservingD:
12.64 - "T \<in> measure_preserving A B \<Longrightarrow> X \<in> sets B \<Longrightarrow> measure A (T -` X \<inter> space A) = measure B X"
12.65 - unfolding measure_preserving_def by auto
12.66 -
12.67 -lemma (in sigma_algebra) borel_measurable_real_natfloor[intro, simp]:
12.68 +lemma borel_measurable_real_natfloor[intro, simp]:
12.69 assumes "f \<in> borel_measurable M"
12.70 shows "(\<lambda>x. real (natfloor (f x))) \<in> borel_measurable M"
12.71 proof -
12.72 @@ -87,8 +79,8 @@
12.73 show ?thesis by (simp add: comp_def)
12.74 qed
12.75
12.76 -lemma (in measure_space) AE_not_in:
12.77 - assumes N: "N \<in> null_sets" shows "AE x. x \<notin> N"
12.78 +lemma AE_not_in:
12.79 + assumes N: "N \<in> null_sets M" shows "AE x in M. x \<notin> N"
12.80 using N by (rule AE_I') auto
12.81
12.82 lemma sums_If_finite:
12.83 @@ -128,7 +120,7 @@
12.84 finite (g ` space M) \<and>
12.85 (\<forall>x \<in> g ` space M. g -` {x} \<inter> space M \<in> sets M)"
12.86
12.87 -lemma (in sigma_algebra) simple_functionD:
12.88 +lemma simple_functionD:
12.89 assumes "simple_function M g"
12.90 shows "finite (g ` space M)" and "g -` X \<inter> space M \<in> sets M"
12.91 proof -
12.92 @@ -140,7 +132,7 @@
12.93 by (auto intro!: finite_UN simp del: UN_simps simp: simple_function_def)
12.94 qed
12.95
12.96 -lemma (in sigma_algebra) simple_function_measurable2[intro]:
12.97 +lemma simple_function_measurable2[intro]:
12.98 assumes "simple_function M f" "simple_function M g"
12.99 shows "f -` A \<inter> g -` B \<inter> space M \<in> sets M"
12.100 proof -
12.101 @@ -149,7 +141,7 @@
12.102 then show ?thesis using assms[THEN simple_functionD(2)] by auto
12.103 qed
12.104
12.105 -lemma (in sigma_algebra) simple_function_indicator_representation:
12.106 +lemma simple_function_indicator_representation:
12.107 fixes f ::"'a \<Rightarrow> ereal"
12.108 assumes f: "simple_function M f" and x: "x \<in> space M"
12.109 shows "f x = (\<Sum>y \<in> f ` space M. y * indicator (f -` {y} \<inter> space M) x)"
12.110 @@ -164,7 +156,7 @@
12.111 finally show ?thesis by auto
12.112 qed
12.113
12.114 -lemma (in measure_space) simple_function_notspace:
12.115 +lemma simple_function_notspace:
12.116 "simple_function M (\<lambda>x. h x * indicator (- space M) x::ereal)" (is "simple_function M ?h")
12.117 proof -
12.118 have "?h ` space M \<subseteq> {0}" unfolding indicator_def by auto
12.119 @@ -173,7 +165,7 @@
12.120 thus ?thesis unfolding simple_function_def by auto
12.121 qed
12.122
12.123 -lemma (in sigma_algebra) simple_function_cong:
12.124 +lemma simple_function_cong:
12.125 assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t"
12.126 shows "simple_function M f \<longleftrightarrow> simple_function M g"
12.127 proof -
12.128 @@ -183,12 +175,12 @@
12.129 thus ?thesis unfolding simple_function_def using assms by simp
12.130 qed
12.131
12.132 -lemma (in sigma_algebra) simple_function_cong_algebra:
12.133 +lemma simple_function_cong_algebra:
12.134 assumes "sets N = sets M" "space N = space M"
12.135 shows "simple_function M f \<longleftrightarrow> simple_function N f"
12.136 unfolding simple_function_def assms ..
12.137
12.138 -lemma (in sigma_algebra) borel_measurable_simple_function:
12.139 +lemma borel_measurable_simple_function:
12.140 assumes "simple_function M f"
12.141 shows "f \<in> borel_measurable M"
12.142 proof (rule borel_measurableI)
12.143 @@ -204,24 +196,23 @@
12.144 thus "f -` S \<inter> space M \<in> sets M" unfolding * .
12.145 qed
12.146
12.147 -lemma (in sigma_algebra) simple_function_borel_measurable:
12.148 +lemma simple_function_borel_measurable:
12.149 fixes f :: "'a \<Rightarrow> 'x::{t2_space}"
12.150 assumes "f \<in> borel_measurable M" and "finite (f ` space M)"
12.151 shows "simple_function M f"
12.152 using assms unfolding simple_function_def
12.153 by (auto intro: borel_measurable_vimage)
12.154
12.155 -lemma (in sigma_algebra) simple_function_eq_borel_measurable:
12.156 +lemma simple_function_eq_borel_measurable:
12.157 fixes f :: "'a \<Rightarrow> ereal"
12.158 shows "simple_function M f \<longleftrightarrow> finite (f`space M) \<and> f \<in> borel_measurable M"
12.159 - using simple_function_borel_measurable[of f]
12.160 - borel_measurable_simple_function[of f]
12.161 + using simple_function_borel_measurable[of f] borel_measurable_simple_function[of M f]
12.162 by (fastforce simp: simple_function_def)
12.163
12.164 -lemma (in sigma_algebra) simple_function_const[intro, simp]:
12.165 +lemma simple_function_const[intro, simp]:
12.166 "simple_function M (\<lambda>x. c)"
12.167 by (auto intro: finite_subset simp: simple_function_def)
12.168 -lemma (in sigma_algebra) simple_function_compose[intro, simp]:
12.169 +lemma simple_function_compose[intro, simp]:
12.170 assumes "simple_function M f"
12.171 shows "simple_function M (g \<circ> f)"
12.172 unfolding simple_function_def
12.173 @@ -238,7 +229,7 @@
12.174 by (rule_tac finite_UN) (auto intro!: finite_UN)
12.175 qed
12.176
12.177 -lemma (in sigma_algebra) simple_function_indicator[intro, simp]:
12.178 +lemma simple_function_indicator[intro, simp]:
12.179 assumes "A \<in> sets M"
12.180 shows "simple_function M (indicator A)"
12.181 proof -
12.182 @@ -250,7 +241,7 @@
12.183 using assms by (auto simp: indicator_def [abs_def])
12.184 qed
12.185
12.186 -lemma (in sigma_algebra) simple_function_Pair[intro, simp]:
12.187 +lemma simple_function_Pair[intro, simp]:
12.188 assumes "simple_function M f"
12.189 assumes "simple_function M g"
12.190 shows "simple_function M (\<lambda>x. (f x, g x))" (is "simple_function M ?p")
12.191 @@ -268,13 +259,13 @@
12.192 using assms unfolding simple_function_def by auto
12.193 qed
12.194
12.195 -lemma (in sigma_algebra) simple_function_compose1:
12.196 +lemma simple_function_compose1:
12.197 assumes "simple_function M f"
12.198 shows "simple_function M (\<lambda>x. g (f x))"
12.199 using simple_function_compose[OF assms, of g]
12.200 by (simp add: comp_def)
12.201
12.202 -lemma (in sigma_algebra) simple_function_compose2:
12.203 +lemma simple_function_compose2:
12.204 assumes "simple_function M f" and "simple_function M g"
12.205 shows "simple_function M (\<lambda>x. h (f x) (g x))"
12.206 proof -
12.207 @@ -283,7 +274,7 @@
12.208 thus ?thesis by (simp_all add: comp_def)
12.209 qed
12.210
12.211 -lemmas (in sigma_algebra) simple_function_add[intro, simp] = simple_function_compose2[where h="op +"]
12.212 +lemmas simple_function_add[intro, simp] = simple_function_compose2[where h="op +"]
12.213 and simple_function_diff[intro, simp] = simple_function_compose2[where h="op -"]
12.214 and simple_function_uminus[intro, simp] = simple_function_compose[where g="uminus"]
12.215 and simple_function_mult[intro, simp] = simple_function_compose2[where h="op *"]
12.216 @@ -291,24 +282,24 @@
12.217 and simple_function_inverse[intro, simp] = simple_function_compose[where g="inverse"]
12.218 and simple_function_max[intro, simp] = simple_function_compose2[where h=max]
12.219
12.220 -lemma (in sigma_algebra) simple_function_setsum[intro, simp]:
12.221 +lemma simple_function_setsum[intro, simp]:
12.222 assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)"
12.223 shows "simple_function M (\<lambda>x. \<Sum>i\<in>P. f i x)"
12.224 proof cases
12.225 assume "finite P" from this assms show ?thesis by induct auto
12.226 qed auto
12.227
12.228 -lemma (in sigma_algebra)
12.229 +lemma
12.230 fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f"
12.231 shows simple_function_ereal[intro, simp]: "simple_function M (\<lambda>x. ereal (f x))"
12.232 by (auto intro!: simple_function_compose1[OF sf])
12.233
12.234 -lemma (in sigma_algebra)
12.235 +lemma
12.236 fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f"
12.237 shows simple_function_real_of_nat[intro, simp]: "simple_function M (\<lambda>x. real (f x))"
12.238 by (auto intro!: simple_function_compose1[OF sf])
12.239
12.240 -lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence:
12.241 +lemma borel_measurable_implies_simple_function_sequence:
12.242 fixes u :: "'a \<Rightarrow> ereal"
12.243 assumes u: "u \<in> borel_measurable M"
12.244 shows "\<exists>f. incseq f \<and> (\<forall>i. \<infinity> \<notin> range (f i) \<and> simple_function M (f i)) \<and>
12.245 @@ -416,14 +407,14 @@
12.246 qed (auto simp: divide_nonneg_pos)
12.247 qed
12.248
12.249 -lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence':
12.250 +lemma borel_measurable_implies_simple_function_sequence':
12.251 fixes u :: "'a \<Rightarrow> ereal"
12.252 assumes u: "u \<in> borel_measurable M"
12.253 obtains f where "\<And>i. simple_function M (f i)" "incseq f" "\<And>i. \<infinity> \<notin> range (f i)"
12.254 "\<And>x. (SUP i. f i x) = max 0 (u x)" "\<And>i x. 0 \<le> f i x"
12.255 using borel_measurable_implies_simple_function_sequence[OF u] by auto
12.256
12.257 -lemma (in sigma_algebra) simple_function_If_set:
12.258 +lemma simple_function_If_set:
12.259 assumes sf: "simple_function M f" "simple_function M g" and A: "A \<inter> space M \<in> sets M"
12.260 shows "simple_function M (\<lambda>x. if x \<in> A then f x else g x)" (is "simple_function M ?IF")
12.261 proof -
12.262 @@ -445,7 +436,7 @@
12.263 qed
12.264 qed
12.265
12.266 -lemma (in sigma_algebra) simple_function_If:
12.267 +lemma simple_function_If:
12.268 assumes sf: "simple_function M f" "simple_function M g" and P: "{x\<in>space M. P x} \<in> sets M"
12.269 shows "simple_function M (\<lambda>x. if P x then f x else g x)"
12.270 proof -
12.271 @@ -453,58 +444,17 @@
12.272 with simple_function_If_set[OF sf, of "{x. P x}"] P show ?thesis by simp
12.273 qed
12.274
12.275 -lemma (in measure_space) simple_function_restricted:
12.276 - fixes f :: "'a \<Rightarrow> ereal" assumes "A \<in> sets M"
12.277 - shows "simple_function (restricted_space A) f \<longleftrightarrow> simple_function M (\<lambda>x. f x * indicator A x)"
12.278 - (is "simple_function ?R f \<longleftrightarrow> simple_function M ?f")
12.279 -proof -
12.280 - interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \<in> sets M`])
12.281 - have f: "finite (f`A) \<longleftrightarrow> finite (?f`space M)"
12.282 - proof cases
12.283 - assume "A = space M"
12.284 - then have "f`A = ?f`space M" by (fastforce simp: image_iff)
12.285 - then show ?thesis by simp
12.286 - next
12.287 - assume "A \<noteq> space M"
12.288 - then obtain x where x: "x \<in> space M" "x \<notin> A"
12.289 - using sets_into_space `A \<in> sets M` by auto
12.290 - have *: "?f`space M = f`A \<union> {0}"
12.291 - proof (auto simp add: image_iff)
12.292 - show "\<exists>x\<in>space M. f x = 0 \<or> indicator A x = 0"
12.293 - using x by (auto intro!: bexI[of _ x])
12.294 - next
12.295 - fix x assume "x \<in> A"
12.296 - then show "\<exists>y\<in>space M. f x = f y * indicator A y"
12.297 - using `A \<in> sets M` sets_into_space by (auto intro!: bexI[of _ x])
12.298 - next
12.299 - fix x
12.300 - assume "indicator A x \<noteq> (0::ereal)"
12.301 - then have "x \<in> A" by (auto simp: indicator_def split: split_if_asm)
12.302 - moreover assume "x \<in> space M" "\<forall>y\<in>A. ?f x \<noteq> f y"
12.303 - ultimately show "f x = 0" by auto
12.304 - qed
12.305 - then show ?thesis by auto
12.306 - qed
12.307 - then show ?thesis
12.308 - unfolding simple_function_eq_borel_measurable
12.309 - R.simple_function_eq_borel_measurable
12.310 - unfolding borel_measurable_restricted[OF `A \<in> sets M`]
12.311 - using assms(1)[THEN sets_into_space]
12.312 - by (auto simp: indicator_def)
12.313 -qed
12.314 -
12.315 -lemma (in sigma_algebra) simple_function_subalgebra:
12.316 +lemma simple_function_subalgebra:
12.317 assumes "simple_function N f"
12.318 and N_subalgebra: "sets N \<subseteq> sets M" "space N = space M"
12.319 shows "simple_function M f"
12.320 using assms unfolding simple_function_def by auto
12.321
12.322 -lemma (in measure_space) simple_function_vimage:
12.323 - assumes T: "sigma_algebra M'" "T \<in> measurable M M'"
12.324 +lemma simple_function_comp:
12.325 + assumes T: "T \<in> measurable M M'"
12.326 and f: "simple_function M' f"
12.327 shows "simple_function M (\<lambda>x. f (T x))"
12.328 proof (intro simple_function_def[THEN iffD2] conjI ballI)
12.329 - interpret T: sigma_algebra M' by fact
12.330 have "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space M'"
12.331 using T unfolding measurable_def by auto
12.332 then show "finite ((\<lambda>x. f (T x)) ` space M)"
12.333 @@ -523,16 +473,16 @@
12.334
12.335 section "Simple integral"
12.336
12.337 -definition simple_integral_def:
12.338 - "integral\<^isup>S M f = (\<Sum>x \<in> f ` space M. x * measure M (f -` {x} \<inter> space M))"
12.339 +definition simple_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> ereal" ("integral\<^isup>S") where
12.340 + "integral\<^isup>S M f = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M))"
12.341
12.342 syntax
12.343 - "_simple_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> ereal" ("\<integral>\<^isup>S _. _ \<partial>_" [60,61] 110)
12.344 + "_simple_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> 'a measure \<Rightarrow> ereal" ("\<integral>\<^isup>S _. _ \<partial>_" [60,61] 110)
12.345
12.346 translations
12.347 - "\<integral>\<^isup>S x. f \<partial>M" == "CONST integral\<^isup>S M (%x. f)"
12.348 + "\<integral>\<^isup>S x. f \<partial>M" == "CONST simple_integral M (%x. f)"
12.349
12.350 -lemma (in measure_space) simple_integral_cong:
12.351 +lemma simple_integral_cong:
12.352 assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t"
12.353 shows "integral\<^isup>S M f = integral\<^isup>S M g"
12.354 proof -
12.355 @@ -542,19 +492,8 @@
12.356 thus ?thesis unfolding simple_integral_def by simp
12.357 qed
12.358
12.359 -lemma (in measure_space) simple_integral_cong_measure:
12.360 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
12.361 - and "simple_function M f"
12.362 - shows "integral\<^isup>S N f = integral\<^isup>S M f"
12.363 -proof -
12.364 - interpret v: measure_space N
12.365 - by (rule measure_space_cong) fact+
12.366 - from simple_functionD[OF `simple_function M f`] assms show ?thesis
12.367 - by (auto intro!: setsum_cong simp: simple_integral_def)
12.368 -qed
12.369 -
12.370 -lemma (in measure_space) simple_integral_const[simp]:
12.371 - "(\<integral>\<^isup>Sx. c \<partial>M) = c * \<mu> (space M)"
12.372 +lemma simple_integral_const[simp]:
12.373 + "(\<integral>\<^isup>Sx. c \<partial>M) = c * (emeasure M) (space M)"
12.374 proof (cases "space M = {}")
12.375 case True thus ?thesis unfolding simple_integral_def by simp
12.376 next
12.377 @@ -562,9 +501,9 @@
12.378 thus ?thesis unfolding simple_integral_def by simp
12.379 qed
12.380
12.381 -lemma (in measure_space) simple_function_partition:
12.382 +lemma simple_function_partition:
12.383 assumes f: "simple_function M f" and g: "simple_function M g"
12.384 - shows "integral\<^isup>S M f = (\<Sum>A\<in>(\<lambda>x. f -` {f x} \<inter> g -` {g x} \<inter> space M) ` space M. the_elem (f`A) * \<mu> A)"
12.385 + shows "integral\<^isup>S M f = (\<Sum>A\<in>(\<lambda>x. f -` {f x} \<inter> g -` {g x} \<inter> space M) ` space M. the_elem (f`A) * (emeasure M) A)"
12.386 (is "_ = setsum _ (?p ` space M)")
12.387 proof-
12.388 let ?sub = "\<lambda>x. ?p ` (f -` {x} \<inter> space M)"
12.389 @@ -586,13 +525,13 @@
12.390
12.391 { fix x assume "x \<in> space M"
12.392 have "\<Union>(?sub (f x)) = (f -` {f x} \<inter> space M)" by auto
12.393 - with sets have "\<mu> (f -` {f x} \<inter> space M) = setsum \<mu> (?sub (f x))"
12.394 + with sets have "(emeasure M) (f -` {f x} \<inter> space M) = setsum (emeasure M) (?sub (f x))"
12.395 by (subst measure_Union) auto }
12.396 - hence "integral\<^isup>S M f = (\<Sum>(x,A)\<in>?SIGMA. x * \<mu> A)"
12.397 + hence "integral\<^isup>S M f = (\<Sum>(x,A)\<in>?SIGMA. x * (emeasure M) A)"
12.398 unfolding simple_integral_def using f sets
12.399 by (subst setsum_Sigma[symmetric])
12.400 (auto intro!: setsum_cong setsum_ereal_right_distrib)
12.401 - also have "\<dots> = (\<Sum>A\<in>?p ` space M. the_elem (f`A) * \<mu> A)"
12.402 + also have "\<dots> = (\<Sum>A\<in>?p ` space M. the_elem (f`A) * (emeasure M) A)"
12.403 proof -
12.404 have [simp]: "\<And>x. x \<in> space M \<Longrightarrow> f ` ?p x = {f x}" by (auto intro!: imageI)
12.405 have "(\<lambda>A. (the_elem (f ` A), A)) ` ?p ` space M
12.406 @@ -610,7 +549,7 @@
12.407 finally show ?thesis .
12.408 qed
12.409
12.410 -lemma (in measure_space) simple_integral_add[simp]:
12.411 +lemma simple_integral_add[simp]:
12.412 assumes f: "simple_function M f" and "\<And>x. 0 \<le> f x" and g: "simple_function M g" and "\<And>x. 0 \<le> g x"
12.413 shows "(\<integral>\<^isup>Sx. f x + g x \<partial>M) = integral\<^isup>S M f + integral\<^isup>S M g"
12.414 proof -
12.415 @@ -628,7 +567,7 @@
12.416 (auto simp add: ereal_left_distrib setsum_addf[symmetric] intro!: setsum_cong)
12.417 qed
12.418
12.419 -lemma (in measure_space) simple_integral_setsum[simp]:
12.420 +lemma simple_integral_setsum[simp]:
12.421 assumes "\<And>i x. i \<in> P \<Longrightarrow> 0 \<le> f i x"
12.422 assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)"
12.423 shows "(\<integral>\<^isup>Sx. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^isup>S M (f i))"
12.424 @@ -638,11 +577,11 @@
12.425 by induct (auto simp: simple_function_setsum simple_integral_add setsum_nonneg)
12.426 qed auto
12.427
12.428 -lemma (in measure_space) simple_integral_mult[simp]:
12.429 +lemma simple_integral_mult[simp]:
12.430 assumes f: "simple_function M f" "\<And>x. 0 \<le> f x"
12.431 shows "(\<integral>\<^isup>Sx. c * f x \<partial>M) = c * integral\<^isup>S M f"
12.432 proof -
12.433 - note mult = simple_function_mult[OF simple_function_const[of c] f(1)]
12.434 + note mult = simple_function_mult[OF simple_function_const[of _ c] f(1)]
12.435 { fix x let ?S = "f -` {f x} \<inter> (\<lambda>x. c * f x) -` {c * f x} \<inter> space M"
12.436 assume "x \<in> space M"
12.437 hence "(\<lambda>x. c * f x) ` ?S = {c * f x}" "f ` ?S = {f x}"
12.438 @@ -654,9 +593,9 @@
12.439 (auto intro!: ereal_0_le_mult setsum_cong simp: mult_assoc)
12.440 qed
12.441
12.442 -lemma (in measure_space) simple_integral_mono_AE:
12.443 +lemma simple_integral_mono_AE:
12.444 assumes f: "simple_function M f" and g: "simple_function M g"
12.445 - and mono: "AE x. f x \<le> g x"
12.446 + and mono: "AE x in M. f x \<le> g x"
12.447 shows "integral\<^isup>S M f \<le> integral\<^isup>S M g"
12.448 proof -
12.449 let ?S = "\<lambda>x. (g -` {g x} \<inter> space M) \<inter> (f -` {f x} \<inter> space M)"
12.450 @@ -669,55 +608,55 @@
12.451 proof (safe intro!: setsum_mono)
12.452 fix x assume "x \<in> space M"
12.453 then have *: "f ` ?S x = {f x}" "g ` ?S x = {g x}" by auto
12.454 - show "the_elem (f`?S x) * \<mu> (?S x) \<le> the_elem (g`?S x) * \<mu> (?S x)"
12.455 + show "the_elem (f`?S x) * (emeasure M) (?S x) \<le> the_elem (g`?S x) * (emeasure M) (?S x)"
12.456 proof (cases "f x \<le> g x")
12.457 case True then show ?thesis
12.458 using * assms(1,2)[THEN simple_functionD(2)]
12.459 by (auto intro!: ereal_mult_right_mono)
12.460 next
12.461 case False
12.462 - obtain N where N: "{x\<in>space M. \<not> f x \<le> g x} \<subseteq> N" "N \<in> sets M" "\<mu> N = 0"
12.463 + obtain N where N: "{x\<in>space M. \<not> f x \<le> g x} \<subseteq> N" "N \<in> sets M" "(emeasure M) N = 0"
12.464 using mono by (auto elim!: AE_E)
12.465 have "?S x \<subseteq> N" using N `x \<in> space M` False by auto
12.466 moreover have "?S x \<in> sets M" using assms
12.467 by (rule_tac Int) (auto intro!: simple_functionD)
12.468 - ultimately have "\<mu> (?S x) \<le> \<mu> N"
12.469 - using `N \<in> sets M` by (auto intro!: measure_mono)
12.470 - moreover have "0 \<le> \<mu> (?S x)"
12.471 + ultimately have "(emeasure M) (?S x) \<le> (emeasure M) N"
12.472 + using `N \<in> sets M` by (auto intro!: emeasure_mono)
12.473 + moreover have "0 \<le> (emeasure M) (?S x)"
12.474 using assms(1,2)[THEN simple_functionD(2)] by auto
12.475 - ultimately have "\<mu> (?S x) = 0" using `\<mu> N = 0` by auto
12.476 + ultimately have "(emeasure M) (?S x) = 0" using `(emeasure M) N = 0` by auto
12.477 then show ?thesis by simp
12.478 qed
12.479 qed
12.480 qed
12.481
12.482 -lemma (in measure_space) simple_integral_mono:
12.483 +lemma simple_integral_mono:
12.484 assumes "simple_function M f" and "simple_function M g"
12.485 and mono: "\<And> x. x \<in> space M \<Longrightarrow> f x \<le> g x"
12.486 shows "integral\<^isup>S M f \<le> integral\<^isup>S M g"
12.487 using assms by (intro simple_integral_mono_AE) auto
12.488
12.489 -lemma (in measure_space) simple_integral_cong_AE:
12.490 +lemma simple_integral_cong_AE:
12.491 assumes "simple_function M f" and "simple_function M g"
12.492 - and "AE x. f x = g x"
12.493 + and "AE x in M. f x = g x"
12.494 shows "integral\<^isup>S M f = integral\<^isup>S M g"
12.495 using assms by (auto simp: eq_iff intro!: simple_integral_mono_AE)
12.496
12.497 -lemma (in measure_space) simple_integral_cong':
12.498 +lemma simple_integral_cong':
12.499 assumes sf: "simple_function M f" "simple_function M g"
12.500 - and mea: "\<mu> {x\<in>space M. f x \<noteq> g x} = 0"
12.501 + and mea: "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0"
12.502 shows "integral\<^isup>S M f = integral\<^isup>S M g"
12.503 proof (intro simple_integral_cong_AE sf AE_I)
12.504 - show "\<mu> {x\<in>space M. f x \<noteq> g x} = 0" by fact
12.505 + show "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0" by fact
12.506 show "{x \<in> space M. f x \<noteq> g x} \<in> sets M"
12.507 using sf[THEN borel_measurable_simple_function] by auto
12.508 qed simp
12.509
12.510 -lemma (in measure_space) simple_integral_indicator:
12.511 +lemma simple_integral_indicator:
12.512 assumes "A \<in> sets M"
12.513 assumes "simple_function M f"
12.514 shows "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) =
12.515 - (\<Sum>x \<in> f ` space M. x * \<mu> (f -` {x} \<inter> space M \<inter> A))"
12.516 + (\<Sum>x \<in> f ` space M. x * (emeasure M) (f -` {x} \<inter> space M \<inter> A))"
12.517 proof cases
12.518 assume "A = space M"
12.519 moreover hence "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = integral\<^isup>S M f"
12.520 @@ -737,7 +676,7 @@
12.521 show "0 \<in> ?I ` space M" using x by (auto intro!: image_eqI[of _ _ x])
12.522 qed
12.523 have *: "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) =
12.524 - (\<Sum>x \<in> f ` space M \<union> {0}. x * \<mu> (f -` {x} \<inter> space M \<inter> A))"
12.525 + (\<Sum>x \<in> f ` space M \<union> {0}. x * (emeasure M) (f -` {x} \<inter> space M \<inter> A))"
12.526 unfolding simple_integral_def I
12.527 proof (rule setsum_mono_zero_cong_left)
12.528 show "finite (f ` space M \<union> {0})"
12.529 @@ -747,118 +686,83 @@
12.530 have "\<And>x. f x \<notin> f ` A \<Longrightarrow> f -` {f x} \<inter> space M \<inter> A = {}"
12.531 by (auto simp: image_iff)
12.532 thus "\<forall>i\<in>f ` space M \<union> {0} - (f ` A \<union> {0}).
12.533 - i * \<mu> (f -` {i} \<inter> space M \<inter> A) = 0" by auto
12.534 + i * (emeasure M) (f -` {i} \<inter> space M \<inter> A) = 0" by auto
12.535 next
12.536 fix x assume "x \<in> f`A \<union> {0}"
12.537 hence "x \<noteq> 0 \<Longrightarrow> ?I -` {x} \<inter> space M = f -` {x} \<inter> space M \<inter> A"
12.538 by (auto simp: indicator_def split: split_if_asm)
12.539 - thus "x * \<mu> (?I -` {x} \<inter> space M) =
12.540 - x * \<mu> (f -` {x} \<inter> space M \<inter> A)" by (cases "x = 0") simp_all
12.541 + thus "x * (emeasure M) (?I -` {x} \<inter> space M) =
12.542 + x * (emeasure M) (f -` {x} \<inter> space M \<inter> A)" by (cases "x = 0") simp_all
12.543 qed
12.544 show ?thesis unfolding *
12.545 using assms(2) unfolding simple_function_def
12.546 by (auto intro!: setsum_mono_zero_cong_right)
12.547 qed
12.548
12.549 -lemma (in measure_space) simple_integral_indicator_only[simp]:
12.550 +lemma simple_integral_indicator_only[simp]:
12.551 assumes "A \<in> sets M"
12.552 - shows "integral\<^isup>S M (indicator A) = \<mu> A"
12.553 + shows "integral\<^isup>S M (indicator A) = emeasure M A"
12.554 proof cases
12.555 assume "space M = {}" hence "A = {}" using sets_into_space[OF assms] by auto
12.556 thus ?thesis unfolding simple_integral_def using `space M = {}` by auto
12.557 next
12.558 assume "space M \<noteq> {}" hence "(\<lambda>x. 1) ` space M = {1::ereal}" by auto
12.559 thus ?thesis
12.560 - using simple_integral_indicator[OF assms simple_function_const[of 1]]
12.561 + using simple_integral_indicator[OF assms simple_function_const[of _ 1]]
12.562 using sets_into_space[OF assms]
12.563 - by (auto intro!: arg_cong[where f="\<mu>"])
12.564 + by (auto intro!: arg_cong[where f="(emeasure M)"])
12.565 qed
12.566
12.567 -lemma (in measure_space) simple_integral_null_set:
12.568 - assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets"
12.569 +lemma simple_integral_null_set:
12.570 + assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets M"
12.571 shows "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = 0"
12.572 proof -
12.573 - have "AE x. indicator N x = (0 :: ereal)"
12.574 - using `N \<in> null_sets` by (auto simp: indicator_def intro!: AE_I[of _ N])
12.575 + have "AE x in M. indicator N x = (0 :: ereal)"
12.576 + using `N \<in> null_sets M` by (auto simp: indicator_def intro!: AE_I[of _ _ N])
12.577 then have "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^isup>Sx. 0 \<partial>M)"
12.578 using assms apply (intro simple_integral_cong_AE) by auto
12.579 then show ?thesis by simp
12.580 qed
12.581
12.582 -lemma (in measure_space) simple_integral_cong_AE_mult_indicator:
12.583 - assumes sf: "simple_function M f" and eq: "AE x. x \<in> S" and "S \<in> sets M"
12.584 +lemma simple_integral_cong_AE_mult_indicator:
12.585 + assumes sf: "simple_function M f" and eq: "AE x in M. x \<in> S" and "S \<in> sets M"
12.586 shows "integral\<^isup>S M f = (\<integral>\<^isup>Sx. f x * indicator S x \<partial>M)"
12.587 using assms by (intro simple_integral_cong_AE) auto
12.588
12.589 -lemma (in measure_space) simple_integral_restricted:
12.590 - assumes "A \<in> sets M"
12.591 - assumes sf: "simple_function M (\<lambda>x. f x * indicator A x)"
12.592 - shows "integral\<^isup>S (restricted_space A) f = (\<integral>\<^isup>Sx. f x * indicator A x \<partial>M)"
12.593 - (is "_ = integral\<^isup>S M ?f")
12.594 +lemma simple_integral_distr:
12.595 + assumes T: "T \<in> measurable M M'"
12.596 + and f: "simple_function M' f"
12.597 + shows "integral\<^isup>S (distr M M' T) f = (\<integral>\<^isup>S x. f (T x) \<partial>M)"
12.598 unfolding simple_integral_def
12.599 -proof (simp, safe intro!: setsum_mono_zero_cong_left)
12.600 - from sf show "finite (?f ` space M)"
12.601 - unfolding simple_function_def by auto
12.602 +proof (intro setsum_mono_zero_cong_right ballI)
12.603 + show "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space (distr M M' T)"
12.604 + using T unfolding measurable_def by auto
12.605 + show "finite (f ` space (distr M M' T))"
12.606 + using f unfolding simple_function_def by auto
12.607 next
12.608 - fix x assume "x \<in> A"
12.609 - then show "f x \<in> ?f ` space M"
12.610 - using sets_into_space `A \<in> sets M` by (auto intro!: image_eqI[of _ _ x])
12.611 + fix i assume "i \<in> f ` space (distr M M' T) - (\<lambda>x. f (T x)) ` space M"
12.612 + then have "T -` (f -` {i} \<inter> space (distr M M' T)) \<inter> space M = {}" by (auto simp: image_iff)
12.613 + with f[THEN simple_functionD(2), of "{i}"]
12.614 + show "i * emeasure (distr M M' T) (f -` {i} \<inter> space (distr M M' T)) = 0"
12.615 + using T by (simp add: emeasure_distr)
12.616 next
12.617 - fix x assume "x \<in> space M" "?f x \<notin> f`A"
12.618 - then have "x \<notin> A" by (auto simp: image_iff)
12.619 - then show "?f x * \<mu> (?f -` {?f x} \<inter> space M) = 0" by simp
12.620 -next
12.621 - fix x assume "x \<in> A"
12.622 - then have "f x \<noteq> 0 \<Longrightarrow>
12.623 - f -` {f x} \<inter> A = ?f -` {f x} \<inter> space M"
12.624 - using `A \<in> sets M` sets_into_space
12.625 - by (auto simp: indicator_def split: split_if_asm)
12.626 - then show "f x * \<mu> (f -` {f x} \<inter> A) =
12.627 - f x * \<mu> (?f -` {f x} \<inter> space M)"
12.628 - unfolding ereal_mult_cancel_left by auto
12.629 + fix i assume "i \<in> (\<lambda>x. f (T x)) ` space M"
12.630 + then have "T -` (f -` {i} \<inter> space M') \<inter> space M = (\<lambda>x. f (T x)) -` {i} \<inter> space M"
12.631 + using T unfolding measurable_def by auto
12.632 + with f[THEN simple_functionD(2), of "{i}"] T
12.633 + show "i * emeasure (distr M M' T) (f -` {i} \<inter> space (distr M M' T)) =
12.634 + i * (emeasure M) ((\<lambda>x. f (T x)) -` {i} \<inter> space M)"
12.635 + by (auto simp add: emeasure_distr)
12.636 qed
12.637
12.638 -lemma (in measure_space) simple_integral_subalgebra:
12.639 - assumes N: "measure_space N" and [simp]: "space N = space M" "measure N = measure M"
12.640 - shows "integral\<^isup>S N = integral\<^isup>S M"
12.641 - unfolding simple_integral_def [abs_def] by simp
12.642 -
12.643 -lemma (in measure_space) simple_integral_vimage:
12.644 - assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'"
12.645 - and f: "simple_function M' f"
12.646 - shows "integral\<^isup>S M' f = (\<integral>\<^isup>S x. f (T x) \<partial>M)"
12.647 -proof -
12.648 - interpret T: measure_space M' by (rule measure_space_vimage[OF T])
12.649 - show "integral\<^isup>S M' f = (\<integral>\<^isup>S x. f (T x) \<partial>M)"
12.650 - unfolding simple_integral_def
12.651 - proof (intro setsum_mono_zero_cong_right ballI)
12.652 - show "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space M'"
12.653 - using T unfolding measurable_def measure_preserving_def by auto
12.654 - show "finite (f ` space M')"
12.655 - using f unfolding simple_function_def by auto
12.656 - next
12.657 - fix i assume "i \<in> f ` space M' - (\<lambda>x. f (T x)) ` space M"
12.658 - then have "T -` (f -` {i} \<inter> space M') \<inter> space M = {}" by (auto simp: image_iff)
12.659 - with f[THEN T.simple_functionD(2), THEN measure_preservingD[OF T(2)], of "{i}"]
12.660 - show "i * T.\<mu> (f -` {i} \<inter> space M') = 0" by simp
12.661 - next
12.662 - fix i assume "i \<in> (\<lambda>x. f (T x)) ` space M"
12.663 - then have "T -` (f -` {i} \<inter> space M') \<inter> space M = (\<lambda>x. f (T x)) -` {i} \<inter> space M"
12.664 - using T unfolding measurable_def measure_preserving_def by auto
12.665 - with f[THEN T.simple_functionD(2), THEN measure_preservingD[OF T(2)], of "{i}"]
12.666 - show "i * T.\<mu> (f -` {i} \<inter> space M') = i * \<mu> ((\<lambda>x. f (T x)) -` {i} \<inter> space M)"
12.667 - by auto
12.668 - qed
12.669 -qed
12.670 -
12.671 -lemma (in measure_space) simple_integral_cmult_indicator:
12.672 +lemma simple_integral_cmult_indicator:
12.673 assumes A: "A \<in> sets M"
12.674 - shows "(\<integral>\<^isup>Sx. c * indicator A x \<partial>M) = c * \<mu> A"
12.675 + shows "(\<integral>\<^isup>Sx. c * indicator A x \<partial>M) = c * (emeasure M) A"
12.676 using simple_integral_mult[OF simple_function_indicator[OF A]]
12.677 unfolding simple_integral_indicator_only[OF A] by simp
12.678
12.679 -lemma (in measure_space) simple_integral_positive:
12.680 - assumes f: "simple_function M f" and ae: "AE x. 0 \<le> f x"
12.681 +lemma simple_integral_positive:
12.682 + assumes f: "simple_function M f" and ae: "AE x in M. 0 \<le> f x"
12.683 shows "0 \<le> integral\<^isup>S M f"
12.684 proof -
12.685 have "integral\<^isup>S M (\<lambda>x. 0) \<le> integral\<^isup>S M f"
12.686 @@ -868,29 +772,23 @@
12.687
12.688 section "Continuous positive integration"
12.689
12.690 -definition positive_integral_def:
12.691 +definition positive_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> ereal" ("integral\<^isup>P") where
12.692 "integral\<^isup>P M f = (SUP g : {g. simple_function M g \<and> g \<le> max 0 \<circ> f}. integral\<^isup>S M g)"
12.693
12.694 syntax
12.695 - "_positive_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> ereal" ("\<integral>\<^isup>+ _. _ \<partial>_" [60,61] 110)
12.696 + "_positive_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> 'a measure \<Rightarrow> ereal" ("\<integral>\<^isup>+ _. _ \<partial>_" [60,61] 110)
12.697
12.698 translations
12.699 - "\<integral>\<^isup>+ x. f \<partial>M" == "CONST integral\<^isup>P M (%x. f)"
12.700 + "\<integral>\<^isup>+ x. f \<partial>M" == "CONST positive_integral M (%x. f)"
12.701
12.702 -lemma (in measure_space) positive_integral_cong_measure:
12.703 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
12.704 - shows "integral\<^isup>P N f = integral\<^isup>P M f"
12.705 - unfolding positive_integral_def
12.706 - unfolding simple_function_cong_algebra[OF assms(2,3), symmetric]
12.707 - using AE_cong_measure[OF assms]
12.708 - using simple_integral_cong_measure[OF assms]
12.709 - by (auto intro!: SUP_cong)
12.710 -
12.711 -lemma (in measure_space) positive_integral_positive:
12.712 +lemma positive_integral_positive:
12.713 "0 \<le> integral\<^isup>P M f"
12.714 by (auto intro!: SUP_upper2[of "\<lambda>x. 0"] simp: positive_integral_def le_fun_def)
12.715
12.716 -lemma (in measure_space) positive_integral_def_finite:
12.717 +lemma positive_integral_not_MInfty[simp]: "integral\<^isup>P M f \<noteq> -\<infinity>"
12.718 + using positive_integral_positive[of M f] by auto
12.719 +
12.720 +lemma positive_integral_def_finite:
12.721 "integral\<^isup>P M f = (SUP g : {g. simple_function M g \<and> g \<le> max 0 \<circ> f \<and> range g \<subseteq> {0 ..< \<infinity>}}. integral\<^isup>S M g)"
12.722 (is "_ = SUPR ?A ?f")
12.723 unfolding positive_integral_def
12.724 @@ -898,7 +796,7 @@
12.725 fix g assume g: "simple_function M g" "g \<le> max 0 \<circ> f"
12.726 let ?G = "{x \<in> space M. \<not> g x \<noteq> \<infinity>}"
12.727 note gM = g(1)[THEN borel_measurable_simple_function]
12.728 - have \<mu>G_pos: "0 \<le> \<mu> ?G" using gM by auto
12.729 + have \<mu>G_pos: "0 \<le> (emeasure M) ?G" using gM by auto
12.730 let ?g = "\<lambda>y x. if g x = \<infinity> then y else max 0 (g x)"
12.731 from g gM have g_in_A: "\<And>y. 0 \<le> y \<Longrightarrow> y \<noteq> \<infinity> \<Longrightarrow> ?g y \<in> ?A"
12.732 apply (safe intro!: simple_function_max simple_function_If)
12.733 @@ -907,21 +805,22 @@
12.734 show "integral\<^isup>S M g \<le> SUPR ?A ?f"
12.735 proof cases
12.736 have g0: "?g 0 \<in> ?A" by (intro g_in_A) auto
12.737 - assume "\<mu> ?G = 0"
12.738 - with gM have "AE x. x \<notin> ?G" by (simp add: AE_iff_null_set)
12.739 + assume "(emeasure M) ?G = 0"
12.740 + with gM have "AE x in M. x \<notin> ?G"
12.741 + by (auto simp add: AE_iff_null intro!: null_setsI)
12.742 with gM g show ?thesis
12.743 by (intro SUP_upper2[OF g0] simple_integral_mono_AE)
12.744 (auto simp: max_def intro!: simple_function_If)
12.745 next
12.746 - assume \<mu>G: "\<mu> ?G \<noteq> 0"
12.747 + assume \<mu>G: "(emeasure M) ?G \<noteq> 0"
12.748 have "SUPR ?A (integral\<^isup>S M) = \<infinity>"
12.749 proof (intro SUP_PInfty)
12.750 fix n :: nat
12.751 - let ?y = "ereal (real n) / (if \<mu> ?G = \<infinity> then 1 else \<mu> ?G)"
12.752 + let ?y = "ereal (real n) / (if (emeasure M) ?G = \<infinity> then 1 else (emeasure M) ?G)"
12.753 have "0 \<le> ?y" "?y \<noteq> \<infinity>" using \<mu>G \<mu>G_pos by (auto simp: ereal_divide_eq)
12.754 then have "?g ?y \<in> ?A" by (rule g_in_A)
12.755 - have "real n \<le> ?y * \<mu> ?G"
12.756 - using \<mu>G \<mu>G_pos by (cases "\<mu> ?G") (auto simp: field_simps)
12.757 + have "real n \<le> ?y * (emeasure M) ?G"
12.758 + using \<mu>G \<mu>G_pos by (cases "(emeasure M) ?G") (auto simp: field_simps)
12.759 also have "\<dots> = (\<integral>\<^isup>Sx. ?y * indicator ?G x \<partial>M)"
12.760 using `0 \<le> ?y` `?g ?y \<in> ?A` gM
12.761 by (subst simple_integral_cmult_indicator) auto
12.762 @@ -934,15 +833,15 @@
12.763 qed
12.764 qed (auto intro: SUP_upper)
12.765
12.766 -lemma (in measure_space) positive_integral_mono_AE:
12.767 - assumes ae: "AE x. u x \<le> v x" shows "integral\<^isup>P M u \<le> integral\<^isup>P M v"
12.768 +lemma positive_integral_mono_AE:
12.769 + assumes ae: "AE x in M. u x \<le> v x" shows "integral\<^isup>P M u \<le> integral\<^isup>P M v"
12.770 unfolding positive_integral_def
12.771 proof (safe intro!: SUP_mono)
12.772 fix n assume n: "simple_function M n" "n \<le> max 0 \<circ> u"
12.773 from ae[THEN AE_E] guess N . note N = this
12.774 - then have ae_N: "AE x. x \<notin> N" by (auto intro: AE_not_in)
12.775 + then have ae_N: "AE x in M. x \<notin> N" by (auto intro: AE_not_in)
12.776 let ?n = "\<lambda>x. n x * indicator (space M - N) x"
12.777 - have "AE x. n x \<le> ?n x" "simple_function M ?n"
12.778 + have "AE x in M. n x \<le> ?n x" "simple_function M ?n"
12.779 using n N ae_N by auto
12.780 moreover
12.781 { fix x have "?n x \<le> max 0 (v x)"
12.782 @@ -959,19 +858,19 @@
12.783 by force
12.784 qed
12.785
12.786 -lemma (in measure_space) positive_integral_mono:
12.787 +lemma positive_integral_mono:
12.788 "(\<And>x. x \<in> space M \<Longrightarrow> u x \<le> v x) \<Longrightarrow> integral\<^isup>P M u \<le> integral\<^isup>P M v"
12.789 by (auto intro: positive_integral_mono_AE)
12.790
12.791 -lemma (in measure_space) positive_integral_cong_AE:
12.792 - "AE x. u x = v x \<Longrightarrow> integral\<^isup>P M u = integral\<^isup>P M v"
12.793 +lemma positive_integral_cong_AE:
12.794 + "AE x in M. u x = v x \<Longrightarrow> integral\<^isup>P M u = integral\<^isup>P M v"
12.795 by (auto simp: eq_iff intro!: positive_integral_mono_AE)
12.796
12.797 -lemma (in measure_space) positive_integral_cong:
12.798 +lemma positive_integral_cong:
12.799 "(\<And>x. x \<in> space M \<Longrightarrow> u x = v x) \<Longrightarrow> integral\<^isup>P M u = integral\<^isup>P M v"
12.800 by (auto intro: positive_integral_cong_AE)
12.801
12.802 -lemma (in measure_space) positive_integral_eq_simple_integral:
12.803 +lemma positive_integral_eq_simple_integral:
12.804 assumes f: "simple_function M f" "\<And>x. 0 \<le> f x" shows "integral\<^isup>P M f = integral\<^isup>S M f"
12.805 proof -
12.806 let ?f = "\<lambda>x. f x * indicator (space M) x"
12.807 @@ -987,10 +886,10 @@
12.808 by (simp cong: positive_integral_cong simple_integral_cong)
12.809 qed
12.810
12.811 -lemma (in measure_space) positive_integral_eq_simple_integral_AE:
12.812 - assumes f: "simple_function M f" "AE x. 0 \<le> f x" shows "integral\<^isup>P M f = integral\<^isup>S M f"
12.813 +lemma positive_integral_eq_simple_integral_AE:
12.814 + assumes f: "simple_function M f" "AE x in M. 0 \<le> f x" shows "integral\<^isup>P M f = integral\<^isup>S M f"
12.815 proof -
12.816 - have "AE x. f x = max 0 (f x)" using f by (auto split: split_max)
12.817 + have "AE x in M. f x = max 0 (f x)" using f by (auto split: split_max)
12.818 with f have "integral\<^isup>P M f = integral\<^isup>S M (\<lambda>x. max 0 (f x))"
12.819 by (simp cong: positive_integral_cong_AE simple_integral_cong_AE
12.820 add: positive_integral_eq_simple_integral)
12.821 @@ -998,7 +897,7 @@
12.822 by (auto intro!: simple_integral_cong_AE split: split_max)
12.823 qed
12.824
12.825 -lemma (in measure_space) positive_integral_SUP_approx:
12.826 +lemma positive_integral_SUP_approx:
12.827 assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M" "\<And>i x. 0 \<le> f i x"
12.828 and u: "simple_function M u" "u \<le> (SUP i. f i)" "u`space M \<subseteq> {0..<\<infinity>}"
12.829 shows "integral\<^isup>S M u \<le> (SUP i. integral\<^isup>P M (f i))" (is "_ \<le> ?S")
12.830 @@ -1028,7 +927,7 @@
12.831 note B_u = Int[OF u(1)[THEN simple_functionD(2)] B]
12.832
12.833 let ?B' = "\<lambda>i n. (u -` {i} \<inter> space M) \<inter> ?B n"
12.834 - have measure_conv: "\<And>i. \<mu> (u -` {i} \<inter> space M) = (SUP n. \<mu> (?B' i n))"
12.835 + have measure_conv: "\<And>i. (emeasure M) (u -` {i} \<inter> space M) = (SUP n. (emeasure M) (?B' i n))"
12.836 proof -
12.837 fix i
12.838 have 1: "range (?B' i) \<subseteq> sets M" using B_u by auto
12.839 @@ -1051,17 +950,17 @@
12.840 thus ?thesis using `x \<in> space M` by auto
12.841 qed
12.842 qed
12.843 - then show "?thesis i" using continuity_from_below[OF 1 2] by simp
12.844 + then show "?thesis i" using SUP_emeasure_incseq[OF 1 2] by simp
12.845 qed
12.846
12.847 have "integral\<^isup>S M u = (SUP i. integral\<^isup>S M (?uB i))"
12.848 unfolding simple_integral_indicator[OF B `simple_function M u`]
12.849 proof (subst SUPR_ereal_setsum, safe)
12.850 fix x n assume "x \<in> space M"
12.851 - with u_range show "incseq (\<lambda>i. u x * \<mu> (?B' (u x) i))" "\<And>i. 0 \<le> u x * \<mu> (?B' (u x) i)"
12.852 - using B_mono B_u by (auto intro!: measure_mono ereal_mult_left_mono incseq_SucI simp: ereal_zero_le_0_iff)
12.853 + with u_range show "incseq (\<lambda>i. u x * (emeasure M) (?B' (u x) i))" "\<And>i. 0 \<le> u x * (emeasure M) (?B' (u x) i)"
12.854 + using B_mono B_u by (auto intro!: emeasure_mono ereal_mult_left_mono incseq_SucI simp: ereal_zero_le_0_iff)
12.855 next
12.856 - show "integral\<^isup>S M u = (\<Sum>i\<in>u ` space M. SUP n. i * \<mu> (?B' i n))"
12.857 + show "integral\<^isup>S M u = (\<Sum>i\<in>u ` space M. SUP n. i * (emeasure M) (?B' i n))"
12.858 using measure_conv u_range B_u unfolding simple_integral_def
12.859 by (auto intro!: setsum_cong SUPR_ereal_cmult[symmetric])
12.860 qed
12.861 @@ -1089,7 +988,7 @@
12.862 ultimately show "a * integral\<^isup>S M u \<le> ?S" by simp
12.863 qed
12.864
12.865 -lemma (in measure_space) incseq_positive_integral:
12.866 +lemma incseq_positive_integral:
12.867 assumes "incseq f" shows "incseq (\<lambda>i. integral\<^isup>P M (f i))"
12.868 proof -
12.869 have "\<And>i x. f i x \<le> f (Suc i) x"
12.870 @@ -1099,7 +998,7 @@
12.871 qed
12.872
12.873 text {* Beppo-Levi monotone convergence theorem *}
12.874 -lemma (in measure_space) positive_integral_monotone_convergence_SUP:
12.875 +lemma positive_integral_monotone_convergence_SUP:
12.876 assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M" "\<And>i x. 0 \<le> f i x"
12.877 shows "(\<integral>\<^isup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^isup>P M (f i))"
12.878 proof (rule antisym)
12.879 @@ -1107,7 +1006,7 @@
12.880 by (auto intro!: SUP_least SUP_upper positive_integral_mono)
12.881 next
12.882 show "(\<integral>\<^isup>+ x. (SUP i. f i x) \<partial>M) \<le> (SUP j. integral\<^isup>P M (f j))"
12.883 - unfolding positive_integral_def_finite[of "\<lambda>x. SUP i. f i x"]
12.884 + unfolding positive_integral_def_finite[of _ "\<lambda>x. SUP i. f i x"]
12.885 proof (safe intro!: SUP_least)
12.886 fix g assume g: "simple_function M g"
12.887 and "g \<le> max 0 \<circ> (\<lambda>x. SUP i. f i x)" "range g \<subseteq> {0..<\<infinity>}"
12.888 @@ -1119,15 +1018,15 @@
12.889 qed
12.890 qed
12.891
12.892 -lemma (in measure_space) positive_integral_monotone_convergence_SUP_AE:
12.893 - assumes f: "\<And>i. AE x. f i x \<le> f (Suc i) x \<and> 0 \<le> f i x" "\<And>i. f i \<in> borel_measurable M"
12.894 +lemma positive_integral_monotone_convergence_SUP_AE:
12.895 + assumes f: "\<And>i. AE x in M. f i x \<le> f (Suc i) x \<and> 0 \<le> f i x" "\<And>i. f i \<in> borel_measurable M"
12.896 shows "(\<integral>\<^isup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^isup>P M (f i))"
12.897 proof -
12.898 - from f have "AE x. \<forall>i. f i x \<le> f (Suc i) x \<and> 0 \<le> f i x"
12.899 + from f have "AE x in M. \<forall>i. f i x \<le> f (Suc i) x \<and> 0 \<le> f i x"
12.900 by (simp add: AE_all_countable)
12.901 from this[THEN AE_E] guess N . note N = this
12.902 let ?f = "\<lambda>i x. if x \<in> space M - N then f i x else 0"
12.903 - have f_eq: "AE x. \<forall>i. ?f i x = f i x" using N by (auto intro!: AE_I[of _ N])
12.904 + have f_eq: "AE x in M. \<forall>i. ?f i x = f i x" using N by (auto intro!: AE_I[of _ _ N])
12.905 then have "(\<integral>\<^isup>+ x. (SUP i. f i x) \<partial>M) = (\<integral>\<^isup>+ x. (SUP i. ?f i x) \<partial>M)"
12.906 by (auto intro!: positive_integral_cong_AE)
12.907 also have "\<dots> = (SUP i. (\<integral>\<^isup>+ x. ?f i x \<partial>M))"
12.908 @@ -1143,14 +1042,14 @@
12.909 finally show ?thesis .
12.910 qed
12.911
12.912 -lemma (in measure_space) positive_integral_monotone_convergence_SUP_AE_incseq:
12.913 - assumes f: "incseq f" "\<And>i. AE x. 0 \<le> f i x" and borel: "\<And>i. f i \<in> borel_measurable M"
12.914 +lemma positive_integral_monotone_convergence_SUP_AE_incseq:
12.915 + assumes f: "incseq f" "\<And>i. AE x in M. 0 \<le> f i x" and borel: "\<And>i. f i \<in> borel_measurable M"
12.916 shows "(\<integral>\<^isup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^isup>P M (f i))"
12.917 using f[unfolded incseq_Suc_iff le_fun_def]
12.918 by (intro positive_integral_monotone_convergence_SUP_AE[OF _ borel])
12.919 auto
12.920
12.921 -lemma (in measure_space) positive_integral_monotone_convergence_simple:
12.922 +lemma positive_integral_monotone_convergence_simple:
12.923 assumes f: "incseq f" "\<And>i x. 0 \<le> f i x" "\<And>i. simple_function M (f i)"
12.924 shows "(SUP i. integral\<^isup>S M (f i)) = (\<integral>\<^isup>+x. (SUP i. f i x) \<partial>M)"
12.925 using assms unfolding positive_integral_monotone_convergence_SUP[OF f(1)
12.926 @@ -1161,7 +1060,7 @@
12.927 "(\<integral>\<^isup>+x. max 0 (f x) \<partial>M) = integral\<^isup>P M f"
12.928 by (simp add: le_fun_def positive_integral_def)
12.929
12.930 -lemma (in measure_space) positive_integral_cong_pos:
12.931 +lemma positive_integral_cong_pos:
12.932 assumes "\<And>x. x \<in> space M \<Longrightarrow> f x \<le> 0 \<and> g x \<le> 0 \<or> f x = g x"
12.933 shows "integral\<^isup>P M f = integral\<^isup>P M g"
12.934 proof -
12.935 @@ -1174,10 +1073,10 @@
12.936 then show ?thesis by (simp add: positive_integral_max_0)
12.937 qed
12.938
12.939 -lemma (in measure_space) SUP_simple_integral_sequences:
12.940 +lemma SUP_simple_integral_sequences:
12.941 assumes f: "incseq f" "\<And>i x. 0 \<le> f i x" "\<And>i. simple_function M (f i)"
12.942 and g: "incseq g" "\<And>i x. 0 \<le> g i x" "\<And>i. simple_function M (g i)"
12.943 - and eq: "AE x. (SUP i. f i x) = (SUP i. g i x)"
12.944 + and eq: "AE x in M. (SUP i. f i x) = (SUP i. g i x)"
12.945 shows "(SUP i. integral\<^isup>S M (f i)) = (SUP i. integral\<^isup>S M (g i))"
12.946 (is "SUPR _ ?F = SUPR _ ?G")
12.947 proof -
12.948 @@ -1190,32 +1089,11 @@
12.949 finally show ?thesis by simp
12.950 qed
12.951
12.952 -lemma (in measure_space) positive_integral_const[simp]:
12.953 - "0 \<le> c \<Longrightarrow> (\<integral>\<^isup>+ x. c \<partial>M) = c * \<mu> (space M)"
12.954 +lemma positive_integral_const[simp]:
12.955 + "0 \<le> c \<Longrightarrow> (\<integral>\<^isup>+ x. c \<partial>M) = c * (emeasure M) (space M)"
12.956 by (subst positive_integral_eq_simple_integral) auto
12.957
12.958 -lemma (in measure_space) positive_integral_vimage:
12.959 - assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'"
12.960 - and f: "f \<in> borel_measurable M'"
12.961 - shows "integral\<^isup>P M' f = (\<integral>\<^isup>+ x. f (T x) \<partial>M)"
12.962 -proof -
12.963 - interpret T: measure_space M' by (rule measure_space_vimage[OF T])
12.964 - from T.borel_measurable_implies_simple_function_sequence'[OF f]
12.965 - guess f' . note f' = this
12.966 - let ?f = "\<lambda>i x. f' i (T x)"
12.967 - have inc: "incseq ?f" using f' by (force simp: le_fun_def incseq_def)
12.968 - have sup: "\<And>x. (SUP i. ?f i x) = max 0 (f (T x))"
12.969 - using f'(4) .
12.970 - have sf: "\<And>i. simple_function M (\<lambda>x. f' i (T x))"
12.971 - using simple_function_vimage[OF T(1) measure_preservingD2[OF T(2)] f'(1)] .
12.972 - show "integral\<^isup>P M' f = (\<integral>\<^isup>+ x. f (T x) \<partial>M)"
12.973 - using
12.974 - T.positive_integral_monotone_convergence_simple[OF f'(2,5,1)]
12.975 - positive_integral_monotone_convergence_simple[OF inc f'(5) sf]
12.976 - by (simp add: positive_integral_max_0 simple_integral_vimage[OF T f'(1)] f')
12.977 -qed
12.978 -
12.979 -lemma (in measure_space) positive_integral_linear:
12.980 +lemma positive_integral_linear:
12.981 assumes f: "f \<in> borel_measurable M" "\<And>x. 0 \<le> f x" and "0 \<le> a"
12.982 and g: "g \<in> borel_measurable M" "\<And>x. 0 \<le> g x"
12.983 shows "(\<integral>\<^isup>+ x. a * f x + g x \<partial>M) = a * integral\<^isup>P M f + integral\<^isup>P M g"
12.984 @@ -1254,7 +1132,7 @@
12.985 by (subst SUPR_ereal_cmult[symmetric, OF u(6) `0 \<le> a`])
12.986 (auto intro!: SUPR_ereal_add
12.987 simp: incseq_Suc_iff le_fun_def add_mono ereal_mult_left_mono ereal_add_nonneg_nonneg) }
12.988 - then show "AE x. (SUP i. l i x) = (SUP i. ?L' i x)"
12.989 + then show "AE x in M. (SUP i. l i x) = (SUP i. ?L' i x)"
12.990 unfolding l(5) using `0 \<le> a` u(5) v(5) l(5) f(2) g(2)
12.991 by (intro AE_I2) (auto split: split_max simp add: ereal_add_nonneg_nonneg)
12.992 qed
12.993 @@ -1268,8 +1146,8 @@
12.994 then show ?thesis by (simp add: positive_integral_max_0)
12.995 qed
12.996
12.997 -lemma (in measure_space) positive_integral_cmult:
12.998 - assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" "0 \<le> c"
12.999 +lemma positive_integral_cmult:
12.1000 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "0 \<le> c"
12.1001 shows "(\<integral>\<^isup>+ x. c * f x \<partial>M) = c * integral\<^isup>P M f"
12.1002 proof -
12.1003 have [simp]: "\<And>x. c * max 0 (f x) = max 0 (c * f x)" using `0 \<le> c`
12.1004 @@ -1277,68 +1155,68 @@
12.1005 have "(\<integral>\<^isup>+ x. c * f x \<partial>M) = (\<integral>\<^isup>+ x. c * max 0 (f x) \<partial>M)"
12.1006 by (simp add: positive_integral_max_0)
12.1007 then show ?thesis
12.1008 - using positive_integral_linear[OF _ _ `0 \<le> c`, of "\<lambda>x. max 0 (f x)" "\<lambda>x. 0"] f
12.1009 + using positive_integral_linear[OF _ _ `0 \<le> c`, of "\<lambda>x. max 0 (f x)" _ "\<lambda>x. 0"] f
12.1010 by (auto simp: positive_integral_max_0)
12.1011 qed
12.1012
12.1013 -lemma (in measure_space) positive_integral_multc:
12.1014 - assumes "f \<in> borel_measurable M" "AE x. 0 \<le> f x" "0 \<le> c"
12.1015 +lemma positive_integral_multc:
12.1016 + assumes "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "0 \<le> c"
12.1017 shows "(\<integral>\<^isup>+ x. f x * c \<partial>M) = integral\<^isup>P M f * c"
12.1018 unfolding mult_commute[of _ c] positive_integral_cmult[OF assms] by simp
12.1019
12.1020 -lemma (in measure_space) positive_integral_indicator[simp]:
12.1021 - "A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. indicator A x\<partial>M) = \<mu> A"
12.1022 +lemma positive_integral_indicator[simp]:
12.1023 + "A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. indicator A x\<partial>M) = (emeasure M) A"
12.1024 by (subst positive_integral_eq_simple_integral)
12.1025 (auto simp: simple_function_indicator simple_integral_indicator)
12.1026
12.1027 -lemma (in measure_space) positive_integral_cmult_indicator:
12.1028 - "0 \<le> c \<Longrightarrow> A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x \<partial>M) = c * \<mu> A"
12.1029 +lemma positive_integral_cmult_indicator:
12.1030 + "0 \<le> c \<Longrightarrow> A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x \<partial>M) = c * (emeasure M) A"
12.1031 by (subst positive_integral_eq_simple_integral)
12.1032 (auto simp: simple_function_indicator simple_integral_indicator)
12.1033
12.1034 -lemma (in measure_space) positive_integral_add:
12.1035 - assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
12.1036 - and g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x"
12.1037 +lemma positive_integral_add:
12.1038 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
12.1039 + and g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
12.1040 shows "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = integral\<^isup>P M f + integral\<^isup>P M g"
12.1041 proof -
12.1042 - have ae: "AE x. max 0 (f x) + max 0 (g x) = max 0 (f x + g x)"
12.1043 + have ae: "AE x in M. max 0 (f x) + max 0 (g x) = max 0 (f x + g x)"
12.1044 using assms by (auto split: split_max simp: ereal_add_nonneg_nonneg)
12.1045 have "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = (\<integral>\<^isup>+ x. max 0 (f x + g x) \<partial>M)"
12.1046 by (simp add: positive_integral_max_0)
12.1047 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) + max 0 (g x) \<partial>M)"
12.1048 unfolding ae[THEN positive_integral_cong_AE] ..
12.1049 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) \<partial>M) + (\<integral>\<^isup>+ x. max 0 (g x) \<partial>M)"
12.1050 - using positive_integral_linear[of "\<lambda>x. max 0 (f x)" 1 "\<lambda>x. max 0 (g x)"] f g
12.1051 + using positive_integral_linear[of "\<lambda>x. max 0 (f x)" _ 1 "\<lambda>x. max 0 (g x)"] f g
12.1052 by auto
12.1053 finally show ?thesis
12.1054 by (simp add: positive_integral_max_0)
12.1055 qed
12.1056
12.1057 -lemma (in measure_space) positive_integral_setsum:
12.1058 - assumes "\<And>i. i\<in>P \<Longrightarrow> f i \<in> borel_measurable M" "\<And>i. i\<in>P \<Longrightarrow> AE x. 0 \<le> f i x"
12.1059 +lemma positive_integral_setsum:
12.1060 + assumes "\<And>i. i\<in>P \<Longrightarrow> f i \<in> borel_measurable M" "\<And>i. i\<in>P \<Longrightarrow> AE x in M. 0 \<le> f i x"
12.1061 shows "(\<integral>\<^isup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^isup>P M (f i))"
12.1062 proof cases
12.1063 assume f: "finite P"
12.1064 - from assms have "AE x. \<forall>i\<in>P. 0 \<le> f i x" unfolding AE_finite_all[OF f] by auto
12.1065 + from assms have "AE x in M. \<forall>i\<in>P. 0 \<le> f i x" unfolding AE_finite_all[OF f] by auto
12.1066 from f this assms(1) show ?thesis
12.1067 proof induct
12.1068 case (insert i P)
12.1069 - then have "f i \<in> borel_measurable M" "AE x. 0 \<le> f i x"
12.1070 - "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M" "AE x. 0 \<le> (\<Sum>i\<in>P. f i x)"
12.1071 + then have "f i \<in> borel_measurable M" "AE x in M. 0 \<le> f i x"
12.1072 + "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M" "AE x in M. 0 \<le> (\<Sum>i\<in>P. f i x)"
12.1073 by (auto intro!: borel_measurable_ereal_setsum setsum_nonneg)
12.1074 from positive_integral_add[OF this]
12.1075 show ?case using insert by auto
12.1076 qed simp
12.1077 qed simp
12.1078
12.1079 -lemma (in measure_space) positive_integral_Markov_inequality:
12.1080 - assumes u: "u \<in> borel_measurable M" "AE x. 0 \<le> u x" and "A \<in> sets M" and c: "0 \<le> c" "c \<noteq> \<infinity>"
12.1081 - shows "\<mu> ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)"
12.1082 - (is "\<mu> ?A \<le> _ * ?PI")
12.1083 +lemma positive_integral_Markov_inequality:
12.1084 + assumes u: "u \<in> borel_measurable M" "AE x in M. 0 \<le> u x" and "A \<in> sets M" and c: "0 \<le> c" "c \<noteq> \<infinity>"
12.1085 + shows "(emeasure M) ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)"
12.1086 + (is "(emeasure M) ?A \<le> _ * ?PI")
12.1087 proof -
12.1088 have "?A \<in> sets M"
12.1089 using `A \<in> sets M` u by auto
12.1090 - hence "\<mu> ?A = (\<integral>\<^isup>+ x. indicator ?A x \<partial>M)"
12.1091 + hence "(emeasure M) ?A = (\<integral>\<^isup>+ x. indicator ?A x \<partial>M)"
12.1092 using positive_integral_indicator by simp
12.1093 also have "\<dots> \<le> (\<integral>\<^isup>+ x. c * (u x * indicator A x) \<partial>M)" using u c
12.1094 by (auto intro!: positive_integral_mono_AE
12.1095 @@ -1349,17 +1227,17 @@
12.1096 finally show ?thesis .
12.1097 qed
12.1098
12.1099 -lemma (in measure_space) positive_integral_noteq_infinite:
12.1100 - assumes g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x"
12.1101 +lemma positive_integral_noteq_infinite:
12.1102 + assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
12.1103 and "integral\<^isup>P M g \<noteq> \<infinity>"
12.1104 - shows "AE x. g x \<noteq> \<infinity>"
12.1105 + shows "AE x in M. g x \<noteq> \<infinity>"
12.1106 proof (rule ccontr)
12.1107 - assume c: "\<not> (AE x. g x \<noteq> \<infinity>)"
12.1108 - have "\<mu> {x\<in>space M. g x = \<infinity>} \<noteq> 0"
12.1109 - using c g by (simp add: AE_iff_null_set)
12.1110 - moreover have "0 \<le> \<mu> {x\<in>space M. g x = \<infinity>}" using g by (auto intro: measurable_sets)
12.1111 - ultimately have "0 < \<mu> {x\<in>space M. g x = \<infinity>}" by auto
12.1112 - then have "\<infinity> = \<infinity> * \<mu> {x\<in>space M. g x = \<infinity>}" by auto
12.1113 + assume c: "\<not> (AE x in M. g x \<noteq> \<infinity>)"
12.1114 + have "(emeasure M) {x\<in>space M. g x = \<infinity>} \<noteq> 0"
12.1115 + using c g by (auto simp add: AE_iff_null)
12.1116 + moreover have "0 \<le> (emeasure M) {x\<in>space M. g x = \<infinity>}" using g by (auto intro: measurable_sets)
12.1117 + ultimately have "0 < (emeasure M) {x\<in>space M. g x = \<infinity>}" by auto
12.1118 + then have "\<infinity> = \<infinity> * (emeasure M) {x\<in>space M. g x = \<infinity>}" by auto
12.1119 also have "\<dots> \<le> (\<integral>\<^isup>+x. \<infinity> * indicator {x\<in>space M. g x = \<infinity>} x \<partial>M)"
12.1120 using g by (subst positive_integral_cmult_indicator) auto
12.1121 also have "\<dots> \<le> integral\<^isup>P M g"
12.1122 @@ -1367,34 +1245,34 @@
12.1123 finally show False using `integral\<^isup>P M g \<noteq> \<infinity>` by auto
12.1124 qed
12.1125
12.1126 -lemma (in measure_space) positive_integral_diff:
12.1127 +lemma positive_integral_diff:
12.1128 assumes f: "f \<in> borel_measurable M"
12.1129 - and g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x"
12.1130 + and g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
12.1131 and fin: "integral\<^isup>P M g \<noteq> \<infinity>"
12.1132 - and mono: "AE x. g x \<le> f x"
12.1133 + and mono: "AE x in M. g x \<le> f x"
12.1134 shows "(\<integral>\<^isup>+ x. f x - g x \<partial>M) = integral\<^isup>P M f - integral\<^isup>P M g"
12.1135 proof -
12.1136 - have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" "AE x. 0 \<le> f x - g x"
12.1137 + have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" "AE x in M. 0 \<le> f x - g x"
12.1138 using assms by (auto intro: ereal_diff_positive)
12.1139 - have pos_f: "AE x. 0 \<le> f x" using mono g by auto
12.1140 + have pos_f: "AE x in M. 0 \<le> f x" using mono g by auto
12.1141 { fix a b :: ereal assume "0 \<le> a" "a \<noteq> \<infinity>" "0 \<le> b" "a \<le> b" then have "b - a + a = b"
12.1142 by (cases rule: ereal2_cases[of a b]) auto }
12.1143 note * = this
12.1144 - then have "AE x. f x = f x - g x + g x"
12.1145 + then have "AE x in M. f x = f x - g x + g x"
12.1146 using mono positive_integral_noteq_infinite[OF g fin] assms by auto
12.1147 then have **: "integral\<^isup>P M f = (\<integral>\<^isup>+x. f x - g x \<partial>M) + integral\<^isup>P M g"
12.1148 unfolding positive_integral_add[OF diff g, symmetric]
12.1149 by (rule positive_integral_cong_AE)
12.1150 show ?thesis unfolding **
12.1151 - using fin positive_integral_positive[of g]
12.1152 + using fin positive_integral_positive[of M g]
12.1153 by (cases rule: ereal2_cases[of "\<integral>\<^isup>+ x. f x - g x \<partial>M" "integral\<^isup>P M g"]) auto
12.1154 qed
12.1155
12.1156 -lemma (in measure_space) positive_integral_suminf:
12.1157 - assumes f: "\<And>i. f i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> f i x"
12.1158 +lemma positive_integral_suminf:
12.1159 + assumes f: "\<And>i. f i \<in> borel_measurable M" "\<And>i. AE x in M. 0 \<le> f i x"
12.1160 shows "(\<integral>\<^isup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^isup>P M (f i))"
12.1161 proof -
12.1162 - have all_pos: "AE x. \<forall>i. 0 \<le> f i x"
12.1163 + have all_pos: "AE x in M. \<forall>i. 0 \<le> f i x"
12.1164 using assms by (auto simp: AE_all_countable)
12.1165 have "(\<Sum>i. integral\<^isup>P M (f i)) = (SUP n. \<Sum>i<n. integral\<^isup>P M (f i))"
12.1166 using positive_integral_positive by (rule suminf_ereal_eq_SUPR)
12.1167 @@ -1409,12 +1287,12 @@
12.1168 qed
12.1169
12.1170 text {* Fatou's lemma: convergence theorem on limes inferior *}
12.1171 -lemma (in measure_space) positive_integral_lim_INF:
12.1172 +lemma positive_integral_lim_INF:
12.1173 fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
12.1174 - assumes u: "\<And>i. u i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> u i x"
12.1175 + assumes u: "\<And>i. u i \<in> borel_measurable M" "\<And>i. AE x in M. 0 \<le> u i x"
12.1176 shows "(\<integral>\<^isup>+ x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^isup>P M (u n))"
12.1177 proof -
12.1178 - have pos: "AE x. \<forall>i. 0 \<le> u i x" using u by (auto simp: AE_all_countable)
12.1179 + have pos: "AE x in M. \<forall>i. 0 \<le> u i x" using u by (auto simp: AE_all_countable)
12.1180 have "(\<integral>\<^isup>+ x. liminf (\<lambda>n. u n x) \<partial>M) =
12.1181 (SUP n. \<integral>\<^isup>+ x. (INF i:{n..}. u i x) \<partial>M)"
12.1182 unfolding liminf_SUPR_INFI using pos u
12.1183 @@ -1426,120 +1304,31 @@
12.1184 finally show ?thesis .
12.1185 qed
12.1186
12.1187 -lemma (in measure_space) measure_space_density:
12.1188 - assumes u: "u \<in> borel_measurable M" "AE x. 0 \<le> u x"
12.1189 - and M'[simp]: "M' = (M\<lparr>measure := \<lambda>A. (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)\<rparr>)"
12.1190 - shows "measure_space M'"
12.1191 -proof -
12.1192 - interpret M': sigma_algebra M' by (intro sigma_algebra_cong) auto
12.1193 - show ?thesis
12.1194 - proof
12.1195 - have pos: "\<And>A. AE x. 0 \<le> u x * indicator A x"
12.1196 - using u by (auto simp: ereal_zero_le_0_iff)
12.1197 - then show "positive M' (measure M')" unfolding M'
12.1198 - using u(1) by (auto simp: positive_def intro!: positive_integral_positive)
12.1199 - show "countably_additive M' (measure M')"
12.1200 - proof (intro countably_additiveI)
12.1201 - fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M'"
12.1202 - then have *: "\<And>i. (\<lambda>x. u x * indicator (A i) x) \<in> borel_measurable M"
12.1203 - using u by (auto intro: borel_measurable_indicator)
12.1204 - assume disj: "disjoint_family A"
12.1205 - have "(\<Sum>n. measure M' (A n)) = (\<integral>\<^isup>+ x. (\<Sum>n. u x * indicator (A n) x) \<partial>M)"
12.1206 - unfolding M' using u(1) *
12.1207 - by (simp add: positive_integral_suminf[OF _ pos, symmetric])
12.1208 - also have "\<dots> = (\<integral>\<^isup>+ x. u x * (\<Sum>n. indicator (A n) x) \<partial>M)" using u
12.1209 - by (intro positive_integral_cong_AE)
12.1210 - (elim AE_mp, auto intro!: AE_I2 suminf_cmult_ereal)
12.1211 - also have "\<dots> = (\<integral>\<^isup>+ x. u x * indicator (\<Union>n. A n) x \<partial>M)"
12.1212 - unfolding suminf_indicator[OF disj] ..
12.1213 - finally show "(\<Sum>n. measure M' (A n)) = measure M' (\<Union>x. A x)"
12.1214 - unfolding M' by simp
12.1215 - qed
12.1216 - qed
12.1217 -qed
12.1218 -
12.1219 -lemma (in measure_space) positive_integral_null_set:
12.1220 - assumes "N \<in> null_sets" shows "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = 0"
12.1221 +lemma positive_integral_null_set:
12.1222 + assumes "N \<in> null_sets M" shows "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = 0"
12.1223 proof -
12.1224 have "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = (\<integral>\<^isup>+ x. 0 \<partial>M)"
12.1225 proof (intro positive_integral_cong_AE AE_I)
12.1226 show "{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N"
12.1227 by (auto simp: indicator_def)
12.1228 - show "\<mu> N = 0" "N \<in> sets M"
12.1229 + show "(emeasure M) N = 0" "N \<in> sets M"
12.1230 using assms by auto
12.1231 qed
12.1232 then show ?thesis by simp
12.1233 qed
12.1234
12.1235 -lemma (in measure_space) positive_integral_translated_density:
12.1236 - assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
12.1237 - assumes g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x"
12.1238 - and M': "M' = (M\<lparr> measure := \<lambda>A. (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)\<rparr>)"
12.1239 - shows "integral\<^isup>P M' g = (\<integral>\<^isup>+ x. f x * g x \<partial>M)"
12.1240 -proof -
12.1241 - from measure_space_density[OF f M']
12.1242 - interpret T: measure_space M' .
12.1243 - have borel[simp]:
12.1244 - "borel_measurable M' = borel_measurable M"
12.1245 - "simple_function M' = simple_function M"
12.1246 - unfolding measurable_def simple_function_def [abs_def] by (auto simp: M')
12.1247 - from borel_measurable_implies_simple_function_sequence'[OF g(1)] guess G . note G = this
12.1248 - note G' = borel_measurable_simple_function[OF this(1)] simple_functionD[OF G(1)]
12.1249 - note G'(2)[simp]
12.1250 - { fix P have "AE x. P x \<Longrightarrow> AE x in M'. P x"
12.1251 - using positive_integral_null_set[of _ f]
12.1252 - unfolding T.almost_everywhere_def almost_everywhere_def
12.1253 - by (auto simp: M') }
12.1254 - note ac = this
12.1255 - from G(4) g(2) have G_M': "AE x in M'. (SUP i. G i x) = g x"
12.1256 - by (auto intro!: ac split: split_max)
12.1257 - { fix i
12.1258 - let ?I = "\<lambda>y x. indicator (G i -` {y} \<inter> space M) x"
12.1259 - { fix x assume *: "x \<in> space M" "0 \<le> f x" "0 \<le> g x"
12.1260 - then have [simp]: "G i ` space M \<inter> {y. G i x = y \<and> x \<in> space M} = {G i x}" by auto
12.1261 - from * G' G have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * (\<Sum>y\<in>G i`space M. (y * ?I y x))"
12.1262 - by (subst setsum_ereal_right_distrib) (auto simp: ac_simps)
12.1263 - also have "\<dots> = f x * G i x"
12.1264 - by (simp add: indicator_def if_distrib setsum_cases)
12.1265 - finally have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * G i x" . }
12.1266 - note to_singleton = this
12.1267 - have "integral\<^isup>P M' (G i) = integral\<^isup>S M' (G i)"
12.1268 - using G T.positive_integral_eq_simple_integral by simp
12.1269 - also have "\<dots> = (\<Sum>y\<in>G i`space M. y * (\<integral>\<^isup>+x. f x * ?I y x \<partial>M))"
12.1270 - unfolding simple_integral_def M' by simp
12.1271 - also have "\<dots> = (\<Sum>y\<in>G i`space M. (\<integral>\<^isup>+x. y * (f x * ?I y x) \<partial>M))"
12.1272 - using f G' G by (auto intro!: setsum_cong positive_integral_cmult[symmetric])
12.1273 - also have "\<dots> = (\<integral>\<^isup>+x. (\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) \<partial>M)"
12.1274 - using f G' G by (auto intro!: positive_integral_setsum[symmetric])
12.1275 - finally have "integral\<^isup>P M' (G i) = (\<integral>\<^isup>+x. f x * G i x \<partial>M)"
12.1276 - using f g G' to_singleton by (auto intro!: positive_integral_cong_AE) }
12.1277 - note [simp] = this
12.1278 - have "integral\<^isup>P M' g = (SUP i. integral\<^isup>P M' (G i))" using G'(1) G_M'(1) G
12.1279 - using T.positive_integral_monotone_convergence_SUP[symmetric, OF `incseq G`]
12.1280 - by (simp cong: T.positive_integral_cong_AE)
12.1281 - also have "\<dots> = (SUP i. (\<integral>\<^isup>+x. f x * G i x \<partial>M))" by simp
12.1282 - also have "\<dots> = (\<integral>\<^isup>+x. (SUP i. f x * G i x) \<partial>M)"
12.1283 - using f G' G(2)[THEN incseq_SucD] G
12.1284 - by (intro positive_integral_monotone_convergence_SUP_AE[symmetric])
12.1285 - (auto simp: ereal_mult_left_mono le_fun_def ereal_zero_le_0_iff)
12.1286 - also have "\<dots> = (\<integral>\<^isup>+x. f x * g x \<partial>M)" using f G' G g
12.1287 - by (intro positive_integral_cong_AE)
12.1288 - (auto simp add: SUPR_ereal_cmult split: split_max)
12.1289 - finally show "integral\<^isup>P M' g = (\<integral>\<^isup>+x. f x * g x \<partial>M)" .
12.1290 -qed
12.1291 -
12.1292 -lemma (in measure_space) positive_integral_0_iff:
12.1293 - assumes u: "u \<in> borel_measurable M" and pos: "AE x. 0 \<le> u x"
12.1294 - shows "integral\<^isup>P M u = 0 \<longleftrightarrow> \<mu> {x\<in>space M. u x \<noteq> 0} = 0"
12.1295 - (is "_ \<longleftrightarrow> \<mu> ?A = 0")
12.1296 +lemma positive_integral_0_iff:
12.1297 + assumes u: "u \<in> borel_measurable M" and pos: "AE x in M. 0 \<le> u x"
12.1298 + shows "integral\<^isup>P M u = 0 \<longleftrightarrow> emeasure M {x\<in>space M. u x \<noteq> 0} = 0"
12.1299 + (is "_ \<longleftrightarrow> (emeasure M) ?A = 0")
12.1300 proof -
12.1301 have u_eq: "(\<integral>\<^isup>+ x. u x * indicator ?A x \<partial>M) = integral\<^isup>P M u"
12.1302 by (auto intro!: positive_integral_cong simp: indicator_def)
12.1303 show ?thesis
12.1304 proof
12.1305 - assume "\<mu> ?A = 0"
12.1306 - with positive_integral_null_set[of ?A u] u
12.1307 - show "integral\<^isup>P M u = 0" by (simp add: u_eq)
12.1308 + assume "(emeasure M) ?A = 0"
12.1309 + with positive_integral_null_set[of ?A M u] u
12.1310 + show "integral\<^isup>P M u = 0" by (simp add: u_eq null_sets_def)
12.1311 next
12.1312 { fix r :: ereal and n :: nat assume gt_1: "1 \<le> real n * r"
12.1313 then have "0 < real n * r" by (cases r) (auto split: split_if_asm simp: one_ereal_def)
12.1314 @@ -1547,17 +1336,17 @@
12.1315 note gt_1 = this
12.1316 assume *: "integral\<^isup>P M u = 0"
12.1317 let ?M = "\<lambda>n. {x \<in> space M. 1 \<le> real (n::nat) * u x}"
12.1318 - have "0 = (SUP n. \<mu> (?M n \<inter> ?A))"
12.1319 + have "0 = (SUP n. (emeasure M) (?M n \<inter> ?A))"
12.1320 proof -
12.1321 { fix n :: nat
12.1322 from positive_integral_Markov_inequality[OF u pos, of ?A "ereal (real n)"]
12.1323 - have "\<mu> (?M n \<inter> ?A) \<le> 0" unfolding u_eq * using u by simp
12.1324 - moreover have "0 \<le> \<mu> (?M n \<inter> ?A)" using u by auto
12.1325 - ultimately have "\<mu> (?M n \<inter> ?A) = 0" by auto }
12.1326 + have "(emeasure M) (?M n \<inter> ?A) \<le> 0" unfolding u_eq * using u by simp
12.1327 + moreover have "0 \<le> (emeasure M) (?M n \<inter> ?A)" using u by auto
12.1328 + ultimately have "(emeasure M) (?M n \<inter> ?A) = 0" by auto }
12.1329 thus ?thesis by simp
12.1330 qed
12.1331 - also have "\<dots> = \<mu> (\<Union>n. ?M n \<inter> ?A)"
12.1332 - proof (safe intro!: continuity_from_below)
12.1333 + also have "\<dots> = (emeasure M) (\<Union>n. ?M n \<inter> ?A)"
12.1334 + proof (safe intro!: SUP_emeasure_incseq)
12.1335 fix n show "?M n \<inter> ?A \<in> sets M"
12.1336 using u by (auto intro!: Int)
12.1337 next
12.1338 @@ -1570,8 +1359,8 @@
12.1339 finally show "1 \<le> real (Suc n) * u x" by auto
12.1340 qed
12.1341 qed
12.1342 - also have "\<dots> = \<mu> {x\<in>space M. 0 < u x}"
12.1343 - proof (safe intro!: arg_cong[where f="\<mu>"] dest!: gt_1)
12.1344 + also have "\<dots> = (emeasure M) {x\<in>space M. 0 < u x}"
12.1345 + proof (safe intro!: arg_cong[where f="(emeasure M)"] dest!: gt_1)
12.1346 fix x assume "0 < u x" and [simp, intro]: "x \<in> space M"
12.1347 show "x \<in> (\<Union>n. ?M n \<inter> ?A)"
12.1348 proof (cases "u x")
12.1349 @@ -1582,88 +1371,48 @@
12.1350 thus ?thesis using `0 < r` real by (auto simp: one_ereal_def)
12.1351 qed (insert `0 < u x`, auto)
12.1352 qed auto
12.1353 - finally have "\<mu> {x\<in>space M. 0 < u x} = 0" by simp
12.1354 + finally have "(emeasure M) {x\<in>space M. 0 < u x} = 0" by simp
12.1355 moreover
12.1356 - from pos have "AE x. \<not> (u x < 0)" by auto
12.1357 - then have "\<mu> {x\<in>space M. u x < 0} = 0"
12.1358 - using AE_iff_null_set u by auto
12.1359 - moreover have "\<mu> {x\<in>space M. u x \<noteq> 0} = \<mu> {x\<in>space M. u x < 0} + \<mu> {x\<in>space M. 0 < u x}"
12.1360 - using u by (subst measure_additive) (auto intro!: arg_cong[where f=\<mu>])
12.1361 - ultimately show "\<mu> ?A = 0" by simp
12.1362 + from pos have "AE x in M. \<not> (u x < 0)" by auto
12.1363 + then have "(emeasure M) {x\<in>space M. u x < 0} = 0"
12.1364 + using AE_iff_null[of M] u by auto
12.1365 + moreover have "(emeasure M) {x\<in>space M. u x \<noteq> 0} = (emeasure M) {x\<in>space M. u x < 0} + (emeasure M) {x\<in>space M. 0 < u x}"
12.1366 + using u by (subst plus_emeasure) (auto intro!: arg_cong[where f="emeasure M"])
12.1367 + ultimately show "(emeasure M) ?A = 0" by simp
12.1368 qed
12.1369 qed
12.1370
12.1371 -lemma (in measure_space) positive_integral_0_iff_AE:
12.1372 +lemma positive_integral_0_iff_AE:
12.1373 assumes u: "u \<in> borel_measurable M"
12.1374 - shows "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x. u x \<le> 0)"
12.1375 + shows "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x in M. u x \<le> 0)"
12.1376 proof -
12.1377 have sets: "{x\<in>space M. max 0 (u x) \<noteq> 0} \<in> sets M"
12.1378 using u by auto
12.1379 from positive_integral_0_iff[of "\<lambda>x. max 0 (u x)"]
12.1380 - have "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x. max 0 (u x) = 0)"
12.1381 + have "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x in M. max 0 (u x) = 0)"
12.1382 unfolding positive_integral_max_0
12.1383 - using AE_iff_null_set[OF sets] u by auto
12.1384 - also have "\<dots> \<longleftrightarrow> (AE x. u x \<le> 0)" by (auto split: split_max)
12.1385 + using AE_iff_null[OF sets] u by auto
12.1386 + also have "\<dots> \<longleftrightarrow> (AE x in M. u x \<le> 0)" by (auto split: split_max)
12.1387 finally show ?thesis .
12.1388 qed
12.1389
12.1390 -lemma (in measure_space) positive_integral_const_If:
12.1391 - "(\<integral>\<^isup>+x. a \<partial>M) = (if 0 \<le> a then a * \<mu> (space M) else 0)"
12.1392 +lemma positive_integral_const_If:
12.1393 + "(\<integral>\<^isup>+x. a \<partial>M) = (if 0 \<le> a then a * (emeasure M) (space M) else 0)"
12.1394 by (auto intro!: positive_integral_0_iff_AE[THEN iffD2])
12.1395
12.1396 -lemma (in measure_space) positive_integral_restricted:
12.1397 - assumes A: "A \<in> sets M"
12.1398 - shows "integral\<^isup>P (restricted_space A) f = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
12.1399 - (is "integral\<^isup>P ?R f = integral\<^isup>P M ?f")
12.1400 -proof -
12.1401 - interpret R: measure_space ?R
12.1402 - by (rule restricted_measure_space) fact
12.1403 - let ?I = "\<lambda>g x. g x * indicator A x :: ereal"
12.1404 - show ?thesis
12.1405 - unfolding positive_integral_def
12.1406 - unfolding simple_function_restricted[OF A]
12.1407 - unfolding AE_restricted[OF A]
12.1408 - proof (safe intro!: SUPR_eq)
12.1409 - fix g assume g: "simple_function M (?I g)" and le: "g \<le> max 0 \<circ> f"
12.1410 - show "\<exists>j\<in>{g. simple_function M g \<and> g \<le> max 0 \<circ> ?I f}.
12.1411 - integral\<^isup>S (restricted_space A) g \<le> integral\<^isup>S M j"
12.1412 - proof (safe intro!: bexI[of _ "?I g"])
12.1413 - show "integral\<^isup>S (restricted_space A) g \<le> integral\<^isup>S M (?I g)"
12.1414 - using g A by (simp add: simple_integral_restricted)
12.1415 - show "?I g \<le> max 0 \<circ> ?I f"
12.1416 - using le by (auto simp: le_fun_def max_def indicator_def split: split_if_asm)
12.1417 - qed fact
12.1418 - next
12.1419 - fix g assume g: "simple_function M g" and le: "g \<le> max 0 \<circ> ?I f"
12.1420 - show "\<exists>i\<in>{g. simple_function M (?I g) \<and> g \<le> max 0 \<circ> f}.
12.1421 - integral\<^isup>S M g \<le> integral\<^isup>S (restricted_space A) i"
12.1422 - proof (safe intro!: bexI[of _ "?I g"])
12.1423 - show "?I g \<le> max 0 \<circ> f"
12.1424 - using le by (auto simp: le_fun_def max_def indicator_def split: split_if_asm)
12.1425 - from le have "\<And>x. g x \<le> ?I (?I g) x"
12.1426 - by (auto simp: le_fun_def max_def indicator_def split: split_if_asm)
12.1427 - then show "integral\<^isup>S M g \<le> integral\<^isup>S (restricted_space A) (?I g)"
12.1428 - using A g by (auto intro!: simple_integral_mono simp: simple_integral_restricted)
12.1429 - show "simple_function M (?I (?I g))" using g A by auto
12.1430 - qed
12.1431 - qed
12.1432 -qed
12.1433 -
12.1434 -lemma (in measure_space) positive_integral_subalgebra:
12.1435 +lemma positive_integral_subalgebra:
12.1436 assumes f: "f \<in> borel_measurable N" "AE x in N. 0 \<le> f x"
12.1437 - and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> measure N A = \<mu> A"
12.1438 - and sa: "sigma_algebra N"
12.1439 + and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> emeasure N A = emeasure M A"
12.1440 shows "integral\<^isup>P N f = integral\<^isup>P M f"
12.1441 proof -
12.1442 - interpret N: measure_space N using measure_space_subalgebra[OF sa N] .
12.1443 - from N.borel_measurable_implies_simple_function_sequence'[OF f(1)] guess fs . note fs = this
12.1444 + from borel_measurable_implies_simple_function_sequence'[OF f(1)] guess fs . note fs = this
12.1445 note sf = simple_function_subalgebra[OF fs(1) N(1,2)]
12.1446 - from N.positive_integral_monotone_convergence_simple[OF fs(2,5,1), symmetric]
12.1447 - have "integral\<^isup>P N f = (SUP i. \<Sum>x\<in>fs i ` space M. x * N.\<mu> (fs i -` {x} \<inter> space M))"
12.1448 + from positive_integral_monotone_convergence_simple[OF fs(2,5,1), symmetric]
12.1449 + have "integral\<^isup>P N f = (SUP i. \<Sum>x\<in>fs i ` space M. x * emeasure N (fs i -` {x} \<inter> space M))"
12.1450 unfolding fs(4) positive_integral_max_0
12.1451 unfolding simple_integral_def `space N = space M` by simp
12.1452 - also have "\<dots> = (SUP i. \<Sum>x\<in>fs i ` space M. x * \<mu> (fs i -` {x} \<inter> space M))"
12.1453 - using N N.simple_functionD(2)[OF fs(1)] unfolding `space N = space M` by auto
12.1454 + also have "\<dots> = (SUP i. \<Sum>x\<in>fs i ` space M. x * (emeasure M) (fs i -` {x} \<inter> space M))"
12.1455 + using N simple_functionD(2)[OF fs(1)] unfolding `space N = space M` by auto
12.1456 also have "\<dots> = integral\<^isup>P M f"
12.1457 using positive_integral_monotone_convergence_simple[OF fs(2,5) sf, symmetric]
12.1458 unfolding fs(4) positive_integral_max_0
12.1459 @@ -1673,7 +1422,7 @@
12.1460
12.1461 section "Lebesgue Integral"
12.1462
12.1463 -definition integrable where
12.1464 +definition integrable :: "'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool" where
12.1465 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and>
12.1466 (\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>"
12.1467
12.1468 @@ -1682,55 +1431,44 @@
12.1469 shows "f \<in> borel_measurable M" "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity>" "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>"
12.1470 using assms unfolding integrable_def by auto
12.1471
12.1472 -definition lebesgue_integral_def:
12.1473 +definition lebesgue_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> real" ("integral\<^isup>L") where
12.1474 "integral\<^isup>L M f = real ((\<integral>\<^isup>+ x. ereal (f x) \<partial>M)) - real ((\<integral>\<^isup>+ x. ereal (- f x) \<partial>M))"
12.1475
12.1476 syntax
12.1477 - "_lebesgue_integral" :: "pttrn \<Rightarrow> real \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> real" ("\<integral> _. _ \<partial>_" [60,61] 110)
12.1478 + "_lebesgue_integral" :: "pttrn \<Rightarrow> real \<Rightarrow> 'a measure \<Rightarrow> real" ("\<integral> _. _ \<partial>_" [60,61] 110)
12.1479
12.1480 translations
12.1481 - "\<integral> x. f \<partial>M" == "CONST integral\<^isup>L M (%x. f)"
12.1482 + "\<integral> x. f \<partial>M" == "CONST lebesgue_integral M (%x. f)"
12.1483
12.1484 -lemma (in measure_space) integrableE:
12.1485 +lemma integrableE:
12.1486 assumes "integrable M f"
12.1487 obtains r q where
12.1488 "(\<integral>\<^isup>+x. ereal (f x)\<partial>M) = ereal r"
12.1489 "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M) = ereal q"
12.1490 "f \<in> borel_measurable M" "integral\<^isup>L M f = r - q"
12.1491 using assms unfolding integrable_def lebesgue_integral_def
12.1492 - using positive_integral_positive[of "\<lambda>x. ereal (f x)"]
12.1493 - using positive_integral_positive[of "\<lambda>x. ereal (-f x)"]
12.1494 + using positive_integral_positive[of M "\<lambda>x. ereal (f x)"]
12.1495 + using positive_integral_positive[of M "\<lambda>x. ereal (-f x)"]
12.1496 by (cases rule: ereal2_cases[of "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M)" "(\<integral>\<^isup>+x. ereal (f x)\<partial>M)"]) auto
12.1497
12.1498 -lemma (in measure_space) integral_cong:
12.1499 +lemma integral_cong:
12.1500 assumes "\<And>x. x \<in> space M \<Longrightarrow> f x = g x"
12.1501 shows "integral\<^isup>L M f = integral\<^isup>L M g"
12.1502 using assms by (simp cong: positive_integral_cong add: lebesgue_integral_def)
12.1503
12.1504 -lemma (in measure_space) integral_cong_measure:
12.1505 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
12.1506 - shows "integral\<^isup>L N f = integral\<^isup>L M f"
12.1507 - by (simp add: positive_integral_cong_measure[OF assms] lebesgue_integral_def)
12.1508 -
12.1509 -lemma (in measure_space) integrable_cong_measure:
12.1510 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
12.1511 - shows "integrable N f \<longleftrightarrow> integrable M f"
12.1512 - using assms
12.1513 - by (simp add: positive_integral_cong_measure[OF assms] integrable_def measurable_def)
12.1514 -
12.1515 -lemma (in measure_space) integral_cong_AE:
12.1516 - assumes cong: "AE x. f x = g x"
12.1517 +lemma integral_cong_AE:
12.1518 + assumes cong: "AE x in M. f x = g x"
12.1519 shows "integral\<^isup>L M f = integral\<^isup>L M g"
12.1520 proof -
12.1521 - have *: "AE x. ereal (f x) = ereal (g x)"
12.1522 - "AE x. ereal (- f x) = ereal (- g x)" using cong by auto
12.1523 + have *: "AE x in M. ereal (f x) = ereal (g x)"
12.1524 + "AE x in M. ereal (- f x) = ereal (- g x)" using cong by auto
12.1525 show ?thesis
12.1526 unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def ..
12.1527 qed
12.1528
12.1529 -lemma (in measure_space) integrable_cong_AE:
12.1530 +lemma integrable_cong_AE:
12.1531 assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
12.1532 - assumes "AE x. f x = g x"
12.1533 + assumes "AE x in M. f x = g x"
12.1534 shows "integrable M f = integrable M g"
12.1535 proof -
12.1536 have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (g x) \<partial>M)"
12.1537 @@ -1740,11 +1478,23 @@
12.1538 by (auto simp: integrable_def)
12.1539 qed
12.1540
12.1541 -lemma (in measure_space) integrable_cong:
12.1542 +lemma integrable_cong:
12.1543 "(\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> integrable M f \<longleftrightarrow> integrable M g"
12.1544 by (simp cong: positive_integral_cong measurable_cong add: integrable_def)
12.1545
12.1546 -lemma (in measure_space) integral_eq_positive_integral:
12.1547 +lemma positive_integral_eq_integral:
12.1548 + assumes f: "integrable M f"
12.1549 + assumes nonneg: "AE x in M. 0 \<le> f x"
12.1550 + shows "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) = integral\<^isup>L M f"
12.1551 +proof -
12.1552 + have "(\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M) = (\<integral>\<^isup>+ x. 0 \<partial>M)"
12.1553 + using nonneg by (intro positive_integral_cong_AE) (auto split: split_max)
12.1554 + with f positive_integral_positive show ?thesis
12.1555 + by (cases "\<integral>\<^isup>+ x. ereal (f x) \<partial>M")
12.1556 + (auto simp add: lebesgue_integral_def positive_integral_max_0 integrable_def)
12.1557 +qed
12.1558 +
12.1559 +lemma integral_eq_positive_integral:
12.1560 assumes f: "\<And>x. 0 \<le> f x"
12.1561 shows "integral\<^isup>L M f = real (\<integral>\<^isup>+ x. ereal (f x) \<partial>M)"
12.1562 proof -
12.1563 @@ -1755,84 +1505,12 @@
12.1564 unfolding lebesgue_integral_def by simp
12.1565 qed
12.1566
12.1567 -lemma (in measure_space) integral_vimage:
12.1568 - assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'"
12.1569 - assumes f: "f \<in> borel_measurable M'"
12.1570 - shows "integral\<^isup>L M' f = (\<integral>x. f (T x) \<partial>M)"
12.1571 -proof -
12.1572 - interpret T: measure_space M' by (rule measure_space_vimage[OF T])
12.1573 - from measurable_comp[OF measure_preservingD2[OF T(2)], of f borel]
12.1574 - have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'"
12.1575 - and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
12.1576 - using f by (auto simp: comp_def)
12.1577 - then show ?thesis
12.1578 - using f unfolding lebesgue_integral_def integrable_def
12.1579 - by (auto simp: borel[THEN positive_integral_vimage[OF T]])
12.1580 -qed
12.1581 -
12.1582 -lemma (in measure_space) integrable_vimage:
12.1583 - assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'"
12.1584 - assumes f: "integrable M' f"
12.1585 - shows "integrable M (\<lambda>x. f (T x))"
12.1586 -proof -
12.1587 - interpret T: measure_space M' by (rule measure_space_vimage[OF T])
12.1588 - from measurable_comp[OF measure_preservingD2[OF T(2)], of f borel]
12.1589 - have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'"
12.1590 - and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
12.1591 - using f by (auto simp: comp_def)
12.1592 - then show ?thesis
12.1593 - using f unfolding lebesgue_integral_def integrable_def
12.1594 - by (auto simp: borel[THEN positive_integral_vimage[OF T]])
12.1595 -qed
12.1596 -
12.1597 -lemma (in measure_space) integral_translated_density:
12.1598 - assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
12.1599 - and g: "g \<in> borel_measurable M"
12.1600 - and N: "space N = space M" "sets N = sets M"
12.1601 - and density: "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
12.1602 - (is "\<And>A. _ \<Longrightarrow> _ = ?d A")
12.1603 - shows "integral\<^isup>L N g = (\<integral> x. f x * g x \<partial>M)" (is ?integral)
12.1604 - and "integrable N g = integrable M (\<lambda>x. f x * g x)" (is ?integrable)
12.1605 -proof -
12.1606 - from f have ms: "measure_space (M\<lparr>measure := ?d\<rparr>)"
12.1607 - by (intro measure_space_density[where u="\<lambda>x. ereal (f x)"]) auto
12.1608 -
12.1609 - from ms density N have "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (g x)) \<partial>M\<lparr>measure := ?d\<rparr>)"
12.1610 - unfolding positive_integral_max_0
12.1611 - by (intro measure_space.positive_integral_cong_measure) auto
12.1612 - also have "\<dots> = (\<integral>\<^isup>+ x. ereal (f x) * max 0 (ereal (g x)) \<partial>M)"
12.1613 - using f g by (intro positive_integral_translated_density) auto
12.1614 - also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (ereal (f x * g x)) \<partial>M)"
12.1615 - using f by (intro positive_integral_cong_AE)
12.1616 - (auto simp: ereal_max_0 zero_le_mult_iff split: split_max)
12.1617 - finally have pos: "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. f x * g x \<partial>M)"
12.1618 - by (simp add: positive_integral_max_0)
12.1619 -
12.1620 - from ms density N have "(\<integral>\<^isup>+ x. - (g x) \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (- g x)) \<partial>M\<lparr>measure := ?d\<rparr>)"
12.1621 - unfolding positive_integral_max_0
12.1622 - by (intro measure_space.positive_integral_cong_measure) auto
12.1623 - also have "\<dots> = (\<integral>\<^isup>+ x. ereal (f x) * max 0 (ereal (- g x)) \<partial>M)"
12.1624 - using f g by (intro positive_integral_translated_density) auto
12.1625 - also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (ereal (- f x * g x)) \<partial>M)"
12.1626 - using f by (intro positive_integral_cong_AE)
12.1627 - (auto simp: ereal_max_0 mult_le_0_iff split: split_max)
12.1628 - finally have neg: "(\<integral>\<^isup>+ x. - g x \<partial>N) = (\<integral>\<^isup>+ x. - (f x * g x) \<partial>M)"
12.1629 - by (simp add: positive_integral_max_0)
12.1630 -
12.1631 - have g_N: "g \<in> borel_measurable N"
12.1632 - using g N unfolding measurable_def by simp
12.1633 -
12.1634 - show ?integral ?integrable
12.1635 - unfolding lebesgue_integral_def integrable_def
12.1636 - using pos neg f g g_N by auto
12.1637 -qed
12.1638 -
12.1639 -lemma (in measure_space) integral_minus[intro, simp]:
12.1640 +lemma integral_minus[intro, simp]:
12.1641 assumes "integrable M f"
12.1642 shows "integrable M (\<lambda>x. - f x)" "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f"
12.1643 using assms by (auto simp: integrable_def lebesgue_integral_def)
12.1644
12.1645 -lemma (in measure_space) integral_minus_iff[simp]:
12.1646 +lemma integral_minus_iff[simp]:
12.1647 "integrable M (\<lambda>x. - f x) \<longleftrightarrow> integrable M f"
12.1648 proof
12.1649 assume "integrable M (\<lambda>x. - f x)"
12.1650 @@ -1841,7 +1519,7 @@
12.1651 then show "integrable M f" by simp
12.1652 qed (rule integral_minus)
12.1653
12.1654 -lemma (in measure_space) integral_of_positive_diff:
12.1655 +lemma integral_of_positive_diff:
12.1656 assumes integrable: "integrable M u" "integrable M v"
12.1657 and f_def: "\<And>x. f x = u x - v x" and pos: "\<And>x. 0 \<le> u x" "\<And>x. 0 \<le> v x"
12.1658 shows "integrable M f" and "integral\<^isup>L M f = integral\<^isup>L M u - integral\<^isup>L M v"
12.1659 @@ -1851,7 +1529,7 @@
12.1660 let ?u = "\<lambda>x. max 0 (ereal (u x))"
12.1661 let ?v = "\<lambda>x. max 0 (ereal (v x))"
12.1662
12.1663 - from borel_measurable_diff[of u v] integrable
12.1664 + from borel_measurable_diff[of u M v] integrable
12.1665 have f_borel: "?f \<in> borel_measurable M" and
12.1666 mf_borel: "?mf \<in> borel_measurable M" and
12.1667 v_borel: "?v \<in> borel_measurable M" and
12.1668 @@ -1881,7 +1559,7 @@
12.1669 using integrable f by (auto elim!: integrableE)
12.1670 qed
12.1671
12.1672 -lemma (in measure_space) integral_linear:
12.1673 +lemma integral_linear:
12.1674 assumes "integrable M f" "integrable M g" and "0 \<le> a"
12.1675 shows "integrable M (\<lambda>t. a * f t + g t)"
12.1676 and "(\<integral> t. a * f t + g t \<partial>M) = a * integral\<^isup>L M f + integral\<^isup>L M g" (is ?EQ)
12.1677 @@ -1917,18 +1595,18 @@
12.1678 by (auto elim!: integrableE simp: field_simps)
12.1679 qed
12.1680
12.1681 -lemma (in measure_space) integral_add[simp, intro]:
12.1682 +lemma integral_add[simp, intro]:
12.1683 assumes "integrable M f" "integrable M g"
12.1684 shows "integrable M (\<lambda>t. f t + g t)"
12.1685 and "(\<integral> t. f t + g t \<partial>M) = integral\<^isup>L M f + integral\<^isup>L M g"
12.1686 using assms integral_linear[where a=1] by auto
12.1687
12.1688 -lemma (in measure_space) integral_zero[simp, intro]:
12.1689 +lemma integral_zero[simp, intro]:
12.1690 shows "integrable M (\<lambda>x. 0)" "(\<integral> x.0 \<partial>M) = 0"
12.1691 unfolding integrable_def lebesgue_integral_def
12.1692 by (auto simp add: borel_measurable_const)
12.1693
12.1694 -lemma (in measure_space) integral_cmult[simp, intro]:
12.1695 +lemma integral_cmult[simp, intro]:
12.1696 assumes "integrable M f"
12.1697 shows "integrable M (\<lambda>t. a * f t)" (is ?P)
12.1698 and "(\<integral> t. a * f t \<partial>M) = a * integral\<^isup>L M f" (is ?I)
12.1699 @@ -1942,37 +1620,80 @@
12.1700 assume "a \<le> 0" hence "0 \<le> - a" by auto
12.1701 have *: "\<And>t. - a * t + 0 = (-a) * t" by simp
12.1702 show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`]
12.1703 - integral_minus(1)[of "\<lambda>t. - a * f t"]
12.1704 + integral_minus(1)[of M "\<lambda>t. - a * f t"]
12.1705 unfolding * integral_zero by simp
12.1706 qed
12.1707 thus ?P ?I by auto
12.1708 qed
12.1709
12.1710 -lemma (in measure_space) integral_multc:
12.1711 +lemma lebesgue_integral_cmult_nonneg:
12.1712 + assumes f: "f \<in> borel_measurable M" and "0 \<le> c"
12.1713 + shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f"
12.1714 +proof -
12.1715 + { have "c * real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (f x)))) =
12.1716 + real (ereal c * integral\<^isup>P M (\<lambda>x. max 0 (ereal (f x))))"
12.1717 + by simp
12.1718 + also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. ereal c * max 0 (ereal (f x))))"
12.1719 + using f `0 \<le> c` by (subst positive_integral_cmult) auto
12.1720 + also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (c * f x))))"
12.1721 + using `0 \<le> c` by (auto intro!: arg_cong[where f=real] positive_integral_cong simp: max_def zero_le_mult_iff)
12.1722 + finally have "real (integral\<^isup>P M (\<lambda>x. ereal (c * f x))) = c * real (integral\<^isup>P M (\<lambda>x. ereal (f x)))"
12.1723 + by (simp add: positive_integral_max_0) }
12.1724 + moreover
12.1725 + { have "c * real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (- f x)))) =
12.1726 + real (ereal c * integral\<^isup>P M (\<lambda>x. max 0 (ereal (- f x))))"
12.1727 + by simp
12.1728 + also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. ereal c * max 0 (ereal (- f x))))"
12.1729 + using f `0 \<le> c` by (subst positive_integral_cmult) auto
12.1730 + also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (- c * f x))))"
12.1731 + using `0 \<le> c` by (auto intro!: arg_cong[where f=real] positive_integral_cong simp: max_def mult_le_0_iff)
12.1732 + finally have "real (integral\<^isup>P M (\<lambda>x. ereal (- c * f x))) = c * real (integral\<^isup>P M (\<lambda>x. ereal (- f x)))"
12.1733 + by (simp add: positive_integral_max_0) }
12.1734 + ultimately show ?thesis
12.1735 + by (simp add: lebesgue_integral_def field_simps)
12.1736 +qed
12.1737 +
12.1738 +lemma lebesgue_integral_uminus:
12.1739 + "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f"
12.1740 + unfolding lebesgue_integral_def by simp
12.1741 +
12.1742 +lemma lebesgue_integral_cmult:
12.1743 + assumes f: "f \<in> borel_measurable M"
12.1744 + shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f"
12.1745 +proof (cases rule: linorder_le_cases)
12.1746 + assume "0 \<le> c" with f show ?thesis by (rule lebesgue_integral_cmult_nonneg)
12.1747 +next
12.1748 + assume "c \<le> 0"
12.1749 + with lebesgue_integral_cmult_nonneg[OF f, of "-c"]
12.1750 + show ?thesis
12.1751 + by (simp add: lebesgue_integral_def)
12.1752 +qed
12.1753 +
12.1754 +lemma integral_multc:
12.1755 assumes "integrable M f"
12.1756 shows "(\<integral> x. f x * c \<partial>M) = integral\<^isup>L M f * c"
12.1757 unfolding mult_commute[of _ c] integral_cmult[OF assms] ..
12.1758
12.1759 -lemma (in measure_space) integral_mono_AE:
12.1760 +lemma integral_mono_AE:
12.1761 assumes fg: "integrable M f" "integrable M g"
12.1762 - and mono: "AE t. f t \<le> g t"
12.1763 + and mono: "AE t in M. f t \<le> g t"
12.1764 shows "integral\<^isup>L M f \<le> integral\<^isup>L M g"
12.1765 proof -
12.1766 - have "AE x. ereal (f x) \<le> ereal (g x)"
12.1767 + have "AE x in M. ereal (f x) \<le> ereal (g x)"
12.1768 using mono by auto
12.1769 - moreover have "AE x. ereal (- g x) \<le> ereal (- f x)"
12.1770 + moreover have "AE x in M. ereal (- g x) \<le> ereal (- f x)"
12.1771 using mono by auto
12.1772 ultimately show ?thesis using fg
12.1773 by (auto intro!: add_mono positive_integral_mono_AE real_of_ereal_positive_mono
12.1774 simp: positive_integral_positive lebesgue_integral_def diff_minus)
12.1775 qed
12.1776
12.1777 -lemma (in measure_space) integral_mono:
12.1778 +lemma integral_mono:
12.1779 assumes "integrable M f" "integrable M g" "\<And>t. t \<in> space M \<Longrightarrow> f t \<le> g t"
12.1780 shows "integral\<^isup>L M f \<le> integral\<^isup>L M g"
12.1781 using assms by (auto intro: integral_mono_AE)
12.1782
12.1783 -lemma (in measure_space) integral_diff[simp, intro]:
12.1784 +lemma integral_diff[simp, intro]:
12.1785 assumes f: "integrable M f" and g: "integrable M g"
12.1786 shows "integrable M (\<lambda>t. f t - g t)"
12.1787 and "(\<integral> t. f t - g t \<partial>M) = integral\<^isup>L M f - integral\<^isup>L M g"
12.1788 @@ -1980,9 +1701,9 @@
12.1789 unfolding diff_minus integral_minus(2)[OF g]
12.1790 by auto
12.1791
12.1792 -lemma (in measure_space) integral_indicator[simp, intro]:
12.1793 - assumes "A \<in> sets M" and "\<mu> A \<noteq> \<infinity>"
12.1794 - shows "integral\<^isup>L M (indicator A) = real (\<mu> A)" (is ?int)
12.1795 +lemma integral_indicator[simp, intro]:
12.1796 + assumes "A \<in> sets M" and "(emeasure M) A \<noteq> \<infinity>"
12.1797 + shows "integral\<^isup>L M (indicator A) = real ((emeasure M) A)" (is ?int)
12.1798 and "integrable M (indicator A)" (is ?able)
12.1799 proof -
12.1800 from `A \<in> sets M` have *:
12.1801 @@ -1994,10 +1715,10 @@
12.1802 by (auto simp: * positive_integral_indicator borel_measurable_indicator)
12.1803 qed
12.1804
12.1805 -lemma (in measure_space) integral_cmul_indicator:
12.1806 - assumes "A \<in> sets M" and "c \<noteq> 0 \<Longrightarrow> \<mu> A \<noteq> \<infinity>"
12.1807 +lemma integral_cmul_indicator:
12.1808 + assumes "A \<in> sets M" and "c \<noteq> 0 \<Longrightarrow> (emeasure M) A \<noteq> \<infinity>"
12.1809 shows "integrable M (\<lambda>x. c * indicator A x)" (is ?P)
12.1810 - and "(\<integral>x. c * indicator A x \<partial>M) = c * real (\<mu> A)" (is ?I)
12.1811 + and "(\<integral>x. c * indicator A x \<partial>M) = c * real ((emeasure M) A)" (is ?I)
12.1812 proof -
12.1813 show ?P
12.1814 proof (cases "c = 0")
12.1815 @@ -2010,7 +1731,7 @@
12.1816 qed simp
12.1817 qed
12.1818
12.1819 -lemma (in measure_space) integral_setsum[simp, intro]:
12.1820 +lemma integral_setsum[simp, intro]:
12.1821 assumes "\<And>n. n \<in> S \<Longrightarrow> integrable M (f n)"
12.1822 shows "(\<integral>x. (\<Sum> i \<in> S. f i x) \<partial>M) = (\<Sum> i \<in> S. integral\<^isup>L M (f i))" (is "?int S")
12.1823 and "integrable M (\<lambda>x. \<Sum> i \<in> S. f i x)" (is "?I S")
12.1824 @@ -2023,7 +1744,7 @@
12.1825 thus "?int S" and "?I S" by auto
12.1826 qed
12.1827
12.1828 -lemma (in measure_space) integrable_abs:
12.1829 +lemma integrable_abs:
12.1830 assumes "integrable M f"
12.1831 shows "integrable M (\<lambda> x. \<bar>f x\<bar>)"
12.1832 proof -
12.1833 @@ -2034,23 +1755,22 @@
12.1834 by (simp add: positive_integral_add positive_integral_max_0 integrable_def)
12.1835 qed
12.1836
12.1837 -lemma (in measure_space) integral_subalgebra:
12.1838 +lemma integral_subalgebra:
12.1839 assumes borel: "f \<in> borel_measurable N"
12.1840 - and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> measure N A = \<mu> A" and sa: "sigma_algebra N"
12.1841 + and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> emeasure N A = emeasure M A"
12.1842 shows "integrable N f \<longleftrightarrow> integrable M f" (is ?P)
12.1843 and "integral\<^isup>L N f = integral\<^isup>L M f" (is ?I)
12.1844 proof -
12.1845 - interpret N: measure_space N using measure_space_subalgebra[OF sa N] .
12.1846 have "(\<integral>\<^isup>+ x. max 0 (ereal (f x)) \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (f x)) \<partial>M)"
12.1847 "(\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M)"
12.1848 - using borel by (auto intro!: positive_integral_subalgebra N sa)
12.1849 + using borel by (auto intro!: positive_integral_subalgebra N)
12.1850 moreover have "f \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable N"
12.1851 using assms unfolding measurable_def by auto
12.1852 ultimately show ?P ?I
12.1853 by (auto simp: integrable_def lebesgue_integral_def positive_integral_max_0)
12.1854 qed
12.1855
12.1856 -lemma (in measure_space) integrable_bound:
12.1857 +lemma integrable_bound:
12.1858 assumes "integrable M f"
12.1859 and f: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
12.1860 "\<And>x. x \<in> space M \<Longrightarrow> \<bar>g x\<bar> \<le> f x"
12.1861 @@ -2077,11 +1797,21 @@
12.1862 unfolding integrable_def by auto
12.1863 qed
12.1864
12.1865 -lemma (in measure_space) integrable_abs_iff:
12.1866 +lemma lebesgue_integral_nonneg:
12.1867 + assumes ae: "(AE x in M. 0 \<le> f x)" shows "0 \<le> integral\<^isup>L M f"
12.1868 +proof -
12.1869 + have "(\<integral>\<^isup>+x. max 0 (ereal (- f x)) \<partial>M) = (\<integral>\<^isup>+x. 0 \<partial>M)"
12.1870 + using ae by (intro positive_integral_cong_AE) (auto simp: max_def)
12.1871 + then show ?thesis
12.1872 + by (auto simp: lebesgue_integral_def positive_integral_max_0
12.1873 + intro!: real_of_ereal_pos positive_integral_positive)
12.1874 +qed
12.1875 +
12.1876 +lemma integrable_abs_iff:
12.1877 "f \<in> borel_measurable M \<Longrightarrow> integrable M (\<lambda> x. \<bar>f x\<bar>) \<longleftrightarrow> integrable M f"
12.1878 by (auto intro!: integrable_bound[where g=f] integrable_abs)
12.1879
12.1880 -lemma (in measure_space) integrable_max:
12.1881 +lemma integrable_max:
12.1882 assumes int: "integrable M f" "integrable M g"
12.1883 shows "integrable M (\<lambda> x. max (f x) (g x))"
12.1884 proof (rule integrable_bound)
12.1885 @@ -2095,7 +1825,7 @@
12.1886 by auto
12.1887 qed
12.1888
12.1889 -lemma (in measure_space) integrable_min:
12.1890 +lemma integrable_min:
12.1891 assumes int: "integrable M f" "integrable M g"
12.1892 shows "integrable M (\<lambda> x. min (f x) (g x))"
12.1893 proof (rule integrable_bound)
12.1894 @@ -2109,18 +1839,18 @@
12.1895 by auto
12.1896 qed
12.1897
12.1898 -lemma (in measure_space) integral_triangle_inequality:
12.1899 +lemma integral_triangle_inequality:
12.1900 assumes "integrable M f"
12.1901 shows "\<bar>integral\<^isup>L M f\<bar> \<le> (\<integral>x. \<bar>f x\<bar> \<partial>M)"
12.1902 proof -
12.1903 have "\<bar>integral\<^isup>L M f\<bar> = max (integral\<^isup>L M f) (- integral\<^isup>L M f)" by auto
12.1904 also have "\<dots> \<le> (\<integral>x. \<bar>f x\<bar> \<partial>M)"
12.1905 - using assms integral_minus(2)[of f, symmetric]
12.1906 + using assms integral_minus(2)[of M f, symmetric]
12.1907 by (auto intro!: integral_mono integrable_abs simp del: integral_minus)
12.1908 finally show ?thesis .
12.1909 qed
12.1910
12.1911 -lemma (in measure_space) integral_positive:
12.1912 +lemma integral_positive:
12.1913 assumes "integrable M f" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
12.1914 shows "0 \<le> integral\<^isup>L M f"
12.1915 proof -
12.1916 @@ -2130,7 +1860,7 @@
12.1917 finally show ?thesis .
12.1918 qed
12.1919
12.1920 -lemma (in measure_space) integral_monotone_convergence_pos:
12.1921 +lemma integral_monotone_convergence_pos:
12.1922 assumes i: "\<And>i. integrable M (f i)" and mono: "\<And>x. mono (\<lambda>n. f n x)"
12.1923 and pos: "\<And>x i. 0 \<le> f i x"
12.1924 and lim: "\<And>x. (\<lambda>i. f i x) ----> u x"
12.1925 @@ -2157,7 +1887,7 @@
12.1926 using i borel_u pos pos_u by (auto simp: positive_integral_0_iff_AE integrable_def)
12.1927
12.1928 have integral_eq: "\<And>n. (\<integral>\<^isup>+ x. ereal (f n x) \<partial>M) = ereal (integral\<^isup>L M (f n))"
12.1929 - using i positive_integral_positive by (auto simp: ereal_real lebesgue_integral_def integrable_def)
12.1930 + using i positive_integral_positive[of M] by (auto simp: ereal_real lebesgue_integral_def integrable_def)
12.1931
12.1932 have pos_integral: "\<And>n. 0 \<le> integral\<^isup>L M (f n)"
12.1933 using pos i by (auto simp: integral_positive)
12.1934 @@ -2177,7 +1907,7 @@
12.1935 unfolding integrable_def lebesgue_integral_def by auto
12.1936 qed
12.1937
12.1938 -lemma (in measure_space) integral_monotone_convergence:
12.1939 +lemma integral_monotone_convergence:
12.1940 assumes f: "\<And>i. integrable M (f i)" and "mono f"
12.1941 and lim: "\<And>x. (\<lambda>i. f i x) ----> u x"
12.1942 and ilim: "(\<lambda>i. integral\<^isup>L M (f i)) ----> x"
12.1943 @@ -2201,9 +1931,9 @@
12.1944 by (auto simp: integral_diff)
12.1945 qed
12.1946
12.1947 -lemma (in measure_space) integral_0_iff:
12.1948 +lemma integral_0_iff:
12.1949 assumes "integrable M f"
12.1950 - shows "(\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> \<mu> {x\<in>space M. f x \<noteq> 0} = 0"
12.1951 + shows "(\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> (emeasure M) {x\<in>space M. f x \<noteq> 0} = 0"
12.1952 proof -
12.1953 have *: "(\<integral>\<^isup>+x. ereal (- \<bar>f x\<bar>) \<partial>M) = 0"
12.1954 using assms by (auto simp: positive_integral_0_iff_AE integrable_def)
12.1955 @@ -2212,57 +1942,57 @@
12.1956 "(\<integral>\<^isup>+ x. ereal \<bar>f x\<bar> \<partial>M) \<noteq> \<infinity>" unfolding integrable_def by auto
12.1957 from positive_integral_0_iff[OF this(1)] this(2)
12.1958 show ?thesis unfolding lebesgue_integral_def *
12.1959 - using positive_integral_positive[of "\<lambda>x. ereal \<bar>f x\<bar>"]
12.1960 + using positive_integral_positive[of M "\<lambda>x. ereal \<bar>f x\<bar>"]
12.1961 by (auto simp add: real_of_ereal_eq_0)
12.1962 qed
12.1963
12.1964 -lemma (in measure_space) positive_integral_PInf:
12.1965 +lemma positive_integral_PInf:
12.1966 assumes f: "f \<in> borel_measurable M"
12.1967 and not_Inf: "integral\<^isup>P M f \<noteq> \<infinity>"
12.1968 - shows "\<mu> (f -` {\<infinity>} \<inter> space M) = 0"
12.1969 + shows "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0"
12.1970 proof -
12.1971 - have "\<infinity> * \<mu> (f -` {\<infinity>} \<inter> space M) = (\<integral>\<^isup>+ x. \<infinity> * indicator (f -` {\<infinity>} \<inter> space M) x \<partial>M)"
12.1972 + have "\<infinity> * (emeasure M) (f -` {\<infinity>} \<inter> space M) = (\<integral>\<^isup>+ x. \<infinity> * indicator (f -` {\<infinity>} \<inter> space M) x \<partial>M)"
12.1973 using f by (subst positive_integral_cmult_indicator) (auto simp: measurable_sets)
12.1974 also have "\<dots> \<le> integral\<^isup>P M (\<lambda>x. max 0 (f x))"
12.1975 by (auto intro!: positive_integral_mono simp: indicator_def max_def)
12.1976 - finally have "\<infinity> * \<mu> (f -` {\<infinity>} \<inter> space M) \<le> integral\<^isup>P M f"
12.1977 + finally have "\<infinity> * (emeasure M) (f -` {\<infinity>} \<inter> space M) \<le> integral\<^isup>P M f"
12.1978 by (simp add: positive_integral_max_0)
12.1979 - moreover have "0 \<le> \<mu> (f -` {\<infinity>} \<inter> space M)"
12.1980 - using f by (simp add: measurable_sets)
12.1981 + moreover have "0 \<le> (emeasure M) (f -` {\<infinity>} \<inter> space M)"
12.1982 + by (rule emeasure_nonneg)
12.1983 ultimately show ?thesis
12.1984 using assms by (auto split: split_if_asm)
12.1985 qed
12.1986
12.1987 -lemma (in measure_space) positive_integral_PInf_AE:
12.1988 - assumes "f \<in> borel_measurable M" "integral\<^isup>P M f \<noteq> \<infinity>" shows "AE x. f x \<noteq> \<infinity>"
12.1989 +lemma positive_integral_PInf_AE:
12.1990 + assumes "f \<in> borel_measurable M" "integral\<^isup>P M f \<noteq> \<infinity>" shows "AE x in M. f x \<noteq> \<infinity>"
12.1991 proof (rule AE_I)
12.1992 - show "\<mu> (f -` {\<infinity>} \<inter> space M) = 0"
12.1993 + show "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0"
12.1994 by (rule positive_integral_PInf[OF assms])
12.1995 show "f -` {\<infinity>} \<inter> space M \<in> sets M"
12.1996 using assms by (auto intro: borel_measurable_vimage)
12.1997 qed auto
12.1998
12.1999 -lemma (in measure_space) simple_integral_PInf:
12.2000 +lemma simple_integral_PInf:
12.2001 assumes "simple_function M f" "\<And>x. 0 \<le> f x"
12.2002 and "integral\<^isup>S M f \<noteq> \<infinity>"
12.2003 - shows "\<mu> (f -` {\<infinity>} \<inter> space M) = 0"
12.2004 + shows "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0"
12.2005 proof (rule positive_integral_PInf)
12.2006 show "f \<in> borel_measurable M" using assms by (auto intro: borel_measurable_simple_function)
12.2007 show "integral\<^isup>P M f \<noteq> \<infinity>"
12.2008 using assms by (simp add: positive_integral_eq_simple_integral)
12.2009 qed
12.2010
12.2011 -lemma (in measure_space) integral_real:
12.2012 - "AE x. \<bar>f x\<bar> \<noteq> \<infinity> \<Longrightarrow> (\<integral>x. real (f x) \<partial>M) = real (integral\<^isup>P M f) - real (integral\<^isup>P M (\<lambda>x. - f x))"
12.2013 +lemma integral_real:
12.2014 + "AE x in M. \<bar>f x\<bar> \<noteq> \<infinity> \<Longrightarrow> (\<integral>x. real (f x) \<partial>M) = real (integral\<^isup>P M f) - real (integral\<^isup>P M (\<lambda>x. - f x))"
12.2015 using assms unfolding lebesgue_integral_def
12.2016 by (subst (1 2) positive_integral_cong_AE) (auto simp add: ereal_real)
12.2017
12.2018 lemma (in finite_measure) lebesgue_integral_const[simp]:
12.2019 shows "integrable M (\<lambda>x. a)"
12.2020 - and "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)"
12.2021 + and "(\<integral>x. a \<partial>M) = a * (measure M) (space M)"
12.2022 proof -
12.2023 { fix a :: real assume "0 \<le> a"
12.2024 - then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * \<mu> (space M)"
12.2025 + then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * (emeasure M) (space M)"
12.2026 by (subst positive_integral_const) auto
12.2027 moreover
12.2028 from `0 \<le> a` have "(\<integral>\<^isup>+ x. ereal (-a) \<partial>M) = 0"
12.2029 @@ -2277,8 +2007,8 @@
12.2030 then have "0 \<le> -a" by auto
12.2031 from *[OF this] show ?thesis by simp
12.2032 qed
12.2033 - show "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)"
12.2034 - by (simp add: \<mu>'_def lebesgue_integral_def positive_integral_const_If)
12.2035 + show "(\<integral>x. a \<partial>M) = a * measure M (space M)"
12.2036 + by (simp add: lebesgue_integral_def positive_integral_const_If emeasure_eq_measure)
12.2037 qed
12.2038
12.2039 lemma indicator_less[simp]:
12.2040 @@ -2287,8 +2017,8 @@
12.2041
12.2042 lemma (in finite_measure) integral_less_AE:
12.2043 assumes int: "integrable M X" "integrable M Y"
12.2044 - assumes A: "\<mu> A \<noteq> 0" "A \<in> sets M" "AE x. x \<in> A \<longrightarrow> X x \<noteq> Y x"
12.2045 - assumes gt: "AE x. X x \<le> Y x"
12.2046 + assumes A: "(emeasure M) A \<noteq> 0" "A \<in> sets M" "AE x in M. x \<in> A \<longrightarrow> X x \<noteq> Y x"
12.2047 + assumes gt: "AE x in M. X x \<le> Y x"
12.2048 shows "integral\<^isup>L M X < integral\<^isup>L M Y"
12.2049 proof -
12.2050 have "integral\<^isup>L M X \<le> integral\<^isup>L M Y"
12.2051 @@ -2301,26 +2031,27 @@
12.2052 using gt by (intro integral_cong_AE) auto
12.2053 also have "\<dots> = 0"
12.2054 using eq int by simp
12.2055 - finally have "\<mu> {x \<in> space M. Y x - X x \<noteq> 0} = 0"
12.2056 + finally have "(emeasure M) {x \<in> space M. Y x - X x \<noteq> 0} = 0"
12.2057 using int by (simp add: integral_0_iff)
12.2058 moreover
12.2059 have "(\<integral>\<^isup>+x. indicator A x \<partial>M) \<le> (\<integral>\<^isup>+x. indicator {x \<in> space M. Y x - X x \<noteq> 0} x \<partial>M)"
12.2060 using A by (intro positive_integral_mono_AE) auto
12.2061 - then have "\<mu> A \<le> \<mu> {x \<in> space M. Y x - X x \<noteq> 0}"
12.2062 + then have "(emeasure M) A \<le> (emeasure M) {x \<in> space M. Y x - X x \<noteq> 0}"
12.2063 using int A by (simp add: integrable_def)
12.2064 - moreover note `\<mu> A \<noteq> 0` positive_measure[OF `A \<in> sets M`]
12.2065 - ultimately show False by auto
12.2066 + ultimately have "emeasure M A = 0"
12.2067 + using emeasure_nonneg[of M A] by simp
12.2068 + with `(emeasure M) A \<noteq> 0` show False by auto
12.2069 qed
12.2070 ultimately show ?thesis by auto
12.2071 qed
12.2072
12.2073 lemma (in finite_measure) integral_less_AE_space:
12.2074 assumes int: "integrable M X" "integrable M Y"
12.2075 - assumes gt: "AE x. X x < Y x" "\<mu> (space M) \<noteq> 0"
12.2076 + assumes gt: "AE x in M. X x < Y x" "(emeasure M) (space M) \<noteq> 0"
12.2077 shows "integral\<^isup>L M X < integral\<^isup>L M Y"
12.2078 using gt by (intro integral_less_AE[OF int, where A="space M"]) auto
12.2079
12.2080 -lemma (in measure_space) integral_dominated_convergence:
12.2081 +lemma integral_dominated_convergence:
12.2082 assumes u: "\<And>i. integrable M (u i)" and bound: "\<And>x j. x\<in>space M \<Longrightarrow> \<bar>u j x\<bar> \<le> w x"
12.2083 and w: "integrable M w"
12.2084 and u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"
12.2085 @@ -2336,7 +2067,7 @@
12.2086
12.2087 from u[unfolded integrable_def]
12.2088 have u'_borel: "u' \<in> borel_measurable M"
12.2089 - using u' by (blast intro: borel_measurable_LIMSEQ[of u])
12.2090 + using u' by (blast intro: borel_measurable_LIMSEQ[of M u])
12.2091
12.2092 { fix x assume x: "x \<in> space M"
12.2093 then have "0 \<le> \<bar>u 0 x\<bar>" by auto
12.2094 @@ -2385,7 +2116,7 @@
12.2095 using diff_less_2w[of _ n] unfolding positive_integral_max_0
12.2096 by (intro positive_integral_mono) auto
12.2097 then have "?f n = 0"
12.2098 - using positive_integral_positive[of ?f'] eq_0 by auto }
12.2099 + using positive_integral_positive[of M ?f'] eq_0 by auto }
12.2100 then show ?thesis by (simp add: Limsup_const)
12.2101 next
12.2102 assume neq_0: "(\<integral>\<^isup>+ x. max 0 (ereal (2 * w x)) \<partial>M) \<noteq> 0" (is "?wx \<noteq> 0")
12.2103 @@ -2411,10 +2142,10 @@
12.2104 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (2 * w x) \<partial>M) -
12.2105 limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)"
12.2106 unfolding PI_diff positive_integral_max_0
12.2107 - using positive_integral_positive[of "\<lambda>x. ereal (2 * w x)"]
12.2108 + using positive_integral_positive[of M "\<lambda>x. ereal (2 * w x)"]
12.2109 by (subst liminf_ereal_cminus) auto
12.2110 finally show ?thesis
12.2111 - using neq_0 I2w_fin positive_integral_positive[of "\<lambda>x. ereal (2 * w x)"] pos
12.2112 + using neq_0 I2w_fin positive_integral_positive[of M "\<lambda>x. ereal (2 * w x)"] pos
12.2113 unfolding positive_integral_max_0
12.2114 by (cases rule: ereal2_cases[of "\<integral>\<^isup>+ x. ereal (2 * w x) \<partial>M" "limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)"])
12.2115 auto
12.2116 @@ -2430,8 +2161,8 @@
12.2117 ultimately have liminf_limsup_eq: "liminf ?f = ereal 0" "limsup ?f = ereal 0"
12.2118 using `limsup ?f = 0` by auto
12.2119 have "\<And>n. (\<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M) = ereal (\<integral>x. \<bar>u n x - u' x\<bar> \<partial>M)"
12.2120 - using diff positive_integral_positive
12.2121 - by (subst integral_eq_positive_integral) (auto simp: ereal_real integrable_def)
12.2122 + using diff positive_integral_positive[of M]
12.2123 + by (subst integral_eq_positive_integral[of _ M]) (auto simp: ereal_real integrable_def)
12.2124 then show ?lim_diff
12.2125 using ereal_Liminf_eq_Limsup[OF trivial_limit_sequentially liminf_limsup_eq]
12.2126 by (simp add: lim_ereal)
12.2127 @@ -2456,7 +2187,7 @@
12.2128 qed
12.2129 qed
12.2130
12.2131 -lemma (in measure_space) integral_sums:
12.2132 +lemma integral_sums:
12.2133 assumes borel: "\<And>i. integrable M (f i)"
12.2134 and summable: "\<And>x. x \<in> space M \<Longrightarrow> summable (\<lambda>i. \<bar>f i x\<bar>)"
12.2135 and sums: "summable (\<lambda>i. (\<integral>x. \<bar>f i x\<bar> \<partial>M))"
12.2136 @@ -2513,18 +2244,18 @@
12.2137
12.2138 section "Lebesgue integration on countable spaces"
12.2139
12.2140 -lemma (in measure_space) integral_on_countable:
12.2141 +lemma integral_on_countable:
12.2142 assumes f: "f \<in> borel_measurable M"
12.2143 and bij: "bij_betw enum S (f ` space M)"
12.2144 and enum_zero: "enum ` (-S) \<subseteq> {0}"
12.2145 - and fin: "\<And>x. x \<noteq> 0 \<Longrightarrow> \<mu> (f -` {x} \<inter> space M) \<noteq> \<infinity>"
12.2146 - and abs_summable: "summable (\<lambda>r. \<bar>enum r * real (\<mu> (f -` {enum r} \<inter> space M))\<bar>)"
12.2147 + and fin: "\<And>x. x \<noteq> 0 \<Longrightarrow> (emeasure M) (f -` {x} \<inter> space M) \<noteq> \<infinity>"
12.2148 + and abs_summable: "summable (\<lambda>r. \<bar>enum r * real ((emeasure M) (f -` {enum r} \<inter> space M))\<bar>)"
12.2149 shows "integrable M f"
12.2150 - and "(\<lambda>r. enum r * real (\<mu> (f -` {enum r} \<inter> space M))) sums integral\<^isup>L M f" (is ?sums)
12.2151 + and "(\<lambda>r. enum r * real ((emeasure M) (f -` {enum r} \<inter> space M))) sums integral\<^isup>L M f" (is ?sums)
12.2152 proof -
12.2153 let ?A = "\<lambda>r. f -` {enum r} \<inter> space M"
12.2154 let ?F = "\<lambda>r x. enum r * indicator (?A r) x"
12.2155 - have enum_eq: "\<And>r. enum r * real (\<mu> (?A r)) = integral\<^isup>L M (?F r)"
12.2156 + have enum_eq: "\<And>r. enum r * real ((emeasure M) (?A r)) = integral\<^isup>L M (?F r)"
12.2157 using f fin by (simp add: borel_measurable_vimage integral_cmul_indicator)
12.2158
12.2159 { fix x assume "x \<in> space M"
12.2160 @@ -2551,9 +2282,9 @@
12.2161 { fix r
12.2162 have "(\<integral>x. \<bar>?F r x\<bar> \<partial>M) = (\<integral>x. \<bar>enum r\<bar> * indicator (?A r) x \<partial>M)"
12.2163 by (auto simp: indicator_def intro!: integral_cong)
12.2164 - also have "\<dots> = \<bar>enum r\<bar> * real (\<mu> (?A r))"
12.2165 + also have "\<dots> = \<bar>enum r\<bar> * real ((emeasure M) (?A r))"
12.2166 using f fin by (simp add: borel_measurable_vimage integral_cmul_indicator)
12.2167 - finally have "(\<integral>x. \<bar>?F r x\<bar> \<partial>M) = \<bar>enum r * real (\<mu> (?A r))\<bar>"
12.2168 + finally have "(\<integral>x. \<bar>?F r x\<bar> \<partial>M) = \<bar>enum r * real ((emeasure M) (?A r))\<bar>"
12.2169 using f by (subst (2) abs_mult_pos[symmetric]) (auto intro!: real_of_ereal_pos measurable_sets) }
12.2170 note int_abs_F = this
12.2171
12.2172 @@ -2570,67 +2301,469 @@
12.2173 show "integrable M f" unfolding int_f by simp
12.2174 qed
12.2175
12.2176 -section "Lebesgue integration on finite space"
12.2177 +section {* Distributions *}
12.2178
12.2179 -lemma (in measure_space) integral_on_finite:
12.2180 - assumes f: "f \<in> borel_measurable M" and finite: "finite (f`space M)"
12.2181 - and fin: "\<And>x. x \<noteq> 0 \<Longrightarrow> \<mu> (f -` {x} \<inter> space M) \<noteq> \<infinity>"
12.2182 - shows "integrable M f"
12.2183 - and "(\<integral>x. f x \<partial>M) =
12.2184 - (\<Sum> r \<in> f`space M. r * real (\<mu> (f -` {r} \<inter> space M)))" (is "?integral")
12.2185 +lemma simple_function_distr[simp]:
12.2186 + "simple_function (distr M M' T) f \<longleftrightarrow> simple_function M' (\<lambda>x. f x)"
12.2187 + unfolding simple_function_def by simp
12.2188 +
12.2189 +lemma positive_integral_distr:
12.2190 + assumes T: "T \<in> measurable M M'"
12.2191 + and f: "f \<in> borel_measurable M'"
12.2192 + shows "integral\<^isup>P (distr M M' T) f = (\<integral>\<^isup>+ x. f (T x) \<partial>M)"
12.2193 proof -
12.2194 - let ?A = "\<lambda>r. f -` {r} \<inter> space M"
12.2195 - let ?S = "\<lambda>x. \<Sum>r\<in>f`space M. r * indicator (?A r) x"
12.2196 -
12.2197 - { fix x assume "x \<in> space M"
12.2198 - have "f x = (\<Sum>r\<in>f`space M. if x \<in> ?A r then r else 0)"
12.2199 - using finite `x \<in> space M` by (simp add: setsum_cases)
12.2200 - also have "\<dots> = ?S x"
12.2201 - by (auto intro!: setsum_cong)
12.2202 - finally have "f x = ?S x" . }
12.2203 - note f_eq = this
12.2204 -
12.2205 - have f_eq_S: "integrable M f \<longleftrightarrow> integrable M ?S" "integral\<^isup>L M f = integral\<^isup>L M ?S"
12.2206 - by (auto intro!: integrable_cong integral_cong simp only: f_eq)
12.2207 -
12.2208 - show "integrable M f" ?integral using fin f f_eq_S
12.2209 - by (simp_all add: integral_cmul_indicator borel_measurable_vimage)
12.2210 + from borel_measurable_implies_simple_function_sequence'[OF f]
12.2211 + guess f' . note f' = this
12.2212 + then have f_distr: "\<And>i. simple_function (distr M M' T) (f' i)"
12.2213 + by simp
12.2214 + let ?f = "\<lambda>i x. f' i (T x)"
12.2215 + have inc: "incseq ?f" using f' by (force simp: le_fun_def incseq_def)
12.2216 + have sup: "\<And>x. (SUP i. ?f i x) = max 0 (f (T x))"
12.2217 + using f'(4) .
12.2218 + have sf: "\<And>i. simple_function M (\<lambda>x. f' i (T x))"
12.2219 + using simple_function_comp[OF T(1) f'(1)] .
12.2220 + show "integral\<^isup>P (distr M M' T) f = (\<integral>\<^isup>+ x. f (T x) \<partial>M)"
12.2221 + using
12.2222 + positive_integral_monotone_convergence_simple[OF f'(2,5) f_distr]
12.2223 + positive_integral_monotone_convergence_simple[OF inc f'(5) sf]
12.2224 + by (simp add: positive_integral_max_0 simple_integral_distr[OF T f'(1)] f')
12.2225 qed
12.2226
12.2227 -lemma (in finite_measure_space) simple_function_finite[simp, intro]: "simple_function M f"
12.2228 - unfolding simple_function_def using finite_space by auto
12.2229 -
12.2230 -lemma (in finite_measure_space) borel_measurable_finite[intro, simp]: "f \<in> borel_measurable M"
12.2231 - by (auto intro: borel_measurable_simple_function)
12.2232 -
12.2233 -lemma (in finite_measure_space) positive_integral_finite_eq_setsum:
12.2234 - assumes pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
12.2235 - shows "integral\<^isup>P M f = (\<Sum>x \<in> space M. f x * \<mu> {x})"
12.2236 +lemma integral_distr:
12.2237 + assumes T: "T \<in> measurable M M'"
12.2238 + assumes f: "f \<in> borel_measurable M'"
12.2239 + shows "integral\<^isup>L (distr M M' T) f = (\<integral>x. f (T x) \<partial>M)"
12.2240 proof -
12.2241 - have *: "integral\<^isup>P M f = (\<integral>\<^isup>+ x. (\<Sum>y\<in>space M. f y * indicator {y} x) \<partial>M)"
12.2242 - by (auto intro!: positive_integral_cong simp add: indicator_def if_distrib setsum_cases[OF finite_space])
12.2243 - show ?thesis unfolding * using borel_measurable_finite[of f] pos
12.2244 - by (simp add: positive_integral_setsum positive_integral_cmult_indicator)
12.2245 + from measurable_comp[OF T, of f borel]
12.2246 + have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'"
12.2247 + and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
12.2248 + using f by (auto simp: comp_def)
12.2249 + then show ?thesis
12.2250 + using f unfolding lebesgue_integral_def integrable_def
12.2251 + by (auto simp: borel[THEN positive_integral_distr[OF T]])
12.2252 qed
12.2253
12.2254 -lemma (in finite_measure_space) integral_finite_singleton:
12.2255 - shows "integrable M f"
12.2256 - and "integral\<^isup>L M f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I)
12.2257 +lemma integrable_distr:
12.2258 + assumes T: "T \<in> measurable M M'" and f: "integrable (distr M M' T) f"
12.2259 + shows "integrable M (\<lambda>x. f (T x))"
12.2260 proof -
12.2261 - have *:
12.2262 - "(\<integral>\<^isup>+ x. max 0 (ereal (f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (ereal (f x)) * \<mu> {x})"
12.2263 - "(\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (ereal (- f x)) * \<mu> {x})"
12.2264 - by (simp_all add: positive_integral_finite_eq_setsum)
12.2265 - then show "integrable M f" using finite_space finite_measure
12.2266 - by (simp add: setsum_Pinfty integrable_def positive_integral_max_0
12.2267 - split: split_max)
12.2268 - show ?I using finite_measure *
12.2269 - apply (simp add: positive_integral_max_0 lebesgue_integral_def)
12.2270 - apply (subst (1 2) setsum_real_of_ereal[symmetric])
12.2271 - apply (simp_all split: split_max add: setsum_subtractf[symmetric])
12.2272 - apply (intro setsum_cong[OF refl])
12.2273 - apply (simp split: split_max)
12.2274 - done
12.2275 + from measurable_comp[OF T, of f borel]
12.2276 + have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'"
12.2277 + and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
12.2278 + using f by (auto simp: comp_def)
12.2279 + then show ?thesis
12.2280 + using f unfolding lebesgue_integral_def integrable_def
12.2281 + using borel[THEN positive_integral_distr[OF T]]
12.2282 + by (auto simp: borel[THEN positive_integral_distr[OF T]])
12.2283 qed
12.2284
12.2285 +section {* Lebesgue integration on @{const count_space} *}
12.2286 +
12.2287 +lemma simple_function_count_space[simp]:
12.2288 + "simple_function (count_space A) f \<longleftrightarrow> finite (f ` A)"
12.2289 + unfolding simple_function_def by simp
12.2290 +
12.2291 +lemma positive_integral_count_space:
12.2292 + assumes A: "finite {a\<in>A. 0 < f a}"
12.2293 + shows "integral\<^isup>P (count_space A) f = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)"
12.2294 +proof -
12.2295 + have *: "(\<integral>\<^isup>+x. max 0 (f x) \<partial>count_space A) =
12.2296 + (\<integral>\<^isup>+ x. (\<Sum>a|a\<in>A \<and> 0 < f a. f a * indicator {a} x) \<partial>count_space A)"
12.2297 + by (auto intro!: positive_integral_cong
12.2298 + simp add: indicator_def if_distrib setsum_cases[OF A] max_def le_less)
12.2299 + also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. \<integral>\<^isup>+ x. f a * indicator {a} x \<partial>count_space A)"
12.2300 + by (subst positive_integral_setsum)
12.2301 + (simp_all add: AE_count_space ereal_zero_le_0_iff less_imp_le)
12.2302 + also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)"
12.2303 + by (auto intro!: setsum_cong simp: positive_integral_cmult_indicator one_ereal_def[symmetric])
12.2304 + finally show ?thesis by (simp add: positive_integral_max_0)
12.2305 +qed
12.2306 +
12.2307 +lemma integrable_count_space:
12.2308 + "finite X \<Longrightarrow> integrable (count_space X) f"
12.2309 + by (auto simp: positive_integral_count_space integrable_def)
12.2310 +
12.2311 +lemma positive_integral_count_space_finite:
12.2312 + "finite A \<Longrightarrow> (\<integral>\<^isup>+x. f x \<partial>count_space A) = (\<Sum>a\<in>A. max 0 (f a))"
12.2313 + by (subst positive_integral_max_0[symmetric])
12.2314 + (auto intro!: setsum_mono_zero_left simp: positive_integral_count_space less_le)
12.2315 +
12.2316 +lemma lebesgue_integral_count_space_finite:
12.2317 + "finite A \<Longrightarrow> (\<integral>x. f x \<partial>count_space A) = (\<Sum>a\<in>A. f a)"
12.2318 + apply (auto intro!: setsum_mono_zero_left
12.2319 + simp: positive_integral_count_space_finite lebesgue_integral_def)
12.2320 + apply (subst (1 2) setsum_real_of_ereal[symmetric])
12.2321 + apply (auto simp: max_def setsum_subtractf[symmetric] intro!: setsum_cong)
12.2322 + done
12.2323 +
12.2324 +section {* Measure spaces with an associated density *}
12.2325 +
12.2326 +definition density :: "'a measure \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> 'a measure" where
12.2327 + "density M f = measure_of (space M) (sets M) (\<lambda>A. \<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
12.2328 +
12.2329 +lemma
12.2330 + shows sets_density[simp]: "sets (density M f) = sets M"
12.2331 + and space_density[simp]: "space (density M f) = space M"
12.2332 + by (auto simp: density_def)
12.2333 +
12.2334 +lemma
12.2335 + shows measurable_density_eq1[simp]: "g \<in> measurable (density Mg f) Mg' \<longleftrightarrow> g \<in> measurable Mg Mg'"
12.2336 + and measurable_density_eq2[simp]: "h \<in> measurable Mh (density Mh' f) \<longleftrightarrow> h \<in> measurable Mh Mh'"
12.2337 + and simple_function_density_eq[simp]: "simple_function (density Mu f) u \<longleftrightarrow> simple_function Mu u"
12.2338 + unfolding measurable_def simple_function_def by simp_all
12.2339 +
12.2340 +lemma density_cong: "f \<in> borel_measurable M \<Longrightarrow> f' \<in> borel_measurable M \<Longrightarrow>
12.2341 + (AE x in M. f x = f' x) \<Longrightarrow> density M f = density M f'"
12.2342 + unfolding density_def by (auto intro!: measure_of_eq positive_integral_cong_AE space_closed)
12.2343 +
12.2344 +lemma density_max_0: "density M f = density M (\<lambda>x. max 0 (f x))"
12.2345 +proof -
12.2346 + have "\<And>x A. max 0 (f x) * indicator A x = max 0 (f x * indicator A x)"
12.2347 + by (auto simp: indicator_def)
12.2348 + then show ?thesis
12.2349 + unfolding density_def by (simp add: positive_integral_max_0)
12.2350 +qed
12.2351 +
12.2352 +lemma density_ereal_max_0: "density M (\<lambda>x. ereal (f x)) = density M (\<lambda>x. ereal (max 0 (f x)))"
12.2353 + by (subst density_max_0) (auto intro!: arg_cong[where f="density M"] split: split_max)
12.2354 +
12.2355 +lemma emeasure_density:
12.2356 + assumes f: "f \<in> borel_measurable M" and A: "A \<in> sets M"
12.2357 + shows "emeasure (density M f) A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)"
12.2358 + (is "_ = ?\<mu> A")
12.2359 + unfolding density_def
12.2360 +proof (rule emeasure_measure_of_sigma)
12.2361 + show "sigma_algebra (space M) (sets M)" ..
12.2362 + show "positive (sets M) ?\<mu>"
12.2363 + using f by (auto simp: positive_def intro!: positive_integral_positive)
12.2364 + have \<mu>_eq: "?\<mu> = (\<lambda>A. \<integral>\<^isup>+ x. max 0 (f x) * indicator A x \<partial>M)" (is "?\<mu> = ?\<mu>'")
12.2365 + apply (subst positive_integral_max_0[symmetric])
12.2366 + apply (intro ext positive_integral_cong_AE AE_I2)
12.2367 + apply (auto simp: indicator_def)
12.2368 + done
12.2369 + show "countably_additive (sets M) ?\<mu>"
12.2370 + unfolding \<mu>_eq
12.2371 + proof (intro countably_additiveI)
12.2372 + fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M"
12.2373 + then have *: "\<And>i. (\<lambda>x. max 0 (f x) * indicator (A i) x) \<in> borel_measurable M"
12.2374 + using f by (auto intro!: borel_measurable_ereal_times)
12.2375 + assume disj: "disjoint_family A"
12.2376 + have "(\<Sum>n. ?\<mu>' (A n)) = (\<integral>\<^isup>+ x. (\<Sum>n. max 0 (f x) * indicator (A n) x) \<partial>M)"
12.2377 + using f * by (simp add: positive_integral_suminf)
12.2378 + also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) * (\<Sum>n. indicator (A n) x) \<partial>M)" using f
12.2379 + by (auto intro!: suminf_cmult_ereal positive_integral_cong_AE)
12.2380 + also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) * indicator (\<Union>n. A n) x \<partial>M)"
12.2381 + unfolding suminf_indicator[OF disj] ..
12.2382 + finally show "(\<Sum>n. ?\<mu>' (A n)) = ?\<mu>' (\<Union>x. A x)" by simp
12.2383 + qed
12.2384 +qed fact
12.2385 +
12.2386 +lemma null_sets_density_iff:
12.2387 + assumes f: "f \<in> borel_measurable M"
12.2388 + shows "A \<in> null_sets (density M f) \<longleftrightarrow> A \<in> sets M \<and> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)"
12.2389 +proof -
12.2390 + { assume "A \<in> sets M"
12.2391 + have eq: "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. max 0 (f x) * indicator A x \<partial>M)"
12.2392 + apply (subst positive_integral_max_0[symmetric])
12.2393 + apply (intro positive_integral_cong)
12.2394 + apply (auto simp: indicator_def)
12.2395 + done
12.2396 + have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow>
12.2397 + emeasure M {x \<in> space M. max 0 (f x) * indicator A x \<noteq> 0} = 0"
12.2398 + unfolding eq
12.2399 + using f `A \<in> sets M`
12.2400 + by (intro positive_integral_0_iff) auto
12.2401 + also have "\<dots> \<longleftrightarrow> (AE x in M. max 0 (f x) * indicator A x = 0)"
12.2402 + using f `A \<in> sets M`
12.2403 + by (intro AE_iff_measurable[OF _ refl, symmetric])
12.2404 + (auto intro!: sets_Collect borel_measurable_ereal_eq)
12.2405 + also have "(AE x in M. max 0 (f x) * indicator A x = 0) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)"
12.2406 + by (auto simp add: indicator_def max_def split: split_if_asm)
12.2407 + finally have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" . }
12.2408 + with f show ?thesis
12.2409 + by (simp add: null_sets_def emeasure_density cong: conj_cong)
12.2410 +qed
12.2411 +
12.2412 +lemma AE_density:
12.2413 + assumes f: "f \<in> borel_measurable M"
12.2414 + shows "(AE x in density M f. P x) \<longleftrightarrow> (AE x in M. 0 < f x \<longrightarrow> P x)"
12.2415 +proof
12.2416 + assume "AE x in density M f. P x"
12.2417 + with f obtain N where "{x \<in> space M. \<not> P x} \<subseteq> N" "N \<in> sets M" and ae: "AE x in M. x \<in> N \<longrightarrow> f x \<le> 0"
12.2418 + by (auto simp: eventually_ae_filter null_sets_density_iff)
12.2419 + then have "AE x in M. x \<notin> N \<longrightarrow> P x" by auto
12.2420 + with ae show "AE x in M. 0 < f x \<longrightarrow> P x"
12.2421 + by (rule eventually_elim2) auto
12.2422 +next
12.2423 + fix N assume ae: "AE x in M. 0 < f x \<longrightarrow> P x"
12.2424 + then obtain N where "{x \<in> space M. \<not> (0 < f x \<longrightarrow> P x)} \<subseteq> N" "N \<in> null_sets M"
12.2425 + by (auto simp: eventually_ae_filter)
12.2426 + then have *: "{x \<in> space (density M f). \<not> P x} \<subseteq> N \<union> {x\<in>space M. \<not> 0 < f x}"
12.2427 + "N \<union> {x\<in>space M. \<not> 0 < f x} \<in> sets M" and ae2: "AE x in M. x \<notin> N"
12.2428 + using f by (auto simp: subset_eq intro!: sets_Collect_neg AE_not_in)
12.2429 + show "AE x in density M f. P x"
12.2430 + using ae2
12.2431 + unfolding eventually_ae_filter[of _ "density M f"] Bex_def null_sets_density_iff[OF f]
12.2432 + by (intro exI[of _ "N \<union> {x\<in>space M. \<not> 0 < f x}"] conjI *)
12.2433 + (auto elim: eventually_elim2)
12.2434 +qed
12.2435 +
12.2436 +lemma positive_integral_density:
12.2437 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
12.2438 + assumes g': "g' \<in> borel_measurable M"
12.2439 + shows "integral\<^isup>P (density M f) g' = (\<integral>\<^isup>+ x. f x * g' x \<partial>M)"
12.2440 +proof -
12.2441 + def g \<equiv> "\<lambda>x. max 0 (g' x)"
12.2442 + then have g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
12.2443 + using g' by auto
12.2444 + from borel_measurable_implies_simple_function_sequence'[OF g(1)] guess G . note G = this
12.2445 + note G' = borel_measurable_simple_function[OF this(1)] simple_functionD[OF G(1)]
12.2446 + note G'(2)[simp]
12.2447 + { fix P have "AE x in M. P x \<Longrightarrow> AE x in M. P x"
12.2448 + using positive_integral_null_set[of _ _ f]
12.2449 + by (auto simp: eventually_ae_filter ) }
12.2450 + note ac = this
12.2451 + with G(4) f g have G_M': "AE x in density M f. (SUP i. G i x) = g x"
12.2452 + by (auto simp add: AE_density[OF f(1)] max_def)
12.2453 + { fix i
12.2454 + let ?I = "\<lambda>y x. indicator (G i -` {y} \<inter> space M) x"
12.2455 + { fix x assume *: "x \<in> space M" "0 \<le> f x" "0 \<le> g x"
12.2456 + then have [simp]: "G i ` space M \<inter> {y. G i x = y \<and> x \<in> space M} = {G i x}" by auto
12.2457 + from * G' G have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * (\<Sum>y\<in>G i`space M. (y * ?I y x))"
12.2458 + by (subst setsum_ereal_right_distrib) (auto simp: ac_simps)
12.2459 + also have "\<dots> = f x * G i x"
12.2460 + by (simp add: indicator_def if_distrib setsum_cases)
12.2461 + finally have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * G i x" . }
12.2462 + note to_singleton = this
12.2463 + have "integral\<^isup>P (density M f) (G i) = integral\<^isup>S (density M f) (G i)"
12.2464 + using G by (intro positive_integral_eq_simple_integral) simp_all
12.2465 + also have "\<dots> = (\<Sum>y\<in>G i`space M. y * (\<integral>\<^isup>+x. f x * ?I y x \<partial>M))"
12.2466 + using f G(1)
12.2467 + by (auto intro!: setsum_cong arg_cong2[where f="op *"] emeasure_density
12.2468 + simp: simple_function_def simple_integral_def)
12.2469 + also have "\<dots> = (\<Sum>y\<in>G i`space M. (\<integral>\<^isup>+x. y * (f x * ?I y x) \<partial>M))"
12.2470 + using f G' G by (auto intro!: setsum_cong positive_integral_cmult[symmetric])
12.2471 + also have "\<dots> = (\<integral>\<^isup>+x. (\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) \<partial>M)"
12.2472 + using f G' G by (auto intro!: positive_integral_setsum[symmetric])
12.2473 + finally have "integral\<^isup>P (density M f) (G i) = (\<integral>\<^isup>+x. f x * G i x \<partial>M)"
12.2474 + using f g G' to_singleton by (auto intro!: positive_integral_cong_AE) }
12.2475 + note [simp] = this
12.2476 + have "integral\<^isup>P (density M f) g = (SUP i. integral\<^isup>P (density M f) (G i))" using G'(1) G_M'(1) G
12.2477 + using positive_integral_monotone_convergence_SUP[symmetric, OF `incseq G`, of "density M f"]
12.2478 + by (simp cong: positive_integral_cong_AE)
12.2479 + also have "\<dots> = (SUP i. (\<integral>\<^isup>+x. f x * G i x \<partial>M))" by simp
12.2480 + also have "\<dots> = (\<integral>\<^isup>+x. (SUP i. f x * G i x) \<partial>M)"
12.2481 + using f G' G(2)[THEN incseq_SucD] G
12.2482 + by (intro positive_integral_monotone_convergence_SUP_AE[symmetric])
12.2483 + (auto simp: ereal_mult_left_mono le_fun_def ereal_zero_le_0_iff)
12.2484 + also have "\<dots> = (\<integral>\<^isup>+x. f x * g x \<partial>M)" using f G' G g
12.2485 + by (intro positive_integral_cong_AE)
12.2486 + (auto simp add: SUPR_ereal_cmult split: split_max)
12.2487 + also have "\<dots> = (\<integral>\<^isup>+x. f x * g' x \<partial>M)"
12.2488 + using f(2)
12.2489 + by (subst (2) positive_integral_max_0[symmetric])
12.2490 + (auto simp: g_def max_def ereal_zero_le_0_iff intro!: positive_integral_cong_AE)
12.2491 + finally show "integral\<^isup>P (density M f) g' = (\<integral>\<^isup>+x. f x * g' x \<partial>M)"
12.2492 + unfolding g_def positive_integral_max_0 .
12.2493 +qed
12.2494 +
12.2495 +lemma integral_density:
12.2496 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
12.2497 + and g: "g \<in> borel_measurable M"
12.2498 + shows "integral\<^isup>L (density M f) g = (\<integral> x. f x * g x \<partial>M)"
12.2499 + and "integrable (density M f) g \<longleftrightarrow> integrable M (\<lambda>x. f x * g x)"
12.2500 + unfolding lebesgue_integral_def integrable_def using f g
12.2501 + by (auto simp: positive_integral_density)
12.2502 +
12.2503 +lemma emeasure_restricted:
12.2504 + assumes S: "S \<in> sets M" and X: "X \<in> sets M"
12.2505 + shows "emeasure (density M (indicator S)) X = emeasure M (S \<inter> X)"
12.2506 +proof -
12.2507 + have "emeasure (density M (indicator S)) X = (\<integral>\<^isup>+x. indicator S x * indicator X x \<partial>M)"
12.2508 + using S X by (simp add: emeasure_density)
12.2509 + also have "\<dots> = (\<integral>\<^isup>+x. indicator (S \<inter> X) x \<partial>M)"
12.2510 + by (auto intro!: positive_integral_cong simp: indicator_def)
12.2511 + also have "\<dots> = emeasure M (S \<inter> X)"
12.2512 + using S X by (simp add: Int)
12.2513 + finally show ?thesis .
12.2514 +qed
12.2515 +
12.2516 +lemma measure_restricted:
12.2517 + "S \<in> sets M \<Longrightarrow> X \<in> sets M \<Longrightarrow> measure (density M (indicator S)) X = measure M (S \<inter> X)"
12.2518 + by (simp add: emeasure_restricted measure_def)
12.2519 +
12.2520 +lemma (in finite_measure) finite_measure_restricted:
12.2521 + "S \<in> sets M \<Longrightarrow> finite_measure (density M (indicator S))"
12.2522 + by default (simp add: emeasure_restricted)
12.2523 +
12.2524 +lemma emeasure_density_const:
12.2525 + "A \<in> sets M \<Longrightarrow> 0 \<le> c \<Longrightarrow> emeasure (density M (\<lambda>_. c)) A = c * emeasure M A"
12.2526 + by (auto simp: positive_integral_cmult_indicator emeasure_density)
12.2527 +
12.2528 +lemma measure_density_const:
12.2529 + "A \<in> sets M \<Longrightarrow> 0 < c \<Longrightarrow> c \<noteq> \<infinity> \<Longrightarrow> measure (density M (\<lambda>_. c)) A = real c * measure M A"
12.2530 + by (auto simp: emeasure_density_const measure_def)
12.2531 +
12.2532 +lemma density_density_eq:
12.2533 + "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> AE x in M. 0 \<le> f x \<Longrightarrow>
12.2534 + density (density M f) g = density M (\<lambda>x. f x * g x)"
12.2535 + by (auto intro!: measure_eqI simp: emeasure_density positive_integral_density ac_simps)
12.2536 +
12.2537 +lemma distr_density_distr:
12.2538 + assumes T: "T \<in> measurable M M'" and T': "T' \<in> measurable M' M"
12.2539 + and inv: "\<forall>x\<in>space M. T' (T x) = x"
12.2540 + assumes f: "f \<in> borel_measurable M'"
12.2541 + shows "distr (density (distr M M' T) f) M T' = density M (f \<circ> T)" (is "?R = ?L")
12.2542 +proof (rule measure_eqI)
12.2543 + fix A assume A: "A \<in> sets ?R"
12.2544 + { fix x assume "x \<in> space M"
12.2545 + with sets_into_space[OF A]
12.2546 + have "indicator (T' -` A \<inter> space M') (T x) = (indicator A x :: ereal)"
12.2547 + using T inv by (auto simp: indicator_def measurable_space) }
12.2548 + with A T T' f show "emeasure ?R A = emeasure ?L A"
12.2549 + by (simp add: measurable_comp emeasure_density emeasure_distr
12.2550 + positive_integral_distr measurable_sets cong: positive_integral_cong)
12.2551 +qed simp
12.2552 +
12.2553 +lemma density_density_divide:
12.2554 + fixes f g :: "'a \<Rightarrow> real"
12.2555 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
12.2556 + assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
12.2557 + assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0"
12.2558 + shows "density (density M f) (\<lambda>x. g x / f x) = density M g"
12.2559 +proof -
12.2560 + have "density M g = density M (\<lambda>x. f x * (g x / f x))"
12.2561 + using f g ac by (auto intro!: density_cong measurable_If)
12.2562 + then show ?thesis
12.2563 + using f g by (subst density_density_eq) auto
12.2564 +qed
12.2565 +
12.2566 +section {* Point measure *}
12.2567 +
12.2568 +definition point_measure :: "'a set \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> 'a measure" where
12.2569 + "point_measure A f = density (count_space A) f"
12.2570 +
12.2571 +lemma
12.2572 + shows space_point_measure: "space (point_measure A f) = A"
12.2573 + and sets_point_measure: "sets (point_measure A f) = Pow A"
12.2574 + by (auto simp: point_measure_def)
12.2575 +
12.2576 +lemma measurable_point_measure_eq1[simp]:
12.2577 + "g \<in> measurable (point_measure A f) M \<longleftrightarrow> g \<in> A \<rightarrow> space M"
12.2578 + unfolding point_measure_def by simp
12.2579 +
12.2580 +lemma measurable_point_measure_eq2_finite[simp]:
12.2581 + "finite A \<Longrightarrow>
12.2582 + g \<in> measurable M (point_measure A f) \<longleftrightarrow>
12.2583 + (g \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. g -` {a} \<inter> space M \<in> sets M))"
12.2584 + unfolding point_measure_def by simp
12.2585 +
12.2586 +lemma simple_function_point_measure[simp]:
12.2587 + "simple_function (point_measure A f) g \<longleftrightarrow> finite (g ` A)"
12.2588 + by (simp add: point_measure_def)
12.2589 +
12.2590 +lemma emeasure_point_measure:
12.2591 + assumes A: "finite {a\<in>X. 0 < f a}" "X \<subseteq> A"
12.2592 + shows "emeasure (point_measure A f) X = (\<Sum>a|a\<in>X \<and> 0 < f a. f a)"
12.2593 +proof -
12.2594 + have "{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a\<in>X. 0 < f a}"
12.2595 + using `X \<subseteq> A` by auto
12.2596 + with A show ?thesis
12.2597 + by (simp add: emeasure_density positive_integral_count_space ereal_zero_le_0_iff
12.2598 + point_measure_def indicator_def)
12.2599 +qed
12.2600 +
12.2601 +lemma emeasure_point_measure_finite:
12.2602 + "finite A \<Longrightarrow> (\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a|a\<in>X. f a)"
12.2603 + by (subst emeasure_point_measure) (auto dest: finite_subset intro!: setsum_mono_zero_left simp: less_le)
12.2604 +
12.2605 +lemma null_sets_point_measure_iff:
12.2606 + "X \<in> null_sets (point_measure A f) \<longleftrightarrow> X \<subseteq> A \<and> (\<forall>x\<in>X. f x \<le> 0)"
12.2607 + by (auto simp: AE_count_space null_sets_density_iff point_measure_def)
12.2608 +
12.2609 +lemma AE_point_measure:
12.2610 + "(AE x in point_measure A f. P x) \<longleftrightarrow> (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)"
12.2611 + unfolding point_measure_def
12.2612 + by (subst AE_density) (auto simp: AE_density AE_count_space point_measure_def)
12.2613 +
12.2614 +lemma positive_integral_point_measure:
12.2615 + "finite {a\<in>A. 0 < f a \<and> 0 < g a} \<Longrightarrow>
12.2616 + integral\<^isup>P (point_measure A f) g = (\<Sum>a|a\<in>A \<and> 0 < f a \<and> 0 < g a. f a * g a)"
12.2617 + unfolding point_measure_def
12.2618 + apply (subst density_max_0)
12.2619 + apply (subst positive_integral_density)
12.2620 + apply (simp_all add: AE_count_space positive_integral_density)
12.2621 + apply (subst positive_integral_count_space )
12.2622 + apply (auto intro!: setsum_cong simp: max_def ereal_zero_less_0_iff)
12.2623 + apply (rule finite_subset)
12.2624 + prefer 2
12.2625 + apply assumption
12.2626 + apply auto
12.2627 + done
12.2628 +
12.2629 +lemma positive_integral_point_measure_finite:
12.2630 + "finite A \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> f a) \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> g a) \<Longrightarrow>
12.2631 + integral\<^isup>P (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)"
12.2632 + by (subst positive_integral_point_measure) (auto intro!: setsum_mono_zero_left simp: less_le)
12.2633 +
12.2634 +lemma lebesgue_integral_point_measure_finite:
12.2635 + "finite A \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> f a) \<Longrightarrow> integral\<^isup>L (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)"
12.2636 + by (simp add: lebesgue_integral_count_space_finite AE_count_space integral_density point_measure_def)
12.2637 +
12.2638 +lemma integrable_point_measure_finite:
12.2639 + "finite A \<Longrightarrow> integrable (point_measure A (\<lambda>x. ereal (f x))) g"
12.2640 + unfolding point_measure_def
12.2641 + apply (subst density_ereal_max_0)
12.2642 + apply (subst integral_density)
12.2643 + apply (auto simp: AE_count_space integrable_count_space)
12.2644 + done
12.2645 +
12.2646 +section {* Uniform measure *}
12.2647 +
12.2648 +definition "uniform_measure M A = density M (\<lambda>x. indicator A x / emeasure M A)"
12.2649 +
12.2650 +lemma
12.2651 + shows sets_uniform_measure[simp]: "sets (uniform_measure M A) = sets M"
12.2652 + and space_uniform_measure[simp]: "space (uniform_measure M A) = space M"
12.2653 + by (auto simp: uniform_measure_def)
12.2654 +
12.2655 +lemma emeasure_uniform_measure[simp]:
12.2656 + assumes A: "A \<in> sets M" and B: "B \<in> sets M"
12.2657 + shows "emeasure (uniform_measure M A) B = emeasure M (A \<inter> B) / emeasure M A"
12.2658 +proof -
12.2659 + from A B have "emeasure (uniform_measure M A) B = (\<integral>\<^isup>+x. (1 / emeasure M A) * indicator (A \<inter> B) x \<partial>M)"
12.2660 + by (auto simp add: uniform_measure_def emeasure_density split: split_indicator
12.2661 + intro!: positive_integral_cong)
12.2662 + also have "\<dots> = emeasure M (A \<inter> B) / emeasure M A"
12.2663 + using A B
12.2664 + by (subst positive_integral_cmult_indicator) (simp_all add: Int emeasure_nonneg)
12.2665 + finally show ?thesis .
12.2666 +qed
12.2667 +
12.2668 +lemma emeasure_neq_0_sets: "emeasure M A \<noteq> 0 \<Longrightarrow> A \<in> sets M"
12.2669 + using emeasure_notin_sets[of A M] by blast
12.2670 +
12.2671 +lemma measure_uniform_measure[simp]:
12.2672 + assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>" and B: "B \<in> sets M"
12.2673 + shows "measure (uniform_measure M A) B = measure M (A \<inter> B) / measure M A"
12.2674 + using emeasure_uniform_measure[OF emeasure_neq_0_sets[OF A(1)] B] A
12.2675 + by (cases "emeasure M A" "emeasure M (A \<inter> B)" rule: ereal2_cases) (simp_all add: measure_def)
12.2676 +
12.2677 +section {* Uniform count measure *}
12.2678 +
12.2679 +definition "uniform_count_measure A = point_measure A (\<lambda>x. 1 / card A)"
12.2680 +
12.2681 +lemma
12.2682 + shows space_uniform_count_measure: "space (uniform_count_measure A) = A"
12.2683 + and sets_uniform_count_measure: "sets (uniform_count_measure A) = Pow A"
12.2684 + unfolding uniform_count_measure_def by (auto simp: space_point_measure sets_point_measure)
12.2685 +
12.2686 +lemma emeasure_uniform_count_measure:
12.2687 + "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (uniform_count_measure A) X = card X / card A"
12.2688 + by (simp add: real_eq_of_nat emeasure_point_measure_finite uniform_count_measure_def)
12.2689 +
12.2690 +lemma measure_uniform_count_measure:
12.2691 + "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> measure (uniform_count_measure A) X = card X / card A"
12.2692 + by (simp add: real_eq_of_nat emeasure_point_measure_finite uniform_count_measure_def measure_def)
12.2693 +
12.2694 end
13.1 --- a/src/HOL/Probability/Lebesgue_Measure.thy Mon Apr 23 12:23:23 2012 +0100
13.2 +++ b/src/HOL/Probability/Lebesgue_Measure.thy Mon Apr 23 12:14:35 2012 +0200
13.3 @@ -9,6 +9,15 @@
13.4 imports Finite_Product_Measure
13.5 begin
13.6
13.7 +lemma borel_measurable_sets:
13.8 + assumes "f \<in> measurable borel M" "A \<in> sets M"
13.9 + shows "f -` A \<in> sets borel"
13.10 + using measurable_sets[OF assms] by simp
13.11 +
13.12 +lemma measurable_identity[intro,simp]:
13.13 + "(\<lambda>x. x) \<in> measurable M M"
13.14 + unfolding measurable_def by auto
13.15 +
13.16 subsection {* Standard Cubes *}
13.17
13.18 definition cube :: "nat \<Rightarrow> 'a::ordered_euclidean_space set" where
13.19 @@ -52,17 +61,13 @@
13.20
13.21 subsection {* Lebesgue measure *}
13.22
13.23 -definition lebesgue :: "'a::ordered_euclidean_space measure_space" where
13.24 - "lebesgue = \<lparr> space = UNIV,
13.25 - sets = {A. \<forall>n. (indicator A :: 'a \<Rightarrow> real) integrable_on cube n},
13.26 - measure = \<lambda>A. SUP n. ereal (integral (cube n) (indicator A)) \<rparr>"
13.27 +definition lebesgue :: "'a::ordered_euclidean_space measure" where
13.28 + "lebesgue = measure_of UNIV {A. \<forall>n. (indicator A :: 'a \<Rightarrow> real) integrable_on cube n}
13.29 + (\<lambda>A. SUP n. ereal (integral (cube n) (indicator A)))"
13.30
13.31 lemma space_lebesgue[simp]: "space lebesgue = UNIV"
13.32 unfolding lebesgue_def by simp
13.33
13.34 -lemma lebesgueD: "A \<in> sets lebesgue \<Longrightarrow> (indicator A :: _ \<Rightarrow> real) integrable_on cube n"
13.35 - unfolding lebesgue_def by simp
13.36 -
13.37 lemma lebesgueI: "(\<And>n. (indicator A :: _ \<Rightarrow> real) integrable_on cube n) \<Longrightarrow> A \<in> sets lebesgue"
13.38 unfolding lebesgue_def by simp
13.39
13.40 @@ -86,23 +91,23 @@
13.41 "A \<inter> B = {} \<Longrightarrow> (indicator A x::_::monoid_add) + indicator B x = indicator (A \<union> B) x"
13.42 unfolding indicator_def by auto
13.43
13.44 -interpretation lebesgue: sigma_algebra lebesgue
13.45 -proof (intro sigma_algebra_iff2[THEN iffD2] conjI allI ballI impI lebesgueI)
13.46 - fix A n assume A: "A \<in> sets lebesgue"
13.47 - have "indicator (space lebesgue - A) = (\<lambda>x. 1 - indicator A x :: real)"
13.48 +lemma sigma_algebra_lebesgue:
13.49 + defines "leb \<equiv> {A. \<forall>n. (indicator A :: 'a::ordered_euclidean_space \<Rightarrow> real) integrable_on cube n}"
13.50 + shows "sigma_algebra UNIV leb"
13.51 +proof (safe intro!: sigma_algebra_iff2[THEN iffD2])
13.52 + fix A assume A: "A \<in> leb"
13.53 + moreover have "indicator (UNIV - A) = (\<lambda>x. 1 - indicator A x :: real)"
13.54 by (auto simp: fun_eq_iff indicator_def)
13.55 - then show "(indicator (space lebesgue - A) :: _ \<Rightarrow> real) integrable_on cube n"
13.56 - using A by (auto intro!: integrable_sub dest: lebesgueD simp: cube_def)
13.57 + ultimately show "UNIV - A \<in> leb"
13.58 + using A by (auto intro!: integrable_sub simp: cube_def leb_def)
13.59 next
13.60 - fix n show "(indicator {} :: _\<Rightarrow>real) integrable_on cube n"
13.61 - by (auto simp: cube_def indicator_def [abs_def])
13.62 + fix n show "{} \<in> leb"
13.63 + by (auto simp: cube_def indicator_def[abs_def] leb_def)
13.64 next
13.65 - fix A :: "nat \<Rightarrow> 'a set" and n ::nat assume "range A \<subseteq> sets lebesgue"
13.66 - then have A: "\<And>i. (indicator (A i) :: _ \<Rightarrow> real) integrable_on cube n"
13.67 - by (auto dest: lebesgueD)
13.68 - show "(indicator (\<Union>i. A i) :: _ \<Rightarrow> real) integrable_on cube n" (is "?g integrable_on _")
13.69 - proof (intro dominated_convergence[where g="?g"] ballI)
13.70 - fix k show "(indicator (\<Union>i<k. A i) :: _ \<Rightarrow> real) integrable_on cube n"
13.71 + fix A :: "nat \<Rightarrow> _" assume A: "range A \<subseteq> leb"
13.72 + have "\<forall>n. (indicator (\<Union>i. A i) :: _ \<Rightarrow> real) integrable_on cube n" (is "\<forall>n. ?g integrable_on _")
13.73 + proof (intro dominated_convergence[where g="?g"] ballI allI)
13.74 + fix k n show "(indicator (\<Union>i<k. A i) :: _ \<Rightarrow> real) integrable_on cube n"
13.75 proof (induct k)
13.76 case (Suc k)
13.77 have *: "(\<Union> i<Suc k. A i) = (\<Union> i<k. A i) \<union> A k"
13.78 @@ -111,36 +116,45 @@
13.79 indicator (\<Union> i<Suc k. A i)" (is "(\<lambda>x. max (?f x) (?g x)) = _")
13.80 by (auto simp: fun_eq_iff * indicator_def)
13.81 show ?case
13.82 - using absolutely_integrable_max[of ?f "cube n" ?g] A Suc by (simp add: *)
13.83 + using absolutely_integrable_max[of ?f "cube n" ?g] A Suc
13.84 + by (simp add: * leb_def subset_eq)
13.85 qed auto
13.86 qed (auto intro: LIMSEQ_indicator_UN simp: cube_def)
13.87 + then show "(\<Union>i. A i) \<in> leb" by (auto simp: leb_def)
13.88 qed simp
13.89
13.90 -interpretation lebesgue: measure_space lebesgue
13.91 -proof
13.92 +lemma sets_lebesgue: "sets lebesgue = {A. \<forall>n. (indicator A :: _ \<Rightarrow> real) integrable_on cube n}"
13.93 + unfolding lebesgue_def sigma_algebra.sets_measure_of_eq[OF sigma_algebra_lebesgue] ..
13.94 +
13.95 +lemma lebesgueD: "A \<in> sets lebesgue \<Longrightarrow> (indicator A :: _ \<Rightarrow> real) integrable_on cube n"
13.96 + unfolding sets_lebesgue by simp
13.97 +
13.98 +lemma emeasure_lebesgue:
13.99 + assumes "A \<in> sets lebesgue"
13.100 + shows "emeasure lebesgue A = (SUP n. ereal (integral (cube n) (indicator A)))"
13.101 + (is "_ = ?\<mu> A")
13.102 +proof (rule emeasure_measure_of[OF lebesgue_def])
13.103 have *: "indicator {} = (\<lambda>x. 0 :: real)" by (simp add: fun_eq_iff)
13.104 - show "positive lebesgue (measure lebesgue)"
13.105 - proof (unfold positive_def, safe)
13.106 - show "measure lebesgue {} = 0" by (simp add: integral_0 * lebesgue_def)
13.107 - fix A assume "A \<in> sets lebesgue"
13.108 - then show "0 \<le> measure lebesgue A"
13.109 - unfolding lebesgue_def
13.110 - by (auto intro!: SUP_upper2 integral_nonneg)
13.111 + show "positive (sets lebesgue) ?\<mu>"
13.112 + proof (unfold positive_def, intro conjI ballI)
13.113 + show "?\<mu> {} = 0" by (simp add: integral_0 *)
13.114 + fix A :: "'a set" assume "A \<in> sets lebesgue" then show "0 \<le> ?\<mu> A"
13.115 + by (auto intro!: SUP_upper2 Integration.integral_nonneg simp: sets_lebesgue)
13.116 qed
13.117 next
13.118 - show "countably_additive lebesgue (measure lebesgue)"
13.119 + show "countably_additive (sets lebesgue) ?\<mu>"
13.120 proof (intro countably_additive_def[THEN iffD2] allI impI)
13.121 - fix A :: "nat \<Rightarrow> 'b set" assume rA: "range A \<subseteq> sets lebesgue" "disjoint_family A"
13.122 + fix A :: "nat \<Rightarrow> 'a set" assume rA: "range A \<subseteq> sets lebesgue" "disjoint_family A"
13.123 then have A[simp, intro]: "\<And>i n. (indicator (A i) :: _ \<Rightarrow> real) integrable_on cube n"
13.124 by (auto dest: lebesgueD)
13.125 let ?m = "\<lambda>n i. integral (cube n) (indicator (A i) :: _\<Rightarrow>real)"
13.126 let ?M = "\<lambda>n I. integral (cube n) (indicator (\<Union>i\<in>I. A i) :: _\<Rightarrow>real)"
13.127 - have nn[simp, intro]: "\<And>i n. 0 \<le> ?m n i" by (auto intro!: integral_nonneg)
13.128 + have nn[simp, intro]: "\<And>i n. 0 \<le> ?m n i" by (auto intro!: Integration.integral_nonneg)
13.129 assume "(\<Union>i. A i) \<in> sets lebesgue"
13.130 then have UN_A[simp, intro]: "\<And>i n. (indicator (\<Union>i. A i) :: _ \<Rightarrow> real) integrable_on cube n"
13.131 - by (auto dest: lebesgueD)
13.132 - show "(\<Sum>n. measure lebesgue (A n)) = measure lebesgue (\<Union>i. A i)"
13.133 - proof (simp add: lebesgue_def, subst suminf_SUP_eq, safe intro!: incseq_SucI)
13.134 + by (auto simp: sets_lebesgue)
13.135 + show "(\<Sum>n. ?\<mu> (A n)) = ?\<mu> (\<Union>i. A i)"
13.136 + proof (subst suminf_SUP_eq, safe intro!: incseq_SucI)
13.137 fix i n show "ereal (?m n i) \<le> ereal (?m (Suc n) i)"
13.138 using cube_subset[of n "Suc n"] by (auto intro!: integral_subset_le incseq_SucI)
13.139 next
13.140 @@ -172,14 +186,15 @@
13.141 indicator (\<Union>i<m. A i) x + (indicator (A m) x :: real)"
13.142 by (auto simp: indicator_add lessThan_Suc ac_simps)
13.143 ultimately show ?case
13.144 - using Suc A by (simp add: integral_add[symmetric])
13.145 + using Suc A by (simp add: Integration.integral_add[symmetric])
13.146 qed auto }
13.147 ultimately show "(\<lambda>m. \<Sum>x = 0..<m. ?m n x) ----> ?M n UNIV"
13.148 by (simp add: atLeast0LessThan)
13.149 qed
13.150 qed
13.151 qed
13.152 -qed
13.153 +next
13.154 +qed (auto, fact)
13.155
13.156 lemma has_integral_interval_cube:
13.157 fixes a b :: "'a::ordered_euclidean_space"
13.158 @@ -202,9 +217,10 @@
13.159 fixes s::"'a::ordered_euclidean_space set"
13.160 assumes "s \<in> sets borel" shows "s \<in> sets lebesgue"
13.161 proof -
13.162 - let ?S = "range (\<lambda>(a, b). {a .. (b :: 'a\<Colon>ordered_euclidean_space)})"
13.163 - have *:"?S \<subseteq> sets lebesgue"
13.164 - proof (safe intro!: lebesgueI)
13.165 + have "s \<in> sigma_sets (space lebesgue) (range (\<lambda>(a, b). {a .. (b :: 'a\<Colon>ordered_euclidean_space)}))"
13.166 + using assms by (simp add: borel_eq_atLeastAtMost)
13.167 + also have "\<dots> \<subseteq> sets lebesgue"
13.168 + proof (safe intro!: sigma_sets_subset lebesgueI)
13.169 fix n :: nat and a b :: 'a
13.170 let ?N = "\<chi>\<chi> i. max (- real n) (a $$ i)"
13.171 let ?P = "\<chi>\<chi> i. min (real n) (b $$ i)"
13.172 @@ -212,11 +228,7 @@
13.173 unfolding integrable_on_def
13.174 using has_integral_interval_cube[of a b] by auto
13.175 qed
13.176 - have "s \<in> sigma_sets UNIV ?S" using assms
13.177 - unfolding borel_eq_atLeastAtMost by (simp add: sigma_def)
13.178 - thus ?thesis
13.179 - using lebesgue.sigma_subset[of "\<lparr> space = UNIV, sets = ?S\<rparr>", simplified, OF *]
13.180 - by (auto simp: sigma_def)
13.181 + finally show ?thesis .
13.182 qed
13.183
13.184 lemma lebesgueI_negligible[dest]: fixes s::"'a::ordered_euclidean_space set"
13.185 @@ -224,19 +236,21 @@
13.186 using assms by (force simp: cube_def integrable_on_def negligible_def intro!: lebesgueI)
13.187
13.188 lemma lmeasure_eq_0:
13.189 - fixes S :: "'a::ordered_euclidean_space set" assumes "negligible S" shows "lebesgue.\<mu> S = 0"
13.190 + fixes S :: "'a::ordered_euclidean_space set"
13.191 + assumes "negligible S" shows "emeasure lebesgue S = 0"
13.192 proof -
13.193 have "\<And>n. integral (cube n) (indicator S :: 'a\<Rightarrow>real) = 0"
13.194 unfolding lebesgue_integral_def using assms
13.195 by (intro integral_unique some1_equality ex_ex1I)
13.196 (auto simp: cube_def negligible_def)
13.197 - then show ?thesis by (auto simp: lebesgue_def)
13.198 + then show ?thesis
13.199 + using assms by (simp add: emeasure_lebesgue lebesgueI_negligible)
13.200 qed
13.201
13.202 lemma lmeasure_iff_LIMSEQ:
13.203 - assumes "A \<in> sets lebesgue" "0 \<le> m"
13.204 - shows "lebesgue.\<mu> A = ereal m \<longleftrightarrow> (\<lambda>n. integral (cube n) (indicator A :: _ \<Rightarrow> real)) ----> m"
13.205 -proof (simp add: lebesgue_def, intro SUP_eq_LIMSEQ)
13.206 + assumes A: "A \<in> sets lebesgue" and "0 \<le> m"
13.207 + shows "emeasure lebesgue A = ereal m \<longleftrightarrow> (\<lambda>n. integral (cube n) (indicator A :: _ \<Rightarrow> real)) ----> m"
13.208 +proof (subst emeasure_lebesgue[OF A], intro SUP_eq_LIMSEQ)
13.209 show "mono (\<lambda>n. integral (cube n) (indicator A::_=>real))"
13.210 using cube_subset assms by (intro monoI integral_subset_le) (auto dest!: lebesgueD)
13.211 qed
13.212 @@ -261,7 +275,7 @@
13.213
13.214 lemma lmeasure_finite_has_integral:
13.215 fixes s :: "'a::ordered_euclidean_space set"
13.216 - assumes "s \<in> sets lebesgue" "lebesgue.\<mu> s = ereal m" "0 \<le> m"
13.217 + assumes "s \<in> sets lebesgue" "emeasure lebesgue s = ereal m" "0 \<le> m"
13.218 shows "(indicator s has_integral m) UNIV"
13.219 proof -
13.220 let ?I = "indicator :: 'a set \<Rightarrow> 'a \<Rightarrow> real"
13.221 @@ -275,7 +289,7 @@
13.222 (auto dest!: lebesgueD) }
13.223 moreover
13.224 { fix n have "0 \<le> integral (cube n) (?I s)"
13.225 - using assms by (auto dest!: lebesgueD intro!: integral_nonneg) }
13.226 + using assms by (auto dest!: lebesgueD intro!: Integration.integral_nonneg) }
13.227 ultimately
13.228 show "bounded {integral UNIV (?I (s \<inter> cube k)) |k. True}"
13.229 unfolding bounded_def
13.230 @@ -303,14 +317,13 @@
13.231 unfolding m by (intro integrable_integral **)
13.232 qed
13.233
13.234 -lemma lmeasure_finite_integrable: assumes s: "s \<in> sets lebesgue" and "lebesgue.\<mu> s \<noteq> \<infinity>"
13.235 +lemma lmeasure_finite_integrable: assumes s: "s \<in> sets lebesgue" and "emeasure lebesgue s \<noteq> \<infinity>"
13.236 shows "(indicator s :: _ \<Rightarrow> real) integrable_on UNIV"
13.237 -proof (cases "lebesgue.\<mu> s")
13.238 +proof (cases "emeasure lebesgue s")
13.239 case (real m)
13.240 - with lmeasure_finite_has_integral[OF `s \<in> sets lebesgue` this]
13.241 - lebesgue.positive_measure[OF s]
13.242 + with lmeasure_finite_has_integral[OF `s \<in> sets lebesgue` this] emeasure_nonneg[of lebesgue s]
13.243 show ?thesis unfolding integrable_on_def by auto
13.244 -qed (insert assms lebesgue.positive_measure[OF s], auto)
13.245 +qed (insert assms emeasure_nonneg[of lebesgue s], auto)
13.246
13.247 lemma has_integral_lebesgue: assumes "((indicator s :: _\<Rightarrow>real) has_integral m) UNIV"
13.248 shows "s \<in> sets lebesgue"
13.249 @@ -324,7 +337,7 @@
13.250 qed
13.251
13.252 lemma has_integral_lmeasure: assumes "((indicator s :: _\<Rightarrow>real) has_integral m) UNIV"
13.253 - shows "lebesgue.\<mu> s = ereal m"
13.254 + shows "emeasure lebesgue s = ereal m"
13.255 proof (intro lmeasure_iff_LIMSEQ[THEN iffD2])
13.256 let ?I = "indicator :: 'a set \<Rightarrow> 'a \<Rightarrow> real"
13.257 show "s \<in> sets lebesgue" using has_integral_lebesgue[OF assms] .
13.258 @@ -349,55 +362,56 @@
13.259 qed
13.260
13.261 lemma has_integral_iff_lmeasure:
13.262 - "(indicator A has_integral m) UNIV \<longleftrightarrow> (A \<in> sets lebesgue \<and> 0 \<le> m \<and> lebesgue.\<mu> A = ereal m)"
13.263 + "(indicator A has_integral m) UNIV \<longleftrightarrow> (A \<in> sets lebesgue \<and> 0 \<le> m \<and> emeasure lebesgue A = ereal m)"
13.264 proof
13.265 assume "(indicator A has_integral m) UNIV"
13.266 with has_integral_lmeasure[OF this] has_integral_lebesgue[OF this]
13.267 - show "A \<in> sets lebesgue \<and> 0 \<le> m \<and> lebesgue.\<mu> A = ereal m"
13.268 + show "A \<in> sets lebesgue \<and> 0 \<le> m \<and> emeasure lebesgue A = ereal m"
13.269 by (auto intro: has_integral_nonneg)
13.270 next
13.271 - assume "A \<in> sets lebesgue \<and> 0 \<le> m \<and> lebesgue.\<mu> A = ereal m"
13.272 + assume "A \<in> sets lebesgue \<and> 0 \<le> m \<and> emeasure lebesgue A = ereal m"
13.273 then show "(indicator A has_integral m) UNIV" by (intro lmeasure_finite_has_integral) auto
13.274 qed
13.275
13.276 lemma lmeasure_eq_integral: assumes "(indicator s::_\<Rightarrow>real) integrable_on UNIV"
13.277 - shows "lebesgue.\<mu> s = ereal (integral UNIV (indicator s))"
13.278 + shows "emeasure lebesgue s = ereal (integral UNIV (indicator s))"
13.279 using assms unfolding integrable_on_def
13.280 proof safe
13.281 fix y :: real assume "(indicator s has_integral y) UNIV"
13.282 from this[unfolded has_integral_iff_lmeasure] integral_unique[OF this]
13.283 - show "lebesgue.\<mu> s = ereal (integral UNIV (indicator s))" by simp
13.284 + show "emeasure lebesgue s = ereal (integral UNIV (indicator s))" by simp
13.285 qed
13.286
13.287 lemma lebesgue_simple_function_indicator:
13.288 fixes f::"'a::ordered_euclidean_space \<Rightarrow> ereal"
13.289 assumes f:"simple_function lebesgue f"
13.290 shows "f = (\<lambda>x. (\<Sum>y \<in> f ` UNIV. y * indicator (f -` {y}) x))"
13.291 - by (rule, subst lebesgue.simple_function_indicator_representation[OF f]) auto
13.292 + by (rule, subst simple_function_indicator_representation[OF f]) auto
13.293
13.294 lemma integral_eq_lmeasure:
13.295 - "(indicator s::_\<Rightarrow>real) integrable_on UNIV \<Longrightarrow> integral UNIV (indicator s) = real (lebesgue.\<mu> s)"
13.296 + "(indicator s::_\<Rightarrow>real) integrable_on UNIV \<Longrightarrow> integral UNIV (indicator s) = real (emeasure lebesgue s)"
13.297 by (subst lmeasure_eq_integral) (auto intro!: integral_nonneg)
13.298
13.299 -lemma lmeasure_finite: assumes "(indicator s::_\<Rightarrow>real) integrable_on UNIV" shows "lebesgue.\<mu> s \<noteq> \<infinity>"
13.300 +lemma lmeasure_finite: assumes "(indicator s::_\<Rightarrow>real) integrable_on UNIV" shows "emeasure lebesgue s \<noteq> \<infinity>"
13.301 using lmeasure_eq_integral[OF assms] by auto
13.302
13.303 lemma negligible_iff_lebesgue_null_sets:
13.304 - "negligible A \<longleftrightarrow> A \<in> lebesgue.null_sets"
13.305 + "negligible A \<longleftrightarrow> A \<in> null_sets lebesgue"
13.306 proof
13.307 assume "negligible A"
13.308 from this[THEN lebesgueI_negligible] this[THEN lmeasure_eq_0]
13.309 - show "A \<in> lebesgue.null_sets" by auto
13.310 + show "A \<in> null_sets lebesgue" by auto
13.311 next
13.312 - assume A: "A \<in> lebesgue.null_sets"
13.313 - then have *:"((indicator A) has_integral (0::real)) UNIV" using lmeasure_finite_has_integral[of A] by auto
13.314 + assume A: "A \<in> null_sets lebesgue"
13.315 + then have *:"((indicator A) has_integral (0::real)) UNIV" using lmeasure_finite_has_integral[of A]
13.316 + by (auto simp: null_sets_def)
13.317 show "negligible A" unfolding negligible_def
13.318 proof (intro allI)
13.319 fix a b :: 'a
13.320 have integrable: "(indicator A :: _\<Rightarrow>real) integrable_on {a..b}"
13.321 by (intro integrable_on_subinterval has_integral_integrable) (auto intro: *)
13.322 then have "integral {a..b} (indicator A) \<le> (integral UNIV (indicator A) :: real)"
13.323 - using * by (auto intro!: integral_subset_le has_integral_integrable)
13.324 + using * by (auto intro!: integral_subset_le)
13.325 moreover have "(0::real) \<le> integral {a..b} (indicator A)"
13.326 using integrable by (auto intro!: integral_nonneg)
13.327 ultimately have "integral {a..b} (indicator A) = (0::real)"
13.328 @@ -412,8 +426,8 @@
13.329 shows "integral {a .. b} (\<lambda>x. c) = content {a .. b} *\<^sub>R c"
13.330 by (rule integral_unique) (rule has_integral_const)
13.331
13.332 -lemma lmeasure_UNIV[intro]: "lebesgue.\<mu> (UNIV::'a::ordered_euclidean_space set) = \<infinity>"
13.333 -proof (simp add: lebesgue_def, intro SUP_PInfty bexI)
13.334 +lemma lmeasure_UNIV[intro]: "emeasure lebesgue (UNIV::'a::ordered_euclidean_space set) = \<infinity>"
13.335 +proof (simp add: emeasure_lebesgue, intro SUP_PInfty bexI)
13.336 fix n :: nat
13.337 have "indicator UNIV = (\<lambda>x::'a. 1 :: real)" by auto
13.338 moreover
13.339 @@ -434,7 +448,7 @@
13.340
13.341 lemma
13.342 fixes a b ::"'a::ordered_euclidean_space"
13.343 - shows lmeasure_atLeastAtMost[simp]: "lebesgue.\<mu> {a..b} = ereal (content {a..b})"
13.344 + shows lmeasure_atLeastAtMost[simp]: "emeasure lebesgue {a..b} = ereal (content {a..b})"
13.345 proof -
13.346 have "(indicator (UNIV \<inter> {a..b})::_\<Rightarrow>real) integrable_on UNIV"
13.347 unfolding integrable_indicator_UNIV by (simp add: integrable_const indicator_def [abs_def])
13.348 @@ -454,7 +468,7 @@
13.349 qed
13.350
13.351 lemma lmeasure_singleton[simp]:
13.352 - fixes a :: "'a::ordered_euclidean_space" shows "lebesgue.\<mu> {a} = 0"
13.353 + fixes a :: "'a::ordered_euclidean_space" shows "emeasure lebesgue {a} = 0"
13.354 using lmeasure_atLeastAtMost[of a a] by simp
13.355
13.356 declare content_real[simp]
13.357 @@ -462,82 +476,68 @@
13.358 lemma
13.359 fixes a b :: real
13.360 shows lmeasure_real_greaterThanAtMost[simp]:
13.361 - "lebesgue.\<mu> {a <.. b} = ereal (if a \<le> b then b - a else 0)"
13.362 + "emeasure lebesgue {a <.. b} = ereal (if a \<le> b then b - a else 0)"
13.363 proof cases
13.364 assume "a < b"
13.365 - then have "lebesgue.\<mu> {a <.. b} = lebesgue.\<mu> {a .. b} - lebesgue.\<mu> {a}"
13.366 - by (subst lebesgue.measure_Diff[symmetric])
13.367 - (auto intro!: arg_cong[where f=lebesgue.\<mu>])
13.368 + then have "emeasure lebesgue {a <.. b} = emeasure lebesgue {a .. b} - emeasure lebesgue {a}"
13.369 + by (subst emeasure_Diff[symmetric])
13.370 + (auto intro!: arg_cong[where f="emeasure lebesgue"])
13.371 then show ?thesis by auto
13.372 qed auto
13.373
13.374 lemma
13.375 fixes a b :: real
13.376 shows lmeasure_real_atLeastLessThan[simp]:
13.377 - "lebesgue.\<mu> {a ..< b} = ereal (if a \<le> b then b - a else 0)"
13.378 + "emeasure lebesgue {a ..< b} = ereal (if a \<le> b then b - a else 0)"
13.379 proof cases
13.380 assume "a < b"
13.381 - then have "lebesgue.\<mu> {a ..< b} = lebesgue.\<mu> {a .. b} - lebesgue.\<mu> {b}"
13.382 - by (subst lebesgue.measure_Diff[symmetric])
13.383 - (auto intro!: arg_cong[where f=lebesgue.\<mu>])
13.384 + then have "emeasure lebesgue {a ..< b} = emeasure lebesgue {a .. b} - emeasure lebesgue {b}"
13.385 + by (subst emeasure_Diff[symmetric])
13.386 + (auto intro!: arg_cong[where f="emeasure lebesgue"])
13.387 then show ?thesis by auto
13.388 qed auto
13.389
13.390 lemma
13.391 fixes a b :: real
13.392 shows lmeasure_real_greaterThanLessThan[simp]:
13.393 - "lebesgue.\<mu> {a <..< b} = ereal (if a \<le> b then b - a else 0)"
13.394 + "emeasure lebesgue {a <..< b} = ereal (if a \<le> b then b - a else 0)"
13.395 proof cases
13.396 assume "a < b"
13.397 - then have "lebesgue.\<mu> {a <..< b} = lebesgue.\<mu> {a <.. b} - lebesgue.\<mu> {b}"
13.398 - by (subst lebesgue.measure_Diff[symmetric])
13.399 - (auto intro!: arg_cong[where f=lebesgue.\<mu>])
13.400 + then have "emeasure lebesgue {a <..< b} = emeasure lebesgue {a <.. b} - emeasure lebesgue {b}"
13.401 + by (subst emeasure_Diff[symmetric])
13.402 + (auto intro!: arg_cong[where f="emeasure lebesgue"])
13.403 then show ?thesis by auto
13.404 qed auto
13.405
13.406 subsection {* Lebesgue-Borel measure *}
13.407
13.408 -definition "lborel = lebesgue \<lparr> sets := sets borel \<rparr>"
13.409 +definition "lborel = measure_of UNIV (sets borel) (emeasure lebesgue)"
13.410
13.411 lemma
13.412 shows space_lborel[simp]: "space lborel = UNIV"
13.413 and sets_lborel[simp]: "sets lborel = sets borel"
13.414 - and measure_lborel[simp]: "measure lborel = lebesgue.\<mu>"
13.415 - and measurable_lborel[simp]: "measurable lborel = measurable borel"
13.416 - by (simp_all add: measurable_def [abs_def] lborel_def)
13.417 + and measurable_lborel1[simp]: "measurable lborel = measurable borel"
13.418 + and measurable_lborel2[simp]: "measurable A lborel = measurable A borel"
13.419 + using sigma_sets_eq[of borel]
13.420 + by (auto simp add: lborel_def measurable_def[abs_def])
13.421
13.422 -interpretation lborel: measure_space "lborel :: ('a::ordered_euclidean_space) measure_space"
13.423 - where "space lborel = UNIV"
13.424 - and "sets lborel = sets borel"
13.425 - and "measure lborel = lebesgue.\<mu>"
13.426 - and "measurable lborel = measurable borel"
13.427 -proof (rule lebesgue.measure_space_subalgebra)
13.428 - have "sigma_algebra (lborel::'a measure_space) \<longleftrightarrow> sigma_algebra (borel::'a algebra)"
13.429 - unfolding sigma_algebra_iff2 lborel_def by simp
13.430 - then show "sigma_algebra (lborel::'a measure_space)" by simp default
13.431 -qed auto
13.432 +lemma emeasure_lborel[simp]: "A \<in> sets borel \<Longrightarrow> emeasure lborel A = emeasure lebesgue A"
13.433 + by (rule emeasure_measure_of[OF lborel_def])
13.434 + (auto simp: positive_def emeasure_nonneg countably_additive_def intro!: suminf_emeasure)
13.435
13.436 interpretation lborel: sigma_finite_measure lborel
13.437 - where "space lborel = UNIV"
13.438 - and "sets lborel = sets borel"
13.439 - and "measure lborel = lebesgue.\<mu>"
13.440 - and "measurable lborel = measurable borel"
13.441 -proof -
13.442 - show "sigma_finite_measure lborel"
13.443 - proof (default, intro conjI exI[of _ "\<lambda>n. cube n"])
13.444 - show "range cube \<subseteq> sets lborel" by (auto intro: borel_closed)
13.445 - { fix x have "\<exists>n. x\<in>cube n" using mem_big_cube by auto }
13.446 - thus "(\<Union>i. cube i) = space lborel" by auto
13.447 - show "\<forall>i. measure lborel (cube i) \<noteq> \<infinity>" by (simp add: cube_def)
13.448 - qed
13.449 -qed simp_all
13.450 +proof (default, intro conjI exI[of _ "\<lambda>n. cube n"])
13.451 + show "range cube \<subseteq> sets lborel" by (auto intro: borel_closed)
13.452 + { fix x :: 'a have "\<exists>n. x\<in>cube n" using mem_big_cube by auto }
13.453 + then show "(\<Union>i. cube i) = (space lborel :: 'a set)" using mem_big_cube by auto
13.454 + show "\<forall>i. emeasure lborel (cube i) \<noteq> \<infinity>" by (simp add: cube_def)
13.455 +qed
13.456
13.457 interpretation lebesgue: sigma_finite_measure lebesgue
13.458 proof
13.459 - from lborel.sigma_finite guess A ..
13.460 - moreover then have "range A \<subseteq> sets lebesgue" using lebesgueI_borel by blast
13.461 - ultimately show "\<exists>A::nat \<Rightarrow> 'b set. range A \<subseteq> sets lebesgue \<and> (\<Union>i. A i) = space lebesgue \<and> (\<forall>i. lebesgue.\<mu> (A i) \<noteq> \<infinity>)"
13.462 - by auto
13.463 + from lborel.sigma_finite guess A :: "nat \<Rightarrow> 'a set" ..
13.464 + then show "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets lebesgue \<and> (\<Union>i. A i) = space lebesgue \<and> (\<forall>i. emeasure lebesgue (A i) \<noteq> \<infinity>)"
13.465 + by (intro exI[of _ A]) (auto simp: subset_eq)
13.466 qed
13.467
13.468 subsection {* Lebesgue integrable implies Gauge integrable *}
13.469 @@ -556,11 +556,11 @@
13.470 fixes f::"'a::ordered_euclidean_space \<Rightarrow> ereal"
13.471 assumes f:"simple_function lebesgue f"
13.472 and f':"range f \<subseteq> {0..<\<infinity>}"
13.473 - and om:"\<And>x. x \<in> range f \<Longrightarrow> lebesgue.\<mu> (f -` {x} \<inter> UNIV) = \<infinity> \<Longrightarrow> x = 0"
13.474 + and om:"\<And>x. x \<in> range f \<Longrightarrow> emeasure lebesgue (f -` {x} \<inter> UNIV) = \<infinity> \<Longrightarrow> x = 0"
13.475 shows "((\<lambda>x. real (f x)) has_integral (real (integral\<^isup>S lebesgue f))) UNIV"
13.476 unfolding simple_integral_def space_lebesgue
13.477 proof (subst lebesgue_simple_function_indicator)
13.478 - let ?M = "\<lambda>x. lebesgue.\<mu> (f -` {x} \<inter> UNIV)"
13.479 + let ?M = "\<lambda>x. emeasure lebesgue (f -` {x} \<inter> UNIV)"
13.480 let ?F = "\<lambda>x. indicator (f -` {x})"
13.481 { fix x y assume "y \<in> range f"
13.482 from subsetD[OF f' this] have "y * ?F y x = ereal (real y * ?F y x)"
13.483 @@ -571,7 +571,7 @@
13.484 have "x * ?M x = real x * real (?M x)"
13.485 proof cases
13.486 assume "x \<noteq> 0" with om[OF x] have "?M x \<noteq> \<infinity>" by auto
13.487 - with subsetD[OF f' x] f[THEN lebesgue.simple_functionD(2)] show ?thesis
13.488 + with subsetD[OF f' x] f[THEN simple_functionD(2)] show ?thesis
13.489 by (cases rule: ereal2_cases[of x "?M x"]) auto
13.490 qed simp }
13.491 ultimately
13.492 @@ -580,11 +580,11 @@
13.493 by simp
13.494 also have \<dots>
13.495 proof (intro has_integral_setsum has_integral_cmult_real lmeasure_finite_has_integral
13.496 - real_of_ereal_pos lebesgue.positive_measure ballI)
13.497 - show *: "finite (range f)" "\<And>y. f -` {y} \<in> sets lebesgue" "\<And>y. f -` {y} \<inter> UNIV \<in> sets lebesgue"
13.498 - using lebesgue.simple_functionD[OF f] by auto
13.499 + real_of_ereal_pos emeasure_nonneg ballI)
13.500 + show *: "finite (range f)" "\<And>y. f -` {y} \<in> sets lebesgue"
13.501 + using simple_functionD[OF f] by auto
13.502 fix y assume "real y \<noteq> 0" "y \<in> range f"
13.503 - with * om[OF this(2)] show "lebesgue.\<mu> (f -` {y}) = ereal (real (?M y))"
13.504 + with * om[OF this(2)] show "emeasure lebesgue (f -` {y}) = ereal (real (?M y))"
13.505 by (auto simp: ereal_real)
13.506 qed
13.507 finally show "((\<lambda>x. real (\<Sum>y\<in>range f. y * ?F y x)) has_integral real (\<Sum>x\<in>range f. x * ?M x)) UNIV" .
13.508 @@ -601,28 +601,28 @@
13.509 shows "((\<lambda>x. real (f x)) has_integral (real (integral\<^isup>S lebesgue f))) UNIV"
13.510 proof -
13.511 let ?f = "\<lambda>x. if x \<in> f -` {\<infinity>} then 0 else f x"
13.512 - note f(1)[THEN lebesgue.simple_functionD(2)]
13.513 + note f(1)[THEN simple_functionD(2)]
13.514 then have [simp, intro]: "\<And>X. f -` X \<in> sets lebesgue" by auto
13.515 have f': "simple_function lebesgue ?f"
13.516 - using f by (intro lebesgue.simple_function_If_set) auto
13.517 + using f by (intro simple_function_If_set) auto
13.518 have rng: "range ?f \<subseteq> {0..<\<infinity>}" using f by auto
13.519 have "AE x in lebesgue. f x = ?f x"
13.520 - using lebesgue.simple_integral_PInf[OF f i]
13.521 - by (intro lebesgue.AE_I[where N="f -` {\<infinity>} \<inter> space lebesgue"]) auto
13.522 + using simple_integral_PInf[OF f i]
13.523 + by (intro AE_I[where N="f -` {\<infinity>} \<inter> space lebesgue"]) auto
13.524 from f(1) f' this have eq: "integral\<^isup>S lebesgue f = integral\<^isup>S lebesgue ?f"
13.525 - by (rule lebesgue.simple_integral_cong_AE)
13.526 + by (rule simple_integral_cong_AE)
13.527 have real_eq: "\<And>x. real (f x) = real (?f x)" by auto
13.528
13.529 show ?thesis
13.530 unfolding eq real_eq
13.531 proof (rule simple_function_has_integral[OF f' rng])
13.532 - fix x assume x: "x \<in> range ?f" and inf: "lebesgue.\<mu> (?f -` {x} \<inter> UNIV) = \<infinity>"
13.533 - have "x * lebesgue.\<mu> (?f -` {x} \<inter> UNIV) = (\<integral>\<^isup>S y. x * indicator (?f -` {x}) y \<partial>lebesgue)"
13.534 - using f'[THEN lebesgue.simple_functionD(2)]
13.535 - by (simp add: lebesgue.simple_integral_cmult_indicator)
13.536 + fix x assume x: "x \<in> range ?f" and inf: "emeasure lebesgue (?f -` {x} \<inter> UNIV) = \<infinity>"
13.537 + have "x * emeasure lebesgue (?f -` {x} \<inter> UNIV) = (\<integral>\<^isup>S y. x * indicator (?f -` {x}) y \<partial>lebesgue)"
13.538 + using f'[THEN simple_functionD(2)]
13.539 + by (simp add: simple_integral_cmult_indicator)
13.540 also have "\<dots> \<le> integral\<^isup>S lebesgue f"
13.541 - using f'[THEN lebesgue.simple_functionD(2)] f
13.542 - by (intro lebesgue.simple_integral_mono lebesgue.simple_function_mult lebesgue.simple_function_indicator)
13.543 + using f'[THEN simple_functionD(2)] f
13.544 + by (intro simple_integral_mono simple_function_mult simple_function_indicator)
13.545 (auto split: split_indicator)
13.546 finally show "x = 0" unfolding inf using i subsetD[OF rng x] by (auto split: split_if_asm)
13.547 qed
13.548 @@ -633,16 +633,16 @@
13.549 assumes f: "f \<in> borel_measurable lebesgue" "range f \<subseteq> {0..<\<infinity>}" "integral\<^isup>P lebesgue f \<noteq> \<infinity>"
13.550 shows "((\<lambda>x. real (f x)) has_integral (real (integral\<^isup>P lebesgue f))) UNIV"
13.551 proof -
13.552 - from lebesgue.borel_measurable_implies_simple_function_sequence'[OF f(1)]
13.553 + from borel_measurable_implies_simple_function_sequence'[OF f(1)]
13.554 guess u . note u = this
13.555 have SUP_eq: "\<And>x. (SUP i. u i x) = f x"
13.556 using u(4) f(2)[THEN subsetD] by (auto split: split_max)
13.557 let ?u = "\<lambda>i x. real (u i x)"
13.558 - note u_eq = lebesgue.positive_integral_eq_simple_integral[OF u(1,5), symmetric]
13.559 + note u_eq = positive_integral_eq_simple_integral[OF u(1,5), symmetric]
13.560 { fix i
13.561 note u_eq
13.562 also have "integral\<^isup>P lebesgue (u i) \<le> (\<integral>\<^isup>+x. max 0 (f x) \<partial>lebesgue)"
13.563 - by (intro lebesgue.positive_integral_mono) (auto intro: SUP_upper simp: u(4)[symmetric])
13.564 + by (intro positive_integral_mono) (auto intro: SUP_upper simp: u(4)[symmetric])
13.565 finally have "integral\<^isup>S lebesgue (u i) \<noteq> \<infinity>"
13.566 unfolding positive_integral_max_0 using f by auto }
13.567 note u_fin = this
13.568 @@ -684,10 +684,10 @@
13.569 also have "\<dots> = real (integral\<^isup>S lebesgue (u k))"
13.570 using u_int[THEN integral_unique] by (simp add: u')
13.571 also have "\<dots> = real (integral\<^isup>P lebesgue (u k))"
13.572 - using lebesgue.positive_integral_eq_simple_integral[OF u(1,5)] by simp
13.573 + using positive_integral_eq_simple_integral[OF u(1,5)] by simp
13.574 also have "\<dots> \<le> real (integral\<^isup>P lebesgue f)" using f
13.575 - by (auto intro!: real_of_ereal_positive_mono lebesgue.positive_integral_positive
13.576 - lebesgue.positive_integral_mono SUP_upper simp: SUP_eq[symmetric])
13.577 + by (auto intro!: real_of_ereal_positive_mono positive_integral_positive
13.578 + positive_integral_mono SUP_upper simp: SUP_eq[symmetric])
13.579 finally show "\<bar>integral UNIV (u' k)\<bar> \<le> real (integral\<^isup>P lebesgue f)" .
13.580 qed
13.581 qed
13.582 @@ -695,21 +695,21 @@
13.583 have "integral\<^isup>P lebesgue f = ereal (integral UNIV f')"
13.584 proof (rule tendsto_unique[OF trivial_limit_sequentially])
13.585 have "(\<lambda>i. integral\<^isup>S lebesgue (u i)) ----> (SUP i. integral\<^isup>P lebesgue (u i))"
13.586 - unfolding u_eq by (intro LIMSEQ_ereal_SUPR lebesgue.incseq_positive_integral u)
13.587 - also note lebesgue.positive_integral_monotone_convergence_SUP
13.588 - [OF u(2) lebesgue.borel_measurable_simple_function[OF u(1)] u(5), symmetric]
13.589 + unfolding u_eq by (intro LIMSEQ_ereal_SUPR incseq_positive_integral u)
13.590 + also note positive_integral_monotone_convergence_SUP
13.591 + [OF u(2) borel_measurable_simple_function[OF u(1)] u(5), symmetric]
13.592 finally show "(\<lambda>k. integral\<^isup>S lebesgue (u k)) ----> integral\<^isup>P lebesgue f"
13.593 unfolding SUP_eq .
13.594
13.595 { fix k
13.596 have "0 \<le> integral\<^isup>S lebesgue (u k)"
13.597 - using u by (auto intro!: lebesgue.simple_integral_positive)
13.598 + using u by (auto intro!: simple_integral_positive)
13.599 then have "integral\<^isup>S lebesgue (u k) = ereal (real (integral\<^isup>S lebesgue (u k)))"
13.600 using u_fin by (auto simp: ereal_real) }
13.601 note * = this
13.602 show "(\<lambda>k. integral\<^isup>S lebesgue (u k)) ----> ereal (integral UNIV f')"
13.603 using convergent using u_int[THEN integral_unique, symmetric]
13.604 - by (subst *) (simp add: lim_ereal u')
13.605 + by (subst *) (simp add: u')
13.606 qed
13.607 then show ?thesis using convergent by (simp add: f' integrable_integral)
13.608 qed
13.609 @@ -721,8 +721,8 @@
13.610 proof -
13.611 let ?n = "\<lambda>x. real (ereal (max 0 (- f x)))" and ?p = "\<lambda>x. real (ereal (max 0 (f x)))"
13.612 have *: "f = (\<lambda>x. ?p x - ?n x)" by (auto simp del: ereal_max)
13.613 - { fix f have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue) = (\<integral>\<^isup>+ x. ereal (max 0 (f x)) \<partial>lebesgue)"
13.614 - by (intro lebesgue.positive_integral_cong_pos) (auto split: split_max) }
13.615 + { fix f :: "'a \<Rightarrow> real" have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>lebesgue) = (\<integral>\<^isup>+ x. ereal (max 0 (f x)) \<partial>lebesgue)"
13.616 + by (intro positive_integral_cong_pos) (auto split: split_max) }
13.617 note eq = this
13.618 show ?thesis
13.619 unfolding lebesgue_integral_def
13.620 @@ -732,7 +732,7 @@
13.621 apply (safe intro!: positive_integral_has_integral)
13.622 using integrableD[OF f]
13.623 by (auto simp: zero_ereal_def[symmetric] positive_integral_max_0 split: split_max
13.624 - intro!: lebesgue.measurable_If lebesgue.borel_measurable_ereal)
13.625 + intro!: measurable_If)
13.626 qed
13.627
13.628 lemma lebesgue_positive_integral_eq_borel:
13.629 @@ -740,7 +740,7 @@
13.630 shows "integral\<^isup>P lebesgue f = integral\<^isup>P lborel f"
13.631 proof -
13.632 from f have "integral\<^isup>P lebesgue (\<lambda>x. max 0 (f x)) = integral\<^isup>P lborel (\<lambda>x. max 0 (f x))"
13.633 - by (auto intro!: lebesgue.positive_integral_subalgebra[symmetric]) default
13.634 + by (auto intro!: positive_integral_subalgebra[symmetric])
13.635 then show ?thesis unfolding positive_integral_max_0 .
13.636 qed
13.637
13.638 @@ -749,9 +749,8 @@
13.639 shows "integrable lebesgue f \<longleftrightarrow> integrable lborel f" (is ?P)
13.640 and "integral\<^isup>L lebesgue f = integral\<^isup>L lborel f" (is ?I)
13.641 proof -
13.642 - have *: "sigma_algebra lborel" by default
13.643 have "sets lborel \<subseteq> sets lebesgue" by auto
13.644 - from lebesgue.integral_subalgebra[of f lborel, OF _ this _ _ *] assms
13.645 + from integral_subalgebra[of f lborel, OF _ this _ _] assms
13.646 show ?P ?I by auto
13.647 qed
13.648
13.649 @@ -783,152 +782,109 @@
13.650 "p2e (e2p x) = (x::'a::ordered_euclidean_space)"
13.651 by (auto simp: euclidean_eq[where 'a='a] p2e_def e2p_def)
13.652
13.653 -interpretation lborel_product: product_sigma_finite "\<lambda>x. lborel::real measure_space"
13.654 +interpretation lborel_product: product_sigma_finite "\<lambda>x. lborel::real measure"
13.655 by default
13.656
13.657 -interpretation lborel_space: finite_product_sigma_finite "\<lambda>x. lborel::real measure_space" "{..<n}" for n :: nat
13.658 - where "space lborel = UNIV"
13.659 - and "sets lborel = sets borel"
13.660 - and "measure lborel = lebesgue.\<mu>"
13.661 - and "measurable lborel = measurable borel"
13.662 -proof -
13.663 - show "finite_product_sigma_finite (\<lambda>x. lborel::real measure_space) {..<n}"
13.664 - by default simp
13.665 -qed simp_all
13.666 +interpretation lborel_space: finite_product_sigma_finite "\<lambda>x. lborel::real measure" "{..<n}" for n :: nat
13.667 + by default auto
13.668 +
13.669 +lemma bchoice_iff: "(\<forall>x\<in>A. \<exists>y. P x y) \<longleftrightarrow> (\<exists>f. \<forall>x\<in>A. P x (f x))"
13.670 + by metis
13.671
13.672 lemma sets_product_borel:
13.673 - assumes [intro]: "finite I"
13.674 - shows "sets (\<Pi>\<^isub>M i\<in>I.
13.675 - \<lparr> space = UNIV::real set, sets = range lessThan, measure = lebesgue.\<mu> \<rparr>) =
13.676 - sets (\<Pi>\<^isub>M i\<in>I. lborel)" (is "sets ?G = _")
13.677 -proof -
13.678 - have "sets ?G = sets (\<Pi>\<^isub>M i\<in>I.
13.679 - sigma \<lparr> space = UNIV::real set, sets = range lessThan, measure = lebesgue.\<mu> \<rparr>)"
13.680 - by (subst sigma_product_algebra_sigma_eq[of I "\<lambda>_ i. {..<real i}" ])
13.681 - (auto intro!: measurable_sigma_sigma incseq_SucI reals_Archimedean2
13.682 - simp: product_algebra_def)
13.683 - then show ?thesis
13.684 - unfolding lborel_def borel_eq_lessThan lebesgue_def sigma_def by simp
13.685 + assumes I: "finite I"
13.686 + shows "sets (\<Pi>\<^isub>M i\<in>I. lborel) = sigma_sets (\<Pi>\<^isub>E i\<in>I. UNIV) { \<Pi>\<^isub>E i\<in>I. {..< x i :: real} | x. True}" (is "_ = ?G")
13.687 +proof (subst sigma_prod_algebra_sigma_eq[where S="\<lambda>_ i::nat. {..<real i}" and E="\<lambda>_. range lessThan", OF I])
13.688 + show "sigma_sets (space (Pi\<^isub>M I (\<lambda>i. lborel))) {Pi\<^isub>E I F |F. \<forall>i\<in>I. F i \<in> range lessThan} = ?G"
13.689 + by (intro arg_cong2[where f=sigma_sets]) (auto simp: space_PiM image_iff bchoice_iff)
13.690 +qed (auto simp: borel_eq_lessThan incseq_def reals_Archimedean2 image_iff intro: real_natceiling_ge)
13.691 +
13.692 +lemma measurable_e2p:
13.693 + "e2p \<in> measurable (borel::'a::ordered_euclidean_space measure) (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure))"
13.694 +proof (rule measurable_sigma_sets[OF sets_product_borel])
13.695 + fix A :: "(nat \<Rightarrow> real) set" assume "A \<in> {\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {..<x i} |x. True} "
13.696 + then obtain x where "A = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {..<x i})" by auto
13.697 + then have "e2p -` A = {..< (\<chi>\<chi> i. x i) :: 'a}"
13.698 + using DIM_positive by (auto simp add: Pi_iff set_eq_iff e2p_def
13.699 + euclidean_eq[where 'a='a] eucl_less[where 'a='a])
13.700 + then show "e2p -` A \<inter> space (borel::'a measure) \<in> sets borel" by simp
13.701 +qed (auto simp: e2p_def)
13.702 +
13.703 +lemma measurable_p2e:
13.704 + "p2e \<in> measurable (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure))
13.705 + (borel :: 'a::ordered_euclidean_space measure)"
13.706 + (is "p2e \<in> measurable ?P _")
13.707 +proof (safe intro!: borel_measurable_iff_halfspace_le[THEN iffD2])
13.708 + fix x i
13.709 + let ?A = "{w \<in> space ?P. (p2e w :: 'a) $$ i \<le> x}"
13.710 + assume "i < DIM('a)"
13.711 + then have "?A = (\<Pi>\<^isub>E j\<in>{..<DIM('a)}. if i = j then {.. x} else UNIV)"
13.712 + using DIM_positive by (auto simp: space_PiM p2e_def split: split_if_asm)
13.713 + then show "?A \<in> sets ?P"
13.714 + by auto
13.715 qed
13.716
13.717 -lemma measurable_e2p:
13.718 - "e2p \<in> measurable (borel::'a::ordered_euclidean_space algebra)
13.719 - (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure_space))"
13.720 - (is "_ \<in> measurable ?E ?P")
13.721 -proof -
13.722 - let ?B = "\<lparr> space = UNIV::real set, sets = range lessThan, measure = lebesgue.\<mu> \<rparr>"
13.723 - let ?G = "product_algebra_generator {..<DIM('a)} (\<lambda>_. ?B)"
13.724 - have "e2p \<in> measurable ?E (sigma ?G)"
13.725 - proof (rule borel.measurable_sigma)
13.726 - show "e2p \<in> space ?E \<rightarrow> space ?G" by (auto simp: e2p_def)
13.727 - fix A assume "A \<in> sets ?G"
13.728 - then obtain E where A: "A = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. E i)"
13.729 - and "E \<in> {..<DIM('a)} \<rightarrow> (range lessThan)"
13.730 - by (auto elim!: product_algebraE simp: )
13.731 - then have "\<forall>i\<in>{..<DIM('a)}. \<exists>xs. E i = {..< xs}" by auto
13.732 - from this[THEN bchoice] guess xs ..
13.733 - then have A_eq: "A = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {..< xs i})"
13.734 - using A by auto
13.735 - have "e2p -` A = {..< (\<chi>\<chi> i. xs i) :: 'a}"
13.736 - using DIM_positive by (auto simp add: Pi_iff set_eq_iff e2p_def A_eq
13.737 - euclidean_eq[where 'a='a] eucl_less[where 'a='a])
13.738 - then show "e2p -` A \<inter> space ?E \<in> sets ?E" by simp
13.739 - qed (auto simp: product_algebra_generator_def)
13.740 - with sets_product_borel[of "{..<DIM('a)}"] show ?thesis
13.741 - unfolding measurable_def product_algebra_def by simp
13.742 +lemma Int_stable_atLeastAtMost:
13.743 + fixes x::"'a::ordered_euclidean_space"
13.744 + shows "Int_stable (range (\<lambda>(a, b::'a). {a..b}))"
13.745 + by (auto simp: inter_interval Int_stable_def)
13.746 +
13.747 +lemma lborel_eqI:
13.748 + fixes M :: "'a::ordered_euclidean_space measure"
13.749 + assumes emeasure_eq: "\<And>a b. emeasure M {a .. b} = content {a .. b}"
13.750 + assumes sets_eq: "sets M = sets borel"
13.751 + shows "lborel = M"
13.752 +proof (rule measure_eqI_generator_eq[OF Int_stable_atLeastAtMost])
13.753 + let ?P = "\<Pi>\<^isub>M i\<in>{..<DIM('a::ordered_euclidean_space)}. lborel"
13.754 + let ?E = "range (\<lambda>(a, b). {a..b} :: 'a set)"
13.755 + show "?E \<subseteq> Pow UNIV" "sets lborel = sigma_sets UNIV ?E" "sets M = sigma_sets UNIV ?E"
13.756 + by (simp_all add: borel_eq_atLeastAtMost sets_eq)
13.757 +
13.758 + show "range cube \<subseteq> ?E" unfolding cube_def [abs_def] by auto
13.759 + show "incseq cube" using cube_subset_Suc by (auto intro!: incseq_SucI)
13.760 + { fix x :: 'a have "\<exists>n. x \<in> cube n" using mem_big_cube[of x] by fastforce }
13.761 + then show "(\<Union>i. cube i :: 'a set) = UNIV" by auto
13.762 +
13.763 + { fix i show "emeasure lborel (cube i) \<noteq> \<infinity>" unfolding cube_def by auto }
13.764 + { fix X assume "X \<in> ?E" then show "emeasure lborel X = emeasure M X"
13.765 + by (auto simp: emeasure_eq) }
13.766 qed
13.767
13.768 -lemma measurable_p2e:
13.769 - "p2e \<in> measurable (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure_space))
13.770 - (borel :: 'a::ordered_euclidean_space algebra)"
13.771 - (is "p2e \<in> measurable ?P _")
13.772 - unfolding borel_eq_lessThan
13.773 -proof (intro lborel_space.measurable_sigma)
13.774 - let ?E = "\<lparr> space = UNIV :: 'a set, sets = range lessThan \<rparr>"
13.775 - show "p2e \<in> space ?P \<rightarrow> space ?E" by simp
13.776 - fix A assume "A \<in> sets ?E"
13.777 - then obtain x where "A = {..<x}" by auto
13.778 - then have "p2e -` A \<inter> space ?P = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {..< x $$ i})"
13.779 - using DIM_positive
13.780 - by (auto simp: Pi_iff set_eq_iff p2e_def
13.781 - euclidean_eq[where 'a='a] eucl_less[where 'a='a])
13.782 - then show "p2e -` A \<inter> space ?P \<in> sets ?P" by auto
13.783 -qed simp
13.784 -
13.785 -lemma Int_stable_cuboids:
13.786 - fixes x::"'a::ordered_euclidean_space"
13.787 - shows "Int_stable \<lparr>space = UNIV, sets = range (\<lambda>(a, b::'a). {a..b})\<rparr>"
13.788 - by (auto simp: inter_interval Int_stable_def)
13.789 -
13.790 lemma lborel_eq_lborel_space:
13.791 - fixes A :: "('a::ordered_euclidean_space) set"
13.792 - assumes "A \<in> sets borel"
13.793 - shows "lborel.\<mu> A = lborel_space.\<mu> DIM('a) (p2e -` A \<inter> (space (lborel_space.P DIM('a))))"
13.794 - (is "_ = measure ?P (?T A)")
13.795 -proof (rule measure_unique_Int_stable_vimage)
13.796 - show "measure_space ?P" by default
13.797 - show "measure_space lborel" by default
13.798 -
13.799 - let ?E = "\<lparr> space = UNIV :: 'a set, sets = range (\<lambda>(a,b). {a..b}) \<rparr>"
13.800 - show "Int_stable ?E" using Int_stable_cuboids .
13.801 - show "range cube \<subseteq> sets ?E" unfolding cube_def [abs_def] by auto
13.802 - show "incseq cube" using cube_subset_Suc by (auto intro!: incseq_SucI)
13.803 - { fix x have "\<exists>n. x \<in> cube n" using mem_big_cube[of x] by fastforce }
13.804 - then show "(\<Union>i. cube i) = space ?E" by auto
13.805 - { fix i show "lborel.\<mu> (cube i) \<noteq> \<infinity>" unfolding cube_def by auto }
13.806 - show "A \<in> sets (sigma ?E)" "sets (sigma ?E) = sets lborel" "space ?E = space lborel"
13.807 - using assms by (simp_all add: borel_eq_atLeastAtMost)
13.808 -
13.809 - show "p2e \<in> measurable ?P (lborel :: 'a measure_space)"
13.810 - using measurable_p2e unfolding measurable_def by simp
13.811 - { fix X assume "X \<in> sets ?E"
13.812 - then obtain a b where X[simp]: "X = {a .. b}" by auto
13.813 - have *: "?T X = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {a $$ i .. b $$ i})"
13.814 - by (auto simp: Pi_iff eucl_le[where 'a='a] p2e_def)
13.815 - show "lborel.\<mu> X = measure ?P (?T X)"
13.816 - proof cases
13.817 - assume "X \<noteq> {}"
13.818 - then have "a \<le> b"
13.819 - by (simp add: interval_ne_empty eucl_le[where 'a='a])
13.820 - then have "lborel.\<mu> X = (\<Prod>x<DIM('a). lborel.\<mu> {a $$ x .. b $$ x})"
13.821 - by (auto simp: content_closed_interval eucl_le[where 'a='a]
13.822 - intro!: setprod_ereal[symmetric])
13.823 - also have "\<dots> = measure ?P (?T X)"
13.824 - unfolding * by (subst lborel_space.measure_times) auto
13.825 - finally show ?thesis .
13.826 - qed simp }
13.827 + "(lborel :: 'a measure) = distr (\<Pi>\<^isub>M i\<in>{..<DIM('a::ordered_euclidean_space)}. lborel) lborel p2e"
13.828 + (is "?B = ?D")
13.829 +proof (rule lborel_eqI)
13.830 + show "sets ?D = sets borel" by simp
13.831 + let ?P = "(\<Pi>\<^isub>M i\<in>{..<DIM('a::ordered_euclidean_space)}. lborel)"
13.832 + fix a b :: 'a
13.833 + have *: "p2e -` {a .. b} \<inter> space ?P = (\<Pi>\<^isub>E i\<in>{..<DIM('a)}. {a $$ i .. b $$ i})"
13.834 + by (auto simp: Pi_iff eucl_le[where 'a='a] p2e_def space_PiM)
13.835 + have "emeasure ?P (p2e -` {a..b} \<inter> space ?P) = content {a..b}"
13.836 + proof cases
13.837 + assume "{a..b} \<noteq> {}"
13.838 + then have "a \<le> b"
13.839 + by (simp add: interval_ne_empty eucl_le[where 'a='a])
13.840 + then have "emeasure lborel {a..b} = (\<Prod>x<DIM('a). emeasure lborel {a $$ x .. b $$ x})"
13.841 + by (auto simp: content_closed_interval eucl_le[where 'a='a]
13.842 + intro!: setprod_ereal[symmetric])
13.843 + also have "\<dots> = emeasure ?P (p2e -` {a..b} \<inter> space ?P)"
13.844 + unfolding * by (subst lborel_space.measure_times) auto
13.845 + finally show ?thesis by simp
13.846 + qed simp
13.847 + then show "emeasure ?D {a .. b} = content {a .. b}"
13.848 + by (simp add: emeasure_distr measurable_p2e)
13.849 qed
13.850
13.851 -lemma measure_preserving_p2e:
13.852 - "p2e \<in> measure_preserving (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. (lborel :: real measure_space))
13.853 - (lborel::'a::ordered_euclidean_space measure_space)" (is "_ \<in> measure_preserving ?P ?E")
13.854 -proof
13.855 - show "p2e \<in> measurable ?P ?E"
13.856 - using measurable_p2e by (simp add: measurable_def)
13.857 - fix A :: "'a set" assume "A \<in> sets lborel"
13.858 - then show "lborel_space.\<mu> DIM('a) (p2e -` A \<inter> (space (lborel_space.P DIM('a)))) = lborel.\<mu> A"
13.859 - by (intro lborel_eq_lborel_space[symmetric]) simp
13.860 -qed
13.861 -
13.862 -lemma lebesgue_eq_lborel_space_in_borel:
13.863 - fixes A :: "('a::ordered_euclidean_space) set"
13.864 - assumes A: "A \<in> sets borel"
13.865 - shows "lebesgue.\<mu> A = lborel_space.\<mu> DIM('a) (p2e -` A \<inter> (space (lborel_space.P DIM('a))))"
13.866 - using lborel_eq_lborel_space[OF A] by simp
13.867 -
13.868 lemma borel_fubini_positiv_integral:
13.869 fixes f :: "'a::ordered_euclidean_space \<Rightarrow> ereal"
13.870 assumes f: "f \<in> borel_measurable borel"
13.871 - shows "integral\<^isup>P lborel f = \<integral>\<^isup>+x. f (p2e x) \<partial>(lborel_space.P DIM('a))"
13.872 -proof (rule lborel_space.positive_integral_vimage[OF _ measure_preserving_p2e _])
13.873 - show "f \<in> borel_measurable lborel"
13.874 - using f by (simp_all add: measurable_def)
13.875 -qed default
13.876 + shows "integral\<^isup>P lborel f = \<integral>\<^isup>+x. f (p2e x) \<partial>(\<Pi>\<^isub>M i\<in>{..<DIM('a)}. lborel)"
13.877 + by (subst lborel_eq_lborel_space) (simp add: positive_integral_distr measurable_p2e f)
13.878
13.879 lemma borel_fubini_integrable:
13.880 fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real"
13.881 shows "integrable lborel f \<longleftrightarrow>
13.882 - integrable (lborel_space.P DIM('a)) (\<lambda>x. f (p2e x))"
13.883 + integrable (\<Pi>\<^isub>M i\<in>{..<DIM('a)}. lborel) (\<lambda>x. f (p2e x))"
13.884 (is "_ \<longleftrightarrow> integrable ?B ?f")
13.885 proof
13.886 assume "integrable lborel f"
13.887 @@ -941,9 +897,9 @@
13.888 by (simp add: comp_def borel_fubini_positiv_integral integrable_def)
13.889 next
13.890 assume "integrable ?B ?f"
13.891 - moreover then
13.892 - have "?f \<circ> e2p \<in> borel_measurable (borel::'a algebra)"
13.893 - by (auto intro!: measurable_e2p measurable_comp)
13.894 + moreover
13.895 + then have "?f \<circ> e2p \<in> borel_measurable (borel::'a measure)"
13.896 + by (auto intro!: measurable_e2p)
13.897 then have "f \<in> borel_measurable borel"
13.898 by (simp cong: measurable_cong)
13.899 ultimately show "integrable lborel f"
13.900 @@ -953,100 +909,35 @@
13.901 lemma borel_fubini:
13.902 fixes f :: "'a::ordered_euclidean_space \<Rightarrow> real"
13.903 assumes f: "f \<in> borel_measurable borel"
13.904 - shows "integral\<^isup>L lborel f = \<integral>x. f (p2e x) \<partial>(lborel_space.P DIM('a))"
13.905 + shows "integral\<^isup>L lborel f = \<integral>x. f (p2e x) \<partial>((\<Pi>\<^isub>M i\<in>{..<DIM('a)}. lborel))"
13.906 using f by (simp add: borel_fubini_positiv_integral lebesgue_integral_def)
13.907
13.908 -
13.909 -lemma Int_stable_atLeastAtMost:
13.910 - "Int_stable \<lparr>space = UNIV, sets = range (\<lambda>(a,b). {a::'a::ordered_euclidean_space .. b}) \<rparr>"
13.911 -proof (simp add: Int_stable_def image_iff, intro allI)
13.912 - fix a1 b1 a2 b2 :: 'a
13.913 - have "\<forall>i<DIM('a). \<exists>a b. {a1$$i..b1$$i} \<inter> {a2$$i..b2$$i} = {a..b}" by auto
13.914 - then have "\<exists>a b. \<forall>i<DIM('a). {a1$$i..b1$$i} \<inter> {a2$$i..b2$$i} = {a i..b i}"
13.915 - unfolding choice_iff' .
13.916 - then guess a b by safe
13.917 - then have "{a1..b1} \<inter> {a2..b2} = {(\<chi>\<chi> i. a i) .. (\<chi>\<chi> i. b i)}"
13.918 - by (simp add: set_eq_iff eucl_le[where 'a='a] all_conj_distrib[symmetric]) blast
13.919 - then show "\<exists>a' b'. {a1..b1} \<inter> {a2..b2} = {a'..b'}" by blast
13.920 -qed
13.921 -
13.922 -lemma (in sigma_algebra) borel_measurable_sets:
13.923 - assumes "f \<in> measurable borel M" "A \<in> sets M"
13.924 - shows "f -` A \<in> sets borel"
13.925 - using measurable_sets[OF assms] by simp
13.926 -
13.927 -lemma (in sigma_algebra) measurable_identity[intro,simp]:
13.928 - "(\<lambda>x. x) \<in> measurable M M"
13.929 - unfolding measurable_def by auto
13.930 +lemma borel_measurable_indicator':
13.931 + "A \<in> sets borel \<Longrightarrow> f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. indicator A (f x)) \<in> borel_measurable M"
13.932 + using measurable_comp[OF _ borel_measurable_indicator, of f M borel A] by (auto simp add: comp_def)
13.933
13.934 lemma lebesgue_real_affine:
13.935 - fixes X :: "real set"
13.936 - assumes "X \<in> sets borel" and "c \<noteq> 0"
13.937 - shows "measure lebesgue X = ereal \<bar>c\<bar> * measure lebesgue ((\<lambda>x. t + c * x) -` X)"
13.938 - (is "_ = ?\<nu> X")
13.939 -proof -
13.940 - let ?E = "\<lparr>space = UNIV, sets = range (\<lambda>(a,b). {a::real .. b})\<rparr> :: real algebra"
13.941 - let ?M = "\<lambda>\<nu>. \<lparr>space = space ?E, sets = sets (sigma ?E), measure = \<nu>\<rparr> :: real measure_space"
13.942 - have *: "?M (measure lebesgue) = lborel"
13.943 - unfolding borel_eq_atLeastAtMost[symmetric]
13.944 - by (simp add: lborel_def lebesgue_def)
13.945 - have **: "?M ?\<nu> = lborel \<lparr> measure := ?\<nu> \<rparr>"
13.946 - unfolding borel_eq_atLeastAtMost[symmetric]
13.947 - by (simp add: lborel_def lebesgue_def)
13.948 - show ?thesis
13.949 - proof (rule measure_unique_Int_stable[where X=X, OF Int_stable_atLeastAtMost], unfold * **)
13.950 - show "X \<in> sets (sigma ?E)"
13.951 - unfolding borel_eq_atLeastAtMost[symmetric] by fact
13.952 - have "\<And>x. \<exists>xa. x \<in> cube xa" apply(rule_tac x=x in mem_big_cube) by fastforce
13.953 - then show "(\<Union>i. cube i) = space ?E" by auto
13.954 - show "incseq cube" by (intro incseq_SucI cube_subset_Suc)
13.955 - show "range cube \<subseteq> sets ?E"
13.956 - unfolding cube_def [abs_def] by auto
13.957 - show "\<And>i. measure lebesgue (cube i) \<noteq> \<infinity>"
13.958 - by (simp add: cube_def)
13.959 - show "measure_space lborel" by default
13.960 - then interpret sigma_algebra "lborel\<lparr>measure := ?\<nu>\<rparr>"
13.961 - by (auto simp add: measure_space_def)
13.962 - show "measure_space (lborel\<lparr>measure := ?\<nu>\<rparr>)"
13.963 - proof
13.964 - show "positive (lborel\<lparr>measure := ?\<nu>\<rparr>) (measure (lborel\<lparr>measure := ?\<nu>\<rparr>))"
13.965 - by (auto simp: positive_def intro!: ereal_0_le_mult borel.borel_measurable_sets)
13.966 - show "countably_additive (lborel\<lparr>measure := ?\<nu>\<rparr>) (measure (lborel\<lparr>measure := ?\<nu>\<rparr>))"
13.967 - proof (simp add: countably_additive_def, safe)
13.968 - fix A :: "nat \<Rightarrow> real set" assume A: "range A \<subseteq> sets borel" "disjoint_family A"
13.969 - then have Ai: "\<And>i. A i \<in> sets borel" by auto
13.970 - have "(\<Sum>n. measure lebesgue ((\<lambda>x. t + c * x) -` A n)) = measure lebesgue (\<Union>n. (\<lambda>x. t + c * x) -` A n)"
13.971 - proof (intro lborel.measure_countably_additive)
13.972 - { fix n have "(\<lambda>x. t + c * x) -` A n \<inter> space borel \<in> sets borel"
13.973 - using A borel.measurable_ident unfolding id_def
13.974 - by (intro measurable_sets[where A=borel] borel.borel_measurable_add[OF _ borel.borel_measurable_times]) auto }
13.975 - then show "range (\<lambda>i. (\<lambda>x. t + c * x) -` A i) \<subseteq> sets borel" by auto
13.976 - from `disjoint_family A`
13.977 - show "disjoint_family (\<lambda>i. (\<lambda>x. t + c * x) -` A i)"
13.978 - by (rule disjoint_family_on_bisimulation) auto
13.979 - qed
13.980 - with Ai show "(\<Sum>n. ?\<nu> (A n)) = ?\<nu> (UNION UNIV A)"
13.981 - by (subst suminf_cmult_ereal)
13.982 - (auto simp: vimage_UN borel.borel_measurable_sets)
13.983 - qed
13.984 - qed
13.985 - fix X assume "X \<in> sets ?E"
13.986 - then obtain a b where [simp]: "X = {a .. b}" by auto
13.987 - show "measure lebesgue X = ?\<nu> X"
13.988 - proof cases
13.989 - assume "0 < c"
13.990 - then have "(\<lambda>x. t + c * x) -` {a..b} = {(a - t) / c .. (b - t) / c}"
13.991 - by (auto simp: field_simps)
13.992 - with `0 < c` show ?thesis
13.993 - by (cases "a \<le> b") (auto simp: field_simps)
13.994 - next
13.995 - assume "\<not> 0 < c" with `c \<noteq> 0` have "c < 0" by auto
13.996 - then have *: "(\<lambda>x. t + c * x) -` {a..b} = {(b - t) / c .. (a - t) / c}"
13.997 - by (auto simp: field_simps)
13.998 - with `c < 0` show ?thesis
13.999 - by (cases "a \<le> b") (auto simp: field_simps)
13.1000 - qed
13.1001 + fixes c :: real assumes "c \<noteq> 0"
13.1002 + shows "lborel = density (distr lborel borel (\<lambda>x. t + c * x)) (\<lambda>_. \<bar>c\<bar>)" (is "_ = ?D")
13.1003 +proof (rule lborel_eqI)
13.1004 + fix a b show "emeasure ?D {a..b} = content {a .. b}"
13.1005 + proof cases
13.1006 + assume "0 < c"
13.1007 + then have "(\<lambda>x. t + c * x) -` {a..b} = {(a - t) / c .. (b - t) / c}"
13.1008 + by (auto simp: field_simps)
13.1009 + with `0 < c` show ?thesis
13.1010 + by (cases "a \<le> b")
13.1011 + (auto simp: field_simps emeasure_density positive_integral_distr positive_integral_cmult
13.1012 + borel_measurable_indicator' emeasure_distr)
13.1013 + next
13.1014 + assume "\<not> 0 < c" with `c \<noteq> 0` have "c < 0" by auto
13.1015 + then have *: "(\<lambda>x. t + c * x) -` {a..b} = {(b - t) / c .. (a - t) / c}"
13.1016 + by (auto simp: field_simps)
13.1017 + with `c < 0` show ?thesis
13.1018 + by (cases "a \<le> b")
13.1019 + (auto simp: field_simps emeasure_density positive_integral_distr
13.1020 + positive_integral_cmult borel_measurable_indicator' emeasure_distr)
13.1021 qed
13.1022 -qed
13.1023 +qed simp
13.1024
13.1025 end
14.1 --- a/src/HOL/Probability/Measure.thy Mon Apr 23 12:23:23 2012 +0100
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,1452 +0,0 @@
14.4 -(* Title: HOL/Probability/Measure.thy
14.5 - Author: Lawrence C Paulson
14.6 - Author: Johannes Hölzl, TU München
14.7 - Author: Armin Heller, TU München
14.8 -*)
14.9 -
14.10 -header {* Properties about measure spaces *}
14.11 -
14.12 -theory Measure
14.13 - imports Caratheodory
14.14 -begin
14.15 -
14.16 -lemma measure_algebra_more[simp]:
14.17 - "\<lparr> space = A, sets = B, \<dots> = algebra.more M \<rparr> \<lparr> measure := m \<rparr> =
14.18 - \<lparr> space = A, sets = B, \<dots> = algebra.more (M \<lparr> measure := m \<rparr>) \<rparr>"
14.19 - by (cases M) simp
14.20 -
14.21 -lemma measure_algebra_more_eq[simp]:
14.22 - "\<And>X. measure \<lparr> space = T, sets = A, \<dots> = algebra.more X \<rparr> = measure X"
14.23 - unfolding measure_space.splits by simp
14.24 -
14.25 -lemma measure_sigma[simp]: "measure (sigma A) = measure A"
14.26 - unfolding sigma_def by simp
14.27 -
14.28 -lemma algebra_measure_update[simp]:
14.29 - "algebra (M'\<lparr>measure := m\<rparr>) \<longleftrightarrow> algebra M'"
14.30 - unfolding algebra_iff_Un by simp
14.31 -
14.32 -lemma sigma_algebra_measure_update[simp]:
14.33 - "sigma_algebra (M'\<lparr>measure := m\<rparr>) \<longleftrightarrow> sigma_algebra M'"
14.34 - unfolding sigma_algebra_def sigma_algebra_axioms_def by simp
14.35 -
14.36 -lemma finite_sigma_algebra_measure_update[simp]:
14.37 - "finite_sigma_algebra (M'\<lparr>measure := m\<rparr>) \<longleftrightarrow> finite_sigma_algebra M'"
14.38 - unfolding finite_sigma_algebra_def finite_sigma_algebra_axioms_def by simp
14.39 -
14.40 -lemma measurable_cancel_measure[simp]:
14.41 - "measurable M1 (M2\<lparr>measure := m2\<rparr>) = measurable M1 M2"
14.42 - "measurable (M2\<lparr>measure := m1\<rparr>) M1 = measurable M2 M1"
14.43 - unfolding measurable_def by auto
14.44 -
14.45 -lemma inj_on_image_eq_iff:
14.46 - assumes "inj_on f S"
14.47 - assumes "A \<subseteq> S" "B \<subseteq> S"
14.48 - shows "(f ` A = f ` B) \<longleftrightarrow> (A = B)"
14.49 -proof -
14.50 - have "inj_on f (A \<union> B)"
14.51 - using assms by (auto intro: subset_inj_on)
14.52 - from inj_on_Un_image_eq_iff[OF this]
14.53 - show ?thesis .
14.54 -qed
14.55 -
14.56 -lemma image_vimage_inter_eq:
14.57 - assumes "f ` S = T" "X \<subseteq> T"
14.58 - shows "f ` (f -` X \<inter> S) = X"
14.59 -proof (intro antisym)
14.60 - have "f ` (f -` X \<inter> S) \<subseteq> f ` (f -` X)" by auto
14.61 - also have "\<dots> = X \<inter> range f" by simp
14.62 - also have "\<dots> = X" using assms by auto
14.63 - finally show "f ` (f -` X \<inter> S) \<subseteq> X" by auto
14.64 -next
14.65 - show "X \<subseteq> f ` (f -` X \<inter> S)"
14.66 - proof
14.67 - fix x assume "x \<in> X"
14.68 - then have "x \<in> T" using `X \<subseteq> T` by auto
14.69 - then obtain y where "x = f y" "y \<in> S"
14.70 - using assms by auto
14.71 - then have "{y} \<subseteq> f -` X \<inter> S" using `x \<in> X` by auto
14.72 - moreover have "x \<in> f ` {y}" using `x = f y` by auto
14.73 - ultimately show "x \<in> f ` (f -` X \<inter> S)" by auto
14.74 - qed
14.75 -qed
14.76 -
14.77 -text {*
14.78 - This formalisation of measure theory is based on the work of Hurd/Coble wand
14.79 - was later translated by Lawrence Paulson to Isabelle/HOL. Later it was
14.80 - modified to use the positive infinite reals and to prove the uniqueness of
14.81 - cut stable measures.
14.82 -*}
14.83 -
14.84 -section {* Equations for the measure function @{text \<mu>} *}
14.85 -
14.86 -lemma (in measure_space) measure_countably_additive:
14.87 - assumes "range A \<subseteq> sets M" "disjoint_family A"
14.88 - shows "(\<Sum>i. \<mu> (A i)) = \<mu> (\<Union>i. A i)"
14.89 -proof -
14.90 - have "(\<Union> i. A i) \<in> sets M" using assms(1) by (rule countable_UN)
14.91 - with ca assms show ?thesis by (simp add: countably_additive_def)
14.92 -qed
14.93 -
14.94 -lemma (in sigma_algebra) sigma_algebra_cong:
14.95 - assumes "space N = space M" "sets N = sets M"
14.96 - shows "sigma_algebra N"
14.97 - by default (insert sets_into_space, auto simp: assms)
14.98 -
14.99 -lemma (in measure_space) measure_space_cong:
14.100 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "space N = space M" "sets N = sets M"
14.101 - shows "measure_space N"
14.102 -proof -
14.103 - interpret N: sigma_algebra N by (intro sigma_algebra_cong assms)
14.104 - show ?thesis
14.105 - proof
14.106 - show "positive N (measure N)" using assms by (auto simp: positive_def)
14.107 - show "countably_additive N (measure N)" unfolding countably_additive_def
14.108 - proof safe
14.109 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets N" "disjoint_family A"
14.110 - then have "\<And>i. A i \<in> sets M" "(UNION UNIV A) \<in> sets M" unfolding assms by auto
14.111 - from measure_countably_additive[of A] A this[THEN assms(1)]
14.112 - show "(\<Sum>n. measure N (A n)) = measure N (UNION UNIV A)"
14.113 - unfolding assms by simp
14.114 - qed
14.115 - qed
14.116 -qed
14.117 -
14.118 -lemma (in measure_space) additive: "additive M \<mu>"
14.119 - using ca by (auto intro!: countably_additive_additive simp: positive_def)
14.120 -
14.121 -lemma (in measure_space) measure_additive:
14.122 - "a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {}
14.123 - \<Longrightarrow> \<mu> a + \<mu> b = \<mu> (a \<union> b)"
14.124 - by (metis additiveD additive)
14.125 -
14.126 -lemma (in measure_space) measure_mono:
14.127 - assumes "a \<subseteq> b" "a \<in> sets M" "b \<in> sets M"
14.128 - shows "\<mu> a \<le> \<mu> b"
14.129 -proof -
14.130 - have "b = a \<union> (b - a)" using assms by auto
14.131 - moreover have "{} = a \<inter> (b - a)" by auto
14.132 - ultimately have "\<mu> b = \<mu> a + \<mu> (b - a)"
14.133 - using measure_additive[of a "b - a"] Diff[of b a] assms by auto
14.134 - moreover have "\<mu> a + 0 \<le> \<mu> a + \<mu> (b - a)" using assms by (intro add_mono) auto
14.135 - ultimately show "\<mu> a \<le> \<mu> b" by auto
14.136 -qed
14.137 -
14.138 -lemma (in measure_space) measure_top:
14.139 - "A \<in> sets M \<Longrightarrow> \<mu> A \<le> \<mu> (space M)"
14.140 - using sets_into_space[of A] by (auto intro!: measure_mono)
14.141 -
14.142 -lemma (in measure_space) measure_compl:
14.143 - assumes s: "s \<in> sets M" and fin: "\<mu> s \<noteq> \<infinity>"
14.144 - shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s"
14.145 -proof -
14.146 - have s_less_space: "\<mu> s \<le> \<mu> (space M)"
14.147 - using s by (auto intro!: measure_mono sets_into_space)
14.148 - from s have "0 \<le> \<mu> s" by auto
14.149 - have "\<mu> (space M) = \<mu> (s \<union> (space M - s))" using s
14.150 - by (metis Un_Diff_cancel Un_absorb1 s sets_into_space)
14.151 - also have "... = \<mu> s + \<mu> (space M - s)"
14.152 - by (rule additiveD [OF additive]) (auto simp add: s)
14.153 - finally have "\<mu> (space M) = \<mu> s + \<mu> (space M - s)" .
14.154 - then show ?thesis
14.155 - using fin `0 \<le> \<mu> s`
14.156 - unfolding ereal_eq_minus_iff by (auto simp: ac_simps)
14.157 -qed
14.158 -
14.159 -lemma (in measure_space) measure_Diff:
14.160 - assumes finite: "\<mu> B \<noteq> \<infinity>"
14.161 - and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
14.162 - shows "\<mu> (A - B) = \<mu> A - \<mu> B"
14.163 -proof -
14.164 - have "0 \<le> \<mu> B" using assms by auto
14.165 - have "(A - B) \<union> B = A" using `B \<subseteq> A` by auto
14.166 - then have "\<mu> A = \<mu> ((A - B) \<union> B)" by simp
14.167 - also have "\<dots> = \<mu> (A - B) + \<mu> B"
14.168 - using measurable by (subst measure_additive[symmetric]) auto
14.169 - finally show "\<mu> (A - B) = \<mu> A - \<mu> B"
14.170 - unfolding ereal_eq_minus_iff
14.171 - using finite `0 \<le> \<mu> B` by auto
14.172 -qed
14.173 -
14.174 -lemma (in measure_space) measure_countable_increasing:
14.175 - assumes A: "range A \<subseteq> sets M"
14.176 - and A0: "A 0 = {}"
14.177 - and ASuc: "\<And>n. A n \<subseteq> A (Suc n)"
14.178 - shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
14.179 -proof -
14.180 - { fix n
14.181 - have "\<mu> (A n) = (\<Sum>i<n. \<mu> (A (Suc i) - A i))"
14.182 - proof (induct n)
14.183 - case 0 thus ?case by (auto simp add: A0)
14.184 - next
14.185 - case (Suc m)
14.186 - have "A (Suc m) = A m \<union> (A (Suc m) - A m)"
14.187 - by (metis ASuc Un_Diff_cancel Un_absorb1)
14.188 - hence "\<mu> (A (Suc m)) =
14.189 - \<mu> (A m) + \<mu> (A (Suc m) - A m)"
14.190 - by (subst measure_additive)
14.191 - (auto simp add: measure_additive range_subsetD [OF A])
14.192 - with Suc show ?case
14.193 - by simp
14.194 - qed }
14.195 - note Meq = this
14.196 - have Aeq: "(\<Union>i. A (Suc i) - A i) = (\<Union>i. A i)"
14.197 - proof (rule UN_finite2_eq [where k=1], simp)
14.198 - fix i
14.199 - show "(\<Union>i\<in>{0..<i}. A (Suc i) - A i) = (\<Union>i\<in>{0..<Suc i}. A i)"
14.200 - proof (induct i)
14.201 - case 0 thus ?case by (simp add: A0)
14.202 - next
14.203 - case (Suc i)
14.204 - thus ?case
14.205 - by (auto simp add: atLeastLessThanSuc intro: subsetD [OF ASuc])
14.206 - qed
14.207 - qed
14.208 - have A1: "\<And>i. A (Suc i) - A i \<in> sets M"
14.209 - by (metis A Diff range_subsetD)
14.210 - have A2: "(\<Union>i. A (Suc i) - A i) \<in> sets M"
14.211 - by (blast intro: range_subsetD [OF A])
14.212 - have "(SUP n. \<Sum>i<n. \<mu> (A (Suc i) - A i)) = (\<Sum>i. \<mu> (A (Suc i) - A i))"
14.213 - using A by (auto intro!: suminf_ereal_eq_SUPR[symmetric])
14.214 - also have "\<dots> = \<mu> (\<Union>i. A (Suc i) - A i)"
14.215 - by (rule measure_countably_additive)
14.216 - (auto simp add: disjoint_family_Suc ASuc A1 A2)
14.217 - also have "... = \<mu> (\<Union>i. A i)"
14.218 - by (simp add: Aeq)
14.219 - finally have "(SUP n. \<Sum>i<n. \<mu> (A (Suc i) - A i)) = \<mu> (\<Union>i. A i)" .
14.220 - then show ?thesis by (auto simp add: Meq)
14.221 -qed
14.222 -
14.223 -lemma (in measure_space) continuity_from_below:
14.224 - assumes A: "range A \<subseteq> sets M" and "incseq A"
14.225 - shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
14.226 -proof -
14.227 - have *: "(SUP n. \<mu> (nat_case {} A (Suc n))) = (SUP n. \<mu> (nat_case {} A n))"
14.228 - using A by (auto intro!: SUPR_eq exI split: nat.split)
14.229 - have ueq: "(\<Union>i. nat_case {} A i) = (\<Union>i. A i)"
14.230 - by (auto simp add: split: nat.splits)
14.231 - have meq: "\<And>n. \<mu> (A n) = (\<mu> \<circ> nat_case {} A) (Suc n)"
14.232 - by simp
14.233 - have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. nat_case {} A i)"
14.234 - using range_subsetD[OF A] incseq_SucD[OF `incseq A`]
14.235 - by (force split: nat.splits intro!: measure_countable_increasing)
14.236 - also have "\<mu> (\<Union>i. nat_case {} A i) = \<mu> (\<Union>i. A i)"
14.237 - by (simp add: ueq)
14.238 - finally have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. A i)" .
14.239 - thus ?thesis unfolding meq * comp_def .
14.240 -qed
14.241 -
14.242 -lemma (in measure_space) measure_incseq:
14.243 - assumes "range B \<subseteq> sets M" "incseq B"
14.244 - shows "incseq (\<lambda>i. \<mu> (B i))"
14.245 - using assms by (auto simp: incseq_def intro!: measure_mono)
14.246 -
14.247 -lemma (in measure_space) continuity_from_below_Lim:
14.248 - assumes A: "range A \<subseteq> sets M" "incseq A"
14.249 - shows "(\<lambda>i. (\<mu> (A i))) ----> \<mu> (\<Union>i. A i)"
14.250 - using LIMSEQ_ereal_SUPR[OF measure_incseq, OF A]
14.251 - continuity_from_below[OF A] by simp
14.252 -
14.253 -lemma (in measure_space) measure_decseq:
14.254 - assumes "range B \<subseteq> sets M" "decseq B"
14.255 - shows "decseq (\<lambda>i. \<mu> (B i))"
14.256 - using assms by (auto simp: decseq_def intro!: measure_mono)
14.257 -
14.258 -lemma (in measure_space) continuity_from_above:
14.259 - assumes A: "range A \<subseteq> sets M" and "decseq A"
14.260 - and finite: "\<And>i. \<mu> (A i) \<noteq> \<infinity>"
14.261 - shows "(INF n. \<mu> (A n)) = \<mu> (\<Inter>i. A i)"
14.262 -proof -
14.263 - have le_MI: "\<mu> (\<Inter>i. A i) \<le> \<mu> (A 0)"
14.264 - using A by (auto intro!: measure_mono)
14.265 - hence *: "\<mu> (\<Inter>i. A i) \<noteq> \<infinity>" using finite[of 0] by auto
14.266 -
14.267 - have A0: "0 \<le> \<mu> (A 0)" using A by auto
14.268 -
14.269 - have "\<mu> (A 0) - (INF n. \<mu> (A n)) = \<mu> (A 0) + (SUP n. - \<mu> (A n))"
14.270 - by (simp add: ereal_SUPR_uminus minus_ereal_def)
14.271 - also have "\<dots> = (SUP n. \<mu> (A 0) - \<mu> (A n))"
14.272 - unfolding minus_ereal_def using A0 assms
14.273 - by (subst SUPR_ereal_add) (auto simp add: measure_decseq)
14.274 - also have "\<dots> = (SUP n. \<mu> (A 0 - A n))"
14.275 - using A finite `decseq A`[unfolded decseq_def] by (subst measure_Diff) auto
14.276 - also have "\<dots> = \<mu> (\<Union>i. A 0 - A i)"
14.277 - proof (rule continuity_from_below)
14.278 - show "range (\<lambda>n. A 0 - A n) \<subseteq> sets M"
14.279 - using A by auto
14.280 - show "incseq (\<lambda>n. A 0 - A n)"
14.281 - using `decseq A` by (auto simp add: incseq_def decseq_def)
14.282 - qed
14.283 - also have "\<dots> = \<mu> (A 0) - \<mu> (\<Inter>i. A i)"
14.284 - using A finite * by (simp, subst measure_Diff) auto
14.285 - finally show ?thesis
14.286 - unfolding ereal_minus_eq_minus_iff using finite A0 by auto
14.287 -qed
14.288 -
14.289 -lemma (in measure_space) measure_insert:
14.290 - assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A"
14.291 - shows "\<mu> (insert x A) = \<mu> {x} + \<mu> A"
14.292 -proof -
14.293 - have "{x} \<inter> A = {}" using `x \<notin> A` by auto
14.294 - from measure_additive[OF sets this] show ?thesis by simp
14.295 -qed
14.296 -
14.297 -lemma (in measure_space) measure_setsum:
14.298 - assumes "finite S" and "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M"
14.299 - assumes disj: "disjoint_family_on A S"
14.300 - shows "(\<Sum>i\<in>S. \<mu> (A i)) = \<mu> (\<Union>i\<in>S. A i)"
14.301 -using assms proof induct
14.302 - case (insert i S)
14.303 - then have "(\<Sum>i\<in>S. \<mu> (A i)) = \<mu> (\<Union>a\<in>S. A a)"
14.304 - by (auto intro: disjoint_family_on_mono)
14.305 - moreover have "A i \<inter> (\<Union>a\<in>S. A a) = {}"
14.306 - using `disjoint_family_on A (insert i S)` `i \<notin> S`
14.307 - by (auto simp: disjoint_family_on_def)
14.308 - ultimately show ?case using insert
14.309 - by (auto simp: measure_additive finite_UN)
14.310 -qed simp
14.311 -
14.312 -lemma (in measure_space) measure_finite_singleton:
14.313 - assumes "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
14.314 - shows "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})"
14.315 - using measure_setsum[of S "\<lambda>x. {x}", OF assms]
14.316 - by (auto simp: disjoint_family_on_def)
14.317 -
14.318 -lemma finite_additivity_sufficient:
14.319 - assumes "sigma_algebra M"
14.320 - assumes fin: "finite (space M)" and pos: "positive M (measure M)" and add: "additive M (measure M)"
14.321 - shows "measure_space M"
14.322 -proof -
14.323 - interpret sigma_algebra M by fact
14.324 - show ?thesis
14.325 - proof
14.326 - show [simp]: "positive M (measure M)" using pos by (simp add: positive_def)
14.327 - show "countably_additive M (measure M)"
14.328 - proof (auto simp add: countably_additive_def)
14.329 - fix A :: "nat \<Rightarrow> 'a set"
14.330 - assume A: "range A \<subseteq> sets M"
14.331 - and disj: "disjoint_family A"
14.332 - and UnA: "(\<Union>i. A i) \<in> sets M"
14.333 - def I \<equiv> "{i. A i \<noteq> {}}"
14.334 - have "Union (A ` I) \<subseteq> space M" using A
14.335 - by auto (metis range_subsetD subsetD sets_into_space)
14.336 - hence "finite (A ` I)"
14.337 - by (metis finite_UnionD finite_subset fin)
14.338 - moreover have "inj_on A I" using disj
14.339 - by (auto simp add: I_def disjoint_family_on_def inj_on_def)
14.340 - ultimately have finI: "finite I"
14.341 - by (metis finite_imageD)
14.342 - hence "\<exists>N. \<forall>m\<ge>N. A m = {}"
14.343 - proof (cases "I = {}")
14.344 - case True thus ?thesis by (simp add: I_def)
14.345 - next
14.346 - case False
14.347 - hence "\<forall>i\<in>I. i < Suc(Max I)"
14.348 - by (simp add: Max_less_iff [symmetric] finI)
14.349 - hence "\<forall>m \<ge> Suc(Max I). A m = {}"
14.350 - by (simp add: I_def) (metis less_le_not_le)
14.351 - thus ?thesis
14.352 - by blast
14.353 - qed
14.354 - then obtain N where N: "\<forall>m\<ge>N. A m = {}" by blast
14.355 - then have "\<forall>m\<ge>N. measure M (A m) = 0" using pos[unfolded positive_def] by simp
14.356 - then have "(\<Sum>n. measure M (A n)) = (\<Sum>m<N. measure M (A m))"
14.357 - by (simp add: suminf_finite)
14.358 - also have "... = measure M (\<Union>i<N. A i)"
14.359 - proof (induct N)
14.360 - case 0 thus ?case using pos[unfolded positive_def] by simp
14.361 - next
14.362 - case (Suc n)
14.363 - have "measure M (A n \<union> (\<Union> x<n. A x)) = measure M (A n) + measure M (\<Union> i<n. A i)"
14.364 - proof (rule Caratheodory.additiveD [OF add])
14.365 - show "A n \<inter> (\<Union> x<n. A x) = {}" using disj
14.366 - by (auto simp add: disjoint_family_on_def nat_less_le) blast
14.367 - show "A n \<in> sets M" using A
14.368 - by force
14.369 - show "(\<Union>i<n. A i) \<in> sets M"
14.370 - proof (induct n)
14.371 - case 0 thus ?case by simp
14.372 - next
14.373 - case (Suc n) thus ?case using A
14.374 - by (simp add: lessThan_Suc Un range_subsetD)
14.375 - qed
14.376 - qed
14.377 - thus ?case using Suc
14.378 - by (simp add: lessThan_Suc)
14.379 - qed
14.380 - also have "... = measure M (\<Union>i. A i)"
14.381 - proof -
14.382 - have "(\<Union> i<N. A i) = (\<Union>i. A i)" using N
14.383 - by auto (metis Int_absorb N disjoint_iff_not_equal lessThan_iff not_leE)
14.384 - thus ?thesis by simp
14.385 - qed
14.386 - finally show "(\<Sum>n. measure M (A n)) = measure M (\<Union>i. A i)" .
14.387 - qed
14.388 - qed
14.389 -qed
14.390 -
14.391 -lemma (in measure_space) measure_setsum_split:
14.392 - assumes "finite S" and "A \<in> sets M" and br_in_M: "B ` S \<subseteq> sets M"
14.393 - assumes "(\<Union>i\<in>S. B i) = space M"
14.394 - assumes "disjoint_family_on B S"
14.395 - shows "\<mu> A = (\<Sum>i\<in>S. \<mu> (A \<inter> (B i)))"
14.396 -proof -
14.397 - have *: "\<mu> A = \<mu> (\<Union>i\<in>S. A \<inter> B i)"
14.398 - using assms by auto
14.399 - show ?thesis unfolding *
14.400 - proof (rule measure_setsum[symmetric])
14.401 - show "disjoint_family_on (\<lambda>i. A \<inter> B i) S"
14.402 - using `disjoint_family_on B S`
14.403 - unfolding disjoint_family_on_def by auto
14.404 - qed (insert assms, auto)
14.405 -qed
14.406 -
14.407 -lemma (in measure_space) measure_subadditive:
14.408 - assumes measurable: "A \<in> sets M" "B \<in> sets M"
14.409 - shows "\<mu> (A \<union> B) \<le> \<mu> A + \<mu> B"
14.410 -proof -
14.411 - from measure_additive[of A "B - A"]
14.412 - have "\<mu> (A \<union> B) = \<mu> A + \<mu> (B - A)"
14.413 - using assms by (simp add: Diff)
14.414 - also have "\<dots> \<le> \<mu> A + \<mu> B"
14.415 - using assms by (auto intro!: add_left_mono measure_mono)
14.416 - finally show ?thesis .
14.417 -qed
14.418 -
14.419 -lemma (in measure_space) measure_subadditive_finite:
14.420 - assumes "finite I" "\<And>i. i\<in>I \<Longrightarrow> A i \<in> sets M"
14.421 - shows "\<mu> (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. \<mu> (A i))"
14.422 -using assms proof induct
14.423 - case (insert i I)
14.424 - then have "\<mu> (\<Union>i\<in>insert i I. A i) = \<mu> (A i \<union> (\<Union>i\<in>I. A i))"
14.425 - by simp
14.426 - also have "\<dots> \<le> \<mu> (A i) + \<mu> (\<Union>i\<in>I. A i)"
14.427 - using insert by (intro measure_subadditive finite_UN) auto
14.428 - also have "\<dots> \<le> \<mu> (A i) + (\<Sum>i\<in>I. \<mu> (A i))"
14.429 - using insert by (intro add_mono) auto
14.430 - also have "\<dots> = (\<Sum>i\<in>insert i I. \<mu> (A i))"
14.431 - using insert by auto
14.432 - finally show ?case .
14.433 -qed simp
14.434 -
14.435 -lemma (in measure_space) measure_eq_0:
14.436 - assumes "N \<in> sets M" and "\<mu> N = 0" and "K \<subseteq> N" and "K \<in> sets M"
14.437 - shows "\<mu> K = 0"
14.438 - using measure_mono[OF assms(3,4,1)] assms(2) positive_measure[OF assms(4)] by auto
14.439 -
14.440 -lemma (in measure_space) measure_finitely_subadditive:
14.441 - assumes "finite I" "A ` I \<subseteq> sets M"
14.442 - shows "\<mu> (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. \<mu> (A i))"
14.443 -using assms proof induct
14.444 - case (insert i I)
14.445 - then have "(\<Union>i\<in>I. A i) \<in> sets M" by auto
14.446 - then have "\<mu> (\<Union>i\<in>insert i I. A i) \<le> \<mu> (A i) + \<mu> (\<Union>i\<in>I. A i)"
14.447 - using insert by (simp add: measure_subadditive)
14.448 - also have "\<dots> \<le> (\<Sum>i\<in>insert i I. \<mu> (A i))"
14.449 - using insert by (auto intro!: add_left_mono)
14.450 - finally show ?case .
14.451 -qed simp
14.452 -
14.453 -lemma (in measure_space) measure_countably_subadditive:
14.454 - assumes "range f \<subseteq> sets M"
14.455 - shows "\<mu> (\<Union>i. f i) \<le> (\<Sum>i. \<mu> (f i))"
14.456 -proof -
14.457 - have "\<mu> (\<Union>i. f i) = \<mu> (\<Union>i. disjointed f i)"
14.458 - unfolding UN_disjointed_eq ..
14.459 - also have "\<dots> = (\<Sum>i. \<mu> (disjointed f i))"
14.460 - using range_disjointed_sets[OF assms] measure_countably_additive
14.461 - by (simp add: disjoint_family_disjointed comp_def)
14.462 - also have "\<dots> \<le> (\<Sum>i. \<mu> (f i))"
14.463 - using range_disjointed_sets[OF assms] assms
14.464 - by (auto intro!: suminf_le_pos measure_mono disjointed_subset)
14.465 - finally show ?thesis .
14.466 -qed
14.467 -
14.468 -lemma (in measure_space) measure_UN_eq_0:
14.469 - assumes "\<And>i::nat. \<mu> (N i) = 0" and "range N \<subseteq> sets M"
14.470 - shows "\<mu> (\<Union> i. N i) = 0"
14.471 -proof -
14.472 - have "0 \<le> \<mu> (\<Union> i. N i)" using assms by auto
14.473 - moreover have "\<mu> (\<Union> i. N i) \<le> 0"
14.474 - using measure_countably_subadditive[OF assms(2)] assms(1) by simp
14.475 - ultimately show ?thesis by simp
14.476 -qed
14.477 -
14.478 -lemma (in measure_space) measure_inter_full_set:
14.479 - assumes "S \<in> sets M" "T \<in> sets M" and fin: "\<mu> (T - S) \<noteq> \<infinity>"
14.480 - assumes T: "\<mu> T = \<mu> (space M)"
14.481 - shows "\<mu> (S \<inter> T) = \<mu> S"
14.482 -proof (rule antisym)
14.483 - show " \<mu> (S \<inter> T) \<le> \<mu> S"
14.484 - using assms by (auto intro!: measure_mono)
14.485 -
14.486 - have pos: "0 \<le> \<mu> (T - S)" using assms by auto
14.487 - show "\<mu> S \<le> \<mu> (S \<inter> T)"
14.488 - proof (rule ccontr)
14.489 - assume contr: "\<not> ?thesis"
14.490 - have "\<mu> (space M) = \<mu> ((T - S) \<union> (S \<inter> T))"
14.491 - unfolding T[symmetric] by (auto intro!: arg_cong[where f="\<mu>"])
14.492 - also have "\<dots> \<le> \<mu> (T - S) + \<mu> (S \<inter> T)"
14.493 - using assms by (auto intro!: measure_subadditive)
14.494 - also have "\<dots> < \<mu> (T - S) + \<mu> S"
14.495 - using fin contr pos by (intro ereal_less_add) auto
14.496 - also have "\<dots> = \<mu> (T \<union> S)"
14.497 - using assms by (subst measure_additive) auto
14.498 - also have "\<dots> \<le> \<mu> (space M)"
14.499 - using assms sets_into_space by (auto intro!: measure_mono)
14.500 - finally show False ..
14.501 - qed
14.502 -qed
14.503 -
14.504 -lemma measure_unique_Int_stable:
14.505 - fixes E :: "('a, 'b) algebra_scheme" and A :: "nat \<Rightarrow> 'a set"
14.506 - assumes "Int_stable E"
14.507 - and A: "range A \<subseteq> sets E" "incseq A" "(\<Union>i. A i) = space E"
14.508 - and M: "measure_space \<lparr>space = space E, sets = sets (sigma E), measure = \<mu>\<rparr>" (is "measure_space ?M")
14.509 - and N: "measure_space \<lparr>space = space E, sets = sets (sigma E), measure = \<nu>\<rparr>" (is "measure_space ?N")
14.510 - and eq: "\<And>X. X \<in> sets E \<Longrightarrow> \<mu> X = \<nu> X"
14.511 - and finite: "\<And>i. \<mu> (A i) \<noteq> \<infinity>"
14.512 - assumes "X \<in> sets (sigma E)"
14.513 - shows "\<mu> X = \<nu> X"
14.514 -proof -
14.515 - let ?D = "\<lambda>F. {D. D \<in> sets (sigma E) \<and> \<mu> (F \<inter> D) = \<nu> (F \<inter> D)}"
14.516 - interpret M: measure_space ?M
14.517 - where "space ?M = space E" and "sets ?M = sets (sigma E)" and "measure ?M = \<mu>" by (simp_all add: M)
14.518 - interpret N: measure_space ?N
14.519 - where "space ?N = space E" and "sets ?N = sets (sigma E)" and "measure ?N = \<nu>" by (simp_all add: N)
14.520 - { fix F assume "F \<in> sets E" and "\<mu> F \<noteq> \<infinity>"
14.521 - then have [intro]: "F \<in> sets (sigma E)" by auto
14.522 - have "\<nu> F \<noteq> \<infinity>" using `\<mu> F \<noteq> \<infinity>` `F \<in> sets E` eq by simp
14.523 - interpret D: dynkin_system "\<lparr>space=space E, sets=?D F\<rparr>"
14.524 - proof (rule dynkin_systemI, simp_all)
14.525 - fix A assume "A \<in> sets (sigma E) \<and> \<mu> (F \<inter> A) = \<nu> (F \<inter> A)"
14.526 - then show "A \<subseteq> space E" using M.sets_into_space by auto
14.527 - next
14.528 - have "F \<inter> space E = F" using `F \<in> sets E` by auto
14.529 - then show "\<mu> (F \<inter> space E) = \<nu> (F \<inter> space E)"
14.530 - using `F \<in> sets E` eq by auto
14.531 - next
14.532 - fix A assume *: "A \<in> sets (sigma E) \<and> \<mu> (F \<inter> A) = \<nu> (F \<inter> A)"
14.533 - then have **: "F \<inter> (space (sigma E) - A) = F - (F \<inter> A)"
14.534 - and [intro]: "F \<inter> A \<in> sets (sigma E)"
14.535 - using `F \<in> sets E` M.sets_into_space by auto
14.536 - have "\<nu> (F \<inter> A) \<le> \<nu> F" by (auto intro!: N.measure_mono)
14.537 - then have "\<nu> (F \<inter> A) \<noteq> \<infinity>" using `\<nu> F \<noteq> \<infinity>` by auto
14.538 - have "\<mu> (F \<inter> A) \<le> \<mu> F" by (auto intro!: M.measure_mono)
14.539 - then have "\<mu> (F \<inter> A) \<noteq> \<infinity>" using `\<mu> F \<noteq> \<infinity>` by auto
14.540 - then have "\<mu> (F \<inter> (space (sigma E) - A)) = \<mu> F - \<mu> (F \<inter> A)" unfolding **
14.541 - using `F \<inter> A \<in> sets (sigma E)` by (auto intro!: M.measure_Diff)
14.542 - also have "\<dots> = \<nu> F - \<nu> (F \<inter> A)" using eq `F \<in> sets E` * by simp
14.543 - also have "\<dots> = \<nu> (F \<inter> (space (sigma E) - A))" unfolding **
14.544 - using `F \<inter> A \<in> sets (sigma E)` `\<nu> (F \<inter> A) \<noteq> \<infinity>` by (auto intro!: N.measure_Diff[symmetric])
14.545 - finally show "space E - A \<in> sets (sigma E) \<and> \<mu> (F \<inter> (space E - A)) = \<nu> (F \<inter> (space E - A))"
14.546 - using * by auto
14.547 - next
14.548 - fix A :: "nat \<Rightarrow> 'a set"
14.549 - assume "disjoint_family A" "range A \<subseteq> {X \<in> sets (sigma E). \<mu> (F \<inter> X) = \<nu> (F \<inter> X)}"
14.550 - then have A: "range (\<lambda>i. F \<inter> A i) \<subseteq> sets (sigma E)" "F \<inter> (\<Union>x. A x) = (\<Union>x. F \<inter> A x)"
14.551 - "disjoint_family (\<lambda>i. F \<inter> A i)" "\<And>i. \<mu> (F \<inter> A i) = \<nu> (F \<inter> A i)" "range A \<subseteq> sets (sigma E)"
14.552 - by (auto simp: disjoint_family_on_def subset_eq)
14.553 - then show "(\<Union>x. A x) \<in> sets (sigma E) \<and> \<mu> (F \<inter> (\<Union>x. A x)) = \<nu> (F \<inter> (\<Union>x. A x))"
14.554 - by (auto simp: M.measure_countably_additive[symmetric]
14.555 - N.measure_countably_additive[symmetric]
14.556 - simp del: UN_simps)
14.557 - qed
14.558 - have *: "sets (sigma E) = sets \<lparr>space = space E, sets = ?D F\<rparr>"
14.559 - using `F \<in> sets E` `Int_stable E`
14.560 - by (intro D.dynkin_lemma)
14.561 - (auto simp add: sets_sigma Int_stable_def eq intro: sigma_sets.Basic)
14.562 - have "\<And>D. D \<in> sets (sigma E) \<Longrightarrow> \<mu> (F \<inter> D) = \<nu> (F \<inter> D)"
14.563 - by (subst (asm) *) auto }
14.564 - note * = this
14.565 - let ?A = "\<lambda>i. A i \<inter> X"
14.566 - have A': "range ?A \<subseteq> sets (sigma E)" "incseq ?A"
14.567 - using A(1,2) `X \<in> sets (sigma E)` by (auto simp: incseq_def)
14.568 - { fix i have "\<mu> (?A i) = \<nu> (?A i)"
14.569 - using *[of "A i" X] `X \<in> sets (sigma E)` A finite by auto }
14.570 - with M.continuity_from_below[OF A'] N.continuity_from_below[OF A']
14.571 - show ?thesis using A(3) `X \<in> sets (sigma E)` by auto
14.572 -qed
14.573 -
14.574 -section "@{text \<mu>}-null sets"
14.575 -
14.576 -abbreviation (in measure_space) "null_sets \<equiv> {N\<in>sets M. \<mu> N = 0}"
14.577 -
14.578 -sublocale measure_space \<subseteq> nullsets!: ring_of_sets "\<lparr> space = space M, sets = null_sets \<rparr>"
14.579 - where "space \<lparr> space = space M, sets = null_sets \<rparr> = space M"
14.580 - and "sets \<lparr> space = space M, sets = null_sets \<rparr> = null_sets"
14.581 -proof -
14.582 - { fix A B assume sets: "A \<in> sets M" "B \<in> sets M"
14.583 - moreover then have "\<mu> (A \<union> B) \<le> \<mu> A + \<mu> B" "\<mu> (A - B) \<le> \<mu> A"
14.584 - by (auto intro!: measure_subadditive measure_mono)
14.585 - moreover assume "\<mu> B = 0" "\<mu> A = 0"
14.586 - ultimately have "\<mu> (A - B) = 0" "\<mu> (A \<union> B) = 0"
14.587 - by (auto intro!: antisym) }
14.588 - note null = this
14.589 - show "ring_of_sets \<lparr> space = space M, sets = null_sets \<rparr>"
14.590 - by default (insert sets_into_space null, auto)
14.591 -qed simp_all
14.592 -
14.593 -lemma UN_from_nat: "(\<Union>i. N i) = (\<Union>i. N (Countable.from_nat i))"
14.594 -proof -
14.595 - have "(\<Union>i. N i) = (\<Union>i. (N \<circ> Countable.from_nat) i)"
14.596 - unfolding SUP_def image_compose
14.597 - unfolding surj_from_nat ..
14.598 - then show ?thesis by simp
14.599 -qed
14.600 -
14.601 -lemma (in measure_space) null_sets_UN[intro]:
14.602 - assumes "\<And>i::'i::countable. N i \<in> null_sets"
14.603 - shows "(\<Union>i. N i) \<in> null_sets"
14.604 -proof (intro conjI CollectI)
14.605 - show "(\<Union>i. N i) \<in> sets M" using assms by auto
14.606 - then have "0 \<le> \<mu> (\<Union>i. N i)" by simp
14.607 - moreover have "\<mu> (\<Union>i. N i) \<le> (\<Sum>n. \<mu> (N (Countable.from_nat n)))"
14.608 - unfolding UN_from_nat[of N]
14.609 - using assms by (intro measure_countably_subadditive) auto
14.610 - ultimately show "\<mu> (\<Union>i. N i) = 0" using assms by auto
14.611 -qed
14.612 -
14.613 -lemma (in measure_space) null_set_Int1:
14.614 - assumes "B \<in> null_sets" "A \<in> sets M" shows "A \<inter> B \<in> null_sets"
14.615 -using assms proof (intro CollectI conjI)
14.616 - show "\<mu> (A \<inter> B) = 0" using assms by (intro measure_eq_0[of B "A \<inter> B"]) auto
14.617 -qed auto
14.618 -
14.619 -lemma (in measure_space) null_set_Int2:
14.620 - assumes "B \<in> null_sets" "A \<in> sets M" shows "B \<inter> A \<in> null_sets"
14.621 - using assms by (subst Int_commute) (rule null_set_Int1)
14.622 -
14.623 -lemma (in measure_space) measure_Diff_null_set:
14.624 - assumes "B \<in> null_sets" "A \<in> sets M"
14.625 - shows "\<mu> (A - B) = \<mu> A"
14.626 -proof -
14.627 - have *: "A - B = (A - (A \<inter> B))" by auto
14.628 - have "A \<inter> B \<in> null_sets" using assms by (rule null_set_Int1)
14.629 - then show ?thesis
14.630 - unfolding * using assms
14.631 - by (subst measure_Diff) auto
14.632 -qed
14.633 -
14.634 -lemma (in measure_space) null_set_Diff:
14.635 - assumes "B \<in> null_sets" "A \<in> sets M" shows "B - A \<in> null_sets"
14.636 -using assms proof (intro CollectI conjI)
14.637 - show "\<mu> (B - A) = 0" using assms by (intro measure_eq_0[of B "B - A"]) auto
14.638 -qed auto
14.639 -
14.640 -lemma (in measure_space) measure_Un_null_set:
14.641 - assumes "A \<in> sets M" "B \<in> null_sets"
14.642 - shows "\<mu> (A \<union> B) = \<mu> A"
14.643 -proof -
14.644 - have *: "A \<union> B = A \<union> (B - A)" by auto
14.645 - have "B - A \<in> null_sets" using assms(2,1) by (rule null_set_Diff)
14.646 - then show ?thesis
14.647 - unfolding * using assms
14.648 - by (subst measure_additive[symmetric]) auto
14.649 -qed
14.650 -
14.651 -section "Formalise almost everywhere"
14.652 -
14.653 -definition (in measure_space)
14.654 - almost_everywhere :: "('a \<Rightarrow> bool) \<Rightarrow> bool" (binder "AE " 10) where
14.655 - "almost_everywhere P \<longleftrightarrow> (\<exists>N\<in>null_sets. { x \<in> space M. \<not> P x } \<subseteq> N)"
14.656 -
14.657 -syntax
14.658 - "_almost_everywhere" :: "pttrn \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> bool \<Rightarrow> bool" ("AE _ in _. _" [0,0,10] 10)
14.659 -
14.660 -translations
14.661 - "AE x in M. P" == "CONST measure_space.almost_everywhere M (%x. P)"
14.662 -
14.663 -lemma (in measure_space) AE_cong_measure:
14.664 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M"
14.665 - shows "(AE x in N. P x) \<longleftrightarrow> (AE x. P x)"
14.666 -proof -
14.667 - interpret N: measure_space N
14.668 - by (rule measure_space_cong) fact+
14.669 - show ?thesis
14.670 - unfolding N.almost_everywhere_def almost_everywhere_def
14.671 - by (auto simp: assms)
14.672 -qed
14.673 -
14.674 -lemma (in measure_space) AE_I':
14.675 - "N \<in> null_sets \<Longrightarrow> {x\<in>space M. \<not> P x} \<subseteq> N \<Longrightarrow> (AE x. P x)"
14.676 - unfolding almost_everywhere_def by auto
14.677 -
14.678 -lemma (in measure_space) AE_iff_null_set:
14.679 - assumes "{x\<in>space M. \<not> P x} \<in> sets M" (is "?P \<in> sets M")
14.680 - shows "(AE x. P x) \<longleftrightarrow> {x\<in>space M. \<not> P x} \<in> null_sets"
14.681 -proof
14.682 - assume "AE x. P x" then obtain N where N: "N \<in> sets M" "?P \<subseteq> N" "\<mu> N = 0"
14.683 - unfolding almost_everywhere_def by auto
14.684 - have "0 \<le> \<mu> ?P" using assms by simp
14.685 - moreover have "\<mu> ?P \<le> \<mu> N"
14.686 - using assms N(1,2) by (auto intro: measure_mono)
14.687 - ultimately have "\<mu> ?P = 0" unfolding `\<mu> N = 0` by auto
14.688 - then show "?P \<in> null_sets" using assms by simp
14.689 -next
14.690 - assume "?P \<in> null_sets" with assms show "AE x. P x" by (auto intro: AE_I')
14.691 -qed
14.692 -
14.693 -lemma (in measure_space) AE_iff_measurable:
14.694 - "N \<in> sets M \<Longrightarrow> {x\<in>space M. \<not> P x} = N \<Longrightarrow> (AE x. P x) \<longleftrightarrow> \<mu> N = 0"
14.695 - using AE_iff_null_set[of P] by simp
14.696 -
14.697 -lemma (in measure_space) AE_True[intro, simp]: "AE x. True"
14.698 - unfolding almost_everywhere_def by auto
14.699 -
14.700 -lemma (in measure_space) AE_E[consumes 1]:
14.701 - assumes "AE x. P x"
14.702 - obtains N where "{x \<in> space M. \<not> P x} \<subseteq> N" "\<mu> N = 0" "N \<in> sets M"
14.703 - using assms unfolding almost_everywhere_def by auto
14.704 -
14.705 -lemma (in measure_space) AE_E2:
14.706 - assumes "AE x. P x" "{x\<in>space M. P x} \<in> sets M"
14.707 - shows "\<mu> {x\<in>space M. \<not> P x} = 0" (is "\<mu> ?P = 0")
14.708 -proof -
14.709 - have "{x\<in>space M. \<not> P x} = space M - {x\<in>space M. P x}"
14.710 - by auto
14.711 - with AE_iff_null_set[of P] assms show ?thesis by auto
14.712 -qed
14.713 -
14.714 -lemma (in measure_space) AE_I:
14.715 - assumes "{x \<in> space M. \<not> P x} \<subseteq> N" "\<mu> N = 0" "N \<in> sets M"
14.716 - shows "AE x. P x"
14.717 - using assms unfolding almost_everywhere_def by auto
14.718 -
14.719 -lemma (in measure_space) AE_mp[elim!]:
14.720 - assumes AE_P: "AE x. P x" and AE_imp: "AE x. P x \<longrightarrow> Q x"
14.721 - shows "AE x. Q x"
14.722 -proof -
14.723 - from AE_P obtain A where P: "{x\<in>space M. \<not> P x} \<subseteq> A"
14.724 - and A: "A \<in> sets M" "\<mu> A = 0"
14.725 - by (auto elim!: AE_E)
14.726 -
14.727 - from AE_imp obtain B where imp: "{x\<in>space M. P x \<and> \<not> Q x} \<subseteq> B"
14.728 - and B: "B \<in> sets M" "\<mu> B = 0"
14.729 - by (auto elim!: AE_E)
14.730 -
14.731 - show ?thesis
14.732 - proof (intro AE_I)
14.733 - have "0 \<le> \<mu> (A \<union> B)" using A B by auto
14.734 - moreover have "\<mu> (A \<union> B) \<le> 0"
14.735 - using measure_subadditive[of A B] A B by auto
14.736 - ultimately show "A \<union> B \<in> sets M" "\<mu> (A \<union> B) = 0" using A B by auto
14.737 - show "{x\<in>space M. \<not> Q x} \<subseteq> A \<union> B"
14.738 - using P imp by auto
14.739 - qed
14.740 -qed
14.741 -
14.742 -lemma (in measure_space)
14.743 - shows AE_iffI: "AE x. P x \<Longrightarrow> AE x. P x \<longleftrightarrow> Q x \<Longrightarrow> AE x. Q x"
14.744 - and AE_disjI1: "AE x. P x \<Longrightarrow> AE x. P x \<or> Q x"
14.745 - and AE_disjI2: "AE x. Q x \<Longrightarrow> AE x. P x \<or> Q x"
14.746 - and AE_conjI: "AE x. P x \<Longrightarrow> AE x. Q x \<Longrightarrow> AE x. P x \<and> Q x"
14.747 - and AE_conj_iff[simp]: "(AE x. P x \<and> Q x) \<longleftrightarrow> (AE x. P x) \<and> (AE x. Q x)"
14.748 - by auto
14.749 -
14.750 -lemma (in measure_space) AE_measure:
14.751 - assumes AE: "AE x. P x" and sets: "{x\<in>space M. P x} \<in> sets M"
14.752 - shows "\<mu> {x\<in>space M. P x} = \<mu> (space M)"
14.753 -proof -
14.754 - from AE_E[OF AE] guess N . note N = this
14.755 - with sets have "\<mu> (space M) \<le> \<mu> ({x\<in>space M. P x} \<union> N)"
14.756 - by (intro measure_mono) auto
14.757 - also have "\<dots> \<le> \<mu> {x\<in>space M. P x} + \<mu> N"
14.758 - using sets N by (intro measure_subadditive) auto
14.759 - also have "\<dots> = \<mu> {x\<in>space M. P x}" using N by simp
14.760 - finally show "\<mu> {x\<in>space M. P x} = \<mu> (space M)"
14.761 - using measure_top[OF sets] by auto
14.762 -qed
14.763 -
14.764 -lemma (in measure_space) AE_space: "AE x. x \<in> space M"
14.765 - by (rule AE_I[where N="{}"]) auto
14.766 -
14.767 -lemma (in measure_space) AE_I2[simp, intro]:
14.768 - "(\<And>x. x \<in> space M \<Longrightarrow> P x) \<Longrightarrow> AE x. P x"
14.769 - using AE_space by auto
14.770 -
14.771 -lemma (in measure_space) AE_Ball_mp:
14.772 - "\<forall>x\<in>space M. P x \<Longrightarrow> AE x. P x \<longrightarrow> Q x \<Longrightarrow> AE x. Q x"
14.773 - by auto
14.774 -
14.775 -lemma (in measure_space) AE_cong[cong]:
14.776 - "(\<And>x. x \<in> space M \<Longrightarrow> P x \<longleftrightarrow> Q x) \<Longrightarrow> (AE x. P x) \<longleftrightarrow> (AE x. Q x)"
14.777 - by auto
14.778 -
14.779 -lemma (in measure_space) AE_all_countable:
14.780 - "(AE x. \<forall>i. P i x) \<longleftrightarrow> (\<forall>i::'i::countable. AE x. P i x)"
14.781 -proof
14.782 - assume "\<forall>i. AE x. P i x"
14.783 - from this[unfolded almost_everywhere_def Bex_def, THEN choice]
14.784 - obtain N where N: "\<And>i. N i \<in> null_sets" "\<And>i. {x\<in>space M. \<not> P i x} \<subseteq> N i" by auto
14.785 - have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. {x\<in>space M. \<not> P i x})" by auto
14.786 - also have "\<dots> \<subseteq> (\<Union>i. N i)" using N by auto
14.787 - finally have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. N i)" .
14.788 - moreover from N have "(\<Union>i. N i) \<in> null_sets"
14.789 - by (intro null_sets_UN) auto
14.790 - ultimately show "AE x. \<forall>i. P i x"
14.791 - unfolding almost_everywhere_def by auto
14.792 -qed auto
14.793 -
14.794 -lemma (in measure_space) AE_finite_all:
14.795 - assumes f: "finite S" shows "(AE x. \<forall>i\<in>S. P i x) \<longleftrightarrow> (\<forall>i\<in>S. AE x. P i x)"
14.796 - using f by induct auto
14.797 -
14.798 -lemma (in measure_space) restricted_measure_space:
14.799 - assumes "S \<in> sets M"
14.800 - shows "measure_space (restricted_space S)"
14.801 - (is "measure_space ?r")
14.802 - unfolding measure_space_def measure_space_axioms_def
14.803 -proof safe
14.804 - show "sigma_algebra ?r" using restricted_sigma_algebra[OF assms] .
14.805 - show "positive ?r (measure ?r)" using `S \<in> sets M` by (auto simp: positive_def)
14.806 -
14.807 - show "countably_additive ?r (measure ?r)"
14.808 - unfolding countably_additive_def
14.809 - proof safe
14.810 - fix A :: "nat \<Rightarrow> 'a set"
14.811 - assume *: "range A \<subseteq> sets ?r" and **: "disjoint_family A"
14.812 - from restriction_in_sets[OF assms *[simplified]] **
14.813 - show "(\<Sum>n. measure ?r (A n)) = measure ?r (\<Union>i. A i)"
14.814 - using measure_countably_additive by simp
14.815 - qed
14.816 -qed
14.817 -
14.818 -lemma (in measure_space) AE_restricted:
14.819 - assumes "A \<in> sets M"
14.820 - shows "(AE x in restricted_space A. P x) \<longleftrightarrow> (AE x. x \<in> A \<longrightarrow> P x)"
14.821 -proof -
14.822 - interpret R: measure_space "restricted_space A"
14.823 - by (rule restricted_measure_space[OF `A \<in> sets M`])
14.824 - show ?thesis
14.825 - proof
14.826 - assume "AE x in restricted_space A. P x"
14.827 - from this[THEN R.AE_E] guess N' .
14.828 - then obtain N where "{x \<in> A. \<not> P x} \<subseteq> A \<inter> N" "\<mu> (A \<inter> N) = 0" "N \<in> sets M"
14.829 - by auto
14.830 - moreover then have "{x \<in> space M. \<not> (x \<in> A \<longrightarrow> P x)} \<subseteq> A \<inter> N"
14.831 - using `A \<in> sets M` sets_into_space by auto
14.832 - ultimately show "AE x. x \<in> A \<longrightarrow> P x"
14.833 - using `A \<in> sets M` by (auto intro!: AE_I[where N="A \<inter> N"])
14.834 - next
14.835 - assume "AE x. x \<in> A \<longrightarrow> P x"
14.836 - from this[THEN AE_E] guess N .
14.837 - then show "AE x in restricted_space A. P x"
14.838 - using null_set_Int1[OF _ `A \<in> sets M`] `A \<in> sets M`[THEN sets_into_space]
14.839 - by (auto intro!: R.AE_I[where N="A \<inter> N"] simp: subset_eq)
14.840 - qed
14.841 -qed
14.842 -
14.843 -lemma (in measure_space) measure_space_subalgebra:
14.844 - assumes "sigma_algebra N" and "sets N \<subseteq> sets M" "space N = space M"
14.845 - and measure[simp]: "\<And>X. X \<in> sets N \<Longrightarrow> measure N X = measure M X"
14.846 - shows "measure_space N"
14.847 -proof -
14.848 - interpret N: sigma_algebra N by fact
14.849 - show ?thesis
14.850 - proof
14.851 - from `sets N \<subseteq> sets M` have "\<And>A. range A \<subseteq> sets N \<Longrightarrow> range A \<subseteq> sets M" by blast
14.852 - then show "countably_additive N (measure N)"
14.853 - by (auto intro!: measure_countably_additive simp: countably_additive_def subset_eq)
14.854 - show "positive N (measure_space.measure N)"
14.855 - using assms(2) by (auto simp add: positive_def)
14.856 - qed
14.857 -qed
14.858 -
14.859 -lemma (in measure_space) AE_subalgebra:
14.860 - assumes ae: "AE x in N. P x"
14.861 - and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> measure N A = \<mu> A"
14.862 - and sa: "sigma_algebra N"
14.863 - shows "AE x. P x"
14.864 -proof -
14.865 - interpret N: measure_space N using measure_space_subalgebra[OF sa N] .
14.866 - from ae[THEN N.AE_E] guess N .
14.867 - with N show ?thesis unfolding almost_everywhere_def by auto
14.868 -qed
14.869 -
14.870 -section "@{text \<sigma>}-finite Measures"
14.871 -
14.872 -locale sigma_finite_measure = measure_space +
14.873 - assumes sigma_finite: "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<infinity>)"
14.874 -
14.875 -lemma (in sigma_finite_measure) restricted_sigma_finite_measure:
14.876 - assumes "S \<in> sets M"
14.877 - shows "sigma_finite_measure (restricted_space S)"
14.878 - (is "sigma_finite_measure ?r")
14.879 - unfolding sigma_finite_measure_def sigma_finite_measure_axioms_def
14.880 -proof safe
14.881 - show "measure_space ?r" using restricted_measure_space[OF assms] .
14.882 -next
14.883 - obtain A :: "nat \<Rightarrow> 'a set" where
14.884 - "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. \<mu> (A i) \<noteq> \<infinity>"
14.885 - using sigma_finite by auto
14.886 - show "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets ?r \<and> (\<Union>i. A i) = space ?r \<and> (\<forall>i. measure ?r (A i) \<noteq> \<infinity>)"
14.887 - proof (safe intro!: exI[of _ "\<lambda>i. A i \<inter> S"] del: notI)
14.888 - fix i
14.889 - show "A i \<inter> S \<in> sets ?r"
14.890 - using `range A \<subseteq> sets M` `S \<in> sets M` by auto
14.891 - next
14.892 - fix x i assume "x \<in> S" thus "x \<in> space ?r" by simp
14.893 - next
14.894 - fix x assume "x \<in> space ?r" thus "x \<in> (\<Union>i. A i \<inter> S)"
14.895 - using `(\<Union>i. A i) = space M` `S \<in> sets M` by auto
14.896 - next
14.897 - fix i
14.898 - have "\<mu> (A i \<inter> S) \<le> \<mu> (A i)"
14.899 - using `range A \<subseteq> sets M` `S \<in> sets M` by (auto intro!: measure_mono)
14.900 - then show "measure ?r (A i \<inter> S) \<noteq> \<infinity>" using `\<mu> (A i) \<noteq> \<infinity>` by auto
14.901 - qed
14.902 -qed
14.903 -
14.904 -lemma (in sigma_finite_measure) sigma_finite_measure_cong:
14.905 - assumes cong: "\<And>A. A \<in> sets M \<Longrightarrow> measure M' A = \<mu> A" "sets M' = sets M" "space M' = space M"
14.906 - shows "sigma_finite_measure M'"
14.907 -proof -
14.908 - interpret M': measure_space M' by (intro measure_space_cong cong)
14.909 - from sigma_finite guess A .. note A = this
14.910 - then have "\<And>i. A i \<in> sets M" by auto
14.911 - with A have fin: "\<forall>i. measure M' (A i) \<noteq> \<infinity>" using cong by auto
14.912 - show ?thesis
14.913 - apply default
14.914 - using A fin cong by auto
14.915 -qed
14.916 -
14.917 -lemma (in sigma_finite_measure) disjoint_sigma_finite:
14.918 - "\<exists>A::nat\<Rightarrow>'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and>
14.919 - (\<forall>i. \<mu> (A i) \<noteq> \<infinity>) \<and> disjoint_family A"
14.920 -proof -
14.921 - obtain A :: "nat \<Rightarrow> 'a set" where
14.922 - range: "range A \<subseteq> sets M" and
14.923 - space: "(\<Union>i. A i) = space M" and
14.924 - measure: "\<And>i. \<mu> (A i) \<noteq> \<infinity>"
14.925 - using sigma_finite by auto
14.926 - note range' = range_disjointed_sets[OF range] range
14.927 - { fix i
14.928 - have "\<mu> (disjointed A i) \<le> \<mu> (A i)"
14.929 - using range' disjointed_subset[of A i] by (auto intro!: measure_mono)
14.930 - then have "\<mu> (disjointed A i) \<noteq> \<infinity>"
14.931 - using measure[of i] by auto }
14.932 - with disjoint_family_disjointed UN_disjointed_eq[of A] space range'
14.933 - show ?thesis by (auto intro!: exI[of _ "disjointed A"])
14.934 -qed
14.935 -
14.936 -lemma (in sigma_finite_measure) sigma_finite_up:
14.937 - "\<exists>F. range F \<subseteq> sets M \<and> incseq F \<and> (\<Union>i. F i) = space M \<and> (\<forall>i. \<mu> (F i) \<noteq> \<infinity>)"
14.938 -proof -
14.939 - obtain F :: "nat \<Rightarrow> 'a set" where
14.940 - F: "range F \<subseteq> sets M" "(\<Union>i. F i) = space M" "\<And>i. \<mu> (F i) \<noteq> \<infinity>"
14.941 - using sigma_finite by auto
14.942 - then show ?thesis
14.943 - proof (intro exI[of _ "\<lambda>n. \<Union>i\<le>n. F i"] conjI allI)
14.944 - from F have "\<And>x. x \<in> space M \<Longrightarrow> \<exists>i. x \<in> F i" by auto
14.945 - then show "(\<Union>n. \<Union> i\<le>n. F i) = space M"
14.946 - using F by fastforce
14.947 - next
14.948 - fix n
14.949 - have "\<mu> (\<Union> i\<le>n. F i) \<le> (\<Sum>i\<le>n. \<mu> (F i))" using F
14.950 - by (auto intro!: measure_finitely_subadditive)
14.951 - also have "\<dots> < \<infinity>"
14.952 - using F by (auto simp: setsum_Pinfty)
14.953 - finally show "\<mu> (\<Union> i\<le>n. F i) \<noteq> \<infinity>" by simp
14.954 - qed (force simp: incseq_def)+
14.955 -qed
14.956 -
14.957 -section {* Measure preserving *}
14.958 -
14.959 -definition "measure_preserving A B =
14.960 - {f \<in> measurable A B. (\<forall>y \<in> sets B. measure B y = measure A (f -` y \<inter> space A))}"
14.961 -
14.962 -lemma measure_preservingI[intro?]:
14.963 - assumes "f \<in> measurable A B"
14.964 - and "\<And>y. y \<in> sets B \<Longrightarrow> measure A (f -` y \<inter> space A) = measure B y"
14.965 - shows "f \<in> measure_preserving A B"
14.966 - unfolding measure_preserving_def using assms by auto
14.967 -
14.968 -lemma (in measure_space) measure_space_vimage:
14.969 - fixes M' :: "('c, 'd) measure_space_scheme"
14.970 - assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'"
14.971 - shows "measure_space M'"
14.972 -proof -
14.973 - interpret M': sigma_algebra M' by fact
14.974 - show ?thesis
14.975 - proof
14.976 - show "positive M' (measure M')" using T
14.977 - by (auto simp: measure_preserving_def positive_def measurable_sets)
14.978 -
14.979 - show "countably_additive M' (measure M')"
14.980 - proof (intro countably_additiveI)
14.981 - fix A :: "nat \<Rightarrow> 'c set" assume "range A \<subseteq> sets M'" "disjoint_family A"
14.982 - then have A: "\<And>i. A i \<in> sets M'" "(\<Union>i. A i) \<in> sets M'" by auto
14.983 - then have *: "range (\<lambda>i. T -` (A i) \<inter> space M) \<subseteq> sets M"
14.984 - using T by (auto simp: measurable_def measure_preserving_def)
14.985 - moreover have "(\<Union>i. T -` A i \<inter> space M) \<in> sets M"
14.986 - using * by blast
14.987 - moreover have **: "disjoint_family (\<lambda>i. T -` A i \<inter> space M)"
14.988 - using `disjoint_family A` by (auto simp: disjoint_family_on_def)
14.989 - ultimately show "(\<Sum>i. measure M' (A i)) = measure M' (\<Union>i. A i)"
14.990 - using measure_countably_additive[OF _ **] A T
14.991 - by (auto simp: comp_def vimage_UN measure_preserving_def)
14.992 - qed
14.993 - qed
14.994 -qed
14.995 -
14.996 -lemma (in measure_space) almost_everywhere_vimage:
14.997 - assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'"
14.998 - and AE: "measure_space.almost_everywhere M' P"
14.999 - shows "AE x. P (T x)"
14.1000 -proof -
14.1001 - interpret M': measure_space M' using T by (rule measure_space_vimage)
14.1002 - from AE[THEN M'.AE_E] guess N .
14.1003 - then show ?thesis
14.1004 - unfolding almost_everywhere_def M'.almost_everywhere_def
14.1005 - using T(2) unfolding measurable_def measure_preserving_def
14.1006 - by (intro bexI[of _ "T -` N \<inter> space M"]) auto
14.1007 -qed
14.1008 -
14.1009 -lemma measure_unique_Int_stable_vimage:
14.1010 - fixes A :: "nat \<Rightarrow> 'a set"
14.1011 - assumes E: "Int_stable E"
14.1012 - and A: "range A \<subseteq> sets E" "incseq A" "(\<Union>i. A i) = space E" "\<And>i. measure M (A i) \<noteq> \<infinity>"
14.1013 - and N: "measure_space N" "T \<in> measurable N M"
14.1014 - and M: "measure_space M" "sets (sigma E) = sets M" "space E = space M"
14.1015 - and eq: "\<And>X. X \<in> sets E \<Longrightarrow> measure M X = measure N (T -` X \<inter> space N)"
14.1016 - assumes X: "X \<in> sets (sigma E)"
14.1017 - shows "measure M X = measure N (T -` X \<inter> space N)"
14.1018 -proof (rule measure_unique_Int_stable[OF E A(1,2,3) _ _ eq _ X])
14.1019 - interpret M: measure_space M by fact
14.1020 - interpret N: measure_space N by fact
14.1021 - let ?T = "\<lambda>X. T -` X \<inter> space N"
14.1022 - show "measure_space \<lparr>space = space E, sets = sets (sigma E), measure = measure M\<rparr>"
14.1023 - by (rule M.measure_space_cong) (auto simp: M)
14.1024 - show "measure_space \<lparr>space = space E, sets = sets (sigma E), measure = \<lambda>X. measure N (?T X)\<rparr>" (is "measure_space ?E")
14.1025 - proof (rule N.measure_space_vimage)
14.1026 - show "sigma_algebra ?E"
14.1027 - by (rule M.sigma_algebra_cong) (auto simp: M)
14.1028 - show "T \<in> measure_preserving N ?E"
14.1029 - using `T \<in> measurable N M` by (auto simp: M measurable_def measure_preserving_def)
14.1030 - qed
14.1031 - show "\<And>i. M.\<mu> (A i) \<noteq> \<infinity>" by fact
14.1032 -qed
14.1033 -
14.1034 -lemma (in measure_space) measure_preserving_Int_stable:
14.1035 - fixes A :: "nat \<Rightarrow> 'a set"
14.1036 - assumes E: "Int_stable E" "range A \<subseteq> sets E" "incseq A" "(\<Union>i. A i) = space E" "\<And>i. measure E (A i) \<noteq> \<infinity>"
14.1037 - and N: "measure_space (sigma E)"
14.1038 - and T: "T \<in> measure_preserving M E"
14.1039 - shows "T \<in> measure_preserving M (sigma E)"
14.1040 -proof
14.1041 - interpret E: measure_space "sigma E" by fact
14.1042 - show "T \<in> measurable M (sigma E)"
14.1043 - using T E.sets_into_space
14.1044 - by (intro measurable_sigma) (auto simp: measure_preserving_def measurable_def)
14.1045 - fix X assume "X \<in> sets (sigma E)"
14.1046 - show "\<mu> (T -` X \<inter> space M) = E.\<mu> X"
14.1047 - proof (rule measure_unique_Int_stable_vimage[symmetric])
14.1048 - show "sets (sigma E) = sets (sigma E)" "space E = space (sigma E)"
14.1049 - "\<And>i. E.\<mu> (A i) \<noteq> \<infinity>" using E by auto
14.1050 - show "measure_space M" by default
14.1051 - next
14.1052 - fix X assume "X \<in> sets E" then show "E.\<mu> X = \<mu> (T -` X \<inter> space M)"
14.1053 - using T unfolding measure_preserving_def by auto
14.1054 - qed fact+
14.1055 -qed
14.1056 -
14.1057 -section "Real measure values"
14.1058 -
14.1059 -lemma (in measure_space) real_measure_Union:
14.1060 - assumes finite: "\<mu> A \<noteq> \<infinity>" "\<mu> B \<noteq> \<infinity>"
14.1061 - and measurable: "A \<in> sets M" "B \<in> sets M" "A \<inter> B = {}"
14.1062 - shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)"
14.1063 - unfolding measure_additive[symmetric, OF measurable]
14.1064 - using measurable(1,2)[THEN positive_measure]
14.1065 - using finite by (cases rule: ereal2_cases[of "\<mu> A" "\<mu> B"]) auto
14.1066 -
14.1067 -lemma (in measure_space) real_measure_finite_Union:
14.1068 - assumes measurable:
14.1069 - "finite S" "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M" "disjoint_family_on A S"
14.1070 - assumes finite: "\<And>i. i \<in> S \<Longrightarrow> \<mu> (A i) \<noteq> \<infinity>"
14.1071 - shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))"
14.1072 - using finite measurable(2)[THEN positive_measure]
14.1073 - by (force intro!: setsum_real_of_ereal[symmetric]
14.1074 - simp: measure_setsum[OF measurable, symmetric])
14.1075 -
14.1076 -lemma (in measure_space) real_measure_Diff:
14.1077 - assumes finite: "\<mu> A \<noteq> \<infinity>"
14.1078 - and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
14.1079 - shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)"
14.1080 -proof -
14.1081 - have "\<mu> (A - B) \<le> \<mu> A" "\<mu> B \<le> \<mu> A"
14.1082 - using measurable by (auto intro!: measure_mono)
14.1083 - hence "real (\<mu> ((A - B) \<union> B)) = real (\<mu> (A - B)) + real (\<mu> B)"
14.1084 - using measurable finite by (rule_tac real_measure_Union) auto
14.1085 - thus ?thesis using `B \<subseteq> A` by (auto simp: Un_absorb2)
14.1086 -qed
14.1087 -
14.1088 -lemma (in measure_space) real_measure_UNION:
14.1089 - assumes measurable: "range A \<subseteq> sets M" "disjoint_family A"
14.1090 - assumes finite: "\<mu> (\<Union>i. A i) \<noteq> \<infinity>"
14.1091 - shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))"
14.1092 -proof -
14.1093 - have "\<And>i. 0 \<le> \<mu> (A i)" using measurable by auto
14.1094 - with summable_sums[OF summable_ereal_pos, of "\<lambda>i. \<mu> (A i)"]
14.1095 - measure_countably_additive[OF measurable]
14.1096 - have "(\<lambda>i. \<mu> (A i)) sums (\<mu> (\<Union>i. A i))" by simp
14.1097 - moreover
14.1098 - { fix i
14.1099 - have "\<mu> (A i) \<le> \<mu> (\<Union>i. A i)"
14.1100 - using measurable by (auto intro!: measure_mono)
14.1101 - moreover have "0 \<le> \<mu> (A i)" using measurable by auto
14.1102 - ultimately have "\<mu> (A i) = ereal (real (\<mu> (A i)))"
14.1103 - using finite by (cases "\<mu> (A i)") auto }
14.1104 - moreover
14.1105 - have "0 \<le> \<mu> (\<Union>i. A i)" using measurable by auto
14.1106 - then have "\<mu> (\<Union>i. A i) = ereal (real (\<mu> (\<Union>i. A i)))"
14.1107 - using finite by (cases "\<mu> (\<Union>i. A i)") auto
14.1108 - ultimately show ?thesis
14.1109 - unfolding sums_ereal[symmetric] by simp
14.1110 -qed
14.1111 -
14.1112 -lemma (in measure_space) real_measure_subadditive:
14.1113 - assumes measurable: "A \<in> sets M" "B \<in> sets M"
14.1114 - and fin: "\<mu> A \<noteq> \<infinity>" "\<mu> B \<noteq> \<infinity>"
14.1115 - shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)"
14.1116 -proof -
14.1117 - have "0 \<le> \<mu> (A \<union> B)" using measurable by auto
14.1118 - then show "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)"
14.1119 - using measure_subadditive[OF measurable] fin
14.1120 - by (cases rule: ereal3_cases[of "\<mu> (A \<union> B)" "\<mu> A" "\<mu> B"]) auto
14.1121 -qed
14.1122 -
14.1123 -lemma (in measure_space) real_measure_setsum_singleton:
14.1124 - assumes S: "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
14.1125 - and fin: "\<And>x. x \<in> S \<Longrightarrow> \<mu> {x} \<noteq> \<infinity>"
14.1126 - shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))"
14.1127 - using measure_finite_singleton[OF S] fin
14.1128 - using positive_measure[OF S(2)]
14.1129 - by (force intro!: setsum_real_of_ereal[symmetric])
14.1130 -
14.1131 -lemma (in measure_space) real_continuity_from_below:
14.1132 - assumes A: "range A \<subseteq> sets M" "incseq A" and fin: "\<mu> (\<Union>i. A i) \<noteq> \<infinity>"
14.1133 - shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))"
14.1134 -proof -
14.1135 - have "0 \<le> \<mu> (\<Union>i. A i)" using A by auto
14.1136 - then have "ereal (real (\<mu> (\<Union>i. A i))) = \<mu> (\<Union>i. A i)"
14.1137 - using fin by (auto intro: ereal_real')
14.1138 - then show ?thesis
14.1139 - using continuity_from_below_Lim[OF A]
14.1140 - by (intro lim_real_of_ereal) simp
14.1141 -qed
14.1142 -
14.1143 -lemma (in measure_space) continuity_from_above_Lim:
14.1144 - assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. \<mu> (A i) \<noteq> \<infinity>"
14.1145 - shows "(\<lambda>i. (\<mu> (A i))) ----> \<mu> (\<Inter>i. A i)"
14.1146 - using LIMSEQ_ereal_INFI[OF measure_decseq, OF A]
14.1147 - using continuity_from_above[OF A fin] by simp
14.1148 -
14.1149 -lemma (in measure_space) real_continuity_from_above:
14.1150 - assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. \<mu> (A i) \<noteq> \<infinity>"
14.1151 - shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))"
14.1152 -proof -
14.1153 - have "0 \<le> \<mu> (\<Inter>i. A i)" using A by auto
14.1154 - moreover
14.1155 - have "\<mu> (\<Inter>i. A i) \<le> \<mu> (A 0)"
14.1156 - using A by (auto intro!: measure_mono)
14.1157 - ultimately have "ereal (real (\<mu> (\<Inter>i. A i))) = \<mu> (\<Inter>i. A i)"
14.1158 - using fin by (auto intro: ereal_real')
14.1159 - then show ?thesis
14.1160 - using continuity_from_above_Lim[OF A fin]
14.1161 - by (intro lim_real_of_ereal) simp
14.1162 -qed
14.1163 -
14.1164 -lemma (in measure_space) real_measure_countably_subadditive:
14.1165 - assumes A: "range A \<subseteq> sets M" and fin: "(\<Sum>i. \<mu> (A i)) \<noteq> \<infinity>"
14.1166 - shows "real (\<mu> (\<Union>i. A i)) \<le> (\<Sum>i. real (\<mu> (A i)))"
14.1167 -proof -
14.1168 - { fix i
14.1169 - have "0 \<le> \<mu> (A i)" using A by auto
14.1170 - moreover have "\<mu> (A i) \<noteq> \<infinity>" using A by (intro suminf_PInfty[OF _ fin]) auto
14.1171 - ultimately have "\<bar>\<mu> (A i)\<bar> \<noteq> \<infinity>" by auto }
14.1172 - moreover have "0 \<le> \<mu> (\<Union>i. A i)" using A by auto
14.1173 - ultimately have "ereal (real (\<mu> (\<Union>i. A i))) \<le> (\<Sum>i. ereal (real (\<mu> (A i))))"
14.1174 - using measure_countably_subadditive[OF A] by (auto simp: ereal_real)
14.1175 - also have "\<dots> = ereal (\<Sum>i. real (\<mu> (A i)))"
14.1176 - using A
14.1177 - by (auto intro!: sums_unique[symmetric] sums_ereal[THEN iffD2] summable_sums summable_real_of_ereal fin)
14.1178 - finally show ?thesis by simp
14.1179 -qed
14.1180 -
14.1181 -locale finite_measure = sigma_finite_measure +
14.1182 - assumes finite_measure_of_space: "\<mu> (space M) \<noteq> \<infinity>"
14.1183 -
14.1184 -lemma finite_measureI[Pure.intro!]:
14.1185 - assumes "measure_space M"
14.1186 - assumes *: "measure M (space M) \<noteq> \<infinity>"
14.1187 - shows "finite_measure M"
14.1188 -proof -
14.1189 - interpret measure_space M by fact
14.1190 - show "finite_measure M"
14.1191 - proof
14.1192 - show "measure M (space M) \<noteq> \<infinity>" by fact
14.1193 - show "\<exists>A. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<infinity>)"
14.1194 - using * by (auto intro!: exI[of _ "\<lambda>x. space M"])
14.1195 - qed
14.1196 -qed
14.1197 -
14.1198 -lemma (in finite_measure) finite_measure[simp, intro]:
14.1199 - assumes "A \<in> sets M"
14.1200 - shows "\<mu> A \<noteq> \<infinity>"
14.1201 -proof -
14.1202 - from `A \<in> sets M` have "A \<subseteq> space M"
14.1203 - using sets_into_space by blast
14.1204 - then have "\<mu> A \<le> \<mu> (space M)"
14.1205 - using assms top by (rule measure_mono)
14.1206 - then show ?thesis
14.1207 - using finite_measure_of_space by auto
14.1208 -qed
14.1209 -
14.1210 -definition (in finite_measure)
14.1211 - "\<mu>' A = (if A \<in> sets M then real (\<mu> A) else 0)"
14.1212 -
14.1213 -lemma (in finite_measure) finite_measure_eq: "A \<in> sets M \<Longrightarrow> \<mu> A = ereal (\<mu>' A)"
14.1214 - by (auto simp: \<mu>'_def ereal_real)
14.1215 -
14.1216 -lemma (in finite_measure) positive_measure'[simp, intro]: "0 \<le> \<mu>' A"
14.1217 - unfolding \<mu>'_def by (auto simp: real_of_ereal_pos)
14.1218 -
14.1219 -lemma (in finite_measure) real_measure:
14.1220 - assumes A: "A \<in> sets M" shows "\<exists>r. 0 \<le> r \<and> \<mu> A = ereal r"
14.1221 - using finite_measure[OF A] positive_measure[OF A] by (cases "\<mu> A") auto
14.1222 -
14.1223 -lemma (in finite_measure) bounded_measure: "\<mu>' A \<le> \<mu>' (space M)"
14.1224 -proof cases
14.1225 - assume "A \<in> sets M"
14.1226 - moreover then have "\<mu> A \<le> \<mu> (space M)"
14.1227 - using sets_into_space by (auto intro!: measure_mono)
14.1228 - ultimately show ?thesis
14.1229 - by (auto simp: \<mu>'_def intro!: real_of_ereal_positive_mono)
14.1230 -qed (simp add: \<mu>'_def real_of_ereal_pos)
14.1231 -
14.1232 -lemma (in finite_measure) restricted_finite_measure:
14.1233 - assumes "S \<in> sets M"
14.1234 - shows "finite_measure (restricted_space S)"
14.1235 - (is "finite_measure ?r")
14.1236 -proof
14.1237 - show "measure_space ?r" using restricted_measure_space[OF assms] .
14.1238 - show "measure ?r (space ?r) \<noteq> \<infinity>" using finite_measure[OF `S \<in> sets M`] by auto
14.1239 -qed
14.1240 -
14.1241 -lemma (in measure_space) restricted_to_finite_measure:
14.1242 - assumes "S \<in> sets M" "\<mu> S \<noteq> \<infinity>"
14.1243 - shows "finite_measure (restricted_space S)"
14.1244 -proof
14.1245 - show "measure_space (restricted_space S)"
14.1246 - using `S \<in> sets M` by (rule restricted_measure_space)
14.1247 - show "measure (restricted_space S) (space (restricted_space S)) \<noteq> \<infinity>"
14.1248 - by simp fact
14.1249 -qed
14.1250 -
14.1251 -lemma (in finite_measure) finite_measure_Diff:
14.1252 - assumes sets: "A \<in> sets M" "B \<in> sets M" and "B \<subseteq> A"
14.1253 - shows "\<mu>' (A - B) = \<mu>' A - \<mu>' B"
14.1254 - using sets[THEN finite_measure_eq]
14.1255 - using Diff[OF sets, THEN finite_measure_eq]
14.1256 - using measure_Diff[OF _ assms] by simp
14.1257 -
14.1258 -lemma (in finite_measure) finite_measure_Union:
14.1259 - assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}"
14.1260 - shows "\<mu>' (A \<union> B) = \<mu>' A + \<mu>' B"
14.1261 - using measure_additive[OF assms]
14.1262 - using sets[THEN finite_measure_eq]
14.1263 - using Un[OF sets, THEN finite_measure_eq]
14.1264 - by simp
14.1265 -
14.1266 -lemma (in finite_measure) finite_measure_finite_Union:
14.1267 - assumes S: "finite S" "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M"
14.1268 - and dis: "disjoint_family_on A S"
14.1269 - shows "\<mu>' (\<Union>i\<in>S. A i) = (\<Sum>i\<in>S. \<mu>' (A i))"
14.1270 - using measure_setsum[OF assms]
14.1271 - using finite_UN[of S A, OF S, THEN finite_measure_eq]
14.1272 - using S(2)[THEN finite_measure_eq]
14.1273 - by simp
14.1274 -
14.1275 -lemma (in finite_measure) finite_measure_UNION:
14.1276 - assumes A: "range A \<subseteq> sets M" "disjoint_family A"
14.1277 - shows "(\<lambda>i. \<mu>' (A i)) sums (\<mu>' (\<Union>i. A i))"
14.1278 - using real_measure_UNION[OF A]
14.1279 - using countable_UN[OF A(1), THEN finite_measure_eq]
14.1280 - using A(1)[THEN subsetD, THEN finite_measure_eq]
14.1281 - by auto
14.1282 -
14.1283 -lemma (in finite_measure) finite_measure_mono:
14.1284 - assumes B: "B \<in> sets M" and "A \<subseteq> B" shows "\<mu>' A \<le> \<mu>' B"
14.1285 -proof cases
14.1286 - assume "A \<in> sets M"
14.1287 - from this[THEN finite_measure_eq] B[THEN finite_measure_eq]
14.1288 - show ?thesis using measure_mono[OF `A \<subseteq> B` `A \<in> sets M` `B \<in> sets M`] by simp
14.1289 -next
14.1290 - assume "A \<notin> sets M" then show ?thesis
14.1291 - using positive_measure'[of B] unfolding \<mu>'_def by auto
14.1292 -qed
14.1293 -
14.1294 -lemma (in finite_measure) finite_measure_subadditive:
14.1295 - assumes m: "A \<in> sets M" "B \<in> sets M"
14.1296 - shows "\<mu>' (A \<union> B) \<le> \<mu>' A + \<mu>' B"
14.1297 - using measure_subadditive[OF m]
14.1298 - using m[THEN finite_measure_eq] Un[OF m, THEN finite_measure_eq] by simp
14.1299 -
14.1300 -lemma (in finite_measure) finite_measure_subadditive_finite:
14.1301 - assumes "finite I" "\<And>i. i\<in>I \<Longrightarrow> A i \<in> sets M"
14.1302 - shows "\<mu>' (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. \<mu>' (A i))"
14.1303 - using measure_subadditive_finite[OF assms] assms
14.1304 - by (simp add: finite_measure_eq finite_UN)
14.1305 -
14.1306 -lemma (in finite_measure) finite_measure_countably_subadditive:
14.1307 - assumes A: "range A \<subseteq> sets M" and sum: "summable (\<lambda>i. \<mu>' (A i))"
14.1308 - shows "\<mu>' (\<Union>i. A i) \<le> (\<Sum>i. \<mu>' (A i))"
14.1309 -proof -
14.1310 - note A[THEN subsetD, THEN finite_measure_eq, simp]
14.1311 - note countable_UN[OF A, THEN finite_measure_eq, simp]
14.1312 - from `summable (\<lambda>i. \<mu>' (A i))`
14.1313 - have "(\<lambda>i. ereal (\<mu>' (A i))) sums ereal (\<Sum>i. \<mu>' (A i))"
14.1314 - by (simp add: sums_ereal) (rule summable_sums)
14.1315 - from sums_unique[OF this, symmetric]
14.1316 - measure_countably_subadditive[OF A]
14.1317 - show ?thesis by simp
14.1318 -qed
14.1319 -
14.1320 -lemma (in finite_measure) finite_measure_finite_singleton:
14.1321 - assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
14.1322 - shows "\<mu>' S = (\<Sum>x\<in>S. \<mu>' {x})"
14.1323 - using real_measure_setsum_singleton[OF assms]
14.1324 - using *[THEN finite_measure_eq]
14.1325 - using finite_UN[of S "\<lambda>x. {x}", OF assms, THEN finite_measure_eq]
14.1326 - by simp
14.1327 -
14.1328 -lemma (in finite_measure) finite_continuity_from_below:
14.1329 - assumes A: "range A \<subseteq> sets M" and "incseq A"
14.1330 - shows "(\<lambda>i. \<mu>' (A i)) ----> \<mu>' (\<Union>i. A i)"
14.1331 - using real_continuity_from_below[OF A, OF `incseq A` finite_measure] assms
14.1332 - using A[THEN subsetD, THEN finite_measure_eq]
14.1333 - using countable_UN[OF A, THEN finite_measure_eq]
14.1334 - by auto
14.1335 -
14.1336 -lemma (in finite_measure) finite_continuity_from_above:
14.1337 - assumes A: "range A \<subseteq> sets M" and "decseq A"
14.1338 - shows "(\<lambda>n. \<mu>' (A n)) ----> \<mu>' (\<Inter>i. A i)"
14.1339 - using real_continuity_from_above[OF A, OF `decseq A` finite_measure] assms
14.1340 - using A[THEN subsetD, THEN finite_measure_eq]
14.1341 - using countable_INT[OF A, THEN finite_measure_eq]
14.1342 - by auto
14.1343 -
14.1344 -lemma (in finite_measure) finite_measure_compl:
14.1345 - assumes S: "S \<in> sets M"
14.1346 - shows "\<mu>' (space M - S) = \<mu>' (space M) - \<mu>' S"
14.1347 - using measure_compl[OF S, OF finite_measure, OF S]
14.1348 - using S[THEN finite_measure_eq]
14.1349 - using compl_sets[OF S, THEN finite_measure_eq]
14.1350 - using top[THEN finite_measure_eq]
14.1351 - by simp
14.1352 -
14.1353 -lemma (in finite_measure) finite_measure_inter_full_set:
14.1354 - assumes S: "S \<in> sets M" "T \<in> sets M"
14.1355 - assumes T: "\<mu>' T = \<mu>' (space M)"
14.1356 - shows "\<mu>' (S \<inter> T) = \<mu>' S"
14.1357 - using measure_inter_full_set[OF S finite_measure]
14.1358 - using T Diff[OF S(2,1)] Diff[OF S, THEN finite_measure_eq]
14.1359 - using Int[OF S, THEN finite_measure_eq]
14.1360 - using S[THEN finite_measure_eq] top[THEN finite_measure_eq]
14.1361 - by simp
14.1362 -
14.1363 -lemma (in finite_measure) empty_measure'[simp]: "\<mu>' {} = 0"
14.1364 - unfolding \<mu>'_def by simp
14.1365 -
14.1366 -section "Finite spaces"
14.1367 -
14.1368 -locale finite_measure_space = finite_measure + finite_sigma_algebra
14.1369 -
14.1370 -lemma finite_measure_spaceI[Pure.intro!]:
14.1371 - assumes "finite (space M)"
14.1372 - assumes sets_Pow: "sets M = Pow (space M)"
14.1373 - and space: "measure M (space M) \<noteq> \<infinity>"
14.1374 - and pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> measure M {x}"
14.1375 - and add: "\<And>A. A \<subseteq> space M \<Longrightarrow> measure M A = (\<Sum>x\<in>A. measure M {x})"
14.1376 - shows "finite_measure_space M"
14.1377 -proof -
14.1378 - interpret finite_sigma_algebra M
14.1379 - proof
14.1380 - show "finite (space M)" by fact
14.1381 - qed (auto simp: sets_Pow)
14.1382 - interpret measure_space M
14.1383 - proof (rule finite_additivity_sufficient)
14.1384 - show "sigma_algebra M" by default
14.1385 - show "finite (space M)" by fact
14.1386 - show "positive M (measure M)"
14.1387 - by (auto simp: add positive_def intro!: setsum_nonneg pos)
14.1388 - show "additive M (measure M)"
14.1389 - using `finite (space M)`
14.1390 - by (auto simp add: additive_def add
14.1391 - intro!: setsum_Un_disjoint dest: finite_subset)
14.1392 - qed
14.1393 - interpret finite_measure M
14.1394 - proof
14.1395 - show "\<mu> (space M) \<noteq> \<infinity>" by fact
14.1396 - qed default
14.1397 - show "finite_measure_space M"
14.1398 - by default
14.1399 -qed
14.1400 -
14.1401 -lemma (in finite_measure_space) sum_over_space: "(\<Sum>x\<in>space M. \<mu> {x}) = \<mu> (space M)"
14.1402 - using measure_setsum[of "space M" "\<lambda>i. {i}"]
14.1403 - by (simp add: disjoint_family_on_def finite_space)
14.1404 -
14.1405 -lemma (in finite_measure_space) finite_measure_singleton:
14.1406 - assumes A: "A \<subseteq> space M" shows "\<mu>' A = (\<Sum>x\<in>A. \<mu>' {x})"
14.1407 - using A finite_subset[OF A finite_space]
14.1408 - by (intro finite_measure_finite_singleton) auto
14.1409 -
14.1410 -lemma (in finite_measure_space) finite_measure_subadditive_setsum:
14.1411 - assumes "finite I"
14.1412 - shows "\<mu>' (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. \<mu>' (A i))"
14.1413 -proof cases
14.1414 - assume "(\<Union>i\<in>I. A i) \<subseteq> space M"
14.1415 - then have "\<And>i. i\<in>I \<Longrightarrow> A i \<in> sets M" by auto
14.1416 - from finite_measure_subadditive_finite[OF `finite I` this]
14.1417 - show ?thesis by auto
14.1418 -next
14.1419 - assume "\<not> (\<Union>i\<in>I. A i) \<subseteq> space M"
14.1420 - then have "\<mu>' (\<Union>i\<in>I. A i) = 0"
14.1421 - by (simp add: \<mu>'_def)
14.1422 - also have "0 \<le> (\<Sum>i\<in>I. \<mu>' (A i))"
14.1423 - by (auto intro!: setsum_nonneg)
14.1424 - finally show ?thesis .
14.1425 -qed
14.1426 -
14.1427 -lemma suminf_cmult_indicator:
14.1428 - fixes f :: "nat \<Rightarrow> ereal"
14.1429 - assumes "disjoint_family A" "x \<in> A i" "\<And>i. 0 \<le> f i"
14.1430 - shows "(\<Sum>n. f n * indicator (A n) x) = f i"
14.1431 -proof -
14.1432 - have **: "\<And>n. f n * indicator (A n) x = (if n = i then f n else 0 :: ereal)"
14.1433 - using `x \<in> A i` assms unfolding disjoint_family_on_def indicator_def by auto
14.1434 - then have "\<And>n. (\<Sum>j<n. f j * indicator (A j) x) = (if i < n then f i else 0 :: ereal)"
14.1435 - by (auto simp: setsum_cases)
14.1436 - moreover have "(SUP n. if i < n then f i else 0) = (f i :: ereal)"
14.1437 - proof (rule ereal_SUPI)
14.1438 - fix y :: ereal assume "\<And>n. n \<in> UNIV \<Longrightarrow> (if i < n then f i else 0) \<le> y"
14.1439 - from this[of "Suc i"] show "f i \<le> y" by auto
14.1440 - qed (insert assms, simp)
14.1441 - ultimately show ?thesis using assms
14.1442 - by (subst suminf_ereal_eq_SUPR) (auto simp: indicator_def)
14.1443 -qed
14.1444 -
14.1445 -lemma suminf_indicator:
14.1446 - assumes "disjoint_family A"
14.1447 - shows "(\<Sum>n. indicator (A n) x :: ereal) = indicator (\<Union>i. A i) x"
14.1448 -proof cases
14.1449 - assume *: "x \<in> (\<Union>i. A i)"
14.1450 - then obtain i where "x \<in> A i" by auto
14.1451 - from suminf_cmult_indicator[OF assms(1), OF `x \<in> A i`, of "\<lambda>k. 1"]
14.1452 - show ?thesis using * by simp
14.1453 -qed simp
14.1454 -
14.1455 -end
14.1456 \ No newline at end of file
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/src/HOL/Probability/Measure_Space.thy Mon Apr 23 12:14:35 2012 +0200
15.3 @@ -0,0 +1,1457 @@
15.4 +(* Title: HOL/Probability/Measure_Space.thy
15.5 + Author: Lawrence C Paulson
15.6 + Author: Johannes Hölzl, TU München
15.7 + Author: Armin Heller, TU München
15.8 +*)
15.9 +
15.10 +header {* Measure spaces and their properties *}
15.11 +
15.12 +theory Measure_Space
15.13 +imports
15.14 + Sigma_Algebra
15.15 + "~~/src/HOL/Multivariate_Analysis/Extended_Real_Limits"
15.16 +begin
15.17 +
15.18 +lemma suminf_eq_setsum:
15.19 + fixes f :: "nat \<Rightarrow> 'a::{comm_monoid_add, t2_space}"
15.20 + assumes "finite {i. f i \<noteq> 0}" (is "finite ?P")
15.21 + shows "(\<Sum>i. f i) = (\<Sum>i | f i \<noteq> 0. f i)"
15.22 +proof cases
15.23 + assume "?P \<noteq> {}"
15.24 + have [dest!]: "\<And>i. Suc (Max ?P) \<le> i \<Longrightarrow> f i = 0"
15.25 + using `finite ?P` `?P \<noteq> {}` by (auto simp: Suc_le_eq)
15.26 + have "(\<Sum>i. f i) = (\<Sum>i<Suc (Max ?P). f i)"
15.27 + by (rule suminf_finite) auto
15.28 + also have "\<dots> = (\<Sum>i | f i \<noteq> 0. f i)"
15.29 + using `finite ?P` `?P \<noteq> {}`
15.30 + by (intro setsum_mono_zero_right) (auto simp: less_Suc_eq_le)
15.31 + finally show ?thesis .
15.32 +qed simp
15.33 +
15.34 +lemma suminf_cmult_indicator:
15.35 + fixes f :: "nat \<Rightarrow> ereal"
15.36 + assumes "disjoint_family A" "x \<in> A i" "\<And>i. 0 \<le> f i"
15.37 + shows "(\<Sum>n. f n * indicator (A n) x) = f i"
15.38 +proof -
15.39 + have **: "\<And>n. f n * indicator (A n) x = (if n = i then f n else 0 :: ereal)"
15.40 + using `x \<in> A i` assms unfolding disjoint_family_on_def indicator_def by auto
15.41 + then have "\<And>n. (\<Sum>j<n. f j * indicator (A j) x) = (if i < n then f i else 0 :: ereal)"
15.42 + by (auto simp: setsum_cases)
15.43 + moreover have "(SUP n. if i < n then f i else 0) = (f i :: ereal)"
15.44 + proof (rule ereal_SUPI)
15.45 + fix y :: ereal assume "\<And>n. n \<in> UNIV \<Longrightarrow> (if i < n then f i else 0) \<le> y"
15.46 + from this[of "Suc i"] show "f i \<le> y" by auto
15.47 + qed (insert assms, simp)
15.48 + ultimately show ?thesis using assms
15.49 + by (subst suminf_ereal_eq_SUPR) (auto simp: indicator_def)
15.50 +qed
15.51 +
15.52 +lemma suminf_indicator:
15.53 + assumes "disjoint_family A"
15.54 + shows "(\<Sum>n. indicator (A n) x :: ereal) = indicator (\<Union>i. A i) x"
15.55 +proof cases
15.56 + assume *: "x \<in> (\<Union>i. A i)"
15.57 + then obtain i where "x \<in> A i" by auto
15.58 + from suminf_cmult_indicator[OF assms(1), OF `x \<in> A i`, of "\<lambda>k. 1"]
15.59 + show ?thesis using * by simp
15.60 +qed simp
15.61 +
15.62 +text {*
15.63 + The type for emeasure spaces is already defined in @{theory Sigma_Algebra}, as it is also used to
15.64 + represent sigma algebras (with an arbitrary emeasure).
15.65 +*}
15.66 +
15.67 +section "Extend binary sets"
15.68 +
15.69 +lemma LIMSEQ_binaryset:
15.70 + assumes f: "f {} = 0"
15.71 + shows "(\<lambda>n. \<Sum>i<n. f (binaryset A B i)) ----> f A + f B"
15.72 +proof -
15.73 + have "(\<lambda>n. \<Sum>i < Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)"
15.74 + proof
15.75 + fix n
15.76 + show "(\<Sum>i < Suc (Suc n). f (binaryset A B i)) = f A + f B"
15.77 + by (induct n) (auto simp add: binaryset_def f)
15.78 + qed
15.79 + moreover
15.80 + have "... ----> f A + f B" by (rule tendsto_const)
15.81 + ultimately
15.82 + have "(\<lambda>n. \<Sum>i< Suc (Suc n). f (binaryset A B i)) ----> f A + f B"
15.83 + by metis
15.84 + hence "(\<lambda>n. \<Sum>i< n+2. f (binaryset A B i)) ----> f A + f B"
15.85 + by simp
15.86 + thus ?thesis by (rule LIMSEQ_offset [where k=2])
15.87 +qed
15.88 +
15.89 +lemma binaryset_sums:
15.90 + assumes f: "f {} = 0"
15.91 + shows "(\<lambda>n. f (binaryset A B n)) sums (f A + f B)"
15.92 + by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f] atLeast0LessThan)
15.93 +
15.94 +lemma suminf_binaryset_eq:
15.95 + fixes f :: "'a set \<Rightarrow> 'b::{comm_monoid_add, t2_space}"
15.96 + shows "f {} = 0 \<Longrightarrow> (\<Sum>n. f (binaryset A B n)) = f A + f B"
15.97 + by (metis binaryset_sums sums_unique)
15.98 +
15.99 +section {* Properties of a premeasure @{term \<mu>} *}
15.100 +
15.101 +text {*
15.102 + The definitions for @{const positive} and @{const countably_additive} should be here, by they are
15.103 + necessary to define @{typ "'a measure"} in @{theory Sigma_Algebra}.
15.104 +*}
15.105 +
15.106 +definition additive where
15.107 + "additive M \<mu> \<longleftrightarrow> (\<forall>x\<in>M. \<forall>y\<in>M. x \<inter> y = {} \<longrightarrow> \<mu> (x \<union> y) = \<mu> x + \<mu> y)"
15.108 +
15.109 +definition increasing where
15.110 + "increasing M \<mu> \<longleftrightarrow> (\<forall>x\<in>M. \<forall>y\<in>M. x \<subseteq> y \<longrightarrow> \<mu> x \<le> \<mu> y)"
15.111 +
15.112 +lemma positiveD_empty:
15.113 + "positive M f \<Longrightarrow> f {} = 0"
15.114 + by (auto simp add: positive_def)
15.115 +
15.116 +lemma additiveD:
15.117 + "additive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x \<in> M \<Longrightarrow> y \<in> M \<Longrightarrow> f (x \<union> y) = f x + f y"
15.118 + by (auto simp add: additive_def)
15.119 +
15.120 +lemma increasingD:
15.121 + "increasing M f \<Longrightarrow> x \<subseteq> y \<Longrightarrow> x\<in>M \<Longrightarrow> y\<in>M \<Longrightarrow> f x \<le> f y"
15.122 + by (auto simp add: increasing_def)
15.123 +
15.124 +lemma countably_additiveI:
15.125 + "(\<And>A. range A \<subseteq> M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i. A i) \<in> M \<Longrightarrow> (\<Sum>i. f (A i)) = f (\<Union>i. A i))
15.126 + \<Longrightarrow> countably_additive M f"
15.127 + by (simp add: countably_additive_def)
15.128 +
15.129 +lemma (in ring_of_sets) disjointed_additive:
15.130 + assumes f: "positive M f" "additive M f" and A: "range A \<subseteq> M" "incseq A"
15.131 + shows "(\<Sum>i\<le>n. f (disjointed A i)) = f (A n)"
15.132 +proof (induct n)
15.133 + case (Suc n)
15.134 + then have "(\<Sum>i\<le>Suc n. f (disjointed A i)) = f (A n) + f (disjointed A (Suc n))"
15.135 + by simp
15.136 + also have "\<dots> = f (A n \<union> disjointed A (Suc n))"
15.137 + using A by (subst f(2)[THEN additiveD]) (auto simp: disjointed_incseq)
15.138 + also have "A n \<union> disjointed A (Suc n) = A (Suc n)"
15.139 + using `incseq A` by (auto dest: incseq_SucD simp: disjointed_incseq)
15.140 + finally show ?case .
15.141 +qed simp
15.142 +
15.143 +lemma (in ring_of_sets) additive_sum:
15.144 + fixes A:: "'i \<Rightarrow> 'a set"
15.145 + assumes f: "positive M f" and ad: "additive M f" and "finite S"
15.146 + and A: "A`S \<subseteq> M"
15.147 + and disj: "disjoint_family_on A S"
15.148 + shows "(\<Sum>i\<in>S. f (A i)) = f (\<Union>i\<in>S. A i)"
15.149 +using `finite S` disj A proof induct
15.150 + case empty show ?case using f by (simp add: positive_def)
15.151 +next
15.152 + case (insert s S)
15.153 + then have "A s \<inter> (\<Union>i\<in>S. A i) = {}"
15.154 + by (auto simp add: disjoint_family_on_def neq_iff)
15.155 + moreover
15.156 + have "A s \<in> M" using insert by blast
15.157 + moreover have "(\<Union>i\<in>S. A i) \<in> M"
15.158 + using insert `finite S` by auto
15.159 + moreover
15.160 + ultimately have "f (A s \<union> (\<Union>i\<in>S. A i)) = f (A s) + f(\<Union>i\<in>S. A i)"
15.161 + using ad UNION_in_sets A by (auto simp add: additive_def)
15.162 + with insert show ?case using ad disjoint_family_on_mono[of S "insert s S" A]
15.163 + by (auto simp add: additive_def subset_insertI)
15.164 +qed
15.165 +
15.166 +lemma (in ring_of_sets) additive_increasing:
15.167 + assumes posf: "positive M f" and addf: "additive M f"
15.168 + shows "increasing M f"
15.169 +proof (auto simp add: increasing_def)
15.170 + fix x y
15.171 + assume xy: "x \<in> M" "y \<in> M" "x \<subseteq> y"
15.172 + then have "y - x \<in> M" by auto
15.173 + then have "0 \<le> f (y-x)" using posf[unfolded positive_def] by auto
15.174 + then have "f x + 0 \<le> f x + f (y-x)" by (intro add_left_mono) auto
15.175 + also have "... = f (x \<union> (y-x))" using addf
15.176 + by (auto simp add: additive_def) (metis Diff_disjoint Un_Diff_cancel Diff xy(1,2))
15.177 + also have "... = f y"
15.178 + by (metis Un_Diff_cancel Un_absorb1 xy(3))
15.179 + finally show "f x \<le> f y" by simp
15.180 +qed
15.181 +
15.182 +lemma (in ring_of_sets) countably_additive_additive:
15.183 + assumes posf: "positive M f" and ca: "countably_additive M f"
15.184 + shows "additive M f"
15.185 +proof (auto simp add: additive_def)
15.186 + fix x y
15.187 + assume x: "x \<in> M" and y: "y \<in> M" and "x \<inter> y = {}"
15.188 + hence "disjoint_family (binaryset x y)"
15.189 + by (auto simp add: disjoint_family_on_def binaryset_def)
15.190 + hence "range (binaryset x y) \<subseteq> M \<longrightarrow>
15.191 + (\<Union>i. binaryset x y i) \<in> M \<longrightarrow>
15.192 + f (\<Union>i. binaryset x y i) = (\<Sum> n. f (binaryset x y n))"
15.193 + using ca
15.194 + by (simp add: countably_additive_def)
15.195 + hence "{x,y,{}} \<subseteq> M \<longrightarrow> x \<union> y \<in> M \<longrightarrow>
15.196 + f (x \<union> y) = (\<Sum>n. f (binaryset x y n))"
15.197 + by (simp add: range_binaryset_eq UN_binaryset_eq)
15.198 + thus "f (x \<union> y) = f x + f y" using posf x y
15.199 + by (auto simp add: Un suminf_binaryset_eq positive_def)
15.200 +qed
15.201 +
15.202 +lemma (in algebra) increasing_additive_bound:
15.203 + fixes A:: "nat \<Rightarrow> 'a set" and f :: "'a set \<Rightarrow> ereal"
15.204 + assumes f: "positive M f" and ad: "additive M f"
15.205 + and inc: "increasing M f"
15.206 + and A: "range A \<subseteq> M"
15.207 + and disj: "disjoint_family A"
15.208 + shows "(\<Sum>i. f (A i)) \<le> f \<Omega>"
15.209 +proof (safe intro!: suminf_bound)
15.210 + fix N
15.211 + note disj_N = disjoint_family_on_mono[OF _ disj, of "{..<N}"]
15.212 + have "(\<Sum>i<N. f (A i)) = f (\<Union>i\<in>{..<N}. A i)"
15.213 + using A by (intro additive_sum [OF f ad _ _]) (auto simp: disj_N)
15.214 + also have "... \<le> f \<Omega>" using space_closed A
15.215 + by (intro increasingD[OF inc] finite_UN) auto
15.216 + finally show "(\<Sum>i<N. f (A i)) \<le> f \<Omega>" by simp
15.217 +qed (insert f A, auto simp: positive_def)
15.218 +
15.219 +lemma (in ring_of_sets) countably_additiveI_finite:
15.220 + assumes "finite \<Omega>" "positive M \<mu>" "additive M \<mu>"
15.221 + shows "countably_additive M \<mu>"
15.222 +proof (rule countably_additiveI)
15.223 + fix F :: "nat \<Rightarrow> 'a set" assume F: "range F \<subseteq> M" "(\<Union>i. F i) \<in> M" and disj: "disjoint_family F"
15.224 +
15.225 + have "\<forall>i\<in>{i. F i \<noteq> {}}. \<exists>x. x \<in> F i" by auto
15.226 + from bchoice[OF this] obtain f where f: "\<And>i. F i \<noteq> {} \<Longrightarrow> f i \<in> F i" by auto
15.227 +
15.228 + have inj_f: "inj_on f {i. F i \<noteq> {}}"
15.229 + proof (rule inj_onI, simp)
15.230 + fix i j a b assume *: "f i = f j" "F i \<noteq> {}" "F j \<noteq> {}"
15.231 + then have "f i \<in> F i" "f j \<in> F j" using f by force+
15.232 + with disj * show "i = j" by (auto simp: disjoint_family_on_def)
15.233 + qed
15.234 + have "finite (\<Union>i. F i)"
15.235 + by (metis F(2) assms(1) infinite_super sets_into_space)
15.236 +
15.237 + have F_subset: "{i. \<mu> (F i) \<noteq> 0} \<subseteq> {i. F i \<noteq> {}}"
15.238 + by (auto simp: positiveD_empty[OF `positive M \<mu>`])
15.239 + moreover have fin_not_empty: "finite {i. F i \<noteq> {}}"
15.240 + proof (rule finite_imageD)
15.241 + from f have "f`{i. F i \<noteq> {}} \<subseteq> (\<Union>i. F i)" by auto
15.242 + then show "finite (f`{i. F i \<noteq> {}})"
15.243 + by (rule finite_subset) fact
15.244 + qed fact
15.245 + ultimately have fin_not_0: "finite {i. \<mu> (F i) \<noteq> 0}"
15.246 + by (rule finite_subset)
15.247 +
15.248 + have disj_not_empty: "disjoint_family_on F {i. F i \<noteq> {}}"
15.249 + using disj by (auto simp: disjoint_family_on_def)
15.250 +
15.251 + from fin_not_0 have "(\<Sum>i. \<mu> (F i)) = (\<Sum>i | \<mu> (F i) \<noteq> 0. \<mu> (F i))"
15.252 + by (rule suminf_eq_setsum)
15.253 + also have "\<dots> = (\<Sum>i | F i \<noteq> {}. \<mu> (F i))"
15.254 + using fin_not_empty F_subset by (rule setsum_mono_zero_left) auto
15.255 + also have "\<dots> = \<mu> (\<Union>i\<in>{i. F i \<noteq> {}}. F i)"
15.256 + using `positive M \<mu>` `additive M \<mu>` fin_not_empty disj_not_empty F by (intro additive_sum) auto
15.257 + also have "\<dots> = \<mu> (\<Union>i. F i)"
15.258 + by (rule arg_cong[where f=\<mu>]) auto
15.259 + finally show "(\<Sum>i. \<mu> (F i)) = \<mu> (\<Union>i. F i)" .
15.260 +qed
15.261 +
15.262 +section {* Properties of @{const emeasure} *}
15.263 +
15.264 +lemma emeasure_positive: "positive (sets M) (emeasure M)"
15.265 + by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def)
15.266 +
15.267 +lemma emeasure_empty[simp, intro]: "emeasure M {} = 0"
15.268 + using emeasure_positive[of M] by (simp add: positive_def)
15.269 +
15.270 +lemma emeasure_nonneg[intro!]: "0 \<le> emeasure M A"
15.271 + using emeasure_notin_sets[of A M] emeasure_positive[of M]
15.272 + by (cases "A \<in> sets M") (auto simp: positive_def)
15.273 +
15.274 +lemma emeasure_not_MInf[simp]: "emeasure M A \<noteq> - \<infinity>"
15.275 + using emeasure_nonneg[of M A] by auto
15.276 +
15.277 +lemma emeasure_countably_additive: "countably_additive (sets M) (emeasure M)"
15.278 + by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def)
15.279 +
15.280 +lemma suminf_emeasure:
15.281 + "range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Sum>i. emeasure M (A i)) = emeasure M (\<Union>i. A i)"
15.282 + using countable_UN[of A UNIV M] emeasure_countably_additive[of M]
15.283 + by (simp add: countably_additive_def)
15.284 +
15.285 +lemma emeasure_additive: "additive (sets M) (emeasure M)"
15.286 + by (metis countably_additive_additive emeasure_positive emeasure_countably_additive)
15.287 +
15.288 +lemma plus_emeasure:
15.289 + "a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {} \<Longrightarrow> emeasure M a + emeasure M b = emeasure M (a \<union> b)"
15.290 + using additiveD[OF emeasure_additive] ..
15.291 +
15.292 +lemma setsum_emeasure:
15.293 + "F`I \<subseteq> sets M \<Longrightarrow> disjoint_family_on F I \<Longrightarrow> finite I \<Longrightarrow>
15.294 + (\<Sum>i\<in>I. emeasure M (F i)) = emeasure M (\<Union>i\<in>I. F i)"
15.295 + by (metis additive_sum emeasure_positive emeasure_additive)
15.296 +
15.297 +lemma emeasure_mono:
15.298 + "a \<subseteq> b \<Longrightarrow> b \<in> sets M \<Longrightarrow> emeasure M a \<le> emeasure M b"
15.299 + by (metis additive_increasing emeasure_additive emeasure_nonneg emeasure_notin_sets
15.300 + emeasure_positive increasingD)
15.301 +
15.302 +lemma emeasure_space:
15.303 + "emeasure M A \<le> emeasure M (space M)"
15.304 + by (metis emeasure_mono emeasure_nonneg emeasure_notin_sets sets_into_space top)
15.305 +
15.306 +lemma emeasure_compl:
15.307 + assumes s: "s \<in> sets M" and fin: "emeasure M s \<noteq> \<infinity>"
15.308 + shows "emeasure M (space M - s) = emeasure M (space M) - emeasure M s"
15.309 +proof -
15.310 + from s have "0 \<le> emeasure M s" by auto
15.311 + have "emeasure M (space M) = emeasure M (s \<union> (space M - s))" using s
15.312 + by (metis Un_Diff_cancel Un_absorb1 s sets_into_space)
15.313 + also have "... = emeasure M s + emeasure M (space M - s)"
15.314 + by (rule plus_emeasure[symmetric]) (auto simp add: s)
15.315 + finally have "emeasure M (space M) = emeasure M s + emeasure M (space M - s)" .
15.316 + then show ?thesis
15.317 + using fin `0 \<le> emeasure M s`
15.318 + unfolding ereal_eq_minus_iff by (auto simp: ac_simps)
15.319 +qed
15.320 +
15.321 +lemma emeasure_Diff:
15.322 + assumes finite: "emeasure M B \<noteq> \<infinity>"
15.323 + and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
15.324 + shows "emeasure M (A - B) = emeasure M A - emeasure M B"
15.325 +proof -
15.326 + have "0 \<le> emeasure M B" using assms by auto
15.327 + have "(A - B) \<union> B = A" using `B \<subseteq> A` by auto
15.328 + then have "emeasure M A = emeasure M ((A - B) \<union> B)" by simp
15.329 + also have "\<dots> = emeasure M (A - B) + emeasure M B"
15.330 + using measurable by (subst plus_emeasure[symmetric]) auto
15.331 + finally show "emeasure M (A - B) = emeasure M A - emeasure M B"
15.332 + unfolding ereal_eq_minus_iff
15.333 + using finite `0 \<le> emeasure M B` by auto
15.334 +qed
15.335 +
15.336 +lemma emeasure_countable_increasing:
15.337 + assumes A: "range A \<subseteq> sets M"
15.338 + and A0: "A 0 = {}"
15.339 + and ASuc: "\<And>n. A n \<subseteq> A (Suc n)"
15.340 + shows "(SUP n. emeasure M (A n)) = emeasure M (\<Union>i. A i)"
15.341 +proof -
15.342 + { fix n
15.343 + have "emeasure M (A n) = (\<Sum>i<n. emeasure M (A (Suc i) - A i))"
15.344 + proof (induct n)
15.345 + case 0 thus ?case by (auto simp add: A0)
15.346 + next
15.347 + case (Suc m)
15.348 + have "A (Suc m) = A m \<union> (A (Suc m) - A m)"
15.349 + by (metis ASuc Un_Diff_cancel Un_absorb1)
15.350 + hence "emeasure M (A (Suc m)) =
15.351 + emeasure M (A m) + emeasure M (A (Suc m) - A m)"
15.352 + by (subst plus_emeasure)
15.353 + (auto simp add: emeasure_additive range_subsetD [OF A])
15.354 + with Suc show ?case
15.355 + by simp
15.356 + qed }
15.357 + note Meq = this
15.358 + have Aeq: "(\<Union>i. A (Suc i) - A i) = (\<Union>i. A i)"
15.359 + proof (rule UN_finite2_eq [where k=1], simp)
15.360 + fix i
15.361 + show "(\<Union>i\<in>{0..<i}. A (Suc i) - A i) = (\<Union>i\<in>{0..<Suc i}. A i)"
15.362 + proof (induct i)
15.363 + case 0 thus ?case by (simp add: A0)
15.364 + next
15.365 + case (Suc i)
15.366 + thus ?case
15.367 + by (auto simp add: atLeastLessThanSuc intro: subsetD [OF ASuc])
15.368 + qed
15.369 + qed
15.370 + have A1: "\<And>i. A (Suc i) - A i \<in> sets M"
15.371 + by (metis A Diff range_subsetD)
15.372 + have A2: "(\<Union>i. A (Suc i) - A i) \<in> sets M"
15.373 + by (blast intro: range_subsetD [OF A])
15.374 + have "(SUP n. \<Sum>i<n. emeasure M (A (Suc i) - A i)) = (\<Sum>i. emeasure M (A (Suc i) - A i))"
15.375 + using A by (auto intro!: suminf_ereal_eq_SUPR[symmetric])
15.376 + also have "\<dots> = emeasure M (\<Union>i. A (Suc i) - A i)"
15.377 + by (rule suminf_emeasure)
15.378 + (auto simp add: disjoint_family_Suc ASuc A1 A2)
15.379 + also have "... = emeasure M (\<Union>i. A i)"
15.380 + by (simp add: Aeq)
15.381 + finally have "(SUP n. \<Sum>i<n. emeasure M (A (Suc i) - A i)) = emeasure M (\<Union>i. A i)" .
15.382 + then show ?thesis by (auto simp add: Meq)
15.383 +qed
15.384 +
15.385 +lemma SUP_emeasure_incseq:
15.386 + assumes A: "range A \<subseteq> sets M" and "incseq A"
15.387 + shows "(SUP n. emeasure M (A n)) = emeasure M (\<Union>i. A i)"
15.388 +proof -
15.389 + have *: "(SUP n. emeasure M (nat_case {} A (Suc n))) = (SUP n. emeasure M (nat_case {} A n))"
15.390 + using A by (auto intro!: SUPR_eq exI split: nat.split)
15.391 + have ueq: "(\<Union>i. nat_case {} A i) = (\<Union>i. A i)"
15.392 + by (auto simp add: split: nat.splits)
15.393 + have meq: "\<And>n. emeasure M (A n) = (emeasure M \<circ> nat_case {} A) (Suc n)"
15.394 + by simp
15.395 + have "(SUP n. emeasure M (nat_case {} A n)) = emeasure M (\<Union>i. nat_case {} A i)"
15.396 + using range_subsetD[OF A] incseq_SucD[OF `incseq A`]
15.397 + by (force split: nat.splits intro!: emeasure_countable_increasing)
15.398 + also have "emeasure M (\<Union>i. nat_case {} A i) = emeasure M (\<Union>i. A i)"
15.399 + by (simp add: ueq)
15.400 + finally have "(SUP n. emeasure M (nat_case {} A n)) = emeasure M (\<Union>i. A i)" .
15.401 + thus ?thesis unfolding meq * comp_def .
15.402 +qed
15.403 +
15.404 +lemma incseq_emeasure:
15.405 + assumes "range B \<subseteq> sets M" "incseq B"
15.406 + shows "incseq (\<lambda>i. emeasure M (B i))"
15.407 + using assms by (auto simp: incseq_def intro!: emeasure_mono)
15.408 +
15.409 +lemma Lim_emeasure_incseq:
15.410 + assumes A: "range A \<subseteq> sets M" "incseq A"
15.411 + shows "(\<lambda>i. (emeasure M (A i))) ----> emeasure M (\<Union>i. A i)"
15.412 + using LIMSEQ_ereal_SUPR[OF incseq_emeasure, OF A]
15.413 + SUP_emeasure_incseq[OF A] by simp
15.414 +
15.415 +lemma decseq_emeasure:
15.416 + assumes "range B \<subseteq> sets M" "decseq B"
15.417 + shows "decseq (\<lambda>i. emeasure M (B i))"
15.418 + using assms by (auto simp: decseq_def intro!: emeasure_mono)
15.419 +
15.420 +lemma INF_emeasure_decseq:
15.421 + assumes A: "range A \<subseteq> sets M" and "decseq A"
15.422 + and finite: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
15.423 + shows "(INF n. emeasure M (A n)) = emeasure M (\<Inter>i. A i)"
15.424 +proof -
15.425 + have le_MI: "emeasure M (\<Inter>i. A i) \<le> emeasure M (A 0)"
15.426 + using A by (auto intro!: emeasure_mono)
15.427 + hence *: "emeasure M (\<Inter>i. A i) \<noteq> \<infinity>" using finite[of 0] by auto
15.428 +
15.429 + have A0: "0 \<le> emeasure M (A 0)" using A by auto
15.430 +
15.431 + have "emeasure M (A 0) - (INF n. emeasure M (A n)) = emeasure M (A 0) + (SUP n. - emeasure M (A n))"
15.432 + by (simp add: ereal_SUPR_uminus minus_ereal_def)
15.433 + also have "\<dots> = (SUP n. emeasure M (A 0) - emeasure M (A n))"
15.434 + unfolding minus_ereal_def using A0 assms
15.435 + by (subst SUPR_ereal_add) (auto simp add: decseq_emeasure)
15.436 + also have "\<dots> = (SUP n. emeasure M (A 0 - A n))"
15.437 + using A finite `decseq A`[unfolded decseq_def] by (subst emeasure_Diff) auto
15.438 + also have "\<dots> = emeasure M (\<Union>i. A 0 - A i)"
15.439 + proof (rule SUP_emeasure_incseq)
15.440 + show "range (\<lambda>n. A 0 - A n) \<subseteq> sets M"
15.441 + using A by auto
15.442 + show "incseq (\<lambda>n. A 0 - A n)"
15.443 + using `decseq A` by (auto simp add: incseq_def decseq_def)
15.444 + qed
15.445 + also have "\<dots> = emeasure M (A 0) - emeasure M (\<Inter>i. A i)"
15.446 + using A finite * by (simp, subst emeasure_Diff) auto
15.447 + finally show ?thesis
15.448 + unfolding ereal_minus_eq_minus_iff using finite A0 by auto
15.449 +qed
15.450 +
15.451 +lemma Lim_emeasure_decseq:
15.452 + assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
15.453 + shows "(\<lambda>i. emeasure M (A i)) ----> emeasure M (\<Inter>i. A i)"
15.454 + using LIMSEQ_ereal_INFI[OF decseq_emeasure, OF A]
15.455 + using INF_emeasure_decseq[OF A fin] by simp
15.456 +
15.457 +lemma emeasure_subadditive:
15.458 + assumes measurable: "A \<in> sets M" "B \<in> sets M"
15.459 + shows "emeasure M (A \<union> B) \<le> emeasure M A + emeasure M B"
15.460 +proof -
15.461 + from plus_emeasure[of A M "B - A"]
15.462 + have "emeasure M (A \<union> B) = emeasure M A + emeasure M (B - A)"
15.463 + using assms by (simp add: Diff)
15.464 + also have "\<dots> \<le> emeasure M A + emeasure M B"
15.465 + using assms by (auto intro!: add_left_mono emeasure_mono)
15.466 + finally show ?thesis .
15.467 +qed
15.468 +
15.469 +lemma emeasure_subadditive_finite:
15.470 + assumes "finite I" "A ` I \<subseteq> sets M"
15.471 + shows "emeasure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. emeasure M (A i))"
15.472 +using assms proof induct
15.473 + case (insert i I)
15.474 + then have "emeasure M (\<Union>i\<in>insert i I. A i) = emeasure M (A i \<union> (\<Union>i\<in>I. A i))"
15.475 + by simp
15.476 + also have "\<dots> \<le> emeasure M (A i) + emeasure M (\<Union>i\<in>I. A i)"
15.477 + using insert by (intro emeasure_subadditive finite_UN) auto
15.478 + also have "\<dots> \<le> emeasure M (A i) + (\<Sum>i\<in>I. emeasure M (A i))"
15.479 + using insert by (intro add_mono) auto
15.480 + also have "\<dots> = (\<Sum>i\<in>insert i I. emeasure M (A i))"
15.481 + using insert by auto
15.482 + finally show ?case .
15.483 +qed simp
15.484 +
15.485 +lemma emeasure_subadditive_countably:
15.486 + assumes "range f \<subseteq> sets M"
15.487 + shows "emeasure M (\<Union>i. f i) \<le> (\<Sum>i. emeasure M (f i))"
15.488 +proof -
15.489 + have "emeasure M (\<Union>i. f i) = emeasure M (\<Union>i. disjointed f i)"
15.490 + unfolding UN_disjointed_eq ..
15.491 + also have "\<dots> = (\<Sum>i. emeasure M (disjointed f i))"
15.492 + using range_disjointed_sets[OF assms] suminf_emeasure[of "disjointed f"]
15.493 + by (simp add: disjoint_family_disjointed comp_def)
15.494 + also have "\<dots> \<le> (\<Sum>i. emeasure M (f i))"
15.495 + using range_disjointed_sets[OF assms] assms
15.496 + by (auto intro!: suminf_le_pos emeasure_mono disjointed_subset)
15.497 + finally show ?thesis .
15.498 +qed
15.499 +
15.500 +lemma emeasure_insert:
15.501 + assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A"
15.502 + shows "emeasure M (insert x A) = emeasure M {x} + emeasure M A"
15.503 +proof -
15.504 + have "{x} \<inter> A = {}" using `x \<notin> A` by auto
15.505 + from plus_emeasure[OF sets this] show ?thesis by simp
15.506 +qed
15.507 +
15.508 +lemma emeasure_eq_setsum_singleton:
15.509 + assumes "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
15.510 + shows "emeasure M S = (\<Sum>x\<in>S. emeasure M {x})"
15.511 + using setsum_emeasure[of "\<lambda>x. {x}" S M] assms
15.512 + by (auto simp: disjoint_family_on_def subset_eq)
15.513 +
15.514 +lemma setsum_emeasure_cover:
15.515 + assumes "finite S" and "A \<in> sets M" and br_in_M: "B ` S \<subseteq> sets M"
15.516 + assumes A: "A \<subseteq> (\<Union>i\<in>S. B i)"
15.517 + assumes disj: "disjoint_family_on B S"
15.518 + shows "emeasure M A = (\<Sum>i\<in>S. emeasure M (A \<inter> (B i)))"
15.519 +proof -
15.520 + have "(\<Sum>i\<in>S. emeasure M (A \<inter> (B i))) = emeasure M (\<Union>i\<in>S. A \<inter> (B i))"
15.521 + proof (rule setsum_emeasure)
15.522 + show "disjoint_family_on (\<lambda>i. A \<inter> B i) S"
15.523 + using `disjoint_family_on B S`
15.524 + unfolding disjoint_family_on_def by auto
15.525 + qed (insert assms, auto)
15.526 + also have "(\<Union>i\<in>S. A \<inter> (B i)) = A"
15.527 + using A by auto
15.528 + finally show ?thesis by simp
15.529 +qed
15.530 +
15.531 +lemma emeasure_eq_0:
15.532 + "N \<in> sets M \<Longrightarrow> emeasure M N = 0 \<Longrightarrow> K \<subseteq> N \<Longrightarrow> emeasure M K = 0"
15.533 + by (metis emeasure_mono emeasure_nonneg order_eq_iff)
15.534 +
15.535 +lemma emeasure_UN_eq_0:
15.536 + assumes "\<And>i::nat. emeasure M (N i) = 0" and "range N \<subseteq> sets M"
15.537 + shows "emeasure M (\<Union> i. N i) = 0"
15.538 +proof -
15.539 + have "0 \<le> emeasure M (\<Union> i. N i)" using assms by auto
15.540 + moreover have "emeasure M (\<Union> i. N i) \<le> 0"
15.541 + using emeasure_subadditive_countably[OF assms(2)] assms(1) by simp
15.542 + ultimately show ?thesis by simp
15.543 +qed
15.544 +
15.545 +lemma measure_eqI_finite:
15.546 + assumes [simp]: "sets M = Pow A" "sets N = Pow A" and "finite A"
15.547 + assumes eq: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} = emeasure N {a}"
15.548 + shows "M = N"
15.549 +proof (rule measure_eqI)
15.550 + fix X assume "X \<in> sets M"
15.551 + then have X: "X \<subseteq> A" by auto
15.552 + then have "emeasure M X = (\<Sum>a\<in>X. emeasure M {a})"
15.553 + using `finite A` by (subst emeasure_eq_setsum_singleton) (auto dest: finite_subset)
15.554 + also have "\<dots> = (\<Sum>a\<in>X. emeasure N {a})"
15.555 + using X eq by (auto intro!: setsum_cong)
15.556 + also have "\<dots> = emeasure N X"
15.557 + using X `finite A` by (subst emeasure_eq_setsum_singleton) (auto dest: finite_subset)
15.558 + finally show "emeasure M X = emeasure N X" .
15.559 +qed simp
15.560 +
15.561 +lemma measure_eqI_generator_eq:
15.562 + fixes M N :: "'a measure" and E :: "'a set set" and A :: "nat \<Rightarrow> 'a set"
15.563 + assumes "Int_stable E" "E \<subseteq> Pow \<Omega>"
15.564 + and eq: "\<And>X. X \<in> E \<Longrightarrow> emeasure M X = emeasure N X"
15.565 + and M: "sets M = sigma_sets \<Omega> E"
15.566 + and N: "sets N = sigma_sets \<Omega> E"
15.567 + and A: "range A \<subseteq> E" "incseq A" "(\<Union>i. A i) = \<Omega>" "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
15.568 + shows "M = N"
15.569 +proof -
15.570 + let ?D = "\<lambda>F. {D. D \<in> sigma_sets \<Omega> E \<and> emeasure M (F \<inter> D) = emeasure N (F \<inter> D)}"
15.571 + interpret S: sigma_algebra \<Omega> "sigma_sets \<Omega> E" by (rule sigma_algebra_sigma_sets) fact
15.572 + { fix F assume "F \<in> E" and "emeasure M F \<noteq> \<infinity>"
15.573 + then have [intro]: "F \<in> sigma_sets \<Omega> E" by auto
15.574 + have "emeasure N F \<noteq> \<infinity>" using `emeasure M F \<noteq> \<infinity>` `F \<in> E` eq by simp
15.575 + interpret D: dynkin_system \<Omega> "?D F"
15.576 + proof (rule dynkin_systemI, simp_all)
15.577 + fix A assume "A \<in> sigma_sets \<Omega> E \<and> emeasure M (F \<inter> A) = emeasure N (F \<inter> A)"
15.578 + then show "A \<subseteq> \<Omega>" using S.sets_into_space by auto
15.579 + next
15.580 + have "F \<inter> \<Omega> = F" using `F \<in> E` `E \<subseteq> Pow \<Omega>` by auto
15.581 + then show "emeasure M (F \<inter> \<Omega>) = emeasure N (F \<inter> \<Omega>)"
15.582 + using `F \<in> E` eq by (auto intro: sigma_sets_top)
15.583 + next
15.584 + fix A assume *: "A \<in> sigma_sets \<Omega> E \<and> emeasure M (F \<inter> A) = emeasure N (F \<inter> A)"
15.585 + then have **: "F \<inter> (\<Omega> - A) = F - (F \<inter> A)"
15.586 + and [intro]: "F \<inter> A \<in> sigma_sets \<Omega> E"
15.587 + using `F \<in> E` S.sets_into_space by auto
15.588 + have "emeasure N (F \<inter> A) \<le> emeasure N F" by (auto intro!: emeasure_mono simp: M N)
15.589 + then have "emeasure N (F \<inter> A) \<noteq> \<infinity>" using `emeasure N F \<noteq> \<infinity>` by auto
15.590 + have "emeasure M (F \<inter> A) \<le> emeasure M F" by (auto intro!: emeasure_mono simp: M N)
15.591 + then have "emeasure M (F \<inter> A) \<noteq> \<infinity>" using `emeasure M F \<noteq> \<infinity>` by auto
15.592 + then have "emeasure M (F \<inter> (\<Omega> - A)) = emeasure M F - emeasure M (F \<inter> A)" unfolding **
15.593 + using `F \<inter> A \<in> sigma_sets \<Omega> E` by (auto intro!: emeasure_Diff simp: M N)
15.594 + also have "\<dots> = emeasure N F - emeasure N (F \<inter> A)" using eq `F \<in> E` * by simp
15.595 + also have "\<dots> = emeasure N (F \<inter> (\<Omega> - A))" unfolding **
15.596 + using `F \<inter> A \<in> sigma_sets \<Omega> E` `emeasure N (F \<inter> A) \<noteq> \<infinity>`
15.597 + by (auto intro!: emeasure_Diff[symmetric] simp: M N)
15.598 + finally show "\<Omega> - A \<in> sigma_sets \<Omega> E \<and> emeasure M (F \<inter> (\<Omega> - A)) = emeasure N (F \<inter> (\<Omega> - A))"
15.599 + using * by auto
15.600 + next
15.601 + fix A :: "nat \<Rightarrow> 'a set"
15.602 + assume "disjoint_family A" "range A \<subseteq> {X \<in> sigma_sets \<Omega> E. emeasure M (F \<inter> X) = emeasure N (F \<inter> X)}"
15.603 + then have A: "range (\<lambda>i. F \<inter> A i) \<subseteq> sigma_sets \<Omega> E" "F \<inter> (\<Union>x. A x) = (\<Union>x. F \<inter> A x)"
15.604 + "disjoint_family (\<lambda>i. F \<inter> A i)" "\<And>i. emeasure M (F \<inter> A i) = emeasure N (F \<inter> A i)" "range A \<subseteq> sigma_sets \<Omega> E"
15.605 + by (auto simp: disjoint_family_on_def subset_eq)
15.606 + then show "(\<Union>x. A x) \<in> sigma_sets \<Omega> E \<and> emeasure M (F \<inter> (\<Union>x. A x)) = emeasure N (F \<inter> (\<Union>x. A x))"
15.607 + by (auto simp: M N suminf_emeasure[symmetric] simp del: UN_simps)
15.608 + qed
15.609 + have *: "sigma_sets \<Omega> E = ?D F"
15.610 + using `F \<in> E` `Int_stable E`
15.611 + by (intro D.dynkin_lemma) (auto simp add: Int_stable_def eq)
15.612 + have "\<And>D. D \<in> sigma_sets \<Omega> E \<Longrightarrow> emeasure M (F \<inter> D) = emeasure N (F \<inter> D)"
15.613 + by (subst (asm) *) auto }
15.614 + note * = this
15.615 + show "M = N"
15.616 + proof (rule measure_eqI)
15.617 + show "sets M = sets N"
15.618 + using M N by simp
15.619 + fix X assume "X \<in> sets M"
15.620 + then have "X \<in> sigma_sets \<Omega> E"
15.621 + using M by simp
15.622 + let ?A = "\<lambda>i. A i \<inter> X"
15.623 + have "range ?A \<subseteq> sigma_sets \<Omega> E" "incseq ?A"
15.624 + using A(1,2) `X \<in> sigma_sets \<Omega> E` by (auto simp: incseq_def)
15.625 + moreover
15.626 + { fix i have "emeasure M (?A i) = emeasure N (?A i)"
15.627 + using *[of "A i" X] `X \<in> sigma_sets \<Omega> E` A finite by auto }
15.628 + ultimately show "emeasure M X = emeasure N X"
15.629 + using SUP_emeasure_incseq[of ?A M] SUP_emeasure_incseq[of ?A N] A(3) `X \<in> sigma_sets \<Omega> E`
15.630 + by (auto simp: M N SUP_emeasure_incseq)
15.631 + qed
15.632 +qed
15.633 +
15.634 +lemma measure_of_of_measure: "measure_of (space M) (sets M) (emeasure M) = M"
15.635 +proof (intro measure_eqI emeasure_measure_of_sigma)
15.636 + show "sigma_algebra (space M) (sets M)" ..
15.637 + show "positive (sets M) (emeasure M)"
15.638 + by (simp add: positive_def emeasure_nonneg)
15.639 + show "countably_additive (sets M) (emeasure M)"
15.640 + by (simp add: emeasure_countably_additive)
15.641 +qed simp_all
15.642 +
15.643 +section "@{text \<mu>}-null sets"
15.644 +
15.645 +definition null_sets :: "'a measure \<Rightarrow> 'a set set" where
15.646 + "null_sets M = {N\<in>sets M. emeasure M N = 0}"
15.647 +
15.648 +lemma null_setsD1[dest]: "A \<in> null_sets M \<Longrightarrow> emeasure M A = 0"
15.649 + by (simp add: null_sets_def)
15.650 +
15.651 +lemma null_setsD2[dest]: "A \<in> null_sets M \<Longrightarrow> A \<in> sets M"
15.652 + unfolding null_sets_def by simp
15.653 +
15.654 +lemma null_setsI[intro]: "emeasure M A = 0 \<Longrightarrow> A \<in> sets M \<Longrightarrow> A \<in> null_sets M"
15.655 + unfolding null_sets_def by simp
15.656 +
15.657 +interpretation null_sets: ring_of_sets "space M" "null_sets M" for M
15.658 +proof
15.659 + show "null_sets M \<subseteq> Pow (space M)"
15.660 + using sets_into_space by auto
15.661 + show "{} \<in> null_sets M"
15.662 + by auto
15.663 + fix A B assume sets: "A \<in> null_sets M" "B \<in> null_sets M"
15.664 + then have "A \<in> sets M" "B \<in> sets M"
15.665 + by auto
15.666 + moreover then have "emeasure M (A \<union> B) \<le> emeasure M A + emeasure M B"
15.667 + "emeasure M (A - B) \<le> emeasure M A"
15.668 + by (auto intro!: emeasure_subadditive emeasure_mono)
15.669 + moreover have "emeasure M B = 0" "emeasure M A = 0"
15.670 + using sets by auto
15.671 + ultimately show "A - B \<in> null_sets M" "A \<union> B \<in> null_sets M"
15.672 + by (auto intro!: antisym)
15.673 +qed
15.674 +
15.675 +lemma UN_from_nat: "(\<Union>i. N i) = (\<Union>i. N (Countable.from_nat i))"
15.676 +proof -
15.677 + have "(\<Union>i. N i) = (\<Union>i. (N \<circ> Countable.from_nat) i)"
15.678 + unfolding SUP_def image_compose
15.679 + unfolding surj_from_nat ..
15.680 + then show ?thesis by simp
15.681 +qed
15.682 +
15.683 +lemma null_sets_UN[intro]:
15.684 + assumes "\<And>i::'i::countable. N i \<in> null_sets M"
15.685 + shows "(\<Union>i. N i) \<in> null_sets M"
15.686 +proof (intro conjI CollectI null_setsI)
15.687 + show "(\<Union>i. N i) \<in> sets M" using assms by auto
15.688 + have "0 \<le> emeasure M (\<Union>i. N i)" by (rule emeasure_nonneg)
15.689 + moreover have "emeasure M (\<Union>i. N i) \<le> (\<Sum>n. emeasure M (N (Countable.from_nat n)))"
15.690 + unfolding UN_from_nat[of N]
15.691 + using assms by (intro emeasure_subadditive_countably) auto
15.692 + ultimately show "emeasure M (\<Union>i. N i) = 0"
15.693 + using assms by (auto simp: null_setsD1)
15.694 +qed
15.695 +
15.696 +lemma null_set_Int1:
15.697 + assumes "B \<in> null_sets M" "A \<in> sets M" shows "A \<inter> B \<in> null_sets M"
15.698 +proof (intro CollectI conjI null_setsI)
15.699 + show "emeasure M (A \<inter> B) = 0" using assms
15.700 + by (intro emeasure_eq_0[of B _ "A \<inter> B"]) auto
15.701 +qed (insert assms, auto)
15.702 +
15.703 +lemma null_set_Int2:
15.704 + assumes "B \<in> null_sets M" "A \<in> sets M" shows "B \<inter> A \<in> null_sets M"
15.705 + using assms by (subst Int_commute) (rule null_set_Int1)
15.706 +
15.707 +lemma emeasure_Diff_null_set:
15.708 + assumes "B \<in> null_sets M" "A \<in> sets M"
15.709 + shows "emeasure M (A - B) = emeasure M A"
15.710 +proof -
15.711 + have *: "A - B = (A - (A \<inter> B))" by auto
15.712 + have "A \<inter> B \<in> null_sets M" using assms by (rule null_set_Int1)
15.713 + then show ?thesis
15.714 + unfolding * using assms
15.715 + by (subst emeasure_Diff) auto
15.716 +qed
15.717 +
15.718 +lemma null_set_Diff:
15.719 + assumes "B \<in> null_sets M" "A \<in> sets M" shows "B - A \<in> null_sets M"
15.720 +proof (intro CollectI conjI null_setsI)
15.721 + show "emeasure M (B - A) = 0" using assms by (intro emeasure_eq_0[of B _ "B - A"]) auto
15.722 +qed (insert assms, auto)
15.723 +
15.724 +lemma emeasure_Un_null_set:
15.725 + assumes "A \<in> sets M" "B \<in> null_sets M"
15.726 + shows "emeasure M (A \<union> B) = emeasure M A"
15.727 +proof -
15.728 + have *: "A \<union> B = A \<union> (B - A)" by auto
15.729 + have "B - A \<in> null_sets M" using assms(2,1) by (rule null_set_Diff)
15.730 + then show ?thesis
15.731 + unfolding * using assms
15.732 + by (subst plus_emeasure[symmetric]) auto
15.733 +qed
15.734 +
15.735 +section "Formalize almost everywhere"
15.736 +
15.737 +definition ae_filter :: "'a measure \<Rightarrow> 'a filter" where
15.738 + "ae_filter M = Abs_filter (\<lambda>P. \<exists>N\<in>null_sets M. {x \<in> space M. \<not> P x} \<subseteq> N)"
15.739 +
15.740 +abbreviation
15.741 + almost_everywhere :: "'a measure \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" where
15.742 + "almost_everywhere M P \<equiv> eventually P (ae_filter M)"
15.743 +
15.744 +syntax
15.745 + "_almost_everywhere" :: "pttrn \<Rightarrow> 'a \<Rightarrow> bool \<Rightarrow> bool" ("AE _ in _. _" [0,0,10] 10)
15.746 +
15.747 +translations
15.748 + "AE x in M. P" == "CONST almost_everywhere M (%x. P)"
15.749 +
15.750 +lemma eventually_ae_filter:
15.751 + fixes M P
15.752 + defines [simp]: "F \<equiv> \<lambda>P. \<exists>N\<in>null_sets M. {x \<in> space M. \<not> P x} \<subseteq> N"
15.753 + shows "eventually P (ae_filter M) \<longleftrightarrow> F P"
15.754 + unfolding ae_filter_def F_def[symmetric]
15.755 +proof (rule eventually_Abs_filter)
15.756 + show "is_filter F"
15.757 + proof
15.758 + fix P Q assume "F P" "F Q"
15.759 + then obtain N L where N: "N \<in> null_sets M" "{x \<in> space M. \<not> P x} \<subseteq> N"
15.760 + and L: "L \<in> null_sets M" "{x \<in> space M. \<not> Q x} \<subseteq> L"
15.761 + by auto
15.762 + then have "L \<union> N \<in> null_sets M" "{x \<in> space M. \<not> (P x \<and> Q x)} \<subseteq> L \<union> N" by auto
15.763 + then show "F (\<lambda>x. P x \<and> Q x)" by auto
15.764 + next
15.765 + fix P Q assume "F P"
15.766 + then obtain N where N: "N \<in> null_sets M" "{x \<in> space M. \<not> P x} \<subseteq> N" by auto
15.767 + moreover assume "\<forall>x. P x \<longrightarrow> Q x"
15.768 + ultimately have "N \<in> null_sets M" "{x \<in> space M. \<not> Q x} \<subseteq> N" by auto
15.769 + then show "F Q" by auto
15.770 + qed auto
15.771 +qed
15.772 +
15.773 +lemma AE_I':
15.774 + "N \<in> null_sets M \<Longrightarrow> {x\<in>space M. \<not> P x} \<subseteq> N \<Longrightarrow> (AE x in M. P x)"
15.775 + unfolding eventually_ae_filter by auto
15.776 +
15.777 +lemma AE_iff_null:
15.778 + assumes "{x\<in>space M. \<not> P x} \<in> sets M" (is "?P \<in> sets M")
15.779 + shows "(AE x in M. P x) \<longleftrightarrow> {x\<in>space M. \<not> P x} \<in> null_sets M"
15.780 +proof
15.781 + assume "AE x in M. P x" then obtain N where N: "N \<in> sets M" "?P \<subseteq> N" "emeasure M N = 0"
15.782 + unfolding eventually_ae_filter by auto
15.783 + have "0 \<le> emeasure M ?P" by auto
15.784 + moreover have "emeasure M ?P \<le> emeasure M N"
15.785 + using assms N(1,2) by (auto intro: emeasure_mono)
15.786 + ultimately have "emeasure M ?P = 0" unfolding `emeasure M N = 0` by auto
15.787 + then show "?P \<in> null_sets M" using assms by auto
15.788 +next
15.789 + assume "?P \<in> null_sets M" with assms show "AE x in M. P x" by (auto intro: AE_I')
15.790 +qed
15.791 +
15.792 +lemma AE_iff_null_sets:
15.793 + "N \<in> sets M \<Longrightarrow> N \<in> null_sets M \<longleftrightarrow> (AE x in M. x \<notin> N)"
15.794 + using Int_absorb1[OF sets_into_space, of N M]
15.795 + by (subst AE_iff_null) (auto simp: Int_def[symmetric])
15.796 +
15.797 +lemma AE_iff_measurable:
15.798 + "N \<in> sets M \<Longrightarrow> {x\<in>space M. \<not> P x} = N \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> emeasure M N = 0"
15.799 + using AE_iff_null[of _ P] by auto
15.800 +
15.801 +lemma AE_E[consumes 1]:
15.802 + assumes "AE x in M. P x"
15.803 + obtains N where "{x \<in> space M. \<not> P x} \<subseteq> N" "emeasure M N = 0" "N \<in> sets M"
15.804 + using assms unfolding eventually_ae_filter by auto
15.805 +
15.806 +lemma AE_E2:
15.807 + assumes "AE x in M. P x" "{x\<in>space M. P x} \<in> sets M"
15.808 + shows "emeasure M {x\<in>space M. \<not> P x} = 0" (is "emeasure M ?P = 0")
15.809 +proof -
15.810 + have "{x\<in>space M. \<not> P x} = space M - {x\<in>space M. P x}" by auto
15.811 + with AE_iff_null[of M P] assms show ?thesis by auto
15.812 +qed
15.813 +
15.814 +lemma AE_I:
15.815 + assumes "{x \<in> space M. \<not> P x} \<subseteq> N" "emeasure M N = 0" "N \<in> sets M"
15.816 + shows "AE x in M. P x"
15.817 + using assms unfolding eventually_ae_filter by auto
15.818 +
15.819 +lemma AE_mp[elim!]:
15.820 + assumes AE_P: "AE x in M. P x" and AE_imp: "AE x in M. P x \<longrightarrow> Q x"
15.821 + shows "AE x in M. Q x"
15.822 +proof -
15.823 + from AE_P obtain A where P: "{x\<in>space M. \<not> P x} \<subseteq> A"
15.824 + and A: "A \<in> sets M" "emeasure M A = 0"
15.825 + by (auto elim!: AE_E)
15.826 +
15.827 + from AE_imp obtain B where imp: "{x\<in>space M. P x \<and> \<not> Q x} \<subseteq> B"
15.828 + and B: "B \<in> sets M" "emeasure M B = 0"
15.829 + by (auto elim!: AE_E)
15.830 +
15.831 + show ?thesis
15.832 + proof (intro AE_I)
15.833 + have "0 \<le> emeasure M (A \<union> B)" using A B by auto
15.834 + moreover have "emeasure M (A \<union> B) \<le> 0"
15.835 + using emeasure_subadditive[of A M B] A B by auto
15.836 + ultimately show "A \<union> B \<in> sets M" "emeasure M (A \<union> B) = 0" using A B by auto
15.837 + show "{x\<in>space M. \<not> Q x} \<subseteq> A \<union> B"
15.838 + using P imp by auto
15.839 + qed
15.840 +qed
15.841 +
15.842 +(* depricated replace by laws about eventually *)
15.843 +lemma
15.844 + shows AE_iffI: "AE x in M. P x \<Longrightarrow> AE x in M. P x \<longleftrightarrow> Q x \<Longrightarrow> AE x in M. Q x"
15.845 + and AE_disjI1: "AE x in M. P x \<Longrightarrow> AE x in M. P x \<or> Q x"
15.846 + and AE_disjI2: "AE x in M. Q x \<Longrightarrow> AE x in M. P x \<or> Q x"
15.847 + and AE_conjI: "AE x in M. P x \<Longrightarrow> AE x in M. Q x \<Longrightarrow> AE x in M. P x \<and> Q x"
15.848 + and AE_conj_iff[simp]: "(AE x in M. P x \<and> Q x) \<longleftrightarrow> (AE x in M. P x) \<and> (AE x in M. Q x)"
15.849 + by auto
15.850 +
15.851 +lemma AE_impI:
15.852 + "(P \<Longrightarrow> AE x in M. Q x) \<Longrightarrow> AE x in M. P \<longrightarrow> Q x"
15.853 + by (cases P) auto
15.854 +
15.855 +lemma AE_measure:
15.856 + assumes AE: "AE x in M. P x" and sets: "{x\<in>space M. P x} \<in> sets M" (is "?P \<in> sets M")
15.857 + shows "emeasure M {x\<in>space M. P x} = emeasure M (space M)"
15.858 +proof -
15.859 + from AE_E[OF AE] guess N . note N = this
15.860 + with sets have "emeasure M (space M) \<le> emeasure M (?P \<union> N)"
15.861 + by (intro emeasure_mono) auto
15.862 + also have "\<dots> \<le> emeasure M ?P + emeasure M N"
15.863 + using sets N by (intro emeasure_subadditive) auto
15.864 + also have "\<dots> = emeasure M ?P" using N by simp
15.865 + finally show "emeasure M ?P = emeasure M (space M)"
15.866 + using emeasure_space[of M "?P"] by auto
15.867 +qed
15.868 +
15.869 +lemma AE_space: "AE x in M. x \<in> space M"
15.870 + by (rule AE_I[where N="{}"]) auto
15.871 +
15.872 +lemma AE_I2[simp, intro]:
15.873 + "(\<And>x. x \<in> space M \<Longrightarrow> P x) \<Longrightarrow> AE x in M. P x"
15.874 + using AE_space by force
15.875 +
15.876 +lemma AE_Ball_mp:
15.877 + "\<forall>x\<in>space M. P x \<Longrightarrow> AE x in M. P x \<longrightarrow> Q x \<Longrightarrow> AE x in M. Q x"
15.878 + by auto
15.879 +
15.880 +lemma AE_cong[cong]:
15.881 + "(\<And>x. x \<in> space M \<Longrightarrow> P x \<longleftrightarrow> Q x) \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> (AE x in M. Q x)"
15.882 + by auto
15.883 +
15.884 +lemma AE_all_countable:
15.885 + "(AE x in M. \<forall>i. P i x) \<longleftrightarrow> (\<forall>i::'i::countable. AE x in M. P i x)"
15.886 +proof
15.887 + assume "\<forall>i. AE x in M. P i x"
15.888 + from this[unfolded eventually_ae_filter Bex_def, THEN choice]
15.889 + obtain N where N: "\<And>i. N i \<in> null_sets M" "\<And>i. {x\<in>space M. \<not> P i x} \<subseteq> N i" by auto
15.890 + have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. {x\<in>space M. \<not> P i x})" by auto
15.891 + also have "\<dots> \<subseteq> (\<Union>i. N i)" using N by auto
15.892 + finally have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. N i)" .
15.893 + moreover from N have "(\<Union>i. N i) \<in> null_sets M"
15.894 + by (intro null_sets_UN) auto
15.895 + ultimately show "AE x in M. \<forall>i. P i x"
15.896 + unfolding eventually_ae_filter by auto
15.897 +qed auto
15.898 +
15.899 +lemma AE_finite_all:
15.900 + assumes f: "finite S" shows "(AE x in M. \<forall>i\<in>S. P i x) \<longleftrightarrow> (\<forall>i\<in>S. AE x in M. P i x)"
15.901 + using f by induct auto
15.902 +
15.903 +lemma AE_finite_allI:
15.904 + assumes "finite S"
15.905 + shows "(\<And>s. s \<in> S \<Longrightarrow> AE x in M. Q s x) \<Longrightarrow> AE x in M. \<forall>s\<in>S. Q s x"
15.906 + using AE_finite_all[OF `finite S`] by auto
15.907 +
15.908 +lemma emeasure_mono_AE:
15.909 + assumes imp: "AE x in M. x \<in> A \<longrightarrow> x \<in> B"
15.910 + and B: "B \<in> sets M"
15.911 + shows "emeasure M A \<le> emeasure M B"
15.912 +proof cases
15.913 + assume A: "A \<in> sets M"
15.914 + from imp obtain N where N: "{x\<in>space M. \<not> (x \<in> A \<longrightarrow> x \<in> B)} \<subseteq> N" "N \<in> null_sets M"
15.915 + by (auto simp: eventually_ae_filter)
15.916 + have "emeasure M A = emeasure M (A - N)"
15.917 + using N A by (subst emeasure_Diff_null_set) auto
15.918 + also have "emeasure M (A - N) \<le> emeasure M (B - N)"
15.919 + using N A B sets_into_space by (auto intro!: emeasure_mono)
15.920 + also have "emeasure M (B - N) = emeasure M B"
15.921 + using N B by (subst emeasure_Diff_null_set) auto
15.922 + finally show ?thesis .
15.923 +qed (simp add: emeasure_nonneg emeasure_notin_sets)
15.924 +
15.925 +lemma emeasure_eq_AE:
15.926 + assumes iff: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
15.927 + assumes A: "A \<in> sets M" and B: "B \<in> sets M"
15.928 + shows "emeasure M A = emeasure M B"
15.929 + using assms by (safe intro!: antisym emeasure_mono_AE) auto
15.930 +
15.931 +section {* @{text \<sigma>}-finite Measures *}
15.932 +
15.933 +locale sigma_finite_measure =
15.934 + fixes M :: "'a measure"
15.935 + assumes sigma_finite: "\<exists>A::nat \<Rightarrow> 'a set.
15.936 + range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. emeasure M (A i) \<noteq> \<infinity>)"
15.937 +
15.938 +lemma (in sigma_finite_measure) sigma_finite_disjoint:
15.939 + obtains A :: "nat \<Rightarrow> 'a set"
15.940 + where "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. emeasure M (A i) \<noteq> \<infinity>" "disjoint_family A"
15.941 +proof atomize_elim
15.942 + case goal1
15.943 + obtain A :: "nat \<Rightarrow> 'a set" where
15.944 + range: "range A \<subseteq> sets M" and
15.945 + space: "(\<Union>i. A i) = space M" and
15.946 + measure: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
15.947 + using sigma_finite by auto
15.948 + note range' = range_disjointed_sets[OF range] range
15.949 + { fix i
15.950 + have "emeasure M (disjointed A i) \<le> emeasure M (A i)"
15.951 + using range' disjointed_subset[of A i] by (auto intro!: emeasure_mono)
15.952 + then have "emeasure M (disjointed A i) \<noteq> \<infinity>"
15.953 + using measure[of i] by auto }
15.954 + with disjoint_family_disjointed UN_disjointed_eq[of A] space range'
15.955 + show ?case by (auto intro!: exI[of _ "disjointed A"])
15.956 +qed
15.957 +
15.958 +lemma (in sigma_finite_measure) sigma_finite_incseq:
15.959 + obtains A :: "nat \<Rightarrow> 'a set"
15.960 + where "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. emeasure M (A i) \<noteq> \<infinity>" "incseq A"
15.961 +proof atomize_elim
15.962 + case goal1
15.963 + obtain F :: "nat \<Rightarrow> 'a set" where
15.964 + F: "range F \<subseteq> sets M" "(\<Union>i. F i) = space M" "\<And>i. emeasure M (F i) \<noteq> \<infinity>"
15.965 + using sigma_finite by auto
15.966 + then show ?case
15.967 + proof (intro exI[of _ "\<lambda>n. \<Union>i\<le>n. F i"] conjI allI)
15.968 + from F have "\<And>x. x \<in> space M \<Longrightarrow> \<exists>i. x \<in> F i" by auto
15.969 + then show "(\<Union>n. \<Union> i\<le>n. F i) = space M"
15.970 + using F by fastforce
15.971 + next
15.972 + fix n
15.973 + have "emeasure M (\<Union> i\<le>n. F i) \<le> (\<Sum>i\<le>n. emeasure M (F i))" using F
15.974 + by (auto intro!: emeasure_subadditive_finite)
15.975 + also have "\<dots> < \<infinity>"
15.976 + using F by (auto simp: setsum_Pinfty)
15.977 + finally show "emeasure M (\<Union> i\<le>n. F i) \<noteq> \<infinity>" by simp
15.978 + qed (force simp: incseq_def)+
15.979 +qed
15.980 +
15.981 +section {* Measure space induced by distribution of @{const measurable}-functions *}
15.982 +
15.983 +definition distr :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b measure" where
15.984 + "distr M N f = measure_of (space N) (sets N) (\<lambda>A. emeasure M (f -` A \<inter> space M))"
15.985 +
15.986 +lemma
15.987 + shows sets_distr[simp]: "sets (distr M N f) = sets N"
15.988 + and space_distr[simp]: "space (distr M N f) = space N"
15.989 + by (auto simp: distr_def)
15.990 +
15.991 +lemma
15.992 + shows measurable_distr_eq1[simp]: "measurable (distr Mf Nf f) Mf' = measurable Nf Mf'"
15.993 + and measurable_distr_eq2[simp]: "measurable Mg' (distr Mg Ng g) = measurable Mg' Ng"
15.994 + by (auto simp: measurable_def)
15.995 +
15.996 +lemma emeasure_distr:
15.997 + fixes f :: "'a \<Rightarrow> 'b"
15.998 + assumes f: "f \<in> measurable M N" and A: "A \<in> sets N"
15.999 + shows "emeasure (distr M N f) A = emeasure M (f -` A \<inter> space M)" (is "_ = ?\<mu> A")
15.1000 + unfolding distr_def
15.1001 +proof (rule emeasure_measure_of_sigma)
15.1002 + show "positive (sets N) ?\<mu>"
15.1003 + by (auto simp: positive_def)
15.1004 +
15.1005 + show "countably_additive (sets N) ?\<mu>"
15.1006 + proof (intro countably_additiveI)
15.1007 + fix A :: "nat \<Rightarrow> 'b set" assume "range A \<subseteq> sets N" "disjoint_family A"
15.1008 + then have A: "\<And>i. A i \<in> sets N" "(\<Union>i. A i) \<in> sets N" by auto
15.1009 + then have *: "range (\<lambda>i. f -` (A i) \<inter> space M) \<subseteq> sets M"
15.1010 + using f by (auto simp: measurable_def)
15.1011 + moreover have "(\<Union>i. f -` A i \<inter> space M) \<in> sets M"
15.1012 + using * by blast
15.1013 + moreover have **: "disjoint_family (\<lambda>i. f -` A i \<inter> space M)"
15.1014 + using `disjoint_family A` by (auto simp: disjoint_family_on_def)
15.1015 + ultimately show "(\<Sum>i. ?\<mu> (A i)) = ?\<mu> (\<Union>i. A i)"
15.1016 + using suminf_emeasure[OF _ **] A f
15.1017 + by (auto simp: comp_def vimage_UN)
15.1018 + qed
15.1019 + show "sigma_algebra (space N) (sets N)" ..
15.1020 +qed fact
15.1021 +
15.1022 +lemma AE_distrD:
15.1023 + assumes f: "f \<in> measurable M M'"
15.1024 + and AE: "AE x in distr M M' f. P x"
15.1025 + shows "AE x in M. P (f x)"
15.1026 +proof -
15.1027 + from AE[THEN AE_E] guess N .
15.1028 + with f show ?thesis
15.1029 + unfolding eventually_ae_filter
15.1030 + by (intro bexI[of _ "f -` N \<inter> space M"])
15.1031 + (auto simp: emeasure_distr measurable_def)
15.1032 +qed
15.1033 +
15.1034 +lemma null_sets_distr_iff:
15.1035 + "f \<in> measurable M N \<Longrightarrow> A \<in> null_sets (distr M N f) \<longleftrightarrow> f -` A \<inter> space M \<in> null_sets M \<and> A \<in> sets N"
15.1036 + by (auto simp add: null_sets_def emeasure_distr measurable_sets)
15.1037 +
15.1038 +lemma distr_distr:
15.1039 + assumes f: "g \<in> measurable N L" and g: "f \<in> measurable M N"
15.1040 + shows "distr (distr M N f) L g = distr M L (g \<circ> f)" (is "?L = ?R")
15.1041 + using measurable_comp[OF g f] f g
15.1042 + by (auto simp add: emeasure_distr measurable_sets measurable_space
15.1043 + intro!: arg_cong[where f="emeasure M"] measure_eqI)
15.1044 +
15.1045 +section {* Real measure values *}
15.1046 +
15.1047 +lemma measure_nonneg: "0 \<le> measure M A"
15.1048 + using emeasure_nonneg[of M A] unfolding measure_def by (auto intro: real_of_ereal_pos)
15.1049 +
15.1050 +lemma measure_empty[simp]: "measure M {} = 0"
15.1051 + unfolding measure_def by simp
15.1052 +
15.1053 +lemma emeasure_eq_ereal_measure:
15.1054 + "emeasure M A \<noteq> \<infinity> \<Longrightarrow> emeasure M A = ereal (measure M A)"
15.1055 + using emeasure_nonneg[of M A]
15.1056 + by (cases "emeasure M A") (auto simp: measure_def)
15.1057 +
15.1058 +lemma measure_Union:
15.1059 + assumes finite: "emeasure M A \<noteq> \<infinity>" "emeasure M B \<noteq> \<infinity>"
15.1060 + and measurable: "A \<in> sets M" "B \<in> sets M" "A \<inter> B = {}"
15.1061 + shows "measure M (A \<union> B) = measure M A + measure M B"
15.1062 + unfolding measure_def
15.1063 + using plus_emeasure[OF measurable, symmetric] finite
15.1064 + by (simp add: emeasure_eq_ereal_measure)
15.1065 +
15.1066 +lemma measure_finite_Union:
15.1067 + assumes measurable: "A`S \<subseteq> sets M" "disjoint_family_on A S" "finite S"
15.1068 + assumes finite: "\<And>i. i \<in> S \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>"
15.1069 + shows "measure M (\<Union>i\<in>S. A i) = (\<Sum>i\<in>S. measure M (A i))"
15.1070 + unfolding measure_def
15.1071 + using setsum_emeasure[OF measurable, symmetric] finite
15.1072 + by (simp add: emeasure_eq_ereal_measure)
15.1073 +
15.1074 +lemma measure_Diff:
15.1075 + assumes finite: "emeasure M A \<noteq> \<infinity>"
15.1076 + and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
15.1077 + shows "measure M (A - B) = measure M A - measure M B"
15.1078 +proof -
15.1079 + have "emeasure M (A - B) \<le> emeasure M A" "emeasure M B \<le> emeasure M A"
15.1080 + using measurable by (auto intro!: emeasure_mono)
15.1081 + hence "measure M ((A - B) \<union> B) = measure M (A - B) + measure M B"
15.1082 + using measurable finite by (rule_tac measure_Union) auto
15.1083 + thus ?thesis using `B \<subseteq> A` by (auto simp: Un_absorb2)
15.1084 +qed
15.1085 +
15.1086 +lemma measure_UNION:
15.1087 + assumes measurable: "range A \<subseteq> sets M" "disjoint_family A"
15.1088 + assumes finite: "emeasure M (\<Union>i. A i) \<noteq> \<infinity>"
15.1089 + shows "(\<lambda>i. measure M (A i)) sums (measure M (\<Union>i. A i))"
15.1090 +proof -
15.1091 + from summable_sums[OF summable_ereal_pos, of "\<lambda>i. emeasure M (A i)"]
15.1092 + suminf_emeasure[OF measurable] emeasure_nonneg[of M]
15.1093 + have "(\<lambda>i. emeasure M (A i)) sums (emeasure M (\<Union>i. A i))" by simp
15.1094 + moreover
15.1095 + { fix i
15.1096 + have "emeasure M (A i) \<le> emeasure M (\<Union>i. A i)"
15.1097 + using measurable by (auto intro!: emeasure_mono)
15.1098 + then have "emeasure M (A i) = ereal ((measure M (A i)))"
15.1099 + using finite by (intro emeasure_eq_ereal_measure) auto }
15.1100 + ultimately show ?thesis using finite
15.1101 + unfolding sums_ereal[symmetric] by (simp add: emeasure_eq_ereal_measure)
15.1102 +qed
15.1103 +
15.1104 +lemma measure_subadditive:
15.1105 + assumes measurable: "A \<in> sets M" "B \<in> sets M"
15.1106 + and fin: "emeasure M A \<noteq> \<infinity>" "emeasure M B \<noteq> \<infinity>"
15.1107 + shows "(measure M (A \<union> B)) \<le> (measure M A) + (measure M B)"
15.1108 +proof -
15.1109 + have "emeasure M (A \<union> B) \<noteq> \<infinity>"
15.1110 + using emeasure_subadditive[OF measurable] fin by auto
15.1111 + then show "(measure M (A \<union> B)) \<le> (measure M A) + (measure M B)"
15.1112 + using emeasure_subadditive[OF measurable] fin
15.1113 + by (auto simp: emeasure_eq_ereal_measure)
15.1114 +qed
15.1115 +
15.1116 +lemma measure_subadditive_finite:
15.1117 + assumes A: "finite I" "A`I \<subseteq> sets M" and fin: "\<And>i. i \<in> I \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>"
15.1118 + shows "measure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. measure M (A i))"
15.1119 +proof -
15.1120 + { have "emeasure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. emeasure M (A i))"
15.1121 + using emeasure_subadditive_finite[OF A] .
15.1122 + also have "\<dots> < \<infinity>"
15.1123 + using fin by (simp add: setsum_Pinfty)
15.1124 + finally have "emeasure M (\<Union>i\<in>I. A i) \<noteq> \<infinity>" by simp }
15.1125 + then show ?thesis
15.1126 + using emeasure_subadditive_finite[OF A] fin
15.1127 + unfolding measure_def by (simp add: emeasure_eq_ereal_measure suminf_ereal measure_nonneg)
15.1128 +qed
15.1129 +
15.1130 +lemma measure_subadditive_countably:
15.1131 + assumes A: "range A \<subseteq> sets M" and fin: "(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>"
15.1132 + shows "measure M (\<Union>i. A i) \<le> (\<Sum>i. measure M (A i))"
15.1133 +proof -
15.1134 + from emeasure_nonneg fin have "\<And>i. emeasure M (A i) \<noteq> \<infinity>" by (rule suminf_PInfty)
15.1135 + moreover
15.1136 + { have "emeasure M (\<Union>i. A i) \<le> (\<Sum>i. emeasure M (A i))"
15.1137 + using emeasure_subadditive_countably[OF A] .
15.1138 + also have "\<dots> < \<infinity>"
15.1139 + using fin by simp
15.1140 + finally have "emeasure M (\<Union>i. A i) \<noteq> \<infinity>" by simp }
15.1141 + ultimately show ?thesis
15.1142 + using emeasure_subadditive_countably[OF A] fin
15.1143 + unfolding measure_def by (simp add: emeasure_eq_ereal_measure suminf_ereal measure_nonneg)
15.1144 +qed
15.1145 +
15.1146 +lemma measure_eq_setsum_singleton:
15.1147 + assumes S: "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
15.1148 + and fin: "\<And>x. x \<in> S \<Longrightarrow> emeasure M {x} \<noteq> \<infinity>"
15.1149 + shows "(measure M S) = (\<Sum>x\<in>S. (measure M {x}))"
15.1150 + unfolding measure_def
15.1151 + using emeasure_eq_setsum_singleton[OF S] fin
15.1152 + by simp (simp add: emeasure_eq_ereal_measure)
15.1153 +
15.1154 +lemma Lim_measure_incseq:
15.1155 + assumes A: "range A \<subseteq> sets M" "incseq A" and fin: "emeasure M (\<Union>i. A i) \<noteq> \<infinity>"
15.1156 + shows "(\<lambda>i. (measure M (A i))) ----> (measure M (\<Union>i. A i))"
15.1157 +proof -
15.1158 + have "ereal ((measure M (\<Union>i. A i))) = emeasure M (\<Union>i. A i)"
15.1159 + using fin by (auto simp: emeasure_eq_ereal_measure)
15.1160 + then show ?thesis
15.1161 + using Lim_emeasure_incseq[OF A]
15.1162 + unfolding measure_def
15.1163 + by (intro lim_real_of_ereal) simp
15.1164 +qed
15.1165 +
15.1166 +lemma Lim_measure_decseq:
15.1167 + assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
15.1168 + shows "(\<lambda>n. measure M (A n)) ----> measure M (\<Inter>i. A i)"
15.1169 +proof -
15.1170 + have "emeasure M (\<Inter>i. A i) \<le> emeasure M (A 0)"
15.1171 + using A by (auto intro!: emeasure_mono)
15.1172 + also have "\<dots> < \<infinity>"
15.1173 + using fin[of 0] by auto
15.1174 + finally have "ereal ((measure M (\<Inter>i. A i))) = emeasure M (\<Inter>i. A i)"
15.1175 + by (auto simp: emeasure_eq_ereal_measure)
15.1176 + then show ?thesis
15.1177 + unfolding measure_def
15.1178 + using Lim_emeasure_decseq[OF A fin]
15.1179 + by (intro lim_real_of_ereal) simp
15.1180 +qed
15.1181 +
15.1182 +section {* Measure spaces with @{term "emeasure M (space M) < \<infinity>"} *}
15.1183 +
15.1184 +locale finite_measure = sigma_finite_measure M for M +
15.1185 + assumes finite_emeasure_space: "emeasure M (space M) \<noteq> \<infinity>"
15.1186 +
15.1187 +lemma finite_measureI[Pure.intro!]:
15.1188 + assumes *: "emeasure M (space M) \<noteq> \<infinity>"
15.1189 + shows "finite_measure M"
15.1190 +proof
15.1191 + show "\<exists>A. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. emeasure M (A i) \<noteq> \<infinity>)"
15.1192 + using * by (auto intro!: exI[of _ "\<lambda>_. space M"])
15.1193 +qed fact
15.1194 +
15.1195 +lemma (in finite_measure) emeasure_finite[simp, intro]: "emeasure M A \<noteq> \<infinity>"
15.1196 + using finite_emeasure_space emeasure_space[of M A] by auto
15.1197 +
15.1198 +lemma (in finite_measure) emeasure_eq_measure: "emeasure M A = ereal (measure M A)"
15.1199 + unfolding measure_def by (simp add: emeasure_eq_ereal_measure)
15.1200 +
15.1201 +lemma (in finite_measure) emeasure_real: "\<exists>r. 0 \<le> r \<and> emeasure M A = ereal r"
15.1202 + using emeasure_finite[of A] emeasure_nonneg[of M A] by (cases "emeasure M A") auto
15.1203 +
15.1204 +lemma (in finite_measure) bounded_measure: "measure M A \<le> measure M (space M)"
15.1205 + using emeasure_space[of M A] emeasure_real[of A] emeasure_real[of "space M"] by (auto simp: measure_def)
15.1206 +
15.1207 +lemma (in finite_measure) finite_measure_Diff:
15.1208 + assumes sets: "A \<in> sets M" "B \<in> sets M" and "B \<subseteq> A"
15.1209 + shows "measure M (A - B) = measure M A - measure M B"
15.1210 + using measure_Diff[OF _ assms] by simp
15.1211 +
15.1212 +lemma (in finite_measure) finite_measure_Union:
15.1213 + assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}"
15.1214 + shows "measure M (A \<union> B) = measure M A + measure M B"
15.1215 + using measure_Union[OF _ _ assms] by simp
15.1216 +
15.1217 +lemma (in finite_measure) finite_measure_finite_Union:
15.1218 + assumes measurable: "A`S \<subseteq> sets M" "disjoint_family_on A S" "finite S"
15.1219 + shows "measure M (\<Union>i\<in>S. A i) = (\<Sum>i\<in>S. measure M (A i))"
15.1220 + using measure_finite_Union[OF assms] by simp
15.1221 +
15.1222 +lemma (in finite_measure) finite_measure_UNION:
15.1223 + assumes A: "range A \<subseteq> sets M" "disjoint_family A"
15.1224 + shows "(\<lambda>i. measure M (A i)) sums (measure M (\<Union>i. A i))"
15.1225 + using measure_UNION[OF A] by simp
15.1226 +
15.1227 +lemma (in finite_measure) finite_measure_mono:
15.1228 + assumes "A \<subseteq> B" "B \<in> sets M" shows "measure M A \<le> measure M B"
15.1229 + using emeasure_mono[OF assms] emeasure_real[of A] emeasure_real[of B] by (auto simp: measure_def)
15.1230 +
15.1231 +lemma (in finite_measure) finite_measure_subadditive:
15.1232 + assumes m: "A \<in> sets M" "B \<in> sets M"
15.1233 + shows "measure M (A \<union> B) \<le> measure M A + measure M B"
15.1234 + using measure_subadditive[OF m] by simp
15.1235 +
15.1236 +lemma (in finite_measure) finite_measure_subadditive_finite:
15.1237 + assumes "finite I" "A`I \<subseteq> sets M" shows "measure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. measure M (A i))"
15.1238 + using measure_subadditive_finite[OF assms] by simp
15.1239 +
15.1240 +lemma (in finite_measure) finite_measure_subadditive_countably:
15.1241 + assumes A: "range A \<subseteq> sets M" and sum: "summable (\<lambda>i. measure M (A i))"
15.1242 + shows "measure M (\<Union>i. A i) \<le> (\<Sum>i. measure M (A i))"
15.1243 +proof -
15.1244 + from `summable (\<lambda>i. measure M (A i))`
15.1245 + have "(\<lambda>i. ereal (measure M (A i))) sums ereal (\<Sum>i. measure M (A i))"
15.1246 + by (simp add: sums_ereal) (rule summable_sums)
15.1247 + from sums_unique[OF this, symmetric]
15.1248 + measure_subadditive_countably[OF A]
15.1249 + show ?thesis by (simp add: emeasure_eq_measure)
15.1250 +qed
15.1251 +
15.1252 +lemma (in finite_measure) finite_measure_eq_setsum_singleton:
15.1253 + assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
15.1254 + shows "measure M S = (\<Sum>x\<in>S. measure M {x})"
15.1255 + using measure_eq_setsum_singleton[OF assms] by simp
15.1256 +
15.1257 +lemma (in finite_measure) finite_Lim_measure_incseq:
15.1258 + assumes A: "range A \<subseteq> sets M" "incseq A"
15.1259 + shows "(\<lambda>i. measure M (A i)) ----> measure M (\<Union>i. A i)"
15.1260 + using Lim_measure_incseq[OF A] by simp
15.1261 +
15.1262 +lemma (in finite_measure) finite_Lim_measure_decseq:
15.1263 + assumes A: "range A \<subseteq> sets M" "decseq A"
15.1264 + shows "(\<lambda>n. measure M (A n)) ----> measure M (\<Inter>i. A i)"
15.1265 + using Lim_measure_decseq[OF A] by simp
15.1266 +
15.1267 +lemma (in finite_measure) finite_measure_compl:
15.1268 + assumes S: "S \<in> sets M"
15.1269 + shows "measure M (space M - S) = measure M (space M) - measure M S"
15.1270 + using measure_Diff[OF _ top S sets_into_space] S by simp
15.1271 +
15.1272 +lemma (in finite_measure) finite_measure_mono_AE:
15.1273 + assumes imp: "AE x in M. x \<in> A \<longrightarrow> x \<in> B" and B: "B \<in> sets M"
15.1274 + shows "measure M A \<le> measure M B"
15.1275 + using assms emeasure_mono_AE[OF imp B]
15.1276 + by (simp add: emeasure_eq_measure)
15.1277 +
15.1278 +lemma (in finite_measure) finite_measure_eq_AE:
15.1279 + assumes iff: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
15.1280 + assumes A: "A \<in> sets M" and B: "B \<in> sets M"
15.1281 + shows "measure M A = measure M B"
15.1282 + using assms emeasure_eq_AE[OF assms] by (simp add: emeasure_eq_measure)
15.1283 +
15.1284 +section {* Counting space *}
15.1285 +
15.1286 +definition count_space :: "'a set \<Rightarrow> 'a measure" where
15.1287 + "count_space \<Omega> = measure_of \<Omega> (Pow \<Omega>) (\<lambda>A. if finite A then ereal (card A) else \<infinity>)"
15.1288 +
15.1289 +lemma
15.1290 + shows space_count_space[simp]: "space (count_space \<Omega>) = \<Omega>"
15.1291 + and sets_count_space[simp]: "sets (count_space \<Omega>) = Pow \<Omega>"
15.1292 + using sigma_sets_into_sp[of "Pow \<Omega>" \<Omega>]
15.1293 + by (auto simp: count_space_def)
15.1294 +
15.1295 +lemma measurable_count_space_eq1[simp]:
15.1296 + "f \<in> measurable (count_space A) M \<longleftrightarrow> f \<in> A \<rightarrow> space M"
15.1297 + unfolding measurable_def by simp
15.1298 +
15.1299 +lemma measurable_count_space_eq2[simp]:
15.1300 + assumes "finite A"
15.1301 + shows "f \<in> measurable M (count_space A) \<longleftrightarrow> (f \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M))"
15.1302 +proof -
15.1303 + { fix X assume "X \<subseteq> A" "f \<in> space M \<rightarrow> A"
15.1304 + with `finite A` have "f -` X \<inter> space M = (\<Union>a\<in>X. f -` {a} \<inter> space M)" "finite X"
15.1305 + by (auto dest: finite_subset)
15.1306 + moreover assume "\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M"
15.1307 + ultimately have "f -` X \<inter> space M \<in> sets M"
15.1308 + using `X \<subseteq> A` by (auto intro!: finite_UN simp del: UN_simps) }
15.1309 + then show ?thesis
15.1310 + unfolding measurable_def by auto
15.1311 +qed
15.1312 +
15.1313 +lemma emeasure_count_space:
15.1314 + assumes "X \<subseteq> A" shows "emeasure (count_space A) X = (if finite X then ereal (card X) else \<infinity>)"
15.1315 + (is "_ = ?M X")
15.1316 + unfolding count_space_def
15.1317 +proof (rule emeasure_measure_of_sigma)
15.1318 + show "sigma_algebra A (Pow A)" by (rule sigma_algebra_Pow)
15.1319 +
15.1320 + show "positive (Pow A) ?M"
15.1321 + by (auto simp: positive_def)
15.1322 +
15.1323 + show "countably_additive (Pow A) ?M"
15.1324 + proof (unfold countably_additive_def, safe)
15.1325 + fix F :: "nat \<Rightarrow> 'a set" assume disj: "disjoint_family F"
15.1326 + show "(\<Sum>i. ?M (F i)) = ?M (\<Union>i. F i)"
15.1327 + proof cases
15.1328 + assume "\<forall>i. finite (F i)"
15.1329 + then have finite_F: "\<And>i. finite (F i)" by auto
15.1330 + have "\<forall>i\<in>{i. F i \<noteq> {}}. \<exists>x. x \<in> F i" by auto
15.1331 + from bchoice[OF this] obtain f where f: "\<And>i. F i \<noteq> {} \<Longrightarrow> f i \<in> F i" by auto
15.1332 +
15.1333 + have inj_f: "inj_on f {i. F i \<noteq> {}}"
15.1334 + proof (rule inj_onI, simp)
15.1335 + fix i j a b assume *: "f i = f j" "F i \<noteq> {}" "F j \<noteq> {}"
15.1336 + then have "f i \<in> F i" "f j \<in> F j" using f by force+
15.1337 + with disj * show "i = j" by (auto simp: disjoint_family_on_def)
15.1338 + qed
15.1339 + have fin_eq: "finite (\<Union>i. F i) \<longleftrightarrow> finite {i. F i \<noteq> {}}"
15.1340 + proof
15.1341 + assume "finite (\<Union>i. F i)"
15.1342 + show "finite {i. F i \<noteq> {}}"
15.1343 + proof (rule finite_imageD)
15.1344 + from f have "f`{i. F i \<noteq> {}} \<subseteq> (\<Union>i. F i)" by auto
15.1345 + then show "finite (f`{i. F i \<noteq> {}})"
15.1346 + by (rule finite_subset) fact
15.1347 + qed fact
15.1348 + next
15.1349 + assume "finite {i. F i \<noteq> {}}"
15.1350 + with finite_F have "finite (\<Union>i\<in>{i. F i \<noteq> {}}. F i)"
15.1351 + by auto
15.1352 + also have "(\<Union>i\<in>{i. F i \<noteq> {}}. F i) = (\<Union>i. F i)"
15.1353 + by auto
15.1354 + finally show "finite (\<Union>i. F i)" .
15.1355 + qed
15.1356 +
15.1357 + show ?thesis
15.1358 + proof cases
15.1359 + assume *: "finite (\<Union>i. F i)"
15.1360 + with finite_F have "finite {i. ?M (F i) \<noteq> 0} "
15.1361 + by (simp add: fin_eq)
15.1362 + then have "(\<Sum>i. ?M (F i)) = (\<Sum>i | ?M (F i) \<noteq> 0. ?M (F i))"
15.1363 + by (rule suminf_eq_setsum)
15.1364 + also have "\<dots> = ereal (\<Sum>i | F i \<noteq> {}. card (F i))"
15.1365 + using finite_F by simp
15.1366 + also have "\<dots> = ereal (card (\<Union>i \<in> {i. F i \<noteq> {}}. F i))"
15.1367 + using * finite_F disj
15.1368 + by (subst card_UN_disjoint) (auto simp: disjoint_family_on_def fin_eq)
15.1369 + also have "\<dots> = ?M (\<Union>i. F i)"
15.1370 + using * by (auto intro!: arg_cong[where f=card])
15.1371 + finally show ?thesis .
15.1372 + next
15.1373 + assume inf: "infinite (\<Union>i. F i)"
15.1374 + { fix i
15.1375 + have "\<exists>N. i \<le> (\<Sum>i<N. card (F i))"
15.1376 + proof (induct i)
15.1377 + case (Suc j)
15.1378 + from Suc obtain N where N: "j \<le> (\<Sum>i<N. card (F i))" by auto
15.1379 + have "infinite ({i. F i \<noteq> {}} - {..< N})"
15.1380 + using inf by (auto simp: fin_eq)
15.1381 + then have "{i. F i \<noteq> {}} - {..< N} \<noteq> {}"
15.1382 + by (metis finite.emptyI)
15.1383 + then obtain i where i: "F i \<noteq> {}" "N \<le> i"
15.1384 + by (auto simp: not_less[symmetric])
15.1385 +
15.1386 + note N
15.1387 + also have "(\<Sum>i<N. card (F i)) \<le> (\<Sum>i<i. card (F i))"
15.1388 + by (rule setsum_mono2) (auto simp: i)
15.1389 + also have "\<dots> < (\<Sum>i<i. card (F i)) + card (F i)"
15.1390 + using finite_F `F i \<noteq> {}` by (simp add: card_gt_0_iff)
15.1391 + finally have "j < (\<Sum>i<Suc i. card (F i))"
15.1392 + by simp
15.1393 + then show ?case unfolding Suc_le_eq by blast
15.1394 + qed simp }
15.1395 + with finite_F inf show ?thesis
15.1396 + by (auto simp del: real_of_nat_setsum intro!: SUP_PInfty
15.1397 + simp add: suminf_ereal_eq_SUPR real_of_nat_setsum[symmetric])
15.1398 + qed
15.1399 + next
15.1400 + assume "\<not> (\<forall>i. finite (F i))"
15.1401 + then obtain j where j: "infinite (F j)" by auto
15.1402 + then have "infinite (\<Union>i. F i)"
15.1403 + using finite_subset[of "F j" "\<Union>i. F i"] by auto
15.1404 + moreover have "\<And>i. 0 \<le> ?M (F i)" by auto
15.1405 + ultimately show ?thesis
15.1406 + using suminf_PInfty[of "\<lambda>i. ?M (F i)" j] j by auto
15.1407 + qed
15.1408 + qed
15.1409 + show "X \<in> Pow A" using `X \<subseteq> A` by simp
15.1410 +qed
15.1411 +
15.1412 +lemma emeasure_count_space_finite[simp]:
15.1413 + "X \<subseteq> A \<Longrightarrow> finite X \<Longrightarrow> emeasure (count_space A) X = ereal (card X)"
15.1414 + using emeasure_count_space[of X A] by simp
15.1415 +
15.1416 +lemma emeasure_count_space_infinite[simp]:
15.1417 + "X \<subseteq> A \<Longrightarrow> infinite X \<Longrightarrow> emeasure (count_space A) X = \<infinity>"
15.1418 + using emeasure_count_space[of X A] by simp
15.1419 +
15.1420 +lemma emeasure_count_space_eq_0:
15.1421 + "emeasure (count_space A) X = 0 \<longleftrightarrow> (X \<subseteq> A \<longrightarrow> X = {})"
15.1422 +proof cases
15.1423 + assume X: "X \<subseteq> A"
15.1424 + then show ?thesis
15.1425 + proof (intro iffI impI)
15.1426 + assume "emeasure (count_space A) X = 0"
15.1427 + with X show "X = {}"
15.1428 + by (subst (asm) emeasure_count_space) (auto split: split_if_asm)
15.1429 + qed simp
15.1430 +qed (simp add: emeasure_notin_sets)
15.1431 +
15.1432 +lemma null_sets_count_space: "null_sets (count_space A) = { {} }"
15.1433 + unfolding null_sets_def by (auto simp add: emeasure_count_space_eq_0)
15.1434 +
15.1435 +lemma AE_count_space: "(AE x in count_space A. P x) \<longleftrightarrow> (\<forall>x\<in>A. P x)"
15.1436 + unfolding eventually_ae_filter by (auto simp add: null_sets_count_space)
15.1437 +
15.1438 +lemma sigma_finite_measure_count_space:
15.1439 + fixes A :: "'a::countable set"
15.1440 + shows "sigma_finite_measure (count_space A)"
15.1441 +proof
15.1442 + show "\<exists>F::nat \<Rightarrow> 'a set. range F \<subseteq> sets (count_space A) \<and> (\<Union>i. F i) = space (count_space A) \<and>
15.1443 + (\<forall>i. emeasure (count_space A) (F i) \<noteq> \<infinity>)"
15.1444 + using surj_from_nat by (intro exI[of _ "\<lambda>i. {from_nat i} \<inter> A"]) (auto simp del: surj_from_nat)
15.1445 +qed
15.1446 +
15.1447 +lemma finite_measure_count_space:
15.1448 + assumes [simp]: "finite A"
15.1449 + shows "finite_measure (count_space A)"
15.1450 + by rule simp
15.1451 +
15.1452 +lemma sigma_finite_measure_count_space_finite:
15.1453 + assumes A: "finite A" shows "sigma_finite_measure (count_space A)"
15.1454 +proof -
15.1455 + interpret finite_measure "count_space A" using A by (rule finite_measure_count_space)
15.1456 + show "sigma_finite_measure (count_space A)" ..
15.1457 +qed
15.1458 +
15.1459 +end
15.1460 +
16.1 --- a/src/HOL/Probability/Probability.thy Mon Apr 23 12:23:23 2012 +0100
16.2 +++ b/src/HOL/Probability/Probability.thy Mon Apr 23 12:14:35 2012 +0200
16.3 @@ -4,7 +4,7 @@
16.4 Probability_Measure
16.5 Infinite_Product_Measure
16.6 Independent_Family
16.7 - Conditional_Probability
16.8 Information
16.9 begin
16.10 +
16.11 end
17.1 --- a/src/HOL/Probability/Probability_Measure.thy Mon Apr 23 12:23:23 2012 +0100
17.2 +++ b/src/HOL/Probability/Probability_Measure.thy Mon Apr 23 12:14:35 2012 +0200
17.3 @@ -6,110 +6,219 @@
17.4 header {*Probability measure*}
17.5
17.6 theory Probability_Measure
17.7 -imports Lebesgue_Measure
17.8 + imports Lebesgue_Measure Radon_Nikodym
17.9 begin
17.10
17.11 +lemma funset_eq_UN_fun_upd_I:
17.12 + assumes *: "\<And>f. f \<in> F (insert a A) \<Longrightarrow> f(a := d) \<in> F A"
17.13 + and **: "\<And>f. f \<in> F (insert a A) \<Longrightarrow> f a \<in> G (f(a:=d))"
17.14 + and ***: "\<And>f x. \<lbrakk> f \<in> F A ; x \<in> G f \<rbrakk> \<Longrightarrow> f(a:=x) \<in> F (insert a A)"
17.15 + shows "F (insert a A) = (\<Union>f\<in>F A. fun_upd f a ` (G f))"
17.16 +proof safe
17.17 + fix f assume f: "f \<in> F (insert a A)"
17.18 + show "f \<in> (\<Union>f\<in>F A. fun_upd f a ` G f)"
17.19 + proof (rule UN_I[of "f(a := d)"])
17.20 + show "f(a := d) \<in> F A" using *[OF f] .
17.21 + show "f \<in> fun_upd (f(a:=d)) a ` G (f(a:=d))"
17.22 + proof (rule image_eqI[of _ _ "f a"])
17.23 + show "f a \<in> G (f(a := d))" using **[OF f] .
17.24 + qed simp
17.25 + qed
17.26 +next
17.27 + fix f x assume "f \<in> F A" "x \<in> G f"
17.28 + from ***[OF this] show "f(a := x) \<in> F (insert a A)" .
17.29 +qed
17.30 +
17.31 +lemma extensional_funcset_insert_eq[simp]:
17.32 + assumes "a \<notin> A"
17.33 + shows "extensional (insert a A) \<inter> (insert a A \<rightarrow> B) = (\<Union>f \<in> extensional A \<inter> (A \<rightarrow> B). (\<lambda>b. f(a := b)) ` B)"
17.34 + apply (rule funset_eq_UN_fun_upd_I)
17.35 + using assms
17.36 + by (auto intro!: inj_onI dest: inj_onD split: split_if_asm simp: extensional_def)
17.37 +
17.38 +lemma finite_extensional_funcset[simp, intro]:
17.39 + assumes "finite A" "finite B"
17.40 + shows "finite (extensional A \<inter> (A \<rightarrow> B))"
17.41 + using assms by induct auto
17.42 +
17.43 +lemma finite_PiE[simp, intro]:
17.44 + assumes fin: "finite A" "\<And>i. i \<in> A \<Longrightarrow> finite (B i)"
17.45 + shows "finite (Pi\<^isub>E A B)"
17.46 +proof -
17.47 + have *: "(Pi\<^isub>E A B) \<subseteq> extensional A \<inter> (A \<rightarrow> (\<Union>i\<in>A. B i))" by auto
17.48 + show ?thesis
17.49 + using fin by (intro finite_subset[OF *] finite_extensional_funcset) auto
17.50 +qed
17.51 +
17.52 +
17.53 +lemma countably_additiveI[case_names countably]:
17.54 + assumes "\<And>A. \<lbrakk> range A \<subseteq> M ; disjoint_family A ; (\<Union>i. A i) \<in> M\<rbrakk> \<Longrightarrow> (\<Sum>n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
17.55 + shows "countably_additive M \<mu>"
17.56 + using assms unfolding countably_additive_def by auto
17.57 +
17.58 +lemma convex_le_Inf_differential:
17.59 + fixes f :: "real \<Rightarrow> real"
17.60 + assumes "convex_on I f"
17.61 + assumes "x \<in> interior I" "y \<in> I"
17.62 + shows "f y \<ge> f x + Inf ((\<lambda>t. (f x - f t) / (x - t)) ` ({x<..} \<inter> I)) * (y - x)"
17.63 + (is "_ \<ge> _ + Inf (?F x) * (y - x)")
17.64 +proof -
17.65 + show ?thesis
17.66 + proof (cases rule: linorder_cases)
17.67 + assume "x < y"
17.68 + moreover
17.69 + have "open (interior I)" by auto
17.70 + from openE[OF this `x \<in> interior I`] guess e . note e = this
17.71 + moreover def t \<equiv> "min (x + e / 2) ((x + y) / 2)"
17.72 + ultimately have "x < t" "t < y" "t \<in> ball x e"
17.73 + by (auto simp: dist_real_def field_simps split: split_min)
17.74 + with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
17.75 +
17.76 + have "open (interior I)" by auto
17.77 + from openE[OF this `x \<in> interior I`] guess e .
17.78 + moreover def K \<equiv> "x - e / 2"
17.79 + with `0 < e` have "K \<in> ball x e" "K < x" by (auto simp: dist_real_def)
17.80 + ultimately have "K \<in> I" "K < x" "x \<in> I"
17.81 + using interior_subset[of I] `x \<in> interior I` by auto
17.82 +
17.83 + have "Inf (?F x) \<le> (f x - f y) / (x - y)"
17.84 + proof (rule Inf_lower2)
17.85 + show "(f x - f t) / (x - t) \<in> ?F x"
17.86 + using `t \<in> I` `x < t` by auto
17.87 + show "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)"
17.88 + using `convex_on I f` `x \<in> I` `y \<in> I` `x < t` `t < y` by (rule convex_on_diff)
17.89 + next
17.90 + fix y assume "y \<in> ?F x"
17.91 + with order_trans[OF convex_on_diff[OF `convex_on I f` `K \<in> I` _ `K < x` _]]
17.92 + show "(f K - f x) / (K - x) \<le> y" by auto
17.93 + qed
17.94 + then show ?thesis
17.95 + using `x < y` by (simp add: field_simps)
17.96 + next
17.97 + assume "y < x"
17.98 + moreover
17.99 + have "open (interior I)" by auto
17.100 + from openE[OF this `x \<in> interior I`] guess e . note e = this
17.101 + moreover def t \<equiv> "x + e / 2"
17.102 + ultimately have "x < t" "t \<in> ball x e"
17.103 + by (auto simp: dist_real_def field_simps)
17.104 + with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
17.105 +
17.106 + have "(f x - f y) / (x - y) \<le> Inf (?F x)"
17.107 + proof (rule Inf_greatest)
17.108 + have "(f x - f y) / (x - y) = (f y - f x) / (y - x)"
17.109 + using `y < x` by (auto simp: field_simps)
17.110 + also
17.111 + fix z assume "z \<in> ?F x"
17.112 + with order_trans[OF convex_on_diff[OF `convex_on I f` `y \<in> I` _ `y < x`]]
17.113 + have "(f y - f x) / (y - x) \<le> z" by auto
17.114 + finally show "(f x - f y) / (x - y) \<le> z" .
17.115 + next
17.116 + have "open (interior I)" by auto
17.117 + from openE[OF this `x \<in> interior I`] guess e . note e = this
17.118 + then have "x + e / 2 \<in> ball x e" by (auto simp: dist_real_def)
17.119 + with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I" by auto
17.120 + then show "?F x \<noteq> {}" by blast
17.121 + qed
17.122 + then show ?thesis
17.123 + using `y < x` by (simp add: field_simps)
17.124 + qed simp
17.125 +qed
17.126 +
17.127 +lemma distr_id[simp]: "distr N N (\<lambda>x. x) = N"
17.128 + by (rule measure_eqI) (auto simp: emeasure_distr)
17.129 +
17.130 locale prob_space = finite_measure +
17.131 - assumes measure_space_1: "measure M (space M) = 1"
17.132 + assumes emeasure_space_1: "emeasure M (space M) = 1"
17.133
17.134 lemma prob_spaceI[Pure.intro!]:
17.135 - assumes "measure_space M"
17.136 - assumes *: "measure M (space M) = 1"
17.137 + assumes *: "emeasure M (space M) = 1"
17.138 shows "prob_space M"
17.139 proof -
17.140 interpret finite_measure M
17.141 proof
17.142 - show "measure_space M" by fact
17.143 - show "measure M (space M) \<noteq> \<infinity>" using * by simp
17.144 + show "emeasure M (space M) \<noteq> \<infinity>" using * by simp
17.145 qed
17.146 show "prob_space M" by default fact
17.147 qed
17.148
17.149 abbreviation (in prob_space) "events \<equiv> sets M"
17.150 -abbreviation (in prob_space) "prob \<equiv> \<mu>'"
17.151 -abbreviation (in prob_space) "random_variable M' X \<equiv> sigma_algebra M' \<and> X \<in> measurable M M'"
17.152 +abbreviation (in prob_space) "prob \<equiv> measure M"
17.153 +abbreviation (in prob_space) "random_variable M' X \<equiv> X \<in> measurable M M'"
17.154 abbreviation (in prob_space) "expectation \<equiv> integral\<^isup>L M"
17.155
17.156 -definition (in prob_space)
17.157 - "distribution X A = \<mu>' (X -` A \<inter> space M)"
17.158 -
17.159 -abbreviation (in prob_space)
17.160 - "joint_distribution X Y \<equiv> distribution (\<lambda>x. (X x, Y x))"
17.161 -
17.162 -lemma (in prob_space) prob_space_cong:
17.163 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "space N = space M" "sets N = sets M"
17.164 - shows "prob_space N"
17.165 -proof
17.166 - show "measure_space N" by (intro measure_space_cong assms)
17.167 - show "measure N (space N) = 1"
17.168 - using measure_space_1 assms by simp
17.169 +lemma (in prob_space) prob_space_distr:
17.170 + assumes f: "f \<in> measurable M M'" shows "prob_space (distr M M' f)"
17.171 +proof (rule prob_spaceI)
17.172 + have "f -` space M' \<inter> space M = space M" using f by (auto dest: measurable_space)
17.173 + with f show "emeasure (distr M M' f) (space (distr M M' f)) = 1"
17.174 + by (auto simp: emeasure_distr emeasure_space_1)
17.175 qed
17.176
17.177 -lemma (in prob_space) distribution_cong:
17.178 - assumes "\<And>x. x \<in> space M \<Longrightarrow> X x = Y x"
17.179 - shows "distribution X = distribution Y"
17.180 - unfolding distribution_def fun_eq_iff
17.181 - using assms by (auto intro!: arg_cong[where f="\<mu>'"])
17.182 -
17.183 -lemma (in prob_space) joint_distribution_cong:
17.184 - assumes "\<And>x. x \<in> space M \<Longrightarrow> X x = X' x"
17.185 - assumes "\<And>x. x \<in> space M \<Longrightarrow> Y x = Y' x"
17.186 - shows "joint_distribution X Y = joint_distribution X' Y'"
17.187 - unfolding distribution_def fun_eq_iff
17.188 - using assms by (auto intro!: arg_cong[where f="\<mu>'"])
17.189 -
17.190 -lemma (in prob_space) distribution_id[simp]:
17.191 - "N \<in> events \<Longrightarrow> distribution (\<lambda>x. x) N = prob N"
17.192 - by (auto simp: distribution_def intro!: arg_cong[where f=prob])
17.193 -
17.194 lemma (in prob_space) prob_space: "prob (space M) = 1"
17.195 - using measure_space_1 unfolding \<mu>'_def by (simp add: one_ereal_def)
17.196 + using emeasure_space_1 unfolding measure_def by (simp add: one_ereal_def)
17.197
17.198 lemma (in prob_space) prob_le_1[simp, intro]: "prob A \<le> 1"
17.199 using bounded_measure[of A] by (simp add: prob_space)
17.200
17.201 -lemma (in prob_space) distribution_positive[simp, intro]:
17.202 - "0 \<le> distribution X A" unfolding distribution_def by auto
17.203 +lemma (in prob_space) not_empty: "space M \<noteq> {}"
17.204 + using prob_space by auto
17.205
17.206 -lemma (in prob_space) not_zero_less_distribution[simp]:
17.207 - "(\<not> 0 < distribution X A) \<longleftrightarrow> distribution X A = 0"
17.208 - using distribution_positive[of X A] by arith
17.209 -
17.210 -lemma (in prob_space) joint_distribution_remove[simp]:
17.211 - "joint_distribution X X {(x, x)} = distribution X {x}"
17.212 - unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>'])
17.213 -
17.214 -lemma (in prob_space) distribution_unit[simp]: "distribution (\<lambda>x. ()) {()} = 1"
17.215 - unfolding distribution_def using prob_space by auto
17.216 -
17.217 -lemma (in prob_space) joint_distribution_unit[simp]: "distribution (\<lambda>x. (X x, ())) {(a, ())} = distribution X {a}"
17.218 - unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>'])
17.219 -
17.220 -lemma (in prob_space) not_empty: "space M \<noteq> {}"
17.221 - using prob_space empty_measure' by auto
17.222 -
17.223 -lemma (in prob_space) measure_le_1: "X \<in> sets M \<Longrightarrow> \<mu> X \<le> 1"
17.224 - unfolding measure_space_1[symmetric]
17.225 - using sets_into_space
17.226 - by (intro measure_mono) auto
17.227 +lemma (in prob_space) measure_le_1: "emeasure M X \<le> 1"
17.228 + using emeasure_space[of M X] by (simp add: emeasure_space_1)
17.229
17.230 lemma (in prob_space) AE_I_eq_1:
17.231 - assumes "\<mu> {x\<in>space M. P x} = 1" "{x\<in>space M. P x} \<in> sets M"
17.232 - shows "AE x. P x"
17.233 + assumes "emeasure M {x\<in>space M. P x} = 1" "{x\<in>space M. P x} \<in> sets M"
17.234 + shows "AE x in M. P x"
17.235 proof (rule AE_I)
17.236 - show "\<mu> (space M - {x \<in> space M. P x}) = 0"
17.237 - using assms measure_space_1 by (simp add: measure_compl)
17.238 + show "emeasure M (space M - {x \<in> space M. P x}) = 0"
17.239 + using assms emeasure_space_1 by (simp add: emeasure_compl)
17.240 qed (insert assms, auto)
17.241
17.242 -lemma (in prob_space) distribution_1:
17.243 - "distribution X A \<le> 1"
17.244 - unfolding distribution_def by simp
17.245 -
17.246 lemma (in prob_space) prob_compl:
17.247 assumes A: "A \<in> events"
17.248 shows "prob (space M - A) = 1 - prob A"
17.249 using finite_measure_compl[OF A] by (simp add: prob_space)
17.250
17.251 +lemma (in prob_space) AE_in_set_eq_1:
17.252 + assumes "A \<in> events" shows "(AE x in M. x \<in> A) \<longleftrightarrow> prob A = 1"
17.253 +proof
17.254 + assume ae: "AE x in M. x \<in> A"
17.255 + have "{x \<in> space M. x \<in> A} = A" "{x \<in> space M. x \<notin> A} = space M - A"
17.256 + using `A \<in> events`[THEN sets_into_space] by auto
17.257 + with AE_E2[OF ae] `A \<in> events` have "1 - emeasure M A = 0"
17.258 + by (simp add: emeasure_compl emeasure_space_1)
17.259 + then show "prob A = 1"
17.260 + using `A \<in> events` by (simp add: emeasure_eq_measure one_ereal_def)
17.261 +next
17.262 + assume prob: "prob A = 1"
17.263 + show "AE x in M. x \<in> A"
17.264 + proof (rule AE_I)
17.265 + show "{x \<in> space M. x \<notin> A} \<subseteq> space M - A" by auto
17.266 + show "emeasure M (space M - A) = 0"
17.267 + using `A \<in> events` prob
17.268 + by (simp add: prob_compl emeasure_space_1 emeasure_eq_measure one_ereal_def)
17.269 + show "space M - A \<in> events"
17.270 + using `A \<in> events` by auto
17.271 + qed
17.272 +qed
17.273 +
17.274 +lemma (in prob_space) AE_False: "(AE x in M. False) \<longleftrightarrow> False"
17.275 +proof
17.276 + assume "AE x in M. False"
17.277 + then have "AE x in M. x \<in> {}" by simp
17.278 + then show False
17.279 + by (subst (asm) AE_in_set_eq_1) auto
17.280 +qed simp
17.281 +
17.282 +lemma (in prob_space) AE_prob_1:
17.283 + assumes "prob A = 1" shows "AE x in M. x \<in> A"
17.284 +proof -
17.285 + from `prob A = 1` have "A \<in> events"
17.286 + by (metis measure_notin_sets zero_neq_one)
17.287 + with AE_in_set_eq_1 assms show ?thesis by simp
17.288 +qed
17.289 +
17.290 lemma (in prob_space) prob_space_increasing: "increasing M prob"
17.291 by (auto intro!: finite_measure_mono simp: increasing_def)
17.292
17.293 @@ -164,9 +273,8 @@
17.294 shows "prob (\<Union> i :: nat. c i) = 0"
17.295 proof (rule antisym)
17.296 show "prob (\<Union> i :: nat. c i) \<le> 0"
17.297 - using finite_measure_countably_subadditive[OF assms(1)]
17.298 - by (simp add: assms(2) suminf_zero summable_zero)
17.299 -qed simp
17.300 + using finite_measure_subadditive_countably[OF assms(1)] by (simp add: assms(2))
17.301 +qed (simp add: measure_nonneg)
17.302
17.303 lemma (in prob_space) prob_equiprobable_finite_unions:
17.304 assumes "s \<in> events"
17.305 @@ -178,7 +286,7 @@
17.306 from someI_ex[OF this] assms
17.307 have prob_some: "\<And> x. x \<in> s \<Longrightarrow> prob {x} = prob {SOME y. y \<in> s}" by blast
17.308 have "prob s = (\<Sum> x \<in> s. prob {x})"
17.309 - using finite_measure_finite_singleton[OF s_finite] by simp
17.310 + using finite_measure_eq_setsum_singleton[OF s_finite] by simp
17.311 also have "\<dots> = (\<Sum> x \<in> s. prob {SOME y. y \<in> s})" using prob_some by auto
17.312 also have "\<dots> = real (card s) * prob {(SOME x. x \<in> s)}"
17.313 using setsum_constant assms by (simp add: real_eq_of_nat)
17.314 @@ -199,96 +307,20 @@
17.315 also have "\<dots> = (\<Sum> x \<in> s. prob (e \<inter> f x))"
17.316 proof (rule finite_measure_finite_Union)
17.317 show "finite s" by fact
17.318 - show "\<And>i. i \<in> s \<Longrightarrow> e \<inter> f i \<in> events" by fact
17.319 + show "(\<lambda>i. e \<inter> f i)`s \<subseteq> events" using assms(2) by auto
17.320 show "disjoint_family_on (\<lambda>i. e \<inter> f i) s"
17.321 using disjoint by (auto simp: disjoint_family_on_def)
17.322 qed
17.323 finally show ?thesis .
17.324 qed
17.325
17.326 -lemma (in prob_space) prob_space_vimage:
17.327 - assumes S: "sigma_algebra S"
17.328 - assumes T: "T \<in> measure_preserving M S"
17.329 - shows "prob_space S"
17.330 -proof
17.331 - interpret S: measure_space S
17.332 - using S and T by (rule measure_space_vimage)
17.333 - show "measure_space S" ..
17.334 -
17.335 - from T[THEN measure_preservingD2]
17.336 - have "T -` space S \<inter> space M = space M"
17.337 - by (auto simp: measurable_def)
17.338 - with T[THEN measure_preservingD, of "space S", symmetric]
17.339 - show "measure S (space S) = 1"
17.340 - using measure_space_1 by simp
17.341 -qed
17.342 -
17.343 -lemma prob_space_unique_Int_stable:
17.344 - fixes E :: "('a, 'b) algebra_scheme" and A :: "nat \<Rightarrow> 'a set"
17.345 - assumes E: "Int_stable E" "space E \<in> sets E"
17.346 - and M: "prob_space M" "space M = space E" "sets M = sets (sigma E)"
17.347 - and N: "prob_space N" "space N = space E" "sets N = sets (sigma E)"
17.348 - and eq: "\<And>X. X \<in> sets E \<Longrightarrow> finite_measure.\<mu>' M X = finite_measure.\<mu>' N X"
17.349 - assumes "X \<in> sets (sigma E)"
17.350 - shows "finite_measure.\<mu>' M X = finite_measure.\<mu>' N X"
17.351 -proof -
17.352 - interpret M!: prob_space M by fact
17.353 - interpret N!: prob_space N by fact
17.354 - have "measure M X = measure N X"
17.355 - proof (rule measure_unique_Int_stable[OF `Int_stable E`])
17.356 - show "range (\<lambda>i. space M) \<subseteq> sets E" "incseq (\<lambda>i. space M)" "(\<Union>i. space M) = space E"
17.357 - using E M N by auto
17.358 - show "\<And>i. M.\<mu> (space M) \<noteq> \<infinity>"
17.359 - using M.measure_space_1 by simp
17.360 - show "measure_space \<lparr>space = space E, sets = sets (sigma E), measure_space.measure = M.\<mu>\<rparr>"
17.361 - using E M N by (auto intro!: M.measure_space_cong)
17.362 - show "measure_space \<lparr>space = space E, sets = sets (sigma E), measure_space.measure = N.\<mu>\<rparr>"
17.363 - using E M N by (auto intro!: N.measure_space_cong)
17.364 - { fix X assume "X \<in> sets E"
17.365 - then have "X \<in> sets (sigma E)"
17.366 - by (auto simp: sets_sigma sigma_sets.Basic)
17.367 - with eq[OF `X \<in> sets E`] M N show "M.\<mu> X = N.\<mu> X"
17.368 - by (simp add: M.finite_measure_eq N.finite_measure_eq) }
17.369 - qed fact
17.370 - with `X \<in> sets (sigma E)` M N show ?thesis
17.371 - by (simp add: M.finite_measure_eq N.finite_measure_eq)
17.372 -qed
17.373 -
17.374 -lemma (in prob_space) distribution_prob_space:
17.375 - assumes X: "random_variable S X"
17.376 - shows "prob_space (S\<lparr>measure := ereal \<circ> distribution X\<rparr>)" (is "prob_space ?S")
17.377 -proof (rule prob_space_vimage)
17.378 - show "X \<in> measure_preserving M ?S"
17.379 - using X
17.380 - unfolding measure_preserving_def distribution_def [abs_def]
17.381 - by (auto simp: finite_measure_eq measurable_sets)
17.382 - show "sigma_algebra ?S" using X by simp
17.383 -qed
17.384 -
17.385 -lemma (in prob_space) AE_distribution:
17.386 - assumes X: "random_variable MX X" and "AE x in MX\<lparr>measure := ereal \<circ> distribution X\<rparr>. Q x"
17.387 - shows "AE x. Q (X x)"
17.388 -proof -
17.389 - interpret X: prob_space "MX\<lparr>measure := ereal \<circ> distribution X\<rparr>" using X by (rule distribution_prob_space)
17.390 - obtain N where N: "N \<in> sets MX" "distribution X N = 0" "{x\<in>space MX. \<not> Q x} \<subseteq> N"
17.391 - using assms unfolding X.almost_everywhere_def by auto
17.392 - from X[unfolded measurable_def] N show "AE x. Q (X x)"
17.393 - by (intro AE_I'[where N="X -` N \<inter> space M"])
17.394 - (auto simp: finite_measure_eq distribution_def measurable_sets)
17.395 -qed
17.396 -
17.397 -lemma (in prob_space) distribution_eq_integral:
17.398 - "random_variable S X \<Longrightarrow> A \<in> sets S \<Longrightarrow> distribution X A = expectation (indicator (X -` A \<inter> space M))"
17.399 - using finite_measure_eq[of "X -` A \<inter> space M"]
17.400 - by (auto simp: measurable_sets distribution_def)
17.401 -
17.402 lemma (in prob_space) expectation_less:
17.403 assumes [simp]: "integrable M X"
17.404 assumes gt: "\<forall>x\<in>space M. X x < b"
17.405 shows "expectation X < b"
17.406 proof -
17.407 have "expectation X < expectation (\<lambda>x. b)"
17.408 - using gt measure_space_1
17.409 + using gt emeasure_space_1
17.410 by (intro integral_less_AE_space) auto
17.411 then show ?thesis using prob_space by simp
17.412 qed
17.413 @@ -299,80 +331,11 @@
17.414 shows "a < expectation X"
17.415 proof -
17.416 have "expectation (\<lambda>x. a) < expectation X"
17.417 - using gt measure_space_1
17.418 + using gt emeasure_space_1
17.419 by (intro integral_less_AE_space) auto
17.420 then show ?thesis using prob_space by simp
17.421 qed
17.422
17.423 -lemma convex_le_Inf_differential:
17.424 - fixes f :: "real \<Rightarrow> real"
17.425 - assumes "convex_on I f"
17.426 - assumes "x \<in> interior I" "y \<in> I"
17.427 - shows "f y \<ge> f x + Inf ((\<lambda>t. (f x - f t) / (x - t)) ` ({x<..} \<inter> I)) * (y - x)"
17.428 - (is "_ \<ge> _ + Inf (?F x) * (y - x)")
17.429 -proof -
17.430 - show ?thesis
17.431 - proof (cases rule: linorder_cases)
17.432 - assume "x < y"
17.433 - moreover
17.434 - have "open (interior I)" by auto
17.435 - from openE[OF this `x \<in> interior I`] guess e . note e = this
17.436 - moreover def t \<equiv> "min (x + e / 2) ((x + y) / 2)"
17.437 - ultimately have "x < t" "t < y" "t \<in> ball x e"
17.438 - by (auto simp: mem_ball dist_real_def field_simps split: split_min)
17.439 - with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
17.440 -
17.441 - have "open (interior I)" by auto
17.442 - from openE[OF this `x \<in> interior I`] guess e .
17.443 - moreover def K \<equiv> "x - e / 2"
17.444 - with `0 < e` have "K \<in> ball x e" "K < x" by (auto simp: mem_ball dist_real_def)
17.445 - ultimately have "K \<in> I" "K < x" "x \<in> I"
17.446 - using interior_subset[of I] `x \<in> interior I` by auto
17.447 -
17.448 - have "Inf (?F x) \<le> (f x - f y) / (x - y)"
17.449 - proof (rule Inf_lower2)
17.450 - show "(f x - f t) / (x - t) \<in> ?F x"
17.451 - using `t \<in> I` `x < t` by auto
17.452 - show "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)"
17.453 - using `convex_on I f` `x \<in> I` `y \<in> I` `x < t` `t < y` by (rule convex_on_diff)
17.454 - next
17.455 - fix y assume "y \<in> ?F x"
17.456 - with order_trans[OF convex_on_diff[OF `convex_on I f` `K \<in> I` _ `K < x` _]]
17.457 - show "(f K - f x) / (K - x) \<le> y" by auto
17.458 - qed
17.459 - then show ?thesis
17.460 - using `x < y` by (simp add: field_simps)
17.461 - next
17.462 - assume "y < x"
17.463 - moreover
17.464 - have "open (interior I)" by auto
17.465 - from openE[OF this `x \<in> interior I`] guess e . note e = this
17.466 - moreover def t \<equiv> "x + e / 2"
17.467 - ultimately have "x < t" "t \<in> ball x e"
17.468 - by (auto simp: mem_ball dist_real_def field_simps)
17.469 - with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
17.470 -
17.471 - have "(f x - f y) / (x - y) \<le> Inf (?F x)"
17.472 - proof (rule Inf_greatest)
17.473 - have "(f x - f y) / (x - y) = (f y - f x) / (y - x)"
17.474 - using `y < x` by (auto simp: field_simps)
17.475 - also
17.476 - fix z assume "z \<in> ?F x"
17.477 - with order_trans[OF convex_on_diff[OF `convex_on I f` `y \<in> I` _ `y < x`]]
17.478 - have "(f y - f x) / (y - x) \<le> z" by auto
17.479 - finally show "(f x - f y) / (x - y) \<le> z" .
17.480 - next
17.481 - have "open (interior I)" by auto
17.482 - from openE[OF this `x \<in> interior I`] guess e . note e = this
17.483 - then have "x + e / 2 \<in> ball x e" by (auto simp: mem_ball dist_real_def)
17.484 - with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I" by auto
17.485 - then show "?F x \<noteq> {}" by blast
17.486 - qed
17.487 - then show ?thesis
17.488 - using `y < x` by (simp add: field_simps)
17.489 - qed simp
17.490 -qed
17.491 -
17.492 lemma (in prob_space) jensens_inequality:
17.493 fixes a b :: real
17.494 assumes X: "integrable M X" "X ` space M \<subseteq> I"
17.495 @@ -410,8 +373,7 @@
17.496 fix k assume "k \<in> (\<lambda>x. q x + ?F x * (expectation X - x)) ` I"
17.497 then guess x .. note x = this
17.498 have "q x + ?F x * (expectation X - x) = expectation (\<lambda>w. q x + ?F x * (X w - x))"
17.499 - using prob_space
17.500 - by (simp add: integral_add integral_cmult integral_diff lebesgue_integral_const X)
17.501 + using prob_space by (simp add: X)
17.502 also have "\<dots> \<le> expectation (\<lambda>w. q (X w))"
17.503 using `x \<in> I` `open I` X(2)
17.504 by (intro integral_mono integral_add integral_cmult integral_diff
17.505 @@ -422,31 +384,6 @@
17.506 finally show "q (expectation X) \<le> expectation (\<lambda>x. q (X x))" .
17.507 qed
17.508
17.509 -lemma (in prob_space) distribution_eq_translated_integral:
17.510 - assumes "random_variable S X" "A \<in> sets S"
17.511 - shows "distribution X A = integral\<^isup>P (S\<lparr>measure := ereal \<circ> distribution X\<rparr>) (indicator A)"
17.512 -proof -
17.513 - interpret S: prob_space "S\<lparr>measure := ereal \<circ> distribution X\<rparr>"
17.514 - using assms(1) by (rule distribution_prob_space)
17.515 - show ?thesis
17.516 - using S.positive_integral_indicator(1)[of A] assms by simp
17.517 -qed
17.518 -
17.519 -lemma (in prob_space) finite_expectation1:
17.520 - assumes f: "finite (X`space M)" and rv: "random_variable borel X"
17.521 - shows "expectation X = (\<Sum>r \<in> X ` space M. r * prob (X -` {r} \<inter> space M))" (is "_ = ?r")
17.522 -proof (subst integral_on_finite)
17.523 - show "X \<in> borel_measurable M" "finite (X`space M)" using assms by auto
17.524 - show "(\<Sum> r \<in> X ` space M. r * real (\<mu> (X -` {r} \<inter> space M))) = ?r"
17.525 - "\<And>x. \<mu> (X -` {x} \<inter> space M) \<noteq> \<infinity>"
17.526 - using finite_measure_eq[OF borel_measurable_vimage, of X] rv by auto
17.527 -qed
17.528 -
17.529 -lemma (in prob_space) finite_expectation:
17.530 - assumes "finite (X`space M)" "random_variable borel X"
17.531 - shows "expectation X = (\<Sum> r \<in> X ` (space M). r * distribution X {r})"
17.532 - using assms unfolding distribution_def using finite_expectation1 by auto
17.533 -
17.534 lemma (in prob_space) prob_x_eq_1_imp_prob_y_eq_0:
17.535 assumes "{x} \<in> events"
17.536 assumes "prob {x} = 1"
17.537 @@ -455,119 +392,25 @@
17.538 shows "prob {y} = 0"
17.539 using prob_one_inter[of "{y}" "{x}"] assms by auto
17.540
17.541 -lemma (in prob_space) distribution_empty[simp]: "distribution X {} = 0"
17.542 - unfolding distribution_def by simp
17.543 -
17.544 -lemma (in prob_space) distribution_space[simp]: "distribution X (X ` space M) = 1"
17.545 -proof -
17.546 - have "X -` X ` space M \<inter> space M = space M" by auto
17.547 - thus ?thesis unfolding distribution_def by (simp add: prob_space)
17.548 -qed
17.549 -
17.550 -lemma (in prob_space) distribution_one:
17.551 - assumes "random_variable M' X" and "A \<in> sets M'"
17.552 - shows "distribution X A \<le> 1"
17.553 -proof -
17.554 - have "distribution X A \<le> \<mu>' (space M)" unfolding distribution_def
17.555 - using assms[unfolded measurable_def] by (auto intro!: finite_measure_mono)
17.556 - thus ?thesis by (simp add: prob_space)
17.557 -qed
17.558 -
17.559 -lemma (in prob_space) distribution_x_eq_1_imp_distribution_y_eq_0:
17.560 - assumes X: "random_variable \<lparr>space = X ` (space M), sets = Pow (X ` (space M))\<rparr> X"
17.561 - (is "random_variable ?S X")
17.562 - assumes "distribution X {x} = 1"
17.563 - assumes "y \<noteq> x"
17.564 - shows "distribution X {y} = 0"
17.565 -proof cases
17.566 - { fix x have "X -` {x} \<inter> space M \<in> sets M"
17.567 - proof cases
17.568 - assume "x \<in> X`space M" with X show ?thesis
17.569 - by (auto simp: measurable_def image_iff)
17.570 - next
17.571 - assume "x \<notin> X`space M" then have "X -` {x} \<inter> space M = {}" by auto
17.572 - then show ?thesis by auto
17.573 - qed } note single = this
17.574 - have "X -` {x} \<inter> space M - X -` {y} \<inter> space M = X -` {x} \<inter> space M"
17.575 - "X -` {y} \<inter> space M \<inter> (X -` {x} \<inter> space M) = {}"
17.576 - using `y \<noteq> x` by auto
17.577 - with finite_measure_inter_full_set[OF single single, of x y] assms(2)
17.578 - show ?thesis by (auto simp: distribution_def prob_space)
17.579 -next
17.580 - assume "{y} \<notin> sets ?S"
17.581 - then have "X -` {y} \<inter> space M = {}" by auto
17.582 - thus "distribution X {y} = 0" unfolding distribution_def by auto
17.583 -qed
17.584 -
17.585 lemma (in prob_space) joint_distribution_Times_le_fst:
17.586 - assumes X: "random_variable MX X" and Y: "random_variable MY Y"
17.587 - and A: "A \<in> sets MX" and B: "B \<in> sets MY"
17.588 - shows "joint_distribution X Y (A \<times> B) \<le> distribution X A"
17.589 - unfolding distribution_def
17.590 -proof (intro finite_measure_mono)
17.591 - show "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M \<subseteq> X -` A \<inter> space M" by force
17.592 - show "X -` A \<inter> space M \<in> events"
17.593 - using X A unfolding measurable_def by simp
17.594 - have *: "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M =
17.595 - (X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M)" by auto
17.596 -qed
17.597 -
17.598 -lemma (in prob_space) joint_distribution_commute:
17.599 - "joint_distribution X Y x = joint_distribution Y X ((\<lambda>(x,y). (y,x))`x)"
17.600 - unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>'])
17.601 + "random_variable MX X \<Longrightarrow> random_variable MY Y \<Longrightarrow> A \<in> sets MX \<Longrightarrow> B \<in> sets MY
17.602 + \<Longrightarrow> emeasure (distr M (MX \<Otimes>\<^isub>M MY) (\<lambda>x. (X x, Y x))) (A \<times> B) \<le> emeasure (distr M MX X) A"
17.603 + by (auto simp: emeasure_distr measurable_pair_iff comp_def intro!: emeasure_mono measurable_sets)
17.604
17.605 lemma (in prob_space) joint_distribution_Times_le_snd:
17.606 - assumes X: "random_variable MX X" and Y: "random_variable MY Y"
17.607 - and A: "A \<in> sets MX" and B: "B \<in> sets MY"
17.608 - shows "joint_distribution X Y (A \<times> B) \<le> distribution Y B"
17.609 - using assms
17.610 - by (subst joint_distribution_commute)
17.611 - (simp add: swap_product joint_distribution_Times_le_fst)
17.612 -
17.613 -lemma (in prob_space) random_variable_pairI:
17.614 - assumes "random_variable MX X"
17.615 - assumes "random_variable MY Y"
17.616 - shows "random_variable (MX \<Otimes>\<^isub>M MY) (\<lambda>x. (X x, Y x))"
17.617 -proof
17.618 - interpret MX: sigma_algebra MX using assms by simp
17.619 - interpret MY: sigma_algebra MY using assms by simp
17.620 - interpret P: pair_sigma_algebra MX MY by default
17.621 - show "sigma_algebra (MX \<Otimes>\<^isub>M MY)" by default
17.622 - have sa: "sigma_algebra M" by default
17.623 - show "(\<lambda>x. (X x, Y x)) \<in> measurable M (MX \<Otimes>\<^isub>M MY)"
17.624 - unfolding P.measurable_pair_iff[OF sa] using assms by (simp add: comp_def)
17.625 -qed
17.626 -
17.627 -lemma (in prob_space) joint_distribution_commute_singleton:
17.628 - "joint_distribution X Y {(x, y)} = joint_distribution Y X {(y, x)}"
17.629 - unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>'])
17.630 -
17.631 -lemma (in prob_space) joint_distribution_assoc_singleton:
17.632 - "joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)} =
17.633 - joint_distribution (\<lambda>x. (X x, Y x)) Z {((x, y), z)}"
17.634 - unfolding distribution_def by (auto intro!: arg_cong[where f=\<mu>'])
17.635 + "random_variable MX X \<Longrightarrow> random_variable MY Y \<Longrightarrow> A \<in> sets MX \<Longrightarrow> B \<in> sets MY
17.636 + \<Longrightarrow> emeasure (distr M (MX \<Otimes>\<^isub>M MY) (\<lambda>x. (X x, Y x))) (A \<times> B) \<le> emeasure (distr M MY Y) B"
17.637 + by (auto simp: emeasure_distr measurable_pair_iff comp_def intro!: emeasure_mono measurable_sets)
17.638
17.639 locale pair_prob_space = pair_sigma_finite M1 M2 + M1: prob_space M1 + M2: prob_space M2 for M1 M2
17.640
17.641 -sublocale pair_prob_space \<subseteq> P: prob_space P
17.642 +sublocale pair_prob_space \<subseteq> P: prob_space "M1 \<Otimes>\<^isub>M M2"
17.643 proof
17.644 - show "measure_space P" ..
17.645 - show "measure P (space P) = 1"
17.646 - by (simp add: pair_measure_times M1.measure_space_1 M2.measure_space_1 space_pair_measure)
17.647 + show "emeasure (M1 \<Otimes>\<^isub>M M2) (space (M1 \<Otimes>\<^isub>M M2)) = 1"
17.648 + by (simp add: emeasure_pair_measure_Times M1.emeasure_space_1 M2.emeasure_space_1 space_pair_measure)
17.649 qed
17.650
17.651 -lemma countably_additiveI[case_names countably]:
17.652 - assumes "\<And>A. \<lbrakk> range A \<subseteq> sets M ; disjoint_family A ; (\<Union>i. A i) \<in> sets M\<rbrakk> \<Longrightarrow>
17.653 - (\<Sum>n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
17.654 - shows "countably_additive M \<mu>"
17.655 - using assms unfolding countably_additive_def by auto
17.656 -
17.657 -lemma (in prob_space) joint_distribution_prob_space:
17.658 - assumes "random_variable MX X" "random_variable MY Y"
17.659 - shows "prob_space ((MX \<Otimes>\<^isub>M MY) \<lparr> measure := ereal \<circ> joint_distribution X Y\<rparr>)"
17.660 - using random_variable_pairI[OF assms] by (rule distribution_prob_space)
17.661 -
17.662 -locale product_prob_space = product_sigma_finite M for M :: "'i \<Rightarrow> ('a, 'b) measure_space_scheme" +
17.663 +locale product_prob_space = product_sigma_finite M for M :: "'i \<Rightarrow> 'a measure" +
17.664 fixes I :: "'i set"
17.665 assumes prob_space: "\<And>i. prob_space (M i)"
17.666
17.667 @@ -578,648 +421,401 @@
17.668
17.669 sublocale finite_product_prob_space \<subseteq> prob_space "\<Pi>\<^isub>M i\<in>I. M i"
17.670 proof
17.671 - show "measure_space P" ..
17.672 - show "measure P (space P) = 1"
17.673 - by (simp add: measure_times M.measure_space_1 setprod_1)
17.674 + show "emeasure (\<Pi>\<^isub>M i\<in>I. M i) (space (\<Pi>\<^isub>M i\<in>I. M i)) = 1"
17.675 + by (simp add: measure_times M.emeasure_space_1 setprod_1 space_PiM)
17.676 qed
17.677
17.678 lemma (in finite_product_prob_space) prob_times:
17.679 assumes X: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> sets (M i)"
17.680 shows "prob (\<Pi>\<^isub>E i\<in>I. X i) = (\<Prod>i\<in>I. M.prob i (X i))"
17.681 proof -
17.682 - have "ereal (\<mu>' (\<Pi>\<^isub>E i\<in>I. X i)) = \<mu> (\<Pi>\<^isub>E i\<in>I. X i)"
17.683 - using X by (intro finite_measure_eq[symmetric] in_P) auto
17.684 - also have "\<dots> = (\<Prod>i\<in>I. M.\<mu> i (X i))"
17.685 + have "ereal (measure (\<Pi>\<^isub>M i\<in>I. M i) (\<Pi>\<^isub>E i\<in>I. X i)) = emeasure (\<Pi>\<^isub>M i\<in>I. M i) (\<Pi>\<^isub>E i\<in>I. X i)"
17.686 + using X by (simp add: emeasure_eq_measure)
17.687 + also have "\<dots> = (\<Prod>i\<in>I. emeasure (M i) (X i))"
17.688 using measure_times X by simp
17.689 - also have "\<dots> = ereal (\<Prod>i\<in>I. M.\<mu>' i (X i))"
17.690 - using X by (simp add: M.finite_measure_eq setprod_ereal)
17.691 + also have "\<dots> = ereal (\<Prod>i\<in>I. measure (M i) (X i))"
17.692 + using X by (simp add: M.emeasure_eq_measure setprod_ereal)
17.693 finally show ?thesis by simp
17.694 qed
17.695
17.696 -lemma (in prob_space) random_variable_restrict:
17.697 - assumes I: "finite I"
17.698 - assumes X: "\<And>i. i \<in> I \<Longrightarrow> random_variable (N i) (X i)"
17.699 - shows "random_variable (Pi\<^isub>M I N) (\<lambda>x. \<lambda>i\<in>I. X i x)"
17.700 -proof
17.701 - { fix i assume "i \<in> I"
17.702 - with X interpret N: sigma_algebra "N i" by simp
17.703 - have "sets (N i) \<subseteq> Pow (space (N i))" by (rule N.space_closed) }
17.704 - note N_closed = this
17.705 - then show "sigma_algebra (Pi\<^isub>M I N)"
17.706 - by (simp add: product_algebra_def)
17.707 - (intro sigma_algebra_sigma product_algebra_generator_sets_into_space)
17.708 - show "(\<lambda>x. \<lambda>i\<in>I. X i x) \<in> measurable M (Pi\<^isub>M I N)"
17.709 - using X by (intro measurable_restrict[OF I N_closed]) auto
17.710 +section {* Distributions *}
17.711 +
17.712 +definition "distributed M N X f \<longleftrightarrow> distr M N X = density N f \<and>
17.713 + f \<in> borel_measurable N \<and> (AE x in N. 0 \<le> f x) \<and> X \<in> measurable M N"
17.714 +
17.715 +lemma
17.716 + shows distributed_distr_eq_density: "distributed M N X f \<Longrightarrow> distr M N X = density N f"
17.717 + and distributed_measurable: "distributed M N X f \<Longrightarrow> X \<in> measurable M N"
17.718 + and distributed_borel_measurable: "distributed M N X f \<Longrightarrow> f \<in> borel_measurable N"
17.719 + and distributed_AE: "distributed M N X f \<Longrightarrow> (AE x in N. 0 \<le> f x)"
17.720 + by (simp_all add: distributed_def)
17.721 +
17.722 +lemma
17.723 + shows distributed_real_measurable: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> f \<in> borel_measurable N"
17.724 + and distributed_real_AE: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> (AE x in N. 0 \<le> f x)"
17.725 + by (simp_all add: distributed_def borel_measurable_ereal_iff)
17.726 +
17.727 +lemma distributed_count_space:
17.728 + assumes X: "distributed M (count_space A) X P" and a: "a \<in> A" and A: "finite A"
17.729 + shows "P a = emeasure M (X -` {a} \<inter> space M)"
17.730 +proof -
17.731 + have "emeasure M (X -` {a} \<inter> space M) = emeasure (distr M (count_space A) X) {a}"
17.732 + using X a A by (simp add: distributed_measurable emeasure_distr)
17.733 + also have "\<dots> = emeasure (density (count_space A) P) {a}"
17.734 + using X by (simp add: distributed_distr_eq_density)
17.735 + also have "\<dots> = (\<integral>\<^isup>+x. P a * indicator {a} x \<partial>count_space A)"
17.736 + using X a by (auto simp add: emeasure_density distributed_def indicator_def intro!: positive_integral_cong)
17.737 + also have "\<dots> = P a"
17.738 + using X a by (subst positive_integral_cmult_indicator) (auto simp: distributed_def one_ereal_def[symmetric] AE_count_space)
17.739 + finally show ?thesis ..
17.740 qed
17.741
17.742 -section "Probability spaces on finite sets"
17.743 +lemma distributed_cong_density:
17.744 + "(AE x in N. f x = g x) \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> f \<in> borel_measurable N \<Longrightarrow>
17.745 + distributed M N X f \<longleftrightarrow> distributed M N X g"
17.746 + by (auto simp: distributed_def intro!: density_cong)
17.747
17.748 -locale finite_prob_space = prob_space + finite_measure_space
17.749 -
17.750 -abbreviation (in prob_space) "finite_random_variable M' X \<equiv> finite_sigma_algebra M' \<and> X \<in> measurable M M'"
17.751 -
17.752 -lemma (in prob_space) finite_random_variableD:
17.753 - assumes "finite_random_variable M' X" shows "random_variable M' X"
17.754 +lemma subdensity:
17.755 + assumes T: "T \<in> measurable P Q"
17.756 + assumes f: "distributed M P X f"
17.757 + assumes g: "distributed M Q Y g"
17.758 + assumes Y: "Y = T \<circ> X"
17.759 + shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0"
17.760 proof -
17.761 - interpret M': finite_sigma_algebra M' using assms by simp
17.762 - show "random_variable M' X" using assms by simp default
17.763 + have "{x\<in>space Q. g x = 0} \<in> null_sets (distr M Q (T \<circ> X))"
17.764 + using g Y by (auto simp: null_sets_density_iff distributed_def)
17.765 + also have "distr M Q (T \<circ> X) = distr (distr M P X) Q T"
17.766 + using T f[THEN distributed_measurable] by (rule distr_distr[symmetric])
17.767 + finally have "T -` {x\<in>space Q. g x = 0} \<inter> space P \<in> null_sets (distr M P X)"
17.768 + using T by (subst (asm) null_sets_distr_iff) auto
17.769 + also have "T -` {x\<in>space Q. g x = 0} \<inter> space P = {x\<in>space P. g (T x) = 0}"
17.770 + using T by (auto dest: measurable_space)
17.771 + finally show ?thesis
17.772 + using f g by (auto simp add: null_sets_density_iff distributed_def)
17.773 qed
17.774
17.775 -lemma (in prob_space) distribution_finite_prob_space:
17.776 - assumes "finite_random_variable MX X"
17.777 - shows "finite_prob_space (MX\<lparr>measure := ereal \<circ> distribution X\<rparr>)"
17.778 +lemma subdensity_real:
17.779 + fixes g :: "'a \<Rightarrow> real" and f :: "'b \<Rightarrow> real"
17.780 + assumes T: "T \<in> measurable P Q"
17.781 + assumes f: "distributed M P X f"
17.782 + assumes g: "distributed M Q Y g"
17.783 + assumes Y: "Y = T \<circ> X"
17.784 + shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0"
17.785 + using subdensity[OF T, of M X "\<lambda>x. ereal (f x)" Y "\<lambda>x. ereal (g x)"] assms by auto
17.786 +
17.787 +lemma distributed_integral:
17.788 + "distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>x. f x * g x \<partial>N) = (\<integral>x. g (X x) \<partial>M)"
17.789 + by (auto simp: distributed_real_measurable distributed_real_AE distributed_measurable
17.790 + distributed_distr_eq_density[symmetric] integral_density[symmetric] integral_distr)
17.791 +
17.792 +lemma distributed_transform_integral:
17.793 + assumes Px: "distributed M N X Px"
17.794 + assumes "distributed M P Y Py"
17.795 + assumes Y: "Y = T \<circ> X" and T: "T \<in> measurable N P" and f: "f \<in> borel_measurable P"
17.796 + shows "(\<integral>x. Py x * f x \<partial>P) = (\<integral>x. Px x * f (T x) \<partial>N)"
17.797 proof -
17.798 - interpret X: prob_space "MX\<lparr>measure := ereal \<circ> distribution X\<rparr>"
17.799 - using assms[THEN finite_random_variableD] by (rule distribution_prob_space)
17.800 - interpret MX: finite_sigma_algebra MX
17.801 - using assms by auto
17.802 - show ?thesis by default (simp_all add: MX.finite_space)
17.803 -qed
17.804 -
17.805 -lemma (in prob_space) simple_function_imp_finite_random_variable[simp, intro]:
17.806 - assumes "simple_function M X"
17.807 - shows "finite_random_variable \<lparr> space = X`space M, sets = Pow (X`space M), \<dots> = x \<rparr> X"
17.808 - (is "finite_random_variable ?X _")
17.809 -proof (intro conjI)
17.810 - have [simp]: "finite (X ` space M)" using assms unfolding simple_function_def by simp
17.811 - interpret X: sigma_algebra ?X by (rule sigma_algebra_Pow)
17.812 - show "finite_sigma_algebra ?X"
17.813 - by default auto
17.814 - show "X \<in> measurable M ?X"
17.815 - proof (unfold measurable_def, clarsimp)
17.816 - fix A assume A: "A \<subseteq> X`space M"
17.817 - then have "finite A" by (rule finite_subset) simp
17.818 - then have "X -` (\<Union>a\<in>A. {a}) \<inter> space M \<in> events"
17.819 - unfolding vimage_UN UN_extend_simps
17.820 - apply (rule finite_UN)
17.821 - using A assms unfolding simple_function_def by auto
17.822 - then show "X -` A \<inter> space M \<in> events" by simp
17.823 - qed
17.824 -qed
17.825 -
17.826 -lemma (in prob_space) simple_function_imp_random_variable[simp, intro]:
17.827 - assumes "simple_function M X"
17.828 - shows "random_variable \<lparr> space = X`space M, sets = Pow (X`space M), \<dots> = ext \<rparr> X"
17.829 - using simple_function_imp_finite_random_variable[OF assms, of ext]
17.830 - by (auto dest!: finite_random_variableD)
17.831 -
17.832 -lemma (in prob_space) sum_over_space_real_distribution:
17.833 - "simple_function M X \<Longrightarrow> (\<Sum>x\<in>X`space M. distribution X {x}) = 1"
17.834 - unfolding distribution_def prob_space[symmetric]
17.835 - by (subst finite_measure_finite_Union[symmetric])
17.836 - (auto simp add: disjoint_family_on_def simple_function_def
17.837 - intro!: arg_cong[where f=prob])
17.838 -
17.839 -lemma (in prob_space) finite_random_variable_pairI:
17.840 - assumes "finite_random_variable MX X"
17.841 - assumes "finite_random_variable MY Y"
17.842 - shows "finite_random_variable (MX \<Otimes>\<^isub>M MY) (\<lambda>x. (X x, Y x))"
17.843 -proof
17.844 - interpret MX: finite_sigma_algebra MX using assms by simp
17.845 - interpret MY: finite_sigma_algebra MY using assms by simp
17.846 - interpret P: pair_finite_sigma_algebra MX MY by default
17.847 - show "finite_sigma_algebra (MX \<Otimes>\<^isub>M MY)" ..
17.848 - have sa: "sigma_algebra M" by default
17.849 - show "(\<lambda>x. (X x, Y x)) \<in> measurable M (MX \<Otimes>\<^isub>M MY)"
17.850 - unfolding P.measurable_pair_iff[OF sa] using assms by (simp add: comp_def)
17.851 -qed
17.852 -
17.853 -lemma (in prob_space) finite_random_variable_imp_sets:
17.854 - "finite_random_variable MX X \<Longrightarrow> x \<in> space MX \<Longrightarrow> {x} \<in> sets MX"
17.855 - unfolding finite_sigma_algebra_def finite_sigma_algebra_axioms_def by simp
17.856 -
17.857 -lemma (in prob_space) finite_random_variable_measurable:
17.858 - assumes X: "finite_random_variable MX X" shows "X -` A \<inter> space M \<in> events"
17.859 -proof -
17.860 - interpret X: finite_sigma_algebra MX using X by simp
17.861 - from X have vimage: "\<And>A. A \<subseteq> space MX \<Longrightarrow> X -` A \<inter> space M \<in> events" and
17.862 - "X \<in> space M \<rightarrow> space MX"
17.863 - by (auto simp: measurable_def)
17.864 - then have *: "X -` A \<inter> space M = X -` (A \<inter> space MX) \<inter> space M"
17.865 - by auto
17.866 - show "X -` A \<inter> space M \<in> events"
17.867 - unfolding * by (intro vimage) auto
17.868 -qed
17.869 -
17.870 -lemma (in prob_space) joint_distribution_finite_Times_le_fst:
17.871 - assumes X: "finite_random_variable MX X" and Y: "finite_random_variable MY Y"
17.872 - shows "joint_distribution X Y (A \<times> B) \<le> distribution X A"
17.873 - unfolding distribution_def
17.874 -proof (intro finite_measure_mono)
17.875 - show "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M \<subseteq> X -` A \<inter> space M" by force
17.876 - show "X -` A \<inter> space M \<in> events"
17.877 - using finite_random_variable_measurable[OF X] .
17.878 - have *: "(\<lambda>x. (X x, Y x)) -` (A \<times> B) \<inter> space M =
17.879 - (X -` A \<inter> space M) \<inter> (Y -` B \<inter> space M)" by auto
17.880 -qed
17.881 -
17.882 -lemma (in prob_space) joint_distribution_finite_Times_le_snd:
17.883 - assumes X: "finite_random_variable MX X" and Y: "finite_random_variable MY Y"
17.884 - shows "joint_distribution X Y (A \<times> B) \<le> distribution Y B"
17.885 - using assms
17.886 - by (subst joint_distribution_commute)
17.887 - (simp add: swap_product joint_distribution_finite_Times_le_fst)
17.888 -
17.889 -lemma (in prob_space) finite_distribution_order:
17.890 - fixes MX :: "('c, 'd) measure_space_scheme" and MY :: "('e, 'f) measure_space_scheme"
17.891 - assumes "finite_random_variable MX X" "finite_random_variable MY Y"
17.892 - shows "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution X {x}"
17.893 - and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution Y {y}"
17.894 - and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution X {x}"
17.895 - and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution Y {y}"
17.896 - and "distribution X {x} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0"
17.897 - and "distribution Y {y} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0"
17.898 - using joint_distribution_finite_Times_le_snd[OF assms, of "{x}" "{y}"]
17.899 - using joint_distribution_finite_Times_le_fst[OF assms, of "{x}" "{y}"]
17.900 - by (auto intro: antisym)
17.901 -
17.902 -lemma (in prob_space) setsum_joint_distribution:
17.903 - assumes X: "finite_random_variable MX X"
17.904 - assumes Y: "random_variable MY Y" "B \<in> sets MY"
17.905 - shows "(\<Sum>a\<in>space MX. joint_distribution X Y ({a} \<times> B)) = distribution Y B"
17.906 - unfolding distribution_def
17.907 -proof (subst finite_measure_finite_Union[symmetric])
17.908 - interpret MX: finite_sigma_algebra MX using X by auto
17.909 - show "finite (space MX)" using MX.finite_space .
17.910 - let ?d = "\<lambda>i. (\<lambda>x. (X x, Y x)) -` ({i} \<times> B) \<inter> space M"
17.911 - { fix i assume "i \<in> space MX"
17.912 - moreover have "?d i = (X -` {i} \<inter> space M) \<inter> (Y -` B \<inter> space M)" by auto
17.913 - ultimately show "?d i \<in> events"
17.914 - using measurable_sets[of X M MX] measurable_sets[of Y M MY B] X Y
17.915 - using MX.sets_eq_Pow by auto }
17.916 - show "disjoint_family_on ?d (space MX)" by (auto simp: disjoint_family_on_def)
17.917 - show "\<mu>' (\<Union>i\<in>space MX. ?d i) = \<mu>' (Y -` B \<inter> space M)"
17.918 - using X[unfolded measurable_def] by (auto intro!: arg_cong[where f=\<mu>'])
17.919 -qed
17.920 -
17.921 -lemma (in prob_space) setsum_joint_distribution_singleton:
17.922 - assumes X: "finite_random_variable MX X"
17.923 - assumes Y: "finite_random_variable MY Y" "b \<in> space MY"
17.924 - shows "(\<Sum>a\<in>space MX. joint_distribution X Y {(a, b)}) = distribution Y {b}"
17.925 - using setsum_joint_distribution[OF X
17.926 - finite_random_variableD[OF Y(1)]
17.927 - finite_random_variable_imp_sets[OF Y]] by simp
17.928 -
17.929 -lemma (in prob_space) setsum_distribution:
17.930 - assumes X: "finite_random_variable MX X" shows "(\<Sum>a\<in>space MX. distribution X {a}) = 1"
17.931 - using setsum_joint_distribution[OF assms, of "\<lparr> space = UNIV, sets = Pow UNIV \<rparr>" "\<lambda>x. ()" "{()}"]
17.932 - using sigma_algebra_Pow[of "UNIV::unit set" "()"] by simp
17.933 -
17.934 -locale pair_finite_prob_space = pair_prob_space M1 M2 + pair_finite_space M1 M2 + M1: finite_prob_space M1 + M2: finite_prob_space M2 for M1 M2
17.935 -
17.936 -sublocale pair_finite_prob_space \<subseteq> finite_prob_space P by default
17.937 -
17.938 -lemma funset_eq_UN_fun_upd_I:
17.939 - assumes *: "\<And>f. f \<in> F (insert a A) \<Longrightarrow> f(a := d) \<in> F A"
17.940 - and **: "\<And>f. f \<in> F (insert a A) \<Longrightarrow> f a \<in> G (f(a:=d))"
17.941 - and ***: "\<And>f x. \<lbrakk> f \<in> F A ; x \<in> G f \<rbrakk> \<Longrightarrow> f(a:=x) \<in> F (insert a A)"
17.942 - shows "F (insert a A) = (\<Union>f\<in>F A. fun_upd f a ` (G f))"
17.943 -proof safe
17.944 - fix f assume f: "f \<in> F (insert a A)"
17.945 - show "f \<in> (\<Union>f\<in>F A. fun_upd f a ` G f)"
17.946 - proof (rule UN_I[of "f(a := d)"])
17.947 - show "f(a := d) \<in> F A" using *[OF f] .
17.948 - show "f \<in> fun_upd (f(a:=d)) a ` G (f(a:=d))"
17.949 - proof (rule image_eqI[of _ _ "f a"])
17.950 - show "f a \<in> G (f(a := d))" using **[OF f] .
17.951 - qed simp
17.952 - qed
17.953 -next
17.954 - fix f x assume "f \<in> F A" "x \<in> G f"
17.955 - from ***[OF this] show "f(a := x) \<in> F (insert a A)" .
17.956 -qed
17.957 -
17.958 -lemma extensional_funcset_insert_eq[simp]:
17.959 - assumes "a \<notin> A"
17.960 - shows "extensional (insert a A) \<inter> (insert a A \<rightarrow> B) = (\<Union>f \<in> extensional A \<inter> (A \<rightarrow> B). (\<lambda>b. f(a := b)) ` B)"
17.961 - apply (rule funset_eq_UN_fun_upd_I)
17.962 - using assms
17.963 - by (auto intro!: inj_onI dest: inj_onD split: split_if_asm simp: extensional_def)
17.964 -
17.965 -lemma finite_extensional_funcset[simp, intro]:
17.966 - assumes "finite A" "finite B"
17.967 - shows "finite (extensional A \<inter> (A \<rightarrow> B))"
17.968 - using assms by induct (auto simp: extensional_funcset_insert_eq)
17.969 -
17.970 -lemma finite_PiE[simp, intro]:
17.971 - assumes fin: "finite A" "\<And>i. i \<in> A \<Longrightarrow> finite (B i)"
17.972 - shows "finite (Pi\<^isub>E A B)"
17.973 -proof -
17.974 - have *: "(Pi\<^isub>E A B) \<subseteq> extensional A \<inter> (A \<rightarrow> (\<Union>i\<in>A. B i))" by auto
17.975 - show ?thesis
17.976 - using fin by (intro finite_subset[OF *] finite_extensional_funcset) auto
17.977 -qed
17.978 -
17.979 -locale finite_product_finite_prob_space = finite_product_prob_space M I for M I +
17.980 - assumes finite_space: "\<And>i. finite_prob_space (M i)"
17.981 -
17.982 -sublocale finite_product_finite_prob_space \<subseteq> M!: finite_prob_space "M i" using finite_space .
17.983 -
17.984 -lemma (in finite_product_finite_prob_space) singleton_eq_product:
17.985 - assumes x: "x \<in> space P" shows "{x} = (\<Pi>\<^isub>E i\<in>I. {x i})"
17.986 -proof (safe intro!: ext[of _ x])
17.987 - fix y i assume *: "y \<in> (\<Pi> i\<in>I. {x i})" "y \<in> extensional I"
17.988 - with x show "y i = x i"
17.989 - by (cases "i \<in> I") (auto simp: extensional_def)
17.990 -qed (insert x, auto)
17.991 -
17.992 -sublocale finite_product_finite_prob_space \<subseteq> finite_prob_space "Pi\<^isub>M I M"
17.993 -proof
17.994 - show "finite (space P)"
17.995 - using finite_index M.finite_space by auto
17.996 -
17.997 - { fix x assume "x \<in> space P"
17.998 - with this[THEN singleton_eq_product]
17.999 - have "{x} \<in> sets P"
17.1000 - by (auto intro!: in_P) }
17.1001 - note x_in_P = this
17.1002 -
17.1003 - have "Pow (space P) \<subseteq> sets P"
17.1004 - proof
17.1005 - fix X assume "X \<in> Pow (space P)"
17.1006 - moreover then have "finite X"
17.1007 - using `finite (space P)` by (blast intro: finite_subset)
17.1008 - ultimately have "(\<Union>x\<in>X. {x}) \<in> sets P"
17.1009 - by (intro finite_UN x_in_P) auto
17.1010 - then show "X \<in> sets P" by simp
17.1011 - qed
17.1012 - with space_closed show [simp]: "sets P = Pow (space P)" ..
17.1013 -qed
17.1014 -
17.1015 -lemma (in finite_product_finite_prob_space) measure_finite_times:
17.1016 - "(\<And>i. i \<in> I \<Longrightarrow> X i \<subseteq> space (M i)) \<Longrightarrow> \<mu> (\<Pi>\<^isub>E i\<in>I. X i) = (\<Prod>i\<in>I. M.\<mu> i (X i))"
17.1017 - by (rule measure_times) simp
17.1018 -
17.1019 -lemma (in finite_product_finite_prob_space) measure_singleton_times:
17.1020 - assumes x: "x \<in> space P" shows "\<mu> {x} = (\<Prod>i\<in>I. M.\<mu> i {x i})"
17.1021 - unfolding singleton_eq_product[OF x] using x
17.1022 - by (intro measure_finite_times) auto
17.1023 -
17.1024 -lemma (in finite_product_finite_prob_space) prob_finite_times:
17.1025 - assumes X: "\<And>i. i \<in> I \<Longrightarrow> X i \<subseteq> space (M i)"
17.1026 - shows "prob (\<Pi>\<^isub>E i\<in>I. X i) = (\<Prod>i\<in>I. M.prob i (X i))"
17.1027 -proof -
17.1028 - have "ereal (\<mu>' (\<Pi>\<^isub>E i\<in>I. X i)) = \<mu> (\<Pi>\<^isub>E i\<in>I. X i)"
17.1029 - using X by (intro finite_measure_eq[symmetric] in_P) auto
17.1030 - also have "\<dots> = (\<Prod>i\<in>I. M.\<mu> i (X i))"
17.1031 - using measure_finite_times X by simp
17.1032 - also have "\<dots> = ereal (\<Prod>i\<in>I. M.\<mu>' i (X i))"
17.1033 - using X by (simp add: M.finite_measure_eq setprod_ereal)
17.1034 - finally show ?thesis by simp
17.1035 -qed
17.1036 -
17.1037 -lemma (in finite_product_finite_prob_space) prob_singleton_times:
17.1038 - assumes x: "x \<in> space P"
17.1039 - shows "prob {x} = (\<Prod>i\<in>I. M.prob i {x i})"
17.1040 - unfolding singleton_eq_product[OF x] using x
17.1041 - by (intro prob_finite_times) auto
17.1042 -
17.1043 -lemma (in finite_product_finite_prob_space) prob_finite_product:
17.1044 - "A \<subseteq> space P \<Longrightarrow> prob A = (\<Sum>x\<in>A. \<Prod>i\<in>I. M.prob i {x i})"
17.1045 - by (auto simp add: finite_measure_singleton prob_singleton_times
17.1046 - simp del: space_product_algebra
17.1047 - intro!: setsum_cong prob_singleton_times)
17.1048 -
17.1049 -lemma (in prob_space) joint_distribution_finite_prob_space:
17.1050 - assumes X: "finite_random_variable MX X"
17.1051 - assumes Y: "finite_random_variable MY Y"
17.1052 - shows "finite_prob_space ((MX \<Otimes>\<^isub>M MY)\<lparr> measure := ereal \<circ> joint_distribution X Y\<rparr>)"
17.1053 - by (intro distribution_finite_prob_space finite_random_variable_pairI X Y)
17.1054 -
17.1055 -lemma finite_prob_space_eq:
17.1056 - "finite_prob_space M \<longleftrightarrow> finite_measure_space M \<and> measure M (space M) = 1"
17.1057 - unfolding finite_prob_space_def finite_measure_space_def prob_space_def prob_space_axioms_def
17.1058 - by auto
17.1059 -
17.1060 -lemma (in finite_prob_space) sum_over_space_eq_1: "(\<Sum>x\<in>space M. \<mu> {x}) = 1"
17.1061 - using measure_space_1 sum_over_space by simp
17.1062 -
17.1063 -lemma (in finite_prob_space) joint_distribution_restriction_fst:
17.1064 - "joint_distribution X Y A \<le> distribution X (fst ` A)"
17.1065 - unfolding distribution_def
17.1066 -proof (safe intro!: finite_measure_mono)
17.1067 - fix x assume "x \<in> space M" and *: "(X x, Y x) \<in> A"
17.1068 - show "x \<in> X -` fst ` A"
17.1069 - by (auto intro!: image_eqI[OF _ *])
17.1070 -qed (simp_all add: sets_eq_Pow)
17.1071 -
17.1072 -lemma (in finite_prob_space) joint_distribution_restriction_snd:
17.1073 - "joint_distribution X Y A \<le> distribution Y (snd ` A)"
17.1074 - unfolding distribution_def
17.1075 -proof (safe intro!: finite_measure_mono)
17.1076 - fix x assume "x \<in> space M" and *: "(X x, Y x) \<in> A"
17.1077 - show "x \<in> Y -` snd ` A"
17.1078 - by (auto intro!: image_eqI[OF _ *])
17.1079 -qed (simp_all add: sets_eq_Pow)
17.1080 -
17.1081 -lemma (in finite_prob_space) distribution_order:
17.1082 - shows "0 \<le> distribution X x'"
17.1083 - and "(distribution X x' \<noteq> 0) \<longleftrightarrow> (0 < distribution X x')"
17.1084 - and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution X {x}"
17.1085 - and "r \<le> joint_distribution X Y {(x, y)} \<Longrightarrow> r \<le> distribution Y {y}"
17.1086 - and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution X {x}"
17.1087 - and "r < joint_distribution X Y {(x, y)} \<Longrightarrow> r < distribution Y {y}"
17.1088 - and "distribution X {x} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0"
17.1089 - and "distribution Y {y} = 0 \<Longrightarrow> joint_distribution X Y {(x, y)} = 0"
17.1090 - using
17.1091 - joint_distribution_restriction_fst[of X Y "{(x, y)}"]
17.1092 - joint_distribution_restriction_snd[of X Y "{(x, y)}"]
17.1093 - by (auto intro: antisym)
17.1094 -
17.1095 -lemma (in finite_prob_space) distribution_mono:
17.1096 - assumes "\<And>t. \<lbrakk> t \<in> space M ; X t \<in> x \<rbrakk> \<Longrightarrow> Y t \<in> y"
17.1097 - shows "distribution X x \<le> distribution Y y"
17.1098 - unfolding distribution_def
17.1099 - using assms by (auto simp: sets_eq_Pow intro!: finite_measure_mono)
17.1100 -
17.1101 -lemma (in finite_prob_space) distribution_mono_gt_0:
17.1102 - assumes gt_0: "0 < distribution X x"
17.1103 - assumes *: "\<And>t. \<lbrakk> t \<in> space M ; X t \<in> x \<rbrakk> \<Longrightarrow> Y t \<in> y"
17.1104 - shows "0 < distribution Y y"
17.1105 - by (rule less_le_trans[OF gt_0 distribution_mono]) (rule *)
17.1106 -
17.1107 -lemma (in finite_prob_space) sum_over_space_distrib:
17.1108 - "(\<Sum>x\<in>X`space M. distribution X {x}) = 1"
17.1109 - unfolding distribution_def prob_space[symmetric] using finite_space
17.1110 - by (subst finite_measure_finite_Union[symmetric])
17.1111 - (auto simp add: disjoint_family_on_def sets_eq_Pow
17.1112 - intro!: arg_cong[where f=\<mu>'])
17.1113 -
17.1114 -lemma (in finite_prob_space) finite_sum_over_space_eq_1:
17.1115 - "(\<Sum>x\<in>space M. prob {x}) = 1"
17.1116 - using prob_space finite_space
17.1117 - by (subst (asm) finite_measure_finite_singleton) auto
17.1118 -
17.1119 -lemma (in prob_space) distribution_remove_const:
17.1120 - shows "joint_distribution X (\<lambda>x. ()) {(x, ())} = distribution X {x}"
17.1121 - and "joint_distribution (\<lambda>x. ()) X {((), x)} = distribution X {x}"
17.1122 - and "joint_distribution X (\<lambda>x. (Y x, ())) {(x, y, ())} = joint_distribution X Y {(x, y)}"
17.1123 - and "joint_distribution X (\<lambda>x. ((), Y x)) {(x, (), y)} = joint_distribution X Y {(x, y)}"
17.1124 - and "distribution (\<lambda>x. ()) {()} = 1"
17.1125 - by (auto intro!: arg_cong[where f=\<mu>'] simp: distribution_def prob_space[symmetric])
17.1126 -
17.1127 -lemma (in finite_prob_space) setsum_distribution_gen:
17.1128 - assumes "Z -` {c} \<inter> space M = (\<Union>x \<in> X`space M. Y -` {f x}) \<inter> space M"
17.1129 - and "inj_on f (X`space M)"
17.1130 - shows "(\<Sum>x \<in> X`space M. distribution Y {f x}) = distribution Z {c}"
17.1131 - unfolding distribution_def assms
17.1132 - using finite_space assms
17.1133 - by (subst finite_measure_finite_Union[symmetric])
17.1134 - (auto simp add: disjoint_family_on_def sets_eq_Pow inj_on_def
17.1135 - intro!: arg_cong[where f=prob])
17.1136 -
17.1137 -lemma (in finite_prob_space) setsum_distribution_cut:
17.1138 - "(\<Sum>x \<in> X`space M. joint_distribution X Y {(x, y)}) = distribution Y {y}"
17.1139 - "(\<Sum>y \<in> Y`space M. joint_distribution X Y {(x, y)}) = distribution X {x}"
17.1140 - "(\<Sum>x \<in> X`space M. joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)}) = joint_distribution Y Z {(y, z)}"
17.1141 - "(\<Sum>y \<in> Y`space M. joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)}) = joint_distribution X Z {(x, z)}"
17.1142 - "(\<Sum>z \<in> Z`space M. joint_distribution X (\<lambda>x. (Y x, Z x)) {(x, y, z)}) = joint_distribution X Y {(x, y)}"
17.1143 - by (auto intro!: inj_onI setsum_distribution_gen)
17.1144 -
17.1145 -lemma (in finite_prob_space) uniform_prob:
17.1146 - assumes "x \<in> space M"
17.1147 - assumes "\<And> x y. \<lbrakk>x \<in> space M ; y \<in> space M\<rbrakk> \<Longrightarrow> prob {x} = prob {y}"
17.1148 - shows "prob {x} = 1 / card (space M)"
17.1149 -proof -
17.1150 - have prob_x: "\<And> y. y \<in> space M \<Longrightarrow> prob {y} = prob {x}"
17.1151 - using assms(2)[OF _ `x \<in> space M`] by blast
17.1152 - have "1 = prob (space M)"
17.1153 - using prob_space by auto
17.1154 - also have "\<dots> = (\<Sum> x \<in> space M. prob {x})"
17.1155 - using finite_measure_finite_Union[of "space M" "\<lambda> x. {x}", simplified]
17.1156 - sets_eq_Pow inj_singleton[unfolded inj_on_def, rule_format]
17.1157 - finite_space unfolding disjoint_family_on_def prob_space[symmetric]
17.1158 - by (auto simp add:setsum_restrict_set)
17.1159 - also have "\<dots> = (\<Sum> y \<in> space M. prob {x})"
17.1160 - using prob_x by auto
17.1161 - also have "\<dots> = real_of_nat (card (space M)) * prob {x}" by simp
17.1162 - finally have one: "1 = real (card (space M)) * prob {x}"
17.1163 - using real_eq_of_nat by auto
17.1164 - hence two: "real (card (space M)) \<noteq> 0" by fastforce
17.1165 - from one have three: "prob {x} \<noteq> 0" by fastforce
17.1166 - thus ?thesis using one two three divide_cancel_right
17.1167 - by (auto simp:field_simps)
17.1168 -qed
17.1169 -
17.1170 -lemma (in prob_space) prob_space_subalgebra:
17.1171 - assumes "sigma_algebra N" "sets N \<subseteq> sets M" "space N = space M"
17.1172 - and "\<And>A. A \<in> sets N \<Longrightarrow> measure N A = \<mu> A"
17.1173 - shows "prob_space N"
17.1174 -proof
17.1175 - interpret N: measure_space N
17.1176 - by (rule measure_space_subalgebra[OF assms])
17.1177 - show "measure_space N" ..
17.1178 - show "measure N (space N) = 1"
17.1179 - using assms(4)[OF N.top] by (simp add: assms measure_space_1)
17.1180 -qed
17.1181 -
17.1182 -lemma (in prob_space) prob_space_of_restricted_space:
17.1183 - assumes "\<mu> A \<noteq> 0" "A \<in> sets M"
17.1184 - shows "prob_space (restricted_space A \<lparr>measure := \<lambda>S. \<mu> S / \<mu> A\<rparr>)"
17.1185 - (is "prob_space ?P")
17.1186 -proof -
17.1187 - interpret A: measure_space "restricted_space A"
17.1188 - using `A \<in> sets M` by (rule restricted_measure_space)
17.1189 - interpret A': sigma_algebra ?P
17.1190 - by (rule A.sigma_algebra_cong) auto
17.1191 - show "prob_space ?P"
17.1192 - proof
17.1193 - show "measure_space ?P"
17.1194 - proof
17.1195 - show "positive ?P (measure ?P)"
17.1196 - proof (simp add: positive_def, safe)
17.1197 - fix B assume "B \<in> events"
17.1198 - with real_measure[of "A \<inter> B"] real_measure[OF `A \<in> events`] `A \<in> sets M`
17.1199 - show "0 \<le> \<mu> (A \<inter> B) / \<mu> A" by (auto simp: Int)
17.1200 - qed
17.1201 - show "countably_additive ?P (measure ?P)"
17.1202 - proof (simp add: countably_additive_def, safe)
17.1203 - fix B and F :: "nat \<Rightarrow> 'a set"
17.1204 - assume F: "range F \<subseteq> op \<inter> A ` events" "disjoint_family F"
17.1205 - { fix i
17.1206 - from F have "F i \<in> op \<inter> A ` events" by auto
17.1207 - with `A \<in> events` have "F i \<in> events" by auto }
17.1208 - moreover then have "range F \<subseteq> events" by auto
17.1209 - moreover have "\<And>S. \<mu> S / \<mu> A = inverse (\<mu> A) * \<mu> S"
17.1210 - by (simp add: mult_commute divide_ereal_def)
17.1211 - moreover have "0 \<le> inverse (\<mu> A)"
17.1212 - using real_measure[OF `A \<in> events`] by auto
17.1213 - ultimately show "(\<Sum>i. \<mu> (F i) / \<mu> A) = \<mu> (\<Union>i. F i) / \<mu> A"
17.1214 - using measure_countably_additive[of F] F
17.1215 - by (auto simp: suminf_cmult_ereal)
17.1216 - qed
17.1217 - qed
17.1218 - show "measure ?P (space ?P) = 1"
17.1219 - using real_measure[OF `A \<in> events`] `\<mu> A \<noteq> 0` by auto
17.1220 - qed
17.1221 -qed
17.1222 -
17.1223 -lemma finite_prob_spaceI:
17.1224 - assumes "finite (space M)" "sets M = Pow(space M)"
17.1225 - and 1: "measure M (space M) = 1" and "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> measure M {x}"
17.1226 - and add: "\<And>A B. A \<subseteq> space M \<Longrightarrow> measure M A = (\<Sum>x\<in>A. measure M {x})"
17.1227 - shows "finite_prob_space M"
17.1228 -proof -
17.1229 - interpret finite_measure_space M
17.1230 - proof
17.1231 - show "measure M (space M) \<noteq> \<infinity>" using 1 by simp
17.1232 - qed fact+
17.1233 - show ?thesis by default fact
17.1234 -qed
17.1235 -
17.1236 -lemma (in finite_prob_space) distribution_eq_setsum:
17.1237 - "distribution X A = (\<Sum>x\<in>A \<inter> X ` space M. distribution X {x})"
17.1238 -proof -
17.1239 - have *: "X -` A \<inter> space M = (\<Union>x\<in>A \<inter> X ` space M. X -` {x} \<inter> space M)"
17.1240 - by auto
17.1241 - then show "distribution X A = (\<Sum>x\<in>A \<inter> X ` space M. distribution X {x})"
17.1242 - using finite_space unfolding distribution_def *
17.1243 - by (intro finite_measure_finite_Union)
17.1244 - (auto simp: disjoint_family_on_def)
17.1245 -qed
17.1246 -
17.1247 -lemma (in finite_prob_space) distribution_eq_setsum_finite:
17.1248 - assumes "finite A"
17.1249 - shows "distribution X A = (\<Sum>x\<in>A. distribution X {x})"
17.1250 -proof -
17.1251 - note distribution_eq_setsum[of X A]
17.1252 - also have "(\<Sum>x\<in>A \<inter> X ` space M. distribution X {x}) = (\<Sum>x\<in>A. distribution X {x})"
17.1253 - proof (intro setsum_mono_zero_cong_left ballI)
17.1254 - fix i assume "i\<in>A - A \<inter> X ` space M"
17.1255 - then have "X -` {i} \<inter> space M = {}" by auto
17.1256 - then show "distribution X {i} = 0"
17.1257 - by (simp add: distribution_def)
17.1258 - next
17.1259 - show "finite A" by fact
17.1260 - qed simp_all
17.1261 + have "(\<integral>x. Py x * f x \<partial>P) = (\<integral>x. f (Y x) \<partial>M)"
17.1262 + by (rule distributed_integral) fact+
17.1263 + also have "\<dots> = (\<integral>x. f (T (X x)) \<partial>M)"
17.1264 + using Y by simp
17.1265 + also have "\<dots> = (\<integral>x. Px x * f (T x) \<partial>N)"
17.1266 + using measurable_comp[OF T f] Px by (intro distributed_integral[symmetric]) (auto simp: comp_def)
17.1267 finally show ?thesis .
17.1268 qed
17.1269
17.1270 -lemma (in finite_prob_space) finite_measure_space:
17.1271 - fixes X :: "'a \<Rightarrow> 'x"
17.1272 - shows "finite_measure_space \<lparr>space = X ` space M, sets = Pow (X ` space M), measure = ereal \<circ> distribution X\<rparr>"
17.1273 - (is "finite_measure_space ?S")
17.1274 -proof (rule finite_measure_spaceI, simp_all)
17.1275 - show "finite (X ` space M)" using finite_space by simp
17.1276 -next
17.1277 - fix A assume "A \<subseteq> X ` space M"
17.1278 - then show "distribution X A = (\<Sum>x\<in>A. distribution X {x})"
17.1279 - by (subst distribution_eq_setsum) (simp add: Int_absorb2)
17.1280 +lemma distributed_marginal_eq_joint:
17.1281 + assumes T: "sigma_finite_measure T"
17.1282 + assumes S: "sigma_finite_measure S"
17.1283 + assumes Px: "distributed M S X Px"
17.1284 + assumes Py: "distributed M T Y Py"
17.1285 + assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy"
17.1286 + shows "AE y in T. Py y = (\<integral>\<^isup>+x. Pxy (x, y) \<partial>S)"
17.1287 +proof (rule sigma_finite_measure.density_unique[OF T])
17.1288 + interpret ST: pair_sigma_finite S T using S T unfolding pair_sigma_finite_def by simp
17.1289 + show "Py \<in> borel_measurable T" "AE y in T. 0 \<le> Py y"
17.1290 + "(\<lambda>x. \<integral>\<^isup>+ xa. Pxy (xa, x) \<partial>S) \<in> borel_measurable T" "AE y in T. 0 \<le> \<integral>\<^isup>+ x. Pxy (x, y) \<partial>S"
17.1291 + using Pxy[THEN distributed_borel_measurable]
17.1292 + by (auto intro!: Py[THEN distributed_borel_measurable] Py[THEN distributed_AE]
17.1293 + ST.positive_integral_snd_measurable' positive_integral_positive)
17.1294 +
17.1295 + show "density T Py = density T (\<lambda>x. \<integral>\<^isup>+ xa. Pxy (xa, x) \<partial>S)"
17.1296 + proof (rule measure_eqI)
17.1297 + fix A assume A: "A \<in> sets (density T Py)"
17.1298 + have *: "\<And>x y. x \<in> space S \<Longrightarrow> indicator (space S \<times> A) (x, y) = indicator A y"
17.1299 + by (auto simp: indicator_def)
17.1300 + have "emeasure (density T Py) A = emeasure (distr M T Y) A"
17.1301 + unfolding Py[THEN distributed_distr_eq_density] ..
17.1302 + also have "\<dots> = emeasure (distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))) (space S \<times> A)"
17.1303 + using A Px Py Pxy
17.1304 + by (subst (1 2) emeasure_distr)
17.1305 + (auto dest: measurable_space distributed_measurable intro!: arg_cong[where f="emeasure M"])
17.1306 + also have "\<dots> = emeasure (density (S \<Otimes>\<^isub>M T) Pxy) (space S \<times> A)"
17.1307 + unfolding Pxy[THEN distributed_distr_eq_density] ..
17.1308 + also have "\<dots> = (\<integral>\<^isup>+ x. Pxy x * indicator (space S \<times> A) x \<partial>(S \<Otimes>\<^isub>M T))"
17.1309 + using A Pxy by (simp add: emeasure_density distributed_borel_measurable)
17.1310 + also have "\<dots> = (\<integral>\<^isup>+y. \<integral>\<^isup>+x. Pxy (x, y) * indicator (space S \<times> A) (x, y) \<partial>S \<partial>T)"
17.1311 + using A Pxy
17.1312 + by (subst ST.positive_integral_snd_measurable) (simp_all add: emeasure_density distributed_borel_measurable)
17.1313 + also have "\<dots> = (\<integral>\<^isup>+y. (\<integral>\<^isup>+x. Pxy (x, y) \<partial>S) * indicator A y \<partial>T)"
17.1314 + using measurable_comp[OF measurable_Pair1[OF measurable_identity] distributed_borel_measurable[OF Pxy]]
17.1315 + using distributed_borel_measurable[OF Pxy] distributed_AE[OF Pxy, THEN ST.AE_pair]
17.1316 + by (subst (asm) ST.AE_commute) (auto intro!: positive_integral_cong_AE positive_integral_multc cong: positive_integral_cong simp: * comp_def)
17.1317 + also have "\<dots> = emeasure (density T (\<lambda>x. \<integral>\<^isup>+ xa. Pxy (xa, x) \<partial>S)) A"
17.1318 + using A by (intro emeasure_density[symmetric]) (auto intro!: ST.positive_integral_snd_measurable' Pxy[THEN distributed_borel_measurable])
17.1319 + finally show "emeasure (density T Py) A = emeasure (density T (\<lambda>x. \<integral>\<^isup>+ xa. Pxy (xa, x) \<partial>S)) A" .
17.1320 + qed simp
17.1321 qed
17.1322
17.1323 -lemma (in finite_prob_space) finite_prob_space_of_images:
17.1324 - "finite_prob_space \<lparr> space = X ` space M, sets = Pow (X ` space M), measure = ereal \<circ> distribution X \<rparr>"
17.1325 - by (simp add: finite_prob_space_eq finite_measure_space measure_space_1 one_ereal_def)
17.1326 +lemma (in prob_space) distr_marginal1:
17.1327 + fixes Pxy :: "('b \<times> 'c) \<Rightarrow> real"
17.1328 + assumes "sigma_finite_measure S" "sigma_finite_measure T"
17.1329 + assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy"
17.1330 + defines "Px \<equiv> \<lambda>x. real (\<integral>\<^isup>+z. Pxy (x, z) \<partial>T)"
17.1331 + shows "distributed M S X Px"
17.1332 + unfolding distributed_def
17.1333 +proof safe
17.1334 + interpret S: sigma_finite_measure S by fact
17.1335 + interpret T: sigma_finite_measure T by fact
17.1336 + interpret ST: pair_sigma_finite S T by default
17.1337
17.1338 -lemma (in finite_prob_space) finite_product_measure_space:
17.1339 - fixes X :: "'a \<Rightarrow> 'x" and Y :: "'a \<Rightarrow> 'y"
17.1340 - assumes "finite s1" "finite s2"
17.1341 - shows "finite_measure_space \<lparr> space = s1 \<times> s2, sets = Pow (s1 \<times> s2), measure = ereal \<circ> joint_distribution X Y\<rparr>"
17.1342 - (is "finite_measure_space ?M")
17.1343 -proof (rule finite_measure_spaceI, simp_all)
17.1344 - show "finite (s1 \<times> s2)"
17.1345 - using assms by auto
17.1346 -next
17.1347 - fix A assume "A \<subseteq> (s1 \<times> s2)"
17.1348 - with assms show "joint_distribution X Y A = (\<Sum>x\<in>A. joint_distribution X Y {x})"
17.1349 - by (intro distribution_eq_setsum_finite) (auto dest: finite_subset)
17.1350 + have XY: "(\<lambda>x. (X x, Y x)) \<in> measurable M (S \<Otimes>\<^isub>M T)"
17.1351 + using Pxy by (rule distributed_measurable)
17.1352 + then show X: "X \<in> measurable M S"
17.1353 + unfolding measurable_pair_iff by (simp add: comp_def)
17.1354 + from XY have Y: "Y \<in> measurable M T"
17.1355 + unfolding measurable_pair_iff by (simp add: comp_def)
17.1356 +
17.1357 + from Pxy show borel: "(\<lambda>x. ereal (Px x)) \<in> borel_measurable S"
17.1358 + by (auto intro!: ST.positive_integral_fst_measurable borel_measurable_real_of_ereal dest!: distributed_real_measurable simp: Px_def)
17.1359 +
17.1360 + interpret Pxy: prob_space "distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))"
17.1361 + using XY by (rule prob_space_distr)
17.1362 + have "(\<integral>\<^isup>+ x. max 0 (ereal (- Pxy x)) \<partial>(S \<Otimes>\<^isub>M T)) = (\<integral>\<^isup>+ x. 0 \<partial>(S \<Otimes>\<^isub>M T))"
17.1363 + using Pxy
17.1364 + by (intro positive_integral_cong_AE) (auto simp: max_def dest: distributed_real_measurable distributed_real_AE)
17.1365 + then have Pxy_integrable: "integrable (S \<Otimes>\<^isub>M T) Pxy"
17.1366 + using Pxy Pxy.emeasure_space_1
17.1367 + by (simp add: integrable_def emeasure_density positive_integral_max_0 distributed_def borel_measurable_ereal_iff cong: positive_integral_cong)
17.1368 +
17.1369 + show "distr M S X = density S Px"
17.1370 + proof (rule measure_eqI)
17.1371 + fix A assume A: "A \<in> sets (distr M S X)"
17.1372 + with X Y XY have "emeasure (distr M S X) A = emeasure (distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))) (A \<times> space T)"
17.1373 + by (auto simp add: emeasure_distr
17.1374 + intro!: arg_cong[where f="emeasure M"] dest: measurable_space)
17.1375 + also have "\<dots> = emeasure (density (S \<Otimes>\<^isub>M T) Pxy) (A \<times> space T)"
17.1376 + using Pxy by (simp add: distributed_def)
17.1377 + also have "\<dots> = \<integral>\<^isup>+ x. \<integral>\<^isup>+ y. ereal (Pxy (x, y)) * indicator (A \<times> space T) (x, y) \<partial>T \<partial>S"
17.1378 + using A borel Pxy
17.1379 + by (simp add: emeasure_density ST.positive_integral_fst_measurable(2)[symmetric] distributed_def)
17.1380 + also have "\<dots> = \<integral>\<^isup>+ x. ereal (Px x) * indicator A x \<partial>S"
17.1381 + apply (rule positive_integral_cong_AE)
17.1382 + using Pxy[THEN distributed_real_AE, THEN ST.AE_pair] ST.integrable_fst_measurable(1)[OF Pxy_integrable] AE_space
17.1383 + proof eventually_elim
17.1384 + fix x assume "x \<in> space S" "AE y in T. 0 \<le> Pxy (x, y)" and i: "integrable T (\<lambda>y. Pxy (x, y))"
17.1385 + moreover have eq: "\<And>y. y \<in> space T \<Longrightarrow> indicator (A \<times> space T) (x, y) = indicator A x"
17.1386 + by (auto simp: indicator_def)
17.1387 + ultimately have "(\<integral>\<^isup>+ y. ereal (Pxy (x, y)) * indicator (A \<times> space T) (x, y) \<partial>T) =
17.1388 + (\<integral>\<^isup>+ y. ereal (Pxy (x, y)) \<partial>T) * indicator A x"
17.1389 + using Pxy[THEN distributed_real_measurable] by (simp add: eq positive_integral_multc measurable_Pair2 cong: positive_integral_cong)
17.1390 + also have "(\<integral>\<^isup>+ y. ereal (Pxy (x, y)) \<partial>T) = Px x"
17.1391 + using i by (simp add: Px_def ereal_real integrable_def positive_integral_positive)
17.1392 + finally show "(\<integral>\<^isup>+ y. ereal (Pxy (x, y)) * indicator (A \<times> space T) (x, y) \<partial>T) = ereal (Px x) * indicator A x" .
17.1393 + qed
17.1394 + finally show "emeasure (distr M S X) A = emeasure (density S Px) A"
17.1395 + using A borel Pxy by (simp add: emeasure_density)
17.1396 + qed simp
17.1397 +
17.1398 + show "AE x in S. 0 \<le> ereal (Px x)"
17.1399 + by (simp add: Px_def positive_integral_positive real_of_ereal_pos)
17.1400 qed
17.1401
17.1402 -lemma (in finite_prob_space) finite_product_measure_space_of_images:
17.1403 - shows "finite_measure_space \<lparr> space = X ` space M \<times> Y ` space M,
17.1404 - sets = Pow (X ` space M \<times> Y ` space M),
17.1405 - measure = ereal \<circ> joint_distribution X Y \<rparr>"
17.1406 - using finite_space by (auto intro!: finite_product_measure_space)
17.1407 +definition
17.1408 + "simple_distributed M X f \<longleftrightarrow> distributed M (count_space (X`space M)) X (\<lambda>x. ereal (f x)) \<and>
17.1409 + finite (X`space M)"
17.1410
17.1411 -lemma (in finite_prob_space) finite_product_prob_space_of_images:
17.1412 - "finite_prob_space \<lparr> space = X ` space M \<times> Y ` space M, sets = Pow (X ` space M \<times> Y ` space M),
17.1413 - measure = ereal \<circ> joint_distribution X Y \<rparr>"
17.1414 - (is "finite_prob_space ?S")
17.1415 -proof (simp add: finite_prob_space_eq finite_product_measure_space_of_images one_ereal_def)
17.1416 - have "X -` X ` space M \<inter> Y -` Y ` space M \<inter> space M = space M" by auto
17.1417 - thus "joint_distribution X Y (X ` space M \<times> Y ` space M) = 1"
17.1418 - by (simp add: distribution_def prob_space vimage_Times comp_def measure_space_1)
17.1419 +lemma simple_distributed:
17.1420 + "simple_distributed M X Px \<Longrightarrow> distributed M (count_space (X`space M)) X Px"
17.1421 + unfolding simple_distributed_def by auto
17.1422 +
17.1423 +lemma simple_distributed_finite[dest]: "simple_distributed M X P \<Longrightarrow> finite (X`space M)"
17.1424 + by (simp add: simple_distributed_def)
17.1425 +
17.1426 +lemma (in prob_space) distributed_simple_function_superset:
17.1427 + assumes X: "simple_function M X" "\<And>x. x \<in> X ` space M \<Longrightarrow> P x = measure M (X -` {x} \<inter> space M)"
17.1428 + assumes A: "X`space M \<subseteq> A" "finite A"
17.1429 + defines "S \<equiv> count_space A" and "P' \<equiv> (\<lambda>x. if x \<in> X`space M then P x else 0)"
17.1430 + shows "distributed M S X P'"
17.1431 + unfolding distributed_def
17.1432 +proof safe
17.1433 + show "(\<lambda>x. ereal (P' x)) \<in> borel_measurable S" unfolding S_def by simp
17.1434 + show "AE x in S. 0 \<le> ereal (P' x)"
17.1435 + using X by (auto simp: S_def P'_def simple_distributed_def intro!: measure_nonneg)
17.1436 + show "distr M S X = density S P'"
17.1437 + proof (rule measure_eqI_finite)
17.1438 + show "sets (distr M S X) = Pow A" "sets (density S P') = Pow A"
17.1439 + using A unfolding S_def by auto
17.1440 + show "finite A" by fact
17.1441 + fix a assume a: "a \<in> A"
17.1442 + then have "a \<notin> X`space M \<Longrightarrow> X -` {a} \<inter> space M = {}" by auto
17.1443 + with A a X have "emeasure (distr M S X) {a} = P' a"
17.1444 + by (subst emeasure_distr)
17.1445 + (auto simp add: S_def P'_def simple_functionD emeasure_eq_measure
17.1446 + intro!: arg_cong[where f=prob])
17.1447 + also have "\<dots> = (\<integral>\<^isup>+x. ereal (P' a) * indicator {a} x \<partial>S)"
17.1448 + using A X a
17.1449 + by (subst positive_integral_cmult_indicator)
17.1450 + (auto simp: S_def P'_def simple_distributed_def simple_functionD measure_nonneg)
17.1451 + also have "\<dots> = (\<integral>\<^isup>+x. ereal (P' x) * indicator {a} x \<partial>S)"
17.1452 + by (auto simp: indicator_def intro!: positive_integral_cong)
17.1453 + also have "\<dots> = emeasure (density S P') {a}"
17.1454 + using a A by (intro emeasure_density[symmetric]) (auto simp: S_def)
17.1455 + finally show "emeasure (distr M S X) {a} = emeasure (density S P') {a}" .
17.1456 + qed
17.1457 + show "random_variable S X"
17.1458 + using X(1) A by (auto simp: measurable_def simple_functionD S_def)
17.1459 qed
17.1460
17.1461 -subsection "Borel Measure on {0 ..< 1}"
17.1462 +lemma (in prob_space) simple_distributedI:
17.1463 + assumes X: "simple_function M X" "\<And>x. x \<in> X ` space M \<Longrightarrow> P x = measure M (X -` {x} \<inter> space M)"
17.1464 + shows "simple_distributed M X P"
17.1465 + unfolding simple_distributed_def
17.1466 +proof
17.1467 + have "distributed M (count_space (X ` space M)) X (\<lambda>x. ereal (if x \<in> X`space M then P x else 0))"
17.1468 + (is "?A")
17.1469 + using simple_functionD[OF X(1)] by (intro distributed_simple_function_superset[OF X]) auto
17.1470 + also have "?A \<longleftrightarrow> distributed M (count_space (X ` space M)) X (\<lambda>x. ereal (P x))"
17.1471 + by (rule distributed_cong_density) auto
17.1472 + finally show "\<dots>" .
17.1473 +qed (rule simple_functionD[OF X(1)])
17.1474
17.1475 -definition pborel :: "real measure_space" where
17.1476 - "pborel = lborel.restricted_space {0 ..< 1}"
17.1477 -
17.1478 -lemma space_pborel[simp]:
17.1479 - "space pborel = {0 ..< 1}"
17.1480 - unfolding pborel_def by auto
17.1481 -
17.1482 -lemma sets_pborel:
17.1483 - "A \<in> sets pborel \<longleftrightarrow> A \<in> sets borel \<and> A \<subseteq> { 0 ..< 1}"
17.1484 - unfolding pborel_def by auto
17.1485 -
17.1486 -lemma in_pborel[intro, simp]:
17.1487 - "A \<subseteq> {0 ..< 1} \<Longrightarrow> A \<in> sets borel \<Longrightarrow> A \<in> sets pborel"
17.1488 - unfolding pborel_def by auto
17.1489 -
17.1490 -interpretation pborel: measure_space pborel
17.1491 - using lborel.restricted_measure_space[of "{0 ..< 1}"]
17.1492 - by (simp add: pborel_def)
17.1493 -
17.1494 -interpretation pborel: prob_space pborel
17.1495 -proof
17.1496 - show "measure pborel (space pborel) = 1"
17.1497 - by (simp add: one_ereal_def pborel_def)
17.1498 -qed default
17.1499 -
17.1500 -lemma pborel_prob: "pborel.prob A = (if A \<in> sets borel \<and> A \<subseteq> {0 ..< 1} then real (lborel.\<mu> A) else 0)"
17.1501 - unfolding pborel.\<mu>'_def by (auto simp: pborel_def)
17.1502 -
17.1503 -lemma pborel_singelton[simp]: "pborel.prob {a} = 0"
17.1504 - by (auto simp: pborel_prob)
17.1505 -
17.1506 -lemma
17.1507 - shows pborel_atLeastAtMost[simp]: "pborel.\<mu>' {a .. b} = (if 0 \<le> a \<and> a \<le> b \<and> b < 1 then b - a else 0)"
17.1508 - and pborel_atLeastLessThan[simp]: "pborel.\<mu>' {a ..< b} = (if 0 \<le> a \<and> a \<le> b \<and> b \<le> 1 then b - a else 0)"
17.1509 - and pborel_greaterThanAtMost[simp]: "pborel.\<mu>' {a <.. b} = (if 0 \<le> a \<and> a \<le> b \<and> b < 1 then b - a else 0)"
17.1510 - and pborel_greaterThanLessThan[simp]: "pborel.\<mu>' {a <..< b} = (if 0 \<le> a \<and> a \<le> b \<and> b \<le> 1 then b - a else 0)"
17.1511 - unfolding pborel_prob
17.1512 - by (auto simp: atLeastAtMost_subseteq_atLeastLessThan_iff
17.1513 - greaterThanAtMost_subseteq_atLeastLessThan_iff greaterThanLessThan_subseteq_atLeastLessThan_iff)
17.1514 -
17.1515 -lemma pborel_lebesgue_measure:
17.1516 - "A \<in> sets pborel \<Longrightarrow> pborel.prob A = real (measure lebesgue A)"
17.1517 - by (simp add: sets_pborel pborel_prob)
17.1518 -
17.1519 -lemma pborel_alt:
17.1520 - "pborel = sigma \<lparr>
17.1521 - space = {0..<1},
17.1522 - sets = range (\<lambda>(x,y). {x..<y} \<inter> {0..<1}),
17.1523 - measure = measure lborel \<rparr>" (is "_ = ?R")
17.1524 +lemma simple_distributed_joint_finite:
17.1525 + assumes X: "simple_distributed M (\<lambda>x. (X x, Y x)) Px"
17.1526 + shows "finite (X ` space M)" "finite (Y ` space M)"
17.1527 proof -
17.1528 - have *: "{0..<1::real} \<in> sets borel" by auto
17.1529 - have **: "op \<inter> {0..<1::real} ` range (\<lambda>(x, y). {x..<y}) = range (\<lambda>(x,y). {x..<y} \<inter> {0..<1})"
17.1530 - unfolding image_image by (intro arg_cong[where f=range]) auto
17.1531 - have "pborel = algebra.restricted_space (sigma \<lparr>space=UNIV, sets=range (\<lambda>(a, b). {a ..< b :: real}),
17.1532 - measure = measure pborel\<rparr>) {0 ..< 1}"
17.1533 - by (simp add: sigma_def lebesgue_def pborel_def borel_eq_atLeastLessThan lborel_def)
17.1534 - also have "\<dots> = ?R"
17.1535 - by (subst restricted_sigma)
17.1536 - (simp_all add: sets_sigma sigma_sets.Basic ** pborel_def image_eqI[of _ _ "(0,1)"])
17.1537 - finally show ?thesis .
17.1538 + have "finite ((\<lambda>x. (X x, Y x)) ` space M)"
17.1539 + using X by (auto simp: simple_distributed_def simple_functionD)
17.1540 + then have "finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)" "finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)"
17.1541 + by auto
17.1542 + then show fin: "finite (X ` space M)" "finite (Y ` space M)"
17.1543 + by (auto simp: image_image)
17.1544 qed
17.1545
17.1546 -subsection "Bernoulli space"
17.1547 +lemma simple_distributed_joint2_finite:
17.1548 + assumes X: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Px"
17.1549 + shows "finite (X ` space M)" "finite (Y ` space M)" "finite (Z ` space M)"
17.1550 +proof -
17.1551 + have "finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)"
17.1552 + using X by (auto simp: simple_distributed_def simple_functionD)
17.1553 + then have "finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M)"
17.1554 + "finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)"
17.1555 + "finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)"
17.1556 + by auto
17.1557 + then show fin: "finite (X ` space M)" "finite (Y ` space M)" "finite (Z ` space M)"
17.1558 + by (auto simp: image_image)
17.1559 +qed
17.1560
17.1561 -definition "bernoulli_space p = \<lparr> space = UNIV, sets = UNIV,
17.1562 - measure = ereal \<circ> setsum (\<lambda>b. if b then min 1 (max 0 p) else 1 - min 1 (max 0 p)) \<rparr>"
17.1563 +lemma simple_distributed_simple_function:
17.1564 + "simple_distributed M X Px \<Longrightarrow> simple_function M X"
17.1565 + unfolding simple_distributed_def distributed_def
17.1566 + by (auto simp: simple_function_def)
17.1567
17.1568 -interpretation bernoulli: finite_prob_space "bernoulli_space p" for p
17.1569 - by (rule finite_prob_spaceI)
17.1570 - (auto simp: bernoulli_space_def UNIV_bool one_ereal_def setsum_Un_disjoint intro!: setsum_nonneg)
17.1571 +lemma simple_distributed_measure:
17.1572 + "simple_distributed M X P \<Longrightarrow> a \<in> X`space M \<Longrightarrow> P a = measure M (X -` {a} \<inter> space M)"
17.1573 + using distributed_count_space[of M "X`space M" X P a, symmetric]
17.1574 + by (auto simp: simple_distributed_def measure_def)
17.1575
17.1576 -lemma bernoulli_measure:
17.1577 - "0 \<le> p \<Longrightarrow> p \<le> 1 \<Longrightarrow> bernoulli.prob p B = (\<Sum>b\<in>B. if b then p else 1 - p)"
17.1578 - unfolding bernoulli.\<mu>'_def unfolding bernoulli_space_def by (auto intro!: setsum_cong)
17.1579 +lemma simple_distributed_nonneg: "simple_distributed M X f \<Longrightarrow> x \<in> space M \<Longrightarrow> 0 \<le> f (X x)"
17.1580 + by (auto simp: simple_distributed_measure measure_nonneg)
17.1581
17.1582 -lemma bernoulli_measure_True: "0 \<le> p \<Longrightarrow> p \<le> 1 \<Longrightarrow> bernoulli.prob p {True} = p"
17.1583 - and bernoulli_measure_False: "0 \<le> p \<Longrightarrow> p \<le> 1 \<Longrightarrow> bernoulli.prob p {False} = 1 - p"
17.1584 - unfolding bernoulli_measure by simp_all
17.1585 +lemma (in prob_space) simple_distributed_joint:
17.1586 + assumes X: "simple_distributed M (\<lambda>x. (X x, Y x)) Px"
17.1587 + defines "S \<equiv> count_space (X`space M) \<Otimes>\<^isub>M count_space (Y`space M)"
17.1588 + defines "P \<equiv> (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x))`space M then Px x else 0)"
17.1589 + shows "distributed M S (\<lambda>x. (X x, Y x)) P"
17.1590 +proof -
17.1591 + from simple_distributed_joint_finite[OF X, simp]
17.1592 + have S_eq: "S = count_space (X`space M \<times> Y`space M)"
17.1593 + by (simp add: S_def pair_measure_count_space)
17.1594 + show ?thesis
17.1595 + unfolding S_eq P_def
17.1596 + proof (rule distributed_simple_function_superset)
17.1597 + show "simple_function M (\<lambda>x. (X x, Y x))"
17.1598 + using X by (rule simple_distributed_simple_function)
17.1599 + fix x assume "x \<in> (\<lambda>x. (X x, Y x)) ` space M"
17.1600 + from simple_distributed_measure[OF X this]
17.1601 + show "Px x = prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M)" .
17.1602 + qed auto
17.1603 +qed
17.1604 +
17.1605 +lemma (in prob_space) simple_distributed_joint2:
17.1606 + assumes X: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Px"
17.1607 + defines "S \<equiv> count_space (X`space M) \<Otimes>\<^isub>M count_space (Y`space M) \<Otimes>\<^isub>M count_space (Z`space M)"
17.1608 + defines "P \<equiv> (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x))`space M then Px x else 0)"
17.1609 + shows "distributed M S (\<lambda>x. (X x, Y x, Z x)) P"
17.1610 +proof -
17.1611 + from simple_distributed_joint2_finite[OF X, simp]
17.1612 + have S_eq: "S = count_space (X`space M \<times> Y`space M \<times> Z`space M)"
17.1613 + by (simp add: S_def pair_measure_count_space)
17.1614 + show ?thesis
17.1615 + unfolding S_eq P_def
17.1616 + proof (rule distributed_simple_function_superset)
17.1617 + show "simple_function M (\<lambda>x. (X x, Y x, Z x))"
17.1618 + using X by (rule simple_distributed_simple_function)
17.1619 + fix x assume "x \<in> (\<lambda>x. (X x, Y x, Z x)) ` space M"
17.1620 + from simple_distributed_measure[OF X this]
17.1621 + show "Px x = prob ((\<lambda>x. (X x, Y x, Z x)) -` {x} \<inter> space M)" .
17.1622 + qed auto
17.1623 +qed
17.1624 +
17.1625 +lemma (in prob_space) simple_distributed_setsum_space:
17.1626 + assumes X: "simple_distributed M X f"
17.1627 + shows "setsum f (X`space M) = 1"
17.1628 +proof -
17.1629 + from X have "setsum f (X`space M) = prob (\<Union>i\<in>X`space M. X -` {i} \<inter> space M)"
17.1630 + by (subst finite_measure_finite_Union)
17.1631 + (auto simp add: disjoint_family_on_def simple_distributed_measure simple_distributed_simple_function simple_functionD
17.1632 + intro!: setsum_cong arg_cong[where f="prob"])
17.1633 + also have "\<dots> = prob (space M)"
17.1634 + by (auto intro!: arg_cong[where f=prob])
17.1635 + finally show ?thesis
17.1636 + using emeasure_space_1 by (simp add: emeasure_eq_measure one_ereal_def)
17.1637 +qed
17.1638 +
17.1639 +lemma (in prob_space) distributed_marginal_eq_joint_simple:
17.1640 + assumes Px: "simple_function M X"
17.1641 + assumes Py: "simple_distributed M Y Py"
17.1642 + assumes Pxy: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"
17.1643 + assumes y: "y \<in> Y`space M"
17.1644 + shows "Py y = (\<Sum>x\<in>X`space M. if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)"
17.1645 +proof -
17.1646 + note Px = simple_distributedI[OF Px refl]
17.1647 + have *: "\<And>f A. setsum (\<lambda>x. max 0 (ereal (f x))) A = ereal (setsum (\<lambda>x. max 0 (f x)) A)"
17.1648 + by (simp add: setsum_ereal[symmetric] zero_ereal_def)
17.1649 + from distributed_marginal_eq_joint[OF sigma_finite_measure_count_space_finite sigma_finite_measure_count_space_finite
17.1650 + simple_distributed[OF Px] simple_distributed[OF Py] simple_distributed_joint[OF Pxy],
17.1651 + OF Py[THEN simple_distributed_finite] Px[THEN simple_distributed_finite]]
17.1652 + y Px[THEN simple_distributed_finite] Py[THEN simple_distributed_finite]
17.1653 + Pxy[THEN simple_distributed, THEN distributed_real_AE]
17.1654 + show ?thesis
17.1655 + unfolding AE_count_space
17.1656 + apply (elim ballE[where x=y])
17.1657 + apply (auto simp add: positive_integral_count_space_finite * intro!: setsum_cong split: split_max)
17.1658 + done
17.1659 +qed
17.1660 +
17.1661 +
17.1662 +lemma prob_space_uniform_measure:
17.1663 + assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>"
17.1664 + shows "prob_space (uniform_measure M A)"
17.1665 +proof
17.1666 + show "emeasure (uniform_measure M A) (space (uniform_measure M A)) = 1"
17.1667 + using emeasure_uniform_measure[OF emeasure_neq_0_sets[OF A(1)], of "space M"]
17.1668 + using sets_into_space[OF emeasure_neq_0_sets[OF A(1)]] A
17.1669 + by (simp add: Int_absorb2 emeasure_nonneg)
17.1670 +qed
17.1671 +
17.1672 +lemma prob_space_uniform_count_measure: "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> prob_space (uniform_count_measure A)"
17.1673 + by default (auto simp: emeasure_uniform_count_measure space_uniform_count_measure one_ereal_def)
17.1674
17.1675 end
18.1 --- a/src/HOL/Probability/Radon_Nikodym.thy Mon Apr 23 12:23:23 2012 +0100
18.2 +++ b/src/HOL/Probability/Radon_Nikodym.thy Mon Apr 23 12:14:35 2012 +0200
18.3 @@ -8,45 +8,79 @@
18.4 imports Lebesgue_Integration
18.5 begin
18.6
18.7 +definition "diff_measure M N =
18.8 + measure_of (space M) (sets M) (\<lambda>A. emeasure M A - emeasure N A)"
18.9 +
18.10 +lemma
18.11 + shows space_diff_measure[simp]: "space (diff_measure M N) = space M"
18.12 + and sets_diff_measure[simp]: "sets (diff_measure M N) = sets M"
18.13 + by (auto simp: diff_measure_def)
18.14 +
18.15 +lemma emeasure_diff_measure:
18.16 + assumes fin: "finite_measure M" "finite_measure N" and sets_eq: "sets M = sets N"
18.17 + assumes pos: "\<And>A. A \<in> sets M \<Longrightarrow> emeasure N A \<le> emeasure M A" and A: "A \<in> sets M"
18.18 + shows "emeasure (diff_measure M N) A = emeasure M A - emeasure N A" (is "_ = ?\<mu> A")
18.19 + unfolding diff_measure_def
18.20 +proof (rule emeasure_measure_of_sigma)
18.21 + show "sigma_algebra (space M) (sets M)" ..
18.22 + show "positive (sets M) ?\<mu>"
18.23 + using pos by (simp add: positive_def ereal_diff_positive)
18.24 + show "countably_additive (sets M) ?\<mu>"
18.25 + proof (rule countably_additiveI)
18.26 + fix A :: "nat \<Rightarrow> _" assume A: "range A \<subseteq> sets M" and "disjoint_family A"
18.27 + then have suminf:
18.28 + "(\<Sum>i. emeasure M (A i)) = emeasure M (\<Union>i. A i)"
18.29 + "(\<Sum>i. emeasure N (A i)) = emeasure N (\<Union>i. A i)"
18.30 + by (simp_all add: suminf_emeasure sets_eq)
18.31 + with A have "(\<Sum>i. emeasure M (A i) - emeasure N (A i)) =
18.32 + (\<Sum>i. emeasure M (A i)) - (\<Sum>i. emeasure N (A i))"
18.33 + using fin
18.34 + by (intro suminf_ereal_minus pos emeasure_nonneg)
18.35 + (auto simp: sets_eq finite_measure.emeasure_eq_measure suminf_emeasure)
18.36 + then show "(\<Sum>i. emeasure M (A i) - emeasure N (A i)) =
18.37 + emeasure M (\<Union>i. A i) - emeasure N (\<Union>i. A i) "
18.38 + by (simp add: suminf)
18.39 + qed
18.40 +qed fact
18.41 +
18.42 lemma (in sigma_finite_measure) Ex_finite_integrable_function:
18.43 shows "\<exists>h\<in>borel_measurable M. integral\<^isup>P M h \<noteq> \<infinity> \<and> (\<forall>x\<in>space M. 0 < h x \<and> h x < \<infinity>) \<and> (\<forall>x. 0 \<le> h x)"
18.44 proof -
18.45 obtain A :: "nat \<Rightarrow> 'a set" where
18.46 range: "range A \<subseteq> sets M" and
18.47 space: "(\<Union>i. A i) = space M" and
18.48 - measure: "\<And>i. \<mu> (A i) \<noteq> \<infinity>" and
18.49 + measure: "\<And>i. emeasure M (A i) \<noteq> \<infinity>" and
18.50 disjoint: "disjoint_family A"
18.51 - using disjoint_sigma_finite by auto
18.52 - let ?B = "\<lambda>i. 2^Suc i * \<mu> (A i)"
18.53 + using sigma_finite_disjoint by auto
18.54 + let ?B = "\<lambda>i. 2^Suc i * emeasure M (A i)"
18.55 have "\<forall>i. \<exists>x. 0 < x \<and> x < inverse (?B i)"
18.56 proof
18.57 - fix i have Ai: "A i \<in> sets M" using range by auto
18.58 - from measure positive_measure[OF this]
18.59 - show "\<exists>x. 0 < x \<and> x < inverse (?B i)"
18.60 - by (auto intro!: ereal_dense simp: ereal_0_gt_inverse)
18.61 + fix i show "\<exists>x. 0 < x \<and> x < inverse (?B i)"
18.62 + using measure[of i] emeasure_nonneg[of M "A i"]
18.63 + by (auto intro!: ereal_dense simp: ereal_0_gt_inverse ereal_zero_le_0_iff)
18.64 qed
18.65 from choice[OF this] obtain n where n: "\<And>i. 0 < n i"
18.66 - "\<And>i. n i < inverse (2^Suc i * \<mu> (A i))" by auto
18.67 + "\<And>i. n i < inverse (2^Suc i * emeasure M (A i))" by auto
18.68 { fix i have "0 \<le> n i" using n(1)[of i] by auto } note pos = this
18.69 let ?h = "\<lambda>x. \<Sum>i. n i * indicator (A i) x"
18.70 show ?thesis
18.71 proof (safe intro!: bexI[of _ ?h] del: notI)
18.72 have "\<And>i. A i \<in> sets M"
18.73 using range by fastforce+
18.74 - then have "integral\<^isup>P M ?h = (\<Sum>i. n i * \<mu> (A i))" using pos
18.75 + then have "integral\<^isup>P M ?h = (\<Sum>i. n i * emeasure M (A i))" using pos
18.76 by (simp add: positive_integral_suminf positive_integral_cmult_indicator)
18.77 also have "\<dots> \<le> (\<Sum>i. (1 / 2)^Suc i)"
18.78 proof (rule suminf_le_pos)
18.79 fix N
18.80 - have "n N * \<mu> (A N) \<le> inverse (2^Suc N * \<mu> (A N)) * \<mu> (A N)"
18.81 - using positive_measure[OF `A N \<in> sets M`] n[of N]
18.82 + have "n N * emeasure M (A N) \<le> inverse (2^Suc N * emeasure M (A N)) * emeasure M (A N)"
18.83 + using n[of N]
18.84 by (intro ereal_mult_right_mono) auto
18.85 also have "\<dots> \<le> (1 / 2) ^ Suc N"
18.86 using measure[of N] n[of N]
18.87 - by (cases rule: ereal2_cases[of "n N" "\<mu> (A N)"])
18.88 + by (cases rule: ereal2_cases[of "n N" "emeasure M (A N)"])
18.89 (simp_all add: inverse_eq_divide power_divide one_ereal_def ereal_power_divide)
18.90 - finally show "n N * \<mu> (A N) \<le> (1 / 2) ^ Suc N" .
18.91 - show "0 \<le> n N * \<mu> (A N)" using n[of N] `A N \<in> sets M` by simp
18.92 + finally show "n N * emeasure M (A N) \<le> (1 / 2) ^ Suc N" .
18.93 + show "0 \<le> n N * emeasure M (A N)" using n[of N] `A N \<in> sets M` by (simp add: emeasure_nonneg)
18.94 qed
18.95 finally show "integral\<^isup>P M ?h \<noteq> \<infinity>" unfolding suminf_half_series_ereal by auto
18.96 next
18.97 @@ -71,68 +105,45 @@
18.98
18.99 subsection "Absolutely continuous"
18.100
18.101 -definition (in measure_space)
18.102 - "absolutely_continuous \<nu> = (\<forall>N\<in>null_sets. \<nu> N = (0 :: ereal))"
18.103 +definition absolutely_continuous :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> bool" where
18.104 + "absolutely_continuous M N \<longleftrightarrow> null_sets M \<subseteq> null_sets N"
18.105
18.106 -lemma (in measure_space) absolutely_continuous_AE:
18.107 - assumes "measure_space M'" and [simp]: "sets M' = sets M" "space M' = space M"
18.108 - and "absolutely_continuous (measure M')" "AE x. P x"
18.109 +lemma absolutely_continuousI_count_space: "absolutely_continuous (count_space A) M"
18.110 + unfolding absolutely_continuous_def by (auto simp: null_sets_count_space)
18.111 +
18.112 +lemma absolutely_continuousI_density:
18.113 + "f \<in> borel_measurable M \<Longrightarrow> absolutely_continuous M (density M f)"
18.114 + by (force simp add: absolutely_continuous_def null_sets_density_iff dest: AE_not_in)
18.115 +
18.116 +lemma absolutely_continuousI_point_measure_finite:
18.117 + "(\<And>x. \<lbrakk> x \<in> A ; f x \<le> 0 \<rbrakk> \<Longrightarrow> g x \<le> 0) \<Longrightarrow> absolutely_continuous (point_measure A f) (point_measure A g)"
18.118 + unfolding absolutely_continuous_def by (force simp: null_sets_point_measure_iff)
18.119 +
18.120 +lemma absolutely_continuous_AE:
18.121 + assumes sets_eq: "sets M' = sets M"
18.122 + and "absolutely_continuous M M'" "AE x in M. P x"
18.123 shows "AE x in M'. P x"
18.124 proof -
18.125 - interpret \<nu>: measure_space M' by fact
18.126 - from `AE x. P x` obtain N where N: "N \<in> null_sets" and "{x\<in>space M. \<not> P x} \<subseteq> N"
18.127 - unfolding almost_everywhere_def by auto
18.128 + from `AE x in M. P x` obtain N where N: "N \<in> null_sets M" "{x\<in>space M. \<not> P x} \<subseteq> N"
18.129 + unfolding eventually_ae_filter by auto
18.130 show "AE x in M'. P x"
18.131 - proof (rule \<nu>.AE_I')
18.132 - show "{x\<in>space M'. \<not> P x} \<subseteq> N" by simp fact
18.133 - from `absolutely_continuous (measure M')` show "N \<in> \<nu>.null_sets"
18.134 - using N unfolding absolutely_continuous_def by auto
18.135 + proof (rule AE_I')
18.136 + show "{x\<in>space M'. \<not> P x} \<subseteq> N" using sets_eq_imp_space_eq[OF sets_eq] N(2) by simp
18.137 + from `absolutely_continuous M M'` show "N \<in> null_sets M'"
18.138 + using N unfolding absolutely_continuous_def sets_eq null_sets_def by auto
18.139 qed
18.140 qed
18.141
18.142 -lemma (in finite_measure_space) absolutely_continuousI:
18.143 - assumes "finite_measure_space (M\<lparr> measure := \<nu>\<rparr>)" (is "finite_measure_space ?\<nu>")
18.144 - assumes v: "\<And>x. \<lbrakk> x \<in> space M ; \<mu> {x} = 0 \<rbrakk> \<Longrightarrow> \<nu> {x} = 0"
18.145 - shows "absolutely_continuous \<nu>"
18.146 -proof (unfold absolutely_continuous_def sets_eq_Pow, safe)
18.147 - fix N assume "\<mu> N = 0" "N \<subseteq> space M"
18.148 - interpret v: finite_measure_space ?\<nu> by fact
18.149 - have "\<nu> N = measure ?\<nu> (\<Union>x\<in>N. {x})" by simp
18.150 - also have "\<dots> = (\<Sum>x\<in>N. measure ?\<nu> {x})"
18.151 - proof (rule v.measure_setsum[symmetric])
18.152 - show "finite N" using `N \<subseteq> space M` finite_space by (auto intro: finite_subset)
18.153 - show "disjoint_family_on (\<lambda>i. {i}) N" unfolding disjoint_family_on_def by auto
18.154 - fix x assume "x \<in> N" thus "{x} \<in> sets ?\<nu>" using `N \<subseteq> space M` sets_eq_Pow by auto
18.155 - qed
18.156 - also have "\<dots> = 0"
18.157 - proof (safe intro!: setsum_0')
18.158 - fix x assume "x \<in> N"
18.159 - hence "\<mu> {x} \<le> \<mu> N" "0 \<le> \<mu> {x}"
18.160 - using sets_eq_Pow `N \<subseteq> space M` positive_measure[of "{x}"]
18.161 - by (auto intro!: measure_mono)
18.162 - then have "\<mu> {x} = 0" using `\<mu> N = 0` by simp
18.163 - thus "measure ?\<nu> {x} = 0" using v[of x] `x \<in> N` `N \<subseteq> space M` by auto
18.164 - qed
18.165 - finally show "\<nu> N = 0" by simp
18.166 -qed
18.167 -
18.168 -lemma (in measure_space) density_is_absolutely_continuous:
18.169 - assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.170 - shows "absolutely_continuous \<nu>"
18.171 - using assms unfolding absolutely_continuous_def
18.172 - by (simp add: positive_integral_null_set)
18.173 -
18.174 subsection "Existence of the Radon-Nikodym derivative"
18.175
18.176 lemma (in finite_measure) Radon_Nikodym_aux_epsilon:
18.177 fixes e :: real assumes "0 < e"
18.178 - assumes "finite_measure (M\<lparr>measure := \<nu>\<rparr>)"
18.179 - shows "\<exists>A\<in>sets M. \<mu>' (space M) - finite_measure.\<mu>' (M\<lparr>measure := \<nu>\<rparr>) (space M) \<le>
18.180 - \<mu>' A - finite_measure.\<mu>' (M\<lparr>measure := \<nu>\<rparr>) A \<and>
18.181 - (\<forall>B\<in>sets M. B \<subseteq> A \<longrightarrow> - e < \<mu>' B - finite_measure.\<mu>' (M\<lparr>measure := \<nu>\<rparr>) B)"
18.182 + assumes "finite_measure N" and sets_eq: "sets N = sets M"
18.183 + shows "\<exists>A\<in>sets M. measure M (space M) - measure N (space M) \<le> measure M A - measure N A \<and>
18.184 + (\<forall>B\<in>sets M. B \<subseteq> A \<longrightarrow> - e < measure M B - measure N B)"
18.185 proof -
18.186 - interpret M': finite_measure "M\<lparr>measure := \<nu>\<rparr>" by fact
18.187 - let ?d = "\<lambda>A. \<mu>' A - M'.\<mu>' A"
18.188 + interpret M': finite_measure N by fact
18.189 + let ?d = "\<lambda>A. measure M A - measure N A"
18.190 let ?A = "\<lambda>A. if (\<forall>B\<in>sets M. B \<subseteq> space M - A \<longrightarrow> -e < ?d B)
18.191 then {}
18.192 else (SOME B. B \<in> sets M \<and> B \<subseteq> space M - A \<and> ?d B \<le> -e)"
18.193 @@ -159,7 +170,7 @@
18.194 fix B assume "B \<in> sets M \<and> B \<subseteq> space M - A n \<and> ?d B \<le> - e"
18.195 hence "A n \<inter> B = {}" "B \<in> sets M" and dB: "?d B \<le> -e" by auto
18.196 hence "?d (A n \<union> B) = ?d (A n) + ?d B"
18.197 - using `A n \<in> sets M` finite_measure_Union M'.finite_measure_Union by simp
18.198 + using `A n \<in> sets M` finite_measure_Union M'.finite_measure_Union by (simp add: sets_eq)
18.199 also have "\<dots> \<le> ?d (A n) - e" using dB by simp
18.200 finally show "?d (A n \<union> B) \<le> ?d (A n) - e" .
18.201 qed }
18.202 @@ -187,8 +198,8 @@
18.203 proof (induct n)
18.204 fix n assume "?d (space M) \<le> ?d (space M - A n)"
18.205 also have "\<dots> \<le> ?d (space M - A (Suc n))"
18.206 - using A_in_sets sets_into_space dA_mono[of n]
18.207 - by (simp del: A_simps add: finite_measure_Diff M'.finite_measure_Diff)
18.208 + using A_in_sets sets_into_space dA_mono[of n] finite_measure_compl M'.finite_measure_compl
18.209 + by (simp del: A_simps add: sets_eq sets_eq_imp_space_eq[OF sets_eq])
18.210 finally show "?d (space M) \<le> ?d (space M - A (Suc n))" .
18.211 qed simp
18.212 qed
18.213 @@ -199,17 +210,17 @@
18.214 proof (induct n)
18.215 case (Suc n) with dA_epsilon[of n, OF B] show ?case by (simp del: A_simps add: real_of_nat_Suc field_simps)
18.216 next
18.217 - case 0 with M'.empty_measure show ?case by (simp add: zero_ereal_def)
18.218 + case 0 with measure_empty show ?case by (simp add: zero_ereal_def)
18.219 qed } note dA_less = this
18.220 have decseq: "decseq (\<lambda>n. ?d (A n))" unfolding decseq_eq_incseq
18.221 proof (rule incseq_SucI)
18.222 fix n show "- ?d (A n) \<le> - ?d (A (Suc n))" using dA_mono[of n] by auto
18.223 qed
18.224 have A: "incseq A" by (auto intro!: incseq_SucI)
18.225 - from finite_continuity_from_below[OF _ A] `range A \<subseteq> sets M`
18.226 - M'.finite_continuity_from_below[OF _ A]
18.227 + from finite_Lim_measure_incseq[OF _ A] `range A \<subseteq> sets M`
18.228 + M'.finite_Lim_measure_incseq[OF _ A]
18.229 have convergent: "(\<lambda>i. ?d (A i)) ----> ?d (\<Union>i. A i)"
18.230 - by (auto intro!: tendsto_diff)
18.231 + by (auto intro!: tendsto_diff simp: sets_eq)
18.232 obtain n :: nat where "- ?d (\<Union>i. A i) / e < real n" using reals_Archimedean2 by auto
18.233 moreover from order_trans[OF decseq_le[OF decseq convergent] dA_less]
18.234 have "real n \<le> - ?d (\<Union>i. A i) / e" using `0<e` by (simp add: field_simps)
18.235 @@ -217,57 +228,24 @@
18.236 qed
18.237 qed
18.238
18.239 -lemma (in finite_measure) restricted_measure_subset:
18.240 - assumes S: "S \<in> sets M" and X: "X \<subseteq> S"
18.241 - shows "finite_measure.\<mu>' (restricted_space S) X = \<mu>' X"
18.242 -proof cases
18.243 - note r = restricted_finite_measure[OF S]
18.244 - { assume "X \<in> sets M" with S X show ?thesis
18.245 - unfolding finite_measure.\<mu>'_def[OF r] \<mu>'_def by auto }
18.246 - { assume "X \<notin> sets M"
18.247 - moreover then have "S \<inter> X \<notin> sets M"
18.248 - using X by (simp add: Int_absorb1)
18.249 - ultimately show ?thesis
18.250 - unfolding finite_measure.\<mu>'_def[OF r] \<mu>'_def using S by auto }
18.251 -qed
18.252 -
18.253 -lemma (in finite_measure) restricted_measure:
18.254 - assumes X: "S \<in> sets M" "X \<in> sets (restricted_space S)"
18.255 - shows "finite_measure.\<mu>' (restricted_space S) X = \<mu>' X"
18.256 +lemma (in finite_measure) Radon_Nikodym_aux:
18.257 + assumes "finite_measure N" and sets_eq: "sets N = sets M"
18.258 + shows "\<exists>A\<in>sets M. measure M (space M) - measure N (space M) \<le>
18.259 + measure M A - measure N A \<and>
18.260 + (\<forall>B\<in>sets M. B \<subseteq> A \<longrightarrow> 0 \<le> measure M B - measure N B)"
18.261 proof -
18.262 - from X have "S \<in> sets M" "X \<subseteq> S" by auto
18.263 - from restricted_measure_subset[OF this] show ?thesis .
18.264 -qed
18.265 -
18.266 -lemma (in finite_measure) Radon_Nikodym_aux:
18.267 - assumes "finite_measure (M\<lparr>measure := \<nu>\<rparr>)" (is "finite_measure ?M'")
18.268 - shows "\<exists>A\<in>sets M. \<mu>' (space M) - finite_measure.\<mu>' (M\<lparr>measure := \<nu>\<rparr>) (space M) \<le>
18.269 - \<mu>' A - finite_measure.\<mu>' (M\<lparr>measure := \<nu>\<rparr>) A \<and>
18.270 - (\<forall>B\<in>sets M. B \<subseteq> A \<longrightarrow> 0 \<le> \<mu>' B - finite_measure.\<mu>' (M\<lparr>measure := \<nu>\<rparr>) B)"
18.271 -proof -
18.272 - interpret M': finite_measure ?M' where
18.273 - "space ?M' = space M" and "sets ?M' = sets M" and "measure ?M' = \<nu>" by fact auto
18.274 - let ?d = "\<lambda>A. \<mu>' A - M'.\<mu>' A"
18.275 + interpret N: finite_measure N by fact
18.276 + let ?d = "\<lambda>A. measure M A - measure N A"
18.277 let ?P = "\<lambda>A B n. A \<in> sets M \<and> A \<subseteq> B \<and> ?d B \<le> ?d A \<and> (\<forall>C\<in>sets M. C \<subseteq> A \<longrightarrow> - 1 / real (Suc n) < ?d C)"
18.278 let ?r = "\<lambda>S. restricted_space S"
18.279 { fix S n assume S: "S \<in> sets M"
18.280 - note r = M'.restricted_finite_measure[of S] restricted_finite_measure[OF S] S
18.281 - then have "finite_measure (?r S)" "0 < 1 / real (Suc n)"
18.282 - "finite_measure (?r S\<lparr>measure := \<nu>\<rparr>)" by auto
18.283 + then have "finite_measure (density M (indicator S))" "0 < 1 / real (Suc n)"
18.284 + "finite_measure (density N (indicator S))" "sets (density N (indicator S)) = sets (density M (indicator S))"
18.285 + by (auto simp: finite_measure_restricted N.finite_measure_restricted sets_eq)
18.286 from finite_measure.Radon_Nikodym_aux_epsilon[OF this] guess X .. note X = this
18.287 - have "?P X S n"
18.288 - proof (intro conjI ballI impI)
18.289 - show "X \<in> sets M" "X \<subseteq> S" using X(1) `S \<in> sets M` by auto
18.290 - have "S \<in> op \<inter> S ` sets M" using `S \<in> sets M` by auto
18.291 - then show "?d S \<le> ?d X"
18.292 - using S X restricted_measure[OF S] M'.restricted_measure[OF S] by simp
18.293 - fix C assume "C \<in> sets M" "C \<subseteq> X"
18.294 - then have "C \<in> sets (restricted_space S)" "C \<subseteq> X"
18.295 - using `S \<in> sets M` `X \<subseteq> S` by auto
18.296 - with X(2) show "- 1 / real (Suc n) < ?d C"
18.297 - using S X restricted_measure[OF S] M'.restricted_measure[OF S] by auto
18.298 - qed
18.299 - hence "\<exists>A. ?P A S n" by auto }
18.300 + with S have "?P (S \<inter> X) S n"
18.301 + by (simp add: measure_restricted sets_eq Int) (metis inf_absorb2)
18.302 + hence "\<exists>A. ?P A S n" .. }
18.303 note Ex_P = this
18.304 def A \<equiv> "nat_rec (space M) (\<lambda>n A. SOME B. ?P B A n)"
18.305 have A_Suc: "\<And>n. A (Suc n) = (SOME B. ?P B (A n) n)" by (simp add: A_def)
18.306 @@ -292,12 +270,11 @@
18.307 proof (safe intro!: bexI[of _ "\<Inter>i. A i"])
18.308 show "(\<Inter>i. A i) \<in> sets M" using A_in_sets by auto
18.309 have A: "decseq A" using A_mono by (auto intro!: decseq_SucI)
18.310 - from
18.311 - finite_continuity_from_above[OF `range A \<subseteq> sets M` A]
18.312 - M'.finite_continuity_from_above[OF `range A \<subseteq> sets M` A]
18.313 - have "(\<lambda>i. ?d (A i)) ----> ?d (\<Inter>i. A i)" by (intro tendsto_diff)
18.314 + from `range A \<subseteq> sets M`
18.315 + finite_Lim_measure_decseq[OF _ A] N.finite_Lim_measure_decseq[OF _ A]
18.316 + have "(\<lambda>i. ?d (A i)) ----> ?d (\<Inter>i. A i)" by (auto intro!: tendsto_diff simp: sets_eq)
18.317 thus "?d (space M) \<le> ?d (\<Inter>i. A i)" using mono_dA[THEN monoD, of 0 _]
18.318 - by (rule_tac LIMSEQ_le_const) (auto intro!: exI)
18.319 + by (rule_tac LIMSEQ_le_const) auto
18.320 next
18.321 fix B assume B: "B \<in> sets M" "B \<subseteq> (\<Inter>i. A i)"
18.322 show "0 \<le> ?d B"
18.323 @@ -315,14 +292,12 @@
18.324 qed
18.325
18.326 lemma (in finite_measure) Radon_Nikodym_finite_measure:
18.327 - assumes "finite_measure (M\<lparr> measure := \<nu>\<rparr>)" (is "finite_measure ?M'")
18.328 - assumes "absolutely_continuous \<nu>"
18.329 - shows "\<exists>f \<in> borel_measurable M. \<forall>A\<in>sets M. \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.330 + assumes "finite_measure N" and sets_eq: "sets N = sets M"
18.331 + assumes "absolutely_continuous M N"
18.332 + shows "\<exists>f \<in> borel_measurable M. (\<forall>x. 0 \<le> f x) \<and> density M f = N"
18.333 proof -
18.334 - interpret M': finite_measure ?M'
18.335 - where "space ?M' = space M" and "sets ?M' = sets M" and "measure ?M' = \<nu>"
18.336 - using assms(1) by auto
18.337 - def G \<equiv> "{g \<in> borel_measurable M. (\<forall>x. 0 \<le> g x) \<and> (\<forall>A\<in>sets M. (\<integral>\<^isup>+x. g x * indicator A x \<partial>M) \<le> \<nu> A)}"
18.338 + interpret N: finite_measure N by fact
18.339 + def G \<equiv> "{g \<in> borel_measurable M. (\<forall>x. 0 \<le> g x) \<and> (\<forall>A\<in>sets M. (\<integral>\<^isup>+x. g x * indicator A x \<partial>M) \<le> N A)}"
18.340 have "(\<lambda>x. 0) \<in> G" unfolding G_def by auto
18.341 hence "G \<noteq> {}" by auto
18.342 { fix f g assume f: "f \<in> G" and g: "g \<in> G"
18.343 @@ -333,6 +308,7 @@
18.344 have "?A \<in> sets M" using f g unfolding G_def by auto
18.345 fix A assume "A \<in> sets M"
18.346 hence sets: "?A \<inter> A \<in> sets M" "(space M - ?A) \<inter> A \<in> sets M" using `?A \<in> sets M` by auto
18.347 + hence sets': "?A \<inter> A \<in> sets N" "(space M - ?A) \<inter> A \<in> sets N" by (auto simp: sets_eq)
18.348 have union: "((?A \<inter> A) \<union> ((space M - ?A) \<inter> A)) = A"
18.349 using sets_into_space[OF `A \<in> sets M`] by auto
18.350 have "\<And>x. x \<in> space M \<Longrightarrow> max (g x) (f x) * indicator A x =
18.351 @@ -343,11 +319,11 @@
18.352 (\<integral>\<^isup>+x. f x * indicator ((space M - ?A) \<inter> A) x \<partial>M)"
18.353 using f g sets unfolding G_def
18.354 by (auto cong: positive_integral_cong intro!: positive_integral_add)
18.355 - also have "\<dots> \<le> \<nu> (?A \<inter> A) + \<nu> ((space M - ?A) \<inter> A)"
18.356 + also have "\<dots> \<le> N (?A \<inter> A) + N ((space M - ?A) \<inter> A)"
18.357 using f g sets unfolding G_def by (auto intro!: add_mono)
18.358 - also have "\<dots> = \<nu> A"
18.359 - using M'.measure_additive[OF sets] union by auto
18.360 - finally show "(\<integral>\<^isup>+x. max (g x) (f x) * indicator A x \<partial>M) \<le> \<nu> A" .
18.361 + also have "\<dots> = N A"
18.362 + using plus_emeasure[OF sets'] union by auto
18.363 + finally show "(\<integral>\<^isup>+x. max (g x) (f x) * indicator A x \<partial>M) \<le> N A" .
18.364 next
18.365 fix x show "0 \<le> max (g x) (f x)" using f g by (auto simp: G_def split: split_max)
18.366 qed }
18.367 @@ -368,15 +344,15 @@
18.368 using `incseq f` f `A \<in> sets M`
18.369 by (intro positive_integral_monotone_convergence_SUP)
18.370 (auto simp: G_def incseq_Suc_iff le_fun_def split: split_indicator)
18.371 - finally show "(\<integral>\<^isup>+x. (SUP i. f i x) * indicator A x \<partial>M) \<le> \<nu> A"
18.372 + finally show "(\<integral>\<^isup>+x. (SUP i. f i x) * indicator A x \<partial>M) \<le> N A"
18.373 using f `A \<in> sets M` by (auto intro!: SUP_least simp: G_def)
18.374 qed }
18.375 note SUP_in_G = this
18.376 let ?y = "SUP g : G. integral\<^isup>P M g"
18.377 - have "?y \<le> \<nu> (space M)" unfolding G_def
18.378 + have y_le: "?y \<le> N (space M)" unfolding G_def
18.379 proof (safe intro!: SUP_least)
18.380 - fix g assume "\<forall>A\<in>sets M. (\<integral>\<^isup>+x. g x * indicator A x \<partial>M) \<le> \<nu> A"
18.381 - from this[THEN bspec, OF top] show "integral\<^isup>P M g \<le> \<nu> (space M)"
18.382 + fix g assume "\<forall>A\<in>sets M. (\<integral>\<^isup>+x. g x * indicator A x \<partial>M) \<le> N A"
18.383 + from this[THEN bspec, OF top] show "integral\<^isup>P M g \<le> N (space M)"
18.384 by (simp cong: positive_integral_cong)
18.385 qed
18.386 from SUPR_countable_SUPR[OF `G \<noteq> {}`, of "integral\<^isup>P M"] guess ys .. note ys = this
18.387 @@ -411,8 +387,7 @@
18.388 also have "\<dots> = ?y"
18.389 proof (rule antisym)
18.390 show "(SUP i. integral\<^isup>P M (?g i)) \<le> ?y"
18.391 - using g_in_G
18.392 - by (auto intro!: exI Sup_mono simp: SUP_def)
18.393 + using g_in_G by (auto intro: Sup_mono simp: SUP_def)
18.394 show "?y \<le> (SUP i. integral\<^isup>P M (?g i))" unfolding y_eq
18.395 by (auto intro!: SUP_mono positive_integral_mono Max_ge)
18.396 qed
18.397 @@ -420,107 +395,68 @@
18.398 have "\<And>x. 0 \<le> f x"
18.399 unfolding f_def using `\<And>i. gs i \<in> G`
18.400 by (auto intro!: SUP_upper2 Max_ge_iff[THEN iffD2] simp: G_def)
18.401 - let ?t = "\<lambda>A. \<nu> A - (\<integral>\<^isup>+x. ?F A x \<partial>M)"
18.402 - let ?M = "M\<lparr> measure := ?t\<rparr>"
18.403 - interpret M: sigma_algebra ?M
18.404 - by (intro sigma_algebra_cong) auto
18.405 - have f_le_\<nu>: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+x. ?F A x \<partial>M) \<le> \<nu> A"
18.406 + let ?t = "\<lambda>A. N A - (\<integral>\<^isup>+x. ?F A x \<partial>M)"
18.407 + let ?M = "diff_measure N (density M f)"
18.408 + have f_le_N: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+x. ?F A x \<partial>M) \<le> N A"
18.409 using `f \<in> G` unfolding G_def by auto
18.410 - have fmM: "finite_measure ?M"
18.411 + have emeasure_M: "\<And>A. A \<in> sets M \<Longrightarrow> emeasure ?M A = ?t A"
18.412 + proof (subst emeasure_diff_measure)
18.413 + from f_le_N[of "space M"] show "finite_measure N" "finite_measure (density M f)"
18.414 + by (auto intro!: finite_measureI simp: emeasure_density cong: positive_integral_cong)
18.415 + next
18.416 + fix B assume "B \<in> sets N" with f_le_N[of B] show "emeasure (density M f) B \<le> emeasure N B"
18.417 + by (auto simp: sets_eq emeasure_density cong: positive_integral_cong)
18.418 + qed (auto simp: sets_eq emeasure_density)
18.419 + from emeasure_M[of "space M"] N.finite_emeasure_space positive_integral_positive[of M "?F (space M)"]
18.420 + interpret M': finite_measure ?M
18.421 + by (auto intro!: finite_measureI simp: sets_eq_imp_space_eq[OF sets_eq] N.emeasure_eq_measure ereal_minus_eq_PInfty_iff)
18.422 +
18.423 + have ac: "absolutely_continuous M ?M" unfolding absolutely_continuous_def
18.424 proof
18.425 - show "measure_space ?M"
18.426 - proof (default, simp_all add: countably_additive_def positive_def, safe del: notI)
18.427 - fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "disjoint_family A"
18.428 - have "(\<Sum>n. (\<integral>\<^isup>+x. ?F (A n) x \<partial>M)) = (\<integral>\<^isup>+x. (\<Sum>n. ?F (A n) x) \<partial>M)"
18.429 - using `range A \<subseteq> sets M` `\<And>x. 0 \<le> f x`
18.430 - by (intro positive_integral_suminf[symmetric]) auto
18.431 - also have "\<dots> = (\<integral>\<^isup>+x. ?F (\<Union>n. A n) x \<partial>M)"
18.432 - using `\<And>x. 0 \<le> f x`
18.433 - by (intro positive_integral_cong) (simp add: suminf_cmult_ereal suminf_indicator[OF `disjoint_family A`])
18.434 - finally have "(\<Sum>n. (\<integral>\<^isup>+x. ?F (A n) x \<partial>M)) = (\<integral>\<^isup>+x. ?F (\<Union>n. A n) x \<partial>M)" .
18.435 - moreover have "(\<Sum>n. \<nu> (A n)) = \<nu> (\<Union>n. A n)"
18.436 - using M'.measure_countably_additive A by (simp add: comp_def)
18.437 - moreover have v_fin: "\<nu> (\<Union>i. A i) \<noteq> \<infinity>" using M'.finite_measure A by (simp add: countable_UN)
18.438 - moreover {
18.439 - have "(\<integral>\<^isup>+x. ?F (\<Union>i. A i) x \<partial>M) \<le> \<nu> (\<Union>i. A i)"
18.440 - using A `f \<in> G` unfolding G_def by (auto simp: countable_UN)
18.441 - also have "\<nu> (\<Union>i. A i) < \<infinity>" using v_fin by simp
18.442 - finally have "(\<integral>\<^isup>+x. ?F (\<Union>i. A i) x \<partial>M) \<noteq> \<infinity>" by simp }
18.443 - moreover have "\<And>i. (\<integral>\<^isup>+x. ?F (A i) x \<partial>M) \<le> \<nu> (A i)"
18.444 - using A by (intro f_le_\<nu>) auto
18.445 - ultimately
18.446 - show "(\<Sum>n. ?t (A n)) = ?t (\<Union>i. A i)"
18.447 - by (subst suminf_ereal_minus) (simp_all add: positive_integral_positive)
18.448 - next
18.449 - fix A assume A: "A \<in> sets M" show "0 \<le> \<nu> A - \<integral>\<^isup>+ x. ?F A x \<partial>M"
18.450 - using f_le_\<nu>[OF A] `f \<in> G` M'.finite_measure[OF A] by (auto simp: G_def ereal_le_minus_iff)
18.451 - qed
18.452 - next
18.453 - show "measure ?M (space ?M) \<noteq> \<infinity>"
18.454 - using positive_integral_positive[of "?F (space M)"]
18.455 - by (cases rule: ereal2_cases[of "\<nu> (space M)" "\<integral>\<^isup>+ x. ?F (space M) x \<partial>M"]) auto
18.456 + fix A assume A: "A \<in> null_sets M"
18.457 + with `absolutely_continuous M N` have "A \<in> null_sets N"
18.458 + unfolding absolutely_continuous_def by auto
18.459 + moreover with A have "(\<integral>\<^isup>+ x. ?F A x \<partial>M) \<le> N A" using `f \<in> G` by (auto simp: G_def)
18.460 + ultimately have "N A - (\<integral>\<^isup>+ x. ?F A x \<partial>M) = 0"
18.461 + using positive_integral_positive[of M] by (auto intro!: antisym)
18.462 + then show "A \<in> null_sets ?M"
18.463 + using A by (simp add: emeasure_M null_sets_def sets_eq)
18.464 qed
18.465 - then interpret M: finite_measure ?M
18.466 - where "space ?M = space M" and "sets ?M = sets M" and "measure ?M = ?t"
18.467 - by (simp_all add: fmM)
18.468 - have ac: "absolutely_continuous ?t" unfolding absolutely_continuous_def
18.469 - proof
18.470 - fix N assume N: "N \<in> null_sets"
18.471 - with `absolutely_continuous \<nu>` have "\<nu> N = 0" unfolding absolutely_continuous_def by auto
18.472 - moreover with N have "(\<integral>\<^isup>+ x. ?F N x \<partial>M) \<le> \<nu> N" using `f \<in> G` by (auto simp: G_def)
18.473 - ultimately show "\<nu> N - (\<integral>\<^isup>+ x. ?F N x \<partial>M) = 0"
18.474 - using positive_integral_positive by (auto intro!: antisym)
18.475 - qed
18.476 - have upper_bound: "\<forall>A\<in>sets M. ?t A \<le> 0"
18.477 + have upper_bound: "\<forall>A\<in>sets M. ?M A \<le> 0"
18.478 proof (rule ccontr)
18.479 assume "\<not> ?thesis"
18.480 - then obtain A where A: "A \<in> sets M" and pos: "0 < ?t A"
18.481 + then obtain A where A: "A \<in> sets M" and pos: "0 < ?M A"
18.482 by (auto simp: not_le)
18.483 note pos
18.484 - also have "?t A \<le> ?t (space M)"
18.485 - using M.measure_mono[of A "space M"] A sets_into_space by simp
18.486 - finally have pos_t: "0 < ?t (space M)" by simp
18.487 + also have "?M A \<le> ?M (space M)"
18.488 + using emeasure_space[of ?M A] by (simp add: sets_eq[THEN sets_eq_imp_space_eq])
18.489 + finally have pos_t: "0 < ?M (space M)" by simp
18.490 moreover
18.491 - then have "\<mu> (space M) \<noteq> 0"
18.492 - using ac unfolding absolutely_continuous_def by auto
18.493 - then have pos_M: "0 < \<mu> (space M)"
18.494 - using positive_measure[OF top] by (simp add: le_less)
18.495 + then have "emeasure M (space M) \<noteq> 0"
18.496 + using ac unfolding absolutely_continuous_def by (auto simp: null_sets_def)
18.497 + then have pos_M: "0 < emeasure M (space M)"
18.498 + using emeasure_nonneg[of M "space M"] by (simp add: le_less)
18.499 moreover
18.500 - have "(\<integral>\<^isup>+x. f x * indicator (space M) x \<partial>M) \<le> \<nu> (space M)"
18.501 + have "(\<integral>\<^isup>+x. f x * indicator (space M) x \<partial>M) \<le> N (space M)"
18.502 using `f \<in> G` unfolding G_def by auto
18.503 hence "(\<integral>\<^isup>+x. f x * indicator (space M) x \<partial>M) \<noteq> \<infinity>"
18.504 - using M'.finite_measure_of_space by auto
18.505 + using M'.finite_emeasure_space by auto
18.506 moreover
18.507 - def b \<equiv> "?t (space M) / \<mu> (space M) / 2"
18.508 + def b \<equiv> "?M (space M) / emeasure M (space M) / 2"
18.509 ultimately have b: "b \<noteq> 0 \<and> 0 \<le> b \<and> b \<noteq> \<infinity>"
18.510 - using M'.finite_measure_of_space positive_integral_positive[of "?F (space M)"]
18.511 - by (cases rule: ereal3_cases[of "integral\<^isup>P M (?F (space M))" "\<nu> (space M)" "\<mu> (space M)"])
18.512 - (simp_all add: field_simps)
18.513 + by (auto simp: ereal_divide_eq)
18.514 then have b: "b \<noteq> 0" "0 \<le> b" "0 < b" "b \<noteq> \<infinity>" by auto
18.515 - let ?Mb = "?M\<lparr>measure := \<lambda>A. b * \<mu> A\<rparr>"
18.516 - interpret b: sigma_algebra ?Mb by (intro sigma_algebra_cong) auto
18.517 - have Mb: "finite_measure ?Mb"
18.518 - proof
18.519 - show "measure_space ?Mb"
18.520 - proof
18.521 - show "positive ?Mb (measure ?Mb)"
18.522 - using `0 \<le> b` by (auto simp: positive_def)
18.523 - show "countably_additive ?Mb (measure ?Mb)"
18.524 - using `0 \<le> b` measure_countably_additive
18.525 - by (auto simp: countably_additive_def suminf_cmult_ereal subset_eq)
18.526 - qed
18.527 - show "measure ?Mb (space ?Mb) \<noteq> \<infinity>"
18.528 - using b by auto
18.529 - qed
18.530 - from M.Radon_Nikodym_aux[OF this]
18.531 - obtain A0 where "A0 \<in> sets M" and
18.532 - space_less_A0: "real (?t (space M)) - real (b * \<mu> (space M)) \<le> real (?t A0) - real (b * \<mu> A0)" and
18.533 - *: "\<And>B. \<lbrakk> B \<in> sets M ; B \<subseteq> A0 \<rbrakk> \<Longrightarrow> 0 \<le> real (?t B) - real (b * \<mu> B)"
18.534 - unfolding M.\<mu>'_def finite_measure.\<mu>'_def[OF Mb] by auto
18.535 + let ?Mb = "density M (\<lambda>_. b)"
18.536 + have Mb: "finite_measure ?Mb" "sets ?Mb = sets ?M"
18.537 + using b by (auto simp: emeasure_density_const sets_eq intro!: finite_measureI)
18.538 + from M'.Radon_Nikodym_aux[OF this] guess A0 ..
18.539 + then have "A0 \<in> sets M"
18.540 + and space_less_A0: "measure ?M (space M) - real b * measure M (space M) \<le> measure ?M A0 - real b * measure M A0"
18.541 + and *: "\<And>B. B \<in> sets M \<Longrightarrow> B \<subseteq> A0 \<Longrightarrow> 0 \<le> measure ?M B - real b * measure M B"
18.542 + using b by (simp_all add: measure_density_const sets_eq_imp_space_eq[OF sets_eq] sets_eq)
18.543 { fix B assume B: "B \<in> sets M" "B \<subseteq> A0"
18.544 - with *[OF this] have "b * \<mu> B \<le> ?t B"
18.545 - using M'.finite_measure b finite_measure M.positive_measure[OF B(1)]
18.546 - by (cases rule: ereal2_cases[of "?t B" "b * \<mu> B"]) auto }
18.547 + with *[OF this] have "b * emeasure M B \<le> ?M B"
18.548 + using b unfolding M'.emeasure_eq_measure emeasure_eq_measure by (cases b) auto }
18.549 note bM_le_t = this
18.550 let ?f0 = "\<lambda>x. f x + b * indicator A0 x"
18.551 { fix A assume A: "A \<in> sets M"
18.552 @@ -529,71 +465,47 @@
18.553 (\<integral>\<^isup>+x. f x * indicator A x + b * indicator (A \<inter> A0) x \<partial>M)"
18.554 by (auto intro!: positive_integral_cong split: split_indicator)
18.555 hence "(\<integral>\<^isup>+x. ?f0 x * indicator A x \<partial>M) =
18.556 - (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) + b * \<mu> (A \<inter> A0)"
18.557 + (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) + b * emeasure M (A \<inter> A0)"
18.558 using `A0 \<in> sets M` `A \<inter> A0 \<in> sets M` A b `f \<in> G`
18.559 by (simp add: G_def positive_integral_add positive_integral_cmult_indicator) }
18.560 note f0_eq = this
18.561 { fix A assume A: "A \<in> sets M"
18.562 hence "A \<inter> A0 \<in> sets M" using `A0 \<in> sets M` by auto
18.563 - have f_le_v: "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) \<le> \<nu> A"
18.564 - using `f \<in> G` A unfolding G_def by auto
18.565 + have f_le_v: "(\<integral>\<^isup>+x. ?F A x \<partial>M) \<le> N A" using `f \<in> G` A unfolding G_def by auto
18.566 note f0_eq[OF A]
18.567 - also have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) + b * \<mu> (A \<inter> A0) \<le>
18.568 - (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) + ?t (A \<inter> A0)"
18.569 + also have "(\<integral>\<^isup>+x. ?F A x \<partial>M) + b * emeasure M (A \<inter> A0) \<le> (\<integral>\<^isup>+x. ?F A x \<partial>M) + ?M (A \<inter> A0)"
18.570 using bM_le_t[OF `A \<inter> A0 \<in> sets M`] `A \<in> sets M` `A0 \<in> sets M`
18.571 by (auto intro!: add_left_mono)
18.572 - also have "\<dots> \<le> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) + ?t A"
18.573 - using M.measure_mono[simplified, OF _ `A \<inter> A0 \<in> sets M` `A \<in> sets M`]
18.574 - by (auto intro!: add_left_mono)
18.575 - also have "\<dots> \<le> \<nu> A"
18.576 - using f_le_v M'.finite_measure[simplified, OF `A \<in> sets M`] positive_integral_positive[of "?F A"]
18.577 - by (cases "\<integral>\<^isup>+x. ?F A x \<partial>M", cases "\<nu> A") auto
18.578 - finally have "(\<integral>\<^isup>+x. ?f0 x * indicator A x \<partial>M) \<le> \<nu> A" . }
18.579 + also have "\<dots> \<le> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) + ?M A"
18.580 + using emeasure_mono[of "A \<inter> A0" A ?M] `A \<in> sets M` `A0 \<in> sets M`
18.581 + by (auto intro!: add_left_mono simp: sets_eq)
18.582 + also have "\<dots> \<le> N A"
18.583 + unfolding emeasure_M[OF `A \<in> sets M`]
18.584 + using f_le_v N.emeasure_eq_measure[of A] positive_integral_positive[of M "?F A"]
18.585 + by (cases "\<integral>\<^isup>+x. ?F A x \<partial>M", cases "N A") auto
18.586 + finally have "(\<integral>\<^isup>+x. ?f0 x * indicator A x \<partial>M) \<le> N A" . }
18.587 hence "?f0 \<in> G" using `A0 \<in> sets M` b `f \<in> G` unfolding G_def
18.588 by (auto intro!: ereal_add_nonneg_nonneg)
18.589 - have real: "?t (space M) \<noteq> \<infinity>" "?t A0 \<noteq> \<infinity>"
18.590 - "b * \<mu> (space M) \<noteq> \<infinity>" "b * \<mu> A0 \<noteq> \<infinity>"
18.591 - using `A0 \<in> sets M` b
18.592 - finite_measure[of A0] M.finite_measure[of A0]
18.593 - finite_measure_of_space M.finite_measure_of_space
18.594 - by auto
18.595 have int_f_finite: "integral\<^isup>P M f \<noteq> \<infinity>"
18.596 - using M'.finite_measure_of_space pos_t unfolding ereal_less_minus_iff
18.597 - by (auto cong: positive_integral_cong)
18.598 - have "0 < ?t (space M) - b * \<mu> (space M)" unfolding b_def
18.599 - using finite_measure_of_space M'.finite_measure_of_space pos_t pos_M
18.600 - using positive_integral_positive[of "?F (space M)"]
18.601 - by (cases rule: ereal3_cases[of "\<mu> (space M)" "\<nu> (space M)" "integral\<^isup>P M (?F (space M))"])
18.602 - (auto simp: field_simps mult_less_cancel_left)
18.603 - also have "\<dots> \<le> ?t A0 - b * \<mu> A0"
18.604 - using space_less_A0 b
18.605 - using
18.606 - `A0 \<in> sets M`[THEN M.real_measure]
18.607 - top[THEN M.real_measure]
18.608 - apply safe
18.609 - apply simp
18.610 - using
18.611 - `A0 \<in> sets M`[THEN real_measure]
18.612 - `A0 \<in> sets M`[THEN M'.real_measure]
18.613 - top[THEN real_measure]
18.614 - top[THEN M'.real_measure]
18.615 - by (cases b) auto
18.616 - finally have 1: "b * \<mu> A0 < ?t A0"
18.617 - using
18.618 - `A0 \<in> sets M`[THEN M.real_measure]
18.619 - apply safe
18.620 - apply simp
18.621 - using
18.622 - `A0 \<in> sets M`[THEN real_measure]
18.623 - `A0 \<in> sets M`[THEN M'.real_measure]
18.624 - by (cases b) auto
18.625 - have "0 < ?t A0"
18.626 - using b `A0 \<in> sets M` by (auto intro!: le_less_trans[OF _ 1])
18.627 - then have "\<mu> A0 \<noteq> 0" using ac unfolding absolutely_continuous_def
18.628 - using `A0 \<in> sets M` by auto
18.629 - then have "0 < \<mu> A0" using positive_measure[OF `A0 \<in> sets M`] by auto
18.630 - hence "0 < b * \<mu> A0" using b by (auto simp: ereal_zero_less_0_iff)
18.631 - with int_f_finite have "?y + 0 < integral\<^isup>P M f + b * \<mu> A0" unfolding int_f_eq_y
18.632 + by (metis N.emeasure_finite ereal_infty_less_eq2(1) int_f_eq_y y_le)
18.633 + have "0 < ?M (space M) - emeasure ?Mb (space M)"
18.634 + using pos_t
18.635 + by (simp add: b emeasure_density_const)
18.636 + (simp add: M'.emeasure_eq_measure emeasure_eq_measure pos_M b_def)
18.637 + also have "\<dots> \<le> ?M A0 - b * emeasure M A0"
18.638 + using space_less_A0 `A0 \<in> sets M` b
18.639 + by (cases b) (auto simp add: b emeasure_density_const sets_eq M'.emeasure_eq_measure emeasure_eq_measure)
18.640 + finally have 1: "b * emeasure M A0 < ?M A0"
18.641 + by (metis M'.emeasure_real `A0 \<in> sets M` bM_le_t diff_self ereal_less(1) ereal_minus(1)
18.642 + less_eq_ereal_def mult_zero_left not_square_less_zero subset_refl zero_ereal_def)
18.643 + with b have "0 < ?M A0"
18.644 + by (metis M'.emeasure_real MInfty_neq_PInfty(1) emeasure_real ereal_less_eq(5) ereal_zero_times
18.645 + ereal_mult_eq_MInfty ereal_mult_eq_PInfty ereal_zero_less_0_iff less_eq_ereal_def)
18.646 + then have "emeasure M A0 \<noteq> 0" using ac `A0 \<in> sets M`
18.647 + by (auto simp: absolutely_continuous_def null_sets_def)
18.648 + then have "0 < emeasure M A0" using emeasure_nonneg[of M A0] by auto
18.649 + hence "0 < b * emeasure M A0" using b by (auto simp: ereal_zero_less_0_iff)
18.650 + with int_f_finite have "?y + 0 < integral\<^isup>P M f + b * emeasure M A0" unfolding int_f_eq_y
18.651 using `f \<in> G`
18.652 by (intro ereal_add_strict_mono) (auto intro!: SUP_upper2 positive_integral_positive)
18.653 also have "\<dots> = integral\<^isup>P M ?f0" using f0_eq[OF top] `A0 \<in> sets M` sets_into_space
18.654 @@ -602,75 +514,67 @@
18.655 moreover from `?f0 \<in> G` have "integral\<^isup>P M ?f0 \<le> ?y" by (auto intro!: SUP_upper)
18.656 ultimately show False by auto
18.657 qed
18.658 + let ?f = "\<lambda>x. max 0 (f x)"
18.659 show ?thesis
18.660 - proof (safe intro!: bexI[of _ f])
18.661 - fix A assume A: "A\<in>sets M"
18.662 - show "\<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.663 - proof (rule antisym)
18.664 - show "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) \<le> \<nu> A"
18.665 - using `f \<in> G` `A \<in> sets M` unfolding G_def by auto
18.666 - show "\<nu> A \<le> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.667 - using upper_bound[THEN bspec, OF `A \<in> sets M`]
18.668 - using M'.real_measure[OF A]
18.669 - by (cases "integral\<^isup>P M (?F A)") auto
18.670 - qed
18.671 - qed simp
18.672 + proof (intro bexI[of _ ?f] measure_eqI conjI)
18.673 + show "sets (density M ?f) = sets N"
18.674 + by (simp add: sets_eq)
18.675 + fix A assume A: "A\<in>sets (density M ?f)"
18.676 + then show "emeasure (density M ?f) A = emeasure N A"
18.677 + using `f \<in> G` A upper_bound[THEN bspec, of A] N.emeasure_eq_measure[of A]
18.678 + by (cases "integral\<^isup>P M (?F A)")
18.679 + (auto intro!: antisym simp add: emeasure_density G_def emeasure_M density_max_0[symmetric])
18.680 + qed auto
18.681 qed
18.682
18.683 lemma (in finite_measure) split_space_into_finite_sets_and_rest:
18.684 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)" (is "measure_space ?N")
18.685 - assumes ac: "absolutely_continuous \<nu>"
18.686 + assumes ac: "absolutely_continuous M N" and sets_eq: "sets N = sets M"
18.687 shows "\<exists>A0\<in>sets M. \<exists>B::nat\<Rightarrow>'a set. disjoint_family B \<and> range B \<subseteq> sets M \<and> A0 = space M - (\<Union>i. B i) \<and>
18.688 - (\<forall>A\<in>sets M. A \<subseteq> A0 \<longrightarrow> (\<mu> A = 0 \<and> \<nu> A = 0) \<or> (\<mu> A > 0 \<and> \<nu> A = \<infinity>)) \<and>
18.689 - (\<forall>i. \<nu> (B i) \<noteq> \<infinity>)"
18.690 + (\<forall>A\<in>sets M. A \<subseteq> A0 \<longrightarrow> (emeasure M A = 0 \<and> N A = 0) \<or> (emeasure M A > 0 \<and> N A = \<infinity>)) \<and>
18.691 + (\<forall>i. N (B i) \<noteq> \<infinity>)"
18.692 proof -
18.693 - interpret v: measure_space ?N
18.694 - where "space ?N = space M" and "sets ?N = sets M" and "measure ?N = \<nu>"
18.695 - by fact auto
18.696 - let ?Q = "{Q\<in>sets M. \<nu> Q \<noteq> \<infinity>}"
18.697 - let ?a = "SUP Q:?Q. \<mu> Q"
18.698 - have "{} \<in> ?Q" using v.empty_measure by auto
18.699 + let ?Q = "{Q\<in>sets M. N Q \<noteq> \<infinity>}"
18.700 + let ?a = "SUP Q:?Q. emeasure M Q"
18.701 + have "{} \<in> ?Q" by auto
18.702 then have Q_not_empty: "?Q \<noteq> {}" by blast
18.703 - have "?a \<le> \<mu> (space M)" using sets_into_space
18.704 - by (auto intro!: SUP_least measure_mono)
18.705 - then have "?a \<noteq> \<infinity>" using finite_measure_of_space
18.706 + have "?a \<le> emeasure M (space M)" using sets_into_space
18.707 + by (auto intro!: SUP_least emeasure_mono)
18.708 + then have "?a \<noteq> \<infinity>" using finite_emeasure_space
18.709 by auto
18.710 - from SUPR_countable_SUPR[OF Q_not_empty, of \<mu>]
18.711 - obtain Q'' where "range Q'' \<subseteq> \<mu> ` ?Q" and a: "?a = (SUP i::nat. Q'' i)"
18.712 + from SUPR_countable_SUPR[OF Q_not_empty, of "emeasure M"]
18.713 + obtain Q'' where "range Q'' \<subseteq> emeasure M ` ?Q" and a: "?a = (SUP i::nat. Q'' i)"
18.714 by auto
18.715 - then have "\<forall>i. \<exists>Q'. Q'' i = \<mu> Q' \<and> Q' \<in> ?Q" by auto
18.716 - from choice[OF this] obtain Q' where Q': "\<And>i. Q'' i = \<mu> (Q' i)" "\<And>i. Q' i \<in> ?Q"
18.717 + then have "\<forall>i. \<exists>Q'. Q'' i = emeasure M Q' \<and> Q' \<in> ?Q" by auto
18.718 + from choice[OF this] obtain Q' where Q': "\<And>i. Q'' i = emeasure M (Q' i)" "\<And>i. Q' i \<in> ?Q"
18.719 by auto
18.720 - then have a_Lim: "?a = (SUP i::nat. \<mu> (Q' i))" using a by simp
18.721 + then have a_Lim: "?a = (SUP i::nat. emeasure M (Q' i))" using a by simp
18.722 let ?O = "\<lambda>n. \<Union>i\<le>n. Q' i"
18.723 - have Union: "(SUP i. \<mu> (?O i)) = \<mu> (\<Union>i. ?O i)"
18.724 - proof (rule continuity_from_below[of ?O])
18.725 - show "range ?O \<subseteq> sets M" using Q' by (auto intro!: finite_UN)
18.726 + have Union: "(SUP i. emeasure M (?O i)) = emeasure M (\<Union>i. ?O i)"
18.727 + proof (rule SUP_emeasure_incseq[of ?O])
18.728 + show "range ?O \<subseteq> sets M" using Q' by auto
18.729 show "incseq ?O" by (fastforce intro!: incseq_SucI)
18.730 qed
18.731 have Q'_sets: "\<And>i. Q' i \<in> sets M" using Q' by auto
18.732 - have O_sets: "\<And>i. ?O i \<in> sets M"
18.733 - using Q' by (auto intro!: finite_UN Un)
18.734 + have O_sets: "\<And>i. ?O i \<in> sets M" using Q' by auto
18.735 then have O_in_G: "\<And>i. ?O i \<in> ?Q"
18.736 proof (safe del: notI)
18.737 - fix i have "Q' ` {..i} \<subseteq> sets M"
18.738 - using Q' by (auto intro: finite_UN)
18.739 - with v.measure_finitely_subadditive[of "{.. i}" Q']
18.740 - have "\<nu> (?O i) \<le> (\<Sum>i\<le>i. \<nu> (Q' i))" by auto
18.741 + fix i have "Q' ` {..i} \<subseteq> sets M" using Q' by auto
18.742 + then have "N (?O i) \<le> (\<Sum>i\<le>i. N (Q' i))"
18.743 + by (simp add: sets_eq emeasure_subadditive_finite)
18.744 also have "\<dots> < \<infinity>" using Q' by (simp add: setsum_Pinfty)
18.745 - finally show "\<nu> (?O i) \<noteq> \<infinity>" by simp
18.746 + finally show "N (?O i) \<noteq> \<infinity>" by simp
18.747 qed auto
18.748 have O_mono: "\<And>n. ?O n \<subseteq> ?O (Suc n)" by fastforce
18.749 - have a_eq: "?a = \<mu> (\<Union>i. ?O i)" unfolding Union[symmetric]
18.750 + have a_eq: "?a = emeasure M (\<Union>i. ?O i)" unfolding Union[symmetric]
18.751 proof (rule antisym)
18.752 - show "?a \<le> (SUP i. \<mu> (?O i))" unfolding a_Lim
18.753 - using Q' by (auto intro!: SUP_mono measure_mono finite_UN)
18.754 - show "(SUP i. \<mu> (?O i)) \<le> ?a" unfolding SUP_def
18.755 + show "?a \<le> (SUP i. emeasure M (?O i))" unfolding a_Lim
18.756 + using Q' by (auto intro!: SUP_mono emeasure_mono)
18.757 + show "(SUP i. emeasure M (?O i)) \<le> ?a" unfolding SUP_def
18.758 proof (safe intro!: Sup_mono, unfold bex_simps)
18.759 fix i
18.760 have *: "(\<Union>Q' ` {..i}) = ?O i" by auto
18.761 - then show "\<exists>x. (x \<in> sets M \<and> \<nu> x \<noteq> \<infinity>) \<and>
18.762 - \<mu> (\<Union>Q' ` {..i}) \<le> \<mu> x"
18.763 + then show "\<exists>x. (x \<in> sets M \<and> N x \<noteq> \<infinity>) \<and>
18.764 + emeasure M (\<Union>Q' ` {..i}) \<le> emeasure M x"
18.765 using O_in_G[of i] by (auto intro!: exI[of _ "?O i"])
18.766 qed
18.767 qed
18.768 @@ -687,51 +591,50 @@
18.769 show "range Q \<subseteq> sets M"
18.770 using Q_sets by auto
18.771 { fix A assume A: "A \<in> sets M" "A \<subseteq> space M - ?O_0"
18.772 - show "\<mu> A = 0 \<and> \<nu> A = 0 \<or> 0 < \<mu> A \<and> \<nu> A = \<infinity>"
18.773 + show "emeasure M A = 0 \<and> N A = 0 \<or> 0 < emeasure M A \<and> N A = \<infinity>"
18.774 proof (rule disjCI, simp)
18.775 - assume *: "0 < \<mu> A \<longrightarrow> \<nu> A \<noteq> \<infinity>"
18.776 - show "\<mu> A = 0 \<and> \<nu> A = 0"
18.777 + assume *: "0 < emeasure M A \<longrightarrow> N A \<noteq> \<infinity>"
18.778 + show "emeasure M A = 0 \<and> N A = 0"
18.779 proof cases
18.780 - assume "\<mu> A = 0" moreover with ac A have "\<nu> A = 0"
18.781 + assume "emeasure M A = 0" moreover with ac A have "N A = 0"
18.782 unfolding absolutely_continuous_def by auto
18.783 ultimately show ?thesis by simp
18.784 next
18.785 - assume "\<mu> A \<noteq> 0" with * have "\<nu> A \<noteq> \<infinity>" using positive_measure[OF A(1)] by auto
18.786 - with A have "\<mu> ?O_0 + \<mu> A = \<mu> (?O_0 \<union> A)"
18.787 - using Q' by (auto intro!: measure_additive countable_UN)
18.788 - also have "\<dots> = (SUP i. \<mu> (?O i \<union> A))"
18.789 - proof (rule continuity_from_below[of "\<lambda>i. ?O i \<union> A", symmetric, simplified])
18.790 + assume "emeasure M A \<noteq> 0" with * have "N A \<noteq> \<infinity>" using emeasure_nonneg[of M A] by auto
18.791 + with A have "emeasure M ?O_0 + emeasure M A = emeasure M (?O_0 \<union> A)"
18.792 + using Q' by (auto intro!: plus_emeasure countable_UN)
18.793 + also have "\<dots> = (SUP i. emeasure M (?O i \<union> A))"
18.794 + proof (rule SUP_emeasure_incseq[of "\<lambda>i. ?O i \<union> A", symmetric, simplified])
18.795 show "range (\<lambda>i. ?O i \<union> A) \<subseteq> sets M"
18.796 - using `\<nu> A \<noteq> \<infinity>` O_sets A by auto
18.797 + using `N A \<noteq> \<infinity>` O_sets A by auto
18.798 qed (fastforce intro!: incseq_SucI)
18.799 also have "\<dots> \<le> ?a"
18.800 proof (safe intro!: SUP_least)
18.801 fix i have "?O i \<union> A \<in> ?Q"
18.802 proof (safe del: notI)
18.803 show "?O i \<union> A \<in> sets M" using O_sets A by auto
18.804 - from O_in_G[of i] have "\<nu> (?O i \<union> A) \<le> \<nu> (?O i) + \<nu> A"
18.805 - using v.measure_subadditive[of "?O i" A] A O_sets by auto
18.806 - with O_in_G[of i] show "\<nu> (?O i \<union> A) \<noteq> \<infinity>"
18.807 - using `\<nu> A \<noteq> \<infinity>` by auto
18.808 + from O_in_G[of i] have "N (?O i \<union> A) \<le> N (?O i) + N A"
18.809 + using emeasure_subadditive[of "?O i" N A] A O_sets by (auto simp: sets_eq)
18.810 + with O_in_G[of i] show "N (?O i \<union> A) \<noteq> \<infinity>"
18.811 + using `N A \<noteq> \<infinity>` by auto
18.812 qed
18.813 - then show "\<mu> (?O i \<union> A) \<le> ?a" by (rule SUP_upper)
18.814 + then show "emeasure M (?O i \<union> A) \<le> ?a" by (rule SUP_upper)
18.815 qed
18.816 - finally have "\<mu> A = 0"
18.817 - unfolding a_eq using real_measure[OF `?O_0 \<in> sets M`] real_measure[OF A(1)] by auto
18.818 - with `\<mu> A \<noteq> 0` show ?thesis by auto
18.819 + finally have "emeasure M A = 0"
18.820 + unfolding a_eq using measure_nonneg[of M A] by (simp add: emeasure_eq_measure)
18.821 + with `emeasure M A \<noteq> 0` show ?thesis by auto
18.822 qed
18.823 qed }
18.824 - { fix i show "\<nu> (Q i) \<noteq> \<infinity>"
18.825 + { fix i show "N (Q i) \<noteq> \<infinity>"
18.826 proof (cases i)
18.827 case 0 then show ?thesis
18.828 unfolding Q_def using Q'[of 0] by simp
18.829 next
18.830 case (Suc n)
18.831 - then show ?thesis unfolding Q_def
18.832 - using `?O n \<in> ?Q` `?O (Suc n) \<in> ?Q`
18.833 - using v.measure_mono[OF O_mono, of n] v.positive_measure[of "?O n"] v.positive_measure[of "?O (Suc n)"]
18.834 - using v.measure_Diff[of "?O n" "?O (Suc n)", OF _ _ _ O_mono]
18.835 - by (cases rule: ereal2_cases[of "\<nu> (\<Union> x\<le>Suc n. Q' x)" "\<nu> (\<Union> i\<le>n. Q' i)"]) auto
18.836 + with `?O n \<in> ?Q` `?O (Suc n) \<in> ?Q`
18.837 + emeasure_Diff[OF _ _ _ O_mono, of N n] emeasure_nonneg[of N "(\<Union> x\<le>n. Q' x)"]
18.838 + show ?thesis
18.839 + by (auto simp: sets_eq ereal_minus_eq_PInfty_iff Q_def)
18.840 qed }
18.841 show "space M - ?O_0 \<in> sets M" using Q'_sets by auto
18.842 { fix j have "(\<Union>i\<le>j. ?O i) = (\<Union>i\<le>j. Q i)"
18.843 @@ -751,96 +654,93 @@
18.844 qed
18.845
18.846 lemma (in finite_measure) Radon_Nikodym_finite_measure_infinite:
18.847 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)" (is "measure_space ?N")
18.848 - assumes "absolutely_continuous \<nu>"
18.849 - shows "\<exists>f \<in> borel_measurable M. (\<forall>x. 0 \<le> f x) \<and> (\<forall>A\<in>sets M. \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M))"
18.850 + assumes "absolutely_continuous M N" and sets_eq: "sets N = sets M"
18.851 + shows "\<exists>f\<in>borel_measurable M. (\<forall>x. 0 \<le> f x) \<and> density M f = N"
18.852 proof -
18.853 - interpret v: measure_space ?N
18.854 - where "space ?N = space M" and "sets ?N = sets M" and "measure ?N = \<nu>"
18.855 - by fact auto
18.856 from split_space_into_finite_sets_and_rest[OF assms]
18.857 obtain Q0 and Q :: "nat \<Rightarrow> 'a set"
18.858 where Q: "disjoint_family Q" "range Q \<subseteq> sets M"
18.859 and Q0: "Q0 \<in> sets M" "Q0 = space M - (\<Union>i. Q i)"
18.860 - and in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> \<mu> A = 0 \<and> \<nu> A = 0 \<or> 0 < \<mu> A \<and> \<nu> A = \<infinity>"
18.861 - and Q_fin: "\<And>i. \<nu> (Q i) \<noteq> \<infinity>" by force
18.862 + and in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> emeasure M A = 0 \<and> N A = 0 \<or> 0 < emeasure M A \<and> N A = \<infinity>"
18.863 + and Q_fin: "\<And>i. N (Q i) \<noteq> \<infinity>" by force
18.864 from Q have Q_sets: "\<And>i. Q i \<in> sets M" by auto
18.865 - have "\<forall>i. \<exists>f. f\<in>borel_measurable M \<and> (\<forall>x. 0 \<le> f x) \<and> (\<forall>A\<in>sets M.
18.866 - \<nu> (Q i \<inter> A) = (\<integral>\<^isup>+x. f x * indicator (Q i \<inter> A) x \<partial>M))"
18.867 - proof
18.868 + let ?N = "\<lambda>i. density N (indicator (Q i))" and ?M = "\<lambda>i. density M (indicator (Q i))"
18.869 + have "\<forall>i. \<exists>f\<in>borel_measurable (?M i). (\<forall>x. 0 \<le> f x) \<and> density (?M i) f = ?N i"
18.870 + proof (intro allI finite_measure.Radon_Nikodym_finite_measure)
18.871 fix i
18.872 - have indicator_eq: "\<And>f x A. (f x :: ereal) * indicator (Q i \<inter> A) x * indicator (Q i) x
18.873 - = (f x * indicator (Q i) x) * indicator A x"
18.874 - unfolding indicator_def by auto
18.875 - have fm: "finite_measure (restricted_space (Q i))"
18.876 - (is "finite_measure ?R") by (rule restricted_finite_measure[OF Q_sets[of i]])
18.877 - then interpret R: finite_measure ?R .
18.878 - have fmv: "finite_measure (restricted_space (Q i) \<lparr> measure := \<nu>\<rparr>)" (is "finite_measure ?Q")
18.879 - proof
18.880 - show "measure_space ?Q"
18.881 - using v.restricted_measure_space Q_sets[of i] by auto
18.882 - show "measure ?Q (space ?Q) \<noteq> \<infinity>" using Q_fin by simp
18.883 - qed
18.884 - have "R.absolutely_continuous \<nu>"
18.885 - using `absolutely_continuous \<nu>` `Q i \<in> sets M`
18.886 - by (auto simp: R.absolutely_continuous_def absolutely_continuous_def)
18.887 - from R.Radon_Nikodym_finite_measure[OF fmv this]
18.888 - obtain f where f: "(\<lambda>x. f x * indicator (Q i) x) \<in> borel_measurable M"
18.889 - and f_int: "\<And>A. A\<in>sets M \<Longrightarrow> \<nu> (Q i \<inter> A) = (\<integral>\<^isup>+x. (f x * indicator (Q i) x) * indicator A x \<partial>M)"
18.890 - unfolding Bex_def borel_measurable_restricted[OF `Q i \<in> sets M`]
18.891 - positive_integral_restricted[OF `Q i \<in> sets M`] by (auto simp: indicator_eq)
18.892 - then show "\<exists>f. f\<in>borel_measurable M \<and> (\<forall>x. 0 \<le> f x) \<and> (\<forall>A\<in>sets M.
18.893 - \<nu> (Q i \<inter> A) = (\<integral>\<^isup>+x. f x * indicator (Q i \<inter> A) x \<partial>M))"
18.894 - by (auto intro!: exI[of _ "\<lambda>x. max 0 (f x * indicator (Q i) x)"] positive_integral_cong_pos
18.895 - split: split_indicator split_if_asm simp: max_def)
18.896 + from Q show "finite_measure (?M i)"
18.897 + by (auto intro!: finite_measureI cong: positive_integral_cong
18.898 + simp add: emeasure_density subset_eq sets_eq)
18.899 + from Q have "emeasure (?N i) (space N) = emeasure N (Q i)"
18.900 + by (simp add: sets_eq[symmetric] emeasure_density subset_eq cong: positive_integral_cong)
18.901 + with Q_fin show "finite_measure (?N i)"
18.902 + by (auto intro!: finite_measureI)
18.903 + show "sets (?N i) = sets (?M i)" by (simp add: sets_eq)
18.904 + show "absolutely_continuous (?M i) (?N i)"
18.905 + using `absolutely_continuous M N` `Q i \<in> sets M`
18.906 + by (auto simp: absolutely_continuous_def null_sets_density_iff sets_eq
18.907 + intro!: absolutely_continuous_AE[OF sets_eq])
18.908 qed
18.909 - from choice[OF this] obtain f where borel: "\<And>i. f i \<in> borel_measurable M" "\<And>i x. 0 \<le> f i x"
18.910 - and f: "\<And>A i. A \<in> sets M \<Longrightarrow>
18.911 - \<nu> (Q i \<inter> A) = (\<integral>\<^isup>+x. f i x * indicator (Q i \<inter> A) x \<partial>M)"
18.912 + from choice[OF this[unfolded Bex_def]]
18.913 + obtain f where borel: "\<And>i. f i \<in> borel_measurable M" "\<And>i x. 0 \<le> f i x"
18.914 + and f_density: "\<And>i. density (?M i) (f i) = ?N i"
18.915 by auto
18.916 + { fix A i assume A: "A \<in> sets M"
18.917 + with Q borel have "(\<integral>\<^isup>+x. f i x * indicator (Q i \<inter> A) x \<partial>M) = emeasure (density (?M i) (f i)) A"
18.918 + by (auto simp add: emeasure_density positive_integral_density subset_eq
18.919 + intro!: positive_integral_cong split: split_indicator)
18.920 + also have "\<dots> = emeasure N (Q i \<inter> A)"
18.921 + using A Q by (simp add: f_density emeasure_restricted subset_eq sets_eq)
18.922 + finally have "emeasure N (Q i \<inter> A) = (\<integral>\<^isup>+x. f i x * indicator (Q i \<inter> A) x \<partial>M)" .. }
18.923 + note integral_eq = this
18.924 let ?f = "\<lambda>x. (\<Sum>i. f i x * indicator (Q i) x) + \<infinity> * indicator Q0 x"
18.925 show ?thesis
18.926 proof (safe intro!: bexI[of _ ?f])
18.927 show "?f \<in> borel_measurable M" using Q0 borel Q_sets
18.928 by (auto intro!: measurable_If)
18.929 show "\<And>x. 0 \<le> ?f x" using borel by (auto intro!: suminf_0_le simp: indicator_def)
18.930 - fix A assume "A \<in> sets M"
18.931 - have Qi: "\<And>i. Q i \<in> sets M" using Q by auto
18.932 - have [intro,simp]: "\<And>i. (\<lambda>x. f i x * indicator (Q i \<inter> A) x) \<in> borel_measurable M"
18.933 - "\<And>i. AE x. 0 \<le> f i x * indicator (Q i \<inter> A) x"
18.934 - using borel Qi Q0(1) `A \<in> sets M` by (auto intro!: borel_measurable_ereal_times)
18.935 - have "(\<integral>\<^isup>+x. ?f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. (\<Sum>i. f i x * indicator (Q i \<inter> A) x) + \<infinity> * indicator (Q0 \<inter> A) x \<partial>M)"
18.936 - using borel by (intro positive_integral_cong) (auto simp: indicator_def)
18.937 - also have "\<dots> = (\<integral>\<^isup>+x. (\<Sum>i. f i x * indicator (Q i \<inter> A) x) \<partial>M) + \<infinity> * \<mu> (Q0 \<inter> A)"
18.938 - using borel Qi Q0(1) `A \<in> sets M`
18.939 - by (subst positive_integral_add) (auto simp del: ereal_infty_mult
18.940 - simp add: positive_integral_cmult_indicator Int intro!: suminf_0_le)
18.941 - also have "\<dots> = (\<Sum>i. \<nu> (Q i \<inter> A)) + \<infinity> * \<mu> (Q0 \<inter> A)"
18.942 - by (subst f[OF `A \<in> sets M`], subst positive_integral_suminf) auto
18.943 - finally have "(\<integral>\<^isup>+x. ?f x * indicator A x \<partial>M) = (\<Sum>i. \<nu> (Q i \<inter> A)) + \<infinity> * \<mu> (Q0 \<inter> A)" .
18.944 - moreover have "(\<Sum>i. \<nu> (Q i \<inter> A)) = \<nu> ((\<Union>i. Q i) \<inter> A)"
18.945 - using Q Q_sets `A \<in> sets M`
18.946 - by (intro v.measure_countably_additive[of "\<lambda>i. Q i \<inter> A", unfolded comp_def, simplified])
18.947 - (auto simp: disjoint_family_on_def)
18.948 - moreover have "\<infinity> * \<mu> (Q0 \<inter> A) = \<nu> (Q0 \<inter> A)"
18.949 - proof -
18.950 - have "Q0 \<inter> A \<in> sets M" using Q0(1) `A \<in> sets M` by blast
18.951 - from in_Q0[OF this] show ?thesis by auto
18.952 - qed
18.953 - moreover have "Q0 \<inter> A \<in> sets M" "((\<Union>i. Q i) \<inter> A) \<in> sets M"
18.954 - using Q_sets `A \<in> sets M` Q0(1) by (auto intro!: countable_UN)
18.955 - moreover have "((\<Union>i. Q i) \<inter> A) \<union> (Q0 \<inter> A) = A" "((\<Union>i. Q i) \<inter> A) \<inter> (Q0 \<inter> A) = {}"
18.956 - using `A \<in> sets M` sets_into_space Q0 by auto
18.957 - ultimately show "\<nu> A = (\<integral>\<^isup>+x. ?f x * indicator A x \<partial>M)"
18.958 - using v.measure_additive[simplified, of "(\<Union>i. Q i) \<inter> A" "Q0 \<inter> A"]
18.959 - by simp
18.960 + show "density M ?f = N"
18.961 + proof (rule measure_eqI)
18.962 + fix A assume "A \<in> sets (density M ?f)"
18.963 + then have "A \<in> sets M" by simp
18.964 + have Qi: "\<And>i. Q i \<in> sets M" using Q by auto
18.965 + have [intro,simp]: "\<And>i. (\<lambda>x. f i x * indicator (Q i \<inter> A) x) \<in> borel_measurable M"
18.966 + "\<And>i. AE x in M. 0 \<le> f i x * indicator (Q i \<inter> A) x"
18.967 + using borel Qi Q0(1) `A \<in> sets M` by (auto intro!: borel_measurable_ereal_times)
18.968 + have "(\<integral>\<^isup>+x. ?f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. (\<Sum>i. f i x * indicator (Q i \<inter> A) x) + \<infinity> * indicator (Q0 \<inter> A) x \<partial>M)"
18.969 + using borel by (intro positive_integral_cong) (auto simp: indicator_def)
18.970 + also have "\<dots> = (\<integral>\<^isup>+x. (\<Sum>i. f i x * indicator (Q i \<inter> A) x) \<partial>M) + \<infinity> * emeasure M (Q0 \<inter> A)"
18.971 + using borel Qi Q0(1) `A \<in> sets M`
18.972 + by (subst positive_integral_add) (auto simp del: ereal_infty_mult
18.973 + simp add: positive_integral_cmult_indicator Int intro!: suminf_0_le)
18.974 + also have "\<dots> = (\<Sum>i. N (Q i \<inter> A)) + \<infinity> * emeasure M (Q0 \<inter> A)"
18.975 + by (subst integral_eq[OF `A \<in> sets M`], subst positive_integral_suminf) auto
18.976 + finally have "(\<integral>\<^isup>+x. ?f x * indicator A x \<partial>M) = (\<Sum>i. N (Q i \<inter> A)) + \<infinity> * emeasure M (Q0 \<inter> A)" .
18.977 + moreover have "(\<Sum>i. N (Q i \<inter> A)) = N ((\<Union>i. Q i) \<inter> A)"
18.978 + using Q Q_sets `A \<in> sets M`
18.979 + by (subst suminf_emeasure) (auto simp: disjoint_family_on_def sets_eq)
18.980 + moreover have "\<infinity> * emeasure M (Q0 \<inter> A) = N (Q0 \<inter> A)"
18.981 + proof -
18.982 + have "Q0 \<inter> A \<in> sets M" using Q0(1) `A \<in> sets M` by blast
18.983 + from in_Q0[OF this] show ?thesis by auto
18.984 + qed
18.985 + moreover have "Q0 \<inter> A \<in> sets M" "((\<Union>i. Q i) \<inter> A) \<in> sets M"
18.986 + using Q_sets `A \<in> sets M` Q0(1) by auto
18.987 + moreover have "((\<Union>i. Q i) \<inter> A) \<union> (Q0 \<inter> A) = A" "((\<Union>i. Q i) \<inter> A) \<inter> (Q0 \<inter> A) = {}"
18.988 + using `A \<in> sets M` sets_into_space Q0 by auto
18.989 + ultimately have "N A = (\<integral>\<^isup>+x. ?f x * indicator A x \<partial>M)"
18.990 + using plus_emeasure[of "(\<Union>i. Q i) \<inter> A" N "Q0 \<inter> A"] by (simp add: sets_eq)
18.991 + with `A \<in> sets M` borel Q Q0(1) show "emeasure (density M ?f) A = N A"
18.992 + by (subst emeasure_density)
18.993 + (auto intro!: borel_measurable_ereal_add borel_measurable_psuminf measurable_If
18.994 + simp: subset_eq)
18.995 + qed (simp add: sets_eq)
18.996 qed
18.997 qed
18.998
18.999 lemma (in sigma_finite_measure) Radon_Nikodym:
18.1000 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)" (is "measure_space ?N")
18.1001 - assumes ac: "absolutely_continuous \<nu>"
18.1002 - shows "\<exists>f \<in> borel_measurable M. (\<forall>x. 0 \<le> f x) \<and> (\<forall>A\<in>sets M. \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M))"
18.1003 + assumes ac: "absolutely_continuous M N" assumes sets_eq: "sets N = sets M"
18.1004 + shows "\<exists>f \<in> borel_measurable M. (\<forall>x. 0 \<le> f x) \<and> density M f = N"
18.1005 proof -
18.1006 from Ex_finite_integrable_function
18.1007 obtain h where finite: "integral\<^isup>P M h \<noteq> \<infinity>" and
18.1008 @@ -849,47 +749,38 @@
18.1009 pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 < h x" and
18.1010 "\<And>x. x \<in> space M \<Longrightarrow> h x < \<infinity>" by auto
18.1011 let ?T = "\<lambda>A. (\<integral>\<^isup>+x. h x * indicator A x \<partial>M)"
18.1012 - let ?MT = "M\<lparr> measure := ?T \<rparr>"
18.1013 - interpret T: finite_measure ?MT
18.1014 - where "space ?MT = space M" and "sets ?MT = sets M" and "measure ?MT = ?T"
18.1015 - using borel finite nn
18.1016 - by (auto intro!: measure_space_density finite_measureI cong: positive_integral_cong)
18.1017 - have "T.absolutely_continuous \<nu>"
18.1018 - proof (unfold T.absolutely_continuous_def, safe)
18.1019 - fix N assume "N \<in> sets M" "(\<integral>\<^isup>+x. h x * indicator N x \<partial>M) = 0"
18.1020 - with borel ac pos have "AE x. x \<notin> N"
18.1021 - by (subst (asm) positive_integral_0_iff_AE) (auto split: split_indicator simp: not_le)
18.1022 - then have "N \<in> null_sets" using `N \<in> sets M` sets_into_space
18.1023 - by (subst (asm) AE_iff_measurable[OF `N \<in> sets M`]) auto
18.1024 - then show "\<nu> N = 0" using ac by (auto simp: absolutely_continuous_def)
18.1025 - qed
18.1026 - from T.Radon_Nikodym_finite_measure_infinite[simplified, OF assms(1) this]
18.1027 - obtain f where f_borel: "f \<in> borel_measurable M" "\<And>x. 0 \<le> f x" and
18.1028 - fT: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>?MT)"
18.1029 - by (auto simp: measurable_def)
18.1030 - show ?thesis
18.1031 - proof (safe intro!: bexI[of _ "\<lambda>x. h x * f x"])
18.1032 - show "(\<lambda>x. h x * f x) \<in> borel_measurable M"
18.1033 - using borel f_borel by auto
18.1034 - show "\<And>x. 0 \<le> h x * f x" using nn f_borel by auto
18.1035 - fix A assume "A \<in> sets M"
18.1036 - then show "\<nu> A = (\<integral>\<^isup>+x. h x * f x * indicator A x \<partial>M)"
18.1037 - unfolding fT[OF `A \<in> sets M`] mult_assoc using nn borel f_borel
18.1038 - by (intro positive_integral_translated_density) auto
18.1039 - qed
18.1040 + let ?MT = "density M h"
18.1041 + from borel finite nn interpret T: finite_measure ?MT
18.1042 + by (auto intro!: finite_measureI cong: positive_integral_cong simp: emeasure_density)
18.1043 + have "absolutely_continuous ?MT N" "sets N = sets ?MT"
18.1044 + proof (unfold absolutely_continuous_def, safe)
18.1045 + fix A assume "A \<in> null_sets ?MT"
18.1046 + with borel have "A \<in> sets M" "AE x in M. x \<in> A \<longrightarrow> h x \<le> 0"
18.1047 + by (auto simp add: null_sets_density_iff)
18.1048 + with pos sets_into_space have "AE x in M. x \<notin> A"
18.1049 + by (elim eventually_elim1) (auto simp: not_le[symmetric])
18.1050 + then have "A \<in> null_sets M"
18.1051 + using `A \<in> sets M` by (simp add: AE_iff_null_sets)
18.1052 + with ac show "A \<in> null_sets N"
18.1053 + by (auto simp: absolutely_continuous_def)
18.1054 + qed (auto simp add: sets_eq)
18.1055 + from T.Radon_Nikodym_finite_measure_infinite[OF this]
18.1056 + obtain f where f_borel: "f \<in> borel_measurable M" "\<And>x. 0 \<le> f x" "density ?MT f = N" by auto
18.1057 + with nn borel show ?thesis
18.1058 + by (auto intro!: bexI[of _ "\<lambda>x. h x * f x"] simp: density_density_eq)
18.1059 qed
18.1060
18.1061 section "Uniqueness of densities"
18.1062
18.1063 -lemma (in measure_space) finite_density_unique:
18.1064 +lemma finite_density_unique:
18.1065 assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
18.1066 - assumes pos: "AE x. 0 \<le> f x" "AE x. 0 \<le> g x"
18.1067 + assumes pos: "AE x in M. 0 \<le> f x" "AE x in M. 0 \<le> g x"
18.1068 and fin: "integral\<^isup>P M f \<noteq> \<infinity>"
18.1069 shows "(\<forall>A\<in>sets M. (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. g x * indicator A x \<partial>M))
18.1070 - \<longleftrightarrow> (AE x. f x = g x)"
18.1071 + \<longleftrightarrow> (AE x in M. f x = g x)"
18.1072 (is "(\<forall>A\<in>sets M. ?P f A = ?P g A) \<longleftrightarrow> _")
18.1073 proof (intro iffI ballI)
18.1074 - fix A assume eq: "AE x. f x = g x"
18.1075 + fix A assume eq: "AE x in M. f x = g x"
18.1076 then show "?P f A = ?P g A"
18.1077 by (auto intro: positive_integral_cong_AE)
18.1078 next
18.1079 @@ -897,7 +788,7 @@
18.1080 from this[THEN bspec, OF top] fin
18.1081 have g_fin: "integral\<^isup>P M g \<noteq> \<infinity>" by (simp cong: positive_integral_cong)
18.1082 { fix f g assume borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
18.1083 - and pos: "AE x. 0 \<le> f x" "AE x. 0 \<le> g x"
18.1084 + and pos: "AE x in M. 0 \<le> f x" "AE x in M. 0 \<le> g x"
18.1085 and g_fin: "integral\<^isup>P M g \<noteq> \<infinity>" and eq: "\<forall>A\<in>sets M. ?P f A = ?P g A"
18.1086 let ?N = "{x\<in>space M. g x < f x}"
18.1087 have N: "?N \<in> sets M" using borel by simp
18.1088 @@ -910,167 +801,163 @@
18.1089 proof (rule positive_integral_diff)
18.1090 show "(\<lambda>x. f x * indicator ?N x) \<in> borel_measurable M" "(\<lambda>x. g x * indicator ?N x) \<in> borel_measurable M"
18.1091 using borel N by auto
18.1092 - show "AE x. g x * indicator ?N x \<le> f x * indicator ?N x"
18.1093 - "AE x. 0 \<le> g x * indicator ?N x"
18.1094 + show "AE x in M. g x * indicator ?N x \<le> f x * indicator ?N x"
18.1095 + "AE x in M. 0 \<le> g x * indicator ?N x"
18.1096 using pos by (auto split: split_indicator)
18.1097 qed fact
18.1098 also have "\<dots> = 0"
18.1099 - unfolding eq[THEN bspec, OF N] using positive_integral_positive Pg_fin by auto
18.1100 - finally have "AE x. f x \<le> g x"
18.1101 + unfolding eq[THEN bspec, OF N] using positive_integral_positive[of M] Pg_fin by auto
18.1102 + finally have "AE x in M. f x \<le> g x"
18.1103 using pos borel positive_integral_PInf_AE[OF borel(2) g_fin]
18.1104 by (subst (asm) positive_integral_0_iff_AE)
18.1105 (auto split: split_indicator simp: not_less ereal_minus_le_iff) }
18.1106 from this[OF borel pos g_fin eq] this[OF borel(2,1) pos(2,1) fin] eq
18.1107 - show "AE x. f x = g x" by auto
18.1108 + show "AE x in M. f x = g x" by auto
18.1109 qed
18.1110
18.1111 lemma (in finite_measure) density_unique_finite_measure:
18.1112 assumes borel: "f \<in> borel_measurable M" "f' \<in> borel_measurable M"
18.1113 - assumes pos: "AE x. 0 \<le> f x" "AE x. 0 \<le> f' x"
18.1114 + assumes pos: "AE x in M. 0 \<le> f x" "AE x in M. 0 \<le> f' x"
18.1115 assumes f: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. f' x * indicator A x \<partial>M)"
18.1116 (is "\<And>A. A \<in> sets M \<Longrightarrow> ?P f A = ?P f' A")
18.1117 - shows "AE x. f x = f' x"
18.1118 + shows "AE x in M. f x = f' x"
18.1119 proof -
18.1120 - let ?\<nu> = "\<lambda>A. ?P f A" and ?\<nu>' = "\<lambda>A. ?P f' A"
18.1121 + let ?D = "\<lambda>f. density M f"
18.1122 + let ?N = "\<lambda>A. ?P f A" and ?N' = "\<lambda>A. ?P f' A"
18.1123 let ?f = "\<lambda>A x. f x * indicator A x" and ?f' = "\<lambda>A x. f' x * indicator A x"
18.1124 - interpret M: measure_space "M\<lparr> measure := ?\<nu>\<rparr>"
18.1125 - using borel(1) pos(1) by (rule measure_space_density) simp
18.1126 - have ac: "absolutely_continuous ?\<nu>"
18.1127 - using f by (rule density_is_absolutely_continuous)
18.1128 - from split_space_into_finite_sets_and_rest[OF `measure_space (M\<lparr> measure := ?\<nu>\<rparr>)` ac]
18.1129 +
18.1130 + have ac: "absolutely_continuous M (density M f)" "sets (density M f) = sets M"
18.1131 + using borel by (auto intro!: absolutely_continuousI_density)
18.1132 + from split_space_into_finite_sets_and_rest[OF this]
18.1133 obtain Q0 and Q :: "nat \<Rightarrow> 'a set"
18.1134 where Q: "disjoint_family Q" "range Q \<subseteq> sets M"
18.1135 and Q0: "Q0 \<in> sets M" "Q0 = space M - (\<Union>i. Q i)"
18.1136 - and in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> \<mu> A = 0 \<and> ?\<nu> A = 0 \<or> 0 < \<mu> A \<and> ?\<nu> A = \<infinity>"
18.1137 - and Q_fin: "\<And>i. ?\<nu> (Q i) \<noteq> \<infinity>" by force
18.1138 + and in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> emeasure M A = 0 \<and> ?D f A = 0 \<or> 0 < emeasure M A \<and> ?D f A = \<infinity>"
18.1139 + and Q_fin: "\<And>i. ?D f (Q i) \<noteq> \<infinity>" by force
18.1140 + with borel pos have in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> emeasure M A = 0 \<and> ?N A = 0 \<or> 0 < emeasure M A \<and> ?N A = \<infinity>"
18.1141 + and Q_fin: "\<And>i. ?N (Q i) \<noteq> \<infinity>" by (auto simp: emeasure_density subset_eq)
18.1142 +
18.1143 from Q have Q_sets: "\<And>i. Q i \<in> sets M" by auto
18.1144 - let ?N = "{x\<in>space M. f x \<noteq> f' x}"
18.1145 - have "?N \<in> sets M" using borel by auto
18.1146 + let ?D = "{x\<in>space M. f x \<noteq> f' x}"
18.1147 + have "?D \<in> sets M" using borel by auto
18.1148 have *: "\<And>i x A. \<And>y::ereal. y * indicator (Q i) x * indicator A x = y * indicator (Q i \<inter> A) x"
18.1149 unfolding indicator_def by auto
18.1150 - have "\<forall>i. AE x. ?f (Q i) x = ?f' (Q i) x" using borel Q_fin Q pos
18.1151 + have "\<forall>i. AE x in M. ?f (Q i) x = ?f' (Q i) x" using borel Q_fin Q pos
18.1152 by (intro finite_density_unique[THEN iffD1] allI)
18.1153 (auto intro!: borel_measurable_ereal_times f Int simp: *)
18.1154 - moreover have "AE x. ?f Q0 x = ?f' Q0 x"
18.1155 + moreover have "AE x in M. ?f Q0 x = ?f' Q0 x"
18.1156 proof (rule AE_I')
18.1157 { fix f :: "'a \<Rightarrow> ereal" assume borel: "f \<in> borel_measurable M"
18.1158 - and eq: "\<And>A. A \<in> sets M \<Longrightarrow> ?\<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.1159 + and eq: "\<And>A. A \<in> sets M \<Longrightarrow> ?N A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.1160 let ?A = "\<lambda>i. Q0 \<inter> {x \<in> space M. f x < (i::nat)}"
18.1161 - have "(\<Union>i. ?A i) \<in> null_sets"
18.1162 + have "(\<Union>i. ?A i) \<in> null_sets M"
18.1163 proof (rule null_sets_UN)
18.1164 fix i ::nat have "?A i \<in> sets M"
18.1165 using borel Q0(1) by auto
18.1166 - have "?\<nu> (?A i) \<le> (\<integral>\<^isup>+x. (i::ereal) * indicator (?A i) x \<partial>M)"
18.1167 + have "?N (?A i) \<le> (\<integral>\<^isup>+x. (i::ereal) * indicator (?A i) x \<partial>M)"
18.1168 unfolding eq[OF `?A i \<in> sets M`]
18.1169 by (auto intro!: positive_integral_mono simp: indicator_def)
18.1170 - also have "\<dots> = i * \<mu> (?A i)"
18.1171 + also have "\<dots> = i * emeasure M (?A i)"
18.1172 using `?A i \<in> sets M` by (auto intro!: positive_integral_cmult_indicator)
18.1173 - also have "\<dots> < \<infinity>"
18.1174 - using `?A i \<in> sets M`[THEN finite_measure] by auto
18.1175 - finally have "?\<nu> (?A i) \<noteq> \<infinity>" by simp
18.1176 - then show "?A i \<in> null_sets" using in_Q0[OF `?A i \<in> sets M`] `?A i \<in> sets M` by auto
18.1177 + also have "\<dots> < \<infinity>" using emeasure_real[of "?A i"] by simp
18.1178 + finally have "?N (?A i) \<noteq> \<infinity>" by simp
18.1179 + then show "?A i \<in> null_sets M" using in_Q0[OF `?A i \<in> sets M`] `?A i \<in> sets M` by auto
18.1180 qed
18.1181 also have "(\<Union>i. ?A i) = Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>}"
18.1182 by (auto simp: less_PInf_Ex_of_nat real_eq_of_nat)
18.1183 - finally have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>} \<in> null_sets" by simp }
18.1184 + finally have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>} \<in> null_sets M" by simp }
18.1185 from this[OF borel(1) refl] this[OF borel(2) f]
18.1186 - have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>} \<in> null_sets" "Q0 \<inter> {x\<in>space M. f' x \<noteq> \<infinity>} \<in> null_sets" by simp_all
18.1187 - then show "(Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<infinity>}) \<in> null_sets" by (rule nullsets.Un)
18.1188 + have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>} \<in> null_sets M" "Q0 \<inter> {x\<in>space M. f' x \<noteq> \<infinity>} \<in> null_sets M" by simp_all
18.1189 + then show "(Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<infinity>}) \<in> null_sets M" by (rule null_sets.Un)
18.1190 show "{x \<in> space M. ?f Q0 x \<noteq> ?f' Q0 x} \<subseteq>
18.1191 (Q0 \<inter> {x\<in>space M. f x \<noteq> \<infinity>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<infinity>})" by (auto simp: indicator_def)
18.1192 qed
18.1193 - moreover have "\<And>x. (?f Q0 x = ?f' Q0 x) \<longrightarrow> (\<forall>i. ?f (Q i) x = ?f' (Q i) x) \<longrightarrow>
18.1194 + moreover have "AE x in M. (?f Q0 x = ?f' Q0 x) \<longrightarrow> (\<forall>i. ?f (Q i) x = ?f' (Q i) x) \<longrightarrow>
18.1195 ?f (space M) x = ?f' (space M) x"
18.1196 by (auto simp: indicator_def Q0)
18.1197 - ultimately have "AE x. ?f (space M) x = ?f' (space M) x"
18.1198 - by (auto simp: AE_all_countable[symmetric])
18.1199 - then show "AE x. f x = f' x" by auto
18.1200 + ultimately have "AE x in M. ?f (space M) x = ?f' (space M) x"
18.1201 + unfolding AE_all_countable[symmetric]
18.1202 + by eventually_elim (auto intro!: AE_I2 split: split_if_asm simp: indicator_def)
18.1203 + then show "AE x in M. f x = f' x" by auto
18.1204 qed
18.1205
18.1206 lemma (in sigma_finite_measure) density_unique:
18.1207 - assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
18.1208 - assumes f': "f' \<in> borel_measurable M" "AE x. 0 \<le> f' x"
18.1209 - assumes eq: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. f' x * indicator A x \<partial>M)"
18.1210 - (is "\<And>A. A \<in> sets M \<Longrightarrow> ?P f A = ?P f' A")
18.1211 - shows "AE x. f x = f' x"
18.1212 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
18.1213 + assumes f': "f' \<in> borel_measurable M" "AE x in M. 0 \<le> f' x"
18.1214 + assumes density_eq: "density M f = density M f'"
18.1215 + shows "AE x in M. f x = f' x"
18.1216 proof -
18.1217 obtain h where h_borel: "h \<in> borel_measurable M"
18.1218 and fin: "integral\<^isup>P M h \<noteq> \<infinity>" and pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 < h x \<and> h x < \<infinity>" "\<And>x. 0 \<le> h x"
18.1219 using Ex_finite_integrable_function by auto
18.1220 - then have h_nn: "AE x. 0 \<le> h x" by auto
18.1221 - let ?H = "M\<lparr> measure := \<lambda>A. (\<integral>\<^isup>+x. h x * indicator A x \<partial>M) \<rparr>"
18.1222 - have H: "measure_space ?H"
18.1223 - using h_borel h_nn by (rule measure_space_density) simp
18.1224 - then interpret h: measure_space ?H .
18.1225 - interpret h: finite_measure "M\<lparr> measure := \<lambda>A. (\<integral>\<^isup>+x. h x * indicator A x \<partial>M) \<rparr>"
18.1226 - by (intro H finite_measureI) (simp cong: positive_integral_cong add: fin)
18.1227 - let ?fM = "M\<lparr>measure := \<lambda>A. (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)\<rparr>"
18.1228 - interpret f: measure_space ?fM
18.1229 - using f by (rule measure_space_density) simp
18.1230 - let ?f'M = "M\<lparr>measure := \<lambda>A. (\<integral>\<^isup>+x. f' x * indicator A x \<partial>M)\<rparr>"
18.1231 - interpret f': measure_space ?f'M
18.1232 - using f' by (rule measure_space_density) simp
18.1233 + then have h_nn: "AE x in M. 0 \<le> h x" by auto
18.1234 + let ?H = "density M h"
18.1235 + interpret h: finite_measure ?H
18.1236 + using fin h_borel pos
18.1237 + by (intro finite_measureI) (simp cong: positive_integral_cong emeasure_density add: fin)
18.1238 + let ?fM = "density M f"
18.1239 + let ?f'M = "density M f'"
18.1240 { fix A assume "A \<in> sets M"
18.1241 then have "{x \<in> space M. h x * indicator A x \<noteq> 0} = A"
18.1242 using pos(1) sets_into_space by (force simp: indicator_def)
18.1243 - then have "(\<integral>\<^isup>+x. h x * indicator A x \<partial>M) = 0 \<longleftrightarrow> A \<in> null_sets"
18.1244 + then have "(\<integral>\<^isup>+x. h x * indicator A x \<partial>M) = 0 \<longleftrightarrow> A \<in> null_sets M"
18.1245 using h_borel `A \<in> sets M` h_nn by (subst positive_integral_0_iff) auto }
18.1246 note h_null_sets = this
18.1247 { fix A assume "A \<in> sets M"
18.1248 have "(\<integral>\<^isup>+x. f x * (h x * indicator A x) \<partial>M) = (\<integral>\<^isup>+x. h x * indicator A x \<partial>?fM)"
18.1249 using `A \<in> sets M` h_borel h_nn f f'
18.1250 - by (intro positive_integral_translated_density[symmetric]) auto
18.1251 + by (intro positive_integral_density[symmetric]) auto
18.1252 also have "\<dots> = (\<integral>\<^isup>+x. h x * indicator A x \<partial>?f'M)"
18.1253 - by (rule f'.positive_integral_cong_measure) (simp_all add: eq)
18.1254 + by (simp_all add: density_eq)
18.1255 also have "\<dots> = (\<integral>\<^isup>+x. f' x * (h x * indicator A x) \<partial>M)"
18.1256 using `A \<in> sets M` h_borel h_nn f f'
18.1257 - by (intro positive_integral_translated_density) auto
18.1258 + by (intro positive_integral_density) auto
18.1259 finally have "(\<integral>\<^isup>+x. h x * (f x * indicator A x) \<partial>M) = (\<integral>\<^isup>+x. h x * (f' x * indicator A x) \<partial>M)"
18.1260 by (simp add: ac_simps)
18.1261 then have "(\<integral>\<^isup>+x. (f x * indicator A x) \<partial>?H) = (\<integral>\<^isup>+x. (f' x * indicator A x) \<partial>?H)"
18.1262 using `A \<in> sets M` h_borel h_nn f f'
18.1263 - by (subst (asm) (1 2) positive_integral_translated_density[symmetric]) auto }
18.1264 + by (subst (asm) (1 2) positive_integral_density[symmetric]) auto }
18.1265 then have "AE x in ?H. f x = f' x" using h_borel h_nn f f'
18.1266 - by (intro h.density_unique_finite_measure absolutely_continuous_AE[OF H] density_is_absolutely_continuous)
18.1267 - simp_all
18.1268 - then show "AE x. f x = f' x"
18.1269 - unfolding h.almost_everywhere_def almost_everywhere_def
18.1270 - by (auto simp add: h_null_sets)
18.1271 + by (intro h.density_unique_finite_measure absolutely_continuous_AE[of M])
18.1272 + (auto simp add: AE_density)
18.1273 + then show "AE x in M. f x = f' x"
18.1274 + unfolding eventually_ae_filter using h_borel pos
18.1275 + by (auto simp add: h_null_sets null_sets_density_iff not_less[symmetric]
18.1276 + AE_iff_null_sets[symmetric])
18.1277 + blast
18.1278 qed
18.1279
18.1280 +lemma (in sigma_finite_measure) density_unique_iff:
18.1281 + assumes f: "f \<in> borel_measurable M" and "AE x in M. 0 \<le> f x"
18.1282 + assumes f': "f' \<in> borel_measurable M" and "AE x in M. 0 \<le> f' x"
18.1283 + shows "density M f = density M f' \<longleftrightarrow> (AE x in M. f x = f' x)"
18.1284 + using density_unique[OF assms] density_cong[OF f f'] by auto
18.1285 +
18.1286 lemma (in sigma_finite_measure) sigma_finite_iff_density_finite:
18.1287 - assumes \<nu>: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" (is "measure_space ?N")
18.1288 - and f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
18.1289 - and eq: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.1290 - shows "sigma_finite_measure (M\<lparr>measure := \<nu>\<rparr>) \<longleftrightarrow> (AE x. f x \<noteq> \<infinity>)"
18.1291 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
18.1292 + shows "sigma_finite_measure (density M f) \<longleftrightarrow> (AE x in M. f x \<noteq> \<infinity>)"
18.1293 + (is "sigma_finite_measure ?N \<longleftrightarrow> _")
18.1294 proof
18.1295 assume "sigma_finite_measure ?N"
18.1296 - then interpret \<nu>: sigma_finite_measure ?N
18.1297 - where "borel_measurable ?N = borel_measurable M" and "measure ?N = \<nu>"
18.1298 - and "sets ?N = sets M" and "space ?N = space M" by (auto simp: measurable_def)
18.1299 - from \<nu>.Ex_finite_integrable_function obtain h where
18.1300 + then interpret N: sigma_finite_measure ?N .
18.1301 + from N.Ex_finite_integrable_function obtain h where
18.1302 h: "h \<in> borel_measurable M" "integral\<^isup>P ?N h \<noteq> \<infinity>" and
18.1303 h_nn: "\<And>x. 0 \<le> h x" and
18.1304 fin: "\<forall>x\<in>space M. 0 < h x \<and> h x < \<infinity>" by auto
18.1305 - have "AE x. f x * h x \<noteq> \<infinity>"
18.1306 + have "AE x in M. f x * h x \<noteq> \<infinity>"
18.1307 proof (rule AE_I')
18.1308 have "integral\<^isup>P ?N h = (\<integral>\<^isup>+x. f x * h x \<partial>M)" using f h h_nn
18.1309 - by (subst \<nu>.positive_integral_cong_measure[symmetric,
18.1310 - of "M\<lparr> measure := \<lambda> A. \<integral>\<^isup>+x. f x * indicator A x \<partial>M \<rparr>"])
18.1311 - (auto intro!: positive_integral_translated_density simp: eq)
18.1312 + by (auto intro!: positive_integral_density)
18.1313 then have "(\<integral>\<^isup>+x. f x * h x \<partial>M) \<noteq> \<infinity>"
18.1314 using h(2) by simp
18.1315 - then show "(\<lambda>x. f x * h x) -` {\<infinity>} \<inter> space M \<in> null_sets"
18.1316 + then show "(\<lambda>x. f x * h x) -` {\<infinity>} \<inter> space M \<in> null_sets M"
18.1317 using f h(1) by (auto intro!: positive_integral_PInf borel_measurable_vimage)
18.1318 qed auto
18.1319 - then show "AE x. f x \<noteq> \<infinity>"
18.1320 + then show "AE x in M. f x \<noteq> \<infinity>"
18.1321 using fin by (auto elim!: AE_Ball_mp)
18.1322 next
18.1323 - assume AE: "AE x. f x \<noteq> \<infinity>"
18.1324 + assume AE: "AE x in M. f x \<noteq> \<infinity>"
18.1325 from sigma_finite guess Q .. note Q = this
18.1326 - interpret \<nu>: measure_space ?N
18.1327 - where "borel_measurable ?N = borel_measurable M" and "measure ?N = \<nu>"
18.1328 - and "sets ?N = sets M" and "space ?N = space M" using \<nu> by (auto simp: measurable_def)
18.1329 def A \<equiv> "\<lambda>i. f -` (case i of 0 \<Rightarrow> {\<infinity>} | Suc n \<Rightarrow> {.. ereal(of_nat (Suc n))}) \<inter> space M"
18.1330 { fix i j have "A i \<inter> Q j \<in> sets M"
18.1331 unfolding A_def using f Q
18.1332 @@ -1113,7 +1000,7 @@
18.1333 have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) \<noteq> \<infinity>"
18.1334 proof (cases i)
18.1335 case 0
18.1336 - have "AE x. f x * indicator (A i \<inter> Q j) x = 0"
18.1337 + have "AE x in M. f x * indicator (A i \<inter> Q j) x = 0"
18.1338 using AE by (auto simp: A_def `i = 0`)
18.1339 from positive_integral_cong_AE[OF this] show ?thesis by simp
18.1340 next
18.1341 @@ -1121,271 +1008,238 @@
18.1342 then have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) \<le>
18.1343 (\<integral>\<^isup>+x. (Suc n :: ereal) * indicator (Q j) x \<partial>M)"
18.1344 by (auto intro!: positive_integral_mono simp: indicator_def A_def real_eq_of_nat)
18.1345 - also have "\<dots> = Suc n * \<mu> (Q j)"
18.1346 + also have "\<dots> = Suc n * emeasure M (Q j)"
18.1347 using Q by (auto intro!: positive_integral_cmult_indicator)
18.1348 also have "\<dots> < \<infinity>"
18.1349 using Q by (auto simp: real_eq_of_nat[symmetric])
18.1350 finally show ?thesis by simp
18.1351 qed
18.1352 - then show "measure ?N (?A n) \<noteq> \<infinity>"
18.1353 - using A_in_sets Q eq by auto
18.1354 + then show "emeasure ?N (?A n) \<noteq> \<infinity>"
18.1355 + using A_in_sets Q f by (auto simp: emeasure_density)
18.1356 qed
18.1357 qed
18.1358
18.1359 section "Radon-Nikodym derivative"
18.1360
18.1361 definition
18.1362 - "RN_deriv M \<nu> \<equiv> SOME f. f \<in> borel_measurable M \<and> (\<forall>x. 0 \<le> f x) \<and>
18.1363 - (\<forall>A \<in> sets M. \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M))"
18.1364 + "RN_deriv M N \<equiv> SOME f. f \<in> borel_measurable M \<and> (\<forall>x. 0 \<le> f x) \<and> density M f = N"
18.1365
18.1366 -lemma (in sigma_finite_measure) RN_deriv_cong:
18.1367 - assumes cong: "\<And>A. A \<in> sets M \<Longrightarrow> measure M' A = \<mu> A" "sets M' = sets M" "space M' = space M"
18.1368 - and \<nu>: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu>' A = \<nu> A"
18.1369 - shows "RN_deriv M' \<nu>' x = RN_deriv M \<nu> x"
18.1370 +lemma
18.1371 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
18.1372 + shows borel_measurable_RN_deriv_density: "RN_deriv M (density M f) \<in> borel_measurable M" (is ?borel)
18.1373 + and density_RN_deriv_density: "density M (RN_deriv M (density M f)) = density M f" (is ?density)
18.1374 + and RN_deriv_density_nonneg: "0 \<le> RN_deriv M (density M f) x" (is ?pos)
18.1375 proof -
18.1376 - interpret \<mu>': sigma_finite_measure M'
18.1377 - using cong by (rule sigma_finite_measure_cong)
18.1378 - show ?thesis
18.1379 - unfolding RN_deriv_def
18.1380 - by (simp add: cong \<nu> positive_integral_cong_measure[OF cong] measurable_def)
18.1381 + let ?f = "\<lambda>x. max 0 (f x)"
18.1382 + let ?P = "\<lambda>g. g \<in> borel_measurable M \<and> (\<forall>x. 0 \<le> g x) \<and> density M g = density M f"
18.1383 + from f have "?P ?f" using f by (auto intro!: density_cong simp: split: split_max)
18.1384 + then have "?P (RN_deriv M (density M f))"
18.1385 + unfolding RN_deriv_def by (rule someI[where P="?P"])
18.1386 + then show ?borel ?density ?pos by auto
18.1387 qed
18.1388
18.1389 lemma (in sigma_finite_measure) RN_deriv:
18.1390 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)"
18.1391 - assumes "absolutely_continuous \<nu>"
18.1392 - shows "RN_deriv M \<nu> \<in> borel_measurable M" (is ?borel)
18.1393 - and "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * indicator A x \<partial>M)"
18.1394 - (is "\<And>A. _ \<Longrightarrow> ?int A")
18.1395 - and "0 \<le> RN_deriv M \<nu> x"
18.1396 + assumes "absolutely_continuous M N" "sets N = sets M"
18.1397 + shows borel_measurable_RN_deriv: "RN_deriv M N \<in> borel_measurable M" (is ?borel)
18.1398 + and density_RN_deriv: "density M (RN_deriv M N) = N" (is ?density)
18.1399 + and RN_deriv_nonneg: "0 \<le> RN_deriv M N x" (is ?pos)
18.1400 proof -
18.1401 note Ex = Radon_Nikodym[OF assms, unfolded Bex_def]
18.1402 - then show ?borel unfolding RN_deriv_def by (rule someI2_ex) auto
18.1403 - from Ex show "0 \<le> RN_deriv M \<nu> x" unfolding RN_deriv_def
18.1404 - by (rule someI2_ex) simp
18.1405 - fix A assume "A \<in> sets M"
18.1406 - from Ex show "?int A" unfolding RN_deriv_def
18.1407 - by (rule someI2_ex) (simp add: `A \<in> sets M`)
18.1408 + from Ex show ?borel unfolding RN_deriv_def by (rule someI2_ex) simp
18.1409 + from Ex show ?density unfolding RN_deriv_def by (rule someI2_ex) simp
18.1410 + from Ex show ?pos unfolding RN_deriv_def by (rule someI2_ex) simp
18.1411 qed
18.1412
18.1413 lemma (in sigma_finite_measure) RN_deriv_positive_integral:
18.1414 - assumes \<nu>: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" "absolutely_continuous \<nu>"
18.1415 + assumes N: "absolutely_continuous M N" "sets N = sets M"
18.1416 and f: "f \<in> borel_measurable M"
18.1417 - shows "integral\<^isup>P (M\<lparr>measure := \<nu>\<rparr>) f = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * f x \<partial>M)"
18.1418 + shows "integral\<^isup>P N f = (\<integral>\<^isup>+x. RN_deriv M N x * f x \<partial>M)"
18.1419 proof -
18.1420 - interpret \<nu>: measure_space "M\<lparr>measure := \<nu>\<rparr>" by fact
18.1421 - note RN = RN_deriv[OF \<nu>]
18.1422 - have "integral\<^isup>P (M\<lparr>measure := \<nu>\<rparr>) f = (\<integral>\<^isup>+x. max 0 (f x) \<partial>M\<lparr>measure := \<nu>\<rparr>)"
18.1423 - unfolding positive_integral_max_0 ..
18.1424 - also have "(\<integral>\<^isup>+x. max 0 (f x) \<partial>M\<lparr>measure := \<nu>\<rparr>) =
18.1425 - (\<integral>\<^isup>+x. max 0 (f x) \<partial>M\<lparr>measure := \<lambda>A. (\<integral>\<^isup>+x. RN_deriv M \<nu> x * indicator A x \<partial>M)\<rparr>)"
18.1426 - by (intro \<nu>.positive_integral_cong_measure[symmetric]) (simp_all add: RN(2))
18.1427 - also have "\<dots> = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * max 0 (f x) \<partial>M)"
18.1428 - by (intro positive_integral_translated_density) (auto simp add: RN f)
18.1429 - also have "\<dots> = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * f x \<partial>M)"
18.1430 - using RN_deriv(3)[OF \<nu>]
18.1431 - by (auto intro!: positive_integral_cong_pos split: split_if_asm
18.1432 - simp: max_def ereal_mult_le_0_iff)
18.1433 - finally show ?thesis .
18.1434 + have "integral\<^isup>P N f = integral\<^isup>P (density M (RN_deriv M N)) f"
18.1435 + using N by (simp add: density_RN_deriv)
18.1436 + also have "\<dots> = (\<integral>\<^isup>+x. RN_deriv M N x * f x \<partial>M)"
18.1437 + using RN_deriv(1,3)[OF N] f by (simp add: positive_integral_density)
18.1438 + finally show ?thesis by simp
18.1439 qed
18.1440
18.1441 +lemma null_setsD_AE: "N \<in> null_sets M \<Longrightarrow> AE x in M. x \<notin> N"
18.1442 + using AE_iff_null_sets[of N M] by auto
18.1443 +
18.1444 lemma (in sigma_finite_measure) RN_deriv_unique:
18.1445 - assumes \<nu>: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" "absolutely_continuous \<nu>"
18.1446 - and f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x"
18.1447 - and eq: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)"
18.1448 - shows "AE x. f x = RN_deriv M \<nu> x"
18.1449 -proof (rule density_unique[OF f RN_deriv(1)[OF \<nu>]])
18.1450 - show "AE x. 0 \<le> RN_deriv M \<nu> x" using RN_deriv[OF \<nu>] by auto
18.1451 - fix A assume A: "A \<in> sets M"
18.1452 - show "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * indicator A x \<partial>M)"
18.1453 - unfolding eq[OF A, symmetric] RN_deriv(2)[OF \<nu> A, symmetric] ..
18.1454 -qed
18.1455 + assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
18.1456 + and eq: "density M f = N"
18.1457 + shows "AE x in M. f x = RN_deriv M N x"
18.1458 +proof (rule density_unique)
18.1459 + have ac: "absolutely_continuous M N"
18.1460 + using f(1) unfolding eq[symmetric] by (rule absolutely_continuousI_density)
18.1461 + have eq2: "sets N = sets M"
18.1462 + unfolding eq[symmetric] by simp
18.1463 + show "RN_deriv M N \<in> borel_measurable M" "AE x in M. 0 \<le> RN_deriv M N x"
18.1464 + "density M f = density M (RN_deriv M N)"
18.1465 + using RN_deriv[OF ac eq2] eq by auto
18.1466 +qed fact+
18.1467
18.1468 -lemma (in sigma_finite_measure) RN_deriv_vimage:
18.1469 - assumes T: "T \<in> measure_preserving M M'"
18.1470 - and T': "T' \<in> measure_preserving (M'\<lparr> measure := \<nu>' \<rparr>) (M\<lparr> measure := \<nu> \<rparr>)"
18.1471 - and inv: "\<And>x. x \<in> space M \<Longrightarrow> T' (T x) = x"
18.1472 - and \<nu>': "measure_space (M'\<lparr>measure := \<nu>'\<rparr>)" "measure_space.absolutely_continuous M' \<nu>'"
18.1473 - shows "AE x. RN_deriv M' \<nu>' (T x) = RN_deriv M \<nu> x"
18.1474 +lemma (in sigma_finite_measure) RN_deriv_distr:
18.1475 + fixes T :: "'a \<Rightarrow> 'b"
18.1476 + assumes T: "T \<in> measurable M M'" and T': "T' \<in> measurable M' M"
18.1477 + and inv: "\<forall>x\<in>space M. T' (T x) = x"
18.1478 + and ac: "absolutely_continuous (distr M M' T) (distr N M' T)"
18.1479 + and N: "sets N = sets M"
18.1480 + shows "AE x in M. RN_deriv (distr M M' T) (distr N M' T) (T x) = RN_deriv M N x"
18.1481 proof (rule RN_deriv_unique)
18.1482 - interpret \<nu>': measure_space "M'\<lparr>measure := \<nu>'\<rparr>" by fact
18.1483 - show "measure_space (M\<lparr> measure := \<nu>\<rparr>)"
18.1484 - by (rule \<nu>'.measure_space_vimage[OF _ T'], simp) default
18.1485 - interpret M': measure_space M'
18.1486 - proof (rule measure_space_vimage)
18.1487 - have "sigma_algebra (M'\<lparr> measure := \<nu>'\<rparr>)" by default
18.1488 - then show "sigma_algebra M'" by simp
18.1489 - qed fact
18.1490 - show "absolutely_continuous \<nu>" unfolding absolutely_continuous_def
18.1491 - proof safe
18.1492 - fix N assume N: "N \<in> sets M" and N_0: "\<mu> N = 0"
18.1493 - then have N': "T' -` N \<inter> space M' \<in> sets M'"
18.1494 - using T' by (auto simp: measurable_def measure_preserving_def)
18.1495 - have "T -` (T' -` N \<inter> space M') \<inter> space M = N"
18.1496 - using inv T N sets_into_space[OF N] by (auto simp: measurable_def measure_preserving_def)
18.1497 - then have "measure M' (T' -` N \<inter> space M') = 0"
18.1498 - using measure_preservingD[OF T N'] N_0 by auto
18.1499 - with \<nu>'(2) N' show "\<nu> N = 0" using measure_preservingD[OF T', of N] N
18.1500 - unfolding M'.absolutely_continuous_def measurable_def by auto
18.1501 - qed
18.1502 - interpret M': sigma_finite_measure M'
18.1503 + have [simp]: "sets N = sets M" by fact
18.1504 + note sets_eq_imp_space_eq[OF N, simp]
18.1505 + have measurable_N[simp]: "\<And>M'. measurable N M' = measurable M M'" by (auto simp: measurable_def)
18.1506 + { fix A assume "A \<in> sets M"
18.1507 + with inv T T' sets_into_space[OF this]
18.1508 + have "T -` T' -` A \<inter> T -` space M' \<inter> space M = A"
18.1509 + by (auto simp: measurable_def) }
18.1510 + note eq = this[simp]
18.1511 + { fix A assume "A \<in> sets M"
18.1512 + with inv T T' sets_into_space[OF this]
18.1513 + have "(T' \<circ> T) -` A \<inter> space M = A"
18.1514 + by (auto simp: measurable_def) }
18.1515 + note eq2 = this[simp]
18.1516 + let ?M' = "distr M M' T" and ?N' = "distr N M' T"
18.1517 + interpret M': sigma_finite_measure ?M'
18.1518 proof
18.1519 from sigma_finite guess F .. note F = this
18.1520 - show "\<exists>A::nat \<Rightarrow> 'c set. range A \<subseteq> sets M' \<and> (\<Union>i. A i) = space M' \<and> (\<forall>i. M'.\<mu> (A i) \<noteq> \<infinity>)"
18.1521 + show "\<exists>A::nat \<Rightarrow> 'b set. range A \<subseteq> sets ?M' \<and> (\<Union>i. A i) = space ?M' \<and> (\<forall>i. emeasure ?M' (A i) \<noteq> \<infinity>)"
18.1522 proof (intro exI conjI allI)
18.1523 - show *: "range (\<lambda>i. T' -` F i \<inter> space M') \<subseteq> sets M'"
18.1524 - using F T' by (auto simp: measurable_def measure_preserving_def)
18.1525 - show "(\<Union>i. T' -` F i \<inter> space M') = space M'"
18.1526 - using F T' by (force simp: measurable_def measure_preserving_def)
18.1527 + show *: "range (\<lambda>i. T' -` F i \<inter> space ?M') \<subseteq> sets ?M'"
18.1528 + using F T' by (auto simp: measurable_def)
18.1529 + show "(\<Union>i. T' -` F i \<inter> space ?M') = space ?M'"
18.1530 + using F T' by (force simp: measurable_def)
18.1531 fix i
18.1532 have "T' -` F i \<inter> space M' \<in> sets M'" using * by auto
18.1533 - note measure_preservingD[OF T this, symmetric]
18.1534 moreover
18.1535 have Fi: "F i \<in> sets M" using F by auto
18.1536 - then have "T -` (T' -` F i \<inter> space M') \<inter> space M = F i"
18.1537 - using T inv sets_into_space[OF Fi]
18.1538 - by (auto simp: measurable_def measure_preserving_def)
18.1539 - ultimately show "measure M' (T' -` F i \<inter> space M') \<noteq> \<infinity>"
18.1540 - using F by simp
18.1541 + ultimately show "emeasure ?M' (T' -` F i \<inter> space ?M') \<noteq> \<infinity>"
18.1542 + using F T T' by (simp add: emeasure_distr)
18.1543 qed
18.1544 qed
18.1545 - have "(RN_deriv M' \<nu>') \<circ> T \<in> borel_measurable M"
18.1546 - by (intro measurable_comp[where b=M'] M'.RN_deriv(1) measure_preservingD2[OF T]) fact+
18.1547 - then show "(\<lambda>x. RN_deriv M' \<nu>' (T x)) \<in> borel_measurable M"
18.1548 + have "(RN_deriv ?M' ?N') \<circ> T \<in> borel_measurable M"
18.1549 + using T ac by (intro measurable_comp[where b="?M'"] M'.borel_measurable_RN_deriv) simp_all
18.1550 + then show "(\<lambda>x. RN_deriv ?M' ?N' (T x)) \<in> borel_measurable M"
18.1551 by (simp add: comp_def)
18.1552 - show "AE x. 0 \<le> RN_deriv M' \<nu>' (T x)" using M'.RN_deriv(3)[OF \<nu>'] by auto
18.1553 - fix A let ?A = "T' -` A \<inter> space M'"
18.1554 - assume A: "A \<in> sets M"
18.1555 - then have A': "?A \<in> sets M'" using T' unfolding measurable_def measure_preserving_def
18.1556 - by auto
18.1557 - from A have "\<nu> A = \<nu>' ?A" using T'[THEN measure_preservingD] by simp
18.1558 - also have "\<dots> = \<integral>\<^isup>+ x. RN_deriv M' \<nu>' x * indicator ?A x \<partial>M'"
18.1559 - using A' by (rule M'.RN_deriv(2)[OF \<nu>'])
18.1560 - also have "\<dots> = \<integral>\<^isup>+ x. RN_deriv M' \<nu>' (T x) * indicator ?A (T x) \<partial>M"
18.1561 - proof (rule positive_integral_vimage)
18.1562 - show "sigma_algebra M'" by default
18.1563 - show "(\<lambda>x. RN_deriv M' \<nu>' x * indicator (T' -` A \<inter> space M') x) \<in> borel_measurable M'"
18.1564 - by (auto intro!: A' M'.RN_deriv(1)[OF \<nu>'])
18.1565 - qed fact
18.1566 - also have "\<dots> = \<integral>\<^isup>+ x. RN_deriv M' \<nu>' (T x) * indicator A x \<partial>M"
18.1567 - using T inv by (auto intro!: positive_integral_cong simp: measure_preserving_def measurable_def indicator_def)
18.1568 - finally show "\<nu> A = \<integral>\<^isup>+ x. RN_deriv M' \<nu>' (T x) * indicator A x \<partial>M" .
18.1569 + show "AE x in M. 0 \<le> RN_deriv ?M' ?N' (T x)" using M'.RN_deriv_nonneg[OF ac] by auto
18.1570 +
18.1571 + have "N = distr N M (T' \<circ> T)"
18.1572 + by (subst measure_of_of_measure[of N, symmetric])
18.1573 + (auto simp add: distr_def sigma_sets_eq intro!: measure_of_eq space_closed)
18.1574 + also have "\<dots> = distr (distr N M' T) M T'"
18.1575 + using T T' by (simp add: distr_distr)
18.1576 + also have "\<dots> = distr (density (distr M M' T) (RN_deriv (distr M M' T) (distr N M' T))) M T'"
18.1577 + using ac by (simp add: M'.density_RN_deriv)
18.1578 + also have "\<dots> = density M (RN_deriv (distr M M' T) (distr N M' T) \<circ> T)"
18.1579 + using M'.borel_measurable_RN_deriv[OF ac] by (simp add: distr_density_distr[OF T T', OF inv])
18.1580 + finally show "density M (\<lambda>x. RN_deriv (distr M M' T) (distr N M' T) (T x)) = N"
18.1581 + by (simp add: comp_def)
18.1582 qed
18.1583
18.1584 lemma (in sigma_finite_measure) RN_deriv_finite:
18.1585 - assumes sfm: "sigma_finite_measure (M\<lparr>measure := \<nu>\<rparr>)" and ac: "absolutely_continuous \<nu>"
18.1586 - shows "AE x. RN_deriv M \<nu> x \<noteq> \<infinity>"
18.1587 + assumes N: "sigma_finite_measure N" and ac: "absolutely_continuous M N" "sets N = sets M"
18.1588 + shows "AE x in M. RN_deriv M N x \<noteq> \<infinity>"
18.1589 proof -
18.1590 - interpret \<nu>: sigma_finite_measure "M\<lparr>measure := \<nu>\<rparr>" by fact
18.1591 - have \<nu>: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" by default
18.1592 - from sfm show ?thesis
18.1593 - using sigma_finite_iff_density_finite[OF \<nu> RN_deriv(1)[OF \<nu> ac]] RN_deriv(2,3)[OF \<nu> ac] by simp
18.1594 + interpret N: sigma_finite_measure N by fact
18.1595 + from N show ?thesis
18.1596 + using sigma_finite_iff_density_finite[OF RN_deriv(1)[OF ac]] RN_deriv(2,3)[OF ac] by simp
18.1597 qed
18.1598
18.1599 lemma (in sigma_finite_measure)
18.1600 - assumes \<nu>: "sigma_finite_measure (M\<lparr>measure := \<nu>\<rparr>)" "absolutely_continuous \<nu>"
18.1601 + assumes N: "sigma_finite_measure N" and ac: "absolutely_continuous M N" "sets N = sets M"
18.1602 and f: "f \<in> borel_measurable M"
18.1603 - shows RN_deriv_integrable: "integrable (M\<lparr>measure := \<nu>\<rparr>) f \<longleftrightarrow>
18.1604 - integrable M (\<lambda>x. real (RN_deriv M \<nu> x) * f x)" (is ?integrable)
18.1605 - and RN_deriv_integral: "integral\<^isup>L (M\<lparr>measure := \<nu>\<rparr>) f =
18.1606 - (\<integral>x. real (RN_deriv M \<nu> x) * f x \<partial>M)" (is ?integral)
18.1607 + shows RN_deriv_integrable: "integrable N f \<longleftrightarrow>
18.1608 + integrable M (\<lambda>x. real (RN_deriv M N x) * f x)" (is ?integrable)
18.1609 + and RN_deriv_integral: "integral\<^isup>L N f =
18.1610 + (\<integral>x. real (RN_deriv M N x) * f x \<partial>M)" (is ?integral)
18.1611 proof -
18.1612 - interpret \<nu>: sigma_finite_measure "M\<lparr>measure := \<nu>\<rparr>" by fact
18.1613 - have ms: "measure_space (M\<lparr>measure := \<nu>\<rparr>)" by default
18.1614 + note ac(2)[simp] and sets_eq_imp_space_eq[OF ac(2), simp]
18.1615 + interpret N: sigma_finite_measure N by fact
18.1616 have minus_cong: "\<And>A B A' B'::ereal. A = A' \<Longrightarrow> B = B' \<Longrightarrow> real A - real B = real A' - real B'" by simp
18.1617 have f': "(\<lambda>x. - f x) \<in> borel_measurable M" using f by auto
18.1618 - have Nf: "f \<in> borel_measurable (M\<lparr>measure := \<nu>\<rparr>)" using f by simp
18.1619 + have Nf: "f \<in> borel_measurable N" using f by (simp add: measurable_def)
18.1620 { fix f :: "'a \<Rightarrow> real"
18.1621 - { fix x assume *: "RN_deriv M \<nu> x \<noteq> \<infinity>"
18.1622 - have "ereal (real (RN_deriv M \<nu> x)) * ereal (f x) = ereal (real (RN_deriv M \<nu> x) * f x)"
18.1623 + { fix x assume *: "RN_deriv M N x \<noteq> \<infinity>"
18.1624 + have "ereal (real (RN_deriv M N x)) * ereal (f x) = ereal (real (RN_deriv M N x) * f x)"
18.1625 by (simp add: mult_le_0_iff)
18.1626 - then have "RN_deriv M \<nu> x * ereal (f x) = ereal (real (RN_deriv M \<nu> x) * f x)"
18.1627 - using RN_deriv(3)[OF ms \<nu>(2)] * by (auto simp add: ereal_real split: split_if_asm) }
18.1628 - then have "(\<integral>\<^isup>+x. ereal (real (RN_deriv M \<nu> x) * f x) \<partial>M) = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * ereal (f x) \<partial>M)"
18.1629 - "(\<integral>\<^isup>+x. ereal (- (real (RN_deriv M \<nu> x) * f x)) \<partial>M) = (\<integral>\<^isup>+x. RN_deriv M \<nu> x * ereal (- f x) \<partial>M)"
18.1630 - using RN_deriv_finite[OF \<nu>] unfolding ereal_mult_minus_right uminus_ereal.simps(1)[symmetric]
18.1631 + then have "RN_deriv M N x * ereal (f x) = ereal (real (RN_deriv M N x) * f x)"
18.1632 + using RN_deriv(3)[OF ac] * by (auto simp add: ereal_real split: split_if_asm) }
18.1633 + then have "(\<integral>\<^isup>+x. ereal (real (RN_deriv M N x) * f x) \<partial>M) = (\<integral>\<^isup>+x. RN_deriv M N x * ereal (f x) \<partial>M)"
18.1634 + "(\<integral>\<^isup>+x. ereal (- (real (RN_deriv M N x) * f x)) \<partial>M) = (\<integral>\<^isup>+x. RN_deriv M N x * ereal (- f x) \<partial>M)"
18.1635 + using RN_deriv_finite[OF N ac] unfolding ereal_mult_minus_right uminus_ereal.simps(1)[symmetric]
18.1636 by (auto intro!: positive_integral_cong_AE) }
18.1637 note * = this
18.1638 show ?integral ?integrable
18.1639 unfolding lebesgue_integral_def integrable_def *
18.1640 - using f RN_deriv(1)[OF ms \<nu>(2)]
18.1641 - by (auto simp: RN_deriv_positive_integral[OF ms \<nu>(2)])
18.1642 + using Nf f RN_deriv(1)[OF ac]
18.1643 + by (auto simp: RN_deriv_positive_integral[OF ac])
18.1644 qed
18.1645
18.1646 lemma (in sigma_finite_measure) real_RN_deriv:
18.1647 - assumes "finite_measure (M\<lparr>measure := \<nu>\<rparr>)" (is "finite_measure ?\<nu>")
18.1648 - assumes ac: "absolutely_continuous \<nu>"
18.1649 + assumes "finite_measure N"
18.1650 + assumes ac: "absolutely_continuous M N" "sets N = sets M"
18.1651 obtains D where "D \<in> borel_measurable M"
18.1652 - and "AE x. RN_deriv M \<nu> x = ereal (D x)"
18.1653 - and "AE x in M\<lparr>measure := \<nu>\<rparr>. 0 < D x"
18.1654 + and "AE x in M. RN_deriv M N x = ereal (D x)"
18.1655 + and "AE x in N. 0 < D x"
18.1656 and "\<And>x. 0 \<le> D x"
18.1657 proof
18.1658 - interpret \<nu>: finite_measure ?\<nu> by fact
18.1659 - have ms: "measure_space ?\<nu>" by default
18.1660 - note RN = RN_deriv[OF ms ac]
18.1661 + interpret N: finite_measure N by fact
18.1662 +
18.1663 + note RN = RN_deriv[OF ac]
18.1664
18.1665 - let ?RN = "\<lambda>t. {x \<in> space M. RN_deriv M \<nu> x = t}"
18.1666 + let ?RN = "\<lambda>t. {x \<in> space M. RN_deriv M N x = t}"
18.1667
18.1668 - show "(\<lambda>x. real (RN_deriv M \<nu> x)) \<in> borel_measurable M"
18.1669 + show "(\<lambda>x. real (RN_deriv M N x)) \<in> borel_measurable M"
18.1670 using RN by auto
18.1671
18.1672 - have "\<nu> (?RN \<infinity>) = (\<integral>\<^isup>+ x. RN_deriv M \<nu> x * indicator (?RN \<infinity>) x \<partial>M)"
18.1673 - using RN by auto
18.1674 + have "N (?RN \<infinity>) = (\<integral>\<^isup>+ x. RN_deriv M N x * indicator (?RN \<infinity>) x \<partial>M)"
18.1675 + using RN(1,3) by (subst RN(2)[symmetric]) (auto simp: emeasure_density)
18.1676 also have "\<dots> = (\<integral>\<^isup>+ x. \<infinity> * indicator (?RN \<infinity>) x \<partial>M)"
18.1677 by (intro positive_integral_cong) (auto simp: indicator_def)
18.1678 - also have "\<dots> = \<infinity> * \<mu> (?RN \<infinity>)"
18.1679 + also have "\<dots> = \<infinity> * emeasure M (?RN \<infinity>)"
18.1680 using RN by (intro positive_integral_cmult_indicator) auto
18.1681 - finally have eq: "\<nu> (?RN \<infinity>) = \<infinity> * \<mu> (?RN \<infinity>)" .
18.1682 + finally have eq: "N (?RN \<infinity>) = \<infinity> * emeasure M (?RN \<infinity>)" .
18.1683 moreover
18.1684 - have "\<mu> (?RN \<infinity>) = 0"
18.1685 + have "emeasure M (?RN \<infinity>) = 0"
18.1686 proof (rule ccontr)
18.1687 - assume "\<mu> {x \<in> space M. RN_deriv M \<nu> x = \<infinity>} \<noteq> 0"
18.1688 - moreover from RN have "0 \<le> \<mu> {x \<in> space M. RN_deriv M \<nu> x = \<infinity>}" by auto
18.1689 - ultimately have "0 < \<mu> {x \<in> space M. RN_deriv M \<nu> x = \<infinity>}" by auto
18.1690 - with eq have "\<nu> (?RN \<infinity>) = \<infinity>" by simp
18.1691 - with \<nu>.finite_measure[of "?RN \<infinity>"] RN show False by auto
18.1692 + assume "emeasure M {x \<in> space M. RN_deriv M N x = \<infinity>} \<noteq> 0"
18.1693 + moreover from RN have "0 \<le> emeasure M {x \<in> space M. RN_deriv M N x = \<infinity>}" by auto
18.1694 + ultimately have "0 < emeasure M {x \<in> space M. RN_deriv M N x = \<infinity>}" by auto
18.1695 + with eq have "N (?RN \<infinity>) = \<infinity>" by simp
18.1696 + with N.emeasure_finite[of "?RN \<infinity>"] RN show False by auto
18.1697 qed
18.1698 - ultimately have "AE x. RN_deriv M \<nu> x < \<infinity>"
18.1699 + ultimately have "AE x in M. RN_deriv M N x < \<infinity>"
18.1700 using RN by (intro AE_iff_measurable[THEN iffD2]) auto
18.1701 - then show "AE x. RN_deriv M \<nu> x = ereal (real (RN_deriv M \<nu> x))"
18.1702 + then show "AE x in M. RN_deriv M N x = ereal (real (RN_deriv M N x))"
18.1703 using RN(3) by (auto simp: ereal_real)
18.1704 - then have eq: "AE x in (M\<lparr>measure := \<nu>\<rparr>) . RN_deriv M \<nu> x = ereal (real (RN_deriv M \<nu> x))"
18.1705 - using ac absolutely_continuous_AE[OF ms] by auto
18.1706 + then have eq: "AE x in N. RN_deriv M N x = ereal (real (RN_deriv M N x))"
18.1707 + using ac absolutely_continuous_AE by auto
18.1708
18.1709 - show "\<And>x. 0 \<le> real (RN_deriv M \<nu> x)"
18.1710 + show "\<And>x. 0 \<le> real (RN_deriv M N x)"
18.1711 using RN by (auto intro: real_of_ereal_pos)
18.1712
18.1713 - have "\<nu> (?RN 0) = (\<integral>\<^isup>+ x. RN_deriv M \<nu> x * indicator (?RN 0) x \<partial>M)"
18.1714 - using RN by auto
18.1715 + have "N (?RN 0) = (\<integral>\<^isup>+ x. RN_deriv M N x * indicator (?RN 0) x \<partial>M)"
18.1716 + using RN(1,3) by (subst RN(2)[symmetric]) (auto simp: emeasure_density)
18.1717 also have "\<dots> = (\<integral>\<^isup>+ x. 0 \<partial>M)"
18.1718 by (intro positive_integral_cong) (auto simp: indicator_def)
18.1719 - finally have "AE x in (M\<lparr>measure := \<nu>\<rparr>). RN_deriv M \<nu> x \<noteq> 0"
18.1720 - using RN by (intro \<nu>.AE_iff_measurable[THEN iffD2]) auto
18.1721 - with RN(3) eq show "AE x in (M\<lparr>measure := \<nu>\<rparr>). 0 < real (RN_deriv M \<nu> x)"
18.1722 + finally have "AE x in N. RN_deriv M N x \<noteq> 0"
18.1723 + using RN by (subst AE_iff_measurable[OF _ refl]) (auto simp: ac cong: sets_eq_imp_space_eq)
18.1724 + with RN(3) eq show "AE x in N. 0 < real (RN_deriv M N x)"
18.1725 by (auto simp: zero_less_real_of_ereal le_less)
18.1726 qed
18.1727
18.1728 lemma (in sigma_finite_measure) RN_deriv_singleton:
18.1729 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)"
18.1730 - and ac: "absolutely_continuous \<nu>"
18.1731 - and "{x} \<in> sets M"
18.1732 - shows "\<nu> {x} = RN_deriv M \<nu> x * \<mu> {x}"
18.1733 + assumes ac: "absolutely_continuous M N" "sets N = sets M"
18.1734 + and x: "{x} \<in> sets M"
18.1735 + shows "N {x} = RN_deriv M N x * emeasure M {x}"
18.1736 proof -
18.1737 - note deriv = RN_deriv[OF assms(1, 2)]
18.1738 - from deriv(2)[OF `{x} \<in> sets M`]
18.1739 - have "\<nu> {x} = (\<integral>\<^isup>+w. RN_deriv M \<nu> x * indicator {x} w \<partial>M)"
18.1740 - by (auto simp: indicator_def intro!: positive_integral_cong)
18.1741 - thus ?thesis using positive_integral_cmult_indicator[OF _ `{x} \<in> sets M`] deriv(3)
18.1742 - by auto
18.1743 -qed
18.1744 -
18.1745 -theorem (in finite_measure_space) RN_deriv_finite_measure:
18.1746 - assumes "measure_space (M\<lparr>measure := \<nu>\<rparr>)"
18.1747 - and ac: "absolutely_continuous \<nu>"
18.1748 - and "x \<in> space M"
18.1749 - shows "\<nu> {x} = RN_deriv M \<nu> x * \<mu> {x}"
18.1750 -proof -
18.1751 - have "{x} \<in> sets M" using sets_eq_Pow `x \<in> space M` by auto
18.1752 - from RN_deriv_singleton[OF assms(1,2) this] show ?thesis .
18.1753 + note deriv = RN_deriv[OF ac]
18.1754 + from deriv(1,3) `{x} \<in> sets M`
18.1755 + have "density M (RN_deriv M N) {x} = (\<integral>\<^isup>+w. RN_deriv M N x * indicator {x} w \<partial>M)"
18.1756 + by (auto simp: indicator_def emeasure_density intro!: positive_integral_cong)
18.1757 + with x deriv show ?thesis
18.1758 + by (auto simp: positive_integral_cmult_indicator)
18.1759 qed
18.1760
18.1761 end
19.1 --- a/src/HOL/Probability/Sigma_Algebra.thy Mon Apr 23 12:23:23 2012 +0100
19.2 +++ b/src/HOL/Probability/Sigma_Algebra.thy Mon Apr 23 12:14:35 2012 +0200
19.3 @@ -13,6 +13,7 @@
19.4 "~~/src/HOL/Library/Countable"
19.5 "~~/src/HOL/Library/FuncSet"
19.6 "~~/src/HOL/Library/Indicator_Function"
19.7 + "~~/src/HOL/Library/Extended_Real"
19.8 begin
19.9
19.10 text {* Sigma algebras are an elementary concept in measure
19.11 @@ -25,203 +26,198 @@
19.12
19.13 subsection {* Algebras *}
19.14
19.15 -record 'a algebra =
19.16 - space :: "'a set"
19.17 - sets :: "'a set set"
19.18 +locale subset_class =
19.19 + fixes \<Omega> :: "'a set" and M :: "'a set set"
19.20 + assumes space_closed: "M \<subseteq> Pow \<Omega>"
19.21
19.22 -locale subset_class =
19.23 - fixes M :: "('a, 'b) algebra_scheme"
19.24 - assumes space_closed: "sets M \<subseteq> Pow (space M)"
19.25 -
19.26 -lemma (in subset_class) sets_into_space: "x \<in> sets M \<Longrightarrow> x \<subseteq> space M"
19.27 +lemma (in subset_class) sets_into_space: "x \<in> M \<Longrightarrow> x \<subseteq> \<Omega>"
19.28 by (metis PowD contra_subsetD space_closed)
19.29
19.30 locale ring_of_sets = subset_class +
19.31 - assumes empty_sets [iff]: "{} \<in> sets M"
19.32 - and Diff [intro]: "\<And>a b. a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a - b \<in> sets M"
19.33 - and Un [intro]: "\<And>a b. a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<union> b \<in> sets M"
19.34 + assumes empty_sets [iff]: "{} \<in> M"
19.35 + and Diff [intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a - b \<in> M"
19.36 + and Un [intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<union> b \<in> M"
19.37
19.38 lemma (in ring_of_sets) Int [intro]:
19.39 - assumes a: "a \<in> sets M" and b: "b \<in> sets M" shows "a \<inter> b \<in> sets M"
19.40 + assumes a: "a \<in> M" and b: "b \<in> M" shows "a \<inter> b \<in> M"
19.41 proof -
19.42 have "a \<inter> b = a - (a - b)"
19.43 by auto
19.44 - then show "a \<inter> b \<in> sets M"
19.45 + then show "a \<inter> b \<in> M"
19.46 using a b by auto
19.47 qed
19.48
19.49 lemma (in ring_of_sets) finite_Union [intro]:
19.50 - "finite X \<Longrightarrow> X \<subseteq> sets M \<Longrightarrow> Union X \<in> sets M"
19.51 + "finite X \<Longrightarrow> X \<subseteq> M \<Longrightarrow> Union X \<in> M"
19.52 by (induct set: finite) (auto simp add: Un)
19.53
19.54 lemma (in ring_of_sets) finite_UN[intro]:
19.55 - assumes "finite I" and "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets M"
19.56 - shows "(\<Union>i\<in>I. A i) \<in> sets M"
19.57 + assumes "finite I" and "\<And>i. i \<in> I \<Longrightarrow> A i \<in> M"
19.58 + shows "(\<Union>i\<in>I. A i) \<in> M"
19.59 using assms by induct auto
19.60
19.61 lemma (in ring_of_sets) finite_INT[intro]:
19.62 - assumes "finite I" "I \<noteq> {}" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets M"
19.63 - shows "(\<Inter>i\<in>I. A i) \<in> sets M"
19.64 + assumes "finite I" "I \<noteq> {}" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> M"
19.65 + shows "(\<Inter>i\<in>I. A i) \<in> M"
19.66 using assms by (induct rule: finite_ne_induct) auto
19.67
19.68 lemma (in ring_of_sets) insert_in_sets:
19.69 - assumes "{x} \<in> sets M" "A \<in> sets M" shows "insert x A \<in> sets M"
19.70 + assumes "{x} \<in> M" "A \<in> M" shows "insert x A \<in> M"
19.71 proof -
19.72 - have "{x} \<union> A \<in> sets M" using assms by (rule Un)
19.73 + have "{x} \<union> A \<in> M" using assms by (rule Un)
19.74 thus ?thesis by auto
19.75 qed
19.76
19.77 -lemma (in ring_of_sets) Int_space_eq1 [simp]: "x \<in> sets M \<Longrightarrow> space M \<inter> x = x"
19.78 +lemma (in ring_of_sets) Int_space_eq1 [simp]: "x \<in> M \<Longrightarrow> \<Omega> \<inter> x = x"
19.79 by (metis Int_absorb1 sets_into_space)
19.80
19.81 -lemma (in ring_of_sets) Int_space_eq2 [simp]: "x \<in> sets M \<Longrightarrow> x \<inter> space M = x"
19.82 +lemma (in ring_of_sets) Int_space_eq2 [simp]: "x \<in> M \<Longrightarrow> x \<inter> \<Omega> = x"
19.83 by (metis Int_absorb2 sets_into_space)
19.84
19.85 lemma (in ring_of_sets) sets_Collect_conj:
19.86 - assumes "{x\<in>space M. P x} \<in> sets M" "{x\<in>space M. Q x} \<in> sets M"
19.87 - shows "{x\<in>space M. Q x \<and> P x} \<in> sets M"
19.88 + assumes "{x\<in>\<Omega>. P x} \<in> M" "{x\<in>\<Omega>. Q x} \<in> M"
19.89 + shows "{x\<in>\<Omega>. Q x \<and> P x} \<in> M"
19.90 proof -
19.91 - have "{x\<in>space M. Q x \<and> P x} = {x\<in>space M. Q x} \<inter> {x\<in>space M. P x}"
19.92 + have "{x\<in>\<Omega>. Q x \<and> P x} = {x\<in>\<Omega>. Q x} \<inter> {x\<in>\<Omega>. P x}"
19.93 by auto
19.94 with assms show ?thesis by auto
19.95 qed
19.96
19.97 lemma (in ring_of_sets) sets_Collect_disj:
19.98 - assumes "{x\<in>space M. P x} \<in> sets M" "{x\<in>space M. Q x} \<in> sets M"
19.99 - shows "{x\<in>space M. Q x \<or> P x} \<in> sets M"
19.100 + assumes "{x\<in>\<Omega>. P x} \<in> M" "{x\<in>\<Omega>. Q x} \<in> M"
19.101 + shows "{x\<in>\<Omega>. Q x \<or> P x} \<in> M"
19.102 proof -
19.103 - have "{x\<in>space M. Q x \<or> P x} = {x\<in>space M. Q x} \<union> {x\<in>space M. P x}"
19.104 + have "{x\<in>\<Omega>. Q x \<or> P x} = {x\<in>\<Omega>. Q x} \<union> {x\<in>\<Omega>. P x}"
19.105 by auto
19.106 with assms show ?thesis by auto
19.107 qed
19.108
19.109 lemma (in ring_of_sets) sets_Collect_finite_All:
19.110 - assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>space M. P i x} \<in> sets M" "finite S" "S \<noteq> {}"
19.111 - shows "{x\<in>space M. \<forall>i\<in>S. P i x} \<in> sets M"
19.112 + assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S" "S \<noteq> {}"
19.113 + shows "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} \<in> M"
19.114 proof -
19.115 - have "{x\<in>space M. \<forall>i\<in>S. P i x} = (\<Inter>i\<in>S. {x\<in>space M. P i x})"
19.116 + have "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} = (\<Inter>i\<in>S. {x\<in>\<Omega>. P i x})"
19.117 using `S \<noteq> {}` by auto
19.118 with assms show ?thesis by auto
19.119 qed
19.120
19.121 lemma (in ring_of_sets) sets_Collect_finite_Ex:
19.122 - assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>space M. P i x} \<in> sets M" "finite S"
19.123 - shows "{x\<in>space M. \<exists>i\<in>S. P i x} \<in> sets M"
19.124 + assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S"
19.125 + shows "{x\<in>\<Omega>. \<exists>i\<in>S. P i x} \<in> M"
19.126 proof -
19.127 - have "{x\<in>space M. \<exists>i\<in>S. P i x} = (\<Union>i\<in>S. {x\<in>space M. P i x})"
19.128 + have "{x\<in>\<Omega>. \<exists>i\<in>S. P i x} = (\<Union>i\<in>S. {x\<in>\<Omega>. P i x})"
19.129 by auto
19.130 with assms show ?thesis by auto
19.131 qed
19.132
19.133 locale algebra = ring_of_sets +
19.134 - assumes top [iff]: "space M \<in> sets M"
19.135 + assumes top [iff]: "\<Omega> \<in> M"
19.136
19.137 lemma (in algebra) compl_sets [intro]:
19.138 - "a \<in> sets M \<Longrightarrow> space M - a \<in> sets M"
19.139 + "a \<in> M \<Longrightarrow> \<Omega> - a \<in> M"
19.140 by auto
19.141
19.142 lemma algebra_iff_Un:
19.143 - "algebra M \<longleftrightarrow>
19.144 - sets M \<subseteq> Pow (space M) &
19.145 - {} \<in> sets M &
19.146 - (\<forall>a \<in> sets M. space M - a \<in> sets M) &
19.147 - (\<forall>a \<in> sets M. \<forall> b \<in> sets M. a \<union> b \<in> sets M)" (is "_ \<longleftrightarrow> ?Un")
19.148 + "algebra \<Omega> M \<longleftrightarrow>
19.149 + M \<subseteq> Pow \<Omega> \<and>
19.150 + {} \<in> M \<and>
19.151 + (\<forall>a \<in> M. \<Omega> - a \<in> M) \<and>
19.152 + (\<forall>a \<in> M. \<forall> b \<in> M. a \<union> b \<in> M)" (is "_ \<longleftrightarrow> ?Un")
19.153 proof
19.154 - assume "algebra M"
19.155 - then interpret algebra M .
19.156 + assume "algebra \<Omega> M"
19.157 + then interpret algebra \<Omega> M .
19.158 show ?Un using sets_into_space by auto
19.159 next
19.160 assume ?Un
19.161 - show "algebra M"
19.162 + show "algebra \<Omega> M"
19.163 proof
19.164 - show space: "sets M \<subseteq> Pow (space M)" "{} \<in> sets M" "space M \<in> sets M"
19.165 + show \<Omega>: "M \<subseteq> Pow \<Omega>" "{} \<in> M" "\<Omega> \<in> M"
19.166 using `?Un` by auto
19.167 - fix a b assume a: "a \<in> sets M" and b: "b \<in> sets M"
19.168 - then show "a \<union> b \<in> sets M" using `?Un` by auto
19.169 - have "a - b = space M - ((space M - a) \<union> b)"
19.170 - using space a b by auto
19.171 - then show "a - b \<in> sets M"
19.172 + fix a b assume a: "a \<in> M" and b: "b \<in> M"
19.173 + then show "a \<union> b \<in> M" using `?Un` by auto
19.174 + have "a - b = \<Omega> - ((\<Omega> - a) \<union> b)"
19.175 + using \<Omega> a b by auto
19.176 + then show "a - b \<in> M"
19.177 using a b `?Un` by auto
19.178 qed
19.179 qed
19.180
19.181 lemma algebra_iff_Int:
19.182 - "algebra M \<longleftrightarrow>
19.183 - sets M \<subseteq> Pow (space M) & {} \<in> sets M &
19.184 - (\<forall>a \<in> sets M. space M - a \<in> sets M) &
19.185 - (\<forall>a \<in> sets M. \<forall> b \<in> sets M. a \<inter> b \<in> sets M)" (is "_ \<longleftrightarrow> ?Int")
19.186 + "algebra \<Omega> M \<longleftrightarrow>
19.187 + M \<subseteq> Pow \<Omega> & {} \<in> M &
19.188 + (\<forall>a \<in> M. \<Omega> - a \<in> M) &
19.189 + (\<forall>a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)" (is "_ \<longleftrightarrow> ?Int")
19.190 proof
19.191 - assume "algebra M"
19.192 - then interpret algebra M .
19.193 + assume "algebra \<Omega> M"
19.194 + then interpret algebra \<Omega> M .
19.195 show ?Int using sets_into_space by auto
19.196 next
19.197 assume ?Int
19.198 - show "algebra M"
19.199 + show "algebra \<Omega> M"
19.200 proof (unfold algebra_iff_Un, intro conjI ballI)
19.201 - show space: "sets M \<subseteq> Pow (space M)" "{} \<in> sets M"
19.202 + show \<Omega>: "M \<subseteq> Pow \<Omega>" "{} \<in> M"
19.203 using `?Int` by auto
19.204 - from `?Int` show "\<And>a. a \<in> sets M \<Longrightarrow> space M - a \<in> sets M" by auto
19.205 - fix a b assume sets: "a \<in> sets M" "b \<in> sets M"
19.206 - hence "a \<union> b = space M - ((space M - a) \<inter> (space M - b))"
19.207 - using space by blast
19.208 - also have "... \<in> sets M"
19.209 - using sets `?Int` by auto
19.210 - finally show "a \<union> b \<in> sets M" .
19.211 + from `?Int` show "\<And>a. a \<in> M \<Longrightarrow> \<Omega> - a \<in> M" by auto
19.212 + fix a b assume M: "a \<in> M" "b \<in> M"
19.213 + hence "a \<union> b = \<Omega> - ((\<Omega> - a) \<inter> (\<Omega> - b))"
19.214 + using \<Omega> by blast
19.215 + also have "... \<in> M"
19.216 + using M `?Int` by auto
19.217 + finally show "a \<union> b \<in> M" .
19.218 qed
19.219 qed
19.220
19.221 lemma (in algebra) sets_Collect_neg:
19.222 - assumes "{x\<in>space M. P x} \<in> sets M"
19.223 - shows "{x\<in>space M. \<not> P x} \<in> sets M"
19.224 + assumes "{x\<in>\<Omega>. P x} \<in> M"
19.225 + shows "{x\<in>\<Omega>. \<not> P x} \<in> M"
19.226 proof -
19.227 - have "{x\<in>space M. \<not> P x} = space M - {x\<in>space M. P x}" by auto
19.228 + have "{x\<in>\<Omega>. \<not> P x} = \<Omega> - {x\<in>\<Omega>. P x}" by auto
19.229 with assms show ?thesis by auto
19.230 qed
19.231
19.232 lemma (in algebra) sets_Collect_imp:
19.233 - "{x\<in>space M. P x} \<in> sets M \<Longrightarrow> {x\<in>space M. Q x} \<in> sets M \<Longrightarrow> {x\<in>space M. Q x \<longrightarrow> P x} \<in> sets M"
19.234 + "{x\<in>\<Omega>. P x} \<in> M \<Longrightarrow> {x\<in>\<Omega>. Q x} \<in> M \<Longrightarrow> {x\<in>\<Omega>. Q x \<longrightarrow> P x} \<in> M"
19.235 unfolding imp_conv_disj by (intro sets_Collect_disj sets_Collect_neg)
19.236
19.237 lemma (in algebra) sets_Collect_const:
19.238 - "{x\<in>space M. P} \<in> sets M"
19.239 + "{x\<in>\<Omega>. P} \<in> M"
19.240 by (cases P) auto
19.241
19.242 lemma algebra_single_set:
19.243 assumes "X \<subseteq> S"
19.244 - shows "algebra \<lparr> space = S, sets = { {}, X, S - X, S }\<rparr>"
19.245 + shows "algebra S { {}, X, S - X, S }"
19.246 by default (insert `X \<subseteq> S`, auto)
19.247
19.248 section {* Restricted algebras *}
19.249
19.250 abbreviation (in algebra)
19.251 - "restricted_space A \<equiv> \<lparr> space = A, sets = (\<lambda>S. (A \<inter> S)) ` sets M, \<dots> = more M \<rparr>"
19.252 + "restricted_space A \<equiv> (op \<inter> A) ` M"
19.253
19.254 lemma (in algebra) restricted_algebra:
19.255 - assumes "A \<in> sets M" shows "algebra (restricted_space A)"
19.256 + assumes "A \<in> M" shows "algebra A (restricted_space A)"
19.257 using assms by unfold_locales auto
19.258
19.259 subsection {* Sigma Algebras *}
19.260
19.261 locale sigma_algebra = algebra +
19.262 - assumes countable_nat_UN [intro]:
19.263 - "!!A. range A \<subseteq> sets M \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
19.264 + assumes countable_nat_UN [intro]: "\<And>A. range A \<subseteq> M \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
19.265
19.266 lemma (in algebra) is_sigma_algebra:
19.267 - assumes "finite (sets M)"
19.268 - shows "sigma_algebra M"
19.269 + assumes "finite M"
19.270 + shows "sigma_algebra \<Omega> M"
19.271 proof
19.272 - fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M"
19.273 - then have "(\<Union>i. A i) = (\<Union>s\<in>sets M \<inter> range A. s)"
19.274 + fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> M"
19.275 + then have "(\<Union>i. A i) = (\<Union>s\<in>M \<inter> range A. s)"
19.276 by auto
19.277 - also have "(\<Union>s\<in>sets M \<inter> range A. s) \<in> sets M"
19.278 - using `finite (sets M)` by auto
19.279 - finally show "(\<Union>i. A i) \<in> sets M" .
19.280 + also have "(\<Union>s\<in>M \<inter> range A. s) \<in> M"
19.281 + using `finite M` by auto
19.282 + finally show "(\<Union>i. A i) \<in> M" .
19.283 qed
19.284
19.285 lemma countable_UN_eq:
19.286 fixes A :: "'i::countable \<Rightarrow> 'a set"
19.287 - shows "(range A \<subseteq> sets M \<longrightarrow> (\<Union>i. A i) \<in> sets M) \<longleftrightarrow>
19.288 - (range (A \<circ> from_nat) \<subseteq> sets M \<longrightarrow> (\<Union>i. (A \<circ> from_nat) i) \<in> sets M)"
19.289 + shows "(range A \<subseteq> M \<longrightarrow> (\<Union>i. A i) \<in> M) \<longleftrightarrow>
19.290 + (range (A \<circ> from_nat) \<subseteq> M \<longrightarrow> (\<Union>i. (A \<circ> from_nat) i) \<in> M)"
19.291 proof -
19.292 let ?A' = "A \<circ> from_nat"
19.293 have *: "(\<Union>i. ?A' i) = (\<Union>i. A i)" (is "?l = ?r")
19.294 @@ -240,60 +236,57 @@
19.295
19.296 lemma (in sigma_algebra) countable_UN[intro]:
19.297 fixes A :: "'i::countable \<Rightarrow> 'a set"
19.298 - assumes "A`X \<subseteq> sets M"
19.299 - shows "(\<Union>x\<in>X. A x) \<in> sets M"
19.300 + assumes "A`X \<subseteq> M"
19.301 + shows "(\<Union>x\<in>X. A x) \<in> M"
19.302 proof -
19.303 let ?A = "\<lambda>i. if i \<in> X then A i else {}"
19.304 - from assms have "range ?A \<subseteq> sets M" by auto
19.305 + from assms have "range ?A \<subseteq> M" by auto
19.306 with countable_nat_UN[of "?A \<circ> from_nat"] countable_UN_eq[of ?A M]
19.307 - have "(\<Union>x. ?A x) \<in> sets M" by auto
19.308 + have "(\<Union>x. ?A x) \<in> M" by auto
19.309 moreover have "(\<Union>x. ?A x) = (\<Union>x\<in>X. A x)" by (auto split: split_if_asm)
19.310 ultimately show ?thesis by simp
19.311 qed
19.312
19.313 lemma (in sigma_algebra) countable_INT [intro]:
19.314 fixes A :: "'i::countable \<Rightarrow> 'a set"
19.315 - assumes A: "A`X \<subseteq> sets M" "X \<noteq> {}"
19.316 - shows "(\<Inter>i\<in>X. A i) \<in> sets M"
19.317 + assumes A: "A`X \<subseteq> M" "X \<noteq> {}"
19.318 + shows "(\<Inter>i\<in>X. A i) \<in> M"
19.319 proof -
19.320 - from A have "\<forall>i\<in>X. A i \<in> sets M" by fast
19.321 - hence "space M - (\<Union>i\<in>X. space M - A i) \<in> sets M" by blast
19.322 + from A have "\<forall>i\<in>X. A i \<in> M" by fast
19.323 + hence "\<Omega> - (\<Union>i\<in>X. \<Omega> - A i) \<in> M" by blast
19.324 moreover
19.325 - have "(\<Inter>i\<in>X. A i) = space M - (\<Union>i\<in>X. space M - A i)" using space_closed A
19.326 + have "(\<Inter>i\<in>X. A i) = \<Omega> - (\<Union>i\<in>X. \<Omega> - A i)" using space_closed A
19.327 by blast
19.328 ultimately show ?thesis by metis
19.329 qed
19.330
19.331 -lemma ring_of_sets_Pow:
19.332 - "ring_of_sets \<lparr> space = sp, sets = Pow sp, \<dots> = X \<rparr>"
19.333 +lemma ring_of_sets_Pow: "ring_of_sets sp (Pow sp)"
19.334 by default auto
19.335
19.336 -lemma algebra_Pow:
19.337 - "algebra \<lparr> space = sp, sets = Pow sp, \<dots> = X \<rparr>"
19.338 +lemma algebra_Pow: "algebra sp (Pow sp)"
19.339 by default auto
19.340
19.341 -lemma sigma_algebra_Pow:
19.342 - "sigma_algebra \<lparr> space = sp, sets = Pow sp, \<dots> = X \<rparr>"
19.343 +lemma sigma_algebra_Pow: "sigma_algebra sp (Pow sp)"
19.344 by default auto
19.345
19.346 lemma sigma_algebra_iff:
19.347 - "sigma_algebra M \<longleftrightarrow>
19.348 - algebra M \<and> (\<forall>A. range A \<subseteq> sets M \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M)"
19.349 + "sigma_algebra \<Omega> M \<longleftrightarrow>
19.350 + algebra \<Omega> M \<and> (\<forall>A. range A \<subseteq> M \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
19.351 by (simp add: sigma_algebra_def sigma_algebra_axioms_def)
19.352
19.353 lemma (in sigma_algebra) sets_Collect_countable_All:
19.354 - assumes "\<And>i. {x\<in>space M. P i x} \<in> sets M"
19.355 - shows "{x\<in>space M. \<forall>i::'i::countable. P i x} \<in> sets M"
19.356 + assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
19.357 + shows "{x\<in>\<Omega>. \<forall>i::'i::countable. P i x} \<in> M"
19.358 proof -
19.359 - have "{x\<in>space M. \<forall>i::'i::countable. P i x} = (\<Inter>i. {x\<in>space M. P i x})" by auto
19.360 + have "{x\<in>\<Omega>. \<forall>i::'i::countable. P i x} = (\<Inter>i. {x\<in>\<Omega>. P i x})" by auto
19.361 with assms show ?thesis by auto
19.362 qed
19.363
19.364 lemma (in sigma_algebra) sets_Collect_countable_Ex:
19.365 - assumes "\<And>i. {x\<in>space M. P i x} \<in> sets M"
19.366 - shows "{x\<in>space M. \<exists>i::'i::countable. P i x} \<in> sets M"
19.367 + assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
19.368 + shows "{x\<in>\<Omega>. \<exists>i::'i::countable. P i x} \<in> M"
19.369 proof -
19.370 - have "{x\<in>space M. \<exists>i::'i::countable. P i x} = (\<Union>i. {x\<in>space M. P i x})" by auto
19.371 + have "{x\<in>\<Omega>. \<exists>i::'i::countable. P i x} = (\<Union>i. {x\<in>\<Omega>. P i x})" by auto
19.372 with assms show ?thesis by auto
19.373 qed
19.374
19.375 @@ -301,9 +294,19 @@
19.376 sets_Collect_imp sets_Collect_disj sets_Collect_conj sets_Collect_neg sets_Collect_const
19.377 sets_Collect_countable_All sets_Collect_countable_Ex sets_Collect_countable_All
19.378
19.379 +lemma (in sigma_algebra) sets_Collect_countable_Ball:
19.380 + assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
19.381 + shows "{x\<in>\<Omega>. \<forall>i::'i::countable\<in>X. P i x} \<in> M"
19.382 + unfolding Ball_def by (intro sets_Collect assms)
19.383 +
19.384 +lemma (in sigma_algebra) sets_Collect_countable_Bex:
19.385 + assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
19.386 + shows "{x\<in>\<Omega>. \<exists>i::'i::countable\<in>X. P i x} \<in> M"
19.387 + unfolding Bex_def by (intro sets_Collect assms)
19.388 +
19.389 lemma sigma_algebra_single_set:
19.390 assumes "X \<subseteq> S"
19.391 - shows "sigma_algebra \<lparr> space = S, sets = { {}, X, S - X, S }\<rparr>"
19.392 + shows "sigma_algebra S { {}, X, S - X, S }"
19.393 using algebra.is_sigma_algebra[OF algebra_single_set[OF `X \<subseteq> S`]] by simp
19.394
19.395 subsection {* Binary Unions *}
19.396 @@ -321,37 +324,34 @@
19.397 by (simp add: INF_def range_binary_eq)
19.398
19.399 lemma sigma_algebra_iff2:
19.400 - "sigma_algebra M \<longleftrightarrow>
19.401 - sets M \<subseteq> Pow (space M) \<and>
19.402 - {} \<in> sets M \<and> (\<forall>s \<in> sets M. space M - s \<in> sets M) \<and>
19.403 - (\<forall>A. range A \<subseteq> sets M \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M)"
19.404 + "sigma_algebra \<Omega> M \<longleftrightarrow>
19.405 + M \<subseteq> Pow \<Omega> \<and>
19.406 + {} \<in> M \<and> (\<forall>s \<in> M. \<Omega> - s \<in> M) \<and>
19.407 + (\<forall>A. range A \<subseteq> M \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
19.408 by (auto simp add: range_binary_eq sigma_algebra_def sigma_algebra_axioms_def
19.409 algebra_iff_Un Un_range_binary)
19.410
19.411 subsection {* Initial Sigma Algebra *}
19.412
19.413 text {*Sigma algebras can naturally be created as the closure of any set of
19.414 - sets with regard to the properties just postulated. *}
19.415 + M with regard to the properties just postulated. *}
19.416
19.417 inductive_set
19.418 sigma_sets :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set"
19.419 for sp :: "'a set" and A :: "'a set set"
19.420 where
19.421 - Basic: "a \<in> A \<Longrightarrow> a \<in> sigma_sets sp A"
19.422 + Basic[intro, simp]: "a \<in> A \<Longrightarrow> a \<in> sigma_sets sp A"
19.423 | Empty: "{} \<in> sigma_sets sp A"
19.424 | Compl: "a \<in> sigma_sets sp A \<Longrightarrow> sp - a \<in> sigma_sets sp A"
19.425 | Union: "(\<And>i::nat. a i \<in> sigma_sets sp A) \<Longrightarrow> (\<Union>i. a i) \<in> sigma_sets sp A"
19.426
19.427 -definition
19.428 - "sigma M = \<lparr> space = space M, sets = sigma_sets (space M) (sets M), \<dots> = more M \<rparr>"
19.429 -
19.430 lemma (in sigma_algebra) sigma_sets_subset:
19.431 - assumes a: "a \<subseteq> sets M"
19.432 - shows "sigma_sets (space M) a \<subseteq> sets M"
19.433 + assumes a: "a \<subseteq> M"
19.434 + shows "sigma_sets \<Omega> a \<subseteq> M"
19.435 proof
19.436 fix x
19.437 - assume "x \<in> sigma_sets (space M) a"
19.438 - from this show "x \<in> sets M"
19.439 + assume "x \<in> sigma_sets \<Omega> a"
19.440 + from this show "x \<in> M"
19.441 by (induct rule: sigma_sets.induct, auto) (metis a subsetD)
19.442 qed
19.443
19.444 @@ -359,35 +359,28 @@
19.445 by (erule sigma_sets.induct, auto)
19.446
19.447 lemma sigma_algebra_sigma_sets:
19.448 - "a \<subseteq> Pow (space M) \<Longrightarrow> sets M = sigma_sets (space M) a \<Longrightarrow> sigma_algebra M"
19.449 + "a \<subseteq> Pow \<Omega> \<Longrightarrow> sigma_algebra \<Omega> (sigma_sets \<Omega> a)"
19.450 by (auto simp add: sigma_algebra_iff2 dest: sigma_sets_into_sp
19.451 intro!: sigma_sets.Union sigma_sets.Empty sigma_sets.Compl)
19.452
19.453 lemma sigma_sets_least_sigma_algebra:
19.454 assumes "A \<subseteq> Pow S"
19.455 - shows "sigma_sets S A = \<Inter>{B. A \<subseteq> B \<and> sigma_algebra \<lparr>space = S, sets = B\<rparr>}"
19.456 + shows "sigma_sets S A = \<Inter>{B. A \<subseteq> B \<and> sigma_algebra S B}"
19.457 proof safe
19.458 - fix B X assume "A \<subseteq> B" and sa: "sigma_algebra \<lparr> space = S, sets = B \<rparr>"
19.459 + fix B X assume "A \<subseteq> B" and sa: "sigma_algebra S B"
19.460 and X: "X \<in> sigma_sets S A"
19.461 from sigma_algebra.sigma_sets_subset[OF sa, simplified, OF `A \<subseteq> B`] X
19.462 show "X \<in> B" by auto
19.463 next
19.464 - fix X assume "X \<in> \<Inter>{B. A \<subseteq> B \<and> sigma_algebra \<lparr>space = S, sets = B\<rparr>}"
19.465 - then have [intro!]: "\<And>B. A \<subseteq> B \<Longrightarrow> sigma_algebra \<lparr>space = S, sets = B\<rparr> \<Longrightarrow> X \<in> B"
19.466 + fix X assume "X \<in> \<Inter>{B. A \<subseteq> B \<and> sigma_algebra S B}"
19.467 + then have [intro!]: "\<And>B. A \<subseteq> B \<Longrightarrow> sigma_algebra S B \<Longrightarrow> X \<in> B"
19.468 by simp
19.469 - have "A \<subseteq> sigma_sets S A" using assms
19.470 - by (auto intro!: sigma_sets.Basic)
19.471 - moreover have "sigma_algebra \<lparr>space = S, sets = sigma_sets S A\<rparr>"
19.472 + have "A \<subseteq> sigma_sets S A" using assms by auto
19.473 + moreover have "sigma_algebra S (sigma_sets S A)"
19.474 using assms by (intro sigma_algebra_sigma_sets[of A]) auto
19.475 ultimately show "X \<in> sigma_sets S A" by auto
19.476 qed
19.477
19.478 -lemma sets_sigma: "sets (sigma M) = sigma_sets (space M) (sets M)"
19.479 - unfolding sigma_def by simp
19.480 -
19.481 -lemma space_sigma [simp]: "space (sigma M) = space M"
19.482 - by (simp add: sigma_def)
19.483 -
19.484 lemma sigma_sets_top: "sp \<in> sigma_sets sp A"
19.485 by (metis Diff_empty sigma_sets.Compl sigma_sets.Empty)
19.486
19.487 @@ -421,7 +414,7 @@
19.488 shows "(\<Inter>i\<in>S. a i) \<in> sigma_sets sp A"
19.489 proof -
19.490 from ai have "\<And>i. (if i\<in>S then a i else sp) \<in> sigma_sets sp A"
19.491 - by (simp add: sigma_sets.intros sigma_sets_top)
19.492 + by (simp add: sigma_sets.intros(2-) sigma_sets_top)
19.493 hence "(\<Inter>i. (if i\<in>S then a i else sp)) \<in> sigma_sets sp A"
19.494 by (rule sigma_sets_Inter [OF Asb])
19.495 also have "(\<Inter>i. (if i\<in>S then a i else sp)) = (\<Inter>i\<in>S. a i)"
19.496 @@ -430,12 +423,12 @@
19.497 qed
19.498
19.499 lemma (in sigma_algebra) sigma_sets_eq:
19.500 - "sigma_sets (space M) (sets M) = sets M"
19.501 + "sigma_sets \<Omega> M = M"
19.502 proof
19.503 - show "sets M \<subseteq> sigma_sets (space M) (sets M)"
19.504 + show "M \<subseteq> sigma_sets \<Omega> M"
19.505 by (metis Set.subsetI sigma_sets.Basic)
19.506 next
19.507 - show "sigma_sets (space M) (sets M) \<subseteq> sets M"
19.508 + show "sigma_sets \<Omega> M \<subseteq> M"
19.509 by (metis sigma_sets_subset subset_refl)
19.510 qed
19.511
19.512 @@ -446,52 +439,42 @@
19.513 proof (intro set_eqI iffI)
19.514 fix a assume "a \<in> sigma_sets M A"
19.515 from this A show "a \<in> sigma_sets M B"
19.516 - by induct (auto intro!: sigma_sets.intros del: sigma_sets.Basic)
19.517 + by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic)
19.518 next
19.519 fix b assume "b \<in> sigma_sets M B"
19.520 from this B show "b \<in> sigma_sets M A"
19.521 - by induct (auto intro!: sigma_sets.intros del: sigma_sets.Basic)
19.522 + by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic)
19.523 qed
19.524
19.525 -lemma sigma_algebra_sigma:
19.526 - "sets M \<subseteq> Pow (space M) \<Longrightarrow> sigma_algebra (sigma M)"
19.527 - apply (rule sigma_algebra_sigma_sets)
19.528 - apply (auto simp add: sigma_def)
19.529 - done
19.530 -
19.531 -lemma (in sigma_algebra) sigma_subset:
19.532 - "sets N \<subseteq> sets M \<Longrightarrow> space N = space M \<Longrightarrow> sets (sigma N) \<subseteq> (sets M)"
19.533 - by (simp add: sigma_def sigma_sets_subset)
19.534 -
19.535 lemma sigma_sets_subseteq: assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
19.536 proof
19.537 fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
19.538 - by induct (insert `A \<subseteq> B`, auto intro: sigma_sets.intros)
19.539 + by induct (insert `A \<subseteq> B`, auto intro: sigma_sets.intros(2-))
19.540 qed
19.541
19.542 lemma (in sigma_algebra) restriction_in_sets:
19.543 fixes A :: "nat \<Rightarrow> 'a set"
19.544 - assumes "S \<in> sets M"
19.545 - and *: "range A \<subseteq> (\<lambda>A. S \<inter> A) ` sets M" (is "_ \<subseteq> ?r")
19.546 - shows "range A \<subseteq> sets M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` sets M"
19.547 + assumes "S \<in> M"
19.548 + and *: "range A \<subseteq> (\<lambda>A. S \<inter> A) ` M" (is "_ \<subseteq> ?r")
19.549 + shows "range A \<subseteq> M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` M"
19.550 proof -
19.551 { fix i have "A i \<in> ?r" using * by auto
19.552 - hence "\<exists>B. A i = B \<inter> S \<and> B \<in> sets M" by auto
19.553 - hence "A i \<subseteq> S" "A i \<in> sets M" using `S \<in> sets M` by auto }
19.554 - thus "range A \<subseteq> sets M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` sets M"
19.555 + hence "\<exists>B. A i = B \<inter> S \<and> B \<in> M" by auto
19.556 + hence "A i \<subseteq> S" "A i \<in> M" using `S \<in> M` by auto }
19.557 + thus "range A \<subseteq> M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` M"
19.558 by (auto intro!: image_eqI[of _ _ "(\<Union>i. A i)"])
19.559 qed
19.560
19.561 lemma (in sigma_algebra) restricted_sigma_algebra:
19.562 - assumes "S \<in> sets M"
19.563 - shows "sigma_algebra (restricted_space S)"
19.564 + assumes "S \<in> M"
19.565 + shows "sigma_algebra S (restricted_space S)"
19.566 unfolding sigma_algebra_def sigma_algebra_axioms_def
19.567 proof safe
19.568 - show "algebra (restricted_space S)" using restricted_algebra[OF assms] .
19.569 + show "algebra S (restricted_space S)" using restricted_algebra[OF assms] .
19.570 next
19.571 - fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets (restricted_space S)"
19.572 + fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> restricted_space S"
19.573 from restriction_in_sets[OF assms this[simplified]]
19.574 - show "(\<Union>i. A i) \<in> sets (restricted_space S)" by simp
19.575 + show "(\<Union>i. A i) \<in> restricted_space S" by simp
19.576 qed
19.577
19.578 lemma sigma_sets_Int:
19.579 @@ -510,7 +493,7 @@
19.580 then show ?case
19.581 by (auto intro!: sigma_sets.Union
19.582 simp add: UN_extend_simps simp del: UN_simps)
19.583 - qed (auto intro!: sigma_sets.intros)
19.584 + qed (auto intro!: sigma_sets.intros(2-))
19.585 then show "x \<in> sigma_sets A (op \<inter> A ` st)"
19.586 using `A \<subseteq> sp` by (simp add: Int_absorb2)
19.587 next
19.588 @@ -529,93 +512,75 @@
19.589 then show ?case
19.590 by (auto intro!: bexI[of _ "(\<Union>x. f x)"] sigma_sets.Union
19.591 simp add: image_iff)
19.592 - qed (auto intro!: sigma_sets.intros)
19.593 + qed (auto intro!: sigma_sets.intros(2-))
19.594 qed
19.595
19.596 -lemma sigma_sets_single[simp]: "sigma_sets {X} {{X}} = {{}, {X}}"
19.597 +lemma sigma_sets_empty_eq: "sigma_sets A {} = {{}, A}"
19.598 proof (intro set_eqI iffI)
19.599 - fix x assume "x \<in> sigma_sets {X} {{X}}"
19.600 - from sigma_sets_into_sp[OF _ this]
19.601 - show "x \<in> {{}, {X}}" by auto
19.602 + fix a assume "a \<in> sigma_sets A {}" then show "a \<in> {{}, A}"
19.603 + by induct blast+
19.604 +qed (auto intro: sigma_sets.Empty sigma_sets_top)
19.605 +
19.606 +lemma sigma_sets_single[simp]: "sigma_sets A {A} = {{}, A}"
19.607 +proof (intro set_eqI iffI)
19.608 + fix x assume "x \<in> sigma_sets A {A}"
19.609 + then show "x \<in> {{}, A}"
19.610 + by induct blast+
19.611 next
19.612 - fix x assume "x \<in> {{}, {X}}"
19.613 - then show "x \<in> sigma_sets {X} {{X}}"
19.614 + fix x assume "x \<in> {{}, A}"
19.615 + then show "x \<in> sigma_sets A {A}"
19.616 by (auto intro: sigma_sets.Empty sigma_sets_top)
19.617 qed
19.618
19.619 -lemma (in sigma_algebra) sets_sigma_subset:
19.620 - assumes "space N = space M"
19.621 - assumes "sets N \<subseteq> sets M"
19.622 - shows "sets (sigma N) \<subseteq> sets M"
19.623 - by (unfold assms sets_sigma, rule sigma_sets_subset, rule assms)
19.624 -
19.625 -lemma in_sigma[intro, simp]: "A \<in> sets M \<Longrightarrow> A \<in> sets (sigma M)"
19.626 - unfolding sigma_def by (auto intro!: sigma_sets.Basic)
19.627 -
19.628 -lemma (in sigma_algebra) sigma_eq[simp]: "sigma M = M"
19.629 - unfolding sigma_def sigma_sets_eq by simp
19.630 -
19.631 -lemma sigma_sigma_eq:
19.632 - assumes "sets M \<subseteq> Pow (space M)"
19.633 - shows "sigma (sigma M) = sigma M"
19.634 - using sigma_algebra.sigma_eq[OF sigma_algebra_sigma, OF assms] .
19.635 -
19.636 lemma sigma_sets_sigma_sets_eq:
19.637 "M \<subseteq> Pow S \<Longrightarrow> sigma_sets S (sigma_sets S M) = sigma_sets S M"
19.638 - using sigma_sigma_eq[of "\<lparr> space = S, sets = M \<rparr>"]
19.639 - by (simp add: sigma_def)
19.640 + by (rule sigma_algebra.sigma_sets_eq[OF sigma_algebra_sigma_sets, of M S]) auto
19.641
19.642 lemma sigma_sets_singleton:
19.643 assumes "X \<subseteq> S"
19.644 shows "sigma_sets S { X } = { {}, X, S - X, S }"
19.645 proof -
19.646 - interpret sigma_algebra "\<lparr> space = S, sets = { {}, X, S - X, S }\<rparr>"
19.647 + interpret sigma_algebra S "{ {}, X, S - X, S }"
19.648 by (rule sigma_algebra_single_set) fact
19.649 have "sigma_sets S { X } \<subseteq> sigma_sets S { {}, X, S - X, S }"
19.650 by (rule sigma_sets_subseteq) simp
19.651 moreover have "\<dots> = { {}, X, S - X, S }"
19.652 - using sigma_eq unfolding sigma_def by simp
19.653 + using sigma_sets_eq by simp
19.654 moreover
19.655 { fix A assume "A \<in> { {}, X, S - X, S }"
19.656 then have "A \<in> sigma_sets S { X }"
19.657 - by (auto intro: sigma_sets.intros sigma_sets_top) }
19.658 + by (auto intro: sigma_sets.intros(2-) sigma_sets_top) }
19.659 ultimately have "sigma_sets S { X } = sigma_sets S { {}, X, S - X, S }"
19.660 by (intro antisym) auto
19.661 - with sigma_eq show ?thesis
19.662 - unfolding sigma_def by simp
19.663 + with sigma_sets_eq show ?thesis by simp
19.664 qed
19.665
19.666 lemma restricted_sigma:
19.667 - assumes S: "S \<in> sets (sigma M)" and M: "sets M \<subseteq> Pow (space M)"
19.668 - shows "algebra.restricted_space (sigma M) S = sigma (algebra.restricted_space M S)"
19.669 + assumes S: "S \<in> sigma_sets \<Omega> M" and M: "M \<subseteq> Pow \<Omega>"
19.670 + shows "algebra.restricted_space (sigma_sets \<Omega> M) S =
19.671 + sigma_sets S (algebra.restricted_space M S)"
19.672 proof -
19.673 from S sigma_sets_into_sp[OF M]
19.674 - have "S \<in> sigma_sets (space M) (sets M)" "S \<subseteq> space M"
19.675 - by (auto simp: sigma_def)
19.676 + have "S \<in> sigma_sets \<Omega> M" "S \<subseteq> \<Omega>" by auto
19.677 from sigma_sets_Int[OF this]
19.678 - show ?thesis
19.679 - by (simp add: sigma_def)
19.680 + show ?thesis by simp
19.681 qed
19.682
19.683 lemma sigma_sets_vimage_commute:
19.684 - assumes X: "X \<in> space M \<rightarrow> space M'"
19.685 - shows "{X -` A \<inter> space M |A. A \<in> sets (sigma M')}
19.686 - = sigma_sets (space M) {X -` A \<inter> space M |A. A \<in> sets M'}" (is "?L = ?R")
19.687 + assumes X: "X \<in> \<Omega> \<rightarrow> \<Omega>'"
19.688 + shows "{X -` A \<inter> \<Omega> |A. A \<in> sigma_sets \<Omega>' M'}
19.689 + = sigma_sets \<Omega> {X -` A \<inter> \<Omega> |A. A \<in> M'}" (is "?L = ?R")
19.690 proof
19.691 show "?L \<subseteq> ?R"
19.692 proof clarify
19.693 - fix A assume "A \<in> sets (sigma M')"
19.694 - then have "A \<in> sigma_sets (space M') (sets M')" by (simp add: sets_sigma)
19.695 - then show "X -` A \<inter> space M \<in> ?R"
19.696 + fix A assume "A \<in> sigma_sets \<Omega>' M'"
19.697 + then show "X -` A \<inter> \<Omega> \<in> ?R"
19.698 proof induct
19.699 - case (Basic B) then show ?case
19.700 - by (auto intro!: sigma_sets.Basic)
19.701 - next
19.702 case Empty then show ?case
19.703 by (auto intro!: sigma_sets.Empty)
19.704 next
19.705 case (Compl B)
19.706 - have [simp]: "X -` (space M' - B) \<inter> space M = space M - (X -` B \<inter> space M)"
19.707 + have [simp]: "X -` (\<Omega>' - B) \<inter> \<Omega> = \<Omega> - (X -` B \<inter> \<Omega>)"
19.708 by (auto simp add: funcset_mem [OF X])
19.709 with Compl show ?case
19.710 by (auto intro!: sigma_sets.Compl)
19.711 @@ -624,194 +589,34 @@
19.712 then show ?case
19.713 by (auto simp add: vimage_UN UN_extend_simps(4) simp del: UN_simps
19.714 intro!: sigma_sets.Union)
19.715 - qed
19.716 + qed auto
19.717 qed
19.718 show "?R \<subseteq> ?L"
19.719 proof clarify
19.720 fix A assume "A \<in> ?R"
19.721 - then show "\<exists>B. A = X -` B \<inter> space M \<and> B \<in> sets (sigma M')"
19.722 + then show "\<exists>B. A = X -` B \<inter> \<Omega> \<and> B \<in> sigma_sets \<Omega>' M'"
19.723 proof induct
19.724 case (Basic B) then show ?case by auto
19.725 next
19.726 case Empty then show ?case
19.727 - by (auto simp: sets_sigma intro!: sigma_sets.Empty exI[of _ "{}"])
19.728 + by (auto intro!: sigma_sets.Empty exI[of _ "{}"])
19.729 next
19.730 case (Compl B)
19.731 - then obtain A where A: "B = X -` A \<inter> space M" "A \<in> sets (sigma M')" by auto
19.732 - then have [simp]: "space M - B = X -` (space M' - A) \<inter> space M"
19.733 + then obtain A where A: "B = X -` A \<inter> \<Omega>" "A \<in> sigma_sets \<Omega>' M'" by auto
19.734 + then have [simp]: "\<Omega> - B = X -` (\<Omega>' - A) \<inter> \<Omega>"
19.735 by (auto simp add: funcset_mem [OF X])
19.736 with A(2) show ?case
19.737 - by (auto simp: sets_sigma intro: sigma_sets.Compl)
19.738 + by (auto intro: sigma_sets.Compl)
19.739 next
19.740 case (Union F)
19.741 - then have "\<forall>i. \<exists>B. F i = X -` B \<inter> space M \<and> B \<in> sets (sigma M')" by auto
19.742 + then have "\<forall>i. \<exists>B. F i = X -` B \<inter> \<Omega> \<and> B \<in> sigma_sets \<Omega>' M'" by auto
19.743 from choice[OF this] guess A .. note A = this
19.744 with A show ?case
19.745 - by (auto simp: sets_sigma vimage_UN[symmetric] intro: sigma_sets.Union)
19.746 + by (auto simp: vimage_UN[symmetric] intro: sigma_sets.Union)
19.747 qed
19.748 qed
19.749 qed
19.750
19.751 -section {* Measurable functions *}
19.752 -
19.753 -definition
19.754 - "measurable A B = {f \<in> space A -> space B. \<forall>y \<in> sets B. f -` y \<inter> space A \<in> sets A}"
19.755 -
19.756 -lemma (in sigma_algebra) measurable_sigma:
19.757 - assumes B: "sets N \<subseteq> Pow (space N)"
19.758 - and f: "f \<in> space M -> space N"
19.759 - and ba: "\<And>y. y \<in> sets N \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M"
19.760 - shows "f \<in> measurable M (sigma N)"
19.761 -proof -
19.762 - have "sigma_sets (space N) (sets N) \<subseteq> {y . (f -` y) \<inter> space M \<in> sets M & y \<subseteq> space N}"
19.763 - proof clarify
19.764 - fix x
19.765 - assume "x \<in> sigma_sets (space N) (sets N)"
19.766 - thus "f -` x \<inter> space M \<in> sets M \<and> x \<subseteq> space N"
19.767 - proof induct
19.768 - case (Basic a)
19.769 - thus ?case
19.770 - by (auto simp add: ba) (metis B subsetD PowD)
19.771 - next
19.772 - case Empty
19.773 - thus ?case
19.774 - by auto
19.775 - next
19.776 - case (Compl a)
19.777 - have [simp]: "f -` space N \<inter> space M = space M"
19.778 - by (auto simp add: funcset_mem [OF f])
19.779 - thus ?case
19.780 - by (auto simp add: vimage_Diff Diff_Int_distrib2 compl_sets Compl)
19.781 - next
19.782 - case (Union a)
19.783 - thus ?case
19.784 - by (simp add: vimage_UN, simp only: UN_extend_simps(4)) blast
19.785 - qed
19.786 - qed
19.787 - thus ?thesis
19.788 - by (simp add: measurable_def sigma_algebra_axioms sigma_algebra_sigma B f)
19.789 - (auto simp add: sigma_def)
19.790 -qed
19.791 -
19.792 -lemma measurable_cong:
19.793 - assumes "\<And> w. w \<in> space M \<Longrightarrow> f w = g w"
19.794 - shows "f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable M M'"
19.795 - unfolding measurable_def using assms
19.796 - by (simp cong: vimage_inter_cong Pi_cong)
19.797 -
19.798 -lemma measurable_space:
19.799 - "f \<in> measurable M A \<Longrightarrow> x \<in> space M \<Longrightarrow> f x \<in> space A"
19.800 - unfolding measurable_def by auto
19.801 -
19.802 -lemma measurable_sets:
19.803 - "f \<in> measurable M A \<Longrightarrow> S \<in> sets A \<Longrightarrow> f -` S \<inter> space M \<in> sets M"
19.804 - unfolding measurable_def by auto
19.805 -
19.806 -lemma (in sigma_algebra) measurable_subset:
19.807 - "(\<And>S. S \<in> sets A \<Longrightarrow> S \<subseteq> space A) \<Longrightarrow> measurable M A \<subseteq> measurable M (sigma A)"
19.808 - by (auto intro: measurable_sigma measurable_sets measurable_space)
19.809 -
19.810 -lemma measurable_eqI:
19.811 - "\<lbrakk> space m1 = space m1' ; space m2 = space m2' ;
19.812 - sets m1 = sets m1' ; sets m2 = sets m2' \<rbrakk>
19.813 - \<Longrightarrow> measurable m1 m2 = measurable m1' m2'"
19.814 - by (simp add: measurable_def sigma_algebra_iff2)
19.815 -
19.816 -lemma (in sigma_algebra) measurable_const[intro, simp]:
19.817 - assumes "c \<in> space M'"
19.818 - shows "(\<lambda>x. c) \<in> measurable M M'"
19.819 - using assms by (auto simp add: measurable_def)
19.820 -
19.821 -lemma (in sigma_algebra) measurable_If:
19.822 - assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
19.823 - assumes P: "{x\<in>space M. P x} \<in> sets M"
19.824 - shows "(\<lambda>x. if P x then f x else g x) \<in> measurable M M'"
19.825 - unfolding measurable_def
19.826 -proof safe
19.827 - fix x assume "x \<in> space M"
19.828 - thus "(if P x then f x else g x) \<in> space M'"
19.829 - using measure unfolding measurable_def by auto
19.830 -next
19.831 - fix A assume "A \<in> sets M'"
19.832 - hence *: "(\<lambda>x. if P x then f x else g x) -` A \<inter> space M =
19.833 - ((f -` A \<inter> space M) \<inter> {x\<in>space M. P x}) \<union>
19.834 - ((g -` A \<inter> space M) \<inter> (space M - {x\<in>space M. P x}))"
19.835 - using measure unfolding measurable_def by (auto split: split_if_asm)
19.836 - show "(\<lambda>x. if P x then f x else g x) -` A \<inter> space M \<in> sets M"
19.837 - using `A \<in> sets M'` measure P unfolding * measurable_def
19.838 - by (auto intro!: Un)
19.839 -qed
19.840 -
19.841 -lemma (in sigma_algebra) measurable_If_set:
19.842 - assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
19.843 - assumes P: "A \<in> sets M"
19.844 - shows "(\<lambda>x. if x \<in> A then f x else g x) \<in> measurable M M'"
19.845 -proof (rule measurable_If[OF measure])
19.846 - have "{x \<in> space M. x \<in> A} = A" using `A \<in> sets M` sets_into_space by auto
19.847 - thus "{x \<in> space M. x \<in> A} \<in> sets M" using `A \<in> sets M` by auto
19.848 -qed
19.849 -
19.850 -lemma (in ring_of_sets) measurable_ident[intro, simp]: "id \<in> measurable M M"
19.851 - by (auto simp add: measurable_def)
19.852 -
19.853 -lemma measurable_comp[intro]:
19.854 - fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c"
19.855 - shows "f \<in> measurable a b \<Longrightarrow> g \<in> measurable b c \<Longrightarrow> (g o f) \<in> measurable a c"
19.856 - apply (auto simp add: measurable_def vimage_compose)
19.857 - apply (subgoal_tac "f -` g -` y \<inter> space a = f -` (g -` y \<inter> space b) \<inter> space a")
19.858 - apply force+
19.859 - done
19.860 -
19.861 -lemma measurable_strong:
19.862 - fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c"
19.863 - assumes f: "f \<in> measurable a b" and g: "g \<in> (space b -> space c)"
19.864 - and a: "sigma_algebra a" and b: "sigma_algebra b" and c: "sigma_algebra c"
19.865 - and t: "f ` (space a) \<subseteq> t"
19.866 - and cb: "\<And>s. s \<in> sets c \<Longrightarrow> (g -` s) \<inter> t \<in> sets b"
19.867 - shows "(g o f) \<in> measurable a c"
19.868 -proof -
19.869 - have fab: "f \<in> (space a -> space b)"
19.870 - and ba: "\<And>y. y \<in> sets b \<Longrightarrow> (f -` y) \<inter> (space a) \<in> sets a" using f
19.871 - by (auto simp add: measurable_def)
19.872 - have eq: "f -` g -` y \<inter> space a = f -` (g -` y \<inter> t) \<inter> space a" using t
19.873 - by force
19.874 - show ?thesis
19.875 - apply (auto simp add: measurable_def vimage_compose a c)
19.876 - apply (metis funcset_mem fab g)
19.877 - apply (subst eq, metis ba cb)
19.878 - done
19.879 -qed
19.880 -
19.881 -lemma measurable_mono1:
19.882 - "a \<subseteq> b \<Longrightarrow> sigma_algebra \<lparr>space = X, sets = b\<rparr>
19.883 - \<Longrightarrow> measurable \<lparr>space = X, sets = a\<rparr> c \<subseteq> measurable \<lparr>space = X, sets = b\<rparr> c"
19.884 - by (auto simp add: measurable_def)
19.885 -
19.886 -lemma measurable_up_sigma:
19.887 - "measurable A M \<subseteq> measurable (sigma A) M"
19.888 - unfolding measurable_def
19.889 - by (auto simp: sigma_def intro: sigma_sets.Basic)
19.890 -
19.891 -lemma (in sigma_algebra) measurable_range_reduce:
19.892 - "\<lbrakk> f \<in> measurable M \<lparr>space = s, sets = Pow s\<rparr> ; s \<noteq> {} \<rbrakk>
19.893 - \<Longrightarrow> f \<in> measurable M \<lparr>space = s \<inter> (f ` space M), sets = Pow (s \<inter> (f ` space M))\<rparr>"
19.894 - by (simp add: measurable_def sigma_algebra_Pow del: Pow_Int_eq) blast
19.895 -
19.896 -lemma (in sigma_algebra) measurable_Pow_to_Pow:
19.897 - "(sets M = Pow (space M)) \<Longrightarrow> f \<in> measurable M \<lparr>space = UNIV, sets = Pow UNIV\<rparr>"
19.898 - by (auto simp add: measurable_def sigma_algebra_def sigma_algebra_axioms_def algebra_def)
19.899 -
19.900 -lemma (in sigma_algebra) measurable_Pow_to_Pow_image:
19.901 - "sets M = Pow (space M)
19.902 - \<Longrightarrow> f \<in> measurable M \<lparr>space = f ` space M, sets = Pow (f ` space M)\<rparr>"
19.903 - by (simp add: measurable_def sigma_algebra_Pow) intro_locales
19.904 -
19.905 -lemma (in sigma_algebra) measurable_iff_sigma:
19.906 - assumes "sets E \<subseteq> Pow (space E)" and "f \<in> space M \<rightarrow> space E"
19.907 - shows "f \<in> measurable M (sigma E) \<longleftrightarrow> (\<forall>A\<in>sets E. f -` A \<inter> space M \<in> sets M)"
19.908 - using measurable_sigma[OF assms]
19.909 - by (fastforce simp: measurable_def sets_sigma intro: sigma_sets.intros)
19.910 -
19.911 section "Disjoint families"
19.912
19.913 definition
19.914 @@ -906,8 +711,8 @@
19.915
19.916 lemma (in ring_of_sets) UNION_in_sets:
19.917 fixes A:: "nat \<Rightarrow> 'a set"
19.918 - assumes A: "range A \<subseteq> sets M "
19.919 - shows "(\<Union>i\<in>{0..<n}. A i) \<in> sets M"
19.920 + assumes A: "range A \<subseteq> M"
19.921 + shows "(\<Union>i\<in>{0..<n}. A i) \<in> M"
19.922 proof (induct n)
19.923 case 0 show ?case by simp
19.924 next
19.925 @@ -917,16 +722,16 @@
19.926 qed
19.927
19.928 lemma (in ring_of_sets) range_disjointed_sets:
19.929 - assumes A: "range A \<subseteq> sets M "
19.930 - shows "range (disjointed A) \<subseteq> sets M"
19.931 + assumes A: "range A \<subseteq> M"
19.932 + shows "range (disjointed A) \<subseteq> M"
19.933 proof (auto simp add: disjointed_def)
19.934 fix n
19.935 - show "A n - (\<Union>i\<in>{0..<n}. A i) \<in> sets M" using UNION_in_sets
19.936 + show "A n - (\<Union>i\<in>{0..<n}. A i) \<in> M" using UNION_in_sets
19.937 by (metis A Diff UNIV_I image_subset_iff)
19.938 qed
19.939
19.940 lemma (in algebra) range_disjointed_sets':
19.941 - "range A \<subseteq> sets M \<Longrightarrow> range (disjointed A) \<subseteq> sets M"
19.942 + "range A \<subseteq> M \<Longrightarrow> range (disjointed A) \<subseteq> M"
19.943 using range_disjointed_sets .
19.944
19.945 lemma disjointed_0[simp]: "disjointed A 0 = A 0"
19.946 @@ -942,81 +747,518 @@
19.947 by (simp add: disjointed_def atLeastLessThanSuc_atLeastAtMost atLeast0AtMost)
19.948
19.949 lemma sigma_algebra_disjoint_iff:
19.950 - "sigma_algebra M \<longleftrightarrow>
19.951 - algebra M &
19.952 - (\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow>
19.953 - (\<Union>i::nat. A i) \<in> sets M)"
19.954 + "sigma_algebra \<Omega> M \<longleftrightarrow> algebra \<Omega> M \<and>
19.955 + (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
19.956 proof (auto simp add: sigma_algebra_iff)
19.957 fix A :: "nat \<Rightarrow> 'a set"
19.958 - assume M: "algebra M"
19.959 - and A: "range A \<subseteq> sets M"
19.960 - and UnA: "\<forall>A. range A \<subseteq> sets M \<longrightarrow>
19.961 - disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
19.962 - hence "range (disjointed A) \<subseteq> sets M \<longrightarrow>
19.963 + assume M: "algebra \<Omega> M"
19.964 + and A: "range A \<subseteq> M"
19.965 + and UnA: "\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M"
19.966 + hence "range (disjointed A) \<subseteq> M \<longrightarrow>
19.967 disjoint_family (disjointed A) \<longrightarrow>
19.968 - (\<Union>i. disjointed A i) \<in> sets M" by blast
19.969 - hence "(\<Union>i. disjointed A i) \<in> sets M"
19.970 - by (simp add: algebra.range_disjointed_sets' M A disjoint_family_disjointed)
19.971 - thus "(\<Union>i::nat. A i) \<in> sets M" by (simp add: UN_disjointed_eq)
19.972 + (\<Union>i. disjointed A i) \<in> M" by blast
19.973 + hence "(\<Union>i. disjointed A i) \<in> M"
19.974 + by (simp add: algebra.range_disjointed_sets'[of \<Omega>] M A disjoint_family_disjointed)
19.975 + thus "(\<Union>i::nat. A i) \<in> M" by (simp add: UN_disjointed_eq)
19.976 qed
19.977
19.978 +section {* Measure type *}
19.979 +
19.980 +definition positive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
19.981 + "positive M \<mu> \<longleftrightarrow> \<mu> {} = 0 \<and> (\<forall>A\<in>M. 0 \<le> \<mu> A)"
19.982 +
19.983 +definition countably_additive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
19.984 + "countably_additive M f \<longleftrightarrow> (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow>
19.985 + (\<Sum>i. f (A i)) = f (\<Union>i. A i))"
19.986 +
19.987 +definition measure_space :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
19.988 + "measure_space \<Omega> A \<mu> \<longleftrightarrow> sigma_algebra \<Omega> A \<and> positive A \<mu> \<and> countably_additive A \<mu>"
19.989 +
19.990 +typedef (open) 'a measure = "{(\<Omega>::'a set, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu> }"
19.991 +proof
19.992 + have "sigma_algebra UNIV {{}, UNIV}"
19.993 + proof qed auto
19.994 + then show "(UNIV, {{}, UNIV}, \<lambda>A. 0) \<in> {(\<Omega>, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu>} "
19.995 + by (auto simp: measure_space_def positive_def countably_additive_def)
19.996 +qed
19.997 +
19.998 +definition space :: "'a measure \<Rightarrow> 'a set" where
19.999 + "space M = fst (Rep_measure M)"
19.1000 +
19.1001 +definition sets :: "'a measure \<Rightarrow> 'a set set" where
19.1002 + "sets M = fst (snd (Rep_measure M))"
19.1003 +
19.1004 +definition emeasure :: "'a measure \<Rightarrow> 'a set \<Rightarrow> ereal" where
19.1005 + "emeasure M = snd (snd (Rep_measure M))"
19.1006 +
19.1007 +definition measure :: "'a measure \<Rightarrow> 'a set \<Rightarrow> real" where
19.1008 + "measure M A = real (emeasure M A)"
19.1009 +
19.1010 +declare [[coercion sets]]
19.1011 +
19.1012 +declare [[coercion measure]]
19.1013 +
19.1014 +declare [[coercion emeasure]]
19.1015 +
19.1016 +lemma measure_space: "measure_space (space M) (sets M) (emeasure M)"
19.1017 + by (cases M) (auto simp: space_def sets_def emeasure_def Abs_measure_inverse)
19.1018 +
19.1019 +interpretation sigma_algebra "space M" "sets M" for M :: "'a measure"
19.1020 + using measure_space[of M] by (auto simp: measure_space_def)
19.1021 +
19.1022 +definition measure_of :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> 'a measure" where
19.1023 + "measure_of \<Omega> A \<mu> = Abs_measure (\<Omega>, sigma_sets \<Omega> A,
19.1024 + \<lambda>a. if a \<in> sigma_sets \<Omega> A \<and> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> then \<mu> a else 0)"
19.1025 +
19.1026 +abbreviation "sigma \<Omega> A \<equiv> measure_of \<Omega> A (\<lambda>x. 0)"
19.1027 +
19.1028 +lemma measure_space_0: "A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)"
19.1029 + unfolding measure_space_def
19.1030 + by (auto intro!: sigma_algebra_sigma_sets simp: positive_def countably_additive_def)
19.1031 +
19.1032 +lemma (in ring_of_sets) positive_cong_eq:
19.1033 + "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> positive M \<mu>' = positive M \<mu>"
19.1034 + by (auto simp add: positive_def)
19.1035 +
19.1036 +lemma (in sigma_algebra) countably_additive_eq:
19.1037 + "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> countably_additive M \<mu>' = countably_additive M \<mu>"
19.1038 + unfolding countably_additive_def
19.1039 + by (intro arg_cong[where f=All] ext) (auto simp add: countably_additive_def subset_eq)
19.1040 +
19.1041 +lemma measure_space_eq:
19.1042 + assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a"
19.1043 + shows "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'"
19.1044 +proof -
19.1045 + interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A" using closed by (rule sigma_algebra_sigma_sets)
19.1046 + from positive_cong_eq[OF eq, of "\<lambda>i. i"] countably_additive_eq[OF eq, of "\<lambda>i. i"] show ?thesis
19.1047 + by (auto simp: measure_space_def)
19.1048 +qed
19.1049 +
19.1050 +lemma measure_of_eq:
19.1051 + assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a)"
19.1052 + shows "measure_of \<Omega> A \<mu> = measure_of \<Omega> A \<mu>'"
19.1053 +proof -
19.1054 + have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'"
19.1055 + using assms by (rule measure_space_eq)
19.1056 + with eq show ?thesis
19.1057 + by (auto simp add: measure_of_def intro!: arg_cong[where f=Abs_measure])
19.1058 +qed
19.1059 +
19.1060 +lemma
19.1061 + assumes A: "A \<subseteq> Pow \<Omega>"
19.1062 + shows sets_measure_of[simp]: "sets (measure_of \<Omega> A \<mu>) = sigma_sets \<Omega> A" (is ?sets)
19.1063 + and space_measure_of[simp]: "space (measure_of \<Omega> A \<mu>) = \<Omega>" (is ?space)
19.1064 +proof -
19.1065 + have "?sets \<and> ?space"
19.1066 + proof cases
19.1067 + assume "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
19.1068 + moreover have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A)
19.1069 + (\<lambda>a. if a \<in> sigma_sets \<Omega> A then \<mu> a else 0)"
19.1070 + using A by (rule measure_space_eq) auto
19.1071 + ultimately show "?sets \<and> ?space"
19.1072 + by (auto simp: Abs_measure_inverse measure_of_def sets_def space_def)
19.1073 + next
19.1074 + assume "\<not> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
19.1075 + with A show "?sets \<and> ?space"
19.1076 + by (auto simp: Abs_measure_inverse measure_of_def sets_def space_def measure_space_0)
19.1077 + qed
19.1078 + then show ?sets ?space by auto
19.1079 +qed
19.1080 +
19.1081 +lemma (in sigma_algebra) sets_measure_of_eq[simp]:
19.1082 + "sets (measure_of \<Omega> M \<mu>) = M"
19.1083 + using space_closed by (auto intro!: sigma_sets_eq)
19.1084 +
19.1085 +lemma (in sigma_algebra) space_measure_of_eq[simp]:
19.1086 + "space (measure_of \<Omega> M \<mu>) = \<Omega>"
19.1087 + using space_closed by (auto intro!: sigma_sets_eq)
19.1088 +
19.1089 +lemma measure_of_subset:
19.1090 + "M \<subseteq> Pow \<Omega> \<Longrightarrow> M' \<subseteq> M \<Longrightarrow> sets (measure_of \<Omega> M' \<mu>) \<subseteq> sets (measure_of \<Omega> M \<mu>')"
19.1091 + by (auto intro!: sigma_sets_subseteq)
19.1092 +
19.1093 +lemma in_extended_measure[intro, simp]: "M \<subseteq> Pow \<Omega> \<Longrightarrow> A \<in> M \<Longrightarrow> A \<in> sets (measure_of \<Omega> M \<mu>)"
19.1094 + by auto
19.1095 +
19.1096 +section {* Constructing simple @{typ "'a measure"} *}
19.1097 +
19.1098 +lemma emeasure_measure_of:
19.1099 + assumes M: "M = measure_of \<Omega> A \<mu>"
19.1100 + assumes ms: "A \<subseteq> Pow \<Omega>" "positive (sets M) \<mu>" "countably_additive (sets M) \<mu>"
19.1101 + assumes X: "X \<in> sets M"
19.1102 + shows "emeasure M X = \<mu> X"
19.1103 +proof -
19.1104 + interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A" by (rule sigma_algebra_sigma_sets) fact
19.1105 + have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
19.1106 + using ms M by (simp add: measure_space_def sigma_algebra_sigma_sets)
19.1107 + moreover have "measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>a. if a \<in> sigma_sets \<Omega> A then \<mu> a else 0)
19.1108 + = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
19.1109 + using ms(1) by (rule measure_space_eq) auto
19.1110 + moreover have "X \<in> sigma_sets \<Omega> A"
19.1111 + using X M ms by simp
19.1112 + ultimately show ?thesis
19.1113 + unfolding emeasure_def measure_of_def M
19.1114 + by (subst Abs_measure_inverse) (simp_all add: sigma_sets_eq)
19.1115 +qed
19.1116 +
19.1117 +lemma emeasure_measure_of_sigma:
19.1118 + assumes ms: "sigma_algebra \<Omega> M" "positive M \<mu>" "countably_additive M \<mu>"
19.1119 + assumes A: "A \<in> M"
19.1120 + shows "emeasure (measure_of \<Omega> M \<mu>) A = \<mu> A"
19.1121 +proof -
19.1122 + interpret sigma_algebra \<Omega> M by fact
19.1123 + have "measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>"
19.1124 + using ms sigma_sets_eq by (simp add: measure_space_def)
19.1125 + moreover have "measure_space \<Omega> (sigma_sets \<Omega> M) (\<lambda>a. if a \<in> sigma_sets \<Omega> M then \<mu> a else 0)
19.1126 + = measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>"
19.1127 + using space_closed by (rule measure_space_eq) auto
19.1128 + ultimately show ?thesis using A
19.1129 + unfolding emeasure_def measure_of_def
19.1130 + by (subst Abs_measure_inverse) (simp_all add: sigma_sets_eq)
19.1131 +qed
19.1132 +
19.1133 +lemma measure_cases[cases type: measure]:
19.1134 + obtains (measure) \<Omega> A \<mu> where "x = Abs_measure (\<Omega>, A, \<mu>)" "\<forall>a\<in>-A. \<mu> a = 0" "measure_space \<Omega> A \<mu>"
19.1135 + by atomize_elim (cases x, auto)
19.1136 +
19.1137 +lemma sets_eq_imp_space_eq:
19.1138 + "sets M = sets M' \<Longrightarrow> space M = space M'"
19.1139 + using top[of M] top[of M'] space_closed[of M] space_closed[of M']
19.1140 + by blast
19.1141 +
19.1142 +lemma emeasure_notin_sets: "A \<notin> sets M \<Longrightarrow> emeasure M A = 0"
19.1143 + by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def)
19.1144 +
19.1145 +lemma measure_notin_sets: "A \<notin> sets M \<Longrightarrow> measure M A = 0"
19.1146 + by (simp add: measure_def emeasure_notin_sets)
19.1147 +
19.1148 +lemma measure_eqI:
19.1149 + fixes M N :: "'a measure"
19.1150 + assumes "sets M = sets N" and eq: "\<And>A. A \<in> sets M \<Longrightarrow> emeasure M A = emeasure N A"
19.1151 + shows "M = N"
19.1152 +proof (cases M N rule: measure_cases[case_product measure_cases])
19.1153 + case (measure_measure \<Omega> A \<mu> \<Omega>' A' \<mu>')
19.1154 + interpret M: sigma_algebra \<Omega> A using measure_measure by (auto simp: measure_space_def)
19.1155 + interpret N: sigma_algebra \<Omega>' A' using measure_measure by (auto simp: measure_space_def)
19.1156 + have "A = sets M" "A' = sets N"
19.1157 + using measure_measure by (simp_all add: sets_def Abs_measure_inverse)
19.1158 + with `sets M = sets N` have "A = A'" by simp
19.1159 + moreover with M.top N.top M.space_closed N.space_closed have "\<Omega> = \<Omega>'" by auto
19.1160 + moreover { fix B have "\<mu> B = \<mu>' B"
19.1161 + proof cases
19.1162 + assume "B \<in> A"
19.1163 + with eq `A = sets M` have "emeasure M B = emeasure N B" by simp
19.1164 + with measure_measure show "\<mu> B = \<mu>' B"
19.1165 + by (simp add: emeasure_def Abs_measure_inverse)
19.1166 + next
19.1167 + assume "B \<notin> A"
19.1168 + with `A = sets M` `A' = sets N` `A = A'` have "B \<notin> sets M" "B \<notin> sets N"
19.1169 + by auto
19.1170 + then have "emeasure M B = 0" "emeasure N B = 0"
19.1171 + by (simp_all add: emeasure_notin_sets)
19.1172 + with measure_measure show "\<mu> B = \<mu>' B"
19.1173 + by (simp add: emeasure_def Abs_measure_inverse)
19.1174 + qed }
19.1175 + then have "\<mu> = \<mu>'" by auto
19.1176 + ultimately show "M = N"
19.1177 + by (simp add: measure_measure)
19.1178 +qed
19.1179 +
19.1180 +lemma emeasure_sigma: "A \<subseteq> Pow \<Omega> \<Longrightarrow> emeasure (sigma \<Omega> A) = (\<lambda>_. 0)"
19.1181 + using measure_space_0[of A \<Omega>]
19.1182 + by (simp add: measure_of_def emeasure_def Abs_measure_inverse)
19.1183 +
19.1184 +lemma sigma_eqI:
19.1185 + assumes [simp]: "M \<subseteq> Pow \<Omega>" "N \<subseteq> Pow \<Omega>" "sigma_sets \<Omega> M = sigma_sets \<Omega> N"
19.1186 + shows "sigma \<Omega> M = sigma \<Omega> N"
19.1187 + by (rule measure_eqI) (simp_all add: emeasure_sigma)
19.1188 +
19.1189 +section {* Measurable functions *}
19.1190 +
19.1191 +definition measurable :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) set" where
19.1192 + "measurable A B = {f \<in> space A -> space B. \<forall>y \<in> sets B. f -` y \<inter> space A \<in> sets A}"
19.1193 +
19.1194 +lemma measurable_space:
19.1195 + "f \<in> measurable M A \<Longrightarrow> x \<in> space M \<Longrightarrow> f x \<in> space A"
19.1196 + unfolding measurable_def by auto
19.1197 +
19.1198 +lemma measurable_sets:
19.1199 + "f \<in> measurable M A \<Longrightarrow> S \<in> sets A \<Longrightarrow> f -` S \<inter> space M \<in> sets M"
19.1200 + unfolding measurable_def by auto
19.1201 +
19.1202 +lemma measurable_sigma_sets:
19.1203 + assumes B: "sets N = sigma_sets \<Omega> A" "A \<subseteq> Pow \<Omega>"
19.1204 + and f: "f \<in> space M \<rightarrow> \<Omega>"
19.1205 + and ba: "\<And>y. y \<in> A \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M"
19.1206 + shows "f \<in> measurable M N"
19.1207 +proof -
19.1208 + interpret A: sigma_algebra \<Omega> "sigma_sets \<Omega> A" using B(2) by (rule sigma_algebra_sigma_sets)
19.1209 + from B top[of N] A.top space_closed[of N] A.space_closed have \<Omega>: "\<Omega> = space N" by force
19.1210 +
19.1211 + { fix X assume "X \<in> sigma_sets \<Omega> A"
19.1212 + then have "f -` X \<inter> space M \<in> sets M \<and> X \<subseteq> \<Omega>"
19.1213 + proof induct
19.1214 + case (Basic a) then show ?case
19.1215 + by (auto simp add: ba) (metis B(2) subsetD PowD)
19.1216 + next
19.1217 + case (Compl a)
19.1218 + have [simp]: "f -` \<Omega> \<inter> space M = space M"
19.1219 + by (auto simp add: funcset_mem [OF f])
19.1220 + then show ?case
19.1221 + by (auto simp add: vimage_Diff Diff_Int_distrib2 compl_sets Compl)
19.1222 + next
19.1223 + case (Union a)
19.1224 + then show ?case
19.1225 + by (simp add: vimage_UN, simp only: UN_extend_simps(4)) blast
19.1226 + qed auto }
19.1227 + with f show ?thesis
19.1228 + by (auto simp add: measurable_def B \<Omega>)
19.1229 +qed
19.1230 +
19.1231 +lemma measurable_measure_of:
19.1232 + assumes B: "N \<subseteq> Pow \<Omega>"
19.1233 + and f: "f \<in> space M \<rightarrow> \<Omega>"
19.1234 + and ba: "\<And>y. y \<in> N \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M"
19.1235 + shows "f \<in> measurable M (measure_of \<Omega> N \<mu>)"
19.1236 +proof -
19.1237 + have "sets (measure_of \<Omega> N \<mu>) = sigma_sets \<Omega> N"
19.1238 + using B by (rule sets_measure_of)
19.1239 + from this assms show ?thesis by (rule measurable_sigma_sets)
19.1240 +qed
19.1241 +
19.1242 +lemma measurable_iff_measure_of:
19.1243 + assumes "N \<subseteq> Pow \<Omega>" "f \<in> space M \<rightarrow> \<Omega>"
19.1244 + shows "f \<in> measurable M (measure_of \<Omega> N \<mu>) \<longleftrightarrow> (\<forall>A\<in>N. f -` A \<inter> space M \<in> sets M)"
19.1245 + by (metis assms in_extended_measure measurable_measure_of assms measurable_sets)
19.1246 +
19.1247 +lemma measurable_cong:
19.1248 + assumes "\<And> w. w \<in> space M \<Longrightarrow> f w = g w"
19.1249 + shows "f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable M M'"
19.1250 + unfolding measurable_def using assms
19.1251 + by (simp cong: vimage_inter_cong Pi_cong)
19.1252 +
19.1253 +lemma measurable_eqI:
19.1254 + "\<lbrakk> space m1 = space m1' ; space m2 = space m2' ;
19.1255 + sets m1 = sets m1' ; sets m2 = sets m2' \<rbrakk>
19.1256 + \<Longrightarrow> measurable m1 m2 = measurable m1' m2'"
19.1257 + by (simp add: measurable_def sigma_algebra_iff2)
19.1258 +
19.1259 +lemma measurable_const[intro, simp]:
19.1260 + "c \<in> space M' \<Longrightarrow> (\<lambda>x. c) \<in> measurable M M'"
19.1261 + by (auto simp add: measurable_def)
19.1262 +
19.1263 +lemma measurable_If:
19.1264 + assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
19.1265 + assumes P: "{x\<in>space M. P x} \<in> sets M"
19.1266 + shows "(\<lambda>x. if P x then f x else g x) \<in> measurable M M'"
19.1267 + unfolding measurable_def
19.1268 +proof safe
19.1269 + fix x assume "x \<in> space M"
19.1270 + thus "(if P x then f x else g x) \<in> space M'"
19.1271 + using measure unfolding measurable_def by auto
19.1272 +next
19.1273 + fix A assume "A \<in> sets M'"
19.1274 + hence *: "(\<lambda>x. if P x then f x else g x) -` A \<inter> space M =
19.1275 + ((f -` A \<inter> space M) \<inter> {x\<in>space M. P x}) \<union>
19.1276 + ((g -` A \<inter> space M) \<inter> (space M - {x\<in>space M. P x}))"
19.1277 + using measure unfolding measurable_def by (auto split: split_if_asm)
19.1278 + show "(\<lambda>x. if P x then f x else g x) -` A \<inter> space M \<in> sets M"
19.1279 + using `A \<in> sets M'` measure P unfolding * measurable_def
19.1280 + by (auto intro!: Un)
19.1281 +qed
19.1282 +
19.1283 +lemma measurable_If_set:
19.1284 + assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
19.1285 + assumes P: "A \<in> sets M"
19.1286 + shows "(\<lambda>x. if x \<in> A then f x else g x) \<in> measurable M M'"
19.1287 +proof (rule measurable_If[OF measure])
19.1288 + have "{x \<in> space M. x \<in> A} = A" using `A \<in> sets M` sets_into_space by auto
19.1289 + thus "{x \<in> space M. x \<in> A} \<in> sets M" using `A \<in> sets M` by auto
19.1290 +qed
19.1291 +
19.1292 +lemma measurable_ident[intro, simp]: "id \<in> measurable M M"
19.1293 + by (auto simp add: measurable_def)
19.1294 +
19.1295 +lemma measurable_comp[intro]:
19.1296 + fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c"
19.1297 + shows "f \<in> measurable a b \<Longrightarrow> g \<in> measurable b c \<Longrightarrow> (g o f) \<in> measurable a c"
19.1298 + apply (auto simp add: measurable_def vimage_compose)
19.1299 + apply (subgoal_tac "f -` g -` y \<inter> space a = f -` (g -` y \<inter> space b) \<inter> space a")
19.1300 + apply force+
19.1301 + done
19.1302 +
19.1303 +lemma measurable_Least:
19.1304 + assumes meas: "\<And>i::nat. {x\<in>space M. P i x} \<in> M"
19.1305 + shows "(\<lambda>x. LEAST j. P j x) -` A \<inter> space M \<in> sets M"
19.1306 +proof -
19.1307 + { fix i have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M \<in> sets M"
19.1308 + proof cases
19.1309 + assume i: "(LEAST j. False) = i"
19.1310 + have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
19.1311 + {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x})) \<union> (space M - (\<Union>i. {x\<in>space M. P i x}))"
19.1312 + by (simp add: set_eq_iff, safe)
19.1313 + (insert i, auto dest: Least_le intro: LeastI intro!: Least_equality)
19.1314 + with meas show ?thesis
19.1315 + by (auto intro!: Int)
19.1316 + next
19.1317 + assume i: "(LEAST j. False) \<noteq> i"
19.1318 + then have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
19.1319 + {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x}))"
19.1320 + proof (simp add: set_eq_iff, safe)
19.1321 + fix x assume neq: "(LEAST j. False) \<noteq> (LEAST j. P j x)"
19.1322 + have "\<exists>j. P j x"
19.1323 + by (rule ccontr) (insert neq, auto)
19.1324 + then show "P (LEAST j. P j x) x" by (rule LeastI_ex)
19.1325 + qed (auto dest: Least_le intro!: Least_equality)
19.1326 + with meas show ?thesis
19.1327 + by auto
19.1328 + qed }
19.1329 + then have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) \<in> sets M"
19.1330 + by (intro countable_UN) auto
19.1331 + moreover have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) =
19.1332 + (\<lambda>x. LEAST j. P j x) -` A \<inter> space M" by auto
19.1333 + ultimately show ?thesis by auto
19.1334 +qed
19.1335 +
19.1336 +lemma measurable_strong:
19.1337 + fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c"
19.1338 + assumes f: "f \<in> measurable a b" and g: "g \<in> space b \<rightarrow> space c"
19.1339 + and t: "f ` (space a) \<subseteq> t"
19.1340 + and cb: "\<And>s. s \<in> sets c \<Longrightarrow> (g -` s) \<inter> t \<in> sets b"
19.1341 + shows "(g o f) \<in> measurable a c"
19.1342 +proof -
19.1343 + have fab: "f \<in> (space a -> space b)"
19.1344 + and ba: "\<And>y. y \<in> sets b \<Longrightarrow> (f -` y) \<inter> (space a) \<in> sets a" using f
19.1345 + by (auto simp add: measurable_def)
19.1346 + have eq: "\<And>y. f -` g -` y \<inter> space a = f -` (g -` y \<inter> t) \<inter> space a" using t
19.1347 + by force
19.1348 + show ?thesis
19.1349 + apply (auto simp add: measurable_def vimage_compose)
19.1350 + apply (metis funcset_mem fab g)
19.1351 + apply (subst eq, metis ba cb)
19.1352 + done
19.1353 +qed
19.1354 +
19.1355 +lemma measurable_mono1:
19.1356 + "M' \<subseteq> Pow \<Omega> \<Longrightarrow> M \<subseteq> M' \<Longrightarrow>
19.1357 + measurable (measure_of \<Omega> M \<mu>) N \<subseteq> measurable (measure_of \<Omega> M' \<mu>') N"
19.1358 + using measure_of_subset[of M' \<Omega> M] by (auto simp add: measurable_def)
19.1359 +
19.1360 +subsection {* Extend measure *}
19.1361 +
19.1362 +definition "extend_measure \<Omega> I G \<mu> =
19.1363 + (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)
19.1364 + 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>')
19.1365 + else measure_of \<Omega> (G`I) (\<lambda>_. 0))"
19.1366 +
19.1367 +lemma space_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> space (extend_measure \<Omega> I G \<mu>) = \<Omega>"
19.1368 + unfolding extend_measure_def by simp
19.1369 +
19.1370 +lemma sets_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> sets (extend_measure \<Omega> I G \<mu>) = sigma_sets \<Omega> (G`I)"
19.1371 + unfolding extend_measure_def by simp
19.1372 +
19.1373 +lemma emeasure_extend_measure:
19.1374 + assumes M: "M = extend_measure \<Omega> I G \<mu>"
19.1375 + and eq: "\<And>i. i \<in> I \<Longrightarrow> \<mu>' (G i) = \<mu> i"
19.1376 + and ms: "G ` I \<subseteq> Pow \<Omega>" "positive (sets M) \<mu>'" "countably_additive (sets M) \<mu>'"
19.1377 + and "i \<in> I"
19.1378 + shows "emeasure M (G i) = \<mu> i"
19.1379 +proof cases
19.1380 + assume *: "(\<forall>i\<in>I. \<mu> i = 0)"
19.1381 + with M have M_eq: "M = measure_of \<Omega> (G`I) (\<lambda>_. 0)"
19.1382 + by (simp add: extend_measure_def)
19.1383 + from measure_space_0[OF ms(1)] ms `i\<in>I`
19.1384 + have "emeasure M (G i) = 0"
19.1385 + by (intro emeasure_measure_of[OF M_eq]) (auto simp add: M measure_space_def sets_extend_measure)
19.1386 + with `i\<in>I` * show ?thesis
19.1387 + by simp
19.1388 +next
19.1389 + def P \<equiv> "\<lambda>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>'"
19.1390 + assume "\<not> (\<forall>i\<in>I. \<mu> i = 0)"
19.1391 + moreover
19.1392 + have "measure_space (space M) (sets M) \<mu>'"
19.1393 + using ms unfolding measure_space_def by auto default
19.1394 + with ms eq have "\<exists>\<mu>'. P \<mu>'"
19.1395 + unfolding P_def
19.1396 + by (intro exI[of _ \<mu>']) (auto simp add: M space_extend_measure sets_extend_measure)
19.1397 + ultimately have M_eq: "M = measure_of \<Omega> (G`I) (Eps P)"
19.1398 + by (simp add: M extend_measure_def P_def[symmetric])
19.1399 +
19.1400 + from `\<exists>\<mu>'. P \<mu>'` have P: "P (Eps P)" by (rule someI_ex)
19.1401 + show "emeasure M (G i) = \<mu> i"
19.1402 + proof (subst emeasure_measure_of[OF M_eq])
19.1403 + have sets_M: "sets M = sigma_sets \<Omega> (G`I)"
19.1404 + using M_eq ms by (auto simp: sets_extend_measure)
19.1405 + then show "G i \<in> sets M" using `i \<in> I` by auto
19.1406 + show "positive (sets M) (Eps P)" "countably_additive (sets M) (Eps P)" "Eps P (G i) = \<mu> i"
19.1407 + using P `i\<in>I` by (auto simp add: sets_M measure_space_def P_def)
19.1408 + qed fact
19.1409 +qed
19.1410 +
19.1411 +lemma emeasure_extend_measure_Pair:
19.1412 + assumes M: "M = extend_measure \<Omega> {(i, j). I i j} (\<lambda>(i, j). G i j) (\<lambda>(i, j). \<mu> i j)"
19.1413 + and eq: "\<And>i j. I i j \<Longrightarrow> \<mu>' (G i j) = \<mu> i j"
19.1414 + and ms: "\<And>i j. I i j \<Longrightarrow> G i j \<in> Pow \<Omega>" "positive (sets M) \<mu>'" "countably_additive (sets M) \<mu>'"
19.1415 + and "I i j"
19.1416 + shows "emeasure M (G i j) = \<mu> i j"
19.1417 + using emeasure_extend_measure[OF M _ _ ms(2,3), of "(i,j)"] eq ms(1) `I i j`
19.1418 + by (auto simp: subset_eq)
19.1419 +
19.1420 subsection {* Sigma algebra generated by function preimages *}
19.1421
19.1422 -definition (in sigma_algebra)
19.1423 - "vimage_algebra S f = \<lparr> space = S, sets = (\<lambda>A. f -` A \<inter> S) ` sets M, \<dots> = more M \<rparr>"
19.1424 +definition
19.1425 + "vimage_algebra M S f = sigma S ((\<lambda>A. f -` A \<inter> S) ` sets M)"
19.1426
19.1427 -lemma (in sigma_algebra) in_vimage_algebra[simp]:
19.1428 - "A \<in> sets (vimage_algebra S f) \<longleftrightarrow> (\<exists>B\<in>sets M. A = f -` B \<inter> S)"
19.1429 - by (simp add: vimage_algebra_def image_iff)
19.1430 -
19.1431 -lemma (in sigma_algebra) space_vimage_algebra[simp]:
19.1432 - "space (vimage_algebra S f) = S"
19.1433 - by (simp add: vimage_algebra_def)
19.1434 -
19.1435 -lemma (in sigma_algebra) sigma_algebra_preimages:
19.1436 +lemma sigma_algebra_preimages:
19.1437 fixes f :: "'x \<Rightarrow> 'a"
19.1438 - assumes "f \<in> A \<rightarrow> space M"
19.1439 - shows "sigma_algebra \<lparr> space = A, sets = (\<lambda>M. f -` M \<inter> A) ` sets M \<rparr>"
19.1440 - (is "sigma_algebra \<lparr> space = _, sets = ?F ` sets M \<rparr>")
19.1441 + assumes "f \<in> S \<rightarrow> space M"
19.1442 + shows "sigma_algebra S ((\<lambda>A. f -` A \<inter> S) ` sets M)"
19.1443 + (is "sigma_algebra _ (?F ` sets M)")
19.1444 proof (simp add: sigma_algebra_iff2, safe)
19.1445 show "{} \<in> ?F ` sets M" by blast
19.1446 next
19.1447 - fix S assume "S \<in> sets M"
19.1448 - moreover have "A - ?F S = ?F (space M - S)"
19.1449 + fix A assume "A \<in> sets M"
19.1450 + moreover have "S - ?F A = ?F (space M - A)"
19.1451 using assms by auto
19.1452 - ultimately show "A - ?F S \<in> ?F ` sets M"
19.1453 + ultimately show "S - ?F A \<in> ?F ` sets M"
19.1454 by blast
19.1455 next
19.1456 - fix S :: "nat \<Rightarrow> 'x set" assume *: "range S \<subseteq> ?F ` sets M"
19.1457 - have "\<forall>i. \<exists>b. b \<in> sets M \<and> S i = ?F b"
19.1458 + fix A :: "nat \<Rightarrow> 'x set" assume *: "range A \<subseteq> ?F ` M"
19.1459 + have "\<forall>i. \<exists>b. b \<in> M \<and> A i = ?F b"
19.1460 proof safe
19.1461 fix i
19.1462 - have "S i \<in> ?F ` sets M" using * by auto
19.1463 - then show "\<exists>b. b \<in> sets M \<and> S i = ?F b" by auto
19.1464 + have "A i \<in> ?F ` M" using * by auto
19.1465 + then show "\<exists>b. b \<in> M \<and> A i = ?F b" by auto
19.1466 qed
19.1467 - from choice[OF this] obtain b where b: "range b \<subseteq> sets M" "\<And>i. S i = ?F (b i)"
19.1468 + from choice[OF this] obtain b where b: "range b \<subseteq> M" "\<And>i. A i = ?F (b i)"
19.1469 by auto
19.1470 - then have "(\<Union>i. S i) = ?F (\<Union>i. b i)" by auto
19.1471 - then show "(\<Union>i. S i) \<in> ?F ` sets M" using b(1) by blast
19.1472 + then have "(\<Union>i. A i) = ?F (\<Union>i. b i)" by auto
19.1473 + then show "(\<Union>i. A i) \<in> ?F ` M" using b(1) by blast
19.1474 qed
19.1475
19.1476 -lemma (in sigma_algebra) sigma_algebra_vimage:
19.1477 +lemma sets_vimage_algebra[simp]:
19.1478 + "f \<in> S \<rightarrow> space M \<Longrightarrow> sets (vimage_algebra M S f) = (\<lambda>A. f -` A \<inter> S) ` sets M"
19.1479 + using sigma_algebra.sets_measure_of_eq[OF sigma_algebra_preimages, of f S M]
19.1480 + by (simp add: vimage_algebra_def)
19.1481 +
19.1482 +lemma space_vimage_algebra[simp]:
19.1483 + "f \<in> S \<rightarrow> space M \<Longrightarrow> space (vimage_algebra M S f) = S"
19.1484 + using sigma_algebra.space_measure_of_eq[OF sigma_algebra_preimages, of f S M]
19.1485 + by (simp add: vimage_algebra_def)
19.1486 +
19.1487 +lemma in_vimage_algebra[simp]:
19.1488 + "f \<in> S \<rightarrow> space M \<Longrightarrow> A \<in> sets (vimage_algebra M S f) \<longleftrightarrow> (\<exists>B\<in>sets M. A = f -` B \<inter> S)"
19.1489 + by (simp add: image_iff)
19.1490 +
19.1491 +lemma measurable_vimage_algebra:
19.1492 fixes S :: "'c set" assumes "f \<in> S \<rightarrow> space M"
19.1493 - shows "sigma_algebra (vimage_algebra S f)"
19.1494 -proof -
19.1495 - from sigma_algebra_preimages[OF assms]
19.1496 - show ?thesis unfolding vimage_algebra_def by (auto simp: sigma_algebra_iff2)
19.1497 -qed
19.1498 + shows "f \<in> measurable (vimage_algebra M S f) M"
19.1499 + unfolding measurable_def using assms by force
19.1500
19.1501 -lemma (in sigma_algebra) measurable_vimage_algebra:
19.1502 - fixes S :: "'c set" assumes "f \<in> S \<rightarrow> space M"
19.1503 - shows "f \<in> measurable (vimage_algebra S f) M"
19.1504 - unfolding measurable_def using assms by force
19.1505 -
19.1506 -lemma (in sigma_algebra) measurable_vimage:
19.1507 +lemma measurable_vimage:
19.1508 fixes g :: "'a \<Rightarrow> 'c" and f :: "'d \<Rightarrow> 'a"
19.1509 assumes "g \<in> measurable M M2" "f \<in> S \<rightarrow> space M"
19.1510 - shows "(\<lambda>x. g (f x)) \<in> measurable (vimage_algebra S f) M2"
19.1511 + shows "(\<lambda>x. g (f x)) \<in> measurable (vimage_algebra M S f) M2"
19.1512 proof -
19.1513 note measurable_vimage_algebra[OF assms(2)]
19.1514 from measurable_comp[OF this assms(1)]
19.1515 @@ -1033,7 +1275,7 @@
19.1516 proof induct
19.1517 case (Basic X) then obtain X' where "X = ?F X'" "X' \<in> A"
19.1518 by auto
19.1519 - then show ?case by (auto intro!: sigma_sets.Basic)
19.1520 + then show ?case by auto
19.1521 next
19.1522 case Empty then show ?case
19.1523 by (auto intro!: image_eqI[of _ _ "{}"] sigma_sets.Empty)
19.1524 @@ -1060,8 +1302,6 @@
19.1525 then obtain X' where "X' \<in> sigma_sets S A" "X = ?F X'" by auto
19.1526 then show "X \<in> sigma_sets S' (?F ` A)"
19.1527 proof (induct arbitrary: X)
19.1528 - case (Basic X') then show ?case by (auto intro: sigma_sets.Basic)
19.1529 - next
19.1530 case Empty then show ?case by (auto intro: sigma_sets.Empty)
19.1531 next
19.1532 case (Compl X')
19.1533 @@ -1078,23 +1318,7 @@
19.1534 also have "(\<Union>i. f -` F i \<inter> S') = X"
19.1535 using assms Union by auto
19.1536 finally show ?case .
19.1537 - qed
19.1538 -qed
19.1539 -
19.1540 -section {* Conditional space *}
19.1541 -
19.1542 -definition (in algebra)
19.1543 - "image_space X = \<lparr> space = X`space M, sets = (\<lambda>S. X`S) ` sets M, \<dots> = more M \<rparr>"
19.1544 -
19.1545 -definition (in algebra)
19.1546 - "conditional_space X A = algebra.image_space (restricted_space A) X"
19.1547 -
19.1548 -lemma (in algebra) space_conditional_space:
19.1549 - assumes "A \<in> sets M" shows "space (conditional_space X A) = X`A"
19.1550 -proof -
19.1551 - interpret r: algebra "restricted_space A" using assms by (rule restricted_algebra)
19.1552 - show ?thesis unfolding conditional_space_def r.image_space_def
19.1553 - by simp
19.1554 + qed auto
19.1555 qed
19.1556
19.1557 subsection {* A Two-Element Series *}
19.1558 @@ -1113,80 +1337,64 @@
19.1559
19.1560 section {* Closed CDI *}
19.1561
19.1562 -definition
19.1563 - closed_cdi where
19.1564 - "closed_cdi M \<longleftrightarrow>
19.1565 - sets M \<subseteq> Pow (space M) &
19.1566 - (\<forall>s \<in> sets M. space M - s \<in> sets M) &
19.1567 - (\<forall>A. (range A \<subseteq> sets M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
19.1568 - (\<Union>i. A i) \<in> sets M) &
19.1569 - (\<forall>A. (range A \<subseteq> sets M) & disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M)"
19.1570 +definition closed_cdi where
19.1571 + "closed_cdi \<Omega> M \<longleftrightarrow>
19.1572 + M \<subseteq> Pow \<Omega> &
19.1573 + (\<forall>s \<in> M. \<Omega> - s \<in> M) &
19.1574 + (\<forall>A. (range A \<subseteq> M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
19.1575 + (\<Union>i. A i) \<in> M) &
19.1576 + (\<forall>A. (range A \<subseteq> M) & disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
19.1577
19.1578 inductive_set
19.1579 - smallest_ccdi_sets :: "('a, 'b) algebra_scheme \<Rightarrow> 'a set set"
19.1580 - for M
19.1581 + smallest_ccdi_sets :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set"
19.1582 + for \<Omega> M
19.1583 where
19.1584 Basic [intro]:
19.1585 - "a \<in> sets M \<Longrightarrow> a \<in> smallest_ccdi_sets M"
19.1586 + "a \<in> M \<Longrightarrow> a \<in> smallest_ccdi_sets \<Omega> M"
19.1587 | Compl [intro]:
19.1588 - "a \<in> smallest_ccdi_sets M \<Longrightarrow> space M - a \<in> smallest_ccdi_sets M"
19.1589 + "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> \<Omega> - a \<in> smallest_ccdi_sets \<Omega> M"
19.1590 | Inc:
19.1591 - "range A \<in> Pow(smallest_ccdi_sets M) \<Longrightarrow> A 0 = {} \<Longrightarrow> (\<And>n. A n \<subseteq> A (Suc n))
19.1592 - \<Longrightarrow> (\<Union>i. A i) \<in> smallest_ccdi_sets M"
19.1593 + "range A \<in> Pow(smallest_ccdi_sets \<Omega> M) \<Longrightarrow> A 0 = {} \<Longrightarrow> (\<And>n. A n \<subseteq> A (Suc n))
19.1594 + \<Longrightarrow> (\<Union>i. A i) \<in> smallest_ccdi_sets \<Omega> M"
19.1595 | Disj:
19.1596 - "range A \<in> Pow(smallest_ccdi_sets M) \<Longrightarrow> disjoint_family A
19.1597 - \<Longrightarrow> (\<Union>i::nat. A i) \<in> smallest_ccdi_sets M"
19.1598 + "range A \<in> Pow(smallest_ccdi_sets \<Omega> M) \<Longrightarrow> disjoint_family A
19.1599 + \<Longrightarrow> (\<Union>i::nat. A i) \<in> smallest_ccdi_sets \<Omega> M"
19.1600
19.1601 +lemma (in subset_class) smallest_closed_cdi1: "M \<subseteq> smallest_ccdi_sets \<Omega> M"
19.1602 + by auto
19.1603
19.1604 -definition
19.1605 - smallest_closed_cdi where
19.1606 - "smallest_closed_cdi M = (|space = space M, sets = smallest_ccdi_sets M|)"
19.1607 -
19.1608 -lemma space_smallest_closed_cdi [simp]:
19.1609 - "space (smallest_closed_cdi M) = space M"
19.1610 - by (simp add: smallest_closed_cdi_def)
19.1611 -
19.1612 -lemma (in algebra) smallest_closed_cdi1: "sets M \<subseteq> sets (smallest_closed_cdi M)"
19.1613 - by (auto simp add: smallest_closed_cdi_def)
19.1614 -
19.1615 -lemma (in algebra) smallest_ccdi_sets:
19.1616 - "smallest_ccdi_sets M \<subseteq> Pow (space M)"
19.1617 +lemma (in subset_class) smallest_ccdi_sets: "smallest_ccdi_sets \<Omega> M \<subseteq> Pow \<Omega>"
19.1618 apply (rule subsetI)
19.1619 apply (erule smallest_ccdi_sets.induct)
19.1620 apply (auto intro: range_subsetD dest: sets_into_space)
19.1621 done
19.1622
19.1623 -lemma (in algebra) smallest_closed_cdi2: "closed_cdi (smallest_closed_cdi M)"
19.1624 - apply (auto simp add: closed_cdi_def smallest_closed_cdi_def smallest_ccdi_sets)
19.1625 +lemma (in subset_class) smallest_closed_cdi2: "closed_cdi \<Omega> (smallest_ccdi_sets \<Omega> M)"
19.1626 + apply (auto simp add: closed_cdi_def smallest_ccdi_sets)
19.1627 apply (blast intro: smallest_ccdi_sets.Inc smallest_ccdi_sets.Disj) +
19.1628 done
19.1629
19.1630 -lemma (in algebra) smallest_closed_cdi3:
19.1631 - "sets (smallest_closed_cdi M) \<subseteq> Pow (space M)"
19.1632 - by (simp add: smallest_closed_cdi_def smallest_ccdi_sets)
19.1633 -
19.1634 -lemma closed_cdi_subset: "closed_cdi M \<Longrightarrow> sets M \<subseteq> Pow (space M)"
19.1635 +lemma closed_cdi_subset: "closed_cdi \<Omega> M \<Longrightarrow> M \<subseteq> Pow \<Omega>"
19.1636 by (simp add: closed_cdi_def)
19.1637
19.1638 -lemma closed_cdi_Compl: "closed_cdi M \<Longrightarrow> s \<in> sets M \<Longrightarrow> space M - s \<in> sets M"
19.1639 +lemma closed_cdi_Compl: "closed_cdi \<Omega> M \<Longrightarrow> s \<in> M \<Longrightarrow> \<Omega> - s \<in> M"
19.1640 by (simp add: closed_cdi_def)
19.1641
19.1642 lemma closed_cdi_Inc:
19.1643 - "closed_cdi M \<Longrightarrow> range A \<subseteq> sets M \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n)) \<Longrightarrow>
19.1644 - (\<Union>i. A i) \<in> sets M"
19.1645 + "closed_cdi \<Omega> M \<Longrightarrow> range A \<subseteq> M \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n)) \<Longrightarrow> (\<Union>i. A i) \<in> M"
19.1646 by (simp add: closed_cdi_def)
19.1647
19.1648 lemma closed_cdi_Disj:
19.1649 - "closed_cdi M \<Longrightarrow> range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
19.1650 + "closed_cdi \<Omega> M \<Longrightarrow> range A \<subseteq> M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
19.1651 by (simp add: closed_cdi_def)
19.1652
19.1653 lemma closed_cdi_Un:
19.1654 - assumes cdi: "closed_cdi M" and empty: "{} \<in> sets M"
19.1655 - and A: "A \<in> sets M" and B: "B \<in> sets M"
19.1656 + assumes cdi: "closed_cdi \<Omega> M" and empty: "{} \<in> M"
19.1657 + and A: "A \<in> M" and B: "B \<in> M"
19.1658 and disj: "A \<inter> B = {}"
19.1659 - shows "A \<union> B \<in> sets M"
19.1660 + shows "A \<union> B \<in> M"
19.1661 proof -
19.1662 - have ra: "range (binaryset A B) \<subseteq> sets M"
19.1663 + have ra: "range (binaryset A B) \<subseteq> M"
19.1664 by (simp add: range_binaryset_eq empty A B)
19.1665 have di: "disjoint_family (binaryset A B)" using disj
19.1666 by (simp add: disjoint_family_on_def binaryset_def Int_commute)
19.1667 @@ -1196,11 +1404,11 @@
19.1668 qed
19.1669
19.1670 lemma (in algebra) smallest_ccdi_sets_Un:
19.1671 - assumes A: "A \<in> smallest_ccdi_sets M" and B: "B \<in> smallest_ccdi_sets M"
19.1672 + assumes A: "A \<in> smallest_ccdi_sets \<Omega> M" and B: "B \<in> smallest_ccdi_sets \<Omega> M"
19.1673 and disj: "A \<inter> B = {}"
19.1674 - shows "A \<union> B \<in> smallest_ccdi_sets M"
19.1675 + shows "A \<union> B \<in> smallest_ccdi_sets \<Omega> M"
19.1676 proof -
19.1677 - have ra: "range (binaryset A B) \<in> Pow (smallest_ccdi_sets M)"
19.1678 + have ra: "range (binaryset A B) \<in> Pow (smallest_ccdi_sets \<Omega> M)"
19.1679 by (simp add: range_binaryset_eq A B smallest_ccdi_sets.Basic)
19.1680 have di: "disjoint_family (binaryset A B)" using disj
19.1681 by (simp add: disjoint_family_on_def binaryset_def Int_commute)
19.1682 @@ -1210,33 +1418,32 @@
19.1683 qed
19.1684
19.1685 lemma (in algebra) smallest_ccdi_sets_Int1:
19.1686 - assumes a: "a \<in> sets M"
19.1687 - shows "b \<in> smallest_ccdi_sets M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets M"
19.1688 + assumes a: "a \<in> M"
19.1689 + shows "b \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M"
19.1690 proof (induct rule: smallest_ccdi_sets.induct)
19.1691 case (Basic x)
19.1692 thus ?case
19.1693 by (metis a Int smallest_ccdi_sets.Basic)
19.1694 next
19.1695 case (Compl x)
19.1696 - have "a \<inter> (space M - x) = space M - ((space M - a) \<union> (a \<inter> x))"
19.1697 + have "a \<inter> (\<Omega> - x) = \<Omega> - ((\<Omega> - a) \<union> (a \<inter> x))"
19.1698 by blast
19.1699 - also have "... \<in> smallest_ccdi_sets M"
19.1700 + also have "... \<in> smallest_ccdi_sets \<Omega> M"
19.1701 by (metis smallest_ccdi_sets.Compl a Compl(2) Diff_Int2 Diff_Int_distrib2
19.1702 - Diff_disjoint Int_Diff Int_empty_right Un_commute
19.1703 - smallest_ccdi_sets.Basic smallest_ccdi_sets.Compl
19.1704 - smallest_ccdi_sets_Un)
19.1705 + Diff_disjoint Int_Diff Int_empty_right smallest_ccdi_sets_Un
19.1706 + smallest_ccdi_sets.Basic smallest_ccdi_sets.Compl)
19.1707 finally show ?case .
19.1708 next
19.1709 case (Inc A)
19.1710 have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)"
19.1711 by blast
19.1712 - have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets M)" using Inc
19.1713 + have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Inc
19.1714 by blast
19.1715 moreover have "(\<lambda>i. a \<inter> A i) 0 = {}"
19.1716 by (simp add: Inc)
19.1717 moreover have "!!n. (\<lambda>i. a \<inter> A i) n \<subseteq> (\<lambda>i. a \<inter> A i) (Suc n)" using Inc
19.1718 by blast
19.1719 - ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets M"
19.1720 + ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets \<Omega> M"
19.1721 by (rule smallest_ccdi_sets.Inc)
19.1722 show ?case
19.1723 by (metis 1 2)
19.1724 @@ -1244,11 +1451,11 @@
19.1725 case (Disj A)
19.1726 have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)"
19.1727 by blast
19.1728 - have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets M)" using Disj
19.1729 + have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Disj
19.1730 by blast
19.1731 moreover have "disjoint_family (\<lambda>i. a \<inter> A i)" using Disj
19.1732 by (auto simp add: disjoint_family_on_def)
19.1733 - ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets M"
19.1734 + ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets \<Omega> M"
19.1735 by (rule smallest_ccdi_sets.Disj)
19.1736 show ?case
19.1737 by (metis 1 2)
19.1738 @@ -1256,17 +1463,17 @@
19.1739
19.1740
19.1741 lemma (in algebra) smallest_ccdi_sets_Int:
19.1742 - assumes b: "b \<in> smallest_ccdi_sets M"
19.1743 - shows "a \<in> smallest_ccdi_sets M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets M"
19.1744 + assumes b: "b \<in> smallest_ccdi_sets \<Omega> M"
19.1745 + shows "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M"
19.1746 proof (induct rule: smallest_ccdi_sets.induct)
19.1747 case (Basic x)
19.1748 thus ?case
19.1749 by (metis b smallest_ccdi_sets_Int1)
19.1750 next
19.1751 case (Compl x)
19.1752 - have "(space M - x) \<inter> b = space M - (x \<inter> b \<union> (space M - b))"
19.1753 + have "(\<Omega> - x) \<inter> b = \<Omega> - (x \<inter> b \<union> (\<Omega> - b))"
19.1754 by blast
19.1755 - also have "... \<in> smallest_ccdi_sets M"
19.1756 + also have "... \<in> smallest_ccdi_sets \<Omega> M"
19.1757 by (metis Compl(2) Diff_disjoint Int_Diff Int_commute Int_empty_right b
19.1758 smallest_ccdi_sets.Compl smallest_ccdi_sets_Un)
19.1759 finally show ?case .
19.1760 @@ -1274,13 +1481,13 @@
19.1761 case (Inc A)
19.1762 have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b"
19.1763 by blast
19.1764 - have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets M)" using Inc
19.1765 + have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Inc
19.1766 by blast
19.1767 moreover have "(\<lambda>i. A i \<inter> b) 0 = {}"
19.1768 by (simp add: Inc)
19.1769 moreover have "!!n. (\<lambda>i. A i \<inter> b) n \<subseteq> (\<lambda>i. A i \<inter> b) (Suc n)" using Inc
19.1770 by blast
19.1771 - ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets M"
19.1772 + ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets \<Omega> M"
19.1773 by (rule smallest_ccdi_sets.Inc)
19.1774 show ?case
19.1775 by (metis 1 2)
19.1776 @@ -1288,39 +1495,34 @@
19.1777 case (Disj A)
19.1778 have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b"
19.1779 by blast
19.1780 - have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets M)" using Disj
19.1781 + have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Disj
19.1782 by blast
19.1783 moreover have "disjoint_family (\<lambda>i. A i \<inter> b)" using Disj
19.1784 by (auto simp add: disjoint_family_on_def)
19.1785 - ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets M"
19.1786 + ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets \<Omega> M"
19.1787 by (rule smallest_ccdi_sets.Disj)
19.1788 show ?case
19.1789 by (metis 1 2)
19.1790 qed
19.1791
19.1792 -lemma (in algebra) sets_smallest_closed_cdi_Int:
19.1793 - "a \<in> sets (smallest_closed_cdi M) \<Longrightarrow> b \<in> sets (smallest_closed_cdi M)
19.1794 - \<Longrightarrow> a \<inter> b \<in> sets (smallest_closed_cdi M)"
19.1795 - by (simp add: smallest_ccdi_sets_Int smallest_closed_cdi_def)
19.1796 -
19.1797 lemma (in algebra) sigma_property_disjoint_lemma:
19.1798 - assumes sbC: "sets M \<subseteq> C"
19.1799 - and ccdi: "closed_cdi (|space = space M, sets = C|)"
19.1800 - shows "sigma_sets (space M) (sets M) \<subseteq> C"
19.1801 + assumes sbC: "M \<subseteq> C"
19.1802 + and ccdi: "closed_cdi \<Omega> C"
19.1803 + shows "sigma_sets \<Omega> M \<subseteq> C"
19.1804 proof -
19.1805 - have "smallest_ccdi_sets M \<in> {B . sets M \<subseteq> B \<and> sigma_algebra (|space = space M, sets = B|)}"
19.1806 + have "smallest_ccdi_sets \<Omega> M \<in> {B . M \<subseteq> B \<and> sigma_algebra \<Omega> B}"
19.1807 apply (auto simp add: sigma_algebra_disjoint_iff algebra_iff_Int
19.1808 smallest_ccdi_sets_Int)
19.1809 apply (metis Union_Pow_eq Union_upper subsetD smallest_ccdi_sets)
19.1810 apply (blast intro: smallest_ccdi_sets.Disj)
19.1811 done
19.1812 - hence "sigma_sets (space M) (sets M) \<subseteq> smallest_ccdi_sets M"
19.1813 + hence "sigma_sets (\<Omega>) (M) \<subseteq> smallest_ccdi_sets \<Omega> M"
19.1814 by clarsimp
19.1815 - (drule sigma_algebra.sigma_sets_subset [where a="sets M"], auto)
19.1816 + (drule sigma_algebra.sigma_sets_subset [where a="M"], auto)
19.1817 also have "... \<subseteq> C"
19.1818 proof
19.1819 fix x
19.1820 - assume x: "x \<in> smallest_ccdi_sets M"
19.1821 + assume x: "x \<in> smallest_ccdi_sets \<Omega> M"
19.1822 thus "x \<in> C"
19.1823 proof (induct rule: smallest_ccdi_sets.induct)
19.1824 case (Basic x)
19.1825 @@ -1344,21 +1546,21 @@
19.1826 qed
19.1827
19.1828 lemma (in algebra) sigma_property_disjoint:
19.1829 - assumes sbC: "sets M \<subseteq> C"
19.1830 - and compl: "!!s. s \<in> C \<inter> sigma_sets (space M) (sets M) \<Longrightarrow> space M - s \<in> C"
19.1831 - and inc: "!!A. range A \<subseteq> C \<inter> sigma_sets (space M) (sets M)
19.1832 + assumes sbC: "M \<subseteq> C"
19.1833 + and compl: "!!s. s \<in> C \<inter> sigma_sets (\<Omega>) (M) \<Longrightarrow> \<Omega> - s \<in> C"
19.1834 + and inc: "!!A. range A \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)
19.1835 \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n))
19.1836 \<Longrightarrow> (\<Union>i. A i) \<in> C"
19.1837 - and disj: "!!A. range A \<subseteq> C \<inter> sigma_sets (space M) (sets M)
19.1838 + and disj: "!!A. range A \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)
19.1839 \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> C"
19.1840 - shows "sigma_sets (space M) (sets M) \<subseteq> C"
19.1841 + shows "sigma_sets (\<Omega>) (M) \<subseteq> C"
19.1842 proof -
19.1843 - have "sigma_sets (space M) (sets M) \<subseteq> C \<inter> sigma_sets (space M) (sets M)"
19.1844 + have "sigma_sets (\<Omega>) (M) \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)"
19.1845 proof (rule sigma_property_disjoint_lemma)
19.1846 - show "sets M \<subseteq> C \<inter> sigma_sets (space M) (sets M)"
19.1847 + show "M \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)"
19.1848 by (metis Int_greatest Set.subsetI sbC sigma_sets.Basic)
19.1849 next
19.1850 - show "closed_cdi \<lparr>space = space M, sets = C \<inter> sigma_sets (space M) (sets M)\<rparr>"
19.1851 + show "closed_cdi \<Omega> (C \<inter> sigma_sets (\<Omega>) (M))"
19.1852 by (simp add: closed_cdi_def compl inc disj)
19.1853 (metis PowI Set.subsetI le_infI2 sigma_sets_into_sp space_closed
19.1854 IntE sigma_sets.Compl range_subsetD sigma_sets.Union)
19.1855 @@ -1370,97 +1572,97 @@
19.1856 section {* Dynkin systems *}
19.1857
19.1858 locale dynkin_system = subset_class +
19.1859 - assumes space: "space M \<in> sets M"
19.1860 - and compl[intro!]: "\<And>A. A \<in> sets M \<Longrightarrow> space M - A \<in> sets M"
19.1861 - and UN[intro!]: "\<And>A. disjoint_family A \<Longrightarrow> range A \<subseteq> sets M
19.1862 - \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
19.1863 + assumes space: "\<Omega> \<in> M"
19.1864 + and compl[intro!]: "\<And>A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M"
19.1865 + and UN[intro!]: "\<And>A. disjoint_family A \<Longrightarrow> range A \<subseteq> M
19.1866 + \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
19.1867
19.1868 -lemma (in dynkin_system) empty[intro, simp]: "{} \<in> sets M"
19.1869 - using space compl[of "space M"] by simp
19.1870 +lemma (in dynkin_system) empty[intro, simp]: "{} \<in> M"
19.1871 + using space compl[of "\<Omega>"] by simp
19.1872
19.1873 lemma (in dynkin_system) diff:
19.1874 - assumes sets: "D \<in> sets M" "E \<in> sets M" and "D \<subseteq> E"
19.1875 - shows "E - D \<in> sets M"
19.1876 + assumes sets: "D \<in> M" "E \<in> M" and "D \<subseteq> E"
19.1877 + shows "E - D \<in> M"
19.1878 proof -
19.1879 - let ?f = "\<lambda>x. if x = 0 then D else if x = Suc 0 then space M - E else {}"
19.1880 - have "range ?f = {D, space M - E, {}}"
19.1881 + let ?f = "\<lambda>x. if x = 0 then D else if x = Suc 0 then \<Omega> - E else {}"
19.1882 + have "range ?f = {D, \<Omega> - E, {}}"
19.1883 by (auto simp: image_iff)
19.1884 - moreover have "D \<union> (space M - E) = (\<Union>i. ?f i)"
19.1885 + moreover have "D \<union> (\<Omega> - E) = (\<Union>i. ?f i)"
19.1886 by (auto simp: image_iff split: split_if_asm)
19.1887 moreover
19.1888 then have "disjoint_family ?f" unfolding disjoint_family_on_def
19.1889 - using `D \<in> sets M`[THEN sets_into_space] `D \<subseteq> E` by auto
19.1890 - ultimately have "space M - (D \<union> (space M - E)) \<in> sets M"
19.1891 + using `D \<in> M`[THEN sets_into_space] `D \<subseteq> E` by auto
19.1892 + ultimately have "\<Omega> - (D \<union> (\<Omega> - E)) \<in> M"
19.1893 using sets by auto
19.1894 - also have "space M - (D \<union> (space M - E)) = E - D"
19.1895 + also have "\<Omega> - (D \<union> (\<Omega> - E)) = E - D"
19.1896 using assms sets_into_space by auto
19.1897 finally show ?thesis .
19.1898 qed
19.1899
19.1900 lemma dynkin_systemI:
19.1901 - assumes "\<And> A. A \<in> sets M \<Longrightarrow> A \<subseteq> space M" "space M \<in> sets M"
19.1902 - assumes "\<And> A. A \<in> sets M \<Longrightarrow> space M - A \<in> sets M"
19.1903 - assumes "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> sets M
19.1904 - \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
19.1905 - shows "dynkin_system M"
19.1906 + assumes "\<And> A. A \<in> M \<Longrightarrow> A \<subseteq> \<Omega>" "\<Omega> \<in> M"
19.1907 + assumes "\<And> A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M"
19.1908 + assumes "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> M
19.1909 + \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
19.1910 + shows "dynkin_system \<Omega> M"
19.1911 using assms by (auto simp: dynkin_system_def dynkin_system_axioms_def subset_class_def)
19.1912
19.1913 lemma dynkin_systemI':
19.1914 - assumes 1: "\<And> A. A \<in> sets M \<Longrightarrow> A \<subseteq> space M"
19.1915 - assumes empty: "{} \<in> sets M"
19.1916 - assumes Diff: "\<And> A. A \<in> sets M \<Longrightarrow> space M - A \<in> sets M"
19.1917 - assumes 2: "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> sets M
19.1918 - \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
19.1919 - shows "dynkin_system M"
19.1920 + assumes 1: "\<And> A. A \<in> M \<Longrightarrow> A \<subseteq> \<Omega>"
19.1921 + assumes empty: "{} \<in> M"
19.1922 + assumes Diff: "\<And> A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M"
19.1923 + assumes 2: "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> M
19.1924 + \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
19.1925 + shows "dynkin_system \<Omega> M"
19.1926 proof -
19.1927 - from Diff[OF empty] have "space M \<in> sets M" by auto
19.1928 + from Diff[OF empty] have "\<Omega> \<in> M" by auto
19.1929 from 1 this Diff 2 show ?thesis
19.1930 by (intro dynkin_systemI) auto
19.1931 qed
19.1932
19.1933 lemma dynkin_system_trivial:
19.1934 - shows "dynkin_system \<lparr> space = A, sets = Pow A \<rparr>"
19.1935 + shows "dynkin_system A (Pow A)"
19.1936 by (rule dynkin_systemI) auto
19.1937
19.1938 lemma sigma_algebra_imp_dynkin_system:
19.1939 - assumes "sigma_algebra M" shows "dynkin_system M"
19.1940 + assumes "sigma_algebra \<Omega> M" shows "dynkin_system \<Omega> M"
19.1941 proof -
19.1942 - interpret sigma_algebra M by fact
19.1943 + interpret sigma_algebra \<Omega> M by fact
19.1944 show ?thesis using sets_into_space by (fastforce intro!: dynkin_systemI)
19.1945 qed
19.1946
19.1947 subsection "Intersection stable algebras"
19.1948
19.1949 -definition "Int_stable M \<longleftrightarrow> (\<forall> a \<in> sets M. \<forall> b \<in> sets M. a \<inter> b \<in> sets M)"
19.1950 +definition "Int_stable M \<longleftrightarrow> (\<forall> a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)"
19.1951
19.1952 lemma (in algebra) Int_stable: "Int_stable M"
19.1953 unfolding Int_stable_def by auto
19.1954
19.1955 lemma Int_stableI:
19.1956 - "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> Int_stable \<lparr> space = \<Omega>, sets = A \<rparr>"
19.1957 + "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> Int_stable A"
19.1958 unfolding Int_stable_def by auto
19.1959
19.1960 lemma Int_stableD:
19.1961 - "Int_stable M \<Longrightarrow> a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b \<in> sets M"
19.1962 + "Int_stable M \<Longrightarrow> a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<inter> b \<in> M"
19.1963 unfolding Int_stable_def by auto
19.1964
19.1965 lemma (in dynkin_system) sigma_algebra_eq_Int_stable:
19.1966 - "sigma_algebra M \<longleftrightarrow> Int_stable M"
19.1967 + "sigma_algebra \<Omega> M \<longleftrightarrow> Int_stable M"
19.1968 proof
19.1969 - assume "sigma_algebra M" then show "Int_stable M"
19.1970 + assume "sigma_algebra \<Omega> M" then show "Int_stable M"
19.1971 unfolding sigma_algebra_def using algebra.Int_stable by auto
19.1972 next
19.1973 assume "Int_stable M"
19.1974 - show "sigma_algebra M"
19.1975 + show "sigma_algebra \<Omega> M"
19.1976 unfolding sigma_algebra_disjoint_iff algebra_iff_Un
19.1977 proof (intro conjI ballI allI impI)
19.1978 - show "sets M \<subseteq> Pow (space M)" using sets_into_space by auto
19.1979 + show "M \<subseteq> Pow (\<Omega>)" using sets_into_space by auto
19.1980 next
19.1981 - fix A B assume "A \<in> sets M" "B \<in> sets M"
19.1982 - then have "A \<union> B = space M - ((space M - A) \<inter> (space M - B))"
19.1983 - "space M - A \<in> sets M" "space M - B \<in> sets M"
19.1984 + fix A B assume "A \<in> M" "B \<in> M"
19.1985 + then have "A \<union> B = \<Omega> - ((\<Omega> - A) \<inter> (\<Omega> - B))"
19.1986 + "\<Omega> - A \<in> M" "\<Omega> - B \<in> M"
19.1987 using sets_into_space by auto
19.1988 - then show "A \<union> B \<in> sets M"
19.1989 + then show "A \<union> B \<in> M"
19.1990 using `Int_stable M` unfolding Int_stable_def by auto
19.1991 qed auto
19.1992 qed
19.1993 @@ -1468,217 +1670,148 @@
19.1994 subsection "Smallest Dynkin systems"
19.1995
19.1996 definition dynkin where
19.1997 - "dynkin M = \<lparr> space = space M,
19.1998 - sets = \<Inter>{D. dynkin_system \<lparr> space = space M, sets = D \<rparr> \<and> sets M \<subseteq> D},
19.1999 - \<dots> = more M \<rparr>"
19.2000 + "dynkin \<Omega> M = (\<Inter>{D. dynkin_system \<Omega> D \<and> M \<subseteq> D})"
19.2001
19.2002 lemma dynkin_system_dynkin:
19.2003 - assumes "sets M \<subseteq> Pow (space M)"
19.2004 - shows "dynkin_system (dynkin M)"
19.2005 + assumes "M \<subseteq> Pow (\<Omega>)"
19.2006 + shows "dynkin_system \<Omega> (dynkin \<Omega> M)"
19.2007 proof (rule dynkin_systemI)
19.2008 - fix A assume "A \<in> sets (dynkin M)"
19.2009 + fix A assume "A \<in> dynkin \<Omega> M"
19.2010 moreover
19.2011 - { fix D assume "A \<in> D" and d: "dynkin_system \<lparr> space = space M, sets = D \<rparr>"
19.2012 - then have "A \<subseteq> space M" by (auto simp: dynkin_system_def subset_class_def) }
19.2013 - moreover have "{D. dynkin_system \<lparr> space = space M, sets = D\<rparr> \<and> sets M \<subseteq> D} \<noteq> {}"
19.2014 + { fix D assume "A \<in> D" and d: "dynkin_system \<Omega> D"
19.2015 + then have "A \<subseteq> \<Omega>" by (auto simp: dynkin_system_def subset_class_def) }
19.2016 + moreover have "{D. dynkin_system \<Omega> D \<and> M \<subseteq> D} \<noteq> {}"
19.2017 using assms dynkin_system_trivial by fastforce
19.2018 - ultimately show "A \<subseteq> space (dynkin M)"
19.2019 + ultimately show "A \<subseteq> \<Omega>"
19.2020 unfolding dynkin_def using assms
19.2021 - by simp (metis dynkin_system_def subset_class_def in_mono)
19.2022 + by auto
19.2023 next
19.2024 - show "space (dynkin M) \<in> sets (dynkin M)"
19.2025 + show "\<Omega> \<in> dynkin \<Omega> M"
19.2026 unfolding dynkin_def using dynkin_system.space by fastforce
19.2027 next
19.2028 - fix A assume "A \<in> sets (dynkin M)"
19.2029 - then show "space (dynkin M) - A \<in> sets (dynkin M)"
19.2030 + fix A assume "A \<in> dynkin \<Omega> M"
19.2031 + then show "\<Omega> - A \<in> dynkin \<Omega> M"
19.2032 unfolding dynkin_def using dynkin_system.compl by force
19.2033 next
19.2034 fix A :: "nat \<Rightarrow> 'a set"
19.2035 - assume A: "disjoint_family A" "range A \<subseteq> sets (dynkin M)"
19.2036 - show "(\<Union>i. A i) \<in> sets (dynkin M)" unfolding dynkin_def
19.2037 + assume A: "disjoint_family A" "range A \<subseteq> dynkin \<Omega> M"
19.2038 + show "(\<Union>i. A i) \<in> dynkin \<Omega> M" unfolding dynkin_def
19.2039 proof (simp, safe)
19.2040 - fix D assume "dynkin_system \<lparr>space = space M, sets = D\<rparr>" "sets M \<subseteq> D"
19.2041 - with A have "(\<Union>i. A i) \<in> sets \<lparr>space = space M, sets = D\<rparr>"
19.2042 + fix D assume "dynkin_system \<Omega> D" "M \<subseteq> D"
19.2043 + with A have "(\<Union>i. A i) \<in> D"
19.2044 by (intro dynkin_system.UN) (auto simp: dynkin_def)
19.2045 then show "(\<Union>i. A i) \<in> D" by auto
19.2046 qed
19.2047 qed
19.2048
19.2049 -lemma dynkin_Basic[intro]:
19.2050 - "A \<in> sets M \<Longrightarrow> A \<in> sets (dynkin M)"
19.2051 - unfolding dynkin_def by auto
19.2052 -
19.2053 -lemma dynkin_space[simp]:
19.2054 - "space (dynkin M) = space M"
19.2055 +lemma dynkin_Basic[intro]: "A \<in> M \<Longrightarrow> A \<in> dynkin \<Omega> M"
19.2056 unfolding dynkin_def by auto
19.2057
19.2058 lemma (in dynkin_system) restricted_dynkin_system:
19.2059 - assumes "D \<in> sets M"
19.2060 - shows "dynkin_system \<lparr> space = space M,
19.2061 - sets = {Q. Q \<subseteq> space M \<and> Q \<inter> D \<in> sets M} \<rparr>"
19.2062 + assumes "D \<in> M"
19.2063 + shows "dynkin_system \<Omega> {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> D \<in> M}"
19.2064 proof (rule dynkin_systemI, simp_all)
19.2065 - have "space M \<inter> D = D"
19.2066 - using `D \<in> sets M` sets_into_space by auto
19.2067 - then show "space M \<inter> D \<in> sets M"
19.2068 - using `D \<in> sets M` by auto
19.2069 + have "\<Omega> \<inter> D = D"
19.2070 + using `D \<in> M` sets_into_space by auto
19.2071 + then show "\<Omega> \<inter> D \<in> M"
19.2072 + using `D \<in> M` by auto
19.2073 next
19.2074 - fix A assume "A \<subseteq> space M \<and> A \<inter> D \<in> sets M"
19.2075 - moreover have "(space M - A) \<inter> D = (space M - (A \<inter> D)) - (space M - D)"
19.2076 + fix A assume "A \<subseteq> \<Omega> \<and> A \<inter> D \<in> M"
19.2077 + moreover have "(\<Omega> - A) \<inter> D = (\<Omega> - (A \<inter> D)) - (\<Omega> - D)"
19.2078 by auto
19.2079 - ultimately show "space M - A \<subseteq> space M \<and> (space M - A) \<inter> D \<in> sets M"
19.2080 - using `D \<in> sets M` by (auto intro: diff)
19.2081 + ultimately show "\<Omega> - A \<subseteq> \<Omega> \<and> (\<Omega> - A) \<inter> D \<in> M"
19.2082 + using `D \<in> M` by (auto intro: diff)
19.2083 next
19.2084 fix A :: "nat \<Rightarrow> 'a set"
19.2085 - assume "disjoint_family A" "range A \<subseteq> {Q. Q \<subseteq> space M \<and> Q \<inter> D \<in> sets M}"
19.2086 - then have "\<And>i. A i \<subseteq> space M" "disjoint_family (\<lambda>i. A i \<inter> D)"
19.2087 - "range (\<lambda>i. A i \<inter> D) \<subseteq> sets M" "(\<Union>x. A x) \<inter> D = (\<Union>x. A x \<inter> D)"
19.2088 + assume "disjoint_family A" "range A \<subseteq> {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> D \<in> M}"
19.2089 + then have "\<And>i. A i \<subseteq> \<Omega>" "disjoint_family (\<lambda>i. A i \<inter> D)"
19.2090 + "range (\<lambda>i. A i \<inter> D) \<subseteq> M" "(\<Union>x. A x) \<inter> D = (\<Union>x. A x \<inter> D)"
19.2091 by ((fastforce simp: disjoint_family_on_def)+)
19.2092 - then show "(\<Union>x. A x) \<subseteq> space M \<and> (\<Union>x. A x) \<inter> D \<in> sets M"
19.2093 + then show "(\<Union>x. A x) \<subseteq> \<Omega> \<and> (\<Union>x. A x) \<inter> D \<in> M"
19.2094 by (auto simp del: UN_simps)
19.2095 qed
19.2096
19.2097 lemma (in dynkin_system) dynkin_subset:
19.2098 - assumes "sets N \<subseteq> sets M"
19.2099 - assumes "space N = space M"
19.2100 - shows "sets (dynkin N) \<subseteq> sets M"
19.2101 + assumes "N \<subseteq> M"
19.2102 + shows "dynkin \<Omega> N \<subseteq> M"
19.2103 proof -
19.2104 - have "dynkin_system M" by default
19.2105 - then have "dynkin_system \<lparr>space = space N, sets = sets M \<rparr>"
19.2106 + have "dynkin_system \<Omega> M" by default
19.2107 + then have "dynkin_system \<Omega> M"
19.2108 using assms unfolding dynkin_system_def dynkin_system_axioms_def subset_class_def by simp
19.2109 - with `sets N \<subseteq> sets M` show ?thesis by (auto simp add: dynkin_def)
19.2110 + with `N \<subseteq> M` show ?thesis by (auto simp add: dynkin_def)
19.2111 qed
19.2112
19.2113 lemma sigma_eq_dynkin:
19.2114 - assumes sets: "sets M \<subseteq> Pow (space M)"
19.2115 + assumes sets: "M \<subseteq> Pow \<Omega>"
19.2116 assumes "Int_stable M"
19.2117 - shows "sigma M = dynkin M"
19.2118 + shows "sigma_sets \<Omega> M = dynkin \<Omega> M"
19.2119 proof -
19.2120 - have "sets (dynkin M) \<subseteq> sigma_sets (space M) (sets M)"
19.2121 + have "dynkin \<Omega> M \<subseteq> sigma_sets (\<Omega>) (M)"
19.2122 using sigma_algebra_imp_dynkin_system
19.2123 - unfolding dynkin_def sigma_def sigma_sets_least_sigma_algebra[OF sets] by auto
19.2124 + unfolding dynkin_def sigma_sets_least_sigma_algebra[OF sets] by auto
19.2125 moreover
19.2126 - interpret dynkin_system "dynkin M"
19.2127 + interpret dynkin_system \<Omega> "dynkin \<Omega> M"
19.2128 using dynkin_system_dynkin[OF sets] .
19.2129 - have "sigma_algebra (dynkin M)"
19.2130 + have "sigma_algebra \<Omega> (dynkin \<Omega> M)"
19.2131 unfolding sigma_algebra_eq_Int_stable Int_stable_def
19.2132 proof (intro ballI)
19.2133 - fix A B assume "A \<in> sets (dynkin M)" "B \<in> sets (dynkin M)"
19.2134 - let ?D = "\<lambda>E. \<lparr> space = space M,
19.2135 - sets = {Q. Q \<subseteq> space M \<and> Q \<inter> E \<in> sets (dynkin M)} \<rparr>"
19.2136 - have "sets M \<subseteq> sets (?D B)"
19.2137 + fix A B assume "A \<in> dynkin \<Omega> M" "B \<in> dynkin \<Omega> M"
19.2138 + let ?D = "\<lambda>E. {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> E \<in> dynkin \<Omega> M}"
19.2139 + have "M \<subseteq> ?D B"
19.2140 proof
19.2141 - fix E assume "E \<in> sets M"
19.2142 - then have "sets M \<subseteq> sets (?D E)" "E \<in> sets (dynkin M)"
19.2143 + fix E assume "E \<in> M"
19.2144 + then have "M \<subseteq> ?D E" "E \<in> dynkin \<Omega> M"
19.2145 using sets_into_space `Int_stable M` by (auto simp: Int_stable_def)
19.2146 - then have "sets (dynkin M) \<subseteq> sets (?D E)"
19.2147 - using restricted_dynkin_system `E \<in> sets (dynkin M)`
19.2148 + then have "dynkin \<Omega> M \<subseteq> ?D E"
19.2149 + using restricted_dynkin_system `E \<in> dynkin \<Omega> M`
19.2150 by (intro dynkin_system.dynkin_subset) simp_all
19.2151 - then have "B \<in> sets (?D E)"
19.2152 - using `B \<in> sets (dynkin M)` by auto
19.2153 - then have "E \<inter> B \<in> sets (dynkin M)"
19.2154 + then have "B \<in> ?D E"
19.2155 + using `B \<in> dynkin \<Omega> M` by auto
19.2156 + then have "E \<inter> B \<in> dynkin \<Omega> M"
19.2157 by (subst Int_commute) simp
19.2158 - then show "E \<in> sets (?D B)"
19.2159 - using sets `E \<in> sets M` by auto
19.2160 + then show "E \<in> ?D B"
19.2161 + using sets `E \<in> M` by auto
19.2162 qed
19.2163 - then have "sets (dynkin M) \<subseteq> sets (?D B)"
19.2164 - using restricted_dynkin_system `B \<in> sets (dynkin M)`
19.2165 + then have "dynkin \<Omega> M \<subseteq> ?D B"
19.2166 + using restricted_dynkin_system `B \<in> dynkin \<Omega> M`
19.2167 by (intro dynkin_system.dynkin_subset) simp_all
19.2168 - then show "A \<inter> B \<in> sets (dynkin M)"
19.2169 - using `A \<in> sets (dynkin M)` sets_into_space by auto
19.2170 + then show "A \<inter> B \<in> dynkin \<Omega> M"
19.2171 + using `A \<in> dynkin \<Omega> M` sets_into_space by auto
19.2172 qed
19.2173 - from sigma_algebra.sigma_sets_subset[OF this, of "sets M"]
19.2174 - have "sigma_sets (space M) (sets M) \<subseteq> sets (dynkin M)" by auto
19.2175 - ultimately have "sigma_sets (space M) (sets M) = sets (dynkin M)" by auto
19.2176 + from sigma_algebra.sigma_sets_subset[OF this, of "M"]
19.2177 + have "sigma_sets (\<Omega>) (M) \<subseteq> dynkin \<Omega> M" by auto
19.2178 + ultimately have "sigma_sets (\<Omega>) (M) = dynkin \<Omega> M" by auto
19.2179 then show ?thesis
19.2180 - by (auto intro!: algebra.equality simp: sigma_def dynkin_def)
19.2181 + by (auto simp: dynkin_def)
19.2182 qed
19.2183
19.2184 lemma (in dynkin_system) dynkin_idem:
19.2185 - "dynkin M = M"
19.2186 + "dynkin \<Omega> M = M"
19.2187 proof -
19.2188 - have "sets (dynkin M) = sets M"
19.2189 + have "dynkin \<Omega> M = M"
19.2190 proof
19.2191 - show "sets M \<subseteq> sets (dynkin M)"
19.2192 + show "M \<subseteq> dynkin \<Omega> M"
19.2193 using dynkin_Basic by auto
19.2194 - show "sets (dynkin M) \<subseteq> sets M"
19.2195 + show "dynkin \<Omega> M \<subseteq> M"
19.2196 by (intro dynkin_subset) auto
19.2197 qed
19.2198 then show ?thesis
19.2199 - by (auto intro!: algebra.equality simp: dynkin_def)
19.2200 + by (auto simp: dynkin_def)
19.2201 qed
19.2202
19.2203 lemma (in dynkin_system) dynkin_lemma:
19.2204 assumes "Int_stable E"
19.2205 - and E: "sets E \<subseteq> sets M" "space E = space M" "sets M \<subseteq> sets (sigma E)"
19.2206 - shows "sets (sigma E) = sets M"
19.2207 + and E: "E \<subseteq> M" "M \<subseteq> sigma_sets \<Omega> E"
19.2208 + shows "sigma_sets \<Omega> E = M"
19.2209 proof -
19.2210 - have "sets E \<subseteq> Pow (space E)"
19.2211 + have "E \<subseteq> Pow \<Omega>"
19.2212 using E sets_into_space by force
19.2213 - then have "sigma E = dynkin E"
19.2214 + then have "sigma_sets \<Omega> E = dynkin \<Omega> E"
19.2215 using `Int_stable E` by (rule sigma_eq_dynkin)
19.2216 - moreover then have "sets (dynkin E) = sets M"
19.2217 - using assms dynkin_subset[OF E(1,2)] by simp
19.2218 + moreover then have "dynkin \<Omega> E = M"
19.2219 + using assms dynkin_subset[OF E(1)] by simp
19.2220 ultimately show ?thesis
19.2221 - using assms by (auto intro!: algebra.equality simp: dynkin_def)
19.2222 -qed
19.2223 -
19.2224 -subsection "Sigma algebras on finite sets"
19.2225 -
19.2226 -locale finite_sigma_algebra = sigma_algebra +
19.2227 - assumes finite_space: "finite (space M)"
19.2228 - and sets_eq_Pow[simp]: "sets M = Pow (space M)"
19.2229 -
19.2230 -lemma (in finite_sigma_algebra) sets_image_space_eq_Pow:
19.2231 - "sets (image_space X) = Pow (space (image_space X))"
19.2232 -proof safe
19.2233 - fix x S assume "S \<in> sets (image_space X)" "x \<in> S"
19.2234 - then show "x \<in> space (image_space X)"
19.2235 - using sets_into_space by (auto intro!: imageI simp: image_space_def)
19.2236 -next
19.2237 - fix S assume "S \<subseteq> space (image_space X)"
19.2238 - then obtain S' where "S = X`S'" "S'\<in>sets M"
19.2239 - by (auto simp: subset_image_iff image_space_def)
19.2240 - then show "S \<in> sets (image_space X)"
19.2241 - by (auto simp: image_space_def)
19.2242 -qed
19.2243 -
19.2244 -lemma measurable_sigma_sigma:
19.2245 - assumes M: "sets M \<subseteq> Pow (space M)" and N: "sets N \<subseteq> Pow (space N)"
19.2246 - shows "f \<in> measurable M N \<Longrightarrow> f \<in> measurable (sigma M) (sigma N)"
19.2247 - using sigma_algebra.measurable_subset[OF sigma_algebra_sigma[OF M], of N]
19.2248 - using measurable_up_sigma[of M N] N by auto
19.2249 -
19.2250 -lemma (in sigma_algebra) measurable_Least:
19.2251 - assumes meas: "\<And>i::nat. {x\<in>space M. P i x} \<in> sets M"
19.2252 - shows "(\<lambda>x. LEAST j. P j x) -` A \<inter> space M \<in> sets M"
19.2253 -proof -
19.2254 - { fix i have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M \<in> sets M"
19.2255 - proof cases
19.2256 - assume i: "(LEAST j. False) = i"
19.2257 - have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
19.2258 - {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x})) \<union> (space M - (\<Union>i. {x\<in>space M. P i x}))"
19.2259 - by (simp add: set_eq_iff, safe)
19.2260 - (insert i, auto dest: Least_le intro: LeastI intro!: Least_equality)
19.2261 - with meas show ?thesis
19.2262 - by (auto intro!: Int)
19.2263 - next
19.2264 - assume i: "(LEAST j. False) \<noteq> i"
19.2265 - then have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
19.2266 - {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x}))"
19.2267 - proof (simp add: set_eq_iff, safe)
19.2268 - fix x assume neq: "(LEAST j. False) \<noteq> (LEAST j. P j x)"
19.2269 - have "\<exists>j. P j x"
19.2270 - by (rule ccontr) (insert neq, auto)
19.2271 - then show "P (LEAST j. P j x) x" by (rule LeastI_ex)
19.2272 - qed (auto dest: Least_le intro!: Least_equality)
19.2273 - with meas show ?thesis
19.2274 - by (auto intro!: Int)
19.2275 - qed }
19.2276 - then have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) \<in> sets M"
19.2277 - by (intro countable_UN) auto
19.2278 - moreover have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) =
19.2279 - (\<lambda>x. LEAST j. P j x) -` A \<inter> space M" by auto
19.2280 - ultimately show ?thesis by auto
19.2281 + using assms by (auto simp: dynkin_def)
19.2282 qed
19.2283
19.2284 end
20.1 --- a/src/HOL/Probability/ex/Dining_Cryptographers.thy Mon Apr 23 12:23:23 2012 +0100
20.2 +++ b/src/HOL/Probability/ex/Dining_Cryptographers.thy Mon Apr 23 12:14:35 2012 +0200
20.3 @@ -8,29 +8,6 @@
20.4 lemma Ex1_eq: "\<exists>! x. P x \<Longrightarrow> P x \<Longrightarrow> P y \<Longrightarrow> x = y"
20.5 by auto
20.6
20.7 -locale finite_space =
20.8 - fixes S :: "'a set"
20.9 - assumes finite[simp]: "finite S"
20.10 - and not_empty[simp]: "S \<noteq> {}"
20.11 -
20.12 -definition (in finite_space) "M = \<lparr> space = S, sets = Pow S,
20.13 - measure = \<lambda>A. ereal (card A / card S) \<rparr>"
20.14 -
20.15 -lemma (in finite_space)
20.16 - shows space_M[simp]: "space M = S"
20.17 - and sets_M[simp]: "sets M = Pow S"
20.18 - by (simp_all add: M_def)
20.19 -
20.20 -sublocale finite_space \<subseteq> finite_measure_space M
20.21 - by (rule finite_measure_spaceI)
20.22 - (simp_all add: M_def real_of_nat_def)
20.23 -
20.24 -sublocale finite_space \<subseteq> information_space M 2
20.25 - by default (simp_all add: M_def one_ereal_def)
20.26 -
20.27 -lemma (in finite_space) \<mu>'_eq[simp]: "\<mu>' A = (if A \<subseteq> S then card A / card S else 0)"
20.28 - unfolding \<mu>'_def by (auto simp: M_def)
20.29 -
20.30 section "Define the state space"
20.31
20.32 text {*
20.33 @@ -68,7 +45,7 @@
20.34 definition "dining_cryptographers =
20.35 ({None} \<union> Some ` {0..<n}) \<times> {xs :: bool list. length xs = n}"
20.36 definition "payer dc = fst dc"
20.37 -definition coin :: "(nat option \<times> bool list) => nat \<Rightarrow> bool" where
20.38 +definition coin :: "(nat option \<times> bool list) \<Rightarrow> nat \<Rightarrow> bool" where
20.39 "coin dc c = snd dc ! (c mod n)"
20.40 definition "inversion dc =
20.41 map (\<lambda>c. (payer dc = Some c) \<noteq> (coin dc c \<noteq> coin dc (c + 1))) [0..<n]"
20.42 @@ -417,15 +394,12 @@
20.43
20.44 end
20.45
20.46 +sublocale dining_cryptographers_space \<subseteq> prob_space "uniform_count_measure dc_crypto"
20.47 + by (rule prob_space_uniform_count_measure[OF finite_dc_crypto])
20.48 + (insert n_gt_3, auto simp: dc_crypto intro: exI[of _ "replicate n True"])
20.49
20.50 -sublocale
20.51 - dining_cryptographers_space \<subseteq> finite_space "dc_crypto"
20.52 -proof
20.53 - show "finite dc_crypto" using finite_dc_crypto .
20.54 - show "dc_crypto \<noteq> {}"
20.55 - unfolding dc_crypto
20.56 - using n_gt_3 by (auto intro: exI[of _ "replicate n True"])
20.57 -qed
20.58 +sublocale dining_cryptographers_space \<subseteq> information_space "uniform_count_measure dc_crypto" 2
20.59 + by default auto
20.60
20.61 notation (in dining_cryptographers_space)
20.62 mutual_information_Pow ("\<I>'( _ ; _ ')")
20.63 @@ -438,71 +412,64 @@
20.64
20.65 theorem (in dining_cryptographers_space)
20.66 "\<I>( inversion ; payer ) = 0"
20.67 -proof -
20.68 +proof (rule mutual_information_eq_0_simple)
20.69 have n: "0 < n" using n_gt_3 by auto
20.70 - have lists: "{xs. length xs = n} \<noteq> {}" using Ex_list_of_length by auto
20.71 have card_image_inversion:
20.72 "real (card (inversion ` dc_crypto)) = 2^n / 2"
20.73 unfolding card_image_inversion using `0 < n` by (cases n) auto
20.74
20.75 - let ?dIP = "distribution (\<lambda>x. (inversion x, payer x))"
20.76 - let ?dP = "distribution payer"
20.77 - let ?dI = "distribution inversion"
20.78 + show inversion: "simple_distributed (uniform_count_measure dc_crypto) inversion (\<lambda>x. 2 / 2^n)"
20.79 + proof (rule simple_distributedI)
20.80 + show "simple_function (uniform_count_measure dc_crypto) inversion"
20.81 + using finite_dc_crypto
20.82 + by (auto simp: simple_function_def space_uniform_count_measure sets_uniform_count_measure)
20.83 + fix x assume "x \<in> inversion ` space (uniform_count_measure dc_crypto)"
20.84 + moreover have "inversion -` {x} \<inter> dc_crypto = {dc \<in> dc_crypto. inversion dc = x}" by auto
20.85 + ultimately show "2 / 2^n = prob (inversion -` {x} \<inter> space (uniform_count_measure dc_crypto))"
20.86 + using `0 < n`
20.87 + by (simp add: card_inversion card_dc_crypto finite_dc_crypto
20.88 + subset_eq space_uniform_count_measure measure_uniform_count_measure)
20.89 + qed
20.90
20.91 - { have "\<H>(inversion|payer) =
20.92 - - (\<Sum>x\<in>inversion`dc_crypto. (\<Sum>z\<in>Some ` {0..<n}. ?dIP {(x, z)} * log 2 (?dIP {(x, z)} / ?dP {z})))"
20.93 - unfolding conditional_entropy_eq[OF simple_function_finite simple_function_finite]
20.94 - by (simp add: image_payer_dc_crypto setsum_Sigma)
20.95 - also have "... =
20.96 - - (\<Sum>x\<in>inversion`dc_crypto. (\<Sum>z\<in>Some ` {0..<n}. 2 / (real n * 2^n) * (1 - real n)))"
20.97 - unfolding neg_equal_iff_equal
20.98 - proof (rule setsum_cong[OF refl], rule setsum_cong[OF refl])
20.99 - fix x z assume x: "x \<in> inversion`dc_crypto" and z: "z \<in> Some ` {0..<n}"
20.100 - hence "(\<lambda>x. (inversion x, payer x)) -` {(x, z)} \<inter> dc_crypto =
20.101 - {dc \<in> dc_crypto. payer dc = Some (the z) \<and> inversion dc = x}"
20.102 - by (auto simp add: payer_def)
20.103 - moreover from x z obtain i where "z = Some i" and "i < n" by auto
20.104 - moreover from x have "length x = n" by (auto simp: inversion_def [abs_def] dc_crypto)
20.105 - ultimately
20.106 - have "?dIP {(x, z)} = 2 / (real n * 2^n)" using x
20.107 - by (auto simp add: card_dc_crypto card_payer_and_inversion distribution_def)
20.108 - moreover
20.109 - from z have "payer -` {z} \<inter> dc_crypto = {z} \<times> {xs. length xs = n}"
20.110 - by (auto simp: dc_crypto payer_def)
20.111 - hence "card (payer -` {z} \<inter> dc_crypto) = 2^n"
20.112 - using card_lists_length_eq[where A="UNIV::bool set"]
20.113 - by (simp add: card_cartesian_product_singleton)
20.114 - hence "?dP {z} = 1 / real n"
20.115 - by (simp add: distribution_def card_dc_crypto)
20.116 - ultimately
20.117 - show "?dIP {(x,z)} * log 2 (?dIP {(x,z)} / ?dP {z}) =
20.118 - 2 / (real n * 2^n) * (1 - real n)"
20.119 - by (simp add: log_divide log_nat_power[of 2])
20.120 - qed
20.121 - also have "... = real n - 1"
20.122 - using n finite_space
20.123 - by (simp add: card_image_inversion card_image[OF inj_Some] field_simps real_eq_of_nat[symmetric])
20.124 - finally have "\<H>(inversion|payer) = real n - 1" . }
20.125 - moreover
20.126 - { have "\<H>(inversion) = - (\<Sum>x \<in> inversion`dc_crypto. ?dI {x} * log 2 (?dI {x}))"
20.127 - unfolding entropy_eq[OF simple_function_finite] by simp
20.128 - also have "... = - (\<Sum>x \<in> inversion`dc_crypto. 2 * (1 - real n) / 2^n)"
20.129 - unfolding neg_equal_iff_equal
20.130 - proof (rule setsum_cong[OF refl])
20.131 - fix x assume x_inv: "x \<in> inversion ` dc_crypto"
20.132 - hence "length x = n" by (auto simp: inversion_def [abs_def] dc_crypto)
20.133 - moreover have "inversion -` {x} \<inter> dc_crypto = {dc \<in> dc_crypto. inversion dc = x}" by auto
20.134 - ultimately have "?dI {x} = 2 / 2^n" using `0 < n`
20.135 - by (auto simp: card_inversion[OF x_inv] card_dc_crypto distribution_def)
20.136 - thus "?dI {x} * log 2 (?dI {x}) = 2 * (1 - real n) / 2^n"
20.137 - by (simp add: log_divide log_nat_power power_le_zero_eq inverse_eq_divide)
20.138 - qed
20.139 - also have "... = real n - 1"
20.140 - by (simp add: card_image_inversion real_of_nat_def[symmetric] field_simps)
20.141 - finally have "\<H>(inversion) = real n - 1" .
20.142 - }
20.143 - ultimately show ?thesis
20.144 - unfolding mutual_information_eq_entropy_conditional_entropy[OF simple_function_finite simple_function_finite]
20.145 + show "simple_distributed (uniform_count_measure dc_crypto) payer (\<lambda>x. 1 / real n)"
20.146 + proof (rule simple_distributedI)
20.147 + show "simple_function (uniform_count_measure dc_crypto) payer"
20.148 + using finite_dc_crypto
20.149 + by (auto simp: simple_function_def space_uniform_count_measure sets_uniform_count_measure)
20.150 + fix z assume "z \<in> payer ` space (uniform_count_measure dc_crypto)"
20.151 + then have "payer -` {z} \<inter> dc_crypto = {z} \<times> {xs. length xs = n}"
20.152 + by (auto simp: dc_crypto payer_def space_uniform_count_measure)
20.153 + hence "card (payer -` {z} \<inter> dc_crypto) = 2^n"
20.154 + using card_lists_length_eq[where A="UNIV::bool set"]
20.155 + by (simp add: card_cartesian_product_singleton)
20.156 + then show "1 / real n = prob (payer -` {z} \<inter> space (uniform_count_measure dc_crypto))"
20.157 + using finite_dc_crypto
20.158 + by (subst measure_uniform_count_measure) (auto simp add: card_dc_crypto space_uniform_count_measure)
20.159 + qed
20.160 +
20.161 + show "simple_distributed (uniform_count_measure dc_crypto) (\<lambda>x. (inversion x, payer x)) (\<lambda>x. 2 / (real n *2^n))"
20.162 + proof (rule simple_distributedI)
20.163 + show "simple_function (uniform_count_measure dc_crypto) (\<lambda>x. (inversion x, payer x))"
20.164 + using finite_dc_crypto
20.165 + by (auto simp: simple_function_def space_uniform_count_measure sets_uniform_count_measure)
20.166 + fix x assume "x \<in> (\<lambda>x. (inversion x, payer x)) ` space (uniform_count_measure dc_crypto)"
20.167 + then obtain i xs where x: "x = (inversion (Some i, xs), payer (Some i, xs))"
20.168 + and "i < n" "length xs = n"
20.169 + by (simp add: image_iff space_uniform_count_measure dc_crypto Bex_def) blast
20.170 + then have xs: "inversion (Some i, xs) \<in> inversion`dc_crypto" and i: "Some i \<in> Some ` {0..<n}"
20.171 + and x: "x = (inversion (Some i, xs), Some i)" by (simp_all add: payer_def dc_crypto)
20.172 + moreover def ys \<equiv> "inversion (Some i, xs)"
20.173 + ultimately have ys: "ys \<in> inversion`dc_crypto"
20.174 + and "Some i \<in> Some ` {0..<n}" "x = (ys, Some i)" by simp_all
20.175 + then have "(\<lambda>x. (inversion x, payer x)) -` {x} \<inter> space (uniform_count_measure dc_crypto) =
20.176 + {dc \<in> dc_crypto. payer dc = Some (the (Some i)) \<and> inversion dc = ys}"
20.177 + by (auto simp add: payer_def space_uniform_count_measure)
20.178 + then show "2 / (real n * 2 ^ n) = prob ((\<lambda>x. (inversion x, payer x)) -` {x} \<inter> space (uniform_count_measure dc_crypto))"
20.179 + using `i < n` ys
20.180 + by (simp add: measure_uniform_count_measure card_payer_and_inversion finite_dc_crypto subset_eq card_dc_crypto)
20.181 + qed
20.182 +
20.183 + show "\<forall>x\<in>space (uniform_count_measure dc_crypto). 2 / (real n * 2 ^ n) = 2 / 2 ^ n * (1 / real n) "
20.184 by simp
20.185 qed
20.186
21.1 --- a/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy Mon Apr 23 12:23:23 2012 +0100
21.2 +++ b/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy Mon Apr 23 12:14:35 2012 +0200
21.3 @@ -103,49 +103,14 @@
21.4 lessThan_Suc_eq_insert_0 setprod_reindex setsum_left_distrib[symmetric] setsum_right_distrib[symmetric])
21.5 qed
21.6
21.7 -lemma ex_ordered_bij_betw_nat_finite:
21.8 - fixes order :: "nat \<Rightarrow> 'a\<Colon>linorder"
21.9 - assumes "finite S"
21.10 - shows "\<exists>f. bij_betw f {0..<card S} S \<and> (\<forall>i<card S. \<forall>j<card S. i \<le> j \<longrightarrow> order (f i) \<le> order (f j))"
21.11 -proof -
21.12 - from ex_bij_betw_nat_finite [OF `finite S`] guess f .. note f = this
21.13 - let ?xs = "sort_key order (map f [0 ..< card S])"
21.14 +declare space_point_measure[simp]
21.15
21.16 - have "?xs <~~> map f [0 ..< card S]"
21.17 - unfolding multiset_of_eq_perm[symmetric] by (rule multiset_of_sort)
21.18 - from permutation_Ex_bij [OF this]
21.19 - obtain g where g: "bij_betw g {0..<card S} {0..<card S}" and
21.20 - map: "\<And>i. i<card S \<Longrightarrow> ?xs ! i = map f [0 ..< card S] ! g i"
21.21 - by (auto simp: atLeast0LessThan)
21.22 +declare sets_point_measure[simp]
21.23
21.24 - { fix i assume "i < card S"
21.25 - then have "g i < card S" using g by (auto simp: bij_betw_def)
21.26 - with map [OF `i < card S`] have "f (g i) = ?xs ! i" by simp }
21.27 - note this[simp]
21.28 -
21.29 - show ?thesis
21.30 - proof (intro exI allI conjI impI)
21.31 - show "bij_betw (f\<circ>g) {0..<card S} S"
21.32 - using g f by (rule bij_betw_trans)
21.33 - fix i j assume [simp]: "i < card S" "j < card S" "i \<le> j"
21.34 - from sorted_nth_mono[of "map order ?xs" i j]
21.35 - show "order ((f\<circ>g) i) \<le> order ((f\<circ>g) j)" by simp
21.36 - qed
21.37 -qed
21.38 -
21.39 -definition (in prob_space)
21.40 - "ordered_variable_partition X = (SOME f. bij_betw f {0..<card (X`space M)} (X`space M) \<and>
21.41 - (\<forall>i<card (X`space M). \<forall>j<card (X`space M). i \<le> j \<longrightarrow> distribution X {f i} \<le> distribution X {f j}))"
21.42 -
21.43 -definition (in prob_space)
21.44 - "order_distribution X i = real (distribution X {ordered_variable_partition X i})"
21.45 -
21.46 -definition (in prob_space)
21.47 - "guessing_entropy b X = (\<Sum>i<card(X`space M). real i * log b (order_distribution X i))"
21.48 -
21.49 -abbreviation (in information_space)
21.50 - finite_guessing_entropy ("\<G>'(_')") where
21.51 - "\<G>(X) \<equiv> guessing_entropy b X"
21.52 +lemma measure_point_measure:
21.53 + "finite \<Omega> \<Longrightarrow> A \<subseteq> \<Omega> \<Longrightarrow> (\<And>x. x \<in> \<Omega> \<Longrightarrow> 0 \<le> p x) \<Longrightarrow>
21.54 + measure (point_measure \<Omega> (\<lambda>x. ereal (p x))) A = (\<Sum>i\<in>A. p i)"
21.55 + unfolding measure_def by (subst emeasure_point_measure_finite) auto
21.56
21.57 locale finite_information =
21.58 fixes \<Omega> :: "'a set"
21.59 @@ -159,17 +124,14 @@
21.60 lemma (in finite_information) positive_p_sum[simp]: "0 \<le> setsum p X"
21.61 by (auto intro!: setsum_nonneg)
21.62
21.63 -sublocale finite_information \<subseteq> finite_measure_space "\<lparr> space = \<Omega>, sets = Pow \<Omega>, measure = \<lambda>S. ereal (setsum p S)\<rparr>"
21.64 - by (rule finite_measure_spaceI) (simp_all add: setsum_Un_disjoint finite_subset)
21.65 +sublocale finite_information \<subseteq> prob_space "point_measure \<Omega> p"
21.66 + by default (simp add: one_ereal_def emeasure_point_measure_finite)
21.67
21.68 -sublocale finite_information \<subseteq> finite_prob_space "\<lparr> space = \<Omega>, sets = Pow \<Omega>, measure = \<lambda>S. ereal (setsum p S)\<rparr>"
21.69 - by default (simp add: one_ereal_def)
21.70 -
21.71 -sublocale finite_information \<subseteq> information_space "\<lparr> space = \<Omega>, sets = Pow \<Omega>, measure = \<lambda>S. ereal (setsum p S)\<rparr>" b
21.72 +sublocale finite_information \<subseteq> information_space "point_measure \<Omega> p" b
21.73 by default simp
21.74
21.75 -lemma (in finite_information) \<mu>'_eq: "A \<subseteq> \<Omega> \<Longrightarrow> \<mu>' A = setsum p A"
21.76 - unfolding \<mu>'_def by auto
21.77 +lemma (in finite_information) \<mu>'_eq: "A \<subseteq> \<Omega> \<Longrightarrow> prob A = setsum p A"
21.78 + by (auto simp: measure_point_measure)
21.79
21.80 locale koepf_duermuth = K: finite_information keys K b + M: finite_information messages M b
21.81 for b :: real
21.82 @@ -247,14 +209,19 @@
21.83 abbreviation
21.84 "p A \<equiv> setsum P A"
21.85
21.86 +abbreviation
21.87 + "\<mu> \<equiv> point_measure msgs P"
21.88 +
21.89 abbreviation probability ("\<P>'(_') _") where
21.90 - "\<P>(X) x \<equiv> distribution X x"
21.91 + "\<P>(X) x \<equiv> measure \<mu> (X -` x \<inter> msgs)"
21.92
21.93 -abbreviation joint_probability ("\<P>'(_, _') _") where
21.94 - "\<P>(X, Y) x \<equiv> joint_distribution X Y x"
21.95 +abbreviation joint_probability ("\<P>'(_ ; _') _") where
21.96 + "\<P>(X ; Y) x \<equiv> \<P>(\<lambda>x. (X x, Y x)) x"
21.97
21.98 -abbreviation conditional_probability ("\<P>'(_|_') _") where
21.99 - "\<P>(X|Y) x \<equiv> \<P>(X, Y) x / \<P>(Y) (snd`x)"
21.100 +no_notation disj (infixr "|" 30)
21.101 +
21.102 +abbreviation conditional_probability ("\<P>'(_ | _') _") where
21.103 + "\<P>(X | Y) x \<equiv> (\<P>(X ; Y) x) / \<P>(Y) (snd`x)"
21.104
21.105 notation
21.106 entropy_Pow ("\<H>'( _ ')")
21.107 @@ -280,8 +247,8 @@
21.108 from assms have *:
21.109 "fst -` {k} \<inter> msgs = {k}\<times>{ms. set ms \<subseteq> messages \<and> length ms = n}"
21.110 unfolding msgs_def by auto
21.111 - show "\<P>(fst) {k} = K k"
21.112 - apply (simp add: \<mu>'_eq distribution_def)
21.113 + show "(\<P>(fst) {k}) = K k"
21.114 + apply (simp add: \<mu>'_eq)
21.115 apply (simp add: * P_def)
21.116 apply (simp add: setsum_cartesian_product')
21.117 using setprod_setsum_distrib_lists[OF M.finite_space, of M n "\<lambda>x x. True"] `k \<in> keys`
21.118 @@ -297,6 +264,67 @@
21.119 unfolding msgs_def fst_image_times if_not_P[OF *] by simp
21.120 qed
21.121
21.122 +lemma setsum_distribution_cut:
21.123 + "\<P>(X) {x} = (\<Sum>y \<in> Y`space \<mu>. \<P>(X ; Y) {(x, y)})"
21.124 + by (subst finite_measure_finite_Union[symmetric])
21.125 + (auto simp add: disjoint_family_on_def inj_on_def
21.126 + intro!: arg_cong[where f=prob])
21.127 +
21.128 +lemma prob_conj_imp1:
21.129 + "prob ({x. Q x} \<inter> msgs) = 0 \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) = 0"
21.130 + using finite_measure_mono[of "{x. Pr x \<and> Q x} \<inter> msgs" "{x. Q x} \<inter> msgs"]
21.131 + using measure_nonneg[of \<mu> "{x. Pr x \<and> Q x} \<inter> msgs"]
21.132 + by (simp add: subset_eq)
21.133 +
21.134 +lemma prob_conj_imp2:
21.135 + "prob ({x. Pr x} \<inter> msgs) = 0 \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) = 0"
21.136 + using finite_measure_mono[of "{x. Pr x \<and> Q x} \<inter> msgs" "{x. Pr x} \<inter> msgs"]
21.137 + using measure_nonneg[of \<mu> "{x. Pr x \<and> Q x} \<inter> msgs"]
21.138 + by (simp add: subset_eq)
21.139 +
21.140 +lemma simple_function_finite: "simple_function \<mu> f"
21.141 + by (simp add: simple_function_def)
21.142 +
21.143 +lemma entropy_commute: "\<H>(\<lambda>x. (X x, Y x)) = \<H>(\<lambda>x. (Y x, X x))"
21.144 + apply (subst (1 2) entropy_simple_distributed[OF simple_distributedI[OF simple_function_finite refl]])
21.145 + unfolding space_point_measure
21.146 +proof -
21.147 + have eq: "(\<lambda>x. (X x, Y x)) ` msgs = (\<lambda>(x, y). (y, x)) ` (\<lambda>x. (Y x, X x)) ` msgs"
21.148 + by auto
21.149 + show "- (\<Sum>x\<in>(\<lambda>x. (X x, Y x)) ` msgs. (\<P>(X ; Y) {x}) * log b (\<P>(X ; Y) {x})) =
21.150 + - (\<Sum>x\<in>(\<lambda>x. (Y x, X x)) ` msgs. (\<P>(Y ; X) {x}) * log b (\<P>(Y ; X) {x}))"
21.151 + unfolding eq
21.152 + apply (subst setsum_reindex)
21.153 + apply (auto simp: vimage_def inj_on_def intro!: setsum_cong arg_cong[where f="\<lambda>x. prob x * log b (prob x)"])
21.154 + done
21.155 +qed
21.156 +
21.157 +lemma (in -) measure_eq_0I: "A = {} \<Longrightarrow> measure M A = 0" by simp
21.158 +
21.159 +lemma conditional_entropy_eq_ce_with_hypothesis:
21.160 + "\<H>(X | Y) = -(\<Sum>y\<in>Y`msgs. (\<P>(Y) {y}) * (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}) *
21.161 + log b ((\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}))))"
21.162 + apply (subst conditional_entropy_eq[OF
21.163 + simple_distributedI[OF simple_function_finite refl]
21.164 + simple_function_finite
21.165 + simple_distributedI[OF simple_function_finite refl]])
21.166 + unfolding space_point_measure
21.167 +proof -
21.168 + have "- (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` msgs. (\<P>(X ; Y) {(x, y)}) * log b ((\<P>(X ; Y) {(x, y)}) / (\<P>(Y) {y}))) =
21.169 + - (\<Sum>x\<in>X`msgs. (\<Sum>y\<in>Y`msgs. (\<P>(X ; Y) {(x, y)}) * log b ((\<P>(X ; Y) {(x, y)}) / (\<P>(Y) {y}))))"
21.170 + unfolding setsum_cartesian_product
21.171 + apply (intro arg_cong[where f=uminus] setsum_mono_zero_left)
21.172 + apply (auto simp: vimage_def image_iff intro!: measure_eq_0I)
21.173 + apply metis
21.174 + done
21.175 + also have "\<dots> = - (\<Sum>y\<in>Y`msgs. (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x, y)}) * log b ((\<P>(X ; Y) {(x, y)}) / (\<P>(Y) {y}))))"
21.176 + by (subst setsum_commute) rule
21.177 + also have "\<dots> = -(\<Sum>y\<in>Y`msgs. (\<P>(Y) {y}) * (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}) * log b ((\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}))))"
21.178 + by (auto simp add: setsum_right_distrib vimage_def intro!: setsum_cong prob_conj_imp1)
21.179 + finally show "- (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` msgs. (\<P>(X ; Y) {(x, y)}) * log b ((\<P>(X ; Y) {(x, y)}) / (\<P>(Y) {y}))) =
21.180 + -(\<Sum>y\<in>Y`msgs. (\<P>(Y) {y}) * (\<Sum>x\<in>X`msgs. (\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}) * log b ((\<P>(X ; Y) {(x,y)}) / (\<P>(Y) {y}))))" .
21.181 +qed
21.182 +
21.183 lemma ce_OB_eq_ce_t: "\<H>(fst | OB) = \<H>(fst | t\<circ>OB)"
21.184 proof -
21.185 txt {* Lemma 2 *}
21.186 @@ -314,22 +342,22 @@
21.187 then have **: "\<And>ms. length ms = n \<Longrightarrow> OB (k, ms) = obs \<longleftrightarrow> (\<forall>i<n. observe k (ms!i) = obs ! i)"
21.188 unfolding OB_def msgs_def by (simp add: image_iff list_eq_iff_nth_eq)
21.189
21.190 - have "\<P>(OB, fst) {(obs, k)} / K k =
21.191 + have "(\<P>(OB ; fst) {(obs, k)}) / K k =
21.192 p ({k}\<times>{ms. (k,ms) \<in> msgs \<and> OB (k,ms) = obs}) / K k"
21.193 - apply (simp add: distribution_def \<mu>'_eq) by (auto intro!: arg_cong[where f=p])
21.194 + apply (simp add: \<mu>'_eq) by (auto intro!: arg_cong[where f=p])
21.195 also have "\<dots> =
21.196 (\<Prod>i<n. \<Sum>m\<in>{m\<in>messages. observe k m = obs ! i}. M m)"
21.197 unfolding P_def using `K k \<noteq> 0` `k \<in> keys`
21.198 apply (simp add: setsum_cartesian_product' setsum_divide_distrib msgs_def ** cong: conj_cong)
21.199 apply (subst setprod_setsum_distrib_lists[OF M.finite_space]) ..
21.200 - finally have "\<P>(OB, fst) {(obs, k)} / K k =
21.201 + finally have "(\<P>(OB ; fst) {(obs, k)}) / K k =
21.202 (\<Prod>i<n. \<Sum>m\<in>{m\<in>messages. observe k m = obs ! i}. M m)" . }
21.203 note * = this
21.204
21.205 - have "\<P>(OB, fst) {(obs, k)} / K k = \<P>(OB, fst) {(obs', k)} / K k"
21.206 + have "(\<P>(OB ; fst) {(obs, k)}) / K k = (\<P>(OB ; fst) {(obs', k)}) / K k"
21.207 unfolding *[OF obs] *[OF obs']
21.208 using t_f(1) obs_t_f by (subst (2) t_f(2)) (simp add: setprod_reindex)
21.209 - then have "\<P>(OB, fst) {(obs, k)} = \<P>(OB, fst) {(obs', k)}"
21.210 + then have "(\<P>(OB ; fst) {(obs, k)}) = (\<P>(OB ; fst) {(obs', k)})"
21.211 using `K k \<noteq> 0` by auto }
21.212 note t_eq_imp = this
21.213
21.214 @@ -339,13 +367,13 @@
21.215 (\<Union>obs'\<in>?S obs. ((\<lambda>x. (OB x, fst x)) -` {(obs', k)} \<inter> msgs))" by auto
21.216 have df: "disjoint_family_on (\<lambda>obs'. (\<lambda>x. (OB x, fst x)) -` {(obs', k)} \<inter> msgs) (?S obs)"
21.217 unfolding disjoint_family_on_def by auto
21.218 - have "\<P>(t\<circ>OB, fst) {(t obs, k)} = (\<Sum>obs'\<in>?S obs. \<P>(OB, fst) {(obs', k)})"
21.219 - unfolding distribution_def comp_def
21.220 - using finite_measure_finite_Union[OF _ _ df]
21.221 - by (force simp add: * intro!: setsum_nonneg)
21.222 - also have "(\<Sum>obs'\<in>?S obs. \<P>(OB, fst) {(obs', k)}) = real (card (?S obs)) * \<P>(OB, fst) {(obs, k)}"
21.223 + have "\<P>(t\<circ>OB ; fst) {(t obs, k)} = (\<Sum>obs'\<in>?S obs. \<P>(OB ; fst) {(obs', k)})"
21.224 + unfolding comp_def
21.225 + using finite_measure_finite_Union[OF _ df]
21.226 + by (auto simp add: * intro!: setsum_nonneg)
21.227 + also have "(\<Sum>obs'\<in>?S obs. \<P>(OB ; fst) {(obs', k)}) = real (card (?S obs)) * \<P>(OB ; fst) {(obs, k)}"
21.228 by (simp add: t_eq_imp[OF `k \<in> keys` `K k \<noteq> 0` obs] real_eq_of_nat)
21.229 - finally have "\<P>(t\<circ>OB, fst) {(t obs, k)} = real (card (?S obs)) * \<P>(OB, fst) {(obs, k)}" .}
21.230 + finally have "\<P>(t\<circ>OB ; fst) {(t obs, k)} = real (card (?S obs)) * \<P>(OB ; fst) {(obs, k)}" .}
21.231 note P_t_eq_P_OB = this
21.232
21.233 { fix k obs assume "k \<in> keys" and obs: "obs \<in> OB`msgs"
21.234 @@ -359,11 +387,15 @@
21.235 then have "real (card ?S) \<noteq> 0" by auto
21.236
21.237 have "\<P>(fst | t\<circ>OB) {(k, t obs)} = \<P>(t\<circ>OB | fst) {(t obs, k)} * \<P>(fst) {k} / \<P>(t\<circ>OB) {t obs}"
21.238 - using distribution_order(7,8)[where X=fst and x=k and Y="t\<circ>OB" and y="t obs"]
21.239 - by (subst joint_distribution_commute) auto
21.240 - also have "\<P>(t\<circ>OB) {t obs} = (\<Sum>k'\<in>keys. \<P>(t\<circ>OB|fst) {(t obs, k')} * \<P>(fst) {k'})"
21.241 - using setsum_distribution_cut(2)[of "t\<circ>OB" fst "t obs", symmetric]
21.242 - by (auto intro!: setsum_cong distribution_order(8))
21.243 + using finite_measure_mono[of "{x. fst x = k \<and> t (OB x) = t obs} \<inter> msgs" "{x. fst x = k} \<inter> msgs"]
21.244 + using measure_nonneg[of \<mu> "{x. fst x = k \<and> t (OB x) = t obs} \<inter> msgs"]
21.245 + by (auto simp add: vimage_def conj_commute subset_eq)
21.246 + also have "(\<P>(t\<circ>OB) {t obs}) = (\<Sum>k'\<in>keys. (\<P>(t\<circ>OB|fst) {(t obs, k')}) * (\<P>(fst) {k'}))"
21.247 + using finite_measure_mono[of "{x. t (OB x) = t obs \<and> fst x = k} \<inter> msgs" "{x. fst x = k} \<inter> msgs"]
21.248 + using measure_nonneg[of \<mu> "{x. fst x = k \<and> t (OB x) = t obs} \<inter> msgs"]
21.249 + apply (simp add: setsum_distribution_cut[of "t\<circ>OB" "t obs" fst])
21.250 + apply (auto intro!: setsum_cong simp: subset_eq vimage_def prob_conj_imp1)
21.251 + done
21.252 also have "\<P>(t\<circ>OB | fst) {(t obs, k)} * \<P>(fst) {k} / (\<Sum>k'\<in>keys. \<P>(t\<circ>OB|fst) {(t obs, k')} * \<P>(fst) {k'}) =
21.253 \<P>(OB | fst) {(obs, k)} * \<P>(fst) {k} / (\<Sum>k'\<in>keys. \<P>(OB|fst) {(obs, k')} * \<P>(fst) {k'})"
21.254 using CP_t_K[OF `k\<in>keys` obs] CP_t_K[OF _ obs] `real (card ?S) \<noteq> 0`
21.255 @@ -371,10 +403,10 @@
21.256 mult_divide_mult_cancel_left[OF `real (card ?S) \<noteq> 0`]
21.257 cong: setsum_cong)
21.258 also have "(\<Sum>k'\<in>keys. \<P>(OB|fst) {(obs, k')} * \<P>(fst) {k'}) = \<P>(OB) {obs}"
21.259 - using setsum_distribution_cut(2)[of OB fst obs, symmetric]
21.260 - by (auto intro!: setsum_cong distribution_order(8))
21.261 + using setsum_distribution_cut[of OB obs fst]
21.262 + by (auto intro!: setsum_cong simp: prob_conj_imp1 vimage_def)
21.263 also have "\<P>(OB | fst) {(obs, k)} * \<P>(fst) {k} / \<P>(OB) {obs} = \<P>(fst | OB) {(k, obs)}"
21.264 - by (subst joint_distribution_commute) (auto intro!: distribution_order(8))
21.265 + by (auto simp: vimage_def conj_commute prob_conj_imp2)
21.266 finally have "\<P>(fst | t\<circ>OB) {(k, t obs)} = \<P>(fst | OB) {(k, obs)}" . }
21.267 note CP_T_eq_CP_O = this
21.268
21.269 @@ -396,15 +428,15 @@
21.270 have df: "disjoint_family_on (\<lambda>obs. OB -` {obs} \<inter> msgs) (?S (OB x))"
21.271 unfolding disjoint_family_on_def by auto
21.272 have "\<P>(t\<circ>OB) {t (OB x)} = (\<Sum>obs\<in>?S (OB x). \<P>(OB) {obs})"
21.273 - unfolding distribution_def comp_def
21.274 - using finite_measure_finite_Union[OF _ _ df]
21.275 + unfolding comp_def
21.276 + using finite_measure_finite_Union[OF _ df]
21.277 by (force simp add: * intro!: setsum_nonneg) }
21.278 note P_t_sum_P_O = this
21.279
21.280 txt {* Lemma 3 *}
21.281 + txt {* Lemma 3 *}
21.282 have "\<H>(fst | OB) = -(\<Sum>obs\<in>OB`msgs. \<P>(OB) {obs} * ?Ht (t obs))"
21.283 - unfolding conditional_entropy_eq_ce_with_hypothesis[OF
21.284 - simple_function_finite simple_function_finite] using * by simp
21.285 + unfolding conditional_entropy_eq_ce_with_hypothesis using * by simp
21.286 also have "\<dots> = -(\<Sum>obs\<in>t`OB`msgs. \<P>(t\<circ>OB) {obs} * ?Ht obs)"
21.287 apply (subst SIGMA_image_vimage[symmetric, of "OB`msgs" t])
21.288 apply (subst setsum_reindex)
21.289 @@ -418,8 +450,7 @@
21.290 by (simp add: setsum_divide_distrib[symmetric] field_simps **
21.291 setsum_right_distrib[symmetric] setsum_left_distrib[symmetric])
21.292 also have "\<dots> = \<H>(fst | t\<circ>OB)"
21.293 - unfolding conditional_entropy_eq_ce_with_hypothesis[OF
21.294 - simple_function_finite simple_function_finite]
21.295 + unfolding conditional_entropy_eq_ce_with_hypothesis
21.296 by (simp add: comp_def image_image[symmetric])
21.297 finally show ?thesis .
21.298 qed
21.299 @@ -433,11 +464,11 @@
21.300 unfolding ce_OB_eq_ce_t ..
21.301 also have "\<dots> = \<H>(t\<circ>OB) - \<H>(t\<circ>OB | fst)"
21.302 unfolding entropy_chain_rule[symmetric, OF simple_function_finite simple_function_finite] sign_simps
21.303 - by (subst entropy_commute[OF simple_function_finite simple_function_finite]) simp
21.304 + by (subst entropy_commute) simp
21.305 also have "\<dots> \<le> \<H>(t\<circ>OB)"
21.306 - using conditional_entropy_positive[of "t\<circ>OB" fst] by simp
21.307 + using conditional_entropy_nonneg[of "t\<circ>OB" fst] by simp
21.308 also have "\<dots> \<le> log b (real (card ((t\<circ>OB)`msgs)))"
21.309 - using entropy_le_card[of "t\<circ>OB"] by simp
21.310 + using entropy_le_card[of "t\<circ>OB", OF simple_distributedI[OF simple_function_finite refl]] by simp
21.311 also have "\<dots> \<le> log b (real (n + 1)^card observations)"
21.312 using card_T_bound not_empty
21.313 by (auto intro!: log_le simp: card_gt_0_iff power_real_of_nat simp del: real_of_nat_power)