# HG changeset patch # User paulson # Date 1537449491 -3600 # Node ID 4dee7d3267033e5187fd905440ee3cb941cfc8ee # Parent a6ba77af64862a030e526a7b1681b377abd53ca1# Parent 4f94e262976d6dc61b93b01aa821fcc82098b10a merged diff -r a6ba77af6486 -r 4dee7d326703 src/HOL/Analysis/Derivative.thy --- a/src/HOL/Analysis/Derivative.thy Wed Sep 19 22:18:36 2018 +0200 +++ b/src/HOL/Analysis/Derivative.thy Thu Sep 20 14:18:11 2018 +0100 @@ -482,9 +482,7 @@ by (metis Derivative.differentiableI frechet_derivative_unique_within_closed_interval frechet_derivative_works) -subsection \The traditional Rolle theorem in one dimension\ - -text \Derivatives of local minima and maxima are zero.\ +subsection \Derivatives of local minima and maxima are zero.\ lemma has_derivative_local_min: fixes f :: "'a::real_normed_vector \ real" @@ -544,7 +542,7 @@ by (rule has_derivative_local_min) qed -lemma differential_zero_maxmin_component: (* TODO: delete? *) +lemma differential_zero_maxmin_component: fixes f :: "'a::euclidean_space \ 'b::euclidean_space" assumes k: "k \ Basis" and ball: "0 < e" "(\y \ ball x e. (f y)\k \ (f x)\k) \ (\y\ball x e. (f x)\k \ (f y)\k)" @@ -563,78 +561,8 @@ unfolding fun_eq_iff by simp qed -theorem Rolle: - fixes f :: "real \ real" - assumes "a < b" - and fab: "f a = f b" - and contf: "continuous_on {a..b} f" - and derf: "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" - shows "\x\{a <..< b}. f' x = (\v. 0)" -proof - - have "\x\box a b. (\y\box a b. f x \ f y) \ (\y\box a b. f y \ f x)" - proof - - have "(a + b) / 2 \ {a..b}" - using assms(1) by auto - then have *: "{a..b} \ {}" - by auto - obtain d where d: "d \cbox a b" "\y\cbox a b. f y \ f d" - using continuous_attains_sup[OF compact_Icc * contf] by auto - obtain c where c: "c \ cbox a b" "\y\cbox a b. f c \ f y" - using continuous_attains_inf[OF compact_Icc * contf] by auto - show ?thesis - proof (cases "d \ box a b \ c \ box a b") - case True - then show ?thesis - by (metis c(2) d(2) box_subset_cbox subset_iff) - next - define e where "e = (a + b) /2" - case False - then have "f d = f c" - using d c fab by auto - with c d have "\x. x \ {a..b} \ f x = f d" - by force - then show ?thesis - by (rule_tac x=e in bexI) (auto simp: e_def \a < b\) - qed - qed - then obtain x where x: "x \ {a <..< b}" "(\y\{a <..< b}. f x \ f y) \ (\y\{a <..< b}. f y \ f x)" - by auto - then have "f' x = (\v. 0)" - apply (rule_tac differential_zero_maxmin[of x "box a b" f "f' x"]) - using assms - apply auto - done - then show ?thesis - by (metis x(1)) -qed - - subsection \One-dimensional mean value theorem\ -theorem mvt: - fixes f :: "real \ real" - assumes "a < b" - and contf: "continuous_on {a..b} f" - and derf: "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" - shows "\x\{a<..x\{a <..< b}. (\xa. f' x xa - (f b - f a) / (b - a) * xa) = (\v. 0)" - proof (intro Rolle[OF \a < b\, of "\x. f x - (f b - f a) / (b - a) * x"] ballI) - fix x - assume x: "a < x" "x < b" - show "((\x. f x - (f b - f a) / (b - a) * x) has_derivative - (\xa. f' x xa - (f b - f a) / (b - a) * xa)) (at x)" - by (intro derivative_intros derf[OF x]) - qed (use assms in \auto intro!: continuous_intros simp: field_simps\) - then obtain x where - "x \ {a <..< b}" - "(\xa. f' x xa - (f b - f a) / (b - a) * xa) = (\v. 0)" .. - then show ?thesis - by (metis (hide_lams) assms(1) diff_gt_0_iff_gt eq_iff_diff_eq_0 - zero_less_mult_iff nonzero_mult_div_cancel_right not_real_square_gt_zero - times_divide_eq_left) -qed - lemma mvt_simple: fixes f :: "real \ real" assumes "a < b" @@ -647,7 +575,7 @@ by (rule differentiable_imp_continuous_on) show "(f has_derivative f' x) (at x)" if "a < x" "x < b" for x by (metis at_within_Icc_at derf leI order.asym that) -qed (rule assms) +qed (use assms in auto) lemma mvt_very_simple: fixes f :: "real \ real" @@ -677,9 +605,9 @@ shows "\x\{a<.. norm (f' x (b - a))" proof - have "\x\{a<.. f b - (f b - f a) \ f a = (f b - f a) \ f' x (b - a)" - apply (rule mvt [OF \a < b\]) + apply (rule mvt [OF \a < b\, where f = "\x. (f b - f a) \ f x"]) apply (intro continuous_intros contf) - using derf apply (blast intro: has_derivative_inner_right) + using derf apply (auto intro: has_derivative_inner_right) done then obtain x where x: "x \ {a<.. f b - (f b - f a) \ f a = (f b - f a) \ f' x (b - a)" .. diff -r a6ba77af6486 -r 4dee7d326703 src/HOL/Complete_Lattices.thy --- a/src/HOL/Complete_Lattices.thy Wed Sep 19 22:18:36 2018 +0200 +++ b/src/HOL/Complete_Lattices.thy Thu Sep 20 14:18:11 2018 +0100 @@ -1180,6 +1180,10 @@ lemma Int_Inter_image: "(\x\C. A x \ B x) = \(A ` C) \ \(B ` C)" (* FIXME drop *) by (simp add: INT_Int_distrib) +lemma Int_Inter_eq: "A \ \\ = (if \={} then A else (\B\\. A \ B))" + "\\ \ A = (if \={} then A else (\B\\. B \ A))" + by auto + lemma Un_Union_image: "(\x\C. A x \ B x) = \(A ` C) \ \(B ` C)" (* FIXME drop *) \ \Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5:\ \ \Union of a family of unions\ diff -r a6ba77af6486 -r 4dee7d326703 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Wed Sep 19 22:18:36 2018 +0200 +++ b/src/HOL/Deriv.thy Thu Sep 20 14:18:11 2018 +0100 @@ -870,6 +870,11 @@ corollary DERIV_isCont: "DERIV f x :> D \ isCont f x" by (rule DERIV_continuous) +lemma DERIV_atLeastAtMost_imp_continuous_on: + assumes "\x. \a \ x; x \ b\ \ \y. DERIV f x :> y" + shows "continuous_on {a..b} f" + by (meson DERIV_isCont assms atLeastAtMost_iff continuous_at_imp_continuous_at_within continuous_on_eq_continuous_within) + lemma DERIV_continuous_on: "(\x. x \ s \ (f has_field_derivative (D x)) (at x within s)) \ continuous_on s f" unfolding continuous_on_eq_continuous_within @@ -1280,62 +1285,67 @@ \[a,b]\ and differentiable on the open interval \(a,b)\, and @{term "f a = f b"}, then there exists \x0 \ (a,b)\ such that @{term "f' x0 = 0"}\ -theorem Rolle: - fixes a b :: real - assumes lt: "a < b" - and eq: "f a = f b" - and con: "\x. a \ x \ x \ b \ isCont f x" - and dif [rule_format]: "\x. a < x \ x < b \ f differentiable (at x)" - shows "\z. a < z \ z < b \ DERIV f z :> 0" +theorem Rolle_deriv: + fixes f :: "real \ real" + assumes "a < b" + and fab: "f a = f b" + and contf: "continuous_on {a..b} f" + and derf: "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" + shows "\z. a < z \ z < b \ f' z = (\v. 0)" proof - have le: "a \ b" - using lt by simp - from isCont_eq_Ub [OF le con] + using \a < b\ by simp + have "(a + b) / 2 \ {a..b}" + using assms(1) by auto + then have *: "{a..b} \ {}" + by auto obtain x where x_max: "\z. a \ z \ z \ b \ f z \ f x" and "a \ x" "x \ b" - by blast - from isCont_eq_Lb [OF le con] + using continuous_attains_sup[OF compact_Icc * contf] + by (meson atLeastAtMost_iff) obtain x' where x'_min: "\z. a \ z \ z \ b \ f x' \ f z" and "a \ x'" "x' \ b" - by blast + using continuous_attains_inf[OF compact_Icc * contf] by (meson atLeastAtMost_iff) consider "a < x" "x < b" | "x = a \ x = b" using \a \ x\ \x \ b\ by arith then show ?thesis proof cases case 1 \ \@{term f} attains its maximum within the interval\ + then obtain l where der: "DERIV f x :> l" + using derf differentiable_def real_differentiable_def by blast obtain d where d: "0 < d" and bound: "\y. \x - y\ < d \ a \ y \ y \ b" using lemma_interval [OF 1] by blast then have bound': "\y. \x - y\ < d \ f y \ f x" using x_max by blast - obtain l where der: "DERIV f x :> l" - using differentiableD [OF dif [OF conjI [OF 1]]] .. \ \the derivative at a local maximum is zero\ have "l = 0" by (rule DERIV_local_max [OF der d bound']) - with 1 der show ?thesis by auto + with 1 der derf [of x] show ?thesis + by (metis has_derivative_unique has_field_derivative_def mult_zero_left) next case 2 - then have fx: "f b = f x" by (auto simp add: eq) + then have fx: "f b = f x" by (auto simp add: fab) consider "a < x'" "x' < b" | "x' = a \ x' = b" using \a \ x'\ \x' \ b\ by arith then show ?thesis proof cases case 1 \ \@{term f} attains its minimum within the interval\ + then obtain l where der: "DERIV f x' :> l" + using derf differentiable_def real_differentiable_def by blast from lemma_interval [OF 1] obtain d where d: "0y. \x'-y\ < d \ a \ y \ y \ b" by blast then have bound': "\y. \x' - y\ < d \ f x' \ f y" using x'_min by blast - from differentiableD [OF dif [OF conjI [OF 1]]] - obtain l where der: "DERIV f x' :> l" .. have "l = 0" by (rule DERIV_local_min [OF der d bound']) \ \the derivative at a local minimum is zero\ - then show ?thesis using 1 der by auto + then show ?thesis using 1 der derf [of x'] + by (metis has_derivative_unique has_field_derivative_def mult_zero_left) next case 2 \ \@{term f} is constant throughout the interval\ - then have fx': "f b = f x'" by (auto simp: eq) - from dense [OF lt] obtain r where r: "a < r" "r < b" by blast + then have fx': "f b = f x'" by (auto simp: fab) + from dense [OF \a < b\] obtain r where r: "a < r" "r < b" by blast obtain d where d: "0 < d" and bound: "\y. \r - y\ < d \ a \ y \ y \ b" using lemma_interval [OF r] by blast have eq_fb: "f z = f b" if "a \ z" and "z \ b" for z @@ -1351,55 +1361,68 @@ then show "f r = f y" by (simp add: eq_fb r order_less_imp_le) qed obtain l where der: "DERIV f r :> l" - using differentiableD [OF dif [OF conjI [OF r]]] .. + using derf differentiable_def r(1) r(2) real_differentiable_def by blast have "l = 0" by (rule DERIV_local_const [OF der d bound']) \ \the derivative of a constant function is zero\ - with r der show ?thesis by auto + with r der derf [of r] show ?thesis + by (metis has_derivative_unique has_field_derivative_def mult_zero_left) qed qed qed +corollary Rolle: + fixes a b :: real + assumes ab: "a < b" "f a = f b" "continuous_on {a..b} f" + and dif [rule_format]: "\x. a < x \ x < b \ f differentiable (at x)" + shows "\z. a < z \ z < b \ DERIV f z :> 0" +proof - + obtain f' where f': "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" + using dif unfolding differentiable_def by metis + then have "\z. a < z \ z < b \ f' z = (\v. 0)" + by (metis Rolle_deriv [OF ab]) + then show ?thesis + using f' has_derivative_imp_has_field_derivative by fastforce +qed subsection \Mean Value Theorem\ -lemma lemma_MVT: "f a - (f b - f a) / (b - a) * a = f b - (f b - f a) / (b - a) * b" - for a b :: real - by (cases "a = b") (simp_all add: field_simps) +theorem mvt: + fixes f :: "real \ real" + assumes "a < b" + and contf: "continuous_on {a..b} f" + and derf: "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" + obtains z where "a < z" "z < b" "f b - f a = (f' z) (b - a)" +proof - + have "\x. a < x \ x < b \ (\y. f' x y - (f b - f a) / (b - a) * y) = (\v. 0)" + proof (intro Rolle_deriv[OF \a < b\]) + fix x + assume x: "a < x" "x < b" + show "((\x. f x - (f b - f a) / (b - a) * x) has_derivative + (\xa. f' x xa - (f b - f a) / (b - a) * xa)) (at x)" + by (intro derivative_intros derf[OF x]) + qed (use assms in \auto intro!: continuous_intros simp: field_simps\) + then obtain x where + "a < x" "x < b" + "(\y. f' x y - (f b - f a) / (b - a) * y) = (\v. 0)" by metis + then show ?thesis + by (metis (no_types, hide_lams) that add.right_neutral add_diff_cancel_left' add_diff_eq \a < b\ + less_irrefl nonzero_eq_divide_eq) +qed theorem MVT: fixes a b :: real assumes lt: "a < b" - and con: "\x. \a \ x; x \ b\ \ isCont f x" + and contf: "continuous_on {a..b} f" and dif: "\x. \a < x; x < b\ \ f differentiable (at x)" shows "\l z. a < z \ z < b \ DERIV f z :> l \ f b - f a = (b - a) * l" proof - - let ?F = "\x. f x - ((f b - f a) / (b - a)) * x" - have cont_f: "\x. a \ x \ x \ b \ isCont ?F x" - using con by (fast intro: continuous_intros) - have dif_f: "\x. a < x \ x < b \ ?F differentiable (at x)" - proof clarify - fix x :: real - assume x: "a < x" "x < b" - obtain l where der: "DERIV f x :> l" - using differentiableD [OF dif] x by blast - show "?F differentiable (at x)" - by (rule differentiableI [where D = "l - (f b - f a) / (b - a)"], - blast intro: DERIV_diff DERIV_cmult_Id der) - qed - from Rolle [where f = ?F, OF lt lemma_MVT cont_f dif_f] - obtain z where z: "a < z" "z < b" and der: "DERIV ?F z :> 0" - by blast - have "DERIV (\x. ((f b - f a) / (b - a)) * x) z :> (f b - f a) / (b - a)" - by (rule DERIV_cmult_Id) - then have der_f: "DERIV (\x. ?F x + (f b - f a) / (b - a) * x) z :> 0 + (f b - f a) / (b - a)" - by (rule DERIV_add [OF der]) - show ?thesis - proof (intro exI conjI) - show "a < z" and "z < b" using z . - show "f b - f a = (b - a) * ((f b - f a) / (b - a))" by simp - show "DERIV f z :> ((f b - f a) / (b - a))" using der_f by simp - qed + obtain f' where derf: "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" + using dif unfolding differentiable_def by metis + then obtain z where "a < z" "z < b" "f b - f a = (f' z) (b - a)" + using mvt [OF lt contf] by blast + then show ?thesis + by (metis derf dif has_derivative_unique has_field_derivative_imp_has_derivative linordered_field_class.sign_simps(5) real_differentiable_def) qed corollary MVT2: @@ -1411,8 +1434,8 @@ (f has_real_derivative l) (at z) \ f b - f a = (b - a) * l" proof (rule MVT [OF \a < b\]) - show "\x. \a \ x; x \ b\ \ isCont f x" - using assms by (blast intro: DERIV_isCont) + show "continuous_on {a..b} f" + by (meson DERIV_continuous atLeastAtMost_iff continuous_at_imp_continuous_on der) show "\x. \a < x; x < b\ \ f differentiable (at x)" using assms by (force dest: order_less_imp_le simp add: real_differentiable_def) qed @@ -1439,21 +1462,24 @@ lemma DERIV_isconst_end: fixes f :: "real \ real" - assumes "a < b" and contf: "\x. \a \ x; x \ b\ \ isCont f x" + assumes "a < b" and contf: "continuous_on {a..b} f" and 0: "\x. \a < x; x < b\ \ DERIV f x :> 0" shows "f b = f a" - using MVT [OF \a < b\] "0" DERIV_unique contf real_differentiable_def by fastforce + using MVT [OF \a < b\] "0" DERIV_unique contf real_differentiable_def + by (fastforce simp: algebra_simps) lemma DERIV_isconst2: fixes f :: "real \ real" - assumes "a < b" "\x. \a \ x; x \ b\ \ isCont f x" "\x. \a < x; x < b\ \ DERIV f x :> 0" + assumes "a < b" and contf: "continuous_on {a..b} f" and derf: "\x. \a < x; x < b\ \ DERIV f x :> 0" and "a \ x" "x \ b" shows "f x = f a" -proof (cases "x=a") - case False +proof (cases "a < x") + case True + have *: "continuous_on {a..x} f" + using \x \ b\ contf continuous_on_subset by fastforce show ?thesis - by (rule DERIV_isconst_end [where f=f]) (use False assms in auto) -qed auto + by (rule DERIV_isconst_end [OF True *]) (use \x \ b\ derf in auto) +qed (use \a \ x\ in auto) lemma DERIV_isconst3: fixes a b x y :: real @@ -1466,18 +1492,17 @@ case False let ?a = "min x y" let ?b = "max x y" - - have "DERIV f z :> 0" if "?a \ z" "z \ ?b" for z + have *: "DERIV f z :> 0" if "?a \ z" "z \ ?b" for z proof - have "a < z" and "z < b" using that \x \ {a <..< b}\ and \y \ {a <..< b}\ by auto then have "z \ {a<.. 0" by (rule derivable) qed - then have isCont: "\z. \?a \ z; z \ ?b\ \ isCont f z" - and DERIV: "\z. \?a < z; z < ?b\ \ DERIV f z :> 0" - using DERIV_isCont by auto - + have isCont: "continuous_on {?a..?b} f" + by (meson * DERIV_continuous_on atLeastAtMost_iff has_field_derivative_at_within) + have DERIV: "\z. \?a < z; z < ?b\ \ DERIV f z :> 0" + using * by auto have "?a < ?b" using \x \ y\ by auto from DERIV_isconst2[OF this isCont DERIV, of x] and DERIV_isconst2[OF this isCont DERIV, of y] show ?thesis by auto @@ -1487,7 +1512,7 @@ fixes f :: "real \ real" shows "\x. DERIV f x :> 0 \ f x = f y" apply (rule linorder_cases [of x y]) - apply (blast intro: sym DERIV_isCont DERIV_isconst_end)+ + apply (metis DERIV_continuous DERIV_isconst_end continuous_at_imp_continuous_on)+ done lemma DERIV_const_ratio_const: @@ -1497,12 +1522,15 @@ proof (cases a b rule: linorder_cases) case less show ?thesis - using MVT [OF less] df by (auto dest: DERIV_isCont DERIV_unique simp: real_differentiable_def) + using MVT [OF less] df + by (metis DERIV_continuous DERIV_unique continuous_at_imp_continuous_on differentiableI) next case greater - show ?thesis + have "f a - f b = (a - b) * k" using MVT [OF greater] df - by (fastforce dest: DERIV_continuous DERIV_unique simp: real_differentiable_def algebra_simps) + by (metis DERIV_continuous DERIV_unique continuous_at_imp_continuous_on differentiableI) + then show ?thesis + by (simp add: algebra_simps) qed auto lemma DERIV_const_ratio_const2: @@ -1559,7 +1587,7 @@ and f :: "real \ real" assumes "a < b" and "\x. a < x \ x < b \ (\y. DERIV f x :> y \ y > 0)" - and con: "\x. a \ x \ x \ b \ isCont f x" + and con: "continuous_on {a..b} f" shows "f a < f b" proof (rule ccontr) assume f: "\ ?thesis" @@ -1574,12 +1602,11 @@ qed lemma DERIV_pos_imp_increasing: - fixes a b :: real - and f :: "real \ real" + fixes a b :: real and f :: "real \ real" assumes "a < b" - and "\x. a \ x \ x \ b \ (\y. DERIV f x :> y \ y > 0)" + and der: "\x. \a \ x; x \ b\ \ \y. DERIV f x :> y \ y > 0" shows "f a < f b" - by (metis DERIV_pos_imp_increasing_open [of a b f] assms DERIV_continuous less_imp_le) + by (metis less_le_not_le DERIV_atLeastAtMost_imp_continuous_on DERIV_pos_imp_increasing_open [OF \a < b\] der) lemma DERIV_nonneg_imp_nondecreasing: fixes a b :: real @@ -1595,9 +1622,10 @@ assume "a \ b" with \a \ b\ have "a < b" by linarith - with assms have "\l z. a < z \ z < b \ DERIV f z :> l \ f b - f a = (b - a) * l" - by (metis (no_types) not_le not_less_iff_gr_or_eq - MVT [OF \a < b\, of f] DERIV_isCont [of f] differentiableI) + moreover have "continuous_on {a..b} f" + by (meson DERIV_isCont assms(2) atLeastAtMost_iff continuous_at_imp_continuous_on) + ultimately have "\l z. a < z \ z < b \ DERIV f z :> l \ f b - f a = (b - a) * l" + using assms MVT [OF \a < b\, of f] differentiableI less_eq_real_def by blast then obtain l z where lz: "a < z" "z < b" "DERIV f z :> l" and **: "f b - f a = (b - a) * l" by auto with * have "a < b" "f b < f a" by auto @@ -1612,7 +1640,7 @@ and f :: "real \ real" assumes "a < b" and "\x. a < x \ x < b \ \y. DERIV f x :> y \ y < 0" - and con: "\x. a \ x \ x \ b \ isCont f x" + and con: "continuous_on {a..b} f" shows "f a > f b" proof - have "(\x. -f x) a < (\x. -f x) b" @@ -1620,18 +1648,19 @@ show "\x. \a < x; x < b\ \ \y. ((\x. - f x) has_real_derivative y) (at x) \ 0 < y" using assms by simp (metis field_differentiable_minus neg_0_less_iff_less) + show "continuous_on {a..b} (\x. - f x)" + using con continuous_on_minus by blast qed (use assms in auto) then show ?thesis by simp qed lemma DERIV_neg_imp_decreasing: - fixes a b :: real - and f :: "real \ real" + fixes a b :: real and f :: "real \ real" assumes "a < b" - and "\x. \a \ x; x \ b\ \ \y. DERIV f x :> y \ y < 0" + and der: "\x. \a \ x; x \ b\ \ \y. DERIV f x :> y \ y < 0" shows "f a > f b" - by (metis DERIV_neg_imp_decreasing_open [of a b f] assms DERIV_continuous less_imp_le) + by (metis less_le_not_le DERIV_atLeastAtMost_imp_continuous_on DERIV_neg_imp_decreasing_open [OF \a < b\] der) lemma DERIV_nonpos_imp_nonincreasing: fixes a b :: real @@ -1734,8 +1763,8 @@ have "\l z. a < z \ z < b \ DERIV ?h z :> l \ ?h b - ?h a = (b - a) * l" proof (rule MVT) from assms show "a < b" by simp - show "\x. \a \ x; x \ b\ \ isCont ?h x" - using fc gc by simp + show "continuous_on {a..b} ?h" + by (simp add: continuous_at_imp_continuous_on fc gc) show "\x. \a < x; x < b\ \ ?h differentiable (at x)" using fd gd by simp qed diff -r a6ba77af6486 -r 4dee7d326703 src/HOL/MacLaurin.thy --- a/src/HOL/MacLaurin.thy Wed Sep 19 22:18:36 2018 +0200 +++ b/src/HOL/MacLaurin.thy Thu Sep 20 14:18:11 2018 +0100 @@ -109,8 +109,8 @@ show "0 < h" by fact show "difg 0 0 = difg 0 h" by (simp add: difg_0 g2) - show "\x. 0 \ x \ x \ h \ isCont (difg (0::nat)) x" - by (simp add: isCont_difg n) + show "continuous_on {0..h} (difg 0)" + by (simp add: continuous_at_imp_continuous_on isCont_difg n) show "\x. 0 < x \ x < h \ difg (0::nat) differentiable (at x)" by (simp add: differentiable_difg n) qed @@ -125,8 +125,10 @@ show "0 < t" by fact show "difg (Suc m') 0 = difg (Suc m') t" using t \Suc m' < n\ by (simp add: difg_Suc_eq_0 difg_eq_0) - show "\x. 0 \ x \ x \ t \ isCont (difg (Suc m')) x" + have "\x. 0 \ x \ x \ t \ isCont (difg (Suc m')) x" using \t < h\ \Suc m' < n\ by (simp add: isCont_difg) + then show "continuous_on {0..t} (difg (Suc m'))" + by (simp add: continuous_at_imp_continuous_on) show "\x. 0 < x \ x < t \ difg (Suc m') differentiable (at x)" using \t < h\ \Suc m' < n\ by (simp add: differentiable_difg) qed diff -r a6ba77af6486 -r 4dee7d326703 src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Wed Sep 19 22:18:36 2018 +0200 +++ b/src/HOL/Transcendental.thy Thu Sep 20 14:18:11 2018 +0100 @@ -2222,7 +2222,7 @@ assume "x < 1" from dense[OF \x < 1\] obtain a where "x < a" "a < 1" by blast from \x < a\ have "?l x < ?l a" - proof (rule DERIV_pos_imp_increasing, safe) + proof (rule DERIV_pos_imp_increasing) fix y assume "x \ y" "y \ a" with \0 < x\ \a < 1\ have "0 < 1 / y - 1" "0 < y" @@ -3293,10 +3293,16 @@ for x :: "'a::{real_normed_field,banach}" by (rule DERIV_sin [THEN DERIV_isCont]) +lemma continuous_on_sin_real: "continuous_on {a..b} sin" for a::real + using continuous_at_imp_continuous_on isCont_sin by blast + lemma isCont_cos: "isCont cos x" for x :: "'a::{real_normed_field,banach}" by (rule DERIV_cos [THEN DERIV_isCont]) +lemma continuous_on_cos_real: "continuous_on {a..b} cos" for a::real + using continuous_at_imp_continuous_on isCont_cos by blast + lemma isCont_sin' [simp]: "isCont f a \ isCont (\x. sin (f x)) a" for f :: "_ \ 'a::{real_normed_field,banach}" by (rule isCont_o2 [OF _ isCont_sin]) @@ -3323,7 +3329,7 @@ for f :: "_ \ 'a::{real_normed_field,banach}" unfolding continuous_on_def by (auto intro: tendsto_sin) -lemma continuous_within_sin: "continuous (at z within s) sin" +lemma continuous_within_sin: "continuous (at z within s) sin" for z :: "'a::{real_normed_field,banach}" by (simp add: continuous_within tendsto_sin) @@ -3710,7 +3716,7 @@ proof (cases a b rule: linorder_cases) case less then obtain z where "a < z" "z < b" "(cos has_real_derivative 0) (at z)" - using Rolle by (metis cosd isCont_cos ab) + using Rolle by (metis cosd continuous_on_cos_real ab) then have "sin z = 0" using DERIV_cos DERIV_unique neg_equal_0_iff_equal by blast then show ?thesis @@ -3718,7 +3724,7 @@ next case greater then obtain z where "b < z" "z < a" "(cos has_real_derivative 0) (at z)" - using Rolle by (metis cosd isCont_cos ab) + using Rolle by (metis cosd continuous_on_cos_real ab) then have "sin z = 0" using DERIV_cos DERIV_unique neg_equal_0_iff_equal by blast then show ?thesis @@ -4019,7 +4025,7 @@ proof (cases a b rule: linorder_cases) case less then obtain z where "a < z" "z < b" "(cos has_real_derivative 0) (at z)" - using Rolle by (metis cosd isCont_cos ab) + using Rolle by (metis cosd continuous_on_cos_real ab) then have "sin z = 0" using DERIV_cos DERIV_unique neg_equal_0_iff_equal by blast then show ?thesis @@ -4027,7 +4033,7 @@ next case greater then obtain z where "b < z" "z < a" "(cos has_real_derivative 0) (at z)" - using Rolle by (metis cosd isCont_cos ab) + using Rolle by (metis cosd continuous_on_cos_real ab) then have "sin z = 0" using DERIV_cos DERIV_unique neg_equal_0_iff_equal by blast then show ?thesis @@ -4639,7 +4645,9 @@ proof (cases u v rule: linorder_cases) case less have "\x. u \ x \ x \ v \ isCont tan x" - by (metis cos_gt_zero_pi isCont_tan less_numeral_extra(3) less_trans order.not_eq_order_implies_strict u v) + by (metis cos_gt_zero_pi isCont_tan le_less_trans less_irrefl less_le_trans u(1) v(2)) + then have "continuous_on {u..v} tan" + by (simp add: continuous_at_imp_continuous_on) moreover have "\x. u < x \ x < v \ tan differentiable (at x)" by (metis DERIV_tan cos_gt_zero_pi differentiableI less_numeral_extra(3) order.strict_trans u(1) v(2)) ultimately obtain z where "u < z" "z < v" "DERIV tan z :> 0" @@ -4651,13 +4659,15 @@ next case greater have "\x. v \ x \ x \ u \ isCont tan x" - by (metis cos_gt_zero_pi isCont_tan less_numeral_extra(3) less_trans order.not_eq_order_implies_strict u v) + by (metis cos_gt_zero_pi isCont_tan le_less_trans less_irrefl less_le_trans u(2) v(1)) + then have "continuous_on {v..u} tan" + by (simp add: continuous_at_imp_continuous_on) moreover have "\x. v < x \ x < u \ tan differentiable (at x)" by (metis DERIV_tan cos_gt_zero_pi differentiableI less_numeral_extra(3) order.strict_trans u(2) v(1)) ultimately obtain z where "v < z" "z < u" "DERIV tan z :> 0" by (metis greater Rolle eq) moreover have "cos z \ 0" - by (metis \v < z\ \z < u\ cos_gt_zero_pi less_le_trans linorder_not_less not_less_iff_gr_or_eq u(2) v(1)) + by (metis \v < z\ \z < u\ cos_gt_zero_pi less_eq_real_def less_le_trans order_less_irrefl u(2) v(1)) ultimately show ?thesis using DERIV_unique [OF _ DERIV_tan] by fastforce qed auto @@ -5756,8 +5766,8 @@ using \-r < a\ \b < r\ by auto then show "\y. \a < y; y < b\ \ DERIV (\x. suminf (?c x) - arctan x) y :> 0" using \\x\ < r\ by auto - show "\y. \a \ y; y \ b\ \ isCont (\x. suminf (?c x) - arctan x) y" - using DERIV_in_rball DERIV_isCont by auto + show "continuous_on {a..b} (\x. suminf (?c x) - arctan x)" + using DERIV_in_rball DERIV_atLeastAtMost_imp_continuous_on by blast qed qed