QPCF: Higher-Order Languages and Quantum Circuits

  • Luca Paolini
  • Mauro Piccolo
  • Margherita ZorziEmail author


qPCF is a paradigmatic quantum programming language that extends PCF with quantum circuits and a quantum co-processor. Quantum circuits are treated as classical data that can be duplicated and manipulated in flexible ways by means of a dependent type system. The co-processor is essentially a standard QRAM device, albeit we avoid to store permanently quantum states in between two co-processor’s calls. Despite its quantum features, qPCF retains the classic programming approach of PCF. We introduce qPCF syntax, typing rules, and its operational semantics. We prove fundamental syntactic properties of the system. Moreover, we provide some higher-order examples of circuit encoding.


PCF Quantum computing Quantum programming languages 



  1. 1.
    Altenkirch, T., Grattage, J.: A functional quantum programming language. In: Proceedings of 20th Annual IEEE Symposium on Logic in Computer Science, pp. 249–258. IEEE Computer Society (2005)Google Scholar
  2. 2.
    Altenkirch, T., Grattage, J., Vizzotto, J.K., Sabry, A.: An algebra of pure quantum programming. In: QPL05, (2005). ENTCSGoogle Scholar
  3. 3.
    Arrighi, P., Diaz-Caro, A.: A system F accounting for scalars. Logical methods in computer science 8(1), (Feb 2012)Google Scholar
  4. 4.
    Arrighi, P., Dowek, G.: Linear-algebraic lambda-calculus: higher-order, encodings, and confluence. In: Voronkov, A. (ed.) RTA, Lecture Notes in Computer Science, vol. 5117, pp. 17–31. Springer, (2008)Google Scholar
  5. 5.
    Aschieri, F., Zorzi, M.: Non-determinism, non-termination and the strong normalization of system T. In: Typed Lambda Calculi and Applications, 11th International Conference, TLCA 2013, Eindhoven, The Netherlands, 26–28 June 2013. Proceedings, Lecture Notes in Computer Science, vol. 7941 , pp. 31–47 (2013)Google Scholar
  6. 6.
    Aschieri, F., Zorzi, M.: On natural deduction in classical first-order logic: Curry-Howard correspondence, strong normalization and herbrand’s theorem. Theor. Comput. Sci. 625, 125–146 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Aspinall, D., Hofmann, M.: Dependent types. In: Pierce B., (ed.) Advanced Topics in Types and Programming Languages, chapter 2, pp. 45–86. MIT Press (2005)Google Scholar
  8. 8.
    Benioff, P.: The computer as a physical system: a microscopic quantum mechanical Hamiltonian model of computers as represented by Turing machines. J. Stat. Phys. 22(5), 563–591 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Bettelli, S., Calarco, T., Serafini, L.: Toward an architecture for quantum programming. Eur. Phys. J. D At. Mol. Optical Plasma Phys. 25(2), 181–200 (2003)Google Scholar
  10. 10.
    Dal Lago, U., Masini, A., Zorzi, M.: Quantum implicit computational complexity. Theor. Comput. Sci. 411(2), 377–409 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Dal Lago, U., Masini, A., Zorzi, M.: Confluence results for a quantum lambda calculus with measurements. Electron. Notes Theor. Comput. Sci. 270(2), 251–261 (2011)CrossRefzbMATHGoogle Scholar
  12. 12.
    Dal Lago, U., Zorzi, M.: Probabilistic operational semantics for the lambda calculus. RAIRO Theor. Inf. Appl. 46(3), 413–450 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Dal Lago, U., Zorzi, M.: Wave-style token machines and quantum lambda calculi. In: Proceedings Third International Workshop on Linearity, LINEARITY 2014, Vienna, Austria, 13th July, 2014, Electronic Proceedings in Theoretical Computer Science 176, pp. 64–78Google Scholar
  14. 14.
    Dal Lago, U., Masini, A., Zorzi, M.: On a measurement-free quantum lambda calculus with classical control. Math. Struct. Comput. Sci. 19(2), 297–335 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Danos, V., Ehrhard, T.: Probabilistic coherence spaces as a model of higher-order probabilistic computation. Inf. Comput. 209(6), 966–991 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Danos, V., Kashefi, E., Panangaden, P.: The measurement calculus. J. ACM 54, 2 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Deutsch, D.: Quantum theory, the Church-Turing principle and the universal quantum computer. Proc. Roy. Soc. Lond. Ser. A 400, 97–117 (1985)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Di Cosmo, R., Dufour, T.: The equational theory of \(\langle {\mathbb{N}},0,1,+,\times,\uparrow \rangle \) is decidable, but not finitely axiomatisable. In: Baader, F., Voronkov, A. (eds.) Logic for Programming, Artificial Intelligence, and Reasoning, pp. 240–256. Springer, Berlin (2005)CrossRefGoogle Scholar
  19. 19.
    Diao, Z., Zubairy, M.S., Chen, G.: A quantum circuit design for grover’s algorithm. Z. Naturforschung A 57(8), 701–708 (2002)Google Scholar
  20. 20.
    Díaz-Caro, A., Arrighi, P., Gadella, M., Grattage, J.: Measurements and confluence in quantum lambda calculi with explicit qubits. Electron. Notes Theor. Comput. Sci. 270(1), 59–74 (2011)CrossRefzbMATHGoogle Scholar
  21. 21.
    DiVincenzo, D.P.: The physical implementation of quantum computation. Fortschr. Phys. 48, 771–783 (2000)CrossRefzbMATHGoogle Scholar
  22. 22.
    Ehrhard, T., Pagani, M., Tasson, C.: Full abstraction for probabilistic pcf. J. ACM 65(4), 23 (2018)MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    Escardó, M.: Semi-decidability of may, must and probabilistic testing in a higher-type setting. Electronic Notes in Theoretical Computer Science, 249:219 – 242, (2009). In: Proceedings of the 25th Conference on Mathematical Foundations of Programming Semantics, MFPSGoogle Scholar
  24. 24.
    Gaboardi, M., Paolini, L., Piccolo, M.: On the reification of semantic linearity. Math. Struct. Comput. Sci. 26(5), 829–867 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  25. 25.
    Glos, A., Sadowski, P.: Constructive quantum scaling of unitary matrices. Quant. Inf. Process. 15(12), 5145–5154 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Goubault-Larrecq, J.: Full abstraction for non-deterministic and probabilistic extensions of pcf i: The angelic cases. J. Logical Algebraic Methods Program., 84(1):155 – 184 (2015). Special Issue: The 23rd Nordic Workshop on Programming Theory (NWPT 2011) Special Issue: Domains X, International workshop on Domain Theory and applications, Swansea, 5–7 September, 2011Google Scholar
  27. 27.
    Goubault-Larrecq, J., Varacca, D.: Continuous random variables. In: IEEE 26th Annual Symposium on Logic in Computer Science, pp. 97–106, June 2011Google Scholar
  28. 28.
    Grattage, J.: An overview of QML with a concrete implementation in haskell. Electron. Notes Theor. Comput. Sci. 270(1), 165–174 (2011)CrossRefzbMATHGoogle Scholar
  29. 29.
    Green, A.S., Lumsdaine, P.L., Ross, N.J., Selinger, P., Valiron, B.: Quipper: A scalable quantum programming language. In: Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’13, pp. 333–342, New York, NY, USA, (2013)Google Scholar
  30. 30.
    Grover, L.K.: Quantum search on structured problems. In Quantum computing and quantum communications (Palm Springs, CA, 1998) Lecture Notes in Comput. Sci., , vol. 1509 , pp. 126–139. Springer, Berlin, (1999)Google Scholar
  31. 31.
    Hasuo, I., Hoshino, I.: Semantics of higher-order quantum computation via geometry of interaction. In: Proceedings of 26th Annual IEEE Symposium on Logic in Computer Science, pp. 237–246. IEEE Computer Society (2011)Google Scholar
  32. 32.
    Isham, C.J.: Lectures on quantum theory. Imperial College Press, London, (1995). Mathematical and structural foundationsGoogle Scholar
  33. 33.
    Jain, R., Ji, Z., Upadhyay, S., Watrous, J.: QIP = PSPACE. J. ACM 58(6), 30 (2011)MathSciNetCrossRefGoogle Scholar
  34. 34.
    Kaye, P., Laflamme, R., Mosca, M.: An Introduction to Quantum Computing. Oxford University Press, Oxford (2007)zbMATHGoogle Scholar
  35. 35.
    Kiefer, S., Murawski, A.S., Ouaknine, J., Wachter, B., Worrell, J.: Algorithmic probabilistic game semantics. Form. Methods Syst. Des. 43(2), 285–312 (2013)CrossRefzbMATHGoogle Scholar
  36. 36.
    Kitaev, A.Y., Shen, A.H., Vyalyi, M.N.: Classical and quantum computation. AMS, (2002)Google Scholar
  37. 37.
    Knill, E.: Conventions for quantum pseudocode. Technical report, Los Alamos National Laboratory (1996)CrossRefGoogle Scholar
  38. 38.
    Mahmoud, M., Felty, A.P.: Formalization of Metatheory of the Quipper Programming Language in a Linear Logic. University of Ottawa, Canada (2018)Google Scholar
  39. 39.
    Masini, A., Viganò, L., Zorzi, M.: Modal deduction systems for quantum state transformations. Mult. Valued Logic Soft Comput. 17(5–6), 475–519 (2011)MathSciNetzbMATHGoogle Scholar
  40. 40.
    Maymin, P.: The lambda-q calculus can efficiently simulate quantum computers. Technical Report arXiv:quant-ph/9702057 (1997)
  41. 41.
    Metodi, T.S., Faruque, A.I., Chong, F.T.: Quantum Computing for Computer Architects, 2nd edn. Morgan & Claypool Publishers (2011)Google Scholar
  42. 42.
    Miszczak, J.A.: High-level Structures for Quantum Computing, 1st edn. Morgan and Claypool Publishers, San Rafael (2014)Google Scholar
  43. 43.
    Nakahara, M., Ohmi, T.: Quantum Computing-From Linear Algebra to Physical Realizations. CRC Press, Boca Raton (2008)CrossRefzbMATHGoogle Scholar
  44. 44.
    Nielsen, M.: Universal quantum computation using only projective measurement, quantum memory, and preparation of the 0 state. Phys. Lett. 308(2–3), 96–100 (2003)MathSciNetCrossRefGoogle Scholar
  45. 45.
    Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2000)zbMATHGoogle Scholar
  46. 46.
    Nielsen, M.A., Chuang, I.L.: Quantum computation and quantum information, 10th edn. Cambridge University Press, Cambridge (2010)CrossRefzbMATHGoogle Scholar
  47. 47.
    Nishimura, H., Ozawa, M.: Perfect computational equivalence between quantum turing machines and finitely generated uniform quantum circuit families. Quant. Inf. Process. 8(1), 13–24 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  48. 48.
    Pagani, M., Selinger, P., Valiron, B.: Applying quantitative semantics to higher-order quantum computing. In: Proceedings of POPL ’14, pp. 647–658. ACM, (2014)Google Scholar
  49. 49.
    Paolini, L.: A stable programming language. Inf. Comput. 204(3), 339–375 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  50. 50.
    Paolini, L., Piccolo, M., Roversi, L.: A class of reversible primitive recursive functions. Electron. Notes Theor. Comput. Sci. 322(18605), 227–242 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  51. 51.
    Paolini, L., Piccolo, M., Roversi, L.: On a class of reversible primitive recursive functions and its turing-complete extensions. New Gener. Comput. 36(3), 233–256 (2018)CrossRefGoogle Scholar
  52. 52.
    Paolini, L., Pimentel, E., Ronchi Della Rocca, S.:An operational characterization of strong normalization. LNCS 3921, 367–381 (2006)Google Scholar
  53. 53.
    Paolini, L., Roversi, L., Zorzi, M.: Quantum programming made easy. In: V. d. P. Thomas Ehrhard, Maribel Fernández and L. T. de Falco, (ed.). In: Proceedings Joint International Workshop on Linearity & Trends in Linear Logic and Applications (Linearity-TLLA 2018), Oxford, UK, vol. 290 of Electronic Proceedings in Theoretical Computer Science, pp. 58–72, (2019)Google Scholar
  54. 54.
    Paolini, L., Zorzi, M.: qPCF: a language for quantum circuit computations. In: T. Gopal, G. Jäger, and S. Steila, (ed.). In: Theory and Applications of Models of Computation - 14th Annual Conference, TAMC 2017, Bern, Switzerland, 20-22 April 2017, Proceedings, vol. 10185 of Lecture Notes in Computer Science, pp. 455–469. Springer (2017)Google Scholar
  55. 55.
    Paykin, J., Rand, R., Zdancewic, S.: Qwire: A core language for quantum circuits. In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, pp. 846–858, New York, NY, USA, (2017)Google Scholar
  56. 56.
    Pierce, B.C.: Types and Programming Languages. The MIT Press, Cambridge (2002)zbMATHGoogle Scholar
  57. 57.
    Plotkin, G.D.: LCF considered as a programming language. Theor. Comput. Sci. 5, 223–255 (1977)MathSciNetCrossRefzbMATHGoogle Scholar
  58. 58.
    Richardson, D., Fitch, J.P.: The identity problem for elementary functions and constants. In: Proceedings of the International Symposium on Symbolic and Algebraic Computation, ISSAC ’94, pp. 285–290 (1994)Google Scholar
  59. 59.
    Rios, F., Selinger, P.: A categorical model for a quantum circuit description language (extended abstract). In: B. Coecke and A. Kissinger, (ed.) In: Proceedings 14th International Conference on Quantum Physics and Logic, Nijmegen, The Netherlands, 3-7 July 2017, vol. 266 of Electronic Proceedings in Theoretical Computer Science, pp. 164–178. Open Publishing Association (2018)Google Scholar
  60. 60.
    Ross, N.J.: Algebraic and Logical Methods in Quantum Computation. Ph.D. thesis, Department of Mathematics and Statistics, Dalhousie University, (2015). . arXiv:1510.02198
  61. 61.
    Selinger, P.: Towards a quantum programming language. Math. Struct. Comput. Sci. 14(4), 527–586 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  62. 62.
    Selinger, P., Valiron, B.: A lambda calculus for quantum computation with classical control. Math. Struct. Comput. Sci. 16, 527–552 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  63. 63.
    Selinger, P., Valiron, B.: Semantic Techniques in Quantum Computation, Chapter Quantum Lambda Calculus, pp. 135–172. Cambridge University Press, Cambridge (2009)Google Scholar
  64. 64.
    Shor, P.W.: Algorithms for quantum computation: discrete logarithms and factoring. 35th Annual Symposium on Foundations of Computer Science (Santa Fe. NM, 1994), pp. 124–134. IEEE Comput. Soc. Press, Los Alamitos, CA (1994)Google Scholar
  65. 65.
    Shor, P.W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Rev. 41(2), 303–332 (1999). (electronic)Google Scholar
  66. 66.
    Shor, P.W.: Introduction to quantum algorithms. Proceedings of Symposia in Applied Mathematics 58, 143–160 (2002)MathSciNetCrossRefGoogle Scholar
  67. 67.
    Strubell, E.: An introduction to quantum algorithms. University of Massachusetts, Lecture notes (2011)Google Scholar
  68. 68.
    Valiron, B.: Quantum computation: from a programmer’s perspective. New Gener. Comput. 31(1), 1–26 (2013)CrossRefzbMATHGoogle Scholar
  69. 69.
    Valiron, B., Ross, N.J., Selinger, P., Alexander, D.S., Smith, J.M.: Programming the quantum future. Commun. ACM 58(8), 52–61 (2015)CrossRefGoogle Scholar
  70. 70.
    Vaux, L.: The algebraic lambda-calculus. Math. Struct. Comput. Sci. 19(5), 1029–1059 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  71. 71.
    Viganò, L., Volpe, M., Zorzi, M.: Quantum state transformations and branching distributed temporal logic. In: Proceedings of the 21st International Workshop on Logic, Language, Information, and Computation (WoLLIC), vol. 8652 of Lecture Notes in Computer Science, pp. 1–19. Springer (2014)Google Scholar
  72. 72.
    Viganò, L., Volpe, M., Zorzi, M.: A branching distributed temporal logic for reasoning about entanglement-free quantum state transformations. Inf. Comput. 255, 311–333 (2017)MathSciNetCrossRefzbMATHGoogle Scholar
  73. 73.
    Xi, H., Pfenning, F.: Dependent types in practical programming. In: Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’99, pp. 214–227, New York, NY, USA, (1999)Google Scholar
  74. 74.
    Ying, M.: Foundations of Quantum Programming, 1st edn. Morgan Kaufmann Publishers Inc (2016)Google Scholar
  75. 75.
    Zenger, C.: Indexed types. Theor. Comput. Sci. 187(1), 147–165 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  76. 76.
    Zorzi, M.: On quantum lambda calculi: a foundational perspective. Math. Struct. Comput. Sci. 26(7), 1107–1195 (2016)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer Nature B.V. 2019

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of TorinoTurinItaly
  2. 2.Department of Computer ScienceUniversity of VeronaVeronaItaly

Personalised recommendations