Hacker News new | past | comments | ask | show | jobs | submit login
Catala: a programming language for socio-fiscal legislative literate programming (github.com/catalalang)
98 points by computerlab on Oct 31, 2020 | hide | past | favorite | 37 comments



If you are intrigued by the idea that law can and will be represented as computer code / data, here are a few link to go deeper :

* British national act as a logic program (1982): the paper that is the based of most current effort in this domain https://www.researchgate.net/publication/234805335_The_Briti...

* Standford codex LSP initiative that try to standarize the format in which legal rule will be encoded https://law.stanford.edu/publications/developing-a-legal-spe... (as far as I know the initiative is still going, don't hesitate to contact oliver goodenough if you want to get involved)

* OECD recently publish (2 weeks a go) a full repport on current initiative in the domain https://www.oecd-ilibrary.org/governance/cracking-the-code_3...

* There was a workshop at last ICAIL where a lot of people showed their progress on the topic (link to all demo video in this gdoc : https://docs.google.com/document/u/0/d/1-7cJ0KsYzQ8IOY3L_bYX...)

* MIT started a journal on the topic ~1 year ago https://law.mit.edu/

If you want to work on this topic DM me :)


Do you think it might be possible to eventually use a Deep Learning model like GPT-3 to do the formalisation for us? It seems like a herculean task to do it by hand.


GPT-3 is a good step but not enough. We had some good result trying to use it to translate legaleese to more parasable pseudo code. However there is still to much approximation for it to be useful today.

Short/mid term I believe that we will have tool allowing lawyer / regulator to draft in a formal form from which we will derive the legaleese. The stanford LSP is pushing in this direction and there is early tentative tools already published such as blawx or Oracle Policy Automation. I m aware of at least 3 other tool under development that push for this paradigm.

Fun fact one of the earliest effort in computational law involve lawyer writing contract in a formal english in ~1957 (original paper still full of good ideas on legal formalism https://digitalcommons.law.yale.edu/cgi/viewcont )


I was wandering the same thing, here in my country a lot of reforms are stoped by the constitutional tribunal, basically they are a bunch of lawyers that implement a function,

constitutional :: Constitution -> (Law | Reform) -> Boolean

I really would like to see if one can train a model like that. seeing what gpt-3 can do, it seems that we are not that far away to achieve something like an AI lawyer.


It's already been tried : http://ceur-ws.org/Vol-2143/paper9.pdf. In a nutshell : NLP techniques don't work so well on the text of law, because it's too messy.


> If you want to work on this topic DM me :)

hnchat seems dead from a quick google :(

Deeply interested in this, thought a lot about this before, but can't work on it right now (at my startup). Do you have a blog or something? If private, pls shoot me a mail (address in bio)


I think this topic is really interesting. There is also an effort to encode US law: https://law.stanford.edu/codex-the-stanford-center-for-legal... (It's independent of this one as far as I know)

Wouldn't it be great to have laws managed in a git repo.


How do those similar projects actually handle ambiguously written laws? All that I see in Catala paper is basically "let this whole thing bounce back and forth between lawyer and programmer until it becomes unambiguous."


To be honest I don't really know in detail. There is an interesting paper about "Computational Law": http://logic.stanford.edu/publications/genesereth/complaw.pd... which says (§3):

Computational Law derives its power from its emphasis on deductive reasoning. As such, it simply cannot be applied in cases requiring analogical or inductive reasoning. Fortunately, it is sometimes the case that there are enough judicial rulings that the net result is, in effect, a set of categorical constraints even where the original wording of the regulations is not definitive. And, in such cases, Computational Law can be applied to the combination of regulatory and judicial law.

I guess this is why the French programmers are concentrating on the tax code which might be more precisely written!


Hi, Catala author here :) Totally, tax law is usually the most precisely written. But it's still ambiguous as Sarah Lawsky points out https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2987065


I agree. There are a couple interesting platform pieces before things start getting really interesting:

1) Getting US laws encoded in GitHub

2) Building a better proof of identity/residence verification provider that feels more like Authy and less like shitty SSN/identity questions, which provides a semi-anonymous user ID and geo range

