synthesis of reversible logic circuits

44
Synthesis of Synthesis of Reversible Logic Reversible Logic Circuits Circuits Paper by: Vivek Shende, Paper by: Vivek Shende, Aditya Prasad, Igor Markov, Aditya Prasad, Igor Markov, John Hayes, 2003 John Hayes, 2003 Presentation by: Joshua Presentation by: Joshua Taylor, 2010 Taylor, 2010

Upload: linore

Post on 19-Jan-2016

100 views

Category:

Documents


0 download

DESCRIPTION

Synthesis of Reversible Logic Circuits. Paper by: Vivek Shende, Aditya Prasad, Igor Markov, John Hayes, 2003 Presentation by: Joshua Taylor, 2010. What and Why. [Definition 1] A reversible gate is simply one that computes a bijective function. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Synthesis of Reversible Logic Circuits

Synthesis of Reversible Synthesis of Reversible Logic CircuitsLogic Circuits

Paper by: Vivek Shende, Aditya Paper by: Vivek Shende, Aditya Prasad, Igor Markov, John Hayes, Prasad, Igor Markov, John Hayes,

20032003

Presentation by: Joshua Taylor, Presentation by: Joshua Taylor, 20102010

Page 2: Synthesis of Reversible Logic Circuits

What and WhyWhat and Why

[Definition 1] A reversible gate is simply [Definition 1] A reversible gate is simply one that computes a bijective function.one that computes a bijective function.This means that there are exactly as many This means that there are exactly as many

output bits as input bits.output bits as input bits.A gate with k inputs and k outputs is called a A gate with k inputs and k outputs is called a

k×k gate, or a gate on k wires.k×k gate, or a gate on k wires.

Page 3: Synthesis of Reversible Logic Circuits

What and WhyWhat and Why

Some reversible functions have been Some reversible functions have been implemented in hardware:implemented in hardware:Bit permutations speed up some common Bit permutations speed up some common

algorithmsalgorithmsMatrix transpositionMatrix transpositionTwofish cryptographyTwofish cryptography

Butterfly function (x, y)->(x+y, x-y)Butterfly function (x, y)->(x+y, x-y)Important in fast Fourier transformsImportant in fast Fourier transforms

Quantum computers can only compute Quantum computers can only compute reversible functionsreversible functions

Page 4: Synthesis of Reversible Logic Circuits

CNOT gatesCNOT gates

[Definition 2] A k-CNOT gate is a (k+1)×(k+1) [Definition 2] A k-CNOT gate is a (k+1)×(k+1) gate that leaves the first k inputs unchanged and gate that leaves the first k inputs unchanged and inverts the last if and only if all the others are 1.inverts the last if and only if all the others are 1. The 0-CNOT gate is just NOTThe 0-CNOT gate is just NOT The 1-CNOT gate is simple called CNOT or the The 1-CNOT gate is simple called CNOT or the

Controlled-NOT gateControlled-NOT gate Computes the function (x, y)->(x, x XOR y)Computes the function (x, y)->(x, x XOR y)

The 2-CNOT gate is normally called the TOFFOLI The 2-CNOT gate is normally called the TOFFOLI gategate

Sometimes called the Controlled-Controlled-NOT gateSometimes called the Controlled-Controlled-NOT gate

Page 5: Synthesis of Reversible Logic Circuits

GatesGates

This paper only deals with the NOT, This paper only deals with the NOT, CNOT and TOFFOLI gates, plus the CNOT and TOFFOLI gates, plus the SWAP gate.SWAP gate. In quantum computers, swapping qubits is In quantum computers, swapping qubits is

non-trivialnon-trivialSWAP and CNOT are redundant, but offer SWAP and CNOT are redundant, but offer

important speed ups and other reductionsimportant speed ups and other reductions

Page 6: Synthesis of Reversible Logic Circuits

Reversible CircuitsReversible Circuits

[Definition 3] A reversible circuit is a circuit [Definition 3] A reversible circuit is a circuit composed of reversible gates with no fan-out.composed of reversible gates with no fan-out. Feynman’s notation:Feynman’s notation:

Page 7: Synthesis of Reversible Logic Circuits

Constructible circuitsConstructible circuits

[Definition 4] Given a library, L, of reversible [Definition 4] Given a library, L, of reversible gates, a permutation of the numbers [0..2gates, a permutation of the numbers [0..2nn] is L-] is L-constructible if it can be computed by a n×n constructible if it can be computed by a n×n circuit of gates from L.circuit of gates from L. For example, CNOT applied to lines 0 (the control) For example, CNOT applied to lines 0 (the control)

and 1 of a three line circuit swaps the inputs 001 and and 1 of a three line circuit swaps the inputs 001 and 011, and the inputs 101 and 111.011, and the inputs 101 and 111.

We write this using the cycle notation as (1 3)(5 7)We write this using the cycle notation as (1 3)(5 7) Therefore, (1 3)(5 7) is a C-constructible circuitTherefore, (1 3)(5 7) is a C-constructible circuit Permutation, function and circuit are used almost Permutation, function and circuit are used almost

interchangeably.interchangeably.

Page 8: Synthesis of Reversible Logic Circuits

LibrariesLibraries

The C, N, T and S libraries consist of just The C, N, T and S libraries consist of just the CNOT, NOT, TOFFOLI and SWAP the CNOT, NOT, TOFFOLI and SWAP gates respectively.gates respectively.

The CNTS library contains all four.The CNTS library contains all four.Similarly with the CNT, NT, etc. libraries.Similarly with the CNT, NT, etc. libraries.

Page 9: Synthesis of Reversible Logic Circuits

UniversalityUniversality

[Definition 5] A library, L, is universal if for [Definition 5] A library, L, is universal if for all k, and all permutations, all k, and all permutations, ππ, on [0..2, on [0..2kk], ], then there exists some L-constructible then there exists some L-constructible function that computes function that computes ππ using some using some number of wires of temporary storage.number of wires of temporary storage.No constant signalsNo constant signalsMultiple output bits Multiple output bits

Page 10: Synthesis of Reversible Logic Circuits

Temporary StorageTemporary Storage

Temporary storage wires must end with the Temporary storage wires must end with the same value.same value.

Toffoli showed that the CNT library is universal Toffoli showed that the CNT library is universal using at most n-3 lines of temporary storage.using at most n-3 lines of temporary storage. Most literature allows polynomial bounds on Most literature allows polynomial bounds on

temporary storage.temporary storage. Qubits are expensive, so less is betterQubits are expensive, so less is better This paper tries to use no temporary storageThis paper tries to use no temporary storage The C gate can be replaced by two Ts and two Ns The C gate can be replaced by two Ts and two Ns

using one line of temporary storageusing one line of temporary storage

Page 11: Synthesis of Reversible Logic Circuits

LinearityLinearity

[Definition 6] A boolean function, f, is linear [Definition 6] A boolean function, f, is linear if and only if f(x XOR y) = f(x) XOR f(y).if and only if f(x XOR y) = f(x) XOR f(y).Equivalent to the usual definition of linearity Equivalent to the usual definition of linearity

over the finite field Fover the finite field F22.. f can be thought of as a square boolean f can be thought of as a square boolean

matrix.matrix.

Page 12: Synthesis of Reversible Logic Circuits

C-constructible functionsC-constructible functions

[Lemma 7] Every C-constructible [Lemma 7] Every C-constructible permutation computes an invertible linear permutation computes an invertible linear transformation, and every invertible linear transformation, and every invertible linear transformation is C-constructible. Also, no transformation is C-constructible. Also, no C-constructible circuit requires more than C-constructible circuit requires more than nn22 gates. gates. A C gate performs an elementary row addition on the A C gate performs an elementary row addition on the

matrix. Any invertible boolean matrix can be written as matrix. Any invertible boolean matrix can be written as a product of these, and can be row-reduced to the a product of these, and can be row-reduced to the identity matrix using at most nidentity matrix using at most n22 operations. operations.

Page 13: Synthesis of Reversible Logic Circuits

Worse case sizeWorse case size

[Lemma 8] Given a library, L, let K[Lemma 8] Given a library, L, let Knn be the be the

