DispatchContracts

Lean checked

Definition and explanation

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

Definition

A dispatcher contract package consists of operations for sign stripping, numeric and special lexical parsing, the native shortcut, checked increment of the truncated mantissa, integer-tier conversion, raw-pair comparison and forced deferral, the slow fallback, raw-pair assembly, and lexical-sign application. It also has a relation saying when a parsed decimal record represents an unsigned numeric lexeme and an explicit dispatcher-flow relation. Source-valid Rust strings, their byte lists, numeric and special grammars and classification, decimal magnitudes, rounding targets, NaN and infinity predicates, raw-pair assembly, and signed magnitudes have exactly the meanings in DecimalGoalVocabularyDefault; source-valid byte-slice carriers have the meaning in SourceValidByteSlice.
On the bytes of every source-valid Rust string, sign stripping has the following exact behavior. The empty byte list returns none. A leading ASCII + is removed and records the optional Boolean sign \operatorname{some}(\mathit{false}), while a leading ASCII - is removed and records \operatorname{some}(\mathit{true}); either case returns none when the remainder is empty and otherwise returns that exact nonempty remainder as the body. Every other nonempty byte list is returned unchanged as the body with no leading sign. Failed sign stripping classifies the input as invalid. Successful sign stripping produces a nonempty body, the same optional leading sign, and a source-valid Rust byte-slice carrier for exactly that body. The original string's bytes are classified by a numeric lexeme x exactly when there is a valid unsigned lexeme whose rendering is the body and whose complete record becomes x upon replacing its absent leading sign by that exact optional sign. They are classified by a special kind with an optional sign exactly when that sign is the stripped sign and the body is the corresponding unsigned special literal. Thus sign stripping preserves the complete numeric, special, and invalid classification on precisely the source-string domain: empty and sign-only inputs cannot invent a helper body, whereas every other nonempty invalid input reaches the lexical helpers on the exact body just described.
On every nonempty source-valid Rust byte slice, with no UTF-8 premise, numeric completeness says that each valid unsigned numeric lexeme rendering the slice has some returned record that represents it. On that same nonempty domain, per-result correctness says that a particular record is returned exactly when it represents some such lexeme. Special parsing is instead split into three clauses on every source-valid Rust byte slice, including the empty slice. Every returned value is supported by an unsigned special literal and is a NaN for nan or the infinity selected by the separate sign argument for inf and infinity. Conversely, each unsigned special literal has some returned value satisfying its corresponding predicate; this existential does not choose one NaN representation and equate it with all NaNs. When there is no unsigned special literal, the parser returns none. A represented record is nonnegative, has mantissa below 10^{19}, and either denotes the input's accumulated- exponent magnitude when no digits were truncated or brackets that diagnostic magnitude between the values obtained from its mantissa and from mantissa plus one. A distinct target-preservation clause says that a nontruncated record has the same rounding targets as the exact input and that agreement of the two many-digit endpoint pairs gives an exact-input rounding target.
The native contract says that a successful shortcut is possible only without truncated digits and is obtained by applying the package's sign operation to a clear-sign binary64 magnitude rounding the record's value. The integer-tier contract says that its raw pair either has a negative biased exponent, denoting deferral, or has biased exponent in 0\ldots2047 and assembles to a clear-sign rounding of the supplied w10^q. Increment succeeds on every parser-bounded mantissa and produces its mathematical successor. Pair comparison is exact; forced deferral preserves the mantissa and sets the biased exponent to -1. On each source-valid byte slice, the slow contract assembles to a clear-sign accumulated-value rounding of the full unsigned numeric lexeme; its distinct target-preservation clause records the exact-input target required by dispatcher composition. Assembly has exactly the specified raw-pair word, while the sign operation alone applies the requested sign to a clear-sign magnitude.
On bytes of a source-valid Rust string, the flow relation is fixed, not chosen independently. It strips the optional leading sign and parses the nonempty source-valid byte-slice body. Numeric records have their sign field overwritten by the lexical sign and first try the native shortcut. On deferral it calls the integer tier on the record exponent and mantissa. Exactly when digits were truncated and the first pair is nondeferred, it safely increments the mantissa and makes the second integer-tier call; unequal pairs force deferral and equal pairs retain the first. A negative post-comparison exponent selects the slow result on the unchanged body, otherwise the post-comparison pair is retained. The selected pair is assembled and only then is the lexical sign applied. Failure of numeric parsing instead invokes the special parser, and failure of both lexical helpers is the invalid result.

