Bennett's Uncompute Trick

The last lesson left reversible computing in a trap: compute anything interesting and you are stuck holding garbage bits — keep them and drown, erase them and pay Landauer's bill after all. In 1973 Charles Bennett found the exit, and it is one of the great "of course!" moves in computer science. You cannot erase the garbage — but you built the garbage with reversible gates, so you can make the circuit swallow it back. Don't wipe the scratch paper. Run the calculation backwards and un-write it.

The three-phase recipe

Suppose a reversible circuit C computes (x, 0, 0) \mapsto (x, f(x), g(x)) — answer in one register, garbage g(x) in another. Bennett's recipe wraps C in three phases, using one extra zeroed register for the final answer:

Net effect of the whole sandwich:

(x,\; 0) \;\longmapsto\; (x,\; f(x)) \qquad \text{— no garbage, nothing erased.}

Every step was a reversible gate; no bit was ever reset by force. The information that "g(x) would have destroyed" is never destroyed or stored — it is disassembled by the same machinery that assembled it, the way you strike a stage set rather than burning the theatre down.

Watching the registers

The whole trick is easiest to believe as a table of register contents. Step through it:

Why is phase 3 legal? Because phase 1 was a permutation, and permutations have inverses: C^{-1} exists and is built from the inverses of C's gates in reverse order — and since Toffoli, CNOT and NOT are each self-inverse, it is literally the same gates, read right to left. Phase 3 never touches the answer register, so the copy placed there in phase 2 sits safely outside the rewind.

The price tag, honestly itemised

Nothing in thermodynamics is free, and Bennett's trick pays in coin other than heat:

This same choreography — compute, copy out the answer, uncompute the scratch — is not just a classical curiosity: it reappears, forced by different laws, inside quantum algorithms, where leftover workspace doesn't merely cost heat but scrambles the very interference an algorithm depends on. Learn the trick once here, on honest classical bits, and the quantum version will feel inevitable.

Charles Bennett, at IBM Research, published "Logical Reversibility of Computation" in 1973 — a decade before Fredkin and Toffoli's conservative-logic paper, and years before anyone had drawn the gates this module is built from. Working at the level of Turing machines, Bennett showed that any computation can be carried out reversibly, halting with the tape holding just the input and the answer — using exactly the compute–copy–uncompute sandwich. The result rescued Landauer's principle from a gloomy corollary: without it, one could argue that computing must dissipate heat because garbage must eventually be erased. Bennett showed the escape hatch, completing the argument his IBM colleague Rolf Landauer had begun in 1961 — computation itself has no minimum energy cost; only forgetting does. The pair's ideas, hatched two office doors apart, became the twin pillars of the thermodynamics of computation.

A tempting shortcut: the workspace holds f(x) and g(x), and some other, cleverer circuit D also maps (x, f(x), g(x))-shaped states back toward zeros — so why not rewind with D instead? Because D only cleans the workspace if it inverts exactly the map that wrote it. Run anything other than C^{-1} — the same gates, reverse order, each inverted — and the workspace ends up not at 0 \cdots 0 but at some new nonzero pattern: you have not cleaned the garbage, only laundered it. Worse, a D that "zeroes the workspace regardless of its contents" is not reversible at all — that is erasure wearing a disguise, and Landauer bills it accordingly. The uncompute phase is not generic tidying; it is the precise algebraic inverse of the mess-making.