Skip to content

secp256k1: Add field64 proofs. - #3730

Merged
davecgh merged 1 commit into
decred:masterfrom
davecgh:secp256k1_field64_proofs
Jul 15, 2026
Merged

secp256k1: Add field64 proofs.#3730
davecgh merged 1 commit into
decred:masterfrom
davecgh:secp256k1_field64_proofs

Conversation

@davecgh

@davecgh davecgh commented Jul 9, 2026

Copy link
Copy Markdown
Member

This adds formal verification proofs of the arithmetic in the new field64 implementation using the Z3 theorem prover along with a new directory to house all such proofs and an associated README.md to describe its contents.

It includes formal proofs for the following:

  • 512-bit multiplication with saturated 64-bit limbs
  • 512-bit squaring with saturated 64-bit limbs
  • 512-bit modular reduction over the field prime saturated 64-bit limbs

Theorem prover output:

$ python internal/proofs/mul512_4x64_prover.py
discarded carry 0 != 0: unsat
discarded carry 1 != 0: unsat
discarded carry 2 != 0: unsat
discarded carry 3 != 0: unsat
discarded carry 4 != 0: unsat
discarded carry 5 != 0: unsat
discarded carry 6 != 0: unsat
top limb after row 0 > 2**64-2: unsat
limb 5 after row 1 > 2**64-2: unsat
limb 5 after row 2 > 2**64-2: unsat
limb 5 after row 3 > 2**64-2: unsat

$ python internal/proofs/square512_4x64_prover.py
discarded carry 0 != 0: unsat
discarded carry 1 != 0: unsat
discarded carry 2 != 0: unsat
discarded carry 3 != 0: unsat

$ python internal/proofs/field_4x64_reduce_prover.py
discarded carry 0 != 0: unsat
discarded carry 1 != 0: unsat
discarded carry 2 != 0: unsat
top limb after 1st reduction > complement: unsat
value after 2nd reduction >= 2p: unsat
fully reduced result >= prime: unsat

@davecgh davecgh added this to the 2.2.0 milestone Jul 9, 2026
@davecgh
davecgh force-pushed the secp256k1_field64_proofs branch 2 times, most recently from fab138e to 5b8f33b Compare July 9, 2026 04:38
Comment thread dcrec/secp256k1/internal/proofs/README.md
This adds a formal verification proofs of the arithmetic in the new
field64 implementation using the Z3 theorem prover along with a new
directory to house all such proofs and an associated README.md to
describe its contents.

It includes formal proofs for the following:

- 512-bit multiplication with saturated 64-bit limbs
- 512-bit squaring with saturated 64-bit limbs
- 512-bit modular reduction over the field prime saturated 64-bit limbs
@davecgh
davecgh force-pushed the secp256k1_field64_proofs branch from 5b8f33b to 1b88b15 Compare July 15, 2026 00:05
@davecgh
davecgh merged commit 1b88b15 into decred:master Jul 15, 2026
32 checks passed
@davecgh
davecgh deleted the secp256k1_field64_proofs branch July 15, 2026 00:17
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.

3 participants