L-constructible circuits on n wires. The L-constructible circuits on n wires. The longest gate-minimal L-circuit on n wires longest gate-minimal L-circuit on n wires has more than log ||Khas more than log ||Knn|| / log b gates, || / log b gates,

where b in the number of one gate circuits where b in the number of one gate circuits on n wires.on n wires.Proved using a counting argument.Proved using a counting argument.

Page 14: Synthesis of Reversible Logic Circuits

Counting C-constructible circuitsCounting C-constructible circuits

[Corollary 9] There are [Corollary 9] There are ΠΠ(2(2nn-2-2ii), for ), for 0 ≤ i ≤ n-1, C-constructible permutations 0 ≤ i ≤ n-1, C-constructible permutations on n wires.on n wires.Any linear function is fully defined by its action Any linear function is fully defined by its action

on the basis vectors. There are 2on the basis vectors. There are 2nn-1 ways of -1 ways of mapping the first basis vector, 2mapping the first basis vector, 2nn-2 ways for -2 ways for the second, and so on.the second, and so on.

Therefore, worst case C-circuits require Therefore, worst case C-circuits require ΩΩ(n(n22 / log n) gates. / log n) gates.

Page 15: Synthesis of Reversible Logic Circuits

Even permutationsEven permutations

[Definition 10] An even permutation is one [Definition 10] An even permutation is one that can be written as a product of an even that can be written as a product of an even number of transpositions (2-cycles).number of transpositions (2-cycles). (1 3 2) = (1 2)(2 3)(1 3 2) = (1 2)(2 3)Even and odd permutations are very similar to Even and odd permutations are very similar to

even and odd numbers.even and odd numbers.

Page 16: Synthesis of Reversible Logic Circuits

Even permutationsEven permutations

[Lemma 11] Any n×n circuit with no n×n gates [Lemma 11] Any n×n circuit with no n×n gates computes an even permutation.computes an even permutation. With only one gate on fewer than n wires, at least one With only one gate on fewer than n wires, at least one

line must be unaffected. Therefore, the cycles it line must be unaffected. Therefore, the cycles it computes appears in pairs. (1 3)(5 7), for example. computes appears in pairs. (1 3)(5 7), for example. The product of a pair of even or a pair of odd The product of a pair of even or a pair of odd permutations is even.permutations is even.

Any circuit is the product of the permutations of its Any circuit is the product of the permutations of its gates, and the product of any number of even gates, and the product of any number of even permutations is even.permutations is even.

The CNTS library contains no gates of size The CNTS library contains no gates of size greater than 3.greater than 3.

Page 17: Synthesis of Reversible Logic Circuits

Even permutationsEven permutations

[Theorem 12] Every even permutation is [Theorem 12] Every even permutation is CNT-constructible.CNT-constructible.Proof will have to wait.Proof will have to wait.

[Corollary 13] Every permutation is CNT-[Corollary 13] Every permutation is CNT-constructible with at most one line of constructible with at most one line of temporary storage.temporary storage.Adding an extra line doubles all cycles, Adding an extra line doubles all cycles,

making any permutation even.making any permutation even.

Page 18: Synthesis of Reversible Logic Circuits

Constructible permutationsConstructible permutations

[Corollary 14] Any universal library L can [Corollary 14] Any universal library L can construct any permutation above a certain construct any permutation above a certain number of wires can be constructed with number of wires can be constructed with at most one wire of temporary storage.at most one wire of temporary storage.Since L is universal, it can simulate the CNT Since L is universal, it can simulate the CNT

library.library.

Page 19: Synthesis of Reversible Logic Circuits

N-constructible circuitsN-constructible circuits

[Definition 15] N[Definition 15] Nii is the circuit formed by placing is the circuit formed by placing a NOT gate on each wire corresponding to the a NOT gate on each wire corresponding to the 1s in the binary expansion of i.1s in the binary expansion of i. NNii computes the function x XOR i. computes the function x XOR i.

