# HG changeset patch # User hoelzl # Date 1466111007 -7200 # Node ID 158ab2239496683ae1f2088b1c94410161f6d799 # Parent f164526d8727821acb2692cc223dff48cb751d1a Probability: show that measures form a complete lattice diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Binary_Product_Measure.thy --- a/src/HOL/Probability/Binary_Product_Measure.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Binary_Product_Measure.thy Thu Jun 16 23:03:27 2016 +0200 @@ -37,12 +37,6 @@ unfolding pair_measure_def using pair_measure_closed[of A B] by (rule sets_measure_of) -lemma sets_pair_in_sets: - assumes N: "space A \ space B = space N" - assumes "\a b. a \ sets A \ b \ sets B \ a \ b \ sets N" - shows "sets (A \\<^sub>M B) \ sets N" - using assms by (auto intro!: sets.sigma_sets_subset simp: sets_pair_measure N) - lemma sets_pair_measure_cong[measurable_cong, cong]: "sets M1 = sets M1' \ sets M2 = sets M2' \ sets (M1 \\<^sub>M M2) = sets (M1' \\<^sub>M M2')" unfolding sets_pair_measure by (simp cong: sets_eq_imp_space_eq) @@ -122,23 +116,45 @@ and measurable_snd'': "(\x. f (snd x)) \ measurable (P \\<^sub>M M) N" by simp_all +lemma sets_pair_in_sets: + assumes "\a b. a \ sets A \ b \ sets B \ a \ b \ sets N" + shows "sets (A \\<^sub>M B) \ sets N" + unfolding sets_pair_measure + by (intro sets.sigma_sets_subset') (auto intro!: assms) + lemma sets_pair_eq_sets_fst_snd: - "sets (A \\<^sub>M B) = sets (Sup_sigma {vimage_algebra (space A \ space B) fst A, vimage_algebra (space A \ space B) snd B})" - (is "?P = sets (Sup_sigma {?fst, ?snd})") + "sets (A \\<^sub>M B) = sets (Sup {vimage_algebra (space A \ space B) fst A, vimage_algebra (space A \ space B) snd B})" + (is "?P = sets (Sup {?fst, ?snd})") proof - { fix a b assume ab: "a \ sets A" "b \ sets B" then have "a \ b = (fst -` a \ (space A \ space B)) \ (snd -` b \ (space A \ space B))" by (auto dest: sets.sets_into_space) - also have "\ \ sets (Sup_sigma {?fst, ?snd})" - using ab by (auto intro: in_Sup_sigma in_vimage_algebra) - finally have "a \ b \ sets (Sup_sigma {?fst, ?snd})" . } + also have "\ \ sets (Sup {?fst, ?snd})" + apply (rule sets.Int) + apply (rule in_sets_Sup) + apply auto [] + apply (rule insertI1) + apply (auto intro: ab in_vimage_algebra) [] + apply (rule in_sets_Sup) + apply auto [] + apply (rule insertI2) + apply (auto intro: ab in_vimage_algebra) + done + finally have "a \ b \ sets (Sup {?fst, ?snd})" . } moreover have "sets ?fst \ sets (A \\<^sub>M B)" by (rule sets_image_in_sets) (auto simp: space_pair_measure[symmetric]) moreover have "sets ?snd \ sets (A \\<^sub>M B)" by (rule sets_image_in_sets) (auto simp: space_pair_measure) ultimately show ?thesis - by (intro antisym[of "sets A" for A] sets_Sup_in_sets sets_pair_in_sets ) - (auto simp add: space_Sup_sigma space_pair_measure) + apply (intro antisym[of "sets A" for A] sets_Sup_in_sets sets_pair_in_sets) + apply simp + apply simp + apply simp + apply (elim disjE) + apply (simp add: space_pair_measure) + apply (simp add: space_pair_measure) + apply (auto simp add: space_pair_measure) + done qed lemma measurable_pair_iff: @@ -597,11 +613,10 @@ have [simp]: "snd \ X \ Y \ Y" "fst \ X \ Y \ X" by auto let ?XY = "{{fst -` a \ X \ Y | a. a \ A}, {snd -` b \ X \ Y | b. b \ B}}" - have "sets ?P = - sets (\\<^sub>\ xy\?XY. sigma (X \ Y) xy)" + have "sets ?P = sets (SUP xy:?XY. sigma (X \ Y) xy)" by (simp add: vimage_algebra_sigma sets_pair_eq_sets_fst_snd A B) also have "\ = sets (sigma (X \ Y) (\?XY))" - by (intro Sup_sigma_sigma arg_cong[where f=sets]) auto + by (intro Sup_sigma arg_cong[where f=sets]) auto also have "\ = sets ?S" proof (intro arg_cong[where f=sets] sigma_eqI sigma_sets_eqI) show "\?XY \ Pow (X \ Y)" "{a \ b |a b. a \ A \ b \ B} \ Pow (X \ Y)" diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Embed_Measure.thy --- a/src/HOL/Probability/Embed_Measure.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Embed_Measure.thy Thu Jun 16 23:03:27 2016 +0200 @@ -241,20 +241,25 @@ have fg[simp]: "\A. inj_on (map_prod f g) A" "\A. inj_on f A" "\A. inj_on g A" using f g by (auto simp: inj_on_def) + note complete_lattice_class.Sup_insert[simp del] ccSup_insert[simp del] SUP_insert[simp del] + ccSUP_insert[simp del] show sets: "sets ?L = sets (embed_measure (M \\<^sub>M N) (map_prod f g))" unfolding map_prod_def[symmetric] apply (simp add: sets_pair_eq_sets_fst_snd sets_embed_eq_vimage_algebra cong: vimage_algebra_cong) - apply (subst vimage_algebra_Sup_sigma) + apply (subst sets_vimage_Sup_eq[where Y="space (M \\<^sub>M N)"]) apply (simp_all add: space_pair_measure[symmetric]) apply (auto simp add: the_inv_into_f_f simp del: map_prod_simp del: prod_fun_imageE) [] + apply auto [] + apply (subst image_insert) + apply simp apply (subst (1 2 3 4 ) vimage_algebra_vimage_algebra_eq) apply (simp_all add: the_inv_into_in_Pi Pi_iff[of snd] Pi_iff[of fst] space_pair_measure) apply (simp_all add: Pi_iff[of snd] Pi_iff[of fst] the_inv_into_in_Pi vimage_algebra_vimage_algebra_eq space_pair_measure[symmetric] map_prod_image[symmetric]) - apply (intro arg_cong[where f=sets] arg_cong[where f=Sup_sigma] arg_cong2[where f=insert] vimage_algebra_cong) + apply (intro arg_cong[where f=sets] arg_cong[where f=Sup] arg_cong2[where f=insert] vimage_algebra_cong) apply (auto simp: map_prod_image the_inv_into_f_f simp del: map_prod_simp del: prod_fun_imageE) apply (simp_all add: the_inv_into_f_f space_pair_measure) @@ -270,6 +275,19 @@ sigma_finite_measure.emeasure_pair_measure_Times) qed (insert assms, simp_all add: sigma_finite_embed_measure) +lemma mono_embed_measure: + "space M = space M' \ sets M \ sets M' \ sets (embed_measure M f) \ sets (embed_measure M' f)" + unfolding embed_measure_def + apply (subst (1 2) sets_measure_of) + apply (blast dest: sets.sets_into_space) + apply (blast dest: sets.sets_into_space) + apply simp + apply (intro sigma_sets_mono') + apply safe + apply (simp add: subset_eq) + apply metis + done + lemma density_embed_measure: assumes inj: "inj f" and Mg[measurable]: "g \ borel_measurable (embed_measure M f)" shows "density (embed_measure M f) g = embed_measure (density M (g \ f)) f" (is "?M1 = ?M2") diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Finite_Product_Measure.thy --- a/src/HOL/Probability/Finite_Product_Measure.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Finite_Product_Measure.thy Thu Jun 16 23:03:27 2016 +0200 @@ -389,8 +389,12 @@ qed lemma sets_PiM_eq_proj: - "I \ {} \ sets (PiM I M) = sets (\\<^sub>\ i\I. vimage_algebra (\\<^sub>E i\I. space (M i)) (\x. x i) (M i))" - apply (simp add: sets_PiM_single sets_Sup_sigma) + "I \ {} \ sets (PiM I M) = sets (SUP i:I. vimage_algebra (\\<^sub>E i\I. space (M i)) (\x. x i) (M i))" + apply (simp add: sets_PiM_single) + apply (subst sets_Sup_eq[where X="\\<^sub>E i\I. space (M i)"]) + apply auto [] + apply auto [] + apply simp apply (subst SUP_cong[OF refl]) apply (rule sets_vimage_algebra2) apply auto [] @@ -418,10 +422,10 @@ let ?F = "\i. {(\x. x i) -` A \ Pi\<^sub>E I \ |A. A \ E i}" assume "I \ {}" then have "sets (Pi\<^sub>M I (\i. sigma (\ i) (E i))) = - sets (\\<^sub>\ i\I. vimage_algebra (\\<^sub>E i\I. \ i) (\x. x i) (sigma (\ i) (E i)))" + sets (SUP i:I. vimage_algebra (\\<^sub>E i\I. \ i) (\x. x i) (sigma (\ i) (E i)))" by (subst sets_PiM_eq_proj) (auto simp: space_measure_of_conv) - also have "\ = sets (\\<^sub>\ i\I. sigma (Pi\<^sub>E I \) (?F i))" - using E by (intro SUP_sigma_cong arg_cong[where f=sets] vimage_algebra_sigma) auto + also have "\ = sets (SUP i:I. sigma (Pi\<^sub>E I \) (?F i))" + using E by (intro sets_SUP_cong arg_cong[where f=sets] vimage_algebra_sigma) auto also have "\ = sets (sigma (Pi\<^sub>E I \) (\i\I. ?F i))" using \I \ {}\ by (intro arg_cong[where f=sets] SUP_sigma_sigma) auto also have "\ = sets (sigma (Pi\<^sub>E I \) P)" diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Giry_Monad.thy --- a/src/HOL/Probability/Giry_Monad.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Giry_Monad.thy Thu Jun 16 23:03:27 2016 +0200 @@ -162,17 +162,17 @@ definition subprob_algebra :: "'a measure \ 'a measure measure" where "subprob_algebra K = - (\\<^sub>\ A\sets K. vimage_algebra {M. subprob_space M \ sets M = sets K} (\M. emeasure M A) borel)" + (SUP A : sets K. vimage_algebra {M. subprob_space M \ sets M = sets K} (\M. emeasure M A) borel)" lemma space_subprob_algebra: "space (subprob_algebra A) = {M. subprob_space M \ sets M = sets A}" - by (auto simp add: subprob_algebra_def space_Sup_sigma) + by (auto simp add: subprob_algebra_def space_Sup_eq_UN) lemma subprob_algebra_cong: "sets M = sets N \ subprob_algebra M = subprob_algebra N" by (simp add: subprob_algebra_def) lemma measurable_emeasure_subprob_algebra[measurable]: "a \ sets A \ (\M. emeasure M a) \ borel_measurable (subprob_algebra A)" - by (auto intro!: measurable_Sup_sigma1 measurable_vimage_algebra1 simp: subprob_algebra_def) + by (auto intro!: measurable_Sup1 measurable_vimage_algebra1 simp: subprob_algebra_def) lemma measurable_measure_subprob_algebra[measurable]: "a \ sets A \ (\M. measure M a) \ borel_measurable (subprob_algebra A)" @@ -227,7 +227,7 @@ (\a. a \ space M \ sets (K a) = sets N) \ (\A. A \ sets N \ (\a. emeasure (K a) A) \ borel_measurable M) \ K \ measurable M (subprob_algebra N)" - by (auto intro!: measurable_Sup_sigma2 measurable_vimage_algebra2 simp: subprob_algebra_def) + by (auto intro!: measurable_Sup2 measurable_vimage_algebra2 simp: subprob_algebra_def) lemma measurable_submarkov: "K \ measurable M (subprob_algebra M) \ @@ -1504,55 +1504,6 @@ finally show ?thesis . qed -section \Measures form a $\omega$-chain complete partial order\ - -definition SUP_measure :: "(nat \ 'a measure) \ 'a measure" where - "SUP_measure M = measure_of (\i. space (M i)) (\i. sets (M i)) (\A. SUP i. emeasure (M i) A)" - -lemma - assumes const: "\i j. sets (M i) = sets (M j)" - shows space_SUP_measure: "space (SUP_measure M) = space (M i)" (is ?sp) - and sets_SUP_measure: "sets (SUP_measure M) = sets (M i)" (is ?st) -proof - - have "(\i. sets (M i)) = sets (M i)" - using const by auto - moreover have "(\i. space (M i)) = space (M i)" - using const[THEN sets_eq_imp_space_eq] by auto - moreover have "\i. sets (M i) \ Pow (space (M i))" - by (auto dest: sets.sets_into_space) - ultimately show ?sp ?st - by (simp_all add: SUP_measure_def) -qed - -lemma emeasure_SUP_measure: - assumes const: "\i j. sets (M i) = sets (M j)" - and mono: "mono (\i. emeasure (M i))" - shows "emeasure (SUP_measure M) A = (SUP i. emeasure (M i) A)" -proof cases - assume "A \ sets (SUP_measure M)" - show ?thesis - proof (rule emeasure_measure_of[OF SUP_measure_def]) - show "countably_additive (sets (SUP_measure M)) (\A. SUP i. emeasure (M i) A)" - proof (rule countably_additiveI) - fix A :: "nat \ 'a set" assume "range A \ sets (SUP_measure M)" - then have "\i j. A i \ sets (M j)" - using sets_SUP_measure[of M, OF const] by simp - moreover assume "disjoint_family A" - ultimately show "(\i. SUP ia. emeasure (M ia) (A i)) = (SUP i. emeasure (M i) (\i. A i))" - using suminf_SUP_eq - using mono by (subst ennreal_suminf_SUP_eq) (auto simp: mono_def le_fun_def intro!: SUP_cong suminf_emeasure) - qed - show "positive (sets (SUP_measure M)) (\A. SUP i. emeasure (M i) A)" - by (auto simp: positive_def intro: SUP_upper2) - show "(\i. sets (M i)) \ Pow (\i. space (M i))" - using sets.sets_into_space by auto - qed fact -next - assume "A \ sets (SUP_measure M)" - with sets_SUP_measure[of M, OF const] show ?thesis - by (simp add: emeasure_notin_sets) -qed - lemma bind_return'': "sets M = sets N \ M \ return N = M" by (cases "space M = {}") (simp_all add: bind_empty space_empty[symmetric] bind_nonempty join_return' diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Measurable.thy --- a/src/HOL/Probability/Measurable.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Measurable.thy Thu Jun 16 23:03:27 2016 +0200 @@ -266,7 +266,7 @@ unfolding finite_nat_set_iff_bounded by (simp add: Ball_def) lemma measurable_Least[measurable]: - assumes [measurable]: "(\i::nat. (\x. P i x) \ measurable M (count_space UNIV))"q + assumes [measurable]: "(\i::nat. (\x. P i x) \ measurable M (count_space UNIV))" shows "(\x. LEAST i. P i x) \ measurable M (count_space UNIV)" unfolding measurable_def by (safe intro!: sets_Least) simp_all diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Measure_Space.thy --- a/src/HOL/Probability/Measure_Space.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Measure_Space.thy Thu Jun 16 23:03:27 2016 +0200 @@ -26,7 +26,7 @@ proof (rule SUP_eqI) fix y :: ennreal assume "\n. n \ UNIV \ (if i < n then f i else 0) \ y" from this[of "Suc i"] show "f i \ y" by auto - qed (insert assms, simp add: zero_le) + qed (insert assms, simp) ultimately show ?thesis using assms by (subst suminf_eq_SUP) (auto simp: indicator_def) qed @@ -325,7 +325,7 @@ by (auto simp: UN_disjointed_eq disjoint_family_disjointed) moreover have "(\n. (\i (\i. f (disjointed A i))" using f(1)[unfolded positive_def] dA - by (auto intro!: summable_LIMSEQ summableI) + by (auto intro!: summable_LIMSEQ) from LIMSEQ_Suc[OF this] have "(\n. (\i\n. f (disjointed A i))) \ (\i. f (disjointed A i))" unfolding lessThan_Suc_atMost . @@ -1395,7 +1395,7 @@ qed (auto dest: sets.sets_into_space) lemma measure_nonneg[simp]: "0 \ measure M A" - unfolding measure_def by (auto simp: enn2real_nonneg) + unfolding measure_def by auto lemma zero_less_measure_iff: "0 < measure M A \ measure M A \ 0" using measure_nonneg[of M A] by (auto simp add: le_less) @@ -1418,13 +1418,13 @@ by (cases "A \ M") (auto simp: measure_notin_sets emeasure_notin_sets) lemma enn2real_plus:"a < top \ b < top \ enn2real (a + b) = enn2real a + enn2real b" - by (simp add: enn2real_def plus_ennreal.rep_eq real_of_ereal_add enn2ereal_nonneg less_top + by (simp add: enn2real_def plus_ennreal.rep_eq real_of_ereal_add less_top del: real_of_ereal_enn2ereal) lemma measure_Union: "emeasure M A \ \ \ emeasure M B \ \ \ A \ sets M \ B \ sets M \ A \ B = {} \ measure M (A \ B) = measure M A + measure M B" - by (simp add: measure_def enn2ereal_nonneg plus_emeasure[symmetric] enn2real_plus less_top) + by (simp add: measure_def plus_emeasure[symmetric] enn2real_plus less_top) lemma disjoint_family_on_insert: "i \ I \ disjoint_family_on A (insert i I) \ A i \ (\i\I. A i) = {} \ disjoint_family_on A I" @@ -1462,8 +1462,7 @@ then have "emeasure M (A i) = ennreal ((measure M (A i)))" using finite by (intro emeasure_eq_ennreal_measure) (auto simp: top_unique) } ultimately show ?thesis using finite - by (subst (asm) (2) emeasure_eq_ennreal_measure) - (simp_all add: measure_nonneg) + by (subst (asm) (2) emeasure_eq_ennreal_measure) simp_all qed lemma measure_subadditive: @@ -1494,7 +1493,7 @@ show ?thesis using emeasure_subadditive_finite[OF A] fin unfolding emeasure_eq_ennreal_measure[OF *] - by (simp_all add: setsum_ennreal measure_nonneg setsum_nonneg emeasure_eq_ennreal_measure) + by (simp_all add: setsum_nonneg emeasure_eq_ennreal_measure) qed lemma measure_subadditive_countably: @@ -2161,185 +2160,1124 @@ lemma scale_null_measure [simp]: "scale_measure r (null_measure M) = null_measure M" by (rule measure_eqI) simp_all -subsection \Measures form a chain-complete partial order\ + +subsection \Complete lattice structure on measures\ + +lemma (in finite_measure) finite_measure_Diff': + "A \ sets M \ B \ sets M \ measure M (A - B) = measure M A - measure M (A \ B)" + using finite_measure_Diff[of A "A \ B"] by (auto simp: Diff_Int) + +lemma (in finite_measure) finite_measure_Union': + "A \ sets M \ B \ sets M \ measure M (A \ B) = measure M A + measure M (B - A)" + using finite_measure_Union[of A "B - A"] by auto + +lemma finite_unsigned_Hahn_decomposition: + assumes "finite_measure M" "finite_measure N" and [simp]: "sets N = sets M" + shows "\Y\sets M. (\X\sets M. X \ Y \ N X \ M X) \ (\X\sets M. X \ Y = {} \ M X \ N X)" +proof - + interpret M: finite_measure M by fact + interpret N: finite_measure N by fact + + define d where "d X = measure M X - measure N X" for X + + have [intro]: "bdd_above (d`sets M)" + using sets.sets_into_space[of _ M] + by (intro bdd_aboveI[where M="measure M (space M)"]) + (auto simp: d_def field_simps subset_eq intro!: add_increasing M.finite_measure_mono) + + define \ where "\ = (SUP X:sets M. d X)" + have le_\[intro]: "X \ sets M \ d X \ \" for X + by (auto simp: \_def intro!: cSUP_upper) + + have "\f. \n. f n \ sets M \ d (f n) > \ - 1 / 2^n" + proof (intro choice_iff[THEN iffD1] allI) + fix n + have "\X\sets M. \ - 1 / 2^n < d X" + unfolding \_def by (intro less_cSUP_iff[THEN iffD1]) auto + then show "\y. y \ sets M \ \ - 1 / 2 ^ n < d y" + by auto + qed + then obtain E where [measurable]: "E n \ sets M" and E: "d (E n) > \ - 1 / 2^n" for n + by auto + + define F where "F m n = (if m \ n then \i\{m..n}. E i else space M)" for m n + + have [measurable]: "m \ n \ F m n \ sets M" for m n + by (auto simp: F_def) + + have 1: "\ - 2 / 2 ^ m + 1 / 2 ^ n \ d (F m n)" if "m \ n" for m n + using that + proof (induct rule: dec_induct) + case base with E[of m] show ?case + by (simp add: F_def field_simps) + next + case (step i) + have F_Suc: "F m (Suc i) = F m i \ E (Suc i)" + using \m \ i\ by (auto simp: F_def le_Suc_eq) + + have "\ + (\ - 2 / 2^m + 1 / 2 ^ Suc i) \ (\ - 1 / 2^Suc i) + (\ - 2 / 2^m + 1 / 2^i)" + by (simp add: field_simps) + also have "\ \ d (E (Suc i)) + d (F m i)" + using E[of "Suc i"] by (intro add_mono step) auto + also have "\ = d (E (Suc i)) + d (F m i - E (Suc i)) + d (F m (Suc i))" + using \m \ i\ by (simp add: d_def field_simps F_Suc M.finite_measure_Diff' N.finite_measure_Diff') + also have "\ = d (E (Suc i) \ F m i) + d (F m (Suc i))" + using \m \ i\ by (simp add: d_def field_simps M.finite_measure_Union' N.finite_measure_Union') + also have "\ \ \ + d (F m (Suc i))" + using \m \ i\ by auto + finally show ?case + by auto + qed + + define F' where "F' m = (\i\{m..}. E i)" for m + have F'_eq: "F' m = (\i. F m (i + m))" for m + by (fastforce simp: le_iff_add[of m] F'_def F_def) + + have [measurable]: "F' m \ sets M" for m + by (auto simp: F'_def) + + have \_le: "\ - 0 \ d (\m. F' m)" + proof (rule LIMSEQ_le) + show "(\n. \ - 2 / 2 ^ n) \ \ - 0" + by (intro tendsto_intros LIMSEQ_divide_realpow_zero) auto + have "incseq F'" + by (auto simp: incseq_def F'_def) + then show "(\m. d (F' m)) \ d (\m. F' m)" + unfolding d_def + by (intro tendsto_diff M.finite_Lim_measure_incseq N.finite_Lim_measure_incseq) auto + + have "\ - 2 / 2 ^ m + 0 \ d (F' m)" for m + proof (rule LIMSEQ_le) + have *: "decseq (\n. F m (n + m))" + by (auto simp: decseq_def F_def) + show "(\n. d (F m n)) \ d (F' m)" + unfolding d_def F'_eq + by (rule LIMSEQ_offset[where k=m]) + (auto intro!: tendsto_diff M.finite_Lim_measure_decseq N.finite_Lim_measure_decseq *) + show "(\n. \ - 2 / 2 ^ m + 1 / 2 ^ n) \ \ - 2 / 2 ^ m + 0" + by (intro tendsto_add LIMSEQ_divide_realpow_zero tendsto_const) auto + show "\N. \n\N. \ - 2 / 2 ^ m + 1 / 2 ^ n \ d (F m n)" + using 1[of m] by (intro exI[of _ m]) auto + qed + then show "\N. \n\N. \ - 2 / 2 ^ n \ d (F' n)" + by auto + qed + + show ?thesis + proof (safe intro!: bexI[of _ "\m. F' m"]) + fix X assume [measurable]: "X \ sets M" and X: "X \ (\m. F' m)" + have "d (\m. F' m) - d X = d ((\m. F' m) - X)" + using X by (auto simp: d_def M.finite_measure_Diff N.finite_measure_Diff) + also have "\ \ \" + by auto + finally have "0 \ d X" + using \_le by auto + then show "emeasure N X \ emeasure M X" + by (auto simp: d_def M.emeasure_eq_measure N.emeasure_eq_measure) + next + fix X assume [measurable]: "X \ sets M" and X: "X \ (\m. F' m) = {}" + then have "d (\m. F' m) + d X = d (X \ (\m. F' m))" + by (auto simp: d_def M.finite_measure_Union N.finite_measure_Union) + also have "\ \ \" + by auto + finally have "d X \ 0" + using \_le by auto + then show "emeasure M X \ emeasure N X" + by (auto simp: d_def M.emeasure_eq_measure N.emeasure_eq_measure) + qed auto +qed + +lemma unsigned_Hahn_decomposition: + assumes [simp]: "sets N = sets M" and [measurable]: "A \ sets M" + and [simp]: "emeasure M A \ top" "emeasure N A \ top" + shows "\Y\sets M. Y \ A \ (\X\sets M. X \ Y \ N X \ M X) \ (\X\sets M. X \ A \ X \ Y = {} \ M X \ N X)" +proof - + have "\Y\sets (restrict_space M A). + (\X\sets (restrict_space M A). X \ Y \ (restrict_space N A) X \ (restrict_space M A) X) \ + (\X\sets (restrict_space M A). X \ Y = {} \ (restrict_space M A) X \ (restrict_space N A) X)" + proof (rule finite_unsigned_Hahn_decomposition) + show "finite_measure (restrict_space M A)" "finite_measure (restrict_space N A)" + by (auto simp: space_restrict_space emeasure_restrict_space less_top intro!: finite_measureI) + qed (simp add: sets_restrict_space) + then guess Y .. + then show ?thesis + apply (intro bexI[of _ Y] conjI ballI conjI) + apply (simp_all add: sets_restrict_space emeasure_restrict_space) + apply safe + subgoal for X Z + by (erule ballE[of _ _ X]) (auto simp add: Int_absorb1) + subgoal for X Z + by (erule ballE[of _ _ X]) (auto simp add: Int_absorb1 ac_simps) + apply auto + done +qed + +text \ + Define a lexicographical order on @{type measure}, in the order space, sets and measure. The parts + of the lexicographical order are point-wise ordered. +\ instantiation measure :: (type) order_bot begin -definition bot_measure :: "'a measure" where - "bot_measure = sigma {} {{}}" - -lemma space_bot[simp]: "space bot = {}" - unfolding bot_measure_def by (rule space_measure_of) auto - -lemma sets_bot[simp]: "sets bot = {{}}" - unfolding bot_measure_def by (subst sets_measure_of) auto - -lemma emeasure_bot[simp]: "emeasure bot = (\x. 0)" - unfolding bot_measure_def by (rule emeasure_sigma) - inductive less_eq_measure :: "'a measure \ 'a measure \ bool" where - "sets N = sets M \ (\A. A \ sets M \ emeasure M A \ emeasure N A) \ less_eq_measure M N" -| "less_eq_measure bot N" + "space M \ space N \ less_eq_measure M N" +| "space M = space N \ sets M \ sets N \ less_eq_measure M N" +| "space M = space N \ sets M = sets N \ emeasure M \ emeasure N \ less_eq_measure M N" + +lemma le_measure_iff: + "M \ N \ (if space M = space N then + if sets M = sets N then emeasure M \ emeasure N else sets M \ sets N else space M \ space N)" + by (auto elim: less_eq_measure.cases intro: less_eq_measure.intros) definition less_measure :: "'a measure \ 'a measure \ bool" where "less_measure M N \ (M \ N \ \ N \ M)" -instance -proof (standard, goal_cases) - case 1 then show ?case - unfolding less_measure_def .. -next - case (2 M) then show ?case - by (intro less_eq_measure.intros) auto -next - case (3 M N L) then show ?case - apply (safe elim!: less_eq_measure.cases) - apply (simp_all add: less_eq_measure.intros) - apply (rule less_eq_measure.intros) - apply simp - apply (blast intro: order_trans) [] - unfolding less_eq_measure.simps - apply (rule disjI2) - apply simp - apply (rule measure_eqI) - apply (auto intro!: antisym) - done -next - case (4 M N) then show ?case - apply (safe elim!: less_eq_measure.cases intro!: measure_eqI) - apply simp - apply simp - apply (blast intro: antisym) - apply (simp) - apply simp - done -qed (rule less_eq_measure.intros) -end - -lemma le_emeasureD: "M \ N \ emeasure M A \ emeasure N A" - by (cases "A \ sets M") (auto elim!: less_eq_measure.cases simp: emeasure_notin_sets) - -lemma le_sets: "N \ M \ sets N \ sets M" - unfolding less_eq_measure.simps by auto - -instantiation measure :: (type) ccpo -begin - -definition Sup_measure :: "'a measure set \ 'a measure" where - "Sup_measure A = measure_of (SUP a:A. space a) (SUP a:A. sets a) (SUP a:A. emeasure a)" +definition bot_measure :: "'a measure" where + "bot_measure = sigma {} {}" lemma - assumes A: "Complete_Partial_Order.chain op \ A" and a: "a \ bot" "a \ A" - shows space_Sup: "space (Sup A) = space a" - and sets_Sup: "sets (Sup A) = sets a" + shows space_bot[simp]: "space bot = {}" + and sets_bot[simp]: "sets bot = {{}}" + and emeasure_bot[simp]: "emeasure bot X = 0" + by (auto simp: bot_measure_def sigma_sets_empty_eq emeasure_sigma) + +instance +proof standard + show "bot \ a" for a :: "'a measure" + by (simp add: le_measure_iff bot_measure_def sigma_sets_empty_eq emeasure_sigma le_fun_def) +qed (auto simp: le_measure_iff less_measure_def split: if_split_asm intro: measure_eqI) + +end + +lemma le_measure: "sets M = sets N \ M \ N \ (\A\sets M. emeasure M A \ emeasure N A)" + apply (auto simp: le_measure_iff le_fun_def dest: sets_eq_imp_space_eq) + subgoal for X + by (cases "X \ sets M") (auto simp: emeasure_notin_sets) + done + +definition sup_measure' :: "'a measure \ 'a measure \ 'a measure" +where + "sup_measure' A B = measure_of (space A) (sets A) (\X. SUP Y:sets A. emeasure A (X \ Y) + emeasure B (X \ - Y))" + +lemma assumes [simp]: "sets B = sets A" + shows space_sup_measure'[simp]: "space (sup_measure' A B) = space A" + and sets_sup_measure'[simp]: "sets (sup_measure' A B) = sets A" + using sets_eq_imp_space_eq[OF assms] by (simp_all add: sup_measure'_def) + +lemma emeasure_sup_measure': + assumes sets_eq[simp]: "sets B = sets A" and [simp, intro]: "X \ sets A" + shows "emeasure (sup_measure' A B) X = (SUP Y:sets A. emeasure A (X \ Y) + emeasure B (X \ - Y))" + (is "_ = ?S X") proof - - have sets: "(SUP a:A. sets a) = sets a" - proof (intro antisym SUP_least) - fix a' show "a' \ A \ sets a' \ sets a" - using a chainD[OF A, of a a'] by (auto elim!: less_eq_measure.cases) - qed (insert \a\A\, auto) - have space: "(SUP a:A. space a) = space a" - proof (intro antisym SUP_least) - fix a' show "a' \ A \ space a' \ space a" - using a chainD[OF A, of a a'] by (intro sets_le_imp_space_le) (auto elim!: less_eq_measure.cases) - qed (insert \a\A\, auto) - show "space (Sup A) = space a" - unfolding Sup_measure_def sets space sets.space_measure_of_eq .. - show "sets (Sup A) = sets a" - unfolding Sup_measure_def sets space sets.sets_measure_of_eq .. + note sets_eq_imp_space_eq[OF sets_eq, simp] + show ?thesis + using sup_measure'_def + proof (rule emeasure_measure_of) + let ?d = "\X Y. emeasure A (X \ Y) + emeasure B (X \ - Y)" + show "countably_additive (sets (sup_measure' A B)) (\X. SUP Y : sets A. emeasure A (X \ Y) + emeasure B (X \ - Y))" + proof (rule countably_additiveI, goal_cases) + case (1 X) + then have [measurable]: "\i. X i \ sets A" and "disjoint_family X" + by auto + have "(\i. ?S (X i)) = (SUP Y:sets A. \i. ?d (X i) Y)" + proof (rule ennreal_suminf_SUP_eq_directed) + fix J :: "nat set" and a b assume "finite J" and [measurable]: "a \ sets A" "b \ sets A" + have "\c\sets A. c \ X i \ (\a\sets A. ?d (X i) a \ ?d (X i) c)" for i + proof cases + assume "emeasure A (X i) = top \ emeasure B (X i) = top" + then show ?thesis + proof + assume "emeasure A (X i) = top" then show ?thesis + by (intro bexI[of _ "X i"]) auto + next + assume "emeasure B (X i) = top" then show ?thesis + by (intro bexI[of _ "{}"]) auto + qed + next + assume finite: "\ (emeasure A (X i) = top \ emeasure B (X i) = top)" + then have "\Y\sets A. Y \ X i \ (\C\sets A. C \ Y \ B C \ A C) \ (\C\sets A. C \ X i \ C \ Y = {} \ A C \ B C)" + using unsigned_Hahn_decomposition[of B A "X i"] by simp + then obtain Y where [measurable]: "Y \ sets A" and [simp]: "Y \ X i" + and B_le_A: "\C. C \ sets A \ C \ Y \ B C \ A C" + and A_le_B: "\C. C \ sets A \ C \ X i \ C \ Y = {} \ A C \ B C" + by auto + + show ?thesis + proof (intro bexI[of _ Y] ballI conjI) + fix a assume [measurable]: "a \ sets A" + have *: "(X i \ a \ Y \ (X i \ a - Y)) = X i \ a" "(X i - a) \ Y \ (X i - a - Y) = X i \ - a" + for a Y by auto + then have "?d (X i) a = + (A (X i \ a \ Y) + A (X i \ a \ - Y)) + (B (X i \ - a \ Y) + B (X i \ - a \ - Y))" + by (subst (1 2) plus_emeasure) (auto simp: Diff_eq[symmetric]) + also have "\ \ (A (X i \ a \ Y) + B (X i \ a \ - Y)) + (A (X i \ - a \ Y) + B (X i \ - a \ - Y))" + by (intro add_mono order_refl B_le_A A_le_B) (auto simp: Diff_eq[symmetric]) + also have "\ \ (A (X i \ Y \ a) + A (X i \ Y \ - a)) + (B (X i \ - Y \ a) + B (X i \ - Y \ - a))" + by (simp add: ac_simps) + also have "\ \ A (X i \ Y) + B (X i \ - Y)" + by (subst (1 2) plus_emeasure) (auto simp: Diff_eq[symmetric] *) + finally show "?d (X i) a \ ?d (X i) Y" . + qed auto + qed + then obtain C where [measurable]: "C i \ sets A" and "C i \ X i" + and C: "\a. a \ sets A \ ?d (X i) a \ ?d (X i) (C i)" for i + by metis + have *: "X i \ (\i. C i) = X i \ C i" for i + proof safe + fix x j assume "x \ X i" "x \ C j" + moreover have "i = j \ X i \ X j = {}" + using \disjoint_family X\ by (auto simp: disjoint_family_on_def) + ultimately show "x \ C i" + using \C i \ X i\ \C j \ X j\ by auto + qed auto + have **: "X i \ - (\i. C i) = X i \ - C i" for i + proof safe + fix x j assume "x \ X i" "x \ C i" "x \ C j" + moreover have "i = j \ X i \ X j = {}" + using \disjoint_family X\ by (auto simp: disjoint_family_on_def) + ultimately show False + using \C i \ X i\ \C j \ X j\ by auto + qed auto + show "\c\sets A. \i\J. ?d (X i) a \ ?d (X i) c \ ?d (X i) b \ ?d (X i) c" + apply (intro bexI[of _ "\i. C i"]) + unfolding * ** + apply (intro C ballI conjI) + apply auto + done + qed + also have "\ = ?S (\i. X i)" + unfolding UN_extend_simps(4) + by (auto simp add: suminf_add[symmetric] Diff_eq[symmetric] simp del: UN_simps + intro!: SUP_cong arg_cong2[where f="op +"] suminf_emeasure + disjoint_family_on_bisimulation[OF \disjoint_family X\]) + finally show "(\i. ?S (X i)) = ?S (\i. X i)" . + qed + qed (auto dest: sets.sets_into_space simp: positive_def intro!: SUP_const) qed -lemma emeasure_Sup: - assumes A: "Complete_Partial_Order.chain op \ A" "A \ {}" - assumes "X \ sets (Sup A)" - shows "emeasure (Sup A) X = (SUP a:A. emeasure a) X" -proof (rule emeasure_measure_of[OF Sup_measure_def]) - show "countably_additive (sets (Sup A)) (SUP a:A. emeasure a)" - unfolding countably_additive_def - proof safe - fix F :: "nat \ 'a set" assume F: "range F \ sets (Sup A)" "disjoint_family F" - show "(\i. (SUP a:A. emeasure a) (F i)) = SUPREMUM A emeasure (UNION UNIV F)" - unfolding SUP_apply +lemma le_emeasure_sup_measure'1: + assumes "sets B = sets A" "X \ sets A" shows "emeasure A X \ emeasure (sup_measure' A B) X" + by (subst emeasure_sup_measure'[OF assms]) (auto intro!: SUP_upper2[of "X"] assms) + +lemma le_emeasure_sup_measure'2: + assumes "sets B = sets A" "X \ sets A" shows "emeasure B X \ emeasure (sup_measure' A B) X" + by (subst emeasure_sup_measure'[OF assms]) (auto intro!: SUP_upper2[of "{}"] assms) + +lemma emeasure_sup_measure'_le2: + assumes [simp]: "sets B = sets C" "sets A = sets C" and [measurable]: "X \ sets C" + assumes A: "\Y. Y \ X \ Y \ sets A \ emeasure A Y \ emeasure C Y" + assumes B: "\Y. Y \ X \ Y \ sets A \ emeasure B Y \ emeasure C Y" + shows "emeasure (sup_measure' A B) X \ emeasure C X" +proof (subst emeasure_sup_measure') + show "(SUP Y:sets A. emeasure A (X \ Y) + emeasure B (X \ - Y)) \ emeasure C X" + unfolding \sets A = sets C\ + proof (intro SUP_least) + fix Y assume [measurable]: "Y \ sets C" + have [simp]: "X \ Y \ (X - Y) = X" + by auto + have "emeasure A (X \ Y) + emeasure B (X \ - Y) \ emeasure C (X \ Y) + emeasure C (X \ - Y)" + by (intro add_mono A B) (auto simp: Diff_eq[symmetric]) + also have "\ = emeasure C X" + by (subst plus_emeasure) (auto simp: Diff_eq[symmetric]) + finally show "emeasure A (X \ Y) + emeasure B (X \ - Y) \ emeasure C X" . + qed +qed simp_all + +definition sup_lexord :: "'a \ 'a \ ('a \ 'b::order) \ 'a \ 'a \ 'a" +where + "sup_lexord A B k s c = + (if k A = k B then c else if \ k A \ k B \ \ k B \ k A then s else if k B \ k A then A else B)" + +lemma sup_lexord: + "(k A < k B \ P B) \ (k B < k A \ P A) \ (k A = k B \ P c) \ + (\ k B \ k A \ \ k A \ k B \ P s) \ P (sup_lexord A B k s c)" + by (auto simp: sup_lexord_def) + +lemmas le_sup_lexord = sup_lexord[where P="\a. c \ a" for c] + +lemma sup_lexord1: "k A = k B \ sup_lexord A B k s c = c" + by (simp add: sup_lexord_def) + +lemma sup_lexord_commute: "sup_lexord A B k s c = sup_lexord B A k s c" + by (auto simp: sup_lexord_def) + +lemma sigma_sets_le_sets_iff: "(sigma_sets (space x) \ \ sets x) = (\ \ sets x)" + using sets.sigma_sets_subset[of \ x] by auto + +lemma sigma_le_iff: "\ \ Pow \ \ sigma \ \ \ x \ (\ \ space x \ (space x = \ \ \ \ sets x))" + by (cases "\ = space x") + (simp_all add: eq_commute[of _ "sets x"] le_measure_iff emeasure_sigma le_fun_def + sigma_sets_superset_generator sigma_sets_le_sets_iff) + +instantiation measure :: (type) semilattice_sup +begin + +definition sup_measure :: "'a measure \ 'a measure \ 'a measure" +where + "sup_measure A B = + sup_lexord A B space (sigma (space A \ space B) {}) + (sup_lexord A B sets (sigma (space A) (sets A \ sets B)) (sup_measure' A B))" + +instance +proof + fix x y z :: "'a measure" + show "x \ sup x y" + unfolding sup_measure_def + proof (intro le_sup_lexord) + assume "space x = space y" + then have *: "sets x \ sets y \ Pow (space x)" + using sets.space_closed by auto + assume "\ sets y \ sets x" "\ sets x \ sets y" + then have "sets x \ sets x \ sets y" + by auto + also have "\ \ sigma (space x) (sets x \ sets y)" + by (subst sets_measure_of[OF *]) (rule sigma_sets_superset_generator) + finally show "x \ sigma (space x) (sets x \ sets y)" + by (simp add: space_measure_of[OF *] less_eq_measure.intros(2)) + next + assume "\ space y \ space x" "\ space x \ space y" + then show "x \ sigma (space x \ space y) {}" + by (intro less_eq_measure.intros) auto + next + assume "sets x = sets y" then show "x \ sup_measure' x y" + by (simp add: le_measure le_emeasure_sup_measure'1) + qed (auto intro: less_eq_measure.intros) + show "y \ sup x y" + unfolding sup_measure_def + proof (intro le_sup_lexord) + assume **: "space x = space y" + then have *: "sets x \ sets y \ Pow (space y)" + using sets.space_closed by auto + assume "\ sets y \ sets x" "\ sets x \ sets y" + then have "sets y \ sets x \ sets y" + by auto + also have "\ \ sigma (space y) (sets x \ sets y)" + by (subst sets_measure_of[OF *]) (rule sigma_sets_superset_generator) + finally show "y \ sigma (space x) (sets x \ sets y)" + by (simp add: ** space_measure_of[OF *] less_eq_measure.intros(2)) + next + assume "\ space y \ space x" "\ space x \ space y" + then show "y \ sigma (space x \ space y) {}" + by (intro less_eq_measure.intros) auto + next + assume "sets x = sets y" then show "y \ sup_measure' x y" + by (simp add: le_measure le_emeasure_sup_measure'2) + qed (auto intro: less_eq_measure.intros) + show "x \ y \ z \ y \ sup x z \ y" + unfolding sup_measure_def + proof (intro sup_lexord[where P="\x. x \ y"]) + assume "x \ y" "z \ y" and [simp]: "space x = space z" "sets x = sets z" + from \x \ y\ show "sup_measure' x z \ y" + proof cases + case 1 then show ?thesis + by (intro less_eq_measure.intros(1)) simp + next + case 2 then show ?thesis + by (intro less_eq_measure.intros(2)) simp_all + next + case 3 with \z \ y\ \x \ y\ show ?thesis + by (auto simp add: le_measure intro!: emeasure_sup_measure'_le2) + qed + next + assume **: "x \ y" "z \ y" "space x = space z" "\ sets z \ sets x" "\ sets x \ sets z" + then have *: "sets x \ sets z \ Pow (space x)" + using sets.space_closed by auto + show "sigma (space x) (sets x \ sets z) \ y" + unfolding sigma_le_iff[OF *] using ** by (auto simp: le_measure_iff split: if_split_asm) + next + assume "x \ y" "z \ y" "\ space z \ space x" "\ space x \ space z" + then have "space x \ space y" "space z \ space y" + by (auto simp: le_measure_iff split: if_split_asm) + then show "sigma (space x \ space z) {} \ y" + by (simp add: sigma_le_iff) + qed +qed + +end + +lemma space_empty_eq_bot: "space a = {} \ a = bot" + using space_empty[of a] by (auto intro!: measure_eqI) + +interpretation sup_measure: comm_monoid_set sup "bot :: 'a measure" + proof qed (auto intro!: antisym) + +lemma sup_measure_F_mono': + "finite J \ finite I \ sup_measure.F id I \ sup_measure.F id (I \ J)" +proof (induction J rule: finite_induct) + case empty then show ?case + by simp +next + case (insert i J) + show ?case + proof cases + assume "i \ I" with insert show ?thesis + by (auto simp: insert_absorb) + next + assume "i \ I" + have "sup_measure.F id I \ sup_measure.F id (I \ J)" + by (intro insert) + also have "\ \ sup_measure.F id (insert i (I \ J))" + using insert \i \ I\ by (subst sup_measure.insert) auto + finally show ?thesis + by auto + qed +qed + +lemma sup_measure_F_mono: "finite I \ J \ I \ sup_measure.F id J \ sup_measure.F id I" + using sup_measure_F_mono'[of I J] by (auto simp: finite_subset Un_absorb1) + +lemma sets_eq_iff_bounded: "A \ B \ B \ C \ sets A = sets C \ sets B = sets A" + by (auto dest: sets_eq_imp_space_eq simp add: le_measure_iff split: if_split_asm) + +lemma sets_sup: "sets A = sets M \ sets B = sets M \ sets (sup A B) = sets M" + by (auto simp add: sup_measure_def sup_lexord_def dest: sets_eq_imp_space_eq) + +lemma sets_sup_measure_F: + "finite I \ I \ {} \ (\i. i \ I \ sets i = sets M) \ sets (sup_measure.F id I) = sets M" + by (induction I rule: finite_ne_induct) (simp_all add: sets_sup) + +lemma le_measureD1: "A \ B \ space A \ space B" + by (auto simp: le_measure_iff split: if_split_asm) + +lemma le_measureD2: "A \ B \ space A = space B \ sets A \ sets B" + by (auto simp: le_measure_iff split: if_split_asm) + +lemma le_measureD3: "A \ B \ sets A = sets B \ emeasure A X \ emeasure B X" + by (auto simp: le_measure_iff le_fun_def dest: sets_eq_imp_space_eq split: if_split_asm) + +definition Sup_measure' :: "'a measure set \ 'a measure" +where + "Sup_measure' M = measure_of (\a\M. space a) (\a\M. sets a) + (\X. (SUP P:{P. finite P \ P \ M }. sup_measure.F id P X))" + +lemma UN_space_closed: "UNION S sets \ Pow (UNION S space)" + using sets.space_closed by auto + +lemma space_Sup_measure'2: "space (Sup_measure' M) = (\m\M. space m)" + unfolding Sup_measure'_def by (intro space_measure_of[OF UN_space_closed]) + +lemma sets_Sup_measure'2: "sets (Sup_measure' M) = sigma_sets (\m\M. space m) (\m\M. sets m)" + unfolding Sup_measure'_def by (intro sets_measure_of[OF UN_space_closed]) + +lemma sets_Sup_measure': + assumes sets_eq[simp]: "\m. m \ M \ sets m = sets A" and "M \ {}" + shows "sets (Sup_measure' M) = sets A" + using sets_eq[THEN sets_eq_imp_space_eq, simp] \M \ {}\ by (simp add: Sup_measure'_def) + +lemma space_Sup_measure': + assumes sets_eq[simp]: "\m. m \ M \ sets m = sets A" and "M \ {}" + shows "space (Sup_measure' M) = space A" + using sets_eq[THEN sets_eq_imp_space_eq, simp] \M \ {}\ + by (simp add: Sup_measure'_def ) + +lemma emeasure_Sup_measure': + assumes sets_eq[simp]: "\m. m \ M \ sets m = sets A" and "X \ sets A" "M \ {}" + shows "emeasure (Sup_measure' M) X = (SUP P:{P. finite P \ P \ M}. sup_measure.F id P X)" + (is "_ = ?S X") + using Sup_measure'_def +proof (rule emeasure_measure_of) + note sets_eq[THEN sets_eq_imp_space_eq, simp] + have *: "sets (Sup_measure' M) = sets A" "space (Sup_measure' M) = space A" + using \M \ {}\ by (simp_all add: Sup_measure'_def) + let ?\ = "sup_measure.F id" + show "countably_additive (sets (Sup_measure' M)) ?S" + proof (rule countably_additiveI, goal_cases) + case (1 F) + then have **: "range F \ sets A" + by (auto simp: *) + show "(\i. ?S (F i)) = ?S (\i. F i)" proof (subst ennreal_suminf_SUP_eq_directed) - fix N i j assume "i \ A" "j \ A" - with A(1) - show "\k\A. \n\N. emeasure i (F n) \ emeasure k (F n) \ emeasure j (F n) \ emeasure k (F n)" - by (blast elim: chainE dest: le_emeasureD) + fix i j and N :: "nat set" assume ij: "i \ {P. finite P \ P \ M}" "j \ {P. finite P \ P \ M}" + have "(i \ {} \ sets (?\ i) = sets A) \ (j \ {} \ sets (?\ j) = sets A) \ + (i \ {} \ j \ {} \ sets (?\ (i \ j)) = sets A)" + using ij by (intro impI sets_sup_measure_F conjI) auto + then have "?\ j (F n) \ ?\ (i \ j) (F n) \ ?\ i (F n) \ ?\ (i \ j) (F n)" for n + using ij + by (cases "i = {}"; cases "j = {}") + (auto intro!: le_measureD3 sup_measure_F_mono simp: sets_sup_measure_F + simp del: id_apply) + with ij show "\k\{P. finite P \ P \ M}. \n\N. ?\ i (F n) \ ?\ k (F n) \ ?\ j (F n) \ ?\ k (F n)" + by (safe intro!: bexI[of _ "i \ j"]) auto next - show "(SUP n:A. \i. emeasure n (F i)) = (SUP y:A. emeasure y (UNION UNIV F))" + show "(SUP P : {P. finite P \ P \ M}. \n. ?\ P (F n)) = (SUP P : {P. finite P \ P \ M}. ?\ P (UNION UNIV F))" proof (intro SUP_cong refl) - fix a assume "a \ A" then show "(\i. emeasure a (F i)) = emeasure a (UNION UNIV F)" - using sets_Sup[OF A(1), of a] F by (cases "a = bot") (auto simp: suminf_emeasure) + fix i assume i: "i \ {P. finite P \ P \ M}" + show "(\n. ?\ i (F n)) = ?\ i (UNION UNIV F)" + proof cases + assume "i \ {}" with i ** show ?thesis + apply (intro suminf_emeasure \disjoint_family F\) + apply (subst sets_sup_measure_F[OF _ _ sets_eq]) + apply auto + done + qed simp qed qed qed -qed (insert \A \ {}\ \X \ sets (Sup A)\, auto simp: positive_def dest: sets.sets_into_space intro: SUP_upper2) + show "positive (sets (Sup_measure' M)) ?S" + by (auto simp: positive_def bot_ennreal[symmetric]) + show "X \ sets (Sup_measure' M)" + using assms * by auto +qed (rule UN_space_closed) + +definition Sup_lexord :: "('a \ 'b::complete_lattice) \ ('a set \ 'a) \ ('a set \ 'a) \ 'a set \ 'a" +where + "Sup_lexord k c s A = (let U = (SUP a:A. k a) in if \a\A. k a = U then c {a\A. k a = U} else s A)" + +lemma Sup_lexord: + "(\a S. a \ A \ k a = (SUP a:A. k a) \ S = {a'\A. k a' = k a} \ P (c S)) \ ((\a. a \ A \ k a \ (SUP a:A. k a)) \ P (s A)) \ + P (Sup_lexord k c s A)" + by (auto simp: Sup_lexord_def Let_def) + +lemma Sup_lexord1: + assumes A: "A \ {}" "(\a. a \ A \ k a = (\a\A. k a))" "P (c A)" + shows "P (Sup_lexord k c s A)" + unfolding Sup_lexord_def Let_def +proof (clarsimp, safe) + show "\a\A. k a \ (\x\A. k x) \ P (s A)" + by (metis assms(1,2) ex_in_conv) +next + fix a assume "a \ A" "k a = (\x\A. k x)" + then have "{a \ A. k a = (\x\A. k x)} = {a \ A. k a = k a}" + by (metis A(2)[symmetric]) + then show "P (c {a \ A. k a = (\x\A. k x)})" + by (simp add: A(3)) +qed + +instantiation measure :: (type) complete_lattice +begin + +definition Sup_measure :: "'a measure set \ 'a measure" +where + "Sup_measure = Sup_lexord space (Sup_lexord sets Sup_measure' + (\U. sigma (\u\U. space u) (\u\U. sets u))) (\U. sigma (\u\U. space u) {})" + +definition Inf_measure :: "'a measure set \ 'a measure" +where + "Inf_measure A = Sup {x. \a\A. x \ a}" + +definition inf_measure :: "'a measure \ 'a measure \ 'a measure" +where + "inf_measure a b = Inf {a, b}" + +definition top_measure :: "'a measure" +where + "top_measure = Inf {}" instance proof - fix A and x :: "'a measure" assume A: "Complete_Partial_Order.chain op \ A" and x: "x \ A" - show "x \ Sup A" - proof cases - assume "x \ bot" - show ?thesis - proof - show "sets (Sup A) = sets x" - using A \x \ bot\ x by (rule sets_Sup) - with x show "\a. a \ sets x \ emeasure x a \ emeasure (Sup A) a" - by (subst emeasure_Sup[OF A]) (auto intro: SUP_upper) + note UN_space_closed [simp] + show upper: "x \ Sup A" if x: "x \ A" for x :: "'a measure" and A + unfolding Sup_measure_def + proof (intro Sup_lexord[where P="\y. x \ y"]) + assume "\a. a \ A \ space a \ (\a\A. space a)" + from this[OF \x \ A\] \x \ A\ show "x \ sigma (\a\A. space a) {}" + by (intro less_eq_measure.intros) auto + next + fix a S assume "a \ A" and a: "space a = (\a\A. space a)" and S: "S = {a' \ A. space a' = space a}" + and neq: "\aa. aa \ S \ sets aa \ (\a\S. sets a)" + have sp_a: "space a = (UNION S space)" + using \a\A\ by (auto simp: S) + show "x \ sigma (UNION S space) (UNION S sets)" + proof cases + assume [simp]: "space x = space a" + have "sets x \ (\a\S. sets a)" + using \x\A\ neq[of x] by (auto simp: S) + also have "\ \ sigma_sets (\x\S. space x) (\x\S. sets x)" + by (rule sigma_sets_superset_generator) + finally show ?thesis + by (intro less_eq_measure.intros(2)) (simp_all add: sp_a) + next + assume "space x \ space a" + moreover have "space x \ space a" + unfolding a using \x\A\ by auto + ultimately show ?thesis + by (intro less_eq_measure.intros) (simp add: less_le sp_a) qed - qed simp -next - fix A and x :: "'a measure" assume A: "Complete_Partial_Order.chain op \ A" and x: "\z. z \ A \ z \ x" - consider "A = {}" | "A = {bot}" | x where "x\A" "x \ bot" - by blast - then show "Sup A \ x" - proof cases - assume "A = {}" - moreover have "Sup ({}::'a measure set) = bot" - by (auto simp add: Sup_measure_def sigma_sets_empty_eq intro!: measure_eqI) - ultimately show ?thesis - by simp next - assume "A = {bot}" - moreover have "Sup ({bot}::'a measure set) = bot" - by (auto simp add: Sup_measure_def sigma_sets_empty_eq intro!: measure_eqI) - ultimately show ?thesis - by simp + fix a b S S' assume "a \ A" and a: "space a = (\a\A. space a)" and S: "S = {a' \ A. space a' = space a}" + and "b \ S" and b: "sets b = (\a\S. sets a)" and S': "S' = {a' \ S. sets a' = sets b}" + then have "S' \ {}" "space b = space a" + by auto + have sets_eq: "\x. x \ S' \ sets x = sets b" + by (auto simp: S') + note sets_eq[THEN sets_eq_imp_space_eq, simp] + have *: "sets (Sup_measure' S') = sets b" "space (Sup_measure' S') = space b" + using \S' \ {}\ by (simp_all add: Sup_measure'_def sets_eq) + show "x \ Sup_measure' S'" + proof cases + assume "x \ S" + with \b \ S\ have "space x = space b" + by (simp add: S) + show ?thesis + proof cases + assume "x \ S'" + show "x \ Sup_measure' S'" + proof (intro le_measure[THEN iffD2] ballI) + show "sets x = sets (Sup_measure' S')" + using \x\S'\ * by (simp add: S') + fix X assume "X \ sets x" + show "emeasure x X \ emeasure (Sup_measure' S') X" + proof (subst emeasure_Sup_measure'[OF _ \X \ sets x\]) + show "emeasure x X \ (SUP P : {P. finite P \ P \ S'}. emeasure (sup_measure.F id P) X)" + using \x\S'\ by (intro SUP_upper2[where i="{x}"]) auto + qed (insert \x\S'\ S', auto) + qed + next + assume "x \ S'" + then have "sets x \ sets b" + using \x\S\ by (auto simp: S') + moreover have "sets x \ sets b" + using \x\S\ unfolding b by auto + ultimately show ?thesis + using * \x \ S\ + by (intro less_eq_measure.intros(2)) + (simp_all add: * \space x = space b\ less_le) + qed + next + assume "x \ S" + with \x\A\ \x \ S\ \space b = space a\ show ?thesis + by (intro less_eq_measure.intros) + (simp_all add: * less_le a SUP_upper S) + qed + qed + show least: "Sup A \ x" if x: "\z. z \ A \ z \ x" for x :: "'a measure" and A + unfolding Sup_measure_def + proof (intro Sup_lexord[where P="\y. y \ x"]) + assume "\a. a \ A \ space a \ (\a\A. space a)" + show "sigma (UNION A space) {} \ x" + using x[THEN le_measureD1] by (subst sigma_le_iff) auto next - fix a assume "a \ A" "a \ bot" - then have "a \ x" "x \ bot" "a \ bot" - using x[OF \a \ A\] by (auto simp: bot_unique) - then have "sets x = sets a" - by (auto elim: less_eq_measure.cases) - - show "Sup A \ x" - proof (rule less_eq_measure.intros) - show "sets x = sets (Sup A)" - by (subst sets_Sup[OF A \a \ bot\ \a \ A\]) fact + fix a S assume "a \ A" "space a = (\a\A. space a)" and S: "S = {a' \ A. space a' = space a}" + "\a. a \ S \ sets a \ (\a\S. sets a)" + have "UNION S space \ space x" + using S le_measureD1[OF x] by auto + moreover + have "UNION S space = space a" + using \a\A\ S by auto + then have "space x = UNION S space \ UNION S sets \ sets x" + using \a \ A\ le_measureD2[OF x] by (auto simp: S) + ultimately show "sigma (UNION S space) (UNION S sets) \ x" + by (subst sigma_le_iff) simp_all + next + fix a b S S' assume "a \ A" and a: "space a = (\a\A. space a)" and S: "S = {a' \ A. space a' = space a}" + and "b \ S" and b: "sets b = (\a\S. sets a)" and S': "S' = {a' \ S. sets a' = sets b}" + then have "S' \ {}" "space b = space a" + by auto + have sets_eq: "\x. x \ S' \ sets x = sets b" + by (auto simp: S') + note sets_eq[THEN sets_eq_imp_space_eq, simp] + have *: "sets (Sup_measure' S') = sets b" "space (Sup_measure' S') = space b" + using \S' \ {}\ by (simp_all add: Sup_measure'_def sets_eq) + show "Sup_measure' S' \ x" + proof cases + assume "space x = space a" + show ?thesis + proof cases + assume **: "sets x = sets b" + show ?thesis + proof (intro le_measure[THEN iffD2] ballI) + show ***: "sets (Sup_measure' S') = sets x" + by (simp add: * **) + fix X assume "X \ sets (Sup_measure' S')" + show "emeasure (Sup_measure' S') X \ emeasure x X" + unfolding *** + proof (subst emeasure_Sup_measure'[OF _ \X \ sets (Sup_measure' S')\]) + show "(SUP P : {P. finite P \ P \ S'}. emeasure (sup_measure.F id P) X) \ emeasure x X" + proof (safe intro!: SUP_least) + fix P assume P: "finite P" "P \ S'" + show "emeasure (sup_measure.F id P) X \ emeasure x X" + proof cases + assume "P = {}" then show ?thesis + by auto + next + assume "P \ {}" + from P have "finite P" "P \ A" + unfolding S' S by (simp_all add: subset_eq) + then have "sup_measure.F id P \ x" + by (induction P) (auto simp: x) + moreover have "sets (sup_measure.F id P) = sets x" + using \finite P\ \P \ {}\ \P \ S'\ \sets x = sets b\ + by (intro sets_sup_measure_F) (auto simp: S') + ultimately show "emeasure (sup_measure.F id P) X \ emeasure x X" + by (rule le_measureD3) + qed + qed + show "m \ S' \ sets m = sets (Sup_measure' S')" for m + unfolding * by (simp add: S') + qed fact + qed + next + assume "sets x \ sets b" + moreover have "sets b \ sets x" + unfolding b S using x[THEN le_measureD2] \space x = space a\ by auto + ultimately show "Sup_measure' S' \ x" + using \space x = space a\ \b \ S\ + by (intro less_eq_measure.intros(2)) (simp_all add: * S) + qed next - fix X assume "X \ sets (Sup A)" - then have "emeasure (Sup A) X \ (SUP a:A. emeasure a X)" - using \a\A\ by (subst emeasure_Sup[OF A _]) auto - also have "\ \ emeasure x X" - by (intro SUP_least le_emeasureD x) - finally show "emeasure (Sup A) X \ emeasure x X" . + assume "space x \ space a" + then have "space a < space x" + using le_measureD1[OF x[OF \a\A\]] by auto + then show "Sup_measure' S' \ x" + by (intro less_eq_measure.intros) (simp add: * \space b = space a\) qed qed + show "Sup {} = (bot::'a measure)" "Inf {} = (top::'a measure)" + by (auto intro!: antisym least simp: top_measure_def) + show lower: "x \ A \ Inf A \ x" for x :: "'a measure" and A + unfolding Inf_measure_def by (intro least) auto + show greatest: "(\z. z \ A \ x \ z) \ x \ Inf A" for x :: "'a measure" and A + unfolding Inf_measure_def by (intro upper) auto + show "inf x y \ x" "inf x y \ y" "x \ y \ x \ z \ x \ inf y z" for x y z :: "'a measure" + by (auto simp: inf_measure_def intro!: lower greatest) qed + end -lemma - assumes A: "Complete_Partial_Order.chain op \ (f ` A)" and a: "a \ A" "f a \ bot" - shows space_SUP: "space (SUP M:A. f M) = space (f a)" - and sets_SUP: "sets (SUP M:A. f M) = sets (f a)" -by(rule space_Sup[OF A a(2) imageI[OF a(1)]] sets_Sup[OF A a(2) imageI[OF a(1)]])+ +lemma sets_SUP: + assumes "\x. x \ I \ sets (M x) = sets N" + shows "I \ {} \ sets (SUP i:I. M i) = sets N" + unfolding Sup_measure_def + using assms assms[THEN sets_eq_imp_space_eq] + sets_Sup_measure'[where A=N and M="M`I"] + by (intro Sup_lexord1[where P="\x. sets x = sets N"]) auto lemma emeasure_SUP: - assumes A: "Complete_Partial_Order.chain op \ (f ` A)" "A \ {}" - assumes "X \ sets (SUP M:A. f M)" - shows "emeasure (SUP M:A. f M) X = (SUP M:A. emeasure (f M)) X" -using \X \ _\ by(subst emeasure_Sup[OF A(1)]; simp add: A) + assumes sets: "\i. i \ I \ sets (M i) = sets N" "X \ sets N" "I \ {}" + shows "emeasure (SUP i:I. M i) X = (SUP J:{J. J \ {} \ finite J \ J \ I}. emeasure (SUP i:J. M i) X)" +proof - + have eq: "finite J \ sup_measure.F id J = (SUP i:J. i)" for J :: "'b measure set" + by (induction J rule: finite_induct) auto + have 1: "J \ {} \ J \ I \ sets (SUP x:J. M x) = sets N" for J + by (intro sets_SUP sets) (auto ) + + from \I \ {}\ obtain i where "i\I" by auto + have "Sup_measure' (M`I) X = (SUP P:{P. finite P \ P \ M`I}. sup_measure.F id P X)" + using sets by (intro emeasure_Sup_measure') auto + also have "Sup_measure' (M`I) = (SUP i:I. M i)" + unfolding Sup_measure_def using \I \ {}\ sets sets(1)[THEN sets_eq_imp_space_eq] + by (intro Sup_lexord1[where P="\x. _ = x"]) auto + also have "(SUP P:{P. finite P \ P \ M`I}. sup_measure.F id P X) = + (SUP J:{J. J \ {} \ finite J \ J \ I}. (SUP i:J. M i) X)" + proof (intro SUP_eq) + fix J assume "J \ {P. finite P \ P \ M`I}" + then obtain J' where J': "J' \ I" "finite J'" and J: "J = M`J'" and "finite J" + using finite_subset_image[of J M I] by auto + show "\j\{J. J \ {} \ finite J \ J \ I}. sup_measure.F id J X \ (SUP i:j. M i) X" + proof cases + assume "J' = {}" with \i \ I\ show ?thesis + by (auto simp add: J) + next + assume "J' \ {}" with J J' show ?thesis + by (intro bexI[of _ "J'"]) (auto simp add: eq simp del: id_apply) + qed + next + fix J assume J: "J \ {P. P \ {} \ finite P \ P \ I}" + show "\J'\{J. finite J \ J \ M`I}. (SUP i:J. M i) X \ sup_measure.F id J' X" + using J by (intro bexI[of _ "M`J"]) (auto simp add: eq simp del: id_apply) + qed + finally show ?thesis . +qed + +lemma emeasure_SUP_chain: + assumes sets: "\i. i \ A \ sets (M i) = sets N" "X \ sets N" + assumes ch: "Complete_Partial_Order.chain op \ (M ` A)" and "A \ {}" + shows "emeasure (SUP i:A. M i) X = (SUP i:A. emeasure (M i) X)" +proof (subst emeasure_SUP[OF sets \A \ {}\]) + show "(SUP J:{J. J \ {} \ finite J \ J \ A}. emeasure (SUPREMUM J M) X) = (SUP i:A. emeasure (M i) X)" + proof (rule SUP_eq) + fix J assume "J \ {J. J \ {} \ finite J \ J \ A}" + then have J: "Complete_Partial_Order.chain op \ (M ` J)" "finite J" "J \ {}" and "J \ A" + using ch[THEN chain_subset, of "M`J"] by auto + with in_chain_finite[OF J(1)] obtain j where "j \ J" "(SUP j:J. M j) = M j" + by auto + with \J \ A\ show "\j\A. emeasure (SUPREMUM J M) X \ emeasure (M j) X" + by auto + next + fix j assume "j\A" then show "\i\{J. J \ {} \ finite J \ J \ A}. emeasure (M j) X \ emeasure (SUPREMUM i M) X" + by (intro bexI[of _ "{j}"]) auto + qed +qed + +subsubsection \Supremum of a set of $\sigma$-algebras\ + +lemma space_Sup_eq_UN: "space (Sup M) = (\x\M. space x)" + unfolding Sup_measure_def + apply (intro Sup_lexord[where P="\x. space x = _"]) + apply (subst space_Sup_measure'2) + apply auto [] + apply (subst space_measure_of[OF UN_space_closed]) + apply auto + done + +lemma sets_Sup_eq: + assumes *: "\m. m \ M \ space m = X" and "M \ {}" + shows "sets (Sup M) = sigma_sets X (\x\M. sets x)" + unfolding Sup_measure_def + apply (rule Sup_lexord1) + apply fact + apply (simp add: assms) + apply (rule Sup_lexord) + subgoal premises that for a S + unfolding that(3) that(2)[symmetric] + using that(1) + apply (subst sets_Sup_measure'2) + apply (intro arg_cong2[where f=sigma_sets]) + apply (auto simp: *) + done + apply (subst sets_measure_of[OF UN_space_closed]) + apply (simp add: assms) + done + +lemma in_sets_Sup: "(\m. m \ M \ space m = X) \ m \ M \ A \ sets m \ A \ sets (Sup M)" + by (subst sets_Sup_eq[where X=X]) auto + +lemma Sup_lexord_rel: + assumes "\i. i \ I \ k (A i) = k (B i)" + "R (c (A ` {a \ I. k (B a) = (SUP x:I. k (B x))})) (c (B ` {a \ I. k (B a) = (SUP x:I. k (B x))}))" + "R (s (A`I)) (s (B`I))" + shows "R (Sup_lexord k c s (A`I)) (Sup_lexord k c s (B`I))" +proof - + have "A ` {a \ I. k (B a) = (SUP x:I. k (B x))} = {a \ A ` I. k a = (SUP x:I. k (B x))}" + using assms(1) by auto + moreover have "B ` {a \ I. k (B a) = (SUP x:I. k (B x))} = {a \ B ` I. k a = (SUP x:I. k (B x))}" + by auto + ultimately show ?thesis + using assms by (auto simp: Sup_lexord_def Let_def) +qed + +lemma sets_SUP_cong: + assumes eq: "\i. i \ I \ sets (M i) = sets (N i)" shows "sets (SUP i:I. M i) = sets (SUP i:I. N i)" + unfolding Sup_measure_def + using eq eq[THEN sets_eq_imp_space_eq] + apply (intro Sup_lexord_rel[where R="\x y. sets x = sets y"]) + apply simp + apply simp + apply (simp add: sets_Sup_measure'2) + apply (intro arg_cong2[where f="\x y. sets (sigma x y)"]) + apply auto + done + +lemma sets_Sup_in_sets: + assumes "M \ {}" + assumes "\m. m \ M \ space m = space N" + assumes "\m. m \ M \ sets m \ sets N" + shows "sets (Sup M) \ sets N" +proof - + have *: "UNION M space = space N" + using assms by auto + show ?thesis + unfolding * using assms by (subst sets_Sup_eq[of M "space N"]) (auto intro!: sets.sigma_sets_subset) +qed + +lemma measurable_Sup1: + assumes m: "m \ M" and f: "f \ measurable m N" + and const_space: "\m n. m \ M \ n \ M \ space m = space n" + shows "f \ measurable (Sup M) N" +proof - + have "space (Sup M) = space m" + using m by (auto simp add: space_Sup_eq_UN dest: const_space) + then show ?thesis + using m f unfolding measurable_def by (auto intro: in_sets_Sup[OF const_space]) +qed + +lemma measurable_Sup2: + assumes M: "M \ {}" + assumes f: "\m. m \ M \ f \ measurable N m" + and const_space: "\m n. m \ M \ n \ M \ space m = space n" + shows "f \ measurable N (Sup M)" +proof - + from M obtain m where "m \ M" by auto + have space_eq: "\n. n \ M \ space n = space m" + by (intro const_space \m \ M\) + have "f \ measurable N (sigma (\m\M. space m) (\m\M. sets m))" + proof (rule measurable_measure_of) + show "f \ space N \ UNION M space" + using measurable_space[OF f] M by auto + qed (auto intro: measurable_sets f dest: sets.sets_into_space) + also have "measurable N (sigma (\m\M. space m) (\m\M. sets m)) = measurable N (Sup M)" + apply (intro measurable_cong_sets refl) + apply (subst sets_Sup_eq[OF space_eq M]) + apply simp + apply (subst sets_measure_of[OF UN_space_closed]) + apply (simp add: space_eq M) + done + finally show ?thesis . +qed + +lemma sets_Sup_sigma: + assumes [simp]: "M \ {}" and M: "\m. m \ M \ m \ Pow \" + shows "sets (SUP m:M. sigma \ m) = sets (sigma \ (\M))" +proof - + { fix a m assume "a \ sigma_sets \ m" "m \ M" + then have "a \ sigma_sets \ (\M)" + by induction (auto intro: sigma_sets.intros) } + then show "sets (SUP m:M. sigma \ m) = sets (sigma \ (\M))" + apply (subst sets_Sup_eq[where X="\"]) + apply (auto simp add: M) [] + apply auto [] + apply (simp add: space_measure_of_conv M Union_least) + apply (rule sigma_sets_eqI) + apply auto + done +qed + +lemma Sup_sigma: + assumes [simp]: "M \ {}" and M: "\m. m \ M \ m \ Pow \" + shows "(SUP m:M. sigma \ m) = (sigma \ (\M))" +proof (intro antisym SUP_least) + have *: "\M \ Pow \" + using M by auto + show "sigma \ (\M) \ (SUP m:M. sigma \ m)" + proof (intro less_eq_measure.intros(3)) + show "space (sigma \ (\M)) = space (SUP m:M. sigma \ m)" + "sets (sigma \ (\M)) = sets (SUP m:M. sigma \ m)" + using sets_Sup_sigma[OF assms] sets_Sup_sigma[OF assms, THEN sets_eq_imp_space_eq] + by auto + qed (simp add: emeasure_sigma le_fun_def) + fix m assume "m \ M" then show "sigma \ m \ sigma \ (\M)" + by (subst sigma_le_iff) (auto simp add: M *) +qed + +lemma SUP_sigma_sigma: + "M \ {} \ (\m. m \ M \ f m \ Pow \) \ (SUP m:M. sigma \ (f m)) = sigma \ (\m\M. f m)" + using Sup_sigma[of "f`M" \] by auto + +lemma sets_vimage_Sup_eq: + assumes *: "M \ {}" "f \ X \ Y" "\m. m \ M \ space m = Y" + shows "sets (vimage_algebra X f (Sup M)) = sets (SUP m : M. vimage_algebra X f m)" + (is "?IS = ?SI") +proof + show "?IS \ ?SI" + apply (intro sets_image_in_sets measurable_Sup2) + apply (simp add: space_Sup_eq_UN *) + apply (simp add: *) + apply (intro measurable_Sup1) + apply (rule imageI) + apply assumption + apply (rule measurable_vimage_algebra1) + apply (auto simp: *) + done + show "?SI \ ?IS" + apply (intro sets_Sup_in_sets) + apply (auto simp: *) [] + apply (auto simp: *) [] + apply (elim imageE) + apply simp + apply (rule sets_image_in_sets) + apply simp + apply (simp add: measurable_def) + apply (simp add: * space_Sup_eq_UN sets_vimage_algebra2) + apply (auto intro: in_sets_Sup[OF *(3)]) + done +qed + +lemma restrict_space_eq_vimage_algebra': + "sets (restrict_space M \) = sets (vimage_algebra (\ \ space M) (\x. x) M)" +proof - + have *: "{A \ (\ \ space M) |A. A \ sets M} = {A \ \ |A. A \ sets M}" + using sets.sets_into_space[of _ M] by blast + + show ?thesis + unfolding restrict_space_def + by (subst sets_measure_of) + (auto simp add: image_subset_iff sets_vimage_algebra * dest: sets.sets_into_space intro!: arg_cong2[where f=sigma_sets]) +qed + +lemma sigma_le_sets: + assumes [simp]: "A \ Pow X" shows "sets (sigma X A) \ sets N \ X \ sets N \ A \ sets N" +proof + have "X \ sigma_sets X A" "A \ sigma_sets X A" + by (auto intro: sigma_sets_top) + moreover assume "sets (sigma X A) \ sets N" + ultimately show "X \ sets N \ A \ sets N" + by auto +next + assume *: "X \ sets N \ A \ sets N" + { fix Y assume "Y \ sigma_sets X A" from this * have "Y \ sets N" + by induction auto } + then show "sets (sigma X A) \ sets N" + by auto +qed + +lemma measurable_iff_sets: + "f \ measurable M N \ (f \ space M \ space N \ sets (vimage_algebra (space M) f N) \ sets M)" +proof - + have *: "{f -` A \ space M |A. A \ sets N} \ Pow (space M)" + by auto + show ?thesis + unfolding measurable_def + by (auto simp add: vimage_algebra_def sigma_le_sets[OF *]) +qed + +lemma sets_vimage_algebra_space: "X \ sets (vimage_algebra X f M)" + using sets.top[of "vimage_algebra X f M"] by simp + +lemma measurable_mono: + assumes N: "sets N' \ sets N" "space N = space N'" + assumes M: "sets M \ sets M'" "space M = space M'" + shows "measurable M N \ measurable M' N'" + unfolding measurable_def +proof safe + fix f A assume "f \ space M \ space N" "A \ sets N'" + moreover assume "\y\sets N. f -` y \ space M \ sets M" note this[THEN bspec, of A] + ultimately show "f -` A \ space M' \ sets M'" + using assms by auto +qed (insert N M, auto) + +lemma measurable_Sup_measurable: + assumes f: "f \ space N \ A" + shows "f \ measurable N (Sup {M. space M = A \ f \ measurable N M})" +proof (rule measurable_Sup2) + show "{M. space M = A \ f \ measurable N M} \ {}" + using f unfolding ex_in_conv[symmetric] + by (intro exI[of _ "sigma A {}"]) (auto intro!: measurable_measure_of) +qed auto + +lemma (in sigma_algebra) sigma_sets_subset': + assumes a: "a \ M" "\' \ M" + shows "sigma_sets \' a \ M" +proof + show "x \ M" if x: "x \ sigma_sets \' a" for x + using x by (induct rule: sigma_sets.induct) (insert a, auto) +qed + +lemma in_sets_SUP: "i \ I \ (\i. i \ I \ space (M i) = Y) \ X \ sets (M i) \ X \ sets (SUP i:I. M i)" + by (intro in_sets_Sup[where X=Y]) auto + +lemma measurable_SUP1: + "i \ I \ f \ measurable (M i) N \ (\m n. m \ I \ n \ I \ space (M m) = space (M n)) \ + f \ measurable (SUP i:I. M i) N" + by (auto intro: measurable_Sup1) + +lemma sets_image_in_sets': + assumes X: "X \ sets N" + assumes f: "\A. A \ sets M \ f -` A \ X \ sets N" + shows "sets (vimage_algebra X f M) \ sets N" + unfolding sets_vimage_algebra + by (rule sets.sigma_sets_subset') (auto intro!: measurable_sets X f) + +lemma mono_vimage_algebra: + "sets M \ sets N \ sets (vimage_algebra X f M) \ sets (vimage_algebra X f N)" + using sets.top[of "sigma X {f -` A \ X |A. A \ sets N}"] + unfolding vimage_algebra_def + apply (subst (asm) space_measure_of) + apply auto [] + apply (subst sigma_le_sets) + apply auto + done + +lemma mono_restrict_space: "sets M \ sets N \ sets (restrict_space M X) \ sets (restrict_space N X)" + unfolding sets_restrict_space by (rule image_mono) + +lemma sets_eq_bot: "sets M = {{}} \ M = bot" + apply safe + apply (intro measure_eqI) + apply auto + done + +lemma sets_eq_bot2: "{{}} = sets M \ M = bot" + using sets_eq_bot[of M] by blast end diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy --- a/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy Thu Jun 16 23:03:27 2016 +0200 @@ -1525,6 +1525,18 @@ subsection \Integral under concrete measures\ +lemma nn_integral_mono_measure: + assumes "sets M = sets N" "M \ N" shows "nn_integral M f \ nn_integral N f" + unfolding nn_integral_def +proof (intro SUP_subset_mono) + note \sets M = sets N\[simp] \sets M = sets N\[THEN sets_eq_imp_space_eq, simp] + show "{g. simple_function M g \ g \ f} \ {g. simple_function N g \ g \ f}" + by (simp add: simple_function_def) + show "integral\<^sup>S M x \ integral\<^sup>S N x" for x + using le_measureD3[OF \M \ N\] + by (auto simp add: simple_integral_def intro!: setsum_mono mult_mono) +qed + lemma nn_integral_empty: assumes "space M = {}" shows "nn_integral M f = 0" @@ -1534,6 +1546,9 @@ thus ?thesis by simp qed +lemma nn_integral_bot[simp]: "nn_integral bot f = 0" + by (simp add: nn_integral_empty) + subsubsection \Distributions\ lemma nn_integral_distr: diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Radon_Nikodym.thy --- a/src/HOL/Probability/Radon_Nikodym.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Radon_Nikodym.thy Thu Jun 16 23:03:27 2016 +0200 @@ -8,155 +8,6 @@ imports Bochner_Integration begin -lemma (in finite_measure) finite_measure_Diff': - "A \ sets M \ B \ sets M \ measure M (A - B) = measure M A - measure M (A \ B)" - using finite_measure_Diff[of A "A \ B"] by (auto simp: Diff_Int) - -lemma (in finite_measure) finite_measure_Union': - "A \ sets M \ B \ sets M \ measure M (A \ B) = measure M A + measure M (B - A)" - using finite_measure_Union[of A "B - A"] by auto - -lemma finite_unsigned_Hahn_decomposition: - assumes "finite_measure M" "finite_measure N" and [simp]: "sets N = sets M" - shows "\Y\sets M. (\X\sets M. X \ Y \ N X \ M X) \ (\X\sets M. X \ Y = {} \ M X \ N X)" -proof - - interpret M: finite_measure M by fact - interpret N: finite_measure N by fact - - define d where "d X = measure M X - measure N X" for X - - have [intro]: "bdd_above (d`sets M)" - using sets.sets_into_space[of _ M] - by (intro bdd_aboveI[where M="measure M (space M)"]) - (auto simp: d_def field_simps subset_eq intro!: add_increasing M.finite_measure_mono) - - define \ where "\ = (SUP X:sets M. d X)" - have le_\[intro]: "X \ sets M \ d X \ \" for X - by (auto simp: \_def intro!: cSUP_upper) - - have "\f. \n. f n \ sets M \ d (f n) > \ - 1 / 2^n" - proof (intro choice_iff[THEN iffD1] allI) - fix n - have "\X\sets M. \ - 1 / 2^n < d X" - unfolding \_def by (intro less_cSUP_iff[THEN iffD1]) auto - then show "\y. y \ sets M \ \ - 1 / 2 ^ n < d y" - by auto - qed - then obtain E where [measurable]: "E n \ sets M" and E: "d (E n) > \ - 1 / 2^n" for n - by auto - - define F where "F m n = (if m \ n then \i\{m..n}. E i else space M)" for m n - - have [measurable]: "m \ n \ F m n \ sets M" for m n - by (auto simp: F_def) - - have 1: "\ - 2 / 2 ^ m + 1 / 2 ^ n \ d (F m n)" if "m \ n" for m n - using that - proof (induct rule: dec_induct) - case base with E[of m] show ?case - by (simp add: F_def field_simps) - next - case (step i) - have F_Suc: "F m (Suc i) = F m i \ E (Suc i)" - using \m \ i\ by (auto simp: F_def le_Suc_eq) - - have "\ + (\ - 2 / 2^m + 1 / 2 ^ Suc i) \ (\ - 1 / 2^Suc i) + (\ - 2 / 2^m + 1 / 2^i)" - by (simp add: field_simps) - also have "\ \ d (E (Suc i)) + d (F m i)" - using E[of "Suc i"] by (intro add_mono step) auto - also have "\ = d (E (Suc i)) + d (F m i - E (Suc i)) + d (F m (Suc i))" - using \m \ i\ by (simp add: d_def field_simps F_Suc M.finite_measure_Diff' N.finite_measure_Diff') - also have "\ = d (E (Suc i) \ F m i) + d (F m (Suc i))" - using \m \ i\ by (simp add: d_def field_simps M.finite_measure_Union' N.finite_measure_Union') - also have "\ \ \ + d (F m (Suc i))" - using \m \ i\ by auto - finally show ?case - by auto - qed - - define F' where "F' m = (\i\{m..}. E i)" for m - have F'_eq: "F' m = (\i. F m (i + m))" for m - by (fastforce simp: le_iff_add[of m] F'_def F_def) - - have [measurable]: "F' m \ sets M" for m - by (auto simp: F'_def) - - have \_le: "\ - 0 \ d (\m. F' m)" - proof (rule LIMSEQ_le) - show "(\n. \ - 2 / 2 ^ n) \ \ - 0" - by (intro tendsto_intros LIMSEQ_divide_realpow_zero) auto - have "incseq F'" - by (auto simp: incseq_def F'_def) - then show "(\m. d (F' m)) \ d (\m. F' m)" - unfolding d_def - by (intro tendsto_diff M.finite_Lim_measure_incseq N.finite_Lim_measure_incseq) auto - - have "\ - 2 / 2 ^ m + 0 \ d (F' m)" for m - proof (rule LIMSEQ_le) - have *: "decseq (\n. F m (n + m))" - by (auto simp: decseq_def F_def) - show "(\n. d (F m n)) \ d (F' m)" - unfolding d_def F'_eq - by (rule LIMSEQ_offset[where k=m]) - (auto intro!: tendsto_diff M.finite_Lim_measure_decseq N.finite_Lim_measure_decseq *) - show "(\n. \ - 2 / 2 ^ m + 1 / 2 ^ n) \ \ - 2 / 2 ^ m + 0" - by (intro tendsto_add LIMSEQ_divide_realpow_zero tendsto_const) auto - show "\N. \n\N. \ - 2 / 2 ^ m + 1 / 2 ^ n \ d (F m n)" - using 1[of m] by (intro exI[of _ m]) auto - qed - then show "\N. \n\N. \ - 2 / 2 ^ n \ d (F' n)" - by auto - qed - - show ?thesis - proof (safe intro!: bexI[of _ "\m. F' m"]) - fix X assume [measurable]: "X \ sets M" and X: "X \ (\m. F' m)" - have "d (\m. F' m) - d X = d ((\m. F' m) - X)" - using X by (auto simp: d_def M.finite_measure_Diff N.finite_measure_Diff) - also have "\ \ \" - by auto - finally have "0 \ d X" - using \_le by auto - then show "emeasure N X \ emeasure M X" - by (auto simp: d_def M.emeasure_eq_measure N.emeasure_eq_measure) - next - fix X assume [measurable]: "X \ sets M" and X: "X \ (\m. F' m) = {}" - then have "d (\m. F' m) + d X = d (X \ (\m. F' m))" - by (auto simp: d_def M.finite_measure_Union N.finite_measure_Union) - also have "\ \ \" - by auto - finally have "d X \ 0" - using \_le by auto - then show "emeasure M X \ emeasure N X" - by (auto simp: d_def M.emeasure_eq_measure N.emeasure_eq_measure) - qed auto -qed - -lemma unsigned_Hahn_decomposition: - assumes [simp]: "sets N = sets M" and [measurable]: "A \ sets M" - and [simp]: "emeasure M A \ top" "emeasure N A \ top" - shows "\Y\sets M. Y \ A \ (\X\sets M. X \ Y \ N X \ M X) \ (\X\sets M. X \ A \ X \ Y = {} \ M X \ N X)" -proof - - have "\Y\sets (restrict_space M A). - (\X\sets (restrict_space M A). X \ Y \ (restrict_space N A) X \ (restrict_space M A) X) \ - (\X\sets (restrict_space M A). X \ Y = {} \ (restrict_space M A) X \ (restrict_space N A) X)" - proof (rule finite_unsigned_Hahn_decomposition) - show "finite_measure (restrict_space M A)" "finite_measure (restrict_space N A)" - by (auto simp: space_restrict_space emeasure_restrict_space less_top intro!: finite_measureI) - qed (simp add: sets_restrict_space) - then guess Y .. - then show ?thesis - apply (intro bexI[of _ Y] conjI ballI conjI) - apply (simp_all add: sets_restrict_space emeasure_restrict_space) - apply safe - subgoal for X Z - by (erule ballE[of _ _ X]) (auto simp add: Int_absorb1) - subgoal for X Z - by (erule ballE[of _ _ X]) (auto simp add: Int_absorb1 ac_simps) - apply auto - done -qed - definition diff_measure :: "'a measure \ 'a measure \ 'a measure" where "diff_measure M N = measure_of (space M) (sets M) (\A. emeasure M A - emeasure N A)" diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/SPMF.thy --- a/src/HOL/Probability/SPMF.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/SPMF.thy Thu Jun 16 23:03:27 2016 +0200 @@ -302,7 +302,7 @@ finally show ?thesis . qed -lemma integral_measure_spmf: +lemma integral_measure_spmf: assumes "integrable (measure_spmf p) f" shows "(\ x. f x \measure_spmf p) = \ x. spmf p x * f x \count_space UNIV" proof - @@ -340,7 +340,7 @@ proof(rule neq_top_trans) show "(SUP i. ennreal (spmf (Y i) x)) \ 1" by(rule SUP_least)(simp add: pmf_le_1) qed simp - + lemma SUP_emeasure_spmf_neq_top: "(SUP p:Y. emeasure (measure_spmf p) A) \ \" proof(rule neq_top_trans) show "(SUP p:Y. emeasure (measure_spmf p) A) \ 1" @@ -453,7 +453,7 @@ lemma set_map_spmf [simp]: "set_spmf (map_spmf f p) = f ` set_spmf p" by(simp add: set_spmf_def image_bind bind_image o_def Option.option.set_map) - + lemma map_spmf_cong: "\ p = q; \x. x \ set_spmf q \ f x = g x \ \ map_spmf f p = map_spmf g q" @@ -576,7 +576,7 @@ by(simp add: sets_bind[where N="count_space UNIV"] space_measure_spmf) next fix A :: "'a set" - have "emeasure ?lhs A = \\<^sup>+ x. emeasure (measure_spmf (f x)) A \measure_pmf p" + have "emeasure ?lhs A = \\<^sup>+ x. emeasure (measure_spmf (f x)) A \measure_pmf p" by(simp add: measure_spmf_def emeasure_distr space_restrict_space emeasure_restrict_space bind_spmf_def) also have "\ = emeasure ?rhs A" by(simp add: emeasure_bind[where N="count_space UNIV"] space_measure_spmf space_subprob_algebra) @@ -591,13 +591,13 @@ next fix A :: "'a set" let ?A = "the -` A \ range Some" - have "emeasure ?lhs A = \\<^sup>+ x. emeasure (measure_pmf (case x of None \ return_pmf None | Some x \ f x)) ?A \measure_pmf p" + have "emeasure ?lhs A = \\<^sup>+ x. emeasure (measure_pmf (case x of None \ return_pmf None | Some x \ f x)) ?A \measure_pmf p" by(simp add: measure_spmf_def emeasure_distr space_restrict_space emeasure_restrict_space bind_spmf_def) also have "\ = \\<^sup>+ x. emeasure (measure_pmf (f (the x))) ?A * indicator (range Some) x \measure_pmf p" by(rule nn_integral_cong)(auto split: option.split simp add: indicator_def) also have "\ = \\<^sup>+ x. emeasure (measure_spmf (f x)) A \measure_spmf p" by(simp add: measure_spmf_def nn_integral_distr nn_integral_restrict_space emeasure_distr space_restrict_space emeasure_restrict_space) - also have "\ = emeasure ?rhs A" + also have "\ = emeasure ?rhs A" by(simp add: emeasure_bind[where N="count_space UNIV"] space_measure_spmf space_subprob_algebra) finally show "emeasure ?lhs A = emeasure ?rhs A" . qed @@ -663,7 +663,7 @@ lemma rel_spmf_mono: "\rel_spmf A f g; \x y. A x y \ B x y \ \ rel_spmf B f g" -apply(erule rel_pmf_mono) +apply(erule rel_pmf_mono) using option.rel_mono[of A B] by(simp add: le_fun_def) lemma rel_spmf_mono_strong: @@ -684,7 +684,7 @@ lemma rel_spmfE [elim?, consumes 1, case_names rel_spmf]: assumes "rel_spmf P p q" - obtains pq where + obtains pq where "\x y. (x, y) \ set_spmf pq \ P x y" "p = map_spmf fst pq" "q = map_spmf snd pq" @@ -847,7 +847,7 @@ lemma weight_spmf_nonneg: "weight_spmf p \ 0" by(fact measure_nonneg) -lemma (in finite_measure) integrable_weight_spmf [simp]: +lemma (in finite_measure) integrable_weight_spmf [simp]: "(\x. weight_spmf (f x)) \ borel_measurable M \ integrable M (\x. weight_spmf (f x))" by(rule integrable_const_bound[where B=1])(simp_all add: weight_spmf_nonneg weight_spmf_le_1) @@ -1068,7 +1068,7 @@ and refl: "\x. x \ set_spmf p \ R x x" shows "ord_spmf R p q" proof(rule rel_pmf.intros) - define pq where "pq = embed_pmf + define pq where "pq = embed_pmf (\(x, y). case x of Some x' \ (case y of Some y' \ if x' = y' then spmf p x' else 0 | None \ 0) | None \ (case y of None \ pmf q None | Some y' \ spmf q y' - spmf p y'))" (is "_ = embed_pmf ?f") @@ -1077,8 +1077,8 @@ have integral: "(\\<^sup>+ xy. ?f xy \count_space UNIV) = 1" (is "nn_integral ?M _ = _") proof - have "(\\<^sup>+ xy. ?f xy \count_space UNIV) = - \\<^sup>+ xy. ennreal (?f xy) * indicator {(None, None)} xy + - ennreal (?f xy) * indicator (range (\x. (None, Some x))) xy + + \\<^sup>+ xy. ennreal (?f xy) * indicator {(None, None)} xy + + ennreal (?f xy) * indicator (range (\x. (None, Some x))) xy + ennreal (?f xy) * indicator (range (\x. (Some x, Some x))) xy \?M" by(rule nn_integral_cong)(auto split: split_indicator option.splits if_split_asm) also have "\ = (\\<^sup>+ xy. ?f xy * indicator {(None, None)} xy \?M) + @@ -1132,8 +1132,8 @@ then show ?thesis using Some by simp next case None - have "(\\<^sup>+ y. pmf pq (None, y) \count_space UNIV) = - (\\<^sup>+ y. ennreal (pmf pq (None, Some (the y))) * indicator (range Some) y + + have "(\\<^sup>+ y. pmf pq (None, y) \count_space UNIV) = + (\\<^sup>+ y. ennreal (pmf pq (None, Some (the y))) * indicator (range Some) y + ennreal (pmf pq (None, None)) * indicator {None} y \count_space UNIV)" by(rule nn_integral_cong)(auto split: split_indicator) also have "\ = (\\<^sup>+ y. ennreal (pmf pq (None, Some (the y))) \count_space (range Some)) + pmf pq (None, None)" @@ -1170,8 +1170,8 @@ then show ?thesis using None by simp next case (Some y) - have "(\\<^sup>+ x. pmf pq (x, Some y) \count_space UNIV) = - (\\<^sup>+ x. ennreal (pmf pq (x, Some y)) * indicator (range Some) x + + have "(\\<^sup>+ x. pmf pq (x, Some y) \count_space UNIV) = + (\\<^sup>+ x. ennreal (pmf pq (x, Some y)) * indicator (range Some) x + ennreal (pmf pq (None, Some y)) * indicator {None} x \count_space UNIV)" by(rule nn_integral_cong)(auto split: split_indicator) also have "\ = (\\<^sup>+ x. ennreal (pmf pq (x, Some y)) * indicator (range Some) x \count_space UNIV) + pmf pq (None, Some y)" @@ -1215,8 +1215,7 @@ by(auto intro!: nn_integral_mono split: split_indicator dest: ord_spmf_eq_leD simp add: nn_integral_measure_spmf nn_integral_indicator[symmetric]) lemma ord_spmf_eqD_measure_spmf: "ord_spmf op = p q \ measure_spmf p \ measure_spmf q" -by(rule less_eq_measure.intros)(simp_all add: ord_spmf_eqD_emeasure) - + by (subst le_measure) (auto simp: ord_spmf_eqD_emeasure) subsection \CCPO structure for the flat ccpo @{term "ord_option op ="}\ @@ -1224,7 +1223,7 @@ definition lub_spmf :: "'a spmf" where "lub_spmf = embed_spmf (\x. enn2real (SUP p : Y. ennreal (spmf p x)))" - \ \We go through @{typ ennreal} to have a sensible definition even if @{term Y} is empty.\ + \ \We go through @{typ ennreal} to have a sensible definition even if @{term Y} is empty.\ lemma lub_spmf_empty [simp]: "SPMF.lub_spmf {} = return_pmf None" by(simp add: SPMF.lub_spmf_def bot_ereal_def) @@ -1259,18 +1258,18 @@ proof(rule spmf_eqI) fix i from le have le': "\x. spmf p x \ spmf q x" by(rule ord_spmf_eq_leD) - have "(\\<^sup>+ x. ennreal (spmf q x) - spmf p x \count_space UNIV) = + have "(\\<^sup>+ x. ennreal (spmf q x) - spmf p x \count_space UNIV) = (\\<^sup>+ x. spmf q x \count_space UNIV) - (\\<^sup>+ x. spmf p x \count_space UNIV)" by(subst nn_integral_diff)(simp_all add: AE_count_space le' nn_integral_spmf_neq_top) also have "\ = (1 - pmf q None) - (1 - pmf p None)" unfolding pmf_None_eq_weight_spmf by(simp add: weight_spmf_eq_nn_integral_spmf[symmetric] ennreal_minus) also have "\ = 0" using None by simp - finally have "\x. spmf q x \ spmf p x" + finally have "\x. spmf q x \ spmf p x" by(simp add: nn_integral_0_iff_AE AE_count_space ennreal_minus ennreal_eq_0_iff) with le' show "spmf p i = spmf q i" by(rule antisym) qed -lemma ord_spmf_eqD_pmf_None: +lemma ord_spmf_eqD_pmf_None: assumes "ord_spmf op = x y" shows "pmf x None \ pmf y None" using assms @@ -1283,7 +1282,7 @@ Chains on @{typ "'a spmf"} maintain countable support. Thanks to Johannes Hölzl for the proof idea. \ -lemma spmf_chain_countable: "countable (\p\Y. set_spmf p)" +lemma spmf_chain_countable: "countable (\p\Y. set_spmf p)" proof(cases "Y = {}") case Y: False show ?thesis @@ -1295,13 +1294,13 @@ next case False define N :: "'a option pmf \ real" where "N p = pmf p None" for p - + have N_less_imp_le_spmf: "\ x \ Y; y \ Y; N y < N x \ \ ord_spmf op = x y" for x y using chainD[OF chain, of x y] ord_spmf_eqD_pmf_None[of x y] ord_spmf_eqD_pmf_None[of y x] by (auto simp: N_def) have N_eq_imp_eq: "\ x \ Y; y \ Y; N y = N x \ \ x = y" for x y using chainD[OF chain, of x y] by(auto simp add: N_def dest: ord_spmf_eq_pmf_None_eq) - + have NC: "N ` Y \ {}" "bdd_below (N ` Y)" using \Y \ {}\ by(auto intro!: bdd_belowI[of _ 0] simp: N_def) have NC_less: "Inf (N ` Y) < N x" if "x \ Y" for x unfolding cInf_less_iff[OF NC] @@ -1314,12 +1313,12 @@ by cases(auto dest: N_less_imp_le_spmf N_eq_imp_eq intro: ord_spmf_reflI) } with False \x \ Y\ show False by blast qed - + from NC have "Inf (N ` Y) \ closure (N ` Y)" by (intro closure_contains_Inf) then obtain X' where "\n. X' n \ N ` Y" and X': "X' \ Inf (N ` Y)" unfolding closure_sequential by auto then obtain X where X: "\n. X n \ Y" and "X' = (\n. N (X n))" unfolding image_iff Bex_def by metis - + with X' have seq: "(\n. N (X n)) \ Inf (N ` Y)" by simp have "(\x \ Y. set_spmf x) \ (\n. set_spmf (X n))" proof(rule UN_least) @@ -1343,7 +1342,7 @@ let ?B = "\p\Y. set_spmf p" have countable: "countable ?B" by(rule spmf_chain_countable) - have "(\\<^sup>+ x. (SUP p:Y. ennreal (spmf p x)) \count_space UNIV) = + have "(\\<^sup>+ x. (SUP p:Y. ennreal (spmf p x)) \count_space UNIV) = (\\<^sup>+ x. (SUP p:Y. ennreal (spmf p x) * indicator ?B x) \count_space UNIV)" by(intro nn_integral_cong SUP_cong)(auto split: split_indicator simp add: spmf_eq_0_set_spmf) also have "\ = (\\<^sup>+ x. (SUP p:Y. ennreal (spmf p x)) \count_space ?B)" @@ -1481,8 +1480,10 @@ from assms obtain p where p: "p \ Y" by auto from chain have chain': "Complete_Partial_Order.chain op \ (measure_spmf ` Y)" by(rule chain_imageI)(rule ord_spmf_eqD_measure_spmf) - show "sets ?lhs = sets ?rhs" and "emeasure ?lhs A = emeasure ?rhs A" for A - using chain' Y p by(simp_all add: sets_SUP emeasure_SUP emeasure_lub_spmf) + show "sets ?lhs = sets ?rhs" + using Y by (subst sets_SUP) auto + show "emeasure ?lhs A = emeasure ?rhs A" for A + using chain' Y p by (subst emeasure_SUP_chain) (auto simp: emeasure_lub_spmf) qed end @@ -1552,11 +1553,11 @@ ultimately show "ord_spmf op = (bind_spmf (B f) (\y. C y f)) (bind_spmf (B g) (\y'. C y' g))" by(rule bind_spmf_mono') qed - + lemma monotone_bind_spmf1: "monotone (ord_spmf op =) (ord_spmf op =) (\y. bind_spmf y g)" by(rule monotoneI)(simp add: bind_spmf_mono' ord_spmf_reflI) -lemma monotone_bind_spmf2: +lemma monotone_bind_spmf2: assumes g: "\x. monotone ord (ord_spmf op =) (\y. g y x)" shows "monotone ord (ord_spmf op =) (\y. bind_spmf p (g y))" by(rule monotoneI)(auto intro: bind_spmf_mono' monotoneD[OF g] ord_spmf_reflI) @@ -1611,7 +1612,7 @@ using chain by(rule chain_imageI)(auto simp add: le_fun_def dest: ord_spmf_eq_leD monotoneD[OF g] intro!: mult_left_mono) have chain''': "Complete_Partial_Order.chain (ord_spmf op =) ((\p. bind_spmf x (\y. g y p)) ` Y)" using chain by(rule chain_imageI)(rule monotone_bind_spmf2[OF g, THEN monotoneD]) - + have "ennreal (spmf ?lhs i) = \\<^sup>+ y. (SUP p:Y. ennreal (spmf x y * spmf (g y p) i)) \count_space (set_spmf x)" by(simp add: ennreal_spmf_bind ennreal_spmf_lub_spmf[OF chain'] Y nn_integral_measure_spmf' SUP_mult_left_ennreal ennreal_mult) also have "\ = (SUP p:Y. \\<^sup>+ y. ennreal (spmf x y * spmf (g y p) i) \count_space (set_spmf x))" @@ -1707,7 +1708,7 @@ locale rel_spmf_characterisation = assumes rel_pmf_measureI: - "\(R :: 'a option \ 'b option \ bool) p q. + "\(R :: 'a option \ 'b option \ bool) p q. (\A. measure (measure_pmf p) A \ measure (measure_pmf q) {y. \x\A. R x y}) \ rel_pmf R p q" \ \This assumption is shown to hold in general in the AFP entry \MFMC_Countable\.\ @@ -1911,7 +1912,7 @@ subsection \Subprobability distributions of sets\ definition spmf_of_set :: "'a set \ 'a spmf" -where +where "spmf_of_set A = (if finite A \ A \ {} then spmf_of_pmf (pmf_of_set A) else return_pmf None)" lemma spmf_of_set: "spmf (spmf_of_set A) x = indicator A x / card A" @@ -1933,7 +1934,7 @@ "inj_on f A \ map_spmf f (spmf_of_set A) = spmf_of_set (f ` A)" by(auto simp add: spmf_of_set_def map_pmf_of_set_inj dest: finite_imageD) -lemma spmf_of_pmf_pmf_of_set [simp]: +lemma spmf_of_pmf_pmf_of_set [simp]: "\ finite A; A \ {} \ \ spmf_of_pmf (pmf_of_set A) = spmf_of_set A" by(simp add: spmf_of_set_def) @@ -2001,7 +2002,7 @@ lemma rel_pmf_of_set_bij: assumes f: "bij_betw f A B" and A: "A \ {}" "finite A" - and B: "B \ {}" "finite B" + and B: "B \ {}" "finite B" and R: "\x. x \ A \ R x (f x)" shows "rel_pmf R (pmf_of_set A) (pmf_of_set B)" proof(rule pmf.rel_mono_strong) @@ -2056,7 +2057,7 @@ by(auto intro: arg_cong[where f=card]) also have "\ = (if i then card (B \ A) / card B else (card B - card (B \ A)) / card B)" by(auto simp add: card_Diff_subset_Int assms) - also have "\ = ennreal (spmf ?rhs i)" + also have "\ = ennreal (spmf ?rhs i)" by(simp add: assms card_gt_0_iff field_simps card_mono Int_commute of_nat_diff) finally show "spmf ?lhs i = spmf ?rhs i" by simp qed @@ -2233,7 +2234,7 @@ apply(auto simp add: max_def min_def ennreal_mult[symmetric] not_le ennreal_lt_0) done -lemma measure_spmf_scale_spmf': +lemma measure_spmf_scale_spmf': "r \ 1 \ measure_spmf (scale_spmf r p) = scale_measure r (measure_spmf p)" unfolding measure_spmf_scale_spmf apply(cases "weight_spmf p > 0") @@ -2250,7 +2251,7 @@ lemma scale_spmf_0 [simp]: "scale_spmf 0 p = return_pmf None" by(rule spmf_eqI)(simp add: spmf_scale_spmf min_def max_def weight_spmf_le_0) -lemma bind_scale_spmf: +lemma bind_scale_spmf: assumes r: "r \ 1" shows "bind_spmf (scale_spmf r p) f = bind_spmf p (\x. scale_spmf r (f x))" (is "?lhs = ?rhs") @@ -2262,7 +2263,7 @@ thus "spmf ?lhs x = spmf ?rhs x" by simp qed -lemma scale_bind_spmf: +lemma scale_bind_spmf: assumes "r \ 1" shows "scale_spmf r (bind_spmf p f) = bind_spmf p (\x. scale_spmf r (f x))" (is "?lhs = ?rhs") @@ -2298,7 +2299,7 @@ lemma set_scale_spmf' [simp]: "0 < r \ set_spmf (scale_spmf r p) = set_spmf p" by(simp add: set_scale_spmf) -lemma rel_spmf_scaleI: +lemma rel_spmf_scaleI: assumes "r > 0 \ rel_spmf A p q" shows "rel_spmf A (scale_spmf r p) (scale_spmf r q)" proof(cases "r > 0") @@ -2319,7 +2320,7 @@ thus ?thesis by(auto simp add: min_def max_def ennreal_mult[symmetric] split: if_split_asm) qed -lemma weight_scale_spmf' [simp]: +lemma weight_scale_spmf' [simp]: "\ 0 \ r; r \ 1 \ \ weight_spmf (scale_spmf r p) = r * weight_spmf p" by(simp add: weight_scale_spmf max_def min_def)(metis antisym_conv mult_left_le order_trans weight_spmf_le_1) @@ -2327,7 +2328,7 @@ "pmf (scale_spmf k p) None = 1 - min 1 (max 0 k * (1 - pmf p None))" unfolding pmf_None_eq_weight_spmf by(simp add: weight_scale_spmf) -lemma scale_scale_spmf: +lemma scale_scale_spmf: "scale_spmf r (scale_spmf r' p) = scale_spmf (r * max 0 (min (inverse (weight_spmf p)) r')) p" (is "?lhs = ?rhs") proof(rule spmf_eqI) @@ -2432,7 +2433,7 @@ lemma set_pair_spmf [simp]: "set_spmf (pair_spmf p q) = set_spmf p \ set_spmf q" by(auto 4 3 simp add: pair_spmf_def set_spmf_bind_pmf bind_UNION in_set_spmf intro: rev_bexI split: option.splits) - + lemma spmf_pair [simp]: "spmf (pair_spmf p q) (x, y) = spmf p x * spmf q y" (is "?lhs = ?rhs") proof - have "ennreal ?lhs = \\<^sup>+ a. \\<^sup>+ b. indicator {(x, y)} (a, b) \measure_spmf q \measure_spmf p" @@ -2483,8 +2484,8 @@ by(simp add: pair_spmf_return_spmf1) lemma rel_pair_spmf_prod: - "rel_spmf (rel_prod A B) (pair_spmf p q) (pair_spmf p' q') \ - rel_spmf A (scale_spmf (weight_spmf q) p) (scale_spmf (weight_spmf q') p') \ + "rel_spmf (rel_prod A B) (pair_spmf p q) (pair_spmf p' q') \ + rel_spmf A (scale_spmf (weight_spmf q) p) (scale_spmf (weight_spmf q') p') \ rel_spmf B (scale_spmf (weight_spmf p) q) (scale_spmf (weight_spmf p') q')" (is "?lhs \ ?rhs" is "_ \ ?A \ ?B" is "_ \ rel_spmf _ ?p ?p' \ rel_spmf _ ?q ?q'") proof(intro iffI conjI) @@ -2506,7 +2507,7 @@ moreover have "(weight_spmf p * weight_spmf q) * (weight_spmf p * weight_spmf q) \ (1 * 1) * (1 * 1)" by(intro mult_mono)(simp_all add: weight_spmf_nonneg weight_spmf_le_1) ultimately have "(weight_spmf p * weight_spmf q) * (weight_spmf p * weight_spmf q) = 1" by simp - hence *: "weight_spmf p * weight_spmf q = 1" + hence *: "weight_spmf p * weight_spmf q = 1" by(metis antisym_conv less_le mult_less_cancel_left1 weight_pair_spmf weight_spmf_le_1 weight_spmf_nonneg) hence "weight_spmf p = 1" by(metis antisym_conv mult_left_le weight_spmf_le_1 weight_spmf_nonneg) moreover with * have "weight_spmf q = 1" by simp @@ -2526,7 +2527,7 @@ have [simp]: "snd \ ?f = map_prod snd snd" by(simp add: fun_eq_iff) from \?rhs\ have eq: "weight_spmf p * weight_spmf q = weight_spmf p' * weight_spmf q'" by(auto dest!: rel_spmf_weightD simp add: weight_spmf_le_1 weight_spmf_nonneg) - + have "map_spmf snd ?pq = scale_spmf ?r (pair_spmf ?p' ?q')" by(simp add: pair_map_spmf[symmetric] p' q' map_scale_spmf spmf.map_comp) also have "\ = pair_spmf p' q'" using full[of p' q'] eq @@ -2546,24 +2547,24 @@ let ?f = "(\((x, y), (x', y')). (x, x'))" let ?pq = "map_spmf ?f pq" have [simp]: "fst \ ?f = fst \ fst" by(simp add: split_def o_def) - show "map_spmf fst ?pq = scale_spmf (weight_spmf q) p" using pq + show "map_spmf fst ?pq = scale_spmf (weight_spmf q) p" using pq by(simp add: spmf.map_comp)(simp add: spmf.map_comp[symmetric]) have [simp]: "snd \ ?f = fst \ snd" by(simp add: split_def o_def) - show "map_spmf snd ?pq = scale_spmf (weight_spmf q') p'" using pq' + show "map_spmf snd ?pq = scale_spmf (weight_spmf q') p'" using pq' by(simp add: spmf.map_comp)(simp add: spmf.map_comp[symmetric]) qed(auto dest: * ) - + show ?B proof let ?f = "(\((x, y), (x', y')). (y, y'))" let ?pq = "map_spmf ?f pq" have [simp]: "fst \ ?f = snd \ fst" by(simp add: split_def o_def) - show "map_spmf fst ?pq = scale_spmf (weight_spmf p) q" using pq + show "map_spmf fst ?pq = scale_spmf (weight_spmf p) q" using pq by(simp add: spmf.map_comp)(simp add: spmf.map_comp[symmetric]) have [simp]: "snd \ ?f = snd \ snd" by(simp add: split_def o_def) - show "map_spmf snd ?pq = scale_spmf (weight_spmf p') q'" using pq' + show "map_spmf snd ?pq = scale_spmf (weight_spmf p') q'" using pq' by(simp add: spmf.map_comp)(simp add: spmf.map_comp[symmetric]) qed(auto dest: * ) qed @@ -2650,7 +2651,7 @@ lemma rel_spmf_try_spmf: "\ rel_spmf R p p'; \ lossless_spmf p' \ rel_spmf R q q' \ \ rel_spmf R (TRY p ELSE q) (TRY p' ELSE q')" -unfolding try_spmf_def +unfolding try_spmf_def apply(rule rel_pmf_bindI[where R="\x y. rel_option R x y \ x \ set_pmf p \ y \ set_pmf p'"]) apply(erule pmf.rel_mono_strong; simp) apply(auto split: option.split simp add: lossless_iff_set_pmf_None) diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Sigma_Algebra.thy Thu Jun 16 23:03:27 2016 +0200 @@ -2002,86 +2002,6 @@ using emeasure_extend_measure[OF M _ _ ms(2,3), of "(i,j)"] eq ms(1) \I i j\ by (auto simp: subset_eq) -subsubsection \Supremum of a set of $\sigma$-algebras\ - -definition "Sup_sigma M = sigma (\x\M. space x) (\x\M. sets x)" - -syntax - "_SUP_sigma" :: "pttrn \ 'a set \ 'b \ 'b" ("(3\\<^sub>\ _\_./ _)" [0, 0, 10] 10) - -translations - "\\<^sub>\ x\A. B" == "CONST Sup_sigma ((\x. B) ` A)" - -lemma space_Sup_sigma: "space (Sup_sigma M) = (\x\M. space x)" - unfolding Sup_sigma_def by (rule space_measure_of) (auto dest: sets.sets_into_space) - -lemma sets_Sup_sigma: "sets (Sup_sigma M) = sigma_sets (\x\M. space x) (\x\M. sets x)" - unfolding Sup_sigma_def by (rule sets_measure_of) (auto dest: sets.sets_into_space) - -lemma in_Sup_sigma: "m \ M \ A \ sets m \ A \ sets (Sup_sigma M)" - unfolding sets_Sup_sigma by auto - -lemma SUP_sigma_cong: - assumes *: "\i. i \ I \ sets (M i) = sets (N i)" shows "sets (\\<^sub>\ i\I. M i) = sets (\\<^sub>\ i\I. N i)" - using * sets_eq_imp_space_eq[OF *] by (simp add: Sup_sigma_def) - -lemma sets_Sup_in_sets: - assumes "M \ {}" - assumes "\m. m \ M \ space m = space N" - assumes "\m. m \ M \ sets m \ sets N" - shows "sets (Sup_sigma M) \ sets N" -proof - - have *: "UNION M space = space N" - using assms by auto - show ?thesis - unfolding sets_Sup_sigma * using assms by (auto intro!: sets.sigma_sets_subset) -qed - -lemma measurable_Sup_sigma1: - assumes m: "m \ M" and f: "f \ measurable m N" - and const_space: "\m n. m \ M \ n \ M \ space m = space n" - shows "f \ measurable (Sup_sigma M) N" -proof - - have "space (Sup_sigma M) = space m" - using m by (auto simp add: space_Sup_sigma dest: const_space) - then show ?thesis - using m f unfolding measurable_def by (auto intro: in_Sup_sigma) -qed - -lemma measurable_Sup_sigma2: - assumes M: "M \ {}" - assumes f: "\m. m \ M \ f \ measurable N m" - shows "f \ measurable N (Sup_sigma M)" - unfolding Sup_sigma_def -proof (rule measurable_measure_of) - show "f \ space N \ UNION M space" - using measurable_space[OF f] M by auto -qed (auto intro: measurable_sets f dest: sets.sets_into_space) - -lemma Sup_sigma_sigma: - assumes [simp]: "M \ {}" and M: "\m. m \ M \ m \ Pow \" - shows "(\\<^sub>\ m\M. sigma \ m) = sigma \ (\M)" -proof (rule measure_eqI) - { fix a m assume "a \ sigma_sets \ m" "m \ M" - then have "a \ sigma_sets \ (\M)" - by induction (auto intro: sigma_sets.intros) } - then show "sets (\\<^sub>\ m\M. sigma \ m) = sets (sigma \ (\M))" - apply (simp add: sets_Sup_sigma space_measure_of_conv M Union_least) - apply (rule sigma_sets_eqI) - apply auto - done -qed (simp add: Sup_sigma_def emeasure_sigma) - -lemma SUP_sigma_sigma: - assumes M: "M \ {}" "\m. m \ M \ f m \ Pow \" - shows "(\\<^sub>\ m\M. sigma \ (f m)) = sigma \ (\m\M. f m)" -proof - - have "Sup_sigma (sigma \ ` f ` M) = sigma \ (\(f ` M))" - using M by (intro Sup_sigma_sigma) auto - then show ?thesis - by (simp add: image_image) -qed - subsection \The smallest $\sigma$-algebra regarding a function\ definition @@ -2157,31 +2077,6 @@ by (simp add: sets_vimage_algebra2 ex_simps[symmetric] vimage_comp comp_def del: ex_simps) qed (simp add: vimage_algebra_def emeasure_sigma) -lemma sets_vimage_Sup_eq: - assumes *: "M \ {}" "\m. m \ M \ f \ X \ space m" - shows "sets (vimage_algebra X f (Sup_sigma M)) = sets (\\<^sub>\ m \ M. vimage_algebra X f m)" - (is "?IS = ?SI") -proof - show "?IS \ ?SI" - by (intro sets_image_in_sets measurable_Sup_sigma2 measurable_Sup_sigma1) - (auto simp: space_Sup_sigma measurable_vimage_algebra1 *) - { fix m assume "m \ M" - moreover then have "f \ X \ space (Sup_sigma M)" "f \ X \ space m" - using * by (auto simp: space_Sup_sigma) - ultimately have "f \ measurable (vimage_algebra X f (Sup_sigma M)) m" - by (auto simp add: measurable_def sets_vimage_algebra2 intro: in_Sup_sigma) } - then show "?SI \ ?IS" - by (auto intro!: sets_image_in_sets sets_Sup_in_sets del: subsetI simp: *) -qed - -lemma vimage_algebra_Sup_sigma: - assumes [simp]: "MM \ {}" and "\M. M \ MM \ f \ X \ space M" - shows "vimage_algebra X f (Sup_sigma MM) = Sup_sigma (vimage_algebra X f ` MM)" -proof (rule measure_eqI) - show "sets (vimage_algebra X f (Sup_sigma MM)) = sets (Sup_sigma (vimage_algebra X f ` MM))" - using assms by (rule sets_vimage_Sup_eq) -qed (simp add: vimage_algebra_def Sup_sigma_def emeasure_sigma) - subsubsection \Restricted Space Sigma Algebra\ definition restrict_space where diff -r f164526d8727 -r 158ab2239496 src/HOL/Probability/Stream_Space.thy --- a/src/HOL/Probability/Stream_Space.thy Wed Jun 15 22:19:03 2016 +0200 +++ b/src/HOL/Probability/Stream_Space.thy Thu Jun 16 23:03:27 2016 +0200 @@ -94,16 +94,16 @@ shows "(\x. f x ## g x) \ measurable N (stream_space M)" by (rule measurable_stream_space2) (simp add: Stream_snth) -lemma measurable_smap[measurable]: +lemma measurable_smap[measurable]: assumes X[measurable]: "X \ measurable N M" shows "smap X \ measurable (stream_space N) (stream_space M)" by (rule measurable_stream_space2) simp -lemma measurable_stake[measurable]: +lemma measurable_stake[measurable]: "stake i \ measurable (stream_space (count_space UNIV)) (count_space (UNIV :: 'a::countable list set))" by (induct i) auto -lemma measurable_shift[measurable]: +lemma measurable_shift[measurable]: assumes f: "f \ measurable N (stream_space M)" assumes [measurable]: "g \ measurable N (stream_space M)" shows "(\x. stake n (f x) @- g x) \ measurable N (stream_space M)" @@ -168,7 +168,7 @@ lemma (in prob_space) nn_integral_stream_space: assumes [measurable]: "f \ borel_measurable (stream_space M)" shows "(\\<^sup>+X. f X \stream_space M) = (\\<^sup>+x. (\\<^sup>+X. f (x ## X) \stream_space M) \M)" -proof - +proof - interpret S: sequence_space M .. interpret P: pair_sigma_finite M "\\<^sub>M i::nat\UNIV. M" .. @@ -230,7 +230,7 @@ apply (simp add: AE_iff_nn_integral[symmetric]) done qed - + lemma (in prob_space) AE_stream_all: assumes [measurable]: "Measurable.pred M P" and P: "AE x in M. P x" shows "AE x in stream_space M. stream_all P x" @@ -271,14 +271,14 @@ assumes sets: "\i. (\x. x !! i) \ measurable N M" shows "sets (stream_space M) \ sets N" unfolding stream_space_def sets_distr - by (auto intro!: sets_image_in_sets measurable_Sup_sigma2 measurable_vimage_algebra2 del: subsetI equalityI + by (auto intro!: sets_image_in_sets measurable_Sup2 measurable_vimage_algebra2 del: subsetI equalityI simp add: sets_PiM_eq_proj snth_in space sets cong: measurable_cong_sets) lemma sets_stream_space_eq: "sets (stream_space M) = - sets (\\<^sub>\ i\UNIV. vimage_algebra (streams (space M)) (\s. s !! i) M)" + sets (SUP i:UNIV. vimage_algebra (streams (space M)) (\s. s !! i) M)" by (auto intro!: sets_stream_space_in_sets sets_Sup_in_sets sets_image_in_sets - measurable_Sup_sigma1 snth_in measurable_vimage_algebra1 del: subsetI - simp: space_Sup_sigma space_stream_space) + measurable_Sup1 snth_in measurable_vimage_algebra1 del: subsetI + simp: space_Sup_eq_UN space_stream_space) lemma sets_restrict_stream_space: assumes S[measurable]: "S \ sets M" @@ -288,17 +288,17 @@ apply (simp add: space_stream_space streams_mono2) apply (subst vimage_algebra_cong[OF refl refl sets_stream_space_eq]) apply (subst sets_stream_space_eq) - apply (subst sets_vimage_Sup_eq) + apply (subst sets_vimage_Sup_eq[where Y="streams (space M)"]) apply simp + apply auto [] apply (auto intro: streams_mono) [] + apply auto [] apply (simp add: image_image space_restrict_space) - apply (intro SUP_sigma_cong) apply (simp add: vimage_algebra_cong[OF refl refl restrict_space_eq_vimage_algebra]) apply (subst (1 2) vimage_algebra_vimage_algebra_eq) - apply (auto simp: streams_mono snth_in) + apply (auto simp: streams_mono snth_in ) done - primrec sstart :: "'a set \ 'a list \ 'a stream set" where "sstart S [] = streams S" | [simp del]: "sstart S (x # xs) = op ## x ` sstart S xs"