Accumulated-value diagnostic
Provedparse_numberAccumulated-value diagnostic. For every unsigned numeric literal, a
returned record with
many_digits = false represents its accumulated-exponent
value exactly as mantissa * 10^exponent. With many_digits = true, that value
lies in the half-open interval from mantissa * 10^exponent to
(mantissa + 1) * 10^exponent.Later revision · decision
Affected retained goal: outside A a normal unchecked retry exponent can wrap even though the mantissa bound survives. The diagnostic equality/interval law therefore needs the same explicit normal-arithmetic domain. Its coefficient interval, treatment of all digits, and source-defined accumulated exponent are not weakened within that domain.
Definitions quoted from revised requirements
Conditional abstract composition
dec2fltConditional 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
dec2fltConditional 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 (71)
- offset_from · dec2flt/common.rs:30 Program Rust
- read_u64 · dec2flt/common.rs:18 Program Rust
- is_8digits · dec2flt/common.rs:40 Program Rust
More program dependencies (36)
- Decimal · dec2flt/decimal.rs:32 Program Rust
- MIN_19DIGIT_INT · dec2flt/parse.rs:8 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_many_digits · dec2flt/parse.rs:104 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_19digits · dec2flt/parse.rs:61 Program Rust
- try_parse_19digits_loop · dec2flt/parse.rs:64 Program Rust
- body · dec2flt/parse.rs:64 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 · dec2flt/mod.rs:263 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- CastInto · traits.rs:18 Program Rust
- Float · traits.rs:74 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
Standard-library dependencies (32)
- bitand · core/src/ops/bit.rs:178 Rust library
- bitor · core/src/ops/bit.rs:282 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- from_residual · core/src/option.rs:2793 Rust library
- branch · core/src/option.rs:2779 Rust library
- split_first · core/src/slice/mod.rs:198 Rust library
- clone · core/src/clone.rs:698 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- mul · core/src/ops/arith.rs:350 Rust library
- neg · core/src/ops/arith.rs:719 Rust library
- shl · core/src/ops/bit.rs:489 Rust library
- shr · core/src/ops/bit.rs:612 Rust library
- EXPONENT_MASK · core/src/num/f64.rs:615 Rust library
- INFINITY · core/src/num/f64.rs:512 Rust library
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- MANTISSA_MASK · core/src/num/f64.rs:637 Rust library
- NAN · core/src/num/f64.rs:509 Rust library
- NEG_INFINITY · core/src/num/f64.rs:515 Rust library
- classify · core/src/num/f64.rs:782 Rust library
- from_bits · core/src/num/f64.rs:1269 Rust library
- to_bits · core/src/num/f64.rs:1223 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- CoreOpsBitBitAndU64U64 · core/src/ops/bit.rs:174 Rust library
- CoreOpsBitBitOrU64U64 · core/src/ops/bit.rs:278 Rust library
- BitOr · core/src/ops/bit.rs:254 Rust library
- FpCategory · core/src/num/mod.rs:1522 Rust library
- Div · core/src/ops/arith.rs:460 Rust library
- Mul · core/src/ops/arith.rs:322 Rust library
- Neg · core/src/ops/arith.rs:690 Rust library
- 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.
Lean statement and supporting proof
Proposition checked for this verdict
theorem NumberHelperAccumulatedValue :
∀ (s : Slice Std.U8) (x : DecimalLexeme) d, SourceValidByteSlice s -> s.val ≠ [] -> x.leadingSign = none ->
DecimalGoalVocabularyDefault.validNumeric x -> DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x ->
num.imp.dec2flt.parse.parse_number s = ok (some d) ->
(d.many_digits = false ∧ DecimalGoalVocabularyDefault.decimalMagnitude d = DecimalGoalVocabularyDefault.accumulatedMagnitude x) ∨
(d.many_digits = true ∧ DecimalGoalVocabularyDefault.decimalMagnitude d <= DecimalGoalVocabularyDefault.accumulatedMagnitude x ∧
DecimalGoalVocabularyDefault.accumulatedMagnitude x <
((d.mantissa.val + 1 : Nat) : Real) * (10 : Real) ^ d.exponent.val) := byThe requirement is proved.
Alternate registered target · outside this verdict
theorem NumberHelperAccumulatedValue__Refutation : Not
(∀ (s : Aeneas.Std.Slice.{0} Aeneas.Std.U8) (x : dec2flt_model.DecimalLexeme)
(d : dec2flt_model.num.imp.dec2flt.decimal.Decimal),
dec2flt_model.SourceValidByteSlice s →
@Ne.{1} (List.{0} Aeneas.Std.U8)
(@Subtype.val.{1} (List.{0} Aeneas.Std.U8)
(fun (l : List.{0} Aeneas.Std.U8) =>
@LE.le.{0} Nat instLENat (@List.length.{0} Aeneas.Std.U8 l) Aeneas.Std.Usize.max)
s)
(@List.nil.{0} Aeneas.Std.U8) →
@Eq.{1} (Option.{0} Bool) (dec2flt_model.DecimalLexeme.leadingSign x) (@Option.none.{0} Bool) →
dec2flt_model.DecimalGoalVocabulary.validNumeric dec2flt_model.DecimalGoalVocabularyDefault x →
@Eq.{1} (List.{0} Nat)
(dec2flt_model.DecimalGoalVocabulary.bytes dec2flt_model.DecimalGoalVocabularyDefault s)
(dec2flt_model.DecimalGoalVocabulary.renderNumeric dec2flt_model.DecimalGoalVocabularyDefault x) →
@Eq.{1} (Aeneas.Std.Result.{0} (Option.{0} dec2flt_model.num.imp.dec2flt.decimal.Decimal))
(dec2flt_model.num.imp.dec2flt.parse.parse_number s)
(@Aeneas.Std.Result.ok.{0} (Option.{0} dec2flt_model.num.imp.dec2flt.decimal.Decimal)
(@Option.some.{0} dec2flt_model.num.imp.dec2flt.decimal.Decimal d)) →
Or
(And (@Eq.{1} Bool (dec2flt_model.num.imp.dec2flt.decimal.Decimal.many_digits d) Bool.false)
(@Eq.{1} Real
(dec2flt_model.DecimalGoalVocabulary.decimalMagnitude dec2flt_model.DecimalGoalVocabularyDefault
d)
(dec2flt_model.DecimalGoalVocabulary.accumulatedMagnitude
dec2flt_model.DecimalGoalVocabularyDefault x)))
(And (@Eq.{1} Bool (dec2flt_model.num.imp.dec2flt.decimal.Decimal.many_digits d) Bool.true)
(And
(@LE.le.{0} Real Real.instLE
(dec2flt_model.DecimalGoalVocabulary.decimalMagnitude dec2flt_model.DecimalGoalVocabularyDefault
d)
(dec2flt_model.DecimalGoalVocabulary.accumulatedMagnitude
dec2flt_model.DecimalGoalVocabularyDefault x))
(@LT.lt.{0} Real Real.instLT
(dec2flt_model.DecimalGoalVocabulary.accumulatedMagnitude
dec2flt_model.DecimalGoalVocabularyDefault x)
(@HMul.hMul.{0, 0, 0} Real Real Real (@instHMul.{0} Real Real.instMul)
(@Nat.cast.{0} Real Real.instNatCast
(@HAdd.hAdd.{0, 0, 0} Nat Nat Nat (@instHAdd.{0} Nat instAddNat)
(@Aeneas.Std.UScalar.val Aeneas.Std.UScalarTy.U64
(dec2flt_model.num.imp.dec2flt.decimal.Decimal.mantissa d))
(@OfNat.ofNat.{0} Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))))
(@HPow.hPow.{0, 0, 0} Real Int Real
(@instHPow.{0, 0} Real Int (@DivInvMonoid.toZPow.{0} Real Real.instDivInvMonoid))
(@OfNat.ofNat.{0} Real (nat_lit 10)
(@instOfNatAtLeastTwo.{0} Real (nat_lit 10) Real.instNatCast
(@Nat.instAtLeastTwoHAddOfNat
(@OfNat.ofNat.{0} Nat (nat_lit 9) (instOfNatNat (nat_lit 9)))
(@Nat.instNeZeroSucc (@OfNat.ofNat.{0} Nat (nat_lit 8) (instOfNatNat (nat_lit 8)))))))
(@Aeneas.Std.IScalar.val Aeneas.Std.IScalarTy.I64
(dec2flt_model.num.imp.dec2flt.decimal.Decimal.exponent d)))))))) := byStatement registration
| Live polarity | prove |
|---|---|
| Authority | registered Decide default: prove |
| Registered target | authored:NumberHelperAccumulatedValue |
| Closure nodes |
|
Recorded replacement requirements
number_helper_accumulated_value
parse_numberConditional accumulated-value diagnostic. For every source-valid unsigned numeric byte slice of length at most 3 EiB, any returned record with
many_digits = false represents its accumulated-exponent value exactly as mantissa * 10^exponent. With many_digits = true, that value lies in the half-open interval from mantissa * 10^exponent to (mantissa + 1) * 10^exponent. The accumulated-exponent value retains every significand digit and uses the actual source's bounded explicit-exponent accumulation rule.