def perfect

bend-collections-laws-crypto@1.0.0.0 · proofs/lib/array.bend:42

import bend-collections-laws-crypto@1.0.0.0/proofs/lib/array.bend as Array
import Base

42def perfect(-T: Data, +d: Nat, t: Tree<T>) -> Bool:
43  match d t:
44    case 0n TLeaf{x}:
45      True{}
46    case 0n TNode{l, r}:
47      False{}
48    case 1n+p TLeaf{x}:
49      False{}
50    case 1n+p TNode{l, r}:
51      Bool.and(perfect(T, p, l), perfect(T, p, r))

Uses (4)

Used by (22)