P367_T1_NumberHelperExponentAddA

Lean checked

Statement

This explanation was written alongside the formalization to describe the statement and its reasoning.

Lemma · Checked exponent addition through A

Let b,e:\texttt{I64} satisfy -A\le b.\mathit{val}\le A and -C\le e.\mathit{val}\le C, where A=3458764513820540928 and C=5764607523034234879=10\cdot2^{59}-1. The extracted checked signed addition b+e returns normally with an \texttt{I64} whose value is b.\mathit{val}+e.\mathit{val}.

Lean statement

Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.

import Tablet.Assumptions

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P367_T1_NumberHelperExponentAddA]
theorem P367_T1_NumberHelperExponentAddA (base explicit : Std.I64)
    (hbaseLo : -3458764513820540928 <= base.val)
    (hbaseHi : base.val <= 3458764513820540928)
    (hexpLo : -5764607523034234879 <= explicit.val)
    (hexpHi : explicit.val <= 5764607523034234879) :
    exists result : Std.I64,
      base + explicit = ok result /\ result.val = base.val + explicit.val := by
Proof

Natural-language proof

The status above describes the Lean proof. Its explanatory prose may remain a sketch after that proof closes.

Explanatory prose status

Prose retained as authored. The explanatory prose is preserved as it stood when captured.

Proof

The signed 64-bit range is [-9223372036854775808,9223372036854775807]. Direct integer addition gives A+C=9223372036854775807. The four assumed inequalities therefore put the sum in [-9223372036854775807,9223372036854775807], inside that range. The checked signed-addition specification from the scalar library returns an actual normal result and identifies its value with the integer sum. Neither a length of an exponent digit list nor a bound on its mathematical value is used.

Lean proof


  exact Aeneas.Std.WP.spec_imp_exists
    (IScalar.add_spec (x := base) (y := explicit)
      (by simp only [IScalar.min_IScalarTy_I64_eq, I64.min_eq]; omega)
      (by simp only [IScalar.max_IScalarTy_I64_eq, I64.max_eq]; omega))

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.Assumptions

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P367_T1_NumberHelperExponentAddA]
theorem P367_T1_NumberHelperExponentAddA (base explicit : Std.I64)
    (hbaseLo : -3458764513820540928 <= base.val)
    (hbaseHi : base.val <= 3458764513820540928)
    (hexpLo : -5764607523034234879 <= explicit.val)
    (hexpHi : explicit.val <= 5764607523034234879) :
    exists result : Std.I64,
      base + explicit = ok result /\ result.val = base.val + explicit.val := by
-- BODY
  exact Aeneas.Std.WP.spec_imp_exists
    (IScalar.add_spec (x := base) (y := explicit)
      (by simp only [IScalar.min_IScalarTy_I64_eq, I64.min_eq]; omega)
      (by simp only [IScalar.max_IScalarTy_I64_eq, I64.max_eq]; omega))

end dec2flt_model

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (44)
More program dependencies (11)
Standard-library dependencies (30)

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

Proof assumptions and review

Lean checks the formal proof. Trellis also reviews how the statement corresponds to the intended requirement.

Transitive assumptions

This list combines the assumptions recorded for this declaration and its dependencies. It may include assumptions used by auxiliary declarations in those modules.

Helper theorems included
Technical checking records
Local closure summary
{
  "node": "P367_T1_NumberHelperExponentAddA",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "f1e45ecbd3bb3ed50ad311c910748a916cffe342ff8b7f8acbf22d576f69dfca",
  "active_statement_hash": "940b6ce2fc83b48f6bedf2dfb57218e2b5ff87de7add36f79eaa53ab664e887c",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "576e6bf9480cfd32f53c309c7ac8fb115c1ba6e413f299ed5ff9fa7c647e6769",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-74",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {}
}
Prose assessment
{
  "label": "Lean proof closed; predictive prose review no longer required",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "sound-v2:bd811c6ab00c4d7d4d50fc03664ccd55af668db564b062aa00aac4721d438cbc",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}