smartyfy.mrindigi.com

Quantum Computing Master Course — 053. Reversible Computing

Lesson 053: Reversible Computing

Smartyfy Quantum Computing Master Course

Prerequisites and objectives

Quantum gates evolve closed-system states unitarily, so their action is invertible. Many familiar Boolean functions, such as AND, discard information when viewed only as input-to-output maps. You will embed such functions into reversible transformations, prove that the embedding is unitary, and see how it acts coherently on superpositions without becoming a universal cloning operation.

Reversible computing is also a classical subject. A reversible Boolean operation permutes bit strings. Interpreting its permutation matrix as a quantum gate lets the same operation act on arbitrary amplitude combinations. The quantum use adds coherence requirements beyond correct basis-state outputs.

Why a many-to-one map cannot be a unitary

The ordinary AND function maps 00,01,10 to zero and 11 to one. If a proposed quantum operation sent three orthogonal input basis states to the same output vector while keeping no other record, their pairwise overlaps would change from zero to one.

A unitary preserves inner products and cannot do this. There is also a dimension mismatch between a two-qubit input and a one-qubit output when no environment is retained. Simply writing |a,b⟩ → |a AND b⟩ is therefore not a complete unitary specification.

Physical devices can reset, measure, or discard systems, but their full description involves an environment or classical record. Such open-system operations are useful; they are not interchangeable with a coherent reversible subroutine inside a larger quantum circuit.

Retain the input and update a target

For a Boolean function f from n-bit strings to m-bit strings, introduce an m-bit target y and define Uf|x,y⟩ = |x,y ⊕ f(x)⟩. The symbol ⊕ means bitwise XOR: add each pair of bits modulo two, without carrying.

The input x is retained. The target is updated rather than overwritten. Starting it at zero gives |x,0⟩ → |x,f(x)⟩, which exposes the desired function value while preserving enough information for reversibility.

Apply the same transformation twice: y becomes y ⊕ f(x) ⊕ f(x) = y. Thus Uf² = I. Every basis string has a unique image and a unique preimage, so the map is a permutation and its linear extension is unitary.

This argument proves the mathematical embedding exists for every finite function table. It does not prove the corresponding circuit is efficient. A function with a complicated description may require a large implementation; an oracle model can hide that implementation cost unless it is stated separately.

Registers x and y pass through U_f, retaining x and updating the target to y XOR f(x). A second identical block restores x and y because the two copies of f(x) cancel under XOR. The clean-target rule is |x,0⟩ to |x,f(x)⟩. The diagram distinguishes coherent function evaluation from reading out every function value at once.
Retaining the input and updating rather than overwriting the target preserves reversibility, even when f itself is many-to-one. Open full-size diagram

Worked example with an irreversible function

Let x = (a,b) and f(x) = a AND b. For a target c, the reversible map is |a,b,c⟩ → |a,b,c ⊕ ab⟩. If a = b = 1, c flips; otherwise it stays unchanged. This is the Toffoli operation studied in the next lesson.

With c = 0, inputs 000,010,100,110 map to 000,010,100,111. Although three inputs produce AND value zero, their retained a,b labels remain different. No information collision occurs in the full three-qubit register.

If the target initially equals one, the output is the complement of ab. For example, 111 maps to 110. This case is essential to specifying a full unitary: describing only the clean-target inputs leaves half of its basis action unspecified.

Linearity gives coherent function evaluation

For an input superposition Σx αx|x⟩ and a zero target, Uf produces Σx αx|x,f(x)⟩. The same basis rule is applied linearly, preserving the amplitudes and their relative phases. This does not provide a classical list of every f(x) in one measurement.

If the output register is measured, it returns one function value with the probability determined by the relevant amplitudes. Inputs that share a value belong to the corresponding conditional branch. Extracting all values generally requires more work and a different output specification.

The value register can become entangled with the input. For the one-bit function f(x) = x and input |+⟩ with a blank target, the output is Φ+. This is the same CNOT example that failed as a universal cloner: coherent label copying creates correlations, not two independent plus states.

Worked superposition through the AND embedding

Prepare a,b in |++⟩ and c in |0⟩. The input is (|000⟩ + |010⟩ + |100⟩ + |110⟩)/2. After the reversible AND, the final term becomes |111⟩ while the other three remain unchanged.

