Scalar Rounding Approximation #
Rounding-level approximation lemmas.
This module begins the runtime-to-spec bridge. It gives compositional error bounds for expressions
evaluated under a declared Flocq.round rounded-real model such as NF. The NF operator and graph
modules lift these scalar lemmas to tensors and end-to-end executions.
PyTorch correspondence / citations #
In ordinary PyTorch execution, floating-point ops are performed in a chosen dtype (e.g. float32)
with hardware/IEEE-754 rounding. In TorchLean, Flocq.round/NF is a proof-relevant rounding model
where each operation exposes an explicit ulp-style error bound suitable for composition.
https://pytorch.org/docs/stable/tensor_attributes.html#torch.dtype
Scalar Approximation Predicate #
Absolute-error approximation for scalar real values.
scalarApprox x xhat eps means the rounded/interpreted value xhat is within absolute error eps
of the ideal real value x.
Instances For
Convert the scalar rounding predicate to the shared ApproxTol.absOnly predicate.
Single-Step Rounding Bounds #
Interpret one rounded real operation as Flocq.round applied to a real input.
Instances For
One Flocq.round step is within half an ulp of the exact real input.
Compositional Bounds For + And * #
Rounded addition: compute roundR (x + y).
Instances For
Rounded multiplication: compute roundR (x * y).
Instances For
Compositional absolute-error bound for rounded addition.
The output budget is the input budgets plus one fresh rounding term for the addition result.
Compositional absolute-error bound for rounded multiplication.
Besides the fresh rounding term for xhat * yhat, the budget includes magnitude-weighted input
errors and the conservative cross term 2 * epsx * epsy; it is not a first-order-only estimate.