Flocq-style generic formats as ordinary FloatLib formats #
The radix/exponent-function model of FloatRep supplies a representation-independent
EncodedFormat interface.
The runtime code is a canonical integer-mantissa/integer-exponent pair. Its proof of canonicality
is erased by Lean, while its denotation is the corresponding real number. The central theorem
representable_iff_genericFormat proves that common-system representability is exactly
genericFormat.
The definitions mirror the separation in Flocq between:
generic_format, which characterizes representable real values;Valid_exp, which constrains exponent-selection functions; and- a rounding operator proved to return a generic-format value.
Primary references:
- S. Boldo and G. Melquiond, “Flocq: A Unified Library for Proving Floating-Point Algorithms in Coq,” ARITH 2011, DOI 10.1109/ARITH.2011.40.
- Flocq 4.2.2 source repository, including
src/Core/Generic_fmt.v: https://gitlab.inria.fr/flocq/flocq. - Flocq project documentation: https://flocq.gitlabpages.inria.fr/flocq/.
Type-level identity of the generic radix/exponent-function format.
The constructor carries no format data. The radix and exponent function are type parameters, so specialized users do not pass a runtime descriptor through arithmetic kernels.
- format {β : Numerics.Radix} {fexp : ℤ → ℤ} : GenericFormat β fexp
Instances For
Canonical mantissa/exponent codes of a valid Flocq-style generic format.
Instances For
A canonical code represents exactly the real obtained from its mantissa and exponent.
Common FloatLib representability coincides exactly with the Flocq-style generic_format
predicate.
Choose a canonical code for a value already known to belong to the generic format.
This function is proof-facing and noncomputable. Concrete fixed-precision format families supply their own executable packing kernels.
Instances For
encodeGeneric denotes the real value from which it was chosen.
Round a real input and choose a canonical code for the rounded generic-format value.
Instances For
The selected code denotes exactly the standard-mode rounded result.
Relational quantization contract for standard Flocq-style rounding modes.
Instances For
roundCode implements the common relational quantization contract.
Rounding an already representable real denotes that same real.