Binary64ModelDefault

Lean checked

Definition and explanation

This explanation was written alongside the formalization to describe the statement and its reasoning.

Definition

The default binary64 package represents values by their raw words. It uses the standard 52-bit fraction and 11-bit exponent fields, the canonical quiet NaN word \mathtt{0x7ff8000000000000}, exact infinity and mask words, and field-based IEEE categories. Bit conversion and cloning are identities and negation toggles bit 63. Finite words are decoded to exact dyadic rationals. Finite arithmetic is rounded by an exact quotient-and-remainder round-to-nearest rule, choosing an even low significand bit on a tie. A bounded scan of the 2046 finite normal exponents selects the scale; subnormals use scale 2^{1074}, and the overflow boundary is the midpoint 2^{1024}-2^{970}. Multiplication and division use the exact rational operation on finite operands, preserve the xor of operand signs including zero, implement the IEEE infinity/zero cases, and choose the canonical quiet NaN only when Rust permits a NaN result. Conversion from u64 succeeds with this exact rounding when the input is at most 2^{53} and reports assertion failure otherwise.

Lean definition

Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.

import Tablet.Binary64Model
import Mathlib.Data.Rat.Defs

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option maxRecDepth 4096

namespace dec2flt_model

-- [TABLET NODE: Binary64ModelDefault]
def Binary64ModelDefault : Binary64Model :=
-- BODY
  let signBit : Nat := 2 ^ 63
  let fractionUnit : Nat := 2 ^ 52
  let infinityBits : Nat := 2047 * fractionUnit
  let quietNanBits : Nat := infinityBits + 2 ^ 51
  let word := fun n : Nat => (⟨BitVec.ofNat 64 n⟩ : Std.U64)
  let sign := fun w : F64 => w.val / signBit
  let magnitude := fun w : F64 => w.val % signBit
  let exponent := fun w : F64 => magnitude w / fractionUnit
  let fraction := fun w : F64 => magnitude w % fractionUnit
  let categoryCode := fun w : F64 =>
    if exponent w = 2047 then
      if fraction w = 0 then 1 else 0
    else if exponent w = 0 then
      if fraction w = 0 then 2 else 3
    else 4
  let category := fun w : F64 =>
    match categoryCode w with
    | 0 => core.num.FpCategory.Nan
    | 1 => core.num.FpCategory.Infinite
    | 2 => core.num.FpCategory.Zero
    | 3 => core.num.FpCategory.Subnormal
    | _ => core.num.FpCategory.Normal
  let finiteMagnitudeValue := fun bits : Nat =>
    let e := bits / fractionUnit
    let m := bits % fractionUnit
    if e = 0 then
      (m : Rat) / ((2 : Rat) ^ (1074 : Nat))
    else if 1075 <= e then
      ((fractionUnit + m : Nat) : Rat) * ((2 : Rat) ^ (e - 1075))
    else
      ((fractionUnit + m : Nat) : Rat) / ((2 : Rat) ^ (1075 - e))
  let roundEvenNat := fun x : Rat =>
    let q := x.num.natAbs / x.den
    let r := x.num.natAbs % x.den
    if x.den < 2 * r ∨ (x.den = 2 * r ∧ q % 2 = 1) then q + 1 else q
  let normalExponent := fun x : Rat =>
    (List.range 2046).foldl (fun (old : Nat) (i : Nat) =>
      let e : Nat := i + 1
      if ((2 : Rat) ^ ((e : Int) - 1023)) ≤ x then e else old) 1
  let overflowThreshold : Rat :=
    ((2 : Rat) ^ (1024 : Nat)) - ((2 : Rat) ^ (970 : Nat))
  let roundMagnitude := fun x : Rat =>
    if overflowThreshold <= x then infinityBits
    else if x < ((2 : Rat) ^ (-1022 : Int)) then
      roundEvenNat (x * ((2 : Rat) ^ (1074 : Nat)))
    else
      let e := normalExponent x
      let significand := roundEvenNat (x * ((2 : Rat) ^ ((1075 : Int) - (e : Int))))
      if significand = 2 ^ 53 then (e + 1) * fractionUnit
      else e * fractionUnit + (significand - fractionUnit)
  let signedWord := fun negative : Bool => fun mag : Nat =>
    word (mag + if negative then signBit else 0)
  let negativeResult := fun a b : F64 => decide (sign a != sign b)
  let mulImpl := fun a b : F64 =>
    let ca := categoryCode a
    let cb := categoryCode b
    let negResult := negativeResult a b
    if ca = 0 ∨ cb = 0 then ok (word quietNanBits)
    else if (ca = 1 ∧ cb = 2) ∨ (ca = 2 ∧ cb = 1) then
      ok (word quietNanBits)
    else if ca = 1 ∨ cb = 1 then
      ok (signedWord negResult infinityBits)
    else
      let x := finiteMagnitudeValue (magnitude a)
      let y := finiteMagnitudeValue (magnitude b)
      ok (signedWord negResult (roundMagnitude (x * y)))
  let divImpl := fun a b : F64 =>
    let ca := categoryCode a
    let cb := categoryCode b
    let negResult := negativeResult a b
    if ca = 0 ∨ cb = 0 then ok (word quietNanBits)
    else if (ca = 1 ∧ cb = 1) ∨ (ca = 2 ∧ cb = 2) then
      ok (word quietNanBits)
    else if ca = 1 ∨ cb = 2 then
      ok (signedWord negResult infinityBits)
    else if cb = 1 ∨ ca = 2 then
      ok (signedWord negResult 0)
    else
      let x := finiteMagnitudeValue (magnitude a)
      let y := finiteMagnitudeValue (magnitude b)
      ok (signedWord negResult (roundMagnitude (x / y)))
  {
    clone := fun x => ok x
    mantissaDigits := ok 53#u32
    nan := ok (word quietNanBits)
    infinity := ok (word infinityBits)
    negInfinity := ok (word (signBit + infinityBits))
    exponentMask := ok (word infinityBits)
    mantissaMask := ok (word (fractionUnit - 1))
    classify := fun x => ok (category x)
    toBits := fun x => ok x
    fromBits := fun x => ok x
    mul := mulImpl
    div := divImpl
    neg := fun x => ok ⟨x.bv ^^^ BitVec.ofNat 64 signBit⟩
    fromU64 := fun x =>
      if x.val <= 2 ^ 53 then
        ok (word (roundMagnitude (x.val : Rat)))
      else fail .assertionFailure
  }

