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

Proof steps:
state_before: a : UnitAddCircle
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
state_after: case intro.intro
a : ℝ
ha : a ∈ Ico 0 1
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if ↑a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
tactic: obtain ⟨a, ha, rfl⟩ := a.eq_coe_Ico
state_before: case intro.intro
a : ℝ
ha : a ∈ Ico 0 1
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if ↑a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
state_after: case intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if ↑a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
tactic: obtain ⟨p, hp, hp'⟩ := isBigO_atTop_F_nat_zero_sub ha.1
state_before: case intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if ↑a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
state_after: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
hq' : (fun t => F_nat 0 (1 - a) t - if 1 - a = 0 then 1 else 0) =O[atTop] fun t => rexp (-q * t)
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if ↑a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
tactic: obtain ⟨q, hq, hq'⟩ := isBigO_atTop_F_nat_zero_sub (sub_nonneg.mpr ha.2.le)
state_before: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
hq' : (fun t => F_nat 0 (1 - a) t - if 1 - a = 0 then 1 else 0) =O[atTop] fun t => rexp (-q * t)
ha' : ↑a = 0 ↔ a = 0
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if ↑a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
state_after: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
hq' : (fun t => F_nat 0 (1 - a) t - if 1 - a = 0 then 1 else 0) =O[atTop] fun t => rexp (-q * t)
ha' : ↑a = 0 ↔ a = 0
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
tactic: simp_rw [ha']
state_before: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
hq' : (fun t => F_nat 0 (1 - a) t - if 1 - a = 0 then 1 else 0) =O[atTop] fun t => rexp (-q * t)
ha' : ↑a = 0 ↔ a = 0
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
state_after: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
tactic: simp_rw [eq_false_intro (by linarith [ha.2] : 1 - a ≠ 0), if_false, sub_zero] at hq'
state_before: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
⊢ ∃ p, 0 < p ∧ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
state_after: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
⊢ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-min p q * t)
tactic: refine ⟨_, lt_min hp hq, ?_⟩
state_before: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
⊢ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-min p q * t)
state_after: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
this :
  (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
⊢ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-min p q * t)
tactic: have : (fun t ↦ F_int 0 a t - (if a = 0 then 1 else 0)) =ᶠ[atTop]
      fun t ↦ (F_nat 0 a t - (if a = 0 then 1 else 0)) + F_nat 0 (1 - a) t := by
    filter_upwards [eventually_gt_atTop 0] with t ht
    rw [F_int_eq_of_mem_Icc 0 (Ico_subset_Icc_self ha) ht]
    ring
state_before: case intro.intro.intro.intro.intro.intro
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
this :
  (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
⊢ (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-min p q * t)
state_after: case intro.intro.intro.intro.intro.intro.refine_1.hcd
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
this :
  (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
⊢ min p q ≤ p

case intro.intro.intro.intro.intro.intro.refine_2.hcd
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
this :
  (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
⊢ min p q ≤ q
tactic: refine this.isBigO.trans ((hp'.trans ?_).add (hq'.trans ?_)) <;>
  apply isBigO_exp_neg_mul_of_le
state_before: case intro.intro.intro.intro.intro.intro.refine_1.hcd
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
this :
  (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
⊢ min p q ≤ p

case intro.intro.intro.intro.intro.intro.refine_2.hcd
a : ℝ
ha : a ∈ Ico 0 1
p : ℝ
hp : 0 < p
hp' : (fun t => F_nat 0 a t - if a = 0 then 1 else 0) =O[atTop] fun t => rexp (-p * t)
q : ℝ
hq : 0 < q
ha' : ↑a = 0 ↔ a = 0
hq' : (fun t => F_nat 0 (1 - a) t) =O[atTop] fun t => rexp (-q * t)
this :
  (fun t => F_int 0 (↑a) t - if a = 0 then 1 else 0) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
⊢ min p q ≤ q
state_after: no goals
tactic: exacts [min_le_left .., min_le_right ..]