have hc := topCoefficient_pos ha
have hlarge := eventually_poly_le_exp (2*bandConstant D)
(a := topParameter^5*topCoefficient a) (mul_pos (pow_pos topParameter_pos _) hc) 1
filter_upwards [hlarge,eventually_ge_atTop (2:ℝ)] with x hlarge hx
intro s pre post hne hp hdense hpost hlen
havehT2 : 2≤Real.exp x :=by linarith only [Real.add_one_le_exp x,hx]
have hm := s.meanLog_bounds hne (Real.exp_pos x) hp
rw [Real.log_exp] at hm
havehmean : 1≤ s.meanLog :=by linarith only [hm.1,hx]
havehmean0 : 0< s.meanLog :=by linarith only [hmean]
havehlog2 : Real.log 2≤x :=byhave hh :=Real.log_le_sub_one_of_pos (bynorm_num : (0:ℝ)<2)
linarith only [hh,hx]
havehmean' : s.meanLog≤2*x :=by
rw [Real.log_mul (by norm_num) (Real.exp_ne_zero _),Real.log_exp] at hm
linarith only [hm.2,hlog2]
havehscale : bandScale topParameter (a*Real.exp x) topIterations=topCoefficient a*Real.exp x :=by
unfold bandScale topCoefficient; ring
havehmargin : bandConstant D*s.meanLog≤topParameter^5*
bandScale topParameter (a*Real.exp x) topIterations :=byhave hh := mul_le_mul_of_nonneg_left hmean' (bandConstant_pos D).le
rw [hscale]
simp only [pow_one] at hlarge
nlinarith only [hh,hlarge]
have hcap := dense_sieve_cap s hne hT2 hp hdense
(by nlinarith only [haδ,Real.exp_pos x] : 2*(a*Real.exp x)≤δ*Real.exp x)
have hband := entropyBand_from_margin s pre post 0 topIterations hD topParameter_pos
topParameter_small (mul_pos ha (Real.exp_pos _)) hmean hmargin hcap
(by simpa only [hscale,mul_assoc] using hpost)
(by simp only [Nat.cast_zero]; positivity)
(by simpa only [hscale,mul_assoc] using hlen) top_deficit
refine ⟨hband,?_⟩
havehg5 : topParameter^5≤1:= pow_le_one₀ topParameter_pos.le (by norm_num [topParameter])
have hVpos := bandScale_pos topParameter_pos (mul_pos ha (Real.exp_pos x)) topIterations
have hn := mul_le_mul_of_nonneg_right hg5 hVpos.le
havehC : 2≤bandConstant D:=by
unfold bandConstant
linarith only [abs_nonneg (Real.log D),abs_nonneg (Real.log (max D ((latticeBall (4*D)).card:ℝ)))]
have hm2 := mul_le_mul_of_nonneg_right hC hmean0.le
havehV : 2*s.meanLog≤bandScale topParameter (a*Real.exp x) topIterations :=by
nlinarith only [hmargin,hn,hm2]
have hh := bandSize_lower_of_scale hmean0
(show0<Real.log (Real.exp x) by rw [Real.log_exp]; linarith only [hx])
(by simpa only [Real.log_exp] using hmean') hV (le_of_eq hscale.symm)
simpa only [Real.log_exp] using hh
lemmawindowBlocks_succ (a : ℝ) (m : ℕ) (J : ℕ→Finsetℕ) (W : ℕ) :
windowBlocks a m J (W+1)=topBlocks a (JW)++accurateBlock m ((100:ℝ)^W/4)++
windowBlocks a m JW:=by
proof · 2
lines
simp only [windowBlocks,List.range_succ,List.reverse_append,List.reverse_singleton,
List.flatMap_append,List.flatMap_cons,List.flatMap_nil,List.append_nil,List.append_assoc]
lemmawindowBlocks_split (a : ℝ) (m : ℕ) (J : ℕ→Finsetℕ) {Ww : ℕ} (hw : w<W) :
∃ pre, windowBlocks a m JW=pre++topBlocks a (J w)++
accurateBlock m ((100:ℝ)^w/4)++windowBlocks a m J w :=by
proof · 9
lines
induction Wwith
| zero => omega
| succ W ih =>
rw [windowBlocks_succ]
by_cases he : w=W
· subst w; exact ⟨[],by simp only [List.nil_append]⟩
· obtain ⟨pre,hp⟩ := ih (by omega)
rw [hp]
exact ⟨topBlocks a (JW)++accurateBlock m ((100:ℝ)^W/4)++pre,by simp only [List.append_assoc]⟩
havehden : 0<(2:ℝ)^K-1:=byhave hh := one_lt_pow₀ (bynorm_num : (1:ℝ)<2) (byomega : K≠0)
linarith only [hh]
induction JusingFinset.induction_on_max generalizing j with
| empty => simp only [Finset.sum_empty]; positivity
| @insert a J hmax ih =>haveha : a∉J:=fun h => (lt_irrefl a) (hmax a h)
havehci : ∀ b∈J, b+K≤a :=by
intro b hb
exact hsep b (Finset.mem_insert_of_mem hb) a (Finset.mem_insert_self ..)
(hmax b hb)
have hi := ih (fun b hb c hc hbc => hsep b (Finset.mem_insert_of_mem hb)
c (Finset.mem_insert_of_mem hc) hbc) hci
rw [Finset.sum_insert ha]
have hp := pow_le_pow_right₀ (bynorm_num : (1:ℝ)≤2) (hcap a (Finset.mem_insert_self ..))
have hd := (div_le_div_iff_of_pos_right hden).mpr hp
rw [pow_add] at hd
havehe : (2:ℝ)^a+(2:ℝ)^a/((2:ℝ)^K-1)=(2:ℝ)^a*2^K/(2^K-1) :=by
field_simp; ring
exact (add_le_add (le_refl ((2:ℝ)^a)) hi).trans (he ▸ hd)
lemmatopBlock_separated {a : ℝ} (ha : 0<a) {i j K : ℕ}
(hgap : a≤(2:ℝ)^K*topCoefficient a) (hij : i+K≤j) :
∀ n∈topBlock a i, (n:ℝ)≤Real.exp (topParameter*topCoefficient a*(2:ℝ)^j) :=by
proof · 7
lines
apply topBlock_bound ha.le
have hh := mul_le_mul_of_nonneg_left hgap (show0≤(2:ℝ)^i by positivity)
rw [←mul_assoc,←pow_add] at hh
havehp : (2:ℝ)^(i+K)≤(2:ℝ)^j := pow_le_pow_right₀ (by norm_num) hij
have hp' := mul_le_mul_of_nonneg_right hp (topCoefficient_pos ha).le
have hg := mul_le_mul_of_nonneg_left (hh.trans hp') topParameter_pos.le
nlinarith only [hg]