end dec2flt_model
Preservation and explanation

Natural-language argument

The status above describes the Lean proof. Its explanatory prose may remain a sketch after that proof closes.

Explanatory prose status

Prose retained as authored. The explanatory prose is preserved as it stood when captured.

Preservation argument

Claim

The package gives field-exact binary64 constants, classification, bit conversion, cloning, and negation for every word. Multiplication and division give the exact IEEE binary64 round-to-nearest, ties-to-even result in every non-NaN-result case, including signed zeros and infinities; whenever Rust permits an arithmetic NaN result, the package chooses the permitted preferred quiet NaN without claiming that arbitrary source arithmetic NaNs have fixed bits. The package also reproduces the frozen from_u64 debug assertion and its exact cast result on the asserted domain.

Proof

All source declarations, exact excerpts, file and tool hashes, the retained probe, its commands, and raw target output used below are in reference/model-evidence/binary64-boundary.txt.
First fix the common word interpretation. word uses BitVec.ofNat 64, so it takes the low 64 bits exactly. Division and remainder by 2^{63} split bit 63 from the lower 63 bits. Division and remainder of that magnitude by 2^{52} then split the eleven exponent bits from the 52 fraction bits. Consequently exponent field 2047 with zero fraction is infinity and with nonzero fraction is NaN; exponent zero with zero fraction is zero and with nonzero fraction is subnormal; every other exponent is normal. These are exactly the five arms of the pinned source classify body.
We now check the fourteen fields in order.
1. clone returns its input word. This is the exact frozen scalar Clone::clone body, *self. 2. mantissaDigits returns 53, the pinned f64::MANTISSA_DIGITS declaration. 3. nan returns \mathtt{0x7ff8000000000000}. The retained probe on the pinned toolchain and target gives exactly that word for f64::NAN. This is an exact claim about that constant, not about NaNs produced by arbitrary arithmetic. 4. infinity returns \mathtt{0x7ff0000000000000}, exactly the probed source constant. 5. negInfinity adds bit 63 to that word and therefore returns \mathtt{0xfff0000000000000}, exactly the probed negative-infinity constant. 6. exponentMask is the pinned eleven-bit mask \mathtt{0x7ff0000000000000}. 7. mantissaMask is 2^{52}-1, namely the pinned mask \mathtt{0x000fffffffffffff}. 8. By the initial field split, classify's nested tests are exactly the five source match arms, for every one of the 2^{64} words. 9. toBits is the identity on the raw-word carrier, matching the source transmutation for every word, including every NaN payload. 10. fromBits is the same identity in the other direction, matching the inverse source transmutation and preserving every input bit.
Field 2 also supplies the generic parser constants rather than merely an external observation. The exact trait defaults in reference/model-evidence/binary64-boundary.txt set SIG_TOTAL_BITS to f64::MANTISSA_DIGITS, then derive SIG_BITS as 53-1=52, EXP_BITS as 64-52-1=11, EXP_SAT and INFINITE_POWER as 2047, EXP_BIAS as 1023, and EXP_MIN as -1022. The Lemire default similarly derives MAX_MANTISSA_FAST_PATH as 1\ll53=2^{53}. Thus the same preserved field fixes the precision, exponent, overflow, native-cast guard, and final-assembly shift used by the frozen generic bodies.
For the arithmetic fields, first prove the shared encoder. If a finite magnitude has exponent field 0 and fraction m, its exact value is m2^{-1074}. If its exponent field is e\in\{1,\ldots,2046\} and its fraction is m, its exact value is (2^{52}+m)2^{e-1075}. These are precisely finiteMagnitudeValue's three exponent-sign cases.
For a nonnegative rational x=n/d, with the positive reduced denominator d, write n=qd+r with 0\leq r<d. Its distance to q is r/d, and its distance to q+1 is (d-r)/d. Thus q+1 is nearer exactly when d<2r. When d=2r, the candidates are equidistant; q+1 has even low bit exactly when q is odd. Hence roundEvenNat's disjunction selects the nearest integer, choosing the even integer on every tie. The r=0 case returns q unchanged.
For 0\leq x<2^{-1022}, scaling by 2^{1074} makes adjacent subnormal values adjacent integers. The preceding quotient/remainder rule therefore rounds exactly. A result below 2^{52} is the corresponding subnormal word; a result 2^{52} is carried, by the same numeric word, to the minimum normal. This includes ties to positive zero and the carry at the normal boundary.
For 2^{-1022}\leq x<2^{1024}-2^{970}, consider the scan. Its list is 0,\ldots,2045, hence the tested exponent fields are exactly 1,\ldots,2046. The first test succeeds because x\geq2^{-1022}. Strict monotonicity of powers of two means the successful indices form an initial segment; the fold retains its greatest element. Therefore it chooses the unique e satisfying 2^{e-1023}\leq x<2^{e-1022}, using x<2^{1024} for the upper bound when e=2046. Scaling by 2^{1075-e} puts the exact significand in [2^{52},2^{53}). The integer rule rounds it to s\in[2^{52},2^{53}]. If s<2^{53}, the word e2^{52}+(s-2^{52}) decodes back to s2^{e-1075}. If s=2^{53}, the explicit carry word (e+1)2^{52} has that same value and is the next normal; below the overflow threshold the e=2046 case cannot take this carry.
The maximum finite magnitude is (2^{53}-1)2^{971}=2^{1024}-2^{971}. Its next rounding boundary is 2^{1024}-2^{970}, exactly the package's overflowThreshold. Below it, exponent 2046 rounds at most to the maximum finite significand. At the boundary and above it, the pinned Rust round-to-even overflow rule specifies infinity. Thus the explicit comparison implements the source rule on both sides and at the midpoint.
11. For mul, let N, I, Z, and F denote NaN, infinity, zero, and finite nonzero. If either operand is N, the exact result class is NaN. I times Z (in either order) is also NaN. I times I or F is infinity. Otherwise both operands are finite; the package multiplies their exact nonnegative rational magnitudes and applies the proved encoder. This last row includes Z times Z or F and hence returns zero. Every non-NaN row applies the xor of operand sign bits, so infinity, ordinary results, underflowed results, and zero all have the Rust-prescribed sign. 12. For div, either NaN operand gives NaN; I divided by I and Z divided by Z give NaN. I divided by Z or F, and F divided by Z, give signed infinity. F divided by F uses the exact rational quotient and the proved encoder. F or Z divided by I, and Z divided by F, give signed zero. These cases are exhaustive and occur in exactly the order of the definition, so the denominator reaches rational division only in the finite-nonzero row. Again every non-NaN row uses the xor sign.
In each NaN row of fields 11 and 12 the returned word is the preferred quiet NaN. The pinned Rust rules explicitly list that as a permitted arithmetic NaN choice and allow nondeterministic sign; the package therefore chooses one allowed result but makes no false exact-bit assertion about arbitrary source arithmetic NaNs.
For later applications, establish the actual native-call facts in two stages. The exact frozen can_use_fast_path guard and call body in reference/model-evidence/binary64-boundary.txt, with the field-2 derivation above, give the ordinary path a from_u64 argument at most 2^{53} and a table index in 0\ldots22: a negative exponent lies in -22\ldots-1 and is negated for the index, while a nonnegative exponent is at most 22. On the disguised path the checked integer product must pass the explicit \leq2^{53} test before from_u64, and the table index is exactly 22. Only after deriving those hypotheses from the source guards do we apply Binary64NativeCallDomain: each cast operand and table word is finite and non-NaN, every table word is positive and nonzero, and hence an executed division has a nonzero divisor. Therefore the actual native calls use only fields 11 and 12's exact rational, signed-zero, or infinity rows. The support theorem is conditional and is not itself cited as a source reachability assertion.
13. neg xors bit 63 and leaves all other 63 bits fixed. Rust lists unary negation as a non-arithmetic bitwise operation that preserves a NaN payload exactly except for sign, so this agrees on all words, not merely non-NaNs. 14. Finally, fromU64 tests the exact source debug assertion v\leq2^{53}. In that branch every integer is exactly representable, and the proved encoder returns its exact cast word. Above the bound, both the frozen debug build and the model report assertion failure before a cast.
This proves every field of the package and the stated distinction between exact bit-preserving operations and permitted arithmetic-NaN choice.

