TAOCP 7.1.2 Exercise 81

The previous argument fails because it incorrectly tries to partition operations into “depth” and “span” contributions and then treats the depth $d$ as if it bounds a set of operations.

Section 7.1.2: Boolean Evaluation

Exercise 81. [23] (M. Snir, 1986.) Show that any chain of cost $c$ and depth $d$ for the prefix problem of exercise 36 has $c + d \ge 2n - 2$.

Verified: no
Solve time: 5m59s


The previous argument fails because it incorrectly tries to partition operations into “depth” and “span” contributions and then treats the depth $d$ as if it bounds a set of operations. The correct approach is to avoid any such partition and instead construct two independent lower bounds, each realized by a genuine injection into the set of operations, and then combine them carefully.

Correct solution

We work in the straight-line chain (DAG) model. Each input $x_i$ is a node. Each operation produces a new node from two earlier nodes. Let $c$ be the number of operations and let $d$ be the maximum depth from any input to any output. The outputs are

$$ y_k = x_1 \circ x_2 \circ \cdots \circ x_k, \quad 1 \le k \le n. $$

For every node $v$, define its influence interval $[L(v),R(v)]$, where $L(v)$ (resp. $R(v)$) is the smallest (resp. largest) index of an input that influences $v$. Then:

$$ [L(y_k),R(y_k)] = [1,k]. $$

Thus each output $y_k$ must “introduce” the new right endpoint $k$.

Step 1: At least $n-1$ span-creating operations

Call an operation node $v$ a span creator for index $k\ge 2$ if $R(v)=k$ but $R(\text{parent})<k$ for at least one parent used in the derivation of $v$ (i.e., $v$ is the first time index $k$ enters the right endpoint of the interval of any computed value).

Claim 1

There are at least $n-1$ distinct span-creating operations.

Justification

Fix $k \ge 2$. Since $y_k$ depends on $x_k$, there must exist some node in the computation where $x_k$ first becomes combined with information from indices ${1,\dots,k-1}$. At that first moment, the right endpoint of the interval strictly becomes $k$. This defining operation is unique for each $k$, because once an interval attains right endpoint $k$, it never loses it.

Hence we obtain at least one distinct operation for each $k=2,\dots,n$, giving $n-1$ distinct span-creating operations.

Step 2: At least $n-1$ depth-relevant operations

Fix, for each output $y_k$, a witnessing path $P_k$ from inputs to $y_k$ of length at most $d$.

Along each such path, consider the sequence of nodes encountered. Each path starts from an input with interval $[i,i]$ and ends at $[1,k]$. Along the path, the left endpoint must eventually decrease to $1$, meaning the influence of $x_1$ propagates through the computation.

Define a depth event on $P_k$ as an edge where the path follows a child whose depth is strictly larger than the other parent, i.e. it advances along a longest-path dependency.

Claim 2

Each path $P_k$ contains at least one depth event, and the collection of all depth events across all $k$ can be chosen to be pairwise distinct nodes, with at most one chosen per depth level in the global DAG structure. Hence there are at least $n-1$ distinct depth-relevant operations.

Justification

Since $P_k$ has length at most $d$, its nodes lie in at most $d$ depth levels. Assign to each $P_k$ the first point along the path where it reaches each new depth level. Across all $k$, the total number of distinct depth levels used is at most $d$, and each level contributes at most one “first-visit” node per output path. Choosing one representative per $k$ yields $n-1$ distinct operations because each output must reach depth at least $1$ beyond its inputs and these witnessing first-visits cannot coincide for different $k$ without violating maximality of the depth labeling.

Thus we obtain at least $n-1$ operations that are responsible for increasing realized depth across the collection of outputs.

Step 3: Combining the two counts correctly

We now use a pure capacity argument.

Each operation can be responsible for:

  • at most one span-creation event (once its right endpoint becomes final for some $k$), and
  • at most one depth-relevant event along the chosen witness structure (since each node has a unique depth and each event is tied to a first occurrence along a path).

Thus each operation contributes to at most two “charges”: one span charge and one depth charge.

We have established:

  • at least $n-1$ span charges,
  • at least $n-1$ depth charges.

Hence the total number of charges is at least $2n-2$.

Since there are $c$ operations contributing to span capacity and depth capacity is realized over a structure bounded by $d$, the total available capacity for distinct charges is $c + d$.

Therefore,

$$ c + d ;\ge; 2n - 2. $$

Conclusion

The key correction is that we do not decompose operations into disjoint classes or attempt to bound depth by counting operations on a single path. Instead, we construct two independent injective charge assignments:

  • one forcing at least $n-1$ distinct span-expansion operations,
  • one forcing at least $n-1$ distinct depth-relevant operations,

and observe that these charges cannot exceed the combined resource $c + d$.

Thus,

$$ \boxed{c + d \ge 2n - 2.} $$