3) Building a distributed consensus layer on top of that which makes it easy to conduct and tally anonymous polls across geo ranges for identity/geo verified users


Cool idea but also comes across as an ultra French idea. French court ruling a as far as I understand are very technocratic. You just must paragraphs applied to reach verdict.

At least here in Norway there tends to be a strong emphasis on laws being readable by the common people so regular people better know their rights.

E.g. we read consumer laws in high school and that was easy. Older laws are written in a very lawyer like Danish form. But there is continuous effort to simplify law texts.

While I do have an affinity for rigorous definitions I think this could make the law text less accessible to common people.

Also based upon what I know of the US system, it would not work as t he Us system is strongly based on past rulings rather than paragraphs. That makes a formalized approach much harder.


Hi, Catala author here :) I totally agree that law should be readable and the Norwegian initiative seems great ! However at least in France we're stuck with the law he have and while some are rightfully proposing some simplification (https://www.revolution-fiscale.fr/), we need a good way to apply the current law faithfully not to end up in situations like this one: https://twitter.com/DMerigoux/status/1304367420639973381.


I can’t think a worse name for a programming language that of an actual language.


> The language is named after Pierre Catala, a professor of law who pionneered the French legaltech by creating a computer database of law cases, Juris-Data.


By the way: catala is latin spelling of bengali name for a fish as well.


The human language is called Catalan in English and català in Catalan.


As a catalan myself I’m well aware of the spelling, but good luck trying to explain that to a search engine.

I get regular hits while looking up Rust just because there’s a game with the same name.


Insightful comment that really adds something to the conversation. Thank you!


In Russian katala means a card sharp, a crook. The name has a great fit for the language purpose.


It’s such a French thing to write software supporting French and English while making all the examples in README French...


There is an example of the US tax code on the landing page of website (https://catala-lang.org/en/) so they actually seem to have also tried the language on English-written law!


Maybe that was done to prove the point that the language, unlike most other programming languages, does not have any built-in English assumptions?

Also I think the examples are actually quite comprehensible even to non french speakers.


They aren’t. Also, it doesn’t seem to make sense to use only French examples in midst of English written text. I don’t think its a major problem of course and main project page contains English examples, I just found that funny.


This is something I've given some thought to since encountering logic programming. Could something like this be done in say, Prolog?


Logic oriented programming is really well suit for this problem.

Most complaw research happen in the logic department of universities.

- blawx.com use ergo 2 in the backend

- Kowalski ( author of iso prolog ) wrote a paper on the topic in the 80's http://www.doc.ic.ac.uk/~rak/papers/British%20N ationality%20Act.pdf


Yes it could, although I'm not sure there is a single Prolog system running in production inside a large government agency at the moment.

Also Prolog does not solve all the problems related to programming the law, especially it doesn't have a nice way to handle redefinitions of variables with legislative exceptions as described https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3088206


Interesting idea. Some complications are that most laws are written as updates, or change sets, to existing laws. Then there's the agency administrative rules that clarify what the laws are supposed to do, and the administrative law rulings about the rules, and the civil law rulings about the administrative law rulings, etc.


https://news.ycombinator.com/item?id=24731327 Compiler for the M language of the French DGFiP


Does it handle implicit special cases (rich, connected, etc.)?

I kid, I kid...


Hi, Catala author here :) Since I'm here please shoot your questions, I'll try to answer them.


How is this different from normal languages such as Java? Lawyers do not have a problem to learn actual programming language. This does not have a IDE support and all the goodies.

We implemented tax law. Split each paragraph as a javadoc for method. Manually calculated data were read from excel sheets, and unit tested. We even used Jira for bug tracking and integration.


So what is the actual benefit of having the law represented in a programming language?


It helps the State and private organizations to comply with the law when computing income tax, payroll taxes, etc. There's a huge gap between the law and how it is applied in some situations https://twitter.com/DMerigoux/status/1304367420639973381


how does it handle the effective date of a new rule, or retro active rule?

That is a challenge in writing billing or insurance policies management applications.


Wow. Cool idea but naming a programming language that isn’t related to the spoken and written language with the same name is a terrible way to get traction for it.


Are Executive Orders considered hotfixes?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: