skip to main content
research-article
Open Access
Artifacts Evaluated & Functional / v1.1

Catala: a programming language for the law

Published:19 August 2021Publication History
Skip Abstract Section

Abstract

Law at large underpins modern society, codifying and governing many aspects of citizens' daily lives. Oftentimes, law is subject to interpretation, debate and challenges throughout various courts and jurisdictions. But in some other areas, law leaves little room for interpretation, and essentially aims to rigorously describe a computation, a decision procedure or, simply said, an algorithm.

Unfortunately, prose remains a woefully inadequate tool for the job. The lack of formalism leaves room for ambiguities; the structure of legal statutes, with many paragraphs and sub-sections spread across multiple pages, makes it hard to compute the intended outcome of the algorithm underlying a given text; and, as with any other piece of poorly-specified critical software, the use of informal, natural language leaves corner cases unaddressed.

We introduce Catala, a new programming language that we specifically designed to allow a straightforward and systematic translation of statutory law into an executable implementation. Notably, Catala makes it natural and easy to express the general case / exceptions logic that permeates statutory law. Catala aims to bring together lawyers and programmers through a shared medium, which together they can understand, edit and evolve, bridging a gap that too often results in dramatically incorrect implementations of the law. We have implemented a compiler for Catala, and have proven the correctness of its core compilation steps using the F* proof assistant.

We evaluate Catala on several legal texts that are algorithms in disguise, notably section 121 of the US federal income tax and the byzantine French family benefits; in doing so, we uncover a bug in the official implementation of the French benefits. We observe as a consequence of the formalization process that using Catala enables rich interactions between lawyers and programmers, leading to a greater understanding of the original legislative intent, while producing a correct-by-construction executable specification reusable by the greater software ecosystem. Doing so, Catala increases trust in legal institutions, and mitigates the risk of societal damage due to incorrect implementations of the law.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

The presentation video of the paper: "Catala: A Programming Language for the Law" (ICFP2021)

3473582.mp4

Presentation Videos

