Native correctness or defer

Native correctness or defer

Proved
try_fast_path
Native correctness or defer. For every Decimal record, on normal return, the result is either None or Some of the binary64 rounding of the exact mantissa * 10^exponent, with the record's sign. A Some result also implies many_digits = false. The contract applies to both the ordinary native path and the disguised path that transfers powers of ten into the mantissa.

View proof and assumptions

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 NativeCorrectOrDefer :
    ∀ (d : num.imp.dec2flt.decimal.Decimal) out,
      num.imp.dec2flt.decimal.Decimal.try_fast_path
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 d = ok out ->
      out = none ∨ ∃ (f magnitude : F64), out = some f ∧ d.many_digits = false ∧
        DecimalGoalVocabularyDefault.roundsMagnitude (DecimalGoalVocabularyDefault.decimalMagnitude d) magnitude ∧
        DecimalGoalVocabularyDefault.signedMagnitude d.negative magnitude f := by

The requirement is proved.

Alternate registered target · outside this verdict
theorem NativeCorrectOrDefer__Refutation : Not
  (∀ (d : dec2flt_model.num.imp.dec2flt.decimal.Decimal) (out : Option.{0} dec2flt_model.F64),
    @Eq.{1} (Aeneas.Std.Result.{0} (Option.{0} dec2flt_model.F64))
        (@dec2flt_model.num.imp.dec2flt.decimal.Decimal.try_fast_path dec2flt_model.F64 Aeneas.Std.U64
          dec2flt_model.F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 dec2flt_model.F64.Insts.CoreOpsArithDivF64F64
          dec2flt_model.F64.Insts.CoreOpsArithMulF64F64 dec2flt_model.F64.Insts.CoreOpsArithNegF64 d)
        (@Aeneas.Std.Result.ok.{0} (Option.{0} dec2flt_model.F64) out) →
      Or (@Eq.{1} (Option.{0} dec2flt_model.F64) out (@Option.none.{0} dec2flt_model.F64))
        (@Exists.{1} dec2flt_model.F64 fun (f : dec2flt_model.F64) =>
          @Exists.{1} dec2flt_model.F64 fun (magnitude : dec2flt_model.F64) =>
            And (@Eq.{1} (Option.{0} dec2flt_model.F64) out (@Option.some.{0} dec2flt_model.F64 f))
              (And (@Eq.{1} Bool (dec2flt_model.num.imp.dec2flt.decimal.Decimal.many_digits d) Bool.false)
                (And
                  (dec2flt_model.DecimalGoalVocabulary.roundsMagnitude dec2flt_model.DecimalGoalVocabularyDefault
                    (dec2flt_model.DecimalGoalVocabulary.decimalMagnitude dec2flt_model.DecimalGoalVocabularyDefault d)
                    magnitude)
                  (dec2flt_model.DecimalGoalVocabulary.signedMagnitude dec2flt_model.DecimalGoalVocabularyDefault
                    (dec2flt_model.num.imp.dec2flt.decimal.Decimal.negative d) magnitude f))))) := by
Statement registration
Live polarityprove
Authorityregistered Decide default: prove
Registered targetauthored:NativeCorrectOrDefer
Closure nodes
  • NativeCorrectOrDefer

Models and assumptions

Program assumptions and trust

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

All 31 entries