[Lemma 16] The set of N[Lemma 16] The set of N ii over n wires is the set over n wires is the set of N-constructible functions on n wires.of N-constructible functions on n wires. Two NOTs cancel out, leaving any N-constructible Two NOTs cancel out, leaving any N-constructible

function with at most one N per wire, which is one of function with at most one N per wire, which is one of the Nthe Nii functions. functions.

Page 20: Synthesis of Reversible Logic Circuits

T-constructible permutationsT-constructible permutations

[Definition 17] Let N[Definition 17] Let Nkkhh, such that h AND k = , such that h AND k =

0, be the circuit consisting of q-CNOT 0, be the circuit consisting of q-CNOT gates, where q is the number of 1s in k, gates, where q is the number of 1s in k, with the controls of all gates specified by with the controls of all gates specified by the 1s in k, and the inverters of each gate the 1s in k, and the inverters of each gate specified by h.specified by h.NNkk

hh computes N computes Nhh when all of the lines when all of the lines

specified by k are 1.specified by k are 1.

Page 21: Synthesis of Reversible Logic Circuits

T-constructible permutationsT-constructible permutations

[Lemma 18] Every T-circuit fixes 0 and 2[Lemma 18] Every T-circuit fixes 0 and 2 ii for all i.for all i.No T gate can affect any input with fewer than No T gate can affect any input with fewer than

2 active lines.2 active lines.Also, T-circuits can construct only even Also, T-circuits can construct only even

permutations on more than 3 lines (without permutations on more than 3 lines (without temporary storage).temporary storage).

Page 22: Synthesis of Reversible Logic Circuits

T-constructible permutationsT-constructible permutations

[Lemma 19] For n > 4, any even [Lemma 19] For n > 4, any even permutation can be written as a product of permutation can be written as a product of pairs of disjoin transpositions (such as (1 pairs of disjoin transpositions (such as (1 2)(3 4)) using at most k+1 transpositions 2)(3 4)) using at most k+1 transpositions for a permutation that moves k indices.for a permutation that moves k indices.Math heavy proof.Math heavy proof.

Page 23: Synthesis of Reversible Logic Circuits

T-constructible permutationsT-constructible permutations

[Lemma 20] On n wires, the permutation [Lemma 20] On n wires, the permutation (2(2nn-4 2-4 2nn-3)(2-3)(2nn-2 2-2 2nn-1) is T-constructible with -1) is T-constructible with 8(n-5) T gates.8(n-5) T gates.Proved in a previous paper by someone else.Proved in a previous paper by someone else.

Page 24: Synthesis of Reversible Logic Circuits

T-constructible permutationsT-constructible permutations

[Lemma 21] Suppose n >3, and [Lemma 21] Suppose n >3, and 0 < a,b,c,d < 20 < a,b,c,d < 2nn, and none of a, b, c or d is , and none of a, b, c or d is

a power of 2. Then (a b)(c d) is T-a power of 2. Then (a b)(c d) is T-constructible.constructible.Long, complicated construction.Long, complicated construction.

Page 25: Synthesis of Reversible Logic Circuits

T-constructible permutationsT-constructible permutations

[Theorem 22] Every T-constructible [Theorem 22] Every T-constructible permutation fixes 0 and powers of 2 and is permutation fixes 0 and powers of 2 and is even if n > 3. Conversely, every even if n > 3. Conversely, every permutation of this form is T-constructible permutation of this form is T-constructible with at most 3(k + 1)(3n – 7) gates, where with at most 3(k + 1)(3n – 7) gates, where k is the number of indices moved. There k is the number of indices moved. There are (1/2)(2are (1/2)(2nn - n - 1)! such permutations on - n - 1)! such permutations on n wires.n wires.Proof combines several previous lemmas.Proof combines several previous lemmas.

Page 26: Synthesis of Reversible Logic Circuits

CommutatorsCommutators

[Definition 25] The commutator of [Definition 25] The commutator of permutations P and Q, written [P,Q], is permutations P and Q, written [P,Q], is defined as PQPdefined as PQP-1-1QQ-1-1..Commutators are useful in moving gates Commutators are useful in moving gates

