P9_T1_DispatchAbstractComposition

Lean checked

Statement

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

Theorem

Put A=3458764513820540928 bytes and B=576460752303421440 bytes. The component contracts DispatchContracts admit a total abstract implementation C. Independently, for every total abstract package C satisfying those contracts and every source-valid Rust string s of complete byte length at most A, the one fixed DispatchFrame, using the successful embedding EmbedComponents, has a normal Rust result and trace. A returned Rust parsing error counts as a normal output; outer failure or divergence does not.
For every such package and string, every normal result satisfies the following whole-input requirements. Invalid classification returns Rust Err. A special classification returns Rust Ok of a NaN for a NaN literal, or the infinity with the lexical sign for an infinity literal. Numeric classification returns Rust Ok whose magnitude is the nearest-even binary64 rounding of the full-significand accumulated-exponent magnitude, with the exact lexical sign applied, including zero and infinity. If that complete numeric string also has length at most B, the same magnitude rounds its ordinary mathematical exact value. Grammar, values and rounding are those of DecimalGoalVocabularyDefault.
These assertions concern the source-ordered frame, including native direct returns, the integer tier, guarded many-digit endpoint comparison, forced deferral, the fallback on the unchanged body, unrestricted assembly and final sign. Package existence and output existence are conjunctive obligations, not assumptions supplied by an empty compatible package.

Lean statement

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

import Tablet.DispatchContracts
import Tablet.P9_T1_DispatchFrame
import Tablet.P9_T1_EmbedComponents
import Tablet.P616_T1_CompatibleCompletion
import Tablet.P616_T1_FrameNormality
import Tablet.P616_T1_FrameCorrectness
import Tablet.P616_T1_ExactTransportApplicationsB
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P9_T1_DispatchAbstractComposition]
theorem P9_T1_DispatchAbstractComposition :
    (exists C : P9_T1_AbstractComponents, DispatchContracts C) /\
    (forall C : P9_T1_AbstractComponents, DispatchContracts C ->
      forall s : Str, DecimalGoalVocabularyDefault.sourceString s ->
      s.val.length <= 3458764513820540928 ->
      exists r trace, P9_T1_DispatchFrame (P9_T1_EmbedComponents C) s = ok (r, trace)) /\
    (forall C : P9_T1_AbstractComponents, DispatchContracts C ->
      forall (s : Str) r trace, DecimalGoalVocabularyDefault.sourceString s ->
      s.val.length <= 3458764513820540928 ->
      P9_T1_DispatchFrame (P9_T1_EmbedComponents C) s = ok (r, trace) ->
      ((DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s) none ->
        exists error, r = core.result.Result.Err error) /\
      (forall sign nan,
        DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inr (sign, nan))) ->
        exists f, r = core.result.Result.Ok f /\
          (if nan then DecimalGoalVocabularyDefault.isNan f
          else DecimalGoalVocabularyDefault.isInfinity (decide (sign = some true)) f)) /\
      (forall x : DecimalLexeme,
        DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inl x)) ->
        exists f magnitude, r = core.result.Result.Ok f /\
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.accumulatedMagnitude x) magnitude /\
          DecimalGoalVocabularyDefault.signedMagnitude
            (DecimalGoalVocabularyDefault.lexicalNegative x) magnitude f /\
          (s.val.length <= 576460752303421440 ->
            DecimalGoalVocabularyDefault.roundsMagnitude
              (DecimalGoalVocabularyDefault.exactMagnitude x) magnitude)))) := 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 retained as authored. The explanatory prose is preserved as it stood when captured.

Proof

CompatibleCompletion supplies one total package C with both DispatchContracts and normal-observation refinement. Its contract conjunct gives exactly the first existential assertion here; its refinement is additional useful information, not an assumption of the remaining universal assertions.
For an arbitrary total package D and a proof of DispatchContracts(D), FrameNormality supplies a normal Rust result and trace on every source-valid complete string through A. Its domains and fixed frame are exactly those in this theorem, proving the second conjunct. There is no requirement that D be the witness chosen in the first conjunct, or that any actual source conversion be normal.
Fix any such D,s,r,\tau and its stated normal frame equation. FrameCorrectness gives the invalid-result implication, the signed-special implication, and, for every complete numeric classification x, words f,m with r=\mathrm{Ok}(f), accumulated magnitude rounding to m, and the exact lexical sign relating m to f. These are the first two clauses and the accumulated-rounding and sign clauses of the third assertion here, with the same normal frame observation.
If in addition this complete numeric string has length at most B, the complete-string assertion of ExactTransportApplicationsB, applied to its existing source validity and numeric classification, equates the accumulated and exact target predicates for this very m. Its forward implication transports the already established accumulated rounding to exact rounding. It counts the entire string, including a leading sign, and has no public-success or compliance premise. Retain the same f,m and sign relation to obtain the B-conditional exact clause. Thus all three original conjuncts hold. The independent bridge also supplies the contract's unsigned-body exact_transport in the completion lemma; no exact-transport application is made on an unbounded or sign-bearing body, and no ParserExactRounding theorem is used.

