Binary64Model

Lean checked

Definition and explanation

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

Definition

A binary64 model package supplies the fourteen operations left opaque by the extraction boundary: cloning; the precision, NaN, signed-infinity, and field-mask constants; classification; exact conversion to and from raw bits; multiplication, division, and negation; and the parser's checked conversion from an unsigned 64-bit integer.

Lean definition

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

import Tablet.F64
import Tablet.core_num_FpCategory

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: Binary64Model]
structure Binary64Model where
-- BODY
  clone : F64 -> Result F64
  mantissaDigits : Result Std.U32
  nan : Result F64
  infinity : Result F64
  negInfinity : Result F64
  exponentMask : Result Std.U64
  mantissaMask : Result Std.U64
  classify : F64 -> Result core.num.FpCategory
  toBits : F64 -> Result Std.U64
  fromBits : Std.U64 -> Result F64
  mul : F64 -> F64 -> Result F64
  div : F64 -> F64 -> Result F64
  neg : F64 -> Result F64
  fromU64 : Std.U64 -> Result F64

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

This package type records exactly the signatures of the fourteen frozen binary64 externals and introduces no equation or behavioral assumption.

Proof

The reproduced inspect-native records in reference/model-evidence/native-boundary.txt give the following field-to-external correspondence, with the same argument order and result type in every row: clone to F64.Insts.CoreCloneClone.clone; mantissaDigits to core.f64.F64.MANTISSA_DIGITS; nan to core.f64.F64.NAN; infinity to core.f64.F64.INFINITY; negInfinity to core.f64.F64.NEG_INFINITY; exponentMask to core.f64.F64.EXPONENT_MASK; mantissaMask to core.f64.F64.MANTISSA_MASK; classify to core.f64.F64.classify; toBits to core.f64.F64.to_bits; fromBits to core.f64.F64.from_bits; mul to F64.Insts.CoreOpsArithMulF64F64.mul; div to F64.Insts.CoreOpsArithDivF64F64.div; neg to F64.Insts.CoreOpsArithNegF64.neg; and fromU64 to F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64. The frozen declarations are axioms with precisely those signatures, and the structure has only these data-valued or function-valued fields: it has no proposition-valued field and states no equation about any field's result. Thus this node packages the frozen call surface without constraining an implementation. Behavioral preservation is a separate obligation of the corresponding ModelF64Clone, ModelF64MantissaDigits, ModelF64Nan, ModelF64Infinity, ModelF64NegInfinity, ModelF64ExponentMask, ModelF64MantissaMask, ModelF64Classify, ModelF64ToBits, ModelF64FromBits, ModelF64Mul, ModelF64Div, ModelF64Neg, and ModelF64FromU64 binding nodes, not a premise of this claim.

Requirement: parser totality

The full fourteen-external call surface used by the f64 specialization is retained with its frozen signatures. This package adds no behavioral premise or input-domain restriction; normal-return behavior, where needed, belongs separately to the fourteen ModelF64 owners listed in the proof.

Requirement: parser numeric acceptance

The full fourteen-external call surface available to numeric parsing is retained with its frozen signatures. This package adds no acceptance premise or input-domain restriction; any needed constant, conversion, or arithmetic behavior belongs to its corresponding ModelF64 owner listed above.

Requirement: parser invalid rejection

The same fourteen-external call surface remains available to the specialized parser. This interface adds no rejection premise and excludes no input; whether an execution invokes an external, and what it returns, is not asserted here.

Requirement: parser nan acceptance

The special-literal source route requests NAN, conditionally invokes neg for a negative lexical sign, and uses classification to support the required NaN observation. This package retains those three signatures without asserting their results or restricting their domains; their behavior belongs to ModelF64Nan, ModelF64Neg, and ModelF64Classify.

Requirement: parser infinity

The special-literal source route requests INFINITY and then invokes neg exactly when the lexical sign is negative; it does not request NEG_INFINITY. This package retains the two executed signatures without asserting their results or restricting their domains; their behavior belongs to ModelF64Infinity and ModelF64Neg.

