ros: resource-constrained oracle synthesis for quantum ... · implementation of “oracles” /...
TRANSCRIPT
ROS: Resource-constrained Oracle Synthesis for Quantum Computers
@martinquantum
microsoft.com/quantum
Motivation: oracle synthesis
6/13/2019 QPL 2019 2
Arithmetic:Factoring: needs “constant” modular arithmeticECC dlogs: need generic modular arithmetic,
need to execute non-trivial straight-line programsHHL: need sparse matrix access, need integer inverses; Newton type methods
Amplitude amplification: Implementation of “oracles” / subroutines, e.g., for search, collision etc. Implementation of walk operators on data structures
Quantum simulation: Addressing/indexing functions for sparse matricesComputing Hamiltonian terms on the fly
k-LUT based oracle synthesis
Logicnetwork
k-LUT network
Reversible network
Quantum circuit
k-LUTmapping
mappinginto qubits
Graysynthesis
6/13/2019 QPL 2019 3
Logic Network
Hierarchical methods are based on logic networks rather than on less scalable logic representations, i.e. truth tables.
A logic network is a graph, in which each node represents a Boolean function and edges define data dependency.
A network is characterized by the operations that it supports.
x1 x2 x3 x4
f
AND
AND
AND
And-Inverter Graph (AIG) Xor-And-inverter Graph (XAG)
x1 x2
f
AND
XOR
x3
Majority-Inverter Graph (MIG)
x1 x2
f
Maj
x3
Maj
1
6/13/2019 QPL 2019 4
k-LUT mapping
Hierarchical methods use k-LUT mapping to decompose the original network.
A k-LUT is a subnetwork with maximum k inputs.
The decomposition is not unique.
6/13/2019 QPL 2019 5
Mapping into qubits
This step exploits the one-to-one correspondence between a LUT node and a single-target gate.
f
abcdeg
abcdeg ⊕ f(a, b, c, d)
𝑇𝑐 𝑥1, … , 𝑥𝑘 , 𝑥𝑘+1𝑥1, … , 𝑥𝑘 is a set of control lines𝑥𝑘+1 is the target line𝑓: 𝐵𝑘 → 𝐵 is the control function
x1 x2 x3 x4
g
n3
n1 n2
𝑛1 = x1 ∧ x2𝑛2 = 𝑥3⨁ ҧ𝑥4𝑛3 = (𝑛1 ∧ 𝑛2) ∨ 𝑥3
n1
n2 n2
n1
n3
x1
x2
x3
x4
x1
x2
x3
x4
g
Each auxiliary qubit stores one intermediate result.
The order in which operations are computed affects the number of qubits and the number of gates.
6/13/2019 QPL 2019 6
Single target gate (STG)
k-LUT based oracle synthesis
Graphk-LUT
networkReversible network
Quantum circuit
k-LUTmapping
mappinginto qubits
Graysynthesis
During this step we define:• Number of nodes in the k-LUT network• Complexity of the function performed by each node
6/13/2019 QPL 2019 7
Gray synthesis: Phase polynomial
M. Amy, P. Azimzadeh, and M. Mosca, “On the CNOT-complexity of CNOT-phase circuits,” arXiv:1712.01859, 2017
6/13/2019 QPL 2019 8
A {CNOT, RZ} circuit has associated unitary:
𝑈𝐶 =
𝒙∈𝐹2𝑛
𝑒2𝜋𝑖𝑓(𝒙)ȁ ۧ𝐴𝒙 ۦ ȁ𝒙
𝑓 𝒙 =
𝒚∈𝐹2𝑛
መ𝑓(𝒚) (𝑥1𝑦1⨁𝑥2𝑦2⨁…⨁𝑥𝑛𝑦𝑛)
The expression 𝑓(𝑥) is a weighted sum of parities in 𝒙.
Computing a minimal parity network for a particular set of parity functions is shown to be equivalent to finding a CNOT-optimal circuit for a particular phase polynomial
𝐴: ȁ ۧ𝑥1 ȁ ۧ𝑥2 ȁ ۧ𝑥3 → ȁ ۧ𝑥1 ȁ ۧ𝑥1⨁𝑥2 ȁ ۧ𝑥1⨁𝑥2⨁𝑥3
𝑓 𝑥 =𝜋
4𝑥1⨁𝑥2 +
7
4𝜋(𝑥1⨁𝑥2⨁𝑥3)
Example
6/13/2019 QPL 2019 9
Synthesis of single-target gates
When a STG performing ȁ ۧ𝑥1 ȁ ۧ𝑥2 ȁ ۧ𝑥3 → ȁ ۧ𝑥1 ȁ ۧ𝑥2 ȁ ۧ𝑥1⨁𝑓1(𝑥1, 𝑥2)
is synthesized into a {CNOT, RZ} circuit, the CNOTs are used to generate linear combinations of the inputs.
The rotation angles are proportional to the Rademacher-Walsh spectral coefficients of the function
ො𝑔 = 𝑥3 ∧ 𝑓1(𝑥1, 𝑥2)
𝜃𝑖 =𝜋𝑠𝑖2𝑛
A function with many zeros as spectral coefficients will be translated into less gates.
6/14/2019 QPL 2019 10
Space-time tradeoffs: pebbling
Example:
Rules of the game: [Bennett, SIAM J. Comp., 1989]• n boxes, labeled i = 1, …, n• in each move, either add or remove a pebble• a pebble can be added or removed in i=1 at any time• a pebble can be added of removed in i>1 if and only if there is a pebble in i-1.
1 2 3 4
# i
1 12 23 34 45 36 27 1
6/14/2019 QPL 2019 11
Space-time tradeoffs: pebbling
Example: (n=3, S=3)
Imposing resource constraints:• only a total of S pebbles are allowed• corresponds to reversible algorithm with at most S auxiliary qubits
1 2 3 4
# i
1 12 23 34 15 46 37 18 29 1
Mapping into qubits: pebbling strategy
This step defines the number of auxiliary qubits.It can be optimized by changing the order in which the graph is traversed.
a b
f
e
dc
x1 x2 x3x4
y1
y2 inputs
6 ancillae
outputs
x1
x2
x3
x4
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
a ab b
c cd
e
d
f
ȁ ۧ0
ȁ ۧ0 y2
y1
ȁ ۧ0
x1
x2
x3
x4
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
6/13/2019 QPL 2019 12
Mapping into qubits: pebbling strategy
a b
f
e
dc
x1 x2 x3x4
y1
y2 inputs
5 ancillae
x1
x2
x3
x4
y2
y1
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
a ab b
c cd
e
d
f
ȁ ۧ0
x1
x2
x3
x4
ȁ ۧ0ȁ ۧ0
ȁ ۧ0
6/13/2019 QPL 2019 13
This step defines the number of auxiliary qubits.It can be optimized by changing the order in which the graph is traversed.
Mapping into qubits: pebbling strategy
a b
f
e
dc
x1 x2 x3x4
y1
y2 inputs
4 ancillae
x1
x2
x3
x4
y2
y1
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
ȁ ۧ0
a a
b bc d
e
df
a
b
a
cb
ȁ ۧ0
x1
x2
x3
x4
ȁ ۧ0
6/13/2019 QPL 2019 14
This step defines the number of auxiliary qubits.It can be optimized by changing the order in which the graph is traversed.
Results
6/13/2019 QPL 2019 15
github.com/microsoft/quantum/
docs.microsoft.com/quantum/
microsoft.com/quantum