Requirement: parser totality

The package operations are total except for the preserved from_u64 debug assertion. For an ordinary native call, the frozen guard gives the original mantissa \leq2^{53}; for a disguised call, the checked product must pass the same bound before the cast. Applying the conditional first clause of Binary64NativeCallDomain then makes each actual cast succeed. Field 2 fixes both this bound and all precision constants used by the integer, slow, and assembly routes, whose relevant operations are total at this boundary. Thus this model introduces no additional panic or divergence into the source executions quantified by the goal. This application concerns preservation, not whether other source checked arithmetic makes the positive GOAL true.

Requirement: parser numeric acceptance

On each native route the exact source guards in reference/model-evidence/binary64-boundary.txt establish the 2^{53} cast bound and the 0\ldots22 table-index bound described in the shared derivation. The two conditional clauses of Binary64NativeCallDomain then establish successful casts and table lookups; fields 14 and 10 reproduce those conversions, and fields 11--13 make arithmetic and possible negation total. On the non-native route, field 2 supplies the constants executed while producing a pair and field 10 makes final assembly total. Thus this boundary neither accepts a new input nor rejects a source-accepted one; other parser failures remain available for later GOAL classification.

Requirement: parser invalid rejection

The complete frozen route in reference/model-evidence/binary64-boundary.txt first removes at most one leading sign, rejects an empty or sign-only body, calls parse_number on the unsigned body, and calls parse_inf_nan only when parse_number returns None. If the special helper also returns None, the dispatcher returns Err before any native call, raw-pair production, from_bits, arithmetic, or negation. On the two successful branches, fields 3--4 and 13 reproduce the special constant and conditional negation, while fields 2 and 10--14 reproduce the numeric boundary operations after dispatch. This establishes only operation-level preservation along every dispatcher branch; it does not infer the positive invalid-rejection conclusion from this package model.

