Seedelf-Wallet

Chunk 40 · Verification, once upstream is fixed

Branch verification, from main, pushed to origin, with no PR on purpose (the owner, 2026-11-02). It isn’t a web-wallet/… branch because the work lives in seedelf-verification/, not in the wallet.

Archived 2026-11-07. What it did is Where it ended. What it left open, the proofs off our forks and onto IOG’s own tools, is chunk 46. Below is the plan as it stood. Where it says the policy’s success directions are parked, they were proved since, over Slice/’s alias.

Status on 2026-11-03: ✅ the wallet’s core property is proved, on our forks. Chunk 41 fixed the three gaps this file waited on, and a fourth that only showed once they were fixed: the BLS12-381 builtins’ operand order. It fixed them in forks of IOG’s tools, which lakefile.lean pins, and WalletRegister is ✅ Valid in the script’s own order. What stays here: the policy’s success directions, which wait on BitVec (Lean-blaster #153), and, as each upstream PR lands, re-running against upstream with this file’s How to tell each is fixed. Before chunk 41 this file read ⛔, in the owner’s words: “I would want these upstream bugs fixed then work everything out before we continue on.”

What the owner asked (2026-11-02): “a verification folder and branch that we can work on further because it would be interesting to do this for lovejoin as well.” On the wallet’s property: “proving the wallet part of things is verified is huge.”

What’s done ✅

What blocks it

  1. ⛔ A datatype’s parameter names. This is a Lean-blaster regression, filed as #454 on 2026-11-02; our fix is on its way as a PR (chunk 41).
    • Our manifest pins Lean-blaster’s beta-lambda-cache-optimization branch at 46c8479, through CardanoLedgerApiBlaster 9938562.
    • On that branch, genIndParams in Blaster/Smt/Translate/Quantifier.lean telescopes (← hashcons indVal.type). So a datatype takes the parameter names of an earlier alpha-equivalent type.
    • Any goal with both Except and Prod fails, in either order (“unknown sort ‘@ε’”). PlutusCoreBlaster’s goals translate Data × Data before a BLS12-381 builtin’s Except String _.
    • Lean-blaster main at a16614e telescopes indVal.type and passes the same file.
    • Draft: lean-blaster-datatype-param-names.md.
    • It’s already out there: PlutusCoreBlaster main pins Blaster bc03bb4, which has the line, and its #68 moves the pin to 8816f72, which has it too. Lean-blaster #155 (beta → main, under review on 2026-11-02) would bring it to main.
    • The line came in with bafdd4f (2025-12-04, the hash-consing squash). Draft #335 would fix it as a side effect, but has no test for it and was idle from 2026-10-18.
  2. ⛔ BitVec through Char.
    • A ByteString is a String, which is a List Char, and a Char is a UInt32, which is a BitVec 32.
    • byteStringToInteger folds Char.toNat, and sliceByteString is take/drop on the chars. Over a symbolic bytestring, either fails with “Inductive datatype with instance parameters not supported: BitVec”.
    • The upstream issues are Lean-blaster #153, #69 and #67. On 2026-07-29 a maintainer said BitVec/Fin support would come “very soon”.
    • The stopgap’s precedent is PlutusCoreBlaster #27, an opaque alias for serialiseData. It was still open on 2026-11-02.
    • Drafts: the #153 comment, the PlutusCoreBlaster issue, and the #68 comment. The #68 comment needs the number of bug 1’s issue once that’s filed.
    • The “very soon” work looks like branch feat/indexed-types (RSoulatIOHK, last touched 2026-06-21, never a PR), which leaves out Char and toNat, the two things byteStringToInteger needs.
  3. ⛔ Fin in a BLS12-381 coordinate. Fq1.t : Fin fieldPrime (Cryptograph/BLS12_381/Basic.lean), and Fin n is an indexed type: the same throw, waiting behind 1 and 2 for anything holding a symbolic G1 point. Confirmed by a run on 2026-11-02: Upstream/Fq1Fin’s point cases fail with “Inductive datatype with instance parameters not supported: Fin", its control passes. PlutusCoreBlaster draft [#29](https://github.com/input-output-hk/PlutusCoreBlaster/pull/29) (BLS axiomatization, idle since 2026-09-21) changes it to Nat` and adds BLS12-381 axioms and an ownership-verification example: read it before WalletRegister.

What they block:

Property Needs
A Register UTxO moves iff the Schnorr check holds and vkh signed (WalletRegister, left out of check.sh’s list): the wallet’s core property 1, 2 and 3
Burns of 5eed0e1f tokens succeed (burn_at_0, burn_at_255 in PolicyBurn). A mint passes for exactly the name generate gives (mint_at_0_iff, mint_at_255_iff in PolicyMint), then for any input 2

Until then, the wallet’s Schnorr path rests on the Aiken tests, seedelf-crypto’s proptests and seedelf-core’s recorded-transaction evaluations.

The baseline (2026-11-02, Z3 5.3.1)

The owner’s runs gave these results. Compare against them after a bump.

How to tell each is fixed

On 2026-11-02 every pin was its upstream’s head: Lean-blaster beta 46c8479 and main a16614e, PlutusCoreBlaster main 1c23de8, CardanoLedgerApiBlaster main 9938562.

CardanoLedgerApiBlaster requires Blaster and PlutusCore by branch (beta-lambda-cache-optimization and main). So only our lake-manifest.json pins those two, and a fix on either branch reaches us through lake update alone.

Any session can run these reads. None of them builds anything:

# any machine, read-only
gh api repos/input-output-hk/Lean-blaster/branches/beta-lambda-cache-optimization --jq .commit.sha
gh api 'repos/input-output-hk/Lean-blaster/commits?sha=beta-lambda-cache-optimization&path=Blaster/Smt/Translate/Quantifier.lean&per_page=5' --jq '.[] | .sha[:7] + " " + (.commit.message | split("\n")[0])'
gh api 'repos/input-output-hk/CardanoLedgerApiBlaster/commits?per_page=3' --jq '.[] | .sha[:7] + " " + (.commit.message | split("\n")[0])'
gh api repos/input-output-hk/CardanoLedgerApiBlaster/contents/lakefile.lean --jq .content | base64 -d | grep require
gh issue view 153 -R input-output-hk/Lean-blaster --comments
gh pr view 68 -R input-output-hk/PlutusCoreBlaster
gh pr view 27 -R input-output-hk/PlutusCoreBlaster

Resuming

The owner runs every build and pastes the output back (Practicalities). The steps, in order:

  1. ⬜ Read upstream with the commands above, and compare with this file’s baseline.
  2. ⬜ Bump the pins.
    • The owner runs lake update in seedelf-verification/. It moves Blaster and PlutusCore to their branches’ heads in lake-manifest.json.
    • If CardanoLedgerApiBlaster has moved too, put its new commit in lakefile.lean first.
    • Some fixes land where CardanoLedgerApiBlaster doesn’t pull from: a fix branch, or main while it stays on beta. Pull one in with a require of our own in lakefile.lean, at that commit. Lake prefers the root package’s own requirement to an inherited one.
    • Record the new revisions here and in the README.
  3. ⬜ Match the toolchain and Z3.
    • lean-toolchain must equal CardanoLedgerApiBlaster’s at its new commit (4.24.0 today).
    • Z3 must be at least the version Lean-blaster’s README gives under Prerequisites (5.3.1 today). Check with z3 --version.
    • The owner installs any newer Z3. Theirs is in ~/tools, linked from ~/.local/bin/z3.
  4. ⬜ Re-run, cheapest first:
    • ./extract.sh: three oks, so the hex still hashes to the on-chain scripts.
    • ./check.sh upstream.
    • ./check.sh upstream-main: it’s pinned to a16614e, so it shouldn’t change.
    • ./check.sh: all 29 theorems must still be ✅ before anything is un-parked. If a bump breaks them, that’s a regression to report, from a minimal case in Upstream/, as these were.
  5. Un-park, one at a time. Each gets its own ./check.sh <module> run under the cap.
    1. ⛔ WalletRegister (needs bugs 1, 2 and 3).
      • Measure first. Put a valid spend’s concrete run in Steps.lean, with a real proof from schnorr.ak’s or seedelf-crypto’s test vectors. Set the step limit above it (2500 now). That run is also the passing run rule 3 pairs the property with.
      • It may run out of memory. It has six symbolic bytestrings and runs into the crypto builtins, which the README’s rule 4 warns against. If it’s KILLED, split it: one direction per module, or the signer fixed to vkh.
      • Once it proves, add it to check.sh’s default list and update the README’s tables.
    2. ⛔ The policy’s success theorems (needs bug 2).
      • burn_at_0, burn_at_255, mint_at_0_iff and mint_at_255_iff should turn ✅ as they stand.
      • Then make the input id and the tag symbolic, so the mint’s naming holds for any input. That’s where the open question comes back.
    3. ⬜ A symbolic first-input index. It once hit BitVec, but that came from the slicing, not from consByteString’s byte (refuted). So retry PolicyBurn with the index symbolic: burns should succeed for every index from 0 to 255 and fail for every index from 256.
    4. ⬜ Lovejoin, in a Lovejoin/ beside Seedelf/, with its own Scripts.lean and an extract.sh step that checks its hashes.
      • Its bytes are in seedelf-core. The token-pool templates are pinned in templates.rs, before their parameters (Lovejoin 8131b1d, Aiken v1.1.24). The classic pool’s scripts are bundled whole in references.rs: LOVEJOIN_*_MIX_BOX and LOVEJOIN_*_MIX_LOGIC, which Protocol::of reads.
      • Before writing its properties, check which builtins its scripts reach over the inputs a property would leave symbolic. The BLS12-381 builtins and bytestring slicing meet the same two bugs.
  6. As each one lands, update the README’s What’s proved and Not proved tables with it. When the chunk is done, this file moves to the archive, as the plans README says.

Meanwhile

The open question

Why did the policy take 8 GB with wholly symbolic token names? On 2026-11-02, with wholly symbolic names, each of the policy’s modules was killed at the 8 GB cap in about 36 s.

Practicalities and rules

Refuted: don’t repeat these

Found along the way

A burn fails when the transaction’s first input is output #256 or later.

The owner’s decisions

Fixing it ourselves

The 2026-11-02 investigation found it within reach, about 3-5 days: bug 1 is one line plus a test; 3 is #29’s Fq1 change; 2 takes an opaque stopgap for byteStringToInteger (real BitVec/Char support is upstream’s design work, weeks to months). The plan for doing it is chunk 41.

Where it ended