In theoretical computer science, a circuit is a model of computation in which input values proceed through a sequence of gates, each of which computes a function. Circuits of this kind provide a generalization of Boolean circuits and a mathematical model for digital logic circuits. Circuits are defined by the gates they contain and the values the gates can produce. For example, the values in a Boolean circuit are boolean values, and the circuit includes conjunction, disjunction, and negation gates. The values in an integer circuit are sets of integers and the gates compute set union, set intersection, and set complement, as well as the arithmetic operations addition and multiplication.
A circuit is a triplet
(M,L,G)
M
L
Mi
M
i
i
G
L
The vertices of the graph are called gates. For each gate
g
i
g
\ell
L
\ell
Mi.
The gates of in-degree 0 are called inputs or leaves. The gates of out-degree 0 are called outputs. If there is an edge from gate
g
h
G
h
g
k
k
The size of a circuit is the number of nodes of a circuit. The depth of a gate
g
G
g
Level
i
i
i
i+1
The exact value
V(g)
g
i
l
g
V(g)=\begin{cases} l&ifgisaninput\\ l(V(g1),...c,V(gi))&otherwise, \end{cases}
gj
g
The value of the circuit is the value of each of the output gates.
The labels of the leaves can also be variables which take values in
M
n
Mn
M
(Cn)n\inN
Cn
n
M*
M
The notions of size, depth and width can be naturally extended to families of functions, becoming functions from
N
N
size(n)
n
Computing the output of a given Boolean circuit on a specific input is a P-complete problem. If the input is an integer circuit, however, it is unknown whether this problem is decidable.
Circuit complexity attempts to classify Boolean functions with respect to the size or depth of circuits that can compute them.