P13_T1_ParserInfinity

Lean checked

Statement

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

Theorem

Every source-valid Rust string spelling a complete infinity literal returns normally with Rust Ok of infinity with its lexical sign from the actual specialized dec2flt. The grammar includes optionally signed ASCII-case-insensitive inf and infinity. Source strings, whole-input matching and signed infinity words are DecimalGoalVocabularyDefault; a minus gives negative infinity, while plus or no sign gives positive infinity. There is no A or B bound. Outer failure or divergence does not satisfy normal Rust Ok. The specialization is the one in ActualDispatchOperations.

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.P9_T1_ActualDispatchOperations
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.P347_T1_SpecialDispatch
import Tablet.SpecialHelperInfinity

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P13_T1_ParserInfinity]
theorem P13_T1_ParserInfinity :
    forall (s : Str) (sign : Option Bool),
      DecimalGoalVocabularyDefault.sourceString s ->
      DecimalGoalVocabularyDefault.specialLiteral
        (DecimalGoalVocabularyDefault.bytes s) sign false ->
      exists f : F64,
        num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
          F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
          F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) ∧
        DecimalGoalVocabularyDefault.isInfinity (decide (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 retained as authored. The explanatory prose is preserved as it stood when captured.

Proof

Fix a source-valid string s and its optional lexical sign \sigma. The literal hypothesis is exactly DecimalGoalVocabularyDefault's special-literal predicate with kind false. Apply SpecialDispatch to this hypothesis. It supplies a body slice u satisfying the unsigned infinity literal predicate, and a universal implication transferring a normal Some return of the specialized special helper on u to the actual public parser's normal Rust Ok return on s. The negative argument in that implication is \nu=\operatorname{decide}(\sigma=\texttt{some true}), so it is true for a minus prefix and false for a plus prefix or absent sign.
Apply the current SpecialHelperInfinity to u, \nu, and the supplied unsigned-literal predicate. Its statement requires no additional length, numeric-rejection, or platform-width premise. It provides a binary64 word f for which the specialized parse_inf_nan returns ok (Some f) and DecimalGoalVocabularyDefault's predicate \mathit{isInfinity}(\nu,f) holds. Substituting this helper equation into the dispatch implication gives precisely the required actual dec2flt equation ok (Rust Ok f). The specialization in both support statements is the one of ActualDispatchOperations. Take this same f as the existential witness and retain its signed-infinity property. Both equalities are normal outer returns, not checked failure or divergence. The source-validity hypothesis is retained; the support actually proves dispatch for all model strings satisfying this short literal grammar, so no A or B restriction or further domain condition is needed.

Lean proof


  intro s sign _ hspecial
  obtain ⟨body, hbody, hdispatch⟩ := P347_T1_SpecialDispatch s sign false hspecial
  obtain ⟨f, hf, hinfinity⟩ :=
    SpecialHelperInfinity body (decide (sign = some true)) hbody
  exact ⟨f, hdispatch f hf, hinfinity⟩

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.P9_T1_ActualDispatchOperations
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.P347_T1_SpecialDispatch
import Tablet.SpecialHelperInfinity

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P13_T1_ParserInfinity]
theorem P13_T1_ParserInfinity :
    forall (s : Str) (sign : Option Bool),
      DecimalGoalVocabularyDefault.sourceString s ->
      DecimalGoalVocabularyDefault.specialLiteral
        (DecimalGoalVocabularyDefault.bytes s) sign false ->
      exists f : F64,
        num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
          F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
          F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) ∧
        DecimalGoalVocabularyDefault.isInfinity (decide (sign = some true)) f := by
-- BODY
  intro s sign _ hspecial
  obtain ⟨body, hbody, hdispatch⟩ := P347_T1_SpecialDispatch s sign false hspecial
  obtain ⟨f, hf, hinfinity⟩ :=
    SpecialHelperInfinity body (decide (sign = some true)) hbody
  exact ⟨f, hdispatch f hf, hinfinity⟩

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 160 entries
Technical checking records
Local closure summary
{
  "node": "P13_T1_ParserInfinity",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "b15f0771f0d405dbb2847c107b0c3f4ca9e0084a11840b3d0c7dd0264c09872c",
  "active_statement_hash": "079eb708157bab0505888e77c615b07f650bb69d28467ee6b8b52a9344ccf6b2",
  "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-181",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "P347_T1_SpecialDispatch": "a80643c9dc7b88ce",
    "SpecialHelperInfinity": "4124e26dd85ce114"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "1f42f752b5d22513",
    "DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "num_float_parse_ParseFloatError": "c43614ff2149ecf2",
    "num_imp_dec2flt_dec2flt": "f9f7d93449a25efa",
    "num_imp_dec2flt_parse_parse_inf_nan": "85655c19a8791b54"
  }
}
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:58ce104a9cd1457359f9f671eed65b2484eaad747d71ac5e0ebc162e291d53d1",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}