NumberHelperScientificExact

Lean checked

Statement

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

Lemma · Exact scientific-exponent scan

Let D be a nonempty list of ASCII digit bytes, and let s consist of D, optionally preceded by byte 43 or byte 45 according as a supplied sign is positive or negative. Define
G(a,b)=\begin{cases}10a+(b-48),&a<65536,\\a,&a\ge65536, \end{cases} \qquad E=\operatorname{foldl}(G,0,D).
Then the extracted parse_scientific consumes all of s and returns exponent E for no sign or a positive sign, and exponent -E for a negative sign.

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.ModelSliceSplitFirst
import Tablet.ModelU8IsAsciiDigit
import Tablet.num_imp_dec2flt_parse_parse_scientific

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: NumberHelperScientificExact]
theorem NumberHelperScientificExact
    (s : Slice Std.U8) (sign : Option Bool) (digits : List Std.U8)
    (hne : digits != [])
    (hdigits : forall b, List.Mem b digits -> 48 <= b.val /\ b.val <= 57)
    (hs : s.val =
      (match sign with
      | none => []
      | some negative => [if negative then 45#u8 else 43#u8]) ++ digits) :
    exists (exponent : Std.I64) (rest : Slice Std.U8),
      num.imp.dec2flt.parse.parse_scientific s = ok (some exponent, rest) /\
      rest.val = [] /\
      exponent.val =
        if sign = some true then
          -((digits.foldl
            (fun a b => if a < 65536 then 10 * a + (b.val - 48) else a)
            0 : Nat) : Int)
        else ((digits.foldl
          (fun a b => if a < 65536 then 10 * a + (b.val - 48) else a)
          0 : Nat) : Int) := 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

First unfold the scientific loop in num imp dec2flt parse parse scientific. For its state (a,k), maintain k\le |D| and
a=\operatorname{foldl}(G,0,D.\operatorname{take}(k)).
If k<|D|, the extracted indexed read is in bounds. The byte there lies in [48,57] by the digit hypothesis. Consequently wrapping subtraction by 48 is ordinary subtraction, the result is below 10, and the loop takes its digit branch. Its second subtraction has the same exact value, and the cast from eight to signed 64 bits preserves that value.
If a<65536, multiplication by 10 is at most 655350 and adding the digit is at most 655359, so both checked signed operations succeed and compute 10a+(b-48)=G(a,b). If a\ge65536, the extracted guard retains a, again equal to G(a,b). The checked index increment succeeds because k+1\le |D|\le2^{64}-1. The standard fold-over-append identity then gives the invariant at k+1, and |D|-k strictly decreases. If the length guard is false, k=|D| and taking the whole list turns the invariant into the claimed exact value E. Thus the loop returns (E,|D|).
Now unfold the outer extracted parser. The split operation is characterized by ModelSliceSplitFirst, and the digit test by ModelU8IsAsciiDigit. With no explicit sign, the first digit is neither byte 43 nor byte 45, so the parser retains the whole list. With an explicit sign, it drops exactly that first byte. In all three cases the remaining slice is precisely D, is nonempty, and its first byte passes the digit test. Applying the loop result makes the final slice drop start at |D|, hence it returns the empty suffix. The unsigned and plus-sign branches return E directly. In the minus-sign branch, E is a natural number represented in a signed word and is therefore nonnegative, so it is not the minimum signed value; checked negation succeeds and has integer value -E. This proves the return equation and exact exponent in every sign case.

Lean proof


  let digitStep : Nat -> Std.U8 -> Nat := fun a b =>
    if a < 65536 then 10 * a + (b.val - 48) else a
  have loop_exact : forall (t : Slice Std.U8),
      (forall b, List.Mem b t.val -> 48 <= b.val /\ b.val <= 57) ->
      num.imp.dec2flt.parse.parse_scientific_loop 0#i64 t 0#usize
        ⦃ p => p.2.val = t.length /\
          p.1.val = ((t.val.foldl digitStep 0 : Nat) : Int) ⦄ := by
    intro t htdigits
    unfold num.imp.dec2flt.parse.parse_scientific_loop
    apply Aeneas.Std.loop.spec_decr_nat
      (fun p : Std.I64 × Std.Usize => t.length - p.2.val)
      (fun p => p.2.val <= t.length /\
        p.1.val = (((t.val.take p.2.val).foldl digitStep 0 : Nat) : Int))
      (fun p => p.2.val = t.length /\
        p.1.val = ((t.val.foldl digitStep 0 : Nat) : Int))
      (fun p => num.imp.dec2flt.parse.parse_scientific_loop.body
        t p.1 p.2)
      (0#i64, 0#usize)
    · intro p hp
      rcases p with ⟨acc, count⟩
      rcases hp with ⟨hcount, hx⟩
      simp [num.imp.dec2flt.parse.parse_scientific_loop.body, WP.spec_ok]
      split
      · rename_i hinside
        step
        have hiMem : List.Mem i1 t.val := by
          rw [i1_post]
          exact List.getElem_mem _
        have hiDigit := htdigits i1 hiMem
        step
        have hi2Val : i2.val = i1.val - 48 := by
          rw [i2_post, core.num.U8.wrapping_sub_val_eq]
          simp only [UScalar.size_UScalarTyU8, U8.size_eq]
          norm_num
          omega
        have hi2Small : i2.val < 10 := by omega
        simp [hi2Small]
        step
        by_cases hxsmall : acc.val < 65536
        · simp only [if_pos hxsmall]
          step
          step
          have hdigitVal : digit.val = i1.val - 48 := by
            rw [digit_post, core.num.U8.wrapping_sub_val_eq]
            simp only [UScalar.size_UScalarTyU8, U8.size_eq]
            norm_num
            omega
          have hxcast : (UScalar.hcast .I64 digit).val = digit.val := by
            have h := UScalar.hcast_inBounds_spec .I64 digit (by scalar_tac)
            simpa [WP.spec_ok] using h
          have hxVal : x.val = digit.val := by
            rw [x_post, hxcast]
          have hmax : exponent1.val + x.val <= I64.max := by
            rw [I64.max_eq]
            omega
          step with IScalar.add_spec
          step
          have hcount1 : count1.val = count.val + 1 := by
            simpa using count1_post
          have hnextValue : exponent1.val =
              10 * acc.val + (i1.val - 48) := by
            rw [exponent1_post, hxVal, hdigitVal]
            omega
          constructor
          · rw [hcount1]
            omega
          · constructor
            · rw [hcount1, List.take_succ_eq_append_getElem hinside,
                List.foldl_append, List.foldl_cons, List.foldl_nil,
                ← i1_post]
              have hfoldsmall :
                  (t.val.take count.val).foldl digitStep 0 < 65536 := by
                rw [hx] at hxsmall
                exact_mod_cast hxsmall
              simp only [digitStep, if_pos hfoldsmall]
              rw [hnextValue, hx]
              simp [Int.subNatNat_of_le (show 48 <= i1.val by omega),
                Int.ofNat_sub (show 48 <= i1.val by omega)]
              simp only [digitStep]
            · rw [hcount1]
              omega
        · simp only [if_neg hxsmall]
          have hcountMax : count.val + 1 <= UScalar.max .Usize := by
            have ht := t.property
            have hbits := Dec2Flt.configured_x86_64_numBits
            simp [UScalar.max, Usize.max, Usize.numBits, hbits] at ht ⊢
            omega
          obtain ⟨nextCount, hnextCount, hcount1⟩ :=
            Aeneas.Std.WP.spec_imp_exists
              (UScalar.add_spec (x := count) (y := 1#usize) hcountMax)
          rw [hnextCount]
          norm_num at hcount1
          constructor
          · rw [hcount1]
            omega
          · constructor
            · rw [hcount1, List.take_succ_eq_append_getElem hinside,
                List.foldl_append, List.foldl_cons, List.foldl_nil, hx,
                ← i1_post]
              have hfoldge : Not
                  ((t.val.take count.val).foldl digitStep 0 < 65536) := by
                intro hsmall
                apply hxsmall
                rw [hx]
                exact_mod_cast hsmall
              simp [digitStep, hfoldge]
            · rw [hcount1]
              omega
      · have hcountEq : count.val = t.val.length := by
          simp only [Slice.length] at hcount
          omega
        simp only [WP.spec_ok]
        exact ⟨by simpa [Slice.length] using hcountEq,
          by rw [hx, hcountEq, List.take_length]⟩
    · norm_num [digitStep]
  cases sign with
  | none =>
    simp only [List.nil_append] at hs
    cases hd : digits with
    | nil => simp_all
    | cons c cs =>
      have hsval : s.val = c :: cs := by simpa [hd] using hs
      let body : Slice Std.U8 := ⟨c :: cs, by simpa [hsval] using s.property⟩
      have hseq : s = body := (Slice.eq_iff _ _).2 (by simpa [body] using hsval)
      have hc := hdigits c (by rw [hd]; exact List.mem_cons_self)
      have hc45 : c ≠ 45#u8 := by scalar_tac
      have hc43 : c ≠ 43#u8 := by scalar_tac
      have hall : forall b, List.Mem b body.val ->
          48 <= b.val /\ b.val <= 57 := by
        intro b hb
        apply hdigits b
        simpa [body, hd] using hb
      obtain ⟨p, hloop, hp⟩ := Aeneas.Std.WP.spec_imp_exists
        (loop_exact body hall)
      rcases p with ⟨e, count⟩
      have hpCount : count.val = (c :: cs).length := by
        simpa [body, Slice.length] using hp.1
      rw [hseq]
      simp [num.imp.dec2flt.parse.parse_scientific,
        core.slice.Slice.split_first, dec2flt_model.ModelSliceSplitFirst,
        core.num.U8.is_ascii_digit, dec2flt_model.ModelU8IsAsciiDigit,
        Slice.index_usize, body, hc45, hc43]
      simp only [if_pos hc]
      rw [hloop]
      simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
        Slice.drop, hp, hpCount, body, digitStep, hd]
  | some negative =>
    cases negative with
    | false =>
      simp at hs
      cases hd : digits with
      | nil => simp_all
      | cons c cs =>
        have hsval : s.val = 43#u8 :: c :: cs := by simpa [hd] using hs
        have tailProp : (c :: cs).length <= Usize.max := by
          have h := s.property
          rw [hsval] at h
          simp at h ⊢
          omega
        let body : Slice Std.U8 := ⟨c :: cs, tailProp⟩
        have hc := hdigits c (by rw [hd]; exact List.mem_cons_self)
        have hall : forall b, List.Mem b body.val ->
            48 <= b.val /\ b.val <= 57 := by
          intro b hb
          apply hdigits b
          simpa [body, hd] using hb
        obtain ⟨p, hloop, hp⟩ := Aeneas.Std.WP.spec_imp_exists
          (loop_exact body hall)
        rcases p with ⟨e, count⟩
        have hpCount : count.val = (c :: cs).length := by
          simpa [body, Slice.length] using hp.1
        let whole : Slice Std.U8 := ⟨43#u8 :: c :: cs, by
          simpa [hsval] using s.property⟩
        have hseq : s = whole := (Slice.eq_iff _ _).2 hsval
        rw [hseq]
        simp [num.imp.dec2flt.parse.parse_scientific,
          core.slice.Slice.split_first, dec2flt_model.ModelSliceSplitFirst,
          core.num.U8.is_ascii_digit, dec2flt_model.ModelU8IsAsciiDigit,
          Slice.index_usize, whole, body]
        simp only [if_pos hc]
        rw [hloop]
        simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
          Slice.drop, hp, hpCount, body, digitStep, hd]
    | true =>
      simp at hs
      cases hd : digits with
      | nil => simp_all
      | cons c cs =>
        have hsval : s.val = 45#u8 :: c :: cs := by simpa [hd] using hs
        have tailProp : (c :: cs).length <= Usize.max := by
          have h := s.property
          rw [hsval] at h
          simp at h ⊢
          omega
        let body : Slice Std.U8 := ⟨c :: cs, tailProp⟩
        have hc := hdigits c (by rw [hd]; exact List.mem_cons_self)
        have hall : forall b, List.Mem b body.val ->
            48 <= b.val /\ b.val <= 57 := by
          intro b hb
          apply hdigits b
          simpa [body, hd] using hb
        obtain ⟨p, hloop, hp⟩ := Aeneas.Std.WP.spec_imp_exists
          (loop_exact body hall)
        rcases p with ⟨e, count⟩
        have hpCount : count.val = (c :: cs).length := by
          simpa [body, Slice.length] using hp.1
        have heNonneg : 0 <= e.val := by rw [hp.2]; omega
        have hnotmin : e.val ≠ IScalar.min .I64 := by
          simp [IScalar.min, I64.min_eq]
          omega
        obtain ⟨ne, hneg, hne⟩ := Aeneas.Std.WP.spec_imp_exists
          (HNeg.hNeg.step e hnotmin)
        let whole : Slice Std.U8 := ⟨45#u8 :: c :: cs, by
          simpa [hsval] using s.property⟩
        have hseq : s = whole := (Slice.eq_iff _ _).2 hsval
        rw [hseq]
        simp [num.imp.dec2flt.parse.parse_scientific,
          core.slice.Slice.split_first, dec2flt_model.ModelSliceSplitFirst,
          core.num.U8.is_ascii_digit, dec2flt_model.ModelU8IsAsciiDigit,
          Slice.index_usize, whole, body]
        simp only [if_pos hc]
        rw [hloop]
        simp [hneg, core.slice.index.SliceIndexRangeFromUsizeSlice.index,
          Slice.drop, hp, hpCount, hne, body, digitStep, hd]

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.Assumptions
import Tablet.ModelSliceSplitFirst
import Tablet.ModelU8IsAsciiDigit
import Tablet.num_imp_dec2flt_parse_parse_scientific

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: NumberHelperScientificExact]
theorem NumberHelperScientificExact
    (s : Slice Std.U8) (sign : Option Bool) (digits : List Std.U8)
    (hne : digits != [])
    (hdigits : forall b, List.Mem b digits -> 48 <= b.val /\ b.val <= 57)
    (hs : s.val =
      (match sign with
      | none => []
      | some negative => [if negative then 45#u8 else 43#u8]) ++ digits) :
    exists (exponent : Std.I64) (rest : Slice Std.U8),
      num.imp.dec2flt.parse.parse_scientific s = ok (some exponent, rest) /\
      rest.val = [] /\
      exponent.val =
        if sign = some true then
          -((digits.foldl
            (fun a b => if a < 65536 then 10 * a + (b.val - 48) else a)
            0 : Nat) : Int)
        else ((digits.foldl
          (fun a b => if a < 65536 then 10 * a + (b.val - 48) else a)
          0 : Nat) : Int) := by
-- BODY
  let digitStep : Nat -> Std.U8 -> Nat := fun a b =>
    if a < 65536 then 10 * a + (b.val - 48) else a
  have loop_exact : forall (t : Slice Std.U8),
      (forall b, List.Mem b t.val -> 48 <= b.val /\ b.val <= 57) ->
      num.imp.dec2flt.parse.parse_scientific_loop 0#i64 t 0#usize
        ⦃ p => p.2.val = t.length /\
          p.1.val = ((t.val.foldl digitStep 0 : Nat) : Int) ⦄ := by
    intro t htdigits
    unfold num.imp.dec2flt.parse.parse_scientific_loop
    apply Aeneas.Std.loop.spec_decr_nat
      (fun p : Std.I64 × Std.Usize => t.length - p.2.val)
      (fun p => p.2.val <= t.length /\
        p.1.val = (((t.val.take p.2.val).foldl digitStep 0 : Nat) : Int))
      (fun p => p.2.val = t.length /\
        p.1.val = ((t.val.foldl digitStep 0 : Nat) : Int))
      (fun p => num.imp.dec2flt.parse.parse_scientific_loop.body
        t p.1 p.2)
      (0#i64, 0#usize)
    · intro p hp
      rcases p with ⟨acc, count⟩
      rcases hp with ⟨hcount, hx⟩
      simp [num.imp.dec2flt.parse.parse_scientific_loop.body, WP.spec_ok]
      split
      · rename_i hinside
        step
        have hiMem : List.Mem i1 t.val := by
          rw [i1_post]
          exact List.getElem_mem _
        have hiDigit := htdigits i1 hiMem
        step
        have hi2Val : i2.val = i1.val - 48 := by
          rw [i2_post, core.num.U8.wrapping_sub_val_eq]
          simp only [UScalar.size_UScalarTyU8, U8.size_eq]
          norm_num
          omega
        have hi2Small : i2.val < 10 := by omega
        simp [hi2Small]
        step
        by_cases hxsmall : acc.val < 65536
        · simp only [if_pos hxsmall]
          step
          step
          have hdigitVal : digit.val = i1.val - 48 := by
            rw [digit_post, core.num.U8.wrapping_sub_val_eq]
            simp only [UScalar.size_UScalarTyU8, U8.size_eq]
            norm_num
            omega
          have hxcast : (UScalar.hcast .I64 digit).val = digit.val := by
            have h := UScalar.hcast_inBounds_spec .I64 digit (by scalar_tac)
            simpa [WP.spec_ok] using h
          have hxVal : x.val = digit.val := by
            rw [x_post, hxcast]
          have hmax : exponent1.val + x.val <= I64.max := by
            rw [I64.max_eq]
            omega
          step with IScalar.add_spec
          step
          have hcount1 : count1.val = count.val + 1 := by
            simpa using count1_post
          have hnextValue : exponent1.val =
              10 * acc.val + (i1.val - 48) := by
            rw [exponent1_post, hxVal, hdigitVal]
            omega
          constructor
          · rw [hcount1]
            omega
          · constructor
            · rw [hcount1, List.take_succ_eq_append_getElem hinside,
                List.foldl_append, List.foldl_cons, List.foldl_nil,
                ← i1_post]
              have hfoldsmall :
                  (t.val.take count.val).foldl digitStep 0 < 65536 := by
                rw [hx] at hxsmall
                exact_mod_cast hxsmall
              simp only [digitStep, if_pos hfoldsmall]
              rw [hnextValue, hx]
              simp [Int.subNatNat_of_le (show 48 <= i1.val by omega),
                Int.ofNat_sub (show 48 <= i1.val by omega)]
              simp only [digitStep]
            · rw [hcount1]
              omega
        · simp only [if_neg hxsmall]
          have hcountMax : count.val + 1 <= UScalar.max .Usize := by
            have ht := t.property
            have hbits := Dec2Flt.configured_x86_64_numBits
            simp [UScalar.max, Usize.max, Usize.numBits, hbits] at ht ⊢
            omega
          obtain ⟨nextCount, hnextCount, hcount1⟩ :=
            Aeneas.Std.WP.spec_imp_exists
              (UScalar.add_spec (x := count) (y := 1#usize) hcountMax)
          rw [hnextCount]
          norm_num at hcount1
          constructor
          · rw [hcount1]
            omega
          · constructor
            · rw [hcount1, List.take_succ_eq_append_getElem hinside,
                List.foldl_append, List.foldl_cons, List.foldl_nil, hx,
                ← i1_post]
              have hfoldge : Not
                  ((t.val.take count.val).foldl digitStep 0 < 65536) := by
                intro hsmall
                apply hxsmall
                rw [hx]
                exact_mod_cast hsmall
              simp [digitStep, hfoldge]
            · rw [hcount1]
              omega
      · have hcountEq : count.val = t.val.length := by
          simp only [Slice.length] at hcount
          omega
        simp only [WP.spec_ok]
        exact ⟨by simpa [Slice.length] using hcountEq,
          by rw [hx, hcountEq, List.take_length]⟩
    · norm_num [digitStep]
  cases sign with
  | none =>
    simp only [List.nil_append] at hs
    cases hd : digits with
    | nil => simp_all
    | cons c cs =>
      have hsval : s.val = c :: cs := by simpa [hd] using hs
      let body : Slice Std.U8 := ⟨c :: cs, by simpa [hsval] using s.property⟩
      have hseq : s = body := (Slice.eq_iff _ _).2 (by simpa [body] using hsval)
      have hc := hdigits c (by rw [hd]; exact List.mem_cons_self)
      have hc45 : c ≠ 45#u8 := by scalar_tac
      have hc43 : c ≠ 43#u8 := by scalar_tac
      have hall : forall b, List.Mem b body.val ->
          48 <= b.val /\ b.val <= 57 := by
        intro b hb
        apply hdigits b
        simpa [body, hd] using hb
      obtain ⟨p, hloop, hp⟩ := Aeneas.Std.WP.spec_imp_exists
        (loop_exact body hall)
      rcases p with ⟨e, count⟩
      have hpCount : count.val = (c :: cs).length := by
        simpa [body, Slice.length] using hp.1
      rw [hseq]
      simp [num.imp.dec2flt.parse.parse_scientific,
        core.slice.Slice.split_first, dec2flt_model.ModelSliceSplitFirst,
        core.num.U8.is_ascii_digit, dec2flt_model.ModelU8IsAsciiDigit,
        Slice.index_usize, body, hc45, hc43]
      simp only [if_pos hc]
      rw [hloop]
      simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
        Slice.drop, hp, hpCount, body, digitStep, hd]
  | some negative =>
    cases negative with
    | false =>
      simp at hs
      cases hd : digits with
      | nil => simp_all
      | cons c cs =>
        have hsval : s.val = 43#u8 :: c :: cs := by simpa [hd] using hs
        have tailProp : (c :: cs).length <= Usize.max := by
          have h := s.property
          rw [hsval] at h
          simp at h ⊢
          omega
        let body : Slice Std.U8 := ⟨c :: cs, tailProp⟩
        have hc := hdigits c (by rw [hd]; exact List.mem_cons_self)
        have hall : forall b, List.Mem b body.val ->
            48 <= b.val /\ b.val <= 57 := by
          intro b hb
          apply hdigits b
          simpa [body, hd] using hb
        obtain ⟨p, hloop, hp⟩ := Aeneas.Std.WP.spec_imp_exists
          (loop_exact body hall)
        rcases p with ⟨e, count⟩
        have hpCount : count.val = (c :: cs).length := by
          simpa [body, Slice.length] using hp.1
        let whole : Slice Std.U8 := ⟨43#u8 :: c :: cs, by
          simpa [hsval] using s.property⟩
        have hseq : s = whole := (Slice.eq_iff _ _).2 hsval
        rw [hseq]
        simp [num.imp.dec2flt.parse.parse_scientific,
          core.slice.Slice.split_first, dec2flt_model.ModelSliceSplitFirst,
          core.num.U8.is_ascii_digit, dec2flt_model.ModelU8IsAsciiDigit,
          Slice.index_usize, whole, body]
        simp only [if_pos hc]
        rw [hloop]
        simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
          Slice.drop, hp, hpCount, body, digitStep, hd]
    | true =>
      simp at hs
      cases hd : digits with
      | nil => simp_all
      | cons c cs =>
        have hsval : s.val = 45#u8 :: c :: cs := by simpa [hd] using hs
        have tailProp : (c :: cs).length <= Usize.max := by
          have h := s.property
          rw [hsval] at h
          simp at h ⊢
          omega
        let body : Slice Std.U8 := ⟨c :: cs, tailProp⟩
        have hc := hdigits c (by rw [hd]; exact List.mem_cons_self)
        have hall : forall b, List.Mem b body.val ->
            48 <= b.val /\ b.val <= 57 := by
          intro b hb
          apply hdigits b
          simpa [body, hd] using hb
        obtain ⟨p, hloop, hp⟩ := Aeneas.Std.WP.spec_imp_exists
          (loop_exact body hall)
        rcases p with ⟨e, count⟩
        have hpCount : count.val = (c :: cs).length := by
          simpa [body, Slice.length] using hp.1
        have heNonneg : 0 <= e.val := by rw [hp.2]; omega
        have hnotmin : e.val ≠ IScalar.min .I64 := by
          simp [IScalar.min, I64.min_eq]
          omega
        obtain ⟨ne, hneg, hne⟩ := Aeneas.Std.WP.spec_imp_exists
          (HNeg.hNeg.step e hnotmin)
        let whole : Slice Std.U8 := ⟨45#u8 :: c :: cs, by
          simpa [hsval] using s.property⟩
        have hseq : s = whole := (Slice.eq_iff _ _).2 hsval
        rw [hseq]
        simp [num.imp.dec2flt.parse.parse_scientific,
          core.slice.Slice.split_first, dec2flt_model.ModelSliceSplitFirst,
          core.num.U8.is_ascii_digit, dec2flt_model.ModelU8IsAsciiDigit,
          Slice.index_usize, whole, body]
        simp only [if_pos hc]
        rw [hloop]
        simp [hneg, core.slice.index.SliceIndexRangeFromUsizeSlice.index,
          Slice.drop, hp, hpCount, hne, body, digitStep, hd]

end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (47)
More program dependencies (14)
Standard-library dependencies (30)

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 31 entries
Technical checking records
Local closure summary
{
  "node": "NumberHelperScientificExact",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "451a9e6102fc1e9faea03560cbf43a5bf47562bf3e2fd101f6e24202cdba23fd",
  "active_statement_hash": "9de86070ece56bae8a70ea4a0e7d908449950d9da70c77b9615da90ec97f9157",
  "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-137",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "ModelSliceSplitFirst": "f617ee05dd2925a9",
    "num_imp_dec2flt_parse_parse_scientific": "ba81300a2601d639"
  },
  "strict_definition_deps": {
    "ModelSliceSplitFirst": "4ed9c51a5bb9fb58",
    "ModelU8IsAsciiDigit": "67d39fc6c37cfc41",
    "Preamble": "956f3baee2191107",
    "num_imp_dec2flt_parse_parse_scientific": "76b01b9377828a5f"
  }
}
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:329293bd87212a63f0420baddbc3ec8dfcc81d230b3848e09df23f9af1185971",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}