-- File: FoML/FoML/ForMathlib/Probability/Moments.lean
Theorem statement:
theorem extracted_formal_statement_105.{u_1} {Ω : Type u_1} {m : MeasurableSpace Ω} {μ : Measure Ω}
  [inst : IsFiniteMeasure μ] [inst_1 : NeZero μ] (a b : ℝ) {X : Ω → ℝ} (hX : AEMeasurable X μ)
  (h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b) :
  let f := fun t => cgf X μ t;
  ∀ (t : ℝ),
    (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ →
      HasDerivAt f ((∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ) t := sorry

Tactic state before:
Ω : Type u_1
m : MeasurableSpace Ω
μ : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : NeZero μ
a b : ℝ
X : Ω → ℝ
hX : AEMeasurable X μ
h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
f : ℝ → ℝ := fun t => cgf X μ t
f' : ℝ → ℝ := fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω
t : ℝ
g : ℝ → ℝ := fun t => ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ
g' : ℝ → ℝ := fun t => ∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ
r0 : (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
⊢ HasDerivAt f ((∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ) t

Tactic: apply
  HasDerivAt.log (tilt_first_deriv _ _ _ hX h (integrable_deriv_expt t a b hX h))
    (mgf_pos' (NeZero.ne μ) (integrable_expt_bound hX h)).ne'

Tactic state after:

Premises used:
HasDerivAt.log : ∀ {f : ℝ → ℝ} {x f' : ℝ}, HasDerivAt f f' x → f x ≠ 0 → HasDerivAt (fun y => log (f y)) (f' / f x) x
NeZero.ne : ∀ {R : Type u_1} [inst : Zero R] (n : R) [h : NeZero n], n ≠ 0