DispatchAbstractComposition

Open

Statement

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

Theorem

The shared lexical, native-shortcut, integer-tier, many-digit comparison/deferral, slow-fallback, assembly, and sign contracts of DispatchContracts admit implementations whose explicit dispatcher flow produces a normal result for the bytes of every source-valid Rust string. For any implementation of those same contracts and every source-valid Rust string, that flow first strips the sign; failed stripping is invalid, while successful stripping obtains a source-valid byte-slice body and performs numeric-or-special lexical classification. On a numeric record it tries the native shortcut; after native deferral it computes the first integer pair, conditionally computes the mantissa-plus-one pair for a many-digit record, retains an equal pair or forces deferral on disagreement, replaces a deferred pair by the slow result, assembles the selected pair, and finally applies the lexical sign. Every normal flow result is invalid exactly for an invalid input; every numeric literal returns its exact binary64 magnitude rounding with its lexical sign; and every special literal returns a NaN or the infinity with its lexical sign, as appropriate.

Lean statement

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.DispatchContracts
import Tablet.SourceValidByteSlice
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
import Tablet.num_imp_dec2flt_biased_fp_to_float

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: DispatchAbstractComposition]
theorem DispatchAbstractComposition :
    (∃ C : DispatchContracts,
      ∀ s, DecimalGoalVocabularyDefault.sourceString s ->
        ∃ out, C.flow (DecimalGoalVocabularyDefault.bytes s) out) ∧
    ∀ (C : DispatchContracts) s out,
      DecimalGoalVocabularyDefault.sourceString s ->
      C.flow (DecimalGoalVocabularyDefault.bytes s) out ->
      (out = none ↔ DecimalGoalVocabularyDefault.classifies
        (DecimalGoalVocabularyDefault.bytes s) none) ∧
      (∀ x, DecimalGoalVocabularyDefault.classifies
          (DecimalGoalVocabularyDefault.bytes s) (some (Sum.inl x)) ->
          ∃ (f target : F64), out = some f ∧
            DecimalGoalVocabularyDefault.roundsMagnitude
              (DecimalGoalVocabularyDefault.exactMagnitude x) target ∧
            DecimalGoalVocabularyDefault.signedMagnitude
              (DecimalGoalVocabularyDefault.lexicalNegative x) target f) ∧
      (∀ sign nan,
        DecimalGoalVocabularyDefault.classifies
          (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inr (sign, nan))) ->
        ∃ f, out = some f ∧
          (if nan then DecimalGoalVocabularyDefault.isNan f
           else DecimalGoalVocabularyDefault.isInfinity (sign = some true) f)) := by
Proof

Natural-language proof

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

Explanatory prose status

Prose proof: SKETCH. The explanatory prose is preserved as it stood when captured.

Proof

SKETCH: After sign stripping supplies the source-valid body, numeric completeness obtains a parsed record for every valid unsigned numeric lexeme rendering that body; per-result correctness identifies the record's representation. Failure of numeric parsing is therefore reserved for the special or invalid cases. A native success first rounds the represented nontruncated record and the record contract identifies that magnitude with the literal's exact magnitude. Otherwise the integer contract handles the record value. In the many-digit case, equality of the two endpoint pairs gives one rounding target throughout the represented half-open interval; disagreement forces the slow path, whose contract rounds the full exact magnitude. Assembly yields a clear-sign magnitude and the separate sign contract applies precisely the lexical sign. Existence and all of these implications are the positive dispatch_abstract_composition obligation; proof or disproof is deferred to argument development.

Lean proof


  sorry

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.DispatchContracts
import Tablet.SourceValidByteSlice
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
import Tablet.num_imp_dec2flt_biased_fp_to_float

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: DispatchAbstractComposition]
theorem DispatchAbstractComposition :
    (∃ C : DispatchContracts,
      ∀ s, DecimalGoalVocabularyDefault.sourceString s ->
        ∃ out, C.flow (DecimalGoalVocabularyDefault.bytes s) out) ∧
    ∀ (C : DispatchContracts) s out,
      DecimalGoalVocabularyDefault.sourceString s ->
      C.flow (DecimalGoalVocabularyDefault.bytes s) out ->
      (out = none ↔ DecimalGoalVocabularyDefault.classifies
        (DecimalGoalVocabularyDefault.bytes s) none) ∧
      (∀ x, DecimalGoalVocabularyDefault.classifies
          (DecimalGoalVocabularyDefault.bytes s) (some (Sum.inl x)) ->
          ∃ (f target : F64), out = some f ∧
            DecimalGoalVocabularyDefault.roundsMagnitude
              (DecimalGoalVocabularyDefault.exactMagnitude x) target ∧
            DecimalGoalVocabularyDefault.signedMagnitude
              (DecimalGoalVocabularyDefault.lexicalNegative x) target f) ∧
      (∀ sign nan,
        DecimalGoalVocabularyDefault.classifies
          (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inr (sign, nan))) ->
        ∃ f, out = some f ∧
          (if nan then DecimalGoalVocabularyDefault.isNan f
           else DecimalGoalVocabularyDefault.isInfinity (sign = some true) f)) := by
-- BODY
  sorry

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (201)
More program dependencies (159)
Standard-library dependencies (39)

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.

Evidence gap: Incomplete inventory: open dependency: DispatchAbstractComposition

Helper theorems included
All 9 entries
Technical checking records
Local closure summary
{
  "node": "DispatchAbstractComposition",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "df6c07cc54a4e2c30e20b64280b643edd5d89d292b9699138cdbe5c94a38c236",
  "active_statement_hash": "dddccebadf127f4da3244542c99702a9f847e7caf56f8ee8168c9a3558e3f665",
  "kernel_axioms": [
    "propext",
    "sorryAx"
  ],
  "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-27",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "65227461bf3cac06",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "DecimalLexeme": "c43614ff2149ecf2",
    "DispatchContracts": "1b6a73572941f181",
    "F64": "ec4e25fbaf4e11d4"
  }
}
Prose assessment
{
  "label": "Prose review has no verdict in this snapshot",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "sound-v2:9faa9c4b4c4f2da396797943cbe01ef3417b90def7091edd83ea76e34770cca0",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "FalseAsStated"
}