Fredkin gate
The Fredkin gate (also CSWAP gate) is a computational circuit suitable for reversible computing, invented by Edward Fredkin. It is universal, which means that any logical or arithmetic operation can be constructed entirely of Fredkin gates. The Fredkin gate is a circuit or device with three inputs and three outputs that transmits the first bit unchanged and swaps the last two bits if, and only if, the first bit is 1.
Contents
Definition[edit]
The basic Fredkin gate^{[1]} is a controlled swap gate that maps three inputs (C, I_{1}, I_{2}) onto three outputs (C, O_{1}, O_{2}). The C input is mapped directly to the C output. If C = 0, no swap is performed; I_{1} maps to O_{1}, and I_{2} maps to O_{2}. Otherwise, the two outputs are swapped so that I_{1} maps to O_{2}, and I_{2} maps to O_{1}. It is easy to see that this circuit is reversible, i.e., "undoes" itself when run backwards. A generalized n×n Fredkin gate passes its first n2 inputs unchanged to the corresponding outputs, and swaps its last two outputs if and only if the first n2 inputs are all 1.
The Fredkin gate is the reversible threebit gate that swaps the last two bits if, and only if, the first bit is 1.
Truth table  Permutation matrix form  



It has the useful property that the numbers of 0s and 1s are conserved throughout, which in the billiard ball model means the same number of balls are output as input. This corresponds nicely to the conservation of mass in physics, and helps to show that the model is not wasteful.
Truth functions with AND, OR, XOR, and NOT[edit]
The Fredkin gate can be defined using truth functions with AND, OR, XOR, and NOT, as follows:
 O_{1} = I_{1} XOR S
 O_{2} = I_{2} XOR S
 C_{out}= C_{in}
where S = (I_{1} XOR I_{2}) AND C
Alternatively:
 O_{1} = (NOT C AND I_{1}) OR (C AND I_{2})
 O_{2} = (C AND I_{1}) OR (NOT C AND I_{2})
 C_{out}= C_{in}
Completeness[edit]
One way to see that the Fredkin gate is universal is to observe that it can be used to implement AND, NOT and OR:
 If I_{2} = 0, then O_{2} = C AND I_{1}.
 If I_{2} = 1, then O_{1} = C OR I_{1}.
 If I_{1} = 0 and I_{2} = 1, then O_{2} = NOT C.
Example[edit]
Threebit full adder (add with carry) using five Fredkin gates. The "g" garbage output bit is (p NOR q) if r=0, and (p NAND q) if r=1.
Inputs on the left, including two constants, go through three gates to quickly determine the parity. The 0 and 1 bits swap places for each input bit that is set, resulting in parity bit on the 4th row and inverse of parity on 5th row.
Then the carry row and the inverse parity row swap if the parity bit is set and swap again if one of the p or q input bits are set (it doesn't matter which is used) and the resulting carry output appears on the 3rd row.
The p and q inputs are only used as gate controls so they appear unchanged in the output.
Quantum Fredkin gate[edit]
On March 25, 2016, researchers from Griffith University and the University of Queensland announced they had built a quantum Fredkin gate that uses the quantum entanglement of particles of light to swap qubits. The availability of quantum Fredkin gates may facilitate the construction of quantum computers.^{[2]}^{[3]}
See also[edit]
 Quantum computing
 Quantum gate
 Quantum programming
 Toffoli gate, which is a controlledcontrolledNOT gate.
References[edit]
 ^ Brown, Julian, The Quest for the Quantum Computer, New York : Touchstone, 2000.
 ^ http://www.pcworld.com/article/3048763/hardware/quantumcomputingisnowabigstepcloserthankstothisnewbreakthrough.html
 ^ A quantum Fredkin gate Raj B. Patel, Joseph Ho, Franck Ferreyrol, Timothy C. Ralph and Geoff J. Pryde, Science Advances, 25 Mar 2016, Vol. 2, no. 3, e1501531, DOI: 10.1126/sciadv.1501531
Further reading[edit]
 Fredkin, Edward; Toffoli, Tommaso (1982). "Conservative Logic" (PDF). International Journal of Theoretical Physics. 21 (3–4): 219–253. doi:10.1007/BF01857727. Archived from the original (PDF) on October 17, 2006.