Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Lemma · Safe threshold-bounded digit retry
try_parse_19digits returns normally. Its returned slice is a
remaining digit suffix followed by the same tail, every byte in that suffix
is a decimal digit, the suffix is no longer than the original digit list,
and the original digit list is the consumed prefix followed by that suffix.
The returned accumulator is the ordinary base-ten fold of the consumed
prefix from the initial accumulator and is at most
10^{19}-1. If that accumulator is below 10^{18}, the remaining
digit suffix is empty. If the initial accumulator is zero and the returned
accumulator is at least 10^{18}, at least 19 original digits were
consumed.Lean statement
Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.
import Tablet.ModelSliceSplitFirst
import Tablet.num_imp_dec2flt_parse_MIN_19DIGIT_INT
import Tablet.num_imp_dec2flt_parse_try_parse_19digits
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: NumberHelperTryParse19SafeLength]
theorem NumberHelperTryParse19SafeLength :
forall (s : Slice Std.U8) (initial : Std.U64)
(digits tail : List Std.U8),
s.val = digits ++ tail ->
(forall b, List.Mem b digits -> 48 <= b.val /\ b.val <= 57) ->
(forall b rest, tail = b :: rest ->
Not (48 <= b.val /\ b.val <= 57)) ->
initial.val <= 9999999999999999999 ->
exists (rest : Slice Std.U8) (mantissa : Std.U64)
(remaining consumed : List Std.U8),
num.imp.dec2flt.parse.try_parse_19digits s initial =
ok (rest, mantissa) /\
digits = consumed ++ remaining /\
rest.val = remaining ++ tail /\
mantissa.val = consumed.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b remaining -> 48 <= b.val /\ b.val <= 57) /\
remaining.length <= digits.length /\
mantissa.val <= 9999999999999999999 /\
(mantissa.val < 1000000000000000000 -> remaining = []) /\
(initial.val = 0 -> 1000000000000000000 <= mantissa.val ->
remaining.length + 19 <= digits.length) := 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
u64 cast,
multiplication, and addition all succeed, and removing the head byte strictly
decreases the measure while preserving the suffix decomposition.Lean proof
intro s initial digits tail hs hdigits htail hinitial
have loop_safe : forall (t : Slice Std.U8) (x : Std.U64)
(consumed remaining : List Std.U8),
digits = consumed ++ remaining ->
t.val = remaining ++ tail ->
x.val = consumed.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val ->
(forall b, List.Mem b remaining -> 48 <= b.val /\ b.val <= 57) ->
x.val <= 9999999999999999999 ->
num.imp.dec2flt.parse.try_parse_19digits_loop x t
⦃ p => exists used rem : List Std.U8,
digits = used ++ rem /\
p.1.val = rem ++ tail /\
p.2.val = used.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b rem -> 48 <= b.val /\ b.val <= 57) /\
rem.length <= remaining.length /\
p.2.val <= 9999999999999999999 /\
(p.2.val < 1000000000000000000 -> rem = []) ⦄ := by
intro t x consumed remaining hpartition ht hvalue hrem hx
unfold num.imp.dec2flt.parse.try_parse_19digits_loop
apply Aeneas.Std.loop.spec_decr_nat
(fun p : Std.U64 × Slice Std.U8 => p.2.length)
(fun p => exists used rem : List Std.U8,
digits = used ++ rem /\
p.2.val = rem ++ tail /\
p.1.val = used.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b rem -> 48 <= b.val /\ b.val <= 57) /\
rem.length <= remaining.length /\
p.1.val <= 9999999999999999999)
(fun p => exists used rem : List Std.U8,
digits = used ++ rem /\
p.1.val = rem ++ tail /\
p.2.val = used.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b rem -> 48 <= b.val /\ b.val <= 57) /\
rem.length <= remaining.length /\
p.2.val <= 9999999999999999999 /\
(p.2.val < 1000000000000000000 -> rem = []))
(fun p => num.imp.dec2flt.parse.try_parse_19digits_loop.body p.1 p.2)
(x, t)
· intro p hp
rcases p with ⟨a, u⟩
rcases hp with
⟨used, rem, hpartitionNow, hurem, hvalueNow,
hrdigits, hremlen, ha⟩
simp [num.imp.dec2flt.parse.try_parse_19digits_loop.body, WP.spec_ok]
split
· rename_i halow
cases rem with
| nil =>
simp at hurem
cases htailval : tail with
| nil =>
have huempty : u.val = [] := by simpa [htailval] using hurem
let empty : Slice Std.U8 := ⟨[], by simp⟩
have hueq : u = empty := (Slice.eq_iff _ _).2 huempty
subst u
simp only [core.slice.Slice.split_first,
dec2flt_model.ModelSliceSplitFirst, empty, List.nil_append]
simp [WP.spec_ok, ha]
constructor
· rw [hpartitionNow]
simpa using hvalueNow
· exact hrdigits
| cons b bs =>
have huval : u.val = b :: bs := by simpa [htailval] using hurem
have hbnot := htail b bs htailval
have hbsprop : bs.length <= Usize.max := by
have := u.property
simp [huval] at this ⊢
omega
have hubound : (b :: bs).length <= Usize.max := by
simpa [huval] using u.property
let us : Slice Std.U8 := ⟨b :: bs, hubound⟩
have hueq : u = us := (Slice.eq_iff _ _).2 huval
subst u
have hwrap : (core.num.U8.wrapping_sub b 48#u8).val =
(b.val + 256 - 48) % 256 := by
rw [core.num.U8.wrapping_sub_val_eq]
simp [UScalar.size, U8.size_eq]
have hnondigit :
Not ((core.num.U8.wrapping_sub b 48#u8).val < 10) := by
rw [hwrap]
scalar_tac
have hrawnon : Not ((b.val + (256 - 48)) % 256 < 10) := by
simpa [hwrap] using hnondigit
simp [core.slice.Slice.split_first,
dec2flt_model.ModelSliceSplitFirst, us, Aeneas.Std.lift,
U8.size_eq, hrawnon]
refine ⟨?_, hrdigits, ha⟩
rw [hpartitionNow]
simpa using hvalueNow
| cons b bs =>
have huval : u.val = b :: (bs ++ tail) := by simpa using hurem
have hb := hrdigits b (List.mem_cons_self)
have htailprop : (bs ++ tail).length <= Usize.max := by
have := u.property
simp [huval] at this ⊢
omega
have hubound : (b :: (bs ++ tail)).length <= Usize.max := by
simpa [huval] using u.property
let us : Slice Std.U8 := ⟨b :: (bs ++ tail), hubound⟩
have hueq : u = us := (Slice.eq_iff _ _).2 huval
subst u
have hdigitval :
(core.num.U8.wrapping_sub b 48#u8).val = b.val - 48 := by
rw [core.num.U8.wrapping_sub_val_eq]
simp [UScalar.size, U8.size_eq]
omega
have hdigit :
(core.num.U8.wrapping_sub b 48#u8).val < 10 := by
rw [hdigitval]
omega
have hraw : (b.val + (256 - 48)) % 256 < 10 := by
scalar_tac
have halow_num : a.val < 1000000000000000000 := by
simpa [num.imp.dec2flt.parse.MIN_19DIGIT_INT.eq_def] using halow
simp [core.slice.Slice.split_first,
dec2flt_model.ModelSliceSplitFirst, us]
step
have hcast := UScalar.cast_inBounds_spec .U64 digit (by scalar_tac)
obtain ⟨digit64, hdigit64, hdigit64val⟩ :=
Aeneas.Std.WP.spec_imp_exists hcast
rw [hdigit64]
have hmullo : a.val * 10 <= U64.max := by
rw [U64.max_eq]
omega
have hmul := UScalar.mul_spec (x := a) (y := 10#u64) (by
simpa using hmullo)
obtain ⟨prod, hprod, hprodval⟩ :=
Aeneas.Std.WP.spec_imp_exists hmul
rw [hprod]
have hsumlo : prod.val + digit64.val <= U64.max := by
rw [U64.max_eq]
simp at hdigit64val hprodval
rw [digit_post, hdigitval] at hdigit64val
omega
have hsum := UScalar.add_spec (x := prod) (y := digit64) (by
simpa using hsumlo)
obtain ⟨next, hnext, hnextval⟩ :=
Aeneas.Std.WP.spec_imp_exists hsum
simp [digit_post, U8.size_eq, hraw, hnext]
refine ⟨used ++ [b], ?_, ?_, ?_, ?_, ?_⟩
· simpa [List.append_assoc] using hpartitionNow
· simp only [List.foldl_append, List.foldl_cons, List.foldl_nil]
simp at hprodval hdigit64val hnextval
simp at hvalueNow
rw [digit_post, hdigitval] at hdigit64val
omega
· intro c hc
exact hrdigits c (List.mem_cons_of_mem b hc)
· simp only [List.length_cons] at hremlen
omega
· simp at hprodval hdigit64val hnextval
rw [digit_post, hdigitval] at hdigit64val
omega
· rename_i hahigh
simp [WP.spec_ok]
simp [num.imp.dec2flt.parse.MIN_19DIGIT_INT.eq_def] at hahigh
exact ⟨used, rem, hpartitionNow, hurem, hvalueNow,
hrdigits, hremlen, ha, by omega⟩
· exact ⟨consumed, remaining, hpartition, ht, hvalue,
hrem, Nat.le_refl _, hx⟩
have h := loop_safe s initial [] digits (by simp) hs (by simp) hdigits hinitial
obtain ⟨p, hp, hpost⟩ := Aeneas.Std.WP.spec_imp_exists h
rcases p with ⟨rest, mantissa⟩
rcases hpost with
⟨consumed, remaining, hpartition, hrest, hvalue,
hremaining, hremainingLen, hmantissa, hlow⟩
have foldUpper : forall (ds : List Std.U8) (a : Nat),
(forall b, List.Mem b ds -> 48 <= b.val /\ b.val <= 57) ->
ds.foldl (fun x b => 10 * x + (b.val - 48)) a <
(a + 1) * 10 ^ ds.length := by
intro ds
induction ds with
| nil =>
intro a hds
simp
| cons b bs ih =>
intro a hds
have hb := hds b List.mem_cons_self
have hbs : forall c, List.Mem c bs -> 48 <= c.val /\ c.val <= 57 := by
intro c hc
exact hds c (List.mem_cons_of_mem b hc)
simp only [List.foldl_cons, List.length_cons, Nat.pow_succ]
have hrec := ih (10 * a + (b.val - 48)) hbs
have hcoeff : 10 * a + (b.val - 48) + 1 <= 10 * (a + 1) := by
omega
have hmul := Nat.mul_le_mul_right (10 ^ bs.length) hcoeff
exact hrec.trans_le (by
simpa [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hmul)
have hconsumedDigits : forall b, List.Mem b consumed ->
48 <= b.val /\ b.val <= 57 := by
intro b hb
apply hdigits b
rw [hpartition]
exact List.mem_append_left _ hb
have hsharp : initial.val = 0 ->
1000000000000000000 <= mantissa.val ->
remaining.length + 19 <= digits.length := by
intro hinitialZero hthreshold
have hfoldUpper := foldUpper consumed initial.val hconsumedDigits
rw [hvalue, hinitialZero] at hthreshold
rw [hinitialZero] at hfoldUpper
simp only [Nat.zero_add, Nat.one_mul] at hfoldUpper
have hconsumedLen : 19 <= consumed.length := by
by_contra hnot
have hpow : 10 ^ consumed.length <= 10 ^ 18 :=
Nat.pow_le_pow_right (by norm_num) (by omega)
norm_num at hthreshold
omega
have hlength := congrArg List.length hpartition
simp only [List.length_append] at hlength
omega
exact ⟨rest, mantissa, remaining, consumed, hp, hpartition, hrest,
hvalue, hremaining, hremainingLen, hmantissa, hlow, hsharp⟩
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.ModelSliceSplitFirst
import Tablet.num_imp_dec2flt_parse_MIN_19DIGIT_INT
import Tablet.num_imp_dec2flt_parse_try_parse_19digits
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: NumberHelperTryParse19SafeLength]
theorem NumberHelperTryParse19SafeLength :
forall (s : Slice Std.U8) (initial : Std.U64)
(digits tail : List Std.U8),
s.val = digits ++ tail ->
(forall b, List.Mem b digits -> 48 <= b.val /\ b.val <= 57) ->
(forall b rest, tail = b :: rest ->
Not (48 <= b.val /\ b.val <= 57)) ->
initial.val <= 9999999999999999999 ->
exists (rest : Slice Std.U8) (mantissa : Std.U64)
(remaining consumed : List Std.U8),
num.imp.dec2flt.parse.try_parse_19digits s initial =
ok (rest, mantissa) /\
digits = consumed ++ remaining /\
rest.val = remaining ++ tail /\
mantissa.val = consumed.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b remaining -> 48 <= b.val /\ b.val <= 57) /\
remaining.length <= digits.length /\
mantissa.val <= 9999999999999999999 /\
(mantissa.val < 1000000000000000000 -> remaining = []) /\
(initial.val = 0 -> 1000000000000000000 <= mantissa.val ->
remaining.length + 19 <= digits.length) := by
-- BODY
intro s initial digits tail hs hdigits htail hinitial
have loop_safe : forall (t : Slice Std.U8) (x : Std.U64)
(consumed remaining : List Std.U8),
digits = consumed ++ remaining ->
t.val = remaining ++ tail ->
x.val = consumed.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val ->
(forall b, List.Mem b remaining -> 48 <= b.val /\ b.val <= 57) ->
x.val <= 9999999999999999999 ->
num.imp.dec2flt.parse.try_parse_19digits_loop x t
⦃ p => exists used rem : List Std.U8,
digits = used ++ rem /\
p.1.val = rem ++ tail /\
p.2.val = used.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b rem -> 48 <= b.val /\ b.val <= 57) /\
rem.length <= remaining.length /\
p.2.val <= 9999999999999999999 /\
(p.2.val < 1000000000000000000 -> rem = []) ⦄ := by
intro t x consumed remaining hpartition ht hvalue hrem hx
unfold num.imp.dec2flt.parse.try_parse_19digits_loop
apply Aeneas.Std.loop.spec_decr_nat
(fun p : Std.U64 × Slice Std.U8 => p.2.length)
(fun p => exists used rem : List Std.U8,
digits = used ++ rem /\
p.2.val = rem ++ tail /\
p.1.val = used.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b rem -> 48 <= b.val /\ b.val <= 57) /\
rem.length <= remaining.length /\
p.1.val <= 9999999999999999999)
(fun p => exists used rem : List Std.U8,
digits = used ++ rem /\
p.1.val = rem ++ tail /\
p.2.val = used.foldl
(fun a b => 10 * a + (b.val - 48)) initial.val /\
(forall b, List.Mem b rem -> 48 <= b.val /\ b.val <= 57) /\
rem.length <= remaining.length /\
p.2.val <= 9999999999999999999 /\
(p.2.val < 1000000000000000000 -> rem = []))
(fun p => num.imp.dec2flt.parse.try_parse_19digits_loop.body p.1 p.2)
(x, t)
· intro p hp
rcases p with ⟨a, u⟩
rcases hp with
⟨used, rem, hpartitionNow, hurem, hvalueNow,
hrdigits, hremlen, ha⟩
simp [num.imp.dec2flt.parse.try_parse_19digits_loop.body, WP.spec_ok]
split
· rename_i halow
cases rem with
| nil =>
simp at hurem
cases htailval : tail with
| nil =>
have huempty : u.val = [] := by simpa [htailval] using hurem
let empty : Slice Std.U8 := ⟨[], by simp⟩
have hueq : u = empty := (Slice.eq_iff _ _).2 huempty
subst u
simp only [core.slice.Slice.split_first,
dec2flt_model.ModelSliceSplitFirst, empty, List.nil_append]
simp [WP.spec_ok, ha]
constructor
· rw [hpartitionNow]
simpa using hvalueNow
· exact hrdigits
| cons b bs =>
have huval : u.val = b :: bs := by simpa [htailval] using hurem
have hbnot := htail b bs htailval
have hbsprop : bs.length <= Usize.max := by
have := u.property
simp [huval] at this ⊢
omega
have hubound : (b :: bs).length <= Usize.max := by
simpa [huval] using u.property
let us : Slice Std.U8 := ⟨b :: bs, hubound⟩
have hueq : u = us := (Slice.eq_iff _ _).2 huval
subst u
have hwrap : (core.num.U8.wrapping_sub b 48#u8).val =
(b.val + 256 - 48) % 256 := by
rw [core.num.U8.wrapping_sub_val_eq]
simp [UScalar.size, U8.size_eq]
have hnondigit :
Not ((core.num.U8.wrapping_sub b 48#u8).val < 10) := by
rw [hwrap]
scalar_tac
have hrawnon : Not ((b.val + (256 - 48)) % 256 < 10) := by
simpa [hwrap] using hnondigit
simp [core.slice.Slice.split_first,
dec2flt_model.ModelSliceSplitFirst, us, Aeneas.Std.lift,
U8.size_eq, hrawnon]
refine ⟨?_, hrdigits, ha⟩
rw [hpartitionNow]
simpa using hvalueNow
| cons b bs =>
have huval : u.val = b :: (bs ++ tail) := by simpa using hurem
have hb := hrdigits b (List.mem_cons_self)
have htailprop : (bs ++ tail).length <= Usize.max := by
have := u.property
simp [huval] at this ⊢
omega
have hubound : (b :: (bs ++ tail)).length <= Usize.max := by
simpa [huval] using u.property
let us : Slice Std.U8 := ⟨b :: (bs ++ tail), hubound⟩
have hueq : u = us := (Slice.eq_iff _ _).2 huval
subst u
have hdigitval :
(core.num.U8.wrapping_sub b 48#u8).val = b.val - 48 := by
rw [core.num.U8.wrapping_sub_val_eq]
simp [UScalar.size, U8.size_eq]
omega
have hdigit :
(core.num.U8.wrapping_sub b 48#u8).val < 10 := by
rw [hdigitval]
omega
have hraw : (b.val + (256 - 48)) % 256 < 10 := by
scalar_tac
have halow_num : a.val < 1000000000000000000 := by
simpa [num.imp.dec2flt.parse.MIN_19DIGIT_INT.eq_def] using halow
simp [core.slice.Slice.split_first,
dec2flt_model.ModelSliceSplitFirst, us]
step
have hcast := UScalar.cast_inBounds_spec .U64 digit (by scalar_tac)
obtain ⟨digit64, hdigit64, hdigit64val⟩ :=
Aeneas.Std.WP.spec_imp_exists hcast
rw [hdigit64]
have hmullo : a.val * 10 <= U64.max := by
rw [U64.max_eq]
omega
have hmul := UScalar.mul_spec (x := a) (y := 10#u64) (by
simpa using hmullo)
obtain ⟨prod, hprod, hprodval⟩ :=
Aeneas.Std.WP.spec_imp_exists hmul
rw [hprod]
have hsumlo : prod.val + digit64.val <= U64.max := by
rw [U64.max_eq]
simp at hdigit64val hprodval
rw [digit_post, hdigitval] at hdigit64val
omega
have hsum := UScalar.add_spec (x := prod) (y := digit64) (by
simpa using hsumlo)
obtain ⟨next, hnext, hnextval⟩ :=
Aeneas.Std.WP.spec_imp_exists hsum
simp [digit_post, U8.size_eq, hraw, hnext]
refine ⟨used ++ [b], ?_, ?_, ?_, ?_, ?_⟩
· simpa [List.append_assoc] using hpartitionNow
· simp only [List.foldl_append, List.foldl_cons, List.foldl_nil]
simp at hprodval hdigit64val hnextval
simp at hvalueNow
rw [digit_post, hdigitval] at hdigit64val
omega
· intro c hc
exact hrdigits c (List.mem_cons_of_mem b hc)
· simp only [List.length_cons] at hremlen
omega
· simp at hprodval hdigit64val hnextval
rw [digit_post, hdigitval] at hdigit64val
omega
· rename_i hahigh
simp [WP.spec_ok]
simp [num.imp.dec2flt.parse.MIN_19DIGIT_INT.eq_def] at hahigh
exact ⟨used, rem, hpartitionNow, hurem, hvalueNow,
hrdigits, hremlen, ha, by omega⟩
· exact ⟨consumed, remaining, hpartition, ht, hvalue,
hrem, Nat.le_refl _, hx⟩
have h := loop_safe s initial [] digits (by simp) hs (by simp) hdigits hinitial
obtain ⟨p, hp, hpost⟩ := Aeneas.Std.WP.spec_imp_exists h
rcases p with ⟨rest, mantissa⟩
rcases hpost with
⟨consumed, remaining, hpartition, hrest, hvalue,
hremaining, hremainingLen, hmantissa, hlow⟩
have foldUpper : forall (ds : List Std.U8) (a : Nat),
(forall b, List.Mem b ds -> 48 <= b.val /\ b.val <= 57) ->
ds.foldl (fun x b => 10 * x + (b.val - 48)) a <
(a + 1) * 10 ^ ds.length := by
intro ds
induction ds with
| nil =>
intro a hds
simp
| cons b bs ih =>
intro a hds
have hb := hds b List.mem_cons_self
have hbs : forall c, List.Mem c bs -> 48 <= c.val /\ c.val <= 57 := by
intro c hc
exact hds c (List.mem_cons_of_mem b hc)
simp only [List.foldl_cons, List.length_cons, Nat.pow_succ]
have hrec := ih (10 * a + (b.val - 48)) hbs
have hcoeff : 10 * a + (b.val - 48) + 1 <= 10 * (a + 1) := by
omega
have hmul := Nat.mul_le_mul_right (10 ^ bs.length) hcoeff
exact hrec.trans_le (by
simpa [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm] using hmul)
have hconsumedDigits : forall b, List.Mem b consumed ->
48 <= b.val /\ b.val <= 57 := by
intro b hb
apply hdigits b
rw [hpartition]
exact List.mem_append_left _ hb
have hsharp : initial.val = 0 ->
1000000000000000000 <= mantissa.val ->
remaining.length + 19 <= digits.length := by
intro hinitialZero hthreshold
have hfoldUpper := foldUpper consumed initial.val hconsumedDigits
rw [hvalue, hinitialZero] at hthreshold
rw [hinitialZero] at hfoldUpper
simp only [Nat.zero_add, Nat.one_mul] at hfoldUpper
have hconsumedLen : 19 <= consumed.length := by
by_contra hnot
have hpow : 10 ^ consumed.length <= 10 ^ 18 :=
Nat.pow_le_pow_right (by norm_num) (by omega)
norm_num at hthreshold
omega
have hlength := congrArg List.length hpartition
simp only [List.length_append] at hlength
omega
exact ⟨rest, mantissa, remaining, consumed, hp, hpartition, hrest,
hvalue, hremaining, hremainingLen, hmantissa, hlow, hsharp⟩
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
Used by
- NumberHelperFractionalManyDigitsSafeLength
- NumberHelperFractionalManyDigitsSourceLength
- NumberHelperFractionalManyExact
- NumberHelperIntegralManyDigitsSafeLength
- NumberHelperIntegralManyDigitsSourceLength
- NumberHelperIntegralManyExact
All 11 entries
- NumberHelperFractionalManyDigitsSafeLength
- NumberHelperFractionalManyDigitsSourceLength
- NumberHelperFractionalManyExact
- NumberHelperIntegralManyDigitsSafeLength
- NumberHelperIntegralManyDigitsSourceLength
- NumberHelperIntegralManyExact
- NumberHelperManyRetryAccounting
- NumberHelperMaximalRetryScan
- NumberHelperRecordBounds
- ParserNumericLeadingTry19Certificate
- ParserNumericTry19Certificate
Inspect related source (48)
- MIN_19DIGIT_INT · dec2flt/parse.rs:8 Program Rust
- try_parse_19digits · dec2flt/parse.rs:61 Program Rust
- try_parse_19digits_loop · dec2flt/parse.rs:64 Program Rust
More program dependencies (15)
- body · dec2flt/parse.rs:64 Program Rust
- from_u64 · dec2flt/mod.rs:263 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- CastInto · traits.rs:18 Program Rust
- Float · traits.rs:74 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
Standard-library dependencies (30)
- split_first · core/src/slice/mod.rs:198 Rust library
- clone · core/src/clone.rs:698 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- mul · core/src/ops/arith.rs:350 Rust library
- neg · core/src/ops/arith.rs:719 Rust library
- bitand · core/src/ops/bit.rs:178 Rust library
- bitor · core/src/ops/bit.rs:282 Rust library
- shl · core/src/ops/bit.rs:489 Rust library
- shr · core/src/ops/bit.rs:612 Rust library
- EXPONENT_MASK · core/src/num/f64.rs:615 Rust library
- INFINITY · core/src/num/f64.rs:512 Rust library
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- MANTISSA_MASK · core/src/num/f64.rs:637 Rust library
- NAN · core/src/num/f64.rs:509 Rust library
- NEG_INFINITY · core/src/num/f64.rs:515 Rust library
- classify · core/src/num/f64.rs:782 Rust library
- from_bits · core/src/num/f64.rs:1269 Rust library
- to_bits · core/src/num/f64.rs:1223 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- from_residual · core/src/option.rs:2793 Rust library
- branch · core/src/option.rs:2779 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- FpCategory · core/src/num/mod.rs:1522 Rust library
- Div · core/src/ops/arith.rs:460 Rust library
- Mul · core/src/ops/arith.rs:322 Rust library
- Neg · core/src/ops/arith.rs:690 Rust library
- BitOr · core/src/ops/bit.rs:254 Rust library
- Shl · core/src/ops/bit.rs:461 Rust library
- Shr · core/src/ops/bit.rs:584 Rust library
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
- Classical.choice
- Quot.sound
- propext
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 32 entries
- Binary64Model
- Binary64ModelDefault
- F64
- ModelF64Classify
- ModelF64Clone
- ModelF64Div
- ModelF64ExponentMask
- ModelF64FromBits
- ModelF64FromU64
- ModelF64Infinity
- ModelF64MantissaDigits
- ModelF64MantissaMask
- ModelF64Mul
- ModelF64Nan
- ModelF64Neg
- ModelF64NegInfinity
- ModelF64ToBits
- ModelOptionBranch
- ModelOptionFromResidual
- ModelSliceFirst
- ModelSliceSplitFirst
- ModelStrAsBytes
- ModelU64BitAnd
- ModelU64BitOr
- ModelU64Shl
- ModelU64Shr
- ModelU8IsAsciiDigit
- NumberHelperTryParse19SafeLength
- Preamble
- core num FpCategory
- num imp dec2flt parse MIN 19DIGIT INT
- num imp dec2flt parse try parse 19digits
Technical checking records
Local closure summary
{
"node": "NumberHelperTryParse19SafeLength",
"closure_version": "patch_c_v1",
"active_decl_hash": "f183fdc0996c10ecdc5dfb81db2a1375af95748a28817d49a23adcfb583f5eb8",
"active_statement_hash": "9cab43e661d3d4bb2ea1d94a0b436fa611013e366214d382a03fa2c14b698078",
"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-109",
"boundary_theorems": {},
"strict_theorem_deps": {
"ModelSliceSplitFirst": "f617ee05dd2925a9",
"num_imp_dec2flt_parse_MIN_19DIGIT_INT": "8d99761093f40bc7",
"num_imp_dec2flt_parse_try_parse_19digits": "bcad6df678c024ae"
},
"strict_definition_deps": {
"ModelSliceSplitFirst": "4ed9c51a5bb9fb58",
"Preamble": "965f15fc36f80938",
"num_imp_dec2flt_parse_MIN_19DIGIT_INT": "476edc5502ff7bfb",
"num_imp_dec2flt_parse_try_parse_19digits": "c9c74554a359a9c4"
}
}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:b275b3c379661caed48ef2e8ede9ba6084a64daccbf7a55c738fcc808e54ac3e",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"substantiveness_status": "Pass"
}