verifyExclusionProof = function(treeId, index, rootHash, proof) {
  // Verify preconditions.
  e2e.assert(
      treeId.length == TREE_ID_SIZE_BYTES_,
      'tree ID has wrong size (' + treeId.length + ' bytes)',
      InvalidArgumentsError);
  e2e.assert(
      rootHash.length == NODE_HASH_SIZE_BYTES_,
      'root hash has wrong size (' + rootHash.length + ' bytes)',
      InvalidArgumentsError);
  e2e.assert(
      proof.length == TREE_SIZE_,
      'proof has wrong size (' + proof.length + ' elements)',
      InvalidArgumentsError);
  e2e.assert(
      proof.every(function(el) {
        return (el === null) || (el.length == NODE_HASH_SIZE_BYTES_);
      }),
      'proof fails precondition -- every element must be either null or ' +
          NODE_HASH_SIZE_BYTES_ + ' bytes',
      InvalidArgumentsError);
  // Now actually do the work.
  const siblings = index.ascentSiblings();
  let height = findIndex(proof, function(x) {
    return Boolean(x);
  });
  if (height == -1) {
    height = TREE_SIZE_;
  }
  let hash = hashEmpty(treeId, index, height);
  for (; height < TREE_SIZE_; height++) {
    const siblingIndex = siblings[height];
    const neighborHash =
        proof[height] || hashEmpty(treeId, siblingIndex, height);
    hash = (index.isBitSet(TREE_SIZE_ - height)) ?
        hashChildren(hash, neighborHash) :
        hashChildren(neighborHash, hash);
  }
  return e2e.compareByteArray(hash, rootHash);
}
Verifies whether a claimed proof actually shows that a leaf node is empty.

@param {!e2e.ByteArray} treeId Eight-byte nonce identifying the tree.
@param {!TreeIndex} index Index of the leaf node in the Merkle tree (must
    be 64 bytes).
@param {!e2e.ByteArray} rootHash Hash value at the root of the tree.
@param {!Array<?e2e.ByteArray>} proof Exclusion proof claiming to demonstrate
    the absence of data at the index.  Must contain 256 values, which must
    either be 256-bit hashes or null.
@return {boolean} Whether the exclusion proof is correct.
@throws {!InvalidArgumentsError} If any of the data provided is the wrong
size.