Requirement: parser non nan results

The result-producing and classify signatures in the fourteen-external surface are retained, without asserting which words they return or restricting their inputs. Result behavior belongs to the corresponding operation owner, and classification behavior belongs to ModelF64Classify.

Requirement: parser numeric sign

The numeric source routes use from_bits while constructing their magnitudes and invoke neg when applying a negative lexical sign; they do not request either signed-infinity constant or to_bits. This package retains the executed signatures without asserting sign behavior or restricting their domains; behavior belongs to ModelF64FromBits and ModelF64Neg.

Requirement: parser signed zero

The numeric source routes use from_bits while constructing a zero magnitude and invoke neg when applying a negative lexical sign; they do not invoke to_bits. This package retains the executed signatures without asserting a zero encoding or restricting their domains; behavior belongs to ModelF64FromBits and ModelF64Neg.

Requirement: parser exact rounding

The frozen mul, div, from_u64, and from_bits signatures used by magnitude-conversion paths, together with the neg signature used for a negative lexical sign, are retained without an accuracy premise or domain restriction. Their behavior belongs to ModelF64Mul, ModelF64Div, ModelF64FromU64, ModelF64FromBits, and ModelF64Neg.

Requirement: parser selected exponent

The frozen precision, mask, and from_bits signatures remain available to the specialized dispatcher and assembly path. This interface adds no range premise or domain restriction; the concrete owners are ModelF64MantissaDigits, ModelF64ExponentMask, ModelF64MantissaMask, and ModelF64FromBits.

Requirement: parser selected magnitude sign

The frozen mask, to_bits, and from_bits signatures remain available to the specialized conversion and assembly paths. This interface adds no sign-bit premise or domain restriction; behavior belongs to ModelF64ExponentMask, ModelF64MantissaMask, ModelF64ToBits, and ModelF64FromBits.

Requirement: dispatch abstract composition

The full fourteen-external call surface of the f64 specialization is retained. Because the package states neither component contracts nor equations and restricts no input, it adds no behavioral premise to the abstract composition claim; concrete behavior belongs to the corresponding fourteen ModelF64 owners listed above.

Requirement: dispatch component compliance

The full fourteen-external call surface against which the actual f64 components are extracted is retained. This package adds no component-compliance premise or domain restriction; compliance of each operation is the separate responsibility of its corresponding ModelF64 owner listed above.

Requirement: parser accumulated rounding

The frozen mul, div, from_u64, and from_bits signatures used by magnitude conversion, together with the neg signature used for a negative lexical sign, are retained. This interface asserts no rounding or sign behavior and restricts no input; that behavior belongs to ModelF64Mul, ModelF64Div, ModelF64FromU64, ModelF64FromBits, and ModelF64Neg.

Requirement: parser equal target rounding

The frozen mul, div, from_u64, and from_bits signatures used by magnitude conversion, together with the neg signature used for a negative lexical sign, are retained; the numeric source routes do not invoke to_bits. This interface adds no target-equality premise or domain restriction; behavior belongs to ModelF64Mul, ModelF64Div, ModelF64FromU64, ModelF64FromBits, and ModelF64Neg.

Requirement: number helper acceptance

The frozen parse_number call surface contains none of these fourteen binary64 externals. Packaging their signatures therefore adds no acceptance premise and no restriction on byte-slice inputs.

Requirement: number helper rejection

The frozen parse_number call surface contains none of these fourteen binary64 externals. Packaging their signatures therefore adds no rejection premise and no restriction on byte-slice inputs.

Requirement: number helper record bounds

The frozen parse_number call surface contains none of these fourteen binary64 externals. Packaging their signatures therefore adds no record-field premise and no restriction on byte-slice inputs.

Requirement: number helper accumulated value

The frozen parse_number call surface contains none of these fourteen binary64 externals. Packaging their signatures therefore adds no numeric-value premise and no restriction on byte-slice inputs.

