All you need is Tofolli gates
The Endeavour 2026-04-06
Landauer’s principle gives a lower bound on the amount of energy it takes to erase one bit of information:
E ≥ log(2) kB T
where kB is the Boltzmann constant and T is the ambient temperature in Kelvin. The lower bound applies no matter how the bit is physically stored. There is no theoretical lower limit on the energy required to carry out a reversible calculation.
In practice the energy required to erase a bit is around a billion times greater than Landauer’s lower bound. You might reasonably conclude that reversible computing isn’t practical since we’re nowhere near the Landauer limit. And yet in practice reversible circuits have been demonstrated to use less energy than conventional circuits. We’re far from the ultimate physical limit, but reversibility still provides practical efficiency gains today.
A Tofolli gate is a building block of reversible circuits. A Tofolli gate takes three bits as input and returns three bits as output:
T(a, b, c) = (a, b, c XOR (a AND b)).
In words, a Tofolli gate flips its third bit if and only if the first two bits are ones.
A Tofolli gate is its own inverse, and so it is reversible. This is easy to prove. If a = b = 1, then the third bit is flipped. Apply the Tofolli gate again flips the bit back to what it was. If ab = 0, i.e. at least one of the first two bits is zero, then the Tofolli gate doesn’t change anything.
There is a theorem that any Boolean function can be computed by a circuit made of only NAND gates. We’ll show that you can construct a NAND gate out of Tofolli gates, which shows any Boolean function can be computed by a circuit made of Tofolli gates, which shows any Boolean function can be computed reversibly.
To compute NAND, i.e. ¬ (a ∧ b), send (a, b, 1) to the Tofolli gate. The third bit of the output will contain the NAND of a and b.
T(a, b, 1) = (a, b, ¬ (a ∧ b))
A drawback of reversible computing is that you may have to send in more input than you’d like and get back more output than you’d like, as we can already see from the example above. NAND takes two input bits and returns one output bit. But the Tofolli gate simulating NAND takes three input bits and returns three output bits.