AFTD Auto-Formalizing Theoretical Domains

bernoulli_mgf_bound_step2

theoremverifiedimported Lean

Second derivative of the Hoeffding auxiliary function. Let $L, x \in \bbr$ and suppose $1 - L + L\,e^{-x} > 0$. Then the function \[ \varphi'(x) \;=\; -L + \frac{x}{4} + \frac{L\,e^{-x}}{1 - L + L\,e^{-x}} \] (the derivative from $ bernoulli_mgf_bound_step1$) is differentiable at $x$ with derivative \[ \varphi''(x) \;=\; \frac{1}{4} - \frac{L\,(1 - L)\,e^{-x}}{\bigl(1 - L + L\,e^{-x}\bigr)^2}. \] This is the $\varphi''$ computation used in the proof of $ bernoulli_mgf_bound$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Finset BigOperators Real in
lemma bernoulli_mgf_bound_step2 (L x : ℝ) (hpos : 0 < 1 - L + L * Real.exp (-x)) :
    HasDerivAt (fun x => -L + x / 4 + L * Real.exp (-x) / (1 - L + L * Real.exp (-x)))
      (1 / 4 - L * (1 - L) * Real.exp (-x) / (1 - L + L * Real.exp (-x)) ^ 2) x
Source
TCSlib, `bernoulli_mgf_bound_step2`
Lean proof
By Arhaan Aggarwal, from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Copyright (c) 2026 Arhaan Aggarwal. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
What was changed in bernoulli_mgf_bound_step2
--- TCSlib/LearningTheory/Hedge/Hoeffding.lean:205 (bernoulli_mgf_bound_step2)
+++ as compiled here
@@ -1,5 +1,4 @@
-/-- Step lemma for `bernoulli_mgf_bound` (Step 5): at any `x` where `1 - L + L e^{-x} > 0`,
-the derivative `φ'` of `bernoulli_mgf_bound_step1` has itself derivative
-`φ''(x) = 1/4 - L (1 - L) e^{-x} / (1 - L + L e^{-x})²`.  This is the `φ''` computation in
-the proof of [MRT18, Lemma D.1]. -/
+set_option relaxedAutoImplicit false in
+set_option autoImplicit false in
+open Finset BigOperators Real in
 lemma bernoulli_mgf_bound_step2 (L x : ℝ) (hpos : 0 < 1 - L + L * Real.exp (-x)) :
@@ -13,3 +12,3 @@
   have h := (((hasDerivAt_id' x).div_const 4).const_add (-L)).fun_add (h_num.fun_div h_den hne)
-  convert h using 1
+  convert h using 1 <;> try rfl
   field_simp
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • bernoulli_mgf_bound_step1First derivative of the Hoeffding auxiliary function. Let $L, x \in \bbr$ and suppose $1 - L + L\,e^{-x} > 0$. Then the auxiliary function…
Used by 1
  • bernoulli_mgf_boundBernoulli MGF bound (Hoeffding's lemma). Let $L \in [0,1]$ and let $\eta$ be a real number. Then the moment generating function of the…

Lean source view module on GitHub

set_option relaxedAutoImplicit false inset_option autoImplicit false inopen Finset BigOperators Real in/-- Step lemma for `bernoulli_mgf_bound` (Step 5): at any `x` where `1 - L + L e^{-x} > 0`, the derivative `φ'` of `bernoulli_mgf_bound_step1` has itself derivative `φ''(x) = 1/4 - L (1 - L) e^{-x} / (1 - L + L e^{-x})²`. This is the `φ''` computation in the proof of [MRT18, Lemma D.1]. -/lemma bernoulli_mgf_bound_step2 (L x : ℝ) (hpos : 0 < 1 - L + L * Real.exp (-x)) :    HasDerivAt (fun x => -L + x / 4 + L * Real.exp (-x) / (1 - L + L * Real.exp (-x)))      (1 / 4 - L * (1 - L) * Real.exp (-x) / (1 - L + L * Real.exp (-x)) ^ 2) x := by  have hne : 1 - L + L * Real.exp (-x) ≠ 0 := hpos.ne'  have h_num : HasDerivAt (fun x => L * Real.exp (-x)) (L * (Real.exp (-x) * -1)) x :=    (hasDerivAt_neg' x).exp.const_mul L  have h_den : HasDerivAt (fun x => 1 - L + L * Real.exp (-x)) (L * (Real.exp (-x) * -1)) x :=    h_num.const_add (1 - L)  have h := (((hasDerivAt_id' x).div_const 4).const_add (-L)).fun_add (h_num.fun_div h_den hne)  convert h using 1 <;> try rfl  field_simp  ring
See it in the graphDiscuss this resultChallenge it