Reversible circuits with Janus
Run a circuit forward. Then watch it unwind.
call emits a circuit gate by gate. uncall walks the same Janus procedure backward, reversing both the gate order and each operation.
Quantum Fourier Transform
A number becomes phase.
Reverse it to get the number back.
QFT spreads one basis value across eight equal magnitudes. The arrows reveal where the value went: it is now stored in their relative phases.
|101⟩
Gate sequence
ready · 0 / 7q0 · LSBq1q2 · MSB
Forward circuit appears gate by gate.
Ready. Call QFT and watch the value move into relative phase.
-
|000⟩
0.000
0.000 rad -
|001⟩
0.000
0.000 rad -
|010⟩
0.000
0.000 rad -
|011⟩
0.000
0.000 rad -
|100⟩
0.000
0.000 rad -
|101⟩
0.000
0.000 rad -
|110⟩
0.000
0.000 rad -
|111⟩
0.000
0.000 rad
Call · QFT
Uncall · inverse QFT
Reversible adder
Add forward.
Subtract backward.
The gate sequence adds register a into b. Uncall reverses that exact sequence, turning the same procedure into subtraction.
5 + 11 mod 16
a · unchanged0101 · 5
b · sum · editable after call
carry · starts and ends at 00
Gate sequence
ready · 0 / 24a0a1a2a3b0b1b2b3c0 · |0⟩
Forward addition circuit appears gate by gate.
Ready. Call add to compute b = a + b mod 16.