
2 minute read
Reversible Computation
By: Ammar Abushukur Energy
Energy is king, it rules us all, and it determines what things we can afford to do and what we cannot. Computation is not exempt from energy limitations, which is the general form of money. Scientists are constantly working on making computers more and more efficient, and every joule matters. However, what if I told you that there is a minimum amount of energy that computers will always dissipate regardless of what scientists do?
Advertisement
Landauer's Limit
In 1961, physicist Rolf Landauer, working at IBM, applied the laws of thermodynamics to computers and information theory. He argued that for every irreversible operation done, you must dissipate a minimum amount of energy, called Landauer's limit. This loss was not due to inefficiencies in the design of computers. But rather a limitation of the mode of computation we use, namely irreversible computation.
Irreversible computation
Our computers are built using irreversible gates, but what does that mean? Take the AND gate; it takes in two inputs and produces one output, representing the logical ANDing of the two inputs. Here is the truth table of the AND gate:
Now, if we have an output of 0 from an AND gate, can you tell me what the input was? There are three possibilities, so we can’t deterministically go from outputs to inputs. Thus making the model irreversible, and the same applies to OR gates. There is a loss of information from inputs to outputs dissipating energy in the process, but what if we don’t have to use irreversible gates to build our computers?
Reversible computation
Reversible computation is described as a computational model in which the process is time-reversible; it allows you to go from inputs to outputs and the other way back. Landauer's limit does not apply to reversible computation; reversible computers are limitless and can be as efficient as possible. Many reversible gates have been devised. We will discuss two of them.
1) CNOT gate: CNOT gate, or controlled not gate, is a logic gate that takes in two inputs and produces two outputs. One input is called the control input. If the control input is 1, then the gate flips the second input. If the control input is 0, the gate leaves the second input intact. The control input is left as it is.
If I give you the outputs, can you determine the inputs? CNOT gate is f(x, y) = (x, x y), where x is the control input and is XOR.
2) Toffoli gate: This gate has three inputs and three outputs. The first two inputs are control inputs. If both control inputs are 1, the third input is flipped. Otherwise, it is left intact. The control inputs pass the gate unchanged. Here is the truth table for this gate:
Again, you can determine the inputs by looking at the outputs alone. Toffoli gate is given by: f(x, y, z) = (x, y, (x ^ y) z), where x and y are control inputs, ^ is AND and is XOR.
We can build AND gate using Toffoli gate by passing 0 as the third input: f(x, y, 0) = (x, y, (x ^ y) 0) = (x, y, (x ^ y)). The resulting outputs are x, y, and x ^ y, which is x AND y, so we successfully built AND gate using a reversible gate. We can build the NAND gate using the Toffoli gate, which will make the Toffoli universal gate. I will leave it as a challenge for you to try.
Reversible Programming Languages
Finally, to build a fully functional reversible computer, we need the entire process to be reversible, from the logic gates, up to the high-level programming languages. For this, reversible programming languages like Janus have been devised. You can visit their website at Program Inversion and Reversible Computation (diku.dk)