Numeric acceptance

The statement differs between program versions. Each verdict below belongs to the statement shown on its page.

Numeric acceptance

Disproved
dec2flt
Numeric acceptance. Every numeric literal returns Ok.

View counterexample proof

Later revision · decision
ParserNumericAcceptance__Refutation uses a 2147483650-byte input whose numeric record succeeds and whose unequal integer endpoint pairs force a DecimalSeq i32 overflow. This witness is inside A and requires the source count repair. The A condition separately excludes the unrepaired exabyte lexical arithmetic, not the gigabyte fallback defect.
Definitions quoted from revised requirements

Conditional abstract composition

dec2flt
Conditional abstract composition. Let A = 3458764513820540928 bytes and B = 576460752303421440 bytes. The lexical and conversion component contracts admit implementations, with numeric lexical acceptance, rejection and record representation required for nonempty source-valid byte slices of length at most A, and preservation of the ordinary mathematical exact rounding target required for numeric inputs of length at most B. Special parsing, native correctness-or-defer, integer correctness-or-defer, unrestricted assembly, and the full-significand accumulated-exponent slow diagnostic retain their existing domains; the slow diagnostic applies to every source-valid unsigned numeric literal, without an A or B restriction. For any components satisfying these contracts, the dispatcher's normal results on Rust strings of byte length at most A satisfy classification, accumulated-exponent rounding and lexical sign requirements. On numeric strings of byte length at most B they additionally satisfy ordinary mathematical exact rounding. These conclusions include the native shortcut, integer tier, many-digit endpoint decision, fallback, sign handling and final assembly. Contract inhabitability and the existence of an abstract normal output for every Rust string of byte length at most A must be established, not inferred from an implication over an empty contract package.

Conditional component compliance

dec2flt
Conditional component compliance. Let A = 3458764513820540928 bytes and B = 576460752303421440 bytes. The actual source components satisfy the contracts used in conditional abstract composition. In particular, the numeric lexical component returns normally and satisfies acceptance, rejection and record representation on every nonempty source-valid byte slice of length at most A; it preserves the input's ordinary mathematical exact rounding target on numeric slices of length at most B. The source components for special parsing, native conversion, integer conversion and unrestricted assembly retain their existing full-domain obligations. The actual slow component satisfies the full-significand accumulated-exponent diagnostic on every source-valid unsigned numeric literal, without a length restriction. For every Rust string of byte length at most A, the concrete dispatcher agrees with the abstract component operations at its calls and establishes their helper preconditions. On numeric strings of byte length at most B, this agreement additionally preserves the exact rounding target throughout dispatch. These obligations include native shortcut, integer tier, many-digit decision, fallback, sign handling and assembly, and require a genuinely inhabited compatible component package.
Supporting proofs
Inspect related source (201)
More program dependencies (159)
Standard-library dependencies (39)

Related source and models come from the extraction records and declared dependencies.

Lean statement and supporting proof

Proposition checked for this verdict

theorem ParserNumericAcceptance__Refutation : ¬ (∀ (s : Str) (x : DecimalLexeme), DecimalGoalVocabularyDefault.sourceString s -> DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x -> ∃ f : F64,
      num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f)) := by

The negation is proved, disproving the requirement.

Alternate registered target · outside this verdict
theorem ParserNumericAcceptance :
    ∀ (s : Str) (x : DecimalLexeme), DecimalGoalVocabularyDefault.sourceString s -> DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x -> ∃ f : F64,
      num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) := by
Statement registration
Live polaritydisprove
Authorityrecorded audit polarity
Registered targetauthored:ParserNumericAcceptance__refutation
Closure nodes
  • ParserNumericAcceptance__Refutation
Counterexample argument as recorded · ParserNumericAcceptance__Refutation

Theorem

The following result is false: For every source-valid Rust string whose complete byte sequence is a valid numeric literal, the extracted f64 parser returns normally with Ok of a float.

Proof