References

  1. Danel Ahman, Cătălin Hriţcu, Kenji Maillard, Guido Martínez, Gordon Plotkin, Jonathan Protzenko, Aseem Rastogi, and Nikhil Swamy. 2017. Dijkstra monads for free. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. 515–529.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Layman E Allen. 1956. Symbolic logic: A razor-edged tool for drafting and interpreting legal documents. Yale LJ, 66 (1956), 833.Google ScholarGoogle ScholarCross RefCross Ref
  3. Anne Broache. 2008. IRS trudges on with aging computers. https://www.cnet.com/news/irs-trudges-on-with-aging-computers/Google ScholarGoogle Scholar
  4. Marie-Andrée Blanc. 2016. La modulation des allocations familiales : une erreur historique. Travail, genre et sociétés, 35, 1 (2016), 157–161. isbn:9782707189493 https://doi.org/10.3917/tgs.035.0157 Google ScholarGoogle ScholarCross RefCross Ref
  5. Gerhard Brewka and Thomas Eiter. 2000. Prioritizing default logic. In Intellectics and computational logic. Springer, 27–45.Google ScholarGoogle ScholarCross RefCross Ref
  6. Marie-Françoise Clergeau. 2016. Plaidoyer pour la modulation. Travail, genre et sociétés, 35, 1 (2016), 173–177. isbn:9782707189493 https://doi.org/10.3917/tgs.035.0173 Google ScholarGoogle ScholarCross RefCross Ref
  7. Alain Colmerauer and Philippe Roussel. 1996. The Birth of Prolog. Association for Computing Machinery, New York, NY, USA. 331–367.Google ScholarGoogle Scholar
  8. Sylvain Conchon, Jean-Christophe Filliâtre, and Julien Signoles. 2007. Designing a Generic Graph Library Using ML Functors.. Trends in functional programming, 8 (2007), 124–140.Google ScholarGoogle Scholar
  9. Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An Efficient SMT Solver. In Tools and Algorithms for the Construction and Analysis of Systems, C. R. Ramakrishnan and Jakob Rehof (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 337–340.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Merigoux Denis, Chataing Nicolas, and Protzenko Jonathan. 2021. Catala: A Programming Language for the Law. https://doi.org/10.5281/zenodo.4775161 Google ScholarGoogle ScholarCross RefCross Ref
  11. John Dewey. 1924. Logical method and law. Cornell LQ, 10 (1924), 17.Google ScholarGoogle Scholar
  12. Derek Doran, Sarah Schulz, and Tarek R Besold. 2017. What does explainable AI really mean? A new conceptualization of perspectives. arXiv preprint arXiv:1710.00794.Google ScholarGoogle Scholar
  13. Frank R. Konkel. 2018. The IRS system processing your taxes is almost 60 years old. https://www.nextgov.com/it-modernization/2018/03/irs-system-processing-your-taxes-almost-60-years-old/146770/Google ScholarGoogle Scholar
  14. Michael Genesereth. 2015. Computational Law. The Cop in the Backseat.Google ScholarGoogle Scholar
  15. Randy Goebel, Ajay Chander, Katharina Holzinger, Freddy Lecue, Zeynep Akata, Simone Stumpf, Peter Kieseberg, and Andreas Holzinger. 2018. Explainable ai: the new 42? In International cross-domain conference for machine learning and knowledge extraction. 295–303.Google ScholarGoogle Scholar
  16. Government Accountability Office (GAO). 2021. COVID-19: Urgent Actions Needed to Better Ensure an Effective Federal Response – Report to Congressional Committees. https://www.gao.gov/reports/GAO-21-191/##appendix24 Appendix 24, first table.Google ScholarGoogle Scholar
  17. Xiao He, Bohan Qin, Yan Zhu, Xing Chen, and Yi Liu. 2018. Spesc: A specification language for smart contracts. In 2018 IEEE 42nd Annual Computer Software and Applications Conference (COMPSAC). 1, 132–137.Google ScholarGoogle ScholarCross RefCross Ref
  18. Nils Holzenberger, Andrew Blair-Stanek, and Benjamin Van Durme. 2020. A Dataset for Statutory Reasoning in Tax Law Entailment and Question Answering. arXiv preprint arXiv:2005.05257.Google ScholarGoogle Scholar
  19. Tom Hvitved. 2011. Contract formalisation and modular implementation of domain-specific languages. Ph.D. Dissertation. Citeseer.Google ScholarGoogle Scholar
  20. Internal Revenue Service. [n.d.]. Exclusion of gain from sale of principal residence. https://www.law.cornell.edu/uscode/text/26/121Google ScholarGoogle Scholar
  21. Andrew W Keep and R Kent Dybvig. 2013. A nanopass framework for commercial compiler development. In Proceedings of the 18th ACM SIGPLAN international conference on Functional programming. 343–350.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. D. E. Knuth. 1984. Literate Programming. Comput. J., 27, 2 (1984), 01, 97–111.Google ScholarGoogle Scholar
  23. Sarah Lawsky. 2018. Formal Methods and the Law. https://popl18.sigplan.org/details/POPL-2018-papers/3/Formal-Methods-and-the-LawGoogle ScholarGoogle Scholar
  24. Sarah B. Lawsky. 2017. Formalizing the Code. Tax Law Review, 70, 377 (2017).Google ScholarGoogle Scholar
  25. Sarah B. Lawsky. 2018. A Logic for Statutes. Florida Tax Review.Google ScholarGoogle Scholar
  26. Sarah B Lawsky. 2020. Form as Formalization. Ohio State Technology Law Journal.Google ScholarGoogle Scholar
  27. Philip Leith. 2016. The rise and fall of the legal expert system. International Review of Law, Computers & Technology, 30, 3 (2016), 94–106.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Rodolphe Lepigre and Christophe Raffalli. 2018. Abstract representation of binders in ocaml using the bindlib library. arXiv preprint arXiv:1807.01872.Google ScholarGoogle Scholar
  29. Xavier Leroy. 2006. Formal Certification of a Compiler Back-end or: Programming a Compiler with a Proof Assistant. SIGPLAN Not., 41, 1 (2006), Jan., 42–54.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Kif Leswing. 2020. New Jersey needs volunteers who know COBOL, a 60-year-old programming language. https://www.cnbc.com/2020/04/06/new-jersey-seeks-cobol-programmers-to-fix-unemployment-system.htmlGoogle ScholarGoogle Scholar
  31. Guido Martínez, Danel Ahman, Victor Dumitrescu, Nick Giannarakis, Chris Hawblitzel, Cătălin HriŢcu, Monal Narasimhamurthy, Zoe Paraskevopoulou, Clément Pit-Claudel, Jonathan Protzenko, Tahina Ramananandro, Aseem Rastogi, and Nikhil Swamy. 2019. Meta-F*: Proof Automation with SMT, Tactics, and Metaprograms. In Programming Languages and Systems, Luís Caires (Ed.). Springer International Publishing, Cham. 30–59. isbn:978-3-030-17184-1Google ScholarGoogle Scholar
  32. Denis Merigoux, Raphaël Monat, and Jonathan Protzenko. 2021. A Modern Compiler for the French Tax Code. Compiler Construction.Google ScholarGoogle Scholar
  33. Yasuhiko Minamide, Greg Morrisett, and Robert Harper. 1996. Typed closure conversion. In Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on principles of programming languages. 271–283.Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Antoine Miné, Xavier Leroy, Pascal Cuoq, and Christophe Troestler. 2011. The Zarith OCaml library. https://github.com/ocaml/ZarithGoogle ScholarGoogle Scholar
  35. Jacques Monin. 2018. Louvois, le logiciel qui a mis l’armée à terre. https://www.franceinter.fr/emissions/secrets-d-info/secrets-d-info-27-janvier-2018Google ScholarGoogle Scholar
  36. Jason Morris. 2020. Spreadsheets for Legal Reasoning: The Continued Promise of Declarative Logic Programming in Law. Available at SSRN 3577239.Google ScholarGoogle Scholar
  37. Marcos A Pertierra, Sarah Lawsky, Erik Hemberg, and Una-May O’Reilly. 2017. Towards Formalizing Statute Law as Default Logic through Automatic Semantic Parsing.. In ASAIL@ ICAIL.Google ScholarGoogle Scholar
  38. François Pottier. 2016. Reachability and error diagnosis in LR (1) parsers. In Proceedings of the 25th International Conference on Compiler Construction. 88–98.Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. François Pottier and Yann Régis-Gianat. 2014. The Menhir Parser Generator. http://cambium.inria.fr/~fpottier/menhir/Google ScholarGoogle Scholar
  40. Mark Proctor. 2012. Drools: A Rule Engine for Complex Event Processing. In Proceedings of the 4th International Conference on Applications of Graph Transformations with Industrial Relevance (AGTIVE’11). Springer-Verlag, Berlin, Heidelberg. 2–2. https://doi.org/10.1007/978-3-642-34176-2_2 Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. R. Reiter. 1980. A logic for default reasoning. Artificial Intelligence, 13, 1 (1980), 81 – 132. Special Issue on Non-Monotonic Logic.Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Vincenzo Scoca, Rafael Brundo Uriarte, and Rocco De Nicola. 2017. Smart contract negotiation in cloud computing. In 2017 IEEE 10th International Conference on Cloud Computing (CLOUD). 592–599.Google ScholarGoogle ScholarCross RefCross Ref
  43. M. J. Sergot, F. Sadri, R. A. Kowalski, F. Kriwaczek, P. Hammond, and H. T. Cory. 1986. The British Nationality Act As a Logic Program. Commun. ACM, 29, 5 (1986), May, 370–386.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Sébastien Shulz. 2019. Un logiciel libre pour lutter contre l’opacité du système sociofiscal. Revue francaise de science politique, 69, 5 (2019), 845–868.Google ScholarGoogle Scholar
  45. Julien Signoles. 2011. The Calendar OCaml library. https://github.com/ocaml-community/calendarGoogle ScholarGoogle Scholar
  46. Nikhil Swamy, Catalin Hritcu, Chantal Keller, Aseem Rastogi, Antoine Delignat-Lavaud, Simon Forest, Karthikeyan Bhargavan, Cédric Fournet, Pierre-Yves Strub, Markulf Kohlweiss, Jean-Karim Zinzindohoué, and Santiago Zanella-Béguelin. 2016. Dependent Types and Multi-Monadic Effects in F*. In 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, 256–270. https://www.fstar-lang.org/papers/mumon/Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Jonathan Turner. 2016. Shape of errors to come. https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-come.htmlGoogle ScholarGoogle Scholar
  48. Jérôme Vouillon and Vincent Balat. 2014. From bytecode to JavaScript: the Js_of_ocaml compiler. Software: Practice and Experience, 44, 8 (2014), 951–972.Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Wikipedia contributors. 2021. Code of Ur-Nammu — Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/w/index.php?title=Code_of_Ur-Nammu&oldid=998720276 [Online; accessed 22-Feb-2021].Google ScholarGoogle Scholar
  50. Jakub Zakrzewski. 2018. Towards verification of Ethereum smart contracts: a formalization of core of Solidity. In Working Conference on Verified Software: Theories, Tools, and Experiments. 229–247.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Catala: a programming language for the law

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!