text
stringlengths
0
8.13M
0 1 0 1 1 0
1 0 0 1 1 0
1 1 1 1 0 0
The NOT gate simply flips 0 to 1 and 1 to 0.
13ThisissometimescodedintermsofaFANOUTgate,seebelow.
38
x NOT x
0 1
1 0
Apart from the logical gates one also needs the FANOUT gate. It is not
reallyalogicgatebutjustasplittingoffofawireintoseveralwires,allcarrying
the same bit as the original wire. Electrically this is in fact just a splitting
off of a wire, although in practice, since in real wires there are small currents
flowing, one might get problems with the voltage levels at the outputs if a gate
is drained to heavily. There are therefore limits on maximum fanout for real
electronic gates.
x
x
x
x
x
"fanout"
Figure 2.3: The fanout gate.
Below,wegivejustonexampleofasimplecircuit,thehalf-adder,whichcan
be used as a building block in a circuit for binary addition.
x
carry
x + y mod 2
y
Figure 2.4: A half-adder circuit.
One further concept is the ancilla or auxiliary (work) bit. It is a fixed bit,
set to 0 or 1 once and for all. Physically this is realized by a fixed voltage.
Asiswellknown,thereisacompleteisomorphismbetweenthecircuitmodel
and Boolean algebra and the functions computed by a circuit are often called
Boolean functions. In fact the easiest way to analyze a circuit is using Boolean
39
algebra. There is also a very close correspondence with propositional logic,
although in logic the focus is different.14
Note thatthereisno computationalsteps involvedhereapartfromthe time
it takes for the basic circuit elements to compute the outputs from the inputs.
For real physical devices this time is of the order of nanoseconds. Apart from
this time lag, the outputs appears as soon as the inputs are applied.
2.4.1 The circuit model and non-computable functions
We will now prove that there are circuits to compute any function
f : 0,1 k 0,1 l. The proof uses induction over the number of input bits.
{ } →{ }
Theorem
Every function f : 0,1 k 0,1 l has a circuit that computes it.
{ } →{ }
Proof
Firstnotethatitsufficestoprovetheassertionforfunctionsf : 0,1 k 0,1
{ } →{ }
asthe l-bitoutputcaseis easilyputtogetherfroml 1-bitoutputfunctions. For
k =0 there is nothing to prove. For k =1 there are four possible functions:
1. The identity. A circuit consisting of a single wire computes this function.
2. The bit flip. This function is computed by a NOT gate.
3. The constantfunction with output 0. This is computed by anAND gate
with one input bit taken to be an ancilla bit equal to 0.
4. The constant function with output 1. This is computed by an OR gate
with one input bit taken to be an ancilla bit equal to 1.
For the induction step, assume the assertion true for k = n . Now let f be
a function of n+1 bits. Define n bit functions f and f
0 1
f (x ,...,x )=f(0,x ,...,x )
0 1 n 1 n
f (x ,...,x )=f(1,x ,...,x )
1 1 n 1 n
These are both n-bit functions and are therefore computed by circuits. The
function f is now computed by the circuit implementing the formula
f(x ,x ,...,x )=(x ANDf (x ,...,x ))XOR((NOTx )ANDf (x ,...,x ))
0 1 n 0 0 1 n 0 1 1 n
or using the more convenient Boolean algebra notation
f(x ,x ,...,x )=(x f (x ,...,x )) ( x f (x ,...,x ))
0 1 n 0 0 1 n 0 1 1 n
∧ ⊕ ¬ ∧
14In propositional logic the focus is on the logically true propositions and the notion of
completeness, i.e. the question of whether the logically true, and only the logically true
propositionscanbederivedwithinthesystem. Thisquestionhassincelongbeensettled.
40
. The result now follows by induction.
So, using gates and wires,any function f : 0,1 k 0,1 l whatsoevercan
{ } →{ }
be computed. This does not, however, mean that any function f : N N
canbe effectively computedusing circuits. That wouldruncounter to the well-
establishedfact thatthere arenon-computablefunctions. This is aninteresting
pointthatwewillexamineinsomedetail. Supposewewanttocomputeasimple
function like f(x)=x2 for all values of the argument. No single circuit can do
this,asitisimmediatelyclearthattheinputmustberepresentedintheformof
a bit string, or a binary number, and eachbit must be carried by a single wire.
So a 2-bitinput circuit cancalculate the function forat mostthe numbers 0,1,
2,3. A3-bitinputcircuitmanagesthe numbers0through7. Sowhatwereally
need in order to compute the square function is a enumerable infinite family of
circuits. Let us make this notion precise.
Consistent circuit families
Aconsistentcircuitfamilyconsistsofdenumerablyinfinitesetofcircuits C
n }∞n=0
{
with the properties
1. The circuit C has n input bits and a finite number of extra ancilla bits