-- Mathlib/Analysis/SpecialFunctions/Gamma/BohrMollerup.lean
theorem log_doublingGamma_eq :
    EqOn (log ∘ doublingGamma)
      (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π))
      (Ioi 0)

Proof state:
s : ℝ
hs : s ∈ Ioi 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Tactic:
have h1 : √π ≠ 0 := sqrt_ne_zero'.mpr pi_pos

Result:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Proof state:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
h3 : Gamma (s / 2 + 1 / 2) ≠ 0
h4 : 2 ^ (s - 1) ≠ 0
⊢ log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + (s - 1) * log 2 - log √π =
    (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - (log 2 + log √π)) s

Tactic:
ring_nf

Result:
no goals

Proof state:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Tactic:
have h2 : Gamma (s / 2) ≠ 0 := (Gamma_pos_of_pos <| div_pos hs two_pos).ne'

Result:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Proof state:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Tactic:
have h3 : Gamma (s / 2 + 1 / 2) ≠ 0 :=
  (Gamma_pos_of_pos <| add_pos (div_pos hs two_pos) one_half_pos).ne'

Result:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
h3 : Gamma (s / 2 + 1 / 2) ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Proof state:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
h3 : Gamma (s / 2 + 1 / 2) ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Tactic:
have h4 : (2 : ℝ) ^ (s - 1) ≠ 0 := (rpow_pos_of_pos two_pos _).ne'

Result:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
h3 : Gamma (s / 2 + 1 / 2) ≠ 0
h4 : 2 ^ (s - 1) ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Proof state:
⊢ EqOn (log ∘ doublingGamma) (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π))
    (Ioi 0)

Tactic:
intro s hs

Result:
s : ℝ
hs : s ∈ Ioi 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Proof state:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
h3 : Gamma (s / 2 + 1 / 2) ≠ 0
h4 : 2 ^ (s - 1) ≠ 0
⊢ (log ∘ doublingGamma) s = (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - log (2 * √π)) s

Tactic:
rw [Function.comp_apply, doublingGamma, log_div (mul_ne_zero (mul_ne_zero h2 h3) h4) h1,
  log_mul (mul_ne_zero h2 h3) h4, log_mul h2 h3, log_rpow two_pos, log_mul two_ne_zero h1]

Result:
s : ℝ
hs : s ∈ Ioi 0
h1 : √π ≠ 0
h2 : Gamma (s / 2) ≠ 0
h3 : Gamma (s / 2 + 1 / 2) ≠ 0
h4 : 2 ^ (s - 1) ≠ 0
⊢ log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + (s - 1) * log 2 - log √π =
    (fun s => log (Gamma (s / 2)) + log (Gamma (s / 2 + 1 / 2)) + s * log 2 - (log 2 + log √π)) s