Download lean/Recurrence.lean from FINAL-Bench/weil-positivity-gauge: direct link, hf CLI and curl.
- Browser
- Download file 6.22 kB
-
https://huggingface.co/spaces/FINAL-Bench/weil-positivity-gauge/resolve/main/lean/Recurrence.lean
- Command line
-
hf download hf://spaces/FINAL-Bench/weil-positivity-gauge/lean/Recurrence.lean
-
curl -L -o Recurrence.lean https://huggingface.co/spaces/FINAL-Bench/weil-positivity-gauge/resolve/main/lean/Recurrence.lean
6.22 kB
Lean 4 Β· 11
declarations statementsfull
theorem cast_add_one_ne_zero (n : β) : ((n : β) + 1) β 0 := by proof Β· 3 lines
have h : ((n : β) + 1) = ((n + 1 : β) : β) := by push_cast; ring
rw [h, Ne, Nat.cast_eq_zero]
omeganoncomputable def term (s : β) (n : β) : β := 1 / (n + 1) - 1 / (n + s) theorem term_eq (s : β) (n : β) (h : (n : β) + s β 0) :
term s n = (s - 1) / (((n : β) + 1) * ((n : β) + s)) := by proof Β· 4 lines
have h1 : ((n : β) + 1) β 0 := cast_add_one_ne_zero n
simp only [term]
field_simp
ringtheorem norm_term_le (s : β) (n : β) (hn : Nat.ceil (2 * βsβ) + 1 β€ n) :
βterm s nβ β€ (2 * βs - 1β) * (1 / (n : β) ^ 2) := by proof Β· 33 lines
have hn1' : (1 : β) β€ n := le_trans (Nat.le_add_left 1 _) hn
have hn0 : (0 : β) < n := by exact_mod_cast hn1'
have h2s : 2 * βsβ β€ n := by
have h1 := Nat.le_ceil (2 * βsβ)
have h2 : ((Nat.ceil (2 * βsβ) : β) : β) β€ n := by
exact_mod_cast (le_trans (Nat.le_succ _) hn)
linarith
have hnorm : β(n : β)β = n := by simp
have hns : (n : β) / 2 β€ β(n : β) + sβ := by
have h1 : β(n : β)β - β-sβ β€ β(n : β) - (-s)β := norm_sub_norm_le _ _
rw [norm_neg, sub_neg_eq_add, hnorm] at h1
linarith
have hn1 : (n : β) β€ β(n : β) + 1β := by
have h : ((n : β) + 1) = ((n + 1 : β) : β) := by push_cast; ring
rw [h, Complex.norm_natCast]
push_cast
linarith
have hne : (n : β) + s β 0 := by
intro h
rw [h, norm_zero] at hns
linarith
have hprod : (n : β) ^ 2 / 2 β€ β(n : β) + 1β * β(n : β) + sβ := by
have : (n : β) * ((n : β) / 2) β€ β(n : β) + 1β * β(n : β) + sβ :=
mul_le_mul hn1 hns (by positivity) (norm_nonneg _)
nlinarith [this]
have hpos : 0 < β(n : β) + 1β * β(n : β) + sβ := lt_of_lt_of_le (by positivity) hprod
rw [term_eq s n hne, norm_div, norm_mul, div_le_iffβ hpos]
have hk : βs - 1β = (2 * βs - 1β) * (1 / (n : β) ^ 2) * ((n : β) ^ 2 / 2) := by
field_simp
calc βs - 1β = (2 * βs - 1β) * (1 / (n : β) ^ 2) * ((n : β) ^ 2 / 2) := hk
_ β€ (2 * βs - 1β) * (1 / (n : β) ^ 2) * (β(n : β) + 1β * β(n : β) + sβ) := by
apply mul_le_mul_of_nonneg_left hprod
positivity63Summability of the digamma series for every complex
s(Lean's1/0 = 0makes the pole terms harmless, so no hypothesis is needed).
theorem summable_term (s : β) : Summable (term s) := by proof Β· 5 lines
have hsum : Summable (fun n : β => (2 * βs - 1β) * (1 / (n : β) ^ 2)) :=
(Real.summable_one_div_nat_pow.mpr (by norm_num)).mul_left _
refine Summable.of_norm_bounded_eventually_nat hsum ?_
filter_upwards [eventually_ge_atTop (Nat.ceil (2 * βsβ) + 1)] with n hn
exact norm_term_le s n hntheorem term_add_one_sub (s : β) (n : β) :
term (s + 1) n - term s n = 1 / ((n : β) + s) - 1 / ((n : β) + 1 + s) := by proof Β· 4 lines
simp only [term]
have h : ((n : β) + (s + 1)) = ((n : β) + 1 + s) := by ring
rw [h]
ringtheorem tendsto_one_div_nat_add (s : β) :
Tendsto (fun n : β => 1 / ((n : β) + s)) atTop (π 0) := by proof Β· 17 lines
refine squeeze_zero_norm' ?_ (tendsto_const_div_atTop_nhds_zero_nat 2)
filter_upwards [eventually_ge_atTop (Nat.ceil (2 * βsβ) + 1)] with n hn
have hn1' : (1 : β) β€ n := le_trans (Nat.le_add_left 1 _) hn
have hn0 : (0 : β) < n := by exact_mod_cast hn1'
have h2s : 2 * βsβ β€ n := by
have h1 := Nat.le_ceil (2 * βsβ)
have h2 : ((Nat.ceil (2 * βsβ) : β) : β) β€ n := by
exact_mod_cast (le_trans (Nat.le_succ _) hn)
linarith
have hnorm : β(n : β)β = n := by simp
have hns : (n : β) / 2 β€ β(n : β) + sβ := by
have h1 : β(n : β)β - β-sβ β€ β(n : β) - (-s)β := norm_sub_norm_le _ _
rw [norm_neg, sub_neg_eq_add, hnorm] at h1
linarith
have hpos : 0 < β(n : β) + sβ := lt_of_lt_of_le (by positivity) hns
rw [norm_div, norm_one, div_le_div_iffβ hpos hn0]
linarith98The functional equation of the series: the same recurrence as
Complex.digamma_apply_add_one.
theorem tsum_term_add_one (s : β) :
β' n, term (s + 1) n = β' n, term s n + 1 / s := by proof Β· 18 lines
have hd : HasSum (fun n => term (s + 1) n - term s n) (β' n, term (s + 1) n - β' n, term s n) :=
(summable_term (s + 1)).hasSum.sub (summable_term s).hasSum
have hstep : β n : β, term (s + 1) n - term s n
= 1 / ((n : β) + s) - 1 / (((n + 1 : β) : β) + s) := by
intro n
rw [term_add_one_sub, Nat.cast_succ]
have hfun : (fun N : β => β n β Finset.range N, (term (s + 1) n - term s n))
= fun N : β => 1 / (((0 : β) : β) + s) - 1 / ((N : β) + s) := by
funext N
simp_rw [hstep]
exact Finset.sum_range_sub' (fun n : β => 1 / ((n : β) + s)) N
have ht : Tendsto (fun N : β => β n β Finset.range N, (term (s + 1) n - term s n)) atTop
(π (1 / s)) := by
rw [hfun]
have h := (tendsto_const_nhds (x := (1 : β) / s)).sub (tendsto_one_div_nat_add s)
simpa using h
have key := tendsto_nhds_unique hd.tendsto_sum_nat ht
linear_combination keynoncomputable def digammaSeries (s : β) : β := body Β· 1 line
-(Real.eulerMascheroniConstant : β) + β' n : β, term s n123The series obeys the digamma recurrence, for every
s.
theorem digammaSeries_add_one (s : β) : digammaSeries (s + 1) = digammaSeries s + 1 / s := by proof Β· 2 lines
simp only [digammaSeries, tsum_term_add_one] ring
128Hence the difference
digamma - digammaSeriesis 1-periodic away from the poles.
theorem diff_periodic (s : β) (hs : β m : β, s β -m) :
Complex.digamma (s + 1) - digammaSeries (s + 1) = Complex.digamma s - digammaSeries s := by proof Β· 2 lines
rw [Complex.digamma_apply_add_one s hs, digammaSeries_add_one, one_div]
ringOutline