Toffoli/CCNOT GateToffoli/CCNOT Gate
Definition
The following vector-valued Boolean function is called a Toffoli gate.
T:{0,1}3→{0,1}3
T(a,b,c)=(a,b,(a∧b)⊕c)
- The CCNOT gate is also known as.
Description
In the Toffoli gate, if the first two inputs are both 1, the third input is inverted. In all other cases, the input and output are the same. The specific calculation is as follows.
T(0,0,0)T(0,0,1)T(0,1,0)T(0,1,1)T(1,0,0)T(1,0,1)T(1,1,0)T(1,1,1)=(0,0,(0∧0)⊕0)=(0,0,0⊕0)=(0,0,0)=(0,0,(0∧0)⊕1)=(0,0,0⊕1)=(0,0,1)=(0,1,(0∧1)⊕0)=(0,1,0⊕0)=(0,1,0)=(0,1,(0∧1)⊕1)=(0,1,0⊕1)=(0,1,1)=(1,0,(1∧0)⊕0)=(1,0,0⊕0)=(1,0,0)=(1,0,(1∧0)⊕1)=(1,0,0⊕1)=(1,0,1)=(1,1,(1∧1)⊕0)=(1,1,1⊕0)=(1,1,1)=(1,1,(1∧1)⊕1)=(1,1,1⊕1)=(1,1,0)
From the table above, it’s easy to see that T is a reversible function and that applying T twice composes to an identity function.
Id=T∘T
Furthermore, since {T} is functionally complete, T is a universal gate.
부울 함수 | 기호 | 진리표 |
T |  | 입력 | 출력 | a | b | c | a | b | (a∧b)⊕c | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
|
Theorem
(Assuming unrestricted use of projection and injection), the Toffoli gate T is a universal gate. In other words, {T} is functionally complete.
Proof
Theorem
If duplication functions are allowed, {↑} is functionally complete. In other words, the NAND gate ↑ is a universal gate.
According to the theorem above, showing that projection, injection, and T can be used appropriately to express the duplication function cl and the NAND gate completes the proof.
Duplication Function
cl=p1∘T∘2∘1
Holds. First, calculating T∘2∘1(a) gives the following.
T∘2∘1(a)=T∘2(a,1)=T(a,1,0)
Here, if a=1, then T(1,1,0)=(1,1,1); if a=0, then T(0,1,0)=(0,1,0), so the following holds.
T(a,1,0)=(a,1,a)
Therefore, by taking p1,
p1∘T∘2∘1(a)=p1(a,1,a)=(a,a)=cl(a)
NAND Gate
p0∘p1∘T∘2=↑p0∘p1∘T∘2(a,b)=a↑b
Holds. Calculating in order gives the following.
p0∘p1∘T∘2(a,b)=p0∘p1∘T(a,b,1)=p0∘p1(a,b,(a∧b)⊕1)=p0(a,(a∧b)⊕1)=(a∧b)⊕1=¬(a∧b)=a↑b
The last line holds due to the properties of the XOR gate.
■