Decimal intent
The exact sum of the decimal strings you entered.
LEAN 4 · FLOATING-POINT FORMALIZATION
Real-number mathematics. Finite binary values.
FloatSpec makes the relationship precise with machine-checked theorems in Lean.
Correctly rounded can still look surprising.
01 / ROUNDING EXPLORER
Decimal intent, represented inputs, exact sum, rounded output. Four steps that are easy to confuse.
A halfway case. The even significand wins.
The exact sum of the decimal strings you entered.
Each input may move when converted to binary64.
Add the represented values with no further rounding.
The exact real value represented by the result.
This is an original educational JavaScript calculation, using BigInt rational arithmetic to inspect browser binary64 values. It does not run Lean or check a proof. The repository’s separate regression tests check the 0.1 + 0.2 example in Lean’s kernel.
02 / THE PROOF BOUNDARY
FloatSpec connects Lean’s logical Float model to a Lean port of Flocq’s arithmetic. The assumptions are part of the result.
Here, value is the source’s toReal map, and RN rounds to nearest with ties to even in the binary64 format.
Sufficient for the no-overflow premise: the exact sum has magnitude at most (253 − 1) × 2971, the largest finite binary64 value.
Inspect add_eq_round“Exact” means the real sum of the represented operands, not the decimal strings used to enter them.
The additive term accounts for underflow. Float32 has parallel theorems with bounds 2−24 and 2−150.
Inspect add_standard_modelCompiled Float operations call the runtime’s C operators. Agreement with the logical model remains part of the compiler and runtime trust boundary.
The source’s toReal map sends infinities and NaN to zero. A real-valued equality alone is not enough; finiteness conclusions matter.
The native bridge covers +, −, ×, ÷ and √. Division requires a nonzero real-valued divisor. Other operations have their own premises; these are not field laws for machine floats.
03 / INSIDE THE LIBRARY
Layered definitions, executable reference operations and direct mathematical propositions.
Formats, rounding predicates, ulps and foundational definitions
MATHEMATICAL BASIS02Executable reference arithmetic and its specifications
REFERENCE OPERATIONS03Rounding relationships and error-bound theorems
PROPERTIES04Binary representations and the Float.Model bridge
NATIVE CONNECTIONPlanned, not implemented: the separate VCFloat-style ErrorBound layer has six empty component modules at this source revision. It should not be mistaken for an available end-to-end error-analysis API.
04 / PROVENANCE & EVIDENCE
FloatSpec is Hantao Lou’s Lean port of Flocq, including the Float.Model bridge. Flocq originates with Sylvie Boldo and Guillaume Melquiond. Alok’s public fork includes AI-assisted continuation; this project is not presented as sole-author work.
The repository’s root has an Apache 2.0 license, while ported source files retain LGPL v3-or-later notices. Those notices coexist. This site links to the source and does not redistribute or relicense that implementation.