TorchLean API

NN.MLTheory.Proofs.Approximation.Universal.UniversalApproximationIEEE32Exec

IEEE32 executable ReLU approximation #

IEEE32Exec-facing theorems for combining:

The file is organized as a refinement chain:

The construction exposes the finite-execution hypotheses at theorem boundaries: they are the precise trust boundary between mathematical approximation and concrete floating-point execution. The floating-point viewpoint follows IEEE Std 754-2019 and the standard analyses of Goldberg and Higham; the approximation side reuses the constructive hinge-network development in UniversalApproximation and UniversalApproximationFP32.

Embedding IEEE32Exec values into the FP32 (rounded-ℝ) model #

IEEE32Exec hinge network (same shape as hingeFunFp32) #

A finiteness witness for IEEE evaluation (no NaN/Inf intermediates) #

Every intermediate of the hinge fold is finite: no subtraction, ReLU, product, or partial sum overflows to an infinity or produces a NaN.

Stating it as an inductive over the remaining index list rather than as a conjunction is what makes it checkable by decide on a concrete input, via instDecHingeSumFinite.

Instances For

    Discharging HingeSumFinite for concrete networks by computation #

    For typical verification workflows, t, c, and x are concrete IEEE32Exec constants coming from a lowered model artifact. In that setting, the easiest way to satisfy the HingeSumFinite hypotheses is to compute the IEEE32Exec kernel and check finiteness at every intermediate.

    instDecHingeSumFinite provides a Decidable instance generator for HingeSumFinite. This enables proofs like:

      classical
      haveI := IEEE32ExecReLUApprox.instDecHingeSumFinite (t := t) (c := c) (x := x)
        (acc := (0 : IEEE32Exec)) (xs := List.finRange n)
      have hSum : HingeSumFinite t c x (0 : IEEE32Exec) (List.finRange n) := by
        decide
    

    This does not solve the symbolic “no overflow for all x” problem, but it makes the pointwise theorems in this file directly usable for concrete executions.

    A compact finiteness hypothesis bundle (pointwise) #

    Refinement: IEEE32Exec execution equals FP32 rounded-ℝ execution (as reals) #

    Refine an executable IEEE hinge-term fold to the FP32 rounded- fold with the same order.

    Floating-point addition is not associative, so the theorem preserves the exact List.finRange evaluation order. This is why the proof is fold-based rather than rewriting directly to an unordered finite sum.

    IEEE32Exec error bound inherited from the FP32 bound #

    “Approximation error + rounding error” (pointwise) #

    IEEE32Exec pointwise ReLU approximation packaging (1D) #

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.reluApproximationIccIEEE32Exec_fromHinge {f : } {a b : } (ε : ) :
    ε > 0(∃ (hidDim : ) (t : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (c : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (b0 : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), (∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (t i) = true) (∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (c i) = true) (∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a bHingeSumFinite t c x 0 (List.finRange hidDim) FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunIeee t c b0 x) = true) ∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFunReal (embedVec t) (embedVec c) (embed b0) (embed x)| < ε)∃ (hidDim : ) (t : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (c : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (b0 : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), ∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - (FloatLib.Floats.ExecFloat.Binary.toModel (hingeFunIeee t c b0 x)).toReal| < ε + hingeFunErrorBound (embedVec t) (embedVec c) (embed b0) (embed x)

    1D ReLU approximation statement over IEEE32Exec values.

    This is not a full universal approximation theorem, because it does not construct IEEE weights from a real target. Instead it packages the already-proved pointwise inequality hinge_fun_total_abs_error_ieee_lt into an existence/for-all form:

    • assume there exist IEEE32Exec hinge parameters (t,c,b0) that approximate f at the real level (via hingeFunReal on the embedded reals),
    • and assume a finiteness/no-NaN/no-Inf witness for IEEE32Exec evaluation,
    • then IEEE32Exec evaluation approximates f with an explicit extra rounding term hingeFunErrorBound.

    Real approximation + quantization + IEEE rounding (1D, pointwise) #

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.reluApproximationIccIEEE32Exec_threeTerm {f : } {a b : } {hidDim : } (tR cR : Fin hidDim) (t c : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (b0 : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (ht : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (t i) = true) (hc : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (c i) = true) (εApprox εQ : ) :
    (∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a bHingeSumFinite t c x 0 (List.finRange hidDim) FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunIeee t c b0 x) = true)(∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFun hidDim tR cR (f a) (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal| < εApprox)(∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|hingeFun hidDim tR cR (f a) (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFunReal (embedVec t) (embedVec c) (embed b0) (embed x)| εQ)∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - (FloatLib.Floats.ExecFloat.Binary.toModel (hingeFunIeee t c b0 x)).toReal| < εApprox + εQ + hingeFunErrorBound (embedVec t) (embedVec c) (embed b0) (embed x)

    1D IEEE32Exec ReLU approximation with an explicit 3-term error decomposition:

    1. Real approximation error: $|f(r)-\operatorname{hinge\_fun}(\ldots,r)|<\varepsilon_{\mathrm{approx}}$.
    2. Quantization/reference error: $|\operatorname{hinge\_fun}(\ldots,r) -\operatorname{hinge\_fun}_{\mathbb R}(\operatorname{embed}(\text{IEEE parameters}), \operatorname{embed}(r))|\leq\varepsilon_Q$.
    3. IEEE rounding error (proved): hingeFunErrorBound.

    To obtain a fully synthesized IEEE32Exec approximation theorem, callers must additionally:

    • construct IEEE32Exec parameters (t,c,b0) from the real hinge parameters, and
    • prove the finiteness/no-NaN/no-Inf witnesses (HingeSumFinite + finite output), and
    • prove a uniform bound εQ for the parameter-quantization step.

    Pointwise wrappers that take HingeEvalFiniteProp #

    Same 3-term theorem, but with an explicit real bias parameter #

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.reluApproximationIccIEEE32Exec_threeTerm_bias {f : } {a b : } {hidDim : } (bR : ) (tR cR : Fin hidDim) (t c : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (b0 : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (ht : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (t i) = true) (hc : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (c i) = true) (εApprox εQ : ) :
    (∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a bHingeSumFinite t c x 0 (List.finRange hidDim) FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunIeee t c b0 x) = true)(∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFun hidDim tR cR bR (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal| < εApprox)(∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|hingeFun hidDim tR cR bR (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFunReal (embedVec t) (embedVec c) (embed b0) (embed x)| εQ)∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - (FloatLib.Floats.ExecFloat.Binary.toModel (hingeFunIeee t c b0 x)).toReal| < εApprox + εQ + hingeFunErrorBound (embedVec t) (embedVec c) (embed b0) (embed x)

    Three-term IEEE32Exec approximation theorem with a caller-supplied real bias.

    reluApproximationIccIEEE32Exec_threeTerm uses f a as the real hinge-network bias because that is what the constructive one-dimensional interpolation theorem emits. This variant is the more general numerical-analysis statement: any real reference bias bR may be compared with the executable bias b0.

    Dyadic (roundDyadicToIEEE32) quantization helpers #

    Generic half-ulp absolute-error bound for the rounded- binary32 model.

    This is the standard floating-point local rounding statement specialized to TorchLean's FP32 format parameters. It is the bridge from abstract approximation coefficients to explicit quantization budgets.

    Real hinge network sensitivity to parameter rounding (for a compact input domain) #

    This is the “εQ quantization” step for reluApproximationIccIEEE32Exec_threeTerm. The lemma below uses the compact-domain assumption that the reference knot locations tR lie in the input interval [a,b], then bounds the output perturbation using:

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.hinge_fun_abs_error_le_of_params_Icc {n : } {a b x : } (tR cR tI cI : Fin n) (bR bI : ) (hx : x Set.Icc a b) (htR : ∀ (i : Fin n), tR i Set.Icc a b) :
    |hingeFun n tR cR bR x - hingeFun n tI cI bI x| |bR - bI| + i : Fin n, (|cR i - cI i| * |b - a| + |cI i| * |tR i - tI i|)

    Sensitivity of a real hinge network to perturbing all parameters on a compact interval.

    The bound decomposes into a bias perturbation, a coefficient perturbation weighted by the interval width, and a knot perturbation weighted by the absolute executable coefficients. This is the real analysis step that supplies the quantization term εQ.

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.hinge_fun_abs_error_le_of_params_Icc_uniform {n : } {a b x : } (tR cR tI cI : Fin n) (bR bI : ) (hx : x Set.Icc a b) (htR : ∀ (i : Fin n), tR i Set.Icc a b) {Δc C Δt : } (hC0 : 0 C) (hΔc : ∀ (i : Fin n), |cR i - cI i| Δc) (hC : ∀ (i : Fin n), |cI i| C) (hΔt : ∀ (i : Fin n), |tR i - tI i| Δt) :
    |hingeFun n tR cR bR x - hingeFun n tI cI bI x| |bR - bI| + n * (Δc * |b - a| + C * Δt)

    Uniform version of hinge_fun_abs_error_le_of_params_Icc.

    Instead of summing per-neuron perturbation bounds, this theorem uses uniform coefficient and knot budgets Δc, C, and Δt, producing the simpler expression |bR-bI| + n * (Δc * |b-a| + C * Δt).

    Removing the quantization term when reals are exactly representable #

    Uniform quantization-error bound between a real hinge network and executable IEEE parameters.

    This is the user-facing εQ discharge lemma when callers can bound coefficient and knot rounding errors uniformly.

    Dyadic-to-IEEE32Exec quantization bound (εQ) #

    This lemma is a drop-in way to discharge the εQ premise of reluApproximationIccIEEE32Exec_threeTerm when IEEE parameters are obtained by rounding dyadic rationals via roundDyadicToIEEE32.

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.hinge_fun_dyadic_quantization_error_le_Icc {n : } {a b : } (tD cD : Fin nFloatLib.Numerics.Dyadic) (bD : FloatLib.Numerics.Dyadic) (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (hxIn : (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b) (htIn : ∀ (i : Fin n), TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i) Set.Icc a b) :
    |hingeFun n (fun (i : Fin n) => TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i)) (fun (i : Fin n) => TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (cD i)) (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal bD) (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFunReal (embedVec fun (i : Fin n) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) (embedVec fun (i : Fin n) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) (embed (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD))) (embed x)| |TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal bD - (FloatLib.Floats.ExecFloat.Binary.toModel (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD))).toReal| + i : Fin n, (|TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (cD i) - (FloatLib.Floats.ExecFloat.Binary.toModel (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i)))).toReal| * |b - a| + |(FloatLib.Floats.ExecFloat.Binary.toModel (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i)))).toReal| * |TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i) - (FloatLib.Floats.ExecFloat.Binary.toModel (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i)))).toReal|)

    Dyadic quantization error for a hinge network on [a,b].

    The real reference uses exact dyadic parameters, while the executable reference uses those dyadics rounded to IEEE32Exec values. The result is still expressed as a sum of concrete per-parameter rounding errors.

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.hinge_fun_dyadic_quantization_error_le_Icc_halfUlp {n : } {a b : } (tD cD : Fin nFloatLib.Numerics.Dyadic) (bD : FloatLib.Numerics.Dyadic) (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (hxIn : (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b) (htIn : ∀ (i : Fin n), TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i) Set.Icc a b) (htfin : ∀ (i : Fin n), FloatLib.Floats.ExecFloat.Binary.isFinite (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) = true) (hcfin : ∀ (i : Fin n), FloatLib.Floats.ExecFloat.Binary.isFinite (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) = true) (hbfin : FloatLib.Floats.ExecFloat.Binary.isFinite (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD)) = true) :
    |hingeFun n (fun (i : Fin n) => TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i)) (fun (i : Fin n) => TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (cD i)) (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal bD) (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFunReal (embedVec fun (i : Fin n) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) (embedVec fun (i : Fin n) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) (embed (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD))) (embed x)| FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix TorchLean.Floats.fexp32 (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal bD) / 2 + i : Fin n, (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix TorchLean.Floats.fexp32 (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (cD i)) / 2 * |b - a| + |(FloatLib.Floats.ExecFloat.Binary.toModel (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i)))).toReal| * (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix TorchLean.Floats.fexp32 (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i)) / 2))

    Dyadic quantization error with each per-parameter rounding error bounded by a half-ulp term.

    This is the more automated version of hinge_fun_dyadic_quantization_error_le_Icc: callers provide finiteness of every rounded dyadic value, and the theorem substitutes the standard half-ulp bounds.

    Packaged “dyadic quantization + IEEE rounding” theorem (1D, pointwise) #

    This is the “dyadic next step”: it replaces the abstract εQ premise of reluApproximationIccIEEE32Exec_threeTerm_bias with a concrete bound coming from:

    It still assumes the IEEE finiteness witnesses for evaluation (HingeSumFinite + finite output).

    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.reluApproximationIccIEEE32Exec_dyadicHalfUlp {f : } {a b : } {hidDim : } (tD cD : Fin hidDimFloatLib.Numerics.Dyadic) (bD : FloatLib.Numerics.Dyadic) (htIn : ∀ (i : Fin hidDim), TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i) Set.Icc a b) (htfin : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) = true) (hcfin : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) = true) (hbfin : FloatLib.Floats.ExecFloat.Binary.isFinite (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD)) = true) (εApprox : ) :
    (∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a bHingeSumFinite (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) x 0 (List.finRange hidDim) FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunIeee (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD)) x) = true)(∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFun hidDim (fun (i : Fin hidDim) => TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i)) (fun (i : Fin hidDim) => TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (cD i)) (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal bD) (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal| < εApprox)∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - (FloatLib.Floats.ExecFloat.Binary.toModel (hingeFunIeee (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD)) x)).toReal| < εApprox + (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix TorchLean.Floats.fexp32 (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal bD) / 2 + i : Fin hidDim, (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix TorchLean.Floats.fexp32 (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (cD i)) / 2 * |b - a| + |(FloatLib.Floats.ExecFloat.Binary.toModel (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i)))).toReal| * (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix TorchLean.Floats.fexp32 (TorchLean.Floats.IEEE754.IEEE32Exec.dyadicToReal (tD i)) / 2))) + hingeFunErrorBound (embedVec fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (tD i))) (embedVec fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 (cD i))) (embed (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.binary32 bD))) (embed x)
    theorem NN.MLTheory.Proofs.UniversalApproximation.IEEE32ExecReLUApprox.reluApproximationIccIEEE32Exec_twoTerm {f : } {a b : } {hidDim : } (t c : Fin hidDimFloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (b0 : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4) (ht : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (t i) = true) (hc : ∀ (i : Fin hidDim), FloatLib.Floats.ExecFloat.Binary.isFinite (c i) = true) (εApprox : ) :
    (∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a bHingeSumFinite t c x 0 (List.finRange hidDim) FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunIeee t c b0 x) = true)(∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - hingeFun hidDim (fun (i : Fin hidDim) => (FloatLib.Floats.ExecFloat.Binary.toModel (t i)).toReal) (fun (i : Fin hidDim) => (FloatLib.Floats.ExecFloat.Binary.toModel (c i)).toReal) (FloatLib.Floats.ExecFloat.Binary.toModel b0).toReal (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal| < εApprox)∀ (x : FloatLib.Floats.ExecFloat.Binary 8 23 FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee (FloatLib.Floats.Formats.BinaryInterchange.FloatFormat.Encoding.ieee.defaultBias 8) embed._proof_1 embed._proof_2 embed._proof_3 embed._proof_4), FloatLib.Floats.ExecFloat.Binary.isFinite x = true(FloatLib.Floats.ExecFloat.Binary.toModel x).toReal Set.Icc a b|f (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal - (FloatLib.Floats.ExecFloat.Binary.toModel (hingeFunIeee t c b0 x)).toReal| < εApprox + hingeFunErrorBound (embedVec t) (embedVec c) (embed b0) (embed x)

    Two-term 1D IEEE32Exec ReLU approximation statement:

    • assume the real hinge network built from the IEEE parameters’ toReal values already approximates f on toReal inputs in [a,b],
    • and assume finiteness/no-NaN/no-Inf witnesses,
    • then IEEE execution approximates f with an explicit IEEE rounding term.

    This is a specialization of the 3-term theorem with εQ = 0.