- A boolean circuit is like a formula, but where we can reuse sub-formulas.
- Equivalently, it is well-founded diagram built from boolean gates.
- The boolean formulas are just circuits whose underlying graph is a tree.

Definition
An -input Boolean circuit is a directed acyclic graph with:
- sources (vertices with no incoming edges)
- one sink (vertex with no outgoing edges)
- a labelling from non-source vertices to (called gates)
- vertices labelled have fan-in (i.e., number of incoming edges) 1;
- vertices labelled or have fan-in 2
The size of C, written , is its number of vertices.
Example

Here is a circuit that computes the binary exclusive-or :
- has vertices with sources and sink
- has edges:
- has labelling
Computation
Since a circuit is a directed acyclic graphs (dag), given an assignment we may define the value at a note by induction on the structure of :
- ( is already defined).
- if a non-source node is labelled with with incoming edge from a node , then
- if a non-source node is labelled with incoming edges from nodes and , then
- if a non-source node is labelled with incoming edges from nodes and , then
From here, we can define the output of as just .
Example

Complexity Matters
Note that the inductive definition of βoutputβ yields a polynomial-time algorithm for evaluating circuits:
Proposition
The set of pairs where
- is an -input circuit; and
- such that is in P
In fact the βcircuit value problemβ is actually complete for P, under logspace-reduction.