P9_T1_DispatchComponentCompliance

Lean checked

Statement

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

Theorem

There exists a genuinely inhabited total abstract component package C satisfying DispatchContracts, with normal-observation refinement NormalComponentRefinement by the actual frozen source components ActualDispatchOperations. Thus the actual numeric helper returns normally and satisfies lexical acceptance, rejection and full-significand accumulated record representation on nonempty source-valid unsigned slices through A=3458764513820540928 bytes, and exact-target transport on numeric slices through B=576460752303421440 bytes. Returned-record bounds and the special, native, integer, slow and assembly laws retain their original domains; native, integer and slow refinement is on normal return, not a universal termination requirement. In particular slow accumulated rounding applies on every source-valid unsigned numeric slice without a length restriction.
For every source-valid Rust string of complete byte length at most A, each reached call, in the prefix sense of ReachedDispatchCall, returns normally with the corresponding abstract operation value and establishes its helper preconditions. This is not limited to traces of executions already known to finish. Every lexical body is exactly the sign-stripped nonempty source-valid body and has length at most the complete string. The native input overwrites only the record sign; the returned record has false negative field and mantissa below 10^{19}. First and second integer calls use the exact record exponent and, respectively, the mantissa and its checked successor. Every reached increment succeeds with mathematical value mantissa plus one, and reached pair comparison returns the exact equality of both fields. The guarded slow input is that same unsigned numeric body. Assembly uses the actual selected pair; final negation is applied only to a clear-sign magnitude. The fixed actual frame equality is ActualDispatchFrameEquality, independently of correctness.
On numeric complete strings through B, accumulated and ordinary exact magnitude rounding targets agree, so the common rounding target is preserved throughout these calls and decisions. Native and special direct returns select no raw pair, and failed checked arithmetic is never replaced by abstract completion or forced deferral.

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_NormalComponentRefinement
import Tablet.P9_T1_ReachedDispatchCall
import Tablet.P9_T1_ActualDispatchFrameEquality
import Tablet.P13_T1_NativeCorrectOrDefer
import Tablet.P14_NativeTotality
import Tablet.P616_T1_CompatibleCompletion
import Tablet.P616_T1_ExactTransportApplicationsB
import Tablet.P661_T1_PrefixRealization
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P9_T1_DispatchComponentCompliance]
theorem P9_T1_DispatchComponentCompliance :
    exists C : P9_T1_AbstractComponents,
      DispatchContracts C /\ P9_T1_NormalComponentRefinement C /\
      (forall s : Str, DecimalGoalVocabularyDefault.sourceString s ->
        s.val.length <= 3458764513820540928 ->
        forall call : P9_T1_DispatchCall, P9_T1_ReachedDispatchCall s call ->
        match call with
        | .number body _ =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)
        | .special body neg =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)
        | .native body neg d =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            d.negative = false /\ d.mantissa.val < 10 ^ 19 /\
            P9_T1_ActualDispatchOperations.native { d with negative := neg } =
              ok (C.native { d with negative := neg })
        | .first body _ d =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            d.mantissa.val < 10 ^ 19 /\
            P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa =
              ok (C.integer d.exponent d.mantissa)
        | .increment _ _ d _ =>
            d.mantissa.val < 10 ^ 19 /\ exists next : Std.U64,
              d.mantissa + 1#u64 = ok next /\ next.val = d.mantissa.val + 1
        | .second _ _ d _ next =>
            next.val = d.mantissa.val + 1 /\
            P9_T1_ActualDispatchOperations.integer d.exponent next =
              ok (C.integer d.exponent next)
        | .compare _ _ _ first second =>
            num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq first second =
              ok (decide (first.m = second.m /\ first.p_biased = second.p_biased))
        | .post body _ d _ =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            d.negative = false /\ d.mantissa.val < 10 ^ 19
        | .slow body _ _ _ =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            (exists x : DecimalLexeme, x.leadingSign = none /\
              DecimalGoalVocabularyDefault.validNumeric x /\
              DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body) /\
            P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)
        | .assemble _ _ _ selected =>
            P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)
        | .negate _ _ _ magnitude =>
            magnitude.val < 2 ^ 63 /\
            P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude)) /\
      (forall (s : Str) (x : DecimalLexeme),
        DecimalGoalVocabularyDefault.sourceString s ->
        s.val.length <= 576460752303421440 ->
        DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inl x)) ->
        forall target : F64,
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.accumulatedMagnitude x) target ↔
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.exactMagnitude x) target) := 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.

Earlier prose review

An earlier review questioned the prose argument. Lean subsequently checked the formal proof. Review of the statement’s intended meaning is a separate judgment.

Proof

Apply CompatibleCompletion to obtain one package C with both DispatchContracts and NormalComponentRefinement. Keep this very same witness for every remaining conjunct. Its contract and refinement clauses give the stated helper laws with their original bounded and unrestricted domains; on-normal clauses are not being used as termination assertions.
For arbitrary source-valid s with complete length at most A, apply PrefixRealization to this C, these two package hypotheses, s, and its source and complete-length bounds. Its conclusion is exactly the case-by-case reached-call conjunct: actual current-call normality, body preconditions, false parsed sign, mantissa bound, checked mathematical successor, exact pair comparison, unchanged unsigned slow input, unrestricted assembly and clear-sign negation. Its proof is by prefix-constructor induction, so it supplies these assertions without a completed-execution premise or completion of a failed actual call.
Finally the complete-string second conjunct of ExactTransportApplicationsB is exactly the remaining B-bounded equivalence, with the optional sign included in the length and with no execution premise. Apply it to every specified s,x and target word. This adds no B restriction to the A-bounded prefix conjunct or to any unrestricted component law. The conjunction of these three results for the chosen C proves the unchanged statement. The fixed actual/extracted frame equality mentioned in the statement remains ActualDispatchFrameEquality; no equality with an embedded abstract frame is inferred here.

