def normalized_witness

stelliferous@0.0.2.0 · proofs/storage_certificate.bend:30

import stelliferous@0.0.2.0/proofs/storage_certificate.bend as StorageCertificate
import Base
import stelliferous@0.0.2.0/proofs/storage_tree_model.bend as Tree
import stelliferous@0.0.2.0/proofs/storage_witness.bend as Witness

30def normalized_witness(-Element: Data,+depth: Nat,-tree: Tree.Tree<Element>) ->
31  Witness.Witness(Element,depth,Tree.pack(Element,normalized(Element,depth,tree))):
32  match depth:
33    case 0n: Witness.Leaf{first(Element,tree),{==}}
34    case 1n+ +rest:
35      Witness.Node{Tree.pack(Element,normalized(Element,rest,left(Element,tree))),
36        Tree.pack(Element,normalized(Element,rest,right(Element,tree))),{==},
37        normalized_witness(Element,rest,left(Element,tree)),normalized_witness(Element,rest,right(Element,tree))}

Uses (10)

Used by (2)