Let K=2147483618. Instantiate ParserNumericSlowPathOverflowWitness, call its body slice b, and regard that same slice carrier as an Aeneas Str; put s=b. The witness statement gives
s.\mathit{val}=[48,46]\mathbin{++}\operatorname{replicate}(11,48) \mathbin{++}\operatorname{bytes}(\texttt{1000000000000000080}) \mathbin{++}\operatorname{replicate}(K,48). \tag{1}
Let x have no leading sign, integer digits [0], fractional digits consisting of eleven zeroes, then [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0], then K zeroes, and no explicit exponent. This is the concrete unsigned witness.
We verify the three hypotheses of the claimed universal property. Every entry of both digit lists is below ten, the integer list is nonempty, and there is no exponent condition. Unfolding DecimalGoalVocabularyDefault therefore gives validNumeric x. Its rendering prepends no sign, maps the integer zero to byte 48, emits byte 46 for the point, maps the displayed fractional digits to the bytes in (1), and emits no exponent; hence bytes s = renderNumeric x.
The length calculation from ParserNumericSlowPathOverflowWitness is |s|=2147483650=2^{31}+2<2^{63}-1. For the UTF-8 clause, take the Lean string obtained with String.ofList from the character list 0., eleven 0 characters, the nineteen characters of 1000000000000000080, and K further 0 characters. Encoding each of 0, ., 1, and 8 produces its one-byte ASCII code. Induction on List.replicate, together with encoding over each of the four list appends, makes its UTF-8 byte list exactly (1). Mapping the Aeneas u8 wrappers to their natural values gives that same list. The length inequality and this explicit string witness prove sourceString s under DecimalGoalVocabularyDefault.
Now follow the extracted public parser. By ModelStrAsBytes, its first bind returns the complete slice (1). The list is nonempty and begins with byte 48, so ModelSliceFirst returns that byte. It is neither 43 nor 45; consequently num imp dec2flt dec2flt with trace takes no sign slice and its body1 is the complete nonempty body from ParserNumericSlowPathOverflowWitness. More explicitly, body1 and the already chosen s=b have the same underlying byte list; extensionality of the Aeneas slice subtype (the carrier proofs are propositions) gives \texttt{body1}=s=b. Thus that lemma gives parse_number = ok (some d) with mantissa 1000000000000000080, exponent -30, negative false, and many-digits true, and gives try_fast_path d = ok none. The dispatcher overwrites the record's sign with the test 48=45, which is false, so its fast-path input remains exactly d and the cited fast-path equation applies.
The dispatcher therefore calls num imp dec2flt lemire compute float on that exponent and mantissa. The witness lemma supplies (448160529771025,983). Since the record has many digits and 983\ge0, the second-computation guard is true. The checked mantissa increment is 1000000000000000081<2^{64}, and the lemma supplies the second result (448160529771026,983). It also supplies that the extracted pair comparison returns false. Thus lines 109--114 of the pinned dispatcher replace the first pair's biased power by -1 and set forced_deferral true. Because -1<0, the slow-path guard is true and the next monadic operation is exactly parse_long_mantissa(body1).
By ParserNumericSlowPathOverflowWitness, that operation is fail integerOverflow: its decimal parser has an empty remainder and a fractional first slice of length 2^{31}, whose truncating cast is i32::MIN; the immediately following checked subtraction 0-\texttt{i32::MIN} overflows. Result binding propagates this failure out of num imp dec2flt dec2flt with trace before word assembly or sign application is evaluated; in particular no purported trace pair is produced. The wrapper num imp dec2flt dec2flt binds the traced call before projecting its first component, so the public parser also equals fail integerOverflow. (2)
Suppose the universal statement in the theorem were true. Apply it to the just-proved source-valid s and valid exactly rendered x. It would give a float f for which the same public call is ok (Result.Ok f). This contradicts (2), since the Result.fail and Result.ok constructors are disjoint. Therefore the universal statement is false.
ParserNumericAcceptance Refutation
Recorded replacement requirements

parser_numeric_acceptance

dec2flt
Conditional numeric acceptance. Every numeric literal whose complete Rust string has byte length at most 3 EiB returns normally with Ok, without panicking, including executions with integer overflow checks enabled. Optional leading signs and arbitrarily long explicit exponent digit strings are allowed whenever the complete string satisfies the stated byte-length bound.
Compare requirement statements

Revised program

dec2flt
Conditional numeric acceptance. Every numeric literal whose complete Rust string has byte length at most 3 EiB returns normally with Ok, without panicking, including executions with integer overflow checks enabled. Optional leading signs and arbitrarily long explicit exponent digit strings are allowed whenever the complete string satisfies the stated byte-length bound.

Read this version’s verdict and proof

Models and assumptions

Program assumptions and trust

These modeling choices occur in the declared dependencies of this requirement’s proofs.

All 32 entries