skip to main content

Qunity: A Unified Language for Quantum and Classical Computing

Published:11 January 2023Publication History
Skip Abstract Section

Abstract

We introduce Qunity, a new quantum programming language designed to treat quantum computing as a natural generalization of classical computing. Qunity presents a unified syntax where familiar programming constructs can have both quantum and classical effects. For example, one can use sum types to implement the direct sum of linear operators, exception-handling syntax to implement projective measurements, and aliasing to induce entanglement. Further, Qunity takes advantage of the overlooked BQP subroutine theorem, allowing one to construct reversible subroutines from irreversible quantum algorithms through the uncomputation of "garbage" outputs. Unlike existing languages that enable quantum aspects with separate add-ons (like a classical language with quantum gates bolted on), Qunity provides a unified syntax and a novel denotational semantics that guarantees that programs are quantum mechanically valid. We present Qunity's syntax, type system, and denotational semantics, showing how it can cleanly express several quantum algorithms. We also detail how Qunity can be compiled into a low-level qubit circuit language like OpenQASM, proving the realizability of our design.

References

  1. T Altenkirch and J Grattage. 2005. A functional quantum programming language. In 20th Annual IEEE Symposium on Logic in Computer Science (LICS’ 05). IEEE, Chicago, IL. 249–258. https://doi.org/10.1109/LICS.2005.1 arxiv:quant-ph/0409065. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andris Ambainis, Andrew M Childs, Ben W Reichardt, Robert Špalek, and Shengyu Zhang. 2010. Any AND-OR formula of size N can be evaluated in time N^1/2+o(1) on a quantum computer. SIAM J. Comput., 39, 6 (2010), 2513–2530. https://doi.org/10.1137/080712167 Google ScholarGoogle ScholarCross RefCross Ref
  3. Matthew Amy, Martin Roetteler, and Krysta M. Svore. 2017. Verified Compilation of Space-Efficient Reversible Circuits. In Computer Aided Verification, Rupak Majumdar and Viktor Kunčak (Eds.). Springer International Publishing, Cham. 3–21. isbn:978-3-319-63390-9 https://doi.org/10.1007/978-3-319-63390-9_1 arxiv:1603.01635. Google ScholarGoogle ScholarCross RefCross Ref
  4. Pablo Arrighi and Gilles Dowek. 2017. Lineal: A linear-algebraic Lambda-calculus. Logical Methods in Computer Science, 13, 1 (2017), March, https://doi.org/10.23638/LMCS-13(1:8)2017 Google ScholarGoogle ScholarCross RefCross Ref
  5. Sheldon Axler. 2015. Linear Algebra Done Right (third ed.). Springer, Cham. https://doi.org/10.1007/978-3-319-11080-6 Google ScholarGoogle ScholarCross RefCross Ref
  6. Charles H Bennett, Ethan Bernstein, Gilles Brassard, and Umesh Vazirani. 1997. Strengths and Weaknesses of Quantum Computing. SIAM J. Comput., 26, 5 (1997), 1510–1523. https://doi.org/10.1137/S0097539796300933 arxiv:quant-ph/9701001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Benjamin Bichsel, Maximilian Baader, Timon Gehr, and Martin Vechev. 2020. Silq: A High-Level Quantum Language with Safe Uncomputation and Intuitive Semantics. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2020). Association for Computing Machinery, New York. 286–300. isbn:9781450376136 https://doi.org/10.1145/3385412.3386007 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Costin Bădescu and Prakash Panangaden. 2015. Quantum Alternation: Prospects and Problems. In Proceedings of the 12th International Workshop on Quantum Physics and Logic, Oxford, U.K., July 15-17, 2015, Chris Heunen, Peter Selinger, and Jamie Vicary (Eds.) (Electronic Proceedings in Theoretical Computer Science, Vol. 195). Open Publishing Association, Oxford, UK. 33–42. https://doi.org/10.4204/EPTCS.195.3 arxiv:1511.01567. Google ScholarGoogle ScholarCross RefCross Ref
  9. Kostia Chardonnet, Marc de Visme, Benoît Valiron, and Renaud Vilmart. 2022. The Many-Worlds Calculus: Representing Quantum Control. arxiv:2206.10234. Google ScholarGoogle Scholar
  10. Andrew M Childs, Ben W Reichardt, Robert Spalek, and Shengyu Zhang. 2007. Every NAND formula of size N can be evaluated in time N^1/2 + o(1) on a quantum computer. arxiv:quant-ph/0703015. Google ScholarGoogle Scholar
  11. Andrew M. Childs and Wim van Dam. 2010. Quantum algorithms for algebraic problems. Rev. Mod. Phys., 82 (2010), Jan, 1–52. https://doi.org/10.1103/RevModPhys.82.1 arxiv:0812.0380. Google ScholarGoogle ScholarCross RefCross Ref
  12. Andrew W Cross, Lev S Bishop, John A Smolin, and Jay M Gambetta. 2017. Open Quantum Assembly Language. arxiv:1707.03429. https://github.com/Qiskit/openqasm/tree/OpenQASM2.x Google ScholarGoogle Scholar
  13. Andrew W Cross, Ali Javadi-Abhari, Thomas Alexander, Niel de Beaudrap, Lev S Bishop, Steven Heidel, Colm A Ryan, John Smolin, Jay M Gambetta, and Blake R Johnson. 2021. OpenQASM 3: A broader and deeper quantum assembly language. arxiv:2104.14722. https://qiskit.github.io/openqasm/ Google ScholarGoogle Scholar
  14. David Deutsch. 1985. Quantum theory, the Church–Turing principle and the universal quantum computer. Proceedings of the Royal Society of London A, 400, 1818 (1985), 97–117. https://doi.org/10.1098/rspa.1985.0070 Google ScholarGoogle ScholarCross RefCross Ref
  15. Peng Fu, Kohei Kishida, and Peter Selinger. 2020. Linear Dependent Type Theory for Quantum Programming Languages. In Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS ’20). Association for Computing Machinery, New York, NY, USA. 440–453. https://doi.org/10.1145/3373718.3394765 arxiv:2004.13472. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Daniel Gottesman. 2010. An Introduction to Quantum Error Correction and Fault-Tolerant Quantum Computation. In Quantum Information Science and Its Contributions to Mathematics, Samuel J Lomonaco, Jr (Ed.) (Proceedings of Symposia in Applied Mathematics, Vol. 68). American Mathematical Society, Providence, RI. https://doi.org/10.1090/psapm/068 arxiv:0904.2557. Google ScholarGoogle ScholarCross RefCross Ref
  17. Jonathan Grattage. 2011. An Overview of QML With a Concrete Implementation in Haskell. In Proceedings of the Joint 5th International Workshop on Quantum Physics and Logic and 4th Workshop on Developments in Computational Models (QPL/DCM 2008). Electronic Notes in Theoretical Computer Science, 270, 1, 165–174. issn:1571-0661 https://doi.org/10.1016/j.entcs.2011.01.015 arxiv:0806.2735. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Jonathan James Grattage. 2006. A functional quantum programming language. Ph. D. Dissertation. University of Nottingham. http://eprints.nottingham.ac.uk/10250/ Google ScholarGoogle Scholar
  19. Alexander S Green, Peter LeFanu Lumsdaine, Neil J Ross, Peter Selinger, and Benoît Valiron. 2013. Quipper: A Scalable Quantum Programming Language. In Proceedings of the 34th Acm Sigplan Conference on Programming Language Design and Implementation. Association for Computing Machinery, New York, NY. 333–342. isbn:9781450320146 https://doi.org/10.1145/2491956.2462177 arxiv:1304.3390. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Robert B. Griffiths and Chi-Sheng Niu. 1996. Semiclassical Fourier Transform for Quantum Computation. Phys. Rev. Lett., 76 (1996), Apr, 3228–3231. https://doi.org/10.1103/PhysRevLett.76.3228 arxiv:quant-ph/9511007. Google ScholarGoogle ScholarCross RefCross Ref
  21. Teiko Heinosaari and Mário Ziman. 2011. The Mathematical Language of Quantum Theory: From Uncertainty to Entanglement. Cambridge University Press, Cambridge. https://doi.org/10.1017/CBO9781139031103 Google ScholarGoogle ScholarCross RefCross Ref
  22. Gérard Huet. 1980. Confluent Reductions: Abstract Properties and Applications to Term Rewriting Systems. J. ACM, 27, 4 (1980), Oct., 797–821. issn:0004-5411 https://doi.org/10.1145/322217.322230 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Roshan P. James and Amr Sabry. 2012. Information Effects. In Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’12). Association for Computing Machinery, New York, NY, USA. 73–84. isbn:9781450310833 https://doi.org/10.1145/2103656.2103667 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Phillip Kaye, Raymond Laflamme, and Michele Mosca. 2007. An Introduction to Quantum Computing. Oxford University Press, Oxford. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. E Knill. 1996. Conventions for quantum pseudocode. Los Alamos National Lab. https://doi.org/10.2172/366453 Google ScholarGoogle ScholarCross RefCross Ref
  26. Robin Kothari. 2014. Efficient algorithms in quantum query complexity. Ph. D. Dissertation. University of Waterloo. http://hdl.handle.net/10012/8625 Google ScholarGoogle Scholar
  27. Gushu Li, Li Zhou, Nengkun Yu, Yufei Ding, Mingsheng Ying, and Yuan Xie. 2020. Projection-Based Runtime Assertions for Testing and Debugging Quantum Programs. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 150, nov, 29 pages. https://doi.org/10.1145/3428218 arxiv:1911.12855. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Liyi Li, Finn Voichick, Kesha Hietala, Yuxiang Peng, Xiaodi Wu, and Michael Hicks. 2022. Verified Compilation of Quantum Oracles. In Proceedings of the ACM on Programming Languages. 6, Association for Computing Machinery, New York, NY, USA. Article 146, 27 pages. https://doi.org/10.1145/3563309 arxiv:2112.06700. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. M. H. A. Newman. 1942. On Theories with a Combinatorial Definition of “Equivalence”. Annals of Mathematics, 43, 2 (1942), 223–243. issn:0003486X https://doi.org/10.2307/1968867 Google ScholarGoogle ScholarCross RefCross Ref
  30. Michael A Nielsen and Isaac L Chuang. 2010. Quantum Computation and Quantum Information (10 th anniversary ed.). Cambridge University Press, Cambridge, UK. https://worldcat.org/en/title/700706156 Google ScholarGoogle Scholar
  31. Jennifer Paykin, Robert Rand, and Steve Zdancewic. 2017. Qwire: A Core Language for Quantum Circuits. In Proceedings of the 44 th Acm Sigplan Symposium on Principles of Programming Languages. Association for Computing Machinery, New York, NY. 846–858. isbn:9781450346603 https://doi.org/10.1145/3009837.3009894 Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. John Preskill. 2018. Quantum Computing in the NISQ era and beyond. Quantum, 2 (2018), Aug., issn:2521-327X https://doi.org/10.22331/q-2018-08-06-79 arxiv:1801.00862. Google ScholarGoogle ScholarCross RefCross Ref
  33. Robert Rand, Jennifer Paykin, Dong-Ho Lee, and Steve Zdancewic. 2019. ReQWIRE: Reasoning about Reversible Quantum Circuits. In Proceedings of the 15th International Conference on Quantum Physics and Logic (QPL), Halifax, Canada, June 3–7, 2018, Peter Selinger and Giulio Chiribella (Eds.) (Electronic Proceedings in Theoretical Computer Science, Vol. 287). Open Publishing Association, Waterloo, New South Wales. 299–312. https://doi.org/10.4204/EPTCS.287.17 arxiv:1901.10118. Google ScholarGoogle ScholarCross RefCross Ref
  34. Steven Roman. 2008. Advanced Linear Algebra (third ed.) (Graduate Texts in Mathematics, Vol. 135). Springer, New York. https://doi.org/10.1007/978-0-387-72831-5 Google ScholarGoogle ScholarCross RefCross Ref
  35. Neil Julien Ross. 2015. Algebraic and Logical Methods in Quantum Computation. Ph. D. Dissertation. Dalhousie University. arxiv:1510.02198. https://hdl.handle.net/10222/60819 Google ScholarGoogle Scholar
  36. Amr Sabry, Benoît Valiron, and Juliana Kaizer Vizzotto. 2018. From Symmetric Pattern-Matching to Quantum Control. In Foundations of Software Science and Computation Structures, Christel Baier and Ugo Dal Lago (Eds.). Springer International Publishing, Cham, Switzerland. 348–364. isbn:978-3-319-89366-2 https://doi.org/10.1007/978-3-319-89366-2_19 arxiv:1804.00952. Google ScholarGoogle ScholarCross RefCross Ref
  37. Peter Selinger. 2004. Towards a quantum programming language. Mathematical Structures in Computer Science, 14, 4 (2004), 527–586. https://doi.org/10.1017/S0960129504004256 Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Peter Selinger and Benoît Valiron. 2009. Quantum Lambda Calculus. In Semantic Techniques in Quantum Computation, Simon Gay and Ian Mackie (Eds.). Cambridge University Press, Cambridge, UK. 135–172. https://doi.org/10.1017/CBO9781139193313.005 Google ScholarGoogle ScholarCross RefCross Ref
  39. John van de Wetering. 2020. ZX-calculus for the working quantum computer scientist. arxiv:2012.13966. Google ScholarGoogle Scholar
  40. André van Tonder. 2004. A Lambda Calculus for Quantum Computation. SIAM J. Comput., 33, 5 (2004), 1109–1135. https://doi.org/10.1137/S0097539703432165 arxiv:quant-ph/0307150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Finn Voichick, Liyi Li, Robert Rand, and Michael Hicks. 2022. Qunity: A Unified Language for Quantum and Classical Computing (Extended Version). arxiv:2204.12384. Google ScholarGoogle Scholar
  42. Finn Voichick, Liyi Li, Robert Rand, and Michael Hicks. 2022. Qunity: A Unified Language for Quantum and Classical Computing (Type Checker). https://doi.org/10.5281/zenodo.7150282 Google ScholarGoogle ScholarCross RefCross Ref
  43. David Walker. 2004. Substructural Type Systems. In Advanced Topics in Types and Programming Languages, Benjamin C Pierce (Ed.). The MIT Press, Cambridge, MA. Google ScholarGoogle Scholar
  44. John Watrous. 2009. Quantum Computational Complexity. In Encyclopedia of Complexity and Systems Science, Robert A Meyers (Ed.). Springer, New York, NY. 7174–7201. isbn:978-0-387-30440-3 https://doi.org/10.1007/978-0-387-30440-3_428 arxiv:0804.3401. Google ScholarGoogle ScholarCross RefCross Ref
  45. W K Wootters and W H Zurek. 1982. A single quantum cannot be cloned. Nature, 299 (1982), 802–803. https://doi.org/10.1038/299802a0 Google ScholarGoogle ScholarCross RefCross Ref
  46. Mingsheng Ying. 2016. Foundations of Quantum Programming. Elsevier Science, Cambridge, MA. https://worldcat.org/en/title/1027777388 Google ScholarGoogle Scholar

Index Terms

  1. Qunity: A Unified Language for Quantum and Classical Computing

                              Recommendations

                              Comments

                              Login options

                              Check if you have access through your login credentials or your institution to get full access on this article.

                              Sign in

                              Full Access

                              • Article Metrics

                                • Downloads (Last 12 months)241
                                • Downloads (Last 6 weeks)33

                                Other Metrics

                              PDF Format

                              View or Download as a PDF file.

                              PDF

                              eReader

                              View online with eReader.

                              eReader
                              About Cookies On This Site

                              We use cookies to ensure that we give you the best experience on our website.

                              Learn more

                              Got it!