Checked Float32 Discounted Returns #
This module contains the value-learning recurrences that need explicit finite-intermediate checks:
discounted backups and fixed-horizon discounted returns. The public names stay in
Runtime.RL.Numerics.Float32; this file only separates the implementation so the runtime tree is
easier to audit.
Reference: Sutton and Barto, Reinforcement Learning: An Introduction.
Checked RL core transforms (configured binary32) #
Require that an Binary 8 23 value is finite, producing a tagged error on failure.
Instances For
Checked configured binary32 primitives #
The checked RL helpers below are intentionally written in terms of a few small “checked primitive”
combinators (checkedAdd, checkedMul, …). Larger routines (GAE, PPO objectives, …) remain
readable while still producing precise error locations when non-finite values occur.
Exponential uses FloatLib's configured deterministic approximation. Its check rejects nonfinite results; it does not certify correct rounding or a real-error bound.
Checked configured binary32 addition.
Instances For
Checked configured binary32 subtraction.
Instances For
Checked configured binary32 multiplication.
Instances For
Approximate eˣ in binary32 and reject a nonfinite result.
Instances For
Checked configured binary32 min using IEEE-754 minimum.
Instances For
Checked configured binary32 max using IEEE-754 maximum.
Instances For
Checked version of the one-step discounted backup
reward + γ * (1-done) * bootstrap
specialized to Binary 8 23.
The runtime return type is Except String … so training code can choose to:
- fail fast, or
- fall back to a safer scalar backend (interval/oracle), or
- log and skip a bad sample.
Instances For
Checked preconditions → proof hypotheses #
The NN/Proofs/RL/Floats/* bridge theorems for Binary 8 23 are usually stated with
explicit
isFinite … = true hypotheses for each intermediate.
The lemma below is the glue between runtime safety checks and those proof hypotheses:
If the checked routine returns .ok, then all the finiteness side-conditions needed by the
semantic bridge theorems hold automatically.
If discountedBackupChecked returns .ok out, then:
- every configured binary32 intermediate used by the refinement theorem is finite, and
outagrees with the spec-layerdiscountedBackupformula.
Checked fixed-horizon discounted returns (no done flags), specialized to Binary 8 23.
This is the checked/finite counterpart to Runtime.RL.Core.discountedReturns.