Quantum and CircuitsReading edition

Temporary nonlinearity: affine logic versus Toffoli-assisted synthesis

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

10.3 Temporary nonlinearity: affine logic versus Toffoli-assisted synthesis

10.3.1 The question

Let

\[ \operatorname{AGL}(n,2) = \{x\mapsto Ax+b:A\in{\operatorname{GL}}(n,2),\ b\in{\mathbb F}_2^n\} \]

be the affine reversible group. It is generated by NOT and CNOT gates. The ambient gate set adds Toffoli. On three bits it generates the full reversible group. On \(n\ge4\) bits with no ancillas, each NOT, CNOT, or Toffoli gate is an even permutation, so this alphabet does not generate the full symmetric group.

The catalytic question is:

Can a circuit temporarily create nonlinear Boolean terms with Toffoli gates, reuse them, cancel them completely, and implement a final affine permutation with fewer gates than every affine circuit?

This is the nonlinear analogue of dirty linear memory.

10.3.2 Algebraic normal form

Every Boolean coordinate function has a unique algebraic normal form

\[ f_i(x) = \bigoplus_{S\subseteq[n]}a_{i,S}\prod_{j\in S}x_j. \]

Affine maps have degree at most one. A Toffoli gate targeting \(t\) with controls \(a,b\) performs

\[ x_t\longmapsto x_t+x_ax_b, \]

which can raise the degree of later coordinates. The final affine target requires every higher-degree coefficient to cancel.

A candidate lower-bound invariant must do more than track maximum degree. One Toffoli creates degree two and a second can remove it. Useful refinements include:

  • the dimension of the quadratic monomial span,

  • directional derivatives \(D_u f(x)=f(x+u)+f(x)\),

  • the rank of the bilinear polarization,

  • the number of outputs consuming a nonlinear workspace term,

  • restoration obligations for every nonlinear carrier.

10.3.3 Exact three-bit census

On three bits,

\[ |\operatorname{AGL}(3,2)| =2^3|{\operatorname{GL}}(3,2)| =1344, \]

while the group generated by NOT, CNOT, and Toffoli is the full permutation group

\[ S_8, \qquad |S_8|=40320. \]

Both spaces can be enumerated exactly.

Exact finite computation

For three bits, every affine target has the same minimum cost in the affine gate set and in the Toffoli-assisted gate set under each of the following metrics:

  1. total primitive gate count, where NOT, CNOT, and Toffoli cost one,

  2. entangling count, where NOT is free and CNOT and Toffoli cost one.

There are no defective affine targets among all \(1344\) targets.

The restricted total-count diameter is seven and the ambient diameter on \(S_8\) is eight. Under entangling count, both relevant diameters are six. Equality on affine targets is stronger than a diameter comparison because every target is checked individually.

The complete three-bit affine-versus-Toffoli census is rigid.
Figure 10.5. The complete three-bit affine-versus-Toffoli census is rigid.

View full-size figure (new tab)

10.3.4 Interpretation of the negative result

The census does not show that temporary nonlinearity is useless in general. It shows that three bits do not provide enough state space for a nonlinear carrier to repay its creation and cancellation cost under the stated alphabets.

The negative result is valuable for three reasons.

  1. It gives a certified lower threshold: any total- or entangling-count defect requires at least four bits.

  2. It prevents a forced analogy with the six-wire linear catalyst.

  3. It supplies a complete regression test for future synthesis code.

10.3.5 A formal nonlinear catalyst

A clean one-workspace template is

\[ T\;h_m\cdots h_1\;T^{-1}, \]

where \(T\) is Toffoli and the middle gates use the quadratic term created in the workspace. Since Toffoli is self-inverse, the displayed circuit uses two nonlinear gates.

A temporary-nonlinearity template. It is a search skeleton, not a proved shortcut.
Figure 10.6. A temporary-nonlinearity template. It is a search skeleton, not a proved shortcut.

View full-size figure (new tab)

The key difficulty is that a final affine map cannot retain any product term. Every output that consumed the nonlinear carrier must be repaired, or the nonlinear contributions must cancel collectively.

10.3.6 Conjugation formulas

Let \(T_{ab\to t}\) denote Toffoli. Conjugating an affine gate by \(T\) can produce nonlinear permutations. For example, if \(X_t\) flips the target,

\[ T_{ab\to t}X_tT_{ab\to t}=X_t, \]

so no gain occurs. If a CNOT changes a control or exports the target, the conjugated map can contain several quadratic terms. The exact formula is easiest in algebraic normal form: substitute the Toffoli-updated coordinate into the affine map, then apply the inverse substitution.

