NF Elementwise Bounds: Softplus and Safe Log #
NFBackend.safeLog is a clamped log surrogate log (max x ε) with an unconditional forward bound.
For smooth activations that use log (notably softplus and safe_log), we route the outer log
through safeLog at a known lower bound:
softplus(x) = log(1 + exp x)and1 + exp x ≥ 1, sosoftplus = safeLog 1 (1 + exp x);safe_log(x) = log(softplus(x) + ε)andsoftplus(x) + ε ≥ ε, sosafe_log = safeLog ε (softplus(x) + ε).
This avoids needing a separate log approximation lemma while remaining extensionally equal on
ℝ for the intended arguments.
Half-ULP rounding budget at the scalar value 1, used in the softplus helper bounds.
Instances For
Scalar forward-error envelope for exp.
This packages the exact value, the perturbed value at a + eps, and the final rounding budget
into one reusable bound for the later softplus/safe-log proofs.
Instances For
Rounded representation of the scalar constant 1 at the NF backend.
Instances For
Rounded representation of exp a at the NF backend.
Instances For
Rounded surrogate for the inner 1 + exp a term appearing in softplus.
Instances For
Forward-error envelope for the rounded 1 + exp a subexpression used by softplus.
Instances For
Unconditional scalar forward-error bound for softplus, via the safeLog factorization.
Instances For
softplus implemented by safeLog 1 (1 + exp x) at the NF backend.
Instances For
Forward approximation bound for softplus in NF.
We treat softplus(x) = log(1 + exp x) as safeLog 1 (1 + exp x) (since 1 + exp x ≥ 1) and then
compose the scalar bounds for exp, +, and safeLog.
Per-entry bound tensor for softplusR.
This is the elementwise lifting of softplus_bound_scalar, used with linf_norm in
approxT_softplus_spec.
Instances For
approxT bound for softplus lifted to arbitrary tensor shapes.
This is the tensor-level wrapper around approx_softplus_nf, built via
approxT_map_spec_of_scalar_bound.
Runtime implementation of safe_log as a single rounded primitive.
Instances For
Forward approximation bound for the smooth safe_log activation in NF.
safe_log is defined as log(softplus(x) + ε), which is globally well-defined for ε > 0. The
proof combines:
- one rounding step for
safe_logR(defined asNF.ofReal (safe_log_spec ...)); - a
(1/ε)Lipschitz bound for the spec function (via mean value theorem + derivative bound).
Per-entry bound tensor for safe_log.
This is the elementwise lifting of approx_safe_log_nf's bound.
Instances For
approxT bound for safe_log lifted to arbitrary tensor shapes.
This is the tensor-level wrapper around approx_safe_log_nf, built via
approxT_map_spec_of_scalar_bound.