Verified Compilation of Space-Efficient Reversible Circuits

  • Matthew AmyEmail author
  • Martin Roetteler
  • Krysta M. Svore
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10427)


The generation of reversible circuits from high-level code is an important problem in several application domains, including low-power electronics and quantum computing. Existing tools compile and optimize reversible circuits for various metrics, such as the overall circuit size or the total amount of space required to implement a given function reversibly. However, little effort has been spent on verifying the correctness of the results, an issue of particular importance in quantum computing. There, compilation allows not only mapping to hardware, but also the estimation of resources required to implement a given quantum algorithm, a process that is crucial for identifying which algorithms will outperform their classical counterparts. We present a reversible circuit compiler called ReVerC, which has been formally verified in F\(^\star \) and compiles circuits that operate correctly with respect to the input program. Our compiler compiles the Revs language [21] to combinational reversible circuits with as few ancillary bits as possible, and provably cleans temporary values.


  1. 1.
    Using the GNU Compiler Collection. Free Software Foundation, Inc. (2016).
  2. 2.
    Amy, M., Maslov, D., Mosca, M., Roetteler, M.: A meet-in-the-middle algorithm for fast synthesis of depth-optimal quantum circuits. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 32(6), 818–830 (2013)CrossRefGoogle Scholar
  3. 3.
    Amy, M., Roetteler, M., Svore, K.M.: Verified compilation of space-efficient reversible circuits. arXiv e-prints (2016).
  4. 4.
    Anticoli, L., Piazza, C., Taglialegne, L., Zuliani, P.: Towards quantum programs verification: from quipper circuits to QPMC. In: Devitt, S., Lanese, I. (eds.) RC 2016. LNCS, vol. 9720, pp. 213–219. Springer, Cham (2016). doi: 10.1007/978-3-319-40578-0_16 CrossRefGoogle Scholar
  5. 5.
    Bennett, C.H.: Logical reversibility of computation. IBM J. Res. Dev. 17, 525–532 (1973)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Beringer, L., Stewart, G., Dockins, R., Appel, A.W.: Verified compilation for shared-memory C. In: Shao, Z. (ed.) ESOP 2014. LNCS, vol. 8410, pp. 107–127. Springer, Heidelberg (2014). doi: 10.1007/978-3-642-54833-8_7 CrossRefGoogle Scholar
  7. 7.
    Chlipala, A.: A verified compiler for an impure functional language. In: Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2010), pp. 93–106. ACM (2010)Google Scholar
  8. 8.
    Claessen, K.: Embedded languages for describing and verifying hardware. Ph.D. thesis, Chalmers University of Technology and Göteborg University (2001)Google Scholar
  9. 9.
    Fournet, C., Swamy, N., Chen, J., Dagand, P.E., Strub, P.Y., Livshits, B.: Fully abstract compilation to JavaScript. In: Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2013), pp. 371–384. ACM (2013)Google Scholar
  10. 10.
    Green, A.S., LeFanu Lumsdaine, P., Ross, N.J., Selinger, P., Valiron, B.: Quipper: a scalable quantum programming language. In: Proceedings of the 34th Annual ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2013). ACM (2013)Google Scholar
  11. 11.
    Grover, L.K.: A fast quantum mechanical algorithm for database search. In: Proceedings of the 28th Annual ACM Symposium on the Theory of Computing (STOC 1996), pp. 212–219. ACM (1996)Google Scholar
  12. 12.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall Inc., Upper Saddle River (1993)zbMATHGoogle Scholar
  13. 13.
    Leroy, X.: Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In: Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2006), pp. 42–54. ACM (2006)Google Scholar
  14. 14.
    Lin, C.C., Jha, N.K.: RMDDS: Reed-Muller decision diagram synthesis of reversible logic circuits. J. Emerg. Technol. Comput. Syst. 10(2), 14 (2014)CrossRefGoogle Scholar
  15. 15.
    Markov, I.L.: Limits on fundamental limits to computation. Nature 512, 147–154 (2014)CrossRefGoogle Scholar
  16. 16.
    Maslov, D., Miller, D.M., Dueck, G.W.: Techniques for the synthesis of reversible Toffoli networks. ACM Trans. Des. Autom. Electron. Syst. 12(4), 42 (2007)CrossRefGoogle Scholar
  17. 17.
    Miller, D.M., Maslov, D., Dueck, G.W.: A transformation based algorithm for reversible logic synthesis. In: Proceedings of the 40th Annual Design Automation Conference (DAC 2003), pp. 318–323 (2003)Google Scholar
  18. 18.
    Neis, G., Hur, C.K., Kaiser, J.O., McLaughlin, C., Dreyer, D., Vafeiadis, V.: Pilsner: a compositionally verified compiler for a higher-order imperative language. In: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP 2015), pp. 166–178. ACM (2015)Google Scholar
  19. 19.
    Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge (2000)zbMATHGoogle Scholar
  20. 20.
    Ömer, B.: Quantum programming in QCL. Master’s thesis, Technical University of Vienna (2000)Google Scholar
  21. 21.
    Parent, A., Roetteler, M., Svore, K.M.: Reversible circuit compilation with space constraints. arXiv e-prints (2015).
  22. 22.
    Perconti, J.T., Ahmed, A.: Verifying an open compiler using multi-language semantics. In: Shao, Z. (ed.) ESOP 2014. LNCS, vol. 8410, pp. 128–148. Springer, Heidelberg (2014). doi: 10.1007/978-3-642-54833-8_8 CrossRefGoogle Scholar
  23. 23.
    Saeedi, M., Markov, I.L.: Synthesis and optimization of reversible circuits. ACM Comput. Surv. 45(2), 21 (2013)CrossRefzbMATHGoogle Scholar
  24. 24.
    Scherer, A., Valiron, B., Mau, S.C., Alexander, S., van den Berg, E., Chapuran, T.E.: Resource analysis of the quantum linear system algorithm. arXiv e-prints (2015).
  25. 25.
    Shafaei, A., Saeedi, M., Pedram, M.: Reversible logic synthesis of \(k\)-input, \(m\)-output lookup tables. In: Proceedings of the Conference on Design, Automation and Test in Europe (DATE 2013), pp. 1235–1240 (2013)Google Scholar
  26. 26.
    Shor, P.W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comput. 26(5), 1484–1509 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  27. 27.
    Swamy, N., Hriţcu, C., Keller, C., Rastogi, A., Delignat-Lavaud, A., Forest, S., Bhargavan, K., Fournet, C., Strub, P.Y., Kohlweiss, M., Zinzindohoue, J.K., Zanella-Béguelin, S.: Dependent types and multi-monadic effects in F\(^\star \). In: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016), pp. 256–270. ACM (2016)Google Scholar
  28. 28.
    Thomsen, M.K.: A functional language for describing reversible logic. In: Proceedings of the 2012 Forum on Specification and Design Languages (FDL 2012), pp. 135–142. IEEE (2012)Google Scholar
  29. 29.
    Wille, R., Drechsler, R.: Towards a Design Flow for Reversible Logic. Springer, Heidelberg (2010)CrossRefzbMATHGoogle Scholar
  30. 30.
    Wille, R., Grosse, D., Miller, D., Drechsler, R.: Equivalence checking of reversible circuits. In: Proceedings of the 39th IEEE International Symposium on Multiple-Valued Logic (ISMVL 2009), pp. 324–330 (2009)Google Scholar
  31. 31.
    Wille, R., Offermann, S., Drechsler, R.: Syrec: a programming language for synthesis of reversible circuits. In: Proceedings of the 2010 Forum on Specification and Design Languages (FDL 2010), pp. 1–6 (2010)Google Scholar
  32. 32.
    Yamashita, S., Markov, I.: Fast equivalence-checking for quantum circuits. In: Proceedings of the 2010 IEEE/ACM Symposium on Nanoscale Architectures (NANOARCH 2010), pp. 23–28 (2010)Google Scholar
  33. 33.
    Yokoyama, T., Glück, R.: A reversible programming language and its invertible self-interpreter. In: Proceedings of the 2007 Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 2007), pp. 144–153. ACM (2007)Google Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  • Matthew Amy
    • 1
    • 2
    Email author
  • Martin Roetteler
    • 3
  • Krysta M. Svore
    • 3
  1. 1.Institute for Quantum ComputingWaterlooCanada
  2. 2.David R. Cheriton School of Computer ScienceUniversity of WaterlooWaterlooCanada
  3. 3.Microsoft ResearchRedmondUSA

Personalised recommendations