ParserExponentConstants

Lean checked

Statement

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

Helper

For the extracted binary64 trait instance, the bit width, total significand width, significand width, exponent width, saturated exponent, infinite power, exponent bias, and minimum binary exponent are respectively 64,53,52,11,2047,2047,1023,-1022. Its smallest and largest supported decimal powers are -342 and 308, and its round-to-even decimal cutoffs are -4 and 23. Every displayed extracted computation returns normally.

Lean statement

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

import Tablet.ModelF64MantissaDigits
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN
import Tablet.num_imp_traits_Float_SIG_BITS_default
import Tablet.num_imp_traits_Float_EXP_BITS_default
import Tablet.num_imp_traits_Float_EXP_SAT_default
import Tablet.num_imp_traits_Float_INFINITE_POWER_default
import Tablet.num_imp_traits_Float_EXP_BIAS_default
import Tablet.num_imp_traits_Float_EXP_MIN_default

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserExponentConstants]
theorem ParserExponentConstants :
    let F := F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
    F.BITS = ok 64#u32 ∧
    F.SIG_TOTAL_BITS = ok 53#u32 ∧
    F.SIG_BITS = ok 52#u32 ∧
    F.EXP_BITS = ok 11#u32 ∧
    F.EXP_SAT = ok 2047#u32 ∧
    F.INFINITE_POWER = ok 2047#i32 ∧
    F.EXP_BIAS = ok 1023#u32 ∧
    F.EXP_MIN = ok (-1022)#i32 ∧
    F.SMALLEST_POWER_OF_TEN = ok (-342)#i32 ∧
    F.LARGEST_POWER_OF_TEN = ok 308#i32 ∧
    F.MIN_EXPONENT_ROUND_TO_EVEN = ok (-4)#i32 ∧
    F.MAX_EXPONENT_ROUND_TO_EVEN = ok 23#i32 := 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 F64 Insts Dec2flt modelNumImpTraitsFloatU64 BITS, the bit width is 64. The declaration F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS invokes ModelF64MantissaDigits, which returns 53. Thus the checked subtraction in num imp traits Float SIG BITS default is 53-1=52. In num imp traits Float EXP BITS default, the two checked subtractions are 64-52=12 and 12-1=11. In num imp traits Float EXP SAT default, shifting the unsigned value one left by 11 is legal and gives 2048, and the checked subtraction by one gives 2047. The in-range cast in num imp traits Float INFINITE POWER default therefore gives the signed value 2047. The right shift in num imp traits Float EXP BIAS default gives 1023. Finally, num imp traits Float EXP MIN default casts 1023 exactly, subtracts one without overflow, and negates 1022, giving -1022. These explicit values also verify normal return of every checked operation in this chain. The remaining four values are the literal extracted declarations F64 Insts Dec2flt modelNumImpTraitsFloatU64 SMALLEST POWER OF TEN, F64 Insts Dec2flt modelNumImpTraitsFloatU64 LARGEST POWER OF TEN, F64 Insts Dec2flt modelNumImpTraitsFloatU64 MIN EXPONENT ROUND TO EVEN, and F64 Insts Dec2flt modelNumImpTraitsFloatU64 MAX EXPONENT ROUND TO EVEN.

Lean proof


  let F := F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
  have hbits : F.BITS = ok 64#u32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def]
  have htotal : F.SIG_TOTAL_BITS = ok 53#u32 := by
    change F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS = _
    simp only [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def,
      core.f64.F64.MANTISSA_DIGITS, ModelF64MantissaDigits,
      Binary64ModelDefault]
  have hbits0 : ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS =
      ok 64#u32 := by
    simpa only [F] using hbits
  have htotal0 : F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS =
      ok 53#u32 := by
    simpa only [F] using htotal
  have hsig : F.SIG_BITS = ok 52#u32 := by
    dsimp [F]
    rw [htotal0]
    rfl
  have hsig0 := hsig
  dsimp [F] at hsig0
  have hexpbits : F.EXP_BITS = ok 11#u32 := by
    dsimp [F]
    rw [hbits0, hsig0]
    rfl
  have hexpbits0 := hexpbits
  dsimp [F] at hexpbits0
  have hexpsat : F.EXP_SAT = ok 2047#u32 := by
    dsimp [F]
    rw [hexpbits0]
    rfl
  have hexpsat0 := hexpsat
  dsimp [F] at hexpsat0
  have hinf : F.INFINITE_POWER = ok 2047#i32 := by
    dsimp [F]
    rw [hexpsat0]
    rfl
  have hbias : F.EXP_BIAS = ok 1023#u32 := by
    dsimp [F]
    rw [hexpsat0]
    rfl
  have hbias0 := hbias
  dsimp [F] at hbias0
  have hmin : F.EXP_MIN = ok (-1022)#i32 := by
    dsimp [F]
    rw [hbias0]
    rfl
  have hsmall : F.SMALLEST_POWER_OF_TEN = ok (-342)#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
  have hlarge : F.LARGEST_POWER_OF_TEN = ok 308#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def]
  have hroundmin : F.MIN_EXPONENT_ROUND_TO_EVEN = ok (-4)#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MIN_EXPONENT_ROUND_TO_EVEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MIN_EXPONENT_ROUND_TO_EVEN.eq_def]
  have hroundmax : F.MAX_EXPONENT_ROUND_TO_EVEN = ok 23#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MAX_EXPONENT_ROUND_TO_EVEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MAX_EXPONENT_ROUND_TO_EVEN.eq_def]
  exact ⟨hbits, htotal, hsig, hexpbits, hexpsat, hinf, hbias, hmin,
    hsmall, hlarge, hroundmin, hroundmax⟩

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.ModelF64MantissaDigits
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN
import Tablet.num_imp_traits_Float_SIG_BITS_default
import Tablet.num_imp_traits_Float_EXP_BITS_default
import Tablet.num_imp_traits_Float_EXP_SAT_default
import Tablet.num_imp_traits_Float_INFINITE_POWER_default
import Tablet.num_imp_traits_Float_EXP_BIAS_default
import Tablet.num_imp_traits_Float_EXP_MIN_default

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserExponentConstants]
theorem ParserExponentConstants :
    let F := F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
    F.BITS = ok 64#u32 ∧
    F.SIG_TOTAL_BITS = ok 53#u32 ∧
    F.SIG_BITS = ok 52#u32 ∧
    F.EXP_BITS = ok 11#u32 ∧
    F.EXP_SAT = ok 2047#u32 ∧
    F.INFINITE_POWER = ok 2047#i32 ∧
    F.EXP_BIAS = ok 1023#u32 ∧
    F.EXP_MIN = ok (-1022)#i32 ∧
    F.SMALLEST_POWER_OF_TEN = ok (-342)#i32 ∧
    F.LARGEST_POWER_OF_TEN = ok 308#i32 ∧
    F.MIN_EXPONENT_ROUND_TO_EVEN = ok (-4)#i32 ∧
    F.MAX_EXPONENT_ROUND_TO_EVEN = ok 23#i32 := by
