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 (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_NativeCorrectOrDefer :
    forall (d : num.imp.dec2flt.decimal.Decimal) (r : Option F64),
      P9_T1_ActualDispatchOperations.native d = ok r ->
      r = none ∨ exists f magnitude : F64,
        r = 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 P13_T1_NativeCorrectOrDefer__Refutation : Not
  (∀ (d : dec2flt_model.num.imp.dec2flt.decimal.Decimal) (r : Option.{0} dec2flt_model.F64),
    @Eq.{1} (Aeneas.Std.Result.{0} (Option.{0} dec2flt_model.F64))
        (dec2flt_model.P9_T1_DispatchOperations.native dec2flt_model.P9_T1_ActualDispatchOperations d)
        (@Aeneas.Std.Result.ok.{0} (Option.{0} dec2flt_model.F64) r) →
      Or (@Eq.{1} (Option.{0} dec2flt_model.F64) r (@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) r (@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:P13_T1_NativeCorrectOrDefer
Closure nodes
  • P13_T1_NativeCorrectOrDefer

Models and assumptions

Program assumptions and trust

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

All 33 entries