# HG changeset patch # User hoelzl # Date 1454997888 -3600 # Node ID 4fe872ff91bfa0d4b5026adb751703c8c3e128e5 # Parent 7c288c0c7300c14307e571dbe7638a3eecb98da2 Borel_Space.borel is now in the type class locale diff -r 7c288c0c7300 -r 4fe872ff91bf src/HOL/Library/Countable_Set_Type.thy --- a/src/HOL/Library/Countable_Set_Type.thy Tue Feb 09 07:04:32 2016 +0100 +++ b/src/HOL/Library/Countable_Set_Type.thy Tue Feb 09 07:04:48 2016 +0100 @@ -472,7 +472,8 @@ lemma cUnion_parametric [transfer_rule]: "(rel_cset (rel_cset A) ===> rel_cset A) cUnion cUnion" - unfolding rel_fun_def by transfer(simp, fast dest: rel_setD1 rel_setD2 intro!: rel_setI) + unfolding rel_fun_def + by transfer (auto simp: rel_set_def, metis+) lemma cimage_parametric [transfer_rule]: "((A ===> B) ===> rel_cset A ===> rel_cset B) cimage cimage" diff -r 7c288c0c7300 -r 4fe872ff91bf src/HOL/Probability/Borel_Space.thy --- a/src/HOL/Probability/Borel_Space.thy Tue Feb 09 07:04:32 2016 +0100 +++ b/src/HOL/Probability/Borel_Space.thy Tue Feb 09 07:04:48 2016 +0100 @@ -19,7 +19,7 @@ have "{A \ B :: ('a \ 'b) set | A B. open A \ open B} = ((\(a, b). a \ b) ` ({A. open A} \ {A. open A}))" by auto then show ?thesis - by (auto intro: topological_basis_prod topological_basis_trivial topological_basis_imp_subbasis) + by (auto intro: topological_basis_prod topological_basis_trivial topological_basis_imp_subbasis) qed definition "mono_on f A \ \r s. r \ A \ s \ A \ r \ s \ f r \ f s" @@ -76,7 +76,7 @@ fix x y assume "x \ A" "y \ A" "f x = f y" thus "x = y" by (cases x y rule: linorder_cases) - (auto dest: strict_mono_onD[OF assms, of x y] strict_mono_onD[OF assms, of y x]) + (auto dest: strict_mono_onD[OF assms, of x y] strict_mono_onD[OF assms, of y x]) qed lemma strict_mono_on_leD: @@ -121,7 +121,7 @@ qed qed simp -lemma strict_mono_on_imp_mono_on: +lemma strict_mono_on_imp_mono_on: "strict_mono_on (f :: (_ :: linorder) \ _ :: preorder) A \ mono_on f A" by (rule mono_onI, rule strict_mono_on_leD) @@ -153,7 +153,7 @@ apply (auto simp add: dist_real_def not_less) apply (subgoal_tac "f x \ f xa") by (auto intro: mono) - qed + qed thus ?thesis by auto next fix u assume "u > f a" @@ -167,11 +167,11 @@ apply (auto simp add: dist_real_def) apply (subgoal_tac "f x \ f xa") by (auto intro: mono) - qed + qed thus ?thesis by auto qed qed - hence "\g :: real \ nat \ rat . \a \ {a\A. \ continuous (at a within A) f}. + hence "\g :: real \ nat \ rat . \a \ {a\A. \ continuous (at a within A) f}. (fst (g a) = 0 \ of_rat (snd (g a)) < f a \ (\x \ A. x < a \ f x < of_rat (snd (g a)))) | (fst (g a) = 1 \ of_rat (snd (g a)) > f a \ (\x \ A. x > a \ f x > of_rat (snd (g a))))" by (rule bchoice) @@ -186,11 +186,11 @@ assume 1: "w \ A" and 2: "\ continuous (at w within A) f" and 3: "z \ A" and 4: "\ continuous (at z within A) f" and 5: "g w = g z" - from g [OF 1 2 3] g [OF 3 4 1] 5 + from g [OF 1 2 3] g [OF 3 4 1] 5 show "w = z" by auto qed - thus ?thesis - by (rule countableI') + thus ?thesis + by (rule countableI') qed lemma mono_on_ctble_discont_open: @@ -226,7 +226,7 @@ assumes "S \ {}" "bdd_above S" shows "Sup S \ closure S" proof- - have "Inf (uminus ` S) \ closure (uminus ` S)" + have "Inf (uminus ` S) \ closure (uminus ` S)" using assms by (intro closure_contains_Inf) auto also have "Inf (uminus ` S) = -Sup S" by (simp add: Inf_real_def) also have "closure (uminus ` S) = uminus ` closure S" @@ -247,7 +247,7 @@ proof (cases "a < b") assume "a < b" from deriv have "\x. x \ a \ x \ b \ (g has_real_derivative g' x) (at x)" by simp - from MVT2[OF \a < b\ this] and deriv + from MVT2[OF \a < b\ this] and deriv obtain \ where \_ab: "\ > a" "\ < b" and g_ab: "g b - g a = (b - a) * g' \" by blast from \_ab ab nonneg have "(b - a) * g' \ \ 0" by simp with g_ab show ?thesis by simp @@ -259,22 +259,22 @@ obtains c' d' where "{a..b} \ g -` {c..d} = {c'..d'}" "c' \ d'" "g c' = c" "g d' = d" proof- let ?A = "{a..b} \ g -` {c..d}" - from IVT'[of g a c b, OF _ _ \a \ b\ assms(1)] assms(4,5) + from IVT'[of g a c b, OF _ _ \a \ b\ assms(1)] assms(4,5) obtain c'' where c'': "c'' \ ?A" "g c'' = c" by auto - from IVT'[of g a d b, OF _ _ \a \ b\ assms(1)] assms(4,5) + from IVT'[of g a d b, OF _ _ \a \ b\ assms(1)] assms(4,5) obtain d'' where d'': "d'' \ ?A" "g d'' = d" by auto hence [simp]: "?A \ {}" by blast def c' \ "Inf ?A" and d' \ "Sup ?A" have "?A \ {c'..d'}" unfolding c'_def d'_def by (intro subsetI) (auto intro: cInf_lower cSup_upper) - moreover from assms have "closed ?A" + moreover from assms have "closed ?A" using continuous_on_closed_vimage[of "{a..b}" g] by (subst Int_commute) simp hence c'd'_in_set: "c' \ ?A" "d' \ ?A" unfolding c'_def d'_def by ((intro closed_contains_Inf closed_contains_Sup, simp_all)[])+ - hence "{c'..d'} \ ?A" using assms + hence "{c'..d'} \ ?A" using assms by (intro subsetI) - (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x] + (auto intro!: order_trans[of c "g c'" "g x" for x] order_trans[of "g x" "g d'" d for x] intro!: mono) moreover have "c' \ d'" using c'd'_in_set(2) unfolding c'_def by (intro cInf_lower) auto moreover have "g c' \ c" "g d' \ d" @@ -290,7 +290,7 @@ subsection \Generic Borel spaces\ -definition borel :: "'a::topological_space measure" where +definition (in topological_space) borel :: "'a measure" where "borel = sigma UNIV {S. open S}" abbreviation "borel_measurable M \ measurable M borel" @@ -798,7 +798,7 @@ unfolding eq_iff not_less[symmetric] by measurable -lemma +lemma fixes i :: "'a::{second_countable_topology, real_inner}" shows hafspace_less_borel: "{x. a < x \ i} \ sets borel" and hafspace_greater_borel: "{x. x \ i < a} \ sets borel" @@ -881,7 +881,7 @@ lemma halfspace_gt_in_halfspace: assumes i: "i \ A" - shows "{x::'a. a < x \ i} \ + shows "{x::'a. a < x \ i} \ sigma_sets UNIV ((\ (a, i). {x::'a::euclidean_space. x \ i < a}) ` (UNIV \ A))" (is "?set \ ?SIGMA") proof - @@ -1063,7 +1063,7 @@ have "{..i} = (\j::nat. {-j <.. i})" by (auto simp: minus_less_iff reals_Archimedean2) also have "\ \ sets (sigma UNIV (range (\(i, j). {i<..j})))" - by (intro sets.countable_nat_UN) auto + by (intro sets.countable_nat_UN) auto finally show "{..i} \ sets (sigma UNIV (range (\(i, j). {i<..j})))" . qed simp @@ -1100,7 +1100,7 @@ lemma borel_measurable_halfspacesI: fixes f :: "'a \ 'c::euclidean_space" assumes F: "borel = sigma UNIV (F ` (UNIV \ Basis))" - and S_eq: "\a i. S a i = f -` F (a,i) \ space M" + and S_eq: "\a i. S a i = f -` F (a,i) \ space M" shows "f \ borel_measurable M = (\i\Basis. \a::real. S a i \ sets M)" proof safe fix a :: real and i :: 'b assume i: "i \ Basis" and f: "f \ borel_measurable M" @@ -1159,16 +1159,16 @@ qed auto lemma borel_set_induct[consumes 1, case_names empty interval compl union]: - assumes "A \ sets borel" + assumes "A \ sets borel" assumes empty: "P {}" and int: "\a b. a \ b \ P {a..b}" and compl: "\A. A \ sets borel \ P A \ P (-A)" and un: "\f. disjoint_family f \ (\i. f i \ sets borel) \ (\i. P (f i)) \ P (\i::nat. f i)" shows "P (A::real set)" proof- let ?G = "range (\(a,b). {a..b::real})" - have "Int_stable ?G" "?G \ Pow UNIV" "A \ sigma_sets UNIV ?G" + have "Int_stable ?G" "?G \ Pow UNIV" "A \ sigma_sets UNIV ?G" using assms(1) by (auto simp add: borel_eq_atLeastAtMost Int_stable_def) thus ?thesis - proof (induction rule: sigma_sets_induct_disjoint) + proof (induction rule: sigma_sets_induct_disjoint) case (union f) from union.hyps(2) have "\i. f i \ sets borel" by (auto simp: borel_eq_atLeastAtMost) with union show ?case by (auto intro: un) @@ -1240,7 +1240,7 @@ assumes g: "g \ borel_measurable M" shows "(\x. dist (f x) (g x)) \ borel_measurable M" using f g by (rule borel_measurable_continuous_Pair) (intro continuous_intros) - + lemma borel_measurable_scaleR[measurable (raw)]: fixes g :: "'a \ 'b::{second_countable_topology, real_normed_vector}" assumes f: "f \ borel_measurable M" @@ -1323,7 +1323,7 @@ lemma convex_measurable: fixes A :: "'a :: euclidean_space set" - shows "X \ borel_measurable M \ X ` space M \ A \ open A \ convex_on A q \ + shows "X \ borel_measurable M \ X ` space M \ A \ open A \ convex_on A q \ (\x. q (X x)) \ borel_measurable M" by (rule measurable_compose[where f=X and N="restrict_space borel A"]) (auto intro!: borel_measurable_continuous_on_restrict convex_on_continuous measurable_restrict_space2) @@ -1406,7 +1406,7 @@ using continuous_on_ereal f by (rule borel_measurable_continuous_on) (rule continuous_on_id) lemma borel_measurable_real_of_ereal[measurable (raw)]: - fixes f :: "'a \ ereal" + fixes f :: "'a \ ereal" assumes f: "f \ borel_measurable M" shows "(\x. real_of_ereal (f x)) \ borel_measurable M" apply (rule measurable_compose[OF f]) @@ -1415,7 +1415,7 @@ done lemma borel_measurable_ereal_cases: - fixes f :: "'a \ ereal" + fixes f :: "'a \ ereal" assumes f: "f \ borel_measurable M" assumes H: "(\x. H (ereal (real_of_ereal (f x)))) \ borel_measurable M" shows "(\x. H (f x)) \ borel_measurable M" @@ -1439,7 +1439,7 @@ qed auto lemma set_Collect_ereal2: - fixes f g :: "'a \ ereal" + fixes f g :: "'a \ ereal" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" assumes H: "{x \ space M. H (ereal (real_of_ereal (f x))) (ereal (real_of_ereal (g x)))} \ sets M" @@ -1510,7 +1510,7 @@ unfolding borel_measurable_ereal_iff_Iio vimage_sets_compl_iff[where A="{..< a}" for a] by simp lemma borel_measurable_ereal2: - fixes f g :: "'a \ ereal" + fixes f g :: "'a \ ereal" assumes f: "f \ borel_measurable M" assumes g: "g \ borel_measurable M" assumes H: "(\x. H (ereal (real_of_ereal (f x))) (ereal (real_of_ereal (g x)))) \ borel_measurable M" @@ -1573,7 +1573,7 @@ "(\i. {x\space M. P x i} \ sets M) \ {x\space M. eventually (P x) sequentially} \ sets M" unfolding eventually_sequentially by simp -lemma sets_Collect_ereal_convergent[measurable]: +lemma sets_Collect_ereal_convergent[measurable]: fixes f :: "nat \ 'a => ereal" assumes f[measurable]: "\i. f i \ borel_measurable M" shows "{x\space M. convergent (\i. f i x)} \ sets M" @@ -1629,7 +1629,7 @@ shows "g \ borel_measurable M" unfolding borel_eq_closed proof (safe intro!: measurable_measure_of) - fix A :: "'b set" assume "closed A" + fix A :: "'b set" assume "closed A" have [measurable]: "(\x. infdist (g x) A) \ borel_measurable M" proof (rule borel_measurable_LIMSEQ) @@ -1653,7 +1653,7 @@ qed simp qed auto -lemma sets_Collect_Cauchy[measurable]: +lemma sets_Collect_Cauchy[measurable]: fixes f :: "nat \ 'a => 'b::{metric_space, second_countable_topology}" assumes f[measurable]: "\i. f i \ borel_measurable M" shows "{x\space M. Cauchy (\i. f i x)} \ sets M" @@ -1674,7 +1674,7 @@ by (cases "Cauchy (\i. f i x)") (auto simp add: convergent_eq_cauchy[symmetric] convergent_def) then show "(\i. if Cauchy (\i. f i x) then f i x else 0) \ u' x" - unfolding u'_def + unfolding u'_def by (rule convergent_LIMSEQ_iff[THEN iffD1]) qed measurable then show ?thesis @@ -1731,7 +1731,7 @@ from this[THEN spec, of "Suc n"] obtain j where j: "\y z. dist x y < ?I j \ dist x z < ?I j \ dist (f y) (f z) \ ?I (Suc n)" by auto - + show "\d>0. \y. dist y x < d \ dist (f y) (f x) < e" proof (safe intro!: exI[of _ "?I j"]) fix y assume "dist y x < ?I j" @@ -1789,7 +1789,7 @@ apply (rule measurable_restrict_countable[OF mono_on_ctble_discont[OF assms]]) apply (auto intro!: image_eqI[where x="{x}" for x] simp: sets_restrict_space) apply (auto simp add: sets_restrict_restrict_space continuous_on_eq_continuous_within - cong: measurable_cong_sets + cong: measurable_cong_sets intro!: borel_measurable_continuous_on_restrict intro: continuous_within_subset) done