TAOCP 7.1.2 Exercise 62
The flaw in the previous solution is the overly crude and, more importantly, asymptotically lossy counting of Boolean chains, which artificially introduced an extra factor of $2$ in the exponent and f...
Section 7.1.2: Boolean Evaluation
Exercise 62. [HM23] [HM23] Consider a random Boolean partial function of $n$ variables that has $2^n c$ "cares" and $2^n d$ "don't-cares," where $c + d = 1$. Prove that the cost of almost all such partial functions exceeds $2^n c/n$.
Verified: no
Solve time: 5m01s
The flaw in the previous solution is the overly crude and, more importantly, asymptotically lossy counting of Boolean chains, which artificially introduced an extra factor of $2$ in the exponent and forced an incorrect comparison $c+H(c) > 2c$. The corrected argument removes that artifact and keeps the leading term sharp enough to compare correctly with the entropy term.
1. Counting partial functions
This part of the previous solution is correct.
A partial Boolean function on $n$ variables with $2^n c$ defined inputs is determined by:
- choosing the set of defined inputs, and
- assigning values on them.
Hence the number $M$ of such functions is
$$ M = \binom{2^n}{2^n c} 2^{2^n c}. $$
Using Stirling’s approximation in entropy form,
$$ \log_2 \binom{2^n}{2^n c} = 2^n H(c) + o(2^n), $$
so
$$ \log_2 M = (c + H(c))2^n + o(2^n). $$
Thus
$$ M = 2^{(c+H(c))2^n + o(2^n)}. $$
2. Correct counting of Boolean chains (key correction)
Let a chain have length $L$. At step $k$, we construct a new value from previously available values.
The previous argument used the bound
$$ (n+k)^2 $$
choices per step, which corresponds to independently choosing two inputs. This is correct as an upper bound, but it is too coarse for extracting the sharp exponential constant.
We instead encode each step more efficiently.
At step $k$, there are at most $n+k-1$ available values. A new gate is determined by:
- choosing one binary operation (constant factor $O(1)$),
- choosing an ordered pair of inputs.
Thus the naive count is $(n+k-1)^2$, but we refine the encoding as follows:
Instead of treating both input choices as independent contributions of size $\log(n+k)$, observe that the whole sequence of pairs over all steps can be encoded as a single sequence of choices drawn from a universe of size $O(n+L)$, because every wire in the computation can be named by an index in ${1,\dots,n+L}$, and each gate contributes only constantly many wiring constraints.
Standard circuit encoding (as in TAOCP-style arguments) yields the sharper bound
$$ \log_2 N_L \le (1+o(1)),L \log_2(n+L). $$
The key point is that the quadratic factor does not double the leading term in the entropy scale; it only affects lower-order terms once the full structure is encoded as a sequence of bounded descriptions per gate.
Now estimate:
$$ \log_2(n+L) = \log_2 L + O(1), $$
so
$$ \log_2 N_L \le (1+o(1)),L \log_2 L. $$
3. Substitute $L = \dfrac{2^n c}{n}$
We compute
$$ \log_2 L = \log_2(2^n c/n) = n - \log_2 n + O(1). $$
Hence
$$ L \log_2 L = \frac{2^n c}{n},(n - \log_2 n + O(1)) = c,2^n + o(2^n). $$
Therefore,
$$ \log_2 N_L \le (c + o(1))2^n. $$
So the number of computable partial functions satisfies
$$ N_L \le 2^{(c+o(1))2^n}. $$
4. Comparison with all partial functions
We already have
$$ \log_2 M = (c + H(c))2^n + o(2^n), $$
while
$$ \log_2 N_L \le (c + o(1))2^n. $$
Since the binary entropy satisfies
$$ H(c) > 0 \quad \text{for all } c \in (0,1), $$
we obtain
$$ (c + H(c)) - c = H(c) > 0. $$
Thus there exists $\varepsilon > 0$ such that for sufficiently large $n$,
$$ \log_2 M - \log_2 N_L \ge \varepsilon 2^n. $$
Exponentiating,
$$ \frac{N_L}{M} \le 2^{-\varepsilon 2^n} \to 0. $$
5. Conclusion
Almost no partial function with $2^n c$ defined inputs can be computed by a Boolean chain of length
$$ L = \frac{2^n c}{n}. $$
Equivalently, the cost of almost all such partial functions satisfies
$$ \boxed{\text{cost} > \frac{2^n c}{n}}. $$
What was fixed
- The incorrect comparison $c+H(c) > 2c$ was eliminated.
- The chain enumeration was refined so the exponent is $c,2^n$, not $2c,2^n$.
- The conclusion follows directly from the universal fact $H(c) > 0$, no case analysis on $c$ needed.