Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Qunity: A Unified Language for Quantum and Classical Computing

Published: 11 January 2023 Publication History

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.
[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
[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.
[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
[5]
Sheldon Axler. 2015. Linear Algebra Done Right (third ed.). Springer, Cham. https://doi.org/10.1007/978-3-319-11080-6
[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.
[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
[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.
[9]
Kostia Chardonnet, Marc de Visme, Benoît Valiron, and Renaud Vilmart. 2022. The Many-Worlds Calculus: Representing Quantum Control. arxiv:2206.10234.
[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.
[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.
[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
[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/
[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
[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.
[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.
[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.
[18]
Jonathan James Grattage. 2006. A functional quantum programming language. Ph. D. Dissertation. University of Nottingham. http://eprints.nottingham.ac.uk/10250/
[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.
[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.
[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
[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
[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
[24]
Phillip Kaye, Raymond Laflamme, and Michele Mosca. 2007. An Introduction to Quantum Computing. Oxford University Press, Oxford.
[25]
E Knill. 1996. Conventions for quantum pseudocode. Los Alamos National Lab. https://doi.org/10.2172/366453
[26]
Robin Kothari. 2014. Efficient algorithms in quantum query complexity. Ph. D. Dissertation. University of Waterloo. http://hdl.handle.net/10012/8625
[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.
[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.
[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
[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
[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
[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.
[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.
[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
[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
[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.
[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
[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
[39]
John van de Wetering. 2020. ZX-calculus for the working quantum computer scientist. arxiv:2012.13966.
[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.
[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.
[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
[43]
David Walker. 2004. Substructural Type Systems. In Advanced Topics in Types and Programming Languages, Benjamin C Pierce (Ed.). The MIT Press, Cambridge, MA.
[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.
[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
[46]
Mingsheng Ying. 2016. Foundations of Quantum Programming. Elsevier Science, Cambridge, MA. https://worldcat.org/en/title/1027777388

Cited By

View all
  • (2024)Modular Synthesis of Efficient Quantum UncomputationProceedings of the ACM on Programming Languages10.1145/36897858:OOPSLA2(2097-2124)Online publication date: 8-Oct-2024
  • (2024)Quff: A Dynamically Typed Hybrid Quantum-Classical Programming LanguageProceedings of the 21st ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3679007.3685063(65-81)Online publication date: 13-Sep-2024
  • (2024)The T-Complexity Costs of Error Correction for Control Flow in Quantum ComputationProceedings of the ACM on Programming Languages10.1145/36563978:PLDI(492-517)Online publication date: 20-Jun-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 7, Issue POPL
January 2023
2196 pages
EISSN:2475-1421
DOI:10.1145/3554308
  • Editor:
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution 4.0 International License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 January 2023
Published in PACMPL Volume 7, Issue POPL

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Kraus operators
  2. algebraic data types
  3. quantum subroutines
  4. reversible computing

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)476
  • Downloads (Last 6 weeks)92
Reflects downloads up to 14 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Modular Synthesis of Efficient Quantum UncomputationProceedings of the ACM on Programming Languages10.1145/36897858:OOPSLA2(2097-2124)Online publication date: 8-Oct-2024
  • (2024)Quff: A Dynamically Typed Hybrid Quantum-Classical Programming LanguageProceedings of the 21st ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3679007.3685063(65-81)Online publication date: 13-Sep-2024
  • (2024)The T-Complexity Costs of Error Correction for Control Flow in Quantum ComputationProceedings of the ACM on Programming Languages10.1145/36563978:PLDI(492-517)Online publication date: 20-Jun-2024
  • (2024)Quantum Control Machine: The Limits of Control Flow in Quantum ProgrammingProceedings of the ACM on Programming Languages10.1145/36498118:OOPSLA1(1-28)Online publication date: 29-Apr-2024
  • (2024)A Review on Prediction and Diagnosis of Mental Health Disorders Using Quantum Machine Learning Classifier2024 International Conference on Cybernation and Computation (CYBERCOM)10.1109/CYBERCOM63683.2024.10803194(493-498)Online publication date: 15-Nov-2024
  • (2024)On the theory of quantum and towards practical computation: A reviewJournal of Computational Science10.1016/j.jocs.2024.10245483(102454)Online publication date: Dec-2024
  • (2024)ReferencesFoundations of Quantum Programming10.1016/B978-0-44-315942-8.00030-7(435-447)Online publication date: 2024
  • (2024)IntroductionFoundations of Quantum Programming10.1016/B978-0-44-315942-8.00009-5(1-9)Online publication date: 2024
  • (2024)Approximate Relational Reasoning for Quantum ProgramsComputer Aided Verification10.1007/978-3-031-65633-0_22(495-519)Online publication date: 24-Jul-2024
  • (2024)Superoperators for Quantum Software EngineeringQuantum Software10.1007/978-3-031-64136-7_3(45-68)Online publication date: 23-Aug-2024

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media