Conditional accumulated-value diagnostic

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

Conditional accumulated-value diagnostic

Proved
parse_number
Conditional 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.

View proof and assumptions

Revision introducing this program version · 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

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 (198)
More program dependencies (156)
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 P13_T1_NumberHelperAccumulatedValue :
    forall (s : Slice Std.U8) (x : DecimalLexeme) (d : num.imp.dec2flt.decimal.Decimal),
      SourceValidByteSlice s -> s.val.length <= 3458764513820540928 ->
      x.leadingSign = none -> DecimalGoalVocabularyDefault.validNumeric x ->
      DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s ->
      P9_T1_ActualDispatchOperations.parseNumber s = ok (some d) ->
      if d.many_digits then
        DecimalGoalVocabularyDefault.decimalMagnitude d <=
          DecimalGoalVocabularyDefault.accumulatedMagnitude x ∧
        DecimalGoalVocabularyDefault.accumulatedMagnitude x <
          (((d.mantissa.val + 1 : Nat) : Real) * (10 : Real) ^ d.exponent.val)
      else DecimalGoalVocabularyDefault.decimalMagnitude d =
        DecimalGoalVocabularyDefault.accumulatedMagnitude x := by

The requirement is proved.

Alternate registered target · outside this verdict
theorem P13_T1_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 →
      @LE.le.{0} Nat instLENat
          (@List.length.{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))
          (@OfNat.ofNat.{0} Nat (nat_lit 3458764513820540928) (instOfNatNat (nat_lit 3458764513820540928))) →
        @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.renderNumeric dec2flt_model.DecimalGoalVocabularyDefault x)
                (dec2flt_model.DecimalGoalVocabulary.bytes dec2flt_model.DecimalGoalVocabularyDefault s) →
              @Eq.{1} (Aeneas.Std.Result.{0} (Option.{0} dec2flt_model.num.imp.dec2flt.decimal.Decimal))
                  (dec2flt_model.P9_T1_DispatchOperations.parseNumber dec2flt_model.P9_T1_ActualDispatchOperations 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)) →
                @ite.{1} Prop (@Eq.{1} Bool (dec2flt_model.num.imp.dec2flt.decimal.Decimal.many_digits d) Bool.true)
                  (instDecidableEqBool (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))))))
                  (@Eq.{1} Real
                    (dec2flt_model.DecimalGoalVocabulary.decimalMagnitude dec2flt_model.DecimalGoalVocabularyDefault d)
                    (dec2flt_model.DecimalGoalVocabulary.accumulatedMagnitude dec2flt_model.DecimalGoalVocabularyDefault
                      x))) := by
Statement registration
Live polarityprove
Authorityregistered Decide default: prove
Registered targetauthored:P13_T1_NumberHelperAccumulatedValue
Closure nodes
  • P13_T1_NumberHelperAccumulatedValue
Recorded replacement requirements

number_helper_accumulated_value

parse_number
Conditional 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.
Compare requirement statements

Original program

parse_number
Accumulated-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.

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 34 entries