-- Mathlib/NumberTheory/LSeries/HurwitzZetaEven.lean
/-- Formula for `completedCosZeta` as a Dirichlet series in the convergence range
(first version, with sum over `ℤ`). -/
lemma hasSum_int_completedCosZeta (a : ℝ) {s : ℂ} (hs : 1 < re s) :
    HasSum (fun n : ℤ ↦ Gammaℝ s * cexp (2 * π * I * a * n) / (↑|n| : ℂ) ^ s / 2)
    (completedCosZeta a s)

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ (hurwitzEvenFEPair ↑a).symm.Λ (s / 2) / 2 = mellin (fun t => ↑(cosKernel (↑a) t) - 1) (s / 2) / 2

Tactic:
congr 1

Result:
case e_a
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ (hurwitzEvenFEPair ↑a).symm.Λ (s / 2) = mellin (fun t => ↑(cosKernel (↑a) t) - 1) (s / 2)

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
i : ℤ
⊢ 0 ≤ |↑i| ^ s.re

Tactic:
positivity

Result:
no goals

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
i : ℤ
⊢ 2 * ↑π * I * ↑a * ↑i = ↑(2 * π * a * ↑i) * I

Tactic:
push_cast

Result:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
i : ℤ
⊢ 2 * ↑π * I * ↑a * ↑i = 2 * ↑π * ↑a * ↑i * I

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2) (completedCosZeta (↑a) s)

Tactic:
rw [show completedCosZeta a s = mellin (fun t ↦ (cosKernel a t - 1 : ℂ) / 2) (s / 2) by
  rw [mellin_div_const, completedCosZeta]
  congr 1
  refine ((hurwitzEvenFEPair a).symm.hasMellin (?_ : 1 / 2 < (s / 2).re)).2.symm
  rwa [div_ofNat_re, div_lt_div_iff_of_pos_right two_pos]]

Result:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2)
    (mellin (fun t => (↑(cosKernel (↑a) t) - 1) / 2) (s / 2))

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
t : ℝ
ht : 0 < t
n : ℤ
⊢ (if n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) =
    (if n = 0 then 0 else cexp (2 * ↑π * I * ↑a * ↑n) * ↑(rexp (-π * ↑n ^ 2 * t))) / 2

Tactic:
split_ifs <;> simp [c, div_mul_eq_mul_div]

Result:
no goals

Proof state:
case refine_2
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
n : ℤ
⊢ s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2 = s.Gammaℝ * c n / ↑|↑n| ^ s

Tactic:
simp [c, ← Int.cast_abs, div_right_comm, mul_div_assoc]

Result:
no goals

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
t : ℝ
ht : 0 < t
⊢ HasSum (fun n => if n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)

Tactic:
refine ((hasSum_int_cosKernel₀ a ht).div_const 2).congr_fun fun n ↦ ?_

Result:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
t : ℝ
ht : 0 < t
n : ℤ
⊢ (if n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) =
    (if n = 0 then 0 else cexp (2 * ↑π * I * ↑a * ↑n) * ↑(rexp (-π * ↑n ^ 2 * t))) / 2

Proof state:
case refine_1
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
i : ℤ
⊢ ‖‖c i‖ / |↑i| ^ s.re‖ ≤ 1 / |↑i + 0| ^ s.re / 2

Tactic:
simp only [c, (by { push_cast; ring } : 2 * π * I * a * i = ↑(2 * π * a * i) * I), norm_div,
  RCLike.norm_ofNat, norm_norm, Complex.norm_exp_ofReal_mul_I, add_zero, norm_one,
  norm_of_nonneg (by positivity : 0 ≤ |(i : ℝ)| ^ s.re), div_right_comm, le_rfl]

Result:
no goals

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ completedCosZeta (↑a) s = mellin (fun t => (↑(cosKernel (↑a) t) - 1) / 2) (s / 2)

Tactic:
rw [mellin_div_const, completedCosZeta]

Result:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ (hurwitzEvenFEPair ↑a).symm.Λ (s / 2) / 2 = mellin (fun t => ↑(cosKernel (↑a) t) - 1) (s / 2) / 2

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2) (completedCosZeta (↑a) s)

Tactic:
simp only [← Int.cast_eq_zero (α := ℝ)] at hF

Result:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2) (completedCosZeta (↑a) s)

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2) (completedCosZeta (↑a) s)

Tactic:
let c (n : ℤ) : ℂ := cexp (2 * π * I * a * n) / 2

Result:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2) (completedCosZeta (↑a) s)

Proof state:
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ HasSum (fun n => s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2)
    (mellin (fun t => (↑(cosKernel (↑a) t) - 1) / 2) (s / 2))

Tactic:
refine (hasSum_mellin_pi_mul_sq (zero_lt_one.trans hs) hF ?_).congr_fun fun n ↦ ?_

Result:
case refine_1
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ Summable fun i => ‖c i‖ / |↑i| ^ s.re

case refine_2
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
n : ℤ
⊢ s.Gammaℝ * cexp (2 * ↑π * I * ↑a * ↑n) / ↑|n| ^ s / 2 = s.Gammaℝ * c n / ↑|↑n| ^ s

Proof state:
case e_a
a : ℝ
s : ℂ
hs : 1 < s.re
c : ℤ → ℂ := fun n => cexp (2 * ↑π * I * ↑a * ↑n) / 2
hF :
  ∀ (t : ℝ),
    0 < t → HasSum (fun n => if ↑n = 0 then 0 else c n * ↑(rexp (-π * ↑n ^ 2 * t))) ((↑(cosKernel (↑a) t) - 1) / 2)
⊢ 1 / 2 < (s / 2).re

Tactic:
rwa [div_ofNat_re, div_lt_div_iff_of_pos_right two_pos]

Result:
no goals