# HG changeset patch # User wenzelm # Date 1353088186 -3600 # Node ID 3d89c38408cd72170e74d3c794d2817e4e6acd00 # Parent a3bede207a0488a088a080c3485ce795aa94ef5a# Parent 5e01e32dadbea9273ff6959db3383db56f8ce537 merged diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Borel_Space.thy --- a/src/HOL/Probability/Borel_Space.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Borel_Space.thy Fri Nov 16 18:49:46 2012 +0100 @@ -84,8 +84,13 @@ unfolding indicator_def [abs_def] using A by (auto intro!: measurable_If_set) -lemma borel_measurable_indicator'[measurable]: - "{x\space M. x \ A} \ sets M \ indicator A \ borel_measurable M" +lemma borel_measurable_count_space[measurable (raw)]: + "f \ borel_measurable (count_space S)" + unfolding measurable_def by auto + +lemma borel_measurable_indicator'[measurable (raw)]: + assumes [measurable]: "{x\space M. f x \ A x} \ sets M" + shows "(\x. indicator (A x) (f x)) \ borel_measurable M" unfolding indicator_def[abs_def] by (auto intro!: measurable_If) diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Fin_Map.thy --- a/src/HOL/Probability/Fin_Map.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Fin_Map.thy Fri Nov 16 18:49:46 2012 +0100 @@ -1278,7 +1278,7 @@ subsection {* Isomorphism between Functions and Finite Maps *} lemma - measurable_compose: + measurable_finmap_compose: fixes f::"'a \ 'b" assumes inj: "\j. j \ J \ f' (f j) = j" assumes "finite J" @@ -1326,7 +1326,7 @@ shows "(\m. compose (f ` J) m f') \ measurable (PiM J (\_. M)) (PiM (f ` J) (\_. M))" proof - have "(\m. compose (f ` J) m f') \ measurable (Pi\<^isub>M (f' ` f ` J) (\_. M)) (Pi\<^isub>M (f ` J) (\_. M))" - using assms by (auto intro: measurable_compose) + using assms by (auto intro: measurable_finmap_compose) moreover from inj have "f' ` f ` J = J" by (metis (hide_lams, mono_tags) image_iff set_eqI) ultimately show ?thesis by simp @@ -1426,7 +1426,7 @@ proof (rule measurable_comp, rule measurable_proj_PiM) show "(\g. compose J g f) \ measurable (Pi\<^isub>M (f ` J) (\x. M)) (Pi\<^isub>M J (\_. M))" - by (rule measurable_compose, rule inv) auto + by (rule measurable_finmap_compose, rule inv) auto qed (auto simp add: space_PiM extensional_def assms) lemma fm_image_measurable: diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Finite_Product_Measure.thy --- a/src/HOL/Probability/Finite_Product_Measure.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Finite_Product_Measure.thy Fri Nov 16 18:49:46 2012 +0100 @@ -540,6 +540,18 @@ finally show "f -` A \ space N \ sets N" . qed (auto simp: space) +lemma measurable_PiM_single': + assumes f: "\i. i \ I \ f i \ measurable N (M i)" + and "(\\ i. f i \) \ space N \ (\\<^isub>E i\I. space (M i))" + shows "(\\ i. f i \) \ measurable N (Pi\<^isub>M I M)" +proof (rule measurable_PiM_single) + fix A i assume A: "i \ I" "A \ sets (M i)" + then have "{\ \ space N. f i \ \ A} = f i -` A \ space N" + by auto + then show "{\ \ space N. f i \ \ A} \ sets N" + using A f by (auto intro!: measurable_sets) +qed fact + lemma sets_PiM_I_finite[measurable]: assumes "finite I" and sets: "(\i. i \ I \ E i \ sets (M i))" shows "(PIE j:I. E j) \ sets (PIM i:I. M i)" @@ -562,12 +574,22 @@ shows "(\x. (f x) i) \ measurable N (M i)" using measurable_compose[OF f measurable_component_singleton, OF i] . +lemma measurable_PiM_component_rev[measurable (raw)]: + "i \ I \ f \ measurable (M i) N \ (\x. f (x i)) \ measurable (PiM I M) N" + by simp + lemma measurable_nat_case[measurable (raw)]: assumes [measurable (raw)]: "i = 0 \ f \ measurable M N" "\j. i = Suc j \ (\x. g x j) \ measurable M N" shows "(\x. nat_case (f x) (g x) i) \ measurable M N" by (cases i) simp_all +lemma measurable_nat_case'[measurable (raw)]: + assumes fg[measurable]: "f \ measurable N M" "g \ measurable N (\\<^isub>M i\UNIV. M)" + shows "(\x. nat_case (f x) (g x)) \ measurable N (\\<^isub>M i\UNIV. M)" + using fg[THEN measurable_space] + by (auto intro!: measurable_PiM_single' simp add: space_PiM Pi_iff split: nat.split) + lemma measurable_add_dim[measurable]: "(\(f, y). f(i := y)) \ measurable (Pi\<^isub>M I M \\<^isub>M M i) (Pi\<^isub>M (insert i I) M)" (is "?f \ measurable ?P ?I") diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Infinite_Product_Measure.thy --- a/src/HOL/Probability/Infinite_Product_Measure.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Infinite_Product_Measure.thy Fri Nov 16 18:49:46 2012 +0100 @@ -449,23 +449,6 @@ subsection {* Sequence space *} -lemma measurable_nat_case: "(\(x, \). nat_case x \) \ measurable (M \\<^isub>M (\\<^isub>M i\UNIV. M)) (\\<^isub>M i\UNIV. M)" -proof (rule measurable_PiM_single) - show "(\(x, \). nat_case x \) \ space (M \\<^isub>M (\\<^isub>M i\UNIV. M)) \ (UNIV \\<^isub>E space M)" - by (auto simp: space_pair_measure space_PiM Pi_iff split: nat.split) - fix i :: nat and A assume A: "A \ sets M" - then have *: "{\ \ space (M \\<^isub>M (\\<^isub>M i\UNIV. M)). prod_case nat_case \ i \ A} = - (case i of 0 \ A \ space (\\<^isub>M i\UNIV. M) | Suc n \ space M \ {\\space (\\<^isub>M i\UNIV. M). \ n \ A})" - by (auto simp: space_PiM space_pair_measure split: nat.split dest: sets_into_space) - show "{\ \ space (M \\<^isub>M (\\<^isub>M i\UNIV. M)). prod_case nat_case \ i \ A} \ sets (M \\<^isub>M (\\<^isub>M i\UNIV. M))" - unfolding * by (auto simp: A split: nat.split intro!: sets_Collect_single) -qed - -lemma measurable_nat_case': - assumes f: "f \ measurable N M" and g: "g \ measurable N (\\<^isub>M i\UNIV. M)" - shows "(\x. nat_case (f x) (g x)) \ measurable N (\\<^isub>M i\UNIV. M)" - using measurable_compose[OF measurable_Pair[OF f g] measurable_nat_case] by simp - definition comb_seq :: "nat \ (nat \ 'a) \ (nat \ 'a) \ (nat \ 'a)" where "comb_seq i \ \' j = (if j < i then \ j else \' (j - i))" @@ -475,7 +458,8 @@ lemma split_comb_seq_asm: "P (comb_seq i \ \' j) \ \ ((j < i \ \ P (\ j)) \ (\k. j = i + k \ \ P (\' k)))" by (auto simp: comb_seq_def) -lemma measurable_comb_seq: "(\(\, \'). comb_seq i \ \') \ measurable ((\\<^isub>M i\UNIV. M) \\<^isub>M (\\<^isub>M i\UNIV. M)) (\\<^isub>M i\UNIV. M)" +lemma measurable_comb_seq: + "(\(\, \'). comb_seq i \ \') \ measurable ((\\<^isub>M i\UNIV. M) \\<^isub>M (\\<^isub>M i\UNIV. M)) (\\<^isub>M i\UNIV. M)" proof (rule measurable_PiM_single) show "(\(\, \'). comb_seq i \ \') \ space ((\\<^isub>M i\UNIV. M) \\<^isub>M (\\<^isub>M i\UNIV. M)) \ (UNIV \\<^isub>E space M)" by (auto simp: space_pair_measure space_PiM Pi_iff split: split_comb_seq) @@ -488,11 +472,33 @@ unfolding * by (auto simp: A intro!: sets_Collect_single) qed -lemma measurable_comb_seq': +lemma measurable_comb_seq'[measurable (raw)]: assumes f: "f \ measurable N (\\<^isub>M i\UNIV. M)" and g: "g \ measurable N (\\<^isub>M i\UNIV. M)" shows "(\x. comb_seq i (f x) (g x)) \ measurable N (\\<^isub>M i\UNIV. M)" using measurable_compose[OF measurable_Pair[OF f g] measurable_comb_seq] by simp +lemma comb_seq_0: "comb_seq 0 \ \' = \'" + by (auto simp add: comb_seq_def) + +lemma comb_seq_Suc: "comb_seq (Suc n) \ \' = comb_seq n \ (nat_case (\ n) \')" + by (auto simp add: comb_seq_def not_less less_Suc_eq le_imp_diff_is_add intro!: ext split: nat.split) + +lemma comb_seq_Suc_0[simp]: "comb_seq (Suc 0) \ = nat_case (\ 0)" + by (intro ext) (simp add: comb_seq_Suc comb_seq_0) + +lemma comb_seq_less: "i < n \ comb_seq n \ \' i = \ i" + by (auto split: split_comb_seq) + +lemma comb_seq_add: "comb_seq n \ \' (i + n) = \' i" + by (auto split: nat.split split_comb_seq) + +lemma nat_case_comb_seq: "nat_case s' (comb_seq n \ \') (i + n) = nat_case (nat_case s' \ n) \' i" + by (auto split: nat.split split_comb_seq) + +lemma nat_case_comb_seq': + "nat_case s (comb_seq i \ \') = comb_seq (Suc i) (nat_case s \) \'" + by (auto split: split_comb_seq nat.split) + locale sequence_space = product_prob_space "\i. M" "UNIV :: nat set" for M begin @@ -578,7 +584,7 @@ by (auto simp: space_pair_measure space_PiM Pi_iff prod_emb_def all_conj_distrib split: nat.split nat.split_asm) then have "emeasure ?D ?X = emeasure (M \\<^isub>M S) (?E \ ?F)" - by (subst emeasure_distr[OF measurable_nat_case]) + by (subst emeasure_distr) (auto intro!: sets_PiM_I simp: split_beta' J) also have "\ = emeasure M ?E * emeasure S ?F" using J by (intro P.emeasure_pair_measure_Times) (auto intro!: sets_PiM_I finite_vimageI) diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Fri Nov 16 18:49:46 2012 +0100 @@ -1181,6 +1181,17 @@ by (subst positive_integral_eq_simple_integral) (auto simp: simple_function_indicator simple_integral_indicator) +lemma positive_integral_indicator': + assumes [measurable]: "A \ space M \ sets M" + shows "(\\<^isup>+ x. indicator A x \M) = emeasure M (A \ space M)" +proof - + have "(\\<^isup>+ x. indicator A x \M) = (\\<^isup>+ x. indicator (A \ space M) x \M)" + by (intro positive_integral_cong) (simp split: split_indicator) + also have "\ = emeasure M (A \ space M)" + by simp + finally show ?thesis . +qed + lemma positive_integral_add: assumes f: "f \ borel_measurable M" "AE x in M. 0 \ f x" and g: "g \ borel_measurable M" "AE x in M. 0 \ g x" @@ -1430,6 +1441,32 @@ done qed +lemma positive_integral_nat_function: + fixes f :: "'a \ nat" + assumes "f \ measurable M (count_space UNIV)" + shows "(\\<^isup>+x. ereal (of_nat (f x)) \M) = (\t. emeasure M {x\space M. t < f x})" +proof - + def F \ "\i. {x\space M. i < f x}" + with assms have [measurable]: "\i. F i \ sets M" + by auto + + { fix x assume "x \ space M" + have "(\i. if i < f x then 1 else 0) sums (of_nat (f x)::real)" + using sums_If_finite[of "\i. i < f x" "\_. 1::real"] by simp + then have "(\i. ereal(if i < f x then 1 else 0)) sums (ereal(of_nat(f x)))" + unfolding sums_ereal . + moreover have "\i. ereal (if i < f x then 1 else 0) = indicator (F i) x" + using `x \ space M` by (simp add: one_ereal_def F_def) + ultimately have "ereal(of_nat(f x)) = (\i. indicator (F i) x)" + by (simp add: sums_iff) } + then have "(\\<^isup>+x. ereal (of_nat (f x)) \M) = (\\<^isup>+x. (\i. indicator (F i) x) \M)" + by (simp cong: positive_integral_cong) + also have "\ = (\i. emeasure M (F i))" + by (simp add: positive_integral_suminf) + finally show ?thesis + by (simp add: F_def) +qed + section "Lebesgue Integral" definition integrable :: "'a measure \ ('a \ real) \ bool" where @@ -1639,25 +1676,9 @@ unfolding integrable_def lebesgue_integral_def by auto -lemma integral_cmult[simp, intro]: - assumes "integrable M f" - shows "integrable M (\t. a * f t)" (is ?P) - and "(\ t. a * f t \M) = a * integral\<^isup>L M f" (is ?I) -proof - - have "integrable M (\t. a * f t) \ (\ t. a * f t \M) = a * integral\<^isup>L M f" - proof (cases rule: le_cases) - assume "0 \ a" show ?thesis - using integral_linear[OF assms integral_zero(1) `0 \ a`] - by simp - next - assume "a \ 0" hence "0 \ - a" by auto - have *: "\t. - a * t + 0 = (-a) * t" by simp - show ?thesis using integral_linear[OF assms integral_zero(1) `0 \ - a`] - integral_minus(1)[of M "\t. - a * f t"] - unfolding * integral_zero by simp - qed - thus ?P ?I by auto -qed +lemma lebesgue_integral_uminus: + "(\x. - f x \M) = - integral\<^isup>L M f" + unfolding lebesgue_integral_def by simp lemma lebesgue_integral_cmult_nonneg: assumes f: "f \ borel_measurable M" and "0 \ c" @@ -1682,10 +1703,6 @@ by (simp add: lebesgue_integral_def field_simps) qed -lemma lebesgue_integral_uminus: - "(\x. - f x \M) = - integral\<^isup>L M f" - unfolding lebesgue_integral_def by simp - lemma lebesgue_integral_cmult: assumes f: "f \ borel_measurable M" shows "(\x. c * f x \M) = c * integral\<^isup>L M f" @@ -1698,10 +1715,33 @@ by (simp add: lebesgue_integral_def) qed +lemma lebesgue_integral_multc: + "f \ borel_measurable M \ (\x. f x * c \M) = integral\<^isup>L M f * c" + using lebesgue_integral_cmult[of f M c] by (simp add: ac_simps) + lemma integral_multc: + "integrable M f \ (\ x. f x * c \M) = integral\<^isup>L M f * c" + by (simp add: lebesgue_integral_multc) + +lemma integral_cmult[simp, intro]: assumes "integrable M f" - shows "(\ x. f x * c \M) = integral\<^isup>L M f * c" - unfolding mult_commute[of _ c] integral_cmult[OF assms] .. + shows "integrable M (\t. a * f t)" (is ?P) + and "(\ t. a * f t \M) = a * integral\<^isup>L M f" (is ?I) +proof - + have "integrable M (\t. a * f t) \ (\ t. a * f t \M) = a * integral\<^isup>L M f" + proof (cases rule: le_cases) + assume "0 \ a" show ?thesis + using integral_linear[OF assms integral_zero(1) `0 \ a`] + by simp + next + assume "a \ 0" hence "0 \ - a" by auto + have *: "\t. - a * t + 0 = (-a) * t" by simp + show ?thesis using integral_linear[OF assms integral_zero(1) `0 \ - a`] + integral_minus(1)[of M "\t. - a * f t"] + unfolding * integral_zero by simp + qed + thus ?P ?I by auto +qed lemma integral_diff[simp, intro]: assumes f: "integrable M f" and g: "integrable M g" @@ -1713,7 +1753,7 @@ lemma integral_indicator[simp, intro]: assumes "A \ sets M" and "(emeasure M) A \ \" - shows "integral\<^isup>L M (indicator A) = real ((emeasure M) A)" (is ?int) + shows "integral\<^isup>L M (indicator A) = real (emeasure M A)" (is ?int) and "integrable M (indicator A)" (is ?able) proof - from `A \ sets M` have *: @@ -1850,6 +1890,16 @@ finally show ?thesis . qed +lemma integrable_nonneg: + assumes f: "f \ borel_measurable M" "AE x in M. 0 \ f x" "(\\<^isup>+ x. f x \M) \ \" + shows "integrable M f" + unfolding integrable_def +proof (intro conjI f) + have "(\\<^isup>+ x. ereal (- f x) \M) = 0" + using f by (subst positive_integral_0_iff_AE) auto + then show "(\\<^isup>+ x. ereal (- f x) \M) \ \" by simp +qed + lemma integral_positive: assumes "integrable M f" "\x. x \ space M \ 0 \ f x" shows "0 \ integral\<^isup>L M f" @@ -1986,7 +2036,7 @@ lemma (in finite_measure) lebesgue_integral_const[simp]: shows "integrable M (\x. a)" - and "(\x. a \M) = a * (measure M) (space M)" + and "(\x. a \M) = a * measure M (space M)" proof - { fix a :: real assume "0 \ a" then have "(\\<^isup>+ x. ereal a \M) = ereal a * (emeasure M) (space M)" @@ -2008,6 +2058,10 @@ by (simp add: lebesgue_integral_def positive_integral_const_If emeasure_eq_measure) qed +lemma (in finite_measure) integrable_const_bound: + assumes "AE x in M. \f x\ \ B" and "f \ borel_measurable M" shows "integrable M f" + by (auto intro: integrable_bound[where f="\x. B"] lebesgue_integral_const assms) + lemma indicator_less[simp]: "indicator A x \ (indicator B x::ereal) \ (x \ A \ x \ B)" by (simp add: indicator_def not_le) diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Probability_Measure.thy Fri Nov 16 18:49:46 2012 +0100 @@ -219,6 +219,17 @@ with AE_in_set_eq_1 assms show ?thesis by simp qed +lemma (in prob_space) AE_const[simp]: "(AE x in M. P) \ P" + by (cases P) (auto simp: AE_False) + +lemma (in prob_space) AE_contr: + assumes ae: "AE \ in M. P \" "AE \ in M. \ P \" + shows False +proof - + from ae have "AE \ in M. False" by eventually_elim auto + then show False by auto +qed + lemma (in finite_measure) prob_space_increasing: "increasing M (measure M)" by (auto intro!: finite_measure_mono simp: increasing_def) @@ -438,6 +449,23 @@ then show ?thesis by simp qed (simp add: measure_notin_sets) +lemma (in prob_space) prob_Collect_eq_0: + "{x \ space M. P x} \ sets M \ \

