F64

Lean checked

Definition and explanation

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

Definition

The model carrier \mathsf{F64} is the set of unsigned 64-bit words. A word records the complete IEEE-754 binary64 representation, including its sign bit, exponent, significand, signed-zero distinction, infinities, and NaN payload.

Lean definition

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

import Aeneas

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: F64]
abbrev F64 : Type :=
-- BODY
  Std.U64

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

Representing a Rust f64 by its complete to_bits word loses no source encoding or public bit-level observation: on the full 64-bit domain, including every NaN encoding, from_bits interprets every carrier word and is inverse to to_bits at the level of raw encodings.

Proof

The frozen f64 specialization sets Int = u64; its to_bits method calls f64::to_bits, and its from_u64_bits method passes the complete u64 to f64::from_bits. Rust implements those two operations as the opposite same-size transmutations and explicitly specifies exact-bit preservation, including NaN payloads. The exact excerpts, hashes, tool identities, and reproduction commands are recorded in reference/model-evidence/float-carriers.txt.
For the first inverse direction, take any source f64 with raw memory word w. Transmutation by to_bits returns that same w, and transmutation of w by from_bits creates an f64 with the same raw memory word. Thus from_bits(to_bits(x)) has exactly the encoding of x; this is a bitwise statement and does not incorrectly use Rust floating-point equality on NaNs. For the other direction, take any of the 2^{64} words w. from_bits(w) creates the float encoding w, so applying to_bits returns exactly w. This includes all words with an all-ones exponent and nonzero fraction, regardless of sign, quiet/signaling bit, or payload.
The pinned Aeneas declarations make Std.U64 a structure with one BitVec 64 field, and every such bit vector is admitted. Therefore the model carrier contains exactly the words in the two inverse arguments. The carrier correspondence retains every raw encoding; meanings of classification and operations on those words are supplied by their separate bindings.

Requirement: parser totality

The carrier is used only to represent a float after one is returned; it changes neither source control flow nor the distinction between panic, normal return, and parsing error.

Requirement: parser numeric acceptance

Whether the source returns Ok is unchanged, and any float inside such a result has exactly one retained raw word.

Requirement: parser invalid rejection

Whether the source returns Err is unchanged; an error contains no float to which this carrier choice could apply.

Requirement: parser nan acceptance

For any returned float, the carrier retains its exponent and fraction fields exactly, while ModelF64Classify supplies the source-correct classification of that word as NaN.

Requirement: parser infinity

The lexical sign remains a separate source-input observation, and the returned infinity's sign, exponent, and fraction are retained in its word as specified by DecimalGoalVocabularyDefault.

Requirement: parser non nan results

For any returned float, the exponent/fraction NaN test is an exact word observation under DecimalGoalVocabularyDefault, and ModelF64Classify supplies the matching source classification.

Requirement: parser numeric sign

The lexical sign is a distinct source-input observation left unchanged by the carrier; only the returned float's negativity is represented by the retained high bit, as specified by DecimalGoalVocabularyDefault.

Requirement: parser signed zero

Whether the numeric input denotes zero and its lexical sign are unchanged input observations; the returned positive- and negative-zero encodings remain distinct retained words under DecimalGoalVocabularyDefault.

Requirement: parser exact rounding

The exact decimal input value is unchanged; both its binary64 rounding target and the returned float are observed as exact words under DecimalGoalVocabularyDefault.

Requirement: parser selected exponent

The selected raw pair's biased-exponent field is a trace observation that does not use the float carrier, so this choice is noninterfering.

Requirement: parser selected magnitude sign

The selected raw pair is unchanged, and its assembled magnitude and clear-high-bit requirement are exact word observations under DecimalGoalVocabularyDefault.

Requirement: dispatch abstract composition

The component contracts, source inputs, and control choices are unchanged; any component or dispatcher float result is represented by its complete word, including the word-valued classification, rounding, and output-sign observations of DecimalGoalVocabularyDefault.

