ParserAssembledDirectAccumulatedRounding

Lean checked

Statement

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

Lemma

For every modeled Aeneas Str value s, numeric lexeme x, binary64 word f, and assembly trace t, suppose, in order, that \operatorname{sourceString}(s) holds, \operatorname{validNumeric}(x) holds,
\operatorname{bytes}(s)=\operatorname{renderNumeric}(x),
and the configured traced parser satisfies
\begin{split} &\texttt{num.imp.dec2flt.dec2flt\_with\_trace}\\ &\quad\texttt{F64.Insts.Dec2flt\_modelNumImpDec2fltLemireU64}\\ &\quad\texttt{F64.Insts.CoreOpsArithDivF64F64}\\ &\quad\texttt{F64.Insts.CoreOpsArithMulF64F64}\\ &\quad\texttt{F64.Insts.CoreOpsArithNegF64}\ s =\texttt{ok (Ok }f\texttt{, Assembled }t\texttt{)}. \end{split}
Suppose finally that t.\mathit{slow\_path\_guard}=\mathrm{false}. Then there is a binary64 magnitude m such that
\operatorname{roundsMagnitude} (\operatorname{accumulatedMagnitude}(x),m) \quad\text{and}\quad \operatorname{signedMagnitude} (\operatorname{lexicalNegative}(x),m,f).

Lean statement

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

import Tablet.ParserAssembledTraceSign
import Tablet.ParserAssembledDirectMagnitudeRounding

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserAssembledDirectAccumulatedRounding]
theorem ParserAssembledDirectAccumulatedRounding :
    ∀ (s : Str) (x : DecimalLexeme) (f : F64)
      (tr : num.imp.dec2flt.Dec2FltAssemblyTrace F64),
      DecimalGoalVocabularyDefault.sourceString s ->
      DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.bytes s =
        DecimalGoalVocabularyDefault.renderNumeric x ->
      num.imp.dec2flt.dec2flt_with_trace
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s =
          ok (core.result.Result.Ok f,
            num.imp.dec2flt.Dec2FltTrace.Assembled tr) ->
      tr.slow_path_guard = false ->
      ∃ magnitude : F64,
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.accumulatedMagnitude x) magnitude ∧
        DecimalGoalVocabularyDefault.signedMagnitude
          (DecimalGoalVocabularyDefault.lexicalNegative x) magnitude 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

By ParserAssembledDirectMagnitudeRounding, the trace's assembly_result rounds the accumulated magnitude. By ParserAssembledTraceSign, that same word is below the sign bit and applying the lexeme's lexical sign to it gives the returned word. Taking assembly_result as the existential witness proves both conjuncts.

Lean proof


  intro s x f tr hsource hvalid hrender htrace hguard
  refine ⟨tr.assembly_result, ?_, ?_⟩
  · exact ParserAssembledDirectMagnitudeRounding s x f tr hsource hvalid
      hrender htrace hguard
  · exact ParserAssembledTraceSign s x f tr hsource hvalid hrender htrace

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.ParserAssembledTraceSign
import Tablet.ParserAssembledDirectMagnitudeRounding

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserAssembledDirectAccumulatedRounding]
theorem ParserAssembledDirectAccumulatedRounding :
    ∀ (s : Str) (x : DecimalLexeme) (f : F64)
      (tr : num.imp.dec2flt.Dec2FltAssemblyTrace F64),
      DecimalGoalVocabularyDefault.sourceString s ->
      DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.bytes s =
        DecimalGoalVocabularyDefault.renderNumeric x ->
      num.imp.dec2flt.dec2flt_with_trace
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s =
          ok (core.result.Result.Ok f,
            num.imp.dec2flt.Dec2FltTrace.Assembled tr) ->
      tr.slow_path_guard = false ->
      ∃ magnitude : F64,
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.accumulatedMagnitude x) magnitude ∧
        DecimalGoalVocabularyDefault.signedMagnitude
          (DecimalGoalVocabularyDefault.lexicalNegative x) magnitude f := by
-- BODY
  intro s x f tr hsource hvalid hrender htrace hguard
  refine ⟨tr.assembly_result, ?_, ?_⟩
  · exact ParserAssembledDirectMagnitudeRounding s x f tr hsource hvalid
      hrender htrace hguard
  · exact ParserAssembledTraceSign s x f tr hsource hvalid hrender htrace

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (201)
More program dependencies (159)
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 194 entries
Technical checking records
Local closure summary
{
  "node": "ParserAssembledDirectAccumulatedRounding",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "f98f4c1ee6258d91e25deacce88020c3ec0352af5ecb925022211d49045d226c",
  "active_statement_hash": "30d264f121e059dc66c581fff5b51669bffff081fe76dd17cccde1f276f77ea6",
  "kernel_axioms": [
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "ab64d13f256386ee0e494a5abcc6a5db49512cf3d90bbdfcabd6327793a31f95",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "revalidate-cycle-161",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "ParserAssembledDirectMagnitudeRounding": "2aa56b97986d5c04",
    "ParserAssembledTraceSign": "ec6f6c1227983621"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "c08dd4b4aea4abb4",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "DecimalLexeme": "c43614ff2149ecf2",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "num_float_parse_ParseFloatError": "c43614ff2149ecf2",
    "num_imp_dec2flt_Dec2FltAssemblyTrace": "9e332236ff8bbccd",
    "num_imp_dec2flt_Dec2FltTrace": "8fa376ebb5c489ee",
    "num_imp_dec2flt_dec2flt_with_trace": "ebe6a57c6dce0df6"
  }
}
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:ef8e33e6e715e2d7cb28473999164a1404666d16a62bc656f457810bd22323b8",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}