Document Open Access Logo

Kalas: A Verified, End-To-End Compiler for a Choreographic Language

Authors Johannes Åman Pohjola, Alejandro Gómez-Londoño , James Shaker, Michael Norrish

Thumbnail PDF


  • Filesize: 0.92 MB
  • 18 pages

Document Identifiers

Author Details

Johannes Åman Pohjola
  • University of New South Wales, Sydney, Australia
Alejandro Gómez-Londoño
  • Chalmers University of Technology, Gothenburg, Sweden
James Shaker
  • Australian National University, Canberra, Australia
Michael Norrish
  • Australian National University, Canberra, Australia


We are grateful to Marco Carbone, Rob van Glabbeek and Magnus Myreen for insightful discussion on this work.

Cite AsGet BibTex

Johannes Åman Pohjola, Alejandro Gómez-Londoño, James Shaker, and Michael Norrish. Kalas: A Verified, End-To-End Compiler for a Choreographic Language. In 13th International Conference on Interactive Theorem Proving (ITP 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 237, pp. 27:1-27:18, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2022)


Choreographies are an abstraction for globally describing deadlock-free communicating systems. A choreography can be compiled into multiple endpoints preserving the global behavior, providing a path for concrete system implementations. Of course, the soundness of this approach hinges on the correctness of the compilation function. In this paper, we present a verified compiler for Kalas, a choreographic language. Its machine-checked end-to-end proof of correctness ensures all generated endpoints adhere to the system description, preserving the top-level communication guarantees. This work uses the verified CakeML compiler and Hol4 proof assistant, allowing for concrete executable implementations and statements of correctness at the machine code level for multiple architectures.

Subject Classification