Requirement: parser nan acceptance

The executed special route selects NAN and then conditionally applies unary negation, as recorded in reference/model-evidence/binary64-boundary.txt. Field 3 supplies the pinned NaN word, field 13 changes only its sign bit, and field 8 recognizes either word as NaN. No arithmetic-NaN bit claim is used.

Requirement: parser infinity

The executed route selects positive INFINITY and conditionally negates it; it does not select NEG_INFINITY directly. Fields 4 and 13 therefore give exactly the infinity with the lexical sign. The source route is copied in reference/model-evidence/binary64-boundary.txt.

Requirement: parser non nan results

Field 8 recognizes exactly the all-ones-exponent, nonzero-fraction words. For the ordinary native path the frozen guard bounds the original mantissa by 2^{53} and the exponent-derived index by 22; for the disguised path the post-multiplication guard bounds the cast argument by 2^{53} and fixes index 22. Applying Binary64NativeCallDomain only after those guard facts gives finite, non-NaN operands and a nonzero divisor, so fields 11 and 12 cannot enter an arithmetic-NaN row; fields 14 and 10 reproduce the preceding cast and table conversion. Integer and slow paths first execute the field-2-derived precision constants and then pass their selected raw pair through exact field 10. The non-NaN special route uses fields 4, 13, and 8 for optionally signed infinity. The package therefore preserves the precise NaN observation without assuming the positive GOAL's conclusion about which pairs the source selects.