(x in M. P x) = 0 \ (AE x in M. \ P x)" + using AE_iff_measurable[OF _ refl, of M "\x. \ P x"] by (simp add: emeasure_eq_measure) + +lemma (in prob_space) prob_Collect_eq_1: + "{x \ space M. P x} \ sets M \ \

(x in M. P x) = 1 \ (AE x in M. P x)" + using AE_in_set_eq_1[of "{x\space M. P x}"] by simp + +lemma (in prob_space) prob_eq_0: + "A \ sets M \ prob A = 0 \ (AE x in M. x \ A)" + using AE_iff_measurable[OF _ refl, of M "\x. x \ A"] + by (auto simp add: emeasure_eq_measure Int_def[symmetric]) + +lemma (in prob_space) prob_eq_1: + "A \ sets M \ prob A = 1 \ (AE x in M. x \ A)" + using AE_in_set_eq_1[of A] by simp + lemma (in prob_space) prob_sums: assumes P: "\n. {x\space M. P n x} \ events" assumes Q: "{x\space M. Q x} \ events" diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Projective_Family.thy --- a/src/HOL/Probability/Projective_Family.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Projective_Family.thy Fri Nov 16 18:49:46 2012 +0100 @@ -81,7 +81,7 @@ fixes I::"'i set" and P::"'i set \ ('i \ 'a) measure" and M::"('i \ 'a measure)" assumes projective: "\J H X. J \ {} \ J \ H \ H \ I \ finite H \ X \ sets (PiM J M) \ (P H) (prod_emb H M J X) = (P J) X" - assumes prob_space: "\J. finite J \ prob_space (P J)" + assumes proj_prob_space: "\J. finite J \ prob_space (P J)" assumes proj_space: "\J. finite J \ space (P J) = space (PiM J M)" assumes proj_sets: "\J. finite J \ sets (P J) = sets (PiM J M)" begin @@ -133,7 +133,7 @@ let ?\ = "(\\<^isub>E k\J. space (M k))" show "Int_stable ?J" by (rule Int_stable_PiE) - interpret prob_space "P J" using prob_space `finite J` by simp + interpret prob_space "P J" using proj_prob_space `finite J` by simp show "emeasure ?P (?F _) \ \" using assms `finite J` by (auto simp: emeasure_limP) show "?J \ Pow ?\" by (auto simp: Pi_iff dest: sets_into_space) show "sets (limP J M P) = sigma_sets ?\ ?J" "sets (P J) = sigma_sets ?\ ?J" @@ -165,7 +165,7 @@ have "\i\L. \x. x \ space (M i)" proof fix i assume "i \ L" - interpret prob_space "P {i}" using prob_space by simp + interpret prob_space "P {i}" using proj_prob_space by simp from not_empty show "\x. x \ space (M i)" by (auto simp add: proj_space space_PiM) qed from bchoice[OF this] diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Projective_Limit.thy --- a/src/HOL/Probability/Projective_Limit.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Projective_Limit.thy Fri Nov 16 18:49:46 2012 +0100 @@ -207,7 +207,7 @@ OF `I \ {}`, OF `I \ {}`]) fix A assume "A \ ?G" with generatorE guess J X . note JX = this - interpret prob_space "P J" using prob_space[OF `finite J`] . + interpret prob_space "P J" using proj_prob_space[OF `finite J`] . show "\G A \ \" using JX by (simp add: limP_finite) next fix Z assume Z: "range Z \ ?G" "decseq Z" "(\i. Z i) = {}" @@ -241,7 +241,7 @@ note [simp] = `\n. finite (J n)` from J Z_emb have Z_eq: "\n. Z n = emb I (J n) (B n)" "\n. Z n \ ?G" unfolding J_def B_def by (subst prod_emb_trans) (insert Z, auto) - interpret prob_space "P (J i)" for i using prob_space by simp + interpret prob_space "P (J i)" for i using proj_prob_space by simp have "?a \ \G (Z 0)" by (auto intro: INF_lower) also have "\ < \" using J by (auto simp: Z_eq \G_eq limP_finite proj_sets) finally have "?a \ \" by simp @@ -636,13 +636,13 @@ show "emeasure (lim\<^isub>B I P) (space (lim\<^isub>B I P)) = 1" proof cases assume "I = {}" - interpret prob_space "P {}" using prob_space by simp + interpret prob_space "P {}" using proj_prob_space by simp show ?thesis by (simp add: space_PiM_empty limP_finite emeasure_space_1 `I = {}`) next assume "I \ {}" then obtain i where "i \ I" by auto - interpret prob_space "P {i}" using prob_space by simp + interpret prob_space "P {i}" using proj_prob_space by simp have R: "(space (lim\<^isub>B I P)) = (emb I {i} (Pi\<^isub>E {i} (\_. space borel)))" by (auto simp: prod_emb_def space_PiM) moreover have "extensional {i} = space (P {i})" by (simp add: proj_space space_PiM) @@ -660,7 +660,7 @@ assumes X: "J \ I" "finite J" "\i\J. B i \ sets borel" shows "emeasure (lim\<^isub>B I P) (emb I J (Pi\<^isub>E J B)) = emeasure (P J) (Pi\<^isub>E J B)" proof cases - interpret prob_space "P {}" using prob_space by simp + interpret prob_space "P {}" using proj_prob_space by simp assume "J = {}" moreover have "emb I {} {\x. undefined} = space (lim\<^isub>B I P)" by (auto simp: space_PiM prod_emb_def) @@ -677,7 +677,7 @@ assumes "J \ I" "finite J" "\i\J. B i \ sets borel" shows "measure (lim\<^isub>B I P) (emb I J (Pi\<^isub>E J B)) = measure (P J) (Pi\<^isub>E J B)" proof - - interpret prob_space "P J" using prob_space assms by simp + interpret prob_space "P J" using proj_prob_space assms by simp show ?thesis using emeasure_limB_emb[OF assms] unfolding emeasure_eq_measure limP_finite[OF `finite J` `J \ I`] P.emeasure_eq_measure diff -r 5e01e32dadbe -r 3d89c38408cd src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Fri Nov 16 16:59:56 2012 +0100 +++ b/src/HOL/Probability/Sigma_Algebra.thy Fri Nov 16 18:49:46 2012 +0100 @@ -1616,7 +1616,7 @@ fun cert f = map (Option.map (f (Proof_Context.theory_of ctxt))) fun inst t (ts, Ts) = Drule.instantiate' (cert ctyp_of Ts) (cert cterm_of ts) t val cps = cnt_prefixes ctxt f |> map (inst @{thm measurable_compose_countable}) - in if null cps then no_tac else debug_tac ctxt (K ("split countable fun")) (resolve_tac cps i) end + in if null cps then no_tac else debug_tac ctxt (K "split countable fun") (resolve_tac cps i) end handle TERM _ => no_tac) 1) fun measurable_tac' ctxt ss facts = let @@ -1764,7 +1764,7 @@ "pred M (\x. Q x) \ pred M (\x. P x) \ pred M (\x. Q x = P x)" "pred M (\x. f x \ UNIV)" "pred M (\x. f x \ {})" - "pred M (\x. P' (f x)) \ pred M (\x. f x \ {x. P' x})" + "pred M (\x. P' (f x) x) \ pred M (\x. f x \ {y. P' y x})" "pred M (\x. f x \ (B x)) \ pred M (\x. f x \ - (B x))" "pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) - (B x))" "pred M (\x. f x \ (A x)) \ pred M (\x. f x \ (B x)) \ pred M (\x. f x \ (A x) \ (B x))" @@ -1815,10 +1815,23 @@ qed lemma [measurable (raw generic)]: - assumes f: "f \ measurable M N" and c: "{c} \ sets N" + assumes f: "f \ measurable M N" and c: "c \ space N \ {c} \ sets N" shows pred_eq_const1: "pred M (\x. f x = c)" and pred_eq_const2: "pred M (\x. c = f x)" - using measurable_sets[OF f c] by (auto simp: Int_def conj_commute eq_commute pred_def) +proof - + show "pred M (\x. f x = c)" + proof cases + assume "c \ space N" + with measurable_sets[OF f c] show ?thesis + by (auto simp: Int_def conj_commute pred_def) + next + assume "c \ space N" + with f[THEN measurable_space] have "{x \ space M. f x = c} = {}" by auto + then show ?thesis by (auto simp: pred_def cong: conj_cong) + qed + then show "pred M (\x. c = f x)" + by (simp add: eq_commute) +qed lemma pred_le_const[measurable (raw generic)]: assumes f: "f \ measurable M N" and c: "{.. c} \ sets N" shows "pred M (\x. f x \ c)" @@ -1872,6 +1885,21 @@ "\i\I. A i \ sets (N i) \ i\I \ f \ measurable M (N i) \ pred M (\x. f x \ A i)" using pred_sets2[OF sets_Ball, of _ _ _ f] by auto +lemma measurable_finite[measurable (raw)]: + fixes S :: "'a \ nat set" + assumes [measurable]: "\i. {x\space M. i \ S x} \ sets M" + shows "pred M (\x. finite (S x))" + 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 + shows "(\x. LEAST i. P i x) \ measurable M (count_space UNIV)" + unfolding measurable_def by (safe intro!: sets_Least) simp_all + +lemma measurable_count_space_insert[measurable (raw)]: + "s \ S \ A \ sets (count_space S) \ insert s A \ sets (count_space S)" + by simp + hide_const (open) pred subsection {* Extend measure *}