Intheoretical computer science, acircuit is amodel 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 ofBoolean circuits and a mathematical model for digitallogic circuits. Circuits are defined by the gates they contain and the values the gates can produce. For example, the values in a Boolean circuit areBoolean 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, where
The vertices of the graph are calledgates. For each gate ofin-degree, the gate can be labeled by an element of if and only if is defined on
The gates of in-degree 0 are calledinputs orleaves. The gates of out-degree 0 are calledoutputs. If there is an edge from gate to gate in the graph then is called achild of. We suppose there is an order on the vertices of the graph, so we can speak of theth child of a gate when is less than or equal to the out-degree of the gate.
Thesize of a circuit is the number of nodes of a circuit. Thedepth of a gate is the length of thelongest path in beginning at up to an output gate. In particular, the gates of out-degree 0 are the only gates of depth 1. Thedepth of a circuit is the maximum depth of any gate.
Level is the set of all gates of depth. Alevelled circuit is a circuit in which the edges to gates of depth comes only from gates of depth or from the inputs. In other words, edges only exist between adjacent levels of the circuit. Thewidth of a levelled circuit is the maximum size of any level.
The exact value of a gate with in-degree and label is defined recursively for all gates.
where each is a parent of.
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. If there are leaves, then the circuit can be seen as a function from to. It is then usual to consider a family of circuits, a sequence of circuits indexed by the integers where the circuit has variables. Families of circuits can thus be seen as functions from to.
The notions of size, depth and width can be naturally extended to families of functions, becoming functions from to; for example, is the size of theth circuit of the family.
Computing the output of a givenBoolean circuit on a specific input is aP-complete problem. If the input is aninteger circuit, however, it is unknown whether this problem isdecidable.
Circuit complexity attempts to classifyBoolean functions with respect to the size or depth of circuits that can compute them.