Requirement: dispatch component compliance

Actual component calls and their input observations are unchanged; their returned floats and preserved rounding targets are compared as complete words under DecimalGoalVocabularyDefault.

Requirement: parser accumulated rounding

The accumulated decimal value and lexical sign remain separate input observations; the rounding target and returned float are retained words under DecimalGoalVocabularyDefault.

Requirement: parser equal target rounding

The exact and accumulated values are unchanged, while their target equality and the returned result are equality and observation of complete words under DecimalGoalVocabularyDefault.

Requirement: number helper acceptance

This helper returns an optional Decimal record rather than a float, so its acceptance observation does not use this carrier.

Requirement: number helper rejection

This helper returns an optional Decimal record rather than a float, so its rejection observation does not use this carrier.

Requirement: number helper record bounds

The record's negative, mantissa, and other fields are distinct source observations and do not use this float carrier.

Requirement: number helper accumulated value

The unsigned input, Decimal-record fields, and accumulated mathematical value do not use this float carrier.

Requirement: special helper infinity

The helper's separate sign argument is left unchanged and is not identified with an output bit; the returned infinity's sign, exponent, and fraction are retained in its word under DecimalGoalVocabularyDefault.

Requirement: special helper nan

The helper's separate sign argument is left unchanged; every returned word is retained, and ModelF64Classify supplies its source-correct NaN classification.

Requirement: special helper rejection

A None result contains no float, and the input bytes and separate sign argument are unchanged by this carrier choice.

Requirement: native correct or defer

The Decimal record's sign and magnitude fields remain distinct source-input observations; a rounding target and any Some float are retained as words under DecimalGoalVocabularyDefault.

Requirement: integer correct or defer

The integer inputs and deferral condition are unchanged, while the raw-pair assembly used for a nondeferred result is an exact word operation under DecimalGoalVocabularyDefault.

Requirement: slow accumulated rounding

The unsigned input and accumulated value are unchanged, while the helper's raw-pair result is interpreted by the exact word assembly of DecimalGoalVocabularyDefault.

Requirement: assembly correspondence

The input raw pair is unchanged, and its cast-shift-OR assembly is exactly a retained 64-bit word under DecimalGoalVocabularyDefault.

Requirement: classification totality

This claim concerns classification of input byte lists, before any float result exists, so the float carrier is noninterfering.

Requirement: classification determinism

This claim compares classifications and lexeme content of input byte lists, so the float carrier is noninterfering.

Requirement: classification significand digit

This grammar property concerns the input lexeme's digit lists and does not use the float carrier.

Requirement: rounding totality

The nonnegative real input is unchanged, and the binary64 magnitude target is an exact nonnegative word under DecimalGoalVocabularyDefault.

Requirement: rounding determinism

The real input is unchanged, and equality of two binary64 magnitude targets is equality of their complete words under DecimalGoalVocabularyDefault.

Requirement: exponent value agreement

The lexeme and its two mathematical values are unchanged, and equality of their rounding targets is complete-word equality under DecimalGoalVocabularyDefault.

Download Lean source · Download TeX source

Proof structure

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

Uses

Dependency links are unavailable for this declaration.

Explore this dependency tree

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": "F64",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "a6a7d00f8900da0428b974265c175ade7b4387dbbdb4a3cf8d99e4047458a178",
  "active_statement_hash": "4f819467a6312039c7cf776828d79ddfb4a4ea32cb3c0bd1a241d54703504673",
  "kernel_axioms": [],
  "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-18",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {}
}
Prose assessment
{
  "label": "Recorded Sound: VerifierFail",
  "assessment_status": "VerifierFail",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "preservation-v1:5f56f59747e7aed289df753cd667f0ad084251727b39a6a3cd7c1b8cbf83f5f0",
  "current_fingerprint": "preservation-v1:5f56f59747e7aed289df753cd667f0ad084251727b39a6a3cd7c1b8cbf83f5f0",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Fail",
  "substantiveness_status": "Pass"
}