P13_T1_NumberHelperAcceptance

Lean checked

Statement

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

Theorem

Every nonempty source-valid byte slice of length at most A=3458764513820540928 bytes that spells a complete unsigned numeric literal returns normally with Some from the specialized parse_number in ActualDispatchOperations. Source validity is SourceValidByteSlice; arbitrary byte contents are permitted, without a UTF-8 premise. Whole-input unsigned grammar is DecimalGoalVocabularyDefault, with no leading sign but an optional exponent sign. There is no restriction on explicit exponent digit count or mathematical value beyond the slice-length bound. The claim includes the configured checked-arithmetic executions: outer failure and divergence are not normal Some returns.

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.SourceValidByteSlice
import Tablet.P9_T1_ActualDispatchOperations
import Tablet.P367_T1_NumberHelperWholeClassificationA

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P13_T1_NumberHelperAcceptance]
theorem P13_T1_NumberHelperAcceptance :
    forall (s : Slice Std.U8) (x : DecimalLexeme),
      SourceValidByteSlice s -> s.val ≠ [] ->
      s.val.length <= 3458764513820540928 -> x.leadingSign = none ->
      DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s ->
      exists d : num.imp.dec2flt.decimal.Decimal,
        P9_T1_ActualDispatchOperations.parseNumber s = ok (some d) := 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

Fix the slice and lexeme in the statement. NumberHelperWholeClassificationA applies using precisely their nonempty-slice and A-length premises. It gives an actual normal optional result for the specialized call and equates existence of a Some record with existence of a complete valid unsigned rendering. The supplied lexeme is that existential witness: its leading sign is absent, it is valid in DecimalGoalVocabularyDefault, and its rendering is exactly the input bytes. The reverse implication of the classification therefore gives a record d and identifies the optional result with Some d. Substitution into the normal-result equation is the required \texttt{ok (some d)}. The source-validity premise is preserved; the classification is stronger in not needing it separately because its A-bound already bounds all lengths below the source maximum.

Lean proof


  intro s x hsource hne hlen hsign hvalid hrender
  obtain ⟨result, hparse, hclass⟩ :=
    P367_T1_NumberHelperWholeClassificationA s hne hlen
  obtain ⟨d, hd⟩ := hclass.mpr ⟨x, hsign, hvalid, hrender⟩
  exact ⟨d, hd ▸ hparse⟩

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.SourceValidByteSlice
import Tablet.P9_T1_ActualDispatchOperations
import Tablet.P367_T1_NumberHelperWholeClassificationA

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P13_T1_NumberHelperAcceptance]
theorem P13_T1_NumberHelperAcceptance :
    forall (s : Slice Std.U8) (x : DecimalLexeme),
      SourceValidByteSlice s -> s.val ≠ [] ->
      s.val.length <= 3458764513820540928 -> x.leadingSign = none ->
      DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s ->
      exists d : num.imp.dec2flt.decimal.Decimal,
        P9_T1_ActualDispatchOperations.parseNumber s = ok (some d) := by
-- BODY
  intro s x hsource hne hlen hsign hvalid hrender
  obtain ⟨result, hparse, hclass⟩ :=
    P367_T1_NumberHelperWholeClassificationA s hne hlen
  obtain ⟨d, hd⟩ := hclass.mpr ⟨x, hsign, hvalid, hrender⟩
  exact ⟨d, hd ▸ hparse⟩

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (198)
More program dependencies (156)
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 177 entries
Technical checking records
Local closure summary
{
  "node": "P13_T1_NumberHelperAcceptance",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "5efa4154d0b4a255da010b0fea868bca7df92b03bc72d40f04529f37cbf32000",
  "active_statement_hash": "08a0f344a34d4423d380ef4efa9501558a993cc63f4711a2330745e3190de8b7",
  "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-194",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "P367_T1_NumberHelperWholeClassificationA": "5730db65003ba4ba"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "65227461bf3cac06",
    "DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
    "DecimalLexeme": "c43614ff2149ecf2",
    "P9_T1_ActualDispatchOperations": "d8bf51ebbbf153ac",
    "P9_T1_DispatchOperations": "9b177bb1b830a655",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_imp_dec2flt_decimal_Decimal": "c43614ff2149ecf2"
  }
}
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:26be05d37a0fb43e83a2815f61842410ae0a52f41a59c3b36fd26d1e4d092d24",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}