-- Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean
theorem integral_Ioi_rpow_of_lt {a : ℝ} (ha : a < -1) {c : ℝ} (hc : 0 < c) :
    ∫ t : ℝ in Ioi c, t ^ a = -c ^ (a + 1) / (a + 1)

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
⊢ ∫ (t : ℝ) in Ioi c, t ^ a = -c ^ (a + 1) / (a + 1)

Tactic:
have hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x := by
  intro x hx
  convert (hasDerivAt_rpow_const (p := a + 1) (Or.inl (hc.trans_le hx).ne')).div_const _ using 1
  field_simp [show a + 1 ≠ 0 from ne_of_lt (by linarith), mul_comm]

Result:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
⊢ ∫ (t : ℝ) in Ioi c, t ^ a = -c ^ (a + 1) / (a + 1)

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
x : ℝ
hx : x ∈ Ici c
⊢ HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x

Tactic:
convert (hasDerivAt_rpow_const (p := a + 1) (Or.inl (hc.trans_le hx).ne')).div_const _ using 1

Result:
case h.e'_9
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
x : ℝ
hx : x ∈ Ici c
⊢ x ^ a = (a + 1) * x ^ (a + 1 - 1) / (a + 1)

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
⊢ ∫ (t : ℝ) in Ioi c, t ^ a = -c ^ (a + 1) / (a + 1)

Tactic:
have ht : Tendsto (fun t => t ^ (a + 1) / (a + 1)) atTop (𝓝 (0 / (a + 1))) := by
  apply Tendsto.div_const
  simpa only [neg_neg] using tendsto_rpow_neg_atTop (by linarith : 0 < -(a + 1))

Result:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
ht : Tendsto (fun t => t ^ (a + 1) / (a + 1)) atTop (𝓝 (0 / (a + 1)))
⊢ ∫ (t : ℝ) in Ioi c, t ^ a = -c ^ (a + 1) / (a + 1)

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
ht : Tendsto (fun t => t ^ (a + 1) / (a + 1)) atTop (𝓝 (0 / (a + 1)))
⊢ ∫ (t : ℝ) in Ioi c, t ^ a = -c ^ (a + 1) / (a + 1)

Tactic:
convert integral_Ioi_of_hasDerivAt_of_tendsto' hd (integrableOn_Ioi_rpow_of_lt ha hc) ht using 1

Result:
case h.e'_3
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
ht : Tendsto (fun t => t ^ (a + 1) / (a + 1)) atTop (𝓝 (0 / (a + 1)))
⊢ -c ^ (a + 1) / (a + 1) = 0 / (a + 1) - c ^ (a + 1) / (a + 1)

Proof state:
case h.e'_9
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
x : ℝ
hx : x ∈ Ici c
⊢ x ^ a = (a + 1) * x ^ (a + 1 - 1) / (a + 1)

Tactic:
field_simp [show a + 1 ≠ 0 from ne_of_lt (by linarith), mul_comm]

Result:
no goals

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
⊢ Tendsto (fun t => t ^ (a + 1) / (a + 1)) atTop (𝓝 (0 / (a + 1)))

Tactic:
apply Tendsto.div_const

Result:
case hf
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
⊢ Tendsto (fun a_1 => a_1 ^ (a + 1)) atTop (𝓝 0)

Proof state:
case hf
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
⊢ Tendsto (fun a_1 => a_1 ^ (a + 1)) atTop (𝓝 0)

Tactic:
simpa only [neg_neg] using tendsto_rpow_neg_atTop (by linarith : 0 < -(a + 1))

Result:
no goals

Proof state:
case h.e'_3
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
ht : Tendsto (fun t => t ^ (a + 1) / (a + 1)) atTop (𝓝 (0 / (a + 1)))
⊢ -c ^ (a + 1) / (a + 1) = 0 / (a + 1) - c ^ (a + 1) / (a + 1)

Tactic:
simp only [neg_div, zero_div, zero_sub]

Result:
no goals

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
⊢ ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x

Tactic:
intro x hx

Result:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
x : ℝ
hx : x ∈ Ici c
⊢ HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
x : ℝ
hx : x ∈ Ici c
⊢ a + 1 < 0

Tactic:
linarith

Result:
no goals

Proof state:
a : ℝ
ha : a < -1
c : ℝ
hc : 0 < c
hd : ∀ x ∈ Ici c, HasDerivAt (fun t => t ^ (a + 1) / (a + 1)) (x ^ a) x
⊢ 0 < -(a + 1)

Tactic:
linarith

Result:
no goals