Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Theorem
f64 parse result is not a binary64 NaN.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.SourceValidByteSlice
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_SIG_TOTAL_BITS
import Tablet.ModelF64MantissaDigits
import Tablet.ModelF64Neg
import Tablet.ModelStrAsBytes
import Tablet.ModelSliceFirst
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.SpecialHelperRejection
import Tablet.SpecialHelperInfinity
import Tablet.NativeCorrectOrDefer
import Tablet.ParserSelectedExponent
import Tablet.ParserSelectedMantissaBound
import Tablet.ParserComputeFloatInfinityMantissa
import Tablet.ParserSlowInfinityMantissa
import Tablet.ParserAssembledPairNonNan
import Tablet.ParserSelectedMagnitudeSign
import Tablet.AssemblyCorrespondence
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_Dec2FltTrace
import Tablet.num_imp_dec2flt_Dec2FltAssemblyTrace
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_zero_pow2
import Tablet.num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_lemire_compute_product_approx
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_decimal_seq_parse_decimal_seq
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_biased_fp_to_float
import Tablet.num_imp_traits_Float_SIG_BITS_default
import Tablet.num_imp_traits_Float_EXP_BITS_default
import Tablet.num_imp_traits_Float_EXP_SAT_default
import Tablet.num_imp_traits_Float_INFINITE_POWER_default
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ParserNonNanResults]
theorem ParserNonNanResults :
∀ (s : Str) (f : F64), DecimalGoalVocabularyDefault.sourceString s ->
(¬ ∃ negative, DecimalGoalVocabularyDefault.specialLiteral (DecimalGoalVocabularyDefault.bytes s) negative true) ->
num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) -> ¬ DecimalGoalVocabularyDefault.isNan f := 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
The public call and the sign-stripped body.
Unfold num imp dec2flt dec2flt. It first binds the result ofdec2flt_with_trace and then returns the first projection unchanged.
The assumed successful public result therefore supplies a trace T with
ok pair whose first
projection differed from Ok f could not yield the assumed final
ok (Ok f).none exactly when that list is empty and
otherwise returns its head c. The none branch returns
Err with the EmptyInput trace, so it is incompatible with
(2). Thus c exists. The extracted sign branch sets
body1, n is
the Boolean argument later passed to the special parser, and \sigma is the
corresponding optional lexical sign. In the first two cases the range starts
at one; the existence of c proves that this range is in bounds. The next
emptiness branch returns Err with a SignOnly trace, so (2)
also proves that body1 is nonempty.body1 satisfies SourceValidByteSlice. Also,
unfolding the sign-prefix and specialLiteral fields of
DecimalGoalVocabularyDefault, (3) gives, for each Boolean k,
Err with traces
EmptyInput, SignOnly, and Invalid; none can equal
(2). The only remaining traces are Special, FastPath, and
Assembled. We treat them in turn.Special result.
Suppose T isSpecial. Constructor injectivity applied to (2) and
the record-free Special return in
num imp dec2flt dec2flt with trace gives the exact helper equation
ok none, a contradiction. Hence B is an unsigned
inf/infinity spelling. Apply
SpecialHelperInfinity with the same slice and Boolean n. It gives
some g for which the same deterministic helper call is
ok (some g) and
isInfinity n\ g. Comparing with (6), injectivity of
ok and some gives g=f.isInfinity n\ f. By its definition in
DecimalGoalVocabularyDefault, f.\mathit{val} is either I or
I+S. In either case reduction modulo S is I, while reduction modulo
U is zero. Therefore the second conjunct of (1) is false, and f is not a
NaN in the Special case. Notice that (5), rather than an assumption that the
special parser itself prefers infinity, is what excluded its NaN match.Native fast path.
Suppose T isFastPath. The exact constructor fields in
num imp dec2flt Dec2FltTrace and the corresponding return in
num imp dec2flt dec2flt with trace supply a parsed Decimal r and
the overwritten-sign record
out = none
alternative contradicts out = some f. In its other alternative,
injectivity of some identifies its returned value with f, and we
obtain a magnitude word v satisfying
A local invariant for the assembled path.
It remains to handle T=\texttt{Assembled }A. The statements of the assembly support theorems do not by themselves say that an exponent-2047 pair has zero fraction, so we prove the required converter invariant directly. First evaluate the concrete constants. Through the Lemire and FloatExt records F64 Insts Dec2flt modelNumImpDec2fltLemireU64 and F64 Insts Dec2flt modelNumImpTraitsFloatExtU64, the selected Float record is F64 Insts Dec2flt modelNumImpTraitsFloatU64. Its bit width is 64 by F64 Insts Dec2flt modelNumImpTraitsFloatU64 BITS; itsSIG_TOTAL_BITS method
F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS invokes
ModelF64MantissaDigits and returns 53. The checked subtraction in
num imp traits Float SIG BITS default is therefore 53-1=52.
The checked subtractions in num imp traits Float EXP BITS default
give 64-52-1=11; the legal shift and subtraction in
num imp traits Float EXP SAT default give
2^{11}-1=2047; and
num imp traits Float INFINITE POWER default casts this in-range
value exactly to signed 2047. All these monadic constant computations
succeed.I32 counts, so
we use their actual Aeneas semantics rather than the unsigned-count shift
binding. Unfolding UScalar.shiftRight_IScalar, a shift by a signed
count c first tests 0\le c; when that test succeeds it calls
UScalar.shiftRight with c.\texttt{toNat}, which separately tests
c.\texttt{toNat}<64 and then returns the zero-filling
BitVec.ushiftRight. Thus there are two possible failure guards to
discharge for each such shift.toNat is the same natural number 63, and 63<64.
Thus the nonnegative and below-width success tests both hold, excluding both
failure alternatives, and the returned U64 value is the logical natural right
shift hi\mathbin{\mathtt{>>}}63. Since 0\le hi<2^{64},
this value is either zero or one. The exact widening cast makes that same
integer the I32 value upperbit. Consequently the checked
calculation 64+\texttt{upperbit}-52-3 succeeds with I32 value 9
or 10; call this count c. In particular 0\le c<64 and
c.\texttt{toNat} is respectively the natural number 9 or 10. Unfolding
the same two Aeneas definitions for
hi\mathbin{\mathtt{>>>}}c discharges first the nonnegativity guard and then
the width guard, and identifies the returned mantissa with the
logical unsigned shift by that same natural count. If upperbit is
zero, hi\mathbin{\mathtt{>>}}63=0 implies hi<2^{63}, so
hi\mathbin{\mathtt{>>}}9<2^{54}; if it is one, the U64 carrier bound
hi<2^{64} gives hi\mathbin{\mathtt{>>}}10<2^{54}. Thus the local
pre-rounding mantissa is always below 2^{54}. All casts and checked
operations which calculate the accompanying power2 precede every
remaining result monadically; on the assumed successful execution they have
succeeded. The two blocks below the two outcomes of the lo test are
textually the same, so the following argument covers both.power2\le0, its successful checked negation produces
i20 with value -\texttt{power2}\ge0, and its checked addition of
one produces i21 with value
k=-\texttt{power2}+1\ge1. The branch k\ge64 returns the zero sentinel.
On its false branch, therefore, 1\le k<64. The code repeats the very same
checked addition to form i22; determinism of that operation gives
\texttt{i22.val}=k. Hence this signed count is nonnegative, its
toNat is the same natural k, and that natural is below 64.
For the operation
\texttt{mantissa}\mathbin{\mathtt{>>>}}\texttt{i22}, unfolding
UScalar.shiftRight_IScalar and then
UScalar.shiftRight discharges respectively the sign and width
guards and identifies mantissa1 with the logical shift by k.
If k\le54, the pre-rounding bound gives
\texttt{mantissa1}<2^{54-k}\le2^{53}; if k>54, then
\texttt{mantissa}<2^{54}<2^k, so mantissa1 is zero. Thus in all
cases x=\texttt{mantissa1}<2^{53}. By
ModelU64BitAnd, e=x\mathbin{\mathtt{\&}}1 is its low bit, so
x+e\le2^{53}; the checked addition producing mantissa2 therefore
cannot overflow.toNat is the natural number one, and 1<64; the
outer and inner success tests therefore hold, excluding both failure
alternatives. The same unfolding identifies mantissa3 with the logical halving
\lfloor\texttt{mantissa2}/2\rfloor, which is at most 2^{52}=U. The legal
shift 1\mathbin{\mathtt{<<}}52=U is governed by
ModelU64Shl, and the returned exponent is exactly the Boolean
value of m\ge U. Hence m=U implies exponent one, while exponent 2047 is
impossible on this ordinary return.power2>0$, the optional tie adjustment only clears the low bit by
ModelU64BitAnd. Thus mantissa1<2^{54}, and adding its
low bit produces mantissa2\le2^{54} without overflow. Its next
shift again has signed count 1\#\texttt{i32}: 0\le1, its
\texttt{toNat}=1<64, so the two success tests in
UScalar.shiftRight_IScalar and UScalar.shiftRight are
true and neither failure alternative is reachable. The result is the
logical halving
\texttt{mantissa3}=\lfloor\texttt{mantissa2}/2\rfloor\le2^{53}. The legal thresholds
2\mathbin{\mathtt{<<}}52=2^{53} and
1\mathbin{\mathtt{<<}}52=U either replace a carrying value by U or leave
it below 2^{53}. The final conjunction with the complement of U clears
bit 52, and no higher bit is set, so the ordinary record has mantissa
strictly below U. Its final exponent test returns the zero-mantissa
infinity sentinel whenever the computed exponent is at least 2047; otherwise
the ordinary record has exponent below 2047. This proves all three clauses
of (11), including both duplicated product blocks and every underflow,
ordinary, and infinity exit. Any failed product, cast, checked arithmetic,
or shift would propagate and cannot be confused with the successful premise
(10).loop_result is
none or the zero sentinel. It holds initially, and the only branch
which writes the field does so after the closure call
num imp dec2flt slow parse long mantissa closure Insts CoreOpsFunctionFnTupleUsizeUsize call
and num imp dec2flt decimal seq DecimalSeq right shift, writing
exactly that sentinel. Every other branch preserves the field or terminates.
The second loop analogously keeps loop_result equal to
none or the infinity sentinel; its only writes occur after
num imp dec2flt decimal seq DecimalSeq left shift and store exactly
that sentinel. All intervening casts, array accesses, shifts, and checked
exponent operations are monadic, so a failure cannot yield the successful
outer result. Therefore every some exit from either loop has
mantissa zero.none, the third loop repeatedly caps
its positive shift by
num imp dec2flt slow parse long mantissa MAX SHIFT, whose value is
60, applies
num imp dec2flt decimal seq DecimalSeq right shift, and continues;
its only final branch is the one where the exponent has reached the concrete
minimum. Write E_{\min} for the exactly returned EXP_MIN value.
After the loop, the successful checked subtraction and addition name
i is 2047. If the first
guard i7 >= i is true, the function returns the zero-mantissa
infinity sentinel. If it is false, the signed comparison gives the strict
integer inequality
power2=\texttt{exp23}-E_{\min}+1, so
power2=\texttt{i7}. The returned power21 is either
power2, or, when the rounded mantissa is below U, the successful
checked subtraction power2 - 1. In the first case (12a) applies
directly; in the second,
\texttt{power21}=\texttt{power2}-1<\texttt{power2}<2047. Thus every
ordinary noncarry return has exponent strictly below 2047.exp24=\texttt{exp23}+1, the code shifts right once, rounds again,
and names
i14<2047. The immediately following checked subtraction and
addition recompute exactly the same expression, so the local
power2 equals i14. Again power21 is either
power2 or the successfully computed power2 - 1; hence in
both cases power21<2047. Thus every ordinary carry return also
has exponent strictly below 2047.many_digits makes the second-computation guard true, the
checked increment and the second call must both succeed, and the second result
also obeys (11). The comparison
num imp dec2flt common BiasedFp Insts CoreCmpPartialEqBiasedFp eq
is the exact comparison of both fields. Equality retains the first pair;
inequality retains its mantissa but replaces its exponent by -1. Thus a
second-call disagreement cannot be assembled: the subsequent negative-
exponent guard forces the slow call. The same slow replacement occurs for
any other negative post-comparison exponent. If the guard is false, the
post-comparison pair itself is selected. Combining (11), (12), and these
first/second/forced-deferral/slow choices gives the exact local invariant for
the selected pair b:
Assembly and the final sign.
Constructor injectivity in (2), using the field schema num imp dec2flt Dec2FltAssemblyTrace, identifies the local selected pair b with A.\texttt{selected_pair} and the locally computed OR word W with A.\texttt{assembled_word}. Apply ParserSelectedExponent to (2):assembledWord b\ W and W<S.lor(U,U)=U<I. If b.m<U and p\le2046, the operands occupy
disjoint exponent and fraction fields, so
W=pU+b.m\le2046U+(U-1)<I. Finally, if p=2047, (13) gives b.m=0 and
W=I. These cases are exhaustive by (13)--(14), and therefore
biased_fp_to_float(b)=\texttt{ok }A.\texttt{assembly_result}.
Apply AssemblyCorrespondence to b. It supplies a carrier g
with the same deterministic call result and with
assembledWord b\ g. Comparing the two result equations gives
g=A.\texttt{assembly_result}; unfolding the assembled-word relation and
using (15) identifies its raw word with W. This also agrees with the
recorded assembly fact from ParserSelectedMagnitudeSign; no
proof-internal invariant of either cited theorem is being used.Lean proof
intro s f hsource hnotNanLiteral hpublic
have bind_ok_inv : ∀ {α β : Type} (r : Result α) (g : α → Result β) y,
Bind.bind r g = ok y → ∃ z, r = ok z ∧ g z = 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 z => exact ⟨z, rfl, hr⟩
have infinity_not_nan : ∀ (negative : Bool) (value : F64),
DecimalGoalVocabularyDefault.isInfinity negative value ->
¬ DecimalGoalVocabularyDefault.isNan value := by
intro negative value hinfinity hnan
dsimp only [DecimalGoalVocabularyDefault] at hinfinity hnan
cases negative <;>
simp only [Bool.false_eq_true, if_false, if_true] at hinfinity
· rw [hinfinity] at hnan
norm_num at hnan
· rw [hinfinity] at hnan
norm_num at hnan
have signed_bounded_not_nan : ∀ (negative : Bool) (magnitude result : F64),
magnitude.val ≤ 2047 * 2 ^ 52 ->
DecimalGoalVocabularyDefault.signedMagnitude negative magnitude result ->
¬ DecimalGoalVocabularyDefault.isNan result := by
intro negative magnitude result hbound hsigned hnan
dsimp only [DecimalGoalVocabularyDefault] at hsigned hnan
rcases hsigned with ⟨hmag, hresult⟩
rcases hnan with ⟨hexponent, hfraction⟩
have hmodSign : result.val % (2 ^ 63) = magnitude.val := by
cases negative with
| false =>
simp only [Bool.false_eq_true, if_false, add_zero] at hresult
rw [hresult, Nat.mod_eq_of_lt hmag]
| true =>
simp only [if_true] at hresult
rw [hresult, Nat.add_mod]
have hm := Nat.mod_eq_of_lt hmag
rw [hm, Nat.mod_self, Nat.add_zero, hm]
have hmodFraction :
result.val % (2 ^ 52) = magnitude.val % (2 ^ 52) := by
cases negative with
| false =>
simp only [Bool.false_eq_true, if_false, add_zero] at hresult
rw [hresult]
| true =>
simp only [if_true] at hresult
rw [hresult, Nat.add_mod]
norm_num
rw [hmodSign] at hexponent
have hdecomp := Nat.mod_add_div magnitude.val (2 ^ 52)
rw [hexponent] at hdecomp
have hmagExact : magnitude.val = 2047 * 2 ^ 52 := by
norm_num at hdecomp ⊢
omega
rw [hmodFraction, hmagExact] at hfraction
norm_num at hfraction
unfold num.imp.dec2flt.dec2flt at hpublic
obtain ⟨out, hout, hpublic⟩ := bind_ok_inv _ _ _ hpublic
rcases out with ⟨publicResult, trace⟩
cases hpublic
have traced :
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, trace) := hout
rcases s with ⟨source, source_bound⟩
cases source with
| nil =>
unfold num.imp.dec2flt.dec2flt_with_trace at traced
obtain ⟨body, hbody, traced⟩ := bind_ok_inv _ _ _ traced
have hbodyEq : body = (⟨[], source_bound⟩ : Slice Std.U8) := by
simpa [core.str.Str.as_bytes, ModelStrAsBytes] using hbody.symm
subst body
obtain ⟨firstOption, hfirst, traced⟩ := bind_ok_inv _ _ _ traced
have hfirstEq : firstOption = none := by
simpa [core.slice.Slice.first, ModelSliceFirst] using hfirst.symm
subst firstOption
obtain ⟨pfe, hpfe, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
| cons first tail =>
unfold num.imp.dec2flt.dec2flt_with_trace at traced
obtain ⟨body, hbody, traced⟩ := bind_ok_inv _ _ _ traced
have hbodyEq : body = (⟨first :: tail, source_bound⟩ : Slice Std.U8) := by
simpa [core.str.Str.as_bytes, ModelStrAsBytes] using hbody.symm
subst body
obtain ⟨firstOption, hfirst, traced⟩ := bind_ok_inv _ _ _ traced
have hfirstEq : firstOption = some first := by
simpa [core.slice.Slice.first, ModelSliceFirst] using hfirst.symm
subst firstOption
obtain ⟨body1, hbody1, traced⟩ := bind_ok_inv _ _ _ traced
have body1Valid : SourceValidByteSlice body1 := by
unfold SourceValidByteSlice
have hslen := hsource.1
by_cases hminus : first = 45#u8
· simp only [hminus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
simp at hslen ⊢
omega
· simp only [hminus, if_false] at hbody1
by_cases hplus : first = 43#u8
· simp only [hplus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
simp at hslen ⊢
omega
· simp only [hplus, if_false] at hbody1
cases hbody1
exact hslen
have noNanBody : ¬ DecimalGoalVocabularyDefault.specialLiteral
(DecimalGoalVocabularyDefault.bytes body1) none true := by
intro hspecial
apply hnotNanLiteral
by_cases hminus : first = 45#u8
· simp only [hminus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
refine ⟨some true, ?_⟩
dsimp only [DecimalGoalVocabularyDefault] at hspecial ⊢
rcases hspecial with ⟨specialBody, hspecialBody, hcase⟩
refine ⟨specialBody, ?_, hcase⟩
subst first
simpa using hspecialBody
· simp only [hminus, if_false] at hbody1
by_cases hplus : first = 43#u8
· simp only [hplus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
refine ⟨some false, ?_⟩
dsimp only [DecimalGoalVocabularyDefault] at hspecial ⊢
rcases hspecial with ⟨specialBody, hspecialBody, hcase⟩
refine ⟨specialBody, ?_, hcase⟩
subst first
simpa using hspecialBody
· simp only [hplus, if_false] at hbody1
cases hbody1
exact ⟨none, hspecial⟩
obtain ⟨empty, hempty, traced⟩ := bind_ok_inv _ _ _ traced
by_cases emptyTrue : empty = true
· simp only [emptyTrue, if_true] at traced
obtain ⟨pfe, hpfe, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
· have emptyFalse : empty = false := Bool.eq_false_of_not_eq_true emptyTrue
simp only [emptyFalse, if_false] at traced
obtain ⟨parsed, hparsed, traced⟩ := bind_ok_inv _ _ _ traced
cases parsed with
| none =>
obtain ⟨special, hspecial, traced⟩ := bind_ok_inv _ _ _ traced
cases special with
| none =>
obtain ⟨pfe, hpfe, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
| some value =>
cases traced
by_cases hInf : DecimalGoalVocabularyDefault.specialLiteral
(DecimalGoalVocabularyDefault.bytes body1) none false
· obtain ⟨infinity, hinfinityEq, hinfinity⟩ :=
SpecialHelperInfinity body1 (decide (first = 45#u8)) hInf
rw [hspecial] at hinfinityEq
cases hinfinityEq
exact infinity_not_nan _ _ hinfinity
· have hrejection := SpecialHelperRejection body1
(decide (first = 45#u8)) body1Valid hInf noNanBody
rw [hspecial] at hrejection
cases hrejection
| some r =>
obtain ⟨fast, hfast, traced⟩ := bind_ok_inv _ _ _ traced
cases fast with
| some value =>
have hnative := NativeCorrectOrDefer
({ r with negative := decide (first = 45#u8) })
(some value) hfast
rcases hnative with hnone |
⟨value', magnitude, hvalue, _, hrounds, hsigned⟩
· simp at hnone
· cases hvalue
cases traced
dsimp only [DecimalGoalVocabularyDefault] at hrounds
exact signed_bounded_not_nan _ _ _ hrounds.2.1 hsigned
| none =>
obtain ⟨firstPair, hfirstPair, traced⟩ := bind_ok_inv _ _ _ traced
have hfirstInfinity :=
ParserComputeFloatInfinityMantissa _ _ _ hfirstPair
obtain ⟨phase1, hphase1, traced⟩ := bind_ok_inv _ _ _ traced
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, traced⟩ := bind_ok_inv _ _ _ traced
rcases phase2 with
⟨post, secondExp, secondMant, secondResult, secondEqual, forced⟩
have hpostInfinity :
post.p_biased.val = 2047 -> post.m.val = 0 := by
cases guard with
| false =>
simp only [Bool.false_eq_true, if_false] at hphase2
cases hphase2
exact hfirstInfinity
| true =>
simp only [if_true] at hphase2
obtain ⟨mantissa, hmantissa, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
obtain ⟨second, hsecond, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
obtain ⟨equal, hequal, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
obtain ⟨chosen, hchosen, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
rcases chosen with ⟨bf, wasForced⟩
have hbf : bf.p_biased.val = 2047 -> bf.m.val = 0 := by
by_cases heq : equal = true
· simp only [heq, if_true] at hchosen
cases hchosen
exact hfirstInfinity
· have heqf : equal = false :=
Bool.eq_false_of_not_eq_true heq
simp only [heqf, if_false] at hchosen
cases hchosen
intro hp
norm_num at hp
cases hphase2
exact hbf
obtain ⟨phase3, hphase3, traced⟩ := bind_ok_inv _ _ _ traced
rcases phase3 with ⟨selected, slowGuard, slowResult⟩
have hselectedInfinity :
selected.p_biased.val = 2047 -> selected.m.val = 0 := 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 hreplacement :=
ParserSlowInfinityMantissa _ _ hreplacement
cases hphase3
exact hreplacement
· simp only [hneg, if_false] at hphase3
cases hphase3
exact hpostInfinity
obtain ⟨i, hi, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨i1, hi1, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨i2, hi2, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨word, hword, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨assembled, hassembled, traced⟩ := bind_ok_inv _ _ _ traced
by_cases negative : first = 45#u8
· simp only [negative, if_true] at traced
obtain ⟨result, hresult, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
obtain ⟨wordSpec, wordBound⟩ :=
ParserSelectedMagnitudeSign
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have exponentBound := ParserSelectedExponent
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have mantissaBound := ParserSelectedMantissaBound
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
change DecimalGoalVocabularyDefault.assembledWord selected word at wordSpec
change word.val < 2 ^ 63 at wordBound
have hwordNonNan := ParserAssembledPairNonNan selected word
exponentBound.1 exponentBound.2 mantissaBound
hselectedInfinity wordSpec wordBound
obtain ⟨canonical, hcanonical, canonicalSpec⟩ :=
AssemblyCorrespondence selected
rw [hassembled] at hcanonical
cases hcanonical
have assembledVal : assembled.val = word.val := by
dsimp only [DecimalGoalVocabularyDefault] at wordSpec canonicalSpec
exact canonicalSpec.trans wordSpec.symm
have assembledEq : assembled = word :=
UScalar.eq_of_val_eq assembledVal
subst assembled
change ModelF64Neg word = ok f at hresult
cases hresult
dsimp only [DecimalGoalVocabularyDefault] at hwordNonNan ⊢
intro hnan
apply hwordNonNan
rcases hnan with ⟨hexponent, hfraction⟩
refine ⟨?_, ?_⟩
· change (((word.bv ^^^ BitVec.ofNat 64 (2 ^ 63)).toNat) %
2 ^ 63) / 2 ^ 52 = 2047 at hexponent
rw [BitVec.toNat_xor] at hexponent
have hbit : (BitVec.ofNat 64 (2 ^ 63)).toNat = 2 ^ 63 := by
norm_num
rw [hbit] at hexponent
change (word.val ^^^ (2 ^ 63)) % (2 ^ 63) /
(2 ^ 52) = 2047 at hexponent
have hxor : word.val ^^^ (2 ^ 63) = word.val + 2 ^ 63 := by
have hor := Nat.two_pow_add_eq_or_of_lt wordBound 1
have hx : word.val ^^^ (2 ^ 63) =
(2 ^ 63) ||| word.val := by
apply Nat.eq_of_testBit_eq
intro k
rw [Nat.testBit_xor, Nat.testBit_or, Nat.testBit_two_pow]
by_cases hk : k = 63
· subst k
rw [Nat.testBit_lt_two_pow wordBound]
decide
· have hk' : 63 ≠ k := Ne.symm hk
simp [hk, hk']
exact hx.trans (by simpa [Nat.add_comm] using hor.symm)
rw [hxor, Nat.add_mod] at hexponent
norm_num at hexponent
exact hexponent
· change (((word.bv ^^^ BitVec.ofNat 64 (2 ^ 63)).toNat) %
2 ^ 52) ≠ 0 at hfraction
rw [BitVec.toNat_xor] at hfraction
have hbit : (BitVec.ofNat 64 (2 ^ 63)).toNat = 2 ^ 63 := by
norm_num
rw [hbit] at hfraction
change (word.val ^^^ (2 ^ 63)) % (2 ^ 52) ≠ 0 at hfraction
have hxor : word.val ^^^ (2 ^ 63) = word.val + 2 ^ 63 := by
have hor := Nat.two_pow_add_eq_or_of_lt wordBound 1
have hx : word.val ^^^ (2 ^ 63) =
(2 ^ 63) ||| word.val := by
apply Nat.eq_of_testBit_eq
intro k
rw [Nat.testBit_xor, Nat.testBit_or, Nat.testBit_two_pow]
by_cases hk : k = 63
· subst k
rw [Nat.testBit_lt_two_pow wordBound]
decide
· have hk' : 63 ≠ k := Ne.symm hk
simp [hk, hk']
exact hx.trans (by simpa [Nat.add_comm] using hor.symm)
rw [hxor, Nat.add_mod] at hfraction
norm_num at hfraction
exact hfraction
· simp only [negative, if_false] at traced
cases traced
obtain ⟨wordSpec, wordBound⟩ :=
ParserSelectedMagnitudeSign
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have exponentBound := ParserSelectedExponent
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have mantissaBound := ParserSelectedMantissaBound
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
change DecimalGoalVocabularyDefault.assembledWord selected word at wordSpec
change word.val < 2 ^ 63 at wordBound
have hwordNonNan := ParserAssembledPairNonNan selected word
exponentBound.1 exponentBound.2 mantissaBound
hselectedInfinity wordSpec wordBound
obtain ⟨canonical, hcanonical, canonicalSpec⟩ :=
AssemblyCorrespondence selected
rw [hassembled] at hcanonical
cases hcanonical
have resultVal : f.val = word.val := by
dsimp only [DecimalGoalVocabularyDefault] at wordSpec canonicalSpec
exact canonicalSpec.trans wordSpec.symm
dsimp only [DecimalGoalVocabularyDefault] at hwordNonNan ⊢
simpa [resultVal] using hwordNonNan
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.SourceValidByteSlice
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_SIG_TOTAL_BITS
import Tablet.ModelF64MantissaDigits
import Tablet.ModelF64Neg
import Tablet.ModelStrAsBytes
import Tablet.ModelSliceFirst
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.SpecialHelperRejection
import Tablet.SpecialHelperInfinity
import Tablet.NativeCorrectOrDefer
import Tablet.ParserSelectedExponent
import Tablet.ParserSelectedMantissaBound
import Tablet.ParserComputeFloatInfinityMantissa
import Tablet.ParserSlowInfinityMantissa
import Tablet.ParserAssembledPairNonNan
import Tablet.ParserSelectedMagnitudeSign
import Tablet.AssemblyCorrespondence
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_Dec2FltTrace
import Tablet.num_imp_dec2flt_Dec2FltAssemblyTrace
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_zero_pow2
import Tablet.num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_lemire_compute_product_approx
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_decimal_seq_parse_decimal_seq
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_biased_fp_to_float
import Tablet.num_imp_traits_Float_SIG_BITS_default
import Tablet.num_imp_traits_Float_EXP_BITS_default
import Tablet.num_imp_traits_Float_EXP_SAT_default
import Tablet.num_imp_traits_Float_INFINITE_POWER_default
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ParserNonNanResults]
theorem ParserNonNanResults :
∀ (s : Str) (f : F64), DecimalGoalVocabularyDefault.sourceString s ->
(¬ ∃ negative, DecimalGoalVocabularyDefault.specialLiteral (DecimalGoalVocabularyDefault.bytes s) negative true) ->
num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) -> ¬ DecimalGoalVocabularyDefault.isNan f := by
-- BODY
intro s f hsource hnotNanLiteral hpublic
have bind_ok_inv : ∀ {α β : Type} (r : Result α) (g : α → Result β) y,
Bind.bind r g = ok y → ∃ z, r = ok z ∧ g z = 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 z => exact ⟨z, rfl, hr⟩
have infinity_not_nan : ∀ (negative : Bool) (value : F64),
DecimalGoalVocabularyDefault.isInfinity negative value ->
¬ DecimalGoalVocabularyDefault.isNan value := by
intro negative value hinfinity hnan
dsimp only [DecimalGoalVocabularyDefault] at hinfinity hnan
cases negative <;>
simp only [Bool.false_eq_true, if_false, if_true] at hinfinity
· rw [hinfinity] at hnan
norm_num at hnan
· rw [hinfinity] at hnan
norm_num at hnan
have signed_bounded_not_nan : ∀ (negative : Bool) (magnitude result : F64),
magnitude.val ≤ 2047 * 2 ^ 52 ->
DecimalGoalVocabularyDefault.signedMagnitude negative magnitude result ->
¬ DecimalGoalVocabularyDefault.isNan result := by
intro negative magnitude result hbound hsigned hnan
dsimp only [DecimalGoalVocabularyDefault] at hsigned hnan
rcases hsigned with ⟨hmag, hresult⟩
rcases hnan with ⟨hexponent, hfraction⟩
have hmodSign : result.val % (2 ^ 63) = magnitude.val := by
cases negative with
| false =>
simp only [Bool.false_eq_true, if_false, add_zero] at hresult
rw [hresult, Nat.mod_eq_of_lt hmag]
| true =>
simp only [if_true] at hresult
rw [hresult, Nat.add_mod]
have hm := Nat.mod_eq_of_lt hmag
rw [hm, Nat.mod_self, Nat.add_zero, hm]
have hmodFraction :
result.val % (2 ^ 52) = magnitude.val % (2 ^ 52) := by
cases negative with
| false =>
simp only [Bool.false_eq_true, if_false, add_zero] at hresult
rw [hresult]
| true =>
simp only [if_true] at hresult
rw [hresult, Nat.add_mod]
norm_num
rw [hmodSign] at hexponent
have hdecomp := Nat.mod_add_div magnitude.val (2 ^ 52)
rw [hexponent] at hdecomp
have hmagExact : magnitude.val = 2047 * 2 ^ 52 := by
norm_num at hdecomp ⊢
omega
rw [hmodFraction, hmagExact] at hfraction
norm_num at hfraction
unfold num.imp.dec2flt.dec2flt at hpublic
obtain ⟨out, hout, hpublic⟩ := bind_ok_inv _ _ _ hpublic
rcases out with ⟨publicResult, trace⟩
cases hpublic
have traced :
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, trace) := hout
rcases s with ⟨source, source_bound⟩
cases source with
| nil =>
unfold num.imp.dec2flt.dec2flt_with_trace at traced
obtain ⟨body, hbody, traced⟩ := bind_ok_inv _ _ _ traced
have hbodyEq : body = (⟨[], source_bound⟩ : Slice Std.U8) := by
simpa [core.str.Str.as_bytes, ModelStrAsBytes] using hbody.symm
subst body
obtain ⟨firstOption, hfirst, traced⟩ := bind_ok_inv _ _ _ traced
have hfirstEq : firstOption = none := by
simpa [core.slice.Slice.first, ModelSliceFirst] using hfirst.symm
subst firstOption
obtain ⟨pfe, hpfe, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
| cons first tail =>
unfold num.imp.dec2flt.dec2flt_with_trace at traced
obtain ⟨body, hbody, traced⟩ := bind_ok_inv _ _ _ traced
have hbodyEq : body = (⟨first :: tail, source_bound⟩ : Slice Std.U8) := by
simpa [core.str.Str.as_bytes, ModelStrAsBytes] using hbody.symm
subst body
obtain ⟨firstOption, hfirst, traced⟩ := bind_ok_inv _ _ _ traced
have hfirstEq : firstOption = some first := by
simpa [core.slice.Slice.first, ModelSliceFirst] using hfirst.symm
subst firstOption
obtain ⟨body1, hbody1, traced⟩ := bind_ok_inv _ _ _ traced
have body1Valid : SourceValidByteSlice body1 := by
unfold SourceValidByteSlice
have hslen := hsource.1
by_cases hminus : first = 45#u8
· simp only [hminus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
simp at hslen ⊢
omega
· simp only [hminus, if_false] at hbody1
by_cases hplus : first = 43#u8
· simp only [hplus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
simp at hslen ⊢
omega
· simp only [hplus, if_false] at hbody1
cases hbody1
exact hslen
have noNanBody : ¬ DecimalGoalVocabularyDefault.specialLiteral
(DecimalGoalVocabularyDefault.bytes body1) none true := by
intro hspecial
apply hnotNanLiteral
by_cases hminus : first = 45#u8
· simp only [hminus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
refine ⟨some true, ?_⟩
dsimp only [DecimalGoalVocabularyDefault] at hspecial ⊢
rcases hspecial with ⟨specialBody, hspecialBody, hcase⟩
refine ⟨specialBody, ?_, hcase⟩
subst first
simpa using hspecialBody
· simp only [hminus, if_false] at hbody1
by_cases hplus : first = 43#u8
· simp only [hplus, if_true] at hbody1
simp [core.slice.index.SliceIndexRangeFromUsizeSlice.index,
Slice.drop] at hbody1
cases hbody1
refine ⟨some false, ?_⟩
dsimp only [DecimalGoalVocabularyDefault] at hspecial ⊢
rcases hspecial with ⟨specialBody, hspecialBody, hcase⟩
refine ⟨specialBody, ?_, hcase⟩
subst first
simpa using hspecialBody
· simp only [hplus, if_false] at hbody1
cases hbody1
exact ⟨none, hspecial⟩
obtain ⟨empty, hempty, traced⟩ := bind_ok_inv _ _ _ traced
by_cases emptyTrue : empty = true
· simp only [emptyTrue, if_true] at traced
obtain ⟨pfe, hpfe, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
· have emptyFalse : empty = false := Bool.eq_false_of_not_eq_true emptyTrue
simp only [emptyFalse, if_false] at traced
obtain ⟨parsed, hparsed, traced⟩ := bind_ok_inv _ _ _ traced
cases parsed with
| none =>
obtain ⟨special, hspecial, traced⟩ := bind_ok_inv _ _ _ traced
cases special with
| none =>
obtain ⟨pfe, hpfe, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
| some value =>
cases traced
by_cases hInf : DecimalGoalVocabularyDefault.specialLiteral
(DecimalGoalVocabularyDefault.bytes body1) none false
· obtain ⟨infinity, hinfinityEq, hinfinity⟩ :=
SpecialHelperInfinity body1 (decide (first = 45#u8)) hInf
rw [hspecial] at hinfinityEq
cases hinfinityEq
exact infinity_not_nan _ _ hinfinity
· have hrejection := SpecialHelperRejection body1
(decide (first = 45#u8)) body1Valid hInf noNanBody
rw [hspecial] at hrejection
cases hrejection
| some r =>
obtain ⟨fast, hfast, traced⟩ := bind_ok_inv _ _ _ traced
cases fast with
| some value =>
have hnative := NativeCorrectOrDefer
({ r with negative := decide (first = 45#u8) })
(some value) hfast
rcases hnative with hnone |
⟨value', magnitude, hvalue, _, hrounds, hsigned⟩
· simp at hnone
· cases hvalue
cases traced
dsimp only [DecimalGoalVocabularyDefault] at hrounds
exact signed_bounded_not_nan _ _ _ hrounds.2.1 hsigned
| none =>
obtain ⟨firstPair, hfirstPair, traced⟩ := bind_ok_inv _ _ _ traced
have hfirstInfinity :=
ParserComputeFloatInfinityMantissa _ _ _ hfirstPair
obtain ⟨phase1, hphase1, traced⟩ := bind_ok_inv _ _ _ traced
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, traced⟩ := bind_ok_inv _ _ _ traced
rcases phase2 with
⟨post, secondExp, secondMant, secondResult, secondEqual, forced⟩
have hpostInfinity :
post.p_biased.val = 2047 -> post.m.val = 0 := by
cases guard with
| false =>
simp only [Bool.false_eq_true, if_false] at hphase2
cases hphase2
exact hfirstInfinity
| true =>
simp only [if_true] at hphase2
obtain ⟨mantissa, hmantissa, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
obtain ⟨second, hsecond, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
obtain ⟨equal, hequal, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
obtain ⟨chosen, hchosen, hphase2⟩ :=
bind_ok_inv _ _ _ hphase2
rcases chosen with ⟨bf, wasForced⟩
have hbf : bf.p_biased.val = 2047 -> bf.m.val = 0 := by
by_cases heq : equal = true
· simp only [heq, if_true] at hchosen
cases hchosen
exact hfirstInfinity
· have heqf : equal = false :=
Bool.eq_false_of_not_eq_true heq
simp only [heqf, if_false] at hchosen
cases hchosen
intro hp
norm_num at hp
cases hphase2
exact hbf
obtain ⟨phase3, hphase3, traced⟩ := bind_ok_inv _ _ _ traced
rcases phase3 with ⟨selected, slowGuard, slowResult⟩
have hselectedInfinity :
selected.p_biased.val = 2047 -> selected.m.val = 0 := 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 hreplacement :=
ParserSlowInfinityMantissa _ _ hreplacement
cases hphase3
exact hreplacement
· simp only [hneg, if_false] at hphase3
cases hphase3
exact hpostInfinity
obtain ⟨i, hi, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨i1, hi1, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨i2, hi2, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨word, hword, traced⟩ := bind_ok_inv _ _ _ traced
obtain ⟨assembled, hassembled, traced⟩ := bind_ok_inv _ _ _ traced
by_cases negative : first = 45#u8
· simp only [negative, if_true] at traced
obtain ⟨result, hresult, traced⟩ := bind_ok_inv _ _ _ traced
cases traced
obtain ⟨wordSpec, wordBound⟩ :=
ParserSelectedMagnitudeSign
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have exponentBound := ParserSelectedExponent
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have mantissaBound := ParserSelectedMantissaBound
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
change DecimalGoalVocabularyDefault.assembledWord selected word at wordSpec
change word.val < 2 ^ 63 at wordBound
have hwordNonNan := ParserAssembledPairNonNan selected word
exponentBound.1 exponentBound.2 mantissaBound
hselectedInfinity wordSpec wordBound
obtain ⟨canonical, hcanonical, canonicalSpec⟩ :=
AssemblyCorrespondence selected
rw [hassembled] at hcanonical
cases hcanonical
have assembledVal : assembled.val = word.val := by
dsimp only [DecimalGoalVocabularyDefault] at wordSpec canonicalSpec
exact canonicalSpec.trans wordSpec.symm
have assembledEq : assembled = word :=
UScalar.eq_of_val_eq assembledVal
subst assembled
change ModelF64Neg word = ok f at hresult
cases hresult
dsimp only [DecimalGoalVocabularyDefault] at hwordNonNan ⊢
intro hnan
apply hwordNonNan
rcases hnan with ⟨hexponent, hfraction⟩
refine ⟨?_, ?_⟩
· change (((word.bv ^^^ BitVec.ofNat 64 (2 ^ 63)).toNat) %
2 ^ 63) / 2 ^ 52 = 2047 at hexponent
rw [BitVec.toNat_xor] at hexponent
have hbit : (BitVec.ofNat 64 (2 ^ 63)).toNat = 2 ^ 63 := by
norm_num
rw [hbit] at hexponent
change (word.val ^^^ (2 ^ 63)) % (2 ^ 63) /
(2 ^ 52) = 2047 at hexponent
have hxor : word.val ^^^ (2 ^ 63) = word.val + 2 ^ 63 := by
have hor := Nat.two_pow_add_eq_or_of_lt wordBound 1
have hx : word.val ^^^ (2 ^ 63) =
(2 ^ 63) ||| word.val := by
apply Nat.eq_of_testBit_eq
intro k
rw [Nat.testBit_xor, Nat.testBit_or, Nat.testBit_two_pow]
by_cases hk : k = 63
· subst k
rw [Nat.testBit_lt_two_pow wordBound]
decide
· have hk' : 63 ≠ k := Ne.symm hk
simp [hk, hk']
exact hx.trans (by simpa [Nat.add_comm] using hor.symm)
rw [hxor, Nat.add_mod] at hexponent
norm_num at hexponent
exact hexponent
· change (((word.bv ^^^ BitVec.ofNat 64 (2 ^ 63)).toNat) %
2 ^ 52) ≠ 0 at hfraction
rw [BitVec.toNat_xor] at hfraction
have hbit : (BitVec.ofNat 64 (2 ^ 63)).toNat = 2 ^ 63 := by
norm_num
rw [hbit] at hfraction
change (word.val ^^^ (2 ^ 63)) % (2 ^ 52) ≠ 0 at hfraction
have hxor : word.val ^^^ (2 ^ 63) = word.val + 2 ^ 63 := by
have hor := Nat.two_pow_add_eq_or_of_lt wordBound 1
have hx : word.val ^^^ (2 ^ 63) =
(2 ^ 63) ||| word.val := by
apply Nat.eq_of_testBit_eq
intro k
rw [Nat.testBit_xor, Nat.testBit_or, Nat.testBit_two_pow]
by_cases hk : k = 63
· subst k
rw [Nat.testBit_lt_two_pow wordBound]
decide
· have hk' : 63 ≠ k := Ne.symm hk
simp [hk, hk']
exact hx.trans (by simpa [Nat.add_comm] using hor.symm)
rw [hxor, Nat.add_mod] at hfraction
norm_num at hfraction
exact hfraction
· simp only [negative, if_false] at traced
cases traced
obtain ⟨wordSpec, wordBound⟩ :=
ParserSelectedMagnitudeSign
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have exponentBound := ParserSelectedExponent
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
have mantissaBound := ParserSelectedMantissaBound
(⟨first :: tail, source_bound⟩ : Str) f _ hsource hout
change DecimalGoalVocabularyDefault.assembledWord selected word at wordSpec
change word.val < 2 ^ 63 at wordBound
have hwordNonNan := ParserAssembledPairNonNan selected word
exponentBound.1 exponentBound.2 mantissaBound
hselectedInfinity wordSpec wordBound
obtain ⟨canonical, hcanonical, canonicalSpec⟩ :=
AssemblyCorrespondence selected
rw [hassembled] at hcanonical
cases hcanonical
have resultVal : f.val = word.val := by
dsimp only [DecimalGoalVocabularyDefault] at wordSpec canonicalSpec
exact canonicalSpec.trans wordSpec.symm
dsimp only [DecimalGoalVocabularyDefault] at hwordNonNan ⊢
simpa [resultVal] using hwordNonNan
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
- AssemblyCorrespondence
- DecimalGoalVocabularyDefault
- F64 Insts CoreOpsArithDivF64F64
- F64 Insts CoreOpsArithMulF64F64
- F64 Insts CoreOpsArithNegF64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64
All 50 entries
- AssemblyCorrespondence
- DecimalGoalVocabularyDefault
- F64 Insts CoreOpsArithDivF64F64
- F64 Insts CoreOpsArithMulF64F64
- F64 Insts CoreOpsArithNegF64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS
- ModelF64MantissaDigits
- ModelF64Neg
- ModelSliceFirst
- ModelStrAsBytes
- ModelU64BitAnd
- ModelU64BitOr
- ModelU64Shl
- NativeCorrectOrDefer
- ParserAssembledPairNonNan
- ParserComputeFloatInfinityMantissa
- ParserSelectedExponent
- ParserSelectedMagnitudeSign
- ParserSelectedMantissaBound
- ParserSlowInfinityMantissa
- SourceValidByteSlice
- SpecialHelperInfinity
- SpecialHelperRejection
- num imp dec2flt Dec2FltAssemblyTrace
- num imp dec2flt Dec2FltTrace
- num imp dec2flt biased fp to float
- num imp dec2flt common BiasedFp Insts CoreCmpPartialEqBiasedFp eq
- num imp dec2flt common BiasedFp zero pow2
- num imp dec2flt dec2flt
- num imp dec2flt dec2flt with trace
- num imp dec2flt decimal Decimal try fast path
- num imp dec2flt decimal seq DecimalSeq left shift
- num imp dec2flt decimal seq DecimalSeq right shift
- num imp dec2flt decimal seq DecimalSeq round
- num imp dec2flt decimal seq parse decimal seq
- num imp dec2flt lemire compute float
- num imp dec2flt lemire compute product approx
- num imp dec2flt parse parse inf nan
- num imp dec2flt parse parse number
- num imp dec2flt slow parse long mantissa
- num imp dec2flt slow parse long mantissa MAX SHIFT
- num imp dec2flt slow parse long mantissa closure Insts CoreOpsFunctionFnTupleUsizeUsize call
- num imp traits Float EXP BITS default
- num imp traits Float EXP SAT default
- num imp traits Float INFINITE POWER default
- num imp traits Float SIG BITS default
Used by
No other declaration in this version lists this one as a dependency.
Inspect related source (201)
More program dependencies (159)
- BITS · traits.rs:319 Program Rust
- SIG_TOTAL_BITS · traits.rs:320 Program Rust
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- biased_fp_to_float · dec2flt/mod.rs:282 Program Rust
- eq · dec2flt/common.rs:51 Program Rust
- zero_pow2 · dec2flt/common.rs:62 Program Rust
- dec2flt · dec2flt/mod.rs:508 Program Rust
- dec2flt_with_trace · dec2flt/mod.rs:355 Program Rust
- try_fast_path · dec2flt/decimal.rs:59 Program Rust
- left_shift · dec2flt/decimal_seq.rs:129 Program Rust
- left_shift_loop0 · dec2flt/decimal_seq.rs:138 Program Rust
- body · dec2flt/decimal_seq.rs:138 Program Rust
- left_shift_loop1 · dec2flt/decimal_seq.rs:152 Program Rust
- body · dec2flt/decimal_seq.rs:152 Program Rust
- right_shift · dec2flt/decimal_seq.rs:175 Program Rust
- right_shift_loop0 · dec2flt/decimal_seq.rs:180 Program Rust
- body · dec2flt/decimal_seq.rs:180 Program Rust
- right_shift_loop0_loop0 · dec2flt/decimal_seq.rs:190 Program Rust
- body · dec2flt/decimal_seq.rs:190 Program Rust
- right_shift_loop1 · dec2flt/decimal_seq.rs:209 Program Rust
- body · dec2flt/decimal_seq.rs:209 Program Rust
- right_shift_loop2 · dec2flt/decimal_seq.rs:216 Program Rust
- body · dec2flt/decimal_seq.rs:216 Program Rust
- round · dec2flt/decimal_seq.rs:96 Program Rust
- round_loop · dec2flt/decimal_seq.rs:106 Program Rust
- body · dec2flt/decimal_seq.rs:106 Program Rust
- parse_decimal_seq · dec2flt/decimal_seq.rs:283 Program Rust
- parse_decimal_seq_loop0 · dec2flt/decimal_seq.rs:290 Program Rust
- body · dec2flt/decimal_seq.rs:290 Program Rust
- parse_decimal_seq_loop1 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- parse_decimal_seq_loop2 · dec2flt/decimal_seq.rs:303 Program Rust
- body · dec2flt/decimal_seq.rs:303 Program Rust
- parse_decimal_seq_loop3 · dec2flt/decimal_seq.rs:307 Program Rust
- body · dec2flt/decimal_seq.rs:307 Program Rust
- parse_decimal_seq_loop4 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- parse_decimal_seq_loop5 · dec2flt/decimal_seq.rs:307 Program Rust
- body · dec2flt/decimal_seq.rs:307 Program Rust
- parse_decimal_seq_loop6 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- parse_decimal_seq_loop7 · dec2flt/decimal_seq.rs:361 Program Rust
- body · dec2flt/decimal_seq.rs:361 Program Rust
- compute_float · dec2flt/lemire.rs:26 Program Rust
- compute_product_approx · dec2flt/lemire.rs:134 Program Rust
- parse_inf_nan · dec2flt/parse.rs:241 Program Rust
- parse_number · dec2flt/parse.rs:231 Program Rust
- parse_long_mantissa · dec2flt/slow.rs:27 Program Rust
- MAX_SHIFT · dec2flt/slow.rs:28 Program Rust
- call · dec2flt/slow.rs:33 Program Rust
- parse_long_mantissa_loop0 · dec2flt/slow.rs:51 Program Rust
- body · dec2flt/slow.rs:51 Program Rust
- parse_long_mantissa_loop1 · dec2flt/slow.rs:69 Program Rust
- body · dec2flt/slow.rs:69 Program Rust
- parse_long_mantissa_loop2 · dec2flt/slow.rs:94 Program Rust
- body · dec2flt/slow.rs:94 Program Rust
- default · traits.rs:104 Program Rust
- default · traits.rs:110 Program Rust
- default · traits.rs:113 Program Rust
- default · traits.rs:101 Program Rust
- MAX_EXPONENT_DISGUISED_FAST_PATH · dec2flt/mod.rs:220 Program Rust
- MAX_EXPONENT_FAST_PATH · dec2flt/mod.rs:219 Program Rust
- from_u64 · dec2flt/mod.rs:263 Program Rust
- pow10_fast_path · dec2flt/mod.rs:222 Program Rust
- from_u64_bits · traits.rs:341 Program Rust
- integer_decode · traits.rs:348 Program Rust
- EXP_MASK · traits.rs:321 Program Rust
- INFINITY · traits.rs:312 Program Rust
- LARGEST_POWER_OF_TEN · traits.rs:327 Program Rust
- MAX_EXPONENT_ROUND_TO_EVEN · traits.rs:325 Program Rust
- MIN_EXPONENT_ROUND_TO_EVEN · traits.rs:324 Program Rust
- NAN · traits.rs:314 Program Rust
- NEG_INFINITY · traits.rs:313 Program Rust
- NEG_NAN · traits.rs:317 Program Rust
- SIG_MASK · traits.rs:322 Program Rust
- SMALLEST_POWER_OF_TEN · traits.rs:328 Program Rust
- classify · traits.rs:334 Program Rust
- to_bits · traits.rs:330 Program Rust
- read_u64 · dec2flt/common.rs:18 Program Rust
- write_u64 · dec2flt/common.rs:25 Program Rust
- Dec2flt_modelNumImpTraitsInt · traits.rs:51 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- default · dec2flt/mod.rs:128 Program Rust
- default · dec2flt/mod.rs:121 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- is_8digits · dec2flt/common.rs:40 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- can_use_fast_path · dec2flt/decimal.rs:42 Program Rust
- INT_POW10 · dec2flt/decimal.rs:8 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:67 Program Rust
- default · dec2flt/decimal_seq.rs:33 Program Rust
- MAX_DIGITS · dec2flt/decimal_seq.rs:63 Program Rust
- MAX_DIGITS_WITHOUT_OVERFLOW · dec2flt/decimal_seq.rs:66 Program Rust
- trim · dec2flt/decimal_seq.rs:82 Program Rust
- trim_loop · dec2flt/decimal_seq.rs:91 Program Rust
- body · dec2flt/decimal_seq.rs:91 Program Rust
- count_trailing_zeros · dec2flt/decimal_seq.rs:235 Program Rust
- count_trailing_zeros_loop · dec2flt/decimal_seq.rs:239 Program Rust
- body · dec2flt/decimal_seq.rs:239 Program Rust
- number_of_digits_decimal_left_shift · dec2flt/decimal_seq.rs:368 Program Rust
- number_of_digits_decimal_left_shift_loop · dec2flt/decimal_seq.rs:434 Program Rust
- body · dec2flt/decimal_seq.rs:434 Program Rust
- parse_decimal_exponent · dec2flt/decimal_seq.rs:269 Program Rust
- parse_decimal_exponent_loop · dec2flt/decimal_seq.rs:272 Program Rust
- body · dec2flt/decimal_seq.rs:272 Program Rust
- parse_digits_into_seq · dec2flt/decimal_seq.rs:256 Program Rust
- parse_digits_into_seq_loop · dec2flt/decimal_seq.rs:258 Program Rust
- body · dec2flt/decimal_seq.rs:258 Program Rust
- set_precision · dec2flt/fpu.rs:99 Program Rust
- full_multiplication · dec2flt/lemire.rs:126 Program Rust
- power · dec2flt/lemire.rs:121 Program Rust
- parse_partial_number · dec2flt/parse.rs:161 Program Rust
- pfe_empty · dec2flt/mod.rs:270 Program Rust
- pfe_invalid · dec2flt/mod.rs:277 Program Rust
- NUM_POWERS · dec2flt/slow.rs:29 Program Rust
- POWERS · dec2flt/slow.rs:30 Program Rust
- closure · dec2flt/slow.rs:33 Program Rust
- LARGEST_POWER_OF_FIVE · dec2flt/table.rs:10 Program Rust
- POWER_OF_FIVE_128 · dec2flt/table.rs:19 Program Rust
- SMALLEST_POWER_OF_FIVE · dec2flt/table.rs:9 Program Rust
- Float · traits.rs:74 Program Rust
- default · traits.rs:116 Program Rust
- default · traits.rs:119 Program Rust
- FloatExt · traits.rs:170 Program Rust
- offset_from · dec2flt/common.rs:30 Program Rust
- Dec2flt_modelNumImpTraitsCastIntoI16 · traits.rs:45 Program Rust
- ONE · traits.rs:53 Program Rust
- ZERO · traits.rs:52 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- try_add_digit · dec2flt/decimal_seq.rs:73 Program Rust
- TABLE · dec2flt/decimal_seq.rs:370 Program Rust
- TABLE_POW5 · dec2flt/decimal_seq.rs:379 Program Rust
- adjust_many_digit_count · dec2flt/parse.rs:86 Program Rust
- adjust_many_digit_count_loop · dec2flt/parse.rs:89 Program Rust
- body · dec2flt/parse.rs:89 Program Rust
- parse_many_digits · dec2flt/parse.rs:104 Program Rust
- parse_scientific · dec2flt/parse.rs:121 Program Rust
- parse_scientific_loop · dec2flt/parse.rs:142 Program Rust
- body · dec2flt/parse.rs:142 Program Rust
- try_parse_digits · dec2flt/parse.rs:30 Program Rust
- try_parse_digits_loop0 · dec2flt/parse.rs:33 Program Rust
- body · dec2flt/parse.rs:33 Program Rust
- try_parse_digits_loop1 · dec2flt/parse.rs:50 Program Rust
- body · dec2flt/parse.rs:50 Program Rust
- CastInto · traits.rs:18 Program Rust
- Int · traits.rs:27 Program Rust
- cast · traits.rs:46 Program Rust
- MIN_19DIGIT_INT · dec2flt/parse.rs:8 Program Rust
- parse_8digits · dec2flt/parse.rs:18 Program Rust
- try_parse_19digits · dec2flt/parse.rs:61 Program Rust
- try_parse_19digits_loop · dec2flt/parse.rs:64 Program Rust
- body · dec2flt/parse.rs:64 Program Rust
- MASK · dec2flt/parse.rs:19 Program Rust
- MUL1 · dec2flt/parse.rs:20 Program Rust
- MUL2 · dec2flt/parse.rs:21 Program Rust
Standard-library dependencies (39)
- 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
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- mul · core/src/ops/arith.rs:350 Rust library
- INFINITY · core/src/num/f64.rs:512 Rust library
- from_bits · core/src/num/f64.rs:1269 Rust library
- from_residual · core/src/option.rs:2793 Rust library
- branch · core/src/option.rs:2779 Rust library
- clone · core/src/clone.rs:698 Rust library
- shr · core/src/ops/bit.rs:612 Rust library
- EXPONENT_MASK · core/src/num/f64.rs:615 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
- to_bits · core/src/num/f64.rs:1223 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- split_first · core/src/slice/mod.rs:198 Rust library
- CoreOpsArithDivF64F64 · core/src/ops/arith.rs:511 Rust library
- CoreOpsArithMulF64F64 · core/src/ops/arith.rs:344 Rust library
- CoreOpsArithNegF64 · core/src/ops/arith.rs:713 Rust library
- CoreMarkerCopy · core/src/marker.rs:57 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
- CoreCloneClone · core/src/clone.rs:696 Rust library
- CoreOpsBitBitAndU64U64 · core/src/ops/bit.rs:174 Rust library
- CoreOpsBitBitOrU64U64 · core/src/ops/bit.rs:278 Rust library
- CoreOpsBitShlU32U64 · core/src/ops/bit.rs:483 Rust library
- CoreOpsBitShrU32U64 · core/src/ops/bit.rs:606 Rust library
- FpCategory · core/src/num/mod.rs:1522 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
- Dec2Flt.configured_x86_64_numBits
- 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
- AssemblyCorrespondence
- Binary64AdjacentNormalValues
- Binary64ApplySign
- Binary64EncoderCarryArithmetic
- Binary64ExactPositiveDivRounds
- Binary64ExactPositiveMulRounds
All 187 entries
- AssemblyCorrespondence
- Binary64AdjacentNormalValues
- Binary64ApplySign
- Binary64EncoderCarryArithmetic
- Binary64ExactPositiveDivRounds
- Binary64ExactPositiveMulRounds
- Binary64FastPathGuard
- Binary64FastPathIndexCasts
- Binary64FiniteMagnitudeStrictMono
- Binary64FromU64Exact
- Binary64IntPow10Index
- Binary64Model
- Binary64ModelDefault
- Binary64NativeCallDomain
- Binary64NormalEncoderRounds
- Binary64Pow10FastPathExact
- Binary64ZeroDivRounds
- Binary64ZeroMulRounds
- DecimalGoalVocabulary
- DecimalGoalVocabularyDefault
- DecimalLexeme
- F64
- F64 Insts CoreCloneClone
- F64 Insts CoreMarkerCopy
- F64 Insts CoreOpsArithDivF64F64
- F64 Insts CoreOpsArithMulF64F64
- F64 Insts CoreOpsArithNegF64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT DISGUISED FAST PATH
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT FAST PATH
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64 pow10 fast path
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64 from u64 bits
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64 integer decode
- F64 Insts Dec2flt modelNumImpTraitsFloatU64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 EXP MASK
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 INFINITY
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 LARGEST POWER OF TEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 MAX EXPONENT ROUND TO EVEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 MIN EXPONENT ROUND TO EVEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NAN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NEG INFINITY
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NEG NAN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG MASK
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SMALLEST POWER OF TEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 classify
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 to bits
- ModelF64Classify
- ModelF64Clone
- ModelF64Div
- ModelF64ExponentMask
- ModelF64FromBits
- ModelF64FromU64
- ModelF64Infinity
- ModelF64MantissaDigits
- ModelF64MantissaMask
- ModelF64Mul
- ModelF64Nan
- ModelF64Neg
- ModelF64NegInfinity
- ModelF64ToBits
- ModelOptionBranch
- ModelOptionFromResidual
- ModelSliceFirst
- ModelSliceSplitFirst
- ModelStrAsBytes
- ModelU64BitAnd
- ModelU64BitOr
- ModelU64Shl
- ModelU64Shr
- ModelU8IsAsciiDigit
- NativeCorrectOrDefer
- NumberHelperReadEightBytes
- ParserAssembledPairNonNan
- ParserComputeFloatExponentRange
- ParserComputeFloatInfinityMantissa
- ParserComputeFloatMantissaBound
- ParserExponentConstants
- ParserNonNanResults
- ParserSelectedExponent
- ParserSelectedMagnitudeSign
- ParserSelectedMantissaBound
- ParserSlowExponentRange
- ParserSlowInfinityMantissa
- ParserSlowLoopInfinityResult
- ParserSlowLoopMinimumExponent
- ParserSlowLoopZeroResult
- ParserSlowMantissaBound
- ParserSpecialRejectionSafeLength
- Preamble
- ResultLoopPartial
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice offset from
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice read u64
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice write u64
- SourceValidByteSlice
- SpecialHelperInfinity
- SpecialHelperRejection
- U64 Insts CoreOpsBitBitAndU64U64
- U64 Insts CoreOpsBitBitOrU64U64
- U64 Insts CoreOpsBitShlU32U64
- U64 Insts CoreOpsBitShrU32U64
- U64 Insts Dec2flt modelNumImpTraitsCastIntoI16
- U64 Insts Dec2flt modelNumImpTraitsCastIntoI16 cast
- U64 Insts Dec2flt modelNumImpTraitsInt
- U64 Insts Dec2flt modelNumImpTraitsInt ONE
- U64 Insts Dec2flt modelNumImpTraitsInt ZERO
- core num FpCategory
- core ops arith Div
- core ops arith Mul
- core ops arith Neg
- core ops bit BitOr
- core ops bit Shl
- core ops bit Shr
- num float parse FloatErrorKind
- num float parse ParseFloatError
- num imp dec2flt Dec2FltAssemblyTrace
- num imp dec2flt Dec2FltTrace
- num imp dec2flt Lemire
- num imp dec2flt Lemire MAX MANTISSA FAST PATH default
- num imp dec2flt biased fp to float
- num imp dec2flt common BiasedFp
- num imp dec2flt common BiasedFp Insts CoreCmpPartialEqBiasedFp eq
- num imp dec2flt common BiasedFp zero pow2
- num imp dec2flt common is 8digits
- num imp dec2flt dec2flt
- num imp dec2flt dec2flt with trace
- num imp dec2flt decimal Decimal
- num imp dec2flt decimal Decimal can use fast path
- num imp dec2flt decimal Decimal try fast path
- num imp dec2flt decimal INT POW10
- num imp dec2flt decimal seq DecimalSeq
- num imp dec2flt decimal seq DecimalSeq DECIMAL POINT RANGE
- num imp dec2flt decimal seq DecimalSeq Insts CoreDefaultDefault default
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS WITHOUT OVERFLOW
- num imp dec2flt decimal seq DecimalSeq left shift
- num imp dec2flt decimal seq DecimalSeq right shift
- num imp dec2flt decimal seq DecimalSeq round
- num imp dec2flt decimal seq DecimalSeq trim
- num imp dec2flt decimal seq DecimalSeq try add digit
- num imp dec2flt decimal seq count trailing zeros
- num imp dec2flt decimal seq number of digits decimal left shift
- num imp dec2flt decimal seq number of digits decimal left shift TABLE
- num imp dec2flt decimal seq number of digits decimal left shift TABLE POW5
- num imp dec2flt decimal seq parse decimal exponent
- num imp dec2flt decimal seq parse decimal seq
- num imp dec2flt decimal seq parse digits into seq
- num imp dec2flt fpu fpu precision set precision
- num imp dec2flt lemire compute float
- num imp dec2flt lemire compute product approx
- num imp dec2flt lemire full multiplication
- num imp dec2flt lemire power
- num imp dec2flt parse MIN 19DIGIT INT
- num imp dec2flt parse adjust many digit count
- num imp dec2flt parse parse 8digits
- num imp dec2flt parse parse 8digits MASK
- num imp dec2flt parse parse 8digits MUL1
- num imp dec2flt parse parse 8digits MUL2
- num imp dec2flt parse parse inf nan
- num imp dec2flt parse parse many digits
- num imp dec2flt parse parse number
- num imp dec2flt parse parse partial number
- num imp dec2flt parse parse scientific
- num imp dec2flt parse try parse 19digits
- num imp dec2flt parse try parse digits
- num imp dec2flt pfe empty
- num imp dec2flt pfe invalid
- num imp dec2flt slow parse long mantissa
- num imp dec2flt slow parse long mantissa MAX SHIFT
- num imp dec2flt slow parse long mantissa NUM POWERS
- num imp dec2flt slow parse long mantissa POWERS
- num imp dec2flt slow parse long mantissa closure
- num imp dec2flt slow parse long mantissa closure Insts CoreOpsFunctionFnTupleUsizeUsize call
- num imp dec2flt table LARGEST POWER OF FIVE
- num imp dec2flt table POWER OF FIVE 128
- num imp dec2flt table SMALLEST POWER OF FIVE
- num imp traits CastInto
- num imp traits Float
- num imp traits FloatExt
- num imp traits Float EXP BIAS default
- num imp traits Float EXP BITS default
- num imp traits Float EXP MIN default
- num imp traits Float EXP SAT default
- num imp traits Float SIG BITS default
- num imp traits Int
Technical checking records
Local closure summary
{
"node": "ParserNonNanResults",
"closure_version": "patch_c_v1",
"active_decl_hash": "fd5163805484e0f358f113d2c7d40cf25a27a873eb3daffd909fef24b5cc24b1",
"active_statement_hash": "508da2fae6fcede85d303ff05d1a299a8e83316244dadb8d4840c30259c8656b",
"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-136",
"boundary_theorems": {},
"strict_theorem_deps": {
"AssemblyCorrespondence": "e3495a6647394e20",
"DecimalGoalVocabularyDefault": "94cb4c406f8efb78",
"NativeCorrectOrDefer": "4eb7d1b8e4ed1a56",
"ParserAssembledPairNonNan": "5be7fbb4c365e47d",
"ParserComputeFloatInfinityMantissa": "3d5b3a671765d393",
"ParserSelectedExponent": "2d4e5f8c99bf68c7",
"ParserSelectedMagnitudeSign": "70c47baac228615a",
"ParserSelectedMantissaBound": "8c0433452b441220",
"ParserSlowInfinityMantissa": "35810a563a0faf15",
"SpecialHelperInfinity": "4124e26dd85ce114",
"SpecialHelperRejection": "e1e229c5dd3ecf3c",
"num_imp_dec2flt_dec2flt_with_trace": "f3e7d4ffbf9b4d68",
"num_imp_traits_Float_SIG_BITS_default": "9ab622d85ef04d94"
},
"strict_definition_deps": {
"DecimalGoalVocabulary": "91e42e6d78c02c8e",
"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",
"ModelF64Neg": "78a021de99eb373b",
"ModelSliceFirst": "a31394b3c1080f71",
"Preamble": "86dc391ab250c79b",
"SourceValidByteSlice": "3dc42716a6378d26",
"core_ops_arith_Neg": "0ff07135a60bcbf9",
"num_float_parse_ParseFloatError": "c43614ff2149ecf2",
"num_imp_dec2flt_Dec2FltAssemblyTrace": "7bda5de02611ad76",
"num_imp_dec2flt_Dec2FltTrace": "644abe66cec8ac98",
"num_imp_dec2flt_Lemire": "1923f90c53d323e6",
"num_imp_dec2flt_biased_fp_to_float": "acdde060e8d35ca7",
"num_imp_dec2flt_common_BiasedFp": "31d81cf1cf22709f",
"num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq": "fbbf553e3c502a05",
"num_imp_dec2flt_dec2flt": "f9f7d93449a25efa",
"num_imp_dec2flt_dec2flt_with_trace": "5665189e0304a27e",
"num_imp_dec2flt_decimal_Decimal": "fe99f3f976739f2d",
"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": "Recorded Sound: VerifierPass",
"assessment_status": "VerifierPass",
"fingerprint_relation": "matches current fingerprint",
"assessment_fingerprint": "sound-v2:dfd3c70b8df8e62ea62844da2c916902cdb5760ea6c811598421b32d3e226cb4",
"current_fingerprint": "sound-v2:dfd3c70b8df8e62ea62844da2c916902cdb5760ea6c811598421b32d3e226cb4",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}