Documentation

Formalizations.Analysis.TransformerAttention.HeatCapacity

The heat-capacity coefficient at the Hagedorn point (erratum) #

Theorem 5.2 of the paper states C_V(γ = 1, N) = (log N)²/4; the erratum corrects it to (log N)²/12 (a factor 3). This file checks the algebraic chain of both derivations of the corrected coefficient, with L = log N. The asymptotic statement (→ as N → ∞, which needs Euler–Maclaurin bounds for the harmonic sums) is not formalized. The integral ∫₁ᴺ log x / x dx = (log N)²/2 behind it is integral_log_div_self (Formalizations.Analysis.SpecialFunctions.Integrals.LogDivSelf).

Main results #

References #

Cumulant route #

theorem TransformerAttention.HeatCapacity.var_log_d_identity (L : ℝ) :
L ^ 2 / 3 - (L / 2) ^ 2 = L ^ 2 / 12

(log N)²/3 − ((log N)/2)² = (log N)²/12.

theorem TransformerAttention.HeatCapacity.cv_from_cumulant_at_hagedorn (L : ℝ) :
1 ^ 2 * (L ^ 2 / 3 - (L / 2) ^ 2) = L ^ 2 / 12

C_V(γ = 1) = γ² Var(log d) = (log N)²/12.

Taylor route #

1/6 − 1/8 = 1/24 (the log (1 + x) step).

L²/6 − L²/8 = L²/24.

2 · (L²/24) = L²/12 (derivative of the quadratic Taylor term).

The corrected internal energy U(γ) = L/2 + (1 − γ) L²/12.

Equations
Instances For

    Erratum eq. (5): dU/dγ at γ = 1 is −(log N)²/12.

    theorem TransformerAttention.HeatCapacity.cv_corrected_at_hagedorn (L : ℝ) :
    -1 ^ 2 * deriv (fun (γ : ℝ) => U_corrected L γ) 1 = L ^ 2 / 12

    Erratum eq. (6): C_V(γ = 1, N) = −γ² dU/dγ = (log N)²/12.

    Original versus corrected #

    The published (log N)²/4 is exactly three times (log N)²/12.

    theorem TransformerAttention.HeatCapacity.original_ne_corrected (L : ℝ) (hL : L ≠ 0) :
    L ^ 2 / 4 ≠ L ^ 2 / 12

    The two coefficients differ unless L = 0.

    The residual of the wrong derivation: L²/8 = 3 · (L²/24).