Theorem: HasDerivAt.lhopital_zero_atBot_on_Iio
File: Mathlib/Analysis/Calculus/LHopital.lean

tactic: have hdnf : ∀ x ∈ -Iio a, HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x := fun x hx =>
  comp x (hff' (-x) hx) (hasDerivAt_neg x)
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: have hdng : ∀ x ∈ -Iio a, HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x := fun x hx =>
  comp x (hgg' (-x) hx) (hasDerivAt_neg x)
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ -Iio a → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: rw [preimage_neg_Iio] at hdnf
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ -Iio a → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ -Iio a → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: rw [preimage_neg_Iio] at hdng
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ -Iio a → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: have := lhopital_zero_atTop_on_Ioi hdnf hdng
  (by
    intro x hx h
    apply hg' _ (by rw [← preimage_neg_Iio] at hx; exact hx)
    rwa [mul_comm, ← neg_eq_neg_one_mul, neg_eq_zero] at h)
  (hfbot.comp tendsto_neg_atTop_atBot) (hgbot.comp tendsto_neg_atTop_atBot)
  (by
    simp only [mul_one, mul_neg, neg_div_neg_eq]
    exact (tendsto_congr fun x => rfl).mp (hdiv.comp tendsto_neg_atTop_atBot))
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: have := this.comp tendsto_neg_atBot_atTop
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
this : Tendsto (fun x => (f ∘ Neg.neg) x / (g ∘ Neg.neg) x) atTop l
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: unfold Function.comp at this
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
this✝ : Tendsto (fun x => (f ∘ Neg.neg) x / (g ∘ Neg.neg) x) atTop l
this : Tendsto ((fun x => (f ∘ Neg.neg) x / (g ∘ Neg.neg) x) ∘ Neg.neg) atBot l
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: simpa only [neg_neg]
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
this✝ : Tendsto (fun x => (f ∘ Neg.neg) x / (g ∘ Neg.neg) x) atTop l
this : Tendsto (fun x => (fun x => f (-x) / g (-x)) (-x)) atBot l
⊢ Tendsto (fun x => f x / g x) atBot l

tactic: intro x hx h
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
⊢ ∀ (x : ℝ), x ∈ Ioi (-a) → g' (-x) * -1 ≠ 0

tactic: apply hg' _ (by rw [← preimage_neg_Iio] at hx; exact hx)
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
x : ℝ
hx : x ∈ Ioi (-a)
h : g' (-x) * -1 = 0
⊢ False

tactic: rwa [mul_comm, ← neg_eq_neg_one_mul, neg_eq_zero] at h
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
x : ℝ
hx : x ∈ Ioi (-a)
h : g' (-x) * -1 = 0
⊢ g' (-x) = 0

tactic: rw [← preimage_neg_Iio] at hx
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
x : ℝ
hx : x ∈ Ioi (-a)
h : g' (-x) * -1 = 0
⊢ ?m.27057 ∈ Iio a

tactic: exact hx
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
x : ℝ
hx✝ : x ∈ Ioi (-a)
hx : x ∈ -Iio a
h : g' (-x) * -1 = 0
⊢ ?m.27141 h ∈ Iio a

tactic: simp only [mul_one, mul_neg, neg_div_neg_eq]
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
⊢ Tendsto (fun x => f' (-x) * -1 / (g' (-x) * -1)) atTop ?m.26894

tactic: exact (tendsto_congr fun x => rfl).mp (hdiv.comp tendsto_neg_atTop_atBot)
state_before: a b : ℝ
hab : a < b
l : Filter ℝ
f f' g g' : ℝ → ℝ
hff' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt f (f' x) x
hgg' : ∀ (x : ℝ), x ∈ Iio a → HasDerivAt g (g' x) x
hg' : ∀ (x : ℝ), x ∈ Iio a → g' x ≠ 0
hfbot : Tendsto f atBot (𝓝 0)
hgbot : Tendsto g atBot (𝓝 0)
hdiv : Tendsto (fun x => f' x / g' x) atBot l
hdnf : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (f ∘ Neg.neg) (f' (-x) * -1) x
hdng : ∀ (x : ℝ), x ∈ Ioi (-a) → HasDerivAt (g ∘ Neg.neg) (g' (-x) * -1) x
⊢ Tendsto (fun x => f' (-x) / g' (-x)) atTop ?m.26894