Theorem: integral_cpow
File: Mathlib/Analysis/SpecialFunctions/Integrals.lean

tactic: rw [sub_div]
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
⊢ (∫ (x : ℝ) in a..b, ↑x ^ r) = (↑b ^ (r + 1) - ↑a ^ (r + 1)) / (r + 1)

tactic: by_cases hab : (0 : ℝ) ∉ [[a, b]]
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hr : r + 1 ≠ 0
⊢ (∫ (x : ℝ) in a..b, ↑x ^ r) = ↑b ^ (r + 1) / (r + 1) - ↑a ^ (r + 1) / (r + 1)

tactic: replace h : -1 < r.re
state_before: case neg
a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
⊢ (∫ (x : ℝ) in a..b, ↑x ^ r) = ↑b ^ (r + 1) / (r + 1) - ↑a ^ (r + 1) / (r + 1)

tactic: suffices ∀ c : ℝ, (∫ x : ℝ in (0)..c, (x : ℂ) ^ r) =
    (c:ℂ) ^ (r + 1) / (r + 1) - (0:ℂ) ^ (r + 1) / (r + 1) by
  rw [← integral_add_adjacent_intervals (@intervalIntegrable_cpow' a 0 r h)
    (@intervalIntegrable_cpow' 0 b r h), integral_symm, this a, this b, Complex.zero_cpow hr]
  ring
state_before: case neg
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
⊢ (∫ (x : ℝ) in a..b, ↑x ^ r) = ↑b ^ (r + 1) / (r + 1) - ↑a ^ (r + 1) / (r + 1)

tactic: intro c
state_before: case neg
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
⊢ ∀ (c : ℝ), (∫ (x : ℝ) in 0 ..c, ↑x ^ r) = ↑c ^ (r + 1) / (r + 1) - 0 ^ (r + 1) / (r + 1)

tactic: apply integral_eq_sub_of_hasDeriv_right
state_before: case neg
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c : ℝ
⊢ (∫ (x : ℝ) in 0 ..c, ↑x ^ r) = ↑c ^ (r + 1) / (r + 1) - 0 ^ (r + 1) / (r + 1)

tactic: cases' h with h h
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
⊢ r + 1 ≠ 0

tactic: apply_fun Complex.re
state_before: case inl
a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re
⊢ r + 1 ≠ 0

tactic: rw [Complex.add_re, Complex.one_re, Complex.zero_re, Ne.def, add_eq_zero_iff_eq_neg]
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re
⊢ (r + 1).re ≠ 0.re

tactic: exact h.ne'
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re
⊢ ¬r.re = -1

tactic: rw [Ne.def, ← add_eq_zero_iff_eq_neg] at h
state_before: case inr
a b : ℝ
n : ℕ
r : ℂ
h : r ≠ -1 ∧ ¬0 ∈ [[a, b]]
⊢ r + 1 ≠ 0

tactic: exact h.1
state_before: case inr
a b : ℝ
n : ℕ
r : ℂ
h : ¬r + 1 = 0 ∧ ¬0 ∈ [[a, b]]
⊢ r + 1 ≠ 0

tactic: apply integral_eq_sub_of_hasDerivAt (fun x hx => ?_)
  (intervalIntegrable_cpow (r := r) <| Or.inr hab)
state_before: case pos
a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hr : r + 1 ≠ 0
hab : ¬0 ∈ [[a, b]]
⊢ (∫ (x : ℝ) in a..b, ↑x ^ r) = ↑b ^ (r + 1) / (r + 1) - ↑a ^ (r + 1) / (r + 1)

tactic: refine' hasDerivAt_ofReal_cpow (ne_of_mem_of_not_mem hx hab) _
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hr : r + 1 ≠ 0
hab : ¬0 ∈ [[a, b]]
x : ℝ
hx : x ∈ [[a, b]]
⊢ HasDerivAt (fun {b} => ↑b ^ (r + 1) / (r + 1)) (↑x ^ r) x

tactic: contrapose! hr
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hr : r + 1 ≠ 0
hab : ¬0 ∈ [[a, b]]
x : ℝ
hx : x ∈ [[a, b]]
⊢ r ≠ -1

tactic: rwa [add_eq_zero_iff_eq_neg]
state_before: a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hab : ¬0 ∈ [[a, b]]
x : ℝ
hx : x ∈ [[a, b]]
hr : r = -1
⊢ r + 1 = 0

tactic: tauto
state_before: case h
a b : ℝ
n : ℕ
r : ℂ
h : -1 < r.re ∨ r ≠ -1 ∧ ¬0 ∈ [[a, b]]
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
⊢ -1 < r.re

tactic: rw [← integral_add_adjacent_intervals (@intervalIntegrable_cpow' a 0 r h)
  (@intervalIntegrable_cpow' 0 b r h), integral_symm, this a, this b, Complex.zero_cpow hr]
state_before: a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
this : ∀ (c : ℝ), (∫ (x : ℝ) in 0 ..c, ↑x ^ r) = ↑c ^ (r + 1) / (r + 1) - 0 ^ (r + 1) / (r + 1)
⊢ (∫ (x : ℝ) in a..b, ↑x ^ r) = ↑b ^ (r + 1) / (r + 1) - ↑a ^ (r + 1) / (r + 1)

tactic: ring
state_before: a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
this : ∀ (c : ℝ), (∫ (x : ℝ) in 0 ..c, ↑x ^ r) = ↑c ^ (r + 1) / (r + 1) - 0 ^ (r + 1) / (r + 1)
⊢ -(↑a ^ (r + 1) / (r + 1) - 0 / (r + 1)) + (↑b ^ (r + 1) / (r + 1) - 0 / (r + 1)) =
    ↑b ^ (r + 1) / (r + 1) - ↑a ^ (r + 1) / (r + 1)

tactic: refine' ((Complex.continuous_ofReal_cpow_const _).div_const _).continuousOn
state_before: case neg.hcont
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c : ℝ
⊢ ContinuousOn (fun c => ↑c ^ (r + 1) / (r + 1)) [[0, c]]

tactic: rwa [Complex.add_re, Complex.one_re, ← neg_lt_iff_pos_add]
state_before: case neg.hcont
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c : ℝ
⊢ 0 < (r + 1).re

tactic: refine' fun x hx => (hasDerivAt_ofReal_cpow _ _).hasDerivWithinAt
state_before: case neg.hderiv
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c : ℝ
⊢ ∀ (x : ℝ), x ∈ Set.Ioo (min 0 c) (max 0 c) → HasDerivWithinAt (fun c => ↑c ^ (r + 1) / (r + 1)) (↑x ^ r) (Set.Ioi x) x

tactic: rcases le_total c 0 with (hc | hc)
state_before: case neg.hderiv.refine'_1
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) (max 0 c)
⊢ x ≠ 0

tactic: rw [max_eq_left hc] at hx
state_before: case neg.hderiv.refine'_1.inl
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) (max 0 c)
hc : c ≤ 0
⊢ x ≠ 0

tactic: exact hx.2.ne
state_before: case neg.hderiv.refine'_1.inl
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) 0
hc : c ≤ 0
⊢ x ≠ 0

tactic: rw [min_eq_left hc] at hx
state_before: case neg.hderiv.refine'_1.inr
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) (max 0 c)
hc : 0 ≤ c
⊢ x ≠ 0

tactic: exact hx.1.ne'
state_before: case neg.hderiv.refine'_1.inr
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo 0 (max 0 c)
hc : 0 ≤ c
⊢ x ≠ 0

tactic: contrapose! hr
state_before: case neg.hderiv.refine'_2
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) (max 0 c)
⊢ r ≠ -1

tactic: rw [hr]
state_before: case neg.hderiv.refine'_2
a b : ℝ
n : ℕ
r : ℂ
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) (max 0 c)
hr : r = -1
⊢ r + 1 = 0

tactic: ring
state_before: case neg.hderiv.refine'_2
a b : ℝ
n : ℕ
r : ℂ
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c x : ℝ
hx : x ∈ Set.Ioo (min 0 c) (max 0 c)
hr : r = -1
⊢ -1 + 1 = 0

tactic: exact intervalIntegrable_cpow' h
state_before: case neg.hint
a b : ℝ
n : ℕ
r : ℂ
hr : r + 1 ≠ 0
hab : ¬¬0 ∈ [[a, b]]
h : -1 < r.re
c : ℝ
⊢ IntervalIntegrable (fun y => ↑y ^ r) MeasureTheory.volume 0 c