Lean definition

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

import Tablet.DecimalGoalVocabularyDefault
import Tablet.SourceValidByteSlice
import Tablet.num_imp_dec2flt_common_BiasedFp
import Tablet.num_imp_dec2flt_decimal_Decimal

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: DispatchContracts]
structure DispatchContracts where
-- BODY
  stripSign : List Nat -> Option (Option Bool × List Nat)
  parseNumber : List Nat -> Option num.imp.dec2flt.decimal.Decimal
  parseSpecial : List Nat -> Bool -> Option F64
  native : num.imp.dec2flt.decimal.Decimal -> Option F64
  incrementMantissa : Std.U64 -> Option Std.U64
  integer : Std.I64 -> Std.U64 -> num.imp.dec2flt.common.BiasedFp
  samePair : num.imp.dec2flt.common.BiasedFp ->
    num.imp.dec2flt.common.BiasedFp -> Bool
  forceDefer : num.imp.dec2flt.common.BiasedFp ->
    num.imp.dec2flt.common.BiasedFp
  slow : List Nat -> num.imp.dec2flt.common.BiasedFp
  assemble : num.imp.dec2flt.common.BiasedFp -> F64
  applySign : Bool -> F64 -> F64
  recordRepresents : num.imp.dec2flt.decimal.Decimal -> DecimalLexeme -> Prop
  flow : List Nat -> Option F64 -> Prop
  stripSign_exact : ∀ s,
    DecimalGoalVocabularyDefault.sourceString s ->
    stripSign (DecimalGoalVocabularyDefault.bytes s) =
      match DecimalGoalVocabularyDefault.bytes s with
      | [] => none
      | 43 :: body =>
          if body = [] then none else some (some false, body)
      | 45 :: body =>
          if body = [] then none else some (some true, body)
      | body => some (none, body)
  stripSign_none : ∀ s,
    DecimalGoalVocabularyDefault.sourceString s ->
    stripSign (DecimalGoalVocabularyDefault.bytes s) = none ->
    DecimalGoalVocabularyDefault.classifies
      (DecimalGoalVocabularyDefault.bytes s) none
  stripSign_some : ∀ s sign body,
    DecimalGoalVocabularyDefault.sourceString s ->
    stripSign (DecimalGoalVocabularyDefault.bytes s) = some (sign, body) ->
    body ≠ [] ∧
    (∃ bodySlice : Slice Std.U8,
      SourceValidByteSlice bodySlice ∧
      DecimalGoalVocabularyDefault.bytes bodySlice = body) ∧
    (∀ x,
      (DecimalGoalVocabularyDefault.classifies
          (DecimalGoalVocabularyDefault.bytes s) (some (Sum.inl x)) ↔
        ∃ unsigned,
          unsigned.leadingSign = none ∧
          DecimalGoalVocabularyDefault.validNumeric unsigned ∧
          DecimalGoalVocabularyDefault.renderNumeric unsigned = body ∧
          x = { unsigned with leadingSign := sign })) ∧
    (∀ specialSign nan,
      (DecimalGoalVocabularyDefault.classifies
          (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inr (specialSign, nan))) ↔
        specialSign = sign ∧
          DecimalGoalVocabularyDefault.specialLiteral body none nan))
  parseNumber_spec : ∀ (body : Slice Std.U8) d,
    SourceValidByteSlice body ->
    body.val ≠ [] ->
    (parseNumber (DecimalGoalVocabularyDefault.bytes body) = some d ↔
      ∃ x,
        x.leadingSign = none ∧
        DecimalGoalVocabularyDefault.validNumeric x ∧
        DecimalGoalVocabularyDefault.renderNumeric x =
          DecimalGoalVocabularyDefault.bytes body ∧
        recordRepresents d x)
  parseNumber_complete : ∀ (body : Slice Std.U8) x,
    SourceValidByteSlice body ->
    body.val ≠ [] ->
    x.leadingSign = none ->
    DecimalGoalVocabularyDefault.validNumeric x ->
    DecimalGoalVocabularyDefault.renderNumeric x =
      DecimalGoalVocabularyDefault.bytes body ->
    ∃ d,
      parseNumber (DecimalGoalVocabularyDefault.bytes body) = some d ∧
        recordRepresents d x
  recordRepresents_spec : ∀ d x, recordRepresents d x ->
    d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧
      (if d.many_digits then
        DecimalGoalVocabularyDefault.decimalMagnitude d <=
            DecimalGoalVocabularyDefault.accumulatedMagnitude x ∧
          DecimalGoalVocabularyDefault.accumulatedMagnitude x <
            (((d.mantissa.val + 1 : Nat) : Real) *
              (10 : Real) ^ d.exponent.val)
       else
        DecimalGoalVocabularyDefault.decimalMagnitude d =
          DecimalGoalVocabularyDefault.accumulatedMagnitude x)
  parseSpecial_sound : ∀ (body : Slice Std.U8) negative f,
    SourceValidByteSlice body ->
    parseSpecial (DecimalGoalVocabularyDefault.bytes body) negative = some f ->
      ∃ nan,
        DecimalGoalVocabularyDefault.specialLiteral
          (DecimalGoalVocabularyDefault.bytes body) none nan ∧
          (if nan then DecimalGoalVocabularyDefault.isNan f
           else DecimalGoalVocabularyDefault.isInfinity negative f)
  parseSpecial_complete : ∀ (body : Slice Std.U8) negative nan,
    SourceValidByteSlice body ->
    DecimalGoalVocabularyDefault.specialLiteral
      (DecimalGoalVocabularyDefault.bytes body) none nan ->
    ∃ f,
      parseSpecial (DecimalGoalVocabularyDefault.bytes body) negative = some f ∧
        (if nan then DecimalGoalVocabularyDefault.isNan f
         else DecimalGoalVocabularyDefault.isInfinity negative f)
  parseSpecial_reject : ∀ (body : Slice Std.U8) negative,
    SourceValidByteSlice body ->
    (¬ ∃ nan, DecimalGoalVocabularyDefault.specialLiteral
      (DecimalGoalVocabularyDefault.bytes body) none nan) ->
    parseSpecial (DecimalGoalVocabularyDefault.bytes body) negative = none
  native_spec : ∀ d f, native d = some f ->
    d.many_digits = false ∧
      ∃ magnitude,
        DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude ∧
          magnitude.val < 2 ^ 63 ∧
          f = applySign d.negative magnitude
  incrementMantissa_spec : ∀ w,
    w.val < 10 ^ 19 ->
      ∃ w', incrementMantissa w = some w' ∧ w'.val = w.val + 1
  integer_spec : ∀ q w,
    let fp := integer q w
    fp.p_biased.val < 0 ∨
      (0 <= fp.p_biased.val ∧ fp.p_biased.val <= 2047 ∧
        DecimalGoalVocabularyDefault.roundsMagnitude
          ((w.val : Real) * (10 : Real) ^ q.val) (assemble fp) ∧
        (assemble fp).val < 2 ^ 63)
  samePair_spec : ∀ a b, samePair a b = true ↔ a = b
  recordTarget_spec : ∀ d x, recordRepresents d x ->
    (d.many_digits = false ->
      ∀ target,
        (DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.decimalMagnitude d) target ↔
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.exactMagnitude x) target)) ∧
    (d.many_digits = true ->
      ∀ nextMantissa,
        incrementMantissa d.mantissa = some nextMantissa ->
        samePair (integer d.exponent d.mantissa)
            (integer d.exponent nextMantissa) = true ->
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.exactMagnitude x)
          (assemble (integer d.exponent d.mantissa)))
  forceDefer_spec : ∀ fp,
    (forceDefer fp).m = fp.m ∧ (forceDefer fp).p_biased.val = -1
  slow_spec : ∀ (body : Slice Std.U8) x,
    SourceValidByteSlice body ->
    x.leadingSign = none ->
    DecimalGoalVocabularyDefault.validNumeric x ->
    DecimalGoalVocabularyDefault.renderNumeric x =
      DecimalGoalVocabularyDefault.bytes body ->
    let fp := slow (DecimalGoalVocabularyDefault.bytes body)
    0 <= fp.p_biased.val ∧ fp.p_biased.val <= 2047 ∧
      DecimalGoalVocabularyDefault.roundsMagnitude
        (DecimalGoalVocabularyDefault.accumulatedMagnitude x) (assemble fp) ∧
      (assemble fp).val < 2 ^ 63
  slowTarget_spec : ∀ (body : Slice Std.U8) x,
    SourceValidByteSlice body ->
    x.leadingSign = none ->
    DecimalGoalVocabularyDefault.validNumeric x ->
    DecimalGoalVocabularyDefault.renderNumeric x =
      DecimalGoalVocabularyDefault.bytes body ->
    DecimalGoalVocabularyDefault.roundsMagnitude
      (DecimalGoalVocabularyDefault.exactMagnitude x)
      (assemble (slow (DecimalGoalVocabularyDefault.bytes body)))
  assembly_spec : ∀ fp,
    DecimalGoalVocabularyDefault.assembledWord fp (assemble fp)
  sign_spec : ∀ negative magnitude, magnitude.val < 2 ^ 63 ->
    DecimalGoalVocabularyDefault.signedMagnitude
      negative magnitude (applySign negative magnitude)
  flow_spec : ∀ s out,
    DecimalGoalVocabularyDefault.sourceString s ->
    (flow (DecimalGoalVocabularyDefault.bytes s) out ↔
      match stripSign (DecimalGoalVocabularyDefault.bytes s) with
      | none => out = none
      | some (sign, body) =>
          let negative : Bool := decide (sign = some true)
          match parseNumber body with
          | none => out = parseSpecial body negative
          | some parsed =>
              let signedParsed := { parsed with negative := negative }
              match native signedParsed with
              | some f => out = some f
              | none =>
                  let first := integer parsed.exponent parsed.mantissa
                  let secondGuard : Bool :=
                    parsed.many_digits && decide (0 <= first.p_biased.val)
                  let postComparison :=
                    if secondGuard then
                      match incrementMantissa parsed.mantissa with
                      | none => forceDefer first
                      | some nextMantissa =>
                          let second := integer parsed.exponent nextMantissa
                          if samePair first second then first else forceDefer first
                    else first
                  let selected :=
                    if decide (postComparison.p_biased.val < 0) then slow body
                    else postComparison
                  out = some (applySign negative (assemble selected)))

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 dispatcher contract package is an abstract interface whose laws use the source-valid Rust-string domain for sign stripping and whole-dispatch flow, the nonempty source-valid Rust byte-slice domain for the numeric helper, and the full source-valid Rust byte-slice domain, including the empty slice, for the special helper. The slow-helper laws retain their stated source-valid slice plus valid unsigned-numeric-rendering premises, which already entail nonemptiness and are not strengthened here. Its sign/body equation, flow equation, and separate helper operations have the same branch order, call boundaries, and intermediate observations as the frozen f64 dispatcher. The laws distinguish numeric completeness from per-result correctness; special per-result soundness from existential completeness and rejection; and record, target, native, integer, fallback, assembly, and sign properties from one another. These are conditions on every package value, not claims already established for the extracted helpers. Agreement of the actual helpers with a package, their normal returns, and their satisfaction of all those laws remain precisely the separate dispatch_component_compliance obligation.

