Catala is not at all about "proving the law" formally (I'm not even sure what it would mean?). It's about having a formal language to translate law into that both matches the way law is usually written ("default logic") and allows to make numerical computations on. This can typically be used to implement tax or benefits law so that it is way easier to check that the algorithm computing taxes/benefits is correct compared to the actual state of the art of using general purpose programming languages.
definition qualified_employee_discount
under condition is_property consequence
equals
if employee_discount >=
customer_price \* gross_profit_percentage
then customer_price \* gross_profit_percentage
else employee_discount
Dang, I wish all law was written like this instead of the purposefully obfuscated legalise of (lobbied) legislative lawyers meant to mislead people and slip in loopholes for their interest groups to profit of.
Clear legislature is definitely something every person in the world would benefit of - if the the country's administration would want that.
I don’t know if they do it, but it allows proving properties of the law. For example, that the tax increases with income or that an exception doesn’t accidentally increase the tax paid.
I love it. This is a step in the right direction to have a transparent database of existing laws and be able to consult them with your AI or anything capable to reason about them and explain the status quo of our national laws. I would love to see a similar setup for other countries.
The pipeline is multi-country by design. France already works as a second country (Légifrance data). Adding a new country means implementing 4 Python interfaces for your national gazette. The rest (markdown, git, web, API) is generic.
From this thread alone, people asked about Germany, Portugal, Sweden, Finland, Netherlands, and Brazil. If you know your country's open data source for legislation, a PR is the best way to help.
I'll be honest — I don't know how much time I'll be able to dedicate to this, but I'd love to build something big. Legislation is massive and scaling to more countries takes real infrastructure. I'm setting up an Open Collective to fund hosting and development: https://opencollective.com/legalize
It would have been cool if the commit authors reflected the actual politicians responsible for the reforms.
Find a law, run git blame and immediately know who’s responsible for it
This is brilliant. I wish this were available for all legislations. There's so many inefficiencies that are trivially solved with existing tech frameworks.
For others wondering, while most of the Franco-era laws were nuked in 1978, this does include lots of old laws (ie pre-20th C).
However, the source material starts with a sqashed commit in 1960 :) So no changelog before that. The BOE source though is pretty phenomonal, they've scanned files going back to the 1600s so far.
I think this is great. Only limit of git is I can't imagine "git blame" works. It would be nice to know who voted for and against each patch. Git isn't structured for collaborative commits.
Not only would be cool for laws to have appropiate time stamps so we can "go back in time to how it was at a certain moment", but also if we could have proper git commit diffs of how laws change over time. See this: https://www.boe.es/buscar/act.php?id=BOE-A-2015-11430
You can see how certain articles have the option to check "how that particular article was at each moment in time". That would be way harder to track, but it would be awesome if not only could you "go back in time and see what the law was" but also "how its been evolving".
Well done. I believe that Governments should have a Open Licence for copyright purposes like exists in the UK that allows Govt docs to be used for commercial purposes without issue. I would want to propose a step forward there so that the next generation of this open licence actually has a data set approach to making data sets available - possibly at cost. Governments are losing the ability to charge for nominal items in paper as digital is so openly available - they can make a revenue on providing data at large to public so that others can build or simply if not for free.
Well done and great to see items like this and great to see the comments.
Nice, I am going to this for Swedish law!
Any suggestions on how one can model parliament voting when a law passes using GitHub? Or all the work that preceded a law, that’s like a feature request or a bug report.
The biggest impediment to tracking law via git is that you can't commit anything with a timestamp before the unix epoch. And law almost certainly requires the historical antecedents in the repo too, if it's going to be useful.
It's sort of funny to think about how you'd format Thomas Jefferson's email address so that he could be credited as the author of this article or that amendment. I bet someone's already figured out how to do that though.
Looks like we're heading toward some resolution to the old problem 'ignorance of the law is no excuse'. Born in a world with plenty of laws, the jeopardy that goes with them, and no easy and reliable resources, that would certainly be welcome.
This is a key project, and I’m sure many countries have enough developers who might try and get it done, but a project that can do it for most legal systems (assuming the sources are on-line) would help a lot more people access legal resources.
Neat. I wonder if there are commercial products that are formal specifications of laws, decisions, etc. Such that you can reason on them via solvers etc.
233 comments
https://catala-lang.org/
*Edit*: Woah ! The French crew is here. We are at least 5 quoting a variation of <https://www.legifrance.gouv.fr/> for versioning.
> scope QualifiedEmployeeDiscount :
Dang, I wish all law was written like this instead of the purposefully obfuscated legalise of (lobbied) legislative lawyers meant to mislead people and slip in loopholes for their interest groups to profit of.Clear legislature is definitely something every person in the world would benefit of - if the the country's administration would want that.
Many of you asked if the code is shared. It is now: https://github.com/legalize-dev
The pipeline is multi-country by design. France already works as a second country (Légifrance data). Adding a new country means implementing 4 Python interfaces for your national gazette. The rest (markdown, git, web, API) is generic.
I wrote a guide for contributors who want to add their country: https://github.com/legalize-dev/legalize-pipeline/blob/main/...
From this thread alone, people asked about Germany, Portugal, Sweden, Finland, Netherlands, and Brazil. If you know your country's open data source for legislation, a PR is the best way to help.
I'll be honest — I don't know how much time I'll be able to dedicate to this, but I'd love to build something big. Legislation is massive and scaling to more countries takes real infrastructure. I'm setting up an Open Collective to fund hosting and development: https://opencollective.com/legalize
Live site with browsable laws + diffs: https://legalize.dev
Everything is still very precarious, time to time.
Thank you
git blameand immediately know who’s responsible for itIs the parsing/uploading code shared somewhere else?
Definitely the kind of idea that would have been below my activation energy pre-Claude.
I think this approach should be standard, I have always wondered why the source of truth for these documents is not moved to a repo like git.
For others wondering, while most of the Franco-era laws were nuked in 1978, this does include lots of old laws (ie pre-20th C).
However, the source material starts with a sqashed commit in 1960 :) So no changelog before that. The BOE source though is pretty phenomonal, they've scanned files going back to the 1600s so far.
In Brazil we have lexml, a standard to describe the law and their changes over time. It's surprisingly complex.
You can see how certain articles have the option to check "how that particular article was at each moment in time". That would be way harder to track, but it would be awesome if not only could you "go back in time and see what the law was" but also "how its been evolving".
Well done and great to see items like this and great to see the comments.
It's sort of funny to think about how you'd format Thomas Jefferson's email address so that he could be credited as the author of this article or that amendment. I bet someone's already figured out how to do that though.
It left out the tables (e.g. under 2.1 Materiales.) and the images (e.g see the very bottom).