Measuring c gives one with probability one quarter. That branch leaves a,b in |11⟩. Outcome zero has probability three quarters and leaves their normalized conditional state (|00⟩ + |01⟩ + |10⟩)/√3.

It would be incorrect to replace this output by a target with amplitudes √3/2 and 1/2 tensored with the original input. The target is correlated with different input subspaces; a product replacement would erase those correlations and change subsequent interference.

Workspace, garbage, and clean interfaces

A practical reversible implementation may use extra ancillas to store intermediate calculations. Some finish with input-dependent values called garbage. This term means the values are not requested outputs, not that they can be discarded without affecting the remaining coherent state.

If the workspace is entangled with the input, ignoring it can remove coherence needed by later gates. A clean subroutine aims to restore temporary ancillas to their known starting state while retaining the desired output. Lesson 055 derives the compute, copy, uncompute method for doing this.

The word copy in that method refers to computational-basis output labels under a linear reversible operation. It must not be reinterpreted as cloning an arbitrary unknown quantum state. Keeping the basis-state specification visible makes that distinction precise.

Logical reversibility and physical costs

An invertible truth table is a statement about logical information flow. It does not imply a practical gate consumes zero energy, takes zero time, or has no noise. Physical implementation and thermodynamic analysis require additional assumptions.

Similarly, a reset can prepare a clean ancilla for another task but is generally not a substitute for uncomputing correlated workspace during a coherent computation. The right operation depends on what information the larger algorithm must preserve, not simply on whether a register looks unused.

Four exercises with worked solutions

  1. For f(0)=1 and f(1)=0, list Uf on the two-qubit basis 00,01,10,11.

    Solution. With x first and y second, the outputs are 01,00,10,11. The target flips exactly when x=0. Applying this permutation twice returns each input.

  2. For f(x)=x and input |−⟩|0⟩, calculate the output.

    Solution. Linearity gives (|00⟩ − |11⟩)/√2. It is an entangled Bell state, not |−⟩|−⟩. The relative minus sign is preserved in the coherent correlation.

  3. Why does |x,0⟩ → |x,f(x)⟩ alone not specify an entire unitary?

    Solution. It defines only basis states whose target is zero. Other target values still need an action consistent with orthonormal outputs. The XOR construction supplies such a complete extension.

  4. In the uniform two-bit AND example, find P(a=1 given c=0).

    Solution. The c=0 branch has equally weighted input labels 00,01,10. Exactly one has a=1, so the conditional probability is one third. This follows from the normalized branch, not from the original unconditioned input marginal.

Five explained multiple-choice questions

  1. The reversible embedding preserves: A. Only the target’s original value. B. The input x while XOR-updating y. C. Only the function value. D. No input information.

    Answer: B. Retaining x makes the many-to-one function compatible with an invertible joint transformation.

  2. Applying Uf twice gives: A. A measurement. B. A clone. C. The zero vector. D. The identity.

    Answer: D. XOR with the same bit string twice cancels.

  3. A permutation of an orthonormal basis extends to: A. A unitary linear operation. B. An irreversible reset only. C. A list of probabilities. D. An arbitrary nonlinear map.

    Answer: A. Its columns remain an orthonormal basis.

  4. Coherent evaluation provides all values as a readable list in one shot: A. If the target starts at zero. B. For every function. C. No; measurement and output requirements still apply. D. Whenever n is large.

    Answer: C. Correlated amplitudes are not simultaneously accessible classical records.

  5. Input-dependent garbage can affect later computation because it: A. Can always be measured away without affecting coherence. B. Is physically equivalent to a common global phase. C. Is independent of the input in every reversible circuit. D. Can remain entangled with the useful registers.

    Answer: D. Ignoring correlated workspace can remove useful coherence.

Pitfalls and summary

Specify the action on every basis input, retain the information needed for an inverse, and count workspace. The XOR embedding turns any finite classical function into a valid coherent operation, while efficiency, output accessibility, and garbage cleanup remain separate questions.

Primary sources and further study

These sources support the definitions and context. The numerical examples, exercises, and explanations here were prepared for this lesson. Research papers are optional advanced reading.