theorem extracted_formal_statement_20.{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) (t : ℝ)
  (r0 :
    (fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = fun t =>
      (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ)
  (r01 :
    (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ)
  (r0' :
    (∫ (x : Ω), X x ^ 2 ∂μ.tilted fun ω => t * X ω) =
      (∫ (x : Ω), rexp (t * X x) * X x ^ 2 ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ)
  (p :
    (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) / ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ =
      ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
        ((∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ))
  (p'' :
    ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
          (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 -
        (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) ^ 2 / (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 =
      ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * mgf X μ t -
          (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) /
        mgf X μ t ^ 2)
  (h_original_goal :
    HasDerivAt (fun y => ∫ (x : Ω), rexp (y * X x) * X x ∂μ) (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) t) :
  AEStronglyMeasurable (fun x => rexp (t * X x)) μ := sorry

State before:
case hc
Ω : Type u_1
m : MeasurableSpace Ω
μ : Measure Ω
inst✝¹ : IsFiniteMeasure μ
inst✝ : NeZero μ
a b : ℝ
X : Ω → ℝ
hX : AEMeasurable X μ
h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
g' : ℝ → ℝ := fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω
g'' : ℝ → ℝ :=
  fun t => (∫ (x : Ω), (X ^ 2) x ∂μ.tilted fun ω => t * X ω) - (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) ^ 2
t : ℝ
r0 :
  (fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = fun t =>
    (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
r01 : (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
r0' :
  (∫ (x : Ω), X x ^ 2 ∂μ.tilted fun ω => t * X ω) =
    (∫ (x : Ω), rexp (t * X x) * X x ^ 2 ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
p :
  (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) / ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ =
    ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
      ((∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ)
p'' :
  ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
        (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 -
      (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) ^ 2 / (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 =
    ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * mgf X μ t -
        (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) /
      mgf X μ t ^ 2
c : ℝ := ‖a‖ ⊔ ‖b‖
⊢ HasDerivAt (fun y => ∫ (x : Ω), rexp (y * X x) * X x ∂μ) (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) t

Tactic: apply tilt_second_deriv _ _ _ hX h
    apply MeasureTheory.Integrable.bdd_mul'
    ·
  rw [(by ext ω; ring : (fun ω ↦ X ω ^ 2) = (fun ω ↦ X ω * X ω))]
  apply MeasureTheory.Integrable.bdd_mul' (integrable_bounded a b hX h) (aestronglyMeasurable_iff_aemeasurable.mpr hX)
  · filter_upwards [h] with x h
    exact (by simp; exact le_trans' (le_abs_self (max ‖a‖ ‖b‖)) (abs_le_max_abs_abs h.1 h.2) : ‖X x‖ ≤ |c|)

State after:
[case hc.hf
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝¹ : IsFiniteMeasure μ
 inst✝ : NeZero μ
 a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 g' : ℝ → ℝ := fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω
 g'' : ℝ → ℝ :=
   fun t => (∫ (x : Ω), (X ^ 2) x ∂μ.tilted fun ω => t * X ω) - (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) ^ 2
 t : ℝ
 r0 :
   (fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = fun t =>
     (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 r01 : (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 r0' :
   (∫ (x : Ω), X x ^ 2 ∂μ.tilted fun ω => t * X ω) =
     (∫ (x : Ω), rexp (t * X x) * X x ^ 2 ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 p :
   (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) / ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ =
     ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
       ((∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ)
 p'' :
   ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
         (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 -
       (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) ^ 2 / (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 =
     ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * mgf X μ t -
         (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) /
       mgf X μ t ^ 2
 c : ℝ := ‖a‖ ⊔ ‖b‖
 ⊢ AEStronglyMeasurable (fun x => rexp (t * X x)) μ,
 case hc.hf_bound
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝¹ : IsFiniteMeasure μ
 inst✝ : NeZero μ
 a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 g' : ℝ → ℝ := fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω
 g'' : ℝ → ℝ :=
   fun t => (∫ (x : Ω), (X ^ 2) x ∂μ.tilted fun ω => t * X ω) - (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) ^ 2
 t : ℝ
 r0 :
   (fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = fun t =>
     (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 r01 : (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 r0' :
   (∫ (x : Ω), X x ^ 2 ∂μ.tilted fun ω => t * X ω) =
     (∫ (x : Ω), rexp (t * X x) * X x ^ 2 ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 p :
   (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) / ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ =
     ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
       ((∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ)
 p'' :
   ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
         (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 -
       (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) ^ 2 / (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 =
     ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * mgf X μ t -
         (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) /
       mgf X μ t ^ 2
 c : ℝ := ‖a‖ ⊔ ‖b‖
 ⊢ ∀ᵐ (x : Ω) ∂μ, ‖rexp (t * X x)‖ ≤ ?hc.c,
 case hc.c
 Ω : Type u_1
 m : MeasurableSpace Ω
 μ : Measure Ω
 inst✝¹ : IsFiniteMeasure μ
 inst✝ : NeZero μ
 a b : ℝ
 X : Ω → ℝ
 hX : AEMeasurable X μ
 h : ∀ᵐ (ω : Ω) ∂μ, X ω ∈ Set.Icc a b
 g' : ℝ → ℝ := fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω
 g'' : ℝ → ℝ :=
   fun t => (∫ (x : Ω), (X ^ 2) x ∂μ.tilted fun ω => t * X ω) - (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) ^ 2
 t : ℝ
 r0 :
   (fun t => ∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = fun t =>
     (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 r01 : (∫ (x : Ω), X x ∂μ.tilted fun ω => t * X ω) = (∫ (x : Ω), rexp (t * X x) * X x ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 r0' :
   (∫ (x : Ω), X x ^ 2 ∂μ.tilted fun ω => t * X ω) =
     (∫ (x : Ω), rexp (t * X x) * X x ^ 2 ∂μ) / ∫ (x : Ω), rexp (t * X x) ∂μ
 p :
   (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) / ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ =
     ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
       ((∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ)
 p'' :
   ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) /
         (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 -
       (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) ^ 2 / (∫ (x : Ω), (fun ω => rexp (t * X ω)) x ∂μ) ^ 2 =
     ((∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω ^ 2) x ∂μ) * mgf X μ t -
         (∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) * ∫ (x : Ω), (fun ω => rexp (t * X ω) * X ω) x ∂μ) /
       mgf X μ t ^ 2
 c : ℝ := ‖a‖ ⊔ ‖b‖
 ⊢ ℝ]

Relevant lemmas:
error