P13_T1_NativeCorrectOrDefer

Lean checked

Statement

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

Theorem

For every Decimal record d, with arbitrary values of all four fields, any normal return of the specialized try_fast_path is either None or Some of the nearest-even binary64 rounding of the exact real magnitude d.\mathit{mantissa}\,10^{d.\mathit{exponent}} with d.\mathit{negative} applied. A Some result also implies d.\mathit{many\_digits}=\texttt{false}. The operation is the native field of ActualDispatchOperations; this includes both ordinary and disguised native paths, without a reachability or fast-path-guard premise. Rounding and sign application are DecimalGoalVocabularyDefault, including signed zero and infinity. No termination claim is made for outer failure or divergence.

Lean statement

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

import Tablet.DecimalGoalVocabularyDefault
import Tablet.P9_T1_ActualDispatchOperations
import Tablet.Binary64FastPathGuard
import Tablet.Binary64IntPow10Index
import Tablet.Binary64ApplySign
import Tablet.P14_NativeMultiplyRounding
import Tablet.P14_NativeDivideRounding

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

namespace dec2flt_model

-- [TABLET NODE: P13_T1_NativeCorrectOrDefer]
theorem P13_T1_NativeCorrectOrDefer :
    forall (d : num.imp.dec2flt.decimal.Decimal) (r : Option F64),
      P9_T1_ActualDispatchOperations.native d = ok r ->
      r = none ∨ exists f magnitude : F64,
        r = some f ∧ d.many_digits = false ∧
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude ∧
        DecimalGoalVocabularyDefault.signedMagnitude d.negative 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

Use the native projection of ActualDispatchOperations and unfold num imp dec2flt decimal Decimal try fast path at its selected f64 instances. The precision-setting operation num imp dec2flt fpu fpu precision set precision returns unit normally. By Binary64FastPathGuard, the guard returns normally and is true exactly when -22\le q\le37, w\le2^{53} and many_digits is false, where q=d.\mathit{exponent} and w=d.\mathit{mantissa}. If it is false, the extracted branch returns None; equality with the given normal result forces r=\texttt{None}. Hence it remains to treat a true guard, and the many-digits conclusion is already established in every remaining case.
The ordinary maximum exponent is 22 by F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT FAST PATH. If q\le22, the function first converts w and then branches on q<0. For q<0, -22\le q\le-1, so checked I64 negation succeeds with -q\in[1,22], without encountering I64 minimum. Casting this nonnegative value to Usize is exact on the retained 64-bit target and supplies an index i=-q\le22. Apply P14 NativeDivideRounding with v=w. Its successful conversion and table lookup are precisely the two calls in the extracted branch, and its successful division supplies a clear-sign magnitude rounding w10^{-i}=w10^q. For q\ge0, the same cast is exact with i=q\le22. Apply P14 NativeMultiplyRounding with v=w. The conversion, lookup and multiplication calls therefore return a clear-sign magnitude rounding w10^i=w10^q. In both cases these equations identify the rounded value with decimalMagnitude in DecimalGoalVocabularyDefault.
If q>22, the true guard gives 23\le q\le37. The checked subtraction s=q-22 has 1\le s\le15, well within I64, and its cast to Usize is exact. By Binary64IntPow10Index, indexing the 16-entry integer-power table at s returns normally with exactly 10^s. The extracted U64 checked multiplication either returns None, in which case ModelOptionBranch selects its residual branch and ModelOptionFromResidual returns None, or returns Some of a word v. The unsigned checked-multiplication specification in the imported scalar background then gives the exact mathematical equality v=w10^s, not a wrapping equality. The residual case again forces the given result to be None.
In the successful-product case the extracted next test compares v against 2^{53}. The significand constant is 53 by F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS; the selected Lemire maximum-mantissa computation shifts U64 one by 53, a legal shift returning exactly 2^{53}, by F64 Insts Dec2flt modelNumImpDec2fltLemireU64 and num imp dec2flt Lemire MAX MANTISSA FAST PATH default. If v>2^{53} the function returns None. Otherwise the retained ordinary exponent 22 casts exactly to Usize and P14 NativeMultiplyRounding applies to v and index 22. It gives the successful conversion, lookup and multiplication, and a clear-sign magnitude rounding v10^{22}. In the reals, v10^{22}=(w10^s)10^{22}=w10^{s+22}=w10^q. This uses the exact checked-product equality and the nonzero base 10, so there is no intermediate floating rounding of w10^s before conversion.
For every surviving branch, Binary64ApplySign applies to the obtained clear-sign magnitude. The selected negation instance F64 Insts CoreOpsArithNegF64 uses ModelF64Neg; therefore this lemma's successful conditional sign computation is exactly the last source computation. It returns Some of f with the signedMagnitude relation for d.\mathit{negative}. Likewise the selected multiplication and division instances F64 Insts CoreOpsArithMulF64F64 and F64 Insts CoreOpsArithDivF64F64 use ModelF64Mul and ModelF64Div, so all rewritten arithmetic calls above are the actual modeled calls, not abstract completions. Each successful bind can now be substituted into the extracted computation. Injectivity of the outer normal-result constructor identifies the given r with Some of this f. The rounding and sign relations obtained above give all four existential conclusions, including the zero-mantissa case handled by the scaling lemma. No property of dispatcher reachability, and no claimed result of a failed or diverging computation, is used.

