lemmahoD {f:ℝ→ℝ} (hf:TestF f) :
anti (seg m h) f=2*h*mean0 (alongD m h f) :=by
proof · 10
lines
let g:= (liftF f) ∘ (loc m h)
have hd(x): HasDerivAt g (h*alongD m h f x) x:=by
rw [mul_comm]; exact (liftD hf _).comp x (loct ..)
havehc : Continuous (alongD m h f) := (Dt_cont hf).comp (cLoc ..)
have hi:= intervalIntegral.integral_eq_sub_of_hasDerivAt (fun t _=>hd t)
((continuous_const.mul hc).intervalIntegrable (-1:ℝ) 1)
havehe:g 1=f (seg m h).2:=by simp [g,Function.comp_apply,liftF,seg,right,loc]
havehh:g (-1)=f (seg m h).1:=by simp [g,Function.comp_apply,liftF,seg,left,loc,sub_eq_add_neg]
rw [intervalIntegral.integral_const_mul,he,hh] at hi
unfold mean0 anti; linarith
lemmaekB (hh:0<h):
ek (seg m h)=h^2/3*mean0 (negN m h):=by
proof · 8
lines
have hi:=ch_err m h hh testK
have he (f:ℝ→ℝ): mean0 (fun x=> -f x) = -mean0 f:=by
unfold mean0;rw [intervalIntegral.integral_neg];ring
unfold negN alongN ek
have hEq := he (fun x=>omega m h x*NNfKp (loc m h x))
rw [hEq]
dsimp only at hi
linarith
lemmasmallU (H:NG)(hh:0<h)(he:h≤16/100):
ek (seg m h)+sgamma (seg m h) ≤54/100*ubase h :=by
proof · 27
lines
let l:=fun x=>GammaB (alongD m h Kp x) (alongD m h Cp x)
letS:=negN m h
havehc:ContinuousS:= ((omCont m h).mul ((nn_cont testK).comp (cLoc ..))).neg
havehd: Continuous l:=byhavehe:Continuous (alongD m h Kp):=(Dt_cont testK).comp (cLoc ..)
havehv:Continuous (alongD m h Cp):=(Dt_cont testC).comp (cLoc ..)
unfold l GammaB;fun_prop
have hp:=mean_mono (hc.add hd) continuous_const
(f:=fun x=>S x+l x) (g:=fun _=>Ur) ?_
· rw [mean_add hc hd, mean_const] at hp
rw [ekB m hh]
apply le_trans (add_le_add le_rfl (gmBound m)); rw [← mul_add]
apply le_trans (mul_le_mul_of_nonneg_left hp (by positivity))
unfold Ur ubase wp; apply le_of_eq;ring
intro x hx
let t:=loc m h x
letD:=NNfKp t
havehi: 1507/1000*max 0 (-D)+l x≤Ur:= (GlobalCorrH t).2.2.2have hh:= (Wshr m hh he).1 x hx
havehz :0≤ omega m h x := hh.1
change -(omega m h x * D)+l x ≤Ur
apply le_trans _ hi
apply add_le_add _ le_rfl
rw [← mul_neg]
calc
_ ≤ omega m h x*max 0 (-D):=mul_le_mul_of_nonneg_left (le_max_right ..) hz
_ ≤ _:=mul_le_mul_of_nonneg_right hh.2 (le_max_left ..)
lemmachAbs (hh:0<h)(he:h≤16/100) {f:ℝ→ℝ} (hf:TestF f){a:ℝ}
(ha:0≤a) (hp:∀ x,|NNf f x| ≤ a):
let v:=seg m h
proof · 18
lines
|bav f v-(f v.1+f v.2)/2| ≤h^2/3*((1012/1000:ℝ)*a) :=by
intro v; rw [ch_err m h hh hf,abs_mul,abs_neg,abs_of_nonneg (by positivity)]
let g:=fun x=>omega m h x*NNf f (loc m h x)
apply mul_le_mul_of_nonneg_left _ (by positivity)
change |mean0 g|≤_
obtain ⟨he,hb⟩:=Wshr m hh he
have hc:=omCont m h
havehg:Continuous g:= hc.mul ((nn_cont hf).comp (cLoc ..))
have hx(t:ℝ)(ht:t∈Icc (-1:ℝ) 1): -a*omega m h t≤g t ∧ g t≤a*omega m h t:=by
obtain ⟨ha,hc⟩:=abs_le.mp (hp (loc m h t))
have h' :=(he t ht).1
unfold g; constructor<;>nlinarith
have hh:= mean_mono (showContinuous (fun x=> -a*omega m h x) from continuous_const.mul hc) hg
(fun t ht=>(hx t ht).1)
have hj:= mean_mono hg (showContinuous (fun x=>a*omega m h x) from continuous_const.mul hc)
(fun t ht=>(hx t ht).2)
rw [mean_scale] at hh hj
apply abs_le.mpr; constructor <;>nlinarith