Theorem: HurwitzKernelBounds.summable_f_nat
File: Mathlib/NumberTheory/ModularForms/JacobiTheta/Bounds.lean

tactic: have : Summable fun n : ℕ ↦ n ^ k * exp (-π * (n + a) ^ 2 * t) := by
  refine (((summable_pow_mul_jacobiTheta₂_term_bound (|a| * t) ht k).mul_right
    (rexp (-π * a ^ 2 * t))).comp_injective Nat.cast_injective).of_norm_bounded _ (fun n ↦ ?_)
  simp_rw [mul_assoc, Function.comp_apply, ← Real.exp_add, norm_mul, norm_pow, Int.cast_abs,
    Int.cast_natCast, norm_eq_abs, Nat.abs_cast, abs_exp]
  refine mul_le_mul_of_nonneg_left ?_ (pow_nonneg (Nat.cast_nonneg _) _)
  rw [exp_le_exp, ← sub_nonneg]
  rw [show -π * (t * n ^ 2 - 2 * (|a| * (t * n))) + -π * (a ^ 2 * t) - -π * ((n + a) ^ 2 * t)
       = π * t * n * (|a| + a) * 2 by ring]
  refine mul_nonneg (mul_nonneg (by positivity) ?_) two_pos.le
  rw [← neg_le_iff_add_nonneg]
  apply neg_le_abs
state_before: k : ℕ
a t : ℝ
ht : 0 < t
⊢ Summable (f_nat k a t)
state_after: k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
⊢ Summable (f_nat k a t)

tactic: apply (this.mul_left (2 ^ k)).of_norm_bounded_eventually_nat
state_before: k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
⊢ Summable (f_nat k a t)
state_after: k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
⊢ ∀ᶠ (i : ℕ) in atTop, ‖f_nat k a t i‖ ≤ 2 ^ k * (↑i ^ k * rexp (-π * (↑i + a) ^ 2 * t))

tactic: simp_rw [← mul_assoc, f_nat, norm_mul, norm_eq_abs, abs_exp,
  mul_le_mul_iff_of_pos_right (exp_pos _), ← mul_pow, abs_pow, two_mul]
state_before: k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
⊢ ∀ᶠ (i : ℕ) in atTop, ‖f_nat k a t i‖ ≤ 2 ^ k * (↑i ^ k * rexp (-π * (↑i + a) ^ 2 * t))
state_after: k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
⊢ ∀ᶠ (i : ℕ) in atTop, |↑i + a| ^ k ≤ (↑i + ↑i) ^ k

tactic: filter_upwards [eventually_ge_atTop (Nat.ceil |a|)] with n hn
state_before: k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
⊢ ∀ᶠ (i : ℕ) in atTop, |↑i + a| ^ k ≤ (↑i + ↑i) ^ k
state_after: case h
k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
n : ℕ
hn : ⌈|a|⌉₊ ≤ n
⊢ |↑n + a| ^ k ≤ (↑n + ↑n) ^ k

tactic: apply pow_le_pow_left (abs_nonneg _) ((abs_add_le _ _).trans
  (add_le_add (le_of_eq (Nat.abs_cast _)) (Nat.ceil_le.mp hn)))
state_before: case h
k : ℕ
a t : ℝ
ht : 0 < t
this : Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
n : ℕ
hn : ⌈|a|⌉₊ ≤ n
⊢ |↑n + a| ^ k ≤ (↑n + ↑n) ^ k
state_after: no goals

tactic: refine (((summable_pow_mul_jacobiTheta₂_term_bound (|a| * t) ht k).mul_right
  (rexp (-π * a ^ 2 * t))).comp_injective Nat.cast_injective).of_norm_bounded _ (fun n ↦ ?_)
state_before: k : ℕ
a t : ℝ
ht : 0 < t
⊢ Summable fun n => ↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ ‖↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)‖ ≤
    ((fun i => ↑|i| ^ k * rexp (-π * (t * ↑i ^ 2 - 2 * (|a| * t) * ↑|i|)) * rexp (-π * a ^ 2 * t)) ∘ Nat.cast) n

tactic: simp_rw [mul_assoc, Function.comp_apply, ← Real.exp_add, norm_mul, norm_pow, Int.cast_abs,
  Int.cast_natCast, norm_eq_abs, Nat.abs_cast, abs_exp]
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ ‖↑n ^ k * rexp (-π * (↑n + a) ^ 2 * t)‖ ≤
    ((fun i => ↑|i| ^ k * rexp (-π * (t * ↑i ^ 2 - 2 * (|a| * t) * ↑|i|)) * rexp (-π * a ^ 2 * t)) ∘ Nat.cast) n
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ ↑n ^ k * rexp (-π * ((↑n + a) ^ 2 * t)) ≤ ↑n ^ k * rexp (-π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t))

tactic: refine mul_le_mul_of_nonneg_left ?_ (pow_nonneg (Nat.cast_nonneg _) _)
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ ↑n ^ k * rexp (-π * ((↑n + a) ^ 2 * t)) ≤ ↑n ^ k * rexp (-π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t))
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ rexp (-π * ((↑n + a) ^ 2 * t)) ≤ rexp (-π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t))

tactic: rw [exp_le_exp, ← sub_nonneg]
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ rexp (-π * ((↑n + a) ^ 2 * t)) ≤ rexp (-π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t))
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ -π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t) - -π * ((↑n + a) ^ 2 * t)

tactic: rw [show -π * (t * n ^ 2 - 2 * (|a| * (t * n))) + -π * (a ^ 2 * t) - -π * ((n + a) ^ 2 * t)
     = π * t * n * (|a| + a) * 2 by ring]
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ -π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t) - -π * ((↑n + a) ^ 2 * t)
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ π * t * ↑n * (|a| + a) * 2

tactic: refine mul_nonneg (mul_nonneg (by positivity) ?_) two_pos.le
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ π * t * ↑n * (|a| + a) * 2
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ |a| + a

tactic: rw [← neg_le_iff_add_nonneg]
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ |a| + a
state_after: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ -a ≤ |a|

tactic: apply neg_le_abs
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ -a ≤ |a|
state_after: no goals

tactic: ring
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ -π * (t * ↑n ^ 2 - 2 * (|a| * (t * ↑n))) + -π * (a ^ 2 * t) - -π * ((↑n + a) ^ 2 * t) = π * t * ↑n * (|a| + a) * 2
state_after: no goals

tactic: positivity
state_before: k : ℕ
a t : ℝ
ht : 0 < t
n : ℕ
⊢ 0 ≤ π * t * ↑n
state_after: no goals