Lean proof


  intro d r h
  obtain ⟨b, hb, hguard⟩ := Binary64FastPathGuard d
  change num.imp.dec2flt.decimal.Decimal.try_fast_path
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
    F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
    F64.Insts.CoreOpsArithNegF64 d = ok r at h
  unfold num.imp.dec2flt.decimal.Decimal.try_fast_path at h
  simp only [num.imp.dec2flt.fpu.fpu_precision.set_precision, bind_tc_ok] at h
  rw [hb] at h
  cases b with
  | false =>
    exact Or.inl (Result.ok.inj h).symm
  | true =>
    obtain ⟨hqMin, hqMax, hv, hmany⟩ := hguard.mp rfl
    simp only [if_true, bind_tc_ok] at h
    rw [F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH.eq_def] at h
    have finish : forall magnitude : F64, magnitude.val < 2 ^ 63 ->
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude ->
        (if d.negative then
          do let f <- ModelF64Neg magnitude; ok (some f)
         else ok (some magnitude)) = ok r ->
        r = none ∨ exists f magnitude : F64,
          r = some f /\ d.many_digits = false /\
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude /\
          DecimalGoalVocabularyDefault.signedMagnitude d.negative magnitude f := by
      intro magnitude hclear hround hreturn
      obtain ⟨f, hf, hsign⟩ := Binary64ApplySign d.negative magnitude hclear
      rw [hf] at hreturn
      exact Or.inr ⟨f, magnitude, (Result.ok.inj hreturn).symm, hmany, hround, hsign⟩
    by_cases ordinary : d.exponent.val <= 22
    · have hordinary : d.exponent <= 22#i64 := ordinary
      simp only [hordinary, if_true] at h
      by_cases negativeExponent : d.exponent.val < 0
      · have hnegativeExponent : d.exponent < 0#i64 := negativeExponent
        simp only [hnegativeExponent, if_true] at h
        obtain ⟨q, hq, hqVal⟩ := WP.spec_imp_exists
          (IScalar.neg_step d.exponent (by scalar_tac))
        change (-. d.exponent) = ok q at hq
        have qVal : q.val = -d.exponent.val := hqVal
        obtain ⟨i, hi, hiVal⟩ := WP.spec_imp_exists
          (IScalar.hcast_inBounds_spec .Usize q (by scalar_tac))
        have indexBound : i.val <= 22 := by omega
        obtain ⟨a, p, m, ha, hp, hm, hclear, hround⟩ :=
          P14_NativeDivideRounding d.mantissa i hv indexBound
        change F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64 d.mantissa = ok a at ha
        rw [ha] at h
        simp only [bind_tc_ok] at h
        rw [hq] at h
        simp only [bind_tc_ok] at h
        rw [hi] at h
        simp only [bind_tc_ok] at h
        rw [hp] at h
        simp only [bind_tc_ok] at h
        change F64.Insts.CoreOpsArithDivF64F64.div a p = ok m at hm
        rw [hm] at h
        simp only [bind_tc_ok] at h
        have exponentEq : -(i.val : Int) = d.exponent.val := by omega
        rw [exponentEq] at hround
        exact finish m hclear (by simpa only [DecimalGoalVocabularyDefault] using hround) h
      · have hnegativeExponent : ¬ d.exponent < 0#i64 := negativeExponent
        simp only [hnegativeExponent, if_false] at h
        obtain ⟨i, hi, hiVal⟩ := WP.spec_imp_exists
          (IScalar.hcast_inBounds_spec .Usize d.exponent (by scalar_tac))
        have indexBound : i.val <= 22 := by omega
        obtain ⟨a, p, m, ha, hp, hm, hclear, hround⟩ :=
          P14_NativeMultiplyRounding d.mantissa i hv indexBound
        change F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64 d.mantissa = ok a at ha
        rw [ha] at h
        simp only [bind_tc_ok] at h
        rw [hi] at h
        simp only [bind_tc_ok] at h
        rw [hp] at h
        simp only [bind_tc_ok] at h
        change F64.Insts.CoreOpsArithMulF64F64.mul a p = ok m at hm
        rw [hm] at h
        simp only [bind_tc_ok] at h
        rw [hiVal] at hround
        exact finish m hclear (by simpa only [DecimalGoalVocabularyDefault] using hround) h
    · have hordinary : ¬ d.exponent <= 22#i64 := ordinary
      simp only [hordinary, if_false] at h
      obtain ⟨shift, hshift, hshiftVal⟩ := WP.spec_imp_exists
        (IScalar.sub_spec (x := d.exponent) (y := 22#i64) (by scalar_tac) (by scalar_tac))
      have shiftVal : shift.val = d.exponent.val - 22 := hshiftVal
      rw [hshift] at h
      simp only [bind_tc_ok] at h
      obtain ⟨index, hindex, hindexVal⟩ := WP.spec_imp_exists
        (IScalar.hcast_inBounds_spec .Usize shift (by scalar_tac))
      rw [hindex] at h
      simp only [bind_tc_ok] at h
      have indexBound : index.val <= 15 := by omega
      obtain ⟨power, hpower, hpowerVal⟩ := Binary64IntPow10Index index indexBound
      rw [hpower] at h
      simp only [bind_tc_ok, lift] at h
      cases hproduct : U64.checked_mul d.mantissa power with
      | none =>
        rw [hproduct] at h
        simp only [core.option.Option.Insts.CoreOpsTry_traitTry.branch,
          ModelOptionBranch, core.option.Option.Insts.CoreOpsTry_traitFromResidualOptionInfallible.from_residual,
          ModelOptionFromResidual, bind_tc_ok] at h
        exact Or.inl (Result.ok.inj h).symm
      | some v =>
        rw [hproduct] at h
        rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def] at h
        change (if v > 9007199254740992#u64 then ok none else _) = ok r at h
        by_cases tooLarge : v.val > 2 ^ 53
        · have htooLarge : v > 9007199254740992#u64 := tooLarge
          simp only [htooLarge, if_true] at h
          exact Or.inl (Result.ok.inj h).symm
        · have htooLarge : ¬ v > 9007199254740992#u64 := tooLarge
          simp only [htooLarge, if_false] at h
          obtain ⟨a, p, m, ha, hp, hm, hclear, hround⟩ :=
            P14_NativeMultiplyRounding v 22#usize (by omega) (by norm_num)
          change F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64 v = ok a at ha
          rw [ha] at h
          simp only [bind_tc_ok] at h
          have cast22 : IScalar.hcast .Usize 22#i64 = 22#usize := by
            have spec := IScalar.hcast_inBounds_spec .Usize 22#i64 (by scalar_tac)
            simp only [lift, WP.spec_ok] at spec
            apply UScalar.eq_of_val_eq
            change (IScalar.hcast .Usize 22#i64).val = 22
            change ((IScalar.hcast .Usize 22#i64).val : Int) = 22 at spec
            omega
          rw [cast22] at h
          change (do
            let p <- F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.pow10_fast_path 22#usize
            let m <- F64.Insts.CoreOpsArithMulF64F64.mul a p
            if d.negative then
              do let f <- ModelF64Neg m; ok (some f)
            else ok (some m)) = ok r at h
          rw [hp] at h
          simp only [bind_tc_ok] at h
          change F64.Insts.CoreOpsArithMulF64F64.mul a p = ok m at hm
          rw [hm] at h
          simp only [bind_tc_ok] at h
          have vVal : v.val = d.mantissa.val * 10 ^ index.val := by
            have spec := U64.checked_mul_bv_spec d.mantissa power
            rw [hproduct] at spec
            simpa only [hpowerVal] using spec.2.1
          have exponentEq : (index.val : Int) + 22 = d.exponent.val := by omega
          have magnitudeEq : (v.val : Real) * (10 : Real) ^ (22 : Int) =
              DecimalGoalVocabularyDefault.decimalMagnitude d := by
            change _ = (d.mantissa.val : Real) * (10 : Real) ^ d.exponent.val
            rw [vVal, Nat.cast_mul, Nat.cast_pow, mul_assoc]
            simp only [Nat.cast_ofNat]
            rw [← zpow_natCast, ← zpow_add₀ (by norm_num : (10 : Real) ≠ 0), exponentEq]
          have index22Value : ((22#usize).val : Int) = 22 := by norm_num
          rw [index22Value] at hround
          rw [magnitudeEq] at hround
          exact finish m hclear hround h

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.P9_T1_ActualDispatchOperations
import Tablet.Binary64FastPathGuard
import Tablet.Binary64IntPow10Index
import Tablet.Binary64ApplySign
import Tablet.P14_NativeMultiplyRounding
import Tablet.P14_NativeDivideRounding

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

namespace dec2flt_model

-- [TABLET NODE: P13_T1_NativeCorrectOrDefer]
theorem P13_T1_NativeCorrectOrDefer :
    forall (d : num.imp.dec2flt.decimal.Decimal) (r : Option F64),
      P9_T1_ActualDispatchOperations.native d = ok r ->
      r = none ∨ exists f magnitude : F64,
        r = some f ∧ d.many_digits = false ∧
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude ∧
        DecimalGoalVocabularyDefault.signedMagnitude d.negative magnitude f := by
-- BODY
  intro d r h
  obtain ⟨b, hb, hguard⟩ := Binary64FastPathGuard d
  change num.imp.dec2flt.decimal.Decimal.try_fast_path
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
    F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
    F64.Insts.CoreOpsArithNegF64 d = ok r at h
  unfold num.imp.dec2flt.decimal.Decimal.try_fast_path at h
  simp only [num.imp.dec2flt.fpu.fpu_precision.set_precision, bind_tc_ok] at h
  rw [hb] at h
  cases b with
  | false =>
    exact Or.inl (Result.ok.inj h).symm
  | true =>
    obtain ⟨hqMin, hqMax, hv, hmany⟩ := hguard.mp rfl
    simp only [if_true, bind_tc_ok] at h
    rw [F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH.eq_def] at h
    have finish : forall magnitude : F64, magnitude.val < 2 ^ 63 ->
        DecimalGoalVocabularyDefault.roundsMagnitude
          (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude ->
        (if d.negative then
          do let f <- ModelF64Neg magnitude; ok (some f)
         else ok (some magnitude)) = ok r ->
        r = none ∨ exists f magnitude : F64,
          r = some f /\ d.many_digits = false /\
          DecimalGoalVocabularyDefault.roundsMagnitude
            (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude /\
          DecimalGoalVocabularyDefault.signedMagnitude d.negative magnitude f := by
      intro magnitude hclear hround hreturn
      obtain ⟨f, hf, hsign⟩ := Binary64ApplySign d.negative magnitude hclear
      rw [hf] at hreturn
      exact Or.inr ⟨f, magnitude, (Result.ok.inj hreturn).symm, hmany, hround, hsign⟩
    by_cases ordinary : d.exponent.val <= 22
    · have hordinary : d.exponent <= 22#i64 := ordinary
      simp only [hordinary, if_true] at h
      by_cases negativeExponent : d.exponent.val < 0
      · have hnegativeExponent : d.exponent < 0#i64 := negativeExponent
        simp only [hnegativeExponent, if_true] at h
        obtain ⟨q, hq, hqVal⟩ := WP.spec_imp_exists
          (IScalar.neg_step d.exponent (by scalar_tac))
        change (-. d.exponent) = ok q at hq
        have qVal : q.val = -d.exponent.val := hqVal
        obtain ⟨i, hi, hiVal⟩ := WP.spec_imp_exists
          (IScalar.hcast_inBounds_spec .Usize q (by scalar_tac))
        have indexBound : i.val <= 22 := by omega
        obtain ⟨a, p, m, ha, hp, hm, hclear, hround⟩ :=
          P14_NativeDivideRounding d.mantissa i hv indexBound
        change F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64 d.mantissa = ok a at ha
        rw [ha] at h
        simp only [bind_tc_ok] at h
        rw [hq] at h
        simp only [bind_tc_ok] at h
        rw [hi] at h
        simp only [bind_tc_ok] at h
        rw [hp] at h
        simp only [bind_tc_ok] at h
        change F64.Insts.CoreOpsArithDivF64F64.div a p = ok m at hm
        rw [hm] at h
        simp only [bind_tc_ok] at h
        have exponentEq : -(i.val : Int) = d.exponent.val := by omega
        rw [exponentEq] at hround
        exact finish m hclear (by simpa only [DecimalGoalVocabularyDefault] using hround) h
      · have hnegativeExponent : ¬ d.exponent < 0#i64 := negativeExponent
        simp only [hnegativeExponent, if_false] at h
        obtain ⟨i, hi, hiVal⟩ := WP.spec_imp_exists
          (IScalar.hcast_inBounds_spec .Usize d.exponent (by scalar_tac))
        have indexBound : i.val <= 22 := by omega
        obtain ⟨a, p, m, ha, hp, hm, hclear, hround⟩ :=
          P14_NativeMultiplyRounding d.mantissa i hv indexBound
        change F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64 d.mantissa = ok a at ha
        rw [ha] at h
        simp only [bind_tc_ok] at h
        rw [hi] at h
        simp only [bind_tc_ok] at h
        rw [hp] at h
        simp only [bind_tc_ok] at h
        change F64.Insts.CoreOpsArithMulF64F64.mul a p = ok m at hm
        rw [hm] at h
        simp only [bind_tc_ok] at h
        rw [hiVal] at hround
        exact finish m hclear (by simpa only [DecimalGoalVocabularyDefault] using hround) h
    · have hordinary : ¬ d.exponent <= 22#i64 := ordinary
      simp only [hordinary, if_false] at h
      obtain ⟨shift, hshift, hshiftVal⟩ := WP.spec_imp_exists
        (IScalar.sub_spec (x := d.exponent) (y := 22#i64) (by scalar_tac) (by scalar_tac))
      have shiftVal : shift.val = d.exponent.val - 22 := hshiftVal
      rw [hshift] at h
      simp only [bind_tc_ok] at h
      obtain ⟨index, hindex, hindexVal⟩ := WP.spec_imp_exists
        (IScalar.hcast_inBounds_spec .Usize shift (by scalar_tac))
      rw [hindex] at h
      simp only [bind_tc_ok] at h
      have indexBound : index.val <= 15 := by omega
      obtain ⟨power, hpower, hpowerVal⟩ := Binary64IntPow10Index index indexBound
      rw [hpower] at h
      simp only [bind_tc_ok, lift] at h
      cases hproduct : U64.checked_mul d.mantissa power with
      | none =>
        rw [hproduct] at h
        simp only [core.option.Option.Insts.CoreOpsTry_traitTry.branch,
          ModelOptionBranch, core.option.Option.Insts.CoreOpsTry_traitFromResidualOptionInfallible.from_residual,
          ModelOptionFromResidual, bind_tc_ok] at h
        exact Or.inl (Result.ok.inj h).symm
      | some v =>
        rw [hproduct] at h
        rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def] at h
        change (if v > 9007199254740992#u64 then ok none else _) = ok r at h
        by_cases tooLarge : v.val > 2 ^ 53
        · have htooLarge : v > 9007199254740992#u64 := tooLarge
          simp only [htooLarge, if_true] at h
          exact Or.inl (Result.ok.inj h).symm
        · have htooLarge : ¬ v > 9007199254740992#u64 := tooLarge
          simp only [htooLarge, if_false] at h
          obtain ⟨a, p, m, ha, hp, hm, hclear, hround⟩ :=
            P14_NativeMultiplyRounding v 22#usize (by omega) (by norm_num)
          change F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64 v = ok a at ha
          rw [ha] at h
          simp only [bind_tc_ok] at h
          have cast22 : IScalar.hcast .Usize 22#i64 = 22#usize := by
            have spec := IScalar.hcast_inBounds_spec .Usize 22#i64 (by scalar_tac)
            simp only [lift, WP.spec_ok] at spec
            apply UScalar.eq_of_val_eq
            change (IScalar.hcast .Usize 22#i64).val = 22
            change ((IScalar.hcast .Usize 22#i64).val : Int) = 22 at spec
            omega
          rw [cast22] at h
          change (do
            let p <- F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.pow10_fast_path 22#usize
            let m <- F64.Insts.CoreOpsArithMulF64F64.mul a p
            if d.negative then
              do let f <- ModelF64Neg m; ok (some f)
            else ok (some m)) = ok r at h
          rw [hp] at h
          simp only [bind_tc_ok] at h
          change F64.Insts.CoreOpsArithMulF64F64.mul a p = ok m at hm
          rw [hm] at h
          simp only [bind_tc_ok] at h
          have vVal : v.val = d.mantissa.val * 10 ^ index.val := by
            have spec := U64.checked_mul_bv_spec d.mantissa power
            rw [hproduct] at spec
            simpa only [hpowerVal] using spec.2.1
          have exponentEq : (index.val : Int) + 22 = d.exponent.val := by omega
          have magnitudeEq : (v.val : Real) * (10 : Real) ^ (22 : Int) =
              DecimalGoalVocabularyDefault.decimalMagnitude d := by
            change _ = (d.mantissa.val : Real) * (10 : Real) ^ d.exponent.val
            rw [vVal, Nat.cast_mul, Nat.cast_pow, mul_assoc]
            simp only [Nat.cast_ofNat]
            rw [← zpow_natCast, ← zpow_add₀ (by norm_num : (10 : Real) ≠ 0), exponentEq]
          have index22Value : ((22#usize).val : Int) = 22 := by norm_num
          rw [index22Value] at hround
          rw [magnitudeEq] at hround
          exact finish m hclear hround h

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (198)
More program dependencies (156)
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 160 entries
Technical checking records
Local closure summary
{
  "node": "P13_T1_NativeCorrectOrDefer",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "ee338da8cafe7befb4d34cc895e4442811bad86c46b1f01fdd3475824e5ae4a9",
  "active_statement_hash": "5911f74ba1f2fe57145301dae765e1590bb7c885b2378b5cd002d071974b738f",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "576e6bf9480cfd32f53c309c7ac8fb115c1ba6e413f299ed5ff9fa7c647e6769",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-199",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "Binary64ApplySign": "d55a8c73d5261f86",
    "Binary64FastPathGuard": "c1391b605f3cfebb",
    "Binary64IntPow10Index": "335765edc9734a2e",
    "DecimalGoalVocabularyDefault": "2bbf2be48b5a4a4b",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH": "6bf5ea9f18f5e8dc",
    "P14_NativeDivideRounding": "1b9eb29cb2f0528e",
    "P14_NativeMultiplyRounding": "6ba584cabf2f30bd",
    "num_imp_dec2flt_Lemire_MAX_MANTISSA_FAST_PATH_default": "32d9110750ebf062",
    "num_imp_dec2flt_decimal_Decimal_try_fast_path": "acdc05e301fae675"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "91e42e6d78c02c8e",
    "DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
    "DecimalLexeme": "303e59678842cea4",
    "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_FAST_PATH": "c8b07a02533b83c6",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_pow10_fast_path": "c0ce6fdd5caeca22",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
    "ModelF64Div": "f8da2e585a4f4183",
    "ModelF64FromU64": "97a26f5bc593ff7a",
    "ModelF64Mul": "ba97971db93c2ae2",
    "ModelF64Neg": "78a021de99eb373b",
    "ModelOptionBranch": "2b227898dbe15e59",
    "ModelOptionFromResidual": "6d48ecfbc617744f",
    "P9_T1_ActualDispatchOperations": "d8bf51ebbbf153ac",
    "P9_T1_DispatchOperations": "064b44803eb69a33",
    "Preamble": "1f712bede6a5dae6",
    "core_ops_arith_Div": "2704fb3c3065e0f5",
    "core_ops_arith_Mul": "91e8d5ef661a3d2a",
    "core_ops_arith_Neg": "0ff07135a60bcbf9",
    "num_imp_dec2flt_Lemire": "0ca3e3730e543f9e",
    "num_imp_dec2flt_common_BiasedFp": "5c88d5d7976c5e8f",
    "num_imp_dec2flt_decimal_Decimal": "c43614ff2149ecf2",
    "num_imp_dec2flt_decimal_Decimal_can_use_fast_path": "11145d187f88b02e",
    "num_imp_dec2flt_decimal_Decimal_try_fast_path": "2e4888f65a06b49f",
    "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:ebc34fde384a29a389dd71a157b1b2ff4779596128446faee3f820de49c63d7c",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}