lemmacs_L4 {x:ℝ}(h:0≤x): cos x ≤1-x^2/2+x^4/24:=by
proof · 8
lines
let f:=funx:ℝ=>1-x^2/2+x^4/24-cos x
have hd (t):HasDerivAt f (sin t-t+t^3/6) t:=byletT:=hasDerivAt_id' t
convert (((((hasDerivAt_const t 1).fun_sub ((T.pow 2).div_const 2)).fun_add
((T.pow 4).div_const 24)).fun_sub (Real.hasDerivAt_cos t))) using1
all_goals first|rfl|(norm_num;ring)
apply sub_nonneg.mp (integUp f hd h (by simp [f]) _)
intro x hx; linarith [Real.sin_ge_sub_cube hx.1]
lemmasn_H5 {x:ℝ}(h:0≤x): sin x ≤ x-x^3/6+x^5/120:=by
proof · 7
lines
let f:=funx:ℝ=>x-x^3/6+x^5/120-sin x
have hd(t):HasDerivAt f (1-t^2/2+t^4/24-cos t) t:=byletT:=hasDerivAt_id' t
convert (((T.fun_sub ((T.pow 3).div_const 6)).fun_add ((T.pow 5).div_const 120)).fun_sub
(Real.hasDerivAt_sin t)) using1
all_goals first| rfl| (norm_num; ring)
exact sub_nonneg.mp (integUp f hd h (by simp [f]) fun x hx=>sub_nonneg.mpr (cs_L4 hx.1))
lemmacs6 {x:ℝ}(h:0≤x):1-x^2/2+x^4/24-x^6/720≤ cos x:=by
proof · 8
lines
let f:=funx:ℝ=> cos x-(1-x^2/2+x^4/24-x^6/720)
have hd(t):HasDerivAt f (t-t^3/6+t^5/120-sin t) t:=byletT:=hasDerivAt_id' t
convert ((Real.hasDerivAt_cos t).fun_sub
(((((hasDerivAt_const t 1).fun_sub ((T.pow 2).div_const 2)).fun_add
((T.pow 4).div_const 24)).fun_sub ((T.pow 6).div_const 720)))) using1
all_goals first|rfl|( norm_num; ring)
exact sub_nonneg.mp (integUp f hd h (by simp [f]) fun x hx=>sub_nonneg.mpr (sn_H5 hx.1))
let f:=funx:ℝ=> sinh x-(x+x^3/6)
have he(t):HasDerivAt f (cosh t-(1+t^2/2)) t:=by
convert ((Real.hasDerivAt_sinh t).sub ((hasDerivAt_id' t).add
(((hasDerivAt_id' t).pow 3).div_const 6))) using1
all_goals first|rfl|(norm_num;ring)
exact sub_nonneg.mp (integUp f he hx (by simp [f]) (fun t ht=>sub_nonneg.mpr (ch2 t ht.1)))
have h (x:ℝ)(hx:0≤x)(he:x≤H): sinh x≤C*x:=by
apply sub_nonneg.mp
have hd(t): HasDerivAt (fun x=>C*x-sinh x) (C-cosh t) t:=by
convert (((hasDerivAt_id' t).const_mul C).fun_sub (Real.hasDerivAt_sinh t)) using1; first|rfl|ring
refine integUp (fun x=>C*x-sinh x) hd hx (by simp) ?_
intro t ht
apply sub_nonneg.mpr; apply le_trans _ hC
apply cosh_le_cosh.2
rw [abs_of_nonneg ht.1,abs_of_nonneg (hx.trans he)]; exact ht.2.trans he
let f:=funx:ℝ=>1+C*x^2/2-cosh x
have he(t):HasDerivAt f (C*t-sinh t) t:=by
convert ((((((hasDerivAt_id' t).pow 2).const_mul C).div_const 2).const_add 1).sub
(Real.hasDerivAt_cosh t)) using1
all_goals first|rfl|(norm_num;ring)
have hi:= integUp f he (abs_nonneg x) (by simp [f])
(fun t ht=>sub_nonneg.mpr (h t ht.1 (ht.2.trans hx)))
unfold f at hi; rw [sq_abs] at hi
apply sub_nonneg.mp; convert hi using1
rcases le_total 0 x withH|H <;> simp [abs_of_nonpos,abs_of_nonneg,H]
let f:=fun x=> x*cosh x-sinh x
have hf(t):HasDerivAt f (t*sinh t) t:=by
convert (((hasDerivAt_id' t).mul (Real.hasDerivAt_cosh t)).sub (Real.hasDerivAt_sinh t)) using1
all_goals first| rfl|ring
have hh (t:ℝ)(ht:0≤t):0≤f t:=integUp f hf ht (by simp [f])
(fun t ht=> mul_nonneg ht.1 (Real.sinh_nonneg_iff.mpr ht.1))
let g:=funx:ℝ=> x^2*sinh x/3-f x
have he(t): HasDerivAt g (t/3*f t) t:=by
convert ((((((hasDerivAt_id' t).pow 2).mul (Real.hasDerivAt_sinh t))).div_const 3).sub (hf t))
using1
all_goals first|rfl|(unfold f;norm_num;ring)
have hi:=integUp g he hx.le (by simp [f,g])
(fun t ht=>mul_nonneg (by linarith [show0≤t from ht.1]) (hh t ht.1))
have ho:=hh x hx.le
have hp:=Real.sinh_pos_iff.mpr hx
unfold g f at *; constructor <;> field_simp <;> nlinarith