ParserSuccessfulTrace

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 and binary64 word f, with no sourceString premise, if the modeled wrapper dec2flt, using the configured concrete float instances, returns ok (Ok f), then there is a trace t for which dec2flt_with_trace, using those same instances, returns ok (Ok f, t).

Lean statement

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

import Tablet.Assumptions
import Tablet.DecimalGoalVocabularyDefault
import Tablet.SourceValidByteSlice
import Tablet.SpecialHelperRejection
import Tablet.NumberHelperAccumulatedValue
import Tablet.NativeCorrectOrDefer
import Tablet.IntegerCorrectOrDefer
import Tablet.AssemblyCorrespondence
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.num_imp_dec2flt_Dec2FltTrace
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserSuccessfulTrace]
theorem ParserSuccessfulTrace :
    ∀ (s : Str) (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) ->
      ∃ tr : num.imp.dec2flt.Dec2FltTrace F64,
        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, tr) := 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

Unfold the modeled wrapper num imp dec2flt dec2flt. Its entire body is one bind of num imp dec2flt dec2flt with trace, followed by projection of the first component and ok. A failed or divergent traced call would propagate through the bind and could not equal the assumed normal result. Consequently the traced call is ok (r,t) for some r,t. Injectivity of ok and of the result constructor in the assumed equation gives r=\texttt{Ok }f. Substitution gives the asserted traced equation.

Lean proof


  intro s f h
  unfold num.imp.dec2flt.dec2flt at h
  cases htrace : num.imp.dec2flt.dec2flt_with_trace
      F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
      F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
      F64.Insts.CoreOpsArithNegF64 s with
  | fail e => simp [htrace] at h
  | div => simp [htrace] at h
  | ok pair =>
      rw [htrace] at h
      simp only [Bind.bind, Aeneas.Std.bind] at h
      cases pair with
      | mk result tr =>
          cases h
          exact ⟨tr, rfl⟩

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.Assumptions
import Tablet.DecimalGoalVocabularyDefault
import Tablet.SourceValidByteSlice
import Tablet.SpecialHelperRejection
import Tablet.NumberHelperAccumulatedValue
import Tablet.NativeCorrectOrDefer
import Tablet.IntegerCorrectOrDefer
import Tablet.AssemblyCorrespondence
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.num_imp_dec2flt_Dec2FltTrace
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserSuccessfulTrace]
theorem ParserSuccessfulTrace :
    ∀ (s : Str) (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) ->
      ∃ tr : num.imp.dec2flt.Dec2FltTrace F64,
        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, tr) := by
-- BODY
  intro s f h
  unfold num.imp.dec2flt.dec2flt at h
  cases htrace : num.imp.dec2flt.dec2flt_with_trace
      F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
      F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
      F64.Insts.CoreOpsArithNegF64 s with
  | fail e => simp [htrace] at h
  | div => simp [htrace] at h
  | ok pair =>
      rw [htrace] at h
      simp only [Bind.bind, Aeneas.Std.bind] at h
      cases pair with
      | mk result tr =>
          cases h
          exact ⟨tr, rfl⟩

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 147 entries
Technical checking records
Local closure summary
{
  "node": "ParserSuccessfulTrace",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "57c70c7675ffb001f7ab1c9bc25949196a11c65bd564291eec9dc17ecea3107a",
  "active_statement_hash": "3d950e972306c3016a57b0531fdfd153e6e926de76953798777109699973406e",
  "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": "worker-result-local-closure-issuance-cycle-148",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {
    "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_Dec2FltTrace": "644abe66cec8ac98",
    "num_imp_dec2flt_dec2flt": "f9f7d93449a25efa",
    "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:589eae1e38fc595360ab739cbeee248d8dc834d68791c896baad7027f85096b3",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}