diff -r 28b51effc5ed -r cdf7693bbe08 src/HOL/Probability/Product_Measure.thy --- a/src/HOL/Probability/Product_Measure.thy Mon Mar 14 14:37:47 2011 +0100 +++ b/src/HOL/Probability/Product_Measure.thy Mon Mar 14 14:37:49 2011 +0100 @@ -416,7 +416,7 @@ show "?f -` A \ space ?P \ sets ?P" by simp qed -lemma (in pair_sigma_algebra) measurable_cut_fst: +lemma (in pair_sigma_algebra) measurable_cut_fst[simp,intro]: assumes "Q \ sets P" shows "Pair x -` Q \ sets M2" proof - let ?Q' = "{Q. Q \ space P \ Pair x -` Q \ sets M2}" @@ -504,15 +504,14 @@ fix A assume "A \ sets ?D" with sets_into_space have "\x. measure M2 (Pair x -` (space M1 \ space M2 - A)) = (if x \ space M1 then measure M2 (space M2) - ?s A x else 0)" - by (auto intro!: M2.finite_measure_compl measurable_cut_fst - simp: vimage_Diff) + by (auto intro!: M2.measure_compl simp: vimage_Diff) with `A \ sets ?D` top show "space ?D - A \ sets ?D" - by (auto intro!: Diff M1.measurable_If M1.borel_measurable_pextreal_diff) + by (auto intro!: Diff M1.measurable_If M1.borel_measurable_extreal_diff) next fix F :: "nat \ ('a\'b) set" assume "disjoint_family F" "range F \ sets ?D" - moreover then have "\x. measure M2 (\i. Pair x -` F i) = (\\<^isub>\ i. ?s (F i) x)" + moreover then have "\x. measure M2 (\i. Pair x -` F i) = (\i. ?s (F i) x)" by (intro M2.measure_countably_additive[symmetric]) - (auto intro!: measurable_cut_fst simp: disjoint_family_on_def) + (auto simp: disjoint_family_on_def) ultimately show "(\i. F i) \ sets ?D" by (auto simp: vimage_UN intro!: M1.borel_measurable_psuminf) qed @@ -546,7 +545,7 @@ have [intro]: "sigma_algebra M1" and [intro]: "sigma_algebra M2" by default+ have M1: "sigma_finite_measure M1" by default from M2.disjoint_sigma_finite guess F .. note F = this - then have "\i. F i \ sets M2" by auto + then have F_sets: "\i. F i \ sets M2" by auto let "?C x i" = "F i \ Pair x -` Q" { fix i let ?R = "M2.restricted_space (F i)" @@ -578,10 +577,10 @@ by simp } moreover { fix x - have "(\\<^isub>\i. measure M2 (?C x i)) = measure M2 (\i. ?C x i)" + have "(\i. measure M2 (?C x i)) = measure M2 (\i. ?C x i)" proof (intro M2.measure_countably_additive) show "range (?C x) \ sets M2" - using F `Q \ sets P` by (auto intro!: M2.Int measurable_cut_fst) + using F `Q \ sets P` by (auto intro!: M2.Int) have "disjoint_family F" using F by auto show "disjoint_family (?C x)" by (rule disjoint_family_on_bisimulation[OF `disjoint_family F`]) auto @@ -589,10 +588,10 @@ also have "(\i. ?C x i) = Pair x -` Q" using F sets_into_space `Q \ sets P` by (auto simp: space_pair_measure) - finally have "measure M2 (Pair x -` Q) = (\\<^isub>\i. measure M2 (?C x i))" + finally have "measure M2 (Pair x -` Q) = (\i. measure M2 (?C x i))" by simp } - ultimately show ?thesis - by (auto intro!: M1.borel_measurable_psuminf) + ultimately show ?thesis using `Q \ sets P` F_sets + by (auto intro!: M1.borel_measurable_psuminf M2.Int) qed lemma (in pair_sigma_finite) measure_cut_measurable_snd: @@ -620,7 +619,7 @@ apply (simp add: pair_measure_def pair_measure_generator_def) proof (rule M1.positive_integral_cong) fix x assume "x \ space M1" - have *: "\y. indicator A (x, y) = (indicator (Pair x -` A) y :: pextreal)" + have *: "\y. indicator A (x, y) = (indicator (Pair x -` A) y :: extreal)" unfolding indicator_def by auto show "(\\<^isup>+ y. indicator A (x, y) \M2) = measure M2 (Pair x -` A)" unfolding * @@ -639,18 +638,21 @@ by (simp add: M1.positive_integral_cmult_indicator ac_simps) qed +lemma (in measure_space) measure_not_negative[simp,intro]: + assumes A: "A \ sets M" shows "\ A \ - \" + using positive_measure[OF A] by auto + lemma (in pair_sigma_finite) sigma_finite_up_in_pair_measure_generator: - "\F::nat \ ('a \ 'b) set. range F \ sets E \ F \ space E \ - (\i. measure (M1 \\<^isub>M M2) (F i) \ \)" + "\F::nat \ ('a \ 'b) set. range F \ sets E \ incseq F \ (\i. F i) = space E \ + (\i. measure (M1 \\<^isub>M M2) (F i) \ \)" proof - obtain F1 :: "nat \ 'a set" and F2 :: "nat \ 'b set" where - F1: "range F1 \ sets M1" "F1 \ space M1" "\i. M1.\ (F1 i) \ \" and - F2: "range F2 \ sets M2" "F2 \ space M2" "\i. M2.\ (F2 i) \ \" + F1: "range F1 \ sets M1" "incseq F1" "(\i. F1 i) = space M1" "\i. M1.\ (F1 i) \ \" and + F2: "range F2 \ sets M2" "incseq F2" "(\i. F2 i) = space M2" "\i. M2.\ (F2 i) \ \" using M1.sigma_finite_up M2.sigma_finite_up by auto - then have space: "space M1 = (\i. F1 i)" "space M2 = (\i. F2 i)" - unfolding isoton_def by auto + then have space: "space M1 = (\i. F1 i)" "space M2 = (\i. F2 i)" by auto let ?F = "\i. F1 i \ F2 i" - show ?thesis unfolding isoton_def space_pair_measure + show ?thesis unfolding space_pair_measure proof (intro exI[of _ ?F] conjI allI) show "range ?F \ sets E" using F1 F2 by (fastsimp intro!: pair_measure_generatorI) @@ -661,8 +663,8 @@ then obtain i j where "fst x \ F1 i" "snd x \ F2 j" by (auto simp: space) then have "fst x \ F1 (max i j)" "snd x \ F2 (max j i)" - using `F1 \ space M1` `F2 \ space M2` - by (auto simp: max_def dest: isoton_mono_le) + using `incseq F1` `incseq F2` unfolding incseq_def + by (force split: split_max)+ then have "(fst x, snd x) \ F1 (max i j) \ F2 (max i j)" by (intro SigmaI) (auto simp add: min_max.sup_commute) then show "x \ (\i. ?F i)" by auto @@ -670,21 +672,22 @@ then show "(\i. ?F i) = space E" using space by (auto simp: space pair_measure_generator_def) next - fix i show "F1 i \ F2 i \ F1 (Suc i) \ F2 (Suc i)" - using `F1 \ space M1` `F2 \ space M2` unfolding isoton_def - by auto + fix i show "incseq (\i. F1 i \ F2 i)" + using `incseq F1` `incseq F2` unfolding incseq_Suc_iff by auto next fix i from F1 F2 have "F1 i \ sets M1" "F2 i \ sets M2" by auto - with F1 F2 show "measure P (F1 i \ F2 i) \ \" + with F1 F2 M1.positive_measure[OF this(1)] M2.positive_measure[OF this(2)] + show "measure P (F1 i \ F2 i) \ \" by (simp add: pair_measure_times) qed qed sublocale pair_sigma_finite \ sigma_finite_measure P proof - show "measure P {} = 0" - unfolding pair_measure_def pair_measure_generator_def sigma_def by auto + show "positive P (measure P)" + unfolding pair_measure_def pair_measure_generator_def sigma_def positive_def + by (auto intro: M1.positive_integral_positive M2.positive_integral_positive) show "countably_additive P (measure P)" unfolding countably_additive_def @@ -697,20 +700,20 @@ moreover have "\x. disjoint_family (\i. Pair x -` F i)" by (intro disjoint_family_on_bisimulation[OF F(2)]) auto moreover have "\x. x \ space M1 \ range (\i. Pair x -` F i) \ sets M2" - using F by (auto intro!: measurable_cut_fst) - ultimately show "(\\<^isub>\n. measure P (F n)) = measure P (\i. F i)" - by (simp add: pair_measure_alt vimage_UN M1.positive_integral_psuminf[symmetric] + using F by auto + ultimately show "(\n. measure P (F n)) = measure P (\i. F i)" + by (simp add: pair_measure_alt vimage_UN M1.positive_integral_suminf[symmetric] M2.measure_countably_additive cong: M1.positive_integral_cong) qed from sigma_finite_up_in_pair_measure_generator guess F :: "nat \ ('a \ 'b) set" .. note F = this - show "\F::nat \ ('a \ 'b) set. range F \ sets P \ (\i. F i) = space P \ (\i. measure P (F i) \ \)" + show "\F::nat \ ('a \ 'b) set. range F \ sets P \ (\i. F i) = space P \ (\i. measure P (F i) \ \)" proof (rule exI[of _ F], intro conjI) show "range F \ sets P" using F by (auto simp: pair_measure_def) show "(\i. F i) = space P" - using F by (auto simp: pair_measure_def pair_measure_generator_def isoton_def) - show "\i. measure P (F i) \ \" using F by auto + using F by (auto simp: pair_measure_def pair_measure_generator_def) + show "\i. measure P (F i) \ \" using F by auto qed qed @@ -741,7 +744,7 @@ show "(\(y, x). (x, y)) \ measurable Q.P P" by (rule Q.pair_sigma_algebra_swap_measurable) show "sets (sigma E) = sets P" "space E = space P" "A \ sets (sigma E)" using assms unfolding pair_measure_def by auto - show "range F \ sets E" "F \ space E" "\i. \ (F i) \ \" + show "range F \ sets E" "incseq F" "(\i. F i) = space E" "\i. \ (F i) \ \" using F `A \ sets P` by (auto simp: pair_measure_def) fix X assume "X \ sets E" then obtain A B where X[simp]: "X = A \ B" and AB: "A \ sets M1" "B \ sets M2" @@ -758,8 +761,8 @@ qed lemma pair_sigma_algebra_sigma: - assumes 1: "S1 \ (space E1)" "range S1 \ sets E1" and E1: "sets E1 \ Pow (space E1)" - assumes 2: "S2 \ (space E2)" "range S2 \ sets E2" and E2: "sets E2 \ Pow (space E2)" + assumes 1: "incseq S1" "(\i. S1 i) = space E1" "range S1 \ sets E1" and E1: "sets E1 \ Pow (space E1)" + assumes 2: "decseq S2" "(\i. S2 i) = space E2" "range S2 \ sets E2" and E2: "sets E2 \ Pow (space E2)" shows "sets (sigma (pair_measure_generator (sigma E1) (sigma E2))) = sets (sigma (pair_measure_generator E1 E2))" (is "sets ?S = sets ?E") proof - @@ -771,22 +774,22 @@ using E1 E2 by (intro sigma_algebra_sigma) auto { fix A assume "A \ sets E1" then have "fst -` A \ space ?E = A \ (\i. S2 i)" - using E1 2 unfolding isoton_def pair_measure_generator_def by auto + using E1 2 unfolding pair_measure_generator_def by auto also have "\ = (\i. A \ S2 i)" by auto also have "\ \ sets ?E" unfolding pair_measure_generator_def sets_sigma using 2 `A \ sets E1` by (intro sigma_sets.Union) - (auto simp: image_subset_iff intro!: sigma_sets.Basic) + (force simp: image_subset_iff intro!: sigma_sets.Basic) finally have "fst -` A \ space ?E \ sets ?E" . } moreover { fix B assume "B \ sets E2" then have "snd -` B \ space ?E = (\i. S1 i) \ B" - using E2 1 unfolding isoton_def pair_measure_generator_def by auto + using E2 1 unfolding pair_measure_generator_def by auto also have "\ = (\i. S1 i \ B)" by auto also have "\ \ sets ?E" using 1 `B \ sets E2` unfolding pair_measure_generator_def sets_sigma by (intro sigma_sets.Union) - (auto simp: image_subset_iff intro!: sigma_sets.Basic) + (force simp: image_subset_iff intro!: sigma_sets.Basic) finally have "snd -` B \ space ?E \ sets ?E" . } ultimately have proj: "fst \ measurable ?E (sigma E1) \ snd \ measurable ?E (sigma E2)" @@ -819,12 +822,12 @@ section "Fubinis theorem" lemma (in pair_sigma_finite) simple_function_cut: - assumes f: "simple_function P f" + assumes f: "simple_function P f" "\x. 0 \ f x" shows "(\x. \\<^isup>+y. f (x, y) \M2) \ borel_measurable M1" and "(\\<^isup>+ x. (\\<^isup>+ y. f (x, y) \M2) \M1) = integral\<^isup>P P f" proof - have f_borel: "f \ borel_measurable P" - using f by (rule borel_measurable_simple_function) + using f(1) by (rule borel_measurable_simple_function) let "?F z" = "f -` {z} \ space P" let "?F' x z" = "Pair x -` ?F z" { fix x assume "x \ space M1" @@ -836,15 +839,15 @@ by (intro borel_measurable_vimage measurable_cut_fst) ultimately have "simple_function M2 (\ y. f (x, y))" apply (rule_tac M2.simple_function_cong[THEN iffD2, OF _]) - apply (rule simple_function_indicator_representation[OF f]) + apply (rule simple_function_indicator_representation[OF f(1)]) using `x \ space M1` by (auto simp del: space_sigma) } note M2_sf = this { fix x assume x: "x \ space M1" then have "(\\<^isup>+y. f (x, y) \M2) = (\z\f ` space P. z * M2.\ (?F' x z))" - unfolding M2.positive_integral_eq_simple_integral[OF M2_sf[OF x]] + unfolding M2.positive_integral_eq_simple_integral[OF M2_sf[OF x] f(2)] unfolding simple_integral_def proof (safe intro!: setsum_mono_zero_cong_left) - from f show "finite (f ` space P)" by (rule simple_functionD) + from f(1) show "finite (f ` space P)" by (rule simple_functionD) next fix y assume "y \ space M2" then show "f (x, y) \ f ` space P" using `x \ space M1` by (auto simp: space_pair_measure) @@ -862,11 +865,16 @@ by (auto intro!: f_borel borel_measurable_vimage simp del: space_sigma) moreover then have "\z. (\x. M2.\ (?F' x z)) \ borel_measurable M1" by (auto intro!: measure_cut_measurable_fst simp del: vimage_Int) + moreover have *: "\i x. 0 \ M2.\ (Pair x -` (f -` {i} \ space P))" + using f(1)[THEN simple_functionD(2)] f(2) by (intro M2.positive_measure measurable_cut_fst) + moreover { fix i assume "i \ f`space P" + with * have "\x. 0 \ i * M2.\ (Pair x -` (f -` {i} \ space P))" + using f(2) by auto } ultimately show "(\x. \\<^isup>+y. f (x, y) \M2) \ borel_measurable M1" - and "(\\<^isup>+ x. (\\<^isup>+ y. f (x, y) \M2) \M1) = integral\<^isup>P P f" + and "(\\<^isup>+ x. (\\<^isup>+ y. f (x, y) \M2) \M1) = integral\<^isup>P P f" using f(2) by (auto simp del: vimage_Int cong: measurable_cong - intro!: M1.borel_measurable_pextreal_setsum + intro!: M1.borel_measurable_extreal_setsum setsum_cong simp add: M1.positive_integral_setsum simple_integral_def M1.positive_integral_cmult M1.positive_integral_cong[OF eq] @@ -880,42 +888,38 @@ (is "?C f \ borel_measurable M1") and "(\\<^isup>+ x. (\\<^isup>+ y. f (x, y) \M2) \M1) = integral\<^isup>P P f" proof - - from borel_measurable_implies_simple_function_sequence[OF f] - obtain F where F: "\i. simple_function P (F i)" "F \ f" by auto + from borel_measurable_implies_simple_function_sequence'[OF f] guess F . note F = this then have F_borel: "\i. F i \ borel_measurable P" - and F_mono: "\i x. F i x \ F (Suc i) x" - and F_SUPR: "\x. (SUP i. F i x) = f x" - unfolding isoton_fun_expand unfolding isoton_def le_fun_def by (auto intro: borel_measurable_simple_function) - note sf = simple_function_cut[OF F(1)] + note sf = simple_function_cut[OF F(1,5)] then have "(\x. SUP i. ?C (F i) x) \ borel_measurable M1" using F(1) by auto moreover { fix x assume "x \ space M1" - have isotone: "(\ i y. F i (x, y)) \ (\y. f (x, y))" - using `F \ f` unfolding isoton_fun_expand - by (auto simp: isoton_def) - note measurable_pair_image_snd[OF F_borel`x \ space M1`] - from M2.positive_integral_isoton[OF isotone this] - have "(SUP i. ?C (F i) x) = ?C f x" - by (simp add: isoton_def) } + from F measurable_pair_image_snd[OF F_borel`x \ space M1`] + have "(\\<^isup>+y. (SUP i. F i (x, y)) \M2) = (SUP i. ?C (F i) x)" + by (intro M2.positive_integral_monotone_convergence_SUP) + (auto simp: incseq_Suc_iff le_fun_def) + then have "(SUP i. ?C (F i) x) = ?C f x" + unfolding F(4) positive_integral_max_0 by simp } note SUPR_C = this ultimately show "?C f \ borel_measurable M1" by (simp cong: measurable_cong) have "(\\<^isup>+x. (SUP i. F i x) \P) = (SUP i. integral\<^isup>P P (F i))" - using F_borel F_mono - by (auto intro!: positive_integral_monotone_convergence_SUP[symmetric]) + using F_borel F + by (intro positive_integral_monotone_convergence_SUP) auto also have "(SUP i. integral\<^isup>P P (F i)) = (SUP i. \\<^isup>+ x. (\\<^isup>+ y. F i (x, y) \M2) \M1)" unfolding sf(2) by simp - also have "\ = \\<^isup>+ x. (SUP i. \\<^isup>+ y. F i (x, y) \M2) \M1" - by (auto intro!: M1.positive_integral_monotone_convergence_SUP[OF _ sf(1)] - M2.positive_integral_mono F_mono) + also have "\ = \\<^isup>+ x. (SUP i. \\<^isup>+ y. F i (x, y) \M2) \M1" using F sf(1) + by (intro M1.positive_integral_monotone_convergence_SUP[symmetric]) + (auto intro!: M2.positive_integral_mono M2.positive_integral_positive + simp: incseq_Suc_iff le_fun_def) also have "\ = \\<^isup>+ x. (\\<^isup>+ y. (SUP i. F i (x, y)) \M2) \M1" - using F_borel F_mono - by (auto intro!: M2.positive_integral_monotone_convergence_SUP - M1.positive_integral_cong measurable_pair_image_snd) + using F_borel F(2,5) + by (auto intro!: M1.positive_integral_cong M2.positive_integral_monotone_convergence_SUP[symmetric] + simp: incseq_Suc_iff le_fun_def measurable_pair_image_snd) finally show "(\\<^isup>+ x. (\\<^isup>+ y. f (x, y) \M2) \M1) = integral\<^isup>P P f" - unfolding F_SUPR by simp + using F by (simp add: positive_integral_max_0) qed lemma (in pair_sigma_finite) measure_preserving_swap: @@ -963,8 +967,8 @@ unfolding positive_integral_fst_measurable[OF assms] .. lemma (in pair_sigma_finite) AE_pair: - assumes "almost_everywhere (\x. Q x)" - shows "M1.almost_everywhere (\x. M2.almost_everywhere (\y. Q (x, y)))" + assumes "AE x in P. Q x" + shows "AE x in M1. (AE y in M2. Q (x, y))" proof - obtain N where N: "N \ sets P" "\ N = 0" "{x\space P. \ Q x} \ N" using assms unfolding almost_everywhere_def by auto @@ -972,9 +976,9 @@ proof (rule M1.AE_I) from N measure_cut_measurable_fst[OF `N \ sets P`] show "M1.\ {x\space M1. M2.\ (Pair x -` N) \ 0} = 0" - by (simp add: M1.positive_integral_0_iff pair_measure_alt vimage_def) + by (auto simp: pair_measure_alt M1.positive_integral_0_iff) show "{x \ space M1. M2.\ (Pair x -` N) \ 0} \ sets M1" - by (intro M1.borel_measurable_pextreal_neq_const measure_cut_measurable_fst N) + by (intro M1.borel_measurable_extreal_neq_const measure_cut_measurable_fst N) { fix x assume "x \ space M1" "M2.\ (Pair x -` N) = 0" have "M2.almost_everywhere (\y. Q (x, y))" proof (rule M2.AE_I) @@ -1036,41 +1040,52 @@ shows "M1.almost_everywhere (\x. integrable M2 (\ y. f (x, y)))" (is "?AE") and "(\x. (\y. f (x, y) \M2) \M1) = integral\<^isup>L P f" (is "?INT") proof - - let "?pf x" = "Real (f x)" and "?nf x" = "Real (- f x)" + let "?pf x" = "extreal (f x)" and "?nf x" = "extreal (- f x)" have borel: "?nf \ borel_measurable P""?pf \ borel_measurable P" and - int: "integral\<^isup>P P ?nf \ \" "integral\<^isup>P P ?pf \ \" + int: "integral\<^isup>P P ?nf \ \" "integral\<^isup>P P ?pf \ \" using assms by auto - have "(\\<^isup>+x. (\\<^isup>+y. Real (f (x, y)) \M2) \M1) \ \" - "(\\<^isup>+x. (\\<^isup>+y. Real (- f (x, y)) \M2) \M1) \ \" + have "(\\<^isup>+x. (\\<^isup>+y. extreal (f (x, y)) \M2) \M1) \ \" + "(\\<^isup>+x. (\\<^isup>+y. extreal (- f (x, y)) \M2) \M1) \ \" using borel[THEN positive_integral_fst_measurable(1)] int unfolding borel[THEN positive_integral_fst_measurable(2)] by simp_all with borel[THEN positive_integral_fst_measurable(1)] - have AE: "M1.almost_everywhere (\x. (\\<^isup>+y. Real (f (x, y)) \M2) \ \)" - "M1.almost_everywhere (\x. (\\<^isup>+y. Real (- f (x, y)) \M2) \ \)" - by (auto intro!: M1.positive_integral_omega_AE) - then show ?AE using assms + have AE_pos: "AE x in M1. (\\<^isup>+y. extreal (f (x, y)) \M2) \ \" + "AE x in M1. (\\<^isup>+y. extreal (- f (x, y)) \M2) \ \" + by (auto intro!: M1.positive_integral_PInf_AE ) + then have AE: "AE x in M1. \\\<^isup>+y. extreal (f (x, y)) \M2\ \ \" + "AE x in M1. \\\<^isup>+y. extreal (- f (x, y)) \M2\ \ \" + by (auto simp: M2.positive_integral_positive) + from AE_pos show ?AE using assms by (simp add: measurable_pair_image_snd integrable_def) - { fix f assume borel: "(\x. Real (f x)) \ borel_measurable P" - and int: "integral\<^isup>P P (\x. Real (f x)) \ \" - and AE: "M1.almost_everywhere (\x. (\\<^isup>+y. Real (f (x, y)) \M2) \ \)" - have "integrable M1 (\x. real (\\<^isup>+y. Real (f (x, y)) \M2))" (is "integrable M1 ?f") + { fix f have "(\\<^isup>+ x. - \\<^isup>+ y. extreal (f x y) \M2 \M1) = (\\<^isup>+x. 0 \M1)" + using M2.positive_integral_positive + by (intro M1.positive_integral_cong_pos) (auto simp: extreal_uminus_le_reorder) + then have "(\\<^isup>+ x. - \\<^isup>+ y. extreal (f x y) \M2 \M1) = 0" by simp } + note this[simp] + { fix f assume borel: "(\x. extreal (f x)) \ borel_measurable P" + and int: "integral\<^isup>P P (\x. extreal (f x)) \ \" + and AE: "M1.almost_everywhere (\x. (\\<^isup>+y. extreal (f (x, y)) \M2) \ \)" + have "integrable M1 (\x. real (\\<^isup>+y. extreal (f (x, y)) \M2))" (is "integrable M1 ?f") proof (intro integrable_def[THEN iffD2] conjI) show "?f \ borel_measurable M1" - using borel by (auto intro!: M1.borel_measurable_real positive_integral_fst_measurable) - have "(\\<^isup>+x. Real (?f x) \M1) = (\\<^isup>+x. (\\<^isup>+y. Real (f (x, y)) \M2) \M1)" - using AE by (auto intro!: M1.positive_integral_cong_AE simp: Real_real) - then show "(\\<^isup>+x. Real (?f x) \M1) \ \" + using borel by (auto intro!: M1.borel_measurable_real_of_extreal positive_integral_fst_measurable) + have "(\\<^isup>+x. extreal (?f x) \M1) = (\\<^isup>+x. (\\<^isup>+y. extreal (f (x, y)) \M2) \M1)" + using AE M2.positive_integral_positive + by (auto intro!: M1.positive_integral_cong_AE simp: extreal_real) + then show "(\\<^isup>+x. extreal (?f x) \M1) \ \" using positive_integral_fst_measurable[OF borel] int by simp - have "(\\<^isup>+x. Real (- ?f x) \M1) = (\\<^isup>+x. 0 \M1)" - by (intro M1.positive_integral_cong) simp - then show "(\\<^isup>+x. Real (- ?f x) \M1) \ \" by simp + have "(\\<^isup>+x. extreal (- ?f x) \M1) = (\\<^isup>+x. 0 \M1)" + by (intro M1.positive_integral_cong_pos) + (simp add: M2.positive_integral_positive real_of_extreal_pos) + then show "(\\<^isup>+x. extreal (- ?f x) \M1) \ \" by simp qed } - from this[OF borel(1) int(1) AE(2)] this[OF borel(2) int(2) AE(1)] + with this[OF borel(1) int(1) AE_pos(2)] this[OF borel(2) int(2) AE_pos(1)] show ?INT unfolding lebesgue_integral_def[of P] lebesgue_integral_def[of M2] borel[THEN positive_integral_fst_measurable(2), symmetric] - using AE by (simp add: M1.integral_real) + using AE[THEN M1.integral_real] + by simp qed lemma (in pair_sigma_finite) integrable_snd_measurable: @@ -1195,7 +1210,8 @@ lemma sigma_product_algebra_sigma_eq: assumes "finite I" - assumes isotone: "\i. i \ I \ (S i) \ (space (E i))" + assumes mono: "\i. i \ I \ incseq (S i)" + assumes union: "\i. i \ I \ (\j. S i j) = space (E i)" assumes sets_into: "\i. i \ I \ range (S i) \ sets (E i)" and E: "\i. sets (E i) \ Pow (space (E i))" shows "sets (\\<^isub>M i\I. sigma (E i)) = sets (\\<^isub>M i\I. E i)" @@ -1214,13 +1230,13 @@ by (intro sigma_algebra.sigma_algebra_cong[OF sigma_algebra_sigma]) (auto dest: Pi_mem) { fix A i assume "i \ I" and A: "A \ sets (E i)" then have "(\x. x i) -` A \ space ?E = (\\<^isub>E j\I. if j = i then A else \n. S j n) \ space ?E" - using isotone unfolding isoton_def space_product_algebra + using mono union unfolding incseq_Suc_iff space_product_algebra by (auto dest: Pi_mem) also have "\ = (\n. (\\<^isub>E j\I. if j = i then A else S j n))" unfolding space_product_algebra apply simp apply (subst Pi_UN[OF `finite I`]) - using isotone[THEN isoton_mono_le] apply simp + using mono[THEN incseqD] apply simp apply (simp add: PiE_Int) apply (intro PiE_cong) using A sets_into by (auto intro!: into_space) @@ -1324,7 +1340,7 @@ obtain E where E: "A = Pi\<^isub>E (I \ J) E" "E \ (\ i\I \ J. sets (M i))" . then have *: "?f -` A \ space (?I \\<^isub>M ?J) = Pi\<^isub>E I E \ Pi\<^isub>E J E" using sets_into_space `I \ J = {}` - by (auto simp add: space_pair_measure) blast+ + by (auto simp add: space_pair_measure) fast+ then show "?f -` A \ space (?I \\<^isub>M ?J) \ sets (?I \\<^isub>M ?J)" using E unfolding * by (auto intro!: pair_measureI in_sigma product_algebra_generatorI simp: product_algebra_def) @@ -1360,6 +1376,44 @@ sublocale finite_product_sigma_finite \ finite_product_sigma_algebra by default (fact finite_index') +lemma setprod_extreal_0: + fixes f :: "'a \ extreal" + shows "(\i\A. f i) = 0 \ (finite A \ (\i\A. f i = 0))" +proof cases + assume "finite A" + then show ?thesis by (induct A) auto +qed auto + +lemma setprod_extreal_pos: + fixes f :: "'a \ extreal" assumes pos: "\i. i \ I \ 0 \ f i" shows "0 \ (\i\I. f i)" +proof cases + assume "finite I" from this pos show ?thesis by induct auto +qed simp + +lemma setprod_PInf: + assumes "\i. i \ I \ 0 \ f i" + shows "(\i\I. f i) = \ \ finite I \ (\i\I. f i = \) \ (\i\I. f i \ 0)" +proof cases + assume "finite I" from this assms show ?thesis + proof (induct I) + case (insert i I) + then have pos: "0 \ f i" "0 \ setprod f I" by (auto intro!: setprod_extreal_pos) + from insert have "(\j\insert i I. f j) = \ \ setprod f I * f i = \" by auto + also have "\ \ (setprod f I = \ \ f i = \) \ f i \ 0 \ setprod f I \ 0" + using setprod_extreal_pos[of I f] pos + by (cases rule: extreal2_cases[of "f i" "setprod f I"]) auto + also have "\ \ finite (insert i I) \ (\j\insert i I. f j = \) \ (\j\insert i I. f j \ 0)" + using insert by (auto simp: setprod_extreal_0) + finally show ?case . + qed simp +qed simp + +lemma setprod_extreal: "(\i\A. extreal (f i)) = extreal (setprod f A)" +proof cases + assume "finite A" then show ?thesis + by induct (auto simp: one_extreal_def) +qed (simp add: one_extreal_def) + lemma (in finite_product_sigma_finite) product_algebra_generator_measure: assumes "Pi\<^isub>E I F \ sets G" shows "measure G (Pi\<^isub>E I F) = (\i\I. M.\ i (F i))" @@ -1373,13 +1427,13 @@ next assume empty: "\ (\j\I. F j \ {})" then have "(\j\I. M.\ j (F j)) = 0" - by (auto simp: setprod_pextreal_0 intro!: bexI) + by (auto simp: setprod_extreal_0 intro!: bexI) moreover have "\j\I. (SOME F'. Pi\<^isub>E I F = Pi\<^isub>E I F') j = {}" by (rule someI2[where P="\F'. Pi\<^isub>E I F = Pi\<^isub>E I F'"]) (insert empty, auto simp: Pi_eq_empty_iff[symmetric]) then have "(\j\I. M.\ j ((SOME F'. Pi\<^isub>E I F = Pi\<^isub>E I F') j)) = 0" - by (auto simp: setprod_pextreal_0 intro!: bexI) + by (auto simp: setprod_extreal_0 intro!: bexI) ultimately show ?thesis unfolding product_algebra_generator_def by simp qed @@ -1387,34 +1441,32 @@ lemma (in finite_product_sigma_finite) sigma_finite_pairs: "\F::'i \ nat \ 'a set. (\i\I. range (F i) \ sets (M i)) \ - (\k. \i\I. \ i (F i k) \ \) \ - (\k. \\<^isub>E i\I. F i k) \ space G" + (\k. \i\I. \ i (F i k) \ \) \ incseq (\k. \\<^isub>E i\I. F i k) \ + (\k. \\<^isub>E i\I. F i k) = space G" proof - - have "\i::'i. \F::nat \ 'a set. range F \ sets (M i) \ F \ space (M i) \ (\k. \ i (F k) \ \)" + have "\i::'i. \F::nat \ 'a set. range F \ sets (M i) \ incseq F \ (\i. F i) = space (M i) \ (\k. \ i (F k) \ \)" using M.sigma_finite_up by simp from choice[OF this] guess F :: "'i \ nat \ 'a set" .. - then have "\i. range (F i) \ sets (M i)" "\i. F i \ space (M i)" "\i k. \ i (F i k) \ \" + then have F: "\i. range (F i) \ sets (M i)" "\i. incseq (F i)" "\i. (\j. F i j) = space (M i)" "\i k. \ i (F i k) \ \" by auto let ?F = "\k. \\<^isub>E i\I. F i k" note space_product_algebra[simp] show ?thesis - proof (intro exI[of _ F] conjI allI isotoneI set_eqI iffI ballI) + proof (intro exI[of _ F] conjI allI incseq_SucI set_eqI iffI ballI) fix i show "range (F i) \ sets (M i)" by fact next - fix i k show "\ i (F i k) \ \" by fact + fix i k show "\ i (F i k) \ \" by fact next fix A assume "A \ (\i. ?F i)" then show "A \ space G" using `\i. range (F i) \ sets (M i)` M.sets_into_space by (force simp: image_subset_iff) next fix f assume "f \ space G" - with Pi_UN[OF finite_index, of "\k i. F i k"] - `\i. F i \ space (M i)`[THEN isotonD(2)] - `\i. F i \ space (M i)`[THEN isoton_mono_le] - show "f \ (\i. ?F i)" by auto + with Pi_UN[OF finite_index, of "\k i. F i k"] F + show "f \ (\i. ?F i)" by (auto simp: incseq_def) next fix i show "?F i \ ?F (Suc i)" - using `\i. F i \ space (M i)`[THEN isotonD(1)] by auto + using `\i. incseq (F i)`[THEN incseq_SucD] by auto qed qed @@ -1438,7 +1490,7 @@ using `finite I` proof induct case empty interpret finite_product_sigma_finite M "{}" by default simp - let ?\ = "(\A. if A = {} then 0 else 1) :: 'd set \ pextreal" + let ?\ = "(\A. if A = {} then 0 else 1) :: 'd set \ extreal" show ?case proof (intro exI conjI ballI) have "sigma_algebra (sigma G \measure := ?\\)" @@ -1488,22 +1540,23 @@ proof (unfold *, default, simp) from I'.sigma_finite_pairs guess F :: "'i \ nat \ 'a set" .. then have F: "\j. j \ insert i I \ range (F j) \ sets (M j)" - "(\k. \\<^isub>E j \ insert i I. F j k) \ space I'.G" - "\k. \j. j \ insert i I \ \ j (F j k) \ \" + "incseq (\k. \\<^isub>E j \ insert i I. F j k)" + "(\k. \\<^isub>E j \ insert i I. F j k) = space I'.G" + "\k. \j. j \ insert i I \ \ j (F j k) \ \" by blast+ let "?F k" = "\\<^isub>E j \ insert i I. F j k" show "\F::nat \ ('i \ 'a) set. range F \ sets I'.P \ - (\i. F i) = (\\<^isub>E i\insert i I. space (M i)) \ (\i. ?m (F i) \ \)" + (\i. F i) = (\\<^isub>E i\insert i I. space (M i)) \ (\i. ?m (F i) \ \)" proof (intro exI[of _ ?F] conjI allI) show "range ?F \ sets I'.P" using F(1) by auto next - from F(2)[THEN isotonD(2)] - show "(\i. ?F i) = (\\<^isub>E i\insert i I. space (M i))" by simp + from F(3) show "(\i. ?F i) = (\\<^isub>E i\insert i I. space (M i))" by simp next fix j - show "?\ (?F j) \ \" - using F `finite I` - by (subst product) (auto simp: setprod_\) + have "\k. k \ insert i I \ 0 \ measure (M k) (F k j)" + using F(1) by auto + with F `finite I` setprod_PInf[of "insert i I", OF this] show "?\ (?F j) \ \" + by (subst product) auto qed qed qed @@ -1542,7 +1595,8 @@ by (simp_all add: sigma_def image_constant) lemma (in product_sigma_finite) positive_integral_empty: - "integral\<^isup>P (Pi\<^isub>M {} M) f = f (\k. undefined)" + assumes pos: "0 \ f (\k. undefined)" + shows "integral\<^isup>P (Pi\<^isub>M {} M) f = f (\k. undefined)" proof - interpret finite_product_sigma_finite M "{}" by default (fact finite.emptyI) have "\A. measure (Pi\<^isub>M {} M) (Pi\<^isub>E {} A) = 1" @@ -1550,10 +1604,10 @@ then show ?thesis unfolding positive_integral_def simple_function_def simple_integral_def_raw proof (simp add: P_empty, intro antisym) - show "f (\k. undefined) \ (SUP f:{g. g \ f}. f (\k. undefined))" - by (intro le_SUPI) auto - show "(SUP f:{g. g \ f}. f (\k. undefined)) \ f (\k. undefined)" - by (intro SUP_leI) (auto simp: le_fun_def) + show "f (\k. undefined) \ (SUP f:{g. g \ max 0 \ f}. f (\k. undefined))" + by (intro le_SUPI) (auto simp: le_fun_def split: split_max) + show "(SUP f:{g. g \ max 0 \ f}. f (\k. undefined)) \ f (\k. undefined)" using pos + by (intro SUP_leI) (auto simp: le_fun_def simp: max_def split: split_if_asm) qed qed @@ -1572,8 +1626,9 @@ let "?X S" = "?g -` S \ space P.P" from IJ.sigma_finite_pairs obtain F where F: "\i. i\ I \ J \ range (F i) \ sets (M i)" - "(\k. \\<^isub>E i\I \ J. F i k) \ space IJ.G" - "\k. \i\I\J. \ i (F i k) \ \" + "incseq (\k. \\<^isub>E i\I \ J. F i k)" + "(\k. \\<^isub>E i\I \ J. F i k) = space IJ.G" + "\k. \i\I\J. \ i (F i k) \ \" by auto let ?F = "\k. \\<^isub>E i\I \ J. F i k" show "IJ.\ A = P.\ (?X A)" @@ -1589,12 +1644,13 @@ show "range ?F \ sets IJ.G" using F by (simp add: image_subset_iff product_algebra_def product_algebra_generator_def) - show "?F \ space IJ.G " using F(2) by simp - show "\k. IJ.\ (?F k) \ \" - using `finite I` F - by (subst IJ.measure_times) (auto simp add: setprod_\) - show "?g \ measurable P.P IJ.P" - using IJ by (rule measurable_merge) + show "incseq ?F" "(\i. ?F i) = space IJ.G " by fact+ + next + fix k + have "\j. j \ I \ J \ 0 \ measure (M j) (F j k)" + using F(1) by auto + with F `finite I` setprod_PInf[of "I \ J", OF this] + show "IJ.\ (?F k) \ \" by (subst IJ.measure_times) auto next fix A assume "A \ sets IJ.G" then obtain F where A: "A = Pi\<^isub>E (I \ J) F" @@ -1611,7 +1667,7 @@ using `finite J` `finite I` F unfolding A by (intro IJ.measure_times[symmetric]) auto finally show "IJ.\ A = P.\ (?X A)" by (rule sym) - qed + qed (rule measurable_merge[OF IJ]) qed lemma (in product_sigma_finite) measure_preserving_merge: @@ -1692,8 +1748,9 @@ qed lemma (in product_sigma_finite) product_positive_integral_setprod: - fixes f :: "'i \ 'a \ pextreal" + fixes f :: "'i \ 'a \ extreal" assumes "finite I" and borel: "\i. i \ I \ f i \ borel_measurable (M i)" + and pos: "\i x. i \ I \ 0 \ f i x" shows "(\\<^isup>+ x. (\i\I. f i (x i)) \Pi\<^isub>M I M) = (\i\I. integral\<^isup>P (M i) (f i))" using assms proof induct case empty @@ -1707,12 +1764,15 @@ using insert by (auto intro!: setprod_cong) have prod: "\J. J \ insert i I \ (\x. (\i\J. f i (x i))) \ borel_measurable (Pi\<^isub>M J M)" using sets_into_space insert - by (intro sigma_algebra.borel_measurable_pextreal_setprod sigma_algebra_product_algebra + by (intro sigma_algebra.borel_measurable_extreal_setprod sigma_algebra_product_algebra measurable_comp[OF measurable_component_singleton, unfolded comp_def]) auto - show ?case - by (simp add: product_positive_integral_insert[OF insert(1,2) prod]) - (simp add: insert I.positive_integral_cmult M.positive_integral_multc * prod subset_insertI) + then show ?case + apply (simp add: product_positive_integral_insert[OF insert(1,2) prod]) + apply (simp add: insert * pos borel setprod_extreal_pos M.positive_integral_multc) + apply (subst I.positive_integral_cmult) + apply (auto simp add: pos borel insert setprod_extreal_pos positive_integral_positive) + done qed lemma (in product_sigma_finite) product_integral_singleton: @@ -1720,8 +1780,8 @@ shows "(\x. f (x i) \Pi\<^isub>M {i} M) = integral\<^isup>L (M i) f" proof - interpret I: finite_product_sigma_finite M "{i}" by default simp - have *: "(\x. Real (f x)) \ borel_measurable (M i)" - "(\x. Real (- f x)) \ borel_measurable (M i)" + have *: "(\x. extreal (f x)) \ borel_measurable (M i)" + "(\x. extreal (- f x)) \ borel_measurable (M i)" using assms by auto show ?thesis unfolding lebesgue_integral_def *[THEN product_positive_integral_singleton] .. @@ -1795,15 +1855,17 @@ proof (unfold integrable_def, intro conjI) show "(\x. abs (?f x)) \ borel_measurable P" using borel by auto - have "(\\<^isup>+x. Real (abs (?f x)) \P) = (\\<^isup>+x. (\i\I. Real (abs (f i (x i)))) \P)" - by (simp add: Real_setprod abs_setprod) - also have "\ = (\i\I. (\\<^isup>+x. Real (abs (f i x)) \M i))" + have "(\\<^isup>+x. extreal (abs (?f x)) \P) = (\\<^isup>+x. (\i\I. extreal (abs (f i (x i)))) \P)" + by (simp add: setprod_extreal abs_setprod) + also have "\ = (\i\I. (\\<^isup>+x. extreal (abs (f i x)) \M i))" using f by (subst product_positive_integral_setprod) auto - also have "\ < \" + also have "\ < \" using integrable[THEN M.integrable_abs] - unfolding pextreal_less_\ setprod_\ integrable_def by simp - finally show "(\\<^isup>+x. Real (abs (?f x)) \P) \ \" by auto - show "(\\<^isup>+x. Real (- abs (?f x)) \P) \ \" by simp + by (simp add: setprod_PInf integrable_def M.positive_integral_positive) + finally show "(\\<^isup>+x. extreal (abs (?f x)) \P) \ \" by auto + have "(\\<^isup>+x. extreal (- abs (?f x)) \P) = (\\<^isup>+x. 0 \P)" + by (intro positive_integral_cong_pos) auto + then show "(\\<^isup>+x. extreal (- abs (?f x)) \P) \ \" by simp qed ultimately show ?thesis by (rule integrable_abs_iff[THEN iffD1])