around, since PQ = [P,Q]QParound, since PQ = [P,Q]QP [Definition 23], [Lemma 24], [Corollary 26] [Definition 23], [Lemma 24], [Corollary 26]

and [Lemma 27] show how to build and [Lemma 27] show how to build commutators, but the details of this aren’t commutators, but the details of this aren’t important.important.

Page 27: Synthesis of Reversible Logic Circuits

CT|N- and T|C- constructible CT|N- and T|C- constructible permutationspermutations

[Definition 28] For libraries L[Definition 28] For libraries L11, …, L, …, Lkk, a L, a L11||

…|L…|Lkk circuit is a L circuit is a L11 circuit followed by an L circuit followed by an L22

circuit, etc.circuit, etc.

Page 28: Synthesis of Reversible Logic Circuits

CT|N- and T|C- constructible CT|N- and T|C- constructible permutationspermutations

[Thoerem 29] Let [Thoerem 29] Let ππ be CNT-constructible. Then be CNT-constructible. Then ππ is also CT|N-constructible and uniquely is also CT|N-constructible and uniquely determines the permutations determines the permutations ππCTCT and and ππNN.. Proof uses the commutators from before to show how Proof uses the commutators from before to show how

to move an N gate past the other kinds of gates.to move an N gate past the other kinds of gates. Also, this process only introduces a polynomial Also, this process only introduces a polynomial

number of extra gates.number of extra gates. Since a CT-circuit fixes 0, we can compute Since a CT-circuit fixes 0, we can compute ππNN easily, easily,

and then find a circuit for and then find a circuit for ππCTCT..

Page 29: Synthesis of Reversible Logic Circuits

CT|N- and T|C- constructible CT|N- and T|C- constructible permutationspermutations

[Lemma 30] An even permutation is T|C-[Lemma 30] An even permutation is T|C-constructible if and only if it fixes 0 and the constructible if and only if it fixes 0 and the images of the powers of 2 are linearly images of the powers of 2 are linearly independent. Also, independent. Also, ππTT and and ππCC are uniquely are uniquely

determined.determined.The T subcircuit can’t affect the basis vectors, The T subcircuit can’t affect the basis vectors,

so that specifies the C subcircuit, which so that specifies the C subcircuit, which specifies the T circuit.specifies the T circuit.

This also works in reverse.This also works in reverse.

Page 30: Synthesis of Reversible Logic Circuits

T|C|T|N-constructible permutationsT|C|T|N-constructible permutations

[Theorem 31] Every zero-fixing [Theorem 31] Every zero-fixing permutation on 3 wires and every even permutation on 3 wires and every even zero-fixing permutation on 4 or more wires zero-fixing permutation on 4 or more wires is T|C|T-constructible. None requires more is T|C|T-constructible. None requires more than nthan n22 C gates and 3(2 C gates and 3(2nn + n + 1)(3n – 7) T + n + 1)(3n – 7) T gates.gates.Complicated proof.Complicated proof.

Page 31: Synthesis of Reversible Logic Circuits

T|C|T|N-constructible permutationsT|C|T|N-constructible permutations

[Corollary 32] There exists T|C|T-[Corollary 32] There exists T|C|T-constructible permutations that are not T|C constructible permutations that are not T|C constructible.constructible. (2 6)(4 7) is even and fixes 0, so it is T|C|T-(2 6)(4 7) is even and fixes 0, so it is T|C|T-

constructible for any number of wires greater constructible for any number of wires greater than 3.than 3.

But, But, ππ(1) XOR (1) XOR ππ(2) = 1 XOR 6 = 7 = (2) = 1 XOR 6 = 7 = ππ(4), so (4), so the powers of two are not linearly the powers of two are not linearly independent, so it is not T|C-constructible.independent, so it is not T|C-constructible.

Page 32: Synthesis of Reversible Logic Circuits

T|C|T|N-constructible permutationsT|C|T|N-constructible permutations

[Theorem 33] Every permutation on n ≤ 3 wires [Theorem 33] Every permutation on n ≤ 3 wires and every even permutation on n > 3 wires is T|and every even permutation on n > 3 wires is T|C|T|N-constructible, and therefore CNT-C|T|N-constructible, and therefore CNT-constructible, finally proving Theorem 12.constructible, finally proving Theorem 12. Using Using ππ(0), (0), ππNNππ(0)(0) fixes 0, and so is T|C|T- fixes 0, and so is T|C|T-

