Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Theorem
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.Binary64ModelDefault
import Tablet.ParserExactRoundingExecution
import Tablet.ParserExactRoundingWitness
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_DISGUISED_FAST_PATH
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_pow10_fast_path
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_SIG_TOTAL_BITS
import Tablet.ModelF64FromBits
import Tablet.ModelF64FromU64
import Tablet.ModelF64MantissaDigits
import Tablet.ModelF64Mul
import Tablet.ModelOptionBranch
import Tablet.ModelSliceFirst
import Tablet.ModelSliceSplitFirst
import Tablet.ModelStrAsBytes
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.ModelU8IsAsciiDigit
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_offset_from
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64
import Tablet.U64_Insts_CoreOpsBitBitAndU64U64
import Tablet.U64_Insts_CoreOpsBitBitOrU64U64
import Tablet.U64_Insts_CoreOpsBitShlU32U64
import Tablet.num_imp_dec2flt_Lemire_MAX_MANTISSA_FAST_PATH_default
import Tablet.num_imp_dec2flt_Lemire_MIN_EXPONENT_FAST_PATH_default
import Tablet.num_imp_dec2flt_common_is_8digits
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_decimal_Decimal
import Tablet.num_imp_dec2flt_decimal_Decimal_can_use_fast_path
import Tablet.num_imp_dec2flt_decimal_INT_POW10
import Tablet.num_imp_dec2flt_fpu_fpu_precision_set_precision
import Tablet.num_imp_dec2flt_parse_adjust_many_digit_count
import Tablet.num_imp_dec2flt_parse_parse_8digits
import Tablet.num_imp_dec2flt_parse_parse_8digits_MASK
import Tablet.num_imp_dec2flt_parse_parse_8digits_MUL1
import Tablet.num_imp_dec2flt_parse_parse_8digits_MUL2
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_partial_number
import Tablet.num_imp_dec2flt_parse_parse_scientific
import Tablet.num_imp_dec2flt_parse_try_parse_digits
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option maxHeartbeats 0
set_option maxRecDepth 1000000
namespace dec2flt_model
-- [TABLET NODE: ParserExactRounding__Refutation]
theorem ParserExactRounding__Refutation : ¬ (∀ (s : Str) (x : DecimalLexeme) (f : F64), DecimalGoalVocabularyDefault.sourceString s ->
DecimalGoalVocabularyDefault.validNumeric x -> DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x ->
num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) ->
∃ magnitude : F64, DecimalGoalVocabularyDefault.roundsMagnitude (DecimalGoalVocabularyDefault.exactMagnitude x) magnitude ∧
DecimalGoalVocabularyDefault.signedMagnitude (DecimalGoalVocabularyDefault.lexicalNegative x) magnitude 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
0. 0^{65535}1e655360. Let x be the unsigned numeric
lexeme with integer digits [0], fractional digits
\operatorname{replicate}(65535,0)\mathbin{++}[1], and unsigned lower-case
exponent digits [6,5,5,3,6,0]. Let f be the binary64 word
\texttt{0x3ff0000000000000}=4607182418800017408, namely 1.0.String.toUTF8 satisfies the invariant that, at byte-array index i
with reverse accumulator r, the loop result is
r^{\mathrm{rev}} followed by the backing array after index i; induction on
the byte-array loop therefore identifies its output list with the backing
data in order. Applying this to the displayed character list proves that its
UTF-8 bytes are exactly the bytes of s, without relying on evaluation of the
long string.read_u64 below, the current slice has length at
least eight. Its definition creates an eight-byte zero array, obtains its
mutable slice without failure, and takes the checked prefix
self[..8]; the inequality 8\leq|\texttt{self}| discharges that
slice bound. Both source and destination then have length eight, so
copy_from_slice succeeds, and from_le_bytes returns the
little-endian word. Thus none of these monadic steps can be fail.read_u64 returns
is_8digits arithmetic is
u64 is in range,
the wrapping product 0\cdot10 and sum 0+0 are zero, and checked
0+1=1 is within usize. At count one the in-bounds byte is 46;
46-_{8}48=254\not<10, so the scalar loop stops. Dropping the checked
one-byte prefix is allowed because 1\leq65545. The first call therefore
returns the suffix beginning at the point and mantissa zero.is_8digits, the wrapping sum is
8536140394893047414, the wrapping difference z-z is zero, their OR is
8536140394893047414, and conjunction with
9259542123273814144 is zero. Thus the block is accepted. In
parse_8digits, the checked subtraction z-z=0, checked
multiplication 0\cdot10=0, signed-count shift 0\mathbin{\texttt{>>>}}8=0,
and checked addition 0+0=0 all succeed. Conjunction with M is zero;
wrapping multiplication by M_1 is zero. The signed-count shift by 16 is
zero, its conjunction with M is zero, wrapping multiplication by M_2 is
zero, and the wrapping sum is zero. The signed-count shift by 32 is zero.
Each shift count is nonnegative and below 64, so each checked shift succeeds.
Finally 0\leq2^{32}-1, so the u64-to-u32 cast succeeds,
and the widening cast returns u64 zero. Every monadic line of this
call has thus been discharged and the result is zero.parse_8digits reduction is
u32 succeeds, and widening it gives u64 one. Thus this
call also has no failing bind and returns one.e655360 remains. Its length is
less than eight, so the bulk loop stops without reading a word. The scalar
loop performs an in-bounds read of byte 101 at count zero and obtains
101-_{8}48=53\not<10; it stops, and the final drop by count zero is in
bounds. Hence the fractional scan consumes exactly 65536 digits, returns
mantissa one, and leaves e655360.isize and subtracts the remaining length
from the original. All lengths here are at most 65545<2^{63}-1, so both
casts succeed. Initially it computes 65545-65544=1; after the point it
computes 65543-7=65536. Checked negation gives -65536, in range for
isize, and its cast to i64 succeeds. Thus the decimal-point
contribution to the record exponent is -65536, and checked addition of the
two digit counts gives 1+65536=65537.i64 products and sums are
i64; the byte-to-i64 casts are
of values at most six. At the sixth digit, the old accumulator is 65536,
so the strict guard is false and no product or sum is attempted. For counts
0 through 5, the premise count < length justifies each indexed
read and checked increment; the increments end at 6, still in
usize. The range slice dropping six bytes has bound 6\leq6 and
therefore returns the empty suffix. The helper returns
Some 65536. The option branch supplied by
ModelOptionBranch is consequently its nonfailing Continue arm, and
the checked exponent addition is -65536+65536=0.isize cast succeeds, checked count subtraction gives 65517, and
checked index increment gives one. At the point byte 46, the same checked
48-1=47 is followed by 46\mathbin{\mathrm{sat}-}47=0; subtracting zero
leaves 65517, and the checked increment gives index two. This proves the
base. At each fractional zero the indexed read is justified by
2+k<65545, the same computations yield one, and
(65517-k)-1=65517-(k+1) remains between -18 and 65517; the index
increment remains at most 65537. This proves the induction step without an
overflow or a failing cast. At k=65535 the state is count -18 and index
65537. The in-bounds byte there is 49, neither point nor zero, so that
iteration only changes scanning to false. The next loop equation takes the
non-scanning done arm and returns -18.isize length casts, the checked subtraction, and the subsequent
usize cast succeed because 65545<2^{63}-1. Hence the partial
parser returns the num imp dec2flt decimal Decimal record
parse_number returns precisely this record in
Some.Some record.u64 word one using U64 Insts CoreOpsBitShlU32U64
and ModelU64Shl. Since 53<64, that modeled shift succeeds and
returns
2^{53}=9007199254740992. Thus the guards evaluate, in their actual order,
to
can_use_fast_path returns true without failure.from_u64 field is ModelF64FromU64. Its guard
1\leq2^{53} holds. In the exact conversion semantics of
Binary64ModelDefault, one is below the overflow threshold and is
not subnormal because 2^{-1022}\leq1. The normal-exponent scan tests
2^{e-1023}\leq1: it succeeds through exponent field e=1023 and fails
from e=1024 onward, so its retained field is exactly 1023. Scaling the
significand gives
1\cdot2^{1075-1023}=2^{52}; its quotient/remainder rounding has remainder
zero and returns 2^{52}, not the carry value 2^{53}. The encoder therefore
returns the raw word
usize
returns zero. In
F64 Insts Dec2flt modelNumImpDec2fltLemireU64 pow10 fast path, the
mask calculation is 0\mathbin{\&}31=0, so the zero table arm calls the
from-bits operation ModelF64FromBits on
4607182418800017408; that operation preserves the word exactly. The
supplied multiplication record
F64 Insts CoreOpsArithMulF64F64 has operation
ModelF64Mul; by Binary64ModelDefault, its exact finite
decoder maps each operand's exponent-1023, fraction-zero magnitude to one,
and their signs agree. Its rational product is therefore 1\cdot1=1; the
same exponent-scan and zero-remainder calculation just displayed re-encodes
that product as raw word 4607182418800017408. The supplied division and negation records
F64 Insts CoreOpsArithDivF64F64 and
F64 Insts CoreOpsArithNegF64 are not invoked: the exponent is not
negative and the record's negative flag is false. Therefore
try_fast_path returns this word in Some.Result.Ok of the word together
with a fast-path trace. Finally, num imp dec2flt dec2flt projects
the first component and returns
ok (Result.Ok 4607182418800017408). This establishes every premise
of the assumed universal claim for (s,x,f).roundsMagnitude requires the strict reverse
inequality, so it is impossible; its infinity branch forces raw word
2047\cdot2^{52}=9218868437227405312.signedMagnitude requires the returned
word to equal that magnitude word without adding the sign bit. But the
concrete execution returned 4607182418800017408, and
4607182418800017408\ne9218868437227405312. This contradiction proves the
exact negation in the statement.Lean proof
let zeros : List Nat := List.replicate 65535 0
let fraction : List Nat := zeros ++ [1]
let lexeme : DecimalLexeme := {
leadingSign := none
integerDigits := [0]
fractionDigits := some fraction
exponent := some (false, none, [6, 5, 5, 3, 6, 0])
}
let witnessBytes : List Std.U8 :=
[48#u8, 46#u8] ++ List.replicate 65535 48#u8 ++
[49#u8, 101#u8, 54#u8, 53#u8, 53#u8, 51#u8, 54#u8, 48#u8]
have witnessBytes_length : witnessBytes.length = 65545 := by
simp only [witnessBytes, List.length_append, List.length_replicate,
List.length_cons, List.length_nil]
let witness : Str :=
⟨witnessBytes, by
rw [witnessBytes_length]
rcases Usize.bounds_eq with q | q <;>
norm_num [q, U32.max_eq, U64.max_eq]⟩
let one : F64 := ⟨BitVec.ofNat 64 4607182418800017408⟩
have byteArray_toList_eq_data (b : ByteArray) :
b.toList = b.data.toList := by
have aux (i : Nat) (r : List UInt8) (hi : i ≤ b.size) :
ByteArray.toList.loop b i r = r.reverse ++ b.data.toList.drop i := by
fun_induction ByteArray.toList.loop b i r with
| case1 i r h ih =>
rw [ih (by omega)]
simp only [List.reverse_cons, List.append_assoc, List.singleton_append]
have hlen : i < b.data.toList.length := by simpa using h
rw [List.drop_eq_getElem_cons hlen]
congr
cases b
rename_i data
exact getElem!_pos data i (by simpa using h)
| case2 i r h =>
have hieq : i = b.size := by omega
simp [hieq]
unfold ByteArray.toList
simpa using aux 0 [] (Nat.zero_le _)
let witnessString : String :=
String.ofList (['0', '.'] ++ List.replicate 65535 '0' ++
['1', 'e', '6', '5', '5', '3', '6', '0'])
have utf8_ofList (l : List Char) :
(String.ofList l).toUTF8.toList = l.flatMap String.utf8EncodeChar := by
rw [String.toUTF8, String.toByteArray_ofList]
rw [byteArray_toList_eq_data]
simp only [List.utf8Encode, List.toList_data_toByteArray]
have utf8_zeros (n : Nat) :
(List.replicate n '0').flatMap String.utf8EncodeChar =
List.replicate n (48 : UInt8) := by
rw [List.flatMap_replicate]
have h : String.utf8EncodeChar '0' = [(48 : UInt8)] := by decide
rw [h, List.flatten_replicate_singleton]
have witness_source : DecimalGoalVocabularyDefault.sourceString witness := by
dsimp only [DecimalGoalVocabularyDefault]
constructor
· change witnessBytes.length ≤ 9223372036854775807
rw [witnessBytes_length]
norm_num
· refine ⟨witnessString, ?_⟩
simp only [witnessString]
rw [utf8_ofList]
simp only [witness, witnessBytes, List.flatMap_append, utf8_zeros,
List.flatMap_cons, List.flatMap_nil, List.map_append, List.map_replicate,
List.map_cons, List.map_nil]
have h0 : (String.utf8EncodeChar '0').map UInt8.toNat = [48] := by decide
have hd : (String.utf8EncodeChar '.').map UInt8.toNat = [46] := by decide
have h1 : (String.utf8EncodeChar '1').map UInt8.toNat = [49] := by decide
have he : (String.utf8EncodeChar 'e').map UInt8.toNat = [101] := by decide
have h6 : (String.utf8EncodeChar '6').map UInt8.toNat = [54] := by decide
have h5 : (String.utf8EncodeChar '5').map UInt8.toNat = [53] := by decide
have h3 : (String.utf8EncodeChar '3').map UInt8.toNat = [51] := by decide
rw [h0, hd, h1, he, h6, h5, h3]
have u48 : (48#u8 : Std.U8).val = 48 := by decide
have u46 : (46#u8 : Std.U8).val = 46 := by decide
have u49 : (49#u8 : Std.U8).val = 49 := by decide
have u101 : (101#u8 : Std.U8).val = 101 := by decide
have u54 : (54#u8 : Std.U8).val = 54 := by decide
have u53 : (53#u8 : Std.U8).val = 53 := by decide
have u51 : (51#u8 : Std.U8).val = 51 := by decide
have ui48 : UInt8.toNat (48 : UInt8) = 48 := by decide
rw [u48, u46, u49, u101, u54, u53, u51, ui48]
rfl
have zeros_fold :
zeros.foldl (fun a d => 10 * a + d) 0 = 0 := by
have fold_zeros (k : Nat) :
(List.replicate k 0).foldl (fun a d => 10 * a + d) 0 = 0 := by
induction k with
| zero => rfl
| succ k ih => simpa [List.replicate_succ] using ih
exact fold_zeros 65535
have fraction_length : fraction.length = 65536 := by
simp only [fraction, zeros, List.length_append, List.length_replicate,
List.length_cons, List.length_nil]
have significand_fold :
([0] ++ fraction).foldl (fun a d => 10 * a + d) 0 = 1 := by
rw [List.foldl_append]
simp only [List.foldl_cons, List.foldl_nil, mul_zero, zero_add]
simp only [fraction]
rw [List.foldl_append, zeros_fold]
rfl
have lexeme_valid : DecimalGoalVocabularyDefault.validNumeric lexeme := by
have zeros_mem {d : Nat} (h : d ∈ zeros) : d = 0 := by
simp only [zeros, List.mem_replicate] at h
exact h.2
dsimp only [DecimalGoalVocabularyDefault]
constructor
· simp [lexeme]
constructor
· simp only [lexeme]
intro d hd
simp only [fraction] at hd
rcases List.mem_append.mp hd with hd | hd
· rw [zeros_mem hd]
norm_num
· simp only [List.mem_singleton] at hd
omega
constructor
· left
simp [lexeme]
· simp [lexeme]
have lexeme_render :
DecimalGoalVocabularyDefault.bytes witness =
DecimalGoalVocabularyDefault.renderNumeric lexeme := by
dsimp only [DecimalGoalVocabularyDefault]
simp only [lexeme, witness, witnessBytes, fraction, zeros, List.map_append,
List.map_cons, List.map_nil, List.map_replicate, Bool.false_eq_true,
reduceIte, Nat.reduceAdd, List.nil_append, List.cons_append]
norm_num
have lexeme_exact :
DecimalGoalVocabularyDefault.exactMagnitude lexeme =
(10 : Real) ^ (589824 : Nat) := by
dsimp only [DecimalGoalVocabularyDefault, lexeme]
rw [significand_fold, fraction_length]
norm_num
rfl
let infinityBits : Nat := 2047 * 2 ^ 52
have huge_target_is_infinity (w : F64)
(hw : DecimalGoalVocabularyDefault.roundsMagnitude
((10 : Real) ^ (589824 : Nat)) w) :
w.val = infinityBits := by
dsimp only [DecimalGoalVocabularyDefault] at hw
rcases hw with ⟨_, _, hw⟩
by_contra hne
have hne' : w.val ≠ 2047 * 2 ^ 52 := by
simpa [infinityBits] using hne
rw [if_neg hne'] at hw
have hthreshold :
((2 : Real) ^ (1024 : Nat)) - ((2 : Real) ^ (970 : Nat)) ≤
(10 : Real) ^ (589824 : Nat) := by
calc
(2 : Real) ^ 1024 - 2 ^ 970 ≤ 2 ^ 1024 :=
sub_le_self _ (by positivity)
_ ≤ 10 ^ 1024 := by gcongr <;> norm_num
_ ≤ 10 ^ 589824 := by
rw [show (589824 : Nat) = 1024 + 588800 by norm_num, pow_add]
exact le_mul_of_one_le_right (by positivity) (one_le_pow₀ (by norm_num))
exact (not_lt_of_ge hthreshold) hw.1
have hRun :
num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
F64.Insts.CoreOpsArithNegF64 witness =
ok (core.result.Result.Ok one) := by
exact ParserExactRoundingExecution witness (by rfl)
intro hPositive
rcases hPositive witness lexeme one witness_source lexeme_valid lexeme_render hRun with
⟨magnitude, hround, hsigned⟩
rw [lexeme_exact] at hround
have hinf := huge_target_is_infinity magnitude hround
dsimp only [DecimalGoalVocabularyDefault, lexeme, one] at hsigned
rw [hinf] at hsigned
have bad := hsigned.2
change (4607182418800017408 : Nat) = infinityBits + 0 at bad
have harithmetic : False := by
norm_num [infinityBits] at bad
obtain ⟨s, x, f, _, _, _, hsource, hvalid, hrender, hrun, hfalse⟩ :=
ParserExactRoundingWitness
exact hfalse (hPositive s x f hsource hvalid hrender hrun)
Download Lean source · Download TeX source
Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.Binary64ModelDefault
import Tablet.ParserExactRoundingExecution
import Tablet.ParserExactRoundingWitness
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_DISGUISED_FAST_PATH
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_MAX_EXPONENT_FAST_PATH
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64_pow10_fast_path
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_SIG_TOTAL_BITS
import Tablet.ModelF64FromBits
import Tablet.ModelF64FromU64
import Tablet.ModelF64MantissaDigits
import Tablet.ModelF64Mul
import Tablet.ModelOptionBranch
import Tablet.ModelSliceFirst
import Tablet.ModelSliceSplitFirst
import Tablet.ModelStrAsBytes
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.ModelU8IsAsciiDigit
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_offset_from
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64
import Tablet.U64_Insts_CoreOpsBitBitAndU64U64
import Tablet.U64_Insts_CoreOpsBitBitOrU64U64
import Tablet.U64_Insts_CoreOpsBitShlU32U64
import Tablet.num_imp_dec2flt_Lemire_MAX_MANTISSA_FAST_PATH_default
import Tablet.num_imp_dec2flt_Lemire_MIN_EXPONENT_FAST_PATH_default
import Tablet.num_imp_dec2flt_common_is_8digits
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_decimal_Decimal
import Tablet.num_imp_dec2flt_decimal_Decimal_can_use_fast_path
import Tablet.num_imp_dec2flt_decimal_INT_POW10
import Tablet.num_imp_dec2flt_fpu_fpu_precision_set_precision
import Tablet.num_imp_dec2flt_parse_adjust_many_digit_count
import Tablet.num_imp_dec2flt_parse_parse_8digits
import Tablet.num_imp_dec2flt_parse_parse_8digits_MASK
import Tablet.num_imp_dec2flt_parse_parse_8digits_MUL1
import Tablet.num_imp_dec2flt_parse_parse_8digits_MUL2
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_partial_number
import Tablet.num_imp_dec2flt_parse_parse_scientific
import Tablet.num_imp_dec2flt_parse_try_parse_digits
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
set_option maxHeartbeats 0
set_option maxRecDepth 1000000
namespace dec2flt_model
-- [TABLET NODE: ParserExactRounding__Refutation]
theorem ParserExactRounding__Refutation : ¬ (∀ (s : Str) (x : DecimalLexeme) (f : F64), DecimalGoalVocabularyDefault.sourceString s ->
DecimalGoalVocabularyDefault.validNumeric x -> DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x ->
num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) ->
∃ magnitude : F64, DecimalGoalVocabularyDefault.roundsMagnitude (DecimalGoalVocabularyDefault.exactMagnitude x) magnitude ∧
DecimalGoalVocabularyDefault.signedMagnitude (DecimalGoalVocabularyDefault.lexicalNegative x) magnitude f) := by
-- BODY
let zeros : List Nat := List.replicate 65535 0
let fraction : List Nat := zeros ++ [1]
let lexeme : DecimalLexeme := {
leadingSign := none
integerDigits := [0]
fractionDigits := some fraction
exponent := some (false, none, [6, 5, 5, 3, 6, 0])
}
let witnessBytes : List Std.U8 :=
[48#u8, 46#u8] ++ List.replicate 65535 48#u8 ++
[49#u8, 101#u8, 54#u8, 53#u8, 53#u8, 51#u8, 54#u8, 48#u8]
have witnessBytes_length : witnessBytes.length = 65545 := by
simp only [witnessBytes, List.length_append, List.length_replicate,
List.length_cons, List.length_nil]
let witness : Str :=
⟨witnessBytes, by
rw [witnessBytes_length]
rcases Usize.bounds_eq with q | q <;>
norm_num [q, U32.max_eq, U64.max_eq]⟩
let one : F64 := ⟨BitVec.ofNat 64 4607182418800017408⟩
have byteArray_toList_eq_data (b : ByteArray) :
b.toList = b.data.toList := by
have aux (i : Nat) (r : List UInt8) (hi : i ≤ b.size) :
ByteArray.toList.loop b i r = r.reverse ++ b.data.toList.drop i := by
fun_induction ByteArray.toList.loop b i r with
| case1 i r h ih =>
rw [ih (by omega)]
simp only [List.reverse_cons, List.append_assoc, List.singleton_append]
have hlen : i < b.data.toList.length := by simpa using h
rw [List.drop_eq_getElem_cons hlen]
congr
cases b
rename_i data
exact getElem!_pos data i (by simpa using h)
| case2 i r h =>
have hieq : i = b.size := by omega
simp [hieq]
unfold ByteArray.toList
simpa using aux 0 [] (Nat.zero_le _)
let witnessString : String :=
String.ofList (['0', '.'] ++ List.replicate 65535 '0' ++
['1', 'e', '6', '5', '5', '3', '6', '0'])
have utf8_ofList (l : List Char) :
(String.ofList l).toUTF8.toList = l.flatMap String.utf8EncodeChar := by
rw [String.toUTF8, String.toByteArray_ofList]
rw [byteArray_toList_eq_data]
simp only [List.utf8Encode, List.toList_data_toByteArray]
have utf8_zeros (n : Nat) :
(List.replicate n '0').flatMap String.utf8EncodeChar =
List.replicate n (48 : UInt8) := by
rw [List.flatMap_replicate]
have h : String.utf8EncodeChar '0' = [(48 : UInt8)] := by decide
rw [h, List.flatten_replicate_singleton]
have witness_source : DecimalGoalVocabularyDefault.sourceString witness := by
dsimp only [DecimalGoalVocabularyDefault]
constructor
· change witnessBytes.length ≤ 9223372036854775807
rw [witnessBytes_length]
norm_num
· refine ⟨witnessString, ?_⟩
simp only [witnessString]
rw [utf8_ofList]
simp only [witness, witnessBytes, List.flatMap_append, utf8_zeros,
List.flatMap_cons, List.flatMap_nil, List.map_append, List.map_replicate,
List.map_cons, List.map_nil]
have h0 : (String.utf8EncodeChar '0').map UInt8.toNat = [48] := by decide
have hd : (String.utf8EncodeChar '.').map UInt8.toNat = [46] := by decide
have h1 : (String.utf8EncodeChar '1').map UInt8.toNat = [49] := by decide
have he : (String.utf8EncodeChar 'e').map UInt8.toNat = [101] := by decide
have h6 : (String.utf8EncodeChar '6').map UInt8.toNat = [54] := by decide
have h5 : (String.utf8EncodeChar '5').map UInt8.toNat = [53] := by decide
have h3 : (String.utf8EncodeChar '3').map UInt8.toNat = [51] := by decide
rw [h0, hd, h1, he, h6, h5, h3]
have u48 : (48#u8 : Std.U8).val = 48 := by decide
have u46 : (46#u8 : Std.U8).val = 46 := by decide
have u49 : (49#u8 : Std.U8).val = 49 := by decide
have u101 : (101#u8 : Std.U8).val = 101 := by decide
have u54 : (54#u8 : Std.U8).val = 54 := by decide
have u53 : (53#u8 : Std.U8).val = 53 := by decide
have u51 : (51#u8 : Std.U8).val = 51 := by decide
have ui48 : UInt8.toNat (48 : UInt8) = 48 := by decide
rw [u48, u46, u49, u101, u54, u53, u51, ui48]
rfl
have zeros_fold :
zeros.foldl (fun a d => 10 * a + d) 0 = 0 := by
have fold_zeros (k : Nat) :
(List.replicate k 0).foldl (fun a d => 10 * a + d) 0 = 0 := by
induction k with
| zero => rfl
| succ k ih => simpa [List.replicate_succ] using ih
exact fold_zeros 65535
have fraction_length : fraction.length = 65536 := by
simp only [fraction, zeros, List.length_append, List.length_replicate,
List.length_cons, List.length_nil]
have significand_fold :
([0] ++ fraction).foldl (fun a d => 10 * a + d) 0 = 1 := by
rw [List.foldl_append]
simp only [List.foldl_cons, List.foldl_nil, mul_zero, zero_add]
simp only [fraction]
rw [List.foldl_append, zeros_fold]
rfl
have lexeme_valid : DecimalGoalVocabularyDefault.validNumeric lexeme := by
have zeros_mem {d : Nat} (h : d ∈ zeros) : d = 0 := by
simp only [zeros, List.mem_replicate] at h
exact h.2
dsimp only [DecimalGoalVocabularyDefault]
constructor
· simp [lexeme]
constructor
· simp only [lexeme]
intro d hd
simp only [fraction] at hd
rcases List.mem_append.mp hd with hd | hd
· rw [zeros_mem hd]
norm_num
· simp only [List.mem_singleton] at hd
omega
constructor
· left
simp [lexeme]
· simp [lexeme]
have lexeme_render :
DecimalGoalVocabularyDefault.bytes witness =
DecimalGoalVocabularyDefault.renderNumeric lexeme := by
dsimp only [DecimalGoalVocabularyDefault]
simp only [lexeme, witness, witnessBytes, fraction, zeros, List.map_append,
List.map_cons, List.map_nil, List.map_replicate, Bool.false_eq_true,
reduceIte, Nat.reduceAdd, List.nil_append, List.cons_append]
norm_num
have lexeme_exact :
DecimalGoalVocabularyDefault.exactMagnitude lexeme =
(10 : Real) ^ (589824 : Nat) := by
dsimp only [DecimalGoalVocabularyDefault, lexeme]
rw [significand_fold, fraction_length]
norm_num
rfl
let infinityBits : Nat := 2047 * 2 ^ 52
have huge_target_is_infinity (w : F64)
(hw : DecimalGoalVocabularyDefault.roundsMagnitude
((10 : Real) ^ (589824 : Nat)) w) :
w.val = infinityBits := by
dsimp only [DecimalGoalVocabularyDefault] at hw
rcases hw with ⟨_, _, hw⟩
by_contra hne
have hne' : w.val ≠ 2047 * 2 ^ 52 := by
simpa [infinityBits] using hne
rw [if_neg hne'] at hw
have hthreshold :
((2 : Real) ^ (1024 : Nat)) - ((2 : Real) ^ (970 : Nat)) ≤
(10 : Real) ^ (589824 : Nat) := by
calc
(2 : Real) ^ 1024 - 2 ^ 970 ≤ 2 ^ 1024 :=
sub_le_self _ (by positivity)
_ ≤ 10 ^ 1024 := by gcongr <;> norm_num
_ ≤ 10 ^ 589824 := by
rw [show (589824 : Nat) = 1024 + 588800 by norm_num, pow_add]
exact le_mul_of_one_le_right (by positivity) (one_le_pow₀ (by norm_num))
exact (not_lt_of_ge hthreshold) hw.1
have hRun :
num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
F64.Insts.CoreOpsArithNegF64 witness =
ok (core.result.Result.Ok one) := by
exact ParserExactRoundingExecution witness (by rfl)
intro hPositive
rcases hPositive witness lexeme one witness_source lexeme_valid lexeme_render hRun with
⟨magnitude, hround, hsigned⟩
rw [lexeme_exact] at hround
have hinf := huge_target_is_infinity magnitude hround
dsimp only [DecimalGoalVocabularyDefault, lexeme, one] at hsigned
rw [hinf] at hsigned
have bad := hsigned.2
change (4607182418800017408 : Nat) = infinityBits + 0 at bad
have harithmetic : False := by
norm_num [infinityBits] at bad
obtain ⟨s, x, f, _, _, _, hsource, hvalid, hrender, hrun, hfalse⟩ :=
ParserExactRoundingWitness
exact hfalse (hPositive s x f hsource hvalid hrender hrun)
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
- Binary64ModelDefault
- DecimalGoalVocabularyDefault
- F64 Insts CoreOpsArithDivF64F64
- F64 Insts CoreOpsArithMulF64F64
- F64 Insts CoreOpsArithNegF64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64
All 50 entries
- Binary64ModelDefault
- DecimalGoalVocabularyDefault
- 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 modelNumImpTraitsFloatU64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS
- ModelF64FromBits
- ModelF64FromU64
- ModelF64MantissaDigits
- ModelF64Mul
- ModelOptionBranch
- ModelSliceFirst
- ModelSliceSplitFirst
- ModelStrAsBytes
- ModelU64BitAnd
- ModelU64BitOr
- ModelU64Shl
- ModelU8IsAsciiDigit
- ParserExactRoundingExecution
- ParserExactRoundingWitness
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice offset from
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice read u64
- U64 Insts CoreOpsBitBitAndU64U64
- U64 Insts CoreOpsBitBitOrU64U64
- U64 Insts CoreOpsBitShlU32U64
- num imp dec2flt Lemire MAX MANTISSA FAST PATH default
- num imp dec2flt Lemire MIN EXPONENT FAST PATH default
- 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 fpu fpu precision set precision
- 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 number
- num imp dec2flt parse parse partial number
- num imp dec2flt parse parse scientific
- num imp dec2flt parse try parse digits
Used by
No other declaration in this version lists this one as a dependency.
Inspect related source (201)
- Dec2flt_modelNumImpDec2fltLemireU64 · dec2flt/mod.rs:217 Program Rust
- MAX_EXPONENT_DISGUISED_FAST_PATH · dec2flt/mod.rs:220 Program Rust
- MAX_EXPONENT_FAST_PATH · dec2flt/mod.rs:219 Program Rust
More program dependencies (159)
- from_u64 · dec2flt/mod.rs:263 Program Rust
- pow10_fast_path · dec2flt/mod.rs:222 Program Rust
- Dec2flt_modelNumImpTraitsFloatExtU64 · traits.rs:339 Program Rust
- Dec2flt_modelNumImpTraitsFloatU64 · traits.rs:309 Program Rust
- SIG_TOTAL_BITS · traits.rs:320 Program Rust
- offset_from · dec2flt/common.rs:30 Program Rust
- read_u64 · dec2flt/common.rs:18 Program Rust
- default · dec2flt/mod.rs:128 Program Rust
- default · dec2flt/mod.rs:121 Program Rust
- is_8digits · dec2flt/common.rs:40 Program Rust
- dec2flt · dec2flt/mod.rs:508 Program Rust
- dec2flt_with_trace · dec2flt/mod.rs:355 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- can_use_fast_path · dec2flt/decimal.rs:42 Program Rust
- try_fast_path · dec2flt/decimal.rs:59 Program Rust
- INT_POW10 · dec2flt/decimal.rs:8 Program Rust
- set_precision · dec2flt/fpu.rs:99 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_8digits · dec2flt/parse.rs:18 Program Rust
- MASK · dec2flt/parse.rs:19 Program Rust
- MUL1 · dec2flt/parse.rs:20 Program Rust
- MUL2 · dec2flt/parse.rs:21 Program Rust
- parse_number · dec2flt/parse.rs:231 Program Rust
- parse_partial_number · dec2flt/parse.rs:161 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
- from_u64_bits · traits.rs:341 Program Rust
- integer_decode · traits.rs:348 Program Rust
- BITS · traits.rs:319 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
- Dec2flt_modelNumImpTraitsInt · traits.rs:51 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- biased_fp_to_float · dec2flt/mod.rs:282 Program Rust
- eq · dec2flt/common.rs:51 Program Rust
- compute_float · dec2flt/lemire.rs:26 Program Rust
- parse_inf_nan · dec2flt/parse.rs:241 Program Rust
- parse_many_digits · dec2flt/parse.rs:104 Program Rust
- pfe_empty · dec2flt/mod.rs:270 Program Rust
- pfe_invalid · dec2flt/mod.rs:277 Program Rust
- parse_long_mantissa · dec2flt/slow.rs:27 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
- Float · traits.rs:74 Program Rust
- default · traits.rs:116 Program Rust
- default · traits.rs:104 Program Rust
- default · traits.rs:119 Program Rust
- default · traits.rs:110 Program Rust
- default · traits.rs:113 Program Rust
- default · traits.rs:101 Program Rust
- FloatExt · traits.rs:170 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
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- zero_pow2 · dec2flt/common.rs:62 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:67 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_product_approx · dec2flt/lemire.rs:134 Program Rust
- power · dec2flt/lemire.rs:121 Program Rust
- 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
- body · dec2flt/parse.rs:64 Program Rust
- MAX_SHIFT · dec2flt/slow.rs:28 Program Rust
- call · dec2flt/slow.rs:33 Program Rust
- CastInto · traits.rs:18 Program Rust
- Int · traits.rs:27 Program Rust
- write_u64 · dec2flt/common.rs:25 Program Rust
- cast · traits.rs:46 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
- full_multiplication · dec2flt/lemire.rs:126 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
- 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
Standard-library dependencies (39)
- mul · core/src/ops/arith.rs:350 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
- from_bits · core/src/num/f64.rs:1269 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- branch · core/src/option.rs:2779 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- split_first · core/src/slice/mod.rs:198 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- clone · core/src/clone.rs:698 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- neg · core/src/ops/arith.rs:719 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_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
- from_residual · core/src/option.rs:2793 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
- 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
- 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
- BitOr · core/src/ops/bit.rs:254 Rust library
- Shl · core/src/ops/bit.rs:461 Rust library
- CoreCloneClone · core/src/clone.rs:696 Rust library
- CoreOpsBitShrU32U64 · core/src/ops/bit.rs:606 Rust library
- FpCategory · core/src/num/mod.rs:1522 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 160 entries
- Binary64Model
- Binary64ModelDefault
- 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
- NumberHelperEightDigitWordAccepted
- NumberHelperReadEightBytes
- ParserExactRoundingAdjustment
- ParserExactRoundingDigitScans
- ParserExactRoundingExecution
- ParserExactRoundingFastPath
- ParserExactRoundingOffsets
- ParserExactRoundingScientific
- ParserExactRoundingWitness
- ParserExactRounding Refutation
- Preamble
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice offset from
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice read u64
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice write u64
- 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 Lemire MIN EXPONENT 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": "ParserExactRounding__Refutation",
"closure_version": "patch_c_v1",
"active_decl_hash": "7869e8f5ac5a5c5eda3da3b1e132bf2684e558c1943e17173240a1654b2456fa",
"active_statement_hash": "f234394290365492edaad587a58284c0cbfd9f7a211ef71aa80cc00d7861d1da",
"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-128",
"boundary_theorems": {},
"strict_theorem_deps": {
"DecimalGoalVocabularyDefault": "94cb4c406f8efb78",
"ParserExactRoundingExecution": "29e27a892a7fec3d",
"ParserExactRoundingWitness": "420dfed64f59a207"
},
"strict_definition_deps": {
"DecimalGoalVocabulary": "c08dd4b4aea4abb4",
"DecimalGoalVocabularyDefault": "3016c00221d29252",
"DecimalLexeme": "bf0c609978369054",
"F64": "ec4e25fbaf4e11d4",
"F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
"F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
"F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
"F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
"num_float_parse_ParseFloatError": "c43614ff2149ecf2",
"num_imp_dec2flt_dec2flt": "f9f7d93449a25efa"
}
}Prose assessment
{
"label": "Recorded Sound: VerifierPass",
"assessment_status": "VerifierPass",
"fingerprint_relation": "matches current fingerprint",
"assessment_fingerprint": "sound-v2:f10eeaa2fe2c3ad00d9b7dd823ac69afb8327e8acbe49d592511b834ac4ba9d0",
"current_fingerprint": "sound-v2:f10eeaa2fe2c3ad00d9b7dd823ac69afb8327e8acbe49d592511b834ac4ba9d0",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}