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

M_isLittleO

PrimeNumberTheoremAnd.Consequences · PrimeNumberTheoremAnd/Consequences.lean:1857 to 1917

Mathematical statement

Exact Lean statement

lemma M_isLittleO : M =o[atTop] id

Complete declaration

Lean source

Canonical source
Full Lean sourceLean 4
lemma M_isLittleO : M =o[atTop] id := by  have h_identity :  x  1, M x * Real.log x = ∑ k  Iic ⌊x⌋₊, (μ k : ) * (Real.log (x / k) - Psi (x / k)) := by    exact fun x a => M_log_identity x a  have h_term1 : (fun x => ∑ k  Iic ⌊x⌋₊, (μ k : ) * Real.log (x / k)) =O[atTop] id := by    have h_abs :  x  1, |∑ k  Iic ⌊x⌋₊, (μ k : ) * Real.log (x / k)|  ∑ k  Iic ⌊x⌋₊, Real.log (x / k) := by      intros x hx      have h_abs :  k  Iic ⌊x⌋₊, |(μ k : ) * Real.log (x / k)|  Real.log (x / k) := by        intros k hk        have h_abs : |(μ k : )|  1 := by          norm_num [ArithmeticFunction.moebius]          split_ifs <;> norm_num        by_cases hk0 : k = 0        · rw [hk0] ; norm_num [ArithmeticFunction.map_zero, Nat.cast_zero, Real.log_zero, div_zero, abs_zero]        · have hx_pos : 0 < x := by positivity          have hk_pos : 0 < (k : ) := by positivity          rw [Real.log_div hx_pos.ne' hk_pos.ne']          simp only [abs_mul, ge_iff_le]          simp_all only [ge_iff_le, mem_Iic]          exact le_trans (mul_le_of_le_one_left (abs_nonneg _) h_abs) (by rw [abs_of_nonneg] ; exact sub_nonneg_of_le <| Real.log_le_log hk_pos (Nat.cast_le.mpr hk |>.trans (Nat.floor_le hx_pos.le)))      exact le_trans (Finset.abs_sum_le_sum_abs _ _) (Finset.sum_le_sum h_abs)    have h_sum_log : (fun x => ∑ k  Iic ⌊x⌋₊, Real.log (x / k)) =O[atTop] id := by      convert sum_log_div_isBigO using 1    rw [Asymptotics.isBigO_iff] at *    exact h_sum_log.choose, by filter_upwards [h_sum_log.choose_spec, Filter.eventually_ge_atTop 1] with x hx₁ hx₂ using le_trans (h_abs x hx₂) (le_trans (le_abs_self _) hx₁)  have h_term2 : (fun x => ∑ k  Iic ⌊x⌋₊, (μ k : ) * (x / k)) =O[atTop] id := by    convert sum_mobius_div_isBigO using 1  have h_term3 : (fun x => ∑ k  Iic ⌊x⌋₊, (μ k : ) * R (x / k)) =o[atTop] (fun x => x * Real.log x) := by    have h_abs :  x  1, |∑ k  Iic ⌊x⌋₊, (μ k : ) * R (x / k)|  ∑ k  Iic ⌊x⌋₊, |R (x / k)| := by      intros x hx      have h_abs :  k  Iic ⌊x⌋₊, |(μ k : ) * R (x / k)|  |R (x / k)| := by        norm_num [abs_mul]        intro k hk; exact mul_le_of_le_one_left (abs_nonneg _) (mod_cast by exact abs_moebius_le_one)      exact le_trans (Finset.abs_sum_le_sum_abs _ _) (Finset.sum_le_sum h_abs)    have h_sum_abs_R : (fun x => ∑ k  Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * Real.log x) := by      exact sum_abs_R_isLittleO    rw [Asymptotics.isLittleO_iff] at *    intro c hc; filter_upwards [h_sum_abs_R hc, Filter.eventually_ge_atTop 1] with x hx₁ hx₂; exact le_trans (h_abs x hx₂) (le_trans (le_abs_self _) hx₁)  have h_combined : (fun x => M x * Real.log x) =o[atTop] (fun x => x * Real.log x) := by    have h_combined : (fun x => M x * Real.log x) = (fun x => ∑ k  Iic ⌊x⌋₊, (μ k : ) * Real.log (x / k)) - (fun x => ∑ k  Iic ⌊x⌋₊, (μ k : ) * (x / k)) - (fun x => ∑ k  Iic ⌊x⌋₊, (μ k : ) * R (x / k)) := by      ext x; by_cases hx : 1  x <;> simp_all +decide only [ge_iff_le, mul_sub, sum_sub_distrib, not_le, Pi.sub_apply]      · simp +decide [sub_sub, mul_sub, Finset.sum_sub_distrib, Psi, R]      · unfold M R; norm_num [Nat.floor_eq_zero.mpr hx]        norm_num [Finset.Iic_eq_Icc]    rw [h_combined]    refine Asymptotics.IsLittleO.sub ?_ h_term3    refine Asymptotics.IsLittleO.sub ?_ ?_    · refine h_term1.trans_isLittleO ?_      rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num      · norm_num [ div_div]        exact le_trans (Filter.Tendsto.div_atTop (tendsto_const_nhds.congr' (by filter_upwards [Filter.eventually_ne_atTop 0] with x hx; aesop)) (Real.tendsto_log_atTop)) (by norm_num)      · exact 2, by rintro x hx (rfl | rfl | rfl) <;> norm_num at hx    · refine h_term2.trans_isLittleO ?_      rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num      · norm_num [ div_div]        exact le_trans (Filter.Tendsto.div_atTop (tendsto_const_nhds.congr' (by filter_upwards [Filter.eventually_ne_atTop 0] with x hx; aesop)) (Real.tendsto_log_atTop)) (by norm_num)      · exact 2, by rintro x hx (rfl | rfl | rfl) <;> linarith  rw [Asymptotics.isLittleO_iff_tendsto'] at *  · refine h_combined.congr' (by filter_upwards [Filter.eventually_gt_atTop 1] with x hx using by rw [mul_div_mul_right _ _ (ne_of_gt <| Real.log_pos hx)] ; rfl)  · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using absurd hx' <| ne_of_gt <| mul_pos (by positivity) <| Real.log_pos hx  · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using by nlinarith [Real.log_pos hx]  · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne'