ParserSelectedMantissaBound

Lean checked

Statement

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

Lemma

For every source string s, returned binary64 value f, and assembly trace tr, if s satisfies the source-string condition and the traced dispatcher returns the assembled trace tr, then
tr.\texttt{selected\_pair}.m.\mathit{val} \leq 2^{52}.

Lean statement

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

import Tablet.DecimalGoalVocabularyDefault
import Tablet.Assumptions
import Tablet.ModelF64MantissaDigits
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN
import Tablet.num_imp_dec2flt_Dec2FltAssemblyTrace
import Tablet.num_imp_dec2flt_Dec2FltTrace
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_common_BiasedFp
import Tablet.num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq
import Tablet.num_imp_dec2flt_common_BiasedFp_zero_pow2
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_left_shift
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_right_shift
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_round
import Tablet.num_imp_dec2flt_decimal_seq_parse_decimal_seq
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_lemire_compute_product_approx
import Tablet.num_imp_dec2flt_lemire_full_multiplication
import Tablet.num_imp_dec2flt_lemire_power
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa_MAX_SHIFT
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa_closure_Insts_CoreOpsFunctionFnTupleUsizeUsize_call
import Tablet.num_imp_dec2flt_table_LARGEST_POWER_OF_FIVE
import Tablet.num_imp_dec2flt_table_POWER_OF_FIVE_128
import Tablet.num_imp_dec2flt_table_SMALLEST_POWER_OF_FIVE
import Tablet.num_imp_traits_Float_EXP_BIAS_default
import Tablet.num_imp_traits_Float_EXP_BITS_default
import Tablet.num_imp_traits_Float_EXP_MIN_default
import Tablet.num_imp_traits_Float_EXP_SAT_default
import Tablet.num_imp_traits_Float_INFINITE_POWER_default
import Tablet.num_imp_traits_Float_SIG_BITS_default
import Tablet.num_imp_dec2flt_biased_fp_to_float
import Tablet.ParserComputeFloatExponentRange
import Tablet.ParserSlowExponentRange
import Tablet.ParserComputeFloatMantissaBound
import Tablet.ParserSlowMantissaBound
import Tablet.SourceValidByteSlice

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserSelectedMantissaBound]
theorem ParserSelectedMantissaBound :
    ∀ (s : Str) (f : F64) (tr : num.imp.dec2flt.Dec2FltAssemblyTrace F64),
      DecimalGoalVocabularyDefault.sourceString s ->
      num.imp.dec2flt.dec2flt_with_trace
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s =
        ok (core.result.Result.Ok f, num.imp.dec2flt.Dec2FltTrace.Assembled tr) ->
      tr.selected_pair.m.val ≤ 2 ^ 52 := 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 num imp dec2flt dec2flt with trace under the displayed successful Assembled result. The empty-input, sign-only, invalid, special-literal, and fast-path returns have trace constructors distinct from Assembled; hence none can equal the assumed result. Thus numeric parsing returned a record r, the fast path returned none, and the dispatcher reached its integer and slow-converter phase. Every intervening failure propagates through the result monad and therefore cannot occur on this successful execution.
Let b_0 be the result of the first integer conversion. Applying ParserComputeFloatMantissaBound to its recorded call gives b_0.m\leq2^{52}. The next tuple assignment only records the many_digits flags and aliases the same pair as fp, so the bound is preserved. If the second-computation guard is false, the post-comparison pair is exactly b_0.
If that guard is true, the checked addition r.\texttt{mantissa}+1 and the second call to compute_float both succeeded. The second result also satisfies the same bound by ParserComputeFloatMantissaBound. The concrete comparison num imp dec2flt common BiasedFp Insts CoreCmpPartialEqBiasedFp eq then has two outcomes. Equality keeps fp unchanged. Inequality constructs a record update which keeps fp.m unchanged and replaces only its biased exponent by -1. Therefore the post-comparison pair has mantissa at most 2^{52} in either case. This explicitly covers both integer calls, the comparison, and forced deferral.
The final selection tests that post-comparison exponent. If it is negative, the call to the slow converter must succeed and replaces the entire pair. By ParserSlowMantissaBound, the replacement mantissa is strictly less than 2^{52} and hence satisfies the required weak bound. If the test is false, the selected pair is the post-comparison pair and retains the bound just proved.
Finally, both sign branches of num imp dec2flt dec2flt with trace build the Assembled constructor from a record whose selected_pair field is exactly this local selected pair. Failures of conversion to binary64 or of optional negation cannot yield the assumed outer success. Constructor injectivity and projection through num imp dec2flt Dec2FltTrace and num imp dec2flt Dec2FltAssemblyTrace therefore identify the local pair with tr.\texttt{selected\_pair}, transferring the bound to the field claimed in the statement.

Lean proof


  intro s f tr hs h
  have bind_ok_inv : ∀ {α β : Type} (r : Result α) (g : α → Result β) y,
      Bind.bind r g = ok y → ∃ x, r = ok x ∧ g x = ok y := by
    intro α β r g 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⟩
  let Good := fun (x : num.imp.dec2flt.common.BiasedFp) =>
    x.m.val ≤ 2 ^ 52
  unfold num.imp.dec2flt.dec2flt_with_trace at h
  obtain ⟨body, hbody, h⟩ := bind_ok_inv _ _ _ h
  obtain ⟨first, hfirst, h⟩ := bind_ok_inv _ _ _ h
  cases first with
  | none =>
    obtain ⟨pfe, hpfe, h⟩ := bind_ok_inv _ _ _ h
    cases h
  | some c =>
    obtain ⟨body1, hbody1, h⟩ := bind_ok_inv _ _ _ h
    have hbody1Valid : SourceValidByteSlice body1 := by
      have hslen : s.val.length <= 9223372036854775807 := hs.1
      have hbs : body = s := by
        simpa [core.str.Str.as_bytes, ModelStrAsBytes] using hbody.symm
      subst body
      unfold SourceValidByteSlice
      by_cases hminus : c = 45#u8
      · simp only [hminus, if_true] at hbody1
        by_cases hlen : 1 <= s.val.length
        · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
            Slice.drop, hlen] at hbody1
          cases hbody1
          rw [List.length_tail]
          exact Nat.le_trans (Nat.sub_le _ _) hslen
        · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
            hlen] at hbody1
      · simp only [hminus, if_false] at hbody1
        by_cases hplus : c = 43#u8
        · simp only [hplus, if_true] at hbody1
          by_cases hlen : 1 <= s.val.length
          · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              Slice.drop, hlen] at hbody1
            cases hbody1
            rw [List.length_tail]
            exact Nat.le_trans (Nat.sub_le _ _) hslen
          · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              hlen] at hbody1
        · simp only [hplus, if_false] at hbody1
          cases hbody1
          exact hslen
    obtain ⟨empty, hempty, h⟩ := bind_ok_inv _ _ _ h
    by_cases he : empty = true
    · simp only [he, if_true] at h
      obtain ⟨pfe, hpfe, h⟩ := bind_ok_inv _ _ _ h
      cases h
    · have hef : empty = false := Bool.eq_false_of_not_eq_true he
      simp only [hef, if_false] at h
      obtain ⟨parsed, hparsed, h⟩ := bind_ok_inv _ _ _ h
      cases parsed with
      | none =>
        obtain ⟨special, hspecial, h⟩ := bind_ok_inv _ _ _ h
        cases special with
        | none =>
          obtain ⟨pfe, hpfe, h⟩ := bind_ok_inv _ _ _ h
          cases h
        | some value => cases h
      | some r =>
        obtain ⟨fast, hfast, h⟩ := bind_ok_inv _ _ _ h
        cases fast with
        | some value => cases h
        | none =>
          obtain ⟨firstPair, hfirstPair, h⟩ := bind_ok_inv _ _ _ h
          have hfirstGood : Good firstPair :=
            ParserComputeFloatMantissaBound _ _ _ hfirstPair
          obtain ⟨phase1, hphase1, h⟩ := bind_ok_inv _ _ _ h
          rcases phase1 with ⟨many1, many2, firstPair1, fp, guard⟩
          have hfp : fp = firstPair := by
            by_cases hm : r.many_digits
            · simp only [hm, if_true] at hphase1
              cases hphase1
              rfl
            · simp only [hm, if_false] at hphase1
              cases hphase1
              rfl
          subst fp
          obtain ⟨phase2, hphase2, h⟩ := bind_ok_inv _ _ _ h
          rcases phase2 with
            ⟨post, secondExp, secondMant, secondResult, secondEqual, forced⟩
          have hpost : Good post := by
            cases guard with
            | false =>
              simp only [Bool.false_eq_true, if_false] at hphase2
              cases hphase2
              exact hfirstGood
            | true =>
              simp only [if_true] at hphase2
              obtain ⟨mantissa, hmantissa, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              obtain ⟨second, hsecond, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              have hsecondGood : Good second :=
                ParserComputeFloatMantissaBound _ _ _ hsecond
              obtain ⟨equal, hequal, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              obtain ⟨chosen, hchosen, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              rcases chosen with ⟨bf, wasForced⟩
              have hbf : Good bf := by
                by_cases heq : equal = true
                · simp only [heq, if_true] at hchosen
                  cases hchosen
                  exact hfirstGood
                · have heqf : equal = false := Bool.eq_false_of_not_eq_true heq
                  simp only [heqf, if_false] at hchosen
                  cases hchosen
                  exact hfirstGood
              cases hphase2
              exact hbf
          obtain ⟨phase3, hphase3, h⟩ := bind_ok_inv _ _ _ h
          rcases phase3 with ⟨selected, slowGuard, slowResult⟩
          have hselected : Good selected := by
            by_cases hneg : post.p_biased < 0#i32
            · simp only [hneg, if_true] at hphase3
              obtain ⟨replacement, hreplacement, hphase3⟩ :=
                bind_ok_inv _ _ _ hphase3
              have hrange :=
                ParserSlowMantissaBound _ _ hbody1Valid hreplacement
              cases hphase3
              exact Nat.le_of_lt hrange
            · simp only [hneg, if_false] at hphase3
              cases hphase3
              exact hpost
          obtain ⟨i, hi, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i1, hi1, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i2, hi2, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨word, hword, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨assembled, hassembled, h⟩ := bind_ok_inv _ _ _ h
          by_cases hnegative : c = 45#u8
          · simp only [hnegative, if_true] at h
            obtain ⟨result, hresult, h⟩ := bind_ok_inv _ _ _ h
            cases h
            exact hselected
          · simp only [hnegative, if_false] at h
            cases h
            exact hselected

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.Assumptions
import Tablet.ModelF64MantissaDigits
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_LARGEST_POWER_OF_TEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MAX_EXPONENT_ROUND_TO_EVEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_MIN_EXPONENT_ROUND_TO_EVEN
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SMALLEST_POWER_OF_TEN
import Tablet.num_imp_dec2flt_Dec2FltAssemblyTrace
import Tablet.num_imp_dec2flt_Dec2FltTrace
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_common_BiasedFp
import Tablet.num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq
import Tablet.num_imp_dec2flt_common_BiasedFp_zero_pow2
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_left_shift
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_right_shift
import Tablet.num_imp_dec2flt_decimal_seq_DecimalSeq_round
import Tablet.num_imp_dec2flt_decimal_seq_parse_decimal_seq
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_lemire_compute_product_approx
import Tablet.num_imp_dec2flt_lemire_full_multiplication
import Tablet.num_imp_dec2flt_lemire_power
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa_MAX_SHIFT
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa_closure_Insts_CoreOpsFunctionFnTupleUsizeUsize_call
import Tablet.num_imp_dec2flt_table_LARGEST_POWER_OF_FIVE
import Tablet.num_imp_dec2flt_table_POWER_OF_FIVE_128
import Tablet.num_imp_dec2flt_table_SMALLEST_POWER_OF_FIVE
import Tablet.num_imp_traits_Float_EXP_BIAS_default
import Tablet.num_imp_traits_Float_EXP_BITS_default
import Tablet.num_imp_traits_Float_EXP_MIN_default
import Tablet.num_imp_traits_Float_EXP_SAT_default
import Tablet.num_imp_traits_Float_INFINITE_POWER_default
import Tablet.num_imp_traits_Float_SIG_BITS_default
import Tablet.num_imp_dec2flt_biased_fp_to_float
import Tablet.ParserComputeFloatExponentRange
import Tablet.ParserSlowExponentRange
import Tablet.ParserComputeFloatMantissaBound
import Tablet.ParserSlowMantissaBound
import Tablet.SourceValidByteSlice

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserSelectedMantissaBound]
theorem ParserSelectedMantissaBound :
    ∀ (s : Str) (f : F64) (tr : num.imp.dec2flt.Dec2FltAssemblyTrace F64),
      DecimalGoalVocabularyDefault.sourceString s ->
      num.imp.dec2flt.dec2flt_with_trace
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s =
        ok (core.result.Result.Ok f, num.imp.dec2flt.Dec2FltTrace.Assembled tr) ->
      tr.selected_pair.m.val ≤ 2 ^ 52 := by
-- BODY
  intro s f tr hs h
  have bind_ok_inv : ∀ {α β : Type} (r : Result α) (g : α → Result β) y,
      Bind.bind r g = ok y → ∃ x, r = ok x ∧ g x = ok y := by
    intro α β r g 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⟩
  let Good := fun (x : num.imp.dec2flt.common.BiasedFp) =>
    x.m.val ≤ 2 ^ 52
  unfold num.imp.dec2flt.dec2flt_with_trace at h
  obtain ⟨body, hbody, h⟩ := bind_ok_inv _ _ _ h
  obtain ⟨first, hfirst, h⟩ := bind_ok_inv _ _ _ h
  cases first with
  | none =>
    obtain ⟨pfe, hpfe, h⟩ := bind_ok_inv _ _ _ h
    cases h
  | some c =>
    obtain ⟨body1, hbody1, h⟩ := bind_ok_inv _ _ _ h
    have hbody1Valid : SourceValidByteSlice body1 := by
      have hslen : s.val.length <= 9223372036854775807 := hs.1
      have hbs : body = s := by
        simpa [core.str.Str.as_bytes, ModelStrAsBytes] using hbody.symm
      subst body
      unfold SourceValidByteSlice
      by_cases hminus : c = 45#u8
      · simp only [hminus, if_true] at hbody1
        by_cases hlen : 1 <= s.val.length
        · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
            Slice.drop, hlen] at hbody1
          cases hbody1
          rw [List.length_tail]
          exact Nat.le_trans (Nat.sub_le _ _) hslen
        · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
            hlen] at hbody1
      · simp only [hminus, if_false] at hbody1
        by_cases hplus : c = 43#u8
        · simp only [hplus, if_true] at hbody1
          by_cases hlen : 1 <= s.val.length
          · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              Slice.drop, hlen] at hbody1
            cases hbody1
            rw [List.length_tail]
            exact Nat.le_trans (Nat.sub_le _ _) hslen
          · simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              hlen] at hbody1
        · simp only [hplus, if_false] at hbody1
          cases hbody1
          exact hslen
    obtain ⟨empty, hempty, h⟩ := bind_ok_inv _ _ _ h
    by_cases he : empty = true
    · simp only [he, if_true] at h
      obtain ⟨pfe, hpfe, h⟩ := bind_ok_inv _ _ _ h
      cases h
    · have hef : empty = false := Bool.eq_false_of_not_eq_true he
      simp only [hef, if_false] at h
      obtain ⟨parsed, hparsed, h⟩ := bind_ok_inv _ _ _ h
      cases parsed with
      | none =>
        obtain ⟨special, hspecial, h⟩ := bind_ok_inv _ _ _ h
        cases special with
        | none =>
          obtain ⟨pfe, hpfe, h⟩ := bind_ok_inv _ _ _ h
          cases h
        | some value => cases h
      | some r =>
        obtain ⟨fast, hfast, h⟩ := bind_ok_inv _ _ _ h
        cases fast with
        | some value => cases h
        | none =>
          obtain ⟨firstPair, hfirstPair, h⟩ := bind_ok_inv _ _ _ h
          have hfirstGood : Good firstPair :=
            ParserComputeFloatMantissaBound _ _ _ hfirstPair
          obtain ⟨phase1, hphase1, h⟩ := bind_ok_inv _ _ _ h
          rcases phase1 with ⟨many1, many2, firstPair1, fp, guard⟩
          have hfp : fp = firstPair := by
            by_cases hm : r.many_digits
            · simp only [hm, if_true] at hphase1
              cases hphase1
              rfl
            · simp only [hm, if_false] at hphase1
              cases hphase1
              rfl
          subst fp
          obtain ⟨phase2, hphase2, h⟩ := bind_ok_inv _ _ _ h
          rcases phase2 with
            ⟨post, secondExp, secondMant, secondResult, secondEqual, forced⟩
          have hpost : Good post := by
            cases guard with
            | false =>
              simp only [Bool.false_eq_true, if_false] at hphase2
              cases hphase2
              exact hfirstGood
            | true =>
              simp only [if_true] at hphase2
              obtain ⟨mantissa, hmantissa, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              obtain ⟨second, hsecond, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              have hsecondGood : Good second :=
                ParserComputeFloatMantissaBound _ _ _ hsecond
              obtain ⟨equal, hequal, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              obtain ⟨chosen, hchosen, hphase2⟩ :=
                bind_ok_inv _ _ _ hphase2
              rcases chosen with ⟨bf, wasForced⟩
              have hbf : Good bf := by
                by_cases heq : equal = true
                · simp only [heq, if_true] at hchosen
                  cases hchosen
                  exact hfirstGood
                · have heqf : equal = false := Bool.eq_false_of_not_eq_true heq
                  simp only [heqf, if_false] at hchosen
                  cases hchosen
                  exact hfirstGood
              cases hphase2
              exact hbf
          obtain ⟨phase3, hphase3, h⟩ := bind_ok_inv _ _ _ h
          rcases phase3 with ⟨selected, slowGuard, slowResult⟩
          have hselected : Good selected := by
            by_cases hneg : post.p_biased < 0#i32
            · simp only [hneg, if_true] at hphase3
              obtain ⟨replacement, hreplacement, hphase3⟩ :=
                bind_ok_inv _ _ _ hphase3
              have hrange :=
                ParserSlowMantissaBound _ _ hbody1Valid hreplacement
              cases hphase3
              exact Nat.le_of_lt hrange
            · simp only [hneg, if_false] at hphase3
              cases hphase3
              exact hpost
          obtain ⟨i, hi, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i1, hi1, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨i2, hi2, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨word, hword, h⟩ := bind_ok_inv _ _ _ h
          obtain ⟨assembled, hassembled, h⟩ := bind_ok_inv _ _ _ h
          by_cases hnegative : c = 45#u8
          · simp only [hnegative, if_true] at h
            obtain ⟨result, hresult, h⟩ := bind_ok_inv _ _ _ h
            cases h
            exact hselected
          · simp only [hnegative, if_false] at h
            cases h
            exact hselected

end dec2flt_model

Proof structure

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

Uses

All 54 entries

Explore this dependency tree

Inspect related source (201)
More program dependencies (159)
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 157 entries
Technical checking records
Local closure summary
{
  "node": "ParserSelectedMantissaBound",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "db363c70a7e823c41efd016c5640f7b5dda9b5ae18dd660cd34fc3213fb03e02",
  "active_statement_hash": "9c3e09cc8d6543e2b17686d3a2bc3946e45549f13a4654a0d5796827dfaa8641",
  "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-134",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "ParserComputeFloatMantissaBound": "c9d09def95c8f127",
    "ParserSlowMantissaBound": "aa8171dd17b49dff",
    "num_imp_dec2flt_dec2flt_with_trace": "8f54814ba9c190ea",
    "num_imp_traits_Float_SIG_BITS_default": "9ab622d85ef04d94"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "1f42f752b5d22513",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64": "60afe26c6a80cf0f",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
    "ModelStrAsBytes": "024fe35b4dbfa9a3",
    "Preamble": "86dc391ab250c79b",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "core_ops_arith_Neg": "0ff07135a60bcbf9",
    "num_float_parse_ParseFloatError": "c43614ff2149ecf2",
    "num_imp_dec2flt_Dec2FltAssemblyTrace": "598dfa7d7b371110",
    "num_imp_dec2flt_Dec2FltTrace": "6722f59984275e94",
    "num_imp_dec2flt_Lemire": "1923f90c53d323e6",
    "num_imp_dec2flt_biased_fp_to_float": "acdde060e8d35ca7",
    "num_imp_dec2flt_common_BiasedFp": "5c88d5d7976c5e8f",
    "num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq": "fbbf553e3c502a05",
    "num_imp_dec2flt_dec2flt_with_trace": "5665189e0304a27e",
    "num_imp_dec2flt_decimal_Decimal": "4c41a56bf44cb31e",
    "num_imp_dec2flt_decimal_Decimal_try_fast_path": "2e4888f65a06b49f",
    "num_imp_dec2flt_lemire_compute_float": "39d89e3f0a8a9d4c",
    "num_imp_dec2flt_parse_parse_inf_nan": "85655c19a8791b54",
    "num_imp_dec2flt_parse_parse_number": "f73f8bc11faa6db3",
    "num_imp_dec2flt_pfe_empty": "89046d1da5ac1ce2",
    "num_imp_dec2flt_pfe_invalid": "21db875427d92c6d",
    "num_imp_dec2flt_slow_parse_long_mantissa": "cd8af64c3688b60f",
    "num_imp_traits_Float": "02acccb9db3e30f2",
    "num_imp_traits_FloatExt": "f996e5400649797d"
  }
}
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:cdba507fbec05072d9fdb4a1373b5b263a1161984047d242e4e055e2a3a3bfcd",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}