Skip to content

proof(merkle): Stage 1 — buildMerkleTree correctness (WIP)#46

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/dazzling-noether-hkgAV
Jun 15, 2026
Merged

proof(merkle): Stage 1 — buildMerkleTree correctness (WIP)#46
hyperpolymath merged 1 commit into
mainfrom
claude/dazzling-noether-hkgAV

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Stage 1 — Merkle closure (proof campaign; see docs/PROOFS.adoc)

Proof-first work toward buildMerkleTree correctness:
getLeafHash (buildMerkleTree hs) (finToNat i) = Just (index i hs).

Landed (this commit): five reusable, total helper lemmas (ochrance-core/Ochrance/Scratch.idr), all idris2 0.8.0 --check green:

  • indexAppendLeft / indexAppendRightindex over ++ via weakenN / shift
  • indexReplace — transport cancellation (tames buildMerkleTree's replace over powerTwoSucc)
  • finToNatReplace — transport preserves finToNat
  • splitAtConcatsplitAt's two halves re-append to the original

In progress: the buildGetLeaf assembly consuming them (induction + splitSum + the <-Bool / minus branch bridge), a getLeafHash exportpublic export visibility bump, and integration into ochrance.ipkg so CI type-checks it.

Proof-first discipline: only proven lemmas + a visibility change are added; no code is allowed ahead of its proof. Draft / WIP. Verified locally on idris2 0.8.0 (built from source per #44).

https://claude.ai/code/session_011z2t8zAxfcCNLJzU7YdpBQ


Generated by Claude Code

Reusable, total Vect/Fin lemmas underpinning buildMerkleTree correctness: indexAppendLeft, indexAppendRight, indexReplace (transport cancellation), finToNatReplace, splitAtConcat. idris2 0.8.0 --check green. The buildGetLeaf assembly that consumes them is in progress.

https://claude.ai/code/session_011z2t8zAxfcCNLJzU7YdpBQ
@hyperpolymath
hyperpolymath marked this pull request as ready for review June 15, 2026 17:48
@hyperpolymath
hyperpolymath merged commit 03ce34f into main Jun 15, 2026
19 checks passed
hyperpolymath added a commit that referenced this pull request Jun 15, 2026
Re-lands the Stage 1.1 proof that PR #46's merge dropped: buildGetLeaf (getLeafHash (buildMerkleTree hs) (finToNat i) = Just (index i hs)), Ochrance.Util.VectLemmas (helpers), Merkle.idr visibility bumps, and ipkg module registration. Total, machine-checked, idris2 0.8.0 build 19/19.
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