Skip to content

Add U256 subtraction correctness proofs (17/17 u256)#6

Open
MarcIlunga wants to merge 1 commit intomainfrom
proofs/u256-subtraction
Open

Add U256 subtraction correctness proofs (17/17 u256)#6
MarcIlunga wants to merge 1 commit intomainfrom
proofs/u256-subtraction

Conversation

@MarcIlunga
Copy link
Copy Markdown
Contributor

Summary

  • Adds sorry-free correctness proofs for u256::sub_with_borrow_be, u256::overflowing_sub, and u256::wrapping_sub
  • Completes the U256 module: all 17 procedures now have machine-checked proofs
  • sub_with_borrow_be is a 770-line chunked proof (53 instructions, 8-limb borrow chain), following the same pattern as add_with_carry_be

Test plan

  • timeout 300s lake build MidenLean.Proofs.U256.SubWithBorrowBe passes
  • timeout 300s lake build MidenLean.Proofs.U256.OverflowingSub passes
  • timeout 300s lake build MidenLean.Proofs.U256.WrappingSub passes
  • lake build MidenLean full build passes with 0 sorry

🤖 Generated with Claude Code

…tness proofs

Completes the U256 subtraction family (17/17 u256 procedures now proven).

- sub_with_borrow_be: 770-line chunked proof for the 53-instruction
  big-endian subtraction with borrow propagation. Follows the same
  pattern as add_with_carry_be. Includes borrow chain identity,
  digit extraction, and per-limb correctness lemmas.

- overflowing_sub: Composes u256_le_to_be_pair, sub_with_borrow_be,
  and u256_le_to_be with stack rearrangement.

- wrapping_sub: Same as overflowing_sub but drops the borrow flag.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants