Catala

Rules as Code language from Inria

Introductory paper

straightforward and systematic translation of statutory law into an executable implementation

NOTER_PAGE: (1 . 0.365975696926376)

natural and easy to express the general case / exceptions logic

NOTER_PAGE: (1 . 0.39742673338098644)

bring together lawyers and programmers through a shared medium

NOTER_PAGE: (1 . 0.40814867762687634)
NOTER_PAGE: (1 . 0.725518227305218)

Already disagree. Law needn't be textual - indeed this paper is itself proposing non-textual law, if we appreciate the differences between natural language text and code

he practice of law thus oftentimes requires substantial human input

NOTER_PAGE: (2 . 0.2087205146533238)

relevant to a given case

NOTER_PAGE: (2 . 0.22802001429592567)

classify and categorize

NOTER_PAGE: (2 . 0.26090064331665475)

computational law or sometimes rules as code, concerns itself with situations where entities are well-defined, and where human appreciation, judgement or interpretation are not generally expected

NOTER_PAGE: (2 . 0.3288062902072909)

the law is the result of a centuries-long process: its convoluted structure demands tremendous expertise and training to successfully navigate and understand, something that a computer programmer may not have.

NOTER_PAGE: (2 . 0.4403145103645461)

A natural thought is perhaps to try to simplify the law itself. Unfortunately, this recurrent theme of the political discourse often conflicts with the political reality

NOTER_PAGE: (2 . 0.8091493924231594)
NOTER_PAGE: (2 . 0.8413152251608292)

computation of the French income tax, only to discover that the tax returns of an entire nation were processed using an antiquated system designed in 1990, relying on 80,000 lines of code written in a custom, in-house language

NOTER_PAGE: (3 . 0.12580414581844174)

what??? why???

inability to evolve

NOTER_PAGE: (3 . 0.1951393852751966)

reproducing the computation extremely challenging

NOTER_PAGE: (3 . 0.21015010721944247)

lack of accountability

NOTER_PAGE: (3 . 0.2258756254467477)

tailored specifically for the purpose of faithfully, crisply translating computational law into executable specifications

NOTER_PAGE: (3 . 0.3280914939242316)

While a program’s control-flow (as a first approximation) makes forward progress, statutes frequently back-patch previous definitions and re-interpret earlier paragraphs within different contexts.

NOTER_PAGE: (3 . 0.6876340243030736)
NOTER_PAGE: (4 . 0.5453895639742673)

paragraph (A) modifies (b)(1) in place

NOTER_PAGE: (4 . 0.6533238027162259)

law is re-entrant and can call itself recursively under different conditions

NOTER_PAGE: (5 . 0.43459614010007147)

key takeaway is that, for a piece of law, one must process the entire document; barring that, the reader might be missing a crucial limitation that only surfaces much later in the text.

NOTER_PAGE: (5 . 0.6040028591851323)

indeed even this is not enough, there may be regulations, schedules, later laws overriding, to say nothing of case law

pattern of having a default case followed by exceptions. This nonmonotonic logic is known as default logic

NOTER_PAGE: (6 . 0.24803431022158687)

closest to the purposes of the law is known as prioritized default logic

NOTER_PAGE: (6 . 0.280914939242316)

Prioritized logic adds a strict partial order over defaults, to resolve conflicts when multiple defaults may be admissible at the same time.

NOTER_PAGE: (6 . 0.416011436740529)
NOTER_PAGE: (6 . 0.7869907076483202)

dates are triples of a year, month and a day

NOTER_PAGE: (7 . 0.5275196568977841)

Distinct from date is duration, the type of a time interval, always expressed as a number of days

NOTER_PAGE: (7 . 0.54253037884203)

up to the user to specify how "two years" should be interpreted

NOTER_PAGE: (7 . 0.5768406004288777)

non-experts are for the most part puzzled by compact notations

NOTER_PAGE: (7 . 0.6926375982844889)

generous keywords improve readability

NOTER_PAGE: (7 . 0.7262330235882773)

context keyword indicates that the value of the field might be determined later, depending on the context.

NOTER_PAGE: (7 . 0.777698355968549)

intuition is that scopes are functions and contexts are their parameters and local variables.

NOTER_PAGE: (7 . 0.8070050035739814)

the user relates context variables together, via the definition keyword, or the rule keyword for conditions

NOTER_PAGE: (8 . 0.38313080771979985)
NOTER_PAGE: (8 . 0.41815582558970693)

Catala desugars rules to definitions equipped with a default value of false

NOTER_PAGE: (8 . 0.4660471765546819)

Catala at first glance resembles a functional language with heavy syntactic sugar, diving into the subtleties of the law exhibits the need for two features

NOTER_PAGE: (11 . 0.2087205146533238)

define context variables through a combination of an (optional) default case, along with an arbitrary number of special cases

NOTER_PAGE: (11 . 0.2444603288062902)

out-of-order nature of definitions means that Catala is entirely declarative

NOTER_PAGE: (11 . 0.278770550393138)

law does not have general recursion

NOTER_PAGE: (11 . 0.30879199428162973)

our language is not Turing-complete

NOTER_PAGE: (11 . 0.3438170121515368)

seem to be universal features found in all statutes, regardless of the country or even the language

NOTER_PAGE: (11 . 0.3938527519656898)

it works in USA and France so that's all the cultures in the world?

NOTER_PAGE: (11 . 0.4424588992137241)

no

guiding design principle was to always guarantee that the Catala source code matches the structure of the law

NOTER_PAGE: (18 . 0.39742673338098644)

general case / exceptions drafting style

NOTER_PAGE: (18 . 0.45961401000714797)

law encodes a static priority structure

NOTER_PAGE: (18 . 0.4746247319513939)

either one exception applies, and the computation stops. Or if no exception applies, the parent definition is evaluated instead

NOTER_PAGE: (18 . 0.5268048606147249)

internal default calculus representation was drastically simplified

NOTER_PAGE: (18 . 0.6590421729807006)

made the semantics nearly impossible to explain; made the rules overly complicated and the proof of soundness very challenging; and more importantly, was not necessary to capture the essence of Western statutory law

NOTER_PAGE: (18 . 0.7062187276626162)

When the Catala code is compiled to OCaml, execution time drops to 0.5ms. Therefore, we conclude that performance problems are, at this stage of the project, nonexistent.

NOTER_PAGE: (22 . 0.48177269478198714)

the final intermediate representation of the Catala compiler is a pure and generic lambda calculus operating over simply-typed values

NOTER_PAGE: (22 . 0.8048606147248034)

possible to compile Catala to any programming language that has functions, arrays, structures, unions, and support for exceptions

NOTER_PAGE: (22 . 0.8413152251608292)
NOTER_PAGE: (23 . 0.4903502501786991)

this theoretical division of labor is artificial. Indeed, the natural language specification often proves insufficient or ambiguous

NOTER_PAGE: (23 . 0.6104360257326662)

validation of the implementation depends on lawyer-written test cases

NOTER_PAGE: (23 . 0.6619013581129378)

software engineering expertise is needed to produce maintainable, performant, high-quality code

NOTER_PAGE: (23 . 0.7741243745532523)

We deliberately introduced a bug in the code shown to the lawyers in this user study. The bug involved a ⩽ operator replaced by ⩾. Of the 7 who answered "Yes" to (5) in the second round, 2 were able to spot it, which we interpret to be a very encouraging indication

NOTER_PAGE: (25 . 0.3423874195854182)

Wait, so 5 of them incorrectly certified the code as correct?

NOTER_PAGE: (27 . 0.36025732666190136)

line of work around logic programming never took hold

NOTER_PAGE: (27 . 0.4410293066476054)

so far unsuccessful attempts were made to automate the translation using natural language processing techniques

NOTER_PAGE: (27 . 0.49535382416011436)

Others

NOTER_PAGE: (27 . 0.5239456754824875)
NOTER_PAGE: (27 . 0.5432451751250894)

optimistic proponents of computational law

NOTER_PAGE: (27 . 0.557541100786276)
NOTER_PAGE: (27 . 0.6254467476769121)