# How can you convert the depth of a boolean circuit to its size?

I know that the depth of a circuit is the maximal length from an input gate to the output gate of the circuit and its size is its number of gates.

Is there a formula that you can go from depth to size and can someone explain the steps?

• No formula, but depending on the Fan-in and Fan-out of your gates you can give a bound May 13, 2021 at 21:18

First of all, there are several types of (Boolean) circuits:

• Circuits with unbounded fan-in. These are circuits with AND, OR, and NOT gates, where the AND and OR gates can have arbitrarily many inputs.
• Circuits with bounded fan-in. These are circuits with AND, OR, and NOT gates, where the AND and OR gates have exactly two inputs.
• Formulas, which are circuits with bounded fan-in and fan-out. You can think of formulas either as expressions using the operators binary AND, binary OR, and unary NOT, or as circuits with AND, OR, and NOT gates, where the AND and OR gates have exactly two inputs, and the output of each gate is used only once.

(There are even more types of circuits. For example, we could vary the set of gates. But such circuits are less commonly encountered.)

For circuits with unbounded fan-in, not much can be said about the relation between depth and side, since there are depth 1 circuits of arbitrary size.

For circuits with bounded fan-in, we can say that a circuit of depth $$d$$ has size at most roughly $$2^d$$. It also has size at least roughly $$d$$. Both of these are tight: a circuit whose shape is a depth $$d$$ complete binary tree and whose gates are AND computes the AND of $$2^d$$ inputs in depth $$d$$ and size roughly $$2^d$$, and in contrast, you can construct a "path" (a tree where the left child of every internal node is a leaf) which computes the AND of $$d$$ inputs in size and depth both roughly $$d$$.

For formulas you cannot improve on these relations, but you can there is another important property: a formula of size $$s$$ can always be converted to a formula of size $$s^{O(1)}$$ and depth $$O(\log s)$$, an operation we call balancing. It is conjectured that the same cannot be said for circuits (this is one interpretation of the $$\mathsf{NC^1}$$ vs $$\mathsf{P}$$ question), though every circuit of size $$s$$ can be converted to depth $$s/\log s$$.

• Thank you that is very clear and really helpful! May 14, 2021 at 7:02