Surface checked arithmetic proof obligations (#1993)#2013
Open
Th0rgal wants to merge 7 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4dbf7b7. Configure here.
This was referenced Jun 12, 2026
# Conflicts: # PrintAxioms.lean
…ask1993b-fix # Conflicts: # PrintAxioms.lean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
safeAdd/safeSub/safeMulandaddPanic/subPanic/mulPanicin verified contract bodies and generates stable per-entrypointlocalObligations(e.g.checked_arithmetic_increment_1_add_no_overflow), leaving checked-arithmetic codegen untouched.CheckedArithmetic.AddNoOverflow/SubNoUnderflow/MulNoOverflowwith bridging theoremssafeAdd_isSome_iff_addNoOverflow,safeSub_isSome_iff_subNoUnderflow,safeMul_isSome_iff_mulNoOverflow(Verity/Proofs/Stdlib/Math.lean).PrintAxioms.leanrefreshed (zero new axioms).Proof-obligation half of #1993. Downstream target: the 4
LocalNoOverflowForlocal axioms in morpho-verityProofs/Disciplines.leanbecome provable obligations. Stacked on #2009 (#1994 execution summaries); the emission half (#1993a) lands separately.Test plan
lake build Verity Contracts Compiler PrintAxioms→ "Build completed successfully."refresh_verification_artifacts.sh→[refresh] PASSmake check→ "All checks passed."Note
Medium Risk
Changes contract spec generation and obligation surfacing across all entrypoints; incorrect detection or naming could mislead proofs, though smoke tests and unchanged codegen limit runtime impact.
Overview
The Verity macro now scans function, constructor, and immutable-init bodies for
safeAdd/safeSub/safeMuland panic variants, and merges auto-generatedlocalObligations(stable names likechecked_arithmetic_increment_1_add_no_overflow,.assumedstatus, text pointing at proof predicates) into compilation models without changing checked-arithmetic codegen.Proof library:
Verity/Proofs/Stdlib/Math.leanaddsCheckedArithmetic.AddNoOverflow/SubNoUnderflow/MulNoOverflowand iff lemmas tyingsafeAdd/safeSub/safeMul.isSometo those props;PrintAxioms.leanlists the three new theorems.Related macro work in the same diff: auto-generated
_frame_holdsand_view_frameexecution theorems for eligiblemodifies/ parameterlessviewfunctions (smoke examples inEffects.lean), and immutable initializers can lower throughtranslateSafeRequireBindwhen init uses checked ops.Tests:
CheckedArithmeticObligationSmokeinSpecGenAndChecks.leanasserts add/sub/mul obligations onSafeCounterandSafeMulRequireSmoke.Reviewed by Cursor Bugbot for commit 41c14e1. Bugbot is set up for automated code reviews on this repo. Configure here.