Symposium on Real-Time and Hybrid Systems pp 133-164 | Cite as

# \(Q|SI\rangle \) : A Quantum Programming Environment

## Abstract

This paper describes a quantum programming environment, named \(Q|SI\rangle \) , to support quantum programming using a quantum extension of the \(\mathbf {while}\)-language. Embedded in the .Net framework, the \(Q|SI\rangle \) platform includes a quantum \(\mathbf {while}\)-language compiler and a suite of tools to simulate quantum computation, optimize quantum circuits, analyze and verify quantum programs. This paper demonstrates \(Q|SI\rangle \) in use. Quantum behaviors are simulated on classical platforms with a combination of components and the compilation procedures for different back-ends are described in detail. \(Q|SI\rangle \) bridges the gap between quantum hardware and software. As a scalable framework, this platform allows users to code and simulate customized functions, optimize them for a range of quantum circuits, analyze the termination of a quantum program, and verify the program’s correctness (The software of \(Q|SI\rangle \) is available at http://www.qcompiler.com.).

## Keywords

Quantum programming Quantum compilation Quantum simulation Quantum program analysis Quantum program verification## Notes

### Acknowledgments

We are grateful to Professors Michael Blumenstein, Ian Burnett, Yuan Feng, and Glenn Wightwick for their helpful discussions and their strong supports of this project. We also acknowledge use of the IBM Q experience for this work. The views expressed are those of the authors and do not reflect the official policy or position of IBM or the IBM Q experience team.

## Supplementary material

## References

- 1.Barenco, A., Bennett, C.H., Cleve, R., DiVincenzo, D.P., Margolus, N., Shor, P., Sleator, T., Smolin, J.A., Weinfurter, H.: Elementary gates for quantum computation. Phys. Rev. A
**52**(5), 3457 (1995)CrossRefGoogle Scholar - 2.Beals, R., Brierley, S., Gray, O., Harrow, A.W., Kutin, S., Linden, N., Shepherd, D., Stather, M.: Efficient distributed quantum computing. In: Proc. R. Soc. A. vol. 469, p. 20120686. The Royal Society (2013)Google Scholar
- 3.Bennett, C.H., Brassard, G.: Quantum cryptography: public key distribution and coin tossing. Theor. Comput. Sci.
**560**, 7–11 (2014)MathSciNetCrossRefGoogle Scholar - 4.Bettelli, S., Calarco, T., Serafini, L.: Toward an architecture for quantum programming. Eur. Phys.J. D-Atomic, Mol. Opt. Plasma Phys.
**25**(2), 181–200 (2003)Google Scholar - 5.Dawson, C.M., Nielsen, M.A.: The solovay-kitaev algorithm. arXiv preprint quant-ph/ arXiv:0505030 (2005)
- 6.Devroye, L.: Sample-based non-uniform random variate generation. In: Proceedings of the 18th conference on Winter simulation, pp. 260–265 (1986)Google Scholar
- 7.Green, A.S., Lumsdaine, P.L., Ross, N.J., Selinger, P., Valiron, B.: Quipper: a scalable quantum programming language. In: ACM SIGPLAN Notices, vol. 48, pp. 333–342. ACM (2013)Google Scholar
- 8.Grover, L.K.: A fast quantum mechanical algorithm for database search. In: Proceedings of the twenty-eighth annual ACM symposium on Theory of computing, pp. 212–219. ACM (1996)Google Scholar
- 9.Harrow, A.W., Hassidim, A., Lloyd, S.: Quantum algorithm for linear systems of equations. Phys. Rev. Lett.
**103**(15), 150502 (2009)MathSciNetCrossRefGoogle Scholar - 10.Hirata, Y., Nakanishi, M., Yamashita, S., Nakashima, Y.: An efficient conversion of quantum circuits to a linear nearest neighbor architecture. Q. Inf. Comput.
**11**(1&2), 142–166 (2011)MathSciNetzbMATHGoogle Scholar - 11.qubit backend: IBM QX team,: ibmqx3 backend specification. Retrieved from https://ibm.biz/qiskit-ibmqx3 (2017)
- 12.qubit backend: IBM QX team,: ibmqx2 backend specification. Retrieved from https://ibm.biz/qiskit-ibmqx2 (2017)
- 13.JavadiAbhari, A., et al.: Scaffcc: a framework for compilation and analysis of quantum computing programs. In: Proceedings of the 11th ACM Conference on Computing Frontiers, p. 1 (2014)Google Scholar
- 14.JavadiAbhari, A., Patil, S., Kudrow, D., Heckey, J., Lvov, A., Chong, F.T., Martonosi, M.: Scaffcc: scalable compilation and analysis of quantum programs. Parallel Comput.
**45**, 2–17 (2015)CrossRefGoogle Scholar - 15.Jones, C., Gyure, M.F., Ladd, T.D., Fogarty, M.A., Morello, A., Dzurak, A.S.: A logical qubit in a linear array of semiconductor quantum dots. arXiv preprint arXiv:1608.06335 (2016)
- 16.Liu, T., Li, Y., Wang, S., Ying, M., Zhan, N.: A theorem prover for quantum hoare logic and its applications. arXiv preprint arXiv:1601.03835 (2016)
- 17.Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2010)Google Scholar
- 18.Ömer, B.: A procedural formalism for quantum computing (1998)Google Scholar
- 19.Sanders, J.W., Zuliani, P.: Quantum programming. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 80–99. Springer, Heidelberg (2000). https://doi.org/10.1007/10722010_6CrossRefGoogle Scholar
- 20.Selinger, P.: A brief survey of quantum programming languages. In: Kameyama, Y., Stuckey, P.J. (eds.) FLOPS 2004. LNCS, vol. 2998, pp. 1–6. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-24754-8_1CrossRefzbMATHGoogle Scholar
- 21.Shende, V., Bullock, S., Markov, I.: Synthesis of quantum-logic circuits. IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst.
**25**(6), 1000–1010 (2006)CrossRefGoogle Scholar - 22.Shor, P.W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Rev.
**41**(2), 303–332 (1999)MathSciNetCrossRefGoogle Scholar - 23.Shor, P.W., Preskill, J.: Simple proof of security of the bb84 quantum key distribution protocol. Phys. Rev. Lett.
**85**(2), 441 (2000)CrossRefGoogle Scholar - 24.Smelyanskiy, M., Sawaya, N.P., Aspuru-Guzik, A.: qhipster: the quantum high performance software testing environment. arXiv preprint arXiv:1601.07195 (2016)
- 25.Smith, R.S., Curtis, M.J., Zeng, W.J.: A practical quantum instruction set architecture. arXiv preprint arXiv:1608.03355 (2016)
- 26.Svore, K.M., Aho, A.V., Cross, A.W., Chuang, I., Markov, I.L.: A layered software architecture for quantum computing design tools. IEEE Comput.
**39**(1), 74–83 (2006)CrossRefGoogle Scholar - 27.Veldhorst, M., Yang, C., Hwang, J., Huang, W., Dehollain, J., Muhonen, J., Simmons, S., Laucht, A., Hudson, F., Itoh, K., et al.: A two-qubit logic gate in silicon. Nature
**526**(7573), 410–414 (2015)CrossRefGoogle Scholar - 28.Wecker, D., Svore, K.M.: Liquid: A software design architecture and domain-specific language for quantum computing. arXiv preprint arXiv:1402.4467 (2014)
- 29.Ying, M.: Floyd-hoare logic for quantum programs. ACM Trans. Program. Lang. Syst. (TOPLAS)
**33**(6), 19 (2011)CrossRefGoogle Scholar - 30.Ying, M.: Foundations of Quantum Programming. Morgan Kaufmann, Burlington (2016)CrossRefGoogle Scholar
- 31.Ying, M., Feng, Y.: Quantum loop programs. Acta Inf.
**47**(4), 221–250 (2010)MathSciNetCrossRefGoogle Scholar - 32.Ying, M., Feng, Y.: A flowchart language for quantum programming. IEEE Trans. Soft. Eng.
**37**(4), 466–485 (2011)CrossRefGoogle Scholar - 33.Ying, M., Ying, S., Wu, X.: Invariants of quantum programs: characterisations and generation. In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, pp. 818–832. ACM (2017)Google Scholar
- 34.Ying, M., Yu, N., Feng, Y., Duan, R.: Verification of quantum programs. Sci. Comput. Program.
**78**(9), 1679–1700 (2013)CrossRefGoogle Scholar