Proof

The meanings of source-valid strings and their bytes, grammar and classification, decimal magnitudes, rounding observations, special values, raw-pair assembly, and signed magnitudes are fixed independently by DecimalGoalVocabularyDefault. A Rust str is UTF-8 and has length at most isize::MAX; after removal of at most one leading byte, the remaining source subslice still satisfies the length bound. Helper inputs need not themselves be UTF-8. This is exactly the distinction expressed by SourceValidByteSlice.
The frozen source checks emptiness, removes at most one leading ASCII sign, rejects a resulting empty body, calls the numeric parser before the special parser, and then orders the native, integer, comparison/deferral, slow, assembly, and sign stages as stated. The adapted dispatcher records the same body, guards, calls, and results, and the public function is the first projection of that single traced computation. The extracted body retains those matches and calls and its assembly-trace structure retains the named observations. The exact excerpts, hashes, and reproduction commands are in reference/model-evidence/dispatch-contracts.txt. This evidence justifies the interface's decomposition and the trace-preserving adaptation. It does not establish any lexical or conversion helper specification merely from the fact that a call occurs.
The invalid branch illustrates what follows from the abstract laws themselves. Fix any package satisfying the displayed fields, a source-valid string s classified as invalid, and suppose sign stripping succeeds with sign \mathit{sign} and body \mathit{body}. The package's stripSign_some law supplies both \mathit{body}\ne[] and a source-valid body-slice witness whose bytes are exactly \mathit{body}, together with the two classification equivalences. The byte observation in DecimalGoalVocabularyDefault maps every represented slice element and therefore preserves list length. Thus equality of the witness's observed bytes with the nonempty \mathit{body} implies that the witness's carrier list is nonempty. Because invalid classification in DecimalGoalVocabularyDefault excludes every numeric and special classification, those equivalences exclude both a valid unsigned numeric lexeme rendering \mathit{body} and an unsigned special-literal witness on \mathit{body}.
Now case-split the package operation parseNumber on that body. If it were some of a record, parseNumber_spec, applied to the body-slice witness with the just-established nonemptiness premise, would produce a valid unsigned numeric lexeme rendering that body, contradicting the preceding exclusion. Hence it is none. The absence of an unsigned special witness and parseSpecial_reject then give none for the special parser at the Boolean sign determined from \mathit{sign}. Substitution in flow_spec gives the abstract invalid result. If sign stripping is none, stripSign_none gives invalid classification and flow_spec gives the same abstract result directly. Thus this derivation holds for every package satisfying its laws; it neither proves a normal return by the extracted dispatcher nor proves that the extracted helpers satisfy those laws.
All remaining semantic clauses have the same status. Numeric completeness is separate from the per-result equivalence, and both range over exactly the nonempty source-valid slice domain; special returned-value soundness, per-literal existential completeness, and rejection are separate; and record, exact-target, native, integer, slow, assembly, and sign facts are separate package laws. Consequently the package does not assume either dispatcher's combined conclusion. Establishing these laws for the concrete extracted operations, and connecting their normal returns and trace observations to this abstract flow, remains the unresolved concrete-compliance theorem.

