# HG changeset patch # User wenzelm # Date 1498160937 -7200 # Node ID cad55bc7e37ddcaec63d5a75ef6edbc4a055ac93 # Parent 48cfbccaf3f459ac3782e37959a01a9106834e4e# Parent 8cfa8c7ee1f6c80dda2fd9fdbe7c1285bd7c6ed8 merged diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Borel_Space.thy --- a/src/HOL/Analysis/Borel_Space.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Borel_Space.thy Thu Jun 22 21:48:57 2017 +0200 @@ -1379,6 +1379,13 @@ shows "(\x. f x *\<^sub>R g x) \ borel_measurable M" using f g by (rule borel_measurable_continuous_Pair) (intro continuous_intros) +lemma borel_measurable_uminus_eq [simp]: + fixes f :: "'a \ 'b::{second_countable_topology, real_normed_vector}" + shows "(\x. - f x) \ borel_measurable M \ f \ borel_measurable M" (is "?l = ?r") +proof + assume ?l from borel_measurable_uminus[OF this] show ?r by simp +qed auto + lemma affine_borel_measurable_vector: fixes f :: "'a \ 'x::real_normed_vector" assumes "f \ borel_measurable M" diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Cauchy_Integral_Theorem.thy --- a/src/HOL/Analysis/Cauchy_Integral_Theorem.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Cauchy_Integral_Theorem.thy Thu Jun 22 21:48:57 2017 +0200 @@ -1341,9 +1341,6 @@ using assms apply (blast intro: has_contour_integral_subpath) done -lemma has_integral_integrable_integral: "(f has_integral i) s \ f integrable_on s \ integral s f = i" - by blast - lemma has_integral_contour_integral_subpath: assumes "f contour_integrable_on g" "valid_path g" "u \ {0..1}" "v \ {0..1}" "u \ v" shows "(((\x. f(g x) * vector_derivative g (at x))) diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Thu Jun 22 21:48:57 2017 +0200 @@ -860,7 +860,7 @@ then have "(?f has_integral F b - F a) {a .. b}" by (subst has_integral_cong[where g=f]) auto then have "(?f has_integral F b - F a) UNIV" - by (intro has_integral_on_superset[where t=UNIV and s="{a..b}"]) auto + by (intro has_integral_on_superset[where T=UNIV and S="{a..b}"]) auto ultimately show "integral\<^sup>L lborel ?f = F b - F a" by (rule has_integral_unique) qed @@ -908,6 +908,7 @@ (infixr "absolutely'_integrable'_on" 46) where "f absolutely_integrable_on s \ set_integrable lebesgue s f" + lemma absolutely_integrable_on_def: fixes f :: "'a::euclidean_space \ 'b::euclidean_space" shows "f absolutely_integrable_on s \ f integrable_on s \ (\x. norm (f x)) integrable_on s" @@ -933,6 +934,17 @@ by (auto simp: integrable_on_def nn_integral_completion) qed qed + +lemma absolutely_integrable_on_null [intro]: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + shows "content (cbox a b) = 0 \ f absolutely_integrable_on (cbox a b)" + by (auto simp: absolutely_integrable_on_def) + +lemma absolutely_integrable_on_open_interval: + fixes f :: "'a :: euclidean_space \ 'b :: euclidean_space" + shows "f absolutely_integrable_on box a b \ + f absolutely_integrable_on cbox a b" + by (auto simp: integrable_on_open_interval absolutely_integrable_on_def) lemma absolutely_integrable_restrict_UNIV: "(\x. if x \ s then f x else 0) absolutely_integrable_on UNIV \ f absolutely_integrable_on s" @@ -2075,7 +2087,7 @@ assumes "f integrable_on UNIV" and "\d. d division_of (\d) \ sum (\k. norm (integral k f)) d \ B" shows "f absolutely_integrable_on UNIV" -proof (rule absolutely_integrable_onI, fact, rule) +proof (rule absolutely_integrable_onI, fact) let ?f = "\d. \k\d. norm (integral k f)" and ?D = "{d. d division_of (\d)}" have D_1: "?D \ {}" by (rule elementary_interval) auto @@ -2091,7 +2103,7 @@ apply (rule assms(2)[rule_format]) apply auto done - show "((\x. norm (f x)) has_integral ?S) UNIV" + have "((\x. norm (f x)) has_integral ?S) UNIV" apply (subst has_integral_alt') apply safe proof goal_cases @@ -2224,6 +2236,8 @@ qed qed (insert K, auto) qed + then show "(\x. norm (f x)) integrable_on UNIV" + by blast qed lemma absolutely_integrable_add[intro]: diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Thu Jun 22 21:48:57 2017 +0200 @@ -273,13 +273,13 @@ definition "integral i f = (SOME y. (f has_integral y) i \ ~ f integrable_on i \ y=0)" -lemma integrable_integral[dest]: "f integrable_on i \ (f has_integral (integral i f)) i" +lemma integrable_integral[intro]: "f integrable_on i \ (f has_integral (integral i f)) i" unfolding integrable_on_def integral_def by (metis (mono_tags, lifting) someI_ex) lemma not_integrable_integral: "~ f integrable_on i \ integral i f = 0" unfolding integrable_on_def integral_def by blast -lemma has_integral_integrable[intro]: "(f has_integral i) s \ f integrable_on s" +lemma has_integral_integrable[dest]: "(f has_integral i) s \ f integrable_on s" unfolding integrable_on_def by auto lemma has_integral_integral: "f integrable_on s \ (f has_integral (integral s f)) s" @@ -358,7 +358,6 @@ apply (rule someI_ex) by blast - lemma has_integral_const [intro]: fixes a b :: "'a::euclidean_space" shows "((\x. c) has_integral (content (cbox a b) *\<^sub>R c)) (cbox a b)" @@ -372,6 +371,9 @@ shows "((\x. c) has_integral (content {a .. b} *\<^sub>R c)) {a .. b}" by (metis box_real(2) has_integral_const) +lemma has_integral_integrable_integral: "(f has_integral i) s \ f integrable_on s \ integral s f = i" + by blast + lemma integral_const [simp]: fixes a b :: "'a::euclidean_space" shows "integral (cbox a b) (\x. c) = content (cbox a b) *\<^sub>R c" @@ -408,17 +410,17 @@ by (subst has_integral_alt) (force simp add: *) qed -lemma has_integral_0[simp]: "((\x::'n::euclidean_space. 0) has_integral 0) s" +lemma has_integral_0[simp]: "((\x::'n::euclidean_space. 0) has_integral 0) S" by (rule has_integral_is_0) auto -lemma has_integral_0_eq[simp]: "((\x. 0) has_integral i) s \ i = 0" +lemma has_integral_0_eq[simp]: "((\x. 0) has_integral i) S \ i = 0" using has_integral_unique[OF has_integral_0] by auto lemma has_integral_linear: fixes f :: "'n::euclidean_space \ 'a::real_normed_vector" - assumes "(f has_integral y) s" + assumes "(f has_integral y) S" and "bounded_linear h" - shows "((h \ f) has_integral ((h y))) s" + shows "((h \ f) has_integral ((h y))) S" proof - interpret bounded_linear h using assms(2) . @@ -427,11 +429,11 @@ have lem: "\a b y f::'n\'a. (f has_integral y) (cbox a b) \ ((h \ f) has_integral h y) (cbox a b)" unfolding has_integral_cbox by (drule tendsto) (simp add: sum scaleR split_beta') { - presume "\ (\a b. s = cbox a b) \ ?thesis" + presume "\ (\a b. S = cbox a b) \ ?thesis" then show ?thesis using assms(1) lem by blast } - assume as: "\ (\a b. s = cbox a b)" + assume as: "\ (\a b. S = cbox a b)" then show ?thesis proof (subst has_integral_alt, clarsimp) fix e :: real @@ -440,17 +442,17 @@ obtain M where M: "M > 0" "\a b. ball 0 M \ cbox a b \ - \z. ((\x. if x \ s then f x else 0) has_integral z) (cbox a b) \ norm (z - y) < e / B" + \z. ((\x. if x \ S then f x else 0) has_integral z) (cbox a b) \ norm (z - y) < e / B" using has_integral_altD[OF assms(1) as *] by blast show "\B>0. \a b. ball 0 B \ cbox a b \ - (\z. ((\x. if x \ s then (h \ f) x else 0) has_integral z) (cbox a b) \ norm (z - h y) < e)" + (\z. ((\x. if x \ S then (h \ f) x else 0) has_integral z) (cbox a b) \ norm (z - h y) < e)" proof (rule_tac x=M in exI, clarsimp simp add: M, goal_cases) case prems: (1 a b) obtain z where z: - "((\x. if x \ s then f x else 0) has_integral z) (cbox a b)" + "((\x. if x \ S then f x else 0) has_integral z) (cbox a b)" "norm (z - y) < e / B" using M(2)[OF prems(1)] by blast - have *: "(\x. if x \ s then (h \ f) x else 0) = h \ (\x. if x \ s then f x else 0)" + have *: "(\x. if x \ S then (h \ f) x else 0) = h \ (\x. if x \ S then f x else 0)" using zero by auto show ?case apply (rule_tac x="h z" in exI) @@ -462,7 +464,7 @@ qed lemma has_integral_scaleR_left: - "(f has_integral y) s \ ((\x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) s" + "(f has_integral y) S \ ((\x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) S" using has_integral_linear[OF _ bounded_linear_scaleR_left] by (simp add: comp_def) lemma integrable_on_scaleR_left: @@ -472,27 +474,27 @@ lemma has_integral_mult_left: fixes c :: "_ :: real_normed_algebra" - shows "(f has_integral y) s \ ((\x. f x * c) has_integral (y * c)) s" + shows "(f has_integral y) S \ ((\x. f x * c) has_integral (y * c)) S" using has_integral_linear[OF _ bounded_linear_mult_left] by (simp add: comp_def) -text\The case analysis eliminates the condition @{term "f integrable_on s"} at the cost +text\The case analysis eliminates the condition @{term "f integrable_on S"} at the cost of the type class constraint \division_ring\\ corollary integral_mult_left [simp]: fixes c:: "'a::{real_normed_algebra,division_ring}" - shows "integral s (\x. f x * c) = integral s f * c" -proof (cases "f integrable_on s \ c = 0") + shows "integral S (\x. f x * c) = integral S f * c" +proof (cases "f integrable_on S \ c = 0") case True then show ?thesis by (force intro: has_integral_mult_left) next - case False then have "~ (\x. f x * c) integrable_on s" - using has_integral_mult_left [of "(\x. f x * c)" _ s "inverse c"] - by (force simp add: mult.assoc) + case False then have "~ (\x. f x * c) integrable_on S" + using has_integral_mult_left [of "(\x. f x * c)" _ S "inverse c"] + by (auto simp add: mult.assoc) with False show ?thesis by (simp add: not_integrable_integral) qed corollary integral_mult_right [simp]: fixes c:: "'a::{real_normed_field}" - shows "integral s (\x. c * f x) = c * integral s f" + shows "integral S (\x. c * f x) = c * integral S f" by (simp add: mult.commute [of c]) corollary integral_divide [simp]: @@ -506,7 +508,7 @@ shows "(f has_integral y) i \ ((\x. c * f x) has_integral (c * y)) i" using has_integral_linear[OF _ bounded_linear_mult_right] by (simp add: comp_def) -lemma has_integral_cmul: "(f has_integral k) s \ ((\x. c *\<^sub>R f x) has_integral (c *\<^sub>R k)) s" +lemma has_integral_cmul: "(f has_integral k) S \ ((\x. c *\<^sub>R f x) has_integral (c *\<^sub>R k)) S" unfolding o_def[symmetric] by (metis has_integral_linear bounded_linear_scaleR_right) @@ -523,17 +525,17 @@ unfolding real_scaleR_def . qed -lemma has_integral_neg: "(f has_integral k) s \ ((\x. -(f x)) has_integral -k) s" +lemma has_integral_neg: "(f has_integral k) S \ ((\x. -(f x)) has_integral -k) S" by (drule_tac c="-1" in has_integral_cmul) auto -lemma has_integral_neg_iff: "((\x. - f x) has_integral k) s \ (f has_integral - k) s" +lemma has_integral_neg_iff: "((\x. - f x) has_integral k) S \ (f has_integral - k) S" using has_integral_neg[of f "- k"] has_integral_neg[of "\x. - f x" k] by auto lemma has_integral_add: fixes f :: "'n::euclidean_space \ 'a::real_normed_vector" - assumes "(f has_integral k) s" - and "(g has_integral l) s" - shows "((\x. f x + g x) has_integral (k + l)) s" + assumes "(f has_integral k) S" + and "(g has_integral l) S" + shows "((\x. f x + g x) has_integral (k + l)) S" proof - have lem: "(f has_integral k) (cbox a b) \ (g has_integral l) (cbox a b) \ ((\x. f x + g x) has_integral (k + l)) (cbox a b)" @@ -541,11 +543,11 @@ unfolding has_integral_cbox by (simp add: split_beta' scaleR_add_right sum.distrib[abs_def] tendsto_add) { - presume "\ (\a b. s = cbox a b) \ ?thesis" + presume "\ (\a b. S = cbox a b) \ ?thesis" then show ?thesis using assms lem by force } - assume as: "\ (\a b. s = cbox a b)" + assume as: "\ (\a b. S = cbox a b)" then show ?thesis proof (subst has_integral_alt, clarsimp, goal_cases) case (1 e) @@ -555,13 +557,13 @@ obtain B1 where B1: "0 < B1" "\a b. ball 0 B1 \ cbox a b \ - \z. ((\x. if x \ s then f x else 0) has_integral z) (cbox a b) \ norm (z - k) < e / 2" + \z. ((\x. if x \ S then f x else 0) has_integral z) (cbox a b) \ norm (z - k) < e / 2" by blast from has_integral_altD[OF assms(2) as *] obtain B2 where B2: "0 < B2" "\a b. ball 0 B2 \ (cbox a b) \ - \z. ((\x. if x \ s then g x else 0) has_integral z) (cbox a b) \ norm (z - l) < e / 2" + \z. ((\x. if x \ S then g x else 0) has_integral z) (cbox a b) \ norm (z - l) < e / 2" by blast show ?case proof (rule_tac x="max B1 B2" in exI, clarsimp simp add: max.strict_coboundedI1 B1) @@ -570,17 +572,17 @@ then have *: "ball 0 B1 \ cbox a (b::'n)" "ball 0 B2 \ cbox a (b::'n)" by auto obtain w where w: - "((\x. if x \ s then f x else 0) has_integral w) (cbox a b)" + "((\x. if x \ S then f x else 0) has_integral w) (cbox a b)" "norm (w - k) < e / 2" using B1(2)[OF *(1)] by blast obtain z where z: - "((\x. if x \ s then g x else 0) has_integral z) (cbox a b)" + "((\x. if x \ S then g x else 0) has_integral z) (cbox a b)" "norm (z - l) < e / 2" using B2(2)[OF *(2)] by blast - have *: "\x. (if x \ s then f x + g x else 0) = - (if x \ s then f x else 0) + (if x \ s then g x else 0)" + have *: "\x. (if x \ S then f x + g x else 0) = + (if x \ S then f x else 0) + (if x \ S then g x else 0)" by auto - show "\z. ((\x. if x \ s then f x + g x else 0) has_integral z) (cbox a b) \ norm (z - (k + l)) < e" + show "\z. ((\x. if x \ S then f x + g x else 0) has_integral z) (cbox a b) \ norm (z - (k + l)) < e" apply (rule_tac x="w + z" in exI) apply (simp add: lem[OF w(1) z(1), unfolded *[symmetric]]) using norm_triangle_ineq[of "w - k" "z - l"] w(2) z(2) @@ -591,93 +593,92 @@ qed lemma has_integral_diff: - "(f has_integral k) s \ (g has_integral l) s \ - ((\x. f x - g x) has_integral (k - l)) s" - using has_integral_add[OF _ has_integral_neg, of f k s g l] + "(f has_integral k) S \ (g has_integral l) S \ + ((\x. f x - g x) has_integral (k - l)) S" + using has_integral_add[OF _ has_integral_neg, of f k S g l] by (auto simp: algebra_simps) lemma integral_0 [simp]: - "integral s (\x::'n::euclidean_space. 0::'m::real_normed_vector) = 0" + "integral S (\x::'n::euclidean_space. 0::'m::real_normed_vector) = 0" by (rule integral_unique has_integral_0)+ -lemma integral_add: "f integrable_on s \ g integrable_on s \ - integral s (\x. f x + g x) = integral s f + integral s g" +lemma integral_add: "f integrable_on S \ g integrable_on S \ + integral S (\x. f x + g x) = integral S f + integral S g" by (rule integral_unique) (metis integrable_integral has_integral_add) -lemma integral_cmul [simp]: "integral s (\x. c *\<^sub>R f x) = c *\<^sub>R integral s f" -proof (cases "f integrable_on s \ c = 0") - case True with has_integral_cmul show ?thesis by force +lemma integral_cmul [simp]: "integral S (\x. c *\<^sub>R f x) = c *\<^sub>R integral S f" +proof (cases "f integrable_on S \ c = 0") + case True with has_integral_cmul integrable_integral show ?thesis + by fastforce next - case False then have "~ (\x. c *\<^sub>R f x) integrable_on s" - using has_integral_cmul [of "(\x. c *\<^sub>R f x)" _ s "inverse c"] - by force + case False then have "~ (\x. c *\<^sub>R f x) integrable_on S" + using has_integral_cmul [of "(\x. c *\<^sub>R f x)" _ S "inverse c"] by auto with False show ?thesis by (simp add: not_integrable_integral) qed -lemma integral_neg [simp]: "integral s (\x. - f x) = - integral s f" -proof (cases "f integrable_on s") +lemma integral_neg [simp]: "integral S (\x. - f x) = - integral S f" +proof (cases "f integrable_on S") case True then show ?thesis by (simp add: has_integral_neg integrable_integral integral_unique) next - case False then have "~ (\x. - f x) integrable_on s" - using has_integral_neg [of "(\x. - f x)" _ s ] - by force + case False then have "~ (\x. - f x) integrable_on S" + using has_integral_neg [of "(\x. - f x)" _ S ] by auto with False show ?thesis by (simp add: not_integrable_integral) qed -lemma integral_diff: "f integrable_on s \ g integrable_on s \ - integral s (\x. f x - g x) = integral s f - integral s g" +lemma integral_diff: "f integrable_on S \ g integrable_on S \ + integral S (\x. f x - g x) = integral S f - integral S g" by (rule integral_unique) (metis integrable_integral has_integral_diff) -lemma integrable_0: "(\x. 0) integrable_on s" +lemma integrable_0: "(\x. 0) integrable_on S" unfolding integrable_on_def using has_integral_0 by auto -lemma integrable_add: "f integrable_on s \ g integrable_on s \ (\x. f x + g x) integrable_on s" +lemma integrable_add: "f integrable_on S \ g integrable_on S \ (\x. f x + g x) integrable_on S" unfolding integrable_on_def by(auto intro: has_integral_add) -lemma integrable_cmul: "f integrable_on s \ (\x. c *\<^sub>R f(x)) integrable_on s" +lemma integrable_cmul: "f integrable_on S \ (\x. c *\<^sub>R f(x)) integrable_on S" unfolding integrable_on_def by(auto intro: has_integral_cmul) lemma integrable_on_cmult_iff: fixes c :: real assumes "c \ 0" - shows "(\x. c * f x) integrable_on s \ f integrable_on s" - using integrable_cmul[of "\x. c * f x" s "1 / c"] integrable_cmul[of f s c] \c \ 0\ + shows "(\x. c * f x) integrable_on S \ f integrable_on S" + using integrable_cmul[of "\x. c * f x" S "1 / c"] integrable_cmul[of f S c] \c \ 0\ by auto lemma integrable_on_cmult_left: - assumes "f integrable_on s" - shows "(\x. of_real c * f x) integrable_on s" - using integrable_cmul[of f s "of_real c"] assms + assumes "f integrable_on S" + shows "(\x. of_real c * f x) integrable_on S" + using integrable_cmul[of f S "of_real c"] assms by (simp add: scaleR_conv_of_real) -lemma integrable_neg: "f integrable_on s \ (\x. -f(x)) integrable_on s" +lemma integrable_neg: "f integrable_on S \ (\x. -f(x)) integrable_on S" unfolding integrable_on_def by(auto intro: has_integral_neg) lemma integrable_diff: - "f integrable_on s \ g integrable_on s \ (\x. f x - g x) integrable_on s" + "f integrable_on S \ g integrable_on S \ (\x. f x - g x) integrable_on S" unfolding integrable_on_def by(auto intro: has_integral_diff) lemma integrable_linear: - "f integrable_on s \ bounded_linear h \ (h \ f) integrable_on s" + "f integrable_on S \ bounded_linear h \ (h \ f) integrable_on S" unfolding integrable_on_def by(auto intro: has_integral_linear) lemma integral_linear: - "f integrable_on s \ bounded_linear h \ integral s (h \ f) = h (integral s f)" - apply (rule has_integral_unique [where i=s and f = "h \ f"]) + "f integrable_on S \ bounded_linear h \ integral S (h \ f) = h (integral S f)" + apply (rule has_integral_unique [where i=S and f = "h \ f"]) apply (simp_all add: integrable_integral integrable_linear has_integral_linear ) done lemma integral_component_eq[simp]: fixes f :: "'n::euclidean_space \ 'm::euclidean_space" - assumes "f integrable_on s" - shows "integral s (\x. f x \ k) = integral s f \ k" + assumes "f integrable_on S" + shows "integral S (\x. f x \ k) = integral S f \ k" unfolding integral_linear[OF assms(1) bounded_linear_inner_left,unfolded o_def] .. lemma has_integral_sum: assumes "finite t" - and "\a\t. ((f a) has_integral (i a)) s" - shows "((\x. sum (\a. f a x) t) has_integral (sum i t)) s" + and "\a\t. ((f a) has_integral (i a)) S" + shows "((\x. sum (\a. f a x) t) has_integral (sum i t)) S" using assms(1) subset_refl[of t] proof (induct rule: finite_subset_induct) case empty @@ -689,9 +690,9 @@ qed lemma integral_sum: - "\finite t; \a\t. (f a) integrable_on s\ \ - integral s (\x. sum (\a. f a x) t) = sum (\a. integral s (f a)) t" - by (auto intro: has_integral_sum integrable_integral) + "\finite I; \a. a \ I \ f a integrable_on S\ \ + integral S (\x. \a\I. f a x) = (\a\I. integral S (f a))" + by (simp add: has_integral_sum integrable_integral integral_unique) lemma integrable_sum: "\finite I; \a. a \ I \ f a integrable_on S\ \ (\x. \a\I. f a x) integrable_on S" @@ -927,7 +928,7 @@ by auto from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format],rule_format] have "\n. gauge (\x. \{d i x |i. i \ {0..n}})" - apply (rule gauge_inters) + apply (rule gauge_Inter) using d(1) apply auto done @@ -993,33 +994,33 @@ subsection \Additivity of integral on abutting intervals.\ lemma tagged_division_split_left_inj_content: - assumes d: "d tagged_division_of i" - and "(x1, k1) \ d" "(x2, k2) \ d" "k1 \ k2" "k1 \ {x. x\k \ c} = k2 \ {x. x\k \ c}" "k \ Basis" - shows "content (k1 \ {x. x\k \ c}) = 0" + assumes \: "\ tagged_division_of S" + and "(x1, K1) \ \" "(x2, K2) \ \" "K1 \ K2" "K1 \ {x. x\k \ c} = K2 \ {x. x\k \ c}" "k \ Basis" + shows "content (K1 \ {x. x\k \ c}) = 0" proof - - from tagged_division_ofD(4)[OF d \(x1, k1) \ d\] obtain a b where k1: "k1 = cbox a b" + from tagged_division_ofD(4)[OF \ \(x1, K1) \ \\] obtain a b where K1: "K1 = cbox a b" by auto - show ?thesis - unfolding k1 interval_split[OF \k \ Basis\] - unfolding content_eq_0_interior - unfolding interval_split[OF \k \ Basis\, symmetric] k1[symmetric] + then have "interior (K1 \ {x. x \ k \ c}) = {}" by (metis tagged_division_split_left_inj assms) + then show ?thesis + unfolding K1 interval_split[OF \k \ Basis\] by (auto simp: content_eq_0_interior) qed lemma tagged_division_split_right_inj_content: - assumes d: "d tagged_division_of i" - and "(x1, k1) \ d" "(x2, k2) \ d" "k1 \ k2" "k1 \ {x. x\k \ c} = k2 \ {x. x\k \ c}" "k \ Basis" - shows "content (k1 \ {x. x\k \ c}) = 0" + assumes \: "\ tagged_division_of S" + and "(x1, K1) \ \" "(x2, K2) \ \" "K1 \ K2" "K1 \ {x. x\k \ c} = K2 \ {x. x\k \ c}" "k \ Basis" + shows "content (K1 \ {x. x\k \ c}) = 0" proof - - from tagged_division_ofD(4)[OF d \(x1, k1) \ d\] obtain a b where k1: "k1 = cbox a b" + from tagged_division_ofD(4)[OF \ \(x1, K1) \ \\] obtain a b where K1: "K1 = cbox a b" by auto - show ?thesis - unfolding k1 interval_split[OF \k \ Basis\] - unfolding content_eq_0_interior - unfolding interval_split[OF \k \ Basis\, symmetric] k1[symmetric] + then have "interior (K1 \ {x. c \ x \ k}) = {}" by (metis tagged_division_split_right_inj assms) + then show ?thesis + unfolding K1 interval_split[OF \k \ Basis\] + by (auto simp: content_eq_0_interior) qed + lemma has_integral_split: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" assumes fi: "(f has_integral i) (cbox a b \ {x. x\k \ c})" @@ -1313,7 +1314,7 @@ fixes f :: "'a::euclidean_space \ 'b::{real_normed_vector,complete_space}" assumes f: "f integrable_on cbox a b" and k: "k \ Basis" - shows "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?thesis1) + shows "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?thesis1) and "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?thesis2) proof - obtain y where y: "(f has_integral y) (cbox a b)" @@ -1327,12 +1328,12 @@ if "e > 0" for e proof - have "e/2 > 0" using that by auto - with has_integral_separate_sides[OF y this k, of c] - obtain d + with has_integral_separate_sides[OF y this k, of c] + obtain d where "gauge d" - and d: "\p1 p2. \p1 tagged_division_of cbox a b \ {x. x \ k \ c}; d fine p1; - p2 tagged_division_of cbox a b \ {x. c \ x \ k}; d fine p2\ - \ norm ((\(x,K)\p1. content K *\<^sub>R f x) + (\(x,K)\p2. content K *\<^sub>R f x) - y) < e/2" + and d: "\p1 p2. \p1 tagged_division_of cbox a b \ {x. x \ k \ c}; d fine p1; + p2 tagged_division_of cbox a b \ {x. c \ x \ k}; d fine p2\ + \ norm ((\(x,K)\p1. content K *\<^sub>R f x) + (\(x,K)\p2. content K *\<^sub>R f x) - y) < e/2" by metis show ?thesis proof (rule_tac x=d in exI, clarsimp simp add: \gauge d\) @@ -1349,7 +1350,7 @@ by (auto simp add: algebra_simps) qed qed - qed + qed with f show ?thesis1 by (simp add: interval_split[OF k] integrable_cauchy) have "\d. gauge d \ @@ -1359,12 +1360,12 @@ if "e > 0" for e proof - have "e/2 > 0" using that by auto - with has_integral_separate_sides[OF y this k, of c] - obtain d + with has_integral_separate_sides[OF y this k, of c] + obtain d where "gauge d" - and d: "\p1 p2. \p1 tagged_division_of cbox a b \ {x. x \ k \ c}; d fine p1; - p2 tagged_division_of cbox a b \ {x. c \ x \ k}; d fine p2\ - \ norm ((\(x,K)\p1. content K *\<^sub>R f x) + (\(x,K)\p2. content K *\<^sub>R f x) - y) < e/2" + and d: "\p1 p2. \p1 tagged_division_of cbox a b \ {x. x \ k \ c}; d fine p1; + p2 tagged_division_of cbox a b \ {x. c \ x \ k}; d fine p2\ + \ norm ((\(x,K)\p1. content K *\<^sub>R f x) + (\(x,K)\p2. content K *\<^sub>R f x) - y) < e/2" by metis show ?thesis proof (rule_tac x=d in exI, clarsimp simp add: \gauge d\) @@ -1381,7 +1382,7 @@ by (auto simp add: algebra_simps) qed qed - qed + qed with f show ?thesis2 by (simp add: interval_split[OF k] integrable_cauchy) qed @@ -2272,10 +2273,11 @@ using fint gf apply (subst has_integral_alt) apply (subst (asm) has_integral_alt) - apply (simp add: split: if_split_asm) - apply (blast dest: *) - apply (elim all_forward imp_forward ex_forward) - apply (force dest: *[where f="\x. if x\T then f x else 0" and g="\x. if x \ T then g x else 0"])+ + apply (simp split: if_split_asm) + apply (blast dest: *) + apply (erule_tac V = "\a b. T \ cbox a b" in thin_rl) + apply (elim all_forward imp_forward ex_forward all_forward conj_forward asm_rl) + apply (auto dest!: *[where f="\x. if x\T then f x else 0" and g="\x. if x \ T then g x else 0"]) done qed @@ -2764,7 +2766,7 @@ fixes a::real assumes "a \ b" shows "integral {a..b} (\x. x) = (if a \ b then (b\<^sup>2 - a\<^sup>2) / 2 else 0)" -using ident_has_integral integral_unique by fastforce + by (metis assms ident_has_integral integral_unique) lemma ident_integrable_on: fixes a::real @@ -2881,7 +2883,8 @@ have "?sum a = (\iR Df i a)" by (rule sum.reindex_cong) (auto simp add: inj_on_def Dg_def one) finally show c: ?case . - case 2 show ?case using c integral_unique by force + case 2 show ?case using c integral_unique + by (metis (lifting) add.commute diff_eq_eq integral_unique) case 3 show ?case using c by force qed @@ -3111,7 +3114,7 @@ shows "f integrable_on {a .. b}" using assms unfolding integrable_on_def - by (fastforce intro!:has_integral_combine) + by (auto intro!:has_integral_combine) subsection \Reduce integrability to "local" integrability.\ @@ -3181,7 +3184,7 @@ using False x by (simp add: algebra_simps integral_combine) have fux_int: "((\u. f u - f x) has_integral integral {x..y} f - (y - x) *\<^sub>R f x) {x..y}" apply (rule has_integral_diff) - using x y apply (force intro: integrable_integral [OF integrable_subinterval_real [OF f]]) + using x y apply (auto intro: integrable_integral [OF integrable_subinterval_real [OF f]]) using has_integral_const_real [of "f x" x y] False apply (simp add: ) done @@ -3199,7 +3202,7 @@ using True x y by (simp add: algebra_simps integral_combine) have fux_int: "((\u. f u - f x) has_integral integral {y..x} f - (x - y) *\<^sub>R f x) {y..x}" apply (rule has_integral_diff) - using x y apply (force intro: integrable_integral [OF integrable_subinterval_real [OF f]]) + using x y apply (auto intro: integrable_integral [OF integrable_subinterval_real [OF f]]) using has_integral_const_real [of "f x" y x] True apply (simp add: ) done @@ -5086,43 +5089,57 @@ text \Hence a general restriction property.\ -lemma has_integral_restrict[simp]: - assumes "s \ t" - shows "((\x. if x \ s then f x else (0::'a::banach)) has_integral i) t \ (f has_integral i) s" +lemma has_integral_restrict [simp]: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + assumes "S \ T" + shows "((\x. if x \ S then f x else 0) has_integral i) T \ (f has_integral i) S" proof - - have *: "\x. (if x \ t then if x \ s then f x else 0 else 0) = (if x\s then f x else 0)" + have *: "\x. (if x \ T then if x \ S then f x else 0 else 0) = (if x\S then f x else 0)" using assms by auto show ?thesis apply (subst(2) has_integral') apply (subst has_integral') - unfolding * - apply rule + apply (simp add: *) done qed -lemma has_integral_restrict_UNIV: +corollary has_integral_restrict_UNIV: fixes f :: "'n::euclidean_space \ 'a::banach" shows "((\x. if x \ s then f x else 0) has_integral i) UNIV \ (f has_integral i) s" by auto +lemma has_integral_restrict_Int: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "((\x. if x \ S then f x else 0) has_integral i) T \ (f has_integral i) (S \ T)" +proof - + have "((\x. if x \ T then if x \ S then f x else 0 else 0) has_integral i) UNIV = + ((\x. if x \ S \ T then f x else 0) has_integral i) UNIV" + by (rule has_integral_cong) auto + then show ?thesis + using has_integral_restrict_UNIV by fastforce +qed + +lemma integral_restrict_Int: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "integral T (\x. if x \ S then f x else 0) = integral (S \ T) f" + by (metis (no_types, lifting) has_integral_cong has_integral_restrict_Int integrable_integral integral_unique not_integrable_integral) + +lemma integrable_restrict_Int: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "(\x. if x \ S then f x else 0) integrable_on T \ f integrable_on (S \ T)" + using has_integral_restrict_Int by fastforce + lemma has_integral_on_superset: fixes f :: "'n::euclidean_space \ 'a::banach" - assumes "\x. x \ s \ f x = 0" - and "s \ t" - and "(f has_integral i) s" - shows "(f has_integral i) t" + assumes f: "(f has_integral i) S" + and "\x. x \ S \ f x = 0" + and "S \ T" + shows "(f has_integral i) T" proof - - have "(\x. if x \ s then f x else 0) = (\x. if x \ t then f x else 0)" - apply rule - using assms(1-2) - apply auto - done - then show ?thesis - using assms(3) - apply (subst has_integral_restrict_UNIV[symmetric]) - apply (subst(asm) has_integral_restrict_UNIV[symmetric]) - apply auto - done + have "(\x. if x \ S then f x else 0) = (\x. if x \ T then f x else 0)" + using assms by fastforce + with f show ?thesis + by (simp only: has_integral_restrict_UNIV [symmetric, of f]) qed lemma integrable_on_superset: @@ -5135,7 +5152,7 @@ unfolding integrable_on_def by (auto intro:has_integral_on_superset) -lemma integral_restrict_univ[intro]: +lemma integral_restrict_UNIV [intro]: fixes f :: "'n::euclidean_space \ 'a::banach" shows "f integrable_on s \ integral UNIV (\x. if x \ s then f x else 0) = integral s f" apply (rule integral_unique) @@ -5149,6 +5166,20 @@ unfolding integrable_on_def by auto +lemma has_integral_subset_component_le: + fixes f :: "'n::euclidean_space \ 'm::euclidean_space" + assumes k: "k \ Basis" + and as: "S \ T" "(f has_integral i) S" "(f has_integral j) T" "\x. x\T \ 0 \ f(x)\k" + shows "i\k \ j\k" +proof - + have "((\x. if x \ S then f x else 0) has_integral i) UNIV" + "((\x. if x \ T then f x else 0) has_integral j) UNIV" + by (simp_all add: assms) + then show ?thesis + apply (rule has_integral_component_le[OF k]) + using as by auto +qed + lemma negligible_on_intervals: "negligible s \ (\a b. negligible(s \ cbox a b))" (is "?l \ ?r") proof assume ?r @@ -5193,48 +5224,65 @@ lemma has_integral_spike_set_eq: fixes f :: "'n::euclidean_space \ 'a::banach" - assumes "negligible ((s - t) \ (t - s))" - shows "(f has_integral y) s \ (f has_integral y) t" + assumes "negligible ((S - T) \ (T - S))" + shows "(f has_integral y) S \ (f has_integral y) T" unfolding has_integral_restrict_UNIV[symmetric,of f] apply (rule has_integral_spike_eq[OF assms]) by (auto split: if_split_asm) lemma has_integral_spike_set: fixes f :: "'n::euclidean_space \ 'a::banach" - assumes "(f has_integral y) s" "negligible ((s - t) \ (t - s))" - shows "(f has_integral y) t" + assumes "(f has_integral y) S" "negligible ((S - T) \ (T - S))" + shows "(f has_integral y) T" using assms has_integral_spike_set_eq by auto lemma integrable_spike_set: fixes f :: "'n::euclidean_space \ 'a::banach" - assumes "f integrable_on s" and "negligible ((s - t) \ (t - s))" - shows "f integrable_on t" + assumes "f integrable_on S" and "negligible ((S - T) \ (T - S))" + shows "f integrable_on T" using assms by (simp add: integrable_on_def has_integral_spike_set_eq) lemma integrable_spike_set_eq: fixes f :: "'n::euclidean_space \ 'a::banach" - assumes "negligible ((s - t) \ (t - s))" - shows "f integrable_on s \ f integrable_on t" -by (blast intro: integrable_spike_set assms negligible_subset) + assumes "negligible ((S - T) \ (T - S))" + shows "f integrable_on S \ f integrable_on T" + by (blast intro: integrable_spike_set assms negligible_subset) + +lemma has_integral_interior: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "negligible(frontier S) \ (f has_integral y) (interior S) \ (f has_integral y) S" + apply (rule has_integral_spike_set_eq) + apply (auto simp: frontier_def Un_Diff closure_def) + apply (metis Diff_eq_empty_iff interior_subset negligible_empty) + done + +lemma has_integral_closure: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "negligible(frontier S) \ (f has_integral y) (closure S) \ (f has_integral y) S" + apply (rule has_integral_spike_set_eq) + apply (auto simp: Un_Diff closure_Un_frontier negligible_diff) + by (simp add: Diff_eq closure_Un_frontier) + +lemma has_integral_open_interval: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "(f has_integral y) (box a b) \ (f has_integral y) (cbox a b)" + unfolding interior_cbox [symmetric] + by (metis frontier_cbox has_integral_interior negligible_frontier_interval) + +lemma integrable_on_open_interval: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "f integrable_on box a b \ f integrable_on cbox a b" + by (simp add: has_integral_open_interval integrable_on_def) + +lemma integral_open_interval: + fixes f :: "'a :: euclidean_space \ 'b :: banach" + shows "integral(box a b) f = integral(cbox a b) f" + by (metis has_integral_integrable_integral has_integral_open_interval not_integrable_integral) + subsection \More lemmas that are useful later\ -lemma has_integral_subset_component_le: - fixes f :: "'n::euclidean_space \ 'm::euclidean_space" - assumes k: "k \ Basis" - and as: "s \ t" "(f has_integral i) s" "(f has_integral j) t" "\x\t. 0 \ f(x)\k" - shows "i\k \ j\k" -proof - - note has_integral_restrict_UNIV[symmetric, of f] - note as(2-3)[unfolded this] note * = has_integral_component_le[OF k this] - show ?thesis - apply (rule *) - using as(1,4) - apply auto - done -qed - lemma has_integral_subset_le: fixes f :: "'n::euclidean_space \ real" assumes "s \ t" @@ -5504,10 +5552,10 @@ have e: "e/3 > 0" using that by auto then obtain g h i j where ij: "\i - j\ < e/3" - and "(g has_integral i) (cbox a b)" - and "(h has_integral j) (cbox a b)" + and "(g has_integral i) (cbox a b)" + and "(h has_integral j) (cbox a b)" and fgh: "\x. x \ cbox a b \ g x \ f x \ f x \ h x" - using assms real_norm_def by metis + using assms real_norm_def by metis then obtain d1 d2 where "gauge d1" "gauge d2" and d1: "\p. \p tagged_division_of cbox a b; d1 fine p\ \ \(\(x,K)\p. content K *\<^sub>R g x) - i\ < e/3" @@ -5515,10 +5563,10 @@ \(\(x,K) \ p. content K *\<^sub>R h x) - j\ < e/3" by (metis e has_integral real_norm_def) have "\(\(x,K) \ p1. content K *\<^sub>R f x) - (\(x,K) \ p2. content K *\<^sub>R f x)\ < e" - if p1: "p1 tagged_division_of cbox a b" and 11: "d1 fine p1" and 21: "d2 fine p1" + if p1: "p1 tagged_division_of cbox a b" and 11: "d1 fine p1" and 21: "d2 fine p1" and p2: "p2 tagged_division_of cbox a b" and 12: "d1 fine p2" and 22: "d2 fine p2" for p1 p2 proof - - have *: "\g1 g2 h1 h2 f1 f2. + have *: "\g1 g2 h1 h2 f1 f2. \\g2 - i\ < e/3; \g1 - i\ < e/3; \h2 - j\ < e/3; \h1 - j\ < e/3; g1 - h2 \ f1 - f2; f1 - f2 \ h1 - g2\ \ \f1 - f2\ < e" @@ -6617,9 +6665,9 @@ prefer 3 apply (subst abs_of_nonneg) apply (rule *[OF assms(2) that(1)[THEN spec]]) - apply (subst integral_restrict_univ[symmetric,OF int]) + apply (subst integral_restrict_UNIV[symmetric,OF int]) unfolding ifif - unfolding integral_restrict_univ[OF int'] + unfolding integral_restrict_UNIV[OF int'] apply (rule integral_subset_le[OF _ int' assms(2)]) using assms(1) apply auto @@ -6692,8 +6740,8 @@ next case 1 show ?case - apply (subst integral_restrict_univ[symmetric,OF int]) - unfolding ifif integral_restrict_univ[OF int'] + apply (subst integral_restrict_UNIV[symmetric,OF int]) + unfolding ifif integral_restrict_UNIV[OF int'] apply (rule integral_subset_le[OF _ int']) using assms apply auto @@ -6795,7 +6843,7 @@ proof (intro monotone_convergence_increasing allI ballI assms) show "bounded {integral s (f k) |k. True}" unfolding x by (rule convergent_imp_bounded) fact - qed (auto intro: f) + qed (use f in auto) then have "integral s g = x'" by (intro LIMSEQ_unique[OF _ \x \ x'\]) (simp add: x_eq) with * show ?thesis @@ -7924,7 +7972,7 @@ hence "(f n has_integral (F n - F a)) {a..n}" by (rule has_integral_eq [rotated]) (simp add: f_def) thus "(f n has_integral (F n - F a)) {a..}" - by (rule has_integral_on_superset [rotated 2]) (auto simp: f_def) + by (rule has_integral_on_superset) (auto simp: f_def) qed have integral_f: "integral {a..} (f n) = (if n \ a then F n - F a else 0)" for n :: nat proof (cases "n \ a") @@ -7934,7 +7982,7 @@ case False have "(f n has_integral 0) {a}" by (rule has_integral_refl) hence "(f n has_integral 0) {a..}" - by (rule has_integral_on_superset [rotated 2]) (insert False, simp_all add: f_def) + by (rule has_integral_on_superset) (insert False, simp_all add: f_def) with False show ?thesis by (simp add: integral_unique) qed diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Interval_Integral.thy --- a/src/HOL/Analysis/Interval_Integral.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Interval_Integral.thy Thu Jun 22 21:48:57 2017 +0200 @@ -660,7 +660,7 @@ (auto simp del: ereal_less_eq simp add: ereal_less_eq(3)[symmetric]) qed have 2: "set_borel_measurable lborel (einterval a b) f" - by (auto simp del: real_scaleR_def intro!: set_borel_measurable_continuous + by (auto simp del: real_scaleR_def intro!: borel_measurable_continuous_on_indicator simp: continuous_on_eq_continuous_at einterval_iff f) have 3: "(\i. LBINT x=l i..u i. f x) \ B - A" apply (subst FTCi) diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Lebesgue_Measure.thy --- a/src/HOL/Analysis/Lebesgue_Measure.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy Thu Jun 22 21:48:57 2017 +0200 @@ -387,6 +387,12 @@ and measurable_lborel2[simp]: "measurable lborel M = measurable borel M" by (simp_all add: lborel_def) +lemma sets_lebesgue_on_refl [iff]: "S \ sets (lebesgue_on S)" + by (metis inf_top.right_neutral sets.top space_borel space_completion space_lborel space_restrict_space) + +lemma Compl_in_sets_lebesgue: "-A \ sets lebesgue \ A \ sets lebesgue" + by (metis Compl_eq_Diff_UNIV double_compl space_borel space_completion space_lborel Sigma_Algebra.sets.compl_sets) + context begin @@ -495,7 +501,11 @@ lemma emeasure_lborel_singleton[simp]: "emeasure lborel {x} = 0" using emeasure_lborel_cbox[of x x] nonempty_Basis - by (auto simp del: emeasure_lborel_cbox nonempty_Basis simp add: cbox_sing prod_constant) + by (auto simp del: emeasure_lborel_cbox nonempty_Basis simp add: prod_constant) + +lemma fmeasurable_cbox [iff]: "cbox a b \ fmeasurable lborel" + and fmeasurable_box [iff]: "box a b \ fmeasurable lborel" + by (auto simp: fmeasurable_def emeasure_lborel_box_eq emeasure_lborel_cbox_eq) lemma fixes l u :: real diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Set_Integral.thy --- a/src/HOL/Analysis/Set_Integral.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Set_Integral.thy Thu Jun 22 21:48:57 2017 +0200 @@ -1840,22 +1840,10 @@ translations "CLINT x:A|M. f" == "CONST complex_set_lebesgue_integral M A (\x. f)" -lemma set_borel_measurable_continuous: - fixes f :: "_ \ _::real_normed_vector" - assumes "S \ sets borel" "continuous_on S f" - shows "set_borel_measurable borel S f" -proof - - have "(\x. if x \ S then f x else 0) \ borel_measurable borel" - by (intro assms borel_measurable_continuous_on_if continuous_on_const) - also have "(\x. if x \ S then f x else 0) = (\x. indicator S x *\<^sub>R f x)" - by auto - finally show ?thesis . -qed - lemma set_measurable_continuous_on_ivl: assumes "continuous_on {a..b} (f :: real \ real)" shows "set_borel_measurable borel {a..b} f" - by (rule set_borel_measurable_continuous[OF _ assms]) simp + by (rule borel_measurable_continuous_on_indicator[OF _ assms]) simp text\This notation is from Sébastien Gouëzel: His use is not directly in line with the diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Tagged_Division.thy --- a/src/HOL/Analysis/Tagged_Division.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Tagged_Division.thy Thu Jun 22 21:48:57 2017 +0200 @@ -275,9 +275,15 @@ lemma gauge_Int[intro]: "gauge d1 \ gauge d2 \ gauge (\x. d1 x \ d2 x)" unfolding gauge_def by auto -lemma gauge_inters: +lemma gauge_reflect: + fixes \ :: "'a::euclidean_space \ 'a set" + shows "gauge \ \ gauge (\x. uminus ` \ (- x))" + using equation_minus_iff + by (auto simp: gauge_def surj_def intro!: open_surjective_linear_image linear_uminus) + +lemma gauge_Inter: assumes "finite s" - and "\d\s. gauge (f d)" + and "\d. d\s \ gauge (f d)" shows "gauge (\x. \{f d x | d. d \ s})" proof - have *: "\x. {f d x |d. d \ s} = (\d. f d x) ` s" diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Analysis/Topology_Euclidean_Space.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Analysis/Topology_Euclidean_Space.thy Thu Jun 22 21:48:57 2017 +0200 @@ -7537,6 +7537,23 @@ then show "f x \ interior (f ` S)" by (meson assms imageI image_mono interiorI interior_subset open_bijective_linear_image_eq open_interior) qed + +lemma interior_injective_linear_image: + fixes f :: "'a::euclidean_space \ 'a::euclidean_space" + assumes "linear f" "inj f" + shows "interior(f ` S) = f ` (interior S)" + by (simp add: linear_injective_imp_surjective assms bijI interior_bijective_linear_image) + +lemma interior_surjective_linear_image: + fixes f :: "'a::euclidean_space \ 'a::euclidean_space" + assumes "linear f" "surj f" + shows "interior(f ` S) = f ` (interior S)" + by (simp add: assms interior_injective_linear_image linear_surjective_imp_injective) + +lemma interior_negations: + fixes S :: "'a::euclidean_space set" + shows "interior(uminus ` S) = image uminus (interior S)" + by (simp add: bij_uminus interior_bijective_linear_image linear_uminus) text \Also bilinear functions, in composition form.\ diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Filter.thy --- a/src/HOL/Filter.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Filter.thy Thu Jun 22 21:48:57 2017 +0200 @@ -556,6 +556,116 @@ by (subst (1 2) eventually_INF) auto qed + +subsubsection \Contravariant map function for filters\ + +definition filtercomap :: "('a \ 'b) \ 'b filter \ 'a filter" where + "filtercomap f F = Abs_filter (\P. \Q. eventually Q F \ (\x. Q (f x) \ P x))" + +lemma eventually_filtercomap: + "eventually P (filtercomap f F) \ (\Q. eventually Q F \ (\x. Q (f x) \ P x))" + unfolding filtercomap_def +proof (intro eventually_Abs_filter, unfold_locales, goal_cases) + case 1 + show ?case by (auto intro!: exI[of _ "\_. True"]) +next + case (2 P Q) + from 2(1) guess P' by (elim exE conjE) note P' = this + from 2(2) guess Q' by (elim exE conjE) note Q' = this + show ?case + by (rule exI[of _ "\x. P' x \ Q' x"]) + (insert P' Q', auto intro!: eventually_conj) +next + case (3 P Q) + thus ?case by blast +qed + +lemma filtercomap_ident: "filtercomap (\x. x) F = F" + by (auto simp: filter_eq_iff eventually_filtercomap elim!: eventually_mono) + +lemma filtercomap_filtercomap: "filtercomap f (filtercomap g F) = filtercomap (\x. g (f x)) F" + unfolding filter_eq_iff by (auto simp: eventually_filtercomap) + +lemma filtercomap_mono: "F \ F' \ filtercomap f F \ filtercomap f F'" + by (auto simp: eventually_filtercomap le_filter_def) + +lemma filtercomap_bot [simp]: "filtercomap f bot = bot" + by (auto simp: filter_eq_iff eventually_filtercomap) + +lemma filtercomap_top [simp]: "filtercomap f top = top" + by (auto simp: filter_eq_iff eventually_filtercomap) + +lemma filtercomap_inf: "filtercomap f (inf F1 F2) = inf (filtercomap f F1) (filtercomap f F2)" + unfolding filter_eq_iff +proof safe + fix P + assume "eventually P (filtercomap f (F1 \ F2))" + then obtain Q R S where *: + "eventually Q F1" "eventually R F2" "\x. Q x \ R x \ S x" "\x. S (f x) \ P x" + unfolding eventually_filtercomap eventually_inf by blast + from * have "eventually (\x. Q (f x)) (filtercomap f F1)" + "eventually (\x. R (f x)) (filtercomap f F2)" + by (auto simp: eventually_filtercomap) + with * show "eventually P (filtercomap f F1 \ filtercomap f F2)" + unfolding eventually_inf by blast +next + fix P + assume "eventually P (inf (filtercomap f F1) (filtercomap f F2))" + then obtain Q Q' R R' where *: + "eventually Q F1" "eventually R F2" "\x. Q (f x) \ Q' x" "\x. R (f x) \ R' x" + "\x. Q' x \ R' x \ P x" + unfolding eventually_filtercomap eventually_inf by blast + from * have "eventually (\x. Q x \ R x) (F1 \ F2)" by (auto simp: eventually_inf) + with * show "eventually P (filtercomap f (F1 \ F2))" + by (auto simp: eventually_filtercomap) +qed + +lemma filtercomap_sup: "filtercomap f (sup F1 F2) \ sup (filtercomap f F1) (filtercomap f F2)" + unfolding le_filter_def +proof safe + fix P + assume "eventually P (filtercomap f (sup F1 F2))" + thus "eventually P (sup (filtercomap f F1) (filtercomap f F2))" + by (auto simp: filter_eq_iff eventually_filtercomap eventually_sup) +qed + +lemma filtercomap_INF: "filtercomap f (INF b:B. F b) = (INF b:B. filtercomap f (F b))" +proof - + have *: "filtercomap f (INF b:B. F b) = (INF b:B. filtercomap f (F b))" if "finite B" for B + using that by induction (simp_all add: filtercomap_inf) + show ?thesis unfolding filter_eq_iff + proof + fix P + have "eventually P (INF b:B. filtercomap f (F b)) \ + (\X. (X \ B \ finite X) \ eventually P (\b\X. filtercomap f (F b)))" + by (subst eventually_INF) blast + also have "\ \ (\X. (X \ B \ finite X) \ eventually P (filtercomap f (INF b:X. F b)))" + by (rule ex_cong) (simp add: *) + also have "\ \ eventually P (filtercomap f (INFIMUM B F))" + unfolding eventually_filtercomap by (subst eventually_INF) blast + finally show "eventually P (filtercomap f (INFIMUM B F)) = + eventually P (\b\B. filtercomap f (F b))" .. + qed +qed + +lemma filtercomap_SUP_finite: + "finite B \ filtercomap f (SUP b:B. F b) \ (SUP b:B. filtercomap f (F b))" + by (induction B rule: finite_induct) + (auto intro: order_trans[OF _ order_trans[OF _ filtercomap_sup]] filtercomap_mono) + +lemma eventually_filtercomapI [intro]: + assumes "eventually P F" + shows "eventually (\x. P (f x)) (filtercomap f F)" + using assms by (auto simp: eventually_filtercomap) + +lemma filtermap_filtercomap: "filtermap f (filtercomap f F) \ F" + by (auto simp: le_filter_def eventually_filtermap eventually_filtercomap) + +lemma filtercomap_filtermap: "filtercomap f (filtermap f F) \ F" + unfolding le_filter_def eventually_filtermap eventually_filtercomap + by (auto elim!: eventually_mono) + + subsubsection \Standard filters\ definition principal :: "'a set \ 'a filter" where @@ -605,6 +715,9 @@ lemma filtermap_principal[simp]: "filtermap f (principal A) = principal (f ` A)" unfolding filter_eq_iff eventually_filtermap eventually_principal by simp + +lemma filtercomap_principal[simp]: "filtercomap f (principal A) = principal (f -` A)" + unfolding filter_eq_iff eventually_filtercomap eventually_principal by fast subsubsection \Order filters\ @@ -618,6 +731,10 @@ unfolding at_top_def by (subst eventually_INF_base) (auto simp: eventually_principal intro: max.cobounded1 max.cobounded2) +lemma eventually_filtercomap_at_top_linorder: + "eventually P (filtercomap f at_top) \ (\N::'a::linorder. \x. f x \ N \ P x)" + by (auto simp: eventually_filtercomap eventually_at_top_linorder) + lemma eventually_at_top_linorderI: fixes c::"'a::linorder" assumes "\x. c \ x \ P x" @@ -637,6 +754,10 @@ by (intro INF_eq) (auto intro: less_imp_le simp: Ici_subset_Ioi_iff gt_ex) finally show ?thesis . qed + +lemma eventually_filtercomap_at_top_dense: + "eventually P (filtercomap f at_top) \ (\N::'a::{no_top, linorder}. \x. f x > N \ P x)" + by (auto simp: eventually_filtercomap eventually_at_top_dense) lemma eventually_at_top_not_equal [simp]: "eventually (\x::'a::{no_top, linorder}. x \ c) at_top" unfolding eventually_at_top_dense by auto @@ -664,6 +785,10 @@ unfolding at_bot_def by (subst eventually_INF_base) (auto simp: eventually_principal intro: min.cobounded1 min.cobounded2) +lemma eventually_filtercomap_at_bot_linorder: + "eventually P (filtercomap f at_bot) \ (\N::'a::linorder. \x. f x \ N \ P x)" + by (auto simp: eventually_filtercomap eventually_at_bot_linorder) + lemma eventually_le_at_bot [simp]: "eventually (\x. x \ (c::_::linorder)) at_bot" unfolding eventually_at_bot_linorder by auto @@ -678,6 +803,10 @@ finally show ?thesis . qed +lemma eventually_filtercomap_at_bot_dense: + "eventually P (filtercomap f at_bot) \ (\N::'a::{no_bot, linorder}. \x. f x < N \ P x)" + by (auto simp: eventually_filtercomap eventually_at_bot_dense) + lemma eventually_at_bot_not_equal [simp]: "eventually (\x::'a::{no_bot, linorder}. x \ c) at_bot" unfolding eventually_at_bot_dense by auto @@ -1201,6 +1330,9 @@ fixes f :: "'a \ ('b::unbounded_dense_linorder)" and c :: "'b" shows "(LIM x F. f x :> at_bot) \ (\Zx. Z \ f x) F)" by (metis filterlim_at_bot filterlim_at_bot_le lt_ex order_le_less_trans) + +lemma filterlim_filtercomap [intro]: "filterlim f F (filtercomap f F)" + unfolding filterlim_def by (rule filtermap_filtercomap) subsection \Setup @{typ "'a filter"} for lifting and transfer\ @@ -1390,6 +1522,25 @@ show "rel_filter A (principal S) (principal S')" by(simp add: rel_filter_eventually eventually_principal) transfer_prover qed + +lemma filtermap_parametric [transfer_rule]: + "((A ===> B) ===> rel_filter A ===> rel_filter B) filtermap filtermap" +proof (intro rel_funI) + fix f g F G assume [transfer_rule]: "(A ===> B) f g" "rel_filter A F G" + show "rel_filter B (filtermap f F) (filtermap g G)" + unfolding rel_filter_eventually eventually_filtermap by transfer_prover +qed + +(* TODO: Are those assumptions needed? *) +lemma filtercomap_parametric [transfer_rule]: + assumes [transfer_rule]: "bi_unique B" "bi_total A" + shows "((A ===> B) ===> rel_filter B ===> rel_filter A) filtercomap filtercomap" +proof (intro rel_funI) + fix f g F G assume [transfer_rule]: "(A ===> B) f g" "rel_filter B F G" + show "rel_filter A (filtercomap f F) (filtercomap g G)" + unfolding rel_filter_eventually eventually_filtercomap by transfer_prover +qed + context fixes A :: "'a \ 'b \ bool" @@ -1443,6 +1594,7 @@ declare filterlim_principal [code] declare principal_prod_principal [code] declare filtermap_principal [code] +declare filtercomap_principal [code] declare eventually_principal [code] declare inf_principal [code] declare sup_principal [code] diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Nunchaku/Nunchaku.thy --- a/src/HOL/Nunchaku/Nunchaku.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Nunchaku/Nunchaku.thy Thu Jun 22 21:48:57 2017 +0200 @@ -11,7 +11,7 @@ The "$NUNCHAKU_HOME" environment variable must be set to the absolute path to the directory containing the "nunchaku" executable. The Isabelle components -for CVC4 and Kodkodi are necessary to use these backends. +for CVC4 and Kodkodi are necessary to use these backend solvers. *) theory Nunchaku diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Nunchaku/Tools/nunchaku.ML --- a/src/HOL/Nunchaku/Tools/nunchaku.ML Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Nunchaku/Tools/nunchaku.ML Thu Jun 22 21:48:57 2017 +0200 @@ -12,7 +12,8 @@ datatype mode = Auto_Try | Try | Normal type mode_of_operation_params = - {falsify: bool, + {solvers: string list, + falsify: bool, assms: bool, spy: bool, overlord: bool, @@ -74,7 +75,8 @@ datatype mode = Auto_Try | Try | Normal; type mode_of_operation_params = - {falsify: bool, + {solvers: string list, + falsify: bool, assms: bool, spy: bool, overlord: bool, @@ -138,7 +140,7 @@ val timeout_slack = seconds 1.0; fun run_chaku_on_prop state - ({mode_of_operation_params = {falsify, assms, spy, overlord, expect}, + ({mode_of_operation_params = {solvers, falsify, assms, spy, overlord, expect}, scope_of_search_params = {wfs, whacks, cards, monos}, output_format_params = {verbose, debug, evals, atomss, ...}, optimization_params = {specialize, ...}, @@ -157,8 +159,9 @@ val das_wort_Model = if falsify then "Countermodel" else "Model"; val das_wort_model = if falsify then "countermodel" else "model"; - val tool_params = {overlord = overlord, debug = debug, specialize = specialize, - timeout = timeout}; + val tool_params = + {solvers = solvers, overlord = overlord, debug = debug, specialize = specialize, + timeout = timeout}; fun run () = let diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Nunchaku/Tools/nunchaku_commands.ML --- a/src/HOL/Nunchaku/Tools/nunchaku_commands.ML Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Nunchaku/Tools/nunchaku_commands.ML Thu Jun 22 21:48:57 2017 +0200 @@ -27,6 +27,7 @@ ("max_genuine", "1"), ("max_potential", "1"), ("overlord", "false"), + ("solvers", "cvc4 kodkod paradox smbc"), ("specialize", "true"), ("spy", "false"), ("timeout", "30"), @@ -100,6 +101,7 @@ val raw_lookup = AList.lookup (op =) raw_params; val lookup = Option.map stringify_raw_param_value o raw_lookup; val lookup_string = the_default "" o lookup; + val lookup_strings = these o Option.map (space_explode " ") o lookup; fun general_lookup_bool option default_value name = (case lookup name of @@ -161,28 +163,33 @@ Const x => x | t => error ("Not a constant: " ^ Syntax.string_of_term ctxt t)); + val solvers = lookup_strings "solvers"; + val falsify = lookup_bool "falsify"; + val assms = lookup_bool "assms"; + val spy = getenv "NUNCHAKU_SPY" = "yes" orelse lookup_bool "spy"; + val overlord = lookup_bool "overlord"; + val expect = lookup_string "expect"; + val wfs = lookup_bool_option_assigns read_const_polymorphic "wf"; val whacks = lookup_bool_assigns read_term_polymorphic "whack"; val cards = lookup_int_range_assigns read_type_polymorphic "card"; val monos = lookup_bool_option_assigns read_type_polymorphic "mono"; - val falsify = lookup_bool "falsify"; + val debug = (mode <> Auto_Try andalso lookup_bool "debug"); val verbose = debug orelse (mode <> Auto_Try andalso lookup_bool "verbose"); - val overlord = lookup_bool "overlord"; - val spy = getenv "NUNCHAKU_SPY" = "yes" orelse lookup_bool "spy"; - val assms = lookup_bool "assms"; + val max_potential = if mode = Normal then Int.max (0, lookup_int "max_potential") else 0; + val max_genuine = Int.max (0, lookup_int "max_genuine"); + val evals = these (lookup_term_list_option_polymorphic "eval"); + val atomss = lookup_strings_assigns read_type_polymorphic "atoms"; + val specialize = lookup_bool "specialize"; + val multithread = mode = Normal andalso lookup_bool "multithread"; + val timeout = lookup_time "timeout"; val wf_timeout = lookup_time "wf_timeout"; - val multithread = mode = Normal andalso lookup_bool "multithread"; - val evals = these (lookup_term_list_option_polymorphic "eval"); - val atomss = lookup_strings_assigns read_type_polymorphic "atoms"; - val max_potential = if mode = Normal then Int.max (0, lookup_int "max_potential") else 0; - val max_genuine = Int.max (0, lookup_int "max_genuine"); - val expect = lookup_string "expect"; val mode_of_operation_params = - {falsify = falsify, assms = assms, spy = spy, overlord = overlord, + {solvers = solvers, falsify = falsify, assms = assms, spy = spy, overlord = overlord, expect = expect}; val scope_of_search_params = diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Nunchaku/Tools/nunchaku_tool.ML --- a/src/HOL/Nunchaku/Tools/nunchaku_tool.ML Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Nunchaku/Tools/nunchaku_tool.ML Thu Jun 22 21:48:57 2017 +0200 @@ -12,7 +12,8 @@ type nun_problem = Nunchaku_Problem.nun_problem type tool_params = - {overlord: bool, + {solvers: string list, + overlord: bool, debug: bool, specialize: bool, timeout: Time.time} @@ -45,7 +46,8 @@ open Nunchaku_Problem; type tool_params = - {overlord: bool, + {solvers: string list, + overlord: bool, debug: bool, specialize: bool, timeout: Time.time}; @@ -73,10 +75,10 @@ val nunchaku_home_env_var = "NUNCHAKU_HOME"; -val cached_outcome = - Synchronized.var "Nunchaku_Tool.cached_outcome" (NONE : (nun_problem * nun_outcome) option); +val cached_outcome = Synchronized.var "Nunchaku_Tool.cached_outcome" + (NONE : ((string list * nun_problem) * nun_outcome) option); -fun uncached_solve_nun_problem ({overlord, specialize, timeout, ...} : tool_params) +fun uncached_solve_nun_problem ({solvers, overlord, specialize, timeout, ...} : tool_params) (problem as {sound, complete, ...}) = with_tmp_or_overlord_file overlord "nunchaku" "nun" (fn prob_path => if getenv nunchaku_home_env_var = "" then @@ -87,6 +89,7 @@ "PATH=\"$CVC4_HOME:$KODKODI/bin:$PATH\" \"$" ^ nunchaku_home_env_var ^ "\"/nunchaku --skolems-in-model --no-color " ^ (if specialize then "" else "--no-specialize ") ^ + "--solvers \"" ^ Bash_Syntax.string (space_implode " " solvers) ^ "\" " ^ "--timeout " ^ string_of_int (Time.toSeconds timeout) ^ " " ^ File.bash_path prob_path; val comments = @@ -114,23 +117,25 @@ simplify_spaces (elide_string 1000 (if error <> "" then error else output))) end); -fun solve_nun_problem (params as {overlord, debug, ...}) problem = - (case (overlord orelse debug, - AList.lookup (op =) (the_list (Synchronized.value cached_outcome)) problem) of - (false, SOME outcome) => outcome - | _ => - let - val outcome = uncached_solve_nun_problem params problem; +fun solve_nun_problem (params as {solvers, overlord, debug, ...}) problem = + let val key = (solvers, problem) in + (case (overlord orelse debug, + AList.lookup (op =) (the_list (Synchronized.value cached_outcome)) key) of + (false, SOME outcome) => outcome + | _ => + let + val outcome = uncached_solve_nun_problem params problem; - fun update_cache () = - Synchronized.change cached_outcome (K (SOME (problem, outcome))); - in - (case outcome of - Unsat => update_cache () - | Sat _ => update_cache () - | Unknown _ => update_cache () - | _ => ()); - outcome - end); + fun update_cache () = + Synchronized.change cached_outcome (K (SOME (key, outcome))); + in + (case outcome of + Unsat => update_cache () + | Sat _ => update_cache () + | Unknown _ => update_cache () + | _ => ()); + outcome + end) + end; end; diff -r 8cfa8c7ee1f6 -r cad55bc7e37d src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Thu Jun 22 21:44:15 2017 +0200 +++ b/src/HOL/Topological_Spaces.thy Thu Jun 22 21:48:57 2017 +0200 @@ -662,6 +662,17 @@ shows "eventually P (at_right a)" using assms unfolding eventually_at_topological by (intro exI[of _ "{.. (\S. open S \ x \ S \ (\x. f x \ S \ P x))" + unfolding eventually_filtercomap eventually_nhds by auto + +lemma eventually_filtercomap_at_topological: + "eventually P (filtercomap f (at A within B)) \ + (\S. open S \ A \ S \ (\x. f x \ S \ B - {A} \ P x))" (is "?lhs = ?rhs") + unfolding at_within_def filtercomap_inf eventually_inf_principal filtercomap_principal + eventually_filtercomap_nhds eventually_principal by blast + + subsubsection \Tendsto\