Quantum and CircuitsReading edition

A dirty scratch wire can be fully restored

Reading tools
Reading libraryFind statementsInspect Lean
Switch work

Saved reading

Read side by side

Start reading

Resources & source

Original TeX with line links · Download TeX

The wording and mathematics follow the retained manuscript. This reading format does not add a proof review or extend Lean coverage.

Skip contents and start reading

A dirty scratch wire can be fully restored

Consider the four-wire oracle in the Lean examples. First compute \(ab\) into scratch \(s\), copy \(s\) into the target, and uncompute \(s\):

\[ (a,b,s,y)\xrightarrow{T(a,b;s)}(a,b,s+ab,y) \xrightarrow{C(s;y)}(a,b,s+ab,y+s+ab) \xrightarrow{T(a,b;s)}(a,b,s,y+s+ab). \]

The displayed final expression specializes to the required oracle when the boundary scratch is zero. On the positive input \(a=b=1\), the scratch is dirty between the first and last gates.

Exact states for the accepting input, in wire order (a,b,s,y). White cells are zero; teal cells are one.
Exact states for the accepting input, in wire order \((a,b,s,y)\). White cells are zero; teal cells are one.

View full-size figure (new tab)

The two panels check both initial targets. The final target is toggled, the logical inputs are unchanged, and scratch returns to zero. A proof that used an intermediate clean-workspace assumption would fail to cover this explicit legal fixture.

This circuit uses two Toffolis. It is a useful restoration witness, not the optimal two-input AND oracle: the direct gate \(T(a,b;y)\) computes that oracle with one Toffoli and no scratch. The guide distinguishes an exact example from an optimization claim.

Exact new trace assertion imported from the source gate semantics; the same fixture is formalized by Examples.andOracle_restores.

Source and conversion record

Source SHA-256: 488075fae27e7db2e4bcee68c08f93b659a12536c807e5e419d6e8e166317763

Unsupported prose commands stop the build. The mathematical expression sequence is checked against the source, with manuscript macros expanded for display.

Conversion records

Notation in Quantum and Circuits

Look up a symbol without leaving this chapter. Select text before opening help to search for it.

Search this work’s notation.

    Symbols can have different meanings in different passages. Read each result in its own context.

    Open the full notation index