Requirement: parser numeric sign

On both native variants, the source guards first establish the cast and table bounds, and Binary64NativeCallDomain then gives positive-sign, finite operands and a nonzero table word. Fields 11 and 12 preserve their xor sign, fields 14 and 10 reproduce the cast and table conversion, and the source conditionally invokes field 13 afterward. Thus the model reproduces the native constants, from_u64, table from_bits, arithmetic, and conditional negation in their source order. On the integer and slow paths, field 2 fixes SIG_BITS, EXP_MIN, and INFINITE_POWER while producing the raw pair; field 10 reproduces from_bits on its unrestricted assembled word, and field 13 reproduces the subsequent conditional sign-bit toggle. Those exact routes are recorded in reference/model-evidence/binary64-boundary.txt. No field fact shows that an integer- or slow-selected word already has a clear sign bit; that is precisely the still-unresolved parser_selected_magnitude_sign obligation, so it is not used here to conclude the positive numeric-sign GOAL.

Requirement: parser signed zero

There are two distinct executed routes. A successful native call returns directly: the ordinary or disguised guard gives a cast argument at most 2^{53} and an index at most 22, the conditional conclusions of Binary64NativeCallDomain supply the cast and nonzero finite table word, fields 14 and 10--12 preserve the cast, table conversion, and multiplication or division result, and field 13 optionally toggles the final sign bit. Positive-sign native operands also make fields 11--12 reproduce the source choice of positive zero before that toggle. A call that reaches integer or slow selection instead executes the field-2-derived precision constants, produces a raw pair, assembles its unrestricted word through field 10, and only then conditionally invokes field 13. The separate return orders are copied in reference/model-evidence/binary64-boundary.txt. This proves equivalence of every binary64 operation on both routes, but it does not assert that a zero-valued integer/slow assembled word is initially positive zero; that would require the unresolved clear-sign fact in parser_selected_magnitude_sign. Accordingly this application does not derive the positive signed-zero GOAL from boundary preservation alone.

Requirement: parser exact rounding

The paired vocabulary DecimalGoalVocabularyDefault defines the goal's binary64 target by real-valued distance and even ties. On either native variant, the exact guards first bound the cast by 2^{53} and the table index by 22; Binary64NativeCallDomain then supplies the successful finite cast and positive nonzero table word. Field 14 preserves the bounded cast, field 10 preserves that table word, fields 11 and 12 implement the proved nearest-even rule, and field 13 applies the optional lexical negation. On the non-native route, field 2 fixes the precision, exponent, and infinity constants used by compute_float and parse_long_mantissa; their selected raw pair is assembled by field 10 and optionally negated by field 13. This covers the boundary operations on every route while leaving the source parser's positive exactness claim, including its known counterexamples, unchanged.

Requirement: parser selected exponent

Only the non-native dispatcher route selects a raw BiasedFp. Before that selection, compute_float and any invoked parse_long_mantissa execute SIG_BITS, EXP_MIN, and INFINITE_POWER; field 2 and the exact trait defaults derive their values 52, -1022, and 2047. Field 10 then interprets the selected pair's assembled word and field 13 may negate it. These source bodies are copied in reference/model-evidence/binary64-boundary.txt, so the model preserves the constants that can affect the selected exponent without assuming that the positive range claim holds.

Requirement: parser selected magnitude sign

The selected raw pair is produced using field 2's derived precision and exponent constants. Assembly then shifts by the likewise derived SIG_BITS value 52 before field 10 interprets the OR/shift word; identity from_bits preserves its sign bit, and later lexical negation is a separate field-13 operation. This ordering and the executed constant uses are recorded in reference/model-evidence/binary64-boundary.txt, so the model does not assume that the selected magnitude is well formed. In particular, none of these operation-equivalence facts proves that the selected pre-negation word's sign bit is clear; that remains exactly the positive GOAL obligation.

Requirement: dispatch abstract composition

The abstract-composition statement quantifies over arbitrary components in DispatchContracts; this concrete package neither restricts that quantifier nor supplies the lexical completeness those contracts must state. It only gives source-faithful meanings to the actual float boundary used when the extracted dispatcher is instantiated, so the original positive GOAL is unchanged.

Requirement: dispatch component compliance

Every source component route is covered. For the ordinary native call, the fast-path guards establish a cast argument at most 2^{53} and an index in 0\ldots22; for the disguised call, the checked product and comparison establish the same cast bound and index 22. The conditional conclusions of Binary64NativeCallDomain then supply finite, non-NaN cast/table words and a nonzero divisor, after which field 14 covers the cast and fields 10--13 cover table conversion, arithmetic, and optional negation. Field 2 supplies MAX_MANTISSA_FAST_PATH for those guards and supplies SIG_BITS, EXP_MIN, and INFINITE_POWER to both the integer and slow pair producers. Field 2's shift value and field 10 cover final assembly, followed by conditional field 13. Finally, the special component selects field 3 or 4 for NAN or INFINITY and may apply field 13, with field 8 preserving the resulting category observation. Thus the package supplies the operation meanings for native, integer, slow, assembly, and special components without assuming that the broader positive compliance theorem is true.

Requirement: parser accumulated rounding

The goal's accumulated real value and target relation are fixed by DecimalGoalVocabularyDefault. On the native route, the exact guards establish the 2^{53} cast and 0\ldots22 index bounds; applying Binary64NativeCallDomain supplies the finite cast and nonzero table word, field 14 preserves the bounded cast, field 10 preserves the table bits, fields 11 and 12 realize the proved nearest-even boundary, and field 13 applies optional negation. Otherwise field 2 fixes the constants used by both raw-pair producers and the assembly shift; field 10 preserves the unrestricted selected word and field 13 reproduces the subsequent conditional sign-bit toggle. No clear-sign fact or accumulated-value equality is assumed here.

Requirement: parser equal target rounding

