Completeness of vector Merkle trees #
This file proves the completeness theorem for the vector-style Merkle tree
construction defined in VCVio.CryptoFoundations.MerkleTree.Vector.Defs:
honestly generated proofs verify against honestly built roots.
The proof is split into two pieces:
MerkleTree.functional_completenessis a purely functional statement aboutgetPutativeRoot_with_hashandbuildMerkleTree_with_hash, proven by induction on the tree depth.MerkleTree.completenesslifts the functional statement to the monadic API by reducing throughsimulateQof the random oracle.
The auxiliary buildLayer_neverFails and buildMerkleTree_neverFails lemmas
record that honest tree construction never fails under the random-oracle
simulation, which the completeness reduction relies on.
Building a Merkle tree never results in failure (no matter what queries have already been made to the oracle before it runs).
A functional completeness theorem for Merkle proofs built from buildMerkleTree_with_hash.
Completeness theorem for Merkle trees: for any full binary tree with 2 ^ n leaves, and for
any index i, the honestly-generated opening proof verifies against the honestly-built root
with probability one.