What directed endpoint arithmetic is supposed to mean #
NN.MLTheory.CROWN.BoundOps says what a scalar backend must compute; this file says what those
computations mean, by interpreting an endpoint as a real number and comparing each directed
operation with exact real arithmetic. The enclosure predicates and the two Lawful classes are the
form in which CROWN theorems ask for that guarantee, and ℝ itself is the instance where the
guarantee is trivial because no rounding happens.
The real-analysis dependencies belong to the soundness proofs. Certificate replay, the graph
checker, and the trainer use the executable BoundOps interface without importing this file.
Real-semantic enclosure laws for BoundOps.
The executable interface BoundOps is intentionally available without this class: a backend may
be useful for diagnostics before its arithmetic has been connected to a proof. Sound CROWN theorems
require LawfulBoundOps in addition to BoundOps. The interpretation toReal says what a scalar
endpoint means mathematically, and the laws compare each directed operation with exact arithmetic
on those real values. This is stronger than merely surrounding the backend's ordinary rounded
operation.
There is a global instance for ℝ. There is deliberately no global instance for Lean Float or
for all ExecFloat.Binary 8 23 bit patterns. Host Float is a trusted runtime boundary, while
IEEE-754 NaNs,
infinities, and overflow require finite-path hypotheses; those facts are stated at the IEEE
semantics layer rather than hidden in an invalid ordered-ring instance.
- toReal : α → ℝ
Mathematical value represented by an endpoint.
Executable endpoint comparisons agree with the mathematical order.
The endpoint
0means the real number0.The endpoint
1means the real number1.The backend maximum is the real maximum.
Endpoints that test equal denote the same real number.
Instances
The backend minimum denotes the real minimum.
This supplements LawfulBoundOps for transfers that use the context's min operation.
The comparison-based BoundOps.min2 needs no additional law. Ordinary negation and absolute
value may round on a backend, so their exactness is deliberately not assumed here.
- toReal_min (a b : α) : LawfulBoundOps.toReal (a ⊓ b) = min (LawfulBoundOps.toReal a) (LawfulBoundOps.toReal b)
Instances
Soundness predicate for a unary interval transfer.
Returning none is always permitted. If the transfer returns endpoints, every real input between
the interpreted input endpoints must map between the interpreted output endpoints.
Instances For
Soundness predicate for a binary interval transfer.
Instances For
Real-semantic enclosure laws for NonlinearBoundOps.
This class is deliberately separate from the executable transfer table. A backend may implement a transfer for testing before proving it; sound verification entrypoints can require this class and therefore cannot silently promote an unchecked implementation into a theorem.
- divBounds_enclosure : BinaryEnclosure (fun (x1 x2 : ℝ) => x1 / x2) NonlinearBoundOps.divBounds
- expBounds_enclosure : UnaryEnclosure Real.exp NonlinearBoundOps.expBounds
- logBounds_enclosure : UnaryEnclosure Real.log NonlinearBoundOps.logBounds
- sqrtBounds_enclosure : UnaryEnclosure Real.sqrt NonlinearBoundOps.sqrtBounds
- sigmoidBounds_enclosure : UnaryEnclosure (fun (x : ℝ) => 1 / (1 + Real.exp (-x))) NonlinearBoundOps.sigmoidBounds
- tanhBounds_enclosure : UnaryEnclosure Real.tanh NonlinearBoundOps.tanhBounds
- sinBounds_enclosure : UnaryEnclosure Real.sin NonlinearBoundOps.sinBounds
- cosBounds_enclosure : UnaryEnclosure Real.cos NonlinearBoundOps.cosBounds
- layerNormAbsBound_sound {n : ℕ} {radius : α} : NonlinearBoundOps.layerNormAbsBound n = some radius → √↑n ≤ LawfulBoundOps.toReal radius
- coupledDerivatives_exact : NonlinearBoundOps.supportsIdealCoupledDerivatives α = true → BoundOps.supportsExactAffineReassociation α = true
Instances
Exact real arithmetic needs no rounding, so its lower and upper operations coincide.
Exact real endpoint arithmetic satisfies the directed-operation enclosure laws.
The exact real backend preserves minimum.
Over ℝ, the comparison-based BoundOps.min2 is min.
Over ℝ, the comparison-based BoundOps.max2 is max.
Exact nonlinear interval transfers over the real numbers.