Circuit (computer science)

From HandWiki
Short description: Model of computation

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.

Formal definition

A circuit is a triple [math]\displaystyle{ (M, L, G) }[/math], where

  • [math]\displaystyle{ M }[/math] is a set of values,
  • [math]\displaystyle{ L }[/math] is a set of gate labels, each of which is a function from [math]\displaystyle{ M^{i} }[/math] to [math]\displaystyle{ M }[/math] for some non-negative integer [math]\displaystyle{ i }[/math] (where [math]\displaystyle{ i }[/math] represents the number of inputs to the gate), and
  • [math]\displaystyle{ G }[/math] is a labelled directed acyclic graph with labels from [math]\displaystyle{ L }[/math].

The vertices of the graph are called gates. For each gate [math]\displaystyle{ g }[/math] of in-degree [math]\displaystyle{ i }[/math], the gate [math]\displaystyle{ g }[/math] can be labeled by an element [math]\displaystyle{ \ell }[/math] of [math]\displaystyle{ L }[/math] if and only if [math]\displaystyle{ \ell }[/math] is defined on [math]\displaystyle{ M^{i}. }[/math]

Terminology

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 [math]\displaystyle{ g }[/math] to gate [math]\displaystyle{ h }[/math] in the graph [math]\displaystyle{ G }[/math] then [math]\displaystyle{ h }[/math] is called a child of [math]\displaystyle{ g }[/math]. We suppose there is an order on the vertices of the graph, so we can speak of the [math]\displaystyle{ k }[/math]th child of a gate when [math]\displaystyle{ k }[/math] is less than the out-degree of the gate.

The size of a circuit is the number of nodes of a circuit. The depth of a gate [math]\displaystyle{ g }[/math] is the length of the longest path in [math]\displaystyle{ G }[/math] beginning at [math]\displaystyle{ g }[/math] up to an output gate. In particular, the gates of out-degree 0 are the only gates of depth 1. The depth of a circuit is the maximum depth of any gate.

Level [math]\displaystyle{ i }[/math] is the set of all gates of depth [math]\displaystyle{ i }[/math]. A levelled circuit is a circuit in which the edges to gates of depth [math]\displaystyle{ i }[/math] comes only from gates of depth [math]\displaystyle{ i + 1 }[/math] or from the inputs. In other words, edges only exist between adjacent levels of the circuit. The width of a levelled circuit is the maximum size of any level.

Evaluation

The exact value [math]\displaystyle{ V(g) }[/math] of a gate [math]\displaystyle{ g }[/math] with in-degree [math]\displaystyle{ i }[/math] and label [math]\displaystyle{ l }[/math] is defined recursively for all gates [math]\displaystyle{ g }[/math].

[math]\displaystyle{ V(g) = \begin{cases} l & \text{if } g \text{ is an input} \\ l(V(g_1), \dotsc, V(g_i)) & \text{otherwise,} \end{cases} }[/math]

where each [math]\displaystyle{ g_j }[/math] is a parent of [math]\displaystyle{ g }[/math].

The value of the circuit is the value of each of the output gates.

Circuits as functions

The labels of the leaves can also be variables which take values in [math]\displaystyle{ M }[/math]. If there are [math]\displaystyle{ n }[/math] leaves, then the circuit can be seen as a function from [math]\displaystyle{ M^{n} }[/math] to [math]\displaystyle{ M }[/math]. It is then usual to consider a family of circuits [math]\displaystyle{ (C_n)_{n\in\mathbb{N}} }[/math], a sequence of circuits indexed by the integers where the circuit [math]\displaystyle{ C_n }[/math] has [math]\displaystyle{ n }[/math] variables. Families of circuits can thus be seen as functions from [math]\displaystyle{ M^{*} }[/math] to [math]\displaystyle{ M }[/math].

The notions of size, depth and width can be naturally extended to families of functions, becoming functions from [math]\displaystyle{ \mathbb{N} }[/math] to [math]\displaystyle{ \mathbb{N} }[/math]; for example, [math]\displaystyle{ size(n) }[/math] is the size of the [math]\displaystyle{ n }[/math]th circuit of the family.

Complexity and algorithmic problems

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.

See also

References