Lean proof


  obtain ⟨C, hC, _hRefinement⟩ := P616_T1_CompatibleCompletion
  refine ⟨⟨C, hC⟩, P616_T1_FrameNormality, ?_⟩
  intro D hD s r trace hs hA hrun
  obtain ⟨hinvalid, hspecial, hnumeric⟩ :=
    P616_T1_FrameCorrectness D hD s r trace hs hA hrun
  refine ⟨hinvalid, hspecial, ?_⟩
  intro x hx
  obtain ⟨f, magnitude, hr, hm, hsign⟩ := hnumeric x hx
  refine ⟨f, magnitude, hr, hm, hsign, ?_⟩
  intro hB
  exact (P616_T1_ExactTransportApplicationsB.2 s x hs hB hx magnitude).mp hm
end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DispatchContracts
import Tablet.P9_T1_DispatchFrame
import Tablet.P9_T1_EmbedComponents
import Tablet.P616_T1_CompatibleCompletion
import Tablet.P616_T1_FrameNormality
import Tablet.P616_T1_FrameCorrectness
import Tablet.P616_T1_ExactTransportApplicationsB
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P9_T1_DispatchAbstractComposition]
theorem P9_T1_DispatchAbstractComposition :
    (exists C : P9_T1_AbstractComponents, DispatchContracts C) /\
    (forall C : P9_T1_AbstractComponents, DispatchContracts C ->
      forall s : Str, DecimalGoalVocabularyDefault.sourceString s ->
      s.val.length <= 3458764513820540928 ->
      exists r trace, P9_T1_DispatchFrame (P9_T1_EmbedComponents C) s = ok (r, trace)) /\
    (forall C : P9_T1_AbstractComponents, DispatchContracts C ->
      forall (s : Str) r trace, DecimalGoalVocabularyDefault.sourceString s ->
      s.val.length <= 3458764513820540928 ->
      P9_T1_DispatchFrame (P9_T1_EmbedComponents C) s = ok (r, trace) ->
      ((DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s) none ->
        exists error, r = core.result.Result.Err error) /\
      (forall sign nan,
        DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inr (sign, nan))) ->
        exists f, r = core.result.Result.Ok f /\
          (if nan then DecimalGoalVocabularyDefault.isNan f
          else DecimalGoalVocabularyDefault.isInfinity (decide (sign = some true)) f)) /\
      (forall x : DecimalLexeme,
        DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inl x)) ->
        exists f magnitude, r = core.result.Result.Ok f /\
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.accumulatedMagnitude x) magnitude /\
          DecimalGoalVocabularyDefault.signedMagnitude
            (DecimalGoalVocabularyDefault.lexicalNegative x) magnitude f /\
          (s.val.length <= 576460752303421440 ->
            DecimalGoalVocabularyDefault.roundsMagnitude
              (DecimalGoalVocabularyDefault.exactMagnitude x) magnitude)))) := by
-- BODY
  obtain ⟨C, hC, _hRefinement⟩ := P616_T1_CompatibleCompletion
  refine ⟨⟨C, hC⟩, P616_T1_FrameNormality, ?_⟩
  intro D hD s r trace hs hA hrun
  obtain ⟨hinvalid, hspecial, hnumeric⟩ :=
    P616_T1_FrameCorrectness D hD s r trace hs hA hrun
  refine ⟨hinvalid, hspecial, ?_⟩
  intro x hx
  obtain ⟨f, magnitude, hr, hm, hsign⟩ := hnumeric x hx
  refine ⟨f, magnitude, hr, hm, hsign, ?_⟩
  intro hB
  exact (P616_T1_ExactTransportApplicationsB.2 s x hs hB hx magnitude).mp hm
end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (199)
More program dependencies (157)
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.

Helper theorems included
All 345 entries
Technical checking records
Local closure summary
{
  "node": "P9_T1_DispatchAbstractComposition",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "2fc21ddba8e2c6626053b6f97ca7b87c1ce7bc3132a2d3ba05b1372803aa02c1",
  "active_statement_hash": "03e6f3695e82a357a480040fb4a34c38ca236f4e375603db9a4c9e1450da1508",
  "kernel_axioms": [
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "576e6bf9480cfd32f53c309c7ac8fb115c1ba6e413f299ed5ff9fa7c647e6769",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-202",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "P616_T1_CompatibleCompletion": "aa31d8fe34fb8053",
    "P616_T1_ExactTransportApplicationsB": "8f8f27340cee5a3e",
    "P616_T1_FrameCorrectness": "a90f9fab4a7d01e5",
    "P616_T1_FrameNormality": "29abc091a2722bc0"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "4da7f295a9b85b50",
    "DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
    "DecimalLexeme": "c43614ff2149ecf2",
    "DispatchContracts": "008abfbd503545bf",
    "F64": "ec4e25fbaf4e11d4",
    "P9_T1_AbstractComponents": "c43614ff2149ecf2",
    "P9_T1_DispatchFrame": "3d36c6a218e86be3",
    "P9_T1_EmbedComponents": "c6037220641c6c08",
    "P9_T1_NormalComponentRefinement": "008abfbd503545bf",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_float_parse_ParseFloatError": "c43614ff2149ecf2",
    "num_imp_dec2flt_Dec2FltTrace": "644abe66cec8ac98"
  }
}
Prose assessment
{
  "label": "Lean proof closed; predictive prose review no longer required",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "sound-v2:6c09c938bed3ef2d4f4a3010d9755a210f0f8daa11bdb8f3ac837ec12d36c812",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}