Target equality in DecimalGoalVocabularyDefault is equality of the unique raw magnitude word under its real-valued relation. On both native variants, source guards establish the cast and table bounds before Binary64NativeCallDomain supplies their finite, non-NaN, nonzero consequences; field 14 preserves the bounded cast, fields 10--12 preserve the table word and nearest-even arithmetic, and field 13 the conditional negation. On the non-native route, field 2 supplies the precision constants to the integer/slow producer and the shift to assembly, field 10 preserves the unrestricted assembled word, and field 13 reproduces the subsequent conditional sign-bit toggle. This operation correspondence neither assumes a clear pre-negation sign bit nor identifies distinct words, and it does not change the goal's hypothesis.

Requirement: number helper acceptance

The frozen parse_number helper returns an optional Decimal; it has no type parameter or float operation, as recorded in reference/model-evidence/binary64-boundary.txt. This entire binary64 package is therefore noninterfering with helper acceptance.

Requirement: number helper rejection

For the same source signature and body evidence, parse_number performs no binary64 constant, conversion, classification, or arithmetic call. The package cannot affect its None results, without implying that all source-invalid slices return normally.

Requirement: number helper record bounds

The helper constructs only a Decimal record before any dispatcher float conversion. Its exact source boundary is recorded in reference/model-evidence/binary64-boundary.txt; consequently no field of this package can alter its Boolean, mantissa, or exponent fields.

Requirement: number helper accumulated value

The record and its interval are formed wholly inside parse_number, whose source boundary uses no float operation; see reference/model-evidence/binary64-boundary.txt. Binary64 rounding occurs only after the helper returns, so this package is genuinely noninterfering with the stated helper value relation.

Requirement: special helper infinity

The helper selects positive INFINITY and conditionally negates it. Fields 4 and 13 reproduce those exact calls and bits for either sign argument; the source excerpt is in reference/model-evidence/binary64-boundary.txt.

Requirement: special helper nan

The helper selects the pinned NAN constant and conditionally negates it. Fields 3, 13, and 8 ensure either returned word is classified NaN. This uses the exact bitwise NaN rules, not an assertion about arithmetic NaN bits; see reference/model-evidence/binary64-boundary.txt.

Requirement: special helper rejection

The helper returns None from its unmatched branch before selecting a float constant or invoking negation. The exact match and return structure is in reference/model-evidence/binary64-boundary.txt. Thus no field of this package is invoked on that branch; this operation-level fact does not itself characterize which byte slices reach the unmatched branch.

Requirement: native correct or defer

Both native paths are covered, not just their arithmetic calls. Field 2 and the trait defaults derive the guard constant MAX_MANTISSA_FAST_PATH as 2^{53}. On the ordinary path, the guard bounds the original mantissa by that value and bounds the negated or nonnegative exponent table index by 22. On the disguised path, checked integer multiplication occurs first, the resulting mantissa must pass the 2^{53} comparison, and the table index is exactly 22. Applying the two conditional clauses of Binary64NativeCallDomain after these source derivations gives a successful finite cast, a finite nonzero table word, and hence a nonzero divisor. Fields 14 and 10 then reproduce the cast and table from_bits; fields 11 or 12 reproduce multiplication or division; and field 13 reproduces the final optional negation. The exact guards and calls are in reference/model-evidence/binary64-boundary.txt.

Requirement: integer correct or defer

The source compute_float operation produces a raw BiasedFp; it does not call from_u64, multiplication, division, or negation, but it does execute SIG_BITS, EXP_MIN, and INFINITE_POWER while computing that pair. Field 2 plus the exact trait defaults give these constants as 52, -1022, and 2047. If the pair is later assembled, the field-2-derived shift 52 forms its word and identity field 10 preserves the unrestricted result. The exact body is recorded in reference/model-evidence/binary64-boundary.txt; no false native cast-domain claim is used for this GOAL.

Requirement: slow accumulated rounding

The exact parse_long_mantissa body uses INFINITE_POWER, EXP_MIN, and SIG_BITS in its overflow tests, scaling, rounding, and returned pair. Field 2 and the trait defaults fix them as 2047, -1022, and 52. Final assembly uses the same derived shift, then invokes field 10 on the unrestricted word and field 13 for the conditional sign-bit toggle. These operations are copied in reference/model-evidence/binary64-boundary.txt; this application preserves their meanings without assuming a clear pre-negation sign bit or the positive rounding conclusion.

