diff --git a/LeanPool/IwaniecLinearSieve/Jacobsthal/Reduction.lean b/LeanPool/IwaniecLinearSieve/Jacobsthal/Reduction.lean index db90ee5704..a24fd4b086 100644 --- a/LeanPool/IwaniecLinearSieve/Jacobsthal/Reduction.lean +++ b/LeanPool/IwaniecLinearSieve/Jacobsthal/Reduction.lean @@ -44,7 +44,7 @@ theorem exists_covering_length_le (hL : LinearSieveEstimate) refine ⟨K / (c * c'), max z₀ 2, fun z hz S hS hcard x m hm ↦ ?_⟩ have hz0 : z₀ ≤ z := (le_max_left _ _).trans hz have hz2 : 2 ≤ z := (le_max_right _ _).trans hz - have hlog : 0 < log z := log_pos (by linarith) + have hlog : 0 < log z := log_pos (by linarith only [hz2]) have hRz := R_pos z set M := rosserMain true (C₀ * z ^ 2) z obtain ⟨hmain, hcount⟩ := hL z hz0 @@ -56,7 +56,7 @@ theorem exists_covering_length_le (hL : LinearSieveEstimate) exact h q hq hqk rw [hzero, card_empty, Nat.cast_zero] at hsieve -- `M ≥ R(z) c / log z` - have hM : R z * (c / log z) ≤ M := by nlinarith + have hM : R z * (c / log z) ≤ M := by nlinarith only [hmain] have hM0 : 0 ≤ M := (mul_nonneg hRz.le (div_pos hc hlog).le).trans hM have hprod := R_le_prod_of_card_eq hS hcard have h1 : (m : ℝ) * M ≤ #(rosserSet true (C₀ * z ^ 2) z) := by @@ -65,7 +65,7 @@ theorem exists_covering_length_le (hL : LinearSieveEstimate) refine mul_le_mul_of_nonneg_left ?_ m.cast_nonneg calc M = R z * (M / R z) := by field_simp _ ≤ _ := mul_le_mul_of_nonneg_right hprod (div_nonneg hM0 hRz.le) - linarith + linarith only [hsieve, this] have hRlog : c' ≤ R z * log z := by have := hR z hz2 rwa [div_le_iff₀ hlog] at this @@ -82,9 +82,9 @@ theorem exists_covering_length_le (hL : LinearSieveEstimate) exact (mul_le_mul_of_nonneg_left hM hm0).trans (h1.trans hcount) have e3 : K * z ^ 2 / log z ^ 2 * log z ^ 2 = K * z ^ 2 := by field_simp - linarith + linarith only [e1, e2, e3] rw [div_mul_eq_mul_div, le_div_iff₀ (mul_pos hc hc')] - linarith + linarith only [h2] /-- The primes below `p_N + 1`, where `p_N = Nat.nth Nat.Prime (N - 1)` is the `N`-th prime, are diff --git a/LeanPool/IwaniecLinearSieve/Jacobsthal/ShiftedSieve.lean b/LeanPool/IwaniecLinearSieve/Jacobsthal/ShiftedSieve.lean index 27ea5d85ce..ea87723f47 100644 --- a/LeanPool/IwaniecLinearSieve/Jacobsthal/ShiftedSieve.lean +++ b/LeanPool/IwaniecLinearSieve/Jacobsthal/ShiftedSieve.lean @@ -323,7 +323,7 @@ theorem abs_card_filter_dvd_sub_le (x : ℤ) (X : ℕ) {d : ℕ} (hd : 0 < d) : push_cast ring have hX : (0 : ℚ) ≤ X / d := by positivity - have hle : ⌈u⌉ ≤ ⌈v⌉ := Int.ceil_mono (by rw [hvu]; linarith) + have hle : ⌈u⌉ ≤ ⌈v⌉ := Int.ceil_mono (by rw [hvu]; linarith only [hX]) rw [max_eq_left (sub_nonneg.2 hle)] at h have hq : |((⌈v⌉ - ⌈u⌉ : ℤ) : ℚ) - X / d| ≤ 1 := by have h1 := Int.le_ceil v @@ -437,7 +437,7 @@ theorem shiftedSieve_of_bijOn (y : ℝ) {S : Finset ℕ} {e : ℕ → ℕ} ∑ A ∈ T.powerset, w A * #((range X).filter fun k : ℕ ↦ (n A : ℤ) ∣ x + k) := by rw [← sum_sub_distrib] exact sum_le_sum hc - linarith + linarith only [hb, hd, he', hsum] /-- Any `π(z)` primes can be matched with the primes below `z` so that each prime below `z` is diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/Calculus.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/Calculus.lean index 67e8f3bb17..82a9547864 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/Calculus.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/Calculus.lean @@ -50,7 +50,7 @@ theorem mainMaj_antitone : ∀ lower, Antitone (mainMaj lower) | true => fSieve_antitone | false => fun u v h => by simp only [mainMaj_false] - exact add_le_add (FSieve_antitone h) (max_le_max (by linarith) le_rfl) + exact add_le_add (FSieve_antitone h) (max_le_max (by linarith only [h]) le_rfl) theorem mainMaj_le_MSieve : ∀ (lower : Bool) (s : ℝ), mainMaj lower s ≤ MSieve s | true, s => by @@ -58,24 +58,24 @@ theorem mainMaj_le_MSieve : ∀ (lower : Bool) (s : ℝ), mainMaj lower s ≤ MS simp only [mainMaj_true, MSieve]; linarith | false, s => by have := fSieve_nonneg s - simp only [mainMaj_false, MSieve]; linarith + simp only [mainMaj_false, MSieve]; linarith only [this] /-- `g₂(s) = ∫_s^∞ (3 - (t-1))⁺/(t-1) dt` for `s ≥ 2`. -/ theorem g_two_eq_integral {s : ℝ} (hs : 2 ≤ s) : IntegrableOn (fun t => max (3 - (t - 1)) 0 / (t - 1)) (Ioi s) ∧ g 2 s = ∫ t in Ioi s, max (3 - (t - 1)) 0 / (t - 1) := by have hz : ∀ t : ℝ, 4 ≤ t → max (3 - (t - 1)) 0 / (t - 1) = 0 := fun t ht => by - rw [max_eq_right (by linarith), zero_div] + rw [max_eq_right (by linarith only [ht]), zero_div] rcases le_or_gt s 4 with hs4 | hs4 · have heq : EqOn (fun t : ℝ => max (3 - (t - 1)) 0 / (t - 1)) (fun t => 3 / (t - 1) - 1) (Icc s 4) := fun t ht => by - have : 0 < t - 1 := by linarith [ht.1] + have : 0 < t - 1 := by linarith only [ht.1, hs, ht] simp only - rw [max_eq_left (by linarith [ht.2])] + rw [max_eq_left (by linarith only [ht.2, ht])] field_simp have hcont : ContinuousOn (fun t : ℝ => 3 / (t - 1) - 1) (Icc s 4) := (continuousOn_const.div (continuousOn_id.sub continuousOn_const) fun t ht => by - simp only [Pi.sub_apply, id]; linarith [ht.1]).sub continuousOn_const + simp only [Pi.sub_apply, id]; linarith only [ht.1, hs, ht]).sub continuousOn_const obtain ⟨hI, hE⟩ := integral_Ioi_eq_of_eq_zero hs4 (((hcont.congr heq).integrableOn_Icc).mono_set Ioc_subset_Icc_self) hz refine ⟨hI, ?_⟩ @@ -83,12 +83,12 @@ theorem g_two_eq_integral {s : ℝ} (hs : 2 ≤ s) : have hderiv : ∀ t ∈ uIcc s 4, HasDerivAt (fun t => 3 * log (t - 1) - t) (3 / (t - 1) - 1) t := fun t ht => by rw [uIcc_of_le hs4] at ht - have h1 : t - 1 ≠ 0 := by linarith [ht.1] + have h1 : t - 1 ≠ 0 := by linarith only [ht.1, hs, ht] have := ((((hasDerivAt_id' t).sub_const 1).log h1).const_mul 3).sub (hasDerivAt_id' t) convert this using 1; field_simp rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv (hcont.mono (uIcc_of_le hs4).subset |>.intervalIntegrable), g_two_eq ⟨hs, hs4⟩, - log_div (by norm_num) (by linarith)] + log_div (by norm_num) (by linarith only [hs])] norm_num; ring · obtain ⟨hI, hE⟩ := integral_Ioi_eq_of_eq_zero le_rfl (by simp) fun t ht => hz t (by linarith) exact ⟨hI, by rw [hE, intervalIntegral.integral_same, g_two_of_four_le hs4.le]⟩ @@ -117,7 +117,7 @@ theorem mainMaj_false_eq_integral (s : ℝ) : /-- `mainMaj` in terms of `fr`: `M true = f` and, on `s ≥ 3`, `M false = F`. -/ theorem mainMaj_false_of_three_le {s : ℝ} (hs : 3 ≤ s) : mainMaj false s = FSieve s := by - rw [mainMaj_false, max_eq_right (by linarith), add_zero] + rw [mainMaj_false, max_eq_right (by linarith only [hs]), add_zero] /-! ### `errMaj` -/ @@ -172,7 +172,7 @@ theorem errMaj_mem : ∀ (lower : Bool) (s : ℝ), | false, s => majF_mem s theorem errMaj_le_two (lower : Bool) (s : ℝ) : errMaj lower s ≤ 2 := by - linarith [(errMaj_mem lower s).2, bigM_le_three s] + linarith only [(errMaj_mem lower s).2, bigM_le_three s] theorem errMaj_false_of_le_three {s : ℝ} (hs : s ≤ 3) : errMaj false s = 1 := majF_of_le_three hs @@ -190,9 +190,9 @@ theorem tendsto_errMaj_atTop : ∀ lower, Tendsto (errMaj lower) atTop (𝓝 0) theorem errMaj_shift_pos (lower : Bool) {t : ℝ} (ht : 1 < t) : 0 < errMaj lower (t - 1) * t / (t - 1) ^ 2 := by - have h1 : 0 < t - 1 := by linarith + have h1 : 0 < t - 1 := by linarith only [ht] have := errMaj_pos lower (t - 1) - have : 0 < t := by linarith + have : 0 < t := by linarith only [ht] positivity /-- (3.13), (3.14): for `s ≥ 2` (`lower = true`) or `s ≥ 3` (`lower = false`), @@ -207,7 +207,7 @@ theorem errMaj_eq_integral (lower : Bool) {s : ℝ} (hs : errLower lower ≤ s) (errMaj (!lower) (t - 1) * t / (t - 1) ^ 2) t := fun t ht => (hasDerivAt_errMaj lower (hs.trans_lt ht)).neg.congr_deriv (by ring) have hpos : ∀ t ∈ Ioi s, 0 ≤ errMaj (!lower) (t - 1) * t / (t - 1) ^ 2 := fun t ht => - (errMaj_shift_pos _ (by linarith [ht.out])).le + (errMaj_shift_pos _ (by linarith only [ht.out, hs, h2, ht])).le have hlim : Tendsto (fun t => -errMaj lower t) atTop (𝓝 0) := by simpa using (tendsto_errMaj_atTop lower).neg refine ⟨integrableOn_Ioi_deriv_of_nonneg hcont hderiv hpos hlim, ?_⟩ diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/Corollaries.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/Corollaries.lean index 82f2cf608e..041a1d610b 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/Corollaries.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/Corollaries.lean @@ -45,11 +45,11 @@ theorem integral_comp_log_div {F : ℝ → ℝ} {y α β : ℝ} (hy : 1 < y) (h ∫ t in α..β, F t / t := by set L := log y have hL : 0 < L := log_pos hy - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] set f : ℝ → ℝ := fun t => exp (L * t⁻¹) set f' : ℝ → ℝ := fun t => exp (L * t⁻¹) * (L * -(t ^ 2)⁻¹) have hpos : ∀ x ∈ uIcc α β, 0 < x := fun x hx => by - rw [uIcc_of_le hαβ] at hx; linarith [hx.1] + rw [uIcc_of_le hαβ] at hx; linarith only [hx.1, hα, hx] have hderiv : ∀ x, 0 < x → HasDerivAt f (f' x) x := fun x hx => ((hasDerivAt_inv hx.ne').const_mul L).exp have hfA : ∀ γ, f γ = y ^ (1 / γ) := fun γ => by @@ -58,7 +58,7 @@ theorem integral_comp_log_div {F : ℝ → ℝ} {y α β : ℝ} (hy : 1 < y) (h (f' := f') (g := fun u => F (L / log u) / (u * log u)) (continuousOn_of_forall_continuousAt fun x hx => (hderiv x (hpos x hx)).continuousAt) (fun x hx => hderiv x (by - rw [min_eq_left hαβ] at hx; linarith [hx.1])) + rw [min_eq_left hαβ] at hx; linarith only [hx.1, hα, hx])) (fun x hx => by simp only [f'] rw [mul_neg] @@ -84,7 +84,7 @@ theorem log_rpow_one_div {y : ℝ} (hy : 0 < y) (γ : ℝ) : log (y ^ (1 / γ)) theorem div_log_mem_Icc {y α β u : ℝ} (hy : 1 < y) (hα : 0 < α) (hαβ : α ≤ β) (hu : u ∈ Icc (y ^ (1 / β)) (y ^ (1 / α))) : 0 < log u ∧ log y / log u ∈ Icc α β := by have hL : 0 < log y := log_pos hy - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] have hβ : 0 < β := hα.trans_le hαβ have hB0 : 0 < y ^ (1 / β) := rpow_pos_of_pos hy0 _ have hu0 : 0 < u := hB0.trans_le hu.1 @@ -92,8 +92,8 @@ theorem div_log_mem_Icc {y α β u : ℝ} (hy : 1 < y) (hα : 0 < α) (hαβ : have h2 : log u ≤ log y / α := log_rpow_one_div hy0 α ▸ log_le_log hu0 hu.2 have hlu : 0 < log u := (div_pos hL hβ).trans_le h1 refine ⟨hlu, ?_, ?_⟩ - · rw [le_div_iff₀ hlu]; rw [le_div_iff₀ hα] at h2; linarith - · rw [div_le_iff₀ hlu]; rw [div_le_iff₀ hβ] at h1; linarith + · rw [le_div_iff₀ hlu]; rw [le_div_iff₀ hα] at h2; linarith only [h2] + · rw [div_le_iff₀ hlu]; rw [div_le_iff₀ hβ] at h1; linarith only [h1] /-- [I71, Lemma 13] in the variable `t = log y / log u`: for `F ≥ 0` antitone on `[α, β]`, and any set `S` of primes between those in `(y^{1/β}, y^{1/α})` and those in `[y^{1/β}, y^{1/α}]`, @@ -106,7 +106,7 @@ theorem lemma13_param : ∃ C, 0 ≤ C ∧ ∀ (F : ℝ → ℝ) (y α β : ℝ) obtain ⟨C, hC0, hC⟩ := lemma13_mono_of_subset refine ⟨C, hC0, fun F y α β S hy hα hαβ hB hF hF0 hS1 hS2 => ?_⟩ have hL : 0 < log y := log_pos hy - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] have hBA : y ^ (1 / β) ≤ y ^ (1 / α) := rpow_le_rpow_of_exponent_le hy.le (one_div_le_one_div_of_le hα hαβ) have hmono : MonotoneOn (fun u => F (log y / log u)) (Icc (y ^ (1 / β)) (y ^ (1 / α))) := by @@ -114,7 +114,7 @@ theorem lemma13_param : ∃ C, 0 ≤ C ∧ ∀ (F : ℝ → ℝ) (y α β : ℝ) obtain ⟨hlu, hmu⟩ := div_log_mem_Icc hy hα hαβ hu obtain ⟨hlv, hmv⟩ := div_log_mem_Icc hy hα hαβ hv exact hF hmv hmu (div_le_div_of_nonneg_left hL.le hlu - (log_le_log (by linarith [hu.1]) huv)) + (log_le_log (by linarith only [hu.1, hB, hu]) huv)) have h := hC (fun u => F (log y / log u)) (y ^ (1 / α)) (y ^ (1 / β)) S hB hBA hmono (fun u hu => hF0 _ (div_log_mem_Icc hy hα hαβ hu).2) hS1 hS2 rwa [integral_comp_log_div hy hα hαβ, log_rpow_one_div hy0, div_div_cancel₀ hL.ne'] at h @@ -130,15 +130,15 @@ theorem le_div_log_of_le_rpow {y α : ℝ} {p : ℕ} (hy : 1 < y) (hα : 0 < α) (hpA : (p : ℝ) ≤ y ^ (1 / α)) : α ≤ log y / log p := by have hlp : 0 < log (p : ℝ) := log_pos (by exact_mod_cast hp) have h := log_le_log (by positivity) hpA - rw [log_rpow_one_div (by linarith)] at h - rw [le_div_iff₀ hlp]; rw [le_div_iff₀ hα] at h; linarith + rw [log_rpow_one_div (by linarith only [hy])] at h + rw [le_div_iff₀ hlp]; rw [le_div_iff₀ hα] at h; linarith only [h] theorem antitoneOn_div_sub_one : AntitoneOn (fun t : ℝ => t / (t - 1)) (Ioi 1) := by intro u hu v hv huv - have hu1 : 0 < u - 1 := by linarith [hu.out] - have hv1 : 0 < v - 1 := by linarith [hv.out] + have hu1 : 0 < u - 1 := by linarith only [hu.out, hu] + have hv1 : 0 < v - 1 := by linarith only [hv.out, huv, hu1] simp only - rw [div_le_div_iff₀ hv1 hu1]; nlinarith + rw [div_le_div_iff₀ hv1 hu1]; nlinarith only [huv] /-- [I71, Corollary 1 to Lemma 13]: for `M ≥ 0` antitone on `[α - 1, β - 1]`, `2 ≤ α ≤ β`, `y^{1/β} ≥ 2`, @@ -151,16 +151,16 @@ theorem cor1 : ∃ C, 0 ≤ C ∧ ∀ (M : ℝ → ℝ) (y α β : ℝ), 1 < y (∫ t in α..β, M (t - 1) / (t - 1)) / log y| ≤ C * M (α - 1) * pntE (y ^ (1 / β)) / log y := by obtain ⟨C, hC0, hC⟩ := lemma13_param - refine ⟨2 * C, by linarith, fun M y α β hy hα hαβ hB hM hM0 => ?_⟩ + refine ⟨2 * C, by linarith only [hC0], fun M y α β hy hα hαβ hB hM hM0 => ?_⟩ have hL : 0 < log y := log_pos hy - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] set F : ℝ → ℝ := fun t => M (t - 1) * (t / (t - 1)) / log y with hFdef have hMt : AntitoneOn (fun t => M (t - 1)) (Icc α β) := fun u hu v hv huv => hM ⟨by linarith [hu.1], by linarith [hu.2]⟩ ⟨by linarith [hv.1], by linarith [hv.2]⟩ - (by linarith) + (by linarith only [huv]) have hF : AntitoneOn F (Icc α β) := by have := antitoneOn_mul_of_nonneg hMt (antitoneOn_div_sub_one.mono fun t ht => - show (1 : ℝ) < t by linarith [ht.1]) + show (1 : ℝ) < t by linarith only [ht.1, hα, ht]) (fun t ht => hM0 _ ⟨by linarith [ht.1], by linarith [ht.2]⟩) fun t ht => div_nonneg (by linarith [ht.1]) (by linarith [ht.1]) exact fun u hu v hv huv => div_le_div_of_nonneg_right (this hu hv huv) hL.le @@ -168,7 +168,7 @@ theorem cor1 : ∃ C, 0 ≤ C ∧ ∀ (M : ℝ → ℝ) (y α β : ℝ), 1 < y div_nonneg (mul_nonneg (hM0 _ ⟨by linarith [ht.1], by linarith [ht.2]⟩) (div_nonneg (by linarith [ht.1]) (by linarith [ht.1]))) hL.le have h := hC F y α β ((primesLT (y ^ (1 / α))).filter (fun p : ℕ => y ^ (1 / β) ≤ p)) hy - (by linarith) hαβ hB hF hF0 + (by linarith only [hα]) hαβ hB hF hF0 (fun p hp => by rw [mem_filter, mem_primesLT] at hp exact ⟨hp.1.1, hp.2, hp.1.2.le⟩) @@ -181,7 +181,7 @@ theorem cor1 : ∃ C, 0 ≤ C ∧ ∀ (M : ℝ → ℝ) (y α β : ℝ), 1 < y rw [mem_filter, mem_primesLT] at hp have hp1 := hp.1.1.one_lt have hlp : 0 < log (p : ℝ) := log_pos (by exact_mod_cast hp1) - have ht := le_div_log_of_le_rpow hy (by linarith) hp1 hp.1.2.le + have ht := le_div_log_of_le_rpow hy (by linarith only [hα]) hp1 hp.1.2.le rw [log_div_prime_eq hy0 hp1] simp only [F] have : (p : ℝ) ≠ 0 := by positivity @@ -190,15 +190,15 @@ theorem cor1 : ∃ C, 0 ≤ C ∧ ∀ (M : ℝ → ℝ) (y α β : ℝ), 1 < y rw [← intervalIntegral.integral_div] refine intervalIntegral.integral_congr fun t ht => ?_ rw [uIcc_of_le hαβ] at ht - have : 0 < t := by linarith [ht.1] - have : t - 1 ≠ 0 := by linarith [ht.1] + have : 0 < t := by linarith only [ht.1, hα, ht] + have : t - 1 ≠ 0 := by linarith only [ht.1, hα, ht] simp only [F] field_simp have hFα : F α ≤ 2 * M (α - 1) / log y := by - have hMα := hM0 (α - 1) ⟨le_rfl, by linarith⟩ + have hMα := hM0 (α - 1) ⟨le_rfl, by linarith only [hαβ]⟩ have : α / (α - 1) ≤ 2 := by rw [div_le_iff₀ (by linarith)]; linarith simp only [F] - exact div_le_div_of_nonneg_right (by nlinarith) hL.le + exact div_le_div_of_nonneg_right (by nlinarith only [hMα, this]) hL.le rw [hsum, hint] at h refine h.trans ?_ calc C * F α * pntE (y ^ (1 / β)) ≤ C * (2 * M (α - 1) / log y) * pntE (y ^ (1 / β)) := by @@ -214,16 +214,16 @@ theorem cor1_le : ∃ C, 0 ≤ C ∧ ∀ (M : ℝ → ℝ) (y α β : ℝ), 1 < (∫ t in α..β, M (t - 1) / (t - 1)) / log y + C * M (α - 1) * pntE (y ^ (1 / β)) / log y := by obtain ⟨C, hC0, hC⟩ := cor1 exact ⟨C, hC0, fun M y α β hy hα hαβ hB hM hM0 => by - linarith [(abs_le.1 (hC M y α β hy hα hαβ hB hM hM0)).2]⟩ + linarith only [(abs_le.1 (hC M y α β hy hα hαβ hB hM hM0)).2, hC, hy, hα, hαβ, hB, hM, hM0]⟩ /-! ### Corollary 3 -/ /-- `G'(s-1) s²/(s-1)² ≤ 32 s² G(s)` for `s ≥ 2` (Lemma 8 and the Corollary to Lemma 6). -/ theorem errMaj_shift_sq_le (lower lower' : Bool) {s : ℝ} (hs : 2 ≤ s) : errMaj lower' (s - 1) * (s ^ 2 / (s - 1) ^ 2) ≤ 32 * s ^ 2 * errMaj lower s := by - have hs1 : 0 < s - 1 := by linarith + have hs1 : 0 < s - 1 := by linarith only [hs] have hq : s ^ 2 / (s - 1) ^ 2 ≤ 4 := by - rw [div_le_iff₀ (pow_pos hs1 2)]; nlinarith + rw [div_le_iff₀ (pow_pos hs1 2)]; nlinarith only [hs] have hq0 : 0 ≤ s ^ 2 / (s - 1) ^ 2 := by positivity have hG' := errMaj_pos lower' (s - 1) have hG := (errMaj_mem lower s).1 @@ -245,7 +245,7 @@ theorem errMaj_shift_sq_le (lower lower' : Bool) {s : ℝ} (hs : 2 ≤ s) : theorem growth_le_delta {y t a : ℝ} (ht : 1 ≤ t) (hta : t ≤ a) : (1 + t ^ 2 * log t ^ 5 / log y ^ 2) ^ (5 * (t - 1)) ≤ delta a y := by have hlt := log_nonneg ht - have hla : log t ≤ log a := log_le_log (by linarith) hta + have hla : log t ≤ log a := log_le_log (by linarith only [ht]) hta have hx0 := lsx_nonneg (log y) ht have hxa : t ^ 2 * log t ^ 5 / log y ^ 2 ≤ a ^ 2 * log a ^ 5 / log y ^ 2 := by gcongr @@ -265,17 +265,17 @@ theorem cor3_summand_le {G : ℝ → ℝ} {y : ℝ} {p : ℕ} (hy : 1 < y) (hp : (5 * (log y / log p - 1)) * G (log y / log p - 1) * ((log y / log p) ^ 2 / (log y / log p - 1) ^ 2) / log y ^ 2 / p := by have hlp : 0 < log (p : ℝ) := log_pos (by exact_mod_cast hp) - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] have hyp := log_div_prime_eq hy0 hp set t := log y / log p with htdef have hLt : log y = log p * t := by rw [htdef]; field_simp - have ht1 : 0 < t - 1 := by linarith + have ht1 : 0 < t - 1 := by linarith only [ht] have hp0 : (0 : ℝ) < p := by positivity have hb : (t - 1) ^ 2 * log (t - 1) ^ 5 / log (y / p) ^ 2 = t ^ 2 * log (t - 1) ^ 5 / log y ^ 2 := by rw [hyp, hLt]; field_simp - have hl1 : 0 ≤ log (t - 1) := log_nonneg (by linarith) - have hl2 : log (t - 1) ≤ log t := log_le_log ht1 (by linarith) + have hl1 : 0 ≤ log (t - 1) := log_nonneg (by linarith only [ht]) + have hl2 : log (t - 1) ≤ log t := log_le_log ht1 (by linarith only []) have hbase : t ^ 2 * log (t - 1) ^ 5 / log y ^ 2 ≤ t ^ 2 * log t ^ 5 / log y ^ 2 := by gcongr have hb0 : 0 ≤ t ^ 2 * log (t - 1) ^ 5 / log y ^ 2 := by positivity @@ -313,7 +313,7 @@ theorem cor3_large : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ) (S : Fi (p * log (y / p) ^ 2) ≤ delta s y * errMaj lower s / log y ^ 2 * (1 + C * b ^ 2 * pntE (y ^ (1 / b))) := by obtain ⟨C, hC0, hC⟩ := lemma13_param - refine ⟨32 * C, by linarith, fun lower y s b S hy hs hsb hB hb hS1 hS2 => ?_⟩ + refine ⟨32 * C, by linarith only [hC0], fun lower y s b S hy hs hsb hB hb hS1 hS2 => ?_⟩ set r : ℕ := if lower then 1 else 0 have hG' := errMaj_not_eq_majG lower have hGs : errMaj lower s = majG (r + 1) s := by rw [errMaj_eq_majG_succ] @@ -325,44 +325,44 @@ theorem cor3_large : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ) (S : Fi have hΦ : AntitoneOn Φ (Icc s b) := fun u hu v hv huv => div_le_div_of_nonneg_right (antitoneOn_cor3Weight r hs hb hu hv huv) hL2.le have hΦ0 : ∀ t ∈ Icc s b, 0 ≤ Φ t := fun t ht => by - have ht1 : (1 : ℝ) ≤ t := by linarith [ht.1] + have ht1 : (1 : ℝ) ≤ t := by linarith only [ht.1, hs4, ht] have := lsx_nonneg (log y) ht1 have := majG_pos r (t - 1) exact div_nonneg (mul_nonneg (mul_nonneg (rpow_pos_of_pos (by linarith) _).le this.le) (by positivity)) hL2.le - have h13 := hC Φ y s b S hy (by linarith) hsb hB hΦ hΦ0 hS1 hS2 + have h13 := hC Φ y s b S hy (by linarith only [hs4]) hsb hB hΦ hΦ0 hS1 hS2 have hsum : ∑ p ∈ S, delta (log y / log p - 1) (y / p) * errMaj (!lower) (log y / log p - 1) / (p * log (y / p) ^ 2) ≤ ∑ p ∈ S, Φ (log y / log p) / p := by refine sum_le_sum fun p hp => ?_ obtain ⟨hpp, hpB, hpA⟩ := hS1 p hp - have ht := (div_log_mem_Icc hy (by linarith) hsb ⟨hpB, hpA⟩).2 + have ht := (div_log_mem_Icc hy (by linarith only [hs4]) hsb ⟨hpB, hpA⟩).2 rw [hG'] - exact cor3_summand_le hy hpp.one_lt (by linarith [ht.1]) (majG_pos _ _).le + exact cor3_summand_le hy hpp.one_lt (by linarith only [ht.1, hs4, ht]) (majG_pos _ _).le have hint : ∫ t in s..b, Φ t / t = (∫ t in s..b, (1 + t ^ 2 * log t ^ 5 / log y ^ 2) ^ (5 * (t - 1)) * majG r (t - 1) * t / (t - 1) ^ 2) / log y ^ 2 := by rw [← intervalIntegral.integral_div] refine intervalIntegral.integral_congr fun t ht => ?_ rw [uIcc_of_le hsb] at ht - have : t ≠ 0 := by linarith [ht.1] - have : t - 1 ≠ 0 := by linarith [ht.1] + have : t ≠ 0 := by linarith only [ht.1, hs4, ht] + have : t - 1 ≠ 0 := by linarith only [ht.1, hs4, ht] simp only [Φ] field_simp have h11 := lemma11 r hs hsb hb have hΦs : Φ s ≤ delta s y * (32 * s ^ 2 * majG (r + 1) s) / log y ^ 2 := by - have h1 := growth_le_delta (y := y) (by linarith : (1 : ℝ) ≤ s) le_rfl - have h2 := errMaj_shift_sq_le lower (!lower) (by linarith : (2 : ℝ) ≤ s) + have h1 := growth_le_delta (y := y) (by linarith only [hs4] : (1 : ℝ) ≤ s) le_rfl + have h2 := errMaj_shift_sq_le lower (!lower) (by linarith only [hs4] : (2 : ℝ) ≤ s) rw [hG', hGs] at h2 have h3 : 0 ≤ majG r (s - 1) * (s ^ 2 / (s - 1) ^ 2) := by have := majG_pos r (s - 1); positivity change (1 + s ^ 2 * log s ^ 5 / log y ^ 2) ^ (5 * (s - 1)) * majG r (s - 1) * (s ^ 2 / (s - 1) ^ 2) / log y ^ 2 ≤ _ rw [mul_assoc _ (majG r (s - 1))] - exact div_le_div_of_nonneg_right (mul_le_mul h1 h2 h3 (delta_pos (by linarith) y).le) + exact div_le_div_of_nonneg_right (mul_le_mul h1 h2 h3 (delta_pos (by linarith only [hs4]) y).le) hL2.le rw [abs_le] at h13 rw [hint] at h13 have hpE := pntE_pos (y ^ (1 / b)) - have hδ := delta_pos (by linarith : (1 : ℝ) ≤ s) y + have hδ := delta_pos (by linarith only [hs4] : (1 : ℝ) ≤ s) y have hG := majG_pos (r + 1) s have hsb2 : s ^ 2 ≤ b ^ 2 := by gcongr rw [hGs] @@ -383,7 +383,7 @@ theorem cor3_large : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ) (S : Fi majG r (t - 1) * t / (t - 1) ^ 2) / log y ^ 2 ≤ delta s y * majG (r + 1) s / log y ^ 2 := div_le_div_of_nonneg_right h11.le hL2.le calc _ ≤ ∑ p ∈ S, Φ (log y / log p) / p := hsum - _ ≤ _ := by nlinarith + _ ≤ _ := by nlinarith only [h13, e1, e2, e3] /-- Corollary 3 on `[s, a]` with `a ≤ e^{32}`: here `δ(t_p - 1, y/p) ≤ δ(e^{32}, y)` and Lemma 13 is applied to `G'(t-1) t²/(t-1)²` directly. -/ @@ -396,28 +396,28 @@ theorem cor3_small : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s a : ℝ) (S : Fi delta (exp 32) y / log y ^ 2 * (errMaj lower s - errMaj lower a + C * s ^ 2 * errMaj lower s * pntE (y ^ (1 / a))) := by obtain ⟨C, hC0, hC⟩ := lemma13_param - refine ⟨32 * C, by linarith, fun lower y s a S hy hs hsa ha hB hS1 hS2 => ?_⟩ + refine ⟨32 * C, by linarith only [hC0], fun lower y s a S hy hs hsa ha hB hS1 hS2 => ?_⟩ have hs2 : 2 ≤ s := (two_le_errLower lower).trans hs have hL : 0 < log y := log_pos hy have hL2 : 0 < log y ^ 2 := by positivity set F : ℝ → ℝ := fun t => errMaj (!lower) (t - 1) * (t ^ 2 / (t - 1) ^ 2) with hFdef have hF : AntitoneOn F (Icc s a) := - antitoneOn_mul_of_nonneg (fun u _ v _ huv => errMaj_antitone _ (by linarith)) + antitoneOn_mul_of_nonneg (fun u _ v _ huv => errMaj_antitone _ (by linarith only [huv])) (antitoneOn_sq_div_sq_sub_one.mono fun t ht => show (1 : ℝ) < t by linarith [ht.1]) (fun t _ => (errMaj_pos _ _).le) fun t _ => by positivity have hF0 : ∀ t ∈ Icc s a, 0 ≤ F t := fun t _ => by have := errMaj_pos (!lower) (t - 1); positivity - have h13 := hC F y s a S hy (by linarith) hsa hB hF hF0 hS1 hS2 + have h13 := hC F y s a S hy (by linarith only [hs2]) hsa hB hF hF0 hS1 hS2 have hδ0 : 0 ≤ delta (exp 32) y := - (delta_pos (by linarith [four_lt_of_exp_le (le_refl (exp 32))]) y).le + (delta_pos (by linarith only [four_lt_of_exp_le (le_refl (exp 32)), hsa, ha, hs2]) y).le have hsum : ∑ p ∈ S, delta (log y / log p - 1) (y / p) * errMaj (!lower) (log y / log p - 1) / (p * log (y / p) ^ 2) ≤ delta (exp 32) y / log y ^ 2 * ∑ p ∈ S, F (log y / log p) / p := by rw [mul_sum] refine sum_le_sum fun p hp => ?_ obtain ⟨hpp, hpB, hpA⟩ := hS1 p hp - have ht := (div_log_mem_Icc hy (by linarith) hsa ⟨hpB, hpA⟩).2 + have ht := (div_log_mem_Icc hy (by linarith only [hs2]) hsa ⟨hpB, hpA⟩).2 refine (cor3_summand_le hy hpp.one_lt (by linarith [ht.1]) (errMaj_pos _ _).le).trans ?_ - have hg := growth_le_delta (y := y) (by linarith [ht.1] : (1 : ℝ) ≤ log y / log p) + have hg := growth_le_delta (y := y) (by linarith only [ht.1, hs2, ht] : (1 : ℝ) ≤ log y / log p) (ht.2.trans ha) have hF1 : 0 ≤ F (log y / log p) := hF0 _ ht have hp0 : (0 : ℝ) < p := by exact_mod_cast hpp.pos @@ -430,8 +430,8 @@ theorem cor3_small : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s a : ℝ) (S : Fi rw [← integral_errMaj_shift lower hs hsa] refine intervalIntegral.integral_congr fun t ht => ?_ rw [uIcc_of_le hsa] at ht - have : t ≠ 0 := by linarith [ht.1] - have : t - 1 ≠ 0 := by linarith [ht.1] + have : t ≠ 0 := by linarith only [ht.1, hs2, ht] + have : t - 1 ≠ 0 := by linarith only [ht.1, hs2, ht] simp only [F] field_simp have hFs : F s ≤ 32 * s ^ 2 * errMaj lower s := errMaj_shift_sq_le lower (!lower) hs2 @@ -441,7 +441,7 @@ theorem cor3_small : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s a : ℝ) (S : Fi errMaj lower s - errMaj lower a + 32 * C * s ^ 2 * errMaj lower s * pntE (y ^ (1 / a)) := by have : C * F s * pntE (y ^ (1 / a)) ≤ C * (32 * s ^ 2 * errMaj lower s) * pntE (y ^ (1 / a)) := by gcongr - linarith [h13.2] + linarith only [h13.2, h13, this] calc _ ≤ _ := hsum _ ≤ _ := mul_le_mul_of_nonneg_left hmain (div_nonneg hδ0 hL2.le) @@ -460,7 +460,7 @@ theorem cor3_primesLT : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < (1 + C * b ^ 2 * pntE (y ^ (1 / b))) := by obtain ⟨C₁, hC₁, h₁⟩ := cor3_large obtain ⟨C₂, hC₂, h₂⟩ := cor3_small - refine ⟨C₁ + C₂, by linarith, fun lower y s b hy hs hb32 hB hb => ?_⟩ + refine ⟨C₁ + C₂, by linarith only [hC₁, hC₂], fun lower y s b hy hs hb32 hB hb => ?_⟩ set s₀ := exp 32 with hs₀ have hs2 : 2 ≤ s := (two_le_errLower lower).trans hs have hs₀4 : 4 < s₀ := four_lt_of_exp_le le_rfl @@ -470,17 +470,17 @@ theorem cor3_primesLT : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < set S := (primesLT (y ^ (1 / s))).filter (fun p : ℕ => y ^ (1 / b) ≤ p) with hS have hRHS : 0 ≤ delta (max s s₀) y * errMaj lower s / log y ^ 2 * (1 + (C₁ + C₂) * b ^ 2 * pntE (y ^ (1 / b))) := by - have := delta_pos (by linarith [le_max_left s s₀] : (1 : ℝ) ≤ max s s₀) y + have := delta_pos (by linarith only [le_max_left s s₀, hs2] : (1 : ℝ) ≤ max s s₀) y have : 0 ≤ (C₁ + C₂) * b ^ 2 * pntE (y ^ (1 / b)) := - mul_nonneg (mul_nonneg (by linarith) (sq_nonneg b)) hpE.le + mul_nonneg (mul_nonneg (by linarith only [hC₁, hC₂]) (sq_nonneg b)) hpE.le positivity rcases lt_or_ge b s with hbs | hsb · -- no primes have hempty : S = ∅ := by refine Finset.eq_empty_of_forall_notMem fun p hp => ?_ rw [hS, mem_filter, mem_primesLT] at hp - have := rpow_one_div_le_rpow_one_div hy.le (by linarith) hbs.le - linarith [hp.1.2, hp.2] + have := rpow_one_div_le_rpow_one_div hy.le (by linarith only [hb32, hs₀4]) hbs.le + linarith only [hp.1.2, hp.2, hp, this] rw [hempty, sum_empty] exact hRHS rcases le_total s₀ s with hs₀s | hss₀ @@ -489,35 +489,37 @@ theorem cor3_primesLT : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < refine (h₁ lower y s b S hy hs₀s hsb hB hb (fun p hp => ?_) fun p hp h1 h2 => ?_).trans ?_ · rw [hS, mem_filter, mem_primesLT] at hp; exact ⟨hp.1.1, hp.2, hp.1.2.le⟩ · rw [hS, mem_filter, mem_primesLT]; exact ⟨⟨hp, h2⟩, h1.le⟩ - · have := delta_pos (by linarith : (1 : ℝ) ≤ s) y + · have := delta_pos (by linarith only [hs₀4, hs₀s] : (1 : ℝ) ≤ s) y gcongr - linarith + linarith only [hC₂] -- `s < s₀`: split at `y^{1/s₀}` rw [max_eq_right hss₀] - have hB₀ : y ^ (1 / b) ≤ y ^ (1 / s₀) := rpow_one_div_le_rpow_one_div hy.le (by linarith) hb32 - have hB₀s : y ^ (1 / s₀) ≤ y ^ (1 / s) := rpow_one_div_le_rpow_one_div hy.le (by linarith) hss₀ + have hB₀ : y ^ (1 / b) ≤ y ^ (1 / s₀) := rpow_one_div_le_rpow_one_div hy.le (by + linarith only [hs₀4]) hb32 + have hB₀s : y ^ (1 / s₀) ≤ y ^ (1 / s) := rpow_one_div_le_rpow_one_div hy.le (by + linarith only [hs2]) hss₀ rw [← sum_filter_add_sum_filter_not S (fun p : ℕ => y ^ (1 / s₀) ≤ p)] have e₁ := h₂ lower y s s₀ (S.filter fun p : ℕ => y ^ (1 / s₀) ≤ p) hy hs hss₀ le_rfl - (by linarith) (fun p hp => by + (by linarith only [hB, hB₀]) (fun p hp => by rw [mem_filter, hS, mem_filter, mem_primesLT] at hp exact ⟨hp.1.1.1, hp.2, hp.1.1.2.le⟩) (fun p hp h1 h2 => by rw [mem_filter, hS, mem_filter, mem_primesLT] - exact ⟨⟨⟨hp, h2⟩, by linarith⟩, h1.le⟩) + exact ⟨⟨⟨hp, h2⟩, by linarith only [hB₀, h1]⟩, h1.le⟩) have e₂ := h₁ lower y s₀ b (S.filter fun p : ℕ => ¬ y ^ (1 / s₀) ≤ p) hy le_rfl hb32 hB hb (fun p hp => by rw [mem_filter, hS, mem_filter, mem_primesLT] at hp exact ⟨hp.1.1.1, hp.1.2, (not_le.1 hp.2).le⟩) (fun p hp h1 h2 => by rw [mem_filter, hS, mem_filter, mem_primesLT] - exact ⟨⟨⟨hp, by linarith⟩, h1.le⟩, not_le.2 h2⟩) + exact ⟨⟨⟨hp, by linarith only [hB₀s, h2]⟩, h1.le⟩, not_le.2 h2⟩) refine (add_le_add e₁ e₂).trans ?_ -- combine - have hδ := delta_pos (by linarith : (1 : ℝ) ≤ s₀) y + have hδ := delta_pos (by linarith only [hs₀4] : (1 : ℝ) ≤ s₀) y have hG₀ := errMaj_pos lower s₀ have hGG : errMaj lower s₀ ≤ errMaj lower s := errMaj_antitone lower hss₀ have hpE₀ : pntE (y ^ (1 / s₀)) ≤ pntE (y ^ (1 / b)) := - pntE_le_pntE (by linarith) hB₀ + pntE_le_pntE (by linarith only [hB]) hB₀ have hsb2 : s ^ 2 * pntE (y ^ (1 / s₀)) ≤ b ^ 2 * pntE (y ^ (1 / b)) := by have : s ^ 2 ≤ b ^ 2 := by gcongr exact mul_le_mul this hpE₀ (pntE_pos _).le (sq_nonneg b) @@ -531,7 +533,7 @@ theorem cor3_primesLT : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < C₂ * s ^ 2 * errMaj lower s * pntE (y ^ (1 / s₀)) + errMaj lower s₀ * (1 + C₁ * b ^ 2 * pntE (y ^ (1 / b))) ≤ errMaj lower s * (1 + (C₁ + C₂) * b ^ 2 * pntE (y ^ (1 / b))) := by - nlinarith + nlinarith only [i1, i2] have hk : 0 ≤ delta s₀ y / log y ^ 2 := div_nonneg hδ.le hL2.le calc delta s₀ y / log y ^ 2 * (errMaj lower s - errMaj lower s₀ + C₂ * s ^ 2 * errMaj lower s * pntE (y ^ (1 / s₀))) + @@ -548,7 +550,7 @@ theorem cor3_primesLT : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < theorem lt_rpow_one_div_max_three {y s x : ℝ} (hy : 1 < y) (hs : 0 < s) (hx : 0 ≤ x) : x < y ^ (1 / max s 3) ↔ x < y ^ (1 / s) ∧ x ^ 3 < y := by have h3 : x < y ^ (1 / (3 : ℝ)) ↔ x ^ 3 < y := by - rw [one_div, lt_rpow_inv_iff_of_pos hx (by linarith) (by norm_num)] + rw [one_div, lt_rpow_inv_iff_of_pos hx (by linarith only [hy]) (by norm_num)] norm_cast rcases le_total s 3 with hs3 | hs3 · rw [max_eq_right hs3, h3] @@ -586,14 +588,14 @@ theorem cor3 : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < y → sM (primesLT (y ^ (1 / max s 3))).filter (fun p : ℕ => y ^ (1 / b) ≤ p) := by ext p simp only [mem_filter, mem_rosserPrimes, mem_primesLT, Bool.false_eq_true, false_or] - rw [lt_rpow_one_div_max_three hy (by linarith) (Nat.cast_nonneg p)] + rw [lt_rpow_one_div_max_three hy (by linarith only [hs1]) (Nat.cast_nonneg p)] tauto have hG : errMaj false (max s 3) = errMaj false s := by rcases le_total s 3 with h | h · rw [max_eq_right h, errMaj_false_of_le_three le_rfl, errMaj_false_of_le_three h] · rw [max_eq_left h] have hmax : max (max s 3) (exp 32) = max s (exp 32) := by - have : (3 : ℝ) ≤ exp 32 := by linarith [four_lt_of_exp_le (le_refl (exp 32))] + have : (3 : ℝ) ≤ exp 32 := by linarith only [four_lt_of_exp_le (le_refl (exp 32))] rw [max_assoc, max_eq_right this] rw [hset, ← hG, ← hmax] exact hC false y (max s 3) b hy (le_max_right _ _) hb32 hB hb @@ -604,7 +606,7 @@ theorem cor3 : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s b : ℝ), 1 < y → sM theorem sq_mul_log_pow_four_le_of_le {b b' X : ℝ} (hb : 1 ≤ b) (hbb' : b ≤ b') (h : b' ^ 2 * log b' ^ 4 ≤ X) : b ^ 2 * log b ^ 4 ≤ X := by have := log_nonneg hb - have : log b ≤ log b' := log_le_log (by linarith) hbb' + have : log b ≤ log b' := log_le_log (by linarith only [hb]) hbb' have : b ^ 2 * log b ^ 4 ≤ b' ^ 2 * log b' ^ 4 := by gcongr linarith diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/Crude.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/Crude.lean index b713b43aab..7759d722ab 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/Crude.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/Crude.lean @@ -53,7 +53,7 @@ theorem pow_succ_add_mul_le_add_pow {a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (n ≤ (a + b) * (a ^ (n + 1) + (n + 1) * a ^ n * b) := by push_cast rw [pow_succ a (n + 1), pow_succ a n] - nlinarith [mul_nonneg h1 hb] + nlinarith only [mul_nonneg h1 hb, h2] _ ≤ (a + b) * (a + b) ^ (n + 1) := by gcongr _ = (a + b) ^ (n + 1 + 1) := by ring @@ -92,7 +92,7 @@ theorem sum_pow_sum_lt_mul_le (s : Finset ℕ) {w : ℕ → ℝ} (hw : ∀ p ∈ exact ih hw' _ ≤ (w a + ∑ q ∈ s, w q) ^ (n + 1) / (n + 1) := by rw [add_comm (w a), le_div_iff₀ hn, add_mul, div_mul_cancel₀ _ hn.ne'] - nlinarith + nlinarith only [this] /-- `∑_{p < z} SLT(p)^n / p ≤ SLT(z)^{n+1} / (n+1)`. -/ theorem sum_SLT_pow_div_le (n : ℕ) (z : ℝ) : @@ -240,7 +240,7 @@ theorem sum_pow_div_factorial_le {X u : ℝ} (hX : 0 ≤ X) (hu : 0 < u) (h : 2 rw [hk, Nat.add_one_le_iff, Nat.floor_lt hu.le] exact hs l hl have he : 1 ≤ exp 1 := one_le_exp zero_le_one - have h2X : 2 * X ≤ k + 1 := by nlinarith + have h2X : 2 * X ≤ k + 1 := by nlinarith only [h, huk, hX, he] have hf : (0 : ℝ) < k.factorial := by exact_mod_cast k.factorial_pos -- each term is at most `X^k/k! · 2^{-(l-k)}` have hterm : ∀ j : ℕ, X ^ (k + j) / (k + j).factorial ≤ @@ -259,7 +259,7 @@ theorem sum_pow_div_factorial_le {X u : ℝ} (hX : 0 ≤ X) (hu : 0 < u) (h : 2 refine mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (by positivity) ?_ j) (by positivity) rw [div_le_iff₀ (by positivity)] - linarith + linarith only [h2X] set N := s.sup id + 1 have hsub : s ⊆ Ico k N := fun l hl ↦ mem_Ico.2 ⟨hks l hl, Nat.lt_succ_of_le (le_sup (f := id) hl)⟩ @@ -284,7 +284,7 @@ theorem sum_pow_div_factorial_le {X u : ℝ} (hX : 0 ≤ X) (hu : 0 < u) (h : 2 refine mul_le_mul_of_nonneg_right ?_ (by norm_num) refine rpow_le_rpow_of_exponent_ge' (by positivity) ?_ hu.le huk.le rw [div_le_one hu] - nlinarith [exp_pos 1] + nlinarith only [exp_pos 1, hu, h] _ = 2 * (exp 1 * X / u) ^ u := mul_comm _ _ /-- `(e X / u)^u = exp (-(u log u) + u log X + u)`. -/ @@ -307,22 +307,22 @@ theorem fail_le_tail {lower : Bool} {r : ℕ} {y z X u : ℝ} (hz : 1 < z) (hu : rw [← rpow_natCast] at hl have := (rpow_lt_rpow_left_iff hz).1 (hyz.trans_lt hl) push_cast at this - linarith + linarith only [this] /-- `fail_le_tail` with `z = y^{1/s}`: for `y > 1`, `s > 2`, `SLT (y^{1/s}) ≤ X` and `2 e X ≤ s - 2`, `fail lower r y y^{1/s} ≤ 2 (e X / (s - 2))^{s - 2}`. -/ theorem fail_rpow_le_tail {lower : Bool} {r : ℕ} {y s X : ℝ} (hy : 1 < y) (hs : 2 < s) (hX : SLT (y ^ s⁻¹) ≤ X) (h : 2 * exp 1 * X ≤ s - 2) : fail lower r y (y ^ s⁻¹) ≤ 2 * (exp 1 * X / (s - 2)) ^ (s - 2) := by - have hs0 : 0 < s := by linarith - refine fail_le_tail (one_lt_rpow hy (inv_pos.2 hs0)) (by linarith) ?_ hX h - rw [sub_add_cancel, ← rpow_mul (by linarith), inv_mul_cancel₀ hs0.ne', rpow_one] + have hs0 : 0 < s := by linarith only [hs] + refine fail_le_tail (one_lt_rpow hy (inv_pos.2 hs0)) (by linarith only [hs]) ?_ hX h + rw [sub_add_cancel, ← rpow_mul (by linarith only [hy]), inv_mul_cancel₀ hs0.ne', rpow_one] /-- `SLT z ≤ log log z + C` for `z ≥ 2`. -/ theorem SLT_le_loglog : ∃ C : ℝ, ∀ z ≥ 2, SLT z ≤ log (log z) + C := by obtain ⟨c₅, C, hC⟩ := S_asymp refine ⟨c₅ + |C|, fun z hz ↦ ?_⟩ - have h1 := (S_sub_SLT (by linarith : (0 : ℝ) < z)).1 + have h1 := (S_sub_SLT (by linarith only [hz] : (0 : ℝ) < z)).1 have h2 := (abs_le.1 (hC z hz)).2 have h3 : C * pntE z ≤ |C| := by calc @@ -330,7 +330,7 @@ theorem SLT_le_loglog : ∃ C : ℝ, ∀ z ≥ 2, SLT z ≤ log (log z) + C := b mul_le_mul_of_nonneg_right (le_abs_self C) (pntE_nonneg z) _ ≤ |C| * 1 := mul_le_mul_of_nonneg_left (pntE_le_one z) (abs_nonneg C) _ = |C| := mul_one _ - linarith + linarith only [h1, h2, h3] /-! ### Counts -/ diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/Depth.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/Depth.lean index 62fa246b7d..a72a626120 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/Depth.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/Depth.lean @@ -67,7 +67,7 @@ theorem LeProdPrimesLT.succ (h : LeProdPrimesLT r y z) : LeProdPrimesLT (r + 1) have h1 := h (T.erase a) ((erase_subset a T).trans hT) (by rw [card_erase_of_mem ha, hcard]; rfl) have h2 : (1 : ℝ) ≤ a := by exact_mod_cast (prime_of_mem_primesLT (hT ha)).one_lt.le have h3 := one_le_prod_primes ((erase_subset a T).trans hT) - nlinarith + nlinarith only [h1, h2, h3] theorem LeProdPrimesLT.mono {s : ℕ} (h : LeProdPrimesLT r y z) (hrs : r ≤ s) : LeProdPrimesLT s y z := by @@ -210,7 +210,7 @@ theorem card_primeFactors_le_of_mem_rosserSet (hr : 1 ≤ r) (h : LeProdPrimesLT have h' := (Nat.cast_le (α := ℝ)).2 hTd push_cast at h' exact h' - linarith + linarith only [hdy, hyT, this] theorem card_filter_rosserSet_add_eq (hr : 1 ≤ r) (h : LeProdPrimesLT (r + 1) y z) (j : ℕ) : #((rosserSet lower y z).filter fun d ↦ #d.primeFactors ≤ r + j) = @@ -232,13 +232,13 @@ theorem mul_log_sub_one_le_log_factorial (n : ℕ) : rw [div_le_iff₀ hf] at h have := log_le_log (by positivity) h rw [log_pow, log_mul (exp_pos _).ne' hf.ne', log_exp] at this - linarith + linarith only [this] /-- `log x ≤ 2 √x`. -/ theorem log_le_two_mul_sqrt {x : ℝ} (hx : 0 ≤ x) : log x ≤ 2 * √x := by have := log_le_rpow_div hx (by norm_num : (0 : ℝ) < 1 / 2) rw [← sqrt_eq_rpow] at this - linarith + linarith only [this] /-- [I71, p. 23]: if `r + 2 > 2 log y / log log y` and `y` is large then `y ≤ (r + 1)!`, so every product of `r` distinct primes is at least `y`; moreover `r ≥ 2`. -/ @@ -251,21 +251,21 @@ theorem exists_le_factorial : ∃ y₀ : ℝ, ∀ y ≥ y₀, ∀ r : ℕ, have hL49 : exp 49 ≤ L := by rw [hL, le_log_iff_exp_le hy0]; exact hy have hL0 : 0 < L := (exp_pos _).trans_le hL49 have hℓ49 : 49 ≤ ℓ := by rw [hℓ, le_log_iff_exp_le hL0]; exact hL49 - have hℓ0 : 0 < ℓ := by linarith + have hℓ0 : 0 < ℓ := by linarith only [hℓ49] -- `ℓ ≤ L / 4` have hsqrtL : 64 ≤ L := by have := quadratic_le_exp_of_nonneg (by norm_num : (0 : ℝ) ≤ 49) - linarith + linarith only [hL49, this] have hℓL : 4 * ℓ ≤ L := by have h1 := log_le_two_mul_sqrt hL0.le have h2 : 8 ≤ √L := by rw [show (8 : ℝ) = √64 by rw [show (64 : ℝ) = 8 ^ 2 by norm_num, sqrt_sq (by norm_num)]] exact sqrt_le_sqrt hsqrtL have h3 : √L * √L = L := mul_self_sqrt hL0.le - nlinarith - have hratio : 4 ≤ L / ℓ := by rw [le_div_iff₀ hℓ0]; linarith + nlinarith only [hℓ49, h1, h3] + have hratio : 4 ≤ L / ℓ := by rw [le_div_iff₀ hℓ0]; linarith only [hℓL] have h2Lℓ : 2 * L / ℓ = 2 * (L / ℓ) := by ring - refine ⟨by exact_mod_cast (by linarith : (2 : ℝ) ≤ r), ?_⟩ + refine ⟨by exact_mod_cast (by linarith only [hr, hratio, h2Lℓ] : (2 : ℝ) ≤ r), ?_⟩ -- `log ℓ ≤ (ℓ - 3) / 3` have hlogℓ : 3 * log ℓ + 3 ≤ ℓ := by have h1 := log_le_two_mul_sqrt hℓ0.le @@ -273,7 +273,7 @@ theorem exists_le_factorial : ∃ y₀ : ℝ, ∀ y ≥ y₀, ∀ r : ℕ, rw [show (7 : ℝ) = √49 by rw [show (49 : ℝ) = 7 ^ 2 by norm_num, sqrt_sq (by norm_num)]] exact sqrt_le_sqrt hℓ49 have h3 : √ℓ * √ℓ = ℓ := mul_self_sqrt hℓ0.le - nlinarith + nlinarith only [hℓ49, h1, h3, h2] set m := 3 * L / (2 * ℓ) with hm have hm0 : 0 < m := by positivity set n : ℕ := r + 1 with hn @@ -282,14 +282,14 @@ theorem exists_le_factorial : ∃ y₀ : ℝ, ∀ y ≥ y₀, ∀ r : ℕ, rw [hn_cast, hm] have : 3 * L / (2 * ℓ) = 3 / 2 * (L / ℓ) := by field_simp rw [this] - linarith + linarith only [hr, hratio, h2Lℓ] have hlogm : ℓ - log ℓ ≤ log m := by rw [hm, log_div (by positivity) (by positivity), log_mul (by norm_num) hL0.ne', log_mul (by norm_num) hℓ0.ne', ← hℓ] have : log 2 ≤ log 3 := log_le_log (by norm_num) (by norm_num) - linarith + linarith only [this] have hkey : L ≤ m * (log m - 1) := by - have h1 : 2 * ℓ / 3 ≤ log m - 1 := by linarith + have h1 : 2 * ℓ / 3 ≤ log m - 1 := by linarith only [hlogℓ, hlogm] calc L = m * (2 * ℓ / 3) := by rw [hm]; field_simp _ ≤ m * (log m - 1) := by gcongr have hmono : m * (log m - 1) ≤ n * (log n - 1) := by @@ -297,10 +297,10 @@ theorem exists_le_factorial : ∃ y₀ : ℝ, ∀ y ≥ y₀, ∀ r : ℕ, have h2 : 0 ≤ log m - 1 := by by_contra h have : m * (log m - 1) < 0 := mul_neg_of_pos_of_neg hm0 (not_le.1 h) - linarith - nlinarith + linarith only [hℓ49, hlogℓ, hlogm, h] + nlinarith only [hmn, h1, hℓ49, hlogℓ, hlogm] have hfact := mul_log_sub_one_le_log_factorial n - have : L ≤ log n.factorial := by linarith + have : L ≤ log n.factorial := by linarith only [hkey, hmono, hfact] rw [hL, ← exp_le_exp, exp_log hy0, exp_log (by exact_mod_cast n.factorial_pos)] at this exact this diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/Estimate.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/Estimate.lean index 41b51d7dd9..2dc4729b68 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/Estimate.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/Estimate.lean @@ -47,14 +47,14 @@ theorem rpow_one_div_log_div {y z : ℝ} (hy : 0 < y) (hz : 1 < z) (hyl : log y y ^ (1 / (log y / log z)) = z := by have hlz : log z ≠ 0 := (log_pos hz).ne' rw [rpow_def_of_pos hy, show log y * (1 / (log y / log z)) = log z by field_simp, - exp_log (by linarith)] + exp_log (by linarith only [hz])] /-- `log (1 + x) ≥ x / (1 + x)` for `x ≥ 0`. -/ theorem div_one_add_le_log_one_add {x : ℝ} (hx : 0 ≤ x) : x / (1 + x) ≤ log (1 + x) := by have h := log_le_sub_one_of_pos (show 0 < (1 + x)⁻¹ by positivity) rw [log_inv] at h have : (1 + x)⁻¹ - 1 = -(x / (1 + x)) := by field_simp; ring - linarith + linarith only [h, this] /-- If `0 ≤ x ≤ 1/2` and `s ≥ 2 + x`, then `log(s - 1) ≥ 2x/3`. This supplies the logarithmic gain in the linear sieve estimate and Theorem 2. -/ diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaEleven.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaEleven.lean index 8704a11930..97bff3a754 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaEleven.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaEleven.lean @@ -61,8 +61,8 @@ theorem hasDerivAt_growth (L a : ℝ) {t : ℝ} (ht : 1 ≤ t) : ((2 * t * log t ^ 5 + 5 * t * log t ^ 4) / L ^ 2) / (1 + t ^ 2 * log t ^ 5 / L ^ 2))) t := by set x := t ^ 2 * log t ^ 5 / L ^ 2 - have hx : 0 < 1 + x := by linarith [lsx_nonneg L ht] - have h := ((hasDerivAt_lsx L (by linarith)).const_add 1).rpow + have hx : 0 < 1 + x := by linarith only [lsx_nonneg L ht, ht] + have h := ((hasDerivAt_lsx L (by linarith only [ht])).const_add 1).rpow (((hasDerivAt_id' t).sub_const a).const_mul 5) hx convert h using 1 rw [rpow_sub_one hx.ne'] @@ -132,11 +132,11 @@ theorem rate_bound {L a t : ℝ} (ha : 0 ≤ a) (ha1 : a ≤ 1) (ht1 : 1 ≤ t) theorem majG_succ_mul_log_lt (r : ℕ) {t : ℝ} (ht : 2 ≤ t) : majG (r + 1) t * log t < 4 * (majG r (t - 1) * t / (t - 1) ^ 2) := by have h := majG_succ_mul_log_div_lt r ht - have hK : 0 < majG r (t - 1) * t := mul_pos (majG_pos r _) (by linarith) - have h1 : 0 < (t - 1) ^ 2 := by nlinarith + have hK : 0 < majG r (t - 1) * t := mul_pos (majG_pos r _) (by linarith only [ht]) + have h1 : 0 < (t - 1) ^ 2 := by nlinarith only [ht] rw [div_lt_iff₀ hK] at h rw [mul_div_assoc', lt_div_iff₀ h1] - linarith + linarith only [h] theorem five_add_neg_one_pow_div_le (r : ℕ) : (5 + (-1 : ℝ) ^ r) / 2 ≤ 3 := by rcases Nat.even_or_odd r with hr | hr @@ -149,19 +149,19 @@ theorem five_add_neg_one_pow_div_le (r : ℕ) : (5 + (-1 : ℝ) ^ r) / 2 ≤ 3 : theorem range_facts {L t b : ℝ} (ht : exp 32 ≤ t) (htb : t ≤ b) (hb : b ^ 2 * log b ^ 4 ≤ L ^ 2 / 160) : 1 ≤ t ∧ 32 ≤ log t ∧ t ^ 2 * log t ^ 4 / L ^ 2 ≤ 1 / 160 ∧ 0 < L ^ 2 := by - have ht1 : 1 ≤ t := le_trans (by linarith [add_one_le_exp (32 : ℝ)]) ht - have hlt : 32 ≤ log t := (le_log_iff_exp_le (by linarith)).2 ht - have hlb : log t ≤ log b := log_le_log (by linarith) htb + have ht1 : 1 ≤ t := le_trans (by linarith only [add_one_le_exp (32 : ℝ)]) ht + have hlt : 32 ≤ log t := (le_log_iff_exp_le (by linarith only [ht1])).2 ht + have hlb : log t ≤ log b := log_le_log (by linarith only [ht1]) htb have h4 : t ^ 2 * log t ^ 4 ≤ b ^ 2 * log b ^ 4 := by - have : 0 ≤ log t := by linarith + have : 0 ≤ log t := by linarith only [hlt] gcongr have hpos : 0 < t ^ 2 * log t ^ 4 := by - have : 0 < log t := by linarith - have : 0 < t := by linarith + have : 0 < log t := by linarith only [hlt] + have : 0 < t := by linarith only [ht1] positivity - have hL : 0 < L ^ 2 := by linarith + have hL : 0 < L ^ 2 := by linarith only [hb, h4, hpos] refine ⟨ht1, hlt, ?_, hL⟩ - rw [div_le_iff₀ hL]; linarith + rw [div_le_iff₀ hL]; linarith only [hb, h4] /-- `(1 + x)^{5(t-1)} = (1 + x)^{5t} / (1 + x)^5`. -/ theorem rpow_five_mul_sub_one {x : ℝ} (hx : 0 < x) (t : ℝ) : @@ -177,8 +177,8 @@ theorem continuousOn_lemma11_integrand (L : ℝ) (r : ℕ) {s b : ℝ} (hs : 2 ContinuousOn (fun t => (1 + t ^ 2 * log t ^ 5 / L ^ 2) ^ (5 * (t - 1)) * majG r (t - 1) * t / (t - 1) ^ 2) (Icc s b) := by refine continuousOn_of_forall_continuousAt fun t ht => ?_ - have ht1 : t - 1 ≠ 0 := by linarith [ht.1] - exact (((continuousAt_growth L 1 (by linarith [ht.1])).mul + have ht1 : t - 1 ≠ 0 := by linarith only [ht.1, hs, ht] + exact (((continuousAt_growth L 1 (by linarith only [ht.1, hs, ht])).mul ((continuous_majG r).continuousAt.comp (continuous_sub_right 1).continuousAt)).mul continuousAt_id).div ((continuous_sub_right 1).continuousAt.pow 2) (pow_ne_zero 2 ht1) @@ -188,7 +188,7 @@ theorem delta_eq_growth (s y : ℝ) : theorem delta_pos {s : ℝ} (hs : 1 ≤ s) (y : ℝ) : 0 < delta s y := by have := lsx_nonneg (log y) hs - exact rpow_pos_of_pos (by linarith) _ + exact rpow_pos_of_pos (by linarith only [this]) _ /-- The algebraic decay estimate in Lemma 11: the bound on the growth rate `E` and `G ℓ ≤ 4K` imply `K / (1 + x)⁵ ≤ K - EG`. -/ @@ -219,7 +219,7 @@ theorem lemma11 (r : ℕ) {y s b : ℝ} (hs : exp 32 ≤ s) (hsb : s ≤ b) ∫ t in s..b, (1 + t ^ 2 * log t ^ 5 / log y ^ 2) ^ (5 * (t - 1)) * majG r (t - 1) * t / (t - 1) ^ 2 < delta s y * majG (r + 1) s := by set L := log y - have hs3 : 3 < s := by linarith [add_one_le_exp (32 : ℝ)] + have hs3 : 3 < s := by linarith only [add_one_le_exp (32 : ℝ), hs] -- `τ(t) = δ(t) G_{r+1}(t)` and its derivative set τ : ℝ → ℝ := fun t => delta t y * majG (r + 1) t have hτd : ∀ t, 3 < t → HasDerivAt τ @@ -229,7 +229,7 @@ theorem lemma11 (r : ℕ) {y s b : ℝ} (hs : exp 32 ≤ s) (hsb : s ≤ b) (1 + t ^ 2 * log t ^ 5 / L ^ 2)) * majG (r + 1) t + (1 + t ^ 2 * log t ^ 5 / L ^ 2) ^ (5 * (t - 0)) * (-(majG r (t - 1) * t / (t - 1) ^ 2))) t := fun t ht => by - have h1 := hasDerivAt_growth L 0 (t := t) (by linarith) + have h1 := hasDerivAt_growth L 0 (t := t) (by linarith only [ht]) have h2 := hasDerivAt_majG_succ r (t := t) (by linarith [five_add_neg_one_pow_div_le r]) have := h1.mul h2 simp only [τ, delta_eq_growth] @@ -238,14 +238,14 @@ theorem lemma11 (r : ℕ) {y s b : ℝ} (hs : exp 32 ≤ s) (hsb : s ≤ b) (φ := fun t => (1 + t ^ 2 * log t ^ 5 / L ^ 2) ^ (5 * (t - 1)) * majG r (t - 1) * t / (t - 1) ^ 2) hsb (continuousOn_of_forall_continuousAt fun t ht => (hτd t (by linarith [ht.1])).continuousAt.neg) - (fun t ht => (hτd t (by linarith [ht.1])).neg.hasDerivWithinAt) - ((continuousOn_lemma11_integrand L r (by linarith)).integrableOn_Icc) ?_ - · have hτb : 0 < τ b := mul_pos (delta_pos (by linarith) y) (majG_pos _ _) + (fun t ht => (hτd t (by linarith only [ht.1, hs3, ht])).neg.hasDerivWithinAt) + ((continuousOn_lemma11_integrand L r (by linarith only [hs3])).integrableOn_Icc) ?_ + · have hτb : 0 < τ b := mul_pos (delta_pos (by linarith only [hsb, hs3]) y) (majG_pos _ _) simp only [τ] at key hτb ⊢ - linarith + linarith only [key, hτb] -- the pointwise inequality `-τ' ≥ (1 + x)^{5(t-1)} G_r(t-1) t/(t-1)²` intro t ht - have ht3 : 3 < t := by linarith [ht.1] + have ht3 : 3 < t := by linarith only [ht.1, hs3, ht] obtain ⟨ht1, hlt, hw, hL⟩ := range_facts (L := L) (hs.trans ht.1.le) ht.2.le hb obtain ⟨hE0, -, hE2⟩ := rate_bound (L := L) (a := 0) le_rfl zero_le_one ht1 hlt hw set x := t ^ 2 * log t ^ 5 / L ^ 2 @@ -263,7 +263,7 @@ theorem lemma11 (r : ℕ) {y s b : ℝ} (hs : exp 32 ≤ s) (hsb : s ≤ b) (by linarith only [hlt] : 0 < log t) hG.le hE2 change (1 + x) ^ (5 * (t - 1)) * majG r (t - 1) * t / (t - 1) ^ 2 ≤ -((1 + x) ^ (5 * (t - 0)) * E * G + (1 + x) ^ (5 * (t - 0)) * -K) - rw [rpow_five_mul_sub_one (by linarith)] + rw [rpow_five_mul_sub_one (by linarith only [hx0])] simp only [sub_zero] at hP ⊢ calc (1 + x) ^ (5 * t) / (1 + x) ^ 5 * majG r (t - 1) * t / (t - 1) ^ 2 = (1 + x) ^ (5 * t) * (K / (1 + x) ^ 5) := by rw [hK]; ring @@ -272,7 +272,7 @@ theorem lemma11 (r : ℕ) {y s b : ℝ} (hs : exp 32 ≤ s) (hsb : s ≤ b) /-! ### Lemma 12 and the monotonicity used in Corollary 3 -/ theorem four_lt_of_exp_le {t : ℝ} (ht : exp 32 ≤ t) : 4 < t := by - linarith [add_one_le_exp (32 : ℝ)] + linarith only [add_one_le_exp (32 : ℝ), ht] /-- If the growth rate satisfies `4E ≤ ℓ` and the decay satisfies `Gℓ ≤ 4K`, then `EG ≤ K` for `G ≥ 0`. This is the scalar comparison used in Lemma 12. -/ @@ -320,26 +320,26 @@ theorem lemma12 (r : ℕ) {L s b : ℝ} (hs : exp 32 ≤ s) (hb : b ^ 2 * log b AntitoneOn (fun t => (1 + t ^ 2 * log t ^ 5 / L ^ 2) ^ (5 * (t - 1)) * majG (r + 1) t) (Icc s b) := by refine antitoneOn_growth_mul (k := fun t => majG r (t - 1) * t / (t - 1) ^ 2) (ℓ := log) hs hb - (fun t ht => ?_) (fun t _ => (majG_pos _ _).le) (fun t ht => ?_) fun t _ => by linarith + (fun t ht => ?_) (fun t _ => (majG_pos _ _).le) (fun t ht => ?_) fun t _ => by linarith only [] · exact hasDerivAt_majG_succ r (by - linarith [five_add_neg_one_pow_div_le r, four_lt_of_exp_le (hs.trans ht.1)]) - · exact (majG_succ_mul_log_lt r (by linarith [four_lt_of_exp_le (hs.trans ht.1)])).le + linarith only [five_add_neg_one_pow_div_le r, four_lt_of_exp_le (hs.trans ht.1), hs, ht]) + · exact (majG_succ_mul_log_lt r (by linarith only [four_lt_of_exp_le (hs.trans ht.1), hs, ht])).le theorem log_sub_one_ge {t : ℝ} (ht : 2 ≤ t) : log t - 1 ≤ log (t - 1) := by - have h1 : 0 < t - 1 := by linarith - have h := log_le_sub_one_of_pos (div_pos (by linarith : (0 : ℝ) < t) h1) - rw [log_div (by linarith) h1.ne'] at h + have h1 : 0 < t - 1 := by linarith only [ht] + have h := log_le_sub_one_of_pos (div_pos (by linarith only [ht] : (0 : ℝ) < t) h1) + rw [log_div (by linarith only [ht]) h1.ne'] at h have : t / (t - 1) - 1 ≤ 1 := by - rw [div_sub_one h1.ne', div_le_one h1]; linarith - linarith + rw [div_sub_one h1.ne', div_le_one h1]; linarith only [ht] + linarith only [h, this] theorem antitoneOn_sq_div_sq_sub_one : AntitoneOn (fun t : ℝ => t ^ 2 / (t - 1) ^ 2) (Ioi 1) := by intro u hu v hv huv - have hu1 : 0 < u - 1 := by linarith [hu.out] - have hv1 : 0 < v - 1 := by linarith [hv.out] + have hu1 : 0 < u - 1 := by linarith only [hu.out, hu] + have hv1 : 0 < v - 1 := by linarith only [hv.out, huv, hu1] have h : v / (v - 1) ≤ u / (u - 1) := by - rw [div_le_div_iff₀ hv1 hu1]; nlinarith - have h0 : 0 ≤ v / (v - 1) := div_nonneg (by linarith) hv1.le + rw [div_le_div_iff₀ hv1 hu1]; nlinarith only [huv] + have h0 : 0 ≤ v / (v - 1) := div_nonneg (by linarith only [huv, hu1]) hv1.le simp only rw [← div_pow, ← div_pow] exact pow_le_pow_left₀ h0 h 2 @@ -361,9 +361,9 @@ theorem antitoneOn_cor3Weight (r : ℕ) {L s b : ℝ} (hs : exp 32 ≤ s) refine antitoneOn_growth_mul (k := fun t => majG (r + 1) (t - 1 - 1) * (t - 1) / (t - 1 - 1) ^ 2) (ℓ := fun t => log (t - 1)) hs hb (fun t ht => ?_) (fun t _ => (majG_pos _ _).le) - (fun t ht => ?_) fun t ht => log_sub_one_ge (by linarith [hfacts t ht]) + (fun t ht => ?_) fun t ht => log_sub_one_ge (by linarith only [hfacts t ht, hfacts, ht]) · have h := hasDerivAt_majG_succ (r + 1) (t := t - 1) - (by linarith [five_add_neg_one_pow_div_le (r + 1), hfacts t ht]) + (by linarith only [five_add_neg_one_pow_div_le (r + 1), hfacts t ht, hfacts, ht]) rw [majG_add_two] at h exact h.comp_sub_const t 1 · have h := majG_succ_mul_log_lt (r + 1) (t := t - 1) (by linarith [hfacts t ht]) @@ -372,8 +372,8 @@ theorem antitoneOn_cor3Weight (r : ℕ) {L s b : ℝ} (hs : exp 32 ≤ s) refine antitoneOn_mul_of_nonneg hψ (antitoneOn_sq_div_sq_sub_one.mono fun t ht => show (1 : ℝ) < t by linarith [hfacts t ht]) (fun t ht => ?_) fun t _ => by positivity - have := lsx_nonneg L (by linarith [hfacts t ht] : (1 : ℝ) ≤ t) - exact mul_nonneg (rpow_pos_of_pos (by linarith) _).le (majG_pos _ _).le + have := lsx_nonneg L (by linarith only [hfacts t ht, hfacts, ht] : (1 : ℝ) ≤ t) + exact mul_nonneg (rpow_pos_of_pos (by linarith only [this]) _).le (majG_pos _ _).le /-! ### The size of `ξ` -/ @@ -384,7 +384,7 @@ theorem xi_sq_mul_log_pow_four_div_le {y : ℝ} (hy : 1 < y) (hℓ : 1 ≤ log ( set ℓ := log (log (3 * y)) with hℓdef set L := log y with hL have hL0 : 0 < L := log_pos hy - have hℓ0 : 0 < ℓ := by linarith + have hℓ0 : 0 < ℓ := by linarith only [hℓ] have hP : 1 ≤ ℓ ^ (11 / 5 : ℝ) := one_le_rpow hℓ (by norm_num) have hξL : xi y ≤ L := by rw [xi]; exact div_le_self hL0.le hP @@ -418,13 +418,13 @@ theorem tendsto_xi : Tendsto xi atTop atTop := by filter_upwards [hv.eventually ho, hv.eventually (eventually_ge_atTop (exp 1)), hv.eventually (eventually_ge_atTop (2 * log 3)), eventually_gt_atTop 1] with y h1 h2 h3 hy simp only [one_mul] at h1 h2 h3 - have hv0 : 0 < log (3 * y) := by linarith [exp_pos 1] + have hv0 : 0 < log (3 * y) := by linarith only [exp_pos 1, h2] have hℓ : 1 ≤ log (log (3 * y)) := (le_log_iff_exp_le hv0).2 h2 - rw [norm_of_nonneg (rpow_nonneg (by linarith) _), + rw [norm_of_nonneg (rpow_nonneg (by linarith only [hℓ]) _), norm_of_nonneg (rpow_nonneg hv0.le _)] at h1 have hL : log y = log (3 * y) - log 3 := by - rw [log_mul (by norm_num) (by linarith)]; ring - have hP : 0 < log (log (3 * y)) ^ (11 / 5 : ℝ) := rpow_pos_of_pos (by linarith) _ + rw [log_mul (by norm_num) (by linarith only [hy])]; ring + have hP : 0 < log (log (3 * y)) ^ (11 / 5 : ℝ) := rpow_pos_of_pos (by linarith only [hℓ]) _ have hsq : 0 < log (3 * y) ^ (1 / 2 : ℝ) := rpow_pos_of_pos hv0 _ have hsq2 : log (3 * y) ^ (1 / 2 : ℝ) * log (3 * y) ^ (1 / 2 : ℝ) = log (3 * y) := by rw [← rpow_add hv0]; norm_num @@ -432,7 +432,7 @@ theorem tendsto_xi : Tendsto xi atTop atTop := by calc log (3 * y) ^ (1 / 2 : ℝ) / 2 * log (log (3 * y)) ^ (11 / 5 : ℝ) ≤ log (3 * y) ^ (1 / 2 : ℝ) / 2 * log (3 * y) ^ (1 / 2 : ℝ) := by gcongr _ = log (3 * y) / 2 := by rw [div_mul_eq_mul_div, hsq2] - _ ≤ log (3 * y) - log 3 := by linarith + _ ≤ log (3 * y) - log 3 := by linarith only [h3] exact tendsto_atTop_mono' atTop hbound (((tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2)).comp hv).atTop_div_const (by norm_num)) @@ -448,16 +448,16 @@ theorem exists_xi_large : ∃ y₀ : ℝ, ∀ y ≥ y₀, 1 < y ∧ exp 32 ≤ x (eventually_ge_atTop 1)).and (eventually_gt_atTop 1)))) refine ⟨y₀, fun y hy => ?_⟩ obtain ⟨h1, h2, h3, h4⟩ := hy₀ y hy - have hξ1 : 1 ≤ xi y := le_trans (by linarith [add_one_le_exp (32 : ℝ)]) h2 + have hξ1 : 1 ≤ xi y := le_trans (by linarith only [add_one_le_exp (32 : ℝ)]) h2 have hL0 : 0 < log y := log_pos h4 refine ⟨h4, h2, ?_, ?_⟩ · have := (xi_sq_mul_log_pow_four_div_le h4 h3 hξ1).trans h1 rwa [div_le_iff₀ (by positivity), div_mul_eq_mul_div, one_mul] at this - · have hℓ0 : 0 < log (log (3 * y)) := by linarith + · have hℓ0 : 0 < log (log (3 * y)) := by linarith only [h3] have hP : 0 < log (log (3 * y)) ^ (11 / 5 : ℝ) := rpow_pos_of_pos hℓ0 _ - rw [rpow_def_of_pos (by linarith), xi, mul_one_div, div_div_cancel₀ hL0.ne'] + rw [rpow_def_of_pos (by linarith only [h4]), xi, mul_one_div, div_div_cancel₀ hL0.ne'] have : 1 ≤ log (log (3 * y)) ^ (11 / 5 : ℝ) := one_le_rpow h3 (by norm_num) - calc (2 : ℝ) ≤ exp 1 := by linarith [exp_one_gt_d9] + calc (2 : ℝ) ≤ exp 1 := by linarith only [exp_one_gt_d9] _ ≤ _ := exp_le_exp.2 this end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaSeven.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaSeven.lean index f3b8055e13..7622879bd6 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaSeven.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/LemmaSeven.lean @@ -42,54 +42,54 @@ theorem FSieve_three_add_lt_four : FSieve 3 + 3 < 4 := by have h := fSieve_four_add have h4 := fSieve_pos 4 have hl := one_lt_log_three - have hK : 0 < FSieve 3 + 3 := by linarith [FSieve_nonneg 3] - nlinarith + have hK : 0 < FSieve 3 + 3 := by linarith only [FSieve_nonneg 3] + nlinarith only [h, h4, hl, hK] theorem MSieve_eq_on_Icc {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 3) : MSieve s = (FSieve 3 + 3) * (1 - log (s - 1)) := by - rw [MSieve_of_le_three hs.2, fSieve_eq_on_Icc ⟨hs.1, by linarith [hs.2]⟩]; ring + rw [MSieve_of_le_three hs.2, fSieve_eq_on_Icc ⟨hs.1, by linarith only [hs.2, hs]⟩]; ring theorem MSieve_lt_four_mul_bigM_of_le_three {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 3) : MSieve s < 4 * bigM s := by rw [MSieve_eq_on_Icc hs, bigM_eq hs.1 hs.2] - have h1 : 0 < s - 1 := by linarith [hs.1] - have hl0 : 0 ≤ log (s - 1) := log_nonneg (by linarith [hs.1]) + have h1 : 0 < s - 1 := by linarith only [hs.1, hs] + have hl0 : 0 ≤ log (s - 1) := log_nonneg (by linarith only [hs.1, hs]) have hl1 : log (s - 1) < 1 := by - rw [log_lt_iff_lt_exp h1]; linarith [hs.2, exp_one_gt_d9] + rw [log_lt_iff_lt_exp h1]; linarith only [hs.2, exp_one_gt_d9, hs] have hK := FSieve_three_add_lt_four have hinv : 0 < 1 / (s - 1) := by positivity - nlinarith + nlinarith only [hinv, hl1, hK] /-- `(s - 1) M(s) = ∫_{s-1}^s M` for `s ≥ 3` (this is `lemma5Q s = 0`). -/ theorem sub_one_mul_MSieve {s : ℝ} (hs : 3 ≤ s) : (s - 1) * MSieve s = ∫ x in (s - 1)..s, MSieve x := by have h := lemma5Q_const hs rw [lemma5Q_three, lemma5Q] at h - linarith + linarith only [h] /-- `∫_{s-1}^s 𝔐 ≤ (s-1)² 𝔐(s)/s` for `s ≥ 3`, from (3.12). -/ theorem integral_bigM_le {s : ℝ} (hs : 3 ≤ s) : ∫ x in (s - 1)..s, bigM x ≤ (s - 1) ^ 2 * bigM s / s := by - have hs0 : 0 < s := by linarith + have hs0 : 0 < s := by linarith only [hs] have hc : 0 < 1 - 1 / (2 * (s - 1) ^ 2) := by have : 1 / (2 * (s - 1) ^ 2) < 1 := by rw [div_lt_one (by nlinarith)]; nlinarith - linarith + linarith only [this] have hle : ∫ x in (s - 1)..s, (1 - 1 / (2 * (s - 1) ^ 2)) * bigM x ≤ ∫ x in (s - 1)..s, (1 - 1 / (2 * x ^ 2)) * bigM x := by - refine intervalIntegral.integral_mono_on (by linarith) + refine intervalIntegral.integral_mono_on (by linarith only []) (continuous_bigM.intervalIntegrable _ _ |>.const_mul _) - ((continuousOn_weight_mul continuous_bigM (by linarith)).intervalIntegrable_of_Icc - (by linarith)) fun x hx => ?_ - have hx1 : 0 < s - 1 := by linarith + ((continuousOn_weight_mul continuous_bigM (by linarith only [hs])).intervalIntegrable_of_Icc + (by linarith only [])) fun x hx => ?_ + have hx1 : 0 < s - 1 := by linarith only [hs] have : 1 / (2 * x ^ 2) ≤ 1 / (2 * (s - 1) ^ 2) := by apply one_div_le_one_div_of_le (by positivity) - have := hx.1; nlinarith - exact mul_le_mul_of_nonneg_right (by linarith) (bigM_pos x).le + have := hx.1; nlinarith only [this, hs] + exact mul_le_mul_of_nonneg_right (by linarith only [this]) (bigM_pos x).le rw [intervalIntegral.integral_const_mul, ← bigM_integral_identity hs] at hle have hkey : (1 - 1 / (2 * (s - 1) ^ 2)) * ((s - 1) ^ 2 * bigM s / s) = ((s - 1) ^ 2 - 1 / 2) * bigM s / s := by - have h0 : s - 1 ≠ 0 := by linarith + have h0 : s - 1 ≠ 0 := by linarith only [hs] have : (1 - 1 / (2 * (s - 1) ^ 2)) * (s - 1) ^ 2 = (s - 1) ^ 2 - 1 / 2 := by field_simp calc _ = ((1 - 1 / (2 * (s - 1) ^ 2)) * (s - 1) ^ 2) * bigM s / s := by ring @@ -106,7 +106,7 @@ theorem MSieve_lt_four_mul_bigM {s : ℝ} (hs : 2 ≤ s) : MSieve s < 4 * bigM s (fun x hx => (sub_pos.2 (MSieve_lt_four_mul_bigM_of_le_three hx)).le) (sub_pos.2 (MSieve_lt_four_mul_bigM_of_le_three ⟨by norm_num, le_rfl⟩)) ?_ s h3 intro s hs3 hnn _ - have hs0 : 0 < s := by linarith + have hs0 : 0 < s := by linarith only [hs3] have hint : ∫ x in (s - 1)..s, MSieve x ≤ ∫ x in (s - 1)..s, 4 * bigM x := intervalIntegral.integral_mono_on (by linarith) (continuous_MSieve.intervalIntegrable _ _) ((continuous_bigM.intervalIntegrable _ _).const_mul _) fun x hx => by @@ -114,15 +114,15 @@ theorem MSieve_lt_four_mul_bigM {s : ℝ} (hs : 2 ≤ s) : MSieve s < 4 * bigM s rw [intervalIntegral.integral_const_mul, ← sub_one_mul_MSieve hs3.le] at hint have hB := integral_bigM_le hs3.le have hMs := bigM_pos s - have h1 : (s - 1) * MSieve s ≤ 4 * ((s - 1) ^ 2 * bigM s / s) := by nlinarith + have h1 : (s - 1) * MSieve s ≤ 4 * ((s - 1) ^ 2 * bigM s / s) := by nlinarith only [hint, hB] have h2 : 4 * ((s - 1) ^ 2 * bigM s / s) < (s - 1) * (4 * bigM s) := by rw [div_eq_mul_inv] - have : (s - 1) * s⁻¹ < 1 := by rw [← div_eq_mul_inv, div_lt_one hs0]; linarith - have hs1 : 0 < s - 1 := by linarith - nlinarith [mul_pos hs1 hMs] + have : (s - 1) * s⁻¹ < 1 := by rw [← div_eq_mul_inv, div_lt_one hs0]; linarith only [] + have hs1 : 0 < s - 1 := by linarith only [hs3] + nlinarith only [mul_pos hs1 hMs, this, hs1, hMs] have := lt_of_le_of_lt h1 h2 - have hs1 : 0 < s - 1 := by linarith - nlinarith + have hs1 : 0 < s - 1 := by linarith only [hs3] + nlinarith only [hint, hB, h2, hs3] /-- [I71, Lemma 7]: `f_r(s) < M(s) ≤ 4 𝔐(s)` for `s ≥ 2`. -/ theorem lemma7 (r : ℕ) {s : ℝ} (hs : 2 ≤ s) : fr r s < MSieve s ∧ MSieve s ≤ 4 * bigM s := @@ -135,16 +135,16 @@ theorem mainMaj_lt_four_mul_bigM (lower : Bool) {s : ℝ} (hs : 2 ≤ s) : /-- `M lower (s) ≤ 12 G lower' (s)` for `s ≥ 2`. -/ theorem mainMaj_le_errMaj (lower lower' : Bool) {s : ℝ} (hs : 2 ≤ s) : mainMaj lower s ≤ 12 * errMaj lower' s := by - linarith [mainMaj_lt_four_mul_bigM lower hs, (errMaj_mem lower' s).1] + linarith only [mainMaj_lt_four_mul_bigM lower hs, (errMaj_mem lower' s).1, hs] /-- `M(s - 1) < 16 s² 𝔐(s)` for `s ≥ 3` (Lemmas 7 and 8). -/ theorem MSieve_sub_one_lt {s : ℝ} (hs : 3 ≤ s) : MSieve (s - 1) < 16 * s ^ 2 * bigM s := by - have h1 := MSieve_lt_four_mul_bigM (s := s - 1) (by linarith) + have h1 := MSieve_lt_four_mul_bigM (s := s - 1) (by linarith only [hs]) have h2 := bigM_sub_one_lt hs - linarith + linarith only [h1, h2] theorem bigM_three_gt : 3 / 2 < bigM 3 := by - rw [bigM_three]; linarith [log_two_lt_d9] + rw [bigM_three]; linarith only [log_two_lt_d9] /-- The comparison of Corollary 1's error term with the error majorant: `M lower (s - 1) ≤ 48 s² G lower' (s)` for `s ≥ 1` (any flags). -/ @@ -154,15 +154,15 @@ theorem mainMaj_sub_one_le (lower lower' : Bool) {s : ℝ} (hs : 1 ≤ s) : have hM := mainMaj_le_MSieve lower (s - 1) rcases le_total 3 s with h3 | h3 · have := MSieve_sub_one_lt h3 - nlinarith - · have h0 : MSieve (s - 1) ≤ MSieve 0 := MSieve_antitone (by linarith) + nlinarith only [hM, this, hG] + · have h0 : MSieve (s - 1) ≤ MSieve 0 := MSieve_antitone (by linarith only [hs]) rw [MSieve_of_le_three (s := 0) (by norm_num), fSieve_of_le_two (by norm_num), fSieve_two] at h0 have hK := FSieve_three_add_lt_four have hB : bigM 3 ≤ bigM s := bigM_antitone h3 have := bigM_three_gt - have hs2 : 1 ≤ s ^ 2 := by nlinarith - have : 24 ≤ 48 * s ^ 2 * errMaj lower' s := by nlinarith + have hs2 : 1 ≤ s ^ 2 := by nlinarith only [hs] + have : 24 ≤ 48 * s ^ 2 * errMaj lower' s := by nlinarith only [hs2, hG, hB, this] linarith end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFive.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFive.lean index ad809a1aaa..c5366b02ce 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFive.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFive.lean @@ -93,7 +93,7 @@ theorem inner_le {c₇ : ℝ} {r : ℕ} (ih : Bound c₇ r) {lower : Bool} {y s errMaj (!lower) (log y / log p - 1) / (p * log (y / p) ^ 2)) := by obtain ⟨hp1, hpy, hsp⟩ := rosserPrimes_facts hy hs hp have hp0 : (0 : ℝ) < p := by exact_mod_cast (zero_lt_one.trans hp1) - have hyp : 1 < y / p := by rw [lt_div_iff₀ hp0]; linarith + have hyp : 1 < y / p := by rw [lt_div_iff₀ hp0]; linarith only [hpy] have h := ih (!lower) (y / p) (log y / log p - 1) hyp hsp (sub_one_le_xi_div hy hp1 hpy ht) rw [rpow_inv_sub_one_eq hp1 hpy] at h refine h.trans (le_of_eq ?_) @@ -126,16 +126,16 @@ theorem sum_inner_le {c₇ : ℝ} (hc₇ : 0 ≤ c₇) {r : ℕ} (ih : Bound c have hlp : 0 < log (p : ℝ) := log_pos hp1' have ht : log y / log p ≤ xi y := by have hlog := log_le_log (by positivity) hwp - rw [hw, log_rpow_one_div (by linarith)] at hlog - rw [div_le_iff₀ (by linarith)] at hlog + rw [hw, log_rpow_one_div (by linarith only [hy])] at hlog + rw [div_le_iff₀ (by linarith only [hξ])] at hlog rw [div_le_iff₀ hlp] nlinarith only [hlog, hlp] exact inner_le ih hy hs hpP ht _ ≤ ∑ p ∈ P.filter (fun p : ℕ => y ^ (1 / xi y) ≤ p), c₇ * φ * y * term p := by refine sum_le_sum_of_subset_of_nonneg (fun p hp => ?_) fun p hp _ => ?_ · obtain ⟨hpP, hwp⟩ := mem_filter.1 hp - exact mem_filter.2 ⟨hpP, (rpow_one_div_le_rpow_one_div hy.le (by linarith) - (by linarith)).trans hwp⟩ + exact mem_filter.2 ⟨hpP, (rpow_one_div_le_rpow_one_div hy.le (by linarith only [hξ]) + (by linarith only [])).trans hwp⟩ · obtain ⟨-, -, hsp⟩ := rosserPrimes_facts hy hs (mem_filter.1 hp).1 have := delta_pos (one_le_of_sMin_le hsp) (y / p) have := errMaj_pos (!lower) (log y / log p - 1) @@ -158,7 +158,7 @@ theorem gap_le {r : ℕ} {L ℓ : ℝ} (hL : 0 < L) (hℓ : 0 < ℓ) (h : (r : rw [e, le_div_iff₀ (by positivity)] rw [le_div_iff₀ hℓ] at h have h2 : ((r + 3) * ℓ) ^ 2 ≤ (2 * L) ^ 2 := by gcongr - have : (r + 2) * (r + 3) * ℓ ^ 2 ≤ 4 * L ^ 2 := by nlinarith [sq_nonneg ℓ] + have : (r + 2) * (r + 3) * ℓ ^ 2 ≤ 4 * L ^ 2 := by nlinarith only [sq_nonneg ℓ, h2] rw [show 2 * (ℓ ^ 2 / (8 * L ^ 2)) * ((r + 2) * (r + 3)) = (r + 2) * (r + 3) * ℓ ^ 2 / (4 * L ^ 2) by field_simp; ring] rw [div_le_one (by positivity)] @@ -170,10 +170,10 @@ theorem close_step {c₇ φ φ' Q X ε : ℝ} (hc₇ : 1 ≤ c₇) (hQ : 0 ≤ Q Q * ε + c₇ * φ * Q * (1 + X) ≤ c₇ * φ' * Q := by have hε : 0 ≤ ε := hX0.trans hX have h1 : φ * X ≤ ε := (mul_le_of_le_one_left hX0 hφ1).trans hX - have h2 : ε ≤ φ' - φ - φ * X := by linarith - have h3 : c₇ * ε ≤ c₇ * (φ' - φ - φ * X) := mul_le_mul_of_nonneg_left h2 (by linarith) + have h2 : ε ≤ φ' - φ - φ * X := by linarith only [hgap, h1] + have h3 : c₇ * ε ≤ c₇ * (φ' - φ - φ * X) := mul_le_mul_of_nonneg_left h2 (by linarith only [hc₇]) have h4 : ε ≤ c₇ * ε := le_mul_of_one_le_left hε hc₇ - nlinarith [mul_le_mul_of_nonneg_left (h4.trans h3) hQ] + nlinarith only [mul_le_mul_of_nonneg_left (h4.trans h3) hQ, h4, h3, hQ] /-- The main case of the inductive step ([I71, p. 27]): `y` large and `r + 3 ≤ 2 log y / log log y`. The hypotheses are the large-`y` facts: the crude count @@ -209,7 +209,7 @@ theorem step_main {c₇ C : ℝ} (hc₇ : 1 ≤ c₇) {r : ℕ} (ih : Bound c₇ have hGs := errMaj_pos lower s have hQ0 : 0 ≤ Q := by positivity have hφ0 : 0 ≤ φ := by positivity - have hφ1 : φ ≤ 1 := by rw [hφ, div_le_one (by positivity)]; linarith + have hφ1 : φ ≤ 1 := by rw [hφ, div_le_one (by positivity)]; linarith only [] have hE0 : 0 ≤ E := by have := pntE_pos (y ^ (1 / xi y)); positivity have hs₀ : (1 : ℝ) ≤ exp 32 := one_le_exp (by norm_num) have hδ₀ := one_le_delta hs₀ y @@ -283,7 +283,7 @@ theorem small_le {c₈ c₇ : ℝ} have hGm0 : 0 < Gm := lt_min (errMaj_pos _ _) (errMaj_pos _ _) have hs1 := one_le_of_sMin_le hs have hL0 : 0 < log y := log_pos hy - have hLc : log y ≤ log c₈ := log_le_log (by linarith) hyc.le + have hLc : log y ≤ log c₈ := log_le_log (by linarith only [hy]) hyc.le have hG : Gm ≤ errMaj lower s := by have h1 : errMaj lower Ξ ≤ errMaj lower s := errMaj_antitone lower (hsξ.trans (xi_le_of_lt hy hyc)) @@ -292,7 +292,7 @@ theorem small_le {c₈ c₇ : ℝ} · exact (min_le_left _ _).trans h1 have hδ := one_le_delta hs1 y have hφ : (1 : ℝ) / 2 ≤ ((r : ℝ) + 1) / (r + 2) := by - rw [div_le_div_iff₀ (by norm_num) (by positivity)]; linarith [r.cast_nonneg (α := ℝ)] + rw [div_le_div_iff₀ (by norm_num) (by positivity)]; linarith only [r.cast_nonneg (α := ℝ)] have hc₇' : 2 * log c₈ ^ 2 ≤ c₇ * Gm := by rwa [div_le_iff₀ hGm0] at hc₇ have hcount : (#{d ∈ rosserSet lower y (y ^ (1 / s)) | #d.primeFactors ≤ r} : ℝ) ≤ y := (Nat.cast_le.2 (card_filter_le _ _)).trans (card_rosserSet_le hy hs1) @@ -300,15 +300,15 @@ theorem small_le {c₈ c₇ : ℝ} rw [le_div_iff₀ (by positivity)] have hc₇0 : 0 ≤ c₇ := by have := mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) (sq_nonneg (log c₈)) - nlinarith + nlinarith only [hc₇', hGm0] have key : log y ^ 2 ≤ c₇ * (((r : ℝ) + 1) / (r + 2)) * delta s y * errMaj lower s := by have h1 : log y ^ 2 ≤ log c₈ ^ 2 := by gcongr have h2 : c₇ * Gm / 2 ≤ c₇ * (((r : ℝ) + 1) / (r + 2)) * delta s y * errMaj lower s := by have : c₇ * Gm / 2 = c₇ * (1 / 2) * 1 * Gm := by ring rw [this] gcongr - linarith - nlinarith + linarith only [hc₇', h1, h2] + nlinarith only [key, hy] /-! ### Theorem 5 -/ theorem exists_bound : ∃ c₇ : ℝ, 1 ≤ c₇ ∧ ∀ r, Bound c₇ r := by @@ -336,28 +336,28 @@ theorem exists_bound : ∃ c₇ : ℝ, 1 ≤ c₇ ∧ ∀ r, Bound c₇ r := by obtain ⟨hy3, hsmall, -, -, -, -⟩ := hlarge y hyc have hL1 : 1 ≤ log y := by have := log_le_log (by norm_num) hy3 - linarith [one_lt_log_three] + linarith only [one_lt_log_three, this] have h := hsmall lower s hs hsξ rw [card_filter_rosserSet_zero] have hN : (0 : ℝ) ≤ #(rosserSet lower y (y ^ (1 / (xi y - 1)))) := Nat.cast_nonneg _ have hQ : 0 ≤ delta s y * errMaj lower s * y := by have := delta_pos (one_le_of_sMin_le hs) y have := errMaj_pos lower s - have : 0 < y := by linarith + have : 0 < y := by linarith only [hy3] positivity push_cast have : delta s y * errMaj lower s * y / (8 * log y ^ 4) ≤ c₇ * ((0 + 1) / (0 + 2)) * delta s y * errMaj lower s * y / log y ^ 2 := by rw [div_le_div_iff₀ (by positivity) (by positivity)] have h4 : log y ^ 2 ≤ 4 * log y ^ 4 := by - have h1 : 1 ≤ log y ^ 2 := by nlinarith - nlinarith [mul_le_mul_of_nonneg_left h1 (sq_nonneg (log y))] + have h1 : 1 ≤ log y ^ 2 := by nlinarith only [hL1] + nlinarith only [mul_le_mul_of_nonneg_left h1 (sq_nonneg (log y)), h1] have h5 : delta s y * errMaj lower s * y * log y ^ 2 ≤ delta s y * errMaj lower s * y * (4 * log y ^ 4) := mul_le_mul_of_nonneg_left h4 hQ - nlinarith [mul_le_mul_of_nonneg_right hc₇1 (mul_nonneg hQ (pow_pos (by linarith : + nlinarith [mul_le_mul_of_nonneg_right hc₇1 (mul_nonneg hQ (pow_pos (by linarith only [hL1] : (0 : ℝ) < log y) 4).le)] - linarith + linarith only [h, this] | succ r ih => intro lower y s hy hs hsξ rcases lt_or_ge y c₈ with hyc | hyc @@ -372,11 +372,11 @@ theorem exists_bound : ∃ c₇ : ℝ, 1 ≤ c₇ ∧ ∀ r, Bound c₇ r := by have hQ : 0 ≤ delta s y * errMaj lower s * y / log y ^ 2 := by have := delta_pos (one_le_of_sMin_le hs) y have := errMaj_pos lower s - have : 0 < y := by linarith + have : 0 < y := by linarith only [hy] positivity have hφ : ((r : ℝ) + 1) / (r + 2) ≤ (((r + 1 : ℕ) : ℝ) + 1) / (((r + 1 : ℕ) : ℝ) + 2) := by push_cast - rw [div_le_div_iff₀ (by positivity) (by positivity)]; nlinarith + rw [div_le_div_iff₀ (by positivity) (by positivity)]; nlinarith only [] calc c₇ * ((r + 1) / (r + 2)) * delta s y * errMaj lower s * y / log y ^ 2 = c₇ * ((r + 1) / (r + 2)) * (delta s y * errMaj lower s * y / log y ^ 2) := by ring _ ≤ c₇ * ((((r + 1 : ℕ) : ℝ) + 1) / (((r + 1 : ℕ) : ℝ) + 2)) * @@ -386,7 +386,7 @@ theorem exists_bound : ∃ c₇ : ℝ, 1 ≤ c₇ ∧ ∀ r, Bound c₇ r := by obtain ⟨-, hξ32, -, -⟩ := hxi obtain ⟨hsl, hℓ⟩ := hslack have hmain : (r : ℝ) + 3 ≤ 2 * log y / log (log y) := by - push_cast at hdeep; linarith + push_cast at hdeep; linarith only [hdeep] exact step_main hc₇1 ih hy hs hξ32 (hsmall lower s hs hsξ) (hcor lower s hs) hC0 hsl hℓ hmain @@ -405,27 +405,27 @@ theorem theorem5 : ∃ c₇ : ℝ, 0 ≤ c₇ ∧ ∀ (r : ℕ) (lower : Bool) ( (#{d ∈ rosserSet lower y (y ^ (1 / s)) | #d.primeFactors ≤ r} : ℝ) ≤ c₇ * ((r + 1) / (r + 2)) * delta s y * errMaj lower s * y / Real.log y ^ 2 := by obtain ⟨c₇, hc₇, h⟩ := exists_bound - exact ⟨c₇, by linarith, fun r => h r⟩ + exact ⟨c₇, by linarith only [hc₇], fun r => h r⟩ /-- `δ(s, y) ≤ (1 + 9 log⁵ 3)^{15}` for `1 ≤ s ≤ 3` and `log y ≥ 1`. -/ theorem delta_le_of_le_three {s y : ℝ} (hs1 : 1 ≤ s) (hs3 : s ≤ 3) (hy : 1 ≤ Real.log y) : delta s y ≤ (1 + 9 * Real.log 3 ^ 5) ^ (15 : ℝ) := by have hl0 : 0 ≤ Real.log s := Real.log_nonneg hs1 - have hl3 : Real.log s ≤ Real.log 3 := Real.log_le_log (by linarith) hs3 + have hl3 : Real.log s ≤ Real.log 3 := Real.log_le_log (by linarith only [hs1]) hs3 have hx : s ^ 2 * Real.log s ^ 5 / Real.log y ^ 2 ≤ 9 * Real.log 3 ^ 5 := by rw [div_le_iff₀ (by positivity)] - have h1 : s ^ 2 ≤ 9 := by nlinarith + have h1 : s ^ 2 ≤ 9 := by nlinarith only [hs3, hs1] have h2 : Real.log s ^ 5 ≤ Real.log 3 ^ 5 := by gcongr - have h3 : 1 ≤ Real.log y ^ 2 := by nlinarith + have h3 : 1 ≤ Real.log y ^ 2 := by nlinarith only [hy] have h4 : s ^ 2 * Real.log s ^ 5 ≤ 9 * Real.log 3 ^ 5 := mul_le_mul h1 h2 (by positivity) (by norm_num) have h5 : 0 ≤ Real.log 3 ^ 5 := by positivity - nlinarith + nlinarith only [h4, h3, h5] have hx0 : 0 ≤ s ^ 2 * Real.log s ^ 5 / Real.log y ^ 2 := by positivity rw [delta] calc (1 + s ^ 2 * Real.log s ^ 5 / Real.log y ^ 2) ^ (5 * s) ≤ (1 + 9 * Real.log 3 ^ 5) ^ (5 * s) := Real.rpow_le_rpow (by linarith) (by linarith) - (by linarith) + (by linarith only [hs1]) _ ≤ (1 + 9 * Real.log 3 ^ 5) ^ (15 : ℝ) := Real.rpow_le_rpow_of_exponent_le (by linarith) (by linarith) @@ -441,8 +441,8 @@ theorem theorem5_card_rosserSet_le : ∃ K y₀ : ℝ, ∀ y ≥ y₀, ∀ s ∈ have hy3 : 3 ≤ y := le_of_max_le_right hy have hL1 : 1 ≤ Real.log y := by have := Real.log_le_log (by norm_num) hy3 - linarith [one_lt_log_three] - have hsξ : s ≤ xi y := hs.2.trans (by linarith [Real.add_one_le_exp (32 : ℝ)]) + linarith only [one_lt_log_three, this] + have hsξ : s ≤ xi y := hs.2.trans (by linarith only [Real.add_one_le_exp (32 : ℝ), hξ]) set z := y ^ (1 / s) have hall : (rosserSet true y z).filter (fun d => #d.primeFactors ≤ #(primesLT z)) = rosserSet true y z := @@ -450,12 +450,12 @@ theorem theorem5_card_rosserSet_le : ∃ K y₀ : ℝ, ∀ y ≥ y₀, ∀ s ∈ have h := h5 #(primesLT z) true y s hy1 hs.1 hsξ rw [hall] at h refine h.trans ?_ - have hδ := delta_le_of_le_three (by linarith [hs.1]) hs.2 hL1 (y := y) - have hδ0 := delta_pos (by linarith [hs.1] : (1 : ℝ) ≤ s) y + have hδ := delta_le_of_le_three (by linarith only [hs.1, hs]) hs.2 hL1 (y := y) + have hδ0 := delta_pos (by linarith only [hs.1, hs] : (1 : ℝ) ≤ s) y have hG := errMaj_le_two true s have hG0 := errMaj_pos true s have hφ : ((#(primesLT z) : ℕ) + 1 : ℝ) / ((#(primesLT z) : ℕ) + 2) ≤ 1 := by - rw [div_le_one (by positivity)]; linarith + rw [div_le_one (by positivity)]; linarith only [] have hφ0 : (0 : ℝ) ≤ ((#(primesLT z) : ℕ) + 1 : ℝ) / ((#(primesLT z) : ℕ) + 2) := by positivity have hyL : 0 ≤ y / Real.log y ^ 2 := by positivity calc c₇ * ((#(primesLT z) + 1) / (#(primesLT z) + 2)) * delta s y * errMaj true s * y / diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveAux.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveAux.lean index 014377dc04..72dcfc9eed 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveAux.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveAux.lean @@ -46,25 +46,25 @@ theorem eventually_add_mul_log_le (α β : ℝ) : ∀ᶠ x in atTop, α + β * l filter_upwards [isLittleO_log_id_atTop.bound hε, eventually_ge_atTop (2 * α), eventually_ge_atTop 1] with x hx hxα hx1 have hl : 0 ≤ log x := log_nonneg hx1 - rw [norm_of_nonneg hl, id, norm_of_nonneg (by linarith)] at hx + rw [norm_of_nonneg hl, id, norm_of_nonneg (by linarith only [hx1])] at hx have h1 : β * log x ≤ |β| * log x := mul_le_mul_of_nonneg_right (le_abs_self β) hl have h2 : |β| * log x ≤ x / 2 := by have hq : |β| / (|β| + 1) ≤ 1 := by - rw [div_le_one (by positivity)]; linarith + rw [div_le_one (by positivity)]; linarith only [] calc |β| * log x ≤ |β| * (1 / (2 * (|β| + 1)) * x) := by gcongr _ = |β| / (|β| + 1) * (x / 2) := by field_simp _ ≤ 1 * (x / 2) := by gcongr _ = x / 2 := one_mul _ - linarith + linarith only [hxα, h1, h2] theorem one_lt_log_three : 1 < log 3 := by rw [lt_log_iff_exp_lt (by norm_num)] - linarith [exp_one_lt_d9] + linarith only [exp_one_lt_d9] theorem lam_pos {y : ℝ} (hy : 1 < y) : 0 < lam y := by - have h3 : log 3 + log y = log (3 * y) := (log_mul (by norm_num) (by linarith)).symm + have h3 : log 3 + log y = log (3 * y) := (log_mul (by norm_num) (by linarith only [hy])).symm have := log_pos hy - exact log_pos (by linarith [one_lt_log_three]) + exact log_pos (by linarith only [one_lt_log_three, h3, this]) /-- `log ξ = log L - (11/5) log λ`. -/ theorem log_xi_eq {y : ℝ} (hy : 1 < y) : log (xi y) = log (log y) - 11 / 5 * log (lam y) := by @@ -87,40 +87,40 @@ theorem eventually_scalar (c : ℝ) (hc : 100 ≤ c) : ∀ᶠ y in atTop, (eventually_ge_atTop c), tendsto_lam.eventually (eventually_add_mul_log_le (c + 10) 8)] with y hy3 h1 h2 h3 h4 simp only [Function.comp] at h2 h3 - have hy : 1 < y := by linarith + have hy : 1 < y := by linarith only [hy3] have hL : 1 < log y := by - have := log_le_log (by norm_num) hy3; linarith [one_lt_log_three] - have hL0 : 0 < log y := by linarith + have := log_le_log (by norm_num) hy3; linarith only [one_lt_log_three, this] + have hL0 : 0 < log y := by linarith only [hL] have hlam := lam_pos hy - have h3y : log (3 * y) = log 3 + log y := log_mul (by norm_num) (by linarith) - have ha : 0 ≤ log (lam y) := by linarith + have h3y : log (3 * y) = log 3 + log y := log_mul (by norm_num) (by linarith only [hy3]) + have ha : 0 ≤ log (lam y) := by linarith only [hc, h2] -- `log L ≤ λ ≤ log L + 1` have hℓ1 : log (log y) ≤ lam y := by - unfold lam; exact log_le_log hL0 (by rw [h3y]; linarith [one_lt_log_three]) + unfold lam; exact log_le_log hL0 (by rw [h3y]; linarith only [one_lt_log_three]) have hℓ2 : lam y - 1 ≤ log (log y) := by have hle : log (3 * y) ≤ exp 1 * log y := by have : log 3 ≤ log y := log_le_log (by norm_num) hy3 - have : 2 ≤ exp 1 := by linarith [add_one_le_exp (1 : ℝ)] + have : 2 ≤ exp 1 := by linarith only [add_one_le_exp (1 : ℝ)] rw [h3y]; nlinarith - have := log_le_log (by rw [h3y]; linarith [one_lt_log_three]) hle + have := log_le_log (by rw [h3y]; linarith only [one_lt_log_three, hL]) hle rw [log_mul (exp_pos 1).ne' hL0.ne', log_exp] at this - unfold lam; linarith + unfold lam; linarith only [this] have hlogξ := log_xi_eq hy have hξ := xi_pos hy - have hl2 : log 2 ≤ 1 := by linarith [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2)] - have hl16 : log 16 ≤ 15 := by linarith [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 16)] - have hl24 : log 24 ≤ 23 := by linarith [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 24)] + have hl2 : log 2 ≤ 1 := by linarith only [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2)] + have hl16 : log 16 ≤ 15 := by linarith only [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 16)] + have hl24 : log 24 ≤ 23 := by linarith only [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 24)] refine ⟨hy3, h2, h3, h1, hℓ1, hℓ2, ?_, ?_, ?_, ?_, ?_⟩ · rw [← log_le_log_iff (by positivity) hξ, log_mul (by norm_num) hlam.ne'] - linarith + linarith only [hc, h2, h4, hℓ2, hlogξ, hl24] · have h := (log_le_log_iff (by positivity) hL0).1 (by rw [log_mul (by norm_num) (by positivity), log_pow]; push_cast - linarith : log (16 * lam y ^ 2) ≤ log (log y)) + linarith only [hc, h2, h4, hℓ2, hl16] : log (16 * lam y ^ 2) ≤ log (log y)) exact h · rw [log_div hξ.ne' (by norm_num)] - linarith - · linarith - · linarith + linarith only [hc, h2, h4, hℓ2, hlogξ, hl2] + · linarith only [hc, h2, h4, hℓ2, hlogξ] + · linarith only [hc, h2, hℓ1, hlogξ] /-! ### The crude part ([I71, p. 27]) -/ @@ -132,47 +132,52 @@ theorem crude_exponent_le {L ℓ lam ξ a : ℝ} (hL : 0 < L) (hℓ : ℓ = log (h16 : 16 * lam ^ 2 ≤ L) (hlogξ : log ξ ≤ lam) : 8 * L ^ 4 * (1 + exp (L + 2 * ξ - L / lam) + 2 * exp (L - ξ * log ξ + ξ * a + 5 * ξ)) ≤ exp (L - ξ * log ξ + 3 / 2 * ξ * a) := by - have hlam0 : 0 < lam := by linarith - have hξ0 : 0 < ξ := by linarith + have hlam0 : 0 < lam := by linarith only [hlam] + have hξ0 : 0 < ξ := by linarith only [hlam, h24] have h8 : 8 * L ^ 4 = exp (log 8 + 4 * ℓ) := by rw [exp_add, exp_log (by norm_num), hℓ, show (4 : ℝ) * log L = log (L ^ 4) by rw [log_pow]; norm_num, exp_log (by positivity)] - have hl3 : log 3 ≤ 2 := by linarith [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 3)] - have hl8 : log 8 ≤ 7 := by linarith [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 8)] - have hl2 : log 2 ≤ 1 := by linarith [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2)] + have hl3 : log 3 ≤ 2 := by linarith only [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 3)] + have hl8 : log 8 ≤ 7 := by linarith only [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 8)] + have hl2 : log 2 ≤ 1 := by linarith only [log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2)] set T := L - ξ * log ξ + 3 / 2 * ξ * a with hT have h3 : exp T = 3 * exp (T - log 3) := by rw [exp_sub, exp_log (by norm_num)]; field_simp -- `ξ log ξ + 2 ξ ≤ L / (2λ)` and `8 + 4λ ≤ L / (2λ)` have hLl : ξ * log ξ + 2 * ξ ≤ L / (2 * lam) := by rw [le_div_iff₀ (by positivity)] - have : ξ * log ξ ≤ ξ * lam := mul_le_mul_of_nonneg_left hlogξ hξ0.le - nlinarith + calc + (ξ * log ξ + 2 * ξ) * (2 * lam) = 2 * ξ * lam * (log ξ + 2) := by ring + _ ≤ 2 * ξ * lam * (2 * lam) := + mul_le_mul_of_nonneg_left (by linarith only [hlogξ, hlam]) (by positivity) + _ = 4 * (ξ * lam ^ 2) := by ring + _ ≤ L := hxilam have hLm : 8 + 4 * lam ≤ L / (2 * lam) := by - rw [le_div_iff₀ (by positivity)]; nlinarith - have hLlam : L / lam ≤ L := div_le_self hL.le (by linarith) + rw [le_div_iff₀ (by positivity)] + nlinarith only [h16, hlam] + have hLlam : L / lam ≤ L := div_le_self hL.le (by linarith only [hlam]) have hξa : 0 ≤ ξ * a := by positivity have e1 : 8 * L ^ 4 ≤ exp (T - log 3) := by rw [h8, exp_le_exp, hT] have : L / lam = 2 * (L / (2 * lam)) := by field_simp - nlinarith + nlinarith only [this, hLl, hLm, hLlam, hl3, hl8, hℓlam, hξa, h24, hlam] have e2 : 8 * L ^ 4 * exp (L + 2 * ξ - L / lam) ≤ exp (T - log 3) := by rw [h8, ← exp_add, exp_le_exp, hT] have : L / lam = 2 * (L / (2 * lam)) := by field_simp - nlinarith + nlinarith only [this, hLl, hLm, hl3, hl8, hℓlam, ha, hξ0, h24, hlam] have e3 : 8 * L ^ 4 * (2 * exp (L - ξ * log ξ + ξ * a + 5 * ξ)) ≤ exp (T - log 3) := by rw [h8, mul_left_comm, ← exp_add, ← exp_log (by norm_num : (0 : ℝ) < 2), ← exp_add, exp_le_exp, hT] - have : 6 * ξ ≤ 1 / 2 * ξ * a := by nlinarith - nlinarith + have : 6 * ξ ≤ 1 / 2 * ξ * a := by nlinarith only [ha, hξ0] + nlinarith only [this, hl2, hl3, hl8, hℓlam, h24, hlam] rw [h3] - nlinarith + nlinarith only [e1, e2, e3] /-! ### The slack ([I71, (4.2), (4.6)]) -/ /-- `(1 + x)^p ≤ e^{p x}` for `x ≥ 0`, `p ≥ 0`. -/ theorem one_add_rpow_le_exp {x p : ℝ} (hx : 0 ≤ x) (hp : 0 ≤ p) : (1 + x) ^ p ≤ exp (p * x) := by - rw [rpow_def_of_pos (by linarith), exp_le_exp, mul_comm] + rw [rpow_def_of_pos (by linarith only [hx]), exp_le_exp, mul_comm] gcongr linarith [log_le_sub_one_of_pos (by linarith : (0 : ℝ) < 1 + x)] diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveCount.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveCount.lean index 1ad0535ed5..1e465fab6a 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveCount.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFiveCount.lean @@ -14,7 +14,6 @@ import LeanPool.IwaniecLinearSieve.LinearSieve.Crude import LeanPool.IwaniecLinearSieve.LinearSieve.Depth import LeanPool.IwaniecLinearSieve.LinearSieve.LemmaEleven import LeanPool.IwaniecLinearSieve.SieveMajorants.Lemmas -import Mathlib.Algebra.Order.Star.Real import Mathlib.Analysis.Complex.ExponentialBounds import Mathlib.Data.Finset.Slice import Mathlib.Tactic.Polynomial.Basic @@ -72,10 +71,10 @@ theorem card_rosserSet_le (hy : 1 < y) (hs : 1 ≤ s) : exact mem_Ico.2 ⟨pos_of_mem_rosserSet hd, Nat.lt_ceil.2 this⟩ have h := card_le_card hsub rw [Nat.card_Ico] at h - have hc := Nat.ceil_lt_add_one (by linarith : (0 : ℝ) ≤ y) + have hc := Nat.ceil_lt_add_one (by linarith only [hy] : (0 : ℝ) ≤ y) have : ((⌈y⌉₊ - 1 : ℕ) : ℝ) ≤ y := by rw [Nat.cast_sub (Nat.one_le_iff_ne_zero.2 (by positivity))] - push_cast; linarith + push_cast; linarith only [hc] exact (Nat.cast_le.2 h).trans this /-- Lemma 17 split at `w`: the primes `p < w` contribute (with the `1`) at most @@ -105,7 +104,7 @@ theorem card_filter_succ_le (n : ℕ) (lower : Bool) (y z w : ℝ) : (rosserPrimes lower y z).filter (fun p : ℕ ↦ w ≤ p) := filter_congr fun p _ ↦ not_lt rw [h2] - linarith + linarith only [h1] theorem card_primesLT_le {w : ℝ} (hw : 0 ≤ w) : (#(primesLT w) : ℝ) ≤ w + 1 := by have h : #(primesLT w) ≤ ⌈w⌉₊ := by @@ -137,7 +136,7 @@ theorem card_filter_le_le (lower : Bool) (y : ℝ) {w : ℝ} (hw : 1 ≤ w) (K : calc (#(primesLT w) : ℝ) ^ l / l.factorial ≤ (#(primesLT w) : ℝ) ^ l := div_le_self (by positivity) hf _ ≤ (2 * w) ^ l := by gcongr - _ ≤ (2 * w) ^ K := pow_le_pow_right₀ (by linarith) hlK + _ ≤ (2 * w) ^ K := pow_le_pow_right₀ (by linarith only [hw]) hlK _ = (K + 1) * (2 * w) ^ K := by simp /-- The cutoff `u = ξ(1 - 2/λ)` leaves a saving of `1/λ` in the exponent of `w`. -/ @@ -213,8 +212,7 @@ theorem card_rosserSet_rpow_le (hy : 1 < y) (hw : 2 ≤ y ^ (1 / (xi y - 1))) · -- Few prime factors: bound the three factors `K + 1`, `2^u`, and `w^u`. refine (card_filter_le_le lower y (by linarith only [hw]) K).trans ?_ have h2w : 1 ≤ 2 * w := by linarith only [hw] - have hcount_factor : (K : ℝ) + 1 ≤ exp ξ := by - linarith only [hKu, huξ, add_one_le_exp ξ] + have hcount_factor : (K : ℝ) + 1 ≤ exp ξ := by linarith only [hKu, huξ, add_one_le_exp ξ] have htwo_power : (2 : ℝ) ^ u ≤ exp ξ := by rw [rpow_def_of_pos (by norm_num), exp_le_exp] have hlogtwo : log 2 ≤ 1 := by linarith only [log_le_sub_one_of_pos two_pos] @@ -267,7 +265,7 @@ theorem card_rosserSet_rpow_le (hy : 1 < y) (hw : 2 ≤ y ^ (1 / (xi y - 1))) /-! ### The comparison (4.9), (4.10) -/ theorem one_le_of_sMin_le (hs : sMin lower ≤ s) : 1 ≤ s := by - cases lower <;> simp [sMin] at hs <;> linarith + cases lower <;> simp [sMin] at hs <;> linarith only [hs] theorem one_le_delta (hs : 1 ≤ s) (y : ℝ) : 1 ≤ delta s y := one_le_rpow (by linarith [lsx_nonneg (log y) hs]) (by linarith) @@ -396,8 +394,8 @@ theorem exists_card_small : ∃ y₀ : ℝ, ∀ y ≥ y₀, ∀ (lower : Bool) ( exp (-(s * log s) - s * log (log s) - cG * s) ≤ majG r s := by intro r s hs refine le_trans (exp_le_exp.2 ?_) (hG₀ r s hs) - have : cG₀ * s ≤ cG * s := mul_le_mul_of_nonneg_right (le_max_left _ _) (by linarith) - linarith + have : cG₀ * s ≤ cG * s := mul_le_mul_of_nonneg_right (le_max_left _ _) (by linarith only [hs]) + linarith only [this] obtain ⟨C₅, hC₅⟩ := SLT_le_loglog obtain ⟨y₁, hy₁⟩ := exists_xi_large set c := max 100 (max (2 * (cG + 5 * log 128)) (max cG (max C₅ 12))) with hc @@ -413,23 +411,27 @@ theorem exists_card_small : ∃ y₀ : ℝ, ∀ y ≥ y₀, ∀ (lower : Bool) ( ((eventually_scalar c hc1).and (eventually_ge_atTop y₁)) refine ⟨y₀, fun y hy lower s hs hsξ ↦ ?_⟩ obtain ⟨⟨hy3, ha, hμ, hlam, hℓ1, -, h24, h16, h8, h9, h10⟩, hyy₁⟩ := hy₀ y hy - obtain ⟨hy1, -, -, hw2⟩ := hy₁ y hyy₁ + obtain ⟨hy1, hξlarge, -, hw2⟩ := hy₁ y hyy₁ have hL0 : 0 < log y := log_pos hy1 have hm0 := lam_pos hy1 have hξ := xi_pos hy1 + have hξ32 : 32 + 1 ≤ xi y := (add_one_le_exp (32 : ℝ)).trans hξlarge + have hC₅lam : C₅ ≤ lam y := hc7.trans (hc6.trans (hc4.trans (hc2.trans hlam))) -- `w = y^{1/(ξ-1)}` - have hξ1 : 0 < xi y - 1 := by linarith + have hξ1 : 0 < xi y - 1 := by linarith only [hξ32] have hw : 2 ≤ y ^ (1 / (xi y - 1)) := - hw2.trans (rpow_one_div_le_rpow_one_div hy1.le hξ1 (by linarith)) + hw2.trans (rpow_one_div_le_rpow_one_div hy1.le hξ1 (by linarith only [])) have hwy : y ^ (1 / (xi y - 1)) ≤ y := by conv_rhs => rw [← rpow_one y] - exact rpow_le_rpow_of_exponent_le hy1.le (by rw [div_le_one hξ1]; linarith) + exact rpow_le_rpow_of_exponent_le hy1.le (by + rw [div_le_one hξ1] + linarith only [hξ32]) have hSLT : SLT (y ^ (1 / (xi y - 1))) ≤ 2 * lam y := by have h1 := hC₅ _ hw have h2 : log (log (y ^ (1 / (xi y - 1)))) ≤ log (log y) := log_le_log (log_pos (by linarith)) (log_le_log (by linarith) hwy) - linarith - have hcard := card_rosserSet_rpow_le (lower := lower) hy1 hw hSLT (by linarith) h24 h10 + linarith only [h1, h2, hℓ1, hC₅lam] + have hcard := card_rosserSet_rpow_le (lower := lower) hy1 hw hSLT (hc1.trans hlam) h24 h10 -- `4 ξ λ² ≤ L` have hxl : 4 * (xi y * lam y ^ 2) ≤ log y := by have hsplit : lam y ^ (11 / 5 : ℝ) = lam y ^ 2 * lam y ^ (1 / 5 : ℝ) := by diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFour.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFour.lean index 873edd18f8..1cf42f4d99 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFour.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFour.lean @@ -122,19 +122,19 @@ theorem cor1_part : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s : ℝ), 1 < y → (primesLT (y ^ (1 / max s 3))).filter (fun p : ℕ => y ^ (1 / xi y) ≤ p) := by ext p simp only [mem_filter, mem_rosserPrimes, mem_primesLT, Bool.false_eq_true, false_or] - rw [lt_rpow_one_div_max_three hy (by linarith) (Nat.cast_nonneg p)] + rw [lt_rpow_one_div_max_three hy (by linarith only [hs1]) (Nat.cast_nonneg p)] tauto rw [hset] have hα : max s 3 ≤ xi y := max_le hsξ hξ3 - have h := hC fSieve y (max s 3) (xi y) hy (by linarith [le_max_right s 3]) hα hw2 + have h := hC fSieve y (max s 3) (xi y) hy (by linarith only [le_max_right s 3]) hα hw2 (fSieve_antitone.antitoneOn _) (fun t _ => (fSieve_pos t).le) refine h.trans (add_le_add ?_ ?_) · have hint := intervalIntegral_le_integral_Ioi hα (integrableOn_fSieve_shift (le_max_right s 3)) - (fun t ht => div_nonneg (fSieve_pos _).le (by linarith [ht.out, le_max_right s 3])) + (fun t ht => div_nonneg (fSieve_pos _).le (by linarith only [ht.out, le_max_right s 3, ht])) have heq := mainMaj_false_eq_integral s - exact div_le_div_of_nonneg_right (by linarith) hL.le - · have h1 := mainMaj_sub_one_le true false (by linarith [le_max_right s 3] : 1 ≤ max s 3) + exact div_le_div_of_nonneg_right (by linarith only [hint, heq]) hL.le + · have h1 := mainMaj_sub_one_le true false (by linarith only [le_max_right s 3] : 1 ≤ max s 3) rw [mainMaj_true] at h1 have hG : errMaj false (max s 3) = errMaj false s := by rcases le_total s 3 with h | h @@ -143,10 +143,10 @@ theorem cor1_part : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s : ℝ), 1 < y → rw [hG] at h1 have hsq : max s 3 ^ 2 ≤ 9 * s ^ 2 := by rcases le_total s 3 with h | h - · rw [max_eq_right h]; nlinarith - · rw [max_eq_left h]; nlinarith + · rw [max_eq_right h]; nlinarith only [hs1] + · rw [max_eq_left h]; nlinarith only [] have hGs := errMaj_pos false s - have : fSieve (max s 3 - 1) ≤ 432 * s ^ 2 * errMaj false s := by nlinarith + have : fSieve (max s 3 - 1) ≤ 432 * s ^ 2 * errMaj false s := by nlinarith only [h1, hsq, hGs] apply div_le_div_of_nonneg_right _ hL.le calc C * fSieve (max s 3 - 1) * pntE (y ^ (1 / xi y)) ≤ C * (432 * s ^ 2 * errMaj false s) * pntE (y ^ (1 / xi y)) := by gcongr @@ -158,7 +158,7 @@ theorem cor1_part : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s : ℝ), 1 < y → ((mainMaj_antitone false).antitoneOn _) (fun t _ => mainMaj_nonneg false t) refine h.trans (add_le_add ?_ ?_) · have hint := intervalIntegral_le_integral_Ioi hsξ (integrableOn_mainMaj_false_shift hs2) - (fun t ht => div_nonneg (mainMaj_nonneg _ _) (by linarith [ht.out])) + (fun t ht => div_nonneg (mainMaj_nonneg _ _) (by linarith only [ht.out, hs1, ht])) rw [mainMaj_true, fSieve_eq_integral_mainMaj hs2] exact div_le_div_of_nonneg_right hint hL.le · have h1 := mainMaj_sub_one_le false true hs1 @@ -166,7 +166,7 @@ theorem cor1_part : ∃ C, 0 ≤ C ∧ ∀ (lower : Bool) (y s : ℝ), 1 < y → apply div_le_div_of_nonneg_right _ hL.le calc C * mainMaj false (s - 1) * pntE (y ^ (1 / xi y)) ≤ C * (432 * s ^ 2 * errMaj true s) * pntE (y ^ (1 / xi y)) := by - gcongr; nlinarith + gcongr; nlinarith only [h1, hGs] _ = 432 * C * s ^ 2 * errMaj true s * pntE (y ^ (1 / xi y)) := by ring /-- The source term in the form needed for the induction. -/ @@ -193,15 +193,15 @@ theorem src_le_of_le_xi {cR CR : ℝ} (hR : ∀ z ≥ 2, |R z * log z - cR| ≤ rw [mem_filter, mem_primesLT] at hp have hlt : (p : ℝ) < y ^ (1 / (3 : ℝ)) := hp.1.2.trans_le (rpow_one_div_le_rpow_one_div hy.le (by norm_num) h3) - exact absurd ((not_cube_lt_iff (by linarith) p.cast_nonneg).1 hp.2) (not_le.2 hlt) - rw [this, max_eq_right (by linarith)] + exact absurd ((not_cube_lt_iff (by linarith only [hy]) p.cast_nonneg).1 hp.2) (not_le.2 hlt) + rw [this, max_eq_right (by linarith only [h3])] simpa using hE - · refine (src_le hR hy hs1 hw2 (rpow_one_div_le_rpow_one_div hy.le (by linarith) hsξ) + · refine (src_le hR hy hs1 hw2 (rpow_one_div_le_rpow_one_div hy.le (by linarith only [hs1]) hsξ) (rpow_one_div_le_rpow_one_div hy.le (by norm_num) hξ3)).trans ?_ simp only [Bool.false_eq_true, ite_false] rw [errMaj_false_of_le_three h3] have : 6 * CR * pntE (y ^ (1 / xi y)) ≤ 6 * CR * s ^ 2 * 1 * pntE (y ^ (1 / xi y)) := by - have : 1 ≤ s ^ 2 := by nlinarith + have : 1 ≤ s ^ 2 := by nlinarith only [hs1] have := mul_nonneg hCR hpE.le nlinarith gcongr @@ -242,18 +242,18 @@ theorem fail_le_exp_SLT (lower : Bool) (r : ℕ) (y z : ℝ) : fail lower r y z theorem xi_le_of_le {y Y : ℝ} (hy : 1 < y) (hyY : y ≤ Y) : xi y ≤ log Y / log (log 3) ^ (11 / 5 : ℝ) := by have hl3 : 1 < log 3 := by - rw [lt_log_iff_exp_lt (by norm_num)]; have := exp_one_lt_d9; linarith + rw [lt_log_iff_exp_lt (by norm_num)]; have := exp_one_lt_d9; linarith only [this] have hll : 0 < log (log 3) := log_pos hl3 have hL : 0 < log y := log_pos hy have hP : 0 < log (log 3) ^ (11 / 5 : ℝ) := rpow_pos_of_pos hll _ have hle : log (log 3) ^ (11 / 5 : ℝ) ≤ log (log (3 * y)) ^ (11 / 5 : ℝ) := by - refine rpow_le_rpow hll.le (log_le_log (by linarith) (log_le_log (by norm_num) ?_)) + refine rpow_le_rpow hll.le (log_le_log (by linarith only [hl3]) (log_le_log (by norm_num) ?_)) (by norm_num) - linarith + linarith only [hy] rw [xi] calc log y / log (log (3 * y)) ^ (11 / 5 : ℝ) ≤ log y / log (log 3) ^ (11 / 5 : ℝ) := div_le_div_of_nonneg_left hL.le hP hle - _ ≤ _ := div_le_div_of_nonneg_right (log_le_log (by linarith) hyY) hP.le + _ ≤ _ := div_le_div_of_nonneg_right (log_le_log (by linarith only [hy]) hyY) hP.le /-- [I71, (4.8)]: for `1 < y ≤ Y` the claim at depth `r + 1` holds once `c₇` is large in terms of `Y`. -/ @@ -268,14 +268,14 @@ theorem small_y {cR c₇ Y : ℝ} (hcR : 0 < cR) (hY : 1 < Y) set Ξ := log Y / log (log 3) ^ (11 / 5 : ℝ) have hs1 : 1 ≤ s := (one_le_sMin lower).trans hs have hL : 0 < log y := log_pos hy - have hLY : log y ≤ log Y := log_le_log (by linarith) hyY + have hLY : log y ≤ log Y := log_le_log (by linarith only [hy]) hyY have hMΞ := bigM_pos Ξ have hG : bigM Ξ / 3 ≤ errMaj lower s := le_trans (by gcongr; exact bigM_antitone (hsξ.trans (xi_le_of_le hy hyY))) (errMaj_mem lower s).1 have hδ := one_le_delta hs1 y have hρ : (1 : ℝ) / 2 ≤ ((r + 1 : ℕ) : ℝ) / ((r + 1 : ℕ) + 1) := by - rw [div_le_div_iff₀ (by norm_num) (by positivity)]; push_cast; linarith + rw [div_le_div_iff₀ (by norm_num) (by positivity)]; push_cast; linarith only [] have hz : y ^ (1 / s) ≤ Y := by refine le_trans ?_ hyY calc y ^ (1 / s) ≤ y ^ (1 / (1 : ℝ)) := rpow_one_div_le_rpow_one_div hy.le one_pos hs1 @@ -291,7 +291,7 @@ theorem small_y {cR c₇ Y : ℝ} (hcR : 0 < cR) (hY : 1 < Y) have hK : 6 * exp (SLT Y) * log Y ^ 2 ≤ c₇ * (cR * bigM Ξ) := (div_le_iff₀ (mul_pos hcR hMΞ)).1 hc₇ rw [le_div_iff₀ (by have := log_pos hY; positivity)] - linarith + linarith only [hK] have hnum : cR * c₇ * ((1 / 2) * (bigM Ξ / 3)) ≤ cR * c₇ * ((((r + 1 : ℕ) : ℝ) / ((r + 1 : ℕ) + 1)) * delta s y * errMaj lower s) := by refine mul_le_mul_of_nonneg_left ?_ (mul_nonneg hcR.le hc₇0) @@ -300,7 +300,7 @@ theorem small_y {cR c₇ Y : ℝ} (hcR : 0 < cR) (hY : 1 < Y) calc (1 / 2 : ℝ) * (bigM Ξ / 3) ≤ (((r + 1 : ℕ) : ℝ) / ((r + 1 : ℕ) + 1)) * (delta s y * errMaj lower s) := by refine mul_le_mul hρ ?_ (by positivity) (by positivity) - nlinarith + nlinarith only [hG, hMΞ, hδ] _ = _ := by ring have hc0 : 0 ≤ cR * c₇ * ((((r + 1 : ℕ) : ℝ) / ((r + 1 : ℕ) + 1)) * delta s y * errMaj lower s) := le_trans (by positivity) hnum @@ -308,7 +308,7 @@ theorem small_y {cR c₇ Y : ℝ} (hcR : 0 < cR) (hY : 1 < Y) refine h1.trans ((div_le_div₀ hc0 hnum (by positivity) hLL).trans_eq (by ring)) have : 0 ≤ cR * (mainMaj lower s / log y) := by positivity calc fail lower (r + 1) y (y ^ (1 / s)) ≤ exp (SLT Y) := hfail - _ ≤ _ := by rw [mul_add]; linarith + _ ≤ _ := by rw [mul_add]; linarith only [key, this] /-! ### The small primes: the crude bound against Lemma 9 -/ @@ -329,16 +329,16 @@ theorem crude_le : ∃ y₁ : ℝ, ∀ y ≥ y₁, ∀ (lower : Bool) (n : ℕ) set ξ := xi y set X := log (log (y ^ (1 / ξ))) + C' have hs1 : 1 ≤ s := (one_le_sMin lower).trans hs - have hξ4 : 6 ≤ ξ := by linarith [add_one_le_exp (32 : ℝ)] + have hξ4 : 6 ≤ ξ := by linarith only [add_one_le_exp (32 : ℝ), hξ32] have hL4 : 0 < log y ^ 4 := by have := log_pos hy1; positivity -- the crude bound have hfail : fail lower n y (y ^ (1 / ξ)) ≤ 2 * (exp 1 * X / (ξ - 2)) ^ (ξ - 2) := by rw [one_div] - refine fail_rpow_le_tail hy1 (by linarith) ?_ h2e + refine fail_rpow_le_tail hy1 (by linarith only [hξ4]) ?_ h2e rw [← one_div] have := hCS _ hw2 - have : CS ≤ C' := by simp only [C']; linarith [le_abs_self CS] + have : CS ≤ C' := by simp only [C']; linarith only [le_abs_self CS] simp only [X] linarith -- Lemma 9 @@ -346,19 +346,19 @@ theorem crude_le : ∃ y₁ : ℝ, ∀ y ≥ y₁, ∀ (lower : Bool) (n : ℕ) intro t ht rw [errMaj_eq_majG_succ] refine le_trans (exp_le_exp.2 ?_) (hc _ t ht) - have : c * t ≤ c' * t := mul_le_mul_of_nonneg_right (le_max_left _ _) (by linarith) - linarith + have : c * t ≤ c' * t := mul_le_mul_of_nonneg_right (le_max_left _ _) (by linarith only [ht]) + linarith only [this] have hGs := errMaj_pos lower s have hmain : 2 * (exp 1 * X / (ξ - 2)) ^ (ξ - 2) * log y ^ 4 ≤ delta s y * errMaj lower s := by rcases le_total s (ξ / 2) with h | h - · refine hA.trans ((hG _ (by linarith)).trans ?_) + · refine hA.trans ((hG _ (by linarith only [hξ4])).trans ?_) calc errMaj lower (ξ / 2) ≤ errMaj lower s := errMaj_antitone lower h _ ≤ delta s y * errMaj lower s := le_mul_of_one_le_left hGs.le (one_le_delta hs1 y) · refine hB.trans ?_ - have hδ := delta_le_delta (by linarith : 1 ≤ ξ / 2) h y + have hδ := delta_le_delta (by linarith only [hξ4] : 1 ≤ ξ / 2) h y have hGG : exp (-(ξ * log ξ) - ξ * log (log ξ) - c' * ξ) ≤ errMaj lower s := - (hG ξ (by linarith)).trans (errMaj_antitone lower hsξ) - exact mul_le_mul hδ hGG (exp_pos _).le (by linarith [one_le_delta hs1 y]) + (hG ξ (by linarith only [hξ4])).trans (errMaj_antitone lower hsξ) + exact mul_le_mul hδ hGG (exp_pos _).le (by linarith only [one_le_delta hs1 y, hs1]) rw [le_div_iff₀ hL4] calc fail lower n y (y ^ (1 / ξ)) * log y ^ 4 ≤ 2 * (exp 1 * X / (ξ - 2)) ^ (ξ - 2) * log y ^ 4 := by gcongr @@ -372,7 +372,7 @@ theorem ratio_le {r : ℕ} {ε : ℝ} (hε : ε * ((r : ℝ) + 1) ^ 2 ≤ 1) : rw [show ((r + 1 : ℕ) : ℝ) / ((r + 1 : ℕ) + 1) * (1 - ε) = ((r : ℝ) + 1) * (1 - ε) / (r + 2) by push_cast; ring] rw [div_le_div_iff₀ (by positivity) (by positivity)] - nlinarith + nlinarith only [hε] /-- The depth condition supplies the relative gain `(log L)²/(4L²)` used in [I71, (4.6)]. Here `Λ` stands for `log L`; the estimate only needs `Λ > 0`. -/ @@ -398,15 +398,15 @@ theorem combine {cR c₇ L D M F cr E T ρ ρ' ε : ℝ} (hε0 : 0 ≤ ε) (hεL : 1 / (4 * L ^ 2) ≤ ε) (hρ' : 1 / 2 ≤ ρ') (hc : 32 ≤ cR * c₇) (hD : 0 ≤ D) (hL : 0 < L) : F ≤ cR * M / L + cR * c₇ * ρ' * D := by - have hcc : 0 ≤ cR * c₇ := by linarith + have hcc : 0 ≤ cR * c₇ := by linarith only [hc] have hD' : 0 ≤ D * (1 + ε / 2) := by positivity have h1 : cR * c₇ * ρ * T ≤ cR * c₇ * ρ' * D * ((1 - ε) * (1 + ε / 2)) := by calc cR * c₇ * ρ * T ≤ cR * c₇ * ρ * (D * (1 + ε / 2)) := mul_le_mul_of_nonneg_left hT (by positivity) _ ≤ cR * c₇ * (ρ' * (1 - ε)) * (D * (1 + ε / 2)) := by gcongr _ = _ := by ring - have h2 : (1 - ε) * (1 + ε / 2) ≤ 1 - ε / 2 := by nlinarith - have hρ'0 : 0 ≤ ρ' := by linarith + have h2 : (1 - ε) * (1 + ε / 2) ≤ 1 - ε / 2 := by nlinarith only [hε0] + have hρ'0 : 0 ≤ ρ' := by linarith only [hρ'] have h3 : cR * c₇ * ρ' * D * ((1 - ε) * (1 + ε / 2)) ≤ cR * c₇ * ρ' * D * (1 - ε / 2) := mul_le_mul_of_nonneg_left h2 (by positivity) have hL2 : 0 < L ^ 2 := by positivity @@ -417,9 +417,9 @@ theorem combine {cR c₇ L D M F cr E T ρ ρ' ε : ℝ} have h5 : 2 * (D / L ^ 2) ≤ cR * c₇ * ρ' * D * (ε / 2) := by have := mul_le_mul_of_nonneg_left h4 hD calc 2 * (D / L ^ 2) = D * (4 / L ^ 2) / 2 := by ring - _ ≤ D * (cR * c₇ * ρ' * ε) / 2 := by linarith + _ ≤ D * (cR * c₇ * ρ' * ε) / 2 := by linarith only [this] _ = _ := by ring - nlinarith + nlinarith only [hF, hcr, hE, h1, h3, h5] /-- The main case of the inductive step: `y` large and `r + 2 ≤ 2 L / log L`. All analytic inputs are hypotheses at the given `y`, `s`. -/ @@ -499,12 +499,12 @@ theorem main_step {cR c₇ CR C₁ C₃ : ℝ} {r : ℕ} (IH : Bound cR c₇ r) exact div_le_div_of_nonneg_right (by nlinarith only [hΛ]) (by positivity) have hρ' : 1 / 2 ≤ ρ' := by simp only [ρ'] - rw [div_le_div_iff₀ (by norm_num) (by positivity)]; push_cast; linarith + rw [div_le_div_iff₀ (by norm_num) (by positivity)]; push_cast; linarith only [] have hcr : fail lower (r + 1) y w ≤ D / L ^ 2 := by refine hcrude.trans_eq ?_ rw [hD, div_div]; ring -- Split at `w`, apply the inner induction bounds, then combine the main sum and source. - have hwz : w ≤ y ^ (1 / s) := rpow_one_div_le_rpow_one_div hy.le (by linarith) hsξ + have hwz : w ≤ y ^ (1 / s) := rpow_one_div_le_rpow_one_div hy.le (by linarith only [hs1]) hsξ have hF : fail lower (r + 1) y (y ^ (1 / s)) ≤ fail lower (r + 1) y w + (cR * mainMaj lower s / L + K * s ^ 2 * G * pntE w / L) + cR * c₇ * ((r : ℝ) / (r + 1)) * T := by @@ -558,7 +558,7 @@ theorem theorem4 {cR CR : ℝ} (hcR : 0 < cR) (hR : ∀ z ≥ 2, |R z * log z - have hc₇ : 32 ≤ cR * c₇ := by have := le_max_left (32 / cR) (6 * exp (SLT y₀) * log y₀ ^ 2 / (cR * bigM Ξ)) rw [div_le_iff₀ hcR] at this - linarith + linarith only [this] refine ⟨c₇, hc₇0, fun r => ?_⟩ change Bound cR c₇ r induction r with @@ -584,14 +584,14 @@ theorem theorem4 {cR CR : ℝ} (hcR : 0 < cR) (hR : ∀ z ≥ 2, |R z * log z - rw [hyd y hyd' lower r (y ^ (1 / s)) hdeep 1] refine (IH lower y s hy hs hsξ).trans ?_ have hab : (r : ℝ) / (r + 1) ≤ ((r + 1 : ℕ) : ℝ) / ((r + 1 : ℕ) + 1) := by - rw [div_le_div_iff₀ (by positivity) (by positivity)]; push_cast; nlinarith + rw [div_le_div_iff₀ (by positivity) (by positivity)]; push_cast; nlinarith only [] have hL2 : 0 < log y ^ 2 := by have := log_pos hy; positivity refine mul_le_mul_of_nonneg_left (add_le_add_right (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hab hc₇0) (zero_le_one.trans (one_le_delta hs1 y))) (errMaj_pos lower s).le) hL2.le) _) hcR.le · obtain ⟨-, hξ32, -, hw2⟩ := hyx y hyx' - have hξ3 : 3 ≤ xi y := by linarith [add_one_le_exp (32 : ℝ)] + have hξ3 : 3 ≤ xi y := by linarith only [add_one_le_exp (32 : ℝ), hξ32] obtain ⟨⟨hΛ, hδ⟩, hK⟩ := hye y hye' exact main_step IH hcR hc₇ hCR hC₁0 hC₃0 hy hs hsξ (hC₁ lower y s hy hs hsξ hξ3 hw2) (src_le_of_le_xi hR hy hs hsξ hξ3 hw2) (hC₃ lower y s hy₃ hs) diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAsymp.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAsymp.lean index 984ed68bc0..8c27d5277d 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAsymp.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAsymp.lean @@ -70,7 +70,7 @@ theorem tendsto_lin_sub_rpow : have h6 : 6 ≤ pntκ * ℓ ^ (1 / 10 : ℝ) := by rw [div_le_iff₀ pntκ_pos] at h; linarith rw [hsplit] - nlinarith + nlinarith only [hℓ, h6] theorem tendsto_log_pow_pntE : Tendsto (fun y : ℝ => log y ^ 5 * pntE (y ^ (1 / xi y))) atTop (𝓝 0) := by @@ -85,7 +85,7 @@ theorem tendsto_log_pow_pntE : · filter_upwards [eventually_gt_atTop 1] with y hy have hL := log_pos hy have hLe : log y ≤ exp (log (log (3 * y))) := by - rw [← log_add_log_three hy]; linarith [log_pos (by norm_num : (1 : ℝ) < 3)] + rw [← log_add_log_three hy]; linarith only [log_pos (by norm_num : (1 : ℝ) < 3)] rw [pntE_rpow_one_div_xi hy, sub_eq_add_neg, exp_add, ← neg_mul] gcongr calc log y ^ 5 ≤ exp (log (log (3 * y))) ^ 5 := by gcongr @@ -110,12 +110,12 @@ theorem eventually_mul_pntE_le (K : ℝ) : ∀ᶠ y : ℝ in atTop, _ = log y ^ 5 := by ring have h2 : |K| * (log y ^ 5 * pntE (y ^ (1 / xi y))) ≤ |K| * (1 / (|K| + 1)) := by gcongr have h3 : |K| * (1 / (|K| + 1)) ≤ 1 := by - rw [mul_one_div, div_le_one (by positivity)]; linarith + rw [mul_one_div, div_le_one (by positivity)]; linarith only [] calc K * xi y ^ 2 * log y ^ 3 * pntE (y ^ (1 / xi y)) ≤ |K| * (xi y ^ 2 * log y ^ 3) * pntE (y ^ (1 / xi y)) := by rw [mul_assoc K]; gcongr; exact le_abs_self K _ ≤ |K| * log y ^ 5 * pntE (y ^ (1 / xi y)) := by gcongr - _ ≤ 1 := by rw [mul_assoc]; linarith + _ ≤ 1 := by rw [mul_assoc]; linarith only [h2, h3] /-- On `[0, 1]`, the exponential is at most `1 + 2v`. -/ theorem exp_le_one_add_two_mul {v : ℝ} (hv0 : 0 ≤ v) (hv1 : v ≤ 1) : @@ -186,13 +186,13 @@ theorem eventually_delta_mul_le (C : ℝ) (hC : 0 ≤ C) : ∀ᶠ y : ℝ in atT /-- `ξ log ξ - (ξ - 2) log (ξ - 2) ≤ 2 log ξ + 2`. -/ theorem mul_log_sub_le {ξ : ℝ} (hξ : 2 < ξ) : ξ * log ξ - (ξ - 2) * log (ξ - 2) ≤ 2 * log ξ + 2 := by - have hu : 0 < ξ - 2 := by linarith - have h := log_le_sub_one_of_pos (div_pos (by linarith : 0 < ξ) hu) - rw [log_div (by linarith) hu.ne'] at h + have hu : 0 < ξ - 2 := by linarith only [hξ] + have h := log_le_sub_one_of_pos (div_pos (by linarith only [hξ] : 0 < ξ) hu) + rw [log_div (by linarith only [hξ]) hu.ne'] at h have h' : (ξ - 2) * (log ξ - log (ξ - 2)) ≤ (ξ - 2) * (ξ / (ξ - 2) - 1) := mul_le_mul_of_nonneg_left h hu.le have e : (ξ - 2) * (ξ / (ξ - 2) - 1) = 2 := by field_simp; ring - nlinarith + nlinarith only [h', e] /-- The exponent comparison for [I71, (4.4), (4.9)], after bounding the logarithms. -/ theorem crude_half_exponent_le {c ℓ L ξ X : ℝ} (hℓ_large : 2 ≤ ℓ) (hxi_large : 8 * ℓ ≤ ξ) @@ -358,15 +358,15 @@ theorem eventually_crude_hyp (c C' : ℝ) : ∀ᶠ ℓ : ℝ in atTop, (by norm_num : (0 : ℝ) < 1 / 4)).eventually (eventually_ge_atTop (2 * C')), tendsto_log_atTop.eventually (eventually_ge_atTop (4 * (2 + c + 18 * log 2))), hF6, eventually_ge_atTop (16 * (2 + |c|))] with ℓ h1 h2 h3 h4 h4' h5 h6 h6' - have hℓ0 : 0 < ℓ := by linarith - have hlℓ : 0 ≤ log ℓ := log_nonneg (by linarith) - refine ⟨h1, h2, ?_, ?_, by linarith, ?_⟩ + have hℓ0 : 0 < ℓ := by linarith only [h1] + have hlℓ : 0 ≤ log ℓ := log_nonneg (by linarith only [h1]) + refine ⟨h1, h2, ?_, ?_, by linarith only [h5], ?_⟩ · have := mul_le_mul_of_nonneg_right h3 (exp_pos (ℓ / 2)).le rw [mul_assoc, ← exp_add, show -(1 / 2) * ℓ + ℓ / 2 = 0 by ring, exp_zero, mul_one] at this - linarith + linarith only [this] · have hq := rpow_nonneg hℓ0.le (1 / 4 : ℝ) rw [norm_of_nonneg hlℓ, norm_of_nonneg hq] at h4 - linarith + linarith only [h4, h4', hlℓ] · rw [norm_of_nonneg hlℓ, id, norm_of_nonneg hℓ0.le] at h6 have := le_abs_self c have := abs_nonneg c diff --git a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAux.lean b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAux.lean index 1cf36d8606..b1b2fa6ad5 100644 --- a/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAux.lean +++ b/LeanPool/IwaniecLinearSieve/LinearSieve/TheoremFourAux.lean @@ -48,7 +48,7 @@ theorem sum_R_div_eq {a b : ℝ} (hab : a ≤ b) : rw [hs] at h have ha := R_eq a have hb := R_eq b - linarith + linarith only [h, ha, hb] /-- The depth-one source term of `fail false`: the primes `p < z` with `p³ ≥ y` (none for the lower sieve). -/ @@ -83,7 +83,7 @@ theorem src_le {cR CR : ℝ} (hR : ∀ z ≥ 2, |R z * log z - cR| ≤ CR * pntE src lower y (y ^ (1 / s)) ≤ (if lower then 0 else cR * max (3 - s) 0 / log y) + 6 * CR * pntE w / log y := by have hL : 0 < log y := log_pos hy - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] have hCR : 0 ≤ CR := by have h := (abs_nonneg _).trans (hR 2 le_rfl) exact nonneg_of_mul_nonneg_left h (pntE_pos 2) @@ -100,32 +100,32 @@ theorem src_le {cR CR : ℝ} (hR : ∀ z ≥ 2, |R z * log z - cR| ≤ CR * pntE refine eq_empty_of_forall_notMem fun p hp ↦ ?_ rw [mem_filter, mem_primesLT] at hp have := rpow_one_div_le_rpow_one_div hy.le (by norm_num) h3 - linarith [hp.1.2] - rw [this, sum_empty, max_eq_right (by linarith)] + linarith only [hp.1.2, hp, this] + rw [this, sum_empty, max_eq_right (by linarith only [h3])] simpa using hE - · rw [sum_R_div_eq (rpow_one_div_le_rpow_one_div hy.le (by linarith) h3), - max_eq_left (by linarith)] + · rw [sum_R_div_eq (rpow_one_div_le_rpow_one_div hy.le (by linarith only [hs]) h3), + max_eq_left (by linarith only [h3])] have h1 := (abs_le.1 (hR _ (hw.trans hw3))).2 have h2 := (abs_le.1 (hR _ (hw.trans hwz))).1 rw [log_rpow_one_div hy0] at h1 h2 - have e1 : pntE (y ^ (1 / 3 : ℝ)) ≤ pntE w := pntE_le_pntE (by linarith) hw3 - have e2 : pntE (y ^ (1 / s)) ≤ pntE w := pntE_le_pntE (by linarith) hwz + have e1 : pntE (y ^ (1 / 3 : ℝ)) ≤ pntE w := pntE_le_pntE (by linarith only [hw]) hw3 + have e2 : pntE (y ^ (1 / s)) ≤ pntE w := pntE_le_pntE (by linarith only [hw]) hwz have hR1 : R (y ^ (1 / 3 : ℝ)) ≤ 3 * (cR + CR * pntE w) / log y := by rw [le_div_iff₀ hL] - nlinarith + nlinarith only [h1, hCR, e1] have hR2 : s * (cR - CR * pntE w) / log y ≤ R (y ^ (1 / s)) := by rw [div_le_iff₀ hL] have : R (y ^ (1 / s)) * (log y / s) * s = R (y ^ (1 / s)) * log y := by field_simp have h2' : cR - CR * pntE w ≤ R (y ^ (1 / s)) * (log y / s) := by nlinarith - nlinarith [mul_le_mul_of_nonneg_left h2' (by linarith : (0 : ℝ) ≤ s)] + nlinarith [mul_le_mul_of_nonneg_left h2' (by linarith only [hs] : (0 : ℝ) ≤ s)] have : 3 * (cR + CR * pntE w) / log y - s * (cR - CR * pntE w) / log y ≤ cR * (3 - s) / log y + 6 * CR * pntE w / log y := by rw [← sub_div, ← add_div] apply div_le_div_of_nonneg_right _ hL.le have := pntE_pos w - nlinarith [mul_nonneg (mul_nonneg hCR this.le) (by linarith : (0 : ℝ) ≤ 3 - s)] - linarith + nlinarith [mul_nonneg (mul_nonneg hCR this.le) (by linarith only [h3] : (0 : ℝ) ≤ 3 - s)] + linarith only [hR1, hR2, this] · simp only [src, ite_true] simpa using hE @@ -137,7 +137,7 @@ theorem one_le_delta {s : ℝ} (hs : 1 ≤ s) (y : ℝ) : 1 ≤ delta s y := by theorem delta_le_delta {s s' : ℝ} (hs : 1 ≤ s) (hss' : s ≤ s') (y : ℝ) : delta s y ≤ delta s' y := by have hl := log_nonneg hs - have hll : log s ≤ log s' := log_le_log (by linarith) hss' + have hll : log s ≤ log s' := log_le_log (by linarith only [hs]) hss' have hx0 := lsx_nonneg (log y) hs have hx : s ^ 2 * log s ^ 5 / log y ^ 2 ≤ s' ^ 2 * log s' ^ 5 / log y ^ 2 := by gcongr rw [delta, delta] @@ -150,9 +150,9 @@ theorem delta_max_le {s a : ℝ} (hs : 1 ≤ s) (ha : 1 ≤ a) (y : ℝ) : delta (max s a) y ≤ delta a y * delta s y := by rcases le_total s a with h | h · rw [max_eq_right h] - exact le_mul_of_one_le_right (by linarith [one_le_delta ha y]) (one_le_delta hs y) + exact le_mul_of_one_le_right (by linarith only [one_le_delta ha y, ha]) (one_le_delta hs y) · rw [max_eq_left h] - exact le_mul_of_one_le_left (by linarith [one_le_delta hs y]) (one_le_delta ha y) + exact le_mul_of_one_le_left (by linarith only [one_le_delta hs y, hs]) (one_le_delta ha y) /-! ### The inner level of the recursion -/ @@ -172,8 +172,8 @@ theorem lt_div_log_of_lt_rpow {y s : ℝ} {p : ℕ} (hy : 1 < y) (hs : 0 < s) (h (hpz : (p : ℝ) < y ^ (1 / s)) : s < log y / log p := by have hlp : 0 < log (p : ℝ) := log_pos (by exact_mod_cast hp) have h := log_lt_log (by positivity) hpz - rw [log_rpow_one_div (by linarith)] at h - rw [lt_div_iff₀ hlp]; rw [lt_div_iff₀ hs] at h; linarith + rw [log_rpow_one_div (by linarith only [hy])] at h + rw [lt_div_iff₀ hlp]; rw [lt_div_iff₀ hs] at h; linarith only [h] theorem prime_lt_of_mem_rosserPrimes {lower : Bool} {y s : ℝ} {p : ℕ} (hy : 1 < y) (hs : 1 ≤ s) (hp : p ∈ rosserPrimes lower y (y ^ (1 / s))) : (p : ℝ) < y := by @@ -192,19 +192,19 @@ theorem sMin_le_inner {lower : Bool} {y s : ℝ} {p : ℕ} (hy : 1 < y) (hs : sM have h3 := ((mem_rosserPrimes.1 hp).2.resolve_left (by simp)) have h := log_lt_log (by have := hpP.pos; positivity) h3 rw [log_pow] at h - have : 3 < log y / log p := by rw [lt_div_iff₀ hlp]; push_cast at h; linarith + have : 3 < log y / log p := by rw [lt_div_iff₀ hlp]; push_cast at h; linarith only [h] simp only [Bool.not_false, sMin] - linarith + linarith only [this] · have hs2 : (2 : ℝ) ≤ s := hs - have := lt_div_log_of_lt_rpow hy (by linarith) hpP.one_lt + have := lt_div_log_of_lt_rpow hy (by linarith only [hs2]) hpP.one_lt (lt_of_mem_primesLT (rosserPrimes_subset hp)) simp only [Bool.not_true, sMin] - linarith + linarith only [hs2, this] theorem one_lt_log_three_mul {x : ℝ} (hx : 1 ≤ x) : 1 < log (3 * x) := by - rw [lt_log_iff_exp_lt (by linarith)] + rw [lt_log_iff_exp_lt (by linarith only [hx])] have := exp_one_lt_d9 - linarith + linarith only [hx, this] /-- `log (y^{1/ξ(y)}) = (log log 3y)^{11/5}`. -/ theorem log_rpow_one_div_xi {y : ℝ} (hy : 1 < y) : @@ -212,19 +212,19 @@ theorem log_rpow_one_div_xi {y : ℝ} (hy : 1 < y) : have hL : 0 < log y := log_pos hy have hℓ : 0 < log (log (3 * y)) := log_pos (one_lt_log_three_mul hy.le) have hP : 0 < log (log (3 * y)) ^ (11 / 5 : ℝ) := rpow_pos_of_pos hℓ _ - rw [log_rpow_one_div (by linarith), xi, div_div_cancel₀ hL.ne'] + rw [log_rpow_one_div (by linarith only [hy]), xi, div_div_cancel₀ hL.ne'] /-- For `y^{1/ξ(y)} ≤ p < y`, the inner parameter satisfies `t_p - 1 ≤ ξ(y/p)`. -/ theorem inner_le_xi {y : ℝ} {p : ℕ} (hy : 1 < y) (hp : 1 < p) (hpy : (p : ℝ) < y) (hw : y ^ (1 / xi y) ≤ p) : log y / log p - 1 ≤ xi (y / p) := by have hp0 : (0 : ℝ) < p := by positivity - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hy] have hlp : 0 < log (p : ℝ) := log_pos (by exact_mod_cast hp) have hℓ : 0 < log (log (3 * y)) := log_pos (one_lt_log_three_mul hy.le) have hyp1 : 1 < y / p := by rw [one_lt_div hp0]; exact hpy have hℓ' : 0 < log (log (3 * (y / p))) := log_pos (one_lt_log_three_mul hyp1.le) have hℓℓ' : log (log (3 * (y / p))) ≤ log (log (3 * y)) := by - refine log_le_log (log_pos (by linarith)) (log_le_log (by positivity) ?_) + refine log_le_log (log_pos (by linarith only [hyp1])) (log_le_log (by positivity) ?_) gcongr exact div_le_self hy0.le (by exact_mod_cast hp.le) have hP' : 0 < log (log (3 * (y / p))) ^ (11 / 5 : ℝ) := rpow_pos_of_pos hℓ' _ @@ -259,6 +259,6 @@ theorem fail_succ_le_split (lower : Bool) (r : ℕ) {y z w : ℝ} (hwz : w ≤ z rw [fail_succ_eq, fail_succ_eq lower r y w, ← sum_filter_add_sum_filter_not (rosserPrimes lower y z) (fun p : ℕ ↦ w ≤ (p : ℝ)), rosserPrimes_filter_lt hwz] - linarith [src_nonneg lower y w] + linarith only [src_nonneg lower y w] end IwaniecLinearSieve.TheoremFour diff --git a/LeanPool/IwaniecLinearSieve/PrimeSums/Error.lean b/LeanPool/IwaniecLinearSieve/PrimeSums/Error.lean index 340f2aa723..f6bc56b185 100644 --- a/LeanPool/IwaniecLinearSieve/PrimeSums/Error.lean +++ b/LeanPool/IwaniecLinearSieve/PrimeSums/Error.lean @@ -72,7 +72,7 @@ theorem tendsto_pntE : Tendsto pntE atTop (𝓝 0) := by /-- `pntE` dominates `1 / x`. -/ theorem inv_le_pntE {x : ℝ} (hx : 2 ≤ x) : x⁻¹ ≤ pntE x := by - have hx0 : 0 < x := by linarith + have hx0 : 0 < x := by linarith only [hx] have hL : 1 / 4 ≤ log x := by have := log_two_gt_d9 have := log_le_log (by norm_num) hx @@ -85,25 +85,25 @@ theorem inv_le_pntE {x : ℝ} (hx : 2 ≤ x) : x⁻¹ ≤ pntE x := by have := pntκ_le_half have := sqrt_nonneg (log x) nlinarith - rw [mul_self_sqrt (by linarith)] at h1 - linarith + rw [mul_self_sqrt (by linarith only [hL])] at h1 + linarith only [h1] theorem one_div_mul_log_le_pntE {x : ℝ} (hx : 2 ≤ x) : 1 / (x * log x) ≤ 2 * pntE x := by - have hx0 : 0 < x := by linarith + have hx0 : 0 < x := by linarith only [hx] have hL : 1 / 2 ≤ log x := by have := log_two_gt_d9 have := log_le_log (by norm_num) hx linarith calc 1 / (x * log x) = x⁻¹ * (log x)⁻¹ := by rw [one_div, mul_inv] _ ≤ pntE x * 2 := by - refine mul_le_mul (inv_le_pntE hx) ?_ (inv_nonneg.2 (by linarith)) (pntE_nonneg _) - rw [inv_le_comm₀ (by linarith) (by norm_num)] - linarith + refine mul_le_mul (inv_le_pntE hx) ?_ (inv_nonneg.2 (by linarith only [hL])) (pntE_nonneg _) + rw [inv_le_comm₀ (by linarith only [hL]) (by norm_num)] + linarith only [hL] _ = 2 * pntE x := mul_comm _ _ /-- `pntE` dominates `x ^ (-1/2) * log x`. -/ theorem sqrt_mul_log_le {x : ℝ} (hx : 1 ≤ x) : √x * log x ≤ 12 * x * pntE x := by - have hx0 : 0 < x := by linarith + have hx0 : 0 < x := by linarith only [hx] set L := log x with hLdef have hL : 0 ≤ L := log_nonneg hx have hsx : √x = exp (L / 2) := by @@ -113,19 +113,19 @@ theorem sqrt_mul_log_le {x : ℝ} (hx : 1 ≤ x) : √x * log x ≤ 12 * x * pnt rw [← exp_add, add_halves, hLdef, exp_log hx0] clear_value L -- `L ≤ 4 exp (L / 4)` and `κ √L ≤ (L + 1) / 4`. - have h1 : L ≤ 4 * exp (L / 4) := by linarith [add_one_le_exp (L / 4)] + have h1 : L ≤ 4 * exp (L / 4) := by linarith only [add_one_le_exp (L / 4)] have h2 : pntκ * √L ≤ L / 4 + 1 / 4 := by have hκ := pntκ_le_half have hs := sqrt_nonneg L have hsq := mul_self_sqrt hL - nlinarith [sq_nonneg (√L - 1)] + nlinarith only [sq_nonneg (√L - 1), hsq, hκ, hs] have h3 : exp (pntκ * √L) ≤ 3 * exp (L / 4) := by calc exp (pntκ * √L) ≤ exp (L / 4 + 1 / 4) := exp_le_exp.2 h2 _ = exp (L / 4) * exp (1 / 4) := exp_add _ _ _ ≤ exp (L / 4) * 3 := by gcongr calc exp (1 / 4 : ℝ) ≤ exp 1 := exp_le_exp.2 (by norm_num) - _ ≤ 3 := by have := exp_one_lt_d9; linarith + _ ≤ 3 := by have := exp_one_lt_d9; linarith only [this] _ = 3 * exp (L / 4) := mul_comm _ _ have h4 : L * exp (pntκ * √L) ≤ 12 * exp (L / 2) := by calc L * exp (pntκ * √L) ≤ (4 * exp (L / 4)) * (3 * exp (L / 4)) := by @@ -146,7 +146,7 @@ theorem sqrt_mul_log_le {x : ℝ} (hx : 1 ≤ x) : √x * log x ≤ 12 * x * pnt theorem hasDerivAt_pntE {x : ℝ} (hx : 1 < x) : HasDerivAt pntE (pntE x * (-pntκ * (x⁻¹ / (2 * √(log x))))) x := by - have hlog : HasDerivAt log x⁻¹ x := hasDerivAt_log (by linarith) + have hlog : HasDerivAt log x⁻¹ x := hasDerivAt_log (by linarith only [hx]) have h := ((hlog.sqrt (log_pos hx).ne').const_mul (-pntκ)).exp exact h @@ -157,7 +157,7 @@ theorem exists_abs_psi_sub_le : obtain ⟨X, hX⟩ := eventually_atTop.1 hC refine ⟨max C 0, max X 1, le_max_right _ _, fun x hx ↦ ?_⟩ have hx1 : 1 ≤ x := (le_max_right _ _).trans hx - have hx0 : 0 < x := by linarith + have hx0 : 0 < x := by linarith only [hx1] have h := hX x ((le_max_left _ _).trans hx) simp only [Pi.sub_apply, id, norm_eq_abs, norm_mul, abs_of_pos hx0, abs_exp] at h have hexp : exp (-StrongPNT.choose * log x ^ ((1 : ℝ) / 2)) ≤ pntE x := by @@ -176,22 +176,22 @@ theorem exists_abs_psi_sub_le : theorem theta_asymp : ∃ C : ℝ, 0 ≤ C ∧ ∀ x ≥ 2, |Chebyshev.theta x - x| ≤ C * x * pntE x := by obtain ⟨C, X, hC, hX⟩ := exists_abs_psi_sub_le set X' := max X 2 - refine ⟨max (C + 24) (pntE X')⁻¹, (hC.trans (by linarith)).trans (le_max_left _ _), + refine ⟨max (C + 24) (pntE X')⁻¹, (hC.trans (by linarith only [])).trans (le_max_left _ _), fun x hx ↦ ?_⟩ - have hx0 : 0 < x := by linarith + have hx0 : 0 < x := by linarith only [hx] have hE := pntE_pos x rcases le_or_gt X' x with hxX | hxX · -- large `x`: use the PNT for `ψ` and `ψ - θ = O(√x log x)`. have h1 := hX x ((le_max_left _ _).trans hxX) - have h2 := Chebyshev.psi_sub_theta_le (x := x) (by linarith) + have h2 := Chebyshev.psi_sub_theta_le (x := x) (by linarith only [hx]) have h3 := Chebyshev.theta_le_psi x - have h4 := sqrt_mul_log_le (x := x) (by linarith) + have h4 := sqrt_mul_log_le (x := x) (by linarith only [hx]) calc |Chebyshev.theta x - x| ≤ |Chebyshev.psi x - x| + (Chebyshev.psi x - Chebyshev.theta x) := by have h5 := le_abs_self (Chebyshev.psi x - x) have h6 := neg_abs_le (Chebyshev.psi x - x) rw [abs_le]; constructor <;> linarith - _ ≤ C * x * pntE x + 2 * (12 * x * pntE x) := by linarith + _ ≤ C * x * pntE x + 2 * (12 * x * pntE x) := by linarith only [h1, h2, h4] _ = (C + 24) * x * pntE x := by ring _ ≤ max (C + 24) (pntE X')⁻¹ * x * pntE x := by gcongr; exact le_max_left _ _ · -- small `x`: `0 ≤ θ x ≤ log 4 * x ≤ 2 x` and `pntE x ≥ pntE X'`. @@ -201,7 +201,7 @@ theorem theta_asymp : ∃ C : ℝ, 0 ≤ C ∧ ∀ x ≥ 2, |Chebyshev.theta x - rw [show (4 : ℝ) = 2 ^ 2 by norm_num, log_pow] have := log_two_lt_d9 push_cast - linarith + linarith only [this] have h3 : |Chebyshev.theta x - x| ≤ x := by rw [abs_le]; constructor <;> nlinarith have h4 : pntE X' ≤ pntE x := pntE_le_pntE hx0 hxX.le diff --git a/LeanPool/IwaniecLinearSieve/PrimeSums/Lemma13.lean b/LeanPool/IwaniecLinearSieve/PrimeSums/Lemma13.lean index 987b9b1a35..e471b4bf47 100644 --- a/LeanPool/IwaniecLinearSieve/PrimeSums/Lemma13.lean +++ b/LeanPool/IwaniecLinearSieve/PrimeSums/Lemma13.lean @@ -30,10 +30,10 @@ namespace IwaniecLinearSieve /-! ### Elementary facts about `log ∘ log` -/ theorem continuousOn_inv_mul_log {u v : ℝ} (hu : 1 < u) : ContinuousOn (fun x ↦ (x * log x)⁻¹) (Set.Icc u v) := by - have hpos : ∀ x ∈ Set.Icc u v, 1 < x := fun x hx ↦ by linarith [hx.1] + have hpos : ∀ x ∈ Set.Icc u v, 1 < x := fun x hx ↦ by linarith only [hx.1, hu, hx] refine ContinuousOn.inv₀ (ContinuousOn.mul continuousOn_id ?_) fun x hx ↦ ?_ · exact continuousOn_log.mono fun x hx ↦ by - simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith [hpos x hx] + simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith only [hpos x hx, hpos, hx] · have := hpos x hx have := log_pos this positivity @@ -41,7 +41,7 @@ theorem continuousOn_inv_mul_log {u v : ℝ} (hu : 1 < u) : theorem integral_inv_mul_log {u v : ℝ} (hu : 1 < u) (huv : u ≤ v) : ∫ x in u..v, (x * log x)⁻¹ = log (log v) - log (log u) := by have hpos : ∀ x ∈ Set.uIcc u v, 1 < x := fun x hx ↦ by - rw [Set.uIcc_of_le huv] at hx; linarith [hx.1] + rw [Set.uIcc_of_le huv] at hx; linarith only [hx.1, hu, hx] refine integral_eq_sub_of_hasDerivAt (f := fun x ↦ log (log x)) (fun x hx ↦ ?_) ?_ · have hx := hpos x hx have h := (hasDerivAt_log (by linarith : x ≠ 0)).log (log_pos hx).ne' @@ -53,15 +53,15 @@ theorem integral_inv_mul_log {u v : ℝ} (hu : 1 < u) (huv : u ≤ v) : theorem log_log_sub_log_log_le {u v : ℝ} (hu : 1 < u) (huv : u ≤ v) : log (log v) - log (log u) ≤ (v - u) / (u * log u) := by - have hu0 : 0 < u := by linarith + have hu0 : 0 < u := by linarith only [hu] have hlu : 0 < log u := log_pos hu - have hlv : 0 < log v := log_pos (by linarith) + have hlv : 0 < log v := log_pos (by linarith only [hu, huv]) have h1 : log (log v) - log (log u) ≤ log v / log u - 1 := by rw [← log_div hlv.ne' hlu.ne'] exact log_le_sub_one_of_pos (div_pos hlv hlu) have h2 : log v - log u ≤ v / u - 1 := by - rw [← log_div (by linarith) hu0.ne'] - exact log_le_sub_one_of_pos (div_pos (by linarith) hu0) + rw [← log_div (by linarith only [hu, huv]) hu0.ne'] + exact log_le_sub_one_of_pos (div_pos (by linarith only [hu, huv]) hu0) calc log (log v) - log (log u) ≤ log v / log u - 1 := h1 _ = (log v - log u) / log u := by field_simp _ ≤ (v / u - 1) / log u := by gcongr @@ -146,14 +146,14 @@ theorem le_floor_iff_of_prime {p : ℕ} (hp : p.Prime) {A : ℝ} : p ≤ ⌊A⌋ have : (0 : ℝ) < p := by exact_mod_cast hp.pos constructor <;> intro h · exact absurd h (by have := hp.pos; omega) - · linarith + · linarith only [hA, this, h] theorem floor_lt_iff_of_prime {p : ℕ} (hp : p.Prime) {B : ℝ} : ⌊B⌋₊ < p ↔ B < p := by rcases le_or_gt 0 B with hB | hB · exact Nat.floor_lt hB · rw [Nat.floor_of_nonpos hB.le] have : (0 : ℝ) < p := by exact_mod_cast hp.pos - exact ⟨fun _ ↦ by linarith, fun _ ↦ hp.pos⟩ + exact ⟨fun _ ↦ by linarith only [hB, this], fun _ ↦ hp.pos⟩ theorem mem_primesIoc {B A : ℝ} {p : ℕ} : p ∈ primesIoc B A ↔ p.Prime ∧ B < p ∧ (p : ℝ) ≤ A := by simp only [primesIoc, mem_filter, mem_Ioc] @@ -215,47 +215,47 @@ theorem lemma13_Ioc : ∃ C, 0 ≤ C ∧ ∀ (b : ℝ → ℝ) (A B : ℝ), 2 MonotoneOn b (Set.Icc B A) → (∀ x ∈ Set.Icc B A, 0 ≤ b x) → |∑ p ∈ primesIoc B A, b p / p - ∫ x in B..A, b x / (x * log x)| ≤ C * b A * pntE B := by obtain ⟨c₅, C, hC0, hC⟩ := S_asymp_nonneg - refine ⟨2 + 2 * C, by linarith, fun b A B hB hBA hb hb0 ↦ ?_⟩ + refine ⟨2 + 2 * C, by linarith only [hC0], fun b A B hB hBA hb hb0 ↦ ?_⟩ set n := ⌊A⌋₊ - ⌊B⌋₊ + 1 - have h0 : clampPt B A 0 = B := clampPt_zero (by linarith) + have h0 : clampPt B A 0 = B := clampPt_zero (by linarith only [hB]) have hn : clampPt B A n = A := clampPt_last hBA have h2 : ∀ j, 2 ≤ clampPt B A j := fun j ↦ hB.trans (le_clampPt B A j) have hE : ∀ j, pntE (clampPt B A j) ≤ pntE B := fun j ↦ - pntE_le_pntE (by linarith) (le_clampPt B A j) + pntE_le_pntE (by linarith only [hB]) (le_clampPt B A j) have hFf : ∀ j < n, ∫ x in clampPt B A j..clampPt B A (j + 1), (x * log x)⁻¹ = (log (log (clampPt B A (j + 1))) + c₅) - (log (log (clampPt B A j)) + c₅) := by intro j _ - rw [integral_inv_mul_log (by linarith [h2 j]) (clampPt_mono B A (Nat.le_succ j))] + rw [integral_inv_mul_log (by linarith only [h2 j, h2]) (clampPt_mono B A (Nat.le_succ j))] ring have hδ : ∀ j < n, (log (log (clampPt B A (j + 1))) + c₅) - (log (log (clampPt B A j)) + c₅) ≤ 2 * pntE B := by intro j _ have hj := h2 j - have hlog : 0 < log (clampPt B A j) := log_pos (by linarith) + have hlog : 0 < log (clampPt B A j) := log_pos (by linarith only [hj]) calc _ = log (log (clampPt B A (j + 1))) - log (log (clampPt B A j)) := by ring _ ≤ (clampPt B A (j + 1) - clampPt B A j) / (clampPt B A j * log (clampPt B A j)) := - log_log_sub_log_log_le (by linarith) (clampPt_mono B A (Nat.le_succ j)) + log_log_sub_log_log_le (by linarith only [hj]) (clampPt_mono B A (Nat.le_succ j)) _ ≤ 1 / (clampPt B A j * log (clampPt B A j)) := by gcongr - linarith [clampPt_succ_le B A j] + linarith only [clampPt_succ_le B A j] _ ≤ 2 * pntE (clampPt B A j) := one_div_mul_log_le_pntE hj - _ ≤ 2 * pntE B := by linarith [hE j] + _ ≤ 2 * pntE B := by linarith only [hE j, hE] have hε : ∀ j ≤ n, |S (clampPt B A j) - (log (log (clampPt B A j)) + c₅)| ≤ C * pntE B := by intro j _ rw [← sub_sub] exact (hC _ (h2 j)).trans (mul_le_mul_of_nonneg_left (hE j) hC0) have key := abs_sum_sub_integral_le (n := n) (a := clampPt B A) (clampPt_mono B A) (b := b) (f := fun x ↦ (x * log x)⁻¹) (F := fun x ↦ log (log x) + c₅) - (g := fun j ↦ S (clampPt B A j)) (by linarith [pntE_pos B]) (by rw [h0, hn]; exact hb) + (g := fun j ↦ S (clampPt B A j)) (by linarith only [pntE_pos B]) (by rw [h0, hn]; exact hb) (by rw [h0]; exact hb0 B ⟨le_rfl, hBA⟩) (by rw [h0, hn] intro x hx - have : 0 < log x := log_pos (by linarith [hx.1]) - have : 0 < x := by linarith [hx.1] + have : 0 < log x := log_pos (by linarith only [hx.1, hB, hx]) + have : 0 < x := by linarith only [hx.1, hB, hx] positivity) - (by rw [h0, hn]; exact continuousOn_inv_mul_log (by linarith)) hFf hδ hε - rw [h0, hn, sum_clampPt_eq b (by linarith) hBA] at key + (by rw [h0, hn]; exact continuousOn_inv_mul_log (by linarith only [hB])) hFf hδ hε + rw [h0, hn, sum_clampPt_eq b (by linarith only [hB]) hBA] at key simp_rw [div_eq_mul_inv (b _)] calc _ ≤ (2 * pntE B + 2 * (C * pntE B)) * b A := key _ = (2 + 2 * C) * b A * pntE B := by ring @@ -266,7 +266,7 @@ theorem sum_of_forall_cast_eq {t : Finset ℕ} {v : ℝ} (h : ∀ p ∈ t, (p : exact_mod_cast (h a ha).trans (h b hb).symm have hcard' : (t.card : ℝ) ≤ 1 := by exact_mod_cast hcard rw [sum_congr rfl fun p hp ↦ by rw [h p hp], sum_const, nsmul_eq_mul] - exact ⟨by positivity, by nlinarith⟩ + exact ⟨by positivity, by nlinarith only [hφ, hcard']⟩ /-- [I71, Lemma 13], increasing case, for any set of primes between those in `(B, A)` and those in `[B, A]`. -/ @@ -275,8 +275,8 @@ theorem lemma13_mono_of_subset : ∃ C, 0 ≤ C ∧ ∀ (b : ℝ → ℝ) (A B : (∀ p ∈ s, p.Prime ∧ B ≤ p ∧ (p : ℝ) ≤ A) → (∀ p : ℕ, p.Prime → B < p → (p : ℝ) < A → p ∈ s) → |∑ p ∈ s, b p / p - ∫ x in B..A, b x / (x * log x)| ≤ C * b A * pntE B := by obtain ⟨C, hC0, hC⟩ := lemma13_Ioc - refine ⟨C + 1, by linarith, fun b A B s hB hBA hb hb0 hs1 hs2 ↦ ?_⟩ - have hB0 : 0 < B := by linarith + refine ⟨C + 1, by linarith only [hC0], fun b A B s hB hBA hb hb0 hs1 hs2 ↦ ?_⟩ + have hB0 : 0 < B := by linarith only [hB] have hbA : 0 ≤ b A := hb0 A ⟨hBA, le_rfl⟩ have hbB : 0 ≤ b B := hb0 B ⟨le_rfl, hBA⟩ have hbBA : b B ≤ b A := hb ⟨le_rfl, hBA⟩ ⟨hBA, le_rfl⟩ hBA @@ -290,7 +290,7 @@ theorem lemma13_mono_of_subset : ∃ C, 0 ≤ C ∧ ∀ (b : ℝ → ℝ) (A B : rw [Finset.mem_sdiff, mem_primesIoc] at hp obtain ⟨⟨hpp, hBp, hpA⟩, hp2⟩ := hp exact le_antisymm hpA (not_lt.1 fun h ↦ hp2 (hs2 p hpp hBp h))) - (fun x ↦ b x / x) (div_nonneg hbA (by linarith)) + (fun x ↦ b x / x) (div_nonneg hbA (by linarith only [hB, hBA])) have h3 : b B / B ≤ b A * pntE B := by calc b B / B ≤ b A / B := by gcongr _ = b A * B⁻¹ := div_eq_mul_inv _ _ @@ -330,29 +330,29 @@ theorem lemma13_anti_of_subset : ∃ C, 0 ≤ C ∧ ∀ (b : ℝ → ℝ) (A B : (∀ p ∈ s, p.Prime ∧ B ≤ p ∧ (p : ℝ) ≤ A) → (∀ p : ℕ, p.Prime → B < p → (p : ℝ) < A → p ∈ s) → |∑ p ∈ s, b p / p - ∫ x in B..A, b x / (x * log x)| ≤ C * b B * pntE B := by obtain ⟨C, hC0, hC⟩ := lemma13_mono_of_subset - refine ⟨2 * C, by linarith, fun b A B s hB hBA hb hb0 hs1 hs2 ↦ ?_⟩ + refine ⟨2 * C, by linarith only [hC0], fun b A B s hB hBA hb hb0 hs1 hs2 ↦ ?_⟩ set c := b B have hc : 0 ≤ c := hb0 B ⟨le_rfl, hBA⟩ have hbA : 0 ≤ b A := hb0 A ⟨hBA, le_rfl⟩ have hbA' : b A ≤ c := hb ⟨le_rfl, hBA⟩ ⟨hBA, le_rfl⟩ hBA have hb' : MonotoneOn (fun x ↦ c - b x) (Set.Icc B A) := fun x hx y hy hxy ↦ by - simp only; linarith [hb hx hy hxy] + simp only; linarith only [hb hx hy hxy, hb, hx, hy, hxy] have hb'0 : ∀ x ∈ Set.Icc B A, 0 ≤ c - b x := fun x hx ↦ by - simp only [c]; linarith [hb ⟨le_rfl, hBA⟩ hx hx.1] + simp only [c]; linarith only [hb ⟨le_rfl, hBA⟩ hx hx.1, hb, hBA, hx] have e1 := hC (fun _ ↦ c) A B s hB hBA (fun _ _ _ _ _ ↦ le_rfl) (fun _ _ ↦ hc) hs1 hs2 have e2 := hC (fun x ↦ c - b x) A B s hB hBA hb' hb'0 hs1 hs2 have hsum : ∑ p ∈ s, b p / p = ∑ p ∈ s, c / p - ∑ p ∈ s, (c - b p) / p := by rw [← sum_sub_distrib]; exact sum_congr rfl fun p _ ↦ by ring have hint : ∫ x in B..A, b x / (x * log x) = (∫ x in B..A, c / (x * log x)) - ∫ x in B..A, (c - b x) / (x * log x) := by - rw [← integral_sub (intervalIntegrable_div_mul_log (by linarith) hBA - (Or.inl fun _ _ _ _ _ ↦ le_rfl)) (intervalIntegrable_div_mul_log (by linarith) hBA + rw [← integral_sub (intervalIntegrable_div_mul_log (by linarith only [hB]) hBA + (Or.inl fun _ _ _ _ _ ↦ le_rfl)) (intervalIntegrable_div_mul_log (by linarith only [hB]) hBA (Or.inl hb'))] exact integral_congr fun x _ ↦ by ring rw [hsum, hint] have h5 : 0 ≤ C * b A * pntE B := mul_nonneg (mul_nonneg hC0 hbA) (pntE_pos B).le rw [abs_le] at e1 e2 ⊢ - constructor <;> linarith + constructor <;> linarith only [e1, e2, h5] /-- [I71, Lemma 13], decreasing case: for `b ≥ 0` decreasing on `[B, A]`, `2 ≤ B ≤ A`, `|∑_{B ≤ p ≤ A} b(p)/p - ∫_B^A b(x)/(x log x) dx| ≤ C b(B) exp(-κ √(log B))`. -/ @@ -367,7 +367,7 @@ theorem lemma13_anti : ∃ C, ∀ (b : ℝ → ℝ) (A B : ℝ), 2 ≤ B → B theorem integral_inv_log_div_mul_log {u v : ℝ} (hu : 1 < u) (huv : u ≤ v) : ∫ x in u..v, (log x)⁻¹ / (x * log x) = 1 / log u - 1 / log v := by have hpos : ∀ x ∈ Set.uIcc u v, 1 < x := fun x hx ↦ by - rw [Set.uIcc_of_le huv] at hx; linarith [hx.1] + rw [Set.uIcc_of_le huv] at hx; linarith only [hx.1, hu, hx] have hderiv : ∀ x ∈ Set.uIcc u v, HasDerivAt (fun x ↦ -(log x)⁻¹) ((log x)⁻¹ / (x * log x)) x := fun x hx ↦ by have hx := hpos x hx @@ -378,8 +378,8 @@ theorem integral_inv_log_div_mul_log {u v : ℝ} (hu : 1 < u) (huv : u ≤ v) : have hc := continuousOn_inv_mul_log (v := v) hu have hl : ContinuousOn (fun x ↦ (log x)⁻¹) (Set.Icc u v) := ContinuousOn.inv₀ (continuousOn_log.mono fun x hx ↦ by - simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith [hx.1]) - fun x hx ↦ (log_pos (by linarith [hx.1])).ne' + simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith only [hx.1, hu, hx]) + fun x hx ↦ (log_pos (by linarith only [hx.1, hu, hx])).ne' simp_rw [div_eq_mul_inv ((log _)⁻¹)] exact (hl.mul hc).intervalIntegrable_of_Icc huv rw [integral_eq_sub_of_hasDerivAt hderiv hint] @@ -394,12 +394,12 @@ theorem lemma14_of_subset : ∃ C, ∀ (A B : ℝ) (s : Finset ℕ), 2 ≤ B → refine ⟨2 * C, fun A B s hB hBA hs1 hs2 ↦ ?_⟩ have hlogB : 1 / 2 ≤ log B := half_le_log hB have hb : AntitoneOn (fun x ↦ (log x)⁻¹) (Set.Icc B A) := fun x hx y hy hxy ↦ by - have hx0 : 0 < log x := log_pos (by linarith [hx.1]) - exact inv_anti₀ hx0 (log_le_log (by linarith [hx.1]) hxy) + have hx0 : 0 < log x := log_pos (by linarith only [hx.1, hB, hx]) + exact inv_anti₀ hx0 (log_le_log (by linarith only [hx.1, hB, hx]) hxy) have hb0 : ∀ x ∈ Set.Icc B A, 0 ≤ (log x)⁻¹ := fun x hx ↦ - inv_nonneg.2 (log_nonneg (by linarith [hx.1])) + inv_nonneg.2 (log_nonneg (by linarith only [hx.1, hB, hx])) have h := hC _ A B s hB hBA hb hb0 hs1 hs2 - rw [integral_inv_log_div_mul_log (by linarith) hBA] at h + rw [integral_inv_log_div_mul_log (by linarith only [hB]) hBA] at h have hsum : ∑ p ∈ s, (log (p : ℝ))⁻¹ / p = ∑ p ∈ s, 1 / (p * log p) := sum_congr rfl fun p _ ↦ by ring rw [hsum] at h diff --git a/LeanPool/IwaniecLinearSieve/PrimeSums/Mertens.lean b/LeanPool/IwaniecLinearSieve/PrimeSums/Mertens.lean index b0dce2ebd1..8e857d8dad 100644 --- a/LeanPool/IwaniecLinearSieve/PrimeSums/Mertens.lean +++ b/LeanPool/IwaniecLinearSieve/PrimeSums/Mertens.lean @@ -38,8 +38,8 @@ theorem exists_abs_sub_le_of_cauchy {T g : ℝ → ℝ} {a : ℝ} refine ⟨N, fun n hn ↦ ?_⟩ rw [Real.dist_eq] have hNn : (N : ℝ) ≤ n := by exact_mod_cast hn - calc |u n - u N| ≤ g (a + N) := h _ _ (by simp) (by linarith) - _ < ε := hX _ (by linarith) + calc |u n - u N| ≤ g (a + N) := h _ _ (by simp) (by linarith only [hNn]) + _ < ε := hX _ (by linarith only [hN]) obtain ⟨c, hc⟩ := cauchySeq_tendsto_of_complete hu refine ⟨c, fun x hx ↦ ?_⟩ have h1 : Tendsto (fun n : ℕ ↦ |u n - T x|) atTop (𝓝 |c - T x|) := (hc.sub_const _).abs @@ -47,7 +47,7 @@ theorem exists_abs_sub_le_of_cauchy {T g : ℝ → ℝ} {a : ℝ} obtain ⟨N, hN⟩ := exists_nat_ge (x - a) filter_upwards [eventually_ge_atTop N] with n hn have hNn : (N : ℝ) ≤ n := by exact_mod_cast hn - exact h x (a + n) hx (by linarith) + exact h x (a + n) hx (by linarith only [hN, hNn]) rw [abs_sub_comm] exact le_of_tendsto h1 h2 @@ -79,7 +79,7 @@ theorem S_sub_S {x y : ℝ} (hxy : x ≤ y) : theorem hasDerivAt_inv_mul_log {t : ℝ} (ht : 1 < t) : HasDerivAt (fun t ↦ (t * log t)⁻¹) (-((log t + 1) / (t * log t) ^ 2)) t := by - have h0 : t ≠ 0 := by linarith + have h0 : t ≠ 0 := by linarith only [ht] have h1 : HasDerivAt (fun t ↦ t * log t) (1 * log t + t * t⁻¹) t := (hasDerivAt_id t).mul (hasDerivAt_log h0) convert h1.inv (mul_ne_zero h0 (log_pos ht).ne') using 1 @@ -88,7 +88,7 @@ theorem hasDerivAt_inv_mul_log {t : ℝ} (ht : 1 < t) : theorem hasDerivAt_log_log_sub_inv_log {t : ℝ} (ht : 1 < t) : HasDerivAt (fun t ↦ log (log t) - (log t)⁻¹) ((log t + 1) / (t * log t) ^ 2 * t) t := by - have h0 : t ≠ 0 := by linarith + have h0 : t ≠ 0 := by linarith only [ht] have hl : log t ≠ 0 := (log_pos ht).ne' convert ((hasDerivAt_log h0).log hl).sub ((hasDerivAt_log h0).inv hl) using 1 field_simp @@ -98,9 +98,9 @@ theorem continuousOn_log_add_one_div {x y : ℝ} (hx : 1 < x) : ContinuousOn (fun t ↦ (log t + 1) / (t * log t) ^ 2) (Set.Icc x y) := by have hlog : ContinuousOn log (Set.Icc x y) := continuousOn_log.mono fun t ht ↦ by - simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith [ht.1] + simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith only [ht.1, hx, ht] refine ContinuousOn.div (by fun_prop) (by fun_prop) fun t ht ↦ ?_ - have : 1 < t := by linarith [ht.1] + have : 1 < t := by linarith only [ht.1, hx, ht] have := log_pos this positivity @@ -109,16 +109,16 @@ theorem S_sub_loglog_eq {x y : ℝ} (hx : 2 ≤ x) (hxy : x ≤ y) : (S y - log (log y)) - (S x - log (log x)) = (y * log y)⁻¹ * (θ y - y) - (x * log x)⁻¹ * (θ x - x) + ∫ t in x..y, (log t + 1) / (t * log t) ^ 2 * (θ t - t) := by - have hpos : ∀ t ∈ Set.Icc x y, 1 < t := fun t ht ↦ by linarith [ht.1] + have hpos : ∀ t ∈ Set.Icc x y, 1 < t := fun t ht ↦ by linarith only [ht.1, hx, ht] have hderiv : ∀ t ∈ Set.Icc x y, HasDerivAt (fun t ↦ (t * log t)⁻¹) (-((log t + 1) / (t * log t) ^ 2)) t := fun t ht ↦ hasDerivAt_inv_mul_log (hpos t ht) - have hcont := continuousOn_log_add_one_div (y := y) (show 1 < x by linarith) + have hcont := continuousOn_log_add_one_div (y := y) (show 1 < x by linarith only [hx]) have hint : IntegrableOn (deriv fun t ↦ (t * log t)⁻¹) (Set.Icc x y) := hcont.neg.integrableOn_Icc.congr_fun (fun t ht ↦ ((hderiv t ht).deriv).symm) measurableSet_Icc have habel := sum_mul_eq_sub_sub_integral_mul logPrime (f := fun t ↦ (t * log t)⁻¹) - (by linarith) hxy (fun t ht ↦ (hderiv t ht).differentiableAt) hint + (by linarith only [hx]) hxy (fun t ht ↦ (hderiv t ht).differentiableAt) hint rw [← S_sub_S hxy] at habel simp only [sum_logPrime_eq_theta] at habel rw [setIntegral_congr_fun measurableSet_Ioc @@ -149,8 +149,8 @@ theorem S_sub_loglog_eq {x y : ℝ} (hx : 2 ≤ x) (hxy : x ≤ y) : integral_eq_sub_of_hasDerivAt (fun t ht ↦ hasDerivAt_log_log_sub_inv_log (hpos t (by rwa [Set.uIcc_of_le hxy] at ht))) hi2 - have hy0 : y ≠ 0 := by linarith - have hx0 : x ≠ 0 := by linarith + have hy0 : y ≠ 0 := by linarith only [hx, hxy] + have hx0 : x ≠ 0 := by linarith only [hx] have hfy : (y * log y)⁻¹ * y = (log y)⁻¹ := by field_simp have hfx : (x * log x)⁻¹ * x = (log x)⁻¹ := by field_simp rw [hneg] at habel @@ -164,14 +164,14 @@ theorem half_le_log {t : ℝ} (ht : 2 ≤ t) : 1 / 2 ≤ log t := by theorem continuousOn_deriv_pntE {x y : ℝ} (hx : 1 < x) : ContinuousOn (fun t ↦ pntE t * (-pntκ * (t⁻¹ / (2 * √(log t))))) (Set.Icc x y) := by - have hpos : ∀ t ∈ Set.Icc x y, 1 < t := fun t ht ↦ by linarith [ht.1] + have hpos : ∀ t ∈ Set.Icc x y, 1 < t := fun t ht ↦ by linarith only [ht.1, hx, ht] have hlog : ContinuousOn log (Set.Icc x y) := continuousOn_log.mono fun t ht ↦ by - simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith [hpos t ht] + simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith only [hpos t ht, hpos, ht] unfold pntE refine ContinuousOn.mul (by fun_prop) (ContinuousOn.mul (by fun_prop) ?_) refine ContinuousOn.div (continuousOn_inv₀.mono fun t ht ↦ ?_) (by fun_prop) fun t ht ↦ ?_ - · simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith [hpos t ht] + · simp only [Set.mem_compl_iff, Set.mem_singleton_iff]; linarith only [hpos t ht, hpos, ht] · have := sqrt_pos.2 (log_pos (hpos t ht)) positivity @@ -180,15 +180,15 @@ theorem abs_integrand_le {C t : ℝ} (hC : 0 ≤ C) (ht : 2 ≤ t) (hθ : |θ t - t| ≤ C * t * pntE t) : |(log t + 1) / (t * log t) ^ 2 * (θ t - t)| ≤ -(12 * C / pntκ) * (pntE t * (-pntκ * (t⁻¹ / (2 * √(log t))))) := by - have ht0 : 0 < t := by linarith + have ht0 : 0 < t := by linarith only [ht] have hL := half_le_log ht - have hL0 : 0 < log t := by linarith - have hs : 1 / 2 ≤ √(log t) := (le_sqrt (by norm_num) hL0.le).2 (by linarith) - have hs0 : 0 < √(log t) := by linarith + have hL0 : 0 < log t := by linarith only [hL] + have hs : 1 / 2 ≤ √(log t) := (le_sqrt (by norm_num) hL0.le).2 (by linarith only [hL, hL0]) + have hs0 : 0 < √(log t) := by linarith only [hs] have hss := mul_self_sqrt hL0.le have hE := pntE_pos t have hκ := pntκ_pos - have key : (log t + 1) * √(log t) ≤ 6 * log t ^ 2 := by nlinarith + have key : (log t + 1) * √(log t) ≤ 6 * log t ^ 2 := by nlinarith only [hL, hss, hs] calc |(log t + 1) / (t * log t) ^ 2 * (θ t - t)| = (log t + 1) / (t * log t) ^ 2 * |θ t - t| := by rw [abs_mul, abs_of_nonneg (by positivity)] @@ -197,7 +197,7 @@ theorem abs_integrand_le {C t : ℝ} (hC : 0 ≤ C) (ht : 2 ≤ t) _ ≤ C * pntE t * (6 / (t * √(log t))) := by refine mul_le_mul_of_nonneg_left ?_ (by positivity) rw [div_le_div_iff₀ (by positivity) (by positivity)] - nlinarith + nlinarith only [key, ht] _ = -(12 * C / pntκ) * (pntE t * (-pntκ * (t⁻¹ / (2 * √(log t))))) := by field_simp ring @@ -213,7 +213,7 @@ theorem exists_abs_S_sub_loglog_sub_le : have hbd : ∀ t, x ≤ t → |(t * log t)⁻¹ * (θ t - t)| ≤ 2 * C * pntE x := by intro t hxt have ht : 2 ≤ t := hx.trans hxt - have ht0 : 0 < t := by linarith + have ht0 : 0 < t := by linarith only [hx, hxt] have hL := half_le_log ht have hE := pntE_pos t calc |(t * log t)⁻¹ * (θ t - t)| = (t * log t)⁻¹ * |θ t - t| := by @@ -221,13 +221,13 @@ theorem exists_abs_S_sub_loglog_sub_le : _ ≤ (t * log t)⁻¹ * (C * t * pntE t) := by gcongr; exact hC t ht _ = C * pntE t / log t := by field_simp _ ≤ 2 * C * pntE t := by - rw [div_le_iff₀ (by linarith)] - nlinarith [mul_nonneg hC0 hE.le] - _ ≤ 2 * C * pntE x := by gcongr; exact pntE_le_pntE (by linarith) hxt + rw [div_le_iff₀ (by linarith only [hL])] + nlinarith only [mul_nonneg hC0 hE.le, hL, hC0, hE] + _ ≤ 2 * C * pntE x := by gcongr; exact pntE_le_pntE (by linarith only [hx]) hxt have hderivE : ∀ t ∈ Set.uIcc x y, HasDerivAt pntE (pntE t * (-pntκ * (t⁻¹ / (2 * √(log t))))) t := fun t ht ↦ - hasDerivAt_pntE (by rw [Set.uIcc_of_le hxy] at ht; linarith [ht.1]) - have hcontE := continuousOn_deriv_pntE (y := y) (show 1 < x by linarith) + hasDerivAt_pntE (by rw [Set.uIcc_of_le hxy] at ht; linarith only [ht.1, hx, ht]) + have hcontE := continuousOn_deriv_pntE (y := y) (show 1 < x by linarith only [hx]) rw [← Set.uIcc_of_le hxy] at hcontE have hintE := hcontE.intervalIntegrable (μ := volume) have hftc : ∫ t in x..y, -(12 * C / pntκ) * (pntE t * (-pntκ * (t⁻¹ / (2 * √(log t))))) = @@ -240,7 +240,7 @@ theorem exists_abs_S_sub_loglog_sub_le : refine (norm_integral_le_of_norm_le hxy (ae_of_all _ fun t ht ↦ ?_) (hintE.const_mul (-(12 * C / pntκ)))).trans ?_ · rw [norm_eq_abs] - have ht2 : 2 ≤ t := by linarith [ht.1] + have ht2 : 2 ≤ t := by linarith only [ht.1, hx, ht] exact abs_integrand_le hC0 ht2 (hC t ht2) · rw [hftc] have := pntE_pos y @@ -251,7 +251,7 @@ theorem exists_abs_S_sub_loglog_sub_le : calc _ ≤ |(y * log y)⁻¹ * (θ y - y)| + |(x * log x)⁻¹ * (θ x - x)| + |∫ t in x..y, (log t + 1) / (t * log t) ^ 2 * (θ t - t)| := (abs_add_le _ _).trans (add_le_add_left (abs_sub _ _) _) - _ ≤ (4 * C + 12 * C / pntκ) * pntE x := by linarith + _ ≤ (4 * C + 12 * C / pntκ) * pntE x := by linarith only [hint, h1, h2] /-- Mertens' second theorem with the de la Vallée Poussin error term. -/ theorem S_asymp : ∃ c₅ C : ℝ, ∀ x ≥ 2, |S x - log (log x) - c₅| ≤ C * pntE x := by diff --git a/LeanPool/IwaniecLinearSieve/PrimeSums/NthPrime.lean b/LeanPool/IwaniecLinearSieve/PrimeSums/NthPrime.lean index 5b092e1d6c..209f17c7fb 100644 --- a/LeanPool/IwaniecLinearSieve/PrimeSums/NthPrime.lean +++ b/LeanPool/IwaniecLinearSieve/PrimeSums/NthPrime.lean @@ -25,12 +25,12 @@ open Real Filter Topology namespace IwaniecLinearSieve theorem log_le_div_eight {K : ℝ} (hK : 256 ≤ K) : log K ≤ K / 8 := by - have hK0 : 0 < K := by linarith - have hs : 16 ≤ √K := (le_sqrt (by norm_num) hK0.le).2 (by linarith) + have hK0 : 0 < K := by linarith only [hK] + have hs : 16 ≤ √K := (le_sqrt (by norm_num) hK0.le).2 (by linarith only [hK]) have h1 : log K = 2 * log √K := by rw [log_sqrt hK0.le]; ring have h2 := log_le_sub_one_of_pos (sqrt_pos.2 hK0) have h3 := sq_sqrt hK0.le - nlinarith + nlinarith only [hK, h1, h2, h3, hs] /-- The `r`-th prime `p_r = Nat.nth Nat.Prime (r - 1)` satisfies `p_r ≤ C r log r`. -/ theorem nth_prime_le : ∃ C, ∀ r : ℕ, 2 ≤ r → (Nat.nth Nat.Prime (r - 1) : ℝ) ≤ C * r * log r := by diff --git a/LeanPool/IwaniecLinearSieve/PrimeSums/Product.lean b/LeanPool/IwaniecLinearSieve/PrimeSums/Product.lean index b359526d52..7206d2507a 100644 --- a/LeanPool/IwaniecLinearSieve/PrimeSums/Product.lean +++ b/LeanPool/IwaniecLinearSieve/PrimeSums/Product.lean @@ -30,7 +30,7 @@ theorem one_sub_inv_pos {p : ℕ} (hp : p.Prime) : 0 < 1 - (p : ℝ)⁻¹ := by theorem one_sub_inv_le_one (p : ℕ) : 1 - (p : ℝ)⁻¹ ≤ 1 := by have : (0 : ℝ) ≤ (p : ℝ)⁻¹ := by positivity - linarith + linarith only [this] theorem primesLT_mono {z w : ℝ} (hzw : z ≤ w) : primesLT z ⊆ primesLT w := fun p hp ↦ by rw [mem_primesLT] at hp ⊢ @@ -81,20 +81,20 @@ theorem S_sub_SLT {z : ℝ} (hz : 0 < z) : 0 ≤ S z - SLT z ∧ S z - SLT z ≤ /-- `0 ≤ -log (1 - 1/p) - 1/p ≤ 1/(p-1) - 1/p`. -/ theorem abs_log_one_sub_inv_add_inv_le {p : ℝ} (hp : 2 ≤ p) : |log (1 - p⁻¹) + p⁻¹| ≤ (p - 1)⁻¹ - p⁻¹ := by - have hp0 : 0 < p := by linarith + have hp0 : 0 < p := by linarith only [hp] have hq : 0 < 1 - p⁻¹ := by - rw [sub_pos]; exact inv_lt_one_of_one_lt₀ (by linarith) - have h1 : log (1 - p⁻¹) ≤ -p⁻¹ := by linarith [log_le_sub_one_of_pos hq] + rw [sub_pos]; exact inv_lt_one_of_one_lt₀ (by linarith only [hp]) + have h1 : log (1 - p⁻¹) ≤ -p⁻¹ := by linarith only [log_le_sub_one_of_pos hq, hq] have h2 : -((1 - p⁻¹)⁻¹ - 1) ≤ log (1 - p⁻¹) := by have := log_le_sub_one_of_pos (inv_pos.2 hq) rw [log_inv] at this - linarith + linarith only [this] have h3 : (1 - p⁻¹)⁻¹ - 1 = (p - 1)⁻¹ := by - have : p - 1 ≠ 0 := by linarith + have : p - 1 ≠ 0 := by linarith only [hp] field_simp ring - rw [abs_of_nonpos (by linarith)] - linarith + rw [abs_of_nonpos (by linarith only [h1])] + linarith only [h2, h3] theorem sum_Ico_inv_sub_inv {m M : ℕ} (hmM : m ≤ M) : ∑ n ∈ Ico m M, (((n : ℝ) - 1)⁻¹ - (n : ℝ)⁻¹) = ((m : ℝ) - 1)⁻¹ - ((M : ℝ) - 1)⁻¹ := by @@ -127,27 +127,27 @@ theorem abs_sum_log_one_sub_inv_add_inv_le {z w : ℝ} (hz : 2 ≤ z) (hzw : z sum_le_sum_of_subset_of_nonneg hsub fun n hn _ ↦ hnn n hn _ = ((⌈z⌉₊ : ℝ) - 1)⁻¹ - ((⌈w⌉₊ : ℝ) - 1)⁻¹ := sum_Ico_inv_sub_inv (Nat.ceil_mono hzw) _ ≤ (z - 1)⁻¹ := by - have : 0 ≤ ((⌈w⌉₊ : ℝ) - 1)⁻¹ := inv_nonneg.2 (by linarith) + have : 0 ≤ ((⌈w⌉₊ : ℝ) - 1)⁻¹ := inv_nonneg.2 (by linarith only [hw1]) have : ((⌈z⌉₊ : ℝ) - 1)⁻¹ ≤ (z - 1)⁻¹ := inv_anti₀ (by linarith) (by linarith [Nat.le_ceil z]) linarith _ ≤ 2 * z⁻¹ := by rw [← div_eq_mul_inv, inv_eq_one_div, div_le_div_iff₀ (by linarith) (by linarith)] - linarith + linarith only [hz] theorem log_R_eq (z : ℝ) : log (R z) = ∑ p ∈ primesLT z, log (1 - (p : ℝ)⁻¹) := log_prod fun _ hp ↦ (one_sub_inv_pos (mem_primesLT.1 hp).1).ne' theorem abs_exp_sub_one_le_mul_exp (d : ℝ) : |exp d - 1| ≤ |d| * exp |d| := by rcases le_total 0 d with hd | hd - · rw [abs_of_nonneg hd, abs_of_nonneg (by linarith [add_one_le_exp d])] + · rw [abs_of_nonneg hd, abs_of_nonneg (by linarith only [add_one_le_exp d, hd])] have h1 := add_one_le_exp (-d) have h2 : exp d * exp (-d) = 1 := by rw [← exp_add]; simp - nlinarith [exp_pos d] - · rw [abs_of_nonpos hd, abs_of_nonpos (by linarith [exp_le_one_iff.2 hd])] + nlinarith only [exp_pos d, h2, h1] + · rw [abs_of_nonpos hd, abs_of_nonpos (by linarith only [exp_le_one_iff.2 hd, hd])] have h1 := add_one_le_exp d - have h2 : 1 ≤ exp (-d) := one_le_exp_iff.2 (by linarith) - nlinarith + have h2 : 1 ≤ exp (-d) := one_le_exp_iff.2 (by linarith only [hd]) + nlinarith only [h1, hd, h2] theorem exists_abs_log_R_add_loglog_sub_le : ∃ K, 0 ≤ K ∧ ∀ z w, 2 ≤ z → z ≤ w → @@ -170,13 +170,13 @@ theorem exists_abs_log_R_add_loglog_sub_le : ring have h1 := abs_sum_log_one_sub_inv_add_inv_le hz hzw rw [sum_add_distrib, ← hR, ← hS] at h1 - have h2 := S_sub_SLT (z := z) (by linarith) - have h3 := S_sub_SLT (z := w) (by linarith) + have h2 := S_sub_SLT (z := z) (by linarith only [hz]) + have h3 := S_sub_SLT (z := w) (by linarith only [hz, hzw]) have h4 := hC z hz have h5 := hC w hw - have hE : pntE w ≤ pntE z := pntE_le_pntE (by linarith) hzw + have hE : pntE w ≤ pntE z := pntE_le_pntE (by linarith only [hz]) hzw have hiz := inv_le_pntE hz - have hiw : w⁻¹ ≤ z⁻¹ := inv_anti₀ (by linarith) hzw + have hiw : w⁻¹ ≤ z⁻¹ := inv_anti₀ (by linarith only [hz]) hzw rw [abs_le] at h1 h4 h5 ⊢ constructor <;> nlinarith @@ -186,13 +186,13 @@ theorem R_asymp : ∃ cR > 0, ∃ C, ∀ z ≥ 2, |R z * log z - cR| ≤ C * pnt obtain ⟨L, hL⟩ := exists_abs_sub_le_of_cauchy (T := fun z ↦ log (R z) + log (log z)) (g := fun z ↦ K * pntE z) (a := 2) hK (by simpa using tendsto_pntE.const_mul K) refine ⟨exp L, exp_pos L, exp L * (K * exp K), fun z hz ↦ ?_⟩ - have hlog : 0 < log z := log_pos (by linarith) + have hlog : 0 < log z := log_pos (by linarith only [hz]) have hRz : R z * log z = exp (log (R z) + log (log z)) := by rw [exp_add, exp_log (R_pos z), exp_log hlog] have hd := hL z hz have hdK : |log (R z) + log (log z) - L| ≤ K := by have := pntE_le_one z - nlinarith + nlinarith only [hd, hK0, this] rw [hRz, show exp (log (R z) + log (log z)) - exp L = exp L * (exp (log (R z) + log (log z) - L) - 1) by rw [mul_sub, ← exp_add]; ring_nf, abs_mul, abs_of_pos (exp_pos L)] @@ -214,13 +214,13 @@ theorem R_lower : ∃ c > 0, ∀ z ≥ 2, c / log z ≤ R z := by have hlog2 : 0 < log 2 := log_pos one_lt_two refine ⟨min (cR / 2) (R Z' * log 2), lt_min (half_pos hcR) (mul_pos (R_pos _) hlog2), fun z hz ↦ ?_⟩ - have hlog : 0 < log z := log_pos (by linarith) + have hlog : 0 < log z := log_pos (by linarith only [hz]) rw [div_le_iff₀ hlog] rcases le_or_gt Z' z with hzZ | hzZ · have h1 := hC z hz have h2 := hZ z ((le_max_left _ _).trans hzZ) rw [abs_le] at h1 - exact (min_le_left _ _).trans (by linarith) + exact (min_le_left _ _).trans (by linarith only [h1, h2]) · refine (min_le_right _ _).trans ?_ exact mul_le_mul (R_antitone hzZ.le) (log_le_log (by norm_num) hz) hlog2.le (R_pos z).le @@ -228,7 +228,7 @@ theorem R_lower : ∃ c > 0, ∀ z ≥ 2, c / log z ≤ R z := by theorem R_upper : ∃ C > 0, ∀ z ≥ 2, R z ≤ C / log z := by obtain ⟨cR, hcR, C, hC⟩ := R_asymp refine ⟨cR + |C|, by positivity, fun z hz ↦ ?_⟩ - have hlog : 0 < log z := log_pos (by linarith) + have hlog : 0 < log z := log_pos (by linarith only [hz]) rw [le_div_iff₀ hlog] have h1 := hC z hz have h2 : C * pntE z ≤ |C| := @@ -236,6 +236,6 @@ theorem R_upper : ∃ C > 0, ∀ z ≥ 2, R z ≤ C / log z := by rw [abs_mul, abs_of_pos (pntE_pos z)] exact mul_le_of_le_one_right (abs_nonneg _) (pntE_le_one z)) rw [abs_le] at h1 - linarith + linarith only [h1, h2] end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/PrimeSums/SummationByParts.lean b/LeanPool/IwaniecLinearSieve/PrimeSums/SummationByParts.lean index 4e7e53c5bf..10f016926a 100644 --- a/LeanPool/IwaniecLinearSieve/PrimeSums/SummationByParts.lean +++ b/LeanPool/IwaniecLinearSieve/PrimeSums/SummationByParts.lean @@ -129,9 +129,9 @@ theorem abs_sum_sub_integral_le {n : ℕ} {a : ℕ → ℝ} (ha : Monotone a) {b have h2 : (b (a (j + 1)) - b (a j)) * (F (a (j + 1)) - F (a j)) ≤ (b (a (j + 1)) - b (a j)) * δ := mul_le_mul_of_nonneg_left (hδ j hj) (sub_nonneg.2 (hβ j hj)) - linarith + linarith only [h1, h2] _ = (b (a n) - b (a 0)) * δ := by rw [← sum_mul, sum_range_sub (fun j ↦ b (a j))] - _ ≤ δ * b (a n) := by nlinarith + _ ≤ δ * b (a n) := by nlinarith only [hδ0, hb0] have herr := abs_sum_mul_sub_le (β := fun j ↦ b (a j)) (e := fun j ↦ g j - F (a j)) hβ hb0 hε rw [abs_le] at herr ⊢ constructor <;> linarith diff --git a/LeanPool/IwaniecLinearSieve/Rosser.lean b/LeanPool/IwaniecLinearSieve/Rosser.lean index 1cd66330b6..06771699a4 100644 --- a/LeanPool/IwaniecLinearSieve/Rosser.lean +++ b/LeanPool/IwaniecLinearSieve/Rosser.lean @@ -508,10 +508,10 @@ theorem rosserMain_false_eq {r : ℕ} (hr : #(primesLT z) < r) (y : ℝ) : theorem rosserMain_true_le_R (y z : ℝ) : rosserMain true y z ≤ R z := by rw [rosserMain_true_eq (Nat.lt_succ_self _) y] - linarith [fail_nonneg true (#(primesLT z) + 1) y z] + linarith only [fail_nonneg true (#(primesLT z) + 1) y z] theorem R_le_rosserMain_false (y z : ℝ) : R z ≤ rosserMain false y z := by rw [rosserMain_false_eq (Nat.lt_succ_self _) y] - linarith [fail_nonneg false (#(primesLT z) + 1) y z] + linarith only [fail_nonneg false (#(primesLT z) + 1) y z] end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/SieveFunctions/Bounds.lean b/LeanPool/IwaniecLinearSieve/SieveFunctions/Bounds.lean index a4ef49e792..82de2226fe 100644 --- a/LeanPool/IwaniecLinearSieve/SieveFunctions/Bounds.lean +++ b/LeanPool/IwaniecLinearSieve/SieveFunctions/Bounds.lean @@ -37,28 +37,28 @@ theorem log_three_sub_log_two_lt : log 3 - log 2 < 5 / 12 := by have h1 := log_three_lt_d9 have h2 := log_two_gt_d9 norm_num at h1 h2 ⊢ - linarith + linarith only [h1, h2] theorem one_lt_log_three : 1 < log 3 := by - have := log_three_gt_d9; norm_num at this ⊢; linarith + have := log_three_gt_d9; norm_num at this ⊢; linarith only [this] theorem exp_one_sq_lt : exp 1 ^ 2 < 2 + 6 * log 3 := by have h1 := exp_one_lt_d9 have h0 := exp_pos 1 have h3 := one_lt_log_three norm_num at h1 - nlinarith + nlinarith only [h3, h1, h0] /-- `s e^{-s}` is decreasing for `s ≥ 1`. -/ theorem mul_exp_neg_le_of_one_le {u v : ℝ} (hu : 1 ≤ u) (huv : u ≤ v) : v * exp (-v) ≤ u * exp (-u) := by have h1 : v ≤ u * exp (v - u) := by have := add_one_le_exp (v - u) - nlinarith + nlinarith only [this, hu, huv] have h2 : exp (-u) = exp (v - u) * exp (-v) := by rw [← exp_add]; ring_nf rw [h2] have := exp_pos (-v) - nlinarith + nlinarith only [h1, this] /-! ### Lemma 3 -/ @@ -73,7 +73,7 @@ theorem psi_two : psi 2 = (1 + 3 * log 3) / (2 * exp 1) := by theorem psi_deriv_aux {x : ℝ} (hx : 2 < x) : (x - 1) * (1 + 3 * log (3 / (x - 1))) ≤ 3 * x / (x - 1) := by set y := x - 1 with hy - have hy0 : 0 < y := by linarith + have hy0 : 0 < y := by linarith only [hx] have hx' : x = y + 1 := by ring rw [hx'] have hlog : log (2 / y) ≤ 2 / y - 1 := log_le_sub_one_of_pos (by positivity) @@ -81,20 +81,20 @@ theorem psi_deriv_aux {x : ℝ} (hx : 2 < x) : have hL : 1 + 3 * log (3 / y) ≤ -3 / 4 + 6 / y := by rw [log_div (by norm_num) hy0.ne'] have : 6 / y = 3 * (2 / y) := by ring - linarith [log_three_sub_log_two_lt] + linarith only [log_three_sub_log_two_lt, hlog, this] have h6 : y * (6 / y) = 6 := by field_simp have : y * (1 + 3 * log (3 / y)) ≤ -3 / 4 * y + 6 := by have := mul_le_mul_of_nonneg_left hL hy0.le - rw [mul_add y (-3 / 4), h6] at this; linarith + rw [mul_add y (-3 / 4), h6] at this; linarith only [this] rw [le_div_iff₀ hy0] - nlinarith [sq_nonneg (y - 2)] + nlinarith only [sq_nonneg (y - 2), h6, hL, hx] theorem hasDerivAt_psi {x : ℝ} (hx : 1 < x) : HasDerivAt psi (exp (x - 3) * ((x - 1) * (1 + 3 * log (3 / (x - 1))) - 3 * x / (x - 1)) / x ^ 2) x := by have hx0 : x ≠ 0 := by positivity - have hx1 : x - 1 ≠ 0 := by linarith + have hx1 : x - 1 ≠ 0 := by linarith only [hx] have h3 : (3 : ℝ) / (x - 1) ≠ 0 := div_ne_zero (by norm_num) hx1 have h := (((hasDerivAt_id' x).inv hx0).mul ((hasDerivAt_id' x).sub_const 3).exp).mul ((((hasDerivAt_const x (3 : ℝ)).div ((hasDerivAt_id' x).sub_const 1) hx1).log h3).const_mul @@ -112,13 +112,13 @@ theorem psi_le_psi_two {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 4) : psi s ≤ psi 2 (f' := fun x => exp (x - 3) * ((x - 1) * (1 + 3 * log (3 / (x - 1))) - 3 * x / (x - 1)) / x ^ 2) ?_ ?_ ?_ · intro x hx - exact (hasDerivAt_psi (by linarith [hx.1])).continuousAt.continuousWithinAt + exact (hasDerivAt_psi (by linarith only [hx.1, hx])).continuousAt.continuousWithinAt · intro x hx rw [interior_Icc] at hx - exact (hasDerivAt_psi (by linarith [hx.1])).hasDerivWithinAt + exact (hasDerivAt_psi (by linarith only [hx.1, hx])).hasDerivWithinAt · intro x hx rw [interior_Icc] at hx - have hx1 : 0 < x - 1 := by linarith [hx.1] + have hx1 : 0 < x - 1 := by linarith only [hx.1, hx] refine div_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonneg_of_nonpos (exp_pos _).le (sub_nonpos.2 (psi_deriv_aux hx.1))) (by positivity) @@ -137,7 +137,7 @@ theorem gRatio_eq : gRatio = exp 1 / 3 * psi 2 := by theorem gRatio_lt : gRatio < 0.72 := by have := log_three_lt_d9 - rw [gRatio]; norm_num at this ⊢; linarith + rw [gRatio]; norm_num at this ⊢; linarith only [this] theorem gRatio_pos : 0 < gRatio := by rw [gRatio]; have := one_lt_log_three; positivity @@ -147,7 +147,7 @@ theorem gRatio_lt_one : gRatio < 1 := gRatio_lt.trans (by norm_num) theorem bddAbove_gLead : BddAbove ((fun s => g 2 s * s⁻¹ * exp s) '' Icc 2 4) := isCompact_Icc.bddAbove_image <| (((continuous_g 2).continuousOn.mul (continuousOn_inv₀.mono fun x hx => by - simp only [mem_compl_iff, mem_singleton_iff]; linarith [hx.1])).mul + simp only [mem_compl_iff, mem_singleton_iff]; linarith only [hx.1, hx])).mul continuous_exp.continuousOn) theorem le_gLead {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 4) : g 2 s * s⁻¹ * exp s ≤ gLead := @@ -166,16 +166,16 @@ theorem integral_shift_le {h : ℝ → ℝ} (hh : Continuous h) {C s b : ℝ} (h refine ContinuousOn.intervalIntegrable ?_ rw [uIcc_of_le hsb] exact (hh.comp (continuous_sub_right 1)).continuousOn.div - (continuous_sub_right 1).continuousOn fun t ht => by linarith [ht.1] + (continuous_sub_right 1).continuousOn fun t ht => by linarith only [ht.1, hs, ht] have hcont : Continuous fun t : ℝ => C * exp (1 - t) := continuous_const.mul (continuous_exp.comp (continuous_const.sub continuous_id)) calc ∫ t in s..b, h (t - 1) / (t - 1) ≤ ∫ t in s..b, C * exp (1 - t) := by refine integral_mono_on hsb hint1 (hcont.intervalIntegrable _ _) fun t ht => ?_ - have ht1 : 0 < t - 1 := by linarith [ht.1] + have ht1 : 0 < t - 1 := by linarith only [ht.1, hs, ht] rw [div_le_iff₀ ht1] - have := hb (t - 1) (by linarith [ht.1]) + have := hb (t - 1) (by linarith only [ht.1, ht]) have e : exp (-(t - 1)) = exp (1 - t) := by ring_nf - rw [e] at this; linarith + rw [e] at this; linarith only [this] _ = C * exp (1 - s) - C * exp (1 - b) := by rw [integral_eq_sub_of_hasDerivAt (f := fun t => -(C * exp (1 - t))) (fun t _ => ?_) (hcont.intervalIntegrable _ _)] @@ -184,7 +184,7 @@ theorem integral_shift_le {h : ℝ → ℝ} (hh : Continuous h) {C s b : ℝ} (h convert this using 1; ring _ ≤ C * exp (1 - s) := by have := mul_nonneg hC (exp_pos (1 - b)).le - linarith + linarith only [this] /-- The inductive step of [I71, Lemma 4] in uniform form. -/ theorem g_add_three_le {n : ℕ} {C s : ℝ} (hC : 0 ≤ C) (hs : gLower (n + 3) ≤ s) @@ -192,7 +192,7 @@ theorem g_add_three_le {n : ℕ} {C s : ℝ} (hC : 0 ≤ C) (hs : gLower (n + 3) rcases le_or_gt s ((n : ℝ) + 5) with hsb | hsb · rw [g_add_three_eq n hs] exact integral_shift_le (continuous_g _) hC ((two_le_gLower _).trans hs) hsb hb - · rw [g_eq_zero_of_le (n + 3) (by push_cast; linarith)] + · rw [g_eq_zero_of_le (n + 3) (by push_cast; linarith only [hsb])] positivity theorem gLower_two_mul_add_three (n : ℕ) : gLower (2 * n + 3) = 3 := @@ -213,13 +213,13 @@ theorem g_even_eq_on_Icc (n : ℕ) {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 4) : refine integral_congr fun t ht => ?_ rw [uIcc_of_le hs.2] at ht rw [shiftKernel_of_two_le _ (by linarith [ht.1, hs.1]), show 2 * n + 1 + 2 = 2 * n + 3 by ring, - g_eq_of_le_gLower _ (s := t - 1) (by rw [gLower_two_mul_add_three]; linarith [ht.2]), + g_eq_of_le_gLower _ (s := t - 1) (by rw [gLower_two_mul_add_three]; linarith only [ht.2, ht]), gLower_two_mul_add_three, mul_one_div] - have hs1 : 0 < s - 1 := by linarith [hs.1] + have hs1 : 0 < s - 1 := by linarith only [hs.1, hs] rw [hc, intervalIntegral.integral_const_mul, integral_comp_sub_right (fun x => 1 / x), integral_one_div_of_pos hs1 (by norm_num)] at h norm_num at h - linarith + linarith only [h] private theorem g_odd_le_of_even (n : ℕ) (H : ∀ s, 2 ≤ s → g (2 * n + 2) s ≤ gLead * gRatio ^ n * s * exp (-s)) {s : ℝ} (hs : 1 ≤ s) : @@ -234,7 +234,7 @@ private theorem g_odd_le_of_even (n : ℕ) rw [e] have := mul_nonneg (mul_nonneg (mul_nonneg hC (exp_pos (-s)).le) (exp_pos 1).le) (sub_nonneg.2 hs) - nlinarith + nlinarith only [this] rcases le_total 3 s with hs3 | hs3 · exact (h3 s hs3).trans (key s hs3) · have e : g (2 * n + 3) s = g (2 * n + 3) 3 := by @@ -265,11 +265,11 @@ private theorem g_even_le_of_odd (n : ℕ) have e : exp (1 - s) = exp 1 * exp (-s) := by rw [← exp_add]; ring_nf rw [e, pow_succ] have h1 : exp 1 ^ 2 / 3 ≤ gRatio * s := by - rw [gRatio]; nlinarith + rw [gRatio]; nlinarith only [he, hs4, hs] have h0 : 0 ≤ gLead * gRatio ^ n * exp (-s) := mul_nonneg (mul_nonneg gLead_nonneg (pow_nonneg hA.le _)) (exp_pos _).le have := mul_le_mul_of_nonneg_left h1 h0 - nlinarith + nlinarith only [this] · rw [g_even_eq_on_Icc n ⟨hs, hs4⟩] have hg4 := h4 4 (by norm_num) have hg3 := H 3 (by norm_num) @@ -287,7 +287,7 @@ private theorem g_even_le_of_odd (n : ℕ) rw [hpsi'] rw [e4] at hg4 have := mul_le_mul_of_nonneg_right hg3 hlog - nlinarith + nlinarith only [hg4, this] have hs0 : 0 ≤ s * exp (-s) := by positivity have := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hpsi hs0) hC calc _ ≤ gLead * (exp 1 / 3) * gRatio ^ n * (psi 2 * (s * exp (-s))) := by @@ -302,7 +302,7 @@ theorem g_even_le (n : ℕ) {s : ℝ} (hs : 2 ≤ s) : simp only [mul_zero, zero_add, pow_zero, mul_one] rcases le_total s 4 with hs4 | hs4 · have := le_gLead ⟨hs, hs4⟩ - have hs0 : 0 < s := by linarith + have hs0 : 0 < s := by linarith only [hs] have e : g 2 s = g 2 s * s⁻¹ * exp s * (s * exp (-s)) := by rw [exp_neg]; field_simp rw [e] @@ -310,7 +310,7 @@ theorem g_even_le (n : ℕ) {s : ℝ} (hs : 2 ≤ s) : (by ring) · rw [g_two_of_four_le hs4] have := gLead_nonneg - have : 0 ≤ s := by linarith + have : 0 ≤ s := by linarith only [hs4] positivity | succ n ih => rw [show 2 * (n + 1) + 2 = 2 * n + 4 by ring] diff --git a/LeanPool/IwaniecLinearSieve/SieveFunctions/LemmaFive.lean b/LeanPool/IwaniecLinearSieve/SieveFunctions/LemmaFive.lean index b1d9489d81..e28dd9d0e7 100644 --- a/LeanPool/IwaniecLinearSieve/SieveFunctions/LemmaFive.lean +++ b/LeanPool/IwaniecLinearSieve/SieveFunctions/LemmaFive.lean @@ -67,12 +67,12 @@ theorem hasDerivAt_integral_Ioi {k : ℝ → ℝ} {a s : ℝ} (hint : Integrable refine hd.congr_of_eventuallyEq ?_ filter_upwards [Ioi_mem_nhds has] with u hu have := integral_Ioi_sub_Ioi hint (le_of_lt hu) - linarith + linarith only [this] theorem continuousOn_shift {h : ℝ → ℝ} (hh : Continuous h) : ContinuousOn (fun t => h (t - 1) / (t - 1)) (Ioi 1) := (hh.comp (continuous_sub_right 1)).continuousOn.div (continuous_sub_right 1).continuousOn - fun t ht => by have : (1 : ℝ) < t := ht; linarith + fun t ht => by have : (1 : ℝ) < t := ht; linarith only [this] /-- `F'(s) = -f(s-1)/(s-1)` for `s > 3`. -/ theorem hasDerivAt_FSieve {s : ℝ} (hs : 3 < s) : @@ -91,12 +91,12 @@ theorem hasDerivAt_fSieve_of_four_lt {s : ℝ} (hs : 4 < s) : refine hd.congr_of_eventuallyEq ?_ filter_upwards [Ioi_mem_nhds hs] with u hu have hu' : (4 : ℝ) < u := hu - rw [fSieve_eq_integral (by linarith), g_two_of_four_le hu'.le, add_zero] + rw [fSieve_eq_integral (by linarith only [hu']), g_two_of_four_le hu'.le, add_zero] /-- `f'(s) = 1 - (F(3) + 3)/(s-1)` for `2 < s < 4`. -/ theorem hasDerivAt_fSieve_of_lt_four {s : ℝ} (hs2 : 2 < s) (hs4 : s < 4) : HasDerivAt fSieve (1 - (FSieve 3 + 3) / (s - 1)) s := by - have hne : s - 1 ≠ 0 := by linarith + have hne : s - 1 ≠ 0 := by linarith only [hs2] have hd : HasDerivAt (fun u => fSieve 4 + (FSieve 3 + 3) * (log 3 - log (u - 1)) + u - 4) (1 - (FSieve 3 + 3) / (s - 1)) s := by @@ -107,7 +107,7 @@ theorem hasDerivAt_fSieve_of_lt_four {s : ℝ} (hs2 : 2 < s) (hs4 : s < 4) : ring refine hd.congr_of_eventuallyEq ?_ filter_upwards [Ioo_mem_nhds hs2 hs4] with u hu - rw [fSieve_eq_on_Icc' ⟨hu.1.le, hu.2.le⟩, log_div (by norm_num) (by linarith [hu.1])] + rw [fSieve_eq_on_Icc' ⟨hu.1.le, hu.2.le⟩, log_div (by norm_num) (by linarith only [hu.1, hu])] /-! ### Iwaniec's `M` -/ @@ -116,10 +116,10 @@ theorem hasDerivAt_fSieve_of_lt_four {s : ℝ} (hs2 : 2 < s) (hs4 : s < 4) : noncomputable def MSieve (s : ℝ) : ℝ := fSieve s + FSieve s + max (3 - s) 0 theorem MSieve_of_three_le {s : ℝ} (hs : 3 ≤ s) : MSieve s = fSieve s + FSieve s := by - rw [MSieve, max_eq_right (by linarith), add_zero] + rw [MSieve, max_eq_right (by linarith only [hs]), add_zero] theorem MSieve_of_le_three {s : ℝ} (hs : s ≤ 3) : MSieve s = 3 + FSieve 3 - s + fSieve s := by - rw [MSieve, max_eq_left (by linarith), FSieve_of_le_three hs]; ring + rw [MSieve, max_eq_left (by linarith only [hs]), FSieve_of_le_three hs]; ring theorem continuous_MSieve : Continuous MSieve := (continuous_fSieve.add continuous_FSieve).add ((continuous_const.sub continuous_id).max @@ -131,7 +131,7 @@ theorem MSieve_nonneg (s : ℝ) : 0 ≤ MSieve s := by theorem MSieve_antitone : Antitone MSieve := fun u v h => by have := fSieve_antitone h; have := FSieve_antitone h - have : max (3 - v) 0 ≤ max (3 - u) 0 := max_le_max (by linarith) le_rfl + have : max (3 - v) 0 ≤ max (3 - u) 0 := max_le_max (by linarith only [h]) le_rfl rw [MSieve, MSieve]; linarith /-- `Σ_{k ≥ 2} g_k(s) = M(s)` for `s ≥ 3`. -/ @@ -147,26 +147,26 @@ theorem fr_lt_MSieve (r : ℕ) (s : ℝ) : fr r s < MSieve s := by theorem MSieve_le {s : ℝ} (hs : 3 ≤ s) : MSieve s ≤ (gLead * (1 - gRatio)⁻¹ + gLead * (exp 1 / 3) * (1 - gRatio)⁻¹) * s * exp (-s) := by rw [MSieve_of_three_le hs] - have := fSieve_le (by linarith : (2 : ℝ) ≤ s) - have := FSieve_le (by linarith : (1 : ℝ) ≤ s) + have := fSieve_le (by linarith only [hs] : (2 : ℝ) ≤ s) + have := FSieve_le (by linarith only [hs] : (1 : ℝ) ≤ s) linarith /-- The derivative of `M` for `s > 3`, `s ≠ 4`: `(s - 1) M'(s) = -M(s - 1)`. -/ theorem hasDerivAt_MSieve {s : ℝ} (hs3 : 3 < s) (hs4 : s ≠ 4) : HasDerivAt MSieve (-(MSieve (s - 1) / (s - 1))) s := by - have hne : s - 1 ≠ 0 := by linarith + have hne : s - 1 ≠ 0 := by linarith only [hs3] have hev : MSieve =ᶠ[𝓝 s] fun u => fSieve u + FSieve u := by filter_upwards [Ioi_mem_nhds hs3] with u hu exact MSieve_of_three_le (le_of_lt hu) rcases lt_or_gt_of_ne hs4 with h4 | h4 · have hd := (hasDerivAt_fSieve_of_lt_four (by linarith) h4).add (hasDerivAt_FSieve hs3) refine (hd.congr_of_eventuallyEq hev).congr_deriv ?_ - rw [MSieve_of_le_three (by linarith)] + rw [MSieve_of_le_three (by linarith only [h4])] field_simp ring · have hd := (hasDerivAt_fSieve_of_four_lt h4).add (hasDerivAt_FSieve hs3) refine (hd.congr_of_eventuallyEq hev).congr_deriv ?_ - rw [MSieve_of_three_le (by linarith)] + rw [MSieve_of_three_le (by linarith only [h4])] field_simp ring @@ -196,7 +196,7 @@ theorem hasDerivAt_lemma5Q {s : ℝ} (hs3 : 3 < s) (hs4 : s ≠ 4) : HasDerivAt have hd := (((hasDerivAt_id' s).sub_const 1).mul hM).sub ((hP s).sub hP1) rw [funext lemma5Q_eq] refine hd.congr_deriv ?_ - have hne : s - 1 ≠ 0 := by linarith + have hne : s - 1 ≠ 0 := by linarith only [hs3] field_simp ring @@ -206,15 +206,15 @@ theorem lemma5Q_eq_of_deriv {a b : ℝ} (hab : a ≤ b) (hd : ∀ x ∈ Ioo a b, · rw [h] · obtain ⟨c, _, hc⟩ := exists_hasDerivAt_eq_slope lemma5Q (fun _ => (0 : ℝ)) h continuous_lemma5Q.continuousOn hd - have hba : b - a ≠ 0 := by linarith + have hba : b - a ≠ 0 := by linarith only [h] rw [eq_div_iff hba, zero_mul] at hc - linarith + linarith only [hc] theorem lemma5Q_const {b : ℝ} (hb : 3 ≤ b) : lemma5Q b = lemma5Q 3 := by rcases le_total b 4 with h4 | h4 · exact lemma5Q_eq_of_deriv hb fun x hx => hasDerivAt_lemma5Q hx.1 (by linarith [hx.2]) - · rw [lemma5Q_eq_of_deriv h4 fun x hx => hasDerivAt_lemma5Q (by linarith [hx.1]) - (by linarith [hx.1]), + · rw [lemma5Q_eq_of_deriv h4 fun x hx => hasDerivAt_lemma5Q (by linarith only [hx.1, hx]) + (by linarith only [hx.1, hx]), lemma5Q_eq_of_deriv (by norm_num) fun x hx => hasDerivAt_lemma5Q hx.1 (by linarith [hx.2])] theorem abs_lemma5Q_le {b : ℝ} (hb : 4 ≤ b) : @@ -222,11 +222,11 @@ theorem abs_lemma5Q_le {b : ℝ} (hb : 4 ≤ b) : (b ^ 2 * exp (-b)) := by set C := gLead * (1 - gRatio)⁻¹ + gLead * (exp 1 / 3) * (1 - gRatio)⁻¹ have hM1 : MSieve (b - 1) ≤ C * (b - 1) * exp (-(b - 1)) := MSieve_le (s := b - 1) (by linarith) - have hMb : MSieve b ≤ MSieve (b - 1) := MSieve_antitone (by linarith) + have hMb : MSieve b ≤ MSieve (b - 1) := MSieve_antitone (by linarith only []) have hI0 : 0 ≤ ∫ x in (b - 1)..b, MSieve x := - integral_nonneg (by linarith) fun x _ => MSieve_nonneg x + integral_nonneg (by linarith only []) fun x _ => MSieve_nonneg x have hI1 : ∫ x in (b - 1)..b, MSieve x ≤ MSieve (b - 1) := by - have := integral_mono_on (μ := volume) (by linarith : b - 1 ≤ b) + have := integral_mono_on (μ := volume) (by linarith only [] : b - 1 ≤ b) (continuous_MSieve.intervalIntegrable _ _) (intervalIntegrable_const (c := MSieve (b - 1))) fun x hx => MSieve_antitone hx.1 simpa using this @@ -237,14 +237,14 @@ theorem abs_lemma5Q_le {b : ℝ} (hb : 4 ≤ b) : have he : exp (-(b - 1)) = exp 1 * exp (-b) := by rw [← exp_add]; ring_nf rw [he] at hM1 refine hQ.trans ?_ - have := mul_le_mul_of_nonneg_left hM1 (by linarith : (0 : ℝ) ≤ b) + have := mul_le_mul_of_nonneg_left hM1 (by linarith only [hb] : (0 : ℝ) ≤ b) have hb' : 0 ≤ C * exp 1 * exp (-b) * b := by have : 0 ≤ C := by have := gLead_nonneg; have := gRatio_lt_one; have := exp_pos 1 have : 0 ≤ (1 - gRatio)⁻¹ := inv_nonneg.2 (by linarith) positivity have := exp_pos 1; have := exp_pos (-b); positivity - nlinarith + nlinarith only [this, hb'] theorem lemma5Q_three : lemma5Q 3 = 0 := by set C := (gLead * (1 - gRatio)⁻¹ + gLead * (exp 1 / 3) * (1 - gRatio)⁻¹) * exp 1 @@ -271,8 +271,8 @@ theorem integral_MSieve_two_three : ∫ x in (2 : ℝ)..3, MSieve x = ∫ x in (2 : ℝ)..3, (c + K * (log 3 - log (x - 1))) := by refine integral_congr fun x hx => ?_ rw [uIcc_of_le (by norm_num)] at hx - rw [MSieve_of_le_three hx.2, fSieve_eq_on_Icc' ⟨hx.1, by linarith [hx.2]⟩, - log_div (by norm_num) (by linarith [hx.1])] + rw [MSieve_of_le_three hx.2, fSieve_eq_on_Icc' ⟨hx.1, by linarith only [hx.2, hx]⟩, + log_div (by norm_num) (by linarith only [hx.1, hx])] ring rw [hcongr, integral_eq_sub_of_hasDerivAt (f := fun x => c * x + K * ((x - 1) * (log 3 - log (x - 1)) + x))] @@ -280,7 +280,7 @@ theorem integral_MSieve_two_three : ring · intro x hx rw [uIcc_of_le (by norm_num)] at hx - have hne : x - 1 ≠ 0 := by linarith [hx.1] + have hne : x - 1 ≠ 0 := by linarith only [hx.1, hx] have := ((hasDerivAt_id' x).const_mul c).add (((((hasDerivAt_id' x).sub_const 1).mul ((((hasDerivAt_id' x).sub_const 1).log hne).const_sub (log 3))).add @@ -292,7 +292,7 @@ theorem integral_MSieve_two_three : refine continuousOn_const.add (continuousOn_const.mul (continuousOn_const.sub ?_)) refine ((continuous_sub_right 1).continuousOn).log fun x hx => ?_ rw [uIcc_of_le (by norm_num)] at hx - linarith [hx.1] + linarith only [hx.1, hx] /-- The key identity `f(4) + (F(3) + 3) log 3 = 4`. -/ theorem fSieve_four_add : fSieve 4 + (FSieve 3 + 3) * log 3 = 4 := by @@ -300,14 +300,14 @@ theorem fSieve_four_add : fSieve 4 + (FSieve 3 + 3) * log 3 = 4 := by rw [lemma5Q, show (3 : ℝ) - 1 = 2 by norm_num, integral_MSieve_two_three, MSieve_of_three_le le_rfl, fSieve_eq_on_Icc' ⟨by norm_num, by norm_num⟩, show (3 : ℝ) / (3 - 1) = 3 / 2 by norm_num, log_div (by norm_num) (by norm_num)] at h - linarith + linarith only [h] /-- [I71, Lemma 5] in the form we need: `f(s) = s - (F(3) + 3) log (s - 1)` for `2 ≤ s ≤ 4` (Iwaniec: `F(3) + 3 = 2e^γ`). -/ theorem fSieve_eq_on_Icc {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 4) : fSieve s = s - (FSieve 3 + 3) * log (s - 1) := by - rw [fSieve_eq_on_Icc' hs, log_div (by norm_num) (by linarith [hs.1])] - linarith [fSieve_four_add] + rw [fSieve_eq_on_Icc' hs, log_div (by norm_num) (by linarith only [hs.1, hs])] + linarith only [fSieve_four_add] /-- [I71, (3.10)]: `f(2) = 2`. -/ theorem fSieve_two : fSieve 2 = 2 := by @@ -316,11 +316,11 @@ theorem fSieve_two : fSieve 2 = 2 := by /-- The consequence of Lemma 5 used for the sieve: `1 - f(s)/s ≥ 3 log (s - 1) / s` on `[2, 4]`. -/ theorem le_one_sub_fSieve_div {s : ℝ} (hs : s ∈ Icc (2 : ℝ) 4) : 3 * log (s - 1) / s ≤ 1 - fSieve s / s := by - have hs0 : 0 < s := by linarith [hs.1] - have hlog : 0 ≤ log (s - 1) := log_nonneg (by linarith [hs.1]) + have hs0 : 0 < s := by linarith only [hs.1, hs] + have hlog : 0 ≤ log (s - 1) := log_nonneg (by linarith only [hs.1, hs]) have hF := FSieve_nonneg 3 rw [fSieve_eq_on_Icc hs, div_le_iff₀ hs0, sub_mul, div_mul_cancel₀ _ hs0.ne'] - nlinarith + nlinarith only [hlog, hF] /-- `le_one_sub_fSieve_div` in the form used by the linear-sieve modules. -/ theorem one_sub_fSieve_div_ge : ∀ s ∈ Icc (2 : ℝ) 4, 1 - fSieve s / s ≥ 3 * Real.log (s - 1) / s := diff --git a/LeanPool/IwaniecLinearSieve/SieveFunctions/Series.lean b/LeanPool/IwaniecLinearSieve/SieveFunctions/Series.lean index eace69efe9..fd934b2616 100644 --- a/LeanPool/IwaniecLinearSieve/SieveFunctions/Series.lean +++ b/LeanPool/IwaniecLinearSieve/SieveFunctions/Series.lean @@ -130,7 +130,7 @@ theorem FSieve_isBigO : FSieve =O[atTop] fun s => s * exp (-s) := by refine Asymptotics.IsBigO.of_bound (gLead * (exp 1 / 3) * (1 - gRatio)⁻¹) ?_ filter_upwards [eventually_ge_atTop 2] with s hs rw [norm_of_nonneg (FSieve_nonneg s), norm_of_nonneg (by positivity)] - exact (FSieve_le (by linarith)).trans_eq (by ring) + exact (FSieve_le (by linarith only [hs])).trans_eq (by ring) theorem g_even_le_fSieve (n : ℕ) (s : ℝ) : g (2 * n + 2) s ≤ fSieve s := (summable_g_even s).le_tsum n fun _ _ => g_nonneg _ _ @@ -166,10 +166,10 @@ theorem fr_of_odd {r : ℕ} (hr : ¬ Even r) : fr r = FSieve := funext fun _ => theorem shift_div_le {h : ℝ → ℝ} {C t : ℝ} (ht : 1 < t) (hb : h (t - 1) ≤ C * (t - 1) * exp (-(t - 1))) : h (t - 1) / (t - 1) ≤ C * exp 1 * exp (-t) := by - have ht1 : 0 < t - 1 := by linarith + have ht1 : 0 < t - 1 := by linarith only [ht] rw [div_le_iff₀ ht1] have e : exp (-(t - 1)) = exp 1 * exp (-t) := by rw [← exp_add]; ring_nf - rw [e] at hb; linarith + rw [e] at hb; linarith only [hb] /-- An exponentially decaying `h` gives an integrable kernel `h(t-1)/(t-1)` on `(s, ∞)`. -/ theorem integrableOn_shift {h : ℝ → ℝ} (hh : Continuous h) {C s : ℝ} (hs : 2 ≤ s) @@ -179,10 +179,10 @@ theorem integrableOn_shift {h : ℝ → ℝ} (hh : Continuous h) {C s : ℝ} (hs · refine ContinuousOn.aestronglyMeasurable ?_ measurableSet_Ioi exact (hh.comp (continuous_sub_right 1)).continuousOn.div (continuous_sub_right 1).continuousOn fun t ht => by - have : s < t := ht; linarith + have : s < t := ht; linarith only [hs, this] · filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht have ht' : s < t := ht - rw [norm_of_nonneg (div_nonneg (hnn _) (by linarith))] + rw [norm_of_nonneg (div_nonneg (hnn _) (by linarith only [hs, ht']))] have := shift_div_le (C := C) (by linarith) (hb (t - 1) (by linarith)) simpa using this @@ -195,19 +195,19 @@ theorem tsum_integral_Ioi_shift {φ : ℕ → ℝ → ℝ} {s : ℝ} (hs : 2 ≤ · congr 1; funext t; exact tsum_div_const · refine hsum.congr fun n => setIntegral_congr_fun measurableSet_Ioi fun t ht => ?_ have : s < t := ht - exact (norm_of_nonneg (div_nonneg (hnn _ _) (by linarith))).symm + exact (norm_of_nonneg (div_nonneg (hnn _ _) (by linarith only [hs, this]))).symm theorem integrableOn_FSieve_shift {s : ℝ} (hs : 2 ≤ s) : IntegrableOn (fun t => FSieve (t - 1) / (t - 1)) (Ioi s) := integrableOn_shift (C := gLead * (exp 1 / 3) * (1 - gRatio)⁻¹) continuous_FSieve hs FSieve_nonneg fun u hu => - (FSieve_le (by linarith)).trans_eq (by ring) + (FSieve_le (by linarith only [hs, hu])).trans_eq (by ring) theorem integrableOn_fSieve_shift {s : ℝ} (hs : 3 ≤ s) : IntegrableOn (fun t => fSieve (t - 1) / (t - 1)) (Ioi s) := - integrableOn_shift (C := gLead * (1 - gRatio)⁻¹) continuous_fSieve (by linarith) + integrableOn_shift (C := gLead * (1 - gRatio)⁻¹) continuous_fSieve (by linarith only [hs]) fSieve_nonneg fun u hu => - (fSieve_le (by linarith)).trans_eq (by ring) + (fSieve_le (by linarith only [hs, hu])).trans_eq (by ring) theorem g_even_add_four_eq_Ioi (n : ℕ) {s : ℝ} (hs : 2 ≤ s) : IntegrableOn (fun t => g (2 * n + 3) (t - 1) / (t - 1)) (Ioi s) ∧ diff --git a/LeanPool/IwaniecLinearSieve/SieveMajorants/Defs.lean b/LeanPool/IwaniecLinearSieve/SieveMajorants/Defs.lean index 47b1859ebd..b7602b5cb0 100644 --- a/LeanPool/IwaniecLinearSieve/SieveMajorants/Defs.lean +++ b/LeanPool/IwaniecLinearSieve/SieveMajorants/Defs.lean @@ -42,7 +42,7 @@ theorem continuous_delayKer : Continuous delayKer := by refine (continuous_id.max continuous_const).div (((continuous_id.max continuous_const).sub continuous_const).pow 2) fun x => ?_ have : (3 : ℝ) ≤ max x 3 := le_max_right _ _ - have : (0 : ℝ) < max x 3 - 1 := by linarith + have : (0 : ℝ) < max x 3 - 1 := by linarith only [this] positivity theorem continuous_initW : Continuous initW := by @@ -51,7 +51,7 @@ theorem continuous_initW : Continuous initW := by (continuous_id.max continuous_const).sub continuous_const have hne : ∀ s : ℝ, max s 2 - 1 ≠ 0 := fun s => by have : (2 : ℝ) ≤ max s 2 := le_max_right _ _ - linarith + linarith only [this] exact (continuous_const.div h1 hne).sub (h1.log hne) theorem initW_of_le {s : ℝ} (hs : s ≤ 2) : initW s = 1 := by @@ -77,10 +77,10 @@ theorem bigM_of_le_three {s : ℝ} (hs : s ≤ 3) : bigM s = 2 + initW s := Delay.sol_of_le hs theorem bigW_of_le_two {s : ℝ} (hs : s ≤ 2) : bigW s = 1 := by - rw [bigW_of_le_three (by linarith), initW_of_le hs] + rw [bigW_of_le_three (by linarith only [hs]), initW_of_le hs] theorem bigM_of_le_two {s : ℝ} (hs : s ≤ 2) : bigM s = 3 := by - rw [bigM_of_le_three (by linarith), initW_of_le hs]; norm_num + rw [bigM_of_le_three (by linarith only [hs]), initW_of_le hs]; norm_num theorem bigW_eq {s : ℝ} (hs : 2 ≤ s) (hs' : s ≤ 3) : bigW s = 1 / (s - 1) - log (s - 1) := by rw [bigW_of_le_three hs', initW_of_ge hs] @@ -102,7 +102,7 @@ theorem bigM_three : bigM 3 = 5 / 2 - log 2 := by /-- The derivative of `1/(x-1) - log(x-1)` is `-x/(x-1)²`. -/ theorem hasDerivAt_initForm {x : ℝ} (hx : 1 < x) : HasDerivAt (fun x => 1 / (x - 1) - log (x - 1)) (-(x / (x - 1) ^ 2)) x := by - have h0 : x - 1 ≠ 0 := by linarith + have h0 : x - 1 ≠ 0 := by linarith only [hx] have h1 : HasDerivAt (fun x : ℝ => x - 1) 1 x := (hasDerivAt_id x).sub_const 1 have := (h1.inv h0).sub (h1.log h0) convert this using 1 @@ -175,7 +175,7 @@ theorem eq_of_hasDerivAt_zero {g : ℝ → ℝ} {a : ℝ} (hg : ContinuousOn g ( (hg.mono Icc_subset_Ici_self) fun x hx => hd x hx.1 have : s - a ≠ 0 := by linarith field_simp at hc' - linarith + linarith only [hc'] /-! ### (3.11) -/ @@ -197,14 +197,14 @@ theorem integral_wIntegrand_two_three : ∫ x in (2 : ℝ)..3, (1 / (x - 1) - log (x - 1)) / x ^ 2 := by refine intervalIntegral.integral_congr fun x hx => ?_ rw [uIcc_of_le (by norm_num)] at hx - rw [wIntegrand_of_ge (by linarith [hx.1]), bigW_eq hx.1 hx.2] + rw [wIntegrand_of_ge (by linarith only [hx.1, hx]), bigW_eq hx.1 hx.2] rw [hcongr] have hderiv : ∀ x ∈ uIcc (2 : ℝ) 3, HasDerivAt (fun x => (1 + log (x - 1)) / x) ((1 / (x - 1) - log (x - 1)) / x ^ 2) x := by intro x hx rw [uIcc_of_le (by norm_num)] at hx - have hx1 : x - 1 ≠ 0 := by linarith [hx.1] - have hx0 : x ≠ 0 := by linarith [hx.1] + have hx1 : x - 1 ≠ 0 := by linarith only [hx.1, hx] + have hx0 : x ≠ 0 := by linarith only [hx.1, hx] have h1 : HasDerivAt (fun x : ℝ => x - 1) 1 x := (hasDerivAt_id x).sub_const 1 have := ((h1.log hx1).const_add 1).div (hasDerivAt_id x) hx0 refine this.congr_deriv ?_ @@ -214,8 +214,8 @@ theorem integral_wIntegrand_two_three : have hcont : ContinuousOn (fun x : ℝ => (1 / (x - 1) - log (x - 1)) / x ^ 2) (uIcc 2 3) := by rw [uIcc_of_le (by norm_num)] intro x hx - have hx1 : x - 1 ≠ 0 := by linarith [hx.1] - have hx0 : x ^ 2 ≠ 0 := pow_ne_zero 2 (by linarith [hx.1]) + have hx1 : x - 1 ≠ 0 := by linarith only [hx.1, hx] + have hx0 : x ^ 2 ≠ 0 := pow_ne_zero 2 (by linarith only [hx.1, hx]) exact (((continuousAt_const.div (continuousAt_id.sub continuousAt_const) hx1).sub ((continuousAt_id.sub continuousAt_const).log hx1)).div (continuousAt_id.pow 2) hx0).continuousWithinAt @@ -229,13 +229,13 @@ theorem bigW_eq_neg_mul_integral {s : ℝ} (hs : 3 ≤ s) : have hgc : ContinuousOn g (Ici 3) := by refine ContinuousOn.add ?_ ?_ · exact continuous_bigW.continuousOn.div continuousOn_id fun x hx => by - linarith [hx.out] + linarith only [hx.out, hx] · exact fun t _ => (hasDerivAt_integral_unit continuous_wIntegrand t).continuousAt |>.continuousWithinAt have hgd : ∀ t, 3 < t → HasDerivAt g 0 t := by intro t ht - have ht0 : t ≠ 0 := by linarith - have ht1 : t - 1 ≠ 0 := by linarith + have ht0 : t ≠ 0 := by linarith only [ht] + have ht1 : t - 1 ≠ 0 := by linarith only [ht] have := ((hasDerivAt_bigW ht).div (hasDerivAt_id t) ht0).add (hasDerivAt_integral_unit continuous_wIntegrand t) refine this.congr_deriv ?_ @@ -251,12 +251,12 @@ theorem bigW_eq_neg_mul_integral {s : ℝ} (hs : 3 ≤ s) : have hgs : g s = 0 := (eq_of_hasDerivAt_zero hgc hgd hs).trans h3 have hint : ∫ x in (s - 1)..s, wIntegrand x = ∫ x in (s - 1)..s, bigW x / x ^ 2 := by refine intervalIntegral.integral_congr fun x hx => ?_ - rw [uIcc_of_le (by linarith)] at hx - exact wIntegrand_of_ge (by linarith [hx.1]) + rw [uIcc_of_le (by linarith only [])] at hx + exact wIntegrand_of_ge (by linarith only [hx.1, hs, hx]) simp only [g, hint] at hgs - have hs0 : s ≠ 0 := by linarith + have hs0 : s ≠ 0 := by linarith only [hs] field_simp at hgs - linarith + linarith only [hgs] /-! ### (3.12) -/ @@ -280,7 +280,7 @@ theorem integral_mIntegrand_two_three : ∫ x in (2 : ℝ)..3, (1 - 1 / (2 * x ^ 2)) * (2 + (1 / (x - 1) - log (x - 1))) := by refine intervalIntegral.integral_congr fun x hx => ?_ rw [uIcc_of_le (by norm_num)] at hx - rw [mIntegrand_of_ge (by linarith [hx.1]), bigM_eq hx.1 hx.2] + rw [mIntegrand_of_ge (by linarith only [hx.1, hx]), bigM_eq hx.1 hx.2] ring rw [hcongr] have hderiv : ∀ x ∈ uIcc (2 : ℝ) 3, HasDerivAt @@ -289,12 +289,12 @@ theorem integral_mIntegrand_two_three : ((1 - 1 / (2 * x ^ 2)) * (2 + (1 / (x - 1) - log (x - 1)))) x := by intro x hx rw [uIcc_of_le (by norm_num)] at hx - have hx1 : x - 1 ≠ 0 := by linarith [hx.1] - have hx0 : x ≠ 0 := by linarith [hx.1] + have hx1 : x - 1 ≠ 0 := by linarith only [hx.1, hx] + have hx0 : x ≠ 0 := by linarith only [hx.1, hx] have h1 : HasDerivAt (fun x : ℝ => x - 1) 1 x := (hasDerivAt_id x).sub_const 1 have hr : HasDerivAt (fun x : ℝ => (x - 1) ^ 2 - 1 / 2) (2 * (x - 1)) x := by convert (h1.pow 2).sub_const (1 / 2) using 1; ring - have hm := (hasDerivAt_initForm (x := x) (by linarith [hx.1])).const_add 2 + have hm := (hasDerivAt_initForm (x := x) (by linarith only [hx.1, hx])).const_add 2 have hq : HasDerivAt (fun x : ℝ => 2 * (x - 1)) 2 x := by convert h1.const_mul 2 using 1; ring have := (((hr.mul hm).div (hasDerivAt_id x) hx0).add (hasDerivAt_id x)).add @@ -307,8 +307,8 @@ theorem integral_mIntegrand_two_three : (fun x : ℝ => (1 - 1 / (2 * x ^ 2)) * (2 + (1 / (x - 1) - log (x - 1)))) (uIcc 2 3) := by rw [uIcc_of_le (by norm_num)] intro x hx - have hx1 : x - 1 ≠ 0 := by linarith [hx.1] - have hx0 : 2 * x ^ 2 ≠ 0 := by have : x ≠ 0 := by linarith [hx.1] + have hx1 : x - 1 ≠ 0 := by linarith only [hx.1, hx] + have hx0 : 2 * x ^ 2 ≠ 0 := by have : x ≠ 0 := by linarith only [hx.1, hx] positivity exact ((continuousAt_const.sub (continuousAt_const.div (continuousAt_const.mul (continuousAt_id.pow 2)) hx0)).mul @@ -324,15 +324,15 @@ theorem bigM_integral_identity {s : ℝ} (hs : 3 ≤ s) : set g : ℝ → ℝ := fun t => ((t - 1) ^ 2 - 1 / 2) * bigM t / t - ∫ x in (t - 1)..t, mIntegrand x have hgc : ContinuousOn g (Ici 3) := by refine ContinuousOn.sub ?_ ?_ - · refine ContinuousOn.div ?_ continuousOn_id fun x hx => by linarith [hx.out] + · refine ContinuousOn.div ?_ continuousOn_id fun x hx => by linarith only [hx.out, hx] exact (((continuous_id.sub continuous_const).pow 2).sub continuous_const).continuousOn.mul continuous_bigM.continuousOn · exact fun t _ => (hasDerivAt_integral_unit continuous_mIntegrand t).continuousAt |>.continuousWithinAt have hgd : ∀ t, 3 < t → HasDerivAt g 0 t := by intro t ht - have ht0 : t ≠ 0 := by linarith - have ht1 : t - 1 ≠ 0 := by linarith + have ht0 : t ≠ 0 := by linarith only [ht] + have ht1 : t - 1 ≠ 0 := by linarith only [ht] have h1 : HasDerivAt (fun x : ℝ => x - 1) 1 t := (hasDerivAt_id t).sub_const 1 have hr : HasDerivAt (fun x : ℝ => (x - 1) ^ 2 - 1 / 2) (2 * (t - 1)) t := by convert (h1.pow 2).sub_const (1 / 2) using 1; ring @@ -352,9 +352,9 @@ theorem bigM_integral_identity {s : ℝ} (hs : 3 ≤ s) : have hint : ∫ x in (s - 1)..s, mIntegrand x = ∫ x in (s - 1)..s, (1 - 1 / (2 * x ^ 2)) * bigM x := by refine intervalIntegral.integral_congr fun x hx => ?_ - rw [uIcc_of_le (by linarith)] at hx - exact mIntegrand_of_ge (by linarith [hx.1]) + rw [uIcc_of_le (by linarith only [])] at hx + exact mIntegrand_of_ge (by linarith only [hx.1, hs, hx]) simp only [g, hint] at hgs - linarith + linarith only [hgs] end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/SieveMajorants/Delay.lean b/LeanPool/IwaniecLinearSieve/SieveMajorants/Delay.lean index d4cc5d6abd..1cb7fb9bb7 100644 --- a/LeanPool/IwaniecLinearSieve/SieveMajorants/Delay.lean +++ b/LeanPool/IwaniecLinearSieve/SieveMajorants/Delay.lean @@ -52,7 +52,7 @@ theorem step_congr {y y' : ℝ → ℝ} {m : ℝ} (h : ∀ x ≤ m, y x = y' x) congr 1 refine intervalIntegral.integral_congr fun x hx => ?_ rw [uIcc_of_le h3] at hx - rw [h (x - 1) (by linarith [hx.2])] + rw [h (x - 1) (by linarith only [hx.2, hs, hx])] theorem iter_succ_eq (n : ℕ) {s : ℝ} (hs : s ≤ n + 3) : iter k y₀ (n + 1) s = iter k y₀ n s := by @@ -64,14 +64,14 @@ theorem iter_succ_eq (n : ℕ) {s : ℝ} (hs : s ≤ n + 3) : change step k y₀ (iter k y₀ (n + 1)) s = step k y₀ (iter k y₀ n) s refine step_congr (m := n + 3) (fun x hx => ih hx) ?_ push_cast at hs - linarith + linarith only [hs] theorem iter_add_eq (n j : ℕ) {s : ℝ} (hs : s ≤ n + 3) : iter k y₀ (n + j) s = iter k y₀ n s := by induction j with | zero => rfl | succ j ih => - rw [← add_assoc, iter_succ_eq _ (by push_cast; linarith), ih] + rw [← add_assoc, iter_succ_eq _ (by push_cast; linarith only [hs]), ih] theorem iter_eq_of_le {m n : ℕ} (hmn : m ≤ n) {s : ℝ} (hs : s ≤ m + 3) : iter k y₀ n s = iter k y₀ m s := by @@ -82,15 +82,15 @@ theorem sol_eq_iter {n : ℕ} {s : ℝ} (hs : s ≤ n + 3) : sol k y₀ s = iter unfold sol rcases le_total n ⌈s⌉₊ with h | h · exact iter_eq_of_le h hs - · exact (iter_eq_of_le h (by linarith [Nat.le_ceil s])).symm + · exact (iter_eq_of_le h (by linarith only [Nat.le_ceil s])).symm /-- `sol` is a fixed point of `step`. -/ theorem sol_eq_step (s : ℝ) : sol k y₀ s = step k y₀ (sol k y₀) s := by set n := ⌈s⌉₊ have hn : s ≤ n := Nat.le_ceil s - rw [sol_eq_iter (n := n + 1) (by push_cast; linarith)] + rw [sol_eq_iter (n := n + 1) (by push_cast; linarith only [hn])] change step k y₀ (iter k y₀ n) s = _ - exact step_congr (m := n + 3) (fun x hx => (sol_eq_iter hx).symm) (by linarith) + exact step_congr (m := n + 3) (fun x hx => (sol_eq_iter hx).symm) (by linarith only [hn]) theorem sol_of_le {s : ℝ} (hs : s ≤ 3) : sol k y₀ s = y₀ s := by rw [sol_eq_step, step_of_le hs] @@ -119,7 +119,7 @@ theorem continuous_sol (hk : Continuous k) (hy₀ : Continuous y₀) : Continuou set n := ⌈s⌉₊ have hn : s ≤ n := Nat.le_ceil s have hev : iter k y₀ n =ᶠ[𝓝 s] sol k y₀ := by - filter_upwards [Iio_mem_nhds (show s < n + 3 by linarith)] with x hx + filter_upwards [Iio_mem_nhds (show s < n + 3 by linarith only [hn])] with x hx exact (sol_eq_iter hx.le).symm exact ((continuous_iter hk hy₀ n).continuousAt).congr hev @@ -165,7 +165,7 @@ theorem pos_of_first_crossing {f : ℝ → ℝ} {a₀ a : ℝ} (hf : ContinuousO have htB : t ∈ B := hBc.csInf_mem hBne hBb have hat : a ≤ t := htB.1 have hft : f t ≤ 0 := htB.2 - have hat' : a < t := lt_of_le_of_ne hat fun h => by rw [← h] at hft; linarith + have hat' : a < t := lt_of_le_of_ne hat fun h => by rw [← h] at hft; linarith only [ha, hft] have hpos : ∀ x ∈ Ico a t, 0 < f x := by intro x hx by_contra hx' @@ -184,6 +184,6 @@ theorem pos_of_first_crossing {f : ℝ → ℝ} {a₀ a : ℝ} (hf : ContinuousO rcases le_total x a with hxa | hxa · exact hinit x ⟨hx.1, hxa⟩ · exact hnn x ⟨hxa, hx.2⟩ - linarith [hstep t hat' hall hpos] + linarith only [hstep t hat' hall hpos, hft, hstep, hat', hall, hpos] end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/SieveMajorants/Lemmas.lean b/LeanPool/IwaniecLinearSieve/SieveMajorants/Lemmas.lean index 3d9a83b4b8..30d69993df 100644 --- a/LeanPool/IwaniecLinearSieve/SieveMajorants/Lemmas.lean +++ b/LeanPool/IwaniecLinearSieve/SieveMajorants/Lemmas.lean @@ -39,10 +39,10 @@ namespace IwaniecLinearSieve /-- From (3.12): `𝔐(s - 1/2) ≤ 2(s-1)²/s 𝔐(s)` for `s ≥ 3`. -/ theorem bigM_sub_half_le {s : ℝ} (hs : 3 ≤ s) : bigM (s - 1 / 2) ≤ 2 * (s - 1) ^ 2 / s * bigM s := by - have hs0 : 0 < s := by linarith - have hy : 0 < (s - 1) ^ 2 := by nlinarith - have hs1 : s - 1 ≠ 0 := by linarith - have hwc := continuousOn_weight_mul continuous_bigM (a := s - 1) (b := s) (by linarith) + have hs0 : 0 < s := by linarith only [hs] + have hy : 0 < (s - 1) ^ 2 := by nlinarith only [hs] + have hs1 : s - 1 ≠ 0 := by linarith only [hs] + have hwc := continuousOn_weight_mul continuous_bigM (a := s - 1) (b := s) (by linarith only [hs]) have hI : ∀ a b, s - 1 ≤ a → a ≤ b → b ≤ s → IntervalIntegrable (fun x => (1 - 1 / (2 * x ^ 2)) * bigM x) volume a b := fun a b ha hab hb => (hwc.mono (Icc_subset_Icc ha hb)).intervalIntegrable_of_Icc hab @@ -50,56 +50,57 @@ theorem bigM_sub_half_le {s : ℝ} (hs : 3 ≤ s) : (hI (s - 1) (s - 1 / 2) le_rfl (by linarith) (by linarith)) (hI (s - 1 / 2) s (by linarith) (by linarith) le_rfl) have h2 : 0 ≤ ∫ x in (s - 1 / 2)..s, (1 - 1 / (2 * x ^ 2)) * bigM x := - intervalIntegral.integral_nonneg (by linarith) fun x hx => - (mul_pos (weight_mem (by linarith [hx.1])).1 (bigM_pos x)).le + intervalIntegral.integral_nonneg (by linarith only []) fun x hx => + (mul_pos (weight_mem (by linarith only [hx.1, hs, hx])).1 (bigM_pos x)).le have h1 : ∫ _ in (s - 1)..(s - 1 / 2), (1 - 1 / (2 * (s - 1) ^ 2)) * bigM (s - 1 / 2) ≤ ∫ x in (s - 1)..(s - 1 / 2), (1 - 1 / (2 * x ^ 2)) * bigM x := by - refine intervalIntegral.integral_mono_on (by linarith) intervalIntegrable_const + refine intervalIntegral.integral_mono_on (by linarith only []) intervalIntegrable_const (hI _ _ le_rfl (by linarith) (by linarith)) fun x hx => ?_ have hw : 1 - 1 / (2 * (s - 1) ^ 2) ≤ 1 - 1 / (2 * x ^ 2) := by have : 1 / (2 * x ^ 2) ≤ 1 / (2 * (s - 1) ^ 2) := - one_div_le_one_div_of_le (by positivity) (by nlinarith [hx.1]) - linarith + one_div_le_one_div_of_le (by positivity) (by nlinarith only [hx.1, hx, hs]) + linarith only [this] exact mul_le_mul hw (bigM_antitone hx.2) (bigM_pos _).le - (weight_mem (by linarith [hx.1])).1.le + (weight_mem (by linarith only [hx.1, hs, hx])).1.le rw [intervalIntegral.integral_const, smul_eq_mul] at h1 have key := bigM_integral_identity hs rw [← hsplit] at key have : (s - 1 / 2 - (s - 1)) * ((1 - 1 / (2 * (s - 1) ^ 2)) * bigM (s - 1 / 2)) ≤ - ((s - 1) ^ 2 - 1 / 2) * bigM s / s := by linarith + ((s - 1) ^ 2 - 1 / 2) * bigM s / s := by linarith only [h2, h1, key] have e1 : (s - 1 / 2 - (s - 1)) * ((1 - 1 / (2 * (s - 1) ^ 2)) * bigM (s - 1 / 2)) = ((s - 1) ^ 2 - 1 / 2) * bigM (s - 1 / 2) / (2 * (s - 1) ^ 2) := by field_simp; ring rw [e1, div_le_div_iff₀ (by positivity) hs0] at this - have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith + have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith only [hs, hy] rw [div_mul_eq_mul_div, le_div_iff₀ hs0] - nlinarith + nlinarith only [this, hr] /-- [I71, Lemma 8]: `𝔐(s-1) < 4 s² 𝔐(s)` for `s ≥ 3`. -/ theorem bigM_sub_one_lt {s : ℝ} (hs : 3 ≤ s) : bigM (s - 1) < 4 * s ^ 2 * bigM s := by - have hs0 : 0 < s := by linarith + have hs0 : 0 < s := by linarith only [hs] have hB := bigM_sub_half_le hs have hMs := bigM_pos s rcases le_total s (7 / 2) with h | h · have h1 : bigM (s - 1) ≤ 3 := bigM_le_three _ - have h2 : bigM 3 ≤ bigM (s - 1 / 2) := bigM_antitone (by linarith) + have h2 : bigM 3 ≤ bigM (s - 1 / 2) := bigM_antitone (by linarith only [h]) rw [bigM_three] at h2 have h3 : 2 * (s - 1) ^ 2 / s ≤ s ^ 2 := by - rw [div_le_iff₀ hs0]; nlinarith + rw [div_le_iff₀ hs0]; nlinarith only [hs] have := mul_le_mul_of_nonneg_right h3 hMs.le - nlinarith [log_two_lt_d9] - · have hA := bigM_sub_half_le (s := s - 1 / 2) (by linarith) + nlinarith only [log_two_lt_d9, hB, h1, h2, this] + · have hA := bigM_sub_half_le (s := s - 1 / 2) (by linarith only [h]) rw [show s - 1 / 2 - 1 / 2 = s - 1 by ring] at hA have h3 : 2 * (s - 1 / 2 - 1) ^ 2 / (s - 1 / 2) < 2 * s := by - rw [div_lt_iff₀ (by linarith)]; nlinarith + rw [div_lt_iff₀ (by linarith only [h])]; nlinarith have h4 : 2 * (s - 1) ^ 2 / s < 2 * s := by - rw [div_lt_iff₀ hs0]; nlinarith - have h5 : 0 < 2 * (s - 1) ^ 2 / s := div_pos (by nlinarith) hs0 + rw [div_lt_iff₀ hs0]; nlinarith only [h] + have h5 : 0 < 2 * (s - 1) ^ 2 / s := div_pos (by nlinarith only [h, hs]) hs0 calc bigM (s - 1) ≤ 2 * (s - 1 / 2 - 1) ^ 2 / (s - 1 / 2) * bigM (s - 1 / 2) := hA _ ≤ 2 * (s - 1 / 2 - 1) ^ 2 / (s - 1 / 2) * (2 * (s - 1) ^ 2 / s * bigM s) := - mul_le_mul_of_nonneg_left hB (div_nonneg (by positivity) (by linarith)) + mul_le_mul_of_nonneg_left hB (div_nonneg (by positivity) (by linarith only [h])) _ < 2 * s * (2 * s * bigM s) := by - apply mul_lt_mul' h3.le (mul_lt_mul_of_pos_right h4 hMs) (by positivity) (by linarith) + apply mul_lt_mul' h3.le (mul_lt_mul_of_pos_right h4 hMs) (by positivity) (by + linarith only [h]) _ = 4 * s ^ 2 * bigM s := by ring /-- [I71, Lemma 8] in ratio form. -/ @@ -127,7 +128,7 @@ theorem log_four_lt : log 4 < 1.3863 := by rw [show (4 : ℝ) = 2 ^ 2 by norm_num, log_pow] have := log_two_lt_d9 push_cast - linarith + linarith only [this] /-- The numerical comparison in the main range of Lemma 10. With `q² = t - 1`, the logarithmic bound makes the integrated exponential estimate smaller than `2t/(t-1)²`. -/ @@ -136,8 +137,7 @@ theorem log_mul_ratio_lt {t q L : ℝ} (ht0 : 0 < t) (hq1 : 1 < q) log t * (t / ((t - 1) ^ 2 - 1 / 2) * ((1 - q⁻¹) / (L / 2))) < 2 * (t / (t - 1) ^ 2) := by have hq0 : 0 < q := by linarith only [hq1] - have hq4 : 0 < q ^ 4 - 1 / 2 := by - linarith only [one_lt_pow₀ hq1 (by decide : 4 ≠ 0)] + have hq4 : 0 < q ^ 4 - 1 / 2 := by linarith only [one_lt_pow₀ hq1 (by decide : 4 ≠ 0)] have hL0 : 0 < L := by linarith only [hL] have hD : 0 < L * q * (q ^ 4 - 1 / 2) := by positivity have hy : (t - 1) ^ 2 = q ^ 4 := by rw [← hq2]; ring @@ -153,7 +153,7 @@ theorem log_mul_ratio_lt {t q L : ℝ} (ht0 : 0 < t) (hq1 : 1 < q) -- `log t (q-1) q⁴ < L q (q⁴ - 1/2)` using `log t ≤ L + 1/q²` have hLt' : log t ≤ L + 1 / q ^ 2 := by rwa [hq2] have h1 := mul_le_mul_of_nonneg_right hLt' - (show 0 ≤ (q - 1) * q ^ 4 by have : 0 ≤ q - 1 := by linarith + (show 0 ≤ (q - 1) * q ^ 4 by have : 0 ≤ q - 1 := by linarith only [hq1] positivity) have h2 : (L + 1 / q ^ 2) * ((q - 1) * q ^ 4) = L * (q - 1) * q ^ 4 + (q - 1) * q ^ 2 := by field_simp @@ -162,11 +162,11 @@ theorem log_mul_ratio_lt {t q L : ℝ} (ht0 : 0 < t) (hq1 : 1 < q) have hcube := mul_lt_mul_of_pos_right (one_lt_pow₀ hq1 (by decide : 3 ≠ 0)) hq0 nlinarith only [hcube, hq0] have hB' : 0 < q ^ 2 * q * (q - 1) + q * (q - 1 / 2) := by - have : 0 < q - 1 := by linarith - have : 0 < q - 1 / 2 := by linarith + have : 0 < q - 1 := by linarith only [hq1] + have : 0 < q - 1 / 2 := by linarith only [hq1] positivity - nlinarith [mul_lt_mul_of_pos_right hL hA] - nlinarith + nlinarith only [mul_lt_mul_of_pos_right hL hA, hB', hL, hA] + nlinarith only [h1, h2, h3] /-- The inequality behind [I71, Lemma 10]: `log t · 𝔐(t) < 2 t/(t-1)² · 𝔐(t-1)` for `t ≥ 2`. -/ @@ -179,15 +179,15 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : (continuousOn_id.div ((continuousOn_id.sub continuousOn_const).pow 2) fun x hx => ?_)) (continuous_bigM.comp (continuous_sub_right 1)).continuousOn) ((continuousOn_log.mono fun x hx => ?_).mul continuous_bigM.continuousOn) - · have : 0 < x - 1 := by linarith [hx.out] + · have : 0 < x - 1 := by linarith only [hx.out, hx] positivity - · simp only [mem_compl_iff, mem_singleton_iff]; linarith [hx.out] + · simp only [mem_compl_iff, mem_singleton_iff]; linarith only [hx.out, hx] · intro x hx obtain rfl : x = 2 := le_antisymm hx.2 hx.1 rw [show (2 : ℝ) - 1 = 1 by norm_num, bigM_of_le_two (by norm_num), bigM_two] - linarith [log_two_lt_d9] + linarith only [log_two_lt_d9] · rw [show (2 : ℝ) - 1 = 1 by norm_num, bigM_of_le_two (by norm_num), bigM_two] - linarith [log_two_lt_d9] + linarith only [log_two_lt_d9] intro t ht _ hpos show 0 < 2 * (t / (t - 1) ^ 2) * bigM (t - 1) - log t * bigM t rw [sub_pos] @@ -196,24 +196,24 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : have hlog0 : 0 ≤ log t := log_nonneg (by linarith) rcases le_total t 3 with h3 | h3 · -- explicit range `2 < t ≤ 3` - rw [bigM_of_le_two (show t - 1 ≤ 2 by linarith)] - have hl : log t < 1.3863 := (log_le_log ht0 (by linarith)).trans_lt log_four_lt + rw [bigM_of_le_two (show t - 1 ≤ 2 by linarith only [h3])] + have hl : log t < 1.3863 := (log_le_log ht0 (by linarith only [h3])).trans_lt log_four_lt have hk : 3 / 4 ≤ t / (t - 1) ^ 2 := by rw [le_div_iff₀ (by have : 0 < t - 1 := by linarith positivity)] nlinarith have := bigM_le_three t - nlinarith + nlinarith only [hl, hk, hlog0, this] rcases le_total t 4 with h4 | h4 · -- crude range `3 ≤ t ≤ 4`, from `𝔐(t) ≤ t/((t-1)² - 1/2) 𝔐(t-1)` have hl : log t < 1.3863 := (log_le_log ht0 h4).trans_lt log_four_lt have hR := bigM_le_ratio h3 have hy : 4 ≤ (t - 1) ^ 2 := by nlinarith - have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by linarith + have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by linarith only [hy] have key : log t * (t / ((t - 1) ^ 2 - 1 / 2)) < 2 * (t / (t - 1) ^ 2) := by - rw [mul_div_assoc', mul_div_assoc', div_lt_div_iff₀ hr (by linarith)] - have : 1 < (2 - log t) * (t - 1) ^ 2 := by nlinarith - nlinarith [mul_lt_mul_of_pos_left this ht0] + rw [mul_div_assoc', mul_div_assoc', div_lt_div_iff₀ hr (by linarith only [hy])] + have : 1 < (2 - log t) * (t - 1) ^ 2 := by nlinarith only [hy, hl] + nlinarith only [mul_lt_mul_of_pos_left this ht0, this, ht0] calc log t * bigM t ≤ log t * (t / ((t - 1) ^ 2 - 1 / 2) * bigM (t - 1)) := mul_le_mul_of_nonneg_left hR hlog0 _ = log t * (t / ((t - 1) ^ 2 - 1 / 2)) * bigM (t - 1) := by ring @@ -222,9 +222,9 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : set L₁ := log (t - 1) with hL₁ set l := L₁ / 2 with hl have hL₁1 : 1 < L₁ := by - rw [hL₁, lt_log_iff_exp_lt (by linarith)] - linarith [exp_one_lt_d9] - have hl0 : 0 < l := by linarith + rw [hL₁, lt_log_iff_exp_lt (by linarith only [h4])] + linarith only [exp_one_lt_d9, h4] + have hl0 : 0 < l := by linarith only [hl, hL₁1] -- `𝔐(x) ≤ 𝔐(t-1) exp(-l(x - (t-1)))` on `[t-1, t]` have hanti : AntitoneOn (fun x => bigM x * exp (l * x)) (Icc (t - 1) t) := by have hd : ∀ x, 3 < x → HasDerivAt (fun x => bigM x * exp (l * x)) @@ -234,20 +234,20 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : refine antitoneOn_of_deriv_nonpos (convex_Icc _ _) (continuous_bigM.mul (continuous_const.mul continuous_id).rexp).continuousOn (fun x hx => ?_) (fun x hx => ?_) <;> rw [interior_Icc] at hx - · exact (hd x (by linarith [hx.1])).differentiableAt.differentiableWithinAt - · rw [(hd x (by linarith [hx.1])).deriv] - have hfx := hpos x ⟨by linarith [hx.1], hx.2⟩ - have hlx : L₁ ≤ log x := log_le_log (by linarith) hx.1.le + · exact (hd x (by linarith only [hx.1, h4, hx])).differentiableAt.differentiableWithinAt + · rw [(hd x (by linarith only [hx.1, h4, hx])).deriv] + have hfx := hpos x ⟨by linarith only [hx.1, h4, hx], hx.2⟩ + have hlx : L₁ ≤ log x := log_le_log (by linarith only [h4]) hx.1.le have hMx := bigM_pos x - have : l * bigM x < x / (x - 1) ^ 2 * bigM (x - 1) := by nlinarith + have : l * bigM x < x / (x - 1) ^ 2 * bigM (x - 1) := by nlinarith only [hfx, hl, hMx, hlx] have he := exp_pos (l * x) - nlinarith + nlinarith only [this, he] have hbound : ∀ x ∈ Icc (t - 1) t, (1 - 1 / (2 * x ^ 2)) * bigM x ≤ bigM (t - 1) * exp (-(l * (x - (t - 1)))) := by intro x hx - have h := hanti ⟨le_rfl, by linarith⟩ hx hx.1 + have h := hanti ⟨le_rfl, by linarith only []⟩ hx hx.1 simp only at h - have hw := weight_mem (x := x) (by linarith [hx.1]) + have hw := weight_mem (x := x) (by linarith only [hx.1, h4, hx]) have hMx := bigM_pos x have e : bigM (t - 1) * exp (-(l * (x - (t - 1)))) = bigM (t - 1) * exp (l * (t - 1)) / exp (l * x) := by @@ -259,20 +259,20 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : have hint : ((t - 1) ^ 2 - 1 / 2) * bigM t / t ≤ bigM (t - 1) * ((1 - exp (-l)) / l) := by rw [bigM_integral_identity h3, ← integral_exp_neg_mul_unit (t - 1) hl0.ne', sub_add_cancel, ← intervalIntegral.integral_const_mul] - refine intervalIntegral.integral_mono_on (by linarith) - ((continuousOn_weight_mul continuous_bigM (by linarith)).intervalIntegrable_of_Icc - (by linarith)) ((by fun_prop : Continuous fun x => + refine intervalIntegral.integral_mono_on (by linarith only []) + ((continuousOn_weight_mul continuous_bigM (by linarith only [h4])).intervalIntegrable_of_Icc + (by linarith only [])) ((by fun_prop : Continuous fun x => bigM (t - 1) * exp (-(l * (x - (t - 1))))).intervalIntegrable _ _) hbound -- the numerical inequality, with `q = exp l = √(t-1)` set q := exp l with hq have hq2 : q ^ 2 = t - 1 := by - rw [hq, sq, ← exp_add, show l + l = L₁ by rw [hl]; ring, hL₁, exp_log (by linarith)] + rw [hq, sq, ← exp_add, show l + l = L₁ by rw [hl]; ring, hL₁, exp_log (by linarith only [h4])] have hq1 : 1 < q := one_lt_exp_iff.2 hl0 have hel : exp (-l) = q⁻¹ := by rw [exp_neg] have hLt : log t ≤ L₁ + 1 / (t - 1) := by - have := log_le_sub_one_of_pos (div_pos ht0 (by linarith : (0 : ℝ) < t - 1)) + have := log_le_sub_one_of_pos (div_pos ht0 (by linarith only [h4] : (0 : ℝ) < t - 1)) rw [log_div (by linarith) (by linarith)] at this - have : t - 1 ≠ 0 := by linarith + have : t - 1 ≠ 0 := by linarith only [h4] have e : t / (t - 1) - 1 = 1 / (t - 1) := by field_simp; ring linarith rw [hel] at hint @@ -280,7 +280,7 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : have hMt : bigM t ≤ t / ((t - 1) ^ 2 - 1 / 2) * (bigM (t - 1) * ((1 - q⁻¹) / l)) := by rw [div_mul_eq_mul_div, le_div_iff₀ hr] rw [div_le_iff₀ ht0] at hint - linarith + linarith only [hint] have key := log_mul_ratio_lt ht0 hq1 hq2 hL₁1 hLt calc log t * bigM t ≤ log t * (t / ((t - 1) ^ 2 - 1 / 2) * (bigM (t - 1) * ((1 - q⁻¹) / l))) := mul_le_mul_of_nonneg_left hMt hlog0 @@ -290,25 +290,25 @@ theorem log_mul_bigM_lt {t : ℝ} (ht : 2 ≤ t) : /-- [I71, Lemma 10]: `𝔐(t) t log t / 𝔐(t-1) < 9/2` for `t ≥ 3` (so it is `O(1)`). -/ theorem bigM_mul_log_div_lt {t : ℝ} (ht : 3 ≤ t) : bigM t * t * log t / bigM (t - 1) < 9 / 2 := by - have h := log_mul_bigM_lt (t := t) (by linarith) + have h := log_mul_bigM_lt (t := t) (by linarith only [ht]) have hB := bigM_pos (t - 1) - have ht0 : 0 < t := by linarith - have hy : 0 < (t - 1) ^ 2 := by nlinarith + have ht0 : 0 < t := by linarith only [ht] + have hy : 0 < (t - 1) ^ 2 := by nlinarith only [ht] rw [div_lt_iff₀ hB] have h' : log t * bigM t * t ≤ 2 * (t / (t - 1) ^ 2) * bigM (t - 1) * t := mul_le_mul_of_nonneg_right h.le ht0.le have hk : 2 * (t / (t - 1) ^ 2) * t ≤ 9 / 2 := by - rw [mul_div_assoc', div_mul_eq_mul_div, div_le_iff₀ hy]; nlinarith - nlinarith + rw [mul_div_assoc', div_mul_eq_mul_div, div_le_iff₀ hy]; nlinarith only [ht] + nlinarith only [h, ht, hB, hk] /-- Corollary to [I71, Lemma 10]: `G_{r+1}(t) (t-1)² log t / (G_r(t-1) t) < 4` for `t ≥ 2` (and all `r`; [I71] states it for `t > (5 + (-1)^r)/2`). -/ theorem majG_succ_mul_log_div_lt (r : ℕ) {t : ℝ} (ht : 2 ≤ t) : majG (r + 1) t * (t - 1) ^ 2 * log t / (majG r (t - 1) * t) < 4 := by have h := log_mul_bigM_lt ht - have ht0 : 0 < t := by linarith - have hy : 0 < (t - 1) ^ 2 := by nlinarith - have hlog : 0 ≤ log t := log_nonneg (by linarith) + have ht0 : 0 < t := by linarith only [ht] + have hy : 0 < (t - 1) ^ 2 := by nlinarith only [ht] + have hlog : 0 ≤ log t := log_nonneg (by linarith only [ht]) have hG := majG_mem (r + 1) t have hG' := majG_mem r (t - 1) have hGpos := majG_pos r (t - 1) @@ -316,11 +316,11 @@ theorem majG_succ_mul_log_div_lt (r : ℕ) {t : ℝ} (ht : 2 ≤ t) : have h1 : majG (r + 1) t * (t - 1) ^ 2 * log t ≤ 2 * bigM t / 3 * (t - 1) ^ 2 * log t := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hG.2 hy.le) hlog have h2 : log t * bigM t * (t - 1) ^ 2 < 2 * t * bigM (t - 1) := by - have ht1 : t - 1 ≠ 0 := by linarith + have ht1 : t - 1 ≠ 0 := by linarith only [ht] have := mul_lt_mul_of_pos_right h hy rwa [show 2 * (t / (t - 1) ^ 2) * bigM (t - 1) * (t - 1) ^ 2 = 2 * t * bigM (t - 1) by field_simp] at this - nlinarith + nlinarith only [hG', h1, h2, ht] /-! ### Lemma 9 (lower bound) -/ @@ -330,22 +330,22 @@ noncomputable def lemma9Fun (s : ℝ) : ℝ := exp (-(s * log s + s * log (log s theorem continuousOn_lemma9Fun : ContinuousOn lemma9Fun (Ici 3) := by unfold lemma9Fun have hlog : ContinuousOn log (Ici 3) := continuousOn_log.mono fun x hx => by - simp only [mem_compl_iff, mem_singleton_iff]; linarith [hx.out] + simp only [mem_compl_iff, mem_singleton_iff]; linarith only [hx.out, hx] have hloglog : ContinuousOn (fun x => log (log x)) (Ici 3) := - ContinuousOn.log hlog fun x hx => (log_pos (by linarith [hx.out])).ne' + ContinuousOn.log hlog fun x hx => (log_pos (by linarith only [hx.out, hx])).ne' exact ((((continuousOn_id.mul hlog).add (continuousOn_id.mul hloglog)).add (continuousOn_const.mul continuousOn_id)).neg).rexp theorem one_le_log_of_three_le {x : ℝ} (hx : 3 ≤ x) : 1 ≤ log x := by - rw [le_log_iff_exp_le (by linarith)] - linarith [exp_one_lt_d9] + rw [le_log_iff_exp_le (by linarith only [hx])] + linarith only [exp_one_lt_d9, hx] theorem lemma9Fun_le_one {x : ℝ} (hx : 3 ≤ x) : lemma9Fun x ≤ 1 := by unfold lemma9Fun rw [exp_le_one_iff, neg_nonpos] have h1 := log_nonneg (one_le_log_of_three_le hx) - have h2 := log_nonneg (show 1 ≤ x by linarith) - have : 0 ≤ x := by linarith + have h2 := log_nonneg (show 1 ≤ x by linarith only [hx]) + have : 0 ≤ x := by linarith only [hx] positivity /-- Convexity estimate: `φ(s) - φ(x) ≥ λ (s - x)` for `3 ≤ s - 1 ≤ x ≤ s`, where @@ -353,20 +353,21 @@ theorem lemma9Fun_le_one {x : ℝ} (hx : 3 ≤ x) : lemma9Fun x ≤ 1 := by theorem lemma9_phi_sub {s x : ℝ} (hs : 4 ≤ s) (hx : s - 1 ≤ x) (hxs : x ≤ s) : (log (s - 1) + log (log (s - 1)) + 3) * (s - x) ≤ (s * log s + s * log (log s) + 2 * s) - (x * log x + x * log (log x) + 2 * x) := by - have hx0 : 0 < x := by linarith - have hs0 : 0 < s := by linarith + have hx0 : 0 < x := by linarith only [hs, hx] + have hs0 : 0 < s := by linarith only [hs] -- `s log s - x log x ≥ (s - x)(1 + log x)` have h1 : (s - x) * (1 + log x) ≤ s * log s - x * log x := by have := log_le_sub_one_of_pos (div_pos hx0 hs0) rw [log_div hx0.ne' hs0.ne'] at this have e : s * (x / s - 1) = x - s := by field_simp - nlinarith - have h2 : log (s - 1) ≤ log x := log_le_log (by linarith) hx - have hl1 : 1 ≤ log (s - 1) := one_le_log_of_three_le (by linarith) - have h3 : log (log (s - 1)) ≤ log (log x) := log_le_log (by linarith) h2 - have h4 : log (log x) ≤ log (log s) := log_le_log (by linarith) (log_le_log hx0 hxs) + nlinarith only [this, e, hs] + have h2 : log (s - 1) ≤ log x := log_le_log (by linarith only [hs]) hx + have hl1 : 1 ≤ log (s - 1) := one_le_log_of_three_le (by linarith only [hs]) + have h3 : log (log (s - 1)) ≤ log (log x) := log_le_log (by linarith only [hl1]) h2 + have h4 : log (log x) ≤ log (log s) := log_le_log (by + linarith only [h2, hl1]) (log_le_log hx0 hxs) have h5 : 0 ≤ log (log (s - 1)) := log_nonneg hl1 - have hsx : 0 ≤ s - x := by linarith + have hsx : 0 ≤ s - x := by linarith only [hxs] nlinarith [mul_le_mul_of_nonneg_left h2 hsx, mul_le_mul_of_nonneg_left h3 hsx, mul_le_mul_of_nonneg_left h4 hs0.le] @@ -402,8 +403,8 @@ theorem lemma9_integral_factor_ge_one {s : ℝ} (hs : 4 ≤ s) : set L := log (s - 1) with hL set l := L + log L + 3 with hl set w₀ := 1 - 1 / (2 * (s - 1) ^ 2) with hw₀ - have hL1 : 1 ≤ L := one_le_log_of_three_le (by linarith) - have hlogL : log L ≤ L - 1 := log_le_sub_one_of_pos (by linarith) + have hL1 : 1 ≤ L := one_le_log_of_three_le (by linarith only [hs]) + have hlogL : log L ≤ L - 1 := log_le_sub_one_of_pos (by linarith only [hL1]) have hlogL0 : 0 ≤ log L := log_nonneg hL1 have hl0 : 0 < l := by linarith only [hL1, hlogL0, hl] have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith only [hs] @@ -415,18 +416,18 @@ theorem lemma9_integral_factor_ge_one {s : ℝ} (hs : 4 ≤ s) : rw [this] have h := pow_le_pow_left₀ (by norm_num) exp_one_gt_d9.le 3 norm_num at h - linarith + linarith only [this, h] have hexp_gain : l * (s - 1) ^ 2 ≤ s * (exp l - 1) := by rw [hel] - have hy : 3 ≤ s - 1 := by linarith + have hy : 3 ≤ s - 1 := by linarith only [hs] have h0 : 0 ≤ (s - 1) * L := by positivity have : 20 * ((s - 1) * L) ≤ (s - 1) * L * exp 3 := by - nlinarith [mul_le_mul_of_nonneg_left he3 h0] + nlinarith only [mul_le_mul_of_nonneg_left he3 h0, he3, h0] nlinarith [mul_le_mul_of_nonneg_left hL1 (by nlinarith : (0 : ℝ) ≤ (s - 1) ^ 2)] have hexp_cancel : exp l * (1 - exp (-l)) = exp l - 1 := by rw [mul_sub, mul_one, ← exp_add]; simp have hweight_cancel : w₀ / ((s - 1) ^ 2 - 1 / 2) = 1 / (s - 1) ^ 2 := by - have : s - 1 ≠ 0 := by linarith + have : s - 1 ≠ 0 := by linarith only [hs] rw [hw₀, div_eq_div_iff hr.ne' (by positivity)] field_simp have hfactor : w₀ * (exp l * ((1 - exp (-l)) / l)) * (s / ((s - 1) ^ 2 - 1 / 2)) = @@ -435,7 +436,7 @@ theorem lemma9_integral_factor_ge_one {s : ℝ} (hs : 4 ≤ s) : calc w₀ * (exp l * ((1 - exp (-l)) / l)) * (s / ((s - 1) ^ 2 - 1 / 2)) = w₀ / ((s - 1) ^ 2 - 1 / 2) * (s * (exp l * (1 - exp (-l))) / l) := by ring _ = _ := by rw [hweight_cancel]; field_simp - rw [hfactor, le_div_iff₀ (mul_pos hl0 (by nlinarith)), one_mul] + rw [hfactor, le_div_iff₀ (mul_pos hl0 (by nlinarith only [hr])), one_mul] exact hexp_gain /-- `lemma9Fun` is a subsolution of (3.12) for `s ≥ 4`. -/ @@ -487,43 +488,44 @@ theorem bigM_gt_lemma9Fun {s : ℝ} (hs : 3 ≤ s) : bigM 4 / 2 * lemma9Fun s < have h2 : bigM 4 ≤ bigM x := bigM_antitone hx.2 have h3 : κ * lemma9Fun x ≤ κ := by have : 0 ≤ κ := by positivity - nlinarith - linarith + nlinarith only [hκ, h1, hM4] + linarith only [hκ, hM4, h2, h3] rcases le_total s 4 with h4 | h4 · exact sub_pos.1 (hinit s ⟨hs, h4⟩) refine sub_pos.1 <| pos_of_first_crossing (f := fun s => bigM s - κ * lemma9Fun s) (a₀ := 3) (a := 4) (continuous_bigM.continuousOn.sub (continuousOn_const.mul - (continuousOn_lemma9Fun.mono fun x hx => by simp only [mem_Ici] at hx ⊢; linarith))) + (continuousOn_lemma9Fun.mono fun x hx => by simp only [mem_Ici] at hx ⊢; linarith only [hx]))) (fun x hx => (hinit x hx).le) (hinit 4 ⟨by norm_num, le_rfl⟩) ?_ s h4 intro t ht hall hpos show 0 < bigM t - κ * lemma9Fun t have hpos' : ∀ x ∈ Ioo (t - 1) t, 0 < bigM x - κ * lemma9Fun x := by intro x hx rcases le_total x 4 with h | h - · exact hinit x ⟨by linarith [hx.1], h⟩ + · exact hinit x ⟨by linarith only [hx.1, ht, hx], h⟩ · exact hpos x ⟨h, hx.2⟩ - have ht0 : 0 < t := by linarith - have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by nlinarith + have ht0 : 0 < t := by linarith only [ht] + have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by nlinarith only [ht] have hcw : ContinuousOn (fun x => (1 - 1 / (2 * x ^ 2)) * (κ * lemma9Fun x)) (Icc (t - 1) t) := by refine ContinuousOn.mul (continuousOn_const.sub (continuousOn_const.div (continuousOn_const.mul (continuousOn_id.pow 2)) fun x hx => ?_)) (continuousOn_const.mul (continuousOn_lemma9Fun.mono fun x hx => by - simp only [mem_Ici]; linarith [hx.1])) - have : 0 < x := by linarith [hx.1] + simp only [mem_Ici]; linarith only [hx.1, ht, hx])) + have : 0 < x := by linarith only [hx.1, ht, hx] positivity have hlt : ∫ x in (t - 1)..t, (1 - 1 / (2 * x ^ 2)) * (κ * lemma9Fun x) < ∫ x in (t - 1)..t, (1 - 1 / (2 * x ^ 2)) * bigM x := by refine intervalIntegral.integral_lt_integral_of_continuousOn_of_le_of_exists_lt (by linarith) hcw (continuousOn_weight_mul continuous_bigM (by linarith)) ?_ ?_ · intro x hx - have hw := (weight_mem (x := x) (by linarith [hx.1])).1 + have hw := (weight_mem (x := x) (by linarith only [hx.1, ht, hx])).1 rcases hx.2.lt_or_eq with h | rfl · exact mul_le_mul_of_nonneg_left (sub_pos.1 (hpos' x ⟨hx.1, h⟩)).le hw.le - · exact mul_le_mul_of_nonneg_left (sub_nonneg.1 (hall x ⟨by linarith, le_rfl⟩)) hw.le + · exact mul_le_mul_of_nonneg_left (sub_nonneg.1 (hall x ⟨by + linarith only [ht], le_rfl⟩)) hw.le · refine ⟨t - 1 / 2, ⟨by linarith, by linarith⟩, ?_⟩ exact mul_lt_mul_of_pos_left (sub_pos.1 (hpos' _ ⟨by linarith, by linarith⟩)) - (weight_mem (by linarith)).1 - rw [← bigM_integral_identity (by linarith), intervalIntegral.integral_congr + (weight_mem (by linarith only [ht])).1 + rw [← bigM_integral_identity (by linarith only [ht]), intervalIntegral.integral_congr (g := fun x => κ * ((1 - 1 / (2 * x ^ 2)) * lemma9Fun x)) (fun x _ => by simp only; ring), intervalIntegral.integral_const_mul] at hlt have hsub := lemma9Fun_le_integral ht.le @@ -539,13 +541,13 @@ theorem bigM_gt_lemma9Fun {s : ℝ} (hs : 3 ≤ s) : bigM 4 / 2 * lemma9Fun s < generalize (t - 1) ^ 2 - 1 / 2 = r at hr ⊢ field_simp rw [e] at h2 - linarith + linarith only [h1, h2] /-- [I71, Lemma 9], lower bound for `𝔐`: there is `κ > 0` with `𝔐(s) ≥ κ exp(-(s log s + s log log s + 2 s))` for `s ≥ 3`. -/ theorem bigM_ge_exp : ∃ κ > 0, ∀ s ≥ 3, κ * exp (-(s * log s + s * log (log s) + 2 * s)) ≤ bigM s := - ⟨bigM 4 / 2, by linarith [bigM_pos 4], fun _ hs => (bigM_gt_lemma9Fun hs).le⟩ + ⟨bigM 4 / 2, by linarith only [bigM_pos 4], fun _ hs => (bigM_gt_lemma9Fun hs).le⟩ /-- [I71, Lemma 9], lower bound: there is `c` with `G_r(s) ≥ exp(-s log s - s log log s - c s)` for all `r` and `s ≥ 3`. -/ @@ -561,7 +563,7 @@ theorem majG_ge_exp : ∃ c : ℝ, ∀ (r : ℕ) (s : ℝ), 3 ≤ s → calc exp (-(K * s)) ≤ exp (log (κ / 3)) := by rw [exp_le_exp] have : -log (κ / 3) ≤ |log (κ / 3)| := neg_le_abs _ - nlinarith + nlinarith only [hK, this, hK0, hs] _ = κ / 3 := exp_log (by positivity) have e : exp (-(s * log s) - s * log (log s) - (2 + K) * s) = exp (-(K * s)) * exp (-(s * log s + s * log (log s) + 2 * s)) := by @@ -570,7 +572,7 @@ theorem majG_ge_exp : ∃ c : ℝ, ∀ (r : ℕ) (s : ℝ), 3 ≤ s → calc exp (-(K * s)) * exp (-(s * log s + s * log (log s) + 2 * s)) ≤ κ / 3 * exp (-(s * log s + s * log (log s) + 2 * s)) := mul_le_mul_of_nonneg_right hexp (exp_pos _).le - _ ≤ bigM s / 3 := by linarith + _ ≤ bigM s / 3 := by linarith only [h1] _ ≤ majG r s := hG end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/SieveMajorants/Majorants.lean b/LeanPool/IwaniecLinearSieve/SieveMajorants/Majorants.lean index 51a4973987..3789b0eec4 100644 --- a/LeanPool/IwaniecLinearSieve/SieveMajorants/Majorants.lean +++ b/LeanPool/IwaniecLinearSieve/SieveMajorants/Majorants.lean @@ -68,12 +68,12 @@ theorem majf_of_le_two {s : ℝ} (hs : s ≤ 2) : majf s = 2 := by /-- Corollary to [I71, Lemma 6]: `𝔐/3 ≤ 𝔣 ≤ 2𝔐/3`. -/ theorem majf_mem (s : ℝ) : bigM s / 3 ≤ majf s ∧ majf s ≤ 2 * bigM s / 3 := by have := abs_le.1 (abs_bigW_le s) - unfold majf; constructor <;> linarith [this.1, this.2] + unfold majf; constructor <;> linarith only [this.1, this.2, this] /-- Corollary to [I71, Lemma 6]: `𝔐/3 ≤ 𝔉 ≤ 2𝔐/3`. -/ theorem majF_mem (s : ℝ) : bigM s / 3 ≤ majF s ∧ majF s ≤ 2 * bigM s / 3 := by have := abs_le.1 (abs_bigW_le s) - unfold majF; constructor <;> linarith [this.1, this.2] + unfold majF; constructor <;> linarith only [this.1, this.2, this] /-- Corollary to [I71, Lemma 6] for `G_r`. -/ theorem majG_mem (r : ℕ) (s : ℝ) : bigM s / 3 ≤ majG r s ∧ majG r s ≤ 2 * bigM s / 3 := by @@ -82,10 +82,10 @@ theorem majG_mem (r : ℕ) (s : ℝ) : bigM s / 3 ≤ majG r s ∧ majG r s ≤ · exact majF_mem s theorem majG_le_two (r : ℕ) (s : ℝ) : majG r s ≤ 2 := by - linarith [(majG_mem r s).2, bigM_le_three s] + linarith only [(majG_mem r s).2, bigM_le_three s] theorem majG_pos (r : ℕ) (s : ℝ) : 0 < majG r s := - lt_of_lt_of_le (by linarith [bigM_pos s]) (majG_mem r s).1 + lt_of_lt_of_le (by linarith only [bigM_pos s]) (majG_mem r s).1 theorem majf_pos (s : ℝ) : 0 < majf s := by simpa [majG_of_even (⟨0, rfl⟩ : Even 0)] using majG_pos 0 s @@ -111,12 +111,12 @@ theorem hasDerivAt_majf {s : ℝ} (hs : 2 < s) : have hexp : ∀ x, 2 < x → x ≤ 4 → HasDerivAt (fun x => 1 + (1 / (x - 1) - log (x - 1))) (-(x / (x - 1) ^ 2 * majF (x - 1))) x := by intro x hx hx4 - rw [majF_of_le_three (by linarith), mul_one] - exact (hasDerivAt_initForm (by linarith)).const_add 1 + rw [majF_of_le_three (by linarith only [hx4]), mul_one] + exact (hasDerivAt_initForm (by linarith only [hx])).const_add 1 have heq : ∀ x, 2 ≤ x → x ≤ 3 → majf x = 1 + (1 / (x - 1) - log (x - 1)) := by intro x hx hx3; rw [majf_eq hx hx3]; ring rcases lt_trichotomy s 3 with h3 | rfl | h3 - · refine (hexp s hs (by linarith)).congr_of_eventuallyEq ?_ + · refine (hexp s hs (by linarith only [hs, h3])).congr_of_eventuallyEq ?_ filter_upwards [Ioo_mem_nhds hs h3] with x hx exact heq x hx.1.le hx.2.le · have hl : HasDerivWithinAt majf (-(3 / (3 - 1) ^ 2 * majF (3 - 1))) (Iic 3) 3 := by @@ -137,10 +137,10 @@ theorem hasDerivAt_majG_succ (r : ℕ) {t : ℝ} (ht : (5 + (-1) ^ r) / 2 < t) : rcases Nat.even_or_odd r with hr | hr · rw [majG_of_odd hr.add_one, majG_of_even hr] rw [hr.neg_one_pow] at ht - exact (hasDerivAt_majF (by linarith)).congr_deriv (by ring) + exact (hasDerivAt_majF (by linarith only [ht])).congr_deriv (by ring) · rw [majG_of_even hr.add_one, majG_of_odd hr] rw [hr.neg_one_pow] at ht - exact (hasDerivAt_majf (by linarith)).congr_deriv (by ring) + exact (hasDerivAt_majf (by linarith only [ht])).congr_deriv (by ring) /-! ### Monotonicity -/ theorem majF_antitone : Antitone majF := by @@ -151,8 +151,8 @@ theorem majF_antitone : Antitone majF := by (fun x hx => ?_) (fun x hx => ?_) <;> rw [interior_Ici] at hx · exact (hasDerivAt_majF hx).differentiableAt.differentiableWithinAt · rw [(hasDerivAt_majF hx).deriv] - have := mul_pos (kernel_pos (by linarith [hx.out] : (1 : ℝ) < x)) (majf_pos (x - 1)) - linarith + have := mul_pos (kernel_pos (by linarith only [hx.out, hx] : (1 : ℝ) < x)) (majf_pos (x - 1)) + linarith only [this] theorem majf_antitone : Antitone majf := by refine antitone_of_antitoneOn_Iic_Ici (a := 2) ?_ ?_ @@ -162,8 +162,8 @@ theorem majf_antitone : Antitone majf := by (fun x hx => ?_) (fun x hx => ?_) <;> rw [interior_Ici] at hx · exact (hasDerivAt_majf hx).differentiableAt.differentiableWithinAt · rw [(hasDerivAt_majf hx).deriv] - have := mul_pos (kernel_pos (by linarith [hx.out] : (1 : ℝ) < x)) (majF_pos (x - 1)) - linarith + have := mul_pos (kernel_pos (by linarith only [hx.out, hx] : (1 : ℝ) < x)) (majF_pos (x - 1)) + linarith only [this] /-- [I71, Remark after Lemma 6]: `G_r` is decreasing. -/ theorem majG_antitone (r : ℕ) : Antitone (majG r) := by @@ -192,9 +192,9 @@ theorem majF_eq_integral {s : ℝ} (hs : 3 ≤ s) : continuous_majF.neg.continuousWithinAt (fun t ht => (hasDerivAt_majF (hs.trans_lt ht)).neg.congr_deriv (by ring)) (fun t ht => by - have h1 : 0 < t - 1 := by linarith [ht.out] + have h1 : 0 < t - 1 := by linarith only [ht.out, hs, ht] have := majf_pos (t - 1) - have : 0 < t := by linarith + have : 0 < t := by linarith only [h1] positivity) (by simpa using tendsto_majF_atTop.neg) rw [this]; ring @@ -207,9 +207,9 @@ theorem majf_eq_integral {s : ℝ} (hs : 2 ≤ s) : continuous_majf.neg.continuousWithinAt (fun t ht => (hasDerivAt_majf (hs.trans_lt ht)).neg.congr_deriv (by ring)) (fun t ht => by - have h1 : 0 < t - 1 := by linarith [ht.out] + have h1 : 0 < t - 1 := by linarith only [ht.out, hs, ht] have := majF_pos (t - 1) - have : 0 < t := by linarith + have : 0 < t := by linarith only [h1] positivity) (by simpa using tendsto_majf_atTop.neg) rw [this]; ring diff --git a/LeanPool/IwaniecLinearSieve/SieveMajorants/Properties.lean b/LeanPool/IwaniecLinearSieve/SieveMajorants/Properties.lean index d58a76b33b..5b2faa4b96 100644 --- a/LeanPool/IwaniecLinearSieve/SieveMajorants/Properties.lean +++ b/LeanPool/IwaniecLinearSieve/SieveMajorants/Properties.lean @@ -29,16 +29,16 @@ namespace IwaniecLinearSieve theorem initW_mem {s : ℝ} (hs : s ≤ 3) : -(1 / 2) ≤ initW s ∧ initW s ≤ 1 := by unfold initW set y := max s 2 - 1 with hy - have hy1 : 1 ≤ y := by have := le_max_right s 2; linarith - have hy2 : y ≤ 2 := by have : max s 2 ≤ 3 := max_le hs (by norm_num); linarith + have hy1 : 1 ≤ y := by have := le_max_right s 2; linarith only [this] + have hy2 : y ≤ 2 := by have : max s 2 ≤ 3 := max_le hs (by norm_num); linarith only [this] have hlog0 : 0 ≤ log y := log_nonneg hy1 - have hlog1 : log y ≤ y - 1 := log_le_sub_one_of_pos (by linarith) - have h1 : 1 / y ≤ 1 := by rw [div_le_one (by linarith)]; exact hy1 - have h2 : 1 / 2 ≤ 1 / y := one_div_le_one_div_of_le (by linarith) hy2 + have hlog1 : log y ≤ y - 1 := log_le_sub_one_of_pos (by linarith only [hy1]) + have h1 : 1 / y ≤ 1 := by rw [div_le_one (by linarith only [hy1])]; exact hy1 + have h2 : 1 / 2 ≤ 1 / y := one_div_le_one_div_of_le (by linarith only [hy1]) hy2 constructor <;> linarith theorem bigM_pos_of_le_three {s : ℝ} (hs : s ≤ 3) : 0 < bigM s := by - rw [bigM_of_le_three hs]; linarith [(initW_mem hs).1] + rw [bigM_of_le_three hs]; linarith only [(initW_mem hs).1, hs] theorem abs_bigW_le_of_le_three {s : ℝ} (hs : s ≤ 3) : |bigW s| ≤ bigM s / 3 := by rw [bigW_of_le_three hs, bigM_of_le_three hs, abs_le] @@ -49,7 +49,7 @@ theorem abs_bigW_le_of_le_three {s : ℝ} (hs : s ≤ 3) : |bigW s| ≤ bigM s / theorem weight_mem {x : ℝ} (hx : 1 ≤ x) : 0 < 1 - 1 / (2 * x ^ 2) ∧ 1 - 1 / (2 * x ^ 2) ≤ 1 := by have : 1 / (2 * x ^ 2) ≤ 1 / 2 := by apply one_div_le_one_div_of_le (by norm_num) - nlinarith + nlinarith only [hx] have : 0 < 1 / (2 * x ^ 2) := by positivity constructor <;> linarith @@ -73,18 +73,18 @@ theorem bigM_pos (s : ℝ) : 0 < bigM s := by · exact bigM_pos_of_le_three h · exact hpos x ⟨h, hx⟩ have hI : 0 < ∫ x in (t - 1)..t, (1 - 1 / (2 * x ^ 2)) * bigM x := by - refine intervalIntegral.intervalIntegral_pos_of_pos_on ?_ (fun x hx => ?_) (by linarith) + refine intervalIntegral.intervalIntegral_pos_of_pos_on ?_ (fun x hx => ?_) (by linarith only []) · exact (continuousOn_weight_mul continuous_bigM (by linarith)).intervalIntegrable_of_Icc - (by linarith) - · exact mul_pos (weight_mem (by linarith [hx.1])).1 (hpos' x hx.2) + (by linarith only []) + · exact mul_pos (weight_mem (by linarith only [hx.1, ht, hx])).1 (hpos' x hx.2) rw [← bigM_integral_identity ht.le] at hI - have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by nlinarith - have ht0 : 0 < t := by linarith + have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by nlinarith only [ht] + have ht0 : 0 < t := by linarith only [ht] by_contra h push Not at h have : ((t - 1) ^ 2 - 1 / 2) * bigM t / t ≤ 0 := div_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonneg_of_nonpos hr.le h) ht0.le - linarith + linarith only [hI, this] /-- An antitone function on `(-∞, a]` and on `[a, ∞)` is antitone. -/ theorem antitone_of_antitoneOn_Iic_Ici {f : ℝ → ℝ} {a : ℝ} (h₁ : AntitoneOn f (Iic a)) @@ -99,19 +99,19 @@ theorem antitone_of_antitoneOn_Iic_Ici {f : ℝ → ℝ} {a : ℝ} (h₁ : Antit theorem antitoneOn_initW : AntitoneOn initW (Iic 3) := by intro s _ t _ hst unfold initW - have h1 : 1 ≤ max s 2 - 1 := by have := le_max_right s 2; linarith + have h1 : 1 ≤ max s 2 - 1 := by have := le_max_right s 2; linarith only [this] have h2 : max s 2 ≤ max t 2 := max_le_max hst le_rfl have h3 : log (max s 2 - 1) ≤ log (max t 2 - 1) := log_le_log (by linarith) (by linarith) have h4 : 1 / (max t 2 - 1) ≤ 1 / (max s 2 - 1) := one_div_le_one_div_of_le (by linarith) (by linarith) - linarith + linarith only [h3, h4] theorem continuousOn_kernel_mul {g : ℝ → ℝ} (hg : Continuous g) : ContinuousOn (fun x => x / (x - 1) ^ 2 * g (x - 1)) (Ici 2) := by refine ContinuousOn.mul (continuousOn_id.div ((continuousOn_id.sub continuousOn_const).pow 2) fun x hx => ?_) (hg.comp (continuous_sub_right 1)).continuousOn have : (2 : ℝ) ≤ x := hx - have : 0 < x - 1 := by linarith + have : 0 < x - 1 := by linarith only [this] positivity theorem intervalIntegrable_kernel_mul {g : ℝ → ℝ} (hg : Continuous g) {a b : ℝ} (ha : 2 ≤ a) @@ -122,7 +122,7 @@ theorem intervalIntegrable_kernel_mul {g : ℝ → ℝ} (hg : Continuous g) {a b · rw [uIcc_of_ge h] at hx; exact hb.trans hx.1 theorem kernel_pos {x : ℝ} (hx : 1 < x) : 0 < x / (x - 1) ^ 2 := by - have : 0 < x - 1 := by linarith + have : 0 < x - 1 := by linarith only [hx] positivity /-- `𝔐` is antitone (on all of `ℝ`). -/ @@ -130,7 +130,7 @@ theorem bigM_antitone : Antitone bigM := by refine antitone_of_antitoneOn_Iic_Ici (a := 3) ?_ ?_ · intro s hs t ht hst rw [bigM_of_le_three hs, bigM_of_le_three ht] - linarith [antitoneOn_initW hs ht hst] + linarith only [antitoneOn_initW hs ht hst, hs, ht, hst] · intro s hs t ht hst have hs' : (3 : ℝ) ≤ s := hs have ht' : (3 : ℝ) ≤ t := ht @@ -140,8 +140,8 @@ theorem bigM_antitone : Antitone bigM := by (intervalIntegrable_kernel_mul continuous_bigM (by linarith) (by linarith))] have : 0 ≤ ∫ x in s..t, x / (x - 1) ^ 2 * bigM (x - 1) := intervalIntegral.integral_nonneg hst fun x hx => - (mul_pos (kernel_pos (by linarith [hx.1])) (bigM_pos _)).le - linarith + (mul_pos (kernel_pos (by linarith only [hx.1, hs', hx])) (bigM_pos _)).le + linarith only [this] theorem bigM_le_three (s : ℝ) : bigM s ≤ 3 := by rcases le_total s 2 with h | h @@ -151,15 +151,15 @@ theorem bigM_le_three (s : ℝ) : bigM s ≤ 3 := by /-- From (3.12) and monotonicity: `𝔐(s) ≤ s/((s-1)² - 1/2) 𝔐(s-1)` for `s ≥ 3`. -/ theorem bigM_le_ratio {s : ℝ} (hs : 3 ≤ s) : bigM s ≤ s / ((s - 1) ^ 2 - 1 / 2) * bigM (s - 1) := by - have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith - have hs0 : 0 < s := by linarith + have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith only [hs] + have hs0 : 0 < s := by linarith only [hs] have h := bigM_integral_identity hs have hle : ∫ x in (s - 1)..s, (1 - 1 / (2 * x ^ 2)) * bigM x ≤ ∫ _ in (s - 1)..s, bigM (s - 1) := by - refine intervalIntegral.integral_mono_on (by linarith) - ((continuousOn_weight_mul continuous_bigM (by linarith)).intervalIntegrable_of_Icc - (by linarith)) intervalIntegrable_const fun x hx => ?_ - obtain ⟨h0, h1⟩ := weight_mem (x := x) (by linarith [hx.1]) + refine intervalIntegral.integral_mono_on (by linarith only []) + ((continuousOn_weight_mul continuous_bigM (by linarith only [hs])).intervalIntegrable_of_Icc + (by linarith only [])) intervalIntegrable_const fun x hx => ?_ + obtain ⟨h0, h1⟩ := weight_mem (x := x) (by linarith only [hx.1, hs, hx]) calc (1 - 1 / (2 * x ^ 2)) * bigM x ≤ 1 * bigM x := mul_le_mul_of_nonneg_right h1 (bigM_pos x).le _ ≤ bigM (s - 1) := by rw [one_mul]; exact bigM_antitone hx.1 @@ -167,29 +167,29 @@ theorem bigM_le_ratio {s : ℝ} (hs : 3 ≤ s) : simp only [sub_sub_cancel, smul_eq_mul, one_mul] at hle rw [div_mul_eq_mul_div, le_div_iff₀ hr] rw [div_le_iff₀ hs0] at hle - linarith + linarith only [hle] /-- `𝔐(s) = O(e^{-s})`. -/ theorem bigM_le_exp (s : ℝ) : bigM s ≤ 3 * exp 5 * exp (-s) := by have base : ∀ s : ℝ, s ≤ 5 → bigM s ≤ 3 * exp 5 * exp (-s) := by intro s hs have : 1 ≤ exp 5 * exp (-s) := by - rw [← exp_add]; exact one_le_exp (by linarith) - nlinarith [bigM_le_three s] + rw [← exp_add]; exact one_le_exp (by linarith only [hs]) + nlinarith only [bigM_le_three s, this] have key : ∀ n : ℕ, ∀ s : ℝ, s ≤ n → bigM s ≤ 3 * exp 5 * exp (-s) := by intro n induction n with - | zero => intro s hs; exact base s (by simp at hs; linarith) + | zero => intro s hs; exact base s (by simp at hs; linarith only [hs]) | succ n ih => intro s hs rcases le_total s 5 with h5 | h5 · exact base s h5 - have h1 := bigM_le_ratio (s := s) (by linarith) - have h2 := ih (s - 1) (by push_cast at hs; linarith) - have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith + have h1 := bigM_le_ratio (s := s) (by linarith only [h5]) + have h2 := ih (s - 1) (by push_cast at hs; linarith only [hs]) + have hr : 0 < (s - 1) ^ 2 - 1 / 2 := by nlinarith only [h5] have hc : s / ((s - 1) ^ 2 - 1 / 2) ≤ exp (-1) := by rw [div_le_iff₀ hr, exp_neg, ← div_eq_inv_mul, le_div_iff₀ (exp_pos 1)] - nlinarith [exp_one_lt_d9] + nlinarith only [exp_one_lt_d9, hr, h5] calc bigM s ≤ s / ((s - 1) ^ 2 - 1 / 2) * bigM (s - 1) := h1 _ ≤ exp (-1) * (3 * exp 5 * exp (-(s - 1))) := mul_le_mul hc h2 (bigM_pos _).le (exp_pos _).le @@ -213,43 +213,43 @@ theorem abs_bigW_lt {s : ℝ} (hs : 3 ≤ s) : |bigW s| < bigM s / 3 := by refine sub_pos.1 <| pos_of_first_crossing (f := fun s => bigM s / 3 - |bigW s|) (a₀ := 2) (a := 3) ((continuous_bigM.div_const 3).sub continuous_bigW.abs).continuousOn (fun x hx => sub_nonneg.2 (abs_bigW_le_of_le_three hx.2)) ?_ ?_ s hs - · rw [bigM_three, bigW_three, abs_of_neg (by linarith [log_two_gt_d9])] - linarith [log_two_lt_d9] + · rw [bigM_three, bigW_three, abs_of_neg (by linarith only [log_two_gt_d9])] + linarith only [log_two_lt_d9] intro t ht hall _ - have ht0 : 0 < t := by linarith - have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by nlinarith + have ht0 : 0 < t := by linarith only [ht] + have hr : 0 < (t - 1) ^ 2 - 1 / 2 := by nlinarith only [ht] have hx0 : ∀ x ∈ Icc (t - 1) t, x ^ 2 ≠ 0 := fun x hx => - pow_ne_zero 2 (by linarith [hx.1]) + pow_ne_zero 2 (by linarith only [hx.1, ht, hx]) have hcW : ContinuousOn (fun x => |bigW x / x ^ 2|) (Icc (t - 1) t) := (continuous_bigW.continuousOn.div (continuousOn_id.pow 2) hx0).abs have hcM : ContinuousOn (fun x => bigM x / 3 / x ^ 2) (Icc (t - 1) t) := (continuous_bigM.div_const 3).continuousOn.div (continuousOn_id.pow 2) hx0 have hcM' : ContinuousOn (fun x => 1 / (3 * ((t - 1) ^ 2 - 1 / 2)) * ((1 - 1 / (2 * x ^ 2)) * bigM x)) (Icc (t - 1) t) := - continuousOn_const.mul (continuousOn_weight_mul continuous_bigM (by linarith)) + continuousOn_const.mul (continuousOn_weight_mul continuous_bigM (by linarith only [ht])) have h1 : |bigW t| ≤ t * ∫ x in (t - 1)..t, |bigW x / x ^ 2| := by rw [bigW_eq_neg_mul_integral ht.le, abs_mul, abs_neg, abs_of_pos ht0] exact mul_le_mul_of_nonneg_left (intervalIntegral.abs_integral_le_integral_abs - (by linarith)) ht0.le + (by linarith only [])) ht0.le have h2 : ∫ x in (t - 1)..t, |bigW x / x ^ 2| ≤ ∫ x in (t - 1)..t, bigM x / 3 / x ^ 2 := by - refine intervalIntegral.integral_mono_on (by linarith) (hcW.intervalIntegrable_of_Icc + refine intervalIntegral.integral_mono_on (by linarith only []) (hcW.intervalIntegrable_of_Icc (by linarith)) (hcM.intervalIntegrable_of_Icc (by linarith)) fun x hx => ?_ - have hx2 : 0 < x ^ 2 := pow_pos (by linarith [hx.1]) 2 + have hx2 : 0 < x ^ 2 := pow_pos (by linarith only [hx.1, ht, hx]) 2 rw [abs_div, abs_of_pos hx2] - have := hall x ⟨by linarith [hx.1], hx.2⟩ - exact div_le_div_of_nonneg_right (by linarith) hx2.le + have := hall x ⟨by linarith only [hx.1, ht, hx], hx.2⟩ + exact div_le_div_of_nonneg_right (by linarith only [this]) hx2.le have hpt : ∀ x, t - 1 < x → 0 < 1 / (3 * ((t - 1) ^ 2 - 1 / 2)) * ((1 - 1 / (2 * x ^ 2)) * bigM x) - bigM x / 3 / x ^ 2 := by intro x hx - have hx' : 0 < x := by linarith + have hx' : 0 < x := by linarith only [ht, hx] rw [lemma6_aux hr.ne' hx'.ne'] - have : 0 < x ^ 2 - 1 / 2 - ((t - 1) ^ 2 - 1 / 2) := by nlinarith + have : 0 < x ^ 2 - 1 / 2 - ((t - 1) ^ 2 - 1 / 2) := by nlinarith only [hx, ht] have := bigM_pos x positivity have h3 : ∫ x in (t - 1)..t, bigM x / 3 / x ^ 2 < ∫ x in (t - 1)..t, 1 / (3 * ((t - 1) ^ 2 - 1 / 2)) * ((1 - 1 / (2 * x ^ 2)) * bigM x) := by refine intervalIntegral.integral_lt_integral_of_continuousOn_of_le_of_exists_lt - (by linarith) hcM hcM' (fun x hx => (sub_pos.1 (hpt x hx.1)).le) + (by linarith only []) hcM hcM' (fun x hx => (sub_pos.1 (hpt x hx.1)).le) ⟨t, ⟨by linarith, le_rfl⟩, sub_pos.1 (hpt t (by linarith))⟩ rw [intervalIntegral.integral_const_mul, ← bigM_integral_identity ht.le] at h3 have h4 : t * (1 / (3 * ((t - 1) ^ 2 - 1 / 2)) * (((t - 1) ^ 2 - 1 / 2) * bigM t / t)) = @@ -270,6 +270,6 @@ theorem abs_bigW_le (s : ℝ) : |bigW s| ≤ bigM s / 3 := by /-- `𝔚(s) = O(e^{-s})`. -/ theorem abs_bigW_le_exp (s : ℝ) : |bigW s| ≤ exp 5 * exp (-s) := by have := bigM_le_exp s - linarith [abs_bigW_le s] + linarith only [abs_bigW_le s, this] end IwaniecLinearSieve diff --git a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/EulerMaclaurin.lean b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/EulerMaclaurin.lean index 4375c423cb..a7565f0a29 100644 --- a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/EulerMaclaurin.lean +++ b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/EulerMaclaurin.lean @@ -70,7 +70,7 @@ lemma intervalIntegrable_deriv_mul_B1 (ha : 0 ≤ a) (hab : a ≤ b) (h_cont : C filter_upwards [self_mem_ae_restrict (by measurability)] with x hx rw [Set.uIcc_of_le hab, Set.mem_Icc] at hx norm_cast - exact abs_B1_le_half (by linarith) + exact abs_B1_le_half (by linarith only [ha, hx]) lemma integral_deriv_mul_floor_add_one (ha : 0 ≤ a) (hab : a ≤ b) (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) (h_cont : ContinuousOn (deriv f) [[a, diff --git a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MediumPNT.lean b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MediumPNT.lean index 72c402315b..f2ade4d339 100644 --- a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MediumPNT.lean +++ b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MediumPNT.lean @@ -167,21 +167,25 @@ lemma SmoothedChebyshevDirichlet_aux_integrable {SmoothingF : ℝ → ℝ} apply continuous_iff_continuousAt.mpr intro x have := Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ - SmoothingFpos mass_one (s := σ + x * I) (by simp only [add_re, ofReal_re, mul_re, I_re, - mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith) |>.continuousAt + SmoothingFpos mass_one (s := σ + x * I) (by + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero] + linarith only [εpos, ε_lt_one, σ_gt]) |>.continuousAt fun_prop · filter_upwards [] with t calc _≤ c / ε * 1 / (σ^2 + t^2) := by - convert hc (σ / 2) (by linarith) (σ + t * I) (by simp only [add_re, ofReal_re, mul_re, - I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, half_le_self_iff]; linarith) + convert hc (σ / 2) (by linarith only [εpos, ε_lt_one, σ_gt]) (σ + t * I) (by + simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero, half_le_self_iff] + linarith only [εpos, ε_lt_one, σ_gt]) (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, - sub_self, add_zero]; linarith) ε εpos ε_lt_one using 1 + sub_self, add_zero]; linarith only [σ_le]) ε εpos ε_lt_one using 1 simp only [mul_one, Complex.sq_norm, normSq_apply, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, sub_self, add_zero, add_im, mul_im, zero_add, mul_inv_rev] ring_nf _ ≤ _ := by - gcongr; nlinarith + gcongr; nlinarith only [εpos, σ_gt, ε_lt_one] -- TODO: add to mathlib attribute [fun_prop] Continuous.const_cpow @@ -219,17 +223,18 @@ lemma SmoothedChebyshevDirichlet_aux_tsum_integral {SmoothingF : ℝ → ℝ} SmoothingFpos mass_one hz).continuousAt · fun_prop · simp only [mapsTo_univ_iff, mem_ofPred_eq, add_re, ofReal_re, mul_re, I_re, mul_zero, - ofReal_im, I_im, mul_one, sub_self, add_zero, forall_const]; linarith + ofReal_im, I_im, mul_one, sub_self, add_zero, forall_const]; + linarith only [εpos, ε_lt_one, σ_gt] have abs_two : ∀ a : ℝ, ∀ i : ℕ, ‖(i : ℂ) ^ ((σ : ℂ) + ↑a * I)‖₊ = i ^ σ := by intro a i simp_rw [← norm_toNNReal] rw [norm_natCast_cpow_of_re_ne_zero _ (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, - ofReal_im, I_im, mul_one, sub_self, add_zero, ne_eq]; linarith)] + ofReal_im, I_im, mul_one, sub_self, add_zero, ne_eq]; linarith only [εpos, ε_lt_one, σ_gt])] simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, - add_zero, Real.toNNReal_of_nonneg <| rpow_nonneg (y := σ) (x := i) (by linarith)] + add_zero, Real.toNNReal_of_nonneg <| rpow_nonneg (y := σ) (x := i) (by linarith only [])] norm_cast rw [MeasureTheory.integral_tsum] - · have x_neq_zero : X ≠ 0 := by linarith + · have x_neq_zero : X ≠ 0 := by linarith only [X_pos] intro i by_cases i_eq_zero : i = 0 · simpa [i_eq_zero] using aestronglyMeasurable_const @@ -253,7 +258,7 @@ lemma SmoothedChebyshevDirichlet_aux_tsum_integral {SmoothingF : ℝ → ℝ} · rw [lt_top_iff_ne_top, ENNReal.tsum_coe_ne_top_iff_summable_coe] push_cast convert (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := σ) - (by simp only [ofReal_re]; linarith)).norm + (by simp only [ofReal_re]; linarith only [σ_gt])).norm rw [LSeries.term_def] split_ifs with h <;> simp[h] · simp_rw [← enorm_eq_nnnorm] @@ -293,12 +298,12 @@ theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} simp only [σ] have : 0 < (Real.log X)⁻¹ := by simp only [inv_pos] - linarith - linarith + linarith only [εpos, ε_lt_one, log_gt] + linarith only [this] have σ_le : σ ≤ 2 := by simp only [σ] have : (Real.log X)⁻¹ < 1 := inv_lt_one_of_one_lt₀ log_gt - linarith + linarith only [this] calc _ = 1 / (2 * π * I) * (I * ∫ (t : ℝ), ∑' n, Λ n / (n : ℂ) ^ (σ + ↑t * I) * mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ @@ -323,7 +328,7 @@ theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} · simp [σ_gt] · congr exact SmoothedChebyshevDirichlet_aux_tsum_integral diffSmoothingF SmoothingFpos - suppSmoothingF mass_one (by linarith) εpos ε_lt_one σ_gt σ_le + suppSmoothingF mass_one (by linarith only [X_gt, εpos, ε_lt_one]) εpos ε_lt_one σ_gt σ_le · field_simp; congr; ext n; rw [← MeasureTheory.integral_const_mul]; congr; ext t by_cases n_ne_zero : n = 0 · simp [n_ne_zero] @@ -334,7 +339,7 @@ theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} · push_cast at this ⊢ rw [← this, div_mul_cancel₀] · simp only [ne_eq, Nat.cast_eq_zero, n_ne_zero, not_false_eq_true] - · apply div_nonneg (by linarith : 0 ≤ X); simp + · apply div_nonneg (by linarith only [X_gt, εpos, ε_lt_one] : 0 ≤ X); simp · simp · simp only [ne_eq, cpow_eq_zero_iff, Nat.cast_eq_zero, n_ne_zero, false_and, not_false_eq_true] @@ -343,7 +348,8 @@ theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} · have ht (t : ℝ) : -(σ + t * I) = (-1) * (σ + t * I) := by simp have hn (n : ℂ) : (n / X) ^ (-1 : ℂ) = X / n := by simp [cpow_neg_one] have (n : ℕ) : (log ((n : ℂ) / (X : ℂ)) * -1).im = 0 := by - simp [Complex.log_im, arg_eq_zero_iff, div_nonneg (Nat.cast_nonneg _) (by linarith : 0 ≤ X)] + simp [Complex.log_im, arg_eq_zero_iff, div_nonneg (Nat.cast_nonneg _) (by + linarith only [X_gt, εpos, ε_lt_one] : 0 ≤ X)] have h (n : ℕ) (t : ℝ) : ((n : ℂ) / X) ^ ((-1 : ℂ) * (σ + t * I)) = ((n / X) ^ (-1 : ℂ)) ^ (σ + ↑t * I) := by rw [cpow_mul] <;> {rw [this n]; simp [Real.pi_pos, Real.pi_nonneg]} @@ -364,11 +370,11 @@ theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} · norm_cast · rw [mul_comm] norm_cast - · exact div_pos (by exact_mod_cast n_pos) (by linarith : 0 < X) + · exact div_pos (by exact_mod_cast n_pos) (by linarith only [X_gt, εpos, ε_lt_one] : 0 < X) · apply Smooth1MellinConvergent diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one simp only [ofReal_re] - linarith + linarith only [εpos, ε_lt_one, σ_gt] · dsimp [VerticalIntegrable] apply SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos suppSmoothingF mass_one εpos ε_lt_one σ_gt σ_le @@ -658,7 +664,7 @@ theorem SmoothedChebyshevClose {SmoothingF : ℝ → ℝ} rw [C_eq] positivity refine ⟨C, Cpos, fun X X_ge_C ε εpos ε_lt_one ↦ ?_⟩ - have X_gt_zero : (0 : ℝ) < X := by linarith + have X_gt_zero : (0 : ℝ) < X := by linarith only [c₁_pos, c₁_lt, X_ge_C] have n_on_X_pos {n : ℕ} (npos : 0 < n) : 0 < n / X := by have : (0 : ℝ) < n := by exact_mod_cast npos @@ -675,9 +681,9 @@ theorem SmoothedChebyshevClose {SmoothingF : ℝ → ℝ} exact (div_le_iff₀' X_gt_zero).mpr n_le have smoothIs0 (n : ℕ) (n_le : (1 + c₂ * ε) ≤ n / X) := hc₂ (ε := ε) (n / X) ⟨εpos, ε_lt_one⟩ n_le - have ε_pos: ε > 0 := by linarith - have X_pos: X > 0 := by linarith - have X_gt_three : 3 < X := by linarith + have ε_pos: ε > 0 := by linarith only [εpos] + have X_pos: X > 0 := by linarith only [c₁_pos, c₁_lt, X_ge_C] + have X_gt_three : 3 < X := by linarith only [X_ge_C] intro X_bound have X_bound_1 : 1 ≤ X * ε * c₁ := by rw[c₁_eq, ← div_le_iff₀] @@ -706,7 +712,7 @@ theorem SmoothedChebyshevClose {SmoothingF : ℝ → ℝ} norm_num exact Real.log_pos (by norm_num) rw [SmoothedChebyshevDirichlet diffSmoothingF SmoothingFnonneg suppSmoothingF - mass_one (by linarith) εpos ε_lt_one] + mass_one (by linarith only [X_ge_C]) εpos ε_lt_one] convert SmoothedChebyshevClose_aux SmoothingF c₁ c₁_pos c₁_lt c₂ c₂_pos c₂_lt hc₂ C C_eq ε ε_pos ε_lt_one X X_pos X_gt_three X_bound_1 X_bound_2 smooth1BddAbove smooth1BddBelow smoothIs1 smoothIs0 @@ -953,10 +959,10 @@ theorem SmoothedChebyshevPull1_aux_integrable {SmoothingF : ℝ → ℝ} {ε : simp · rw [Complex.norm_cpow_eq_rpow_re_of_nonneg] · simp - · linarith + · linarith only [ε_pos, ε_lt_one, X_gt] · simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, ne_eq] - linarith + linarith only [ε_pos, ε_lt_one, σ₀_gt] convert (SmoothedChebyshevDirichlet_aux_integrable ContDiffSmoothingF SmoothingFnonneg suppSmoothingF mass_one ε_pos ε_lt_one σ₀_gt σ₀_le_2).bdd_mul (c := c) ?_ (ae_of_all _ this) using 2 @@ -990,7 +996,7 @@ theorem SmoothedChebyshevPull1_aux_integrable {SmoothingF : ℝ → ℝ} {ε : · apply ContinuousAt.comp _ (by fun_prop) apply continuousAt_const_cpow norm_cast - linarith + linarith only [ε_pos, ε_lt_one, X_gt] /- Let $g : \C \to \C$ be a holomorphic function on a rectangle, then $g$ is bounded above on the @@ -1108,13 +1114,13 @@ theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 constructor · unfold uIoo rw [min_eq_left (by linarith), max_eq_right (by linarith)] - exact mem_Ioo.mpr ⟨σ₁_lt_one, (by linarith)⟩ + exact mem_Ioo.mpr ⟨σ₁_lt_one, (by linarith only [X_eq_gt_one])⟩ · unfold uIoo rw [min_eq_left (by linarith), max_eq_right (by linarith)] exact mem_Ioo.mpr ⟨(by linarith), (by linarith)⟩ apply ResidueTheoremOnRectangleWithSimplePole' - · simp; linarith - · simp; linarith + · simp; linarith only [σ₁_lt_one, X_eq_gt_one] + · simp; linarith only [T_pos] · simp only [one_div] exact pInRectangleInterior · apply DifferentiableOn.mul @@ -1141,7 +1147,7 @@ theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 simp only [sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, sub_zero, one_div, ofReal_inv, add_re, one_re, inv_re, normSq_ofReal, div_self_mul_self', add_zero] at this - rw [uIcc_of_le (by linarith)] at this + rw [uIcc_of_le (by linarith only [σ₁_lt_one, X_eq_gt_one])] at this linarith [this.1] · intro s hs apply DifferentiableAt.differentiableWithinAt @@ -1149,7 +1155,7 @@ theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 apply DifferentiableAt.const_cpow (by fun_prop) left norm_cast - linarith + linarith only [ε_pos, ε_lt_one, X_gt] · let U : Set ℂ := Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) let f : ℂ → ℂ := fun z ↦ -ζ' z / ζ z let g : ℂ → ℂ := fun z ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z @@ -1168,13 +1174,13 @@ theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 have := uInU.1 simp only [sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, sub_zero, add_re, one_re, inv_re, normSq_ofReal, div_self_mul_self', add_zero] at this - rw [uIcc_of_le (by linarith)] at this + rw [uIcc_of_le (by linarith only [σ₁_lt_one, X_eq_gt_one])] at this linarith [this.1] · unfold HPow.hPow instHPow apply DifferentiableAt.const_cpow differentiableAt_fun_id left norm_cast - linarith + linarith only [ε_pos, ε_lt_one, X_gt] have f_near_p : (f - fun (z : ℂ) => 1 * (z - 1)⁻¹) =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by simp only [one_mul, f] exact riemannZetaLogDerivResidueBigO @@ -1200,7 +1206,7 @@ lemma verticalIntegral_split_three_finite {s a b e σ : ℝ} {f : ℂ → ℂ} VIntegral f σ a b + VIntegral f σ b e := by dsimp [VIntegral] - rw [← intervalIntegrable_iff_integrableOn_Icc_of_le (by linarith)] at hf + rw [← intervalIntegrable_iff_integrableOn_Icc_of_le (by linarith only [hab])] at hf rw [← intervalIntegral.integral_add_adjacent_intervals (b := a), ← intervalIntegral.integral_add_adjacent_intervals (a := a) (b := b)] · ring @@ -1238,11 +1244,11 @@ theorem SmoothedChebyshevPull2_aux1 {T σ₁ : ℝ} (σ₁lt : σ₁ < 1) · apply mem_reProdIm.mpr simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add, left_mem_Icc, ht, and_true] - linarith + linarith only [σ₁lt] · intro h replace h := congr_arg re h simp at h - linarith + linarith only [σ₁lt, h] /- Next pull contours to another box. @@ -1559,7 +1565,7 @@ theorem integral_evaluation (x : ℝ) (T : ℝ) (T_large : 3 < T) : exact ae_volume_of_contains_compl_singleton_zero _ U have T3 : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Iic (-T))) := by have D3 := integrableOn_Ioi_rpow_of_lt (by norm_num : (-2 : ℝ) < -1) - (by linarith : 0 < T) |>.comp_neg + (by linarith only [T_large] : 0 < T) |>.comp_neg simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 have D4 := (integrableOn_Iic_iff_integrableOn_Iio' @@ -1584,7 +1590,7 @@ theorem integral_evaluation (x : ℝ) (T : ℝ) (T_large : 3 < T) : _ = _ := by rw [← integral_comp_neg_Ioi] conv => lhs; arg 2; ext x; rw [show ((-x) ^ 2)⁻¹ = x ^ (-2 : ℝ) by simp [zpow_ofNat]] - rw[integral_Ioi_rpow_of_lt (by norm_num) (by linarith)] + rw[integral_Ioi_rpow_of_lt (by norm_num) (by linarith only [T_large])] ring_nf rw [rpow_neg_one] @@ -1632,7 +1638,7 @@ lemma IBound_aux1 (X₀ : ℝ) (X₀pos : X₀ > 0) {k : ℝ} (k_pos : 0 < k) : _ ≤ max C₁ 1 := le_max_left C₁ 1 · calc Real.log X ^ k ≤ ‖Real.log X ^ k‖ := le_norm_self _ - _ ≤ ‖X ^ 1‖ := by exact_mod_cast hM X (by linarith[hXM]) + _ ≤ ‖X ^ 1‖ := by exact_mod_cast hM X (by linarith only [hXM]) _ = 1 * X := by rw[pow_one, one_mul] apply norm_of_nonneg @@ -1727,12 +1733,12 @@ theorem I1Bound have pts_re_ge_one : 1 < pts_re := by unfold pts_re simp only [lt_add_iff_pos_right, inv_pos] - have U : 1 < X := by linarith + have U : 1 < X := by linarith only [eps_pos, eps_less_one, X_large] exact Real.log_pos U have pts_re_le_one : pts_re < 2 := by have := inv_lt_one_of_one_lt₀ (logt_gt_one X_large.le) dsimp [pts_re] - linarith + linarith only [this] have inve : (pts_re - 1)⁻¹ = Real.log X := by unfold pts_re simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, @@ -1873,7 +1879,7 @@ theorem I1Bound · refine Left.mul_nonneg ?_ ?_ · exact Left.mul_nonneg (by positivity) (by positivity) · refine log_nonneg ?_ - · linarith + · linarith only [eps_pos, eps_less_one, X_large] · refine Left.mul_nonneg ?_ ?_ · exact exp_nonneg 1 · exact le_of_lt X_pos_triv @@ -1939,7 +1945,7 @@ theorem I9Bound refine ⟨C, Cpos, ?_⟩ intro ε εpos ε_lt_one X X_gt T T_gt specialize bound ε εpos ε_lt_one X X_gt T_gt - rwa [I9I1 (by linarith), norm_conj] + rwa [I9I1 (by linarith only [εpos, ε_lt_one, X_gt]), norm_conj] lemma one_add_inv_log {X : ℝ} (X_ge : 3 ≤ X) : (1 + (Real.log X)⁻¹) < 2 := by rw[← one_add_one_eq_two] @@ -2030,7 +2036,7 @@ lemma I2GenBound {SmoothingF : ℝ → ℝ} _ ≤ 1 / 2 / 1 := by refine div_le_div_of_nonneg_left (by norm_num) (by norm_num) (Real.one_le_rpow ?_ n₁_pos.le) rw[Real.le_log_iff_exp_le Tpos] - linarith [Real.exp_one_lt_d9] + linarith only [Real.exp_one_lt_d9, ε_pos, ε_lt_one, T_gt] _ < 1 := by norm_num suffices ∀ σ ∈ Ioc σ₁ (1 + (Real.log X)⁻¹), ‖SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ C' * X / (ε * T) by @@ -2045,7 +2051,7 @@ lemma I2GenBound {SmoothingF : ℝ → ℝ} apply mul_le_mul_of_nonneg_left · rw[abs_of_nonneg (sub_nonneg.mpr interval_length_nonneg)] calc - 1 + (Real.log X)⁻¹ - σ₁ ≤ 1 + (Real.log X)⁻¹ := by linarith + 1 + (Real.log X)⁻¹ - σ₁ ≤ 1 + (Real.log X)⁻¹ := by linarith only [σ₁pos] _ ≤ 2 := (one_add_inv_log X_gt.le).le positivity _ = 2 * C' * X / (ε * T) := by ring @@ -2060,9 +2066,9 @@ lemma I2GenBound {SmoothingF : ℝ → ℝ} _ ≤ C₂ * Real.log |-T| ^ n₂ := has_bound σ (-T) (by simp only [abs_neg]; rw [abs_of_pos Tpos]; exact T_gt) (by unfold σ₁ at hσ; simp only [mem_Ioc, abs_neg, log_abs, mem_Ici, - tsub_le_iff_right] at hσ ⊢; replace hσ := hσ.1; linarith) + tsub_le_iff_right] at hσ ⊢; replace hσ := hσ.1; linarith only [hσ]) _ ≤ C₂ * Real.log T ^ n₂ := by simp - _ ≤ C₂ * (C₃ * T) := by gcongr; exact hC₃ T (by linarith) + _ ≤ C₂ * (C₃ * T) := by gcongr; exact hC₃ T (by linarith only [T_gt]) calc ‖-ζ' (σ - T * I) / ζ (σ - T * I) * 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (σ - T * I) * X ^ (σ - T * I)‖ = @@ -2076,10 +2082,10 @@ lemma I2GenBound {SmoothingF : ℝ → ℝ} · refine Mbd σ₁ σ₁pos _ ?_ ?_ ε ε_pos ε_lt_one · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, sub_zero, σ₁] at hσ ⊢ - linarith + linarith only [hσ] · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, sub_zero, σ₁] at hσ ⊢ - linarith[one_add_inv_log X_gt.le] + linarith only [one_add_inv_log X_gt.le, hσ, X_gt] · rw[cpow_def_of_ne_zero] · rw[norm_exp,← ofReal_log, re_ofReal_mul] · simp only [sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, @@ -2089,10 +2095,10 @@ lemma I2GenBound {SmoothingF : ℝ → ℝ} add_comm, add_div, div_self, one_div] · exact hσ.2 · refine (Real.log_pos ?_).ne.symm - linarith + linarith only [X_gt, ε_pos, ε_lt_one] · apply Real.log_pos - linarith - · linarith + linarith only [X_gt, ε_pos, ε_lt_one] + · linarith only [X_gt, ε_pos, ε_lt_one] · positivity · positivity · exact_mod_cast Xpos.ne.symm @@ -2191,7 +2197,7 @@ lemma _root_.Real.log_le_const_mul_rpow {c x : ℝ} (hc : 0 < c) (hx : 0 < x) : Real.log x ≤ c * x ^ (1 / c) := by have h := Real.log_le_sub_one_of_pos (Real.rpow_pos_of_pos hx (1 / c)); rw [Real.log_rpow hx] at h have h' := mul_le_mul_of_nonneg_left h hc.le; field_simp at h' - nlinarith [Real.rpow_pos_of_pos hx (1 / c)] + nlinarith only [Real.rpow_pos_of_pos hx (1 / c), hc, h'] /- For every $00$ (depending on $n$) such that @@ -2209,7 +2215,7 @@ lemma log_pow_over_xsq_integral_bounded : ∃ C : ℝ, 0 < C ∧ ∀ T > 3, ∫ x in Ioo 3 T, (Real.log x) ^ n / x ^ 2 < C := by intro n n_pos set c : ℝ := 2 * n with cDef - have cpos : 0 < c := by linarith + have cpos : 0 < c := by linarith only [n_pos] set g : ℝ → ℝ := fun x => c ^ n * x ^ (-(3 / 2) : ℝ) with gDef have g_nonneg : ∀ x ∈ Ioi (3 : ℝ), 0 ≤ g x := by intro x hx; simp only [mem_Ioi] at hx @@ -2219,17 +2225,17 @@ lemma log_pow_over_xsq_integral_bounded : Integrable.const_mul (integrableOn_Ioi_rpow_of_lt (by linarith) (by linarith)) _ have g_mono : ∀ x ∈ Ioi (3 : ℝ), Real.log x ^ n / x ^ 2 ≤ g x := by intro x hx; simp only [mem_Ioi] at hx - have xpos : 0 < x := by linarith + have xpos : 0 < x := by linarith only [hx] have logxPos : 0 < Real.log x := by rw [Real.log_pos_iff xpos.le] - linarith + linarith only [hx] have logBnd := Real.rpow_le_rpow logxPos.le (Real.log_le_const_mul_rpow cpos xpos) n_pos.le rw [Real.mul_rpow cpos.le (Real.rpow_nonneg xpos.le _), ← Real.rpow_mul xpos.le, cDef] at logBnd field_simp at logBnd have : - ((3 : ℝ) / 2) = (1 / 2) - 2 := by norm_num simp only [cDef, gDef, this, Real.rpow_sub xpos, ← mul_div_assoc, rpow_ofNat] exact (div_le_div_iff_of_pos_right (sq_pos_iff.mpr (ne_of_gt xpos))).mpr logBnd - refine ⟨1 + (∫ x in Ioi (3 : ℝ), g x), by linarith, fun T _ => ?_⟩ + refine ⟨1 + (∫ x in Ioi (3 : ℝ), g x), by linarith only [gInt_nonneg], fun T _ => ?_⟩ calc _ ≤ ∫ (x : ℝ) in Ioo 3 T, g x := by refine setIntegral_mono_on (IntegrableOn.mono_set (ContinuousOn.integrableOn_Icc @@ -2238,13 +2244,13 @@ lemma log_pow_over_xsq_integral_bounded : (fun x hx ↦ pow_ne_zero _ ?_))) Ioo_subset_Icc_self) (IntegrableOn.mono_set g_integrable Ioo_subset_Ioi_self) measurableSet_Ioo (fun x hx ↦ g_mono x hx.1) - · linarith [hx.1] + · linarith only [hx.1, hx] · simp only [mem_Icc, ne_eq, log_eq_zero, not_or, n_pos.le, or_true, implies_true] - · linarith [hx.1] + · linarith only [hx.1, hx] _ ≤ ∫ (x : ℝ) in Ioi 3, g x := by refine setIntegral_mono_set g_integrable ?_ (LE.le.eventuallyLE Ioo_subset_Ioi_self) exact MeasureTheory.ae_restrict_of_forall_mem measurableSet_Ioi (fun x hx ↦ g_nonneg x hx) - linarith + linarith only [] /-- The uniform estimate for contour segment `I₃` used in the PNT argument. -/ def I3BoundGenProp (n : ℝ) (SmoothingF : ℝ → ℝ) (A : ℝ) : Prop := ∃ (C : ℝ) (_ : 0 < C), @@ -2309,8 +2315,8 @@ theorem I3GenBound {SmoothingF : ℝ → ℝ} intro t ht apply Real.one_lt_rpow _ n₂_pos apply logt_gt_one - rw [abs_of_neg (by linarith [ht.2])] - linarith [ht.2] + rw [abs_of_neg (by linarith only [ht.2, εgt0, εlt1, ht])] + linarith only [ht.2, ht] have Aoverlogt2gtAoverlogT2_bounds : ∀ t, 3 < |t| ∧ |t| < T → A / Real.log |t| ^ n₁ > A / Real.log T ^ n₁ := by intro t ht @@ -2323,16 +2329,16 @@ theorem I3GenBound {SmoothingF : ℝ → ℝ} have hlogT : 1 < Real.log T ^ n₁ := Real.one_lt_rpow (logt_gt_one Tgt3.le) n₁_pos have AoverlogT1in0half : A / Real.log T ^ n₁ ∈ Ioo 0 (1 / 2) := by - refine ⟨div_pos hA.1 (by linarith), ?_⟩ + refine ⟨div_pos hA.1 (by linarith only [εgt0, εlt1, hlogT]), ?_⟩ exact (div_lt_self hA.1 hlogT).trans_le hA.2 - have σ₁lt1 : σ₁ < 1 := by dsimp [σ₁]; linarith [AoverlogT1in0half.1] + have σ₁lt1 : σ₁ < 1 := by dsimp [σ₁]; linarith only [AoverlogT1in0half.1, AoverlogT1in0half] have σ₁pos : 0 < σ₁ := by dsimp [σ₁]; linarith [AoverlogT1in0half.2] have quotient_bound : ∀ t ∈ Ioo (-T) (-3), Real.log |t| ^ n₂ / (σ₁ ^ 2 + t ^ 2) ≤ Real.log |t| ^ n₂ / t ^ 2 := by intro t ht exact div_le_div_of_nonneg_left (Real.rpow_nonneg (by - have := (t_bounds t ht).1; apply Real.log_nonneg; linarith) _) - (sq_pos_of_ne_zero (by have := ht.2; linarith)) (by nlinarith [sq_nonneg σ₁]) + have := (t_bounds t ht).1; apply Real.log_nonneg; linarith only [εgt0, εlt1, this]) _) + (sq_pos_of_ne_zero (by linarith only [ht.2])) (by nlinarith [sq_nonneg σ₁]) have MellinBound : ∀ (t : ℝ), ‖𝓜 (fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖(σ₁ + t * I)‖ ^ 2)⁻¹ := by @@ -2400,7 +2406,7 @@ theorem I3GenBound {SmoothingF : ℝ → ℝ} have ne_zero_of_mem_uIcc (x) (hx : x ∈ uIcc (-T) (-3)) : x ≠ 0 := by rintro rfl norm_num [mem_uIcc] at hx - linarith + linarith only [εgt0, εlt1, Tgt3, hx] have cont1 : ContinuousOn (fun t ↦ Real.log |t| ^ n₂) (uIcc (-T) (-3)) := by exact ContinuousOn.rpow (ContinuousOn.log continuous_abs.continuousOn (fun x hx ↦ abs_ne_zero.mpr (ne_zero_of_mem_uIcc x hx))) continuousOn_const (fun _ _ ↦ Or.inr n₂_pos) @@ -2529,7 +2535,7 @@ theorem I7GenBound {SmoothingF : ℝ → ℝ} refine ⟨C, Cpos, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ specialize bound X X_gt εpos ε_lt_one T_gt intro σ₁ - rwa [I7I3 (by linarith), norm_conj] + rwa [I7I3 (by linarith only [X_gt, εpos, ε_lt_one]), norm_conj] /-- The uniform estimate for contour segment `I₄` used in the PNT argument. -/ def I4BoundGenProp (n : ℝ) (SmoothingF : ℝ → ℝ) (A σ₂ : ℝ) : Prop := ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : @@ -2594,7 +2600,7 @@ private lemma logDeriv_horizontal_bddAbove {σ₂ : ℝ} repeat rw[ofReal_im] at h ring_nf at h obtain ⟨_, ripGoal⟩ := h - linarith + linarith only [ripGoal] refine ⟨?_, this⟩ rw [mem_reProdIm] simp only [sub_re, add_re, ofReal_re, mul_re, one_re, ofReal_im, sub_im, one_im, sub_self, @@ -2606,7 +2612,7 @@ private lemma logDeriv_horizontal_bddAbove {σ₂ : ℝ} · simp only [le_add_iff_nonneg_right] apply mul_nonneg · exact xInIcc.1 - · linarith [hσ₂.2] + · linarith only [hσ₂.2, hσ₂] · have : σ₂ + x * (1 - σ₂) = σ₂ * (1 - x) + x := by ring rw [this] clear this @@ -2614,11 +2620,11 @@ private lemma logDeriv_horizontal_bddAbove {σ₂ : ℝ} rw [this] clear this gcongr - · linarith [xInIcc.2] + · linarith only [xInIcc.2, xInIcc] · exact hσ₂.2.le - · linarith [xInIcc.1] + · linarith only [xInIcc.1, xInIcc] · exact xInIcc.2 - · linarith [hσ₂.2] + · linarith only [hσ₂.2, hσ₂] /-- The horizontal contour stays a positive distance from the origin. -/ private lemma horizontal_norm_sInf_pos (σ₂ : ℝ) : 0 < sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - @@ -2670,11 +2676,11 @@ private lemma horizontal_contour_endpoint_le {n A σ₂ T : ℝ} change σ₂ ≤ σ₁ have logTlb_pos : 0 < Real.log Tlb := by rw[← Real.log_one] - exact log_lt_log (by norm_num) (by linarith [hTlb]) + exact log_lt_log (by norm_num) (by linarith only [hTlb]) have logTlb_nonneg : 0 ≤ Real.log Tlb := le_of_lt (by exact logTlb_pos) have expr_nonneg : 0 ≤ A / (1 - σ₂) := by apply div_nonneg - · linarith [hA.1] + · linarith only [hA.1, hA] · rw[sub_nonneg] exact le_of_lt hσ₂.2 have temp : σ₂ ≤ 1 - A / Real.log Tlb ^ n := by @@ -2690,7 +2696,7 @@ private lemma horizontal_contour_endpoint_le {n A σ₂ T : ℝ} apply rpow_inv_rpow (by exact expr_nonneg) exact Ne.symm (Std.ne_of_lt n_pos) rw[h, div_le_iff₀, mul_comm, ← div_le_iff₀] at this - · linarith + · linarith only [this] · exact rpow_pos_of_pos (by exact logTlb_pos) _ · rw[sub_pos] exact hσ₂.2 @@ -2702,7 +2708,7 @@ private lemma horizontal_contour_endpoint_le {n A σ₂ T : ℝ} · rfl · apply Real.rpow_pos_of_pos apply Real.log_pos - linarith + linarith only [hTlb] · exact Real.rpow_le_rpow logTlb_nonneg (log_le_log (by linarith [hTlb]) T_gt_Tlb.le) n_pos.le exact le_trans temp this @@ -2748,7 +2754,7 @@ lemma I4GenBound {SmoothingF : ℝ → ℝ} have maxσ₂σ₁ : max σ₂ σ₁ = σ₁ := max_eq_right (by exact σ₂_le_σ₁) have σ₁_lt_one : σ₁ < 1 := sub_lt_self _ (div_pos hA.1 - (Real.rpow_pos_of_pos (Real.log_pos (by linarith)) _)) + (Real.rpow_pos_of_pos (Real.log_pos (by linarith only [this, ε_pos, ε_lt_one, T_gt_Tlb])) _)) rw[norm_mul, ← one_mul C] have : 1 * C * X * X ^ (-A / Real.log T ^ n) / ε = 1 * (C * X * X ^ (-A / Real.log T ^ n) / ε) := by ring @@ -2756,7 +2762,7 @@ lemma I4GenBound {SmoothingF : ℝ → ℝ} apply mul_le_mul · simp only [norm_div, norm_one, norm_mul, Complex.norm_two, Complex.norm_real, Real.norm_of_nonneg pi_nonneg, Complex.norm_I, mul_one] - exact (div_le_one (by positivity)).2 (by nlinarith [Real.pi_gt_three]) + exact (div_le_one (by positivity)).2 (by nlinarith only [Real.pi_gt_three, ε_pos, ε_lt_one]) · let f : ℝ → ℂ := fun σ ↦ (-ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)) have temp : ‖∫ (σ : ℝ) in σ₂..σ₁, -ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 @@ -2871,7 +2877,8 @@ lemma I4GenBound {SmoothingF : ℝ → ℝ} exact le_trans this (by refine Complex.abs_re_le_norm ?_) · exact CPrimeNonneg have : ‖(X : ℂ) ^ (↑x - 3 * I)‖ ≤ X * X ^ (-A / Real.log T ^ n) := by - rw [Complex.norm_cpow_eq_rpow_re_of_pos (by linarith : 0 < X)] + rw [Complex.norm_cpow_eq_rpow_re_of_pos (by + linarith only [X_gt_three, ε_pos, ε_lt_one] : 0 < X)] simp only [sub_re, ofReal_re, mul_re, I_re, I_im, reThree, imThree, mul_zero, zero_mul, sub_zero] have hx : x ≤ σ₁ := by @@ -2879,10 +2886,12 @@ lemma I4GenBound {SmoothingF : ℝ → ℝ} rw [maxσ₂σ₁] at xInIoc exact xInIoc.2 calc - X ^ x ≤ X ^ σ₁ := Real.rpow_le_rpow_of_exponent_le (by linarith) hx + X ^ x ≤ X ^ σ₁ := Real.rpow_le_rpow_of_exponent_le (by + linarith only [X_gt_three, ε_pos, ε_lt_one]) hx _ = X * X ^ (-A / Real.log T ^ n) := by dsimp [σ₁] - rw [sub_eq_add_neg, Real.rpow_add (by linarith : 0 < X), + rw [sub_eq_add_neg, Real.rpow_add (by + linarith only [X_gt_three, ε_pos, ε_lt_one] : 0 < X), Real.rpow_one, neg_div] apply mul_le_mul · exact temp @@ -2950,7 +2959,7 @@ lemma I6GenBound {SmoothingF : ℝ → ℝ} refine ⟨C, Cpos, Tlb, Tlb_gt, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ specialize bound X X_gt εpos ε_lt_one T_gt intro σ₁ - rwa [I6I4 (by linarith), norm_neg, norm_conj] + rwa [I6I4 (by linarith only [X_gt, εpos, ε_lt_one]), norm_neg, norm_conj] /-- The uniform estimate for contour segment `I₅` used in the PNT argument. -/ def I5BoundGenProp (SmoothingF : ℝ → ℝ) (σ₂ : ℝ) : Prop := ∃ (C : ℝ) (_ : 0 < C), @@ -3244,18 +3253,18 @@ private lemma eventual_exp_log_rpow_mul_log_le {const1 const2 : ℝ} (const1pos filter_upwards [this, eventually_gt_atTop 10] with x hx x_gt convert hx using 1 · rw [Real.norm_of_nonneg] - exact Real.log_nonneg (logt_gt_one (by linarith)).le + exact Real.log_nonneg (logt_gt_one (by linarith only [x_gt])).le · congr! 1 rw [Real.norm_of_nonneg] apply Real.rpow_nonneg apply Real.log_nonneg - linarith + linarith only [x_gt] have loglogx : ∀ᶠ (x : ℝ) in atTop, Real.log x = rexp (Real.log (Real.log x)) := by filter_upwards [eventually_gt_atTop 3] with x hx rw [Real.exp_log] apply Real.log_pos - linarith + linarith only [hx] filter_upwards [loglogx, this] with x loglogx hx conv => enter [1, 2] @@ -3271,7 +3280,7 @@ private lemma eventual_exp_log_rpow_mul_log_le_exp {const1 const1' const2 : ℝ} ∀ᶠ (x : ℝ) in atTop, rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ rexp (-const1' * Real.log x ^ const2) := by - have : 0 < const1 - const1' := by linarith + have : 0 < const1 - const1' := by linarith only [const1bnds] filter_upwards [eventual_exp_log_rpow_mul_log_le this const2pos] with x hx have : rexp (-const1 * Real.log x ^ const2) * Real.log x = rexp (-(const1') * Real.log x ^ const2) @@ -3297,7 +3306,7 @@ private lemma balanced_rpow_exp_le {n₁ A : ℝ} (n₁_pos : 0 < n₁) filter_upwards [eventually_gt_atTop 0] with x hx rw [Real.exp_log hx] filter_upwards [this, eventually_gt_atTop 3] with x hx x_gt_3 - have logxpos : 0 < Real.log x := by apply Real.log_pos; linarith + have logxpos : 0 < Real.log x := by apply Real.log_pos; linarith only [x_gt_3] conv => enter [1, 1, 1] rw [hx] @@ -3330,13 +3339,13 @@ private lemma balanced_rpow_exp_le {n₁ A : ℝ} (n₁_pos : 0 < n₁) positivity · apply Real.rpow_nonneg apply Real.log_nonneg - linarith + linarith only [x_gt_3] private lemma tendsto_const_mul_log_rpow_neg {pow2 : ℝ} (pow2_neg : pow2 < 0) (c' : ℝ) : Tendsto (fun x ↦ c' * Real.log x ^ pow2) atTop (𝓝 0) := by rw [← mul_zero c'] apply Tendsto.const_mul - have := tendsto_rpow_neg_atTop (y := -pow2) (by linarith) + have := tendsto_rpow_neg_atTop (y := -pow2) (by linarith only [pow2_neg]) rw [neg_neg] at this apply this.comp exact Real.tendsto_log_atTop @@ -3350,21 +3359,23 @@ private lemma eventual_const_mul_log_rpow_lt {pow2 : ℝ} (pow2_neg : pow2 < 0) private lemma eventual_log_linear_nonnegative {c1 : ℝ} (c1pos : 0 < c1) (c2 : ℝ) {pow1 : ℝ} (pow1_lt : pow1 < 1) : ∀ᶠ (x : ℝ) in atTop, 0 ≤ Real.log x * (c1 - c2 * (Real.log x) ^ (pow1 - 1)) := by - filter_upwards [eventually_gt_atTop 3 , eventual_const_mul_log_rpow_lt (by linarith : pow1 - 1 < + filter_upwards [eventually_gt_atTop 3 , eventual_const_mul_log_rpow_lt (by + linarith only [pow1_lt] : pow1 - 1 < 0) - (by linarith : 0 < c1 / 2) c2] with x x_gt hx + (by linarith only [c1pos] : 0 < c1 / 2) c2] with x x_gt hx have : 0 ≤ Real.log x := by apply Real.log_nonneg - linarith + linarith only [x_gt] apply mul_nonneg this - linarith + linarith only [c1pos, hx] private lemma eventual_log_linear_domination {const1 : ℝ} (const1_lt : const1 < 1) (const2 const3 : ℝ) {pow1 : ℝ} (pow1_lt : pow1 < 1) : ∀ᶠ (x : ℝ) in atTop, const1 * Real.log x + const2 * Real.log x ^ pow1 ≤ Real.log x - const3 * Real.log x ^ pow1 := by - filter_upwards [eventual_log_linear_nonnegative (by linarith : 0 < 1 - const1) (const2 + const3) + filter_upwards [eventual_log_linear_nonnegative (by + linarith only [const1_lt] : 0 < 1 - const1) (const2 + const3) pow1_lt, eventually_gt_atTop 3] with x hx x_gt have : @@ -3381,7 +3392,7 @@ private lemma eventual_log_linear_domination {const1 : ℝ} (const1_lt : const1 conv => enter [1, 2] rw [← Real.rpow_one (Real.log x)] - rw [← Real.rpow_add (Real.log_pos (by linarith))] + rw [← Real.rpow_add (Real.log_pos (by linarith only [x_gt]))] ring_nf rw [this] have : Real.log x * const3 * Real.log x ^ (-1 + pow1) @@ -3391,7 +3402,7 @@ private lemma eventual_log_linear_domination {const1 : ℝ} (const1_lt : const1 conv => enter [1, 2] rw [← Real.rpow_one (Real.log x)] - rw [← Real.rpow_add (Real.log_pos (by linarith))] + rw [← Real.rpow_add (Real.log_pos (by linarith only [x_gt]))] ring_nf rw [this] @@ -3526,21 +3537,22 @@ private theorem pnt_from_contour_estimates {n₁ : ℝ} (n₁_pos : 0 < n₁) ( · intro s hs apply DifferentiableAt.differentiableWithinAt apply Smooth1MellinDifferentiable ContDiff1ν ν_supp ⟨ε_pos, ε_lt_one⟩ ν_nonneg ν_massOne - linarith [mem_reProdIm.mp hs.1 |>.1.1, σ₂InIoo.1] + linarith only [mem_reProdIm.mp hs.1 |>.1.1, σ₂InIoo.1, hs, σ₂InIoo] · intro s hs apply DifferentiableAt.differentiableWithinAt apply DifferentiableAt.const_cpow (by fun_prop) left norm_cast - linarith + linarith only [X_gt_3, ε_lt_one, εx_pos] have ψ_ε_diff : ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) 1 * X‖ ≤ ‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ + ‖I₈ ν ε T X σ₁‖ + ‖I₉ ν ε X T‖ := by unfold ψ_ε_of_X - rw [SmoothedChebyshevPull1 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) + rw [SmoothedChebyshevPull1 ε_pos ε_lt_one X X_gt_3 (T := T) (by + linarith only [ε_lt_one, T_gt_3, εx_pos]) σ₁pos σ₁_lt_one holo1 ν_supp ν_nonneg ν_massOne ContDiff1ν] - rw [SmoothedChebyshevPull2 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) + rw [SmoothedChebyshevPull2 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith only [T_gt_3]) σ₂InIoo.1 σ₁_lt_one σ₂_lt_σ₁ holo1 holo2a ν_supp ν_nonneg ν_massOne ContDiff1ν] ring_nf iterate 5 @@ -3558,7 +3570,7 @@ private theorem pnt_from_contour_estimates {n₁ : ℝ} (n₁_pos : 0 < n₁) ( push_cast rw [← sub_mul, norm_mul] gcongr - rw [norm_real, norm_of_nonneg (by linarith)] + rw [norm_real, norm_of_nonneg (by linarith only [X_gt_3, ε_lt_one, εx_pos])] specialize hc₁ ε ε_pos ε_lt_one X X_gt_3 T_gt_3 specialize hc₂ X X_gt_3 ε_pos ε_lt_one T_gt_3 specialize hc₃ X X_gt_3 ε_pos ε_lt_one T_gt_3 @@ -3572,7 +3584,7 @@ private theorem pnt_from_contour_estimates {n₁ : ℝ} (n₁_pos : 0 < n₁) ( have C'bnd : c_close * ε * X * Real.log X + C_main * ε * X ≤ C' * ε * X * Real.log X := by have : C_main * ε * X * 1 ≤ C_main * ε * X * Real.log X := by gcongr - linarith + linarith only [this] have C''bnd : c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) + c₈ * X / (ε * T) + c₉ * X * Real.log X / (ε * T) ≤ C'' * X * Real.log X / (ε * T) := by unfold C'' @@ -3583,7 +3595,7 @@ private theorem pnt_from_contour_estimates {n₁ : ℝ} (n₁_pos : 0 < n₁) ( gcongr have : c₂ * X / (ε * T) ≤ c₂ * X * Real.log X / (ε * T) := by ring_nf at this ⊢ - linarith + linarith only [this] grw [this] have : c₈ * X / (ε * T) * 1 ≤ c₈ * X / (ε * T) * Real.log X := by gcongr @@ -3716,7 +3728,7 @@ lemma GenStrengthPNT {n₁ n₂ : ℝ} let Tx := (fun x ↦ Real.exp (c_Tx * (Real.log x) ^ ((1 : ℝ) / (1 + n₁)))) have one_div_succ_n₁_pos : 0 < (1 : ℝ) / (1 + n₁) := by simp only [one_div, inv_pos] - linarith + linarith only [n₁_pos] have one_div_succ_n₁_lt_one : (1 : ℝ) / (1 + n₁) < 1 := by rw [one_div, inv_lt_one₀ (one_div_pos.mp one_div_succ_n₁_pos)] norm_num [n₁_pos] @@ -3765,7 +3777,7 @@ lemma GenStrengthPNT {n₁ n₂ : ℝ} C' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / (1 + n₁))) := by unfold c εx c_εx have const1bnd : (A ^ ((1 : ℝ) / (1 + n₁)) / 4) < (A ^ ((1 : ℝ) / (1 + n₁)) / 2) := by - linarith + linarith only [c_Tx_pos] have this (x) : C' * rexp (-(A ^ ((1 : ℝ) / (1 + n₁)) / 2) * Real.log x ^ ((1 : ℝ) / (1 + n₁))) * x * Real.log x = @@ -3787,7 +3799,7 @@ lemma GenStrengthPNT {n₁ n₂ : ℝ} simp_rw [← Real.exp_add, div_eq_mul_inv, ← Real.exp_neg, this] have const1bnd : const1' < (A ^ const2 - const1) := by unfold const1' const1 - linarith + linarith only [c_Tx_pos] filter_upwards [eventual_exp_log_rpow_mul_log_le_exp const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt rw [mul_assoc] diff --git a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MellinCalculus.lean b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MellinCalculus.lean index df8f6f6da3..de7b3ad783 100644 --- a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MellinCalculus.lean +++ b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/MellinCalculus.lean @@ -181,7 +181,7 @@ lemma _root_.Filter.TendstoAtZero_of_support_in_Icc {a b : ℝ} (f : ℝ → Tendsto f (𝓝[>]0) (𝓝 0) := by apply Tendsto.comp (tendsto_nhds_of_eventually_eq ?_) tendsto_id filter_upwards [Ioo_mem_nhdsGT ha] with c hc; replace hc := (mem_Ioo.mp hc).2 - have h : c ∉ Icc a b := fun h ↦ by linarith [mem_Icc.mp h] + have h : c ∉ Icc a b := fun h ↦ by linarith only [mem_Icc.mp h, hc, h] convert mt (Function.support_subset_iff.mp fSupp c) h; simp lemma _root_.Filter.TendstoAtTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) @@ -189,16 +189,16 @@ lemma _root_.Filter.TendstoAtTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂 Tendsto f atTop (𝓝 0) := by apply Tendsto.comp (tendsto_nhds_of_eventually_eq ?_) tendsto_id filter_upwards [Ioi_mem_atTop b] with c hc; rw [mem_Ioi] at hc - have h : c ∉ Icc a b := fun h ↦ by linarith [mem_Icc.mp h] + have h : c ∉ Icc a b := fun h ↦ by linarith only [mem_Icc.mp h, hc, h] convert mt (Function.support_subset_iff.mp fSupp c) h; simp lemma _root_.Filter.BigO_zero_atZero_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) (ha : 0 < a) (fSupp : f.support ⊆ Set.Icc a b) : f =O[𝓝[>] 0] fun _ ↦ (0 : ℝ) := by refine Eventually.isBigO ?_ - filter_upwards [Ioo_mem_nhdsGT (by linarith : (0 : ℝ) < a)] with c hc + filter_upwards [Ioo_mem_nhdsGT (by linarith only [ha] : (0 : ℝ) < a)] with c hc refine norm_le_zero_iff.mpr <| Function.support_subset_iff'.mp fSupp c ?_ - exact fun h ↦ by linarith [mem_Icc.mp h, (mem_Ioo.mp hc).2] + exact fun h ↦ by linarith only [mem_Icc.mp h, (mem_Ioo.mp hc).2, h, hc] lemma _root_.Filter.BigO_zero_atTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) (fSupp : f.support ⊆ Set.Icc a b) : @@ -206,7 +206,7 @@ lemma _root_.Filter.BigO_zero_atTop_of_support_in_Icc {a b : ℝ} (f : ℝ → refine Eventually.isBigO ?_ filter_upwards [Ioi_mem_atTop b] with c hc; replace hc := mem_Ioi.mp hc refine norm_le_zero_iff.mpr <| Function.support_subset_iff'.mp fSupp c ?_ - exact fun h ↦ by linarith [mem_Icc.mp h] + exact fun h ↦ by linarith only [mem_Icc.mp h, hc, h] lemma _root_.deriv.ofReal_comp' {f : ℝ → ℝ} : deriv (fun x : ℝ ↦ (f x : ℂ)) = (fun x ↦ ((deriv f) x : ℂ)) := @@ -523,7 +523,7 @@ lemma MellinOfPsi {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) have mainBnd : ∀ (σ₁ : ℝ), 0 < σ₁ → ∀ (s : ℂ), σ₁ ≤ s.re → s.re ≤ 2 → ‖𝓜 (fun x ↦ (ν x : ℂ)) s‖ ≤ C * ‖s‖⁻¹ := by intro σ₁ σ₁pos s hs₁ hs₂ - have s_ne_zero: s ≠ 0 := fun h ↦ by linarith [zero_re ▸ h ▸ hs₁] + have s_ne_zero: s ≠ 0 := fun h ↦ by linarith only [zero_re ▸ h ▸ hs₁, σ₁pos, hs₁, h] simp only [mellin, f, MellinOfPsi_aux diffν suppν s_ne_zero, norm_mul, smul_eq_mul, mul_comm] gcongr · simp @@ -546,9 +546,9 @@ lemma MellinOfPsi {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) · intro x hx; have f_bound := isMaxOn_iff.mp max x hx have pow_bound : ‖(x : ℂ) ^ s‖ ≤ 2 ^ σ₂ := by - rw [norm_cpow_eq_rpow_re_of_pos (by linarith [mem_Icc.mp hx])] - have xpos : 0 ≤ x := by linarith [(mem_Icc.mp hx).1] - have h := rpow_le_rpow xpos (mem_Icc.mp hx).2 (by linarith : 0 ≤ s.re) + rw [norm_cpow_eq_rpow_re_of_pos (by linarith only [mem_Icc.mp hx, hx])] + have xpos : 0 ≤ x := by linarith only [(mem_Icc.mp hx).1, hx] + have h := rpow_le_rpow xpos (mem_Icc.mp hx).2 (by linarith only [σ₁pos, hs₁] : 0 ≤ s.re) exact le_trans h <| rpow_le_rpow_of_exponent_le (by norm_num) hs₂ convert! mul_le_mul f_bound pow_bound (norm_nonneg _) ?_ using 1 <;> simp [f] have Cnonneg : 0 ≤ C := by @@ -558,7 +558,7 @@ lemma MellinOfPsi {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) have := hhh.trans hh exact (mul_nonneg_iff_of_pos_right hhhh).mp this by_cases CeqZero : C = 0 - · refine ⟨1, by linarith, ?_⟩ + · refine ⟨1, by linarith only [], ?_⟩ intro ε εpos s hs₁ hs₂ have := mainBnd ε εpos s hs₁ hs₂ rw [CeqZero, zero_mul] at this @@ -623,7 +623,7 @@ lemma DeltaSpikeSupport_aux {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) have hl := (le_rpow_inv_iff_of_pos (by norm_num) hx εpos).mp this.1 rw [inv_rpow (by norm_num) ε, ← rpow_neg (by norm_num)] at hl refine ⟨hl, (rpow_inv_le_iff_of_pos ?_ (by norm_num) εpos).mp this.2⟩ - linarith [(by apply rpow_nonneg (by norm_num) : 0 ≤ (2 : ℝ) ^ (-ε))] + linarith only [(by apply rpow_nonneg (by norm_num) : 0 ≤ (2 : ℝ) ^ (-ε)), hx] lemma DeltaSpikeSupport' {ν : ℝ → ℝ} {ε x : ℝ} (εpos : 0 < ε) (xnonneg : 0 ≤ x) (suppν : ν.support ⊆ Icc (1 / 2) 2) : @@ -832,15 +832,15 @@ lemma Smooth1Properties_estimate {ε : ℝ} (εpos : 0 < ε) : have mono: StrictMonoOn f <| Ici 1 := by refine strictMonoOn_of_deriv_pos (convex_Ici _) ?_ ?_ · apply continuousOn_id.mul (continuousOn_id.log ?_) |>.sub continuousOn_id - intro x hx; simp only [mem_Ici] at hx; simp only [id_eq, ne_eq]; linarith + intro x hx; simp only [mem_Ici] at hx; simp only [id_eq, ne_eq]; linarith only [hx] · intro x hx; simp only [nonempty_Iio, interior_Ici', mem_Ioi] at hx dsimp only [f] rw [deriv_fun_sub, deriv_fun_mul, Real.deriv_log, deriv_id'', one_mul, mul_inv_cancel₀] · simp [log_pos hx] - · linarith + · linarith only [hx] · simp only [differentiableAt_fun_id] - · simp only [differentiableAt_log_iff, ne_eq]; linarith - · exact differentiableAt_fun_id.mul <| differentiableAt_fun_id.log (by linarith) + · simp only [differentiableAt_log_iff, ne_eq]; linarith only [hx] + · exact differentiableAt_fun_id.mul <| differentiableAt_fun_id.log (by linarith only [hx]) · simp only [differentiableAt_fun_id] exact mono (by rw [mem_Ici]) (mem_Ici.mpr <| le_of_lt hc) hc @@ -923,7 +923,7 @@ lemma Smooth1Properties_below {ν : ℝ → ℝ} (suppν : ν.support ⊆ Icc (1 apply DeltaSpikeSupport εpos ?_ suppν · simp only [mem_Icc, not_and, not_le]; intro linarith [(by apply (div_lt_iff₀ (by linarith)).mpr; nlinarith : x / y < 2 ^ (-ε))] - · rw [le_div_iff₀ (by linarith), zero_mul]; exact xpos.le + · rw [le_div_iff₀ (by linarith only [hy2]), zero_mul]; exact xpos.le @@ -1025,7 +1025,7 @@ lemma Smooth1Properties_above {ν : ℝ → ℝ} (suppν : ν.support ⊆ Icc (1 simp only [mem_Icc, not_and, not_le] on_goal 2 => suffices h : 2 ^ ε < x / y by - linarith [(by apply rpow_pos_of_pos (by norm_num) : 0 < (2 : ℝ) ^ ε)] + linarith only [(by apply rpow_pos_of_pos (by norm_num) : 0 < (2 : ℝ) ^ ε), h] all_goals try intro have : x / y = ((x / y) ^ (1 / ε)) ^ ε := by @@ -1253,7 +1253,7 @@ lemma MellinOfSmooth1a {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) · exact (DeltaSpikeOfRealContinuous εpos diffν).continuousOn · exact continuous_ofReal.continuousOn · intro x hx; simp only [mem_Icc] at hx; simp only [ofReal_ne_zero] - linarith [(by apply rpow_pos_of_pos (by norm_num) : (0 : ℝ) < 2 ^ (-ε))] + linarith only [(by apply rpow_pos_of_pos (by norm_num) : (0 : ℝ) < 2 ^ (-ε)), hx] have : 𝓜 (MellinConvolution g f') s = 𝓜 g s * 𝓜 f' s := by rw [mul_comm, ← MellinConvolutionTransform f' g s (by convert int_F using 1; simp only [f', F, f]; field_simp)] @@ -1285,10 +1285,10 @@ lemma MellinOfSmooth1b {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) rw [MellinOfSmooth1a diffν suppν εpos <| lt_of_le_of_lt' hs1 σ₁pos] have hh1 : ε * σ₁ ≤ (ε * s).re := by simp only [mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] - nlinarith + nlinarith only [hs1, εpos] have hh2 : (ε * s).re ≤ 2 := by simp only [mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] - nlinarith + nlinarith only [hs2, σ₁pos, ε_lt_one, hs1] calc ‖s⁻¹ * 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s)‖ = ‖s⁻¹‖ * ‖𝓜 (fun x ↦ (ν x : ℂ)) (ε * s)‖ := by simp @@ -1317,7 +1317,7 @@ lemma MellinOfSmooth1c {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) rw [Asymptotics.isBigO_iff] at h ⊢ obtain ⟨c, hc⟩ := h use c - filter_upwards [hc, Ioo_mem_nhdsGT (by linarith : (0 : ℝ) < 1)] with ε hε hε' + filter_upwards [hc, Ioo_mem_nhdsGT (by linarith only [] : (0 : ℝ) < 1)] with ε hε hε' rw [MellinOfSmooth1a diffν suppν hε'.1 (s := 1) (by norm_num)] simp only [inv_one, mul_one, one_mul, id_eq, Real.norm_eq_abs] exact hε diff --git a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ResidueCalcOnRectangles.lean b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ResidueCalcOnRectangles.lean index 812fa9f8b0..892105f64b 100644 --- a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ResidueCalcOnRectangles.lean +++ b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ResidueCalcOnRectangles.lean @@ -491,7 +491,7 @@ lemma _root_.Complex.inv_re_add_im : (x + y * I)⁻¹ = (x - I * y) / (x ^ 2 + y congr <;> simp [conj_ofReal, normSq] <;> ring lemma sq_add_sq_ne_zero (hy : y ≠ 0) : x ^ 2 + y ^ 2 ≠ 0 := by - linarith [sq_nonneg x, sq_pos_iff.mpr hy] + linarith only [sq_nonneg x, sq_pos_iff.mpr hy, hy] lemma continuous_self_div_sq_add_sq (hy : y ≠ 0) : Continuous fun x => x / (x ^ 2 + y ^ 2) := diff --git a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/StrongPNT.lean b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/StrongPNT.lean index 0583fdb737..0cefccd5f1 100644 --- a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/StrongPNT.lean +++ b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/StrongPNT.lean @@ -91,7 +91,7 @@ theorem borelCaratheodory' {M r R : ℝ} {f : ℂ → ℂ} {z : ℂ} have h_borelCaratheodory : ∀ ε > 0, ‖f z‖ ≤ (2 * (M + ε) * ‖z‖) / (R - ‖z‖) := by intro ε εpos; apply Complex.borelCaratheodory_zero; - exacts [by linarith, analytic.differentiableOn, + exacts [by linarith only [Mpos, εpos], analytic.differentiableOn, fun z hz => by rw [Set.mem_ofPred_eq]; linarith [realPartBounded z hz], Rpos, by exact Metric.mem_ball.mpr (lt_of_le_of_lt (Metric.mem_closedBall.mp hyp_z) hyp_r), zeroAtZero] @@ -165,7 +165,8 @@ lemma DerivativeBound {M r r' R : ℝ} {f : ℂ → ℂ} {z : ℂ} (z_in_r : z ∈ Metric.closedBall 0 r) : ‖(deriv f) z‖ ≤ 2 * M * (r') ^ 2 / ((R - r') * (r' - r) ^ 2) := by rw [cauchy_formula_deriv r_lt_r' r'_lt_R analytic_f.differentiableOn z_in_r, one_div] - grw [circleIntegral.norm_two_pi_i_inv_smul_integral_le_of_norm_le_const (by linarith) + grw [circleIntegral.norm_two_pi_i_inv_smul_integral_le_of_norm_le_const (by + linarith only [pos_r, r_lt_r']) (C := 2 * M * r' / ((R - r') * (r' - r) ^ 2))] · exact le_of_eq (by ring) · intro z' hz' @@ -180,7 +181,7 @@ lemma DerivativeBound {M r r' R : ℝ} {f : ℂ → ℂ} {z : ℂ} simp only [mem_sphere_iff_norm, sub_zero, Metric.mem_closedBall, dist_zero_right] at hz' z_in_r rw [← hz'] - exact le_trans (by linarith) (norm_sub_norm_le z' z) + exact le_trans (by linarith only [z_in_r]) (norm_sub_norm_le z' z) rw [norm_pow, norm_inv, one_div, inv_pow] gcongr @@ -205,7 +206,7 @@ theorem BorelCaratheodoryDeriv {M r R : ℝ} {f : ℂ → ℂ} {z : ℂ} have hr' : 2 * M * ((R + r) / 2) ^ 2 / ((R - (R + r) / 2) * ((R + r) / 2 - r) ^ 2) = 4 * M * (R + r) ^ 2 / (R - r) ^ 3 := by rw [div_eq_div_iff (mul_ne_zero (by linarith) (pow_ne_zero _ (by linarith))) - (pow_ne_zero _ (by linarith))] + (pow_ne_zero _ (by linarith only [hyp_r]))] ring calc ‖deriv f z‖ _ ≤ 4 * M * (R + r) ^ 2 / (R - r) ^ 3 := hr' ▸ @@ -213,7 +214,8 @@ theorem BorelCaratheodoryDeriv {M r R : ℝ} {f : ℂ → ℂ} {z : ℂ} analytic_f zeroAtZero realPartBounded hyp_z _ ≤ 16 * M * R ^ 2 / (R - r) ^ 3 := by have : 16 * M * R ^ 2 = 4 * M * (2 * R) ^ 2 := by ring_nf - rw [this]; bound + rw [this] + gcongr <;> linarith only [rpos, hyp_r] @@ -296,14 +298,14 @@ theorem LogOfAnalyticFunction {r R : ℝ} {B : ℂ → ℂ} exact enorm_eq_iff_norm_eq.mp (congrArg enorm hc) intro z hz have hBz := Bnonzero z (Metric.ball_subset_closedBall hz) - have hB0 := Bnonzero 0 (by norm_num; linarith) + have hB0 := Bnonzero 0 (by norm_num; linarith only [zero_lt_r, r_lt_R]) rw [← Real.log_div (norm_ne_zero_iff.mpr hBz) (norm_ne_zero_iff.mpr hB0), ← h_exp_re z hz, Real.log_exp] have hmem : ∀ z, z ∈ Metric.ball (0 : ℂ) r → z ∈ Metric.closedBall (0 : ℂ) R := by intro z hz apply Metric.mem_closedBall.mpr rw [Metric.mem_ball] at hz - linarith + linarith only [r_lt_R, hz] refine ⟨J_B, fun z hz => ?_, hJB.2.1, fun z hz => ?_, hJB.2.2⟩ · exact DifferentiableOn.analyticAt (fun w hw ↦ (hJB.1 w hw).differentiableAt.differentiableWithinAt) @@ -347,7 +349,7 @@ lemma finiteSetOfZeros_mono {r : ℝ} {f : ℂ → ℂ} unfold SetOfZeros refine ofPred_subset_ofPred.mpr ?_ intro z hz - exact ⟨by linarith, hz.2⟩ + exact ⟨by linarith only [r_lt_one, hz], hz.2⟩ @@ -405,7 +407,7 @@ lemma ZeroFactorization {R : ℝ} {f : ℂ → ℂ} {ρ : ℂ} exact zero_le_one have ρ_mem_closedBall : ρ ∈ Metric.closedBall (0 : ℂ) 1 := by rw[mem_closedBall_iff_norm, sub_zero] - linarith[hρ.1] + linarith only [hρ.1, RleOne, hρ] have orderAtZeroIsZero : analyticOrderAt f 0 = 0 := by rw[analyticOrderAt_eq_zero] exact Or.symm (Decidable.not_or_of_imp fun a a_1 ↦ hf_neq_zero_at_zero a) @@ -481,8 +483,9 @@ lemma CfAnalytic {r R : ℝ} {f : ℂ → ℂ} · simp only [finite_zeros_mono, ↓reduceDIte] by_cases w_in_zeros : w ∈ SetOfZeros r f · obtain ⟨hW, hhWanalytic, hhWne_zero, hhWeq⟩ := - ZeroFactorization (by linarith) - (hfAnalytic.mono (Metric.closedBall_subset_closedBall (by linarith))) hf_neq_zero_at_zero + ZeroFactorization (by linarith only [r_lt_R, R_lt_one]) + (hfAnalytic.mono (Metric.closedBall_subset_closedBall (by + linarith only []))) hf_neq_zero_at_zero w_in_zeros have h_eq : ∀ᶠ z in nhds w, (if h : z ∈ SetOfZeros r f then ZeroFactor f z / ∏ ρ ∈ finite_zeros_mono.toFinset \ {z}, @@ -518,7 +521,8 @@ lemma CfAnalytic {r R : ℝ} {f : ℂ → ℂ} · apply AnalyticAt.congr _ _ · exact fun z => f z / ∏ ρ ∈ finite_zeros_mono.toFinset, ( z - ρ ) ^ analyticOrderNatAt f ρ · refine AnalyticAt.div ?_ ?_ ?_ - · exact hfAnalytic w ( Metric.mem_closedBall.mpr <| le_trans hw.out <| by linarith ) + · exact hfAnalytic w ( Metric.mem_closedBall.mpr <| le_trans hw.out <| by + linarith only [R_lt_one] ) · exact analyticAt_finset_prod_sub_pow _ _ _ · simp only [ ne_eq, Finset.prod_eq_zero_iff, Finite.mem_toFinset, pow_eq_zero_iff', sub_eq_zero, ↓existsAndEq, true_and, not_and, Decidable.not_not] @@ -605,7 +609,7 @@ lemma BlaschkeOfZero {r R : ℝ} {f : ℂ → ℂ} simp only [finiteSetOfZeros_mono r_lt_one finiteZeros, zero_not_zero, ↓reduceDIte, zero_sub, zero_mul, zero_div, sub_zero, Complex.norm_mul, Complex.norm_div, norm_prod, norm_pow, norm_neg, norm_real, norm_eq_abs] - rw[div_eq_mul_inv, mul_assoc, abs_of_pos (by linarith)] + rw[div_eq_mul_inv, mul_assoc, abs_of_pos (by linarith only [r_pos, r_lt_R])] refine (mul_right_inj' (norm_ne_zero_iff.mpr hf_neq_zero_at_zero)).mpr ?_ rw[← Finset.prod_inv_distrib, ← Finset.prod_mul_distrib] simp only [div_eq_inv_mul, mul_pow, inv_pow] @@ -638,7 +642,7 @@ lemma norm_fOfZero_le_norm_BlaschkeOfZero {r R : ℝ} {f : ℂ → ℂ} simp only [SetOfZeros, Finite.mem_toFinset, mem_ofPred_eq] at hρ apply one_le_pow₀ rw[one_le_div] - · linarith + · linarith only [r_lt_R, hρ] · rw [norm_pos_iff] by_contra h rw [h] at hρ @@ -679,7 +683,7 @@ lemma DiskBound {B r R : ℝ} {f : ℂ → ℂ} {z : ℂ} have hw_not_in : ¬(w ∈ SetOfZeros r f) := by apply notMem_ofPred_iff.mpr intro le_r - linarith + linarith only [r_lt_R, hw, le_r] have Bf_eq_f_at_w : ‖BlaschkeB r R f w‖ = ‖f w‖ := by unfold BlaschkeB Cf simp only [finiteSetOfZeros_mono r_lt_one finiteZeros, hw_not_in, ↓reduceDIte, Complex.norm_mul, @@ -761,7 +765,7 @@ lemma BlaschkeNonzero {r R : ℝ} {f : ℂ → ℂ} have R_pos : 0 < R := lt_trans r_pos r_lt_R intro z hz have hz_norm_le_r : ‖z‖ ≤ r := by rwa [mem_closedBall_iff_norm, sub_zero] at hz - have hz_norm_lt_R : ‖z‖ < R := by linarith + have hz_norm_lt_R : ‖z‖ < R := by linarith only [r_lt_R, hz_norm_le_r] let hFin := finiteSetOfZeros_mono r_lt_one finiteZeros have hBProd : ∏ ρ ∈ hFin.toFinset, (↑R - z * (starRingEnd ℂ) ρ / ↑R) ^ analyticOrderNatAt f ρ ≠ 0 := by @@ -771,17 +775,18 @@ lemma BlaschkeNonzero {r R : ℝ} {f : ℂ → ℂ} norm_num [ sub_eq_zero, Complex.ext_iff ]; simp only [SetOfZeros, Finite.mem_toFinset, mem_ofPred_eq] at hρ rw [ eq_div_iff ] <;> norm_num [ Complex.normSq, Complex.norm_def ] at *; - · rw [Real.sqrt_lt' (by linarith)] at hz_norm_lt_R + · rw [Real.sqrt_lt' (by linarith only [r_pos, r_lt_R])] at hz_norm_lt_R rw [ Real.sqrt_le_iff ] at hρ refine fun h => absurd h ?_ nlinarith [sq_nonneg ( z.re - ρ.re ), sq_nonneg ( z.im - ρ.im ), mul_lt_mul_of_pos_left r_lt_R R_pos] - · linarith + · linarith only [r_pos, r_lt_R] unfold BlaschkeB Cf by_cases z_in_zeros : z ∈ SetOfZeros r f · simp only [hFin, z_in_zeros, ↓reduceDIte] - obtain ⟨_, _, hne, heq⟩ := ZeroFactorization (by linarith) - (hfAnalytic.mono (Metric.closedBall_subset_closedBall (by linarith))) hf_neq_zero_at_zero + obtain ⟨_, _, hne, heq⟩ := ZeroFactorization (by linarith only [r_lt_R, R_lt_one]) + (hfAnalytic.mono (Metric.closedBall_subset_closedBall (by + linarith only []))) hf_neq_zero_at_zero z_in_zeros rw [heq.1] refine mul_ne_zero (div_ne_zero hne (Finset.prod_ne_zero_iff.mpr fun ρ hρ => @@ -915,7 +920,7 @@ theorem JBlaschkeDerivBound {B r' r R : ℝ} {f : ℂ → ℂ} {z : ℂ} rw [← norm_one (α := ℂ), ← hf0_eq_one] exact norm_fOfZero_le_norm_BlaschkeOfZero r_pos r_lt_R R_lt_one finiteZeros (hf0_eq_one ▸ one_ne_zero) - suffices h : Real.log ‖BlaschkeB r R f w‖ ≤ Real.log B by linarith + suffices h : Real.log ‖BlaschkeB r R f w‖ ≤ Real.log B by linarith only [hlog, h] exact Real.log_le_log (norm_pos_iff.mpr (blaschkeNonzero w hwr)) (DiskBound r_pos r_lt_R R_lt_one finiteZeros hfAnalytic (hf0_eq_one ▸ one_ne_zero) fz_bound (Metric.closedBall_subset_closedBall r_lt_R.le hwr)) @@ -1050,7 +1055,7 @@ theorem FinalBound {B r' r R' R : ℝ} {f : ℂ → ℂ} {z : ℂ} apply div_le_div_of_nonneg_left (sq_nonneg R) (norm_pos_iff.mpr (star_ne_zero.mpr (fun h => one_ne_zero (hf0_eq_one ▸ h ▸ hρ.2)))) rw [norm_star] - linarith [hρ.1] + linarith only [hρ.1, r_lt_R', hρ] _ ≤ ‖↑R ^ 2 / conj ρ - z‖ := norm_sub_norm_le _ _ suffices h3 : deriv (BlaschkeB r R f) z / BlaschkeB r R f z = deriv f z / f z + ∑ ρ ∈ (finiteSetOfZeros_mono r_lt_one finiteZeros).toFinset, @@ -1203,7 +1208,7 @@ lemma ZetaFixedLowerBound (t : ℝ) : rw [← Complex.norm_of_nonneg zero_le_one]; exact norm_sub_le _ _ _ = ‖1 + (p : ℂ) ^ (-(3 : ℂ) / 2)‖ := by have : 0 ≤ 1 + (p : ℝ) ^ (-(3 : ℝ) / 2) := - by linarith [Real.rpow_nonneg (cast_nonneg' ↑p) (-3 / 2)] + by linarith only [Real.rpow_nonneg (cast_nonneg' ↑p) (-3 / 2)] simp only [Complex.norm_natCast_cpow_of_pos (Nat.Prime.pos p.2), add_re, neg_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, sub_self, div_ofNat_re, re_ofNat, neg_div', add_zero] @@ -1260,7 +1265,7 @@ lemma Zeta1AltFormula {s : ℂ} (hs : 0 < s.re) : neg_div_neg_eq, one_div, mul_add, ← mul_assoc, mul_right_comm, mul_inv_cancel₀ s_ne_zero] norm_num · simp only [neg_re, one_re, sub_re] - linarith + linarith only [hs] · refine MeasureTheory.Integrable.mono' (integrableOn_Ioi_rpow_of_lt (by linarith) (by linarith)) ?_ ?_ (g := fun u => u ^ ( -s.re - 1 )) · apply Measurable.aestronglyMeasurable @@ -1268,7 +1273,7 @@ lemma Zeta1AltFormula {s : ℂ} (hs : 0 < s.re) : exact (Measurable.of_discrete.comp Int.measurable_floor).sub Complex.measurable_ofReal · filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioi] with x hx norm_num [Complex.norm_cpow_eq_rpow_re_of_pos ( zero_lt_one.trans hx )] - apply mul_le_of_le_one_left (Real.rpow_nonneg (by linarith [hx.out]) _) + apply mul_le_of_le_one_left (Real.rpow_nonneg (by linarith only [hx.out, hx]) _) norm_cast; rw [← norm_neg, neg_sub, ← Int.fract, Real.norm_of_nonneg (Int.fract_nonneg _)] exact (Int.fract_lt_one _).le · refine MeasureTheory.Integrable.mono' (integrableOn_Ioi_rpow_of_lt (by linarith) (by linarith)) @@ -1312,12 +1317,12 @@ For the sake of clearer proof writing let $z=s+3/2+it$. Since $|s|\leq 1$ we kno theorem GlobalBound {s : ℂ} (hs : ‖s‖ ≤ 1) {t : ℝ} (ht : |t| ≥ 2) : ‖ζ (s + 3 / 2 + I * t)‖ ≤ 7 + 2 * |t| := by - have sReLB : -1 ≤ s.re := by linarith [abs_le.mp ((Complex.abs_re_le_norm s).trans hs)] + have sReLB : -1 ≤ s.re := by linarith only [abs_le.mp ((Complex.abs_re_le_norm s).trans hs), hs] have hz : s + 3 / 2 + I * ↑t ∈ {s | 0 < s.re ∧ s ≠ 1} := by simp only [ne_eq, Complex.ext_iff, one_re, one_im, not_and, mem_ofPred_eq, add_re, div_ofNat_re, re_ofNat, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, sub_self, add_zero, add_im, div_ofNat_im, im_ofNat, zero_div, mul_im, one_mul, zero_add] - refine ⟨by linarith, fun hs => ?_⟩ + refine ⟨by linarith only [sReLB], fun hs => ?_⟩ cases abs_cases t <;> linarith [abs_le.mp (Complex.abs_re_le_norm s), abs_le.mp (Complex.abs_im_le_norm s)] have leadingTerms : ‖1 + 1 / (s + 3 / 2 + I * ↑t - 1)‖ ≤ 2 := by @@ -1328,21 +1333,24 @@ theorem GlobalBound add_re, div_ofNat_re, re_ofNat, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, sub_self, add_zero, one_re, sub_im, add_im, div_ofNat_im, im_ofNat, zero_div, mul_im, one_mul, zero_add, one_im, sub_zero, one_le_sqrt] at ⊢ hs - cases abs_cases t <;> nlinarith [sq_nonneg (s.re + 1 / 2), sq_nonneg (s.im + t - 1), - sq_nonneg (s.im + t + 1)] + rcases abs_cases t with ht0 | ht0 <;> + nlinarith only [hs, ht, ht0, sq_nonneg (s.re + 1 / 2), sq_nonneg (s.im + t - 1), + sq_nonneg (s.im + t + 1)] have domBound {x : ℝ} (hu : x ∈ Ioi 1) : |Int.fract x| * ‖(x : ℂ) ^ (-(s + 3 / 2 + I * ↑t) - 1)‖ ≤ x ^ (-(s.re + 3 / 2) - 1) := by rw [mem_Ioi] at hu - rw [Complex.norm_cpow_eq_rpow_re_of_pos (by linarith)] + rw [Complex.norm_cpow_eq_rpow_re_of_pos (by linarith only [hu])] simp only [neg_add_rev, sub_re, add_re, neg_re, mul_re, I_re, ofReal_re, zero_mul, I_im, one_re, ofReal_im, mul_zero, sub_self, neg_zero, div_ofNat_re, re_ofNat, zero_add, Int.abs_fract] - refine mul_le_of_le_one_left (by apply Real.rpow_nonneg (by linarith)) ((Int.fract_lt_one x).le) + refine mul_le_of_le_one_left (by apply Real.rpow_nonneg (by + linarith only [hu])) ((Int.fract_lt_one x).le) have domIntegral : Integrable (fun x : ℝ => x ^ (-(s.re + 3 / 2) - 1)) - (volume.restrict (Set.Ioi 1)) := integrableOn_Ioi_rpow_of_lt (by linarith) zero_lt_one + (volume.restrict (Set.Ioi 1)) := integrableOn_Ioi_rpow_of_lt (by + linarith only [sReLB]) zero_lt_one have hint : ‖∫ (u : ℝ) in Ioi 1, (↑(Int.fract u) : ℂ) * (u : ℂ) ^ (-(s + 3 / 2 + I * ↑t) - 1)‖ ≤ 1 / (s.re + 3 / 2) := by refine (MeasureTheory.norm_integral_le_integral_norm _).trans ?_ - have hI := integral_Ioi_rpow_of_lt (a := -(s.re + 3 / 2) - 1) (by linarith) one_pos + have hI := integral_Ioi_rpow_of_lt (a := -(s.re + 3 / 2) - 1) (by linarith only [sReLB]) one_pos simp only [sub_add_cancel, one_rpow, neg_div_neg_eq] at hI simp only [Complex.norm_mul, norm_real, norm_eq_abs, ← hI] refine integral_mono_ae (domIntegral.mono' (((measurable_fract.abs).mul @@ -1358,16 +1366,16 @@ theorem GlobalBound by rw [norm_div, Complex.norm_ofNat, Complex.norm_ofNat] apply le_trans (norm_add_le_of_le (norm_add_le_of_le hs (le_of_eq threeHalves_norm)) (le_of_eq It_norm)) - linarith + linarith only [] have hmul : ‖(s + 3 / 2 + I * ↑t) * ∫ (u : ℝ) in Ioi 1, (↑(Int.fract u) : ℂ) * (u : ℂ) ^ (-(s + 3 / 2 + I * ↑t) - 1)‖ ≤ 5 + 2 * |t| := by rw [norm_mul] have hinv : (1 : ℝ) / (s.re + 3 / 2) ≤ 2 := by rw [div_le_iff₀ (by linarith)]; linarith apply le_trans - (mul_le_mul z_norm (hint.trans hinv) (norm_nonneg _) (by linarith [abs_nonneg t])) - linarith + (mul_le_mul z_norm (hint.trans hinv) (norm_nonneg _) (by linarith only [abs_nonneg t, ht])) + linarith only [] rw [ZetaAltFormula hz.1 hz.2] - exact (norm_sub_le_of_le leadingTerms hmul).trans (by linarith) + exact (norm_sub_le_of_le leadingTerms hmul).trans (by linarith only []) @@ -1383,7 +1391,7 @@ lemma norm_zeta_strict_mono_ofReal {a b : ℝ} (hb : 1 < b) (hab : b < a) : simp only [rpow_eq_pow] rw [zeta_eq_tsum_one_div_nat_add_one_cpow (by norm_num [hc])] push_cast; congr; funext n - rw [Complex.ofReal_cpow (by linarith)] + rw [Complex.ofReal_cpow (by linarith only [])] push_cast; rfl have hsum {c : ℝ} (hc : 1 < c) : Summable (fun n : ℕ => ((n + 2 : ℝ) ^ c)⁻¹) := by exact_mod_cast (summable_nat_add_iff 2).2 (Real.summable_nat_rpow_inv.2 hc) @@ -1396,7 +1404,7 @@ lemma norm_zeta_strict_mono_ofReal {a b : ℝ} (hb : 1 < b) (hab : b < a) : add_lt_add_iff_left, add_assoc, one_add_one_eq_two] have h : ∀ n : ℕ, ((n + 2 : ℝ) ^ a)⁻¹ < ((n + 2 : ℝ) ^ b)⁻¹ := fun _ => inv_strictAnti₀ (Real.rpow_pos_of_pos (by positivity) b) - (Real.rpow_lt_rpow_of_exponent_lt (by linarith) hab) + (Real.rpow_lt_rpow_of_exponent_lt (by linarith only []) hab) exact Summable.tsum_strict_mono (hsum (hb.trans hab)) (hsum hb) (Pi.lt_def.mpr ⟨fun n => (h n).le, 0, h 0⟩) · push_cast; simpa [add_assoc, one_add_one_eq_two] using hsum hb @@ -1454,15 +1462,16 @@ theorem LogDerivZetaFinalBound {r' r R' R : ℝ} (r'_pos : 0 < r') (r'_lt_r : r' simpa only [ofReal_div, ofReal_ofNat] using one_lt_zeta_div set C : ℝ := 1 + Real.log (11 * (‖ζ (3 / 2)‖₊ / ‖ζ 3‖₊)) / Real.log 2 with C_def refine ⟨C, ?_, ?_⟩ - · rw [C_def, Real.log_mul (Ne.symm (OfNat.zero_ne_ofNat 11)) (by linarith)] + · rw [C_def, Real.log_mul (Ne.symm (OfNat.zero_ne_ofNat 11)) (by linarith only [hzd])] exact add_pos zero_lt_one (div_pos (add_pos (Real.log_pos one_lt_ofNat) (Real.log_pos hzd)) (Real.log_pos one_lt_two)) · intro t ht f finiteZeros z hz set g : ℂ → ℂ := f / (fun z ↦ f 0) with g_def have g_def' : g = fun z ↦ f z / f 0 := rfl set B : ℝ := (7 + 2 * |t|) * (‖ζ (3 / 2)‖₊ / ‖ζ 3‖₊) with B_def - have one_lt_B : 1 < B := one_lt_mul (by linarith) hzd - have one_le_C : (1 : ℝ) ≤ 11 * (‖ζ (3 / 2)‖₊ / ‖ζ 3‖₊) := (one_lt_mul (by linarith) hzd).le + have one_lt_B : 1 < B := one_lt_mul (by linarith only [ht]) hzd + have one_le_C : (1 : ℝ) ≤ 11 * (‖ζ (3 / 2)‖₊ / ‖ζ 3‖₊) := (one_lt_mul (by + linarith only []) hzd).le have f0nonzero : ¬f 0 = 0 := by simp only [f, zero_add] exact riemannZeta_ne_zero_of_one_lt_re (by norm_num) @@ -1470,11 +1479,11 @@ theorem LogDerivZetaFinalBound {r' r R' R : ℝ} (r'_pos : 0 < r') (r'_lt_r : r' rw [← sq_le_one_iff₀ (norm_nonneg _), ← Complex.normSq_eq_norm_sq, Complex.normSq_apply] at hnorm intro hre him - have hre' : z.re = -(1/2 : ℝ) := by linarith - have him' : z.im = -t := by linarith + have hre' : z.re = -(1/2 : ℝ) := by linarith only [hre] + have him' : z.im = -t := by linarith only [him] simp only [hre', him', neg_mul_neg] at hnorm rw [← abs_two, ge_iff_le, ← sq_le_sq] at ht - nlinarith [hnorm, ht] + nlinarith only [hnorm, ht] have gAnalytic : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := by simp only [g_def, f, zero_add] intro z hz; rw [Metric.mem_closedBall, _root_.dist_zero_right] at hz @@ -1496,7 +1505,7 @@ theorem LogDerivZetaFinalBound {r' r R' R : ℝ} (r'_pos : 0 < r') (r'_lt_r : r' simp only [B_def, g_def, f, zero_add, Pi.div_apply, Complex.norm_div] rw [div_eq_mul_one_div] refine mul_le_mul (GlobalBound (le_trans hz' R_lt_one.le) ht) ?_ - (one_div_nonneg.mpr (norm_nonneg _)) (by linarith) + (one_div_nonneg.mpr (norm_nonneg _)) (by linarith only [ht]) rw [one_div_le (norm_pos_iff.mpr (riemannZeta_ne_zero_of_one_lt_re (by norm_num))), one_div, inv_div, ← toReal_coe_nnnorm, ENNReal.coe_toReal, ← NNReal.coe_div, ← nnnorm_div] · exact_mod_cast ZetaFixedLowerBound t @@ -1537,8 +1546,10 @@ theorem LogDerivZetaFinalBound {r' r R' R : ℝ} (r'_pos : 0 < r') (r'_lt_r : r' (add_nonneg (div_nonneg (mul_nonneg (ofNat_nonneg' _) (sq_nonneg _)) (pow_nonneg (sub_nonneg.mpr r'_lt_r.le) _)) (div_nonneg zero_le_one (mul_nonneg (sub_nonneg.mpr ?_) - (Real.log_nonneg ((one_le_div (by linarith)).mpr R'_lt_R.le))))) - rw [le_div_iff₀ (by linarith)]; nlinarith + (Real.log_nonneg ((one_le_div (by + linarith only [r'_pos, r'_lt_r, r_lt_R'])).mpr R'_lt_R.le))))) + rw [le_div_iff₀ (by linarith only [r'_pos, r'_lt_r, r_lt_R'])] + nlinarith only [r'_pos, r'_lt_r, r_lt_R', R'_lt_R] rw [add_mul, one_mul, div_mul_eq_mul_div, mul_div_assoc] suffices h2 : Real.log B ≤ Real.log |t| + Real.log (11 * (↑‖ζ (3 / 2)‖₊ / ↑‖ζ 3‖₊)) by exact le_trans h2 ((add_le_add_iff_left _).mpr (le_mul_of_one_le_right @@ -1547,7 +1558,8 @@ theorem LogDerivZetaFinalBound {r' r R' R : ℝ} (r'_pos : 0 < r') (r'_lt_r : r' rw [← Real.log_mul (by linarith) (by linarith), log_le_log_iff (by linarith) (mul_pos (by linarith) (by linarith))] simp only [← mul_assoc, B_def, coe_nnnorm] - exact mul_le_mul_of_nonneg_right (by linarith) (div_nonneg (norm_nonneg _) (norm_nonneg _)) + exact mul_le_mul_of_nonneg_right (by + linarith only [ht]) (div_nonneg (norm_nonneg _) (norm_nonneg _)) @@ -1572,21 +1584,21 @@ lemma ZetaShiftFiniteZeros {t : ℝ} (ht : |t| ≥ 2) have him : z.im = -t := by have := congr_arg Complex.im h; simp only [add_im, div_ofNat_im, im_ofNat, zero_div, mul_im, I_re, ofReal_im, mul_zero, I_im, ofReal_re, one_mul, zero_add, one_im] at this - linarith + linarith only [this] have abs_z_im := Complex.abs_im_le_norm z rw [him, abs_neg] at abs_z_im - linarith + linarith only [ht, hz, abs_z_im] have hfeq : Set.EqOn f 0 (Metric.ball (0 : ℂ) 2) := by refine AnalyticOnNhd.eqOn_zero_of_preconnected_of_mem_closure hfAnalytic Metric.isPreconnected_ball (z₀ := x) ?_ ?_ · simp only [Metric.mem_ball, Metric.mem_closedBall, dist_zero_right] at hxK ⊢ - linarith + linarith only [hxK] · simp only [mem_closure_iff_clusterPt, ← accPt_principal_iff_clusterPt] exact hacc.mono (principal_mono.mpr fun _ h => h.2) have hne : f 0 ≠ 0 := by simp only [hf, zero_add, ne_eq] exact riemannZeta_ne_zero_of_one_lt_re (by norm_num) - exact hne (hfeq (Metric.mem_ball_self (by linarith))) + exact hne (hfeq (Metric.mem_ball_self (by linarith only []))) @@ -1677,10 +1689,11 @@ lemma SumBoundI : have hz' : z ∈ Metric.closedBall (0 : ℂ) r' \ SetOfZeros R' f := by simp only [SetOfZeros, f, Set.mem_sdiff, Metric.mem_closedBall, dist_zero_right, mem_ofPred_eq, not_and] - refine ⟨le_of_lt (lt_trans hd' (by linarith)), fun _ => riemannZeta_ne_zero_of_one_lt_re ?_⟩ + refine ⟨le_of_lt (lt_trans hd' (by + linarith only [])), fun _ => riemannZeta_ne_zero_of_one_lt_re ?_⟩ simp only [add_re, div_ofNat_re, re_ofNat, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, sub_self, add_zero] - linarith [abs_lt.mp (lt_of_le_of_lt (Complex.abs_re_le_norm z) hd')] + linarith only [abs_lt.mp (lt_of_le_of_lt (Complex.abs_re_le_norm z) hd'), hd'] have LogDerivBound := LogDerivBound finiteZeros' z hz' refine le_trans (le_of_eq ?_) (LogDerivBound.trans (by rw [mul_assoc])) apply congrArg norm @@ -1752,12 +1765,12 @@ lemma ShiftTwoBound : intro δ hd t ht finiteZeros suffices h1 : -(ζ' (1 + δ + 2 * I * t) / ζ (1 + δ + 2 * I * t)).re ≤ C * log |2 * t| by refine le_trans h1 ?_ - rw [mul_assoc C, abs_mul, Real.log_mul (by norm_num) (by linarith [ht]), two_mul] + rw [mul_assoc C, abs_mul, Real.log_mul (by norm_num) (by linarith only [ht]), two_mul] exact mul_le_mul (by rfl) (add_le_add (log_le_log (by norm_num) (by norm_num [ht])) (by rfl)) - (add_nonneg (Real.log_nonneg (by norm_num)) (Real.log_nonneg (by linarith [ht]))) hC.le + (add_nonneg (Real.log_nonneg (by norm_num)) (Real.log_nonneg (by linarith only [ht]))) hC.le have ht' : |2 * t| ≥ 2 := by simp only [abs_mul, abs_ofNat, ofNat_pos, le_mul_iff_one_le_right] - linarith + linarith only [ht] have SumBound := SumBound δ hd _ ht' finiteZeros; rw [← Complex.norm_neg', neg_sub] at SumBound refine le_trans ?_ (le_trans (Complex.re_le_norm _) SumBound) simp only [ofReal_mul, ofReal_ofNat, sub_re, re_sum, ← mul_assoc, mul_comm] @@ -1771,7 +1784,7 @@ lemma ShiftTwoBound : ofReal_im, mul_zero, sub_self, re_ofNat, mul_im, ← sq, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, one_mul, zero_add, im_ofNat, add_zero, normSq_apply, sub_im, add_im, one_im, natCast_im, zero_div] - exact div_nonneg (mul_nonneg (cast_nonneg' _) (by linarith [hd.1])) + exact div_nonneg (mul_nonneg (cast_nonneg' _) (by linarith only [hd.1, hρ_re, hd])) (add_nonneg (sq_nonneg _) (sq_nonneg _)) @@ -1839,7 +1852,7 @@ lemma ShiftOneBound : t = ρ.im → -(ζ' (1 + δ + I * t) / ζ (1 + δ + I * t)).re ≤ C * Real.log |t| - 1 / (1 + δ - ρ.re) := by obtain ⟨C, hC, SumBound⟩ := SumBoundI - refine ⟨7 + C, by linarith, ?_⟩ + refine ⟨7 + C, by linarith only [hC], ?_⟩ intro δ hd t ht finiteZeros ρ hρzero hρim have SumBound := SumBound δ hd t ht finiteZeros; rw [← Complex.norm_neg', neg_sub] at SumBound have SumBound := le_trans (Complex.re_le_norm _) SumBound @@ -1858,9 +1871,9 @@ lemma ShiftOneBound : refine div_nonneg (mul_nonneg (by positivity) ?_) (normSq_nonneg _) by_contra h; push Not at h simp only [ZeroWindow, Finite.mem_toFinset, mem_ofPred_eq] at hρ' - exact riemannZeta_ne_zero_of_one_le_re (by linarith [hd.1]) hρ'.1 + exact riemannZeta_ne_zero_of_one_le_re (by linarith only [hd.1, h, hd]) hρ'.1 by_cases hρZt : ρ ∈ finiteZeros.toFinset - · have obvious : C * log |t| ≤ (7 + C) * log |t| := mul_le_mul (by linarith) (by rfl) + · have obvious : C * log |t| ≤ (7 + C) * log |t| := mul_le_mul (by linarith only []) (by rfl) (Real.log_nonneg (by linarith)) (by linarith) have SumBound := le_trans SumBound obvious rw [← Finset.insert_erase hρZt, ← Finset.singleton_union, ← Finset.sdiff_singleton_eq_erase, @@ -1873,7 +1886,7 @@ lemma ShiftOneBound : ← one_div] at SumBound refine le_sub_left_of_add_le (le_trans (add_le_add ?_ ?_) SumBound) · rw [← mul_div_assoc, mul_one] - refine div_le_div_of_nonneg_right ?_ (by linarith [hd.1]) + refine div_le_div_of_nonneg_right ?_ (by linarith only [hd.1, hρre, hd]) simp only [one_le_cast, Nat.one_le_iff_ne_zero, analyticOrderNatAt, ne_eq, ENat.toNat_eq_zero, analyticOrderAt_eq_zero, analyticOrderAt_eq_top, not_or, not_not] refine ⟨⟨DifferentiableOn.analyticAt (s := {z : ℂ | z ≠ 1}) @@ -1896,7 +1909,7 @@ lemma ShiftOneBound : exact Finset.sum_nonneg (fun ρ' hρ' => hTermNonneg hρ') have invBound : 1 / (1 + δ - ρ.re) ≤ 7 * Real.log |t| := by suffices h1 : 1 / (1 + δ - ρ.re) ≤ 4 by - have explicitEstimate : 4 ≤ 7 * Real.log 2 := by linarith [Real.log_two_gt_d9] + have explicitEstimate : 4 ≤ 7 * Real.log 2 := by linarith only [Real.log_two_gt_d9] exact le_trans h1 (le_trans explicitEstimate ((mul_le_mul_iff_of_pos_left ofNat_pos').mpr (Real.log_le_log ofNat_pos' ht))) simp only [ZeroWindow, Finite.mem_toFinset, mem_ofPred_eq, hρzero, true_and, not_le] at hρZt @@ -1906,9 +1919,9 @@ lemma ShiftOneBound : simp only [ofReal_sub, ofReal_div, ofReal_ofNat, neg_add_eq_sub, neg_div, neg_add_eq_sub] rw [this, Complex.norm_real, Real.norm_eq_abs] at hρZt have hρreImproved : ρ.re < 3 / 4 := by rcases lt_abs.mp hρZt with _ | _ <;> linarith - rw [one_div_le (by linarith [hd.1]) four_pos] - linarith [hd.1] - linarith + rw [one_div_le (by linarith only [hd.1, hρre, hd]) four_pos] + linarith only [hd.1, hρreImproved, hd] + linarith only [logBound, invBound] @@ -1942,7 +1955,7 @@ lemma ShiftZeroBound : simp only [mem_inter_iff, Metric.mem_ball, dist_self_add_left, norm_real, norm_eq_abs, mem_compl_iff, mem_singleton_iff, add_eq_left, ofReal_eq_zero, abs_lt] exact ⟨⟨by linarith [δrange.1], by linarith [δrange.2, min_le_left ε (1 / 2)]⟩, - by linarith [δrange.1]⟩ + by linarith only [δrange.1, δrange]⟩ have reBound := (Complex.re_le_norm _).trans (hε δin) simp only [Pi.sub_apply, Pi.div_apply, Pi.neg_apply, add_sub_cancel_left, sub_re, inv_re, ofReal_re, normSq_ofReal, div_self_mul_self', Pi.one_apply, norm_one, mul_one, @@ -1964,14 +1977,14 @@ lemma ShiftZeroBound : (ContinuousOn.div continuousOn_const continuousOn_id ?_)) · simp only [MapsTo, mem_Icc, mem_compl_iff, mem_singleton_iff, add_eq_left, ofReal_eq_zero, and_imp] - exact fun x hx _ => by linarith [rIn.1, hx] + exact fun x hx _ => by linarith only [rIn.1, hx, rIn] · simp only [MapsTo, mem_Icc, mem_compl_iff, mem_singleton_iff, add_eq_left, ofReal_eq_zero, and_imp] - exact fun x hx _ => by linarith [rIn.1, hx] + exact fun x hx _ => by linarith only [rIn.1, hx, rIn] · simp only [add_re, one_re, ofReal_re, lt_add_iff_pos_right] - linarith [rIn.1, hx.1] + linarith only [rIn.1, hx.1, rIn, hx] · simp only [ne_eq] - exact fun x hx => by linarith [rIn.1, hx.1] + exact fun x hx => by linarith only [rIn.1, hx.1, rIn, hx] obtain ⟨C₁, boundCompact⟩ := ShiftZeroBoundCompact refine ⟨1 + max |C₀| |C₁|, ?_, fun δ δrange => ?_⟩ · simp only [ge_iff_le, le_add_iff_nonneg_right, le_sup_iff, abs_nonneg, or_self] @@ -1979,12 +1992,12 @@ lemma ShiftZeroBound : · have δIn : δ ∈ Ioo 0 r := by simp only [mem_Ioo, δrange.1, δ_lt_r, and_self] apply le_trans (boundNear δ δIn) simp only [one_div, add_le_add_iff_left] - linarith [le_abs_self C₀, le_max_left |C₀| |C₁|] + linarith only [le_abs_self C₀, le_max_left |C₀| |C₁|] · have δIn : δ ∈ Icc r 1 := by simp only [mem_Icc, δrange.2.le, ← not_lt, δ_lt_r, not_false_eq_true, and_self] apply le_trans (boundCompact δ δIn) simp only [one_div, add_le_add_iff_left] - linarith [le_abs_self C₁, le_max_right |C₀| |C₁|] + linarith only [le_abs_self C₁, le_max_right |C₀| |C₁|] @@ -2028,22 +2041,22 @@ lemma ZeroWindowFinite {t : ℝ} (ht : |t| ≥ 2) : (ZeroWindow t).Finite := by simp only [gt_iff_lt, lt_abs] by_cases tpos : 0 < t · rw [abs_of_pos tpos] at ht - exact Or.inl (by linarith) + exact Or.inl (by linarith only [ht, this]) · rw [abs_of_nonpos (not_lt.mp tpos)] at ht - exact Or.inr (by linarith) + exact Or.inr (by linarith only [ht, this]) refine analyticAt_riemannZeta (fun h => ?_) simp only [h, one_im, gt_iff_lt, abs_zero] at him - linarith + linarith only [him] have hfeq : Set.EqOn ζ 0 (Metric.ball (3 / 2 + I * t) 1) := by refine AnalyticOnNhd.eqOn_zero_of_preconnected_of_mem_closure hfAnalytic Metric.isPreconnected_ball (z₀ := x) ?_ ?_ · simp only [Metric.mem_ball, Metric.mem_closedBall] at hxK ⊢ - linarith + linarith only [hxK] · simp only [mem_closure_iff_clusterPt, ← accPt_principal_iff_clusterPt] refine hacc.mono (principal_mono.mpr fun _ h => h.1) have hne : ζ (3 / 2 + I * t) ≠ 0 := by exact riemannZeta_ne_zero_of_one_lt_re (by norm_num) - exact hne (hfeq (Metric.mem_ball_self (by linarith))) + exact hne (hfeq (Metric.mem_ball_self (by linarith only []))) @@ -2093,18 +2106,20 @@ theorem ZeroInequality : ∃ (E : ℝ), E ∈ Ioo (0 : ℝ) (1 / 14 : ℝ) ∧ obtain ⟨C, Cpos, ShiftTwo⟩ := ShiftTwoBound set D : ℝ := 5 * A + 4 * B + C with D_def set E : ℝ := (14 * D)⁻¹ with E_def - have Dge1 : 1 ≤ D := by linarith + have Dge1 : 1 ≤ D := by linarith only [Age, Bpos, Cpos] refine ⟨E, ⟨?_, ?_⟩, fun ρ hρzero σ ρre t ρim ht => ?_⟩ · rw [E_def, mul_inv_rev, mul_pos_iff_of_pos_right (inv_pos.mpr ofNat_pos'), inv_pos] - linarith + linarith only [Age, Bpos, Cpos] · rw [E_def, one_div, inv_lt_inv₀ (by linarith) (by linarith)] - linarith + linarith only [Age, Bpos, Cpos] · set δ : ℝ := 1 / (2 * D * Real.log |t|) with δ_def have δrange : δ ∈ Ioo 0 1 := by simp only [mem_Ioo, δ_def, one_div_pos] - rw [div_lt_one (by nlinarith [Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9])] - exact ⟨by nlinarith [Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9], - by nlinarith [Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9]⟩ + rw [div_lt_one (by + nlinarith only [Dge1, Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9])] + exact ⟨by + nlinarith only [Dge1, Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9], by + nlinarith only [Dge1, Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9]⟩ have hugeEq : 3 * (-ζ' (1 + δ) / ζ (1 + δ)) + 4 * (-ζ' (1 + δ + I * t) / ζ (1 + δ + I * t)) + @@ -2191,7 +2206,7 @@ theorem ZeroInequality : ∃ (E : ℝ), E ∈ Ioo (0 : ℝ) (1 / 14 : ℝ) ∧ have ZeroWindowTwoFinite : (ZeroWindow (2 * t)).Finite := by apply ZeroWindowFinite simp only [abs_mul, abs_ofNat, ge_iff_le, ofNat_pos, le_mul_iff_one_le_right] - linarith + linarith only [ht] have ShiftZero := ShiftZero δ δrange have ShiftOne := ShiftOne δ δrange t ht ZeroWindowOneFinite ρ hρzero ρim have ShiftTwo := ShiftTwo δ δrange t ht ZeroWindowTwoFinite @@ -2203,17 +2218,17 @@ theorem ZeroInequality : ∃ (E : ℝ), E ∈ Ioo (0 : ℝ) (1 / 14 : ℝ) ∧ (Real.log_ne_zero_of_pos_of_ne_one (by linarith) (by linarith))] at h1 rw [E_def, ← inv_mul', le_sub_comm, inv_le_iff_one_le_mul₀' (mul_pos (by linarith) (Real.log_pos (by linarith)))] - linarith + linarith only [h1] · rw [add_sub_right_comm] apply add_pos_of_nonneg_of_pos · by_contra hσ; simp only [sub_nonneg, not_le, ρre] at hσ exact (riemannZeta_ne_zero_of_one_lt_re hσ) hρzero - · exact mul_pos (inv_pos.mpr (Real.log_pos (by linarith))) (by positivity) + · exact mul_pos (inv_pos.mpr (Real.log_pos (by linarith only [ht]))) (by positivity) suffices h2 : 0 ≤ 3 / δ + 3 * A - 4 / (1 + δ - σ) + 4 * B * Real.log |t| + C * Real.log |t| by simp only [sub_eq_neg_add, add_assoc, le_neg_add_iff_add_le, add_zero, ge_iff_le] at ⊢ h2 apply le_trans h2 simp only [← add_assoc, D_def, add_mul, add_le_add_iff_right, add_le_add_iff_left] - nlinarith [Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9] + nlinarith only [Age, Real.log_le_log zero_lt_two ht, Real.log_two_gt_d9] calc 0 ≤ 2 * ∑' (n : ℕ), Λ (n) * n ^ (-1 - δ) * (1 + Real.cos (-t * Real.log n)) ^ 2 := by rw [mul_nonneg_iff_of_pos_left two_pos] exact tsum_nonneg (fun n => mul_nonneg (mul_nonneg ArithmeticFunction.vonMangoldt_nonneg @@ -2262,7 +2277,7 @@ lemma DeltaRange : ∀ (t : ℝ), |t| ≥ 2 → DeltaT t < (1 : ℝ) / 9 := by intro t ht - rw [DeltaT, div_lt_div_iff₀ (Real.log_pos (by linarith)) (ofNat_pos'), one_mul] + rw [DeltaT, div_lt_div_iff₀ (Real.log_pos (by linarith only [ht])) (ofNat_pos'), one_mul] exact lt_of_lt_of_le (by linarith [EinIoo.2, Real.log_two_gt_d9]) (Real.log_le_log zero_lt_two ht) @@ -2336,7 +2351,8 @@ lemma SumBoundII : suffices h1 : 1 - E / Real.log |t| < 1 - DeltaT t / 3 by linarith [hzRe.1, ZeroInequalitySpec z zZetaZero z.re rfl t hzIm ht] simp only [DeltaT, sub_lt_sub_iff_left] - exact _root_.div_lt_self (_root_.div_pos EinIoo.1 (Real.log_pos (by linarith))) one_lt_ofNat + exact _root_.div_lt_self (_root_.div_pos EinIoo.1 (Real.log_pos (by + linarith only [ht]))) one_lt_ofNat have LogDerivBound := LogDerivBound finiteZeros' Z hZ' refine le_trans (le_of_eq ?_) (LogDerivBound.trans (by rw [mul_assoc])) apply congrArg norm @@ -2393,18 +2409,19 @@ lemma GapSize (t : ℝ) (ht : |t| ≥ 3) exact h.trans hρ.2 have ρImAbsUpperBound : Real.log |ρ.im| ≤ 2 * Real.log |t| := by have moveTwo : Real.log (2 * |t|) ≤ 2 * Real.log |t| := by - rw [← Real.log_rpow (by linarith)] + rw [← Real.log_rpow (by linarith only [ht])] have := mul_le_mul_of_nonneg_right ht (abs_nonneg t); rw [← sq, ← Real.rpow_two] at this exact Real.log_le_log (by linarith) (by linarith) - refine le_trans (Real.log_le_log (by linarith) ?_) moveTwo - linarith [abs_sub_abs_le_abs_sub ρ.im t] + refine le_trans (Real.log_le_log (by linarith only [ht, this, ρImDiffBound]) ?_) moveTwo + linarith only [abs_sub_abs_le_abs_sub ρ.im t, ht, ρImDiffBound] have deltaRelation : DeltaT t ≤ 2 * (DeltaT ρ.im) := by simp only [DeltaT, mul_div, mul_comm] rw [div_le_div_iff₀ (Real.log_pos (by linarith)) (Real.log_pos (by linarith)), mul_assoc] - nlinarith [EinIoo.1, EinIoo.2] - have hρRe := ZeroInequalitySpec ρ hρ.1 ρ.re rfl ρ.im rfl (by linarith); rw [← DeltaT] at hρRe - calc DeltaT t / 6 ≤ (1 - DeltaT t / 3) - (1 - DeltaT ρ.im) := by linarith - _ ≤ z.re - ρ.re := by linarith [hzRe.1, hρRe] + nlinarith only [EinIoo.1, EinIoo.2, ρImAbsUpperBound] + have hρRe := ZeroInequalitySpec ρ hρ.1 ρ.re rfl ρ.im rfl (by + linarith only [ht, this, ρImDiffBound]); rw [← DeltaT] at hρRe + calc DeltaT t / 6 ≤ (1 - DeltaT t / 3) - (1 - DeltaT ρ.im) := by linarith only [deltaRelation] + _ ≤ z.re - ρ.re := by linarith only [hzRe.1, hρRe, hzRe] _ = (z - ρ).re := by rw [Complex.sub_re] _ ≤ ‖z - ρ‖ := Complex.re_le_norm _ @@ -2461,10 +2478,10 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) have d_gt_one : 1 < d := by simp only [hd, Complex.norm_div, Complex.norm_mul, Complex.norm_ofNat] rw [one_lt_div] - · refine mul_lt_mul (by linarith) ?_ ?_ (ofNat_nonneg' _) + · refine mul_lt_mul (by linarith only []) ?_ ?_ (ofNat_nonneg' _) · have ζNormLe := norm_zeta_strict_mono_ofReal (a := 3) (b := (3 / 2)) simp only [half_lt_self_iff, ofNat_pos, ofReal_ofNat, ofReal_div, forall_const] at ζNormLe - refine le_of_lt (ζNormLe (by linarith)) + refine le_of_lt (ζNormLe (by linarith only [])) · simp only [norm_pos_iff, ne_eq] exact riemannZeta_ne_zero_of_one_lt_re (by norm_num) · simp only [ofNat_pos, mul_pos_iff_of_pos_left, norm_pos_iff, ne_eq] @@ -2478,7 +2495,7 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) · rw [one_div_pos] exact Real.log_pos (by norm_num) · rw [one_lt_div ofNat_pos'] - linarith + linarith only [] refine ⟨E / 3, rfl, ⟨6 * D / E + C, add_pos (mul_pos (mul_pos ofNat_pos' Dpos) (inv_pos.mpr EinIoo.1)) Cpos, ?_⟩⟩ intro t ht σ hσ @@ -2505,17 +2522,18 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) I_re, ofReal_im, mul_zero, I_im, ofReal_re, one_mul, zero_add, one_im] at hIm rw [add_eq_zero_iff_eq_neg] at hIm have h := Complex.abs_im_le_norm z; rw [hIm, abs_neg] at h - linarith + linarith only [ht, hz, h] have zetaThreeHalfNonzero : ¬ζ (3 / 2 + I * ↑t) = 0 := by exact riemannZeta_ne_zero_of_one_lt_re (by norm_num) have f0_1 : f 0 = 1 := by simp only [hg, hf, zero_add, div_self_eq_one₀, ne_eq, zetaThreeHalfNonzero, not_false_eq_true] have finiteSetOf0s : (SetOfZeros 1 f).Finite := by - have gFiniteSetOf0s := ZetaShiftFiniteZeros (t := t) (by linarith) hg + have gFiniteSetOf0s := ZetaShiftFiniteZeros (t := t) (by + linarith only [ht, r_pos, r_lt_R, R_lt_one]) hg simp only [SetOfZeros, hf, div_eq_zero_iff, zetaThreeHalfNonzero, or_false] at gFiniteSetOf0s ⊢ exact gFiniteSetOf0s have rFinite0s:= finiteSetOfZeros_mono r_lt_one finiteSetOf0s - have finite0s := ZeroWindowFinite (t := t) (by linarith) + have finite0s := ZeroWindowFinite (t := t) (by linarith only [ht, r_pos, r_lt_R, R_lt_one]) have fz_bound : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B := by intro z hz simp only [hf, hg, Complex.norm_div, hB, hd, Complex.norm_mul, Complex.norm_ofNat] @@ -2569,7 +2587,7 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) have h := Complex.abs_im_le_norm (-1 / 2 - I * t); simp only [sub_im, div_ofNat_im, neg_im, one_im, neg_zero, zero_div, mul_im, I_re, ofReal_im, mul_zero, I_im, ofReal_re, one_mul, zero_add, zero_sub, abs_neg] at h - linarith + linarith only [ht, hzBound, h] set z : ℂ := σ + t * I with hz have zIm : t = z.im := by simp only [hz, add_im, ofReal_im, mul_im, ofReal_re, I_im, mul_one, I_re, mul_zero, add_zero, @@ -2580,7 +2598,7 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) have one_le_logt : 1 ≤ Real.log |t| := by rw [← Real.log_exp 1] apply Real.log_le_log (Real.exp_pos _) - linarith [Real.exp_one_lt_three] + linarith only [Real.exp_one_lt_three, ht] calc ‖ζ' z / ζ z‖ ≤ _ := norm_le_norm_sub_add _ (∑ ρ ∈ finite0s.toFinset, analyticOrderNatAt ζ ρ / (z - ρ)) _ ≤ ‖∑ ρ ∈ finite0s.toFinset, ↑(analyticOrderNatAt ζ ρ) / (z - ρ)‖ + C * Real.log |t| := by @@ -2598,7 +2616,7 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) refine div_le_div_of_nonneg_left (cast_nonneg' _) ?_ (GapSize t ht z zRe ρ hρ) simp only [DeltaT, ofNat_pos, div_pos_iff_of_pos_right] refine _root_.div_pos EinIoo.1 (Real.log_pos ?_) - linarith + linarith only [ht, r_pos, r_lt_R, R_lt_one] _ ≤ 6 * D / E * Real.log |t| ^ 2 + C * Real.log |t| := by simp only [DeltaT, add_le_add_iff_right, ← div_mul, mul_comm] field_simp @@ -2606,7 +2624,7 @@ lemma LogDerivZetaUniformLogSquaredBoundStrip : ∃ (F : ℝ) (_ : F = E / 3) _ ≤ _ := by simp only [add_mul, add_le_add_iff_left] refine mul_le_mul_of_nonneg_left ?_ Cpos.le - nlinarith [one_le_logt] + nlinarith only [one_le_logt] @@ -2615,7 +2633,7 @@ noncomputable def F : ℝ := LogDerivZetaUniformLogSquaredBoundStrip.choose lemma Fequ : F = E / 3 := LogDerivZetaUniformLogSquaredBoundStrip.choose_spec.1 lemma FinIoo : F ∈ Ioo (0 : ℝ) (1 / 42 : ℝ) := by simp only [one_div, Fequ, mem_Ioo, EinIoo.1, div_pos_iff_of_pos_left, ofNat_pos, true_and] - linarith [EinIoo.2] + linarith only [EinIoo.2] lemma LogDerivZetaUniformLogSquaredBoundStripSpec : ∃ (C : ℝ) (_ : 0 < C), ∀ (t : ℝ), 3 ≤ |t| → ∀ (σ : ℝ), σ ∈ Set.Icc (1 - F / Real.log |t|) (3 / 2) → @@ -2693,19 +2711,19 @@ theorem LogDerivZetaUniformLogSquaredBound : ∃ (C : ℝ) (_ : 0 < C), · exact le_max_left _ _ · simp only [log_abs, rpow_ofNat, Std.le_refl] · refine (hC2 _ ?_).trans ?_ - · norm_num; linarith + · norm_num; linarith only [hσ'] · nth_rewrite 1 [← mul_one C2, ← mul_one 1, ← sq] refine mul_le_mul (le_max_right _ _) ?_ (sq_nonneg _) ?_ · rw [one_pow, rpow_ofNat, one_le_sq_iff_one_le_abs, abs_of_pos (Real.log_pos (by linarith)), Real.le_log_iff_exp_le (by linarith)] - linarith [Real.exp_one_lt_d9] - · linarith [le_max_right C1 C2] + linarith only [Real.exp_one_lt_d9, ht] + · linarith only [le_max_right C1 C2, hC2pos] /-- A wrapper for the above theorem -/ lemma LogDerivZetaBndUnif12 : LogDerivZetaBndUnifGenProp 1 2 := by - refine ⟨F, ⟨FinIoo.1, by linarith [FinIoo.2]⟩, ?_⟩ + refine ⟨F, ⟨FinIoo.1, by linarith only [FinIoo.2]⟩, ?_⟩ simp only [rpow_one] apply LogDerivZetaUniformLogSquaredBound @@ -2714,15 +2732,15 @@ lemma LogDerivZetaBndUnif12 : LogDerivZetaBndUnifGenProp 1 2 := by -- analouge from ZetaBounds lemma ZetaZeroFree1 : ZetaZeroFreeGenProp 1 := by - refine ⟨F, ⟨FinIoo.1, by linarith [FinIoo.2]⟩, ?_⟩ + refine ⟨F, ⟨FinIoo.1, by linarith only [FinIoo.2]⟩, ?_⟩ intro σ t ht hσ by_contra h have ZeroInequalityThing := ZeroInequalitySpec (σ + t * I) h simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add, ge_iff_le, forall_eq] at ZeroInequalityThing have contra := hσ.1; rw [Fequ] at contra - have contra := le_trans contra (ZeroInequalityThing (by linarith)) - have log_pos : 0 < Real.log |t| := by exact Real.log_pos (by linarith) + have contra := le_trans contra (ZeroInequalityThing (by linarith only [ht])) + have log_pos : 0 < Real.log |t| := by exact Real.log_pos (by linarith only [ht]) rw [rpow_one, sub_le_sub_iff_left, div_div, div_le_div_iff_of_pos_left EinIoo.1 log_pos (mul_pos three_pos (Real.log_pos (lt_trans one_lt_ofNat ht)))] at contra linarith diff --git a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ZetaBounds.lean b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ZetaBounds.lean index a219171358..6234cfda7e 100644 --- a/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ZetaBounds.lean +++ b/LeanPool/IwaniecLinearSieve/Vendor/PrimeNumberTheoremAnd/ZetaBounds.lean @@ -664,7 +664,7 @@ lemma sum_eq_int_deriv {φ : ℝ → ℂ} {a b : ℝ} (apos : 0 ≤ a) (a_lt_b : rw [← intervalIntegral.integral_neg] refine intervalIntegral.integral_congr fun x hx ↦ ?_ rw [uIcc_of_le a_lt_b.le, mem_Icc] at hx - rw [← Int.natCast_floor_eq_floor (by linarith)] + rw [← Int.natCast_floor_eq_floor (by linarith only [apos, hx])] norm_cast push_cast ring @@ -673,7 +673,7 @@ lemma sum_eq_int_deriv {φ : ℝ → ℂ} {a b : ℝ} (apos : 0 ≤ a) (a_lt_b : lemma xpos_of_uIcc {a b : ℕ} (ha : a ∈ Ioo 0 b) {x : ℝ} (x_in : x ∈ [[(a : ℝ), b]]) : 0 < x := by rw [uIcc_of_le (by exact_mod_cast ha.2.le), mem_Icc] at x_in - linarith [(by exact_mod_cast ha.1 : (0 : ℝ) < a)] + linarith only [(by exact_mod_cast ha.1 : (0 : ℝ) < a), x_in, ha] lemma ZetaSum_aux1₁ {a b : ℕ} {s : ℂ} (s_ne_one : s ≠ 1) (ha : a ∈ Ioo 0 b) : (∫ (x : ℝ) in a..b, 1 / (x : ℂ) ^ s) = @@ -737,7 +737,7 @@ lemma ZetaSum_aux1 {a b : ℕ} {s : ℂ} (s_ne_one : s ≠ 1) (s_ne_zero : s ≠ have φderiv : ∀ x ∈ [[(a : ℝ), b]], deriv φ x = φ' x := by exact fun x hx ↦ ZetaSum_aux1φderiv s_ne_zero (xpos x hx) have derivφCont : ContinuousOn (deriv φ) [[a, b]] := ZetaSum_aux1derivφCont s_ne_zero ha - convert sum_eq_int_deriv (by linarith) (by exact_mod_cast ha.2) φDiff derivφCont using 1 + convert sum_eq_int_deriv (by linarith only []) (by exact_mod_cast ha.2) φDiff derivφCont using 1 · congr <;> simp only [Nat.floor_natCast] · rw [Nat.floor_natCast, Nat.floor_natCast, ← intervalIntegral.integral_const_mul] simp_rw [mul_div, ← mul_div, φ, ZetaSum_aux1₁ s_ne_one ha] @@ -866,11 +866,11 @@ lemma finsetSum_tendsto_tsum {N : ℕ} {f : ℕ → ℂ} (hf : Summable f) : filter_upwards [Filter.mem_atTop (N + 1)] intro M hM rw [Finset.sum_Ico_eq_sub] - linarith + linarith only [hM] lemma _root_.Complex.cpow_tendsto {s : ℂ} (s_re_gt : 1 < s.re) : Tendsto (fun (x : ℕ) ↦ (x : ℂ) ^ (1 - s)) atTop (𝓝 0) := by - have one_sub_s_re_ne : (1 - s).re ≠ 0 := by simp only [sub_re, one_re]; linarith + have one_sub_s_re_ne : (1 - s).re ≠ 0 := by simp only [sub_re, one_re]; linarith only [s_re_gt] rw [tendsto_zero_iff_norm_tendsto_zero] simp_rw [Complex.norm_natCast_cpow_of_re_ne_zero _ (one_sub_s_re_ne)] rw [(by simp only [sub_re, one_re, neg_sub] : (1 - s).re = - (s - 1).re)] @@ -922,7 +922,7 @@ lemma ZetaSum_aux2 {N : ℕ} (N_pos : 0 < N) {s : ℂ} (s_re_gt : 1 < s.re) : ∑' (n : ℕ), 1 / (n + N + 1 : ℂ) ^ s = (- N ^ (1 - s)) / (1 - s) - N ^ (-s) / 2 + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) := by - have s_ne_zero : s ≠ 0 := fun hs ↦ by linarith [zero_re ▸ hs ▸ s_re_gt] + have s_ne_zero : s ≠ 0 := fun hs ↦ by linarith only [zero_re ▸ hs ▸ s_re_gt, s_re_gt, hs] have s_ne_one : s ≠ 1 := fun hs ↦ (lt_self_iff_false _).mp <| one_re ▸ hs ▸ s_re_gt apply tendsto_nhds_unique (X := ℂ) (Y := ℕ) (l := atTop) (f := fun k ↦ ((k : ℂ) ^ (1 - s) - (N : ℂ) ^ (1 - s)) / (1 - s) + @@ -969,7 +969,7 @@ lemma ZetaBnd_aux1b (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (σpos : 0 < σ) : simp only [id_eq, intervalIntegral.integral_of_le hu, norm_div] apply setIntegral_congr_fun (by simp) intro x hx; beta_reduce - iterate 2 (rw [norm_cpow_eq_rpow_re_of_pos (by linarith [hx.1])]) + iterate 2 (rw [norm_cpow_eq_rpow_re_of_pos (by linarith only [hx.1, hx])]) simp · apply IntegrableOn.integrable ?_ |>.norm convert! integrableOn_of_Zeta0_fun (s := σ + t * I) Npos (by simp [σpos]) using 1 @@ -979,7 +979,8 @@ lemma ZetaBnd_aux1b (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (σpos : 0 < σ) : have : (N ^ (-σ) - t ^ (-σ)) / σ ≤ N ^ (-σ) / σ := div_le_div_iff_of_pos_right σpos |>.mpr (by simp [Real.rpow_nonneg (by linarith)]) apply le_trans ?_ this - convert! ZetaBnd_aux1a (a := N) (b := t) (by positivity) (by linarith) ?_ <;> simp [σpos] + convert! ZetaBnd_aux1a (a := N) (b := t) (by positivity) (by + linarith only [ht]) ?_ <;> simp [σpos] /- For any $N\ge1$ and $s = \sigma + tI \in \C$, $\sigma=\in(0,2], 2 < |t|$, @@ -998,7 +999,7 @@ lemma ZetaBnd_aux1 (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (hσ : σ ∈ Ioc 0 2 refine le_trans (by apply norm_add_le) ?_ simp only [Complex.norm_of_nonneg hσ.1.le, Complex.norm_mul, norm_real, Real.norm_eq_abs, norm_I, mul_one] - linarith [hσ.2] + linarith only [hσ.2, hσ, ht] /- Big-Oh version of Lemma \ref{ZetaBnd_aux1}. @@ -1023,7 +1024,7 @@ lemma ZetaBnd_aux1p (N : ℕ) (Npos : 1 ≤ N) {σ : ℝ} (hσ : σ ∈ Ioc 0 2) rw [norm_norm, norm_mul, mul_div_assoc, norm_mul] have : 2 * (‖|t|‖ * ‖↑N ^ (-σ) / σ‖) = (2 * |t|) * ((N : ℝ) ^ (-σ) / σ) := by simp only [Real.norm_eq_abs, _root_.abs_abs, norm_div] - have : σ ≠ 0 := by linarith [hσ.1] + have : σ ≠ 0 := by linarith only [hσ.1, hσ] field_simp rw [abs_of_pos hσ.1] have : 0 < (N : ℝ) ^ (-σ) := by @@ -1035,7 +1036,7 @@ lemma ZetaBnd_aux1p (N : ℕ) (Npos : 1 ≤ N) {σ : ℝ} (hσ : σ ∈ Ioc 0 2) apply mul_le_mul ?_ (ZetaBnd_aux1b N Npos hσ.1) (norm_nonneg _) (by positivity) refine le_trans (by apply norm_add_le) ?_ simp only [norm_real, norm_mul, norm_I, mul_one, Complex.norm_of_nonneg hσ.1.le, Real.norm_eq_abs] - linarith [hσ.2] + linarith only [hσ.2, ht, hσ] lemma isOpen_aux : IsOpen {z : ℂ | z ≠ 1 ∧ 0 < z.re} := by refine IsOpen.inter isOpen_ne ?_ @@ -1051,30 +1052,15 @@ lemma integrable_log_over_pow {r : ℝ} (rneg : r < 0) {N : ℕ} (Npos : 0 < N) intro x hx; left; contrapose! Npos with h; exact_mod_cast h ▸ mem_Ici.mp hx · apply continuous_id.continuousOn.log ?_ |>.abs intro x hx; simp only [id_eq]; contrapose! Npos with h; exact_mod_cast h ▸ mem_Ici.mp hx - · have := isLittleO_log_rpow_atTop (r := -r / 2) (by linarith) |>.isBigO - rw [Asymptotics.isBigO_iff_eventually, Filter.eventually_atTop] at this - obtain ⟨C, hC⟩ := this - have hh := hC C (by simp) - rw [Asymptotics.isBigO_atTop_iff_eventually_exists] - have := Filter.eventually_atTop.mp hh - obtain ⟨x₀, hx₀ ⟩ := this - filter_upwards [hh, Filter.mem_atTop x₀, Filter.mem_atTop 1] - intro x hx x_gt x_pos - use C - intro y hy - simp only [norm_mul, Real.norm_eq_abs, _root_.abs_abs] - simp only [Real.norm_eq_abs] at hx - have y_pos : 0 < y := by linarith - have : y ^ (r / 2 - 1) = y ^ (r - 1) * y ^ (-r / 2) := by - rw [← Real.rpow_add y_pos]; ring_nf - rw [this, abs_mul] - have y_gt : y ≥ x₀ := by linarith - have := hx₀ y y_gt - simp only [Real.norm_eq_abs] at this - rw [← mul_assoc, mul_comm C, mul_assoc] - exact mul_le_mul_of_nonneg_left (hbc := this) (a := |y ^ (r - 1)|) (ha := by simp) + · have hlog := (isLittleO_log_rpow_atTop (r := -r / 2) (by linarith only [rneg])).isBigO + have h := ((isBigO_refl (fun x : ℝ ↦ x ^ (r - 1)) atTop).mul hlog).norm_left + refine h.congr' (Eventually.of_forall fun x ↦ norm_mul _ _) ?_ + filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx + rw [← Real.rpow_add hx] + congr 1 + ring · have := integrableOn_Ioi_rpow_iff (s := r / 2 - 1) (t := N) (by simp [Npos]) |>.mpr - (by linarith [rneg]) + (by linarith only [rneg]) exact integrableOn_Ioi_iff_integrableAtFilter_atTop_nhdsWithin.mp this |>.1 open MeasureTheory in @@ -1090,17 +1076,17 @@ lemma integrableOn_of_Zeta0_fun_log {N : ℕ} (Npos : 0 < N) {s : ℂ} (s_re_gt · intro x hx apply ContinuousWithinAt.cpow ?_ continuous_const.continuousWithinAt ?_ · exact RCLike.continuous_ofReal.continuousWithinAt - · simp only [ofReal_mem_slitPlane]; linarith [mem_Ioi.mp hx] + · simp only [ofReal_mem_slitPlane]; linarith only [mem_Ioi.mp hx, hx] · apply RCLike.continuous_ofReal.continuousOn.comp ?_ (mapsTo_image _ _) refine continuous_id.continuousOn.log ?_ - intro x hx; simp only [id_eq]; linarith [mem_Ioi.mp hx] + intro x hx; simp only [id_eq]; linarith only [mem_Ioi.mp hx, hx] · simp only [norm_mul, norm_real] - have := integrable_log_over_pow (r := -s.re) (by linarith) Npos + have := integrable_log_over_pow (r := -s.re) (by linarith only [s_re_gt]) Npos apply IntegrableOn.congr_fun this ?_ (by simp) intro x hx simp only [mul_eq_mul_right_iff, norm_eq_zero, Real.log_eq_zero] left - have xpos : 0 < x := by linarith [mem_Ioi.mp hx] + have xpos : 0 < x := by linarith only [mem_Ioi.mp hx, hx] simp [norm_cpow_eq_rpow_re_of_pos xpos, Real.abs_rpow_of_nonneg xpos.le, abs_eq_self.mpr xpos.le] · apply Measurable.add ?_ measurable_const |>.sub (by fun_prop) |>.aestronglyMeasurable @@ -1149,7 +1135,7 @@ lemma hasDerivAt_Zeta0Integral {N : ℕ} (Npos : 0 < N) {s : ℂ} (hs : s ∈ {s _ = |x ^ (-z.re - 1)| * |(Real.log x)| * |(⌊x⌋ + 1 / 2 - x)| := by simp _ ≤ _ := ?_ · congr! 2 - simp only [Real.norm_eq_abs, norm_cpow_eq_rpow_re_of_pos (by linarith), + simp only [Real.norm_eq_abs, norm_cpow_eq_rpow_re_of_pos (by linarith only [hx]), sub_re, neg_re, one_re] apply abs_eq_self.mpr ?_ |>.symm positivity @@ -1158,17 +1144,17 @@ lemma hasDerivAt_Zeta0Integral {N : ℕ} (Npos : 0 < N) {s : ℂ} (hs : s ∈ {s simp only [Metric.mem_ball, ε, Complex.dist_eq] at hz apply le_trans (b := 1 * |x ^ (-z.re - 1)|) · apply mul_le_mul_of_nonneg_right (le_trans (ZetaSum_aux1_3 _) (by norm_num)) <| abs_nonneg _ - · simp_rw [one_mul, Real.abs_rpow_of_nonneg (by linarith : 0 ≤ x)] + · simp_rw [one_mul, Real.abs_rpow_of_nonneg (by linarith only [hx] : 0 ≤ x)] apply Real.rpow_le_rpow_of_exponent_le <| le_abs.mpr (by left; exact hx.le) have := abs_le.mp <| le_trans (abs_re_le_norm (z-s)) hz.le simp only [sub_re, neg_le_sub_iff_le_add, tsub_le_iff_right] at this - linarith [this.1] + linarith only [this.1, this] have h_bound : ∀ᵐ x ∂μ, ∀ z ∈ Metric.ball s ε, ‖F' z x‖ ≤ bound x := by apply ae_restrict_of_ae_restrict_of_subset IoiSubIoi1 exact h_bound1 have bound_integrable : Integrable bound μ := by simp only [bound] - convert! integrable_log_over_pow (r := -s.re / 2) (by linarith) Npos using 0 + convert! integrable_log_over_pow (r := -s.re / 2) (by linarith only [hs]) Npos using 0 have h_diff : ∀ᵐ x ∂μ, ∀ z ∈ Metric.ball s ε, HasDerivAt (fun w ↦ F w x) (F' z x) z := by simp only [F, F', f] apply ae_restrict_of_ae_restrict_of_subset IoiSubIoi1 @@ -1184,14 +1170,14 @@ lemma hasDerivAt_Zeta0Integral {N : ℕ} (Npos : 0 < N) {s : ℂ} (hs : s ∈ {s · simp only [mul_one, mul_eq_mul_left_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq] left rw [Complex.ofReal_log] - linarith + linarith only [one_lt_x] · right intro h simp only [Metric.mem_ball, ε, Complex.dist_eq, neg_eq_iff_eq_neg.mp <| sub_eq_zero.mp h] at hz have := (abs_le.mp <| le_trans (abs_re_le_norm (-1-s)) hz.le).1 simp only [sub_re, neg_re, one_re, neg_le_sub_iff_le_add, le_neg_add_iff_add_le] at this - linarith + linarith only [hs, this] · apply hasDerivAt_id _ |>.neg |>.sub_const convert! (hasDerivAt_integral_of_dominated_loc_of_deriv_le (F := F) (F' := F') (x₀ := s) (s := Metric.ball s ε) (bound := bound) (μ := μ) (Metric.ball_mem_nhds s ε_pos) @@ -1279,7 +1265,7 @@ lemma isPathConnected_aux : IsPathConnected {z : ℂ | z ≠ 1 ∧ 0 < z.re} := I_re, add_zero, ofReal_re, one_mul, add_im, one_im, I_im, zero_add, ofReal_im, mul_zero, sub_zero, re_ofNat, sub_re, im_ofNat, sub_im, sub_self, f] intro x hx; simp only [mem_Icc] at hx - refine ⟨?_, by linarith⟩ + refine ⟨?_, by linarith only [hx]⟩ intro h rw [Complex.ext_iff] at h; simp [(by apply And.right; simpa [w_im] using h : x = 0)] at h · let f : ℝ → ℂ := fun t ↦ w * t + (1 + I) * (1 - t) @@ -1297,9 +1283,9 @@ lemma isPathConnected_aux : IsPathConnected {z : ℂ | z ≠ 1 ∧ 0 < z.re} := have : x = 1 := by linarith [(by apply And.right; simpa [w_im] using h : 1 - x = 0)] rw [Complex.ext_iff, one_re, one_im]; exact ⟨by simpa [this, w_im] using h, w_im⟩ · by_cases hxx : x = 0 - · simp only [hxx]; linarith + · simp only [hxx]; linarith only [] · have : 0 < x := lt_of_le_of_ne hx.1 (Ne.symm hxx) - have : 0 ≤ 1 - x := by linarith + have : 0 ≤ 1 - x := by linarith only [hx] have := hw.2 positivity · let f : ℝ → ℂ := fun t ↦ w * t + 2 * (1 - t) @@ -1314,9 +1300,9 @@ lemma isPathConnected_aux : IsPathConnected {z : ℂ | z ≠ 1 ∧ 0 < z.re} := rw [Complex.ext_iff] at h; simp [(by apply And.right; simpa [w_im] using h : x = 0)] at h · by_cases hxx : x = 0 - · simp only [hxx]; linarith + · simp only [hxx]; linarith only [] · have : 0 < x := lt_of_le_of_ne hx.1 (Ne.symm hxx) - have : 0 ≤ 1 - x := by linarith + have : 0 ≤ 1 - x := by linarith only [hx] have := hw.2 positivity @@ -1426,7 +1412,7 @@ lemma ZetaBnd_aux2 {n : ℕ} {t A σ : ℝ} (Apos : 0 < A) (σpos : 0 < σ) (n_l · have : ‖(n : ℂ) ^ (-s)‖ = n ^ (-s.re) := norm_cpow_eq_rpow_re_of_pos n_gt_0' (-s) rw [this, abs_eq_self.mpr <| Real.rpow_nonneg n_gt_0'.le _]; simp [s] · apply Real.exp_le_exp_of_le <| mul_le_mul_of_nonneg_left _ <| Real.log_nonneg n_ge_1 - rw [neg_sub, neg_le_sub_iff_le_add, add_comm, ← Real.log_abs]; linarith + rw [neg_sub, neg_le_sub_iff_le_add, add_comm, ← Real.log_abs]; linarith only [σ_ge] · simp only [neg_sub, le_neg_add_iff_add_le] ring_nf conv => rw [mul_comm, ← mul_assoc, ← Real.log_abs]; rhs; rw [← one_mul A] @@ -1445,13 +1431,13 @@ lemma UpperBnd_aux {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) let N := ⌊|t|⌋₊; 0 < N ∧ N ≤ |t| ∧ 1 < Real.log |t| ∧ 1 - A < σ ∧ 0 < σ ∧ σ + t * I ≠ 1 := by intro N - have Npos : 0 < N := Nat.floor_pos.mpr (by linarith) + have Npos : 0 < N := Nat.floor_pos.mpr (by linarith only [t_gt]) have N_le_t : N ≤ |t| := Nat.floor_le <| abs_nonneg _ have logt_gt := logt_gt_one t_gt.le have σ_gt : 1 - A < σ := by apply lt_of_lt_of_le ((sub_lt_sub_iff_left (a := 1)).mpr ?_) σ_ge - exact (div_lt_iff₀ (by linarith)).mpr <| lt_mul_right hA.1 logt_gt - refine ⟨Npos, N_le_t, logt_gt, σ_gt, by linarith [hA.2], ?_⟩ + exact (div_lt_iff₀ (by linarith only [logt_gt])).mpr <| lt_mul_right hA.1 logt_gt + refine ⟨Npos, N_le_t, logt_gt, σ_gt, by linarith only [hA.2, σ_gt, hA], ?_⟩ contrapose! t_gt simp only [Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, one_re, add_im, mul_im, zero_add, one_im] at t_gt @@ -1462,10 +1448,10 @@ lemma UpperBnd_aux2 {A σ t : ℝ} (t_ge : 3 < |t|) (σ_ge : 1 - A / Real.log |t have : |t| ^ (1 - σ) ≤ |t| ^ (A / Real.log |t|) := Real.rpow_le_rpow_of_exponent_le (by linarith) (by linarith) apply le_trans this ?_ - conv => lhs; lhs; rw [← Real.exp_log (by linarith : 0 < |t|)] + conv => lhs; lhs; rw [← Real.exp_log (by linarith only [t_ge] : 0 < |t|)] rw [div_eq_mul_inv, Real.rpow_mul (by positivity), ← Real.exp_mul, ← Real.exp_mul, mul_comm, ← mul_assoc, inv_mul_cancel₀, one_mul] - apply Real.log_ne_zero.mpr; split_ands <;> linarith + apply Real.log_ne_zero.mpr; split_ands <;> linarith only [t_ge] lemma riemannZeta0_zero_aux (N : ℕ) (Npos : 0 < N) : ∑ x ∈ Finset.Ico 0 N, ((x : ℝ))⁻¹ = ∑ x ∈ Finset.Ico 1 N, ((x : ℝ))⁻¹ := by @@ -1522,7 +1508,7 @@ lemma _root_.Nat.self_div_floor_bound {t : ℝ} (t_ge : 1 ≤ |t|) : let N := apply Nat.lt_floor_add_one lemma UpperBnd_aux5 {σ t : ℝ} (t_ge : 3 < |t|) (σ_le : σ ≤ 2) : (|t| / ⌊|t|⌋₊) ^ σ ≤ 4 := by - obtain ⟨h₁, h₂⟩ := Nat.self_div_floor_bound (by linarith) + obtain ⟨h₁, h₂⟩ := Nat.self_div_floor_bound (by linarith only [t_ge]) calc _ ≤ ((|t| / ↑⌊|t|⌋₊) ^ (2 : ℝ)) := by gcongr _ ≤ (2 : ℝ) ^ (2 : ℝ) := by gcongr _ = 4 := by norm_num @@ -1532,24 +1518,25 @@ lemma UpperBnd_aux6 {σ t : ℝ} (t_ge : 3 < |t|) (hσ : σ ∈ Ioc (1 / 2) 2) ⌊|t|⌋₊ ^ (1 - σ) / ‖1 - (σ + t * I)‖ ≤ |t| ^ (1 - σ) * 2 ∧ ⌊|t|⌋₊ ^ (-σ) / 2 ≤ |t| ^ (1 - σ) ∧ ⌊|t|⌋₊ ^ (-σ) / σ ≤ 8 * |t| ^ (-σ) := by have bnd := UpperBnd_aux5 t_ge hσ.2 - have bnd' : (|t| / ⌊|t|⌋₊) ^ σ ≤ 2 * |t| := by linarith + have bnd' : (|t| / ⌊|t|⌋₊) ^ σ ≤ 2 * |t| := by linarith only [t_ge, bnd] split_ands · apply (div_le_iff₀ <| norm_pos_iff.mpr <| sub_ne_zero_of_ne neOne.symm).mpr conv => rw [mul_assoc]; rhs; rw [mul_comm] - apply (div_le_iff₀ <| Real.rpow_pos_of_pos (by linarith) _).mp + apply (div_le_iff₀ <| Real.rpow_pos_of_pos (by linarith only [t_ge]) _).mp rw [div_rpow_eq_rpow_div_neg (by positivity) (by positivity), neg_sub] refine le_trans₄ ?_ bnd' ?_ · exact Real.rpow_le_rpow_of_exponent_le (one_le_div (by positivity) |>.mpr N_le_t) (by simp) · apply (mul_le_mul_iff_right₀ (by norm_num)).mpr; simpa using abs_im_le_norm (1 - (σ + t * I)) · apply div_le_iff₀ (by norm_num) |>.mpr - rw [Real.rpow_sub (by linarith), Real.rpow_one, div_mul_eq_mul_div, mul_comm] + rw [Real.rpow_sub (by linarith only [t_ge]), Real.rpow_one, div_mul_eq_mul_div, mul_comm] apply div_le_iff₀ (by positivity) |>.mp convert! bnd' using 1 - rw [← Real.rpow_neg (by linarith), div_rpow_neg_eq_rpow_div (by positivity) (by positivity)] - · apply div_le_iff₀ (by linarith [hσ.1]) |>.mpr + rw [← Real.rpow_neg (by + linarith only [t_ge]), div_rpow_neg_eq_rpow_div (by positivity) (by positivity)] + · apply div_le_iff₀ (by linarith only [hσ.1, hσ]) |>.mpr rw [mul_assoc, mul_comm, mul_assoc] apply div_le_iff₀' (by positivity) |>.mp - apply le_trans ?_ (by linarith [hσ.1] : 4 ≤ σ * 8) + apply le_trans ?_ (by linarith only [hσ.1, hσ] : 4 ≤ σ * 8) convert! bnd using 1; exact div_rpow_neg_eq_rpow_div (by positivity) (by positivity) lemma ZetaUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) @@ -1806,7 +1793,8 @@ lemma DerivUpperBnd_aux7_1 {x σ t : ℝ} (hx : 1 ≤ x) : lemma DerivUpperBnd_aux7_2 {x σ : ℝ} (hx : 1 ≤ x) : |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log ≤ x ^ (-σ - 1) * x.log := by rw [← one_mul (x ^ (-σ - 1) * Real.log x), mul_assoc] - apply mul_le_mul_of_nonneg_right _ (by bound) + apply mul_le_mul_of_nonneg_right _ + (mul_nonneg (Real.rpow_nonneg (zero_le_one.trans hx) _) (Real.log_nonneg hx)) exact le_trans (ZetaSum_aux1_3 x) (by norm_num) lemma DerivUpperBnd_aux7_3 {x σ : ℝ} (xpos : 0 < x) (σnz : σ ≠ 0) : @@ -1828,14 +1816,15 @@ lemma DerivUpperBnd_aux7_3' {a σ : ℝ} (apos : 0 < a) (σnz : σ ≠ 0) : ∀ x ∈ Ici a, HasDerivAt (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) (x ^ (-σ - 1) * Real.log x) x := by intro x hx - simp at hx - exact DerivUpperBnd_aux7_3 (by linarith) σnz + change a ≤ x at hx + exact DerivUpperBnd_aux7_3 (by linarith only [apos, hx]) σnz lemma DerivUpperBnd_aux7_nonneg {a σ : ℝ} (ha : 1 ≤ a) : ∀ x ∈ Ioi a, 0 ≤ x ^ (-σ - 1) * Real.log x := by intro x hx simp at hx - bound + exact mul_nonneg (Real.rpow_nonneg (zero_le_one.trans (ha.trans hx.le)) _) + (Real.log_nonneg (ha.trans hx.le)) lemma DerivUpperBnd_aux7_tendsto {σ : ℝ} (σpos : 0 < σ) : Tendsto (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) atTop (nhds 0) := by @@ -1924,7 +1913,7 @@ theorem DerivUpperBnd_aux7 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 apply mul_le_mul _ _ (by positivity) (by positivity) · apply le_trans (by apply norm_add_le) simp [abs_of_pos σpos] - linarith [hσ.2] + linarith only [hσ.2, t_gt, hσ] apply le_trans (by apply norm_integral_le_integral_norm) calc ∫ (x : ℝ) in Ioi (N : ℝ), ‖(↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ _ = ∫ (x : ℝ) in Ioi (N : ℝ), |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log := by @@ -1976,7 +1965,7 @@ lemma ZetaDerivUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < | ≤ C * Real.log |t| ^ 2 := by intros C N s obtain ⟨Npos, N_le_t, logt_gt, σ_gt, _, neOne⟩ := UpperBnd_aux hA t_gt hσ.1 - replace σ_gt : 1 / 2 < σ := by linarith [hA.2] + replace σ_gt : 1 / 2 < σ := by linarith only [hA.2, σ_gt, hA] calc _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ‖-(N : ℂ) ^ (1 - s) / (1 - s) ^ 2‖ + ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + @@ -2050,7 +2039,7 @@ lemma ZetaDerivUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < | swap · nth_rewrite 1 [← mul_one |t|.log, (by ring : |t|.log ^ 2 = |t|.log * |t|.log)] gcongr - nlinarith + nlinarith only [logt_gt] /- For any $s = \sigma + tI \in \C$, $1/2 \le \sigma\le 2, 3 < |t|$, @@ -2200,15 +2189,16 @@ lemma ZetaNear1BndExact : · simp only [← h, mem_ofPred_eq] at hσ apply le_trans hσ ?_ norm_cast - have : 0 ≤ 1 / (σ - 1) := by apply one_div_nonneg.mpr; linarith + have : 0 ≤ 1 / (σ - 1) := by apply one_div_nonneg.mpr; linarith only [σ_ge] simp only [Real.norm_eq_abs, abs_eq_self.mpr this, mul_div, mul_one] - exact div_le_div₀ (by simp [Cpos.le]) (by simp) (by linarith) (by rfl) + exact div_le_div₀ (by simp [Cpos.le]) (by simp) (by linarith only [σ_ge]) (by rfl) · replace hσ : σ ∈ W := by simp only [mem_inter_iff, hV σ_ge, and_true] at hσ simp only [mem_Icc, σ_le, and_true, W] contrapose! hσ; exact hε ⟨σ_ge.le, hσ⟩ - apply le_trans (hC σ hσ).le ((le_div_iff₀ (by linarith)).mpr ?_) - rw [le_max_iff, mul_comm 2]; exact Or.inl <| mul_le_mul_of_nonneg_left (by linarith) Cpos.le + apply le_trans (hC σ hσ).le ((le_div_iff₀ (by linarith only [σ_ge])).mpr ?_) + rw [le_max_iff, mul_comm 2]; exact Or.inl <| mul_le_mul_of_nonneg_left (by + linarith only [σ_le]) Cpos.le /-- For positive `x` and nonzero `y` we have that $|\zeta(x)^3 \cdot \zeta(x+iy)^4 \cdot \zeta(x+2iy)| \ge 1$. -/ @@ -2232,7 +2222,7 @@ theorem ZetaLowerBound1_aux1 {σ t : ℝ} (this : 1 ≤ ‖ζ σ‖ ^ (3 : ℝ) lemma ZetaLowerBound1 {σ t : ℝ} (σ_gt : 1 < σ) : ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1 := by -- Start with the fundamental identity - have := norm_zeta_product_ge_one (x := σ - 1) (by linarith) t + have := norm_zeta_product_ge_one (x := σ - 1) (by linarith only [σ_gt]) t simp_rw [ge_iff_le, norm_mul, norm_pow, ofReal_sub, ofReal_one, add_sub_cancel, ← Real.rpow_natCast] at this @@ -2245,7 +2235,7 @@ lemma ZetaLowerBound2 {σ t : ℝ} (σ_gt : 1 < σ) : theorem ZetaLowerBound3_aux1 (A : ℝ) (ha : A ∈ Ioc 0 (1 / 2)) (t : ℝ) (ht_2 : 3 < |2 * t|) : 0 < A / Real.log |2 * t| := by - exact div_pos ha.1 <| Real.log_pos (by linarith) + exact div_pos ha.1 <| Real.log_pos (by linarith only [ht_2]) theorem ZetaLowerBound3_aux2 {C : ℝ} {σ t : ℝ} @@ -2258,7 +2248,7 @@ theorem ZetaLowerBound3_aux3 (C : ℝ) (c_near : ℝ) {σ : ℝ} (t : ℝ) (σ_g ((1 : ℝ) / 4) = c_near ^ ((3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * Real.log |t * 2| ^ ((1 : ℝ) / 4) * (-1 + σ) ^ (-(3 : ℝ) / 4) := by - exact (symm) (.trans (by rw [neg_div, Real.rpow_neg (by linarith)]) (by ring)) + exact (symm) (.trans (by rw [neg_div, Real.rpow_neg (by linarith only [σ_gt])]) (by ring)) theorem ZetaLowerBound3_aux4 (C : ℝ) (hC : 0 < C) (c_near : ℝ) (hc_near : 0 < c_near) {σ : ℝ} (t : ℝ) (ht : 3 < |t|) @@ -2266,9 +2256,14 @@ theorem ZetaLowerBound3_aux4 (C : ℝ) (hC : 0 < C) : 0 < c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * Real.log |2 * t| ^ ((1 : ℝ) / 4) := by - match sub_pos.mpr σ_gt with | S => match Real.log_pos (by simp; linarith : abs (2 *t) > 1) with + match sub_pos.mpr σ_gt with + | S => + match Real.log_pos (show |2 * t| > 1 from by + simp + linarith only [ht]) with | S => positivity + theorem ZetaLowerBound3_aux5 {σ : ℝ} (t : ℝ) (this : ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1) : @@ -2300,14 +2295,14 @@ lemma ZetaLowerBound3 : -- Upper bound on ‖ζ σ‖ from ZetaNear1BndExact have ζ_σ_bound : ‖ζ σ‖ ≤ c_near / (σ - 1) := by exact h_near σ ⟨σ_gt, σ_le⟩ - have ht_2 : 3 < |2 * t| := by simp only [abs_mul, Nat.abs_ofNat]; linarith + have ht_2 : 3 < |2 * t| := by simp only [abs_mul, Nat.abs_ofNat]; linarith only [ht] -- Upper bound on ‖ζ (σ + 2*t * I)‖ from ZetaUpperBnd have σ_in_range : σ ∈ Icc (1 - A / Real.log |2 * t|) 2 := by constructor · -- σ ≥ 1 - A / Real.log |2*t| have : 0 < A / Real.log |2 * t| := by exact ZetaLowerBound3_aux1 A ha t ht_2 - nlinarith + exact (sub_lt_self 1 this).le.trans σ_gt.le · exact σ_le have ζ_2t_bound := h_upper σ (2 * t) ht_2 σ_in_range -- Combine the bounds @@ -2325,7 +2320,7 @@ lemma ZetaLowerBound3 : c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * (Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by rw [Real.div_rpow (by linarith) (by linarith), Real.mul_rpow (by linarith) (Real.log_nonneg - (by linarith))] + (by linarith only [ht_2]))] ring_nf exact ZetaLowerBound3_aux3 _ _ _ σ_gt rw [this] at denom_bound @@ -2382,7 +2377,7 @@ lemma Ioi_union_Iio_mem_cocompact {a : ℝ} (ha : 0 ≤ a) : Ioi (a : ℝ) ∪ I constructor · exact isCompact_Icc · rw [@compl_subset_iff_union, ← union_assoc, Icc_union_Ioi_eq_Ici, union_comm, Iio_union_Ici] - linarith + linarith only [ha] lemma lt_abs_mem_cocompact {a : ℝ} (ha : 0 ≤ a) : {t | a < |t|} ∈ cocompact ℝ := by convert Ioi_union_Iio_mem_cocompact ha using 1; ext t @@ -2404,7 +2399,7 @@ lemma ZetaInvBound2 : refine ⟨c⁻¹, inv_pos.mpr hc, ?_⟩ intro σ hσ t ht have positive_sigma : 0 < σ - 1 := sub_pos.mpr hσ.1 - have positive_log : 0 < Real.log |t| := Real.log_pos (by linarith) + have positive_log : 0 < Real.log |t| := Real.log_pos (by linarith only [ht]) calc _ ≤ (c * (σ - 1) ^ ((3 : ℝ) / 4) / Real.log |t| ^ ((1 : ℝ) / 4))⁻¹ := by simpa only [one_div] using one_div_le_one_div_of_le (by positivity) (lower hσ t ht) @@ -2474,7 +2469,7 @@ lemma Zeta_diff_Bnd : have t_ne_zero : t ≠ 0 := by contrapose! t_gt; simp only [t_gt, abs_zero, Nat.ofNat_nonneg] rw [← Zeta_eq_int_derivZeta t_ne_zero] convert intervalIntegral.norm_integral_le_of_norm_le_const ?_ using 1 - · congr; rw [_root_.abs_of_nonneg (by linarith)] + · congr; rw [_root_.abs_of_nonneg (by linarith only [σ₁_lt_σ₂])] · intro σ hσ; rw [uIoc_of_le σ₁_lt_σ₂.le, mem_Ioc] at hσ exact hC σ t t_gt ⟨le_trans σ₁_ge hσ.1.le, le_trans hσ.2 σ₂_le⟩ @@ -2552,9 +2547,9 @@ lemma ZetaLowerBndStrip : have σ'_gt : 1 < σ' := by simp only [σ', lt_add_iff_pos_right]; positivity have σ'_le : σ' ≤ 2 := by simp only [σ'] - suffices A / Real.log |t| ^ (9 : ℝ) < 1 by linarith + suffices A / Real.log |t| ^ (9 : ℝ) < 1 by linarith only [this] apply div_lt_one (by positivity) |>.mpr - exact lt_trans₄ (by linarith) logt_gt_one <| ZetaInvBnd_aux' logt_gt_one + exact lt_trans₄ (by linarith only [Apos, Ale]) logt_gt_one <| ZetaInvBnd_aux' logt_gt_one set s := σ + t * I set s' := σ' + t * I change ‖ζ s‖ ≥ C / Real.log |t| ^ (7 : ℝ) @@ -2582,7 +2577,7 @@ lemma ZetaLowerBndStrip : exact div_le_div₀ hA'.1.le (by simp [A]) (by positivity) <| ZetaInvBnd_aux logt_gt_one · apply sub_le_sub (by simp only [add_sub_cancel_left, σ']; exact_mod_cast le_rfl) ?_ rw [mul_div_assoc, mul_assoc _ 2 _] - apply mul_le_mul (by exact_mod_cast le_rfl) ?_ (by linarith [hσ.2]) (by positivity) + apply mul_le_mul (by exact_mod_cast le_rfl) ?_ (by linarith only [hσ.2, hσ]) (by positivity) suffices h : σ' + (1 - A / Real.log |t| ^ (9 : ℝ)) ≤ (1 + A / Real.log |t| ^ (9 : ℝ)) + σ by simp only [tsub_le_iff_right] convert! le_sub_right_of_add_le h using 1; ring_nf @@ -2605,7 +2600,7 @@ lemma ZetaInvBnd : obtain ⟨A, hA, c, hc, lower⟩ := ZetaLowerBndStrip refine ⟨A, hA, c⁻¹, inv_pos.mpr hc, ?_⟩ intro σ t ht hσ - have positive_log : 0 < Real.log |t| := Real.log_pos (by linarith) + have positive_log : 0 < Real.log |t| := Real.log_pos (by linarith only [ht]) calc _ ≤ (c / Real.log |t| ^ (7 : ℝ))⁻¹ := by simpa only [one_div] using one_div_le_one_div_of_le (by positivity) (lower σ t ht hσ) @@ -2624,7 +2619,7 @@ lemma ZetaLowerBnd : intro σ t ht hσ apply lower σ t ht refine ⟨hσ.1, hσ.2.trans ?_⟩ - have positive_log : 0 < Real.log |t| := Real.log_pos (by linarith) + have positive_log : 0 < Real.log |t| := Real.log_pos (by linarith only [ht]) exact lt_add_of_pos_right _ (div_pos hA.1 (Real.rpow_pos_of_pos positive_log _)) -- **End collaboration 6/20/25** @@ -2656,8 +2651,8 @@ lemma ZetaZeroFree9 : ZetaZeroFreeGenProp 9 := by apply div_pos hc apply Real.rpow_pos_of_pos apply Real.log_pos - linarith - linarith + linarith only [ht] + linarith only [this, pos_bound] /- @@ -2681,26 +2676,26 @@ lemma LogDerivZetaBnd : apply le_trans (tsub_le_tsub_left ?_ 1) σ_ge apply div_le_div_of_nonneg_right (min_le_left A A') apply Real.rpow_nonneg - linarith + linarith only [logt_gt] have σ_ge'' : 1 - A' / Real.log |t| ≤ σ := by apply le_trans (tsub_le_tsub_left ?_ 1) σ_ge apply div_le_div₀ hA'.1.le (min_le_right A A') (lt_trans (by norm_num) logt_gt) ?_ - rw [← Real.rpow_one (Real.log |t|), ← Real.rpow_mul (by linarith), one_mul] + rw [← Real.rpow_one (Real.log |t|), ← Real.rpow_mul (by linarith only [logt_gt]), one_mul] exact Real.rpow_le_rpow_of_exponent_le logt_gt.le Nat.one_le_ofNat replace h := h σ t t_gt ⟨σ_ge', by calc σ < 1 + min A A' / Real.log |t| ^ (9 : ℝ) := σ_lt _ ≤ 1 + A / Real.log |t| ^ (9 : ℝ) := by gcongr; simp⟩ replace h' := h' σ t t_gt ⟨σ_ge'', by calc - σ ≤ 1 + min A A' / Real.log |t| ^ (9 : ℝ) := by linarith [σ_lt] + σ ≤ 1 + min A A' / Real.log |t| ^ (9 : ℝ) := by linarith only [σ_lt] _ ≤ 1 + (1/2) / Real.log |t| ^ (9 : ℝ) := by gcongr; simp [Set.mem_Ioc] at hA' hA ⊢ ; simp [hA.2] _ ≤ 1 + (1/2) / 1 := by gcongr calc - 1 ≤ Real.log |t| := by linarith + 1 ≤ Real.log |t| := by linarith only [logt_gt] _ ≤ (Real.log |t|) ^ (9 : ℝ) := Real.self_le_rpow_of_one_le (by linarith) (by linarith) - _ ≤ 2 := by linarith + _ ≤ 2 := by linarith only [] ⟩ simp only [norm_div] convert! mul_le_mul h h' (by simp) ?_ using 1 <;> (norm_cast; ring_nf); positivity @@ -2843,7 +2838,7 @@ lemma ZetaNoZerosInBox (T : ℝ) : intro s hs hfalse rw [hfalse] at hs simp only [norm_zero, ge_iff_le] at hs - linarith + linarith only [hs] rw [ht₀] at ToOneT0 simp only [ofReal_zero, mul_zero, add_zero] at ToOneT0 rcases (ToOneT0.eventually ZetaNonZ).exists with ⟨n, hn⟩ @@ -2910,7 +2905,7 @@ theorem LogDerivZetaHolcSmallT : obtain ⟨hre_lower, hre_upper⟩ := hre have : min σ₂ 2 = σ₂ := by apply min_eq_left - linarith [hσ₂_lt_one] + linarith only [hσ₂_lt_one] rwa [← this] apply LogDerivZetaHoloOn · exact Set.notMem_sdiff_of_mem rfl @@ -3115,11 +3110,11 @@ theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → simp only [mem_ofPred_eq] rw [edist_dist, dist_eq_norm] norm_cast - have U : 0 ≤ σ₀ - 1 := by linarith + have U : 0 ≤ σ₀ - 1 := by linarith only [σ₀_gt] simp only [Real.norm_of_nonneg U, gt_iff_lt] simp only [ENNReal.ofReal_lt_iff_lt_toReal U O1] calc - _ ≤ boundary - 1 := by linarith + _ ≤ boundary - 1 := by linarith only [h] _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 @@ -3133,7 +3128,7 @@ theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → · by_contra a have U : σ₀ = 1 := by exact ofReal_eq_one.mp a rw [U] at σ₀_gt - linarith + linarith only [σ₀_gt] have bdd := Set.forall_mem_image.mp bound_prop (σ₀_in_U) simp only [Function.comp_apply, Pi.sub_apply, Pi.neg_apply, Pi.div_apply] at bdd calc @@ -3153,8 +3148,7 @@ theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → norm_cast _ ≤ const + (σ₀ - 1)⁻¹ := by simp [norm_inv] - have pos : 0 ≤ σ₀ - 1 := by - linarith + have pos : 0 ≤ σ₀ - 1 := by linarith only [σ₀_gt] simp [abs_of_nonneg pos] _ = (σ₀ - 1)⁻¹ + const := by rw [add_comm] @@ -3166,7 +3160,7 @@ theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → simp only [mem_ofPred_eq] rw [edist_dist, dist_eq_norm] norm_cast - have U : 0 ≤ boundary - 1 := by linarith + have U : 0 ≤ boundary - 1 := by linarith only [boundary_geq_one] simp only [Real.norm_of_nonneg U, gt_iff_lt] simp only [ENNReal.ofReal_lt_iff_lt_toReal U O1] calc @@ -3188,7 +3182,7 @@ theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → calc _ ≤ ‖ζ' boundary / ζ boundary‖ := by exact dlog_riemannZeta_bdd_on_vertical_lines_generalized boundary σ₀ t - (boundary_geq_one) (by linarith) + (boundary_geq_one) (by linarith only [h]) _ = ‖- ζ' boundary / ζ boundary‖ := by simp only [Complex.norm_div, norm_neg] _ = ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) + (boundary - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] @@ -3204,8 +3198,7 @@ theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → simpa [*] using! U9 _ ≤ const + (boundary - 1)⁻¹ := by simp [norm_inv] - have pos : 0 ≤ boundary - 1 := by - linarith + have pos : 0 ≤ boundary - 1 := by linarith only [boundary_geq_one] simp [abs_of_nonneg pos] _ = (boundary - 1)⁻¹ + const := by rw [add_comm] @@ -3232,7 +3225,7 @@ lemma LogDerivZetaBndUnif99 : LogDerivZetaBndUnifGenProp 9 9 := by simp only [one_div, mem_Ioc, true_and, T0] at pf_A have U := (inv_le_inv₀ (by positivity) (by positivity)).mpr pf_A simp only [inv_inv] at U - linarith + linarith only [T0, pf_A, U] refine ⟨A, pf_A, ((1 + C + C_triv) * A⁻¹), (by positivity), fun σ t hyp_t hyp_σ ↦ ?_⟩ have logt_gt' : (1 : ℝ) < Real.log |t| ^ (9 : ℝ) := by calc @@ -3277,9 +3270,9 @@ lemma LogDerivZetaBndUnif99 : LogDerivZetaBndUnifGenProp 9 9 := by ring_nf gcongr · simp only [inv_pos, le_mul_iff_one_le_left, T0] - linarith + linarith only [logt_gt'] _ ≤ (1 + C + C_triv) * A⁻¹ * Real.log |t| ^ (9 : ℝ) := by gcongr - linarith + linarith only [C_pos] end IwaniecLinearSievePNT