computation 이란, 요구사항인 function 을 컴퓨터가 실제로 수행할 수 있도록 만든 구현체이다.
computation 을 구현하려면 다음 2가지 중에 하나를 하면 된다.
Circuit 이라 하면 AND / OR / NOT 게이트를 가진 Boolean circuit 을 말한다.
프로그램 또한 AND / OR / NOT 연산자로 이루어진 AON-CIRC 프로그램을 말한다.
재밌는 점은 NAND 한개만 있으면, AND / OR / NOT 3가지를 전부 표현 가능하다는 점이다.
그러므로 NAND Circuit 회로도를 작성하거나,
NAND-CIR 프로그램을 코드로 작성하는게 computation 을 구현하는 가장 일반적인 방법이라 할 수 있다.
또한, Circuit 을 구현하는데 필요한 gate 의 숫자와, 프로그램을 구현하는데 필요한 코드 줄 수가 동일하다.
아래 증명은 Circuit 이나 프로그램이나, 그게 그거라는 것을 증명으로 보인 것이다.
and
DAG : directed acyclic graph
A Boolean circuit with s gates, n inputs, and m outputs
is a labeled DAG with vertices.
size of a Boolean circuit = number of gates = s
is a function.
is a Boolean circuit with inputs and outputs.
is a AON-CIRC program of s lines with n inputs and m outputs.
computes if for
computes if for
and
: Boolean circuit with gates, inputs and outputs
: AON-CIRC program of lines with inputs and outputs
f is computable by f is computable by
(i) f is computable by f is computable by
pf
If operator of -th of P has the form "foo = AND(bar,blah)"
then the -th gate in the circuit will be an AND gate
that is connected to gates and
where and correspond to the last lines before
where the variables "bar" and "blah" were written to.
If either "bar" or "blah" is an input variable then we connect the gate to the corresponding input vertex instead.
If "foo" is an output variable, then we add the same label to the corresponding gate to mark it as an output gate.
Do the same for OR and NOT operation.
for .
(ii) f is computable by f is computable by
pf
: sorted the gates according to a topological order.
Create program of lines as follows. \medskip
If is an AND gate with in-neighbors ,
then we will add a line to of the form " = AND(, )"
Because we work in topological ordering, we are guaranteed that the in-neighbors and correspond to variables that have already been assigned a value.
Do the same for OR and NOT gates.
for .
AND, OR, and NOT can be computed only by composing NAND functions.
NOT(a) = NOT(AND(a,a)) = NAND(a,a)
AND(a,b) = NOT(NOT(AND(a,b))) = NOT(NAND(a,b))
OR(a,b) = NOT(AND(NOT(a),NOT(b)))
and
: NAND circuit with gates, inputs and outputs
: NAND-CIRC program of lines with inputs and outputs
f is computable by f is computable by
From Theorem 3.9,
f is computable by Boolean circuit f is computable by AON-CIRC program
From Theorem 3.10,
f is computable by NAND circuit f is computable by Boolean circuit
f is computable by NAND program f is computable by AON-CIRC program
f is computable by NAND circuit f is computable by NAND program.