constructible. Applying Nconstructible. Applying Nππ(0)(0) to this produces a T|C|T| to this produces a T|C|T|N-circuit that computes N-circuit that computes ππ..

The truth table for a n×n circuit is n2The truth table for a n×n circuit is n2nn bits, and the bits, and the run-time to generate a circuit using this procedure is run-time to generate a circuit using this procedure is proportional to the number of gates which is also n2proportional to the number of gates which is also n2nn, , so the procedure has a linear run time.so the procedure has a linear run time.

It might not produce the best circuit though.It might not produce the best circuit though.

Page 33: Synthesis of Reversible Logic Circuits

T|C|T|N-constructible permutationsT|C|T|N-constructible permutations

[Corollary 34] Worst case CNT-circuits on [Corollary 34] Worst case CNT-circuits on n wires require n wires require ΩΩ(n2(n2nn / log n) gates. / log n) gates.This follows from Lemma 8.This follows from Lemma 8.This means that the above construction is off This means that the above construction is off

by at most a factor of log n.by at most a factor of log n.

Page 34: Synthesis of Reversible Logic Circuits

Optimal synthesisOptimal synthesis

[Lemma 35 (Property of Optimality)] If A is [Lemma 35 (Property of Optimality)] If A is an optimal circuit, then any subcircuit is an optimal circuit, then any subcircuit is also optimal.also optimal.Otherwise, we could replace that subcircuit Otherwise, we could replace that subcircuit

with a better one.with a better one.This allows us to build a library of small This allows us to build a library of small

optimal circuits and build bigger ones by optimal circuits and build bigger ones by combining them.combining them.

Page 35: Synthesis of Reversible Logic Circuits

Optimal synthesisOptimal synthesis

The algorithm works by computing bigger The algorithm works by computing bigger and bigger circuits until memory starts to and bigger circuits until memory starts to run out, then uses iterative deepening run out, then uses iterative deepening depth first search to find bigger circuits, depth first search to find bigger circuits, until one is found that computes the until one is found that computes the desired permutation.desired permutation.For each circuit in the library of small circuits, For each circuit in the library of small circuits,

it can divide the desired permutation by that it can divide the desired permutation by that circuit and then use recursion to find the rest.circuit and then use recursion to find the rest.

Page 36: Synthesis of Reversible Logic Circuits

Optimal synthesis of 3-wire circuitsOptimal synthesis of 3-wire circuits

SizeSize NN CC TT NCNC CTCT NTNT CNTCNT CNTSCNTS

1212 4747

1111 16901690

1010 83638363

99 1223712237

88 66 93399339 577577 3232

77 1414 386386 50975097 1025310253 68176817

66 22 215215 16881688 22622262 1704917049 1753117531

55 2424 474474 17841784 870870 89218921 1119411194

44 6060 55 393393 845845 296296 27802780 37523752

33 11 5151 99 187187 261261 8888 625625 844844

22 33 2424 66 5151 6060 2424 102102 134134

11 33 66 33 99 99 66 1212 1515

00 11 11 11 11 11 11 11 11

TotalTotal 88 168168 2424 13441344 50405040 4032040320 4032040320 4032040320

TimeTime 11 11 11 3030 215215 9797 4040 1515

Page 37: Synthesis of Reversible Logic Circuits

Optimal synthesisOptimal synthesis

The running time depends on the gate The running time depends on the gate library chosen, but for the CNTS library, library chosen, but for the CNTS library, it’s at least doubly exponential in the it’s at least doubly exponential in the number of wires, or exponential in the size number of wires, or exponential in the size of the truth table.of the truth table.This limits its use to small problems, but since This limits its use to small problems, but since

current quantum computers are limited to current quantum computers are limited to around 10 qubits, this is still of interest.around 10 qubits, this is still of interest.

Page 38: Synthesis of Reversible Logic Circuits

