# HG changeset patch # User paulson # Date 1676743805 0 # Node ID 8543e6b10a569d38bdc3463ca253664ded927fb1 # Parent c16d423c9cb1f7f1f6d3a908da568a8b0708192e Simplified a few proofs diff -r c16d423c9cb1 -r 8543e6b10a56 src/HOL/MacLaurin.thy --- a/src/HOL/MacLaurin.thy Fri Feb 17 13:48:42 2023 +0000 +++ b/src/HOL/MacLaurin.thy Sat Feb 18 18:10:05 2023 +0000 @@ -114,10 +114,8 @@ qed (simp add: differentiable_difg n) next case (Suc m') - then have "\t. 0 < t \ t < h \ DERIV (difg m') t :> 0" - by simp then obtain t where t: "0 < t" "t < h" "DERIV (difg m') t :> 0" - by fast + by force have "\t'. 0 < t' \ t' < t \ DERIV (difg (Suc m')) t' :> 0" proof (rule Rolle) show "0 < t" by fact @@ -131,14 +129,11 @@ with \t < h\ show ?case by auto qed - then obtain t where "0 < t" "t < h" "DERIV (difg m) t :> 0" - by fast - with \m < n\ have "difg (Suc m) t = 0" - by (simp add: difg_Suc_eq_0) + then obtain t where "0 < t" "t < h" "difg (Suc m) t = 0" + using \m < n\ difg_Suc_eq_0 by force show ?thesis proof (intro exI conjI) - show "0 < t" by fact - show "t < h" by fact + show "0 < t" "t < h" by fact+ show "f h = (\mdifg (Suc m) t = 0\ by (simp add: m f_h difg_def) qed @@ -157,10 +152,8 @@ next case Suc then have "n > 0" by simp - from INIT1 this INIT2 DERIV - have "\t>0. t < h \ f h = (\mmx < 0\ \diff 0 = f\ have "\t\ \ \x\ \ f x = ?f x t" - by simp - then show ?thesis .. + with \x < 0\ \diff 0 = f\ show ?thesis by force next assume "x > 0" with \n \ 0\ \diff 0 = f\ DERIV have "\t>0. t < x \ diff 0 x = ?f x t" @@ -247,20 +238,12 @@ assume "x < 0" with assms have "\t>x. t < 0 \ f x = ?f x t" by (intro Maclaurin_minus) auto - then obtain t where "t > x" "t < 0" "f x = ?f x t" - by blast - with \x < 0\ have "0 < \t\ \ \t\ < \x\ \ f x = ?f x t" - by simp - then show ?thesis .. + then show ?thesis by force next assume "x > 0" with assms have "\t>0. t < x \ f x = ?f x t" by (intro Maclaurin) auto - then obtain t where "t > 0" "t < x" "f x = ?f x t" - by blast - with \x > 0\ have "0 < \t\ \ \t\ < \x\ \ f x = ?f x t" - by simp - then show ?thesis .. + then show ?thesis by force qed lemma Maclaurin_zero: "x = 0 \ n \ 0 \ (\mn \ 0\ have "(\mx = 0\ \n \ 0\ have " \0\ \ \x\ \ f x = ?f x 0" - by force - then show ?thesis .. - next - case False - with INIT \n \ 0\ DERIV have "\t. 0 < \t\ \ \t\ < \x\ \ f x = ?f x t" - by (intro Maclaurin_all_lt) auto - then obtain t where "0 < \t\ \ \t\ < \x\ \ f x = ?f x t" .. - then have "\t\ \ \x\ \ f x = ?f x t" - by simp - then show ?thesis .. - qed + using DERIV INIT Maclaurin_bi_le by auto qed lemma Maclaurin_all_le_objl: @@ -324,12 +292,7 @@ using Maclaurin_exp_le [of x 3] by (auto simp: numeral_3_eq_3 power2_eq_square) corollary ln_2_less_1: "ln 2 < (1::real)" -proof - - have "2 < 5/(2::real)" by simp - also have "5/2 \ exp (1::real)" using exp_lower_Taylor_quadratic[of 1, simplified] by simp - finally have "exp (ln 2) < exp (1::real)" by simp - thus "ln 2 < (1::real)" by (subst (asm) exp_less_cancel_iff) simp -qed + by (smt (verit) ln_eq_minus_one ln_le_minus_one) subsection \Version for Sine Function\ @@ -430,8 +393,8 @@ proof (rule Maclaurin_all_lt) show "\m x. ((\t. cos (t + 1/2 * real m * pi)) has_real_derivative cos (x + 1/2 * real (Suc m) * pi)) (at x)" - apply (rule allI derivative_eq_intros | simp)+ - using cos_expansion_lemma by force + using cos_expansion_lemma + by (intro allI derivative_eq_intros | simp)+ qed (use False in auto) then show ?thesis apply (rule ex_forward, simp) @@ -511,10 +474,10 @@ using mod_exhaust_less_4 [of m] by (auto simp: minus_one_power_iff even_even_mod_4_iff [of m] dest: even_mod_4_div_2 odd_mod_4_div_2) show ?thesis - unfolding sin_coeff_def apply (subst t2) apply (rule sin_bound_lemma) apply (rule sum.cong[OF refl]) + unfolding sin_coeff_def apply (subst diff_m_0, simp) using est apply (auto intro: mult_right_mono [where b=1, simplified] mult_right_mono @@ -559,10 +522,8 @@ f (b - c + c) = (\m x + c < b \ f b = - (\mx. x + c) t :> 1 + 0" by (rule DERIV_add) - ultimately have "DERIV (\x. diff m (x + c)) t :> diff (Suc m) (t + c) * (1 + 0)" - by (rule DERIV_chain2) - then show "DERIV (\x. diff m (x + c)) t :> diff (Suc m) (t + c)" - by simp + ultimately show "DERIV (\x. diff m (x + c)) t :> diff (Suc m) (t + c)" + using DERIV_chain2 DERIV_shift by blast qed ultimately obtain x where "a - c < x \ x < 0 \ @@ -614,26 +573,15 @@ note INIT moreover have "\m t. m < n \ x \ t \ t \ b \ DERIV (diff m) t :> diff (Suc m) t" using DERIV and INTERV by fastforce - moreover note True - moreover from INTERV have "c \ b" - by simp - ultimately have "\t>x. t < c \ f x = - (\mm t. m < n \ a \ t \ t \ x \ DERIV (diff m) t :> diff (Suc m) t" using DERIV and INTERV by fastforce - moreover from INTERV have "a \ c" - by arith - moreover from False and INTERV have "c < x" - by arith - ultimately have "\t>c. t < x \ f x = - (\m