Configured binary values and literals #
Import this module to define a binary format by its exponent and fraction widths:
ExecFloat.Binary (exponentBits := 8) (fractionBits := 23)
Configured.Type owns the public type constructor, the modules below Configured.Storage own
packed-carrier selection and codecs, and Configured.NativeDispatch plus
Configured.Plan.Instances install certified operation backends. The value-facing implementation
is separated further:
Configured.Value.Coreprovides packing, decoding, classification, and special values without importing arithmetic dispatch;Configured.Value.CoreProofproves lossless model and bit-pattern round trips;Configured.Classificationconnects the ten value classes to their exact numerical meaning;Configured.Instancesinstalls comparison, display, literals, and negation;Configured.Rounding.Runtimeexposes all six primitive operations with an explicit IEEE direction, whileConfigured.Rounding.Proofsupplies their contracts;Configured.Comparisonprovides quiet and signaling predicates with explicit exception flags;Configured.TotalOrderorders complete representations, including zero signs and NaN metadata;Configured.Operations.Runtimeexposes integral rounding, scaling, exponent, adjacency, and sign tools, whileConfigured.Operations.Proofsupplies their contracts;Configured.Parsingaccepts exact decimal and radix-two character input without a host float;Configured.Formattingwrites decimal or hexadecimal text at exact or requested precision; the text conversion proofs establish rounding bounds and exact round trips; andConfigured.Reductionprovides exact accumulation with one final rounding and error bounds for trees of separately rounded additions;Configured.Intervalprovides outward-rounded intervals with configured endpoints, reusing the model interval arithmetic and enclosure proofs.
Configured.Transcendentals is a named import, not part of this module: it lifts the
deterministic elementary-function kernels to this type. import FloatLib does not install
ExecFloat.Binary.exp, Model.exp, Model.pow, or the binary MathFunctions instances.
Natural and scientific literals are rounded once from exact rationals into the destination
format. They never pass through Lean's host Float, C double, or an IEEE bit-pattern parser.
Import FloatLib.Floats.Formats.BinaryInterchange.Info.Command when #float_info is also
required.
References #
- IEEE Standard for Floating-Point Arithmetic, IEEE 754-2019, Sections 3.4 and 4.3.1, https://doi.org/10.1109/IEEESTD.2019.8766229.
- Lean scientific literal elaboration, https://lean-lang.org/doc/reference/latest/Terms/Numeric-Literals/.
Plan #
Configured formats make two static decisions:
StoragePlanchooses the persistent carrier from encoded width.- This module chooses a certified kernel independently for each operation.
The implementation is split by responsibility:
Estimatesdecorates arithmetic costs with carrier adaptation.NativeCandidatesnames the fixed-format certificates for binary32 and binary64.Routesrecognizes structural word, fixed-format, and fixed-limb eligibility.Candidatespackages structural routes and the generic kernel with pointwise refinement proofs.WideLimbCandidatescertifies the wide-limb kernels on the limb carrier of formats wider than 128 bits.Automaticadds the direct byte-table and wide-limb fast paths after dependent elimination of the selected carrier.Instancesinstalls the resulting operation capabilities.Proofrelates first-order entry points to policy-selected certificates.
All selection is structural. Word and pair kernels advertise explicit descriptor capabilities; layout-specific implementations remain specialized without testing catalogued format names. Every supported descriptor retains the generic kernel as a fallback.