ParserSlowExponentRange

Lean checked

Statement

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

Helper

For every byte slice and biased pair b, if the extracted binary64 slow conversion parse_long_mantissa returns b normally, then b's signed biased-exponent field lies in the inclusive interval [0,2047].

Lean statement

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

import Tablet.ParserExponentConstants
import Tablet.ParserSlowLoopZeroResult
import Tablet.ParserSlowLoopInfinityResult
import Tablet.ParserSlowLoopMinimumExponent

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserSlowExponentRange]
theorem ParserSlowExponentRange (s : Slice U8)
    (b : num.imp.dec2flt.common.BiasedFp)
    (h : num.imp.dec2flt.slow.parse_long_mantissa
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 s = ok b) :
    0 ≤ b.p_biased.val ∧ b.p_biased.val ≤ 2047 := 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 binary64 values in ParserExponentConstants: infinite power is 2047, minimum exponent is -1022, and significand width is 52. Unfold num imp dec2flt slow parse long mantissa and invert each successful result bind. The eager sentinels have exponent 0 and 2047. After decimal parsing, zero digits and a decimal point below -324 return the zero sentinel, while a point at least 310 returns the infinity sentinel.
On the remaining path, apply ParserSlowLoopZeroResult. A present loop-0 result is exactly the zero sentinel; otherwise proceed to loop 1. Apply ParserSlowLoopInfinityResult. A present loop-1 result is exactly the infinity sentinel; otherwise invert the checked decrement and the loop-2 call. By ParserSlowLoopMinimumExponent, the returned exponent e satisfies e\ge-1022.
The next two successful checked operations compute x=e-(-1022)+1, so x\ge1. If x\ge2047, the result is the infinity sentinel. Otherwise 1\le x<2047. Invert the exact cast of 52 to a machine index, its checked increment to 53, the decimal left shift and round, the checked unsigned increment 52+1, and the legal scalar shift by the resulting count.
If rounding does not carry, the code recomputes p=e-(-1022)+1=x. Its final mantissa comparison either returns p or the successful checked value p-1. Thus the exponent is respectively in [1,2046] or [0,2045]. The remaining shifts by 52, mask subtraction, and conjunction must return normally on the assumed path and do not change the exponent.
If rounding carries, invert the decimal right shift, the successful exponent increment e'=e+1, and the second rounding. The guarded candidate is x'=e'-(-1022)+1=x+1\ge2. If x'\ge2047, the infinity sentinel is returned. Otherwise the code recomputes p=x', then returns either p or the successful checked value p-1 according to the mantissa comparison. Those alternatives lie in [2,2046] and [1,2045]. The final mask operations again affect only the mantissa. Every failure or divergence among the inverted casts, additions, subtractions, shifts, decimal operations, and rounds would propagate instead of producing the assumed normal result. Consequently all successful exits have exponent in [0,2047].

Lean proof


  have bind_ok_inv : ∀ {α β : Type} (r : Result α) (f : α → Result β) y,
      Bind.bind r f = ok y → ∃ x, r = ok x ∧ f x = ok y := by
    intro α β r f y hr
    cases r with
    | fail err => simp [Bind.bind, Aeneas.Std.bind] at hr
    | div => simp [Bind.bind, Aeneas.Std.bind] at hr
    | ok x => exact ⟨x, rfl, hr⟩
  rcases ParserExponentConstants with
    ⟨hbits, htotal, hsig, hexpbits, hexpsat, hinf, hbias, hmin,
      hsmall, hlarge, hroundmin, hroundmax⟩
  have hzero : num.imp.dec2flt.common.BiasedFp.zero_pow2 0#i32 =
      ok { m := 0#u64, p_biased := 0#i32 } := by rfl
  have hinfFp : num.imp.dec2flt.common.BiasedFp.zero_pow2 2047#i32 =
      ok { m := 0#u64, p_biased := 2047#i32 } := by rfl
  unfold num.imp.dec2flt.slow.parse_long_mantissa at h
  rw [hzero, hinf] at h
  simp only [bind_tc_ok] at h
  rw [hinfFp] at h
  simp only [bind_tc_ok] at h
  obtain ⟨d, hd, h⟩ := bind_ok_inv _ _ _ h
  by_cases hempty : d.num_digits = 0#usize
  · simp only [hempty, if_true] at h
    cases h
    norm_num
  simp only [hempty, if_false] at h
  by_cases hsmallp : d.decimal_point < (-324)#i32
  · simp only [hsmallp, if_true] at h
    cases h
    norm_num
  simp only [hsmallp, if_false] at h
  by_cases hlargep : d.decimal_point ≥ 310#i32
  · simp only [hlargep, if_true] at h
    cases h
    norm_num
  simp only [hlargep, if_false] at h
  obtain ⟨out0, hout0, h⟩ := bind_ok_inv _ _ _ h
  rcases out0 with ⟨i1, i2, t, a, exp2, lr0⟩
  have hlr0 := ParserSlowLoopZeroResult
    F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
    ({ m := 0#u64, p_biased := 0#i32 } :
      num.imp.dec2flt.common.BiasedFp)
    d.num_digits d.decimal_point d.truncated d.digits 0#i32
    (i1, i2, t, a, exp2, lr0) hout0
  cases lr0 with
  | some result =>
    rcases hlr0 with hnone | hsome
    · contradiction
    · simp only [Option.some.injEq] at hsome
      subst result
      cases h
      norm_num
  | none =>
    obtain ⟨out1, hout1, h⟩ := bind_ok_inv _ _ _ h
    rcases out1 with ⟨i3, i4, t1, a1, exp21, lr1⟩
    have hlr1 := ParserSlowLoopInfinityResult
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
      ({ m := 0#u64, p_biased := 2047#i32 } :
        num.imp.dec2flt.common.BiasedFp)
      i1 i2 t a exp2 (i3, i4, t1, a1, exp21, lr1) hout1
    cases lr1 with
    | some result =>
      rcases hlr1 with hnone | hsome
      · contradiction
      · simp only [Option.some.injEq] at hsome
        subst result
        cases h
        norm_num
    | none =>
      obtain ⟨exp22, hexp22, h⟩ := bind_ok_inv _ _ _ h
      obtain ⟨out2, hout2, h⟩ := bind_ok_inv _ _ _ h
      rcases out2 with ⟨d1, exp23⟩
      have hexp23 : -1022 ≤ exp23.val :=
        ParserSlowLoopMinimumExponent _ _ _ hout2
      change (do
        let i5 ← F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.EXP_MIN
        _) = ok b at h
      rw [hmin] at h
      simp only [bind_tc_ok] at h
      obtain ⟨i6, hi6, h⟩ := bind_ok_inv _ _ _ h
      obtain ⟨i7, hi7, h⟩ := bind_ok_inv _ _ _ h
      have hi6v : i6.val = exp23.val - (-1022) := by
        have he := IScalar.sub_equiv exp23 ((-1022)#i32)
        rw [hi6] at he
        exact he.2.1
      have hi7v : i7.val = i6.val + 1 := by
        have he := IScalar.add_equiv i6 (1#i32)
        rw [hi7] at he
        exact he.2.1
      by_cases hsat : i7 ≥ 2047#i32
      · simp only [hsat, if_true] at h
        cases h
        norm_num
      · simp only [hsat, if_false] at h
        change (do
          let i8 ← F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_BITS
          _) = ok b at h
        rw [hsig] at h
        simp only [lift, bind_tc_ok] at h
        obtain ⟨i9, hi9, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨i10, hi10, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨d2, hd2, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨mantissa, hmantissa, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨i11, hi11, h⟩ := bind_ok_inv _ _ _ h
        by_cases hcarry : d2 ≥ i11
        · simp only [hcarry, if_true] at h
          obtain ⟨d3, hd3, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨exp24, hexp24, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨mantissa1, hmantissa1, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i13, hi13, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
          by_cases hsat2 : i14 ≥ 2047#i32
          · simp only [hsat2, if_true] at h
            cases h
            norm_num
          · simp only [hsat2, if_false] at h
            obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i16, hi16, h⟩ := bind_ok_inv _ _ _ h
            by_cases hlow : mantissa1 < i16
            · simp only [hlow, if_true] at h
              obtain ⟨power21, hpower21, h⟩ := bind_ok_inv _ _ _ h
              obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
              obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
              cases h
              change 0 ≤ power21.val ∧ power21.val ≤ 2047
              have hexp24v : exp24.val = exp23.val + 1 := by
                have he := IScalar.add_equiv exp23 (1#i32)
                rw [hexp24] at he
                exact he.2.1
              have hi13v : i13.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi13] at he
                exact he.2.1
              have hi14v : i14.val = i13.val + 1 := by
                have he := IScalar.add_equiv i13 (1#i32)
                rw [hi14] at he
                exact he.2.1
              have hi15v : i15.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi15] at he
                exact he.2.1
              have hpower2v : power2.val = i15.val + 1 := by
                have he := IScalar.add_equiv i15 (1#i32)
                rw [hpower2] at he
                exact he.2.1
              have hpower21v : power21.val = power2.val - 1 := by
                have he := IScalar.sub_equiv power2 (1#i32)
                rw [hpower21] at he
                exact he.2.1
              change ¬ 2047 ≤ i14.val at hsat2
              constructor <;> omega
            · simp only [hlow, if_false, bind_tc_ok] at h
              obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
              obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
              cases h
              change 0 ≤ power2.val ∧ power2.val ≤ 2047
              have hexp24v : exp24.val = exp23.val + 1 := by
                have he := IScalar.add_equiv exp23 (1#i32)
                rw [hexp24] at he
                exact he.2.1
              have hi13v : i13.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi13] at he
                exact he.2.1
              have hi14v : i14.val = i13.val + 1 := by
                have he := IScalar.add_equiv i13 (1#i32)
                rw [hi14] at he
                exact he.2.1
              have hi15v : i15.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi15] at he
                exact he.2.1
              have hpower2v : power2.val = i15.val + 1 := by
                have he := IScalar.add_equiv i15 (1#i32)
                rw [hpower2] at he
                exact he.2.1
              change ¬ 2047 ≤ i14.val at hsat2
              constructor <;> omega
        · simp only [hcarry, if_false] at h
          obtain ⟨i13, hi13, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
          by_cases hlow : d2 < i14
          · simp only [hlow, if_true] at h
            obtain ⟨power21, hpower21, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i16, hi16, h⟩ := bind_ok_inv _ _ _ h
            cases h
            change 0 ≤ power21.val ∧ power21.val ≤ 2047
            have hi13v : i13.val = exp23.val - (-1022) := by
              have he := IScalar.sub_equiv exp23 ((-1022)#i32)
              rw [hi13] at he
              exact he.2.1
            have hpower2v : power2.val = i13.val + 1 := by
              have he := IScalar.add_equiv i13 (1#i32)
              rw [hpower2] at he
              exact he.2.1
            have hpower21v : power21.val = power2.val - 1 := by
              have he := IScalar.sub_equiv power2 (1#i32)
              rw [hpower21] at he
              exact he.2.1
            change ¬ 2047 ≤ i7.val at hsat
            constructor <;> omega
          · simp only [hlow, if_false, bind_tc_ok] at h
            obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i16, hi16, h⟩ := bind_ok_inv _ _ _ h
            cases h
            change 0 ≤ power2.val ∧ power2.val ≤ 2047
            have hi13v : i13.val = exp23.val - (-1022) := by
              have he := IScalar.sub_equiv exp23 ((-1022)#i32)
              rw [hi13] at he
              exact he.2.1
            have hpower2v : power2.val = i13.val + 1 := by
              have he := IScalar.add_equiv i13 (1#i32)
              rw [hpower2] at he
              exact he.2.1
            change ¬ 2047 ≤ i7.val at hsat
            constructor <;> omega

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.ParserExponentConstants
import Tablet.ParserSlowLoopZeroResult
import Tablet.ParserSlowLoopInfinityResult
import Tablet.ParserSlowLoopMinimumExponent

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserSlowExponentRange]
theorem ParserSlowExponentRange (s : Slice U8)
    (b : num.imp.dec2flt.common.BiasedFp)
    (h : num.imp.dec2flt.slow.parse_long_mantissa
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 s = ok b) :
    0 ≤ b.p_biased.val ∧ b.p_biased.val ≤ 2047 := by
-- BODY
  have bind_ok_inv : ∀ {α β : Type} (r : Result α) (f : α → Result β) y,
      Bind.bind r f = ok y → ∃ x, r = ok x ∧ f x = ok y := by
    intro α β r f y hr
    cases r with
    | fail err => simp [Bind.bind, Aeneas.Std.bind] at hr
    | div => simp [Bind.bind, Aeneas.Std.bind] at hr
    | ok x => exact ⟨x, rfl, hr⟩
  rcases ParserExponentConstants with
    ⟨hbits, htotal, hsig, hexpbits, hexpsat, hinf, hbias, hmin,
      hsmall, hlarge, hroundmin, hroundmax⟩
  have hzero : num.imp.dec2flt.common.BiasedFp.zero_pow2 0#i32 =
      ok { m := 0#u64, p_biased := 0#i32 } := by rfl
  have hinfFp : num.imp.dec2flt.common.BiasedFp.zero_pow2 2047#i32 =
      ok { m := 0#u64, p_biased := 2047#i32 } := by rfl
  unfold num.imp.dec2flt.slow.parse_long_mantissa at h
  rw [hzero, hinf] at h
  simp only [bind_tc_ok] at h
  rw [hinfFp] at h
  simp only [bind_tc_ok] at h
  obtain ⟨d, hd, h⟩ := bind_ok_inv _ _ _ h
  by_cases hempty : d.num_digits = 0#usize
  · simp only [hempty, if_true] at h
    cases h
    norm_num
  simp only [hempty, if_false] at h
  by_cases hsmallp : d.decimal_point < (-324)#i32
  · simp only [hsmallp, if_true] at h
    cases h
    norm_num
  simp only [hsmallp, if_false] at h
  by_cases hlargep : d.decimal_point ≥ 310#i32
  · simp only [hlargep, if_true] at h
    cases h
    norm_num
  simp only [hlargep, if_false] at h
  obtain ⟨out0, hout0, h⟩ := bind_ok_inv _ _ _ h
  rcases out0 with ⟨i1, i2, t, a, exp2, lr0⟩
  have hlr0 := ParserSlowLoopZeroResult
    F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
    ({ m := 0#u64, p_biased := 0#i32 } :
      num.imp.dec2flt.common.BiasedFp)
    d.num_digits d.decimal_point d.truncated d.digits 0#i32
    (i1, i2, t, a, exp2, lr0) hout0
  cases lr0 with
  | some result =>
    rcases hlr0 with hnone | hsome
    · contradiction
    · simp only [Option.some.injEq] at hsome
      subst result
      cases h
      norm_num
  | none =>
    obtain ⟨out1, hout1, h⟩ := bind_ok_inv _ _ _ h
    rcases out1 with ⟨i3, i4, t1, a1, exp21, lr1⟩
    have hlr1 := ParserSlowLoopInfinityResult
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
      ({ m := 0#u64, p_biased := 2047#i32 } :
        num.imp.dec2flt.common.BiasedFp)
      i1 i2 t a exp2 (i3, i4, t1, a1, exp21, lr1) hout1
    cases lr1 with
    | some result =>
      rcases hlr1 with hnone | hsome
      · contradiction
      · simp only [Option.some.injEq] at hsome
        subst result
        cases h
        norm_num
    | none =>
      obtain ⟨exp22, hexp22, h⟩ := bind_ok_inv _ _ _ h
      obtain ⟨out2, hout2, h⟩ := bind_ok_inv _ _ _ h
      rcases out2 with ⟨d1, exp23⟩
      have hexp23 : -1022 ≤ exp23.val :=
        ParserSlowLoopMinimumExponent _ _ _ hout2
      change (do
        let i5 ← F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.EXP_MIN
        _) = ok b at h
      rw [hmin] at h
      simp only [bind_tc_ok] at h
      obtain ⟨i6, hi6, h⟩ := bind_ok_inv _ _ _ h
      obtain ⟨i7, hi7, h⟩ := bind_ok_inv _ _ _ h
      have hi6v : i6.val = exp23.val - (-1022) := by
        have he := IScalar.sub_equiv exp23 ((-1022)#i32)
        rw [hi6] at he
        exact he.2.1
      have hi7v : i7.val = i6.val + 1 := by
        have he := IScalar.add_equiv i6 (1#i32)
        rw [hi7] at he
        exact he.2.1
      by_cases hsat : i7 ≥ 2047#i32
      · simp only [hsat, if_true] at h
        cases h
        norm_num
      · simp only [hsat, if_false] at h
        change (do
          let i8 ← F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_BITS
          _) = ok b at h
        rw [hsig] at h
        simp only [lift, bind_tc_ok] at h
        obtain ⟨i9, hi9, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨i10, hi10, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨d2, hd2, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨mantissa, hmantissa, h⟩ := bind_ok_inv _ _ _ h
        obtain ⟨i11, hi11, h⟩ := bind_ok_inv _ _ _ h
        by_cases hcarry : d2 ≥ i11
        · simp only [hcarry, if_true] at h
          obtain ⟨d3, hd3, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨exp24, hexp24, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨mantissa1, hmantissa1, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i13, hi13, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
          by_cases hsat2 : i14 ≥ 2047#i32
          · simp only [hsat2, if_true] at h
            cases h
            norm_num
          · simp only [hsat2, if_false] at h
            obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i16, hi16, h⟩ := bind_ok_inv _ _ _ h
            by_cases hlow : mantissa1 < i16
            · simp only [hlow, if_true] at h
              obtain ⟨power21, hpower21, h⟩ := bind_ok_inv _ _ _ h
              obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
              obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
              cases h
              change 0 ≤ power21.val ∧ power21.val ≤ 2047
              have hexp24v : exp24.val = exp23.val + 1 := by
                have he := IScalar.add_equiv exp23 (1#i32)
                rw [hexp24] at he
                exact he.2.1
              have hi13v : i13.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi13] at he
                exact he.2.1
              have hi14v : i14.val = i13.val + 1 := by
                have he := IScalar.add_equiv i13 (1#i32)
                rw [hi14] at he
                exact he.2.1
              have hi15v : i15.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi15] at he
                exact he.2.1
              have hpower2v : power2.val = i15.val + 1 := by
                have he := IScalar.add_equiv i15 (1#i32)
                rw [hpower2] at he
                exact he.2.1
              have hpower21v : power21.val = power2.val - 1 := by
                have he := IScalar.sub_equiv power2 (1#i32)
                rw [hpower21] at he
                exact he.2.1
              change ¬ 2047 ≤ i14.val at hsat2
              constructor <;> omega
            · simp only [hlow, if_false, bind_tc_ok] at h
              obtain ⟨i17, hi17, h⟩ := bind_ok_inv _ _ _ h
              obtain ⟨i18, hi18, h⟩ := bind_ok_inv _ _ _ h
              cases h
              change 0 ≤ power2.val ∧ power2.val ≤ 2047
              have hexp24v : exp24.val = exp23.val + 1 := by
                have he := IScalar.add_equiv exp23 (1#i32)
                rw [hexp24] at he
                exact he.2.1
              have hi13v : i13.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi13] at he
                exact he.2.1
              have hi14v : i14.val = i13.val + 1 := by
                have he := IScalar.add_equiv i13 (1#i32)
                rw [hi14] at he
                exact he.2.1
              have hi15v : i15.val = exp24.val - (-1022) := by
                have he := IScalar.sub_equiv exp24 ((-1022)#i32)
                rw [hi15] at he
                exact he.2.1
              have hpower2v : power2.val = i15.val + 1 := by
                have he := IScalar.add_equiv i15 (1#i32)
                rw [hpower2] at he
                exact he.2.1
              change ¬ 2047 ≤ i14.val at hsat2
              constructor <;> omega
        · simp only [hcarry, if_false] at h
          obtain ⟨i13, hi13, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨power2, hpower2, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i14, hi14, h⟩ := bind_ok_inv _ _ _ h
          by_cases hlow : d2 < i14
          · simp only [hlow, if_true] at h
            obtain ⟨power21, hpower21, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i16, hi16, h⟩ := bind_ok_inv _ _ _ h
            cases h
            change 0 ≤ power21.val ∧ power21.val ≤ 2047
            have hi13v : i13.val = exp23.val - (-1022) := by
              have he := IScalar.sub_equiv exp23 ((-1022)#i32)
              rw [hi13] at he
              exact he.2.1
            have hpower2v : power2.val = i13.val + 1 := by
              have he := IScalar.add_equiv i13 (1#i32)
              rw [hpower2] at he
              exact he.2.1
            have hpower21v : power21.val = power2.val - 1 := by
              have he := IScalar.sub_equiv power2 (1#i32)
              rw [hpower21] at he
              exact he.2.1
            change ¬ 2047 ≤ i7.val at hsat
            constructor <;> omega
          · simp only [hlow, if_false, bind_tc_ok] at h
            obtain ⟨i15, hi15, h⟩ := bind_ok_inv _ _ _ h
            obtain ⟨i16, hi16, h⟩ := bind_ok_inv _ _ _ h
            cases h
            change 0 ≤ power2.val ∧ power2.val ≤ 2047
            have hi13v : i13.val = exp23.val - (-1022) := by
              have he := IScalar.sub_equiv exp23 ((-1022)#i32)
              rw [hi13] at he
              exact he.2.1
            have hpower2v : power2.val = i13.val + 1 := by
              have he := IScalar.add_equiv i13 (1#i32)
              rw [hpower2] at he
              exact he.2.1
            change ¬ 2047 ≤ i7.val at hsat
            constructor <;> omega

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (151)
More program dependencies (109)
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 106 entries
Technical checking records
Local closure summary
{
  "node": "ParserSlowExponentRange",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "0b8d44294547ee3e2e0da2320e1216f57301d2e7b164b5c10525c092999d931e",
  "active_statement_hash": "83bb715c41975f922ba112c6314d37f12f4ba054e1d76884e30e392aa7405006",
  "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": {
    "ParserExponentConstants": "e2a30a7b0c5e9c91",
    "ParserSlowLoopInfinityResult": "aa891aefb58dedf9",
    "ParserSlowLoopMinimumExponent": "276f4842202df35f",
    "ParserSlowLoopZeroResult": "9260d2d32b2b038c",
    "num_imp_dec2flt_slow_parse_long_mantissa": "0eb6fb2627d0ff5c",
    "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": {
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS": "d9fd91641cb78c5e",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_common_BiasedFp_zero_pow2": "0f99ae12c6707137",
    "num_imp_dec2flt_decimal_seq_DecimalSeq": "13e3cec939d02f51",
    "num_imp_dec2flt_decimal_seq_DecimalSeq_left_shift": "fd298e37d5ae4f86",
    "num_imp_dec2flt_decimal_seq_DecimalSeq_right_shift": "1aaf1bb11c0b6a49",
    "num_imp_dec2flt_decimal_seq_DecimalSeq_round": "8ea3c058fea09978",
    "num_imp_dec2flt_decimal_seq_parse_decimal_seq": "244cf8318357caab",
    "num_imp_dec2flt_slow_parse_long_mantissa": "cd8af64c3688b60f",
    "num_imp_traits_Float": "5bbdcb7d46520e94"
  }
}
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:8b833bf5e96ac5675f8f79f76e4479b9d509b4794c1460f9c3a15964323df7ca",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}