ParserNumericFastPathCertificate

Lean checked

Statement

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

Helper · Concrete fast-path rejection

For the binary64 Lemire and arithmetic instances, applying the extracted decimal fast path to exponent -30, mantissa 1{,}000{,}000{,}000{,}000{,}000{,}080, negative flag false, and many-digits flag true returns none.

Lean statement

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

import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_DISGUISED_FAST_PATH
import Tablet.num_imp_dec2flt_decimal_Decimal_can_use_fast_path
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_fpu_fpu_precision_set_precision
import Tablet.num_imp_dec2flt_Lemire_MIN_EXPONENT_FAST_PATH_default

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserNumericFastPathCertificate]
theorem ParserNumericFastPathCertificate :
    num.imp.dec2flt.decimal.Decimal.try_fast_path
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64
        F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64
        { exponent := (-30)#i64
          mantissa := 1000000000000000080#u64
          negative := false
          many_digits := true } = ok none := 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

The binary64 fast exponent maximum in F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT FAST PATH is 22. Unfolding num imp dec2flt Lemire MIN EXPONENT FAST PATH default, checked negation therefore gives the minimum fast exponent -22. The disguised-fast maximum supplied by F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT DISGUISED FAST PATH is 37.
Substitute these bounds and exponent -30 into num imp dec2flt decimal Decimal can use fast path. The ordinary fast interval test fails because -30<-22; the extracted condition therefore returns false (the displayed mantissa and many-digits flag do not change that failed lower-bound test). Unfolding num imp dec2flt decimal Decimal try fast path, the precision wrapper from num imp dec2flt fpu fpu precision set precision preserves the successful boolean computation, and the false branch returns none. Thus the displayed call is exactly ok none.

Lean proof


  have hmax22 :
      F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH =
        22#i64 := by
    rw [F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH.eq_def]
  have hneg22 :
      -. F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH =
        ok (-22)#i64 := by
    rw [hmax22]
    rfl
  have hmin :
      num.imp.dec2flt.Lemire.MIN_EXPONENT_FAST_PATH.default
          F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 = ok (-22)#i64 := by
    unfold num.imp.dec2flt.Lemire.MIN_EXPONENT_FAST_PATH.default
    simp [hneg22]
  have hmax37 :
      F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_DISGUISED_FAST_PATH =
        37#i64 := by
    rw [F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_DISGUISED_FAST_PATH.eq_def]
  have hcan :
      num.imp.dec2flt.decimal.Decimal.can_use_fast_path
          F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
          { exponent := (-30)#i64
            mantissa := 1000000000000000080#u64
            negative := false
            many_digits := true } = ok false := by
    unfold num.imp.dec2flt.decimal.Decimal.can_use_fast_path
    simp [hneg22, hmax37]
  unfold num.imp.dec2flt.decimal.Decimal.try_fast_path
  simp [num.imp.dec2flt.fpu.fpu_precision.set_precision, hcan]

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_DISGUISED_FAST_PATH
import Tablet.num_imp_dec2flt_decimal_Decimal_can_use_fast_path
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_fpu_fpu_precision_set_precision
import Tablet.num_imp_dec2flt_Lemire_MIN_EXPONENT_FAST_PATH_default

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserNumericFastPathCertificate]
theorem ParserNumericFastPathCertificate :
    num.imp.dec2flt.decimal.Decimal.try_fast_path
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64
        F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64
        { exponent := (-30)#i64
          mantissa := 1000000000000000080#u64
          negative := false
          many_digits := true } = ok none := by
-- BODY
  have hmax22 :
      F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH =
        22#i64 := by
    rw [F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH.eq_def]
  have hneg22 :
      -. F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH =
        ok (-22)#i64 := by
    rw [hmax22]
    rfl
  have hmin :
      num.imp.dec2flt.Lemire.MIN_EXPONENT_FAST_PATH.default
          F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 = ok (-22)#i64 := by
    unfold num.imp.dec2flt.Lemire.MIN_EXPONENT_FAST_PATH.default
    simp [hneg22]
  have hmax37 :
      F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_DISGUISED_FAST_PATH =
        37#i64 := by
    rw [F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_DISGUISED_FAST_PATH.eq_def]
  have hcan :
      num.imp.dec2flt.decimal.Decimal.can_use_fast_path
          F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
          { exponent := (-30)#i64
            mantissa := 1000000000000000080#u64
            negative := false
            many_digits := true } = ok false := by
    unfold num.imp.dec2flt.decimal.Decimal.can_use_fast_path
    simp [hneg22, hmax37]
  unfold num.imp.dec2flt.decimal.Decimal.try_fast_path
  simp [num.imp.dec2flt.fpu.fpu_precision.set_precision, hcan]

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (92)
More program dependencies (50)
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 89 entries
Technical checking records
Local closure summary
{
  "node": "ParserNumericFastPathCertificate",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "c53128bcff8c28ae76987d8e0271bd6d576b37310cd1f27708dd11b0f0961ec9",
  "active_statement_hash": "944048078c4a5ea6536ae7babc48753b86acb93ae52c55dac8827bf83b69622a",
  "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-126",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_DISGUISED_FAST_PATH": "394b9257cd714abf",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH": "6bf5ea9f18f5e8dc",
    "num_imp_dec2flt_Lemire_MAX_MANTISSA_FAST_PATH_default": "32d9110750ebf062",
    "num_imp_dec2flt_decimal_Decimal_try_fast_path": "acdc05e301fae675"
  },
  "strict_definition_deps": {
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_DISGUISED_FAST_PATH": "238680a0d0ed48da",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH": "c8b07a02533b83c6",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_pow10_fast_path": "c0ce6fdd5caeca22",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
    "Preamble": "ebc6971dd5f6042c",
    "core_ops_arith_Div": "2704fb3c3065e0f5",
    "core_ops_arith_Mul": "91e8d5ef661a3d2a",
    "core_ops_arith_Neg": "0ff07135a60bcbf9",
    "num_imp_dec2flt_Lemire": "76a77da2a1798c64",
    "num_imp_dec2flt_Lemire_MIN_EXPONENT_FAST_PATH_default": "b183e7a434c9b295",
    "num_imp_dec2flt_decimal_Decimal": "4da4ccbe640ef8e6",
    "num_imp_dec2flt_decimal_Decimal_can_use_fast_path": "11145d187f88b02e",
    "num_imp_dec2flt_decimal_Decimal_try_fast_path": "063a63057ba134c8",
    "num_imp_dec2flt_decimal_INT_POW10": "48c78c3dca210847",
    "num_imp_dec2flt_fpu_fpu_precision_set_precision": "73042c31057f9ab9"
  }
}
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:2eec364a581aa7eaab4aa5c25bb7828990357972afb479a6e5a1436a1ee09829",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}