ACM Subject Classification
  • Theory of computation → Concurrency
  • Software and its engineering → Software verification
  • Software and its engineering → Compilers
  • Choreographies
  • Interactive Theorem Proving
  • Compiler Verification


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Andreas Abel, Stephan Adelsberger, and Anton Setzer. Interactive programming in Agda - Objects and graphical user interfaces. J. Funct. Program., 27:e8, 2017. URL:
  2. Marco Carbone and Fabrizio Montesi. Deadlock-freedom-by-design: Multiparty asynchronous global programming. In Roberto Giacobazzi and Radhia Cousot, editors, The 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '13, Rome, pages 263-274. ACM, 2013. URL:
  3. David Castro, Francisco Ferreira, and Nobuko Yoshida. EMTST: engineering the meta-theory of session types. In Armin Biere and David Parker, editors, Tools and Algorithms for the Construction and Analysis of Systems - 26th International Conference, TACAS 2020, Dublin, Ireland. Proceedings, Part II, volume 12079 of Lecture Notes in Computer Science, pages 278-285. Springer, 2020. URL:, URL:
  4. Coq Development Team. The Coq proof assistant, version 8.11.0, January 2020. URL:
  5. Luís Cruz-Filipe and Fabrizio Montesi. A core model for choreographic programming. Theor. Comput. Sci., 802:38-66, 2020. URL:
  6. Luís Cruz-Filipe, Fabrizio Montesi, and Marco Peressotti. Certifying choreography compilation. In Antonio Cerone and Peter Csaba Ölveczky, editors, Theoretical Aspects of Computing - ICTAC 2021 - 18th International Colloquium, Virtual Event, Nur-Sultan, Kazakhstan, September 8-10, 2021, Proceedings, volume 12819 of Lecture Notes in Computer Science, pages 115-133. Springer, 2021. URL:
  7. Luís Cruz-Filipe, Fabrizio Montesi, and Marco Peressotti. Formalising a Turing-complete choreographic language in Coq. In Liron Cohen and Cezary Kaliszyk, editors, 12th International Conference on Interactive Theorem Proving, ITP 2021. Rome, Italy (Virtual Conference), volume 193 of LIPIcs, pages 15:1-15:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2021. URL:, URL:
  8. Mariangiola Dezani-Ciancaglini, Dimitris Mostrous, Nobuko Yoshida, and Sophia Drossopoulou. Session types for object-oriented languages. In Dave Thomas, editor, ECOOP 2006 - Object-Oriented Programming, 20th European Conference, Nantes, France. Proceedings, volume 4067 of Lecture Notes in Computer Science, pages 328-352. Springer, 2006. URL:
  9. Matthew Fernandez, June Andronick, Gerwin Klein, and Ihor Kuz. Automated verification of RPC stub code. In Nikolaj Bjørner and Frank S. de Boer, editors, FM 2015: Formal Methods - 20th International Symposium, Oslo, Norway. Proceedings, volume 9109 of Lecture Notes in Computer Science, pages 273-290. Springer, 2015. URL:
  10. Simon J. Gay and Vasco Thudichum Vasconcelos. Linear type theory for asynchronous session types. J. Funct. Program., 20(1):19-50, 2010. URL:
  11. Alejandro Gómez-Londoño, Johannes Åman Pohjola, Hira Taqdees Syeda, Magnus O. Myreen, and Yong Kiam Tan. Do you have space for dessert? a verified space cost semantics for CakeML programs. Proc. ACM Program. Lang., 4(OOPSLA):204:1-204:29, 2020. URL:
  12. Rayan Hallal, Mohamad Jaber, and Rasha Abdallah. From global choreography to efficient distributed implementation. In 2018 International Conference on High Performance Computing & Simulation, HPCS 2018, Orleans, France, July 16-20, 2018, pages 756-763. IEEE, 2018. URL:, URL:
  13. Andrew K. Hirsch and Deepak Garg. Pirouette: Higher-order typed functional choreographies. Proc. ACM Program. Lang., 6(POPL), January 2022. URL:
  14. Kohei Honda. Types for dyadic interaction. In Eike Best, editor, CONCUR '93, 4th International Conference on Concurrency Theory, Hildesheim, Germany, August 23-26, 1993, Proceedings, volume 715 of Lecture Notes in Computer Science, pages 509-523. Springer, 1993. URL:
  15. Kohei Honda, Vasco Thudichum Vasconcelos, and Makoto Kubo. Language primitives and type discipline for structured communication-based programming. In Chris Hankin, editor, Programming Languages and Systems - ESOP'98, 7th European Symposium on Programming, Lisbon. Proceedings, volume 1381 of Lecture Notes in Computer Science, pages 122-138. Springer, 1998. URL:
  16. Kohei Honda, Nobuko Yoshida, and Marco Carbone. Multiparty asynchronous session types. J. ACM, 63(1):9:1-9:67, 2016. URL:
  17. Gerwin Klein, June Andronick, Kevin Elphinstone, Gernot Heiser, David Cock, Philip Derrin, Dhammika Elkaduwe, Kai Engelhardt, Rafal Kolanski, Michael Norrish, Thomas Sewell, Harvey Tuch, and Simon Winwood. sel4: formal verification of an operating-system kernel. Commun. ACM, 53(6):107-115, 2010. URL:
  18. Ramana Kumar, Magnus O. Myreen, Michael Norrish, and Scott Owens. CakeML: a verified implementation of ML. In Suresh Jagannathan and Peter Sewell, editors, The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '14, San Diego, pages 179-192. ACM, 2014. URL:
  19. Ihor Kuz, Yan Liu, Ian Gorton, and Gernot Heiser. CAmkES: a component model for secure microkernel-based embedded systems. J. Syst. Softw., 80(5):687-699, 2007. URL:
  20. Fabrizio Montesi. Choreographic Programming. Ph.D. thesis, IT University of Copenhagen, 2013. URL:
  21. Magnus O. Myreen and Scott Owens. Proof-producing synthesis of ML from higher-order logic. In Peter Thiemann and Robby Bruce Findler, editors, ACM SIGPLAN International Conference on Functional Programming, ICFP'12, Copenhagen, Denmark, September 9-15, 2012, pages 115-126. ACM, 2012. URL:
  22. Matthias Neubauer and Peter Thiemann. An implementation of session types. In Bharat Jayaraman, editor, Practical Aspects of Declarative Languages, 6th International Symposium, PADL 2004, Dallas, TX, USA, June 18-19, 2004, Proceedings, volume 3057 of Lecture Notes in Computer Science, pages 56-70. Springer, 2004. URL:
  23. Randy Pollack. Closure under alpha-conversion. In Henk Barendregt and Tobias Nipkow, editors, Types for Proofs and Programs, International Workshop TYPES'93, Nijmegen, The Netherlands, May 24-28, 1993, Selected Papers, volume 806 of Lecture Notes in Computer Science, pages 313-332. Springer, 1993. URL:
  24. Konrad Slind and Michael Norrish. A brief overview of HOL4. In Otmane Aït Mohamed, César A. Muñoz, and Sofiène Tahar, editors, Theorem Proving in Higher Order Logics, 21st International Conference, TPHOLs 2008, Montréal. Proceedings, volume 5170 of Lecture Notes in Computer Science, pages 28-32. Springer, 2008. URL:
  25. Yong Kiam Tan, Magnus O. Myreen, Ramana Kumar, Anthony C. J. Fox, Scott Owens, and Michael Norrish. The verified CakeML compiler backend. J. Funct. Program., 29:e2, 2019. URL:
  26. Joseph Tassarotti, Ralf Jung, and Robert Harper. A higher-order logic for concurrent termination-preserving refinement. In Hongseok Yang, editor, Programming Languages and Systems - 26th European Symposium on Programming, ESOP 2017, Uppsala, Sweden. Proceedings, volume 10201 of Lecture Notes in Computer Science, pages 909-936. Springer, 2017. URL:, URL:
  27. Peter Thiemann. Intrinsically-typed mechanized semantics for session types. In Ekaterina Komendantskaya, editor, Proceedings of the 21st International Symposium on Principles and Practice of Programming Languages, PPDP 2019, Porto, Portugal, pages 19:1-19:15. ACM, 2019. URL:, URL:
  28. Rob J. van Glabbeek. On the validity of encodings of the synchronous in the asynchronous π-calculus. Inf. Process. Lett., 137:17-25, 2018. URL:
  29. Vasco Thudichum Vasconcelos, Simon J. Gay, and António Ravara. Type checking a multithreaded functional language with session types. Theor. Comput. Sci., 368(1-2):64-87, 2006. URL:
  30. Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha, Benjamin C. Pierce, and Steve Zdancewic. Interaction trees: representing recursive and impure programs in coq. Proc. ACM Program. Lang., 4(POPL):51:1-51:32, 2020. URL:
  31. Nobuko Yoshida and Vasco Thudichum Vasconcelos. Language primitives and type discipline for structured communication-based programming revisited: Two systems for higher-order session communication. Electron. Notes Theor. Comput. Sci., 171(4):73-93, 2007. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail