Using Hoare logic for quantum circuit optimization

By employing quantum mechanical phenomena such as superposition, entanglement, and interference, quantum computers promise to perform certain computations exponentially faster than any classical device. Precise control over these physical systems and proper shielding from unwanted interactions with the environment become more difficult as the space/time volume of the computation grows. Code optimization is thus crucial in order to reduce resource requirements to the greatest extent possible. Besides manual optimization, previous work has successfully adapted classical methods such as constant-folding and common subexpression elimination to the quantum domain. However, such classically-inspired methods fail to exploit certain optimization opportunities that arise due to entanglement. To address this insufficiency, we introduce an optimization methodology which employs Hoare triples in order to identify and exploit these optimization opportunities. We implement the optimizer using the Z3 Theorem Prover and the ProjectQ software framework for quantum computing and show that it is able to reduce the circuit area of our benchmarks by up to 5x.

[1]  M. Mariantoni,et al.  Surface codes: Towards practical large-scale quantum computation , 2012, 1208.0928.

[2]  Lauretta O. Osho,et al.  Axiomatic Basis for Computer Programming , 2013 .

[3]  Barenco,et al.  Elementary gates for quantum computation. , 1995, Physical review. A, Atomic, molecular, and optical physics.

[4]  Dmitri Maslov,et al.  Polynomial-Time T-Depth Optimization of Clifford+T Circuits Via Matroid Partitioning , 2013, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.

[5]  Samuel Kutin,et al.  Computation at a Distance , 2007, Chic. J. Theor. Comput. Sci..

[6]  J. Traub,et al.  Quantum algorithm and circuit design solving the Poisson equation , 2012, 1207.2485.

[7]  A. Harrow,et al.  Quantum algorithm for linear systems of equations. , 2008, Physical review letters.

[8]  Mingsheng Ying,et al.  Floyd--hoare logic for quantum programs , 2011, TOPL.

[9]  M. Hastings,et al.  Gate count estimates for performing quantum chemistry on small quantum computers , 2013, 1312.1695.

[10]  Alán Aspuru-Guzik,et al.  Faster quantum chemistry simulation on fault-tolerant quantum computers , 2012 .

[11]  M. Mosca,et al.  A Meet-in-the-Middle Algorithm for Fast Synthesis of Depth-Optimal Quantum Circuits , 2012, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.

[12]  Dmitri Maslov,et al.  Fast and efficient exact synthesis of single-qubit unitaries generated by clifford and T gates , 2012, Quantum Inf. Comput..

[13]  Martin Rötteler,et al.  Factoring using $2n+2$ qubits with Toffoli based modular multiplication , 2016, Quantum Inf. Comput..

[14]  Peter W. Shor,et al.  Algorithms for quantum computation: discrete logarithms and factoring , 1994, Proceedings 35th Annual Symposium on Foundations of Computer Science.

[15]  Charles H. Bennett,et al.  Logical reversibility of computation , 1973 .

[16]  Robert Wille,et al.  Exact Multiple-Control Toffoli Network Synthesis With SAT Techniques , 2009, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.

[17]  Yasuhiro Takahashi,et al.  A quantum circuit for shor's factoring algorithm using 2n + 2 qubits , 2006, Quantum Inf. Comput..

[18]  Giovanni De Micheli,et al.  SAT-based {CNOT, T} Quantum Circuit Synthesis , 2018, RC.

[19]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[20]  David Poulin,et al.  The Trotter step size required for accurate quantum simulation of quantum chemistry , 2014, Quantum Inf. Comput..

[21]  Alán Aspuru-Guzik,et al.  Exploiting Locality in Quantum Computation for Quantum Chemistry. , 2014, The journal of physical chemistry letters.

[22]  Stéphane Beauregard Circuit for Shor's algorithm using 2n+3 qubits , 2003, Quantum Inf. Comput..

[23]  Rolf Drechsler,et al.  Exact sat-based toffoli network synthesis , 2007, GLSVLSI '07.

[24]  William J. Zeng,et al.  A Practical Quantum Instruction Set Architecture , 2016, ArXiv.

[25]  M. Troyer,et al.  Elucidating reaction mechanisms on quantum computers , 2016, Proceedings of the National Academy of Sciences.

[26]  Margaret Martonosi,et al.  ScaffCC: a framework for compilation and analysis of quantum computing programs , 2014, Conf. Computing Frontiers.

[27]  Alan Bundy,et al.  The Automation of Proof by Mathematical Induction , 1999, Handbook of Automated Reasoning.

[28]  Samuel A. Kutin Shor's algorithm on a nearest-neighbor machine , 2006 .

[29]  Matthias Troyer,et al.  ProjectQ: An Open Source Software Framework for Quantum Computing , 2016, ArXiv.

[30]  Matthew B. Hastings,et al.  Improving quantum algorithms for quantum chemistry , 2014, Quantum Inf. Comput..

[31]  Martin Roetteler,et al.  Quantum circuits for floating-point arithmetic , 2018, RC.

[32]  Thierry Paul,et al.  Quantum computation and quantum information , 2007, Mathematical Structures in Computer Science.

[33]  John M. Martinis,et al.  State preservation by repetitive error detection in a superconducting quantum circuit , 2015, Nature.

[34]  Dmitri Maslov,et al.  Automated optimization of large quantum circuits with continuous parameters , 2017, npj Quantum Information.

[35]  Martin Rötteler,et al.  Q#: Enabling Scalable Quantum Computing and Development with a High-level DSL , 2018, RWDSL2018.

[36]  Anna Philippou,et al.  Tools and Algorithms for the Construction and Analysis of Systems , 2018, Lecture Notes in Computer Science.

[37]  Yasuhiro Takahashi,et al.  Quantum addition circuits and unbounded fan-out , 2009, Quantum Inf. Comput..

[38]  Lov K. Grover A fast quantum mechanical algorithm for database search , 1996, STOC '96.

[39]  Martin Rötteler,et al.  Optimizing Quantum Circuits for Arithmetic , 2018, ArXiv.

[40]  Matthias Troyer,et al.  A software methodology for compiling quantum programs , 2016, ArXiv.

[41]  Annie Y. Wei,et al.  Exponentially more precise quantum simulation of fermions in second quantization , 2015, 1506.01020.