Requirement: special helper infinity

The parse_inf_nan source route requests INFINITY and then invokes neg exactly when its separate sign argument is true; it does not request NEG_INFINITY. This package retains the two executed signatures without asserting their results or restricting slice or sign inputs; their behavior belongs to ModelF64Infinity and ModelF64Neg.

Requirement: special helper nan

The parse_inf_nan source route requests NAN and invokes neg when its separate sign argument is true; classification supports the required NaN observation. This package retains those three signatures without asserting their results or restricting slice or sign inputs; their behavior belongs to ModelF64Nan, ModelF64Neg, and ModelF64Classify.

Requirement: special helper rejection

The rejecting parse_inf_nan branches invoke none of the fourteen binary64 externals. Packaging their signatures therefore adds no keyword-recognition premise and no restriction on slice or sign inputs.

Requirement: native correct or defer

The frozen from_u64, from_bits, mul, div, and neg signatures used by the native shortcut are retained. This interface adds no correctness, deferral, or range premise; behavior belongs to ModelF64FromU64, ModelF64FromBits, ModelF64Mul, ModelF64Div, and ModelF64Neg.

Requirement: integer correct or defer

The frozen precision, mask, and bit-conversion signatures available to the integer tier and its eventual assembly are retained. This interface adds no rounding, deferral, or range premise; behavior belongs to ModelF64MantissaDigits, ModelF64ExponentMask, ModelF64MantissaMask, ModelF64ToBits, and ModelF64FromBits.

Requirement: slow accumulated rounding

The frozen precision, mask, and from_bits signatures available to the slow conversion and eventual assembly are retained. This interface adds no rounding premise or domain restriction; behavior belongs to ModelF64MantissaDigits, ModelF64ExponentMask, ModelF64MantissaMask, and ModelF64FromBits.

Requirement: assembly correspondence

The frozen from_bits signature used by final assembly is retained. This interface asserts no assembly equation and restricts no raw word; construction behavior belongs to ModelF64FromBits.

Requirement: classification totality

The mathematical literal-classification call surface contains none of these fourteen program externals. Packaging their signatures adds no classification premise and no restriction on finite byte strings.

Requirement: classification determinism

The mathematical literal-classification call surface contains none of these fourteen program externals. Packaging their signatures adds no uniqueness premise and no restriction on finite byte strings.

Requirement: classification significand digit

The mathematical grammar call surface contains none of these fourteen program externals. Packaging their signatures adds no grammar premise and no restriction on finite byte strings.

Requirement: rounding totality

The mathematical rounding relation's call surface contains none of these fourteen program externals. Packaging their signatures adds no existence premise and no restriction on nonnegative reals.

Requirement: rounding determinism

The mathematical rounding relation's call surface contains none of these fourteen program externals. Packaging their signatures adds no uniqueness premise and no restriction on nonnegative reals.

Requirement: exponent value agreement

The mathematical exact-value and accumulated-exponent-value definitions use none of these fourteen program externals. Packaging their signatures adds no agreement premise and no restriction on numeric literals.

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": "Binary64Model",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "6ba7add83a61ada3a63cc55c1a54ff9e41d0770b0976a20ad0784f02d641d7b9",
  "active_statement_hash": "2c5298109deda2fa1f48c20d54ef3561719537c0ea937e308fefcb51ee2c1699",
  "kernel_axioms": [
    "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-12",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {
    "F64": "ec4e25fbaf4e11d4",
    "core_num_FpCategory": "c43614ff2149ecf2"
  }
}
Prose assessment
{
  "label": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "preservation-v1:2e2a04f82b57707ff12593e1a9115ba7edc9e652945e60ae7dc3b42e4cbe61d2",
  "current_fingerprint": "preservation-v1:2e2a04f82b57707ff12593e1a9115ba7edc9e652945e60ae7dc3b42e4cbe61d2",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}