Requirement: parser totality

For a package satisfying the laws, flow_spec exposes an output in every abstract branch on the full source-string domain. This relational totality does not establish normal termination of the extracted dispatcher; that requires the separate concrete-compliance argument.

Requirement: parser numeric acceptance

For any law-satisfying package, successful sign stripping supplies a nonempty source-valid body-slice witness, so the sign/body classification equivalence and parseNumber_complete place a valid numeric body in the numeric arm of the explicit flow. Agreement and normal return of the extracted numeric parser and dispatcher remain concrete-compliance obligations.

Requirement: parser invalid rejection

For every package satisfying the laws, failed stripping selects the abstract invalid result directly. After successful stripping, the explicit argument above obtains the numeric contract's nonempty body-slice premise from stripSign_some, then uses invalid classification, the two classification equivalences, a case split on parseNumber, parseNumber_spec, parseSpecial_reject on its unchanged all-slices domain, and flow_spec to obtain that same abstract result. It does not assume that the concrete helpers comply or that the extracted dispatcher returns normally with Err.

Requirement: parser nan acceptance

Within a law-satisfying package, special completeness supplies some NaN result and flow_spec returns it directly, without selecting a NaN representation in advance or invoking raw-pair assembly. Concrete parser agreement is not supplied by this definition.