Quantum applicationsQuantum applications

Quantum computation is necessarily Quantum computation is necessarily reversible.reversible.Most quantum gate libraries are combinations Most quantum gate libraries are combinations

of classic reversible gates and a few of classic reversible gates and a few quantum-specific gates such as the quantum-specific gates such as the Hadamard gate.Hadamard gate.The Hadamard gate is a one-qubit gate that The Hadamard gate is a one-qubit gate that

“rotates” the state an eighth of a turn. “rotates” the state an eighth of a turn.

Page 39: Synthesis of Reversible Logic Circuits

Quantum applicationsQuantum applications

Grover’s algorithm can solve an uniformed Grover’s algorithm can solve an uniformed search problem faster than any known search problem faster than any known classical algorithm.classical algorithm.The algorithm needs an oracle function that The algorithm needs an oracle function that

applies a search-specific predicate function, applies a search-specific predicate function, f(x). The oracle function transforms |x> to (-f(x). The oracle function transforms |x> to (-1)1)f(x)f(x)|x>.|x>.

Page 40: Synthesis of Reversible Logic Circuits

Quantum applicationsQuantum applications

[Lemma 36] With one additional qubit of [Lemma 36] With one additional qubit of temporary storage, the synthesis of an temporary storage, the synthesis of an oracle circuit can be reduced to the oracle circuit can be reduced to the synthesis of a classical reversible circuit.synthesis of a classical reversible circuit.Compute Compute ππff as the function (x, y) -> (x, y XOR as the function (x, y) -> (x, y XOR

f(x))f(x))Use that to create a quantum operator that Use that to create a quantum operator that

carries out this permutation and apply that to |carries out this permutation and apply that to |x,H|1>>, which gives |(-1)x,H|1>>, which gives |(-1)f(x)f(x)x, H|1>>x, H|1>>

Page 41: Synthesis of Reversible Logic Circuits

Quantum applicationsQuantum applications

[Corollary 37] If [Corollary 37] If ππff is even, Grover’s is even, Grover’s

algorithm is computable with only one algorithm is computable with only one extra qubit of storage. Two if it’s odd.extra qubit of storage. Two if it’s odd.Qubits are expensive so this is a good thing.Qubits are expensive so this is a good thing.Optimal circuit sizes for 3 input, 1 output Optimal circuit sizes for 3 input, 1 output

circuits on 4 wires:circuits on 4 wires:

SizeSize 00 11 22 33 44 55 66 77 TotalTotal

NumberNumber 11 77 2121 3535 3535 2424 44 11 128128

Page 42: Synthesis of Reversible Logic Circuits

Quantum applicationsQuantum applications

[Lemma 38] There is a reversible 2-bit [Lemma 38] There is a reversible 2-bit ROM-based CNT-circuit that computesROM-based CNT-circuit that computes(x, a, b) -> (x, a, b XOR f(x)), where x is a (x, a, b) -> (x, a, b XOR f(x)), where x is a k-bit input.k-bit input.A ROM-based circuit is one where the values A ROM-based circuit is one where the values

of the read-only bits cannot be changed even of the read-only bits cannot be changed even in the intermediate steps. In the above, a and in the intermediate steps. In the above, a and b can change, even though a must end up b can change, even though a must end up back where it started.back where it started.

Page 43: Synthesis of Reversible Logic Circuits

ConclusionsConclusions

Reversible logic circuits are an important area of Reversible logic circuits are an important area of research especially in quantum computing.research especially in quantum computing.

They have some nice properties that makes They have some nice properties that makes synthesizing them somewhat easier than the synthesizing them somewhat easier than the general case of n×n boolean circuits.general case of n×n boolean circuits.

While most papers are only concerned with While most papers are only concerned with keeping the temporary storage polynomial, this keeping the temporary storage polynomial, this paper shows that any permutation can be paper shows that any permutation can be calculated with only one line of temporary calculated with only one line of temporary storage, and that Grover’s algorithm only needs storage, and that Grover’s algorithm only needs two writable qubits.two writable qubits.

Page 44: Synthesis of Reversible Logic Circuits

Questions?Questions?