ParserNumericLemirePairCertificate

Lean checked

Statement

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

Helper · Concrete Lemire pair

For the binary64 FloatExt instance, the extracted Lemire computation at decimal exponent -30 maps mantissas 1{,}000{,}000{,}000{,}000{,}000{,}080 and 1{,}000{,}000{,}000{,}000{,}000{,}081 respectively to biased pairs (448160529771025,983) and (448160529771026,983).

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.ModelF64MantissaDigits
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.num_imp_dec2flt_lemire_compute_float

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

namespace dec2flt_model

-- [TABLET NODE: ParserNumericLemirePairCertificate]
theorem ParserNumericLemirePairCertificate :
    num.imp.dec2flt.lemire.compute_float
        F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
        (-30)#i64 1000000000000000080#u64 =
      ok { m := 448160529771025#u64, p_biased := 983#i32 } /\
    num.imp.dec2flt.lemire.compute_float
        F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
        (-30)#i64 1000000000000000081#u64 =
      ok { m := 448160529771026#u64, p_biased := 983#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

Unfold the extracted full-multiplication and product-approximation definitions from num imp dec2flt lemire full multiplication and num imp dec2flt lemire compute product approx. At exponent -30, the checked table index is 312. Reading the two pinned 128-bit power-of-five table words and carrying out the four 64-bit limb products gives product pairs (13355886962484770048,10141204801825836022) and (15975119965903962193,10141204801825836032) for the two mantissas.
The binary64 constants supplied by F64 Insts Dec2flt modelNumImpTraitsFloatU64 and F64 Insts Dec2flt modelNumImpTraitsFloatExtU64 reduce to 53 total significand bits, infinite power 2047, minimum exponent -1022, and 52 stored significand bits. The extracted power approximation gives -37. Substituting these constants and the two product pairs into num imp dec2flt lemire compute float, every checked shift, cast, and addition is within its displayed scalar bounds. Both executions normalize to biased exponent 983; their final rounded significands are respectively 448160529771025 and 448160529771026. Hence both displayed result equations hold.

Lean proof


  have full1 :
      num.imp.dec2flt.lemire.full_multiplication
        16000000000000001280#u64 11692013098647223345#u64 =
        ok (13355886962484770048#u64, 10141204801825836022#u64) := by
    have h : num.imp.dec2flt.lemire.full_multiplication
        16000000000000001280#u64 11692013098647223345#u64
        ⦃ x => x = (13355886962484770048#u64,
            10141204801825836022#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.full_multiplication
      step
      step
      step
      step
      step
      step
      constructor
      · apply UScalar.eq_of_val_eq
        rw [i2_post, UScalar.cast_val_eq, r_post, i_post,
          i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
      · apply UScalar.eq_of_val_eq
        rw [i4_post, UScalar.cast_val_eq, i3_post1, r_post,
          i_post, i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have prod1 :
      num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001280#u64 55#usize =
        ok (13355886962484770048#u64, 10141204801825836022#u64) := by
    have h : num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001280#u64 55#usize
        ⦃ x => x = (13355886962484770048#u64,
            10141204801825836022#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_product_approx
      rw [num.imp.dec2flt.table.SMALLEST_POWER_OF_FIVE.eq_def,
        num.imp.dec2flt.table.LARGEST_POWER_OF_FIVE.eq_def]
      step
      step
      · have hi : i.val = -342 := by
          rw [i_post, IScalar.cast_val_eq]
          norm_num [Int.bmod]
        scalar_tac
      · step
        step
        · have hi1 : i1.val = 308 := by
            rw [i1_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          scalar_tac
        · step
          have h55 : 55#usize < 64#usize := by scalar_tac
          simp only [h55, if_true]
          step
          step
          step
          step
          have hi2val : i2.val = -342 := by
            rw [i2_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          have hi3val : i3.val = 312 := by
            rw [i3_post, hi2val]
            norm_num
          have hi3eq : i3 = 312#i64 := by
            apply IScalar.eq_of_val_eq
            simpa using hi3val
          have hcast : IScalar.hcast .Usize 312#i64 = 312#usize := by
            apply UScalar.eq_of_val_eq
            have hs := IScalar.hcast_inBounds_spec .Usize 312#i64 (by
              simp [UScalar.max, Dec2Flt.configured_x86_64_numBits])
            have hs' : ((IScalar.hcast .Usize 312#i64).val : Int) = 312 := by
              simpa [Aeneas.Std.lift, WP.spec_ok] using hs
            exact_mod_cast hs'
          have hindexeq : index = 312#usize := by
            rw [index_post, hi3eq, hcast]
          have htable : Array.index_usize
              num.imp.dec2flt.table.POWER_OF_FIVE_128 312#usize =
              ok (11692013098647223345#u64,
                11611831772799369869#u64) := by
            rw [num.imp.dec2flt.table.POWER_OF_FIVE_128.eq_def]
            rfl
          rw [hindexeq, htable]
          simp only [bind_tc_ok]
          change (do
            let (first_lo, first_hi) ←
              num.imp.dec2flt.lemire.full_multiplication
                16000000000000001280#u64 11692013098647223345#u64
            let i4 ← lift (first_hi &&& mask)
            if i4 = mask then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001280#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add first_lo second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← first_hi + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, first_hi)
            else ok (first_lo, first_hi))
            ⦃ x => x = (13355886962484770048#u64,
                10141204801825836022#u64) ⦄
          rw [full1]
          simp only [bind_tc_ok]
          have hmask : mask = 511#u64 := by
            apply UScalar.eq_of_val_eq
            rw [mask_post1]
            norm_num [Nat.shiftRight_eq_div_pow]
          rw [hmask]
          change (do
            let i4 ← lift (10141204801825836022#u64 &&& 511#u64)
            if i4 = 511#u64 then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001280#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add
                13355886962484770048#u64 second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← 10141204801825836022#u64 + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, 10141204801825836022#u64)
            else ok (13355886962484770048#u64,
              10141204801825836022#u64))
            ⦃ x => x = (13355886962484770048#u64,
                10141204801825836022#u64) ⦄
          have hand : lift (10141204801825836022#u64 &&& 511#u64) =
              ok 502#u64 := by rfl
          rw [hand]
          simp [WP.spec_ok]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have full2 :
      num.imp.dec2flt.lemire.full_multiplication
        16000000000000001296#u64 11692013098647223345#u64 =
        ok (15960655803744827408#u64, 10141204801825836032#u64) := by
    have h : num.imp.dec2flt.lemire.full_multiplication
        16000000000000001296#u64 11692013098647223345#u64
        ⦃ x => x = (15960655803744827408#u64,
            10141204801825836032#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.full_multiplication
      step
      step
      step
      step
      step
      step
      constructor
      · apply UScalar.eq_of_val_eq
        rw [i2_post, UScalar.cast_val_eq, r_post, i_post,
          i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
      · apply UScalar.eq_of_val_eq
        rw [i4_post, UScalar.cast_val_eq, i3_post1, r_post,
          i_post, i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have prod2 :
      num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001296#u64 55#usize =
        ok (15960655803744827408#u64, 10141204801825836032#u64) := by
    have h : num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001296#u64 55#usize
        ⦃ x => x = (15960655803744827408#u64,
            10141204801825836032#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_product_approx
      rw [num.imp.dec2flt.table.SMALLEST_POWER_OF_FIVE.eq_def,
        num.imp.dec2flt.table.LARGEST_POWER_OF_FIVE.eq_def]
      step
      step
      · have hi : i.val = -342 := by
          rw [i_post, IScalar.cast_val_eq]
          norm_num [Int.bmod]
        scalar_tac
      · step
        step
        · have hi1 : i1.val = 308 := by
            rw [i1_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          scalar_tac
        · step
          have h55 : 55#usize < 64#usize := by scalar_tac
          simp only [h55, if_true]
          step
          step
          step
          step
          have hi2val : i2.val = -342 := by
            rw [i2_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          have hi3val : i3.val = 312 := by
            rw [i3_post, hi2val]
            norm_num
          have hi3eq : i3 = 312#i64 := by
            apply IScalar.eq_of_val_eq
            simpa using hi3val
          have hcast : IScalar.hcast .Usize 312#i64 = 312#usize := by
            apply UScalar.eq_of_val_eq
            have hs := IScalar.hcast_inBounds_spec .Usize 312#i64 (by
              simp [UScalar.max, Dec2Flt.configured_x86_64_numBits])
            have hs' : ((IScalar.hcast .Usize 312#i64).val : Int) = 312 := by
              simpa [Aeneas.Std.lift, WP.spec_ok] using hs
            exact_mod_cast hs'
          have hindexeq : index = 312#usize := by
            rw [index_post, hi3eq, hcast]
          have htable : Array.index_usize
              num.imp.dec2flt.table.POWER_OF_FIVE_128 312#usize =
              ok (11692013098647223345#u64,
                11611831772799369869#u64) := by
            rw [num.imp.dec2flt.table.POWER_OF_FIVE_128.eq_def]
            rfl
          rw [hindexeq, htable]
          simp only [bind_tc_ok]
          change (do
            let (first_lo, first_hi) ←
              num.imp.dec2flt.lemire.full_multiplication
                16000000000000001296#u64 11692013098647223345#u64
            let i4 ← lift (first_hi &&& mask)
            if i4 = mask then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001296#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add first_lo second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← first_hi + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, first_hi)
            else ok (first_lo, first_hi))
            ⦃ x => x = (15960655803744827408#u64,
                10141204801825836032#u64) ⦄
          rw [full2]
          simp only [bind_tc_ok]
          have hmask : mask = 511#u64 := by
            apply UScalar.eq_of_val_eq
            rw [mask_post1]
            norm_num [Nat.shiftRight_eq_div_pow]
          rw [hmask]
          change (do
            let i4 ← lift (10141204801825836032#u64 &&& 511#u64)
            if i4 = 511#u64 then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001296#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add
                15960655803744827408#u64 second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← 10141204801825836032#u64 + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, 10141204801825836032#u64)
            else ok (15960655803744827408#u64,
              10141204801825836032#u64))
            ⦃ x => x = (15960655803744827408#u64,
                10141204801825836032#u64) ⦄
          have hand : lift (10141204801825836032#u64 &&& 511#u64) =
              ok 0#u64 := by rfl
          rw [hand]
          simp [WP.spec_ok]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have sig53 : F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS =
      ok 53#u32 := by
    simp only [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def,
      core.f64.F64.MANTISSA_DIGITS, ModelF64MantissaDigits,
      Binary64ModelDefault]
  
  have inf2047 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.INFINITE_POWER =
      ok 2047#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      num.imp.traits.Float.INFINITE_POWER.default.eq_def,
      num.imp.traits.Float.EXP_SAT.default.eq_def,
      num.imp.traits.Float.EXP_BITS.default.eq_def,
      num.imp.traits.Float.SIG_BITS.default.eq_def,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def,
      sig53]
    have h : (do
        let x ← 53#u32 - 1#u32
        let x ← 64#u32 - x
        let x ← x - 1#u32
        let x ← 1#u32 <<< x
        let i ← x - 1#u32
        ok (UScalar.hcast .I32 i))
        ⦃ x => x = 2047#i32 ⦄ := by
      step
      step
      step
      step
      step
      apply IScalar.eq_of_val_eq
      have hi : i.val = 2047 := by scalar_tac
      have hs := UScalar.hcast_inBounds_spec .I32 i (by scalar_tac)
      rw [hi] at hs
      simpa [Aeneas.Std.lift, WP.spec_ok] using hs
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have expmin1022 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.EXP_MIN =
      ok (-1022)#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      num.imp.traits.Float.EXP_MIN.default.eq_def,
      num.imp.traits.Float.EXP_BIAS.default.eq_def,
      num.imp.traits.Float.EXP_SAT.default.eq_def,
      num.imp.traits.Float.EXP_BITS.default.eq_def,
      num.imp.traits.Float.SIG_BITS.default.eq_def,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def,
      sig53]
    have h : (do
        let x ← 53#u32 - 1#u32
        let x ← 64#u32 - x
        let x ← x - 1#u32
        let x ← 1#u32 <<< x
        let x ← x - 1#u32
        let i ← x >>> 1#i32
        let i1 ← lift (UScalar.hcast .I32 i)
        let i2 ← i1 - 1#i32
        -. i2) ⦃ x => x = (-1022)#i32 ⦄ := by
      step
      step
      step
      step
      step
      step
      step
      have hi : i.val = 1023 := by scalar_tac
      have hcast : UScalar.hcast .I32 i = 1023#i32 := by
        apply IScalar.eq_of_val_eq
        have hs := UScalar.hcast_inBounds_spec .I32 i (by scalar_tac)
        rw [hi] at hs
        simpa [Aeneas.Std.lift, WP.spec_ok] using hs
      have hi1 : i1 = 1023#i32 := by rw [i1_post, hcast]
      rw [hi1]
      step
      step
      apply IScalar.eq_of_val_eq
      scalar_tac
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have sig52 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.SIG_BITS =
      ok 52#u32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      num.imp.traits.Float.SIG_BITS.default.eq_def, sig53]
    have h : (53#u32 - 1#u32) ⦃ x => x = 52#u32 ⦄ := by
      step
      apply UScalar.eq_of_val_eq
      simpa using x_post1
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have small342 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.SMALLEST_POWER_OF_TEN =
      ok (-342)#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
  
  have large308 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.LARGEST_POWER_OF_TEN =
      ok 308#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def]
  
  have pow30 : num.imp.dec2flt.lemire.power (-30)#i32 = ok (-37)#i32 := by
    have h : num.imp.dec2flt.lemire.power (-30)#i32
        ⦃ x => x = (-37)#i32 ⦄ := by
      unfold num.imp.dec2flt.lemire.power
      step
      step
      have hi : i = 217706#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i_post
      have hi1 : i1 = (-6531180)#i32 := by
        rw [i1_post, hi]
        rfl
      rw [hi1]
      have hshift : ((-6531180)#i32 >>> 16#i32) = ok (-100)#i32 := by
        rfl
      rw [hshift]
      step
      apply IScalar.eq_of_val_eq
      scalar_tac
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have compute1 :
      num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000080#u64 =
        ok { m := 448160529771025#u64, p_biased := 983#i32 } := by
    have h : num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000080#u64
        ⦃ x => x = ({ m := 448160529771025#u64, p_biased := 983#i32 } :
            num.imp.dec2flt.common.BiasedFp) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_float
      rw [inf2047]
      simp only [num.imp.dec2flt.common.BiasedFp.zero_pow2]
      rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
      simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def,
        sig53, expmin1022, pow30, prod1]
      step
      have hi2 : i2 = (-342)#i64 := by rw [i2_post]; rfl
      rw [hi2]
      have hnsmall : ¬ (-30 < ((-342)#i64).val) := by norm_num
      rw [if_neg hnsmall]
      step
      have hi4 : i4 = 308#i64 := by rw [i4_post]; rfl
      rw [hi4]
      have hnlarge : ¬ (((308)#i64).val < -30) := by norm_num
      rw [if_neg hnlarge]
      step
      have hlz : lz = 4#u32 := by
        rw [lz_post]
        rfl
      rw [hlz]
      step
      have hw1 : w1 = 16000000000000001280#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 16000000000000001280 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at w1_post1
        rw [Nat.mod_eq_of_lt hb] at w1_post1
        norm_num at w1_post1 ⊢
        exact w1_post1
      rw [hw1]
      step
      have hi5 : i5 = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using i5_post1
      rw [hi5]
      step
      have hi6 : i6 = 52#usize := by
        apply UScalar.eq_of_val_eq
        rw [i6_post, UScalar.cast_val_eq]
        simp only [UScalarTy.numBits]
        rw [Dec2Flt.configured_x86_64_numBits]
        norm_num
      rw [hi6]
      step
      have hi7 : i7 = 55#usize := by
        apply UScalar.eq_of_val_eq
        simpa using i7_post
      rw [hi7]
      have hprod : num.imp.dec2flt.lemire.compute_product_approx
          (-30)#i64 16000000000000001280#u64 55#usize
          ⦃ x => x = (13355886962484770048#u64,
              10141204801825836022#u64) ⦄ := by
        rw [prod1]
        simp [WP.spec_ok]
      step
      have hloeq : lo = 13355886962484770048#u64 :=
        congrArg Prod.fst lo_post
      have hhieq : hi = 10141204801825836022#u64 :=
        congrArg Prod.snd lo_post
      rw [hloeq, hhieq]
      have hnomax : (13355886962484770048#u64 : U64) ≠
          18446744073709551615#u64 := by decide
      rw [if_neg hnomax]
      step
      have hi8 : i8 = 1#u64 := by
        apply UScalar.eq_of_val_eq
        rw [i8_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hi8]
      step
      have hupper : upperbit = 1#i32 := by
        rw [upperbit_post]
        rfl
      rw [hupper]
      step
      have hi9 : i9 = 65#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i9_post
      rw [hi9]
      step
      have hi10 : i10 = 52#i32 := by
        rw [i10_post]
        rfl
      rw [hi10]
      step
      have hi11 : i11 = 13#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i11_post
      rw [hi11]
      step
      have hi12 : i12 = 10#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i12_post
      rw [hi12]
      step
      have hmantissa : mantissa = 9903520314283042#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hmantissa]
      step
      have hi13 : i13 = (-30)#i32 := by
        rw [i13_post]
        rfl
      rw [hi13, pow30]
      simp only [bind_tc_ok]
      step
      have hi15 : i15 = (-36)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i15_post
      rw [hi15]
      step
      have hi16 : i16 = 4#i32 := by
        rw [i16_post]
        rfl
      rw [hi16]
      step
      have hi17 : i17 = (-40)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i17_post
      rw [hi17]
      have hexp :
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.EXP_MIN
            ⦃ x => x = (-1022)#i32 ⦄ := by
        rw [expmin1022]
        simp [WP.spec_ok]
      step
      have hx0 : x = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx0,
        F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def]
      step
      have hx1 : x = 12#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx1]
      step
      have hx2 : x = 11#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx2]
      step
      have hx3 : x = 2048#u32 := by
        apply UScalar.eq_of_val_eq
        have hb : 2048 < U32.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at x_post1
        rw [Nat.mod_eq_of_lt hb] at x_post1
        simpa using x_post1
      rw [hx3]
      step
      have hx4 : x = 2047#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx4]
      step
      have hx5 : x = 1023#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx5]
      step
      have hx6 : x = 1023#i32 := by
        rw [x_post]
        rfl
      rw [hx6]
      step
      have hx7 : x = 1022#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using x_post
      rw [hx7]
      step
      have hi18 : i18 = (-1022)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i18_post
      rw [hi18]
      step
      have hi19 : i19 = 982#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i19_post
      rw [hi19]
      step
      have hpower2 : power2 = 983#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using power2_post
      rw [hpower2]
      have hpos : ¬ ((983#i32).val ≤ 0) := by norm_num
      rw [if_neg hpos]
      have hlo1 : ¬ ((13355886962484770048#u64).val ≤ 1) := by norm_num
      rw [if_neg hlo1]
      step
      have hm1 : mantissa1 = 0#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa1_post1]
        rfl
      rw [hm1]
      step
      have hm2 : mantissa2 = 9903520314283042#u64 := by
        apply UScalar.eq_of_val_eq
        simpa using mantissa2_post
      rw [hm2]
      step
      have hm3 : mantissa3 = 4951760157141521#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa3_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hm3]
      step
      have hi21 : i21 = 9007199254740992#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 9007199254740992 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at i21_post1
        rw [Nat.mod_eq_of_lt hb] at i21_post1
        simpa using i21_post1
      rw [hi21]
      have hround : ¬ ((9007199254740992#u64).val ≤
          (4951760157141521#u64).val) := by norm_num
      rw [if_neg hround]
      step
      have hi22 : mantissa4 = 4503599627370496#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 4503599627370496 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at power21
        rw [Nat.mod_eq_of_lt hb] at power21
        simpa using power21
      rw [hi22]
      step
      have hi23 : i23 = 18442240474082181119#u64 := by
        rw [i23_post]
        rfl
      rw [hi23]
      step
      have hm5 : mantissa5 = 448160529771025#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa5_post1]
        rfl
      rw [hm5]
      have hfinite : ¬ ((2047 : Int) ≤ (983#i32).val) := by norm_num
      rw [if_neg hfinite]
      rfl
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have compute2 :
      num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000081#u64 =
        ok { m := 448160529771026#u64, p_biased := 983#i32 } := by
    have h : num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000081#u64
        ⦃ x => x = ({ m := 448160529771026#u64, p_biased := 983#i32 } :
            num.imp.dec2flt.common.BiasedFp) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_float
      rw [inf2047]
      simp only [num.imp.dec2flt.common.BiasedFp.zero_pow2]
      rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
      simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def,
        sig53, expmin1022, pow30, prod2]
      step
      have hi2 : i2 = (-342)#i64 := by rw [i2_post]; rfl
      rw [hi2]
      have hnsmall : ¬ (-30 < ((-342)#i64).val) := by norm_num
      rw [if_neg hnsmall]
      step
      have hi4 : i4 = 308#i64 := by rw [i4_post]; rfl
      rw [hi4]
      have hnlarge : ¬ (((308)#i64).val < -30) := by norm_num
      rw [if_neg hnlarge]
      step
      have hlz : lz = 4#u32 := by
        rw [lz_post]
        rfl
      rw [hlz]
      step
      have hw1 : w1 = 16000000000000001296#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 16000000000000001296 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at w1_post1
        rw [Nat.mod_eq_of_lt hb] at w1_post1
        norm_num at w1_post1 ⊢
        exact w1_post1
      rw [hw1]
      step
      have hi5 : i5 = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using i5_post1
      rw [hi5]
      step
      have hi6 : i6 = 52#usize := by
        apply UScalar.eq_of_val_eq
        rw [i6_post, UScalar.cast_val_eq]
        simp only [UScalarTy.numBits]
        rw [Dec2Flt.configured_x86_64_numBits]
        norm_num
      rw [hi6]
      step
      have hi7 : i7 = 55#usize := by
        apply UScalar.eq_of_val_eq
        simpa using i7_post
      rw [hi7]
      have hprod : num.imp.dec2flt.lemire.compute_product_approx
          (-30)#i64 16000000000000001296#u64 55#usize
          ⦃ x => x = (15960655803744827408#u64,
              10141204801825836032#u64) ⦄ := by
        rw [prod2]
        simp [WP.spec_ok]
      step
      have hloeq : lo = 15960655803744827408#u64 :=
        congrArg Prod.fst lo_post
      have hhieq : hi = 10141204801825836032#u64 :=
        congrArg Prod.snd lo_post
      rw [hloeq, hhieq]
      have hnomax : (15960655803744827408#u64 : U64) ≠
          18446744073709551615#u64 := by decide
      rw [if_neg hnomax]
      step
      have hi8 : i8 = 1#u64 := by
        apply UScalar.eq_of_val_eq
        rw [i8_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hi8]
      step
      have hupper : upperbit = 1#i32 := by
        rw [upperbit_post]
        rfl
      rw [hupper]
      step
      have hi9 : i9 = 65#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i9_post
      rw [hi9]
      step
      have hi10 : i10 = 52#i32 := by
        rw [i10_post]
        rfl
      rw [hi10]
      step
      have hi11 : i11 = 13#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i11_post
      rw [hi11]
      step
      have hi12 : i12 = 10#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i12_post
      rw [hi12]
      step
      have hmantissa : mantissa = 9903520314283043#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hmantissa]
      step
      have hi13 : i13 = (-30)#i32 := by
        rw [i13_post]
        rfl
      rw [hi13, pow30]
      simp only [bind_tc_ok]
      step
      have hi15 : i15 = (-36)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i15_post
      rw [hi15]
      step
      have hi16 : i16 = 4#i32 := by
        rw [i16_post]
        rfl
      rw [hi16]
      step
      have hi17 : i17 = (-40)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i17_post
      rw [hi17]
      have hexp :
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.EXP_MIN
            ⦃ x => x = (-1022)#i32 ⦄ := by
        rw [expmin1022]
        simp [WP.spec_ok]
      step
      have hx0 : x = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx0,
        F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def]
      step
      have hx1 : x = 12#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx1]
      step
      have hx2 : x = 11#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx2]
      step
      have hx3 : x = 2048#u32 := by
        apply UScalar.eq_of_val_eq
        have hb : 2048 < U32.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at x_post1
        rw [Nat.mod_eq_of_lt hb] at x_post1
        simpa using x_post1
      rw [hx3]
      step
      have hx4 : x = 2047#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx4]
      step
      have hx5 : x = 1023#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx5]
      step
      have hx6 : x = 1023#i32 := by
        rw [x_post]
        rfl
      rw [hx6]
      step
      have hx7 : x = 1022#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using x_post
      rw [hx7]
      step
      have hi18 : i18 = (-1022)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i18_post
      rw [hi18]
      step
      have hi19 : i19 = 982#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i19_post
      rw [hi19]
      step
      have hpower2 : power2 = 983#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using power2_post
      rw [hpower2]
      have hpos : ¬ ((983#i32).val ≤ 0) := by norm_num
      rw [if_neg hpos]
      have hlo1 : ¬ ((15960655803744827408#u64).val ≤ 1) := by norm_num
      rw [if_neg hlo1]
      step
      have hm1 : mantissa1 = 1#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa1_post1]
        rfl
      rw [hm1]
      step
      have hm2 : mantissa2 = 9903520314283044#u64 := by
        apply UScalar.eq_of_val_eq
        simpa using mantissa2_post
      rw [hm2]
      step
      have hm3 : mantissa3 = 4951760157141522#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa3_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hm3]
      step
      have hi21 : i21 = 9007199254740992#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 9007199254740992 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at i21_post1
        rw [Nat.mod_eq_of_lt hb] at i21_post1
        simpa using i21_post1
      rw [hi21]
      have hround : ¬ ((9007199254740992#u64).val ≤
          (4951760157141522#u64).val) := by norm_num
      rw [if_neg hround]
      step
      have hi22 : mantissa4 = 4503599627370496#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 4503599627370496 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at power21
        rw [Nat.mod_eq_of_lt hb] at power21
        simpa using power21
      rw [hi22]
      step
      have hi23 : i23 = 18442240474082181119#u64 := by
        rw [i23_post]
        rfl
      rw [hi23]
      step
      have hm5 : mantissa5 = 448160529771026#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa5_post1]
        rfl
      rw [hm5]
      have hfinite : ¬ ((2047 : Int) ≤ (983#i32).val) := by norm_num
      rw [if_neg hfinite]
      rfl
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  exact ⟨compute1, compute2⟩

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.Assumptions
import Tablet.ModelF64MantissaDigits
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.num_imp_dec2flt_lemire_compute_float

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

namespace dec2flt_model

-- [TABLET NODE: ParserNumericLemirePairCertificate]
theorem ParserNumericLemirePairCertificate :
    num.imp.dec2flt.lemire.compute_float
        F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
        (-30)#i64 1000000000000000080#u64 =
      ok { m := 448160529771025#u64, p_biased := 983#i32 } /\
    num.imp.dec2flt.lemire.compute_float
        F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
        (-30)#i64 1000000000000000081#u64 =
      ok { m := 448160529771026#u64, p_biased := 983#i32 } := by
-- BODY
  have full1 :
      num.imp.dec2flt.lemire.full_multiplication
        16000000000000001280#u64 11692013098647223345#u64 =
        ok (13355886962484770048#u64, 10141204801825836022#u64) := by
    have h : num.imp.dec2flt.lemire.full_multiplication
        16000000000000001280#u64 11692013098647223345#u64
        ⦃ x => x = (13355886962484770048#u64,
            10141204801825836022#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.full_multiplication
      step
      step
      step
      step
      step
      step
      constructor
      · apply UScalar.eq_of_val_eq
        rw [i2_post, UScalar.cast_val_eq, r_post, i_post,
          i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
      · apply UScalar.eq_of_val_eq
        rw [i4_post, UScalar.cast_val_eq, i3_post1, r_post,
          i_post, i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have prod1 :
      num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001280#u64 55#usize =
        ok (13355886962484770048#u64, 10141204801825836022#u64) := by
    have h : num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001280#u64 55#usize
        ⦃ x => x = (13355886962484770048#u64,
            10141204801825836022#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_product_approx
      rw [num.imp.dec2flt.table.SMALLEST_POWER_OF_FIVE.eq_def,
        num.imp.dec2flt.table.LARGEST_POWER_OF_FIVE.eq_def]
      step
      step
      · have hi : i.val = -342 := by
          rw [i_post, IScalar.cast_val_eq]
          norm_num [Int.bmod]
        scalar_tac
      · step
        step
        · have hi1 : i1.val = 308 := by
            rw [i1_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          scalar_tac
        · step
          have h55 : 55#usize < 64#usize := by scalar_tac
          simp only [h55, if_true]
          step
          step
          step
          step
          have hi2val : i2.val = -342 := by
            rw [i2_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          have hi3val : i3.val = 312 := by
            rw [i3_post, hi2val]
            norm_num
          have hi3eq : i3 = 312#i64 := by
            apply IScalar.eq_of_val_eq
            simpa using hi3val
          have hcast : IScalar.hcast .Usize 312#i64 = 312#usize := by
            apply UScalar.eq_of_val_eq
            have hs := IScalar.hcast_inBounds_spec .Usize 312#i64 (by
              simp [UScalar.max, Dec2Flt.configured_x86_64_numBits])
            have hs' : ((IScalar.hcast .Usize 312#i64).val : Int) = 312 := by
              simpa [Aeneas.Std.lift, WP.spec_ok] using hs
            exact_mod_cast hs'
          have hindexeq : index = 312#usize := by
            rw [index_post, hi3eq, hcast]
          have htable : Array.index_usize
              num.imp.dec2flt.table.POWER_OF_FIVE_128 312#usize =
              ok (11692013098647223345#u64,
                11611831772799369869#u64) := by
            rw [num.imp.dec2flt.table.POWER_OF_FIVE_128.eq_def]
            rfl
          rw [hindexeq, htable]
          simp only [bind_tc_ok]
          change (do
            let (first_lo, first_hi) ←
              num.imp.dec2flt.lemire.full_multiplication
                16000000000000001280#u64 11692013098647223345#u64
            let i4 ← lift (first_hi &&& mask)
            if i4 = mask then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001280#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add first_lo second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← first_hi + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, first_hi)
            else ok (first_lo, first_hi))
            ⦃ x => x = (13355886962484770048#u64,
                10141204801825836022#u64) ⦄
          rw [full1]
          simp only [bind_tc_ok]
          have hmask : mask = 511#u64 := by
            apply UScalar.eq_of_val_eq
            rw [mask_post1]
            norm_num [Nat.shiftRight_eq_div_pow]
          rw [hmask]
          change (do
            let i4 ← lift (10141204801825836022#u64 &&& 511#u64)
            if i4 = 511#u64 then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001280#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add
                13355886962484770048#u64 second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← 10141204801825836022#u64 + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, 10141204801825836022#u64)
            else ok (13355886962484770048#u64,
              10141204801825836022#u64))
            ⦃ x => x = (13355886962484770048#u64,
                10141204801825836022#u64) ⦄
          have hand : lift (10141204801825836022#u64 &&& 511#u64) =
              ok 502#u64 := by rfl
          rw [hand]
          simp [WP.spec_ok]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have full2 :
      num.imp.dec2flt.lemire.full_multiplication
        16000000000000001296#u64 11692013098647223345#u64 =
        ok (15960655803744827408#u64, 10141204801825836032#u64) := by
    have h : num.imp.dec2flt.lemire.full_multiplication
        16000000000000001296#u64 11692013098647223345#u64
        ⦃ x => x = (15960655803744827408#u64,
            10141204801825836032#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.full_multiplication
      step
      step
      step
      step
      step
      step
      constructor
      · apply UScalar.eq_of_val_eq
        rw [i2_post, UScalar.cast_val_eq, r_post, i_post,
          i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
      · apply UScalar.eq_of_val_eq
        rw [i4_post, UScalar.cast_val_eq, i3_post1, r_post,
          i_post, i1_post, UScalar.cast_val_eq, UScalar.cast_val_eq]
        norm_num [Nat.shiftRight_eq_div_pow]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have prod2 :
      num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001296#u64 55#usize =
        ok (15960655803744827408#u64, 10141204801825836032#u64) := by
    have h : num.imp.dec2flt.lemire.compute_product_approx
        (-30)#i64 16000000000000001296#u64 55#usize
        ⦃ x => x = (15960655803744827408#u64,
            10141204801825836032#u64) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_product_approx
      rw [num.imp.dec2flt.table.SMALLEST_POWER_OF_FIVE.eq_def,
        num.imp.dec2flt.table.LARGEST_POWER_OF_FIVE.eq_def]
      step
      step
      · have hi : i.val = -342 := by
          rw [i_post, IScalar.cast_val_eq]
          norm_num [Int.bmod]
        scalar_tac
      · step
        step
        · have hi1 : i1.val = 308 := by
            rw [i1_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          scalar_tac
        · step
          have h55 : 55#usize < 64#usize := by scalar_tac
          simp only [h55, if_true]
          step
          step
          step
          step
          have hi2val : i2.val = -342 := by
            rw [i2_post, IScalar.cast_val_eq]
            norm_num [Int.bmod]
          have hi3val : i3.val = 312 := by
            rw [i3_post, hi2val]
            norm_num
          have hi3eq : i3 = 312#i64 := by
            apply IScalar.eq_of_val_eq
            simpa using hi3val
          have hcast : IScalar.hcast .Usize 312#i64 = 312#usize := by
            apply UScalar.eq_of_val_eq
            have hs := IScalar.hcast_inBounds_spec .Usize 312#i64 (by
              simp [UScalar.max, Dec2Flt.configured_x86_64_numBits])
            have hs' : ((IScalar.hcast .Usize 312#i64).val : Int) = 312 := by
              simpa [Aeneas.Std.lift, WP.spec_ok] using hs
            exact_mod_cast hs'
          have hindexeq : index = 312#usize := by
            rw [index_post, hi3eq, hcast]
          have htable : Array.index_usize
              num.imp.dec2flt.table.POWER_OF_FIVE_128 312#usize =
              ok (11692013098647223345#u64,
                11611831772799369869#u64) := by
            rw [num.imp.dec2flt.table.POWER_OF_FIVE_128.eq_def]
            rfl
          rw [hindexeq, htable]
          simp only [bind_tc_ok]
          change (do
            let (first_lo, first_hi) ←
              num.imp.dec2flt.lemire.full_multiplication
                16000000000000001296#u64 11692013098647223345#u64
            let i4 ← lift (first_hi &&& mask)
            if i4 = mask then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001296#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add first_lo second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← first_hi + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, first_hi)
            else ok (first_lo, first_hi))
            ⦃ x => x = (15960655803744827408#u64,
                10141204801825836032#u64) ⦄
          rw [full2]
          simp only [bind_tc_ok]
          have hmask : mask = 511#u64 := by
            apply UScalar.eq_of_val_eq
            rw [mask_post1]
            norm_num [Nat.shiftRight_eq_div_pow]
          rw [hmask]
          change (do
            let i4 ← lift (10141204801825836032#u64 &&& 511#u64)
            if i4 = 511#u64 then do
              let (_, second_hi) ←
                num.imp.dec2flt.lemire.full_multiplication
                  16000000000000001296#u64 11611831772799369869#u64
              let first_lo1 ← lift (core.num.U64.wrapping_add
                15960655803744827408#u64 second_hi)
              if second_hi > first_lo1 then do
                let first_hi1 ← 10141204801825836032#u64 + 1#u64
                ok (first_lo1, first_hi1)
              else ok (first_lo1, 10141204801825836032#u64)
            else ok (15960655803744827408#u64,
              10141204801825836032#u64))
            ⦃ x => x = (15960655803744827408#u64,
                10141204801825836032#u64) ⦄
          have hand : lift (10141204801825836032#u64 &&& 511#u64) =
              ok 0#u64 := by rfl
          rw [hand]
          simp [WP.spec_ok]
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have sig53 : F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS =
      ok 53#u32 := by
    simp only [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SIG_TOTAL_BITS.eq_def,
      core.f64.F64.MANTISSA_DIGITS, ModelF64MantissaDigits,
      Binary64ModelDefault]
  
  have inf2047 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.INFINITE_POWER =
      ok 2047#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      num.imp.traits.Float.INFINITE_POWER.default.eq_def,
      num.imp.traits.Float.EXP_SAT.default.eq_def,
      num.imp.traits.Float.EXP_BITS.default.eq_def,
      num.imp.traits.Float.SIG_BITS.default.eq_def,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def,
      sig53]
    have h : (do
        let x ← 53#u32 - 1#u32
        let x ← 64#u32 - x
        let x ← x - 1#u32
        let x ← 1#u32 <<< x
        let i ← x - 1#u32
        ok (UScalar.hcast .I32 i))
        ⦃ x => x = 2047#i32 ⦄ := by
      step
      step
      step
      step
      step
      apply IScalar.eq_of_val_eq
      have hi : i.val = 2047 := by scalar_tac
      have hs := UScalar.hcast_inBounds_spec .I32 i (by scalar_tac)
      rw [hi] at hs
      simpa [Aeneas.Std.lift, WP.spec_ok] using hs
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have expmin1022 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.EXP_MIN =
      ok (-1022)#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      num.imp.traits.Float.EXP_MIN.default.eq_def,
      num.imp.traits.Float.EXP_BIAS.default.eq_def,
      num.imp.traits.Float.EXP_SAT.default.eq_def,
      num.imp.traits.Float.EXP_BITS.default.eq_def,
      num.imp.traits.Float.SIG_BITS.default.eq_def,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def,
      sig53]
    have h : (do
        let x ← 53#u32 - 1#u32
        let x ← 64#u32 - x
        let x ← x - 1#u32
        let x ← 1#u32 <<< x
        let x ← x - 1#u32
        let i ← x >>> 1#i32
        let i1 ← lift (UScalar.hcast .I32 i)
        let i2 ← i1 - 1#i32
        -. i2) ⦃ x => x = (-1022)#i32 ⦄ := by
      step
      step
      step
      step
      step
      step
      step
      have hi : i.val = 1023 := by scalar_tac
      have hcast : UScalar.hcast .I32 i = 1023#i32 := by
        apply IScalar.eq_of_val_eq
        have hs := UScalar.hcast_inBounds_spec .I32 i (by scalar_tac)
        rw [hi] at hs
        simpa [Aeneas.Std.lift, WP.spec_ok] using hs
      have hi1 : i1 = 1023#i32 := by rw [i1_post, hcast]
      rw [hi1]
      step
      step
      apply IScalar.eq_of_val_eq
      scalar_tac
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have sig52 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.SIG_BITS =
      ok 52#u32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      num.imp.traits.Float.SIG_BITS.default.eq_def, sig53]
    have h : (53#u32 - 1#u32) ⦃ x => x = 52#u32 ⦄ := by
      step
      apply UScalar.eq_of_val_eq
      simpa using x_post1
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have small342 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.SMALLEST_POWER_OF_TEN =
      ok (-342)#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
  
  have large308 : F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.LARGEST_POWER_OF_TEN =
      ok 308#i32 := by
    simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64,
      F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def]
  
  have pow30 : num.imp.dec2flt.lemire.power (-30)#i32 = ok (-37)#i32 := by
    have h : num.imp.dec2flt.lemire.power (-30)#i32
        ⦃ x => x = (-37)#i32 ⦄ := by
      unfold num.imp.dec2flt.lemire.power
      step
      step
      have hi : i = 217706#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i_post
      have hi1 : i1 = (-6531180)#i32 := by
        rw [i1_post, hi]
        rfl
      rw [hi1]
      have hshift : ((-6531180)#i32 >>> 16#i32) = ok (-100)#i32 := by
        rfl
      rw [hshift]
      step
      apply IScalar.eq_of_val_eq
      scalar_tac
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have compute1 :
      num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000080#u64 =
        ok { m := 448160529771025#u64, p_biased := 983#i32 } := by
    have h : num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000080#u64
        ⦃ x => x = ({ m := 448160529771025#u64, p_biased := 983#i32 } :
            num.imp.dec2flt.common.BiasedFp) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_float
      rw [inf2047]
      simp only [num.imp.dec2flt.common.BiasedFp.zero_pow2]
      rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
      simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def,
        sig53, expmin1022, pow30, prod1]
      step
      have hi2 : i2 = (-342)#i64 := by rw [i2_post]; rfl
      rw [hi2]
      have hnsmall : ¬ (-30 < ((-342)#i64).val) := by norm_num
      rw [if_neg hnsmall]
      step
      have hi4 : i4 = 308#i64 := by rw [i4_post]; rfl
      rw [hi4]
      have hnlarge : ¬ (((308)#i64).val < -30) := by norm_num
      rw [if_neg hnlarge]
      step
      have hlz : lz = 4#u32 := by
        rw [lz_post]
        rfl
      rw [hlz]
      step
      have hw1 : w1 = 16000000000000001280#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 16000000000000001280 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at w1_post1
        rw [Nat.mod_eq_of_lt hb] at w1_post1
        norm_num at w1_post1 ⊢
        exact w1_post1
      rw [hw1]
      step
      have hi5 : i5 = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using i5_post1
      rw [hi5]
      step
      have hi6 : i6 = 52#usize := by
        apply UScalar.eq_of_val_eq
        rw [i6_post, UScalar.cast_val_eq]
        simp only [UScalarTy.numBits]
        rw [Dec2Flt.configured_x86_64_numBits]
        norm_num
      rw [hi6]
      step
      have hi7 : i7 = 55#usize := by
        apply UScalar.eq_of_val_eq
        simpa using i7_post
      rw [hi7]
      have hprod : num.imp.dec2flt.lemire.compute_product_approx
          (-30)#i64 16000000000000001280#u64 55#usize
          ⦃ x => x = (13355886962484770048#u64,
              10141204801825836022#u64) ⦄ := by
        rw [prod1]
        simp [WP.spec_ok]
      step
      have hloeq : lo = 13355886962484770048#u64 :=
        congrArg Prod.fst lo_post
      have hhieq : hi = 10141204801825836022#u64 :=
        congrArg Prod.snd lo_post
      rw [hloeq, hhieq]
      have hnomax : (13355886962484770048#u64 : U64) ≠
          18446744073709551615#u64 := by decide
      rw [if_neg hnomax]
      step
      have hi8 : i8 = 1#u64 := by
        apply UScalar.eq_of_val_eq
        rw [i8_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hi8]
      step
      have hupper : upperbit = 1#i32 := by
        rw [upperbit_post]
        rfl
      rw [hupper]
      step
      have hi9 : i9 = 65#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i9_post
      rw [hi9]
      step
      have hi10 : i10 = 52#i32 := by
        rw [i10_post]
        rfl
      rw [hi10]
      step
      have hi11 : i11 = 13#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i11_post
      rw [hi11]
      step
      have hi12 : i12 = 10#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i12_post
      rw [hi12]
      step
      have hmantissa : mantissa = 9903520314283042#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hmantissa]
      step
      have hi13 : i13 = (-30)#i32 := by
        rw [i13_post]
        rfl
      rw [hi13, pow30]
      simp only [bind_tc_ok]
      step
      have hi15 : i15 = (-36)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i15_post
      rw [hi15]
      step
      have hi16 : i16 = 4#i32 := by
        rw [i16_post]
        rfl
      rw [hi16]
      step
      have hi17 : i17 = (-40)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i17_post
      rw [hi17]
      have hexp :
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.EXP_MIN
            ⦃ x => x = (-1022)#i32 ⦄ := by
        rw [expmin1022]
        simp [WP.spec_ok]
      step
      have hx0 : x = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx0,
        F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def]
      step
      have hx1 : x = 12#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx1]
      step
      have hx2 : x = 11#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx2]
      step
      have hx3 : x = 2048#u32 := by
        apply UScalar.eq_of_val_eq
        have hb : 2048 < U32.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at x_post1
        rw [Nat.mod_eq_of_lt hb] at x_post1
        simpa using x_post1
      rw [hx3]
      step
      have hx4 : x = 2047#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx4]
      step
      have hx5 : x = 1023#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx5]
      step
      have hx6 : x = 1023#i32 := by
        rw [x_post]
        rfl
      rw [hx6]
      step
      have hx7 : x = 1022#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using x_post
      rw [hx7]
      step
      have hi18 : i18 = (-1022)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i18_post
      rw [hi18]
      step
      have hi19 : i19 = 982#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i19_post
      rw [hi19]
      step
      have hpower2 : power2 = 983#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using power2_post
      rw [hpower2]
      have hpos : ¬ ((983#i32).val ≤ 0) := by norm_num
      rw [if_neg hpos]
      have hlo1 : ¬ ((13355886962484770048#u64).val ≤ 1) := by norm_num
      rw [if_neg hlo1]
      step
      have hm1 : mantissa1 = 0#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa1_post1]
        rfl
      rw [hm1]
      step
      have hm2 : mantissa2 = 9903520314283042#u64 := by
        apply UScalar.eq_of_val_eq
        simpa using mantissa2_post
      rw [hm2]
      step
      have hm3 : mantissa3 = 4951760157141521#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa3_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hm3]
      step
      have hi21 : i21 = 9007199254740992#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 9007199254740992 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at i21_post1
        rw [Nat.mod_eq_of_lt hb] at i21_post1
        simpa using i21_post1
      rw [hi21]
      have hround : ¬ ((9007199254740992#u64).val ≤
          (4951760157141521#u64).val) := by norm_num
      rw [if_neg hround]
      step
      have hi22 : mantissa4 = 4503599627370496#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 4503599627370496 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at power21
        rw [Nat.mod_eq_of_lt hb] at power21
        simpa using power21
      rw [hi22]
      step
      have hi23 : i23 = 18442240474082181119#u64 := by
        rw [i23_post]
        rfl
      rw [hi23]
      step
      have hm5 : mantissa5 = 448160529771025#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa5_post1]
        rfl
      rw [hm5]
      have hfinite : ¬ ((2047 : Int) ≤ (983#i32).val) := by norm_num
      rw [if_neg hfinite]
      rfl
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  have compute2 :
      num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000081#u64 =
        ok { m := 448160529771026#u64, p_biased := 983#i32 } := by
    have h : num.imp.dec2flt.lemire.compute_float
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst
          (-30)#i64 1000000000000000081#u64
        ⦃ x => x = ({ m := 448160529771026#u64, p_biased := 983#i32 } :
            num.imp.dec2flt.common.BiasedFp) ⦄ := by
      unfold num.imp.dec2flt.lemire.compute_float
      rw [inf2047]
      simp only [num.imp.dec2flt.common.BiasedFp.zero_pow2]
      rw [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.SMALLEST_POWER_OF_TEN.eq_def]
      simp [F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.LARGEST_POWER_OF_TEN.eq_def,
        sig53, expmin1022, pow30, prod2]
      step
      have hi2 : i2 = (-342)#i64 := by rw [i2_post]; rfl
      rw [hi2]
      have hnsmall : ¬ (-30 < ((-342)#i64).val) := by norm_num
      rw [if_neg hnsmall]
      step
      have hi4 : i4 = 308#i64 := by rw [i4_post]; rfl
      rw [hi4]
      have hnlarge : ¬ (((308)#i64).val < -30) := by norm_num
      rw [if_neg hnlarge]
      step
      have hlz : lz = 4#u32 := by
        rw [lz_post]
        rfl
      rw [hlz]
      step
      have hw1 : w1 = 16000000000000001296#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 16000000000000001296 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at w1_post1
        rw [Nat.mod_eq_of_lt hb] at w1_post1
        norm_num at w1_post1 ⊢
        exact w1_post1
      rw [hw1]
      step
      have hi5 : i5 = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using i5_post1
      rw [hi5]
      step
      have hi6 : i6 = 52#usize := by
        apply UScalar.eq_of_val_eq
        rw [i6_post, UScalar.cast_val_eq]
        simp only [UScalarTy.numBits]
        rw [Dec2Flt.configured_x86_64_numBits]
        norm_num
      rw [hi6]
      step
      have hi7 : i7 = 55#usize := by
        apply UScalar.eq_of_val_eq
        simpa using i7_post
      rw [hi7]
      have hprod : num.imp.dec2flt.lemire.compute_product_approx
          (-30)#i64 16000000000000001296#u64 55#usize
          ⦃ x => x = (15960655803744827408#u64,
              10141204801825836032#u64) ⦄ := by
        rw [prod2]
        simp [WP.spec_ok]
      step
      have hloeq : lo = 15960655803744827408#u64 :=
        congrArg Prod.fst lo_post
      have hhieq : hi = 10141204801825836032#u64 :=
        congrArg Prod.snd lo_post
      rw [hloeq, hhieq]
      have hnomax : (15960655803744827408#u64 : U64) ≠
          18446744073709551615#u64 := by decide
      rw [if_neg hnomax]
      step
      have hi8 : i8 = 1#u64 := by
        apply UScalar.eq_of_val_eq
        rw [i8_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hi8]
      step
      have hupper : upperbit = 1#i32 := by
        rw [upperbit_post]
        rfl
      rw [hupper]
      step
      have hi9 : i9 = 65#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i9_post
      rw [hi9]
      step
      have hi10 : i10 = 52#i32 := by
        rw [i10_post]
        rfl
      rw [hi10]
      step
      have hi11 : i11 = 13#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i11_post
      rw [hi11]
      step
      have hi12 : i12 = 10#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i12_post
      rw [hi12]
      step
      have hmantissa : mantissa = 9903520314283043#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hmantissa]
      step
      have hi13 : i13 = (-30)#i32 := by
        rw [i13_post]
        rfl
      rw [hi13, pow30]
      simp only [bind_tc_ok]
      step
      have hi15 : i15 = (-36)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i15_post
      rw [hi15]
      step
      have hi16 : i16 = 4#i32 := by
        rw [i16_post]
        rfl
      rw [hi16]
      step
      have hi17 : i17 = (-40)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i17_post
      rw [hi17]
      have hexp :
          F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.FloatInst.EXP_MIN
            ⦃ x => x = (-1022)#i32 ⦄ := by
        rw [expmin1022]
        simp [WP.spec_ok]
      step
      have hx0 : x = 52#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx0,
        F64.Insts.Dec2flt_modelNumImpTraitsFloatU64.BITS.eq_def]
      step
      have hx1 : x = 12#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx1]
      step
      have hx2 : x = 11#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx2]
      step
      have hx3 : x = 2048#u32 := by
        apply UScalar.eq_of_val_eq
        have hb : 2048 < U32.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at x_post1
        rw [Nat.mod_eq_of_lt hb] at x_post1
        simpa using x_post1
      rw [hx3]
      step
      have hx4 : x = 2047#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx4]
      step
      have hx5 : x = 1023#u32 := by
        apply UScalar.eq_of_val_eq
        simpa using x_post1
      rw [hx5]
      step
      have hx6 : x = 1023#i32 := by
        rw [x_post]
        rfl
      rw [hx6]
      step
      have hx7 : x = 1022#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using x_post
      rw [hx7]
      step
      have hi18 : i18 = (-1022)#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i18_post
      rw [hi18]
      step
      have hi19 : i19 = 982#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using i19_post
      rw [hi19]
      step
      have hpower2 : power2 = 983#i32 := by
        apply IScalar.eq_of_val_eq
        simpa using power2_post
      rw [hpower2]
      have hpos : ¬ ((983#i32).val ≤ 0) := by norm_num
      rw [if_neg hpos]
      have hlo1 : ¬ ((15960655803744827408#u64).val ≤ 1) := by norm_num
      rw [if_neg hlo1]
      step
      have hm1 : mantissa1 = 1#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa1_post1]
        rfl
      rw [hm1]
      step
      have hm2 : mantissa2 = 9903520314283044#u64 := by
        apply UScalar.eq_of_val_eq
        simpa using mantissa2_post
      rw [hm2]
      step
      have hm3 : mantissa3 = 4951760157141522#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa3_post1]
        norm_num [Nat.shiftRight_eq_div_pow]
      rw [hm3]
      step
      have hi21 : i21 = 9007199254740992#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 9007199254740992 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at i21_post1
        rw [Nat.mod_eq_of_lt hb] at i21_post1
        simpa using i21_post1
      rw [hi21]
      have hround : ¬ ((9007199254740992#u64).val ≤
          (4951760157141522#u64).val) := by norm_num
      rw [if_neg hround]
      step
      have hi22 : mantissa4 = 4503599627370496#u64 := by
        apply UScalar.eq_of_val_eq
        have hb : 4503599627370496 < U64.size := by scalar_tac
        norm_num [Nat.shiftLeft_eq] at power21
        rw [Nat.mod_eq_of_lt hb] at power21
        simpa using power21
      rw [hi22]
      step
      have hi23 : i23 = 18442240474082181119#u64 := by
        rw [i23_post]
        rfl
      rw [hi23]
      step
      have hm5 : mantissa5 = 448160529771026#u64 := by
        apply UScalar.eq_of_val_eq
        rw [mantissa5_post1]
        rfl
      rw [hm5]
      have hfinite : ¬ ((2047 : Int) ≤ (983#i32).val) := by norm_num
      rw [if_neg hfinite]
      rfl
    obtain ⟨x, hx, hxt⟩ := Aeneas.Std.WP.spec_imp_exists h
    simpa [hxt] using hx
  
  exact ⟨compute1, compute2⟩

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (90)
More program dependencies (48)
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 87 entries
Technical checking records
Local closure summary
{
  "node": "ParserNumericLemirePairCertificate",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "cd05d7b1d9874653971a85dc7538a5ca18aae1043b928b6f13e7311fc6d77d1a",
  "active_statement_hash": "077518a957dc7c306c87f84c19704ed28efa0875f04a684a117eb83c006db607",
  "kernel_axioms": [
    "Classical.choice",
    "Dec2Flt.configured_x86_64_numBits",
    "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": {
    "Binary64ModelDefault": "c722a2c00805b545",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS": "cfedcf26d6dae341",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN": "2532cbe447dc07c7",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN": "8a9e3dfa7e9aa5ec",
    "num_imp_dec2flt_common_BiasedFp_zero_pow2": "0f3e5cc6a65d812e",
    "num_imp_dec2flt_lemire_compute_float": "7539bc2a998f5c1c",
    "num_imp_dec2flt_lemire_compute_product_approx": "c004de0227baca74",
    "num_imp_dec2flt_lemire_full_multiplication": "e9ae367eb148ddf9",
    "num_imp_dec2flt_lemire_power": "c968604a57294c88",
    "num_imp_dec2flt_table_LARGEST_POWER_OF_FIVE": "2532cbe447dc07c7",
    "num_imp_dec2flt_table_POWER_OF_FIVE_128": "1190913ff1c52659",
    "num_imp_dec2flt_table_SMALLEST_POWER_OF_FIVE": "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": "c98c2c511cf0ced6",
    "Binary64ModelDefault": "dc548d1e27696ba4",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64": "60afe26c6a80cf0f",
    "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_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_common_BiasedFp_zero_pow2": "0f99ae12c6707137",
    "num_imp_dec2flt_lemire_compute_float": "39d89e3f0a8a9d4c",
    "num_imp_dec2flt_lemire_compute_product_approx": "af91b9cbef7779f3",
    "num_imp_dec2flt_lemire_full_multiplication": "46682dcb8efbf576",
    "num_imp_dec2flt_lemire_power": "56b7c3bd69ca3c6a",
    "num_imp_dec2flt_table_LARGEST_POWER_OF_FIVE": "133d9b18714defd6",
    "num_imp_dec2flt_table_POWER_OF_FIVE_128": "bdd28e83b60fa362",
    "num_imp_dec2flt_table_SMALLEST_POWER_OF_FIVE": "5394ae3df8a14bc9",
    "num_imp_traits_Float": "94ab5f784cdf5db8",
    "num_imp_traits_FloatExt": "f996e5400649797d",
    "num_imp_traits_Float_EXP_BIAS_default": "5dd7cc80f704045f",
    "num_imp_traits_Float_EXP_BITS_default": "423fa566953dc331",
    "num_imp_traits_Float_EXP_MIN_default": "c60925ad5b795762",
    "num_imp_traits_Float_EXP_SAT_default": "18173bfd92d636d4",
    "num_imp_traits_Float_INFINITE_POWER_default": "dc6c1821199cf762",
    "num_imp_traits_Float_SIG_BITS_default": "d2d17782bab6c1ec"
  }
}
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:6a3ba8a3e796d9efeac31b45872d86b2b37b342f649aad9d2d3eb720d6e7613a",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}