An Introduction to the ZX-Calculus ...and some applications in quantum software Aleks Kissinger Full-stack quantum computing 2020 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 1 / 26
Quantum software 1. := the code the runs on a quantum computer factoring search physical simulation optimisation problems linear systems & codes network flows natural language processing ... 2. := the code that makes that code (better) • compilers • optimisation • verification Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 2 / 26
Problem: no quantum computers Rigetti Aspen IBM Q Rochester Google Sycamore (+ Oxford, Vienna, Delft, Sussex, Maryland...) Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 3 / 26
Problem: limited quantum computers NISQ devices have: • short coherence times • low numbers of qubits • noisy operations • limited connectivity • ... ⇒ small advances in software give big gains on NISQ hardware! Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 4 / 26
Quantum circuits • := the ‘assembly language’ of quantum computation, e.g. INIT 5 ⊕ H S 0 CNOT 1 0 ⊕ H 0 H 2 ⇔ Z 3 ⊕ ⊕ ⊕ H X T 0 H 0 ⊕ H 1 0 Z Z CNOT 4 2 ⊕ 0 ... Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 5 / 26
⊕ H S 0 ⊕ H 0 ⊕ ⊕ 0 H X T ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 6 / 26
⊕ ⊕ H S 0 H 0 ⊕ ⊕ 0 H X T ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 6 / 26
H S 0 H 0 ⊕ ⊕ 0 H X T ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 6 / 26
H S 0 H 0 ⊕ ⊕ 0 H X T ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 6 / 26
⊕ ⊕ H H = = ⊕ ⊕ ⊕ H H = Z Z = ⊕ ⊕ = H S H S H H ⊕ ⊕ ⊕ . . . Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 7 / 26
* Selinger 2015 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 7 / 26
* Selinger 2015 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 7 / 26
* Amy, Chen, & Ross 2018 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 7 / 26
* Nam et al 2018 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 7 / 26
⊕ H S 0 ⊕ H 0 ⊕ ⊕ ⊕ H X T 0 ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 8 / 26
⊕ H S 0 ⊕ H 0 ⊕ ⊕ ⊕ H X T 0 ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 8 / 26
π π π π 2 2 2 2 π π π 2 2 2 π π π π π 2 2 2 4 π π Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 8 / 26
π π π π 2 2 2 2 π π π 2 2 2 π π π π π 2 2 2 4 π π ZX-diagram Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 8 / 26
ZX-diagrams: perspective 1 ...are like circuits, but made from spiders instead of unitary gates: = | 0 ... 0 �� 0 ... 0 | + e i α | 1 ... 1 �� 1 ... 1 | Z α = α ... ... = | + ... + �� + ... + | + e i α |− ... −��− ... −| X α = α ... ... Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 9 / 26
ZX-diagrams are bendy π 2 β 3 π 2 α π Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 10 / 26
ZX-diagrams are bendy β 3 π α 2 π π 2 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 10 / 26
ZX-diagrams are bendy β π 3 π α 2 π 2 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 10 / 26
Why spiders? • They generate all linear maps C 2 m → C 2 n . • Handy for building most common gates, e.g. = = S π T π 2 4 = = H π π π 2 2 2 = = ⊕ • ....and.... Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 11 / 26
1 ZX calculus these 8 rules = ⇒ everything before 1 Vilmart 2018. arXiv:1812.09114 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 12 / 26
⊕ H S 0 ⊕ H 0 ⊕ ⊕ ⊕ 0 H X T ⊕ Z Z 0 ⊕ 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π π π π 2 2 2 2 π π π 2 2 2 π π π π π 2 2 2 4 π π Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π π π 2 2 π π π 2 2 2 π π π π π 2 2 2 4 2 π Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π π π 2 2 π π 2 2 π π π π 2 2 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π π π 2 2 π π 2 2 π π π π 2 2 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π π 2 π π 2 2 π π π π 2 2 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π 2 π π 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π 2 π 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π 2 π 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
π 2 π 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
H S 0 H 0 0 H T 0 0 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 13 / 26
Q: How do we scale up? π π π π 2 2 2 2 π π π 2 2 2 ≪ π π π π π 2 2 2 4 π π � �� � ∼ 30 nodes � �� � 10 2 - 10 5 nodes A: Automation. Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 14 / 26
PyZX • Open-source tool for quantum circuit optimisation, verification, and simulation using the ZX-calculus Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 15 / 26
The idea 1. Turn equations into directed rewrite rules ... ... ... = ⇒ ... α α = → ... ... ... ... α + β α + β ... ... ... ... β β β β ... ... 2. Use rewrite rules to simplify ZX-diagrams 3. Extract meaningful data from simplified diagram (e.g. optimised circuits, amplitudes/probabilities, ...). Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 16 / 26
T-count reduction • := reducing the number of T-gates in a circuit T gates π π 4 4 7 π 7 π π π 4 4 4 4 π 4 7 π 7 π π π 4 4 4 4 7 π π 7 π π π 7 π 7 π π 7 π π 4 4 4 4 4 4 4 4 4 4 • Q: Why T gates? • A: ∼ 100X more overhead in fault-tolerant quantum computing 2 2 A Game of Surface Codes . Litinski 2019 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 17 / 26
T-count reduction π π 4 4 π 7 π π 7 π 4 4 4 4 π 4 7 π π 7 π π 4 4 4 4 7 π 7 π 7 π 7 π 7 π π π π π π 4 4 4 4 4 4 4 4 4 4 ↓ 7 π 7 π 7 π 7 π 7 π π π π π π 4 4 4 4 4 4 4 4 4 4 π 4 π 4 7 π 7 π π 4 4 4 ↓ π 2 π 3 π 2 2 π 4 7 π 7 π π π 4 4 4 4 7 π π 7 π π π 7 π 7 π π 7 π π 4 4 4 4 4 4 4 4 4 4 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 18 / 26
T-count reduction Circuit n T Best prev. Method PyZX adder 8 24 399 213 RM m 173 Adder8 23 266 56 NRSCM 56 • Compared with state of the art for Adder16 47 602 120 NRSCM 120 Adder32 95 1274 248 NRSCM 248 (ancilla-free) T-count reduction: Adder64 191 2618 504 NRSCM 504 barenco-tof3 5 28 16 Tpar 16 • Amy, Maslov, Mosca. 2014 barenco-tof4 7 56 28 Tpar 28 barenco-tof5 9 84 40 Tpar 40 barenco-tof10 19 224 100 Tpar 100 • Amy, Mosca. 2016 tof 3 5 21 15 Tpar 15 tof 4 7 35 23 Tpar 23 • Heyfron, Campbell. 2018 tof 5 9 49 31 Tpar 31 tof 10 19 119 71 Tpar 71 • Nam et al . 2018 csla-mux 3 15 70 58 RM r 62 csum-mux 9 30 196 76 RM r 84 • As of March 2019: cycle17 3 35 4739 1944 RM m 1797 gf( 2 4 )-mult 12 112 56 TODD 68 gf( 2 5 )-mult 15 175 90 TODD 115 • 26 / 36 ≈ 72% match SotA gf( 2 6 )-mult 18 252 132 TODD 150 gf( 2 7 )-mult 21 343 185 TODD 217 • 6 / 36 ≈ 17% beat SotA gf( 2 8 )-mult 24 448 216 TODD 264 ham15-low 17 161 97 Tpar 97 ham15-med 17 574 230 Tpar 212 • In April 2019, Zhang & Chen matched ham15-high 20 2457 1019 Tpar 1019 hwb 6 7 105 75 Tpar 75 PyZX numbers with circuit method hwb 8 12 5887 3531 RM m & r 3517 mod-mult-55 9 49 28 TODD 35 mod-red-21 11 119 73 Tpar 73 • In Nov 2019, de Beaudrap, Bian, & Wang mod5 4 5 28 16 Tpar 8 nth-prime 6 9 567 400 RM m & r 279 beat SotA again with new ZX method + nth-prime 8 12 6671 4045 RM m & r 4047 qcla-adder 10 36 589 162 Tpar 162 TODD qcla-com 7 24 203 94 RM m 95 qcla-mod 7 26 413 235 NRSCM 237 rc-adder 6 14 77 47 RM m & r 47 vbe-adder 3 10 70 24 Tpar 24 Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 19 / 26
Correctness • PyZX optimiser is self-checking : CD † � 1 C � D = ⇒ � �� � � �� � optimising checking Aleks Kissinger ZX-calculus and Quantum Software FSQC 2020 20 / 26
Recommend
More recommend