Lean proof


  obtain ⟨C, hcontracts, hrefine⟩ := P616_T1_CompatibleCompletion
  refine ⟨C, hcontracts, hrefine, ?_, P616_T1_ExactTransportApplicationsB.2⟩
  intro s hsource hA
  exact P661_T1_PrefixRealization C hcontracts hrefine s hsource hA
end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DispatchContracts
import Tablet.P9_T1_NormalComponentRefinement
import Tablet.P9_T1_ReachedDispatchCall
import Tablet.P9_T1_ActualDispatchFrameEquality
import Tablet.P13_T1_NativeCorrectOrDefer
import Tablet.P14_NativeTotality
import Tablet.P616_T1_CompatibleCompletion
import Tablet.P616_T1_ExactTransportApplicationsB
import Tablet.P661_T1_PrefixRealization
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P9_T1_DispatchComponentCompliance]
theorem P9_T1_DispatchComponentCompliance :
    exists C : P9_T1_AbstractComponents,
      DispatchContracts C /\ P9_T1_NormalComponentRefinement C /\
      (forall s : Str, DecimalGoalVocabularyDefault.sourceString s ->
        s.val.length <= 3458764513820540928 ->
        forall call : P9_T1_DispatchCall, P9_T1_ReachedDispatchCall s call ->
        match call with
        | .number body _ =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)
        | .special body neg =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)
        | .native body neg d =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            d.negative = false /\ d.mantissa.val < 10 ^ 19 /\
            P9_T1_ActualDispatchOperations.native { d with negative := neg } =
              ok (C.native { d with negative := neg })
        | .first body _ d =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            d.mantissa.val < 10 ^ 19 /\
            P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa =
              ok (C.integer d.exponent d.mantissa)
        | .increment _ _ d _ =>
            d.mantissa.val < 10 ^ 19 /\ exists next : Std.U64,
              d.mantissa + 1#u64 = ok next /\ next.val = d.mantissa.val + 1
        | .second _ _ d _ next =>
            next.val = d.mantissa.val + 1 /\
            P9_T1_ActualDispatchOperations.integer d.exponent next =
              ok (C.integer d.exponent next)
        | .compare _ _ _ first second =>
            num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq first second =
              ok (decide (first.m = second.m /\ first.p_biased = second.p_biased))
        | .post body _ d _ =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            d.negative = false /\ d.mantissa.val < 10 ^ 19
        | .slow body _ _ _ =>
            SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
            (exists x : DecimalLexeme, x.leadingSign = none /\
              DecimalGoalVocabularyDefault.validNumeric x /\
              DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body) /\
            P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)
        | .assemble _ _ _ selected =>
            P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)
        | .negate _ _ _ magnitude =>
            magnitude.val < 2 ^ 63 /\
            P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude)) /\
      (forall (s : Str) (x : DecimalLexeme),
        DecimalGoalVocabularyDefault.sourceString s ->
        s.val.length <= 576460752303421440 ->
        DecimalGoalVocabularyDefault.classifies (DecimalGoalVocabularyDefault.bytes s)
          (some (Sum.inl x)) ->
        forall target : F64,
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.accumulatedMagnitude x) target ↔
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.exactMagnitude x) target) := by
-- BODY
  obtain ⟨C, hcontracts, hrefine⟩ := P616_T1_CompatibleCompletion
  refine ⟨C, hcontracts, hrefine, ?_, P616_T1_ExactTransportApplicationsB.2⟩
  intro s hsource hA
  exact P661_T1_PrefixRealization C hcontracts hrefine s hsource hA
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 343 entries
Technical checking records
Local closure summary
{
  "node": "P9_T1_DispatchComponentCompliance",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "ac1278c53c1122a76c2bb9fd49e8f07fe9671b022d4653f9466e0ce8d1b38587",
  "active_statement_hash": "4e48b101a69127e6a024221ee71e28e97a54a580a496e76b20b4ed7c97ff0a44",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "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",
    "P661_T1_PrefixRealization": "d16c80e7b6e71737"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "4da7f295a9b85b50",
    "DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
    "DecimalLexeme": "c43614ff2149ecf2",
    "DispatchContracts": "008abfbd503545bf",
    "F64": "ec4e25fbaf4e11d4",
    "P9_T1_AbstractComponents": "0a7e8b7bdbce0180",
    "P9_T1_ActualDispatchOperations": "d8bf51ebbbf153ac",
    "P9_T1_DispatchCall": "c43614ff2149ecf2",
    "P9_T1_DispatchOperations": "9b177bb1b830a655",
    "P9_T1_NormalComponentRefinement": "008abfbd503545bf",
    "P9_T1_ReachedDispatchCall": "d7916c72b79f840d",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_imp_dec2flt_common_BiasedFp": "5c88d5d7976c5e8f",
    "num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq": "fbbf553e3c502a05",
    "num_imp_dec2flt_decimal_Decimal": "c43614ff2149ecf2"
  }
}
Prose assessment
{
  "label": "Sound flag superseded by recorded Lean closure",
  "assessment_status": "ReviewerPinnedFail",
  "fingerprint_relation": "differs from current fingerprint",
  "assessment_fingerprint": "sound-v2:c97be361fe37f430fc7a5141538d6e9e0a950cd8299425e1c2e3d8ef333f0b50",
  "current_fingerprint": "sound-v2:1374be186c2e11a52d08bf247c590055931b8ef4d2ab38828db02b9df4c77392",
  "superseded_for_theorem_closure": true
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Fail",
  "substantiveness_status": "Pass"
}