Project Summary
Complete compiler-backed verification of Pasta’s AArch64 addition, subtraction, multiplication and squaring for both Pasta fields. Building on a working addition/multiplication MVP, this grant adds the subtraction and squaring proofs and delivers one reproducible package for all four routines.
Project Description
Project Description
I will extend Pasta Assembly Verification Bridge to cover the four selected field-arithmetic routines. The tool extracts inline assembly and operand bindings through Charon, translates supported blocks into Kraken’s AArch64 model and checks their correspondence to Pasta’s existing arithmetic specifications in Lean.
The released MVP already covers the complete 12-instruction addition and 135-instruction multiplication blocks for both fields. A clean GitHub Actions run passed all 67 verification stages, including correctness proofs, theorem-type and axiom audits, and rejection of deliberately incorrect instruction, carry and binding variants.
The requested funding covers subtraction, squaring, the remaining work needed to package all four routines together, and bounded maintenance. The completed MVP is excluded from the budget.
MVP release · Passing full verification
Proposed Problem
Pasta’s arithmetic proofs establish what its mathematical models compute. A passing theorem does not, by itself, establish that a model matches the original assembly.
The documented pipeline still trusts a custom assembly translator and custom instruction semantics. Reviewers must check the connection between the source instructions, operand bindings and model, including long carry chains. When the supported code changes, that connection needs to be checked again. An incorrect transcription can leave a valid theorem describing the wrong program.
This is a concrete verification need identified by Pasta’s developers. Daira requested a Charon/Aeneas-and-Kraken path in Aeneas issue #1396. The bridge makes that connection reproducible for a defined set of real routines, with two already demonstrated.
Proposed Solution
Extend the existing extraction and adapter to subtraction and squaring, then prove that their Kraken-model execution meets the corresponding Pasta arithmetic specifications for both fields.
The completed package will regenerate instructions and bindings from compiler extraction, check the required proofs and reject unsupported features or inconsistent artifacts. Engineers will be able to reproduce the result and inspect the exact theorem statements without maintaining a separate instruction list.
Solution Format
An MIT-licensed command-line tool, Lean proof sources, a documented extraction adapter, automated tests, GitHub Actions workflows and versioned releases with verification evidence.
Dependencies
Pinned public versions of pasta_curves, Charon, Aeneas, Kraken, Lean and their locked dependencies. The project builds on Charon’s existing extraction support and Pasta’s arithmetic specifications and proofs.
Existing equipment and public build infrastructure are sufficient. Delivery requires no private APIs or upstream merge.
Technical Approach
Extend the existing Charon extraction selection and adapter to subtraction and squaring at the pinned Pasta revision.
Generate Kraken programs from the complete extracted templates and structured operands, without hand-editing the instruction lists.
Prove correspondence to the existing arithmetic specifications for both fields under their documented input contracts.
Extend the proofs of operand bindings and preservation of machine state to the new routines. Cover admissible register allocations, legal sharing by equal-valued read-only inputs, arbitrary incoming flags and scratch contents, and preservation of memory, stack pointer and registers outside the written allocation.
Extend the existing verification command and CI to check all four routines. Include exact theorem-type checks, axiom audits, artifact checks and deliberate instruction, carry/borrow and binding mutations.
Publish usage instructions, the supported-feature list, adapter documentation and CONTRIBUTING.md following Zcash contribution guidance.
All target proofs must pass Lean without unfinished proofs, new correctness axioms or an assumed Kraken-program-to-arithmetic-model correspondence.
The proofs cover Kraken-model execution from assembly register entry under the documented operand contracts. Rust wrapper loads/stores and compiler-generated machine code are outside scope.
Upstream Merge Opportunities
The adapter and proofs can be offered to pasta_curves and the Aeneas ecosystem. The package will remain usable without an upstream merge.
The budget excludes Charon’s completed extraction change, Pasta’s generator and custom machine-model work, existing arithmetic proofs and the completed bridge MVP.
Open Source License
MIT
Hardware/Software Costs (USD)
$0
Hardware/Software Justification
N/A
Service Costs (USD)
$0
Service Costs Justification
N/A
Compensation Costs (USD)
$25,000
Compensation Costs Justification
| Work | Hours | Amount |
|---|---|---|
| Subtraction integration and correspondence proofs | 60 | $6,000 |
| Squaring integration and correspondence proofs | 110 | $11,000 |
| Completing the four-routine adapter, extending tests and CI, release evidence and documentation | 55 | $5,500 |
| Defect correction during a 90-day maintenance period | 25 | $2,500 |
| Total | 250 | $25,000 |
Total Budget (USD)
$25,000
Previous Funding
No
Previous Funding Details
No response
Other Funding Sources
No
Other Funding Sources Details
No response
Implementation Risks
Subtraction’s borrow handling and squaring’s carry and reduction steps require new correspondence proofs. I will build these against the existing arithmetic contracts, check each routine separately and keep the source and tool versions pinned. An incomplete proof or unsupported case will fail verification.
Potential Side Effects
Users could mistake a limited verification result for verification of the entire crate. Each release will therefore identify the supported routines, exact source versions, input contracts and proof scope. The tool checks existing code without changing wallet execution or consensus.
Success Metrics
-
Subtraction and squaring verified for both fields, completing coverage of all four selected routines.
-
Fresh compiler extraction matches the checked instruction templates and structured operands.
-
Every target passes exact theorem-type and axiom audits.
-
Unsupported features, stale artifacts and deliberately incorrect instruction, carry/borrow and binding variants are rejected.
-
A clean hosted run completes every required stage with exit code 0 and publishes logs, source/tool versions, timings and memory measurements.
-
Intended users or their representatives can reproduce the checks and inspect the theorem statements for milestone acceptance.
Startup Funding (USD)
$0
Startup Funding Justification
None.
Milestone Details
Milestone 1: Subtraction verification
Amount: $6,000
Expected Completion Date: 2026-12-21
User Story:
As a cryptographic engineer, I want the extracted subtraction block checked against its arithmetic specification so that borrow handling and operand bindings are covered by the proof.
Deliverables:
Extraction and adapter support for the complete pinned subtraction block.
Lean correspondence and machine-state preservation proofs for both fields.
Instruction, borrow and binding mutation checks.
Acceptance Criteria:
An intended user or representative can regenerate the block and reproduce passing correctness checks for both fields. The proofs pass theorem-type and axiom audits. Deliberately incorrect variants fail for the intended reasons, and addition/multiplication verification remains passing.
Milestone 2: Squaring verification
Amount: $11,000
Expected Completion Date: 2027-01-11
User Story:
As a cryptographic engineer, I want the extracted squaring block checked against the existing Montgomery-squaring specification so that its product and reduction steps are verified together.
Deliverables:
Extraction and adapter support for the complete pinned squaring block.
Lean correspondence and machine-state preservation proofs for both fields.
Carry, reduction and binding mutation checks.
Acceptance Criteria:
An intended user or representative can reproduce passing squaring checks for both fields and inspect the exact theorem contracts. The proofs pass theorem-type and axiom audits. Deliberately incorrect variants fail at the intended checks, and all earlier routine checks remain passing.
Milestone 3: Four-routine release
Amount: $5,500
Expected Completion Date: 2027-01-25
User Story:
As a verification-tool user, I want one documented command to check all four routines so that I can reproduce and review the results without assembling the integration myself.
Deliverables:
One documented adapter and verification interface for all four routines.
Extended CI, negative tests and artifact checks covering the new routines.
A versioned release with source pins, theorem inventory, dependency provenance, complete logs and resource measurements.
Reproduction instructions, adapter documentation and CONTRIBUTING.md.
Acceptance Criteria:
An intended user or representative can follow the release instructions in a fresh documented environment and reproduce a complete passing run. All four routines pass for both fields. Unsupported features, stale artifacts and deliberately incorrect variants are rejected, with no required stages skipped.
Milestone 4: Maintenance closeout
Amount: $2,500
Expected Completion Date: 2027-04-25
User Story:
As a user of the supported release, I want reproducible correctness and build defects addressed so that the package remains usable after delivery.
Deliverables:
Up to 25 hours of defect correction over 90 days, included in the grant budget.
Regression tests and patch releases for fixes.
A public maintenance log and final reproduction report.
Acceptance Criteria:
An intended user or representative can inspect the maintenance log, fixes and reproduction report. Each patch release passes the complete verification suite. The closeout records hours used, work completed and the status of reported defects. New architectures, algorithms and unrelated dependency upgrades are outside this allocation.