A systematic search should classify pairs \((T,h)\) for which

\[ ThT^{-1}\in\operatorname{AGL}(n,2). \]

For one Toffoli and an affine middle word, this is a normalizer-intersection problem. A useful next bounded test is to examine simple two-Toffoli sandwiches with an affine middle word of restricted length at most five. The present archive contains no reproducible implementation or receipt for this four-bit test, so no negative result from it is claimed here.

10.3.7 Potential lower-bound invariants

10.3.7.1 Quadratic support debt

Let \(Q(f)\) be the span of quadratic monomials appearing across the coordinate functions. A Toffoli changes \(Q(f)\) by at most a controlled rank-one contribution before subsequent substitutions. If several outputs consume the same quadratic term, a dynamic debt invariant may charge its creation, distribution, and cancellation.

10.3.7.2 Derivative rank

For an affine map, every derivative \(D_u f\) is constant. During a nonlinear excursion, the derivative map

\[ u\mapsto D_u f(x) \]

can depend on \(x\). One can track the dimension of the nonconstant derivative space and require it to return to zero.

10.3.7.3 Higher-order Möbius coefficients

The ANF coefficients are the Möbius transform of the truth table. Projectors onto degree layers give an exact packet decomposition

\[ f=f^{(0)}+f^{(1)}+f^{(2)}+\cdots. \]

A restricted affine circuit remains in degrees zero and one. The ambient circuit can populate higher packets temporarily. A successful lower bound must charge the useful flow through those packets, not merely their instantaneous dimension.

10.3.8 Four-bit search architecture

The full permutation group on four-bit states has size \(16!\). The declared no-ancilla gate alphabet lies in its alternating subgroup: NOT, CNOT, and Toffoli are respectively products of eight, four, and two disjoint transpositions. Even this reduced ambient search is large enough to require a more structured approach. Several exact approaches remain available.

  1. Meet in the middle for a fixed candidate target and length.

  2. SAT or SMT encoding of a length-\(L\) circuit with affine endpoint constraints.

  3. Bidirectional search restricted to states within a bounded nonlinear-degree or Toffoli-count budget.

  4. Enumeration of two- or four-Toffoli normal forms modulo affine conjugation.

  5. Mixed-integer or algebraic solving of ANF coefficient equations.

Protocol 10.10: First four-bit threshold search

  1. Compute exact affine distances for all \(322{,}560\) affine targets.

  2. Enumerate ambient words with two Toffoli gates modulo affine gates on the left and right.

  3. Retain words whose endpoint is affine.

  4. Compare with the exact affine distance.

  5. If no defect appears, increase the Toffoli budget and produce an unsatisfiability certificate for every shorter length.

This protocol is a research plan. The packaged executable census stops at three bits, and neither the four-bit normal-form search nor its lower-bound certificates is supplied.

10.3.9 Resource variants

Temporary nonlinearity may be useful under one metric and useless under another. Natural costs include:

\[ \begin{gathered} \text{Toffoli count},\quad \text{CNOT count},\quad T\text{-count after decomposition},\quad T\text{-depth},\\ \text{ancilla count},\quad \text{total depth}. \end{gathered} \]

A Toffoli-assisted affine shortcut in total Boolean gates might disappear after fault-tolerant decomposition. Conversely, a circuit with more Boolean primitives can reduce \(T\)-depth.

10.3.10 Related nonlinear gate families

The same program applies to:

  • CCZ-assisted diagonal Boolean phase maps,

  • relative-phase Toffoli gates,

  • multi-controlled \(X\) and \(Z\) gates,

  • Reed–Muller degree hierarchies,

  • reversible arithmetic over \({\mathbb Z}_d\),

  • polynomial automorphisms over finite rings.

Conjectural frontier

There exists an affine target on finitely many bits whose total or fault-tolerant resource cost is reduced by a restored nonlinear excursion. The exact three-bit census rules out the smallest possible instance but supplies no evidence for a particular larger threshold.

10.3.11 Reproducible code

The implementation represents every reversible map as an exact permutation of \(2^n\) basis states. Breadth-first search enumerates both the affine group and the full three-bit reversible group.

Exact three-bit affine-versus-Toffoli census.

from catalytic_gate_atlas import exact_affine_toffoli_census

print(exact_affine_toffoli_census(3, entangling_cost=False))
print(exact_affine_toffoli_census(3, entangling_cost=True))

The expected defect count is zero in both outputs.

Source and conversion record

Source SHA-256: 22629d44826f9a8ddfbcf801409aaf7974ed9dc899ff39ee67da0ed7fc4e6f60

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