Requirement: parser infinity

Within a law-satisfying package, special completeness supplies a directly returned infinity satisfying the separate lexical sign argument. The corresponding behavior of the extracted helper remains to be established by concrete compliance.

Requirement: parser non nan results

Special per-result soundness in a law-satisfying package distinguishes NaN from the two infinity spellings, while numeric results pass through separate conversion clauses. Deriving the no-spurious-NaN conclusion and transferring it to the extracted dispatcher are not assumptions of this interface.

Requirement: parser numeric sign

The package interface gives the native helper the sign-overwritten record and separates all assembled magnitudes from the final sign operation exactly as the flow requires. Its sign law is conditional package data, and concrete agreement remains a separate obligation.

Requirement: parser signed zero

The magnitude bounds and separate sign law of any satisfying package retain the distinction between positive and negative zero. The interface does not assert that the extracted conversion tiers or negation satisfy those laws.

Requirement: parser exact rounding

For a law-satisfying package, exact rounding must be derived by composing record-target preservation with the selected native, endpoint, or slow tier; it is not a premise about the whole dispatcher. Concrete helper satisfaction is left to compliance.

Requirement: parser selected exponent

The integer and slow laws retain each abstract selected pair and its biased exponent before assembly. Whether the extracted helpers return matching pairs is not established here.

