Distance to the nearest integer
DefinitionLL_Decomp1543c_nintFor real , , the distance from to the nearest integer.
import Mathlib namespace LL_Decomp1543c open Real Finset ArithmeticFunction noncomputable def nint (x : ℝ) : ℝ := |x - round x| end LL_Decomp1543c
Read-back
What the Lean code literally says, in plain math · claude-haiku
The item defines a function , named in the namespace , by for every real . There are no hypotheses and no binders beyond .
Here is an integer, the nearest-integer function of Mathlib (not defined in this item). It is cast to a real before the subtraction, so is the absolute distance from to its nearest integer. At half-integers both nearest integers are equally close, so the value is whichever integer is chosen.
The function is total: there is no division and no natural-number subtraction, so no junk values arise. The item asserts no theorem or property, such as ; its only content is the equation above.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.