2 Metrics

To facilitate the formalized discussion of completeness, we need to define a path. A path is a tuple p(x1,xn) = (x1,x2,x3,xn) such that i [1n1] : (xi,xi+1) P We can further define n = |(x1,x2,x3,xn)| to be the number of items in the tuple. We define that n N : p(n,n) = (n).

Recall that we have already defined the “leaf” predicate L(x) that is true iff x is a leaf. Using these definitions, we can define that a non-empty tree (N,P) rooted at node r is complete iff n 1 : x N : (L(x)) ⇒|p(r,x)|∈{n 1,n}.

We can also define the height h(Tr) of a tree as follows. If the tree only has one node (the root r itself), the height is 1, h(({r},{},{},v)) = 1. An empty tree has a height of 0, h(({},{},{},{})) = 0.

We can recursively define the height of a tree Tr = (N,PL,PR,v) rooted at node r as h(Tr) = 1 + max(h(TrR,h(TrL)), in which TrR is the right subtree of r, and TrL is the left subtree of r.