Requirement: parser selected magnitude sign

The package's assembly and sign clauses are separate, so abstract composition can establish the clear sign bit before lexical sign application. The corresponding concrete assembly behavior remains a compliance obligation.

Requirement: dispatch abstract composition

This is precisely the interface quantified over by the abstract-composition obligation: its conclusion concerns arbitrary packages satisfying all displayed laws. The exact sign/body equation establishes nonemptiness before every numeric call and supplies the corresponding source-valid slice witness; numeric completeness on that domain and the explicit flow make the conditional composition nonvacuous without claiming that the extracted helpers already instantiate the interface. Special parsing remains specified on every source-valid slice.

Requirement: dispatch component compliance

This definition states the package that concrete compliance must instantiate. The source and extraction evidence fixes the numeric helper's nonempty source-valid domain, the special helper's all-source-valid-slices domain, the slow helper's valid-rendering domain, and the relevant branches, calls, and trace observations; every numeric call follows the dispatcher's empty-body rejection. Normal returns, equality with the package operations, and satisfaction of every semantic law by the actual extracted helpers remain the unresolved positive obligation.

Requirement: parser accumulated rounding

For a satisfying package, the record interval and slow-path clauses refer to the accumulated target independently of the exact-target clauses. Applying them to concrete extracted results still requires compliance.

Requirement: parser equal target rounding

A satisfying package keeps component magnitudes and lexical sign separate, allowing an independently established equality of targets to be transported through the abstract selected tier. No equality for the concrete result is assumed.

Requirement: number helper acceptance

On the exact nonempty source-valid byte-slice domain stated by the GOAL, parseNumber_complete requires the abstract operation to return some record for every unsigned numeric body. It identifies the applicable contract clause but does not establish normal return or that parse_number equals that operation.

Requirement: number helper rejection

For a satisfying package, case-splitting parseNumber and applying parseNumber_spec rules out a some result on a nonnumeric nonempty source-valid slice, without adding UTF-8. Equality and normal return of the extracted numeric helper remain concrete-compliance obligations.

Requirement: number helper record bounds

