P616_T1_ExactTransportApplicationsB

Lean checked

Statement

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

Corollary · Unsigned-body and complete-string exact transport

First, for every source-valid slice b of length at most B=576460752303421440, every valid unsigned lexeme x rendering exactly its bytes has identical accumulated and exact magnitude rounding targets. Second, for every source-valid complete Rust string s of length at most B, every lexeme x numerically classifying its complete bytes has the same target equivalence. The second bound counts its optional leading sign, not merely the sign-stripped body. Both equivalences hold for every binary64 word, without any execution hypothesis.

Lean statement

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

import Tablet.P616_T1_LexemeExactTransportB
import Tablet.SourceValidByteSlice

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P616_T1_ExactTransportApplicationsB]
theorem P616_T1_ExactTransportApplicationsB :
    (forall (body : Slice Std.U8) (x : DecimalLexeme),
      SourceValidByteSlice body -> body.val.length <= 576460752303421440 ->
      x.leadingSign = none -> DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body ->
      forall target : F64,
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.accumulatedMagnitude x) target ↔
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.exactMagnitude x) target) ∧
    (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.

Proof

For the slice assertion, the whole-rendering equation and the byte-map definition in DecimalGoalVocabularyDefault imply |\mathrm{renderNumeric}(x)|=|b.\mathrm{val}|: mapping byte values does not change list length. The B-bound and validity are therefore exactly the hypotheses of LexemeExactTransportB; apply its equivalence for each target. SourceValidByteSlice and the absent leading sign are retained as the stated interface domain, not additional premises of the underlying lexeme theorem.
For the string assertion, unfolding numeric classification in DecimalGoalVocabularyDefault supplies validity and \mathrm{renderNumeric}(x)=\mathrm{bytes}(s). Again the byte map preserves length, giving the full rendered B-bound, including every leading sign byte. Apply LexemeExactTransportB to this lexeme and every target. Its argument does not require UTF-8 or any parser result; the source-string predicate is retained in this public interface. These two applications are independent of dispatch contracts.

Lean proof


  constructor
  · intro body x _hsource hB _hsign hx hrender
    apply P616_T1_LexemeExactTransportB x hx
    rw [hrender]
    simpa only [DecimalGoalVocabularyDefault, List.length_map] using hB
  · intro s x _hsource hB hclass
    change DecimalGoalVocabularyDefault.validNumeric x ∧
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s at hclass
    apply P616_T1_LexemeExactTransportB x hclass.1
    rw [hclass.2]
    simpa only [DecimalGoalVocabularyDefault, List.length_map] using hB
end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.P616_T1_LexemeExactTransportB
import Tablet.SourceValidByteSlice

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P616_T1_ExactTransportApplicationsB]
theorem P616_T1_ExactTransportApplicationsB :
    (forall (body : Slice Std.U8) (x : DecimalLexeme),
      SourceValidByteSlice body -> body.val.length <= 576460752303421440 ->
      x.leadingSign = none -> DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body ->
      forall target : F64,
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.accumulatedMagnitude x) target ↔
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.exactMagnitude x) target) ∧
    (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
  constructor
  · intro body x _hsource hB _hsign hx hrender
    apply P616_T1_LexemeExactTransportB x hx
    rw [hrender]
    simpa only [DecimalGoalVocabularyDefault, List.length_map] using hB
  · intro s x _hsource hB hclass
    change DecimalGoalVocabularyDefault.validNumeric x ∧
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s at hclass
    apply P616_T1_LexemeExactTransportB x hclass.1
    rw [hclass.2]
    simpa only [DecimalGoalVocabularyDefault, List.length_map] using hB
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 17 entries
Technical checking records
Local closure summary
{
  "node": "P616_T1_ExactTransportApplicationsB",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "2a65dd77428e4b9a6a686708d11e03d2099149a86a47d2fc9d4053d2521a30a8",
  "active_statement_hash": "c62289da4563edef714b366d6864b74ec95587f53bd3d3e5c452842ee8c06240",
  "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-181",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "DecimalGoalVocabularyDefault": "2bbf2be48b5a4a4b",
    "ExponentValueAgreement": "4dbd872ba02a631e",
    "P616_T1_LexemeExactTransportB": "3e1fd06f0a379192"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "c08dd4b4aea4abb4",
    "DecimalGoalVocabularyDefault": "55eb6bce0e8a4131",
    "DecimalLexeme": "8ad754cf2c272e73",
    "F64": "ec4e25fbaf4e11d4",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_decimal_Decimal": "4c41a56bf44cb31e"
  }
}
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:016b26038e1f87217ae1a9787a292e65b1717770533f1cba178a9b763610eb47",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}