-- Mathlib/Analysis/SpecialFunctions/Gaussian/PoissonSummation.lean
theorem Complex.tsum_exp_neg_quadratic {a : ℂ} (ha : 0 < a.re) (b : ℂ) :
    (∑' n : ℤ, cexp (-π * a * n ^ 2 + 2 * π * b * n)) =
      1 / a ^ (1 / 2 : ℂ) * ∑' n : ℤ, cexp (-π / a * (n + I * b) ^ 2)

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
this : ∀ (x : ℝ), -↑π / a * (↑x + I * b) ^ 2 = -↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x + ↑π * b ^ 2 / a
⊢ (fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x + ↑π * b ^ 2 / a)) =O[cocompact ℝ]
    fun x => |x| ^ (-2)

Tactic:
conv => enter [2, x]; rw [Complex.exp_add, ← mul_assoc _ _ (Complex.exp _), mul_comm]

Result:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
this : ∀ (x : ℝ), -↑π / a * (↑x + I * b) ^ 2 = -↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x + ↑π * b ^ 2 / a
⊢ (fun x =>
      cexp (↑π * b ^ 2 / a) * (1 / a ^ (1 / 2) * cexp (-↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x))) =O[cocompact ℝ]
    fun x => |x| ^ (-2)

Proof state:
case h.e'_3
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
Ff_bd : 𝓕 f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ 1 / a ^ (1 / 2) * ∑' (n : ℤ), cexp (-↑π / a * (↑n + I * b) ^ 2) = ∑' (n : ℤ), 𝓕 f ↑n * (fourier n) ↑0

Tactic:
rw [← tsum_mul_left]

Result:
case h.e'_3
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
Ff_bd : 𝓕 f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ ∑' (x : ℤ), 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2) = ∑' (n : ℤ), 𝓕 f ↑n * (fourier n) ↑0

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
⊢ 0 < (↑π / a).re

Tactic:
rw [div_eq_mul_inv, re_ofReal_mul, inv_re]

Result:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
⊢ 0 < π * (a.re / normSq a)

Proof state:
case convert_2
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
⊢ (-↑π * a).re < 0

Tactic:
rwa [neg_mul, neg_re, neg_lt_zero]

Result:
no goals

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
⊢ ∑' (n : ℤ), cexp (-↑π * a * ↑n ^ 2 + 2 * ↑π * b * ↑n) =
    1 / a ^ (1 / 2) * ∑' (n : ℤ), cexp (-↑π / a * (↑n + I * b) ^ 2)

Tactic:
have hFf : 𝓕 f = fun x : ℝ ↦ 1 / a ^ (1 / 2 : ℂ) * cexp (-π / a * (x + I * b) ^ 2) :=
  fourierIntegral_gaussian_pi' ha b

Result:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
⊢ ∑' (n : ℤ), cexp (-↑π * a * ↑n ^ 2 + 2 * ↑π * b * ↑n) =
    1 / a ^ (1 / 2) * ∑' (n : ℤ), cexp (-↑π / a * (↑n + I * b) ^ 2)

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
Ff_bd : 𝓕 f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ ∑' (n : ℤ), cexp (-↑π * a * ↑n ^ 2 + 2 * ↑π * b * ↑n) =
    1 / a ^ (1 / 2) * ∑' (n : ℤ), cexp (-↑π / a * (↑n + I * b) ^ 2)

Tactic:
convert Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay hCf one_lt_two f_bd Ff_bd 0 using 1

Result:
case h.e'_2
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
Ff_bd : 𝓕 f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ ∑' (n : ℤ), cexp (-↑π * a * ↑n ^ 2 + 2 * ↑π * b * ↑n) = ∑' (n : ℤ), f (0 + ↑n)

case h.e'_3
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
Ff_bd : 𝓕 f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ 1 / a ^ (1 / 2) * ∑' (n : ℤ), cexp (-↑π / a * (↑n + I * b) ^ 2) = ∑' (n : ℤ), 𝓕 f ↑n * (fourier n) ↑0

Proof state:
case refine_2
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
⊢ Continuous fun x => 2 * ↑π * b * ↑x

Tactic:
exact continuous_const.mul Complex.continuous_ofReal

Result:
no goals

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ ∀ (x : ℝ), -↑π / a * (↑x + I * b) ^ 2 = -↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x + ↑π * b ^ 2 / a

Tactic:
intro x

Result:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
x : ℝ
⊢ -↑π / a * (↑x + I * b) ^ 2 = -↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x + ↑π * b ^ 2 / a

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ 𝓕 f =O[cocompact ℝ] fun x => |x| ^ (-2)

Tactic:
rw [hFf]

Result:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
⊢ (fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)) =O[cocompact ℝ] fun x => |x| ^ (-2)

Proof state:
a : ℂ
ha : 0 < a.re
b : ℂ
f : ℝ → ℂ := fun x => cexp (-↑π * a * ↑x ^ 2 + 2 * ↑π * b * ↑x)
hCf : Continuous f
hFf : 𝓕 f = fun x => 1 / a ^ (1 / 2) * cexp (-↑π / a * (↑x + I * b) ^ 2)
h1 : 0 < (↑π * a).re
h2 : 0 < (↑π / a).re
f_bd : f =O[cocompact ℝ] fun x => |x| ^ (-2)
this : ∀ (x : ℝ), -↑π / a * (↑x + I * b) ^ 2 = -↑π / a * ↑x ^ 2 + -2 * ↑π * I * b / a * ↑x + ↑π * b ^ 2 / a
⊢ (-↑π / a).re < 0

Tactic:
rwa [neg_div, neg_re, neg_lt_zero]

Result:
no goals