SlowAccumulatedRoundingWitness

Lean checked

Statement

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

Lemma · Concrete slow accumulated-rounding witness

There are an Aeneas byte slice s and decimal lexeme x such that
\begin{aligned} s.\mathit{val}&=\operatorname{replicate}(2147483648,49\#\mathrm{u8}),\\ x&=(\mathrm{none},\operatorname{replicate}(2147483648,1), \mathrm{none},\mathrm{none}), \end{aligned}
and the following implication is false:
\begin{aligned} &s\text{ is source-valid} \mathbin{\Longrightarrow}x.\mathit{leadingSign}=\mathrm{none} \mathbin{\Longrightarrow}x\text{ is valid numeric syntax}\\ &\mathbin{\Longrightarrow} \mathit{bytes}(s)=\mathit{renderNumeric}(x) \mathbin{\Longrightarrow} \texttt{parse\_long\_mantissa}(s) =\texttt{ok }\{\mathit{m}=0\#\mathrm{u64}, \mathit{p\_biased}=0\#\mathrm{i32}\}\\ &\mathbin{\Longrightarrow}\exists t:\mathrm{F64},\quad \mathit{assembledWord} (\{\mathit{m}=0\#\mathrm{u64},\mathit{p\_biased}=0\#\mathrm{i32}\},t) \ \land\ \mathit{roundsMagnitude}(\mathit{accumulatedMagnitude}(x),t). \end{aligned}
Here the parser call is its binary64 specialization; the bytes/rendering equality says exactly that the rendering of x is the observed content of s.

Lean statement

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

import Tablet.SlowAccumulatedRoundingLexical
import Tablet.SlowAccumulatedRoundingSlow
import Tablet.SlowAccumulatedRoundingMagnitude

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option maxHeartbeats 2000000

namespace dec2flt_model

-- [TABLET NODE: SlowAccumulatedRoundingWitness]
theorem SlowAccumulatedRoundingWitness :
    exists (s : Slice Std.U8) (x : DecimalLexeme),
      s.val = List.replicate 2147483648 49#u8 /\
      x = {
        leadingSign := none
        integerDigits := List.replicate 2147483648 1
        fractionDigits := none
        exponent := none } /\
      Not (SourceValidByteSlice s -> x.leadingSign = none ->
        DecimalGoalVocabularyDefault.validNumeric x ->
        DecimalGoalVocabularyDefault.bytes s =
          DecimalGoalVocabularyDefault.renderNumeric x ->
        num.imp.dec2flt.slow.parse_long_mantissa
            F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 s =
          ok { m := 0#u64, p_biased := 0#i32 } ->
        exists target : F64,
          DecimalGoalVocabularyDefault.assembledWord
              { m := 0#u64, p_biased := 0#i32 } target /\
            DecimalGoalVocabularyDefault.roundsMagnitude
              (DecimalGoalVocabularyDefault.accumulatedMagnitude 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

Choose the slice and lexeme supplied by SlowAccumulatedRoundingLexical. That lemma gives source validity, absence of a sign, numeric validity, and exact byte rendering, together with the two displayed replicate equalities. Applying SlowAccumulatedRoundingSlow to the slice equality gives the normal slow-parser result \{\mathit{m}=0,\mathit{p\_biased}=0\}.
Assume for contradiction that the displayed implication holds. Apply it to the source validity, no-leading-sign, valid-syntax, and exact-rendering facts from the lexical lemma, and then to the slow-parser result above. It yields a binary64 target that is both the unrestricted assembly of the zero pair and a rounding target of the accumulated magnitude of x. But SlowAccumulatedRoundingMagnitude, applied to the displayed equality for x, says that no such target exists. This contradiction proves that the implication is false for the chosen s and x.

Lean proof


  obtain ⟨s, x, hs, hx, hsource, hsign, hvalid, hrender⟩ :=
    SlowAccumulatedRoundingLexical
  have hslow := SlowAccumulatedRoundingSlow s hs
  obtain ⟨_, hnoTarget⟩ := SlowAccumulatedRoundingMagnitude x hx
  refine ⟨s, x, hs, hx, ?_⟩
  intro hmatrix
  exact hnoTarget (hmatrix hsource hsign hvalid hrender hslow)

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.SlowAccumulatedRoundingLexical
import Tablet.SlowAccumulatedRoundingSlow
import Tablet.SlowAccumulatedRoundingMagnitude

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option maxHeartbeats 2000000

namespace dec2flt_model

-- [TABLET NODE: SlowAccumulatedRoundingWitness]
theorem SlowAccumulatedRoundingWitness :
    exists (s : Slice Std.U8) (x : DecimalLexeme),
      s.val = List.replicate 2147483648 49#u8 /\
      x = {
        leadingSign := none
        integerDigits := List.replicate 2147483648 1
        fractionDigits := none
        exponent := none } /\
      Not (SourceValidByteSlice s -> x.leadingSign = none ->
        DecimalGoalVocabularyDefault.validNumeric x ->
        DecimalGoalVocabularyDefault.bytes s =
          DecimalGoalVocabularyDefault.renderNumeric x ->
        num.imp.dec2flt.slow.parse_long_mantissa
            F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 s =
          ok { m := 0#u64, p_biased := 0#i32 } ->
        exists target : F64,
          DecimalGoalVocabularyDefault.assembledWord
              { m := 0#u64, p_biased := 0#i32 } target /\
            DecimalGoalVocabularyDefault.roundsMagnitude
              (DecimalGoalVocabularyDefault.accumulatedMagnitude x)
              target) := by
-- BODY
  obtain ⟨s, x, hs, hx, hsource, hsign, hvalid, hrender⟩ :=
    SlowAccumulatedRoundingLexical
  have hslow := SlowAccumulatedRoundingSlow s hs
  obtain ⟨_, hnoTarget⟩ := SlowAccumulatedRoundingMagnitude x hx
  refine ⟨s, x, hs, hx, ?_⟩
  intro hmatrix
  exact hnoTarget (hmatrix hsource hsign hvalid hrender hslow)

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (154)
More program dependencies (112)
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 113 entries
Technical checking records
Local closure summary
{
  "node": "SlowAccumulatedRoundingWitness",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "24da00e355cba7ea138bc21a0c9776c4fa282abc12c706e4d52c06a2fbe6ec39",
  "active_statement_hash": "20a9e921ccb9bc70bf11158f31cebbbab755008bb5803061133fea77c674d2ee",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "ab64d13f256386ee0e494a5abcc6a5db49512cf3d90bbdfcabd6327793a31f95",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-130",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "SlowAccumulatedRoundingLexical": "51090136c8c78662",
    "SlowAccumulatedRoundingMagnitude": "361d879f9f5e16eb",
    "SlowAccumulatedRoundingSlow": "37833d9b51144d22"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "c08dd4b4aea4abb4",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "DecimalLexeme": "8ad754cf2c272e73",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_slow_parse_long_mantissa": "cd8af64c3688b60f"
  }
}
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:bc6a3eaca7d655203a84963d2498fad476a29ee283b82848f8a64e3b48537aa3",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}