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

tactic: obtain ⟨a, ha, rfl⟩ := a.eq_coe_Ico
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 ⟨p, hp, hp'⟩ := isBigO_atTop_F_nat_zero_sub ha.1
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 ⟨q, hq, hq'⟩ := isBigO_atTop_F_nat_zero_sub (sub_nonneg.mpr ha.2.le)
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: 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
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 [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
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: 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)
⊢ ∃ 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: 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)
⊢ (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: 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
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: exacts [min_le_left .., min_le_right ..]
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: rw [← AddCircle.coe_eq_coe_iff_of_mem_Ico (hp := ⟨zero_lt_one' ℝ⟩), QuotientAddGroup.mk_zero]
state_before: 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)
⊢ ↑a = 0 ↔ a = 0
state_after: case hx
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)
⊢ a ∈ Ico ?m.182483 (?m.182483 + 1)

case hy
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)
⊢ 0 ∈ Ico ?m.182483 (?m.182483 + 1)

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)
⊢ ℝ

tactic: rw [zero_add]
state_before: case hx
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)
⊢ a ∈ Ico ?m.182483 (?m.182483 + 1)
state_after: case hx
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)
⊢ a ∈ Ico 0 1

tactic: exact ha
state_before: case hx
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)
⊢ a ∈ Ico 0 1
state_after: no goals

tactic: simp
state_before: case hy
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)
⊢ 0 ∈ Ico 0 (0 + 1)
state_after: no goals

tactic: linarith [ha.2]
state_before: 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
⊢ 1 - a ≠ 0
state_after: no goals

tactic: filter_upwards [eventually_gt_atTop 0] with t ht
state_before: 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) =ᶠ[atTop] fun t =>
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
state_after: case h
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)
t : ℝ
ht : 0 < t
⊢ (F_int 0 (↑a) t - if a = 0 then 1 else 0) = (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t

tactic: rw [F_int_eq_of_mem_Icc 0 (Ico_subset_Icc_self ha) ht]
state_before: case h
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)
t : ℝ
ht : 0 < t
⊢ (F_int 0 (↑a) t - if a = 0 then 1 else 0) = (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
state_after: case h
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)
t : ℝ
ht : 0 < t
⊢ (F_nat 0 a t + F_nat 0 (1 - a) t - if a = 0 then 1 else 0) =
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t

tactic: ring
state_before: case h
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)
t : ℝ
ht : 0 < t
⊢ (F_nat 0 a t + F_nat 0 (1 - a) t - if a = 0 then 1 else 0) =
    (F_nat 0 a t - if a = 0 then 1 else 0) + F_nat 0 (1 - a) t
state_after: no goals