The Gauss error function #
Mathlib has no error function, so this module defines erf x = 2 / √π ∫₀ˣ exp (-t²) dt on the
reals. It proves the facts that torch.erf and the exact GELU rely on: erf 0 = 0, oddness, the
derivative 2 / √π exp (-x²), strict monotonicity, and the limits 1 at +∞ and -1 at -∞,
hence -1 < erf x < 1.
References #
- NIST Digital Library of Mathematical Functions, section 7.2, error functions:
https://dlmf.nist.gov/7.2
The Gaussian integrand is continuous.
The error function is differentiable everywhere.
The error function tends to 1 at +∞.
The error function tends to -1 at -∞.