TorchLean API

NN.MLTheory.Proofs.Approximation.Universal.UniversalApproximationBinaryExec

Executable ReLU approximation for configured IEEE formats #

hingeFunBinary evaluates a hinge network with a configured FloatFormat, storage plan, and ModelCodec. Refinement to RoundedReLUApprox requires format.isIEEE = true and finite intermediates. The result preserves the exact fold order and combines real approximation, parameter quantization, and arithmetic rounding error.

HingeSumFinite records the finite intermediates. HingeSumBounds supplies sufficient bounds on exact subtractions, products, and partial sums to establish that witness through FloatLib's range theorems. Dyadic quantization bounds use the selected format's rounding and half-ulp API.

Embedding configured binary values into the rounded-real model #

Configured binary hinge network (same shape as RoundedReLUApprox.hingeFun format) #

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 the instance instDecHingeSumFinite.

Instances For

    Discharging HingeSumFinite for concrete networks by computation #

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

    instDecHingeSumFinite is a Decidable instance for HingeSumFinite … that walks the fold, so a true concrete instance closes by computation:

      have hSum : HingeSumFinite t c x (0 : Value) (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) #

    Sufficient range bounds for finite intermediates #

    Exact arithmetic bounds along the executable fold. Each bound compares the unrounded operation with the selected format's largest finite value.

    Instances For

      Refinement to rounded-real execution #

      Refine an executable hinge-term fold to the rounded-real 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.

      Refine the whole executable hinge network to the rounded-real network.

      The theorem composes the fold refinement with the final rounded bias addition. Its hypotheses are exactly the finiteness obligations needed by the IEEE-754 bridge lemmas.

      Configured binary error bound inherited from the rounded-real bound #

      “Approximation error + rounding error” (pointwise) #

      Pointwise triangle bound: target error to executable output is bounded by real approximation error plus the certified IEEE arithmetic rounding error.

      Strict version of hinge_fun_total_abs_error_binary_le, useful for approximation theorems.

      Configured binary pointwise ReLU approximation packaging (1D) #

      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_of_hinge {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] (hformat : format.isIEEE = true) {f : ℝ → ℝ} {a b : ℝ} (ε : ℝ) :
      ε > 0 → (∃ (hidDim : ℕ) (t : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (c : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (b0 : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), (∀ (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 (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), FloatLib.Floats.ExecFloat.Binary.isFinite x = true → (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈ Set.Icc a b → HingeSumFinite t c x 0 (List.finRange hidDim) ∧ FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunBinary t c b0 x) = true) ∧ ∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 - RoundedReLUApprox.hingeFunReal format (embedVec t) (embedVec c) (embed b0) (embed x)| < ε) → ∃ (hidDim : ℕ) (t : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (c : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (b0 : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), ∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 (hingeFunBinary t c b0 x)).toReal| < ε + RoundedReLUApprox.hingeFunErrorBound format (embedVec t) (embedVec c) (embed b0) (embed x)

      1D ReLU approximation statement over configured binary 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_binary_lt into an existence/for-all form:

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

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

      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_three_term_bias {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] (hformat : format.isIEEE = true) {f : ℝ → ℝ} {a b : ℝ} {hidDim : ℕ} (bR : ℝ) (tR cR : Fin hidDim → ℝ) (t c : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (b0 : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (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 (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), FloatLib.Floats.ExecFloat.Binary.isFinite x = true → (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈ Set.Icc a b → HingeSumFinite t c x 0 (List.finRange hidDim) ∧ FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunBinary t c b0 x) = true) → (∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 - RoundedReLUApprox.hingeFunReal format (embedVec t) (embedVec c) (embed b0) (embed x)| ≤ εQ) → ∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 (hingeFunBinary t c b0 x)).toReal| < εApprox + εQ + RoundedReLUApprox.hingeFunErrorBound format (embedVec t) (embedVec c) (embed b0) (embed x)

      1D configured binary ReLU approximation with an explicit 3-term error decomposition, relative to a caller-supplied real reference bias bR:

      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 format.

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

      • construct configured binary 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.
      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_three_term {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] (hformat : format.isIEEE = true) {f : ℝ → ℝ} {a b : ℝ} {hidDim : ℕ} (tR cR : Fin hidDim → ℝ) (t c : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (b0 : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (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 (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), FloatLib.Floats.ExecFloat.Binary.isFinite x = true → (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈ Set.Icc a b → HingeSumFinite t c x 0 (List.finRange hidDim) ∧ FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunBinary t c b0 x) = true) → (∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 - RoundedReLUApprox.hingeFunReal format (embedVec t) (embedVec c) (embed b0) (embed x)| ≤ εQ) → ∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 (hingeFunBinary t c b0 x)).toReal| < εApprox + εQ + RoundedReLUApprox.hingeFunErrorBound format (embedVec t) (embedVec c) (embed b0) (embed x)

      Specialization of relu_approximation_Icc_binary_three_term_bias to the real bias f a, which is the bias the constructive one-dimensional interpolation theorem emits.

      Dyadic quantization helpers #

      Half-ulp error bound for dyadic values rounded into executable configured binary values.

      The finiteness hypothesis excludes overflow/NaN paths, after which the executable rounding of a dyadic agrees with the real Model.roundAt format operation used by the rounded-real model, and FloatLib's local rounding bound Model.abs_roundAt_sub_le applies.

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

      This is the “εQ quantization” step for relu_approximation_Icc_binary_three_term. 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.BinaryExecReLUApprox.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.BinaryExecReLUApprox.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-configured binary quantization bound (εQ) #

      This lemma is a drop-in way to discharge the εQ premise of relu_approximation_Icc_binary_three_term when IEEE parameters are obtained by rounding dyadic rationals with Model.roundDyadic format.

      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.hinge_fun_dyadic_quantization_error_le_Icc {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] {n : ℕ} {a b : ℝ} (tD cD : Fin n → FloatLib.Numerics.Dyadic) (bD : FloatLib.Numerics.Dyadic) (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (hxIn : (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈ Set.Icc a b) (htIn : ∀ (i : Fin n), (tD i).toReal ∈ Set.Icc a b) :

      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 configured binary values. The result is still expressed as a sum of concrete per-parameter rounding errors.

      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.hinge_fun_dyadic_quantization_error_le_Icc_half_ulp {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] (hformat : format.isIEEE = true) {n : ℕ} {a b : ℝ} (tD cD : Fin n → FloatLib.Numerics.Dyadic) (bD : FloatLib.Numerics.Dyadic) (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (hxIn : (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈ Set.Icc a b) (htIn : ∀ (i : Fin n), (tD i).toReal ∈ Set.Icc a b) (htfin : ∀ (i : Fin n), (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (tD i))).isFinite = true) (hcfin : ∀ (i : Fin n), (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))).isFinite = true) (hbfin : (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format bD)).isFinite = true) :

      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 relu_approximation_Icc_binary_three_term_bias with a concrete bound coming from:

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

      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_dyadic_half_ulp {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] (hformat : format.isIEEE = true) {f : ℝ → ℝ} {a b : ℝ} {hidDim : ℕ} (tD cD : Fin hidDim → FloatLib.Numerics.Dyadic) (bD : FloatLib.Numerics.Dyadic) (htIn : ∀ (i : Fin hidDim), (tD i).toReal ∈ Set.Icc a b) (htfin : ∀ (i : Fin hidDim), (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (tD i))).isFinite = true) (hcfin : ∀ (i : Fin hidDim), (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))).isFinite = true) (hbfin : (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format bD)).isFinite = true) (εApprox : ℝ) :
      (∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), FloatLib.Floats.ExecFloat.Binary.isFinite x = true → (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal ∈ Set.Icc a b → HingeSumFinite (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (tD i))) (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))) x 0 (List.finRange hidDim) ∧ FloatLib.Floats.ExecFloat.Binary.isFinite (hingeFunBinary (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (tD i))) (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))) (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format bD)) x) = true) → (∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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) => (tD i).toReal) (fun (i : Fin hidDim) => (cD i).toReal) bD.toReal (FloatLib.Floats.ExecFloat.Binary.toModel x).toReal| < εApprox) → ∀ (x : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)), 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 (hingeFunBinary (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (tD i))) (fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))) (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format bD)) x)).toReal| < εApprox + (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix (FloatLib.Floats.Formats.BinaryInterchange.Model.fexpOf format) bD.toReal / 2 + ∑ i : Fin hidDim, (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix (FloatLib.Floats.Formats.BinaryInterchange.Model.fexpOf format) (cD i).toReal / 2 * |b - a| + |(FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))).toModel.toReal| * (FloatLib.Floats.Formats.Flocq.ulp FloatLib.Numerics.binaryRadix (FloatLib.Floats.Formats.BinaryInterchange.Model.fexpOf format) (tD i).toReal / 2))) + RoundedReLUApprox.hingeFunErrorBound format (embedVec fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (tD i))) (embedVec fun (i : Fin hidDim) => FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format (cD i))) (embed (FloatLib.Floats.ExecFloat.Binary.ofModel (FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadic format bD))) (embed x)

      Three-term configured binary approximation bound with the quantization term instantiated by the half-ulp dyadic rounding budget of hinge_fun_dyadic_quantization_error_le_Icc_half_ulp.

      theorem NN.MLTheory.Proofs.UniversalApproximation.BinaryExecReLUApprox.relu_approximation_Icc_binary_two_term {format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat} {plan : FloatLib.Floats.Formats.BinaryInterchange.Configured.StoragePlan format} {code : Type} [FloatLib.Floats.ExecFloat.ModelCodec plan (FloatLib.Floats.Formats.BinaryInterchange.Model format) code] (hformat : format.isIEEE = true) {f : ℝ → ℝ} {a b : ℝ} {hidDim : ℕ} (t c : Fin hidDim → FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (b0 : FloatLib.Floats.ExecFloat (FloatLib.Floats.Formats.BinaryInterchange.Configured.Family format code plan)) (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 : ℝ) :

      Two-term 1D configured binary 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.