For a satisfying package and every nonempty source-valid slice, parseNumber_spec turns an abstract returned record into a representation witness and recordRepresents_spec gives false sign and the strict 10^{19} bound. Applying this chain to an extracted return requires the separate equality promised by compliance.

Requirement: number helper accumulated value

Every valid unsigned numeric rendering is nonempty, so it lies in the numeric parser contract's nonempty source-valid domain. The representation law of a satisfying package keeps the nontruncated accumulated-value equality and truncated half-open interval distinct. It is a clause to be proved for, not inferred from, the concrete parser call.

Requirement: special helper infinity

On every source-valid byte slice, parseSpecial_complete requires an abstract returned infinity with the separate sign argument, while soundness constrains abstract successful results. This identifies the package clauses; it does not prove the extracted special helper's normal return or agreement.

Requirement: special helper nan

On every source-valid byte slice, parseSpecial_complete requires some abstract NaN result and soundness constrains returned values without equating all NaN representations. Concrete helper satisfaction remains separate.

Requirement: special helper rejection

The rejection law requires the abstract special operation to be none outside all three unsigned keywords on the source-valid byte-slice domain. It does not itself establish that result for the extracted helper.

Requirement: native correct or defer

The native law constrains every abstract some result to a nontruncated record-value rounding with sign factored through applySign; none remains deferral. Its application to a normal extracted native return depends on concrete compliance.

Requirement: integer correct or defer

The integer law covers all abstract machine exponent and mantissa inputs and retains the negative-exponent deferral alternative. It is the corresponding contract clause, not evidence that the extracted integer helper satisfies it.

Requirement: slow accumulated rounding

On source-valid unsigned-numeric slices, slow_spec constrains the abstract slow operation on the unchanged full body to the accumulated-value target and a separately assembled magnitude. Normal return and equality for the extracted slow helper remain concrete-compliance obligations.

Requirement: assembly correspondence

The assembly law applies to every abstract raw pair without a well-formedness precondition and is independent of later sign application. The actual extracted assembly operation must still be shown equal to this package operation.

Requirement: classification totality

The package reuses the standalone classification relation on every finite byte string. Restricting source-facing package laws to representable Rust values neither proves nor narrows the separate classification-totality obligation.

Requirement: classification determinism

The package uses the existing unrestricted classification relation and adds no competing grammar or uniqueness premise. The standalone determinism conclusion remains to be proved independently.

Requirement: classification significand digit

Abstract numeric-parser clauses use the existing valid-lexeme predicate, so they do not change its significand-digit condition or assume the separate theorem's conclusion.

Requirement: rounding totality

The package consumes the existing rounding relation and does not change its real-number domain or binary64 targets; existence of targets remains the separate mathematical obligation.

Requirement: rounding determinism

Endpoint and tier laws use the same existing rounding relation, introducing neither an alternative target notion nor an assumed uniqueness result.

Requirement: exponent value agreement

The package keeps mathematical and accumulated explicit exponents distinct. Any agreement and its rounding consequence remain independent of the component laws.

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 (44)
More program dependencies (11)
Standard-library dependencies (30)

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
All 8 entries
Technical checking records
Local closure summary
{
  "node": "DispatchContracts",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "e3f19f87dee10ae3d7189fb30eb9240c48a532a5115b4c7fd807f00367824862",
  "active_statement_hash": "67a5f6c557d48dd5fa20604f2e713035daa41ffa492f88885218dfbcdb110322",
  "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": {
    "DecimalGoalVocabulary": "af7cd54e9bf14dcd",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "DecimalLexeme": "250be645520aec86",
    "F64": "ec4e25fbaf4e11d4",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_decimal_Decimal": "63fd2f021dd0ef41"
  }
}
Prose assessment
{
  "label": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "preservation-v1:acce2e30ea7c3eb121d3a63eed12bb12df89495e08960d042186d87c2c64f3d9",
  "current_fingerprint": "preservation-v1:acce2e30ea7c3eb121d3a63eed12bb12df89495e08960d042186d87c2c64f3d9",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}