-- BODY
  let F := F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
  have hbits : F.BITS = ok 64#u32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def]
  have htotal : F.SIG_TOTAL_BITS = ok 53#u32 := by
    change F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS = _
    simp only [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def,
      core.f64.F64.MANTISSA_DIGITS, ModelF64MantissaDigits,
      Binary64ModelDefault]
  have hbits0 : ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS =
      ok 64#u32 := by
    simpa only [F] using hbits
  have htotal0 : F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS =
      ok 53#u32 := by
    simpa only [F] using htotal
  have hsig : F.SIG_BITS = ok 52#u32 := by
    dsimp [F]
    rw [htotal0]
    rfl
  have hsig0 := hsig
  dsimp [F] at hsig0
  have hexpbits : F.EXP_BITS = ok 11#u32 := by
    dsimp [F]
    rw [hbits0, hsig0]
    rfl
  have hexpbits0 := hexpbits
  dsimp [F] at hexpbits0
  have hexpsat : F.EXP_SAT = ok 2047#u32 := by
    dsimp [F]
    rw [hexpbits0]
    rfl
  have hexpsat0 := hexpsat
  dsimp [F] at hexpsat0
  have hinf : F.INFINITE_POWER = ok 2047#i32 := by
    dsimp [F]
    rw [hexpsat0]
    rfl
  have hbias : F.EXP_BIAS = ok 1023#u32 := by
    dsimp [F]
    rw [hexpsat0]
    rfl
  have hbias0 := hbias
  dsimp [F] at hbias0
  have hmin : F.EXP_MIN = ok (-1022)#i32 := by
    dsimp [F]
    rw [hbias0]
    rfl
  have hsmall : F.SMALLEST_POWER_OF_TEN = ok (-342)#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
  have hlarge : F.LARGEST_POWER_OF_TEN = ok 308#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def]
  have hroundmin : F.MIN_EXPONENT_ROUND_TO_EVEN = ok (-4)#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MIN_EXPONENT_ROUND_TO_EVEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MIN_EXPONENT_ROUND_TO_EVEN.eq_def]
  have hroundmax : F.MAX_EXPONENT_ROUND_TO_EVEN = ok 23#i32 := by
    change ok F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MAX_EXPONENT_ROUND_TO_EVEN = _
    rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.MAX_EXPONENT_ROUND_TO_EVEN.eq_def]
  exact ⟨hbits, htotal, hsig, hexpbits, hexpsat, hinf, hbias, hmin,
    hsmall, hlarge, hroundmin, hroundmax⟩

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (79)
More program dependencies (37)
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 73 entries
Technical checking records
Local closure summary
{
  "node": "ParserExponentConstants",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "ae1de8270f178cd52f809f57066928e400d68c7de944e53f3a8ae9cc4b7d005d",
  "active_statement_hash": "54ddb8ef3f220a559986d142878ab020eada03b2e29eb4e9c38e286d945634c9",
  "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-132",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "Binary64ModelDefault": "c722a2c00805b545",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS": "cfedcf26d6dae341",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN": "2532cbe447dc07c7",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN": "00627f5fdfb01b16",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN": "4b74105a95f2b02f",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN": "8a9e3dfa7e9aa5ec",
    "num_imp_traits_Float_EXP_BIAS_default": "39417be39e20ce5d",
    "num_imp_traits_Float_EXP_BITS_default": "9ab622d85ef04d94",
    "num_imp_traits_Float_EXP_MIN_default": "39417be39e20ce5d",
    "num_imp_traits_Float_EXP_SAT_default": "9ab622d85ef04d94",
    "num_imp_traits_Float_SIG_BITS_default": "9ab622d85ef04d94"
  },
  "strict_definition_deps": {
    "Binary64Model": "c43614ff2149ecf2",
    "Binary64ModelDefault": "dc548d1e27696ba4",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS": "d9fd91641cb78c5e",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN": "e23324c94fa5d1b5",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN": "3dbd3f15a918cb2c",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN": "e508b987ade7bf71",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN": "0c461c0c4f5aa880",
    "ModelF64MantissaDigits": "9ceb415358831f73",
    "Preamble": "1f712bede6a5dae6",
    "core_num_FpCategory": "f500de642a5d5148",
    "num_imp_traits_Float": "e6fdcaf2f38244d3"
  }
}
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:373a1467f84db7b82bc88a7950f12e631310fd2c3f756969eeddf1eea869885c",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}