IEEE32 Executable Instances #
This file gives IEEE32Exec the standard Lean numeric interfaces needed by tensor specs and
examples. The instances route arithmetic through the executable binary32 operations defined in the
Exec32 hierarchy.
Pretty-print using Lean's Float printer (via toFloat).
Coerce naturals to binary32 by converting through Lean's Float and re-encoding.
0.0 as an executable binary32 value (chosen as +0.0).
1.0 as an executable binary32 value.
Unary negation (IEEE-754 sign flip, with NaN payload rules).
IEEE-754 addition (with NaN/Inf rules).
IEEE-754 subtraction (with NaN/Inf rules).
IEEE-754 multiplication (with NaN/Inf rules).
IEEE-754 division (with NaN/Inf rules).
Exponentiation instance.
This is a deterministic executable choice, not a claim about correctly-rounded pow:
we implement a small set of IEEE-like special cases and handle integer exponents exactly enough to
avoid the most common footguns (negative bases, 0^0, 1^∞, etc.). For general non-integer
exponents we fall back to exp (b * log a) on positive bases.
Instances For
Boolean equality with IEEE-754 NaN/zero conventions.
- If either side is NaN, we return
false. - If both are zeros (either sign), we return
true. - Otherwise we compare raw bits.
Strict order instance, defined via IEEE32Exec.lt.
Non-strict order instance, defined via IEEE32Exec.le.
Decidable < inherited from the compare-based definition.
Decidable ≤ inherited from the compare-based definition.
min operator, implemented by IEEE-754 minimum.
max operator, implemented by IEEE-754 maximum.
Provide the MathFunctions interface using the deterministic implementations in this file.
Numeric constants used by the spec library, instantiated at binary32.
Context instance so the spec layer can execute with IEEE32Exec scalars.