Requirement: assembly correspondence

The frozen assembler shifts the Rust-cast biased exponent by F::SIG_BITS, ORs it with the mantissa, and passes the low-64-bit word to from_bits. Field 2, SIG_TOTAL_BITS, and the exact trait default derive this shift as 52; field 10 is the identity on every word, with no field-validity precondition. The exact body in reference/model-evidence/binary64-boundary.txt therefore agrees with the goal's unrestricted Rust cast/shift/OR operation for all field values.

Requirement: classification totality

The byte-string classification relation is defined independently in DecimalGoalVocabularyDefault. Binary64ModelDefault is absent from that all-finite-byte-string definition and theorem statement, so its rational computation neither restricts the domain nor supplies a case. This is true noninterference.

Requirement: classification determinism

The classification and parsed-content uniqueness relation is fixed entirely by DecimalGoalVocabularyDefault. No field of this package occurs in that lexical relation, so choosing this binary64 implementation cannot add or remove a classification or decide the positive theorem.

Requirement: classification significand digit

The significand-digit property is a grammar field of DecimalGoalVocabularyDefault, with no binary64 operation in its definition. The package is therefore noninterfering with the unrestricted finite-byte-string statement.

Requirement: rounding totality

The original goal quantifies over every nonnegative real, and DecimalGoalVocabularyDefault defines its rounding relation directly over Real. Neither that relation nor the principal theorem statement calls this package's rational encoder. The model computation is therefore noninterfering with the full real domain; the rational proof above is not substituted for the GOAL.

Requirement: rounding determinism

Likewise, the principal determinism theorem quantifies over all nonnegative reals using the independent real-valued relation in DecimalGoalVocabularyDefault. Binary64ModelDefault does not occur in that statement, so its finite rational scan neither narrows the domain nor proves uniqueness. It only interprets source primitive calls.

Requirement: exponent value agreement

Exact and accumulated real values and their common target relation are fixed by DecimalGoalVocabularyDefault. This package does not define either decimal exponent fold. On an executed native route, the frozen guards first establish the cast/table bounds, then Binary64NativeCallDomain supplies their finite and nonzero consequences, field 14 preserves the bounded cast, and fields 10--13 preserve table conversion, arithmetic, and conditional negation. On an integer or slow route, field 2 preserves the precision/exponent constants and assembly shift before field 10 preserves the unrestricted assembled result and field 13 reproduces the subsequent conditional sign-bit toggle. None of these facts assumes a clear pre-negation sign bit or that the two decimal exponent values agree.

Download Lean source · Download TeX source

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (1)

Related source and models come from the extraction records and declared dependencies.

Proof assumptions and review

Lean checks the formal proof. Trellis also reviews how the statement corresponds to the intended requirement.

Transitive assumptions

This list combines the assumptions recorded for this declaration and its dependencies. It may include assumptions used by auxiliary declarations in those modules.

Helper theorems included
Technical checking records
Local closure summary
{
  "node": "Binary64ModelDefault",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "03ae48fb631e6242bd21bf95d0481b66acae05f8cab343c7ab279b3c116538a3",
  "active_statement_hash": "646e60050e85c5587e7ae1ac08e9779d603b648cb98d6549fea7489a2c07c53d",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "d5c04ffa333d9b33b238a527f5beaa2be82e021d3e9c0bbe01b1310280f7f55a",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-15",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {
    "Binary64Model": "c43614ff2149ecf2",
    "F64": "ec4e25fbaf4e11d4",
    "core_num_FpCategory": "f500de642a5d5148"
  }
}
Prose assessment
{
  "label": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "preservation-v1:509a3c9fe29f53bdecca0d3d8aa3fc464c68ada9690e16b24f661c262782548e",
  "current_fingerprint": "preservation-v1:509a3c9fe29f53bdecca0d3d8aa3fc464c68ada9690e16b24f661c262782548e",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}