Skip to main content
AlexKontorovich/PrimeNumberTheoremAnd
Source indexedlemma · leanprover/lean4:v4.32.0

sum_mobius_floor_tail_isLittleO

PrimeNumberTheoremAnd.Consequences · PrimeNumberTheoremAnd/Consequences.lean:2264 to 2349

Mathematical statement

Exact Lean statement

lemma sum_mobius_floor_tail_isLittleO (K : ℕ) (hK : 0 < K) :
    (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x/K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)) =o[atTop] fun x => x

Complete declaration

Lean source

Canonical source
Full Lean sourceLean 4
lemma sum_mobius_floor_tail_isLittleO (K : ) (hK : 0 < K) :    (fun x :  => ∑ n  Finset.Ioc ⌊x/K⌋₊ ⌊x⌋₊, (μ n : ) * (⌊x / (n : )⌋ : )) =o[atTop] fun x => x := by      have h_group :  x : , x  1  ∑ n  Finset.Ioc ⌊x / (K : )⌋₊ ⌊x⌋₊, (μ n : ) * ⌊x / n⌋ = ∑ k  Finset.Ico 1 K, k * (∑ n  Finset.Ioc ⌊x / (k + 1 : )⌋₊ ⌊x / (k : )⌋₊, (μ n : )) := by        intro x hx        have h_group : ∑ n  Finset.Ioc ⌊x / (K : )⌋₊ ⌊x⌋₊, (μ n : ) * ⌊x / n⌋ = ∑ k  Finset.Ico 1 K, ∑ n  Finset.Ioc ⌊x / (k + 1 : )⌋₊ ⌊x / (k : )⌋₊, (μ n : ) * k := by          have h_group : Finset.Ioc ⌊x / (K : )⌋₊ ⌊x⌋₊ = Finset.biUnion (Finset.Ico 1 K) (fun k => Finset.Ioc (⌊x / (k + 1 : )⌋₊) (⌊x / (k : )⌋₊)) := by            ext n            simp only [mem_Ioc, mem_biUnion, mem_Ico]            constructor            · intro hn              refine ⌊x / n⌋₊, ?_, ?_, ?_              all_goals generalize_proofs at *              · rw [Nat.floor_lt', div_lt_iff₀] <;> norm_num <;> try linarith [show (n : )  1 by norm_cast; linarith]                exact by rw [le_div_iff₀ (Nat.cast_pos.mpr <| by linarith)] ; nlinarith [Nat.floor_le (show 0  x by linarith), Nat.lt_floor_add_one x, show (n : )  ⌊x⌋₊ by exact_mod_cast hn.2], by rw [Nat.floor_lt (by positivity)] at *; rw [div_lt_iff₀ (by positivity)] at *; norm_num at *; linarith              · rw [Nat.floor_lt', div_lt_iff₀] <;> norm_num <;> try linarith [Nat.lt_floor_add_one (x / n)]                nlinarith [Nat.lt_floor_add_one (x / n), show (n : )  1 by norm_cast; linarith, div_mul_cancel₀ x (show (n : )  0 by norm_cast; linarith)]              · refine Nat.le_floor ?_                rw [le_div_iff₀] <;> norm_num                · exact le_trans (mul_le_mul_of_nonneg_left (Nat.floor_le (by positivity)) (Nat.cast_nonneg _)) (by rw [mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr <| by linarith)])                · exact Nat.floor_pos.mpr (by rw [le_div_iff₀ (Nat.cast_pos.mpr <| pos_of_gt hn.1)] ; nlinarith [Nat.floor_le (show 0  x by positivity), Nat.lt_floor_add_one x, show (n : )  ⌊x⌋₊ by exact_mod_cast hn.2, div_mul_cancel₀ x (show (K : )  0 by positivity)])            · field_simp              rintro a, ha₁, ha₂, ha₃, ha₄              refine lt_of_le_of_lt ?_ ha₃, ha₄.trans ?_              · gcongr ; norm_cast              · exact Nat.floor_mono <| div_le_self (by positivity) <| mod_cast ha₁          rw [h_group, Finset.sum_biUnion]          · refine Finset.sum_congr rfl fun k hk => Finset.sum_congr rfl fun n hn => ?_            simp +zetaDelta only [ge_iff_le, mem_Ico, mem_Ioc, mul_eq_mul_left_iff, Int.cast_eq_zero] at *            rw [Nat.floor_lt (by positivity), Nat.le_floor_iff (by positivity)] at *            exact Or.inl <| mod_cast Int.floor_eq_iff.mpr by rw [le_div_iff₀ <| Nat.cast_pos.mpr <| Nat.pos_of_ne_zero <| by rintro rfl; norm_num at hn; linarith [show x / (k + 1 : ) > 0 by positivity]] ; norm_num; nlinarith [show (k : )  1 by norm_cast; linarith, div_mul_cancel₀ x (show (k : )  0 by norm_cast; linarith), div_mul_cancel₀ x (show (k + 1 : )  0 by positivity)], by rw [div_lt_iff₀ <| Nat.cast_pos.mpr <| Nat.pos_of_ne_zero <| by rintro rfl; norm_num at hn; linarith [show x / (k + 1 : ) > 0 by positivity]] ; norm_num; nlinarith [show (k : )  1 by norm_cast; linarith, div_mul_cancel₀ x (show (k : )  0 by norm_cast; linarith), div_mul_cancel₀ x (show (k + 1 : )  0 by positivity)]          · intros k hk l hl hkl; simp_all +decide [Finset.disjoint_left]            field_simp            intro a ha₁ ha₂ ha₃; contrapose! hkl            rw [Nat.le_floor_iff (by positivity), Nat.floor_lt (by positivity)] at *            rw [div_lt_iff₀ (by positivity), le_div_iff₀ (by norm_cast; linarith)] at *            exact Nat.le_antisymm (Nat.le_of_lt_succ <| by { rw [ @Nat.cast_lt ] ; push_cast; nlinarith }) (Nat.le_of_lt_succ <| by { rw [ @Nat.cast_lt ] ; push_cast; nlinarith })        simpa only [mul_comm, Finset.mul_sum _ _ _] using h_group      have h_M_x_over_k :  k : , 1  k  k < K  (fun x :  => ∑ n  Finset.Ioc ⌊x / (k + 1 : )⌋₊ ⌊x / (k : )⌋₊, (μ n : )) =o[atTop] (fun x => x) := by        have h_M : (fun x :  => ∑ n  Finset.Icc 1 ⌊x⌋₊, (μ n : )) =o[atTop] (fun x => x) := by          have h_M : (fun x :  => ∑ n  Finset.range ⌊x⌋₊, (μ n : )) =o[atTop] (fun x => x) := by            refine Asymptotics.IsLittleO.of_norm_left ?_            simpa only [ Int.norm_cast_real, Int.cast_sum] using mu_pnt.norm_left          have h_M : (fun x :  => ∑ n  Finset.range (⌊x⌋₊ + 1), (μ n : )) =o[atTop] (fun x => x) := by            simp_all +decide only [ge_iff_le, Finset.sum_range_succ]            refine h_M.add ?_            rw [Asymptotics.isLittleO_iff_tendsto] <;> norm_num            refine squeeze_zero_norm' (a := fun x :  => 1 / |x|) ?_ ?_            · norm_num [abs_div]              exact 1, fun x hx => mul_le_of_le_one_left (by positivity) (mod_cast by exact abs_moebius_le_one)            · exact tendsto_const_nhds.div_atTop (tendsto_norm_atTop_atTop)          convert! h_M.sub (show (fun x :  =>0 : )) =o[Filter.atTop] fun x :  => x from ?_) using 2 <;> norm_num [Finset.sum_range_succ']          erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num [Finset.sum_range_succ']        intros k hk_pos hk_lt_K        have h_M_x_over_k : (fun x :  => ∑ n  Finset.Ioc ⌊x / (k + 1 : )⌋₊ ⌊x / (k : )⌋₊, (μ n : )) = (fun x :  => ∑ n  Finset.Icc 1 ⌊x / (k : )⌋₊, (μ n : )) - (fun x :  => ∑ n  Finset.Icc 1 ⌊x / (k + 1 : )⌋₊, (μ n : )) := by          ext x          simp only [Pi.sub_apply]          rw [eq_sub_iff_add_eq']          simp only [show Finset.Icc (1 : ) (⌊x / (↑k + 1)⌋₊) = Finset.Ioc (0 : ) (⌊x / (↑k + 1)⌋₊) by              simpa using (Finset.Icc_add_one_left_eq_Ioc (a := (0 : )) (b := ⌊x / (↑k + 1)⌋₊)),            show Finset.Icc (1 : ) (⌊x / ↑k⌋₊) = Finset.Ioc (0 : ) (⌊x / ↑k⌋₊) by              simpa using (Finset.Icc_add_one_left_eq_Ioc (a := (0 : )) (b := ⌊x / ↑k⌋₊))]          rw [Finset.sum_Ioc_consecutive] <;> norm_num           by_cases hx : 0  x <;> simp_all +decide only [ge_iff_le, floor_div_natCast, not_le]          · rw [Nat.le_div_iff_mul_le (by positivity)]            exact Nat.le_floor <| by push_cast; nlinarith [Nat.floor_le (show 0  x / (k + 1) by positivity), Nat.lt_floor_add_one (x / (k + 1)), mul_div_cancel₀ x (by positivity : (k + 1 : )  0)]          · rw [Nat.floor_of_nonpos (div_nonpos_of_nonpos_of_nonneg hx.le (by positivity)), Nat.floor_of_nonpos hx.le] ; norm_num        rw [h_M_x_over_k]        refine Asymptotics.IsLittleO.sub ?_ ?_        · field_simp          refine h_M.comp_tendsto (Filter.tendsto_id.atTop_mul_const (by positivity)) |> fun h => h.trans_isBigO ?_          exact Asymptotics.isBigO_iff.mpr (k : ) ⁻¹, Filter.eventually_atTop.mpr 1, fun x hx => by simp +decide ; ring_nf; norm_num [show k  0 by linarith]⟩⟩        · have := h_M.comp_tendsto (show Filter.Tendsto (fun x :  => x / (k + 1)) Filter.atTop Filter.atTop from Filter.tendsto_id.atTop_div_const (by positivity))          rw [Asymptotics.isLittleO_iff] at *          intro c hc; filter_upwards [this (show 0 < c * (k + 1) by positivity), Filter.eventually_gt_atTop 0] with x hx₁ hx₂; simp_all +decide only [ge_iff_le, norm_eq_abs, eventually_atTop, Function.comp_apply, norm_div, cast_nonneg,    zero_le_one, add_nonneg, abs_of_nonneg]          exact hx₁.trans (by rw [mul_assoc, mul_div_cancel₀ _ (by positivity)])      have h_sum_o_x : (fun x :  => ∑ k  Finset.Ico 1 K, (k : ) * (∑ n  Finset.Ioc ⌊x / (k + 1 : )⌋₊ ⌊x / (k : )⌋₊, (μ n : ))) =o[atTop] (fun x => x) := by        rw [Asymptotics.isLittleO_iff_tendsto']        · have h_sum_little_o :  k  Finset.Ico 1 K, Filter.Tendsto (fun x :  => (∑ n  Finset.Ioc ⌊x / (k + 1 : )⌋₊ ⌊x / (k : )⌋₊, (μ n : )) / x) Filter.atTop (nhds 0) := by            intro k hk; specialize h_M_x_over_k k (Finset.mem_Ico.mp hk |>.1) (Finset.mem_Ico.mp hk |>.2) ; rw [Asymptotics.isLittleO_iff_tendsto'] at h_M_x_over_k <;> aesop          simpa [Finset.sum_div _ _ _, mul_div_assoc] using tendsto_finsetSum _ fun k hk => h_sum_little_o k hk |> Filter.Tendsto.const_mul _        · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne'      exact h_sum_o_x.congr'        (by filter_upwards [Filter.eventually_ge_atTop 1] with x hx using by rw [h_group x hx])        (by norm_num)