It is named after a French guy called Pierre Catala, not the language. Probably the name comes from the language but according to the documentation does not seem to be with acute accent.
> 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. The research group that he led in the late 1960s, the Centre d’études et de traitement de l’information juridique (CETIJ), has also influenced the creation by state conselor Lucien Mehl of the Centre de recherches et développement en informatique juridique (CENIJ), which eventually transformed into the entity managing the LegiFrance website, acting as the public service of legislative documentation.
Very cool. Pessimistically, I think that having a clear, understandable view of legal text so that people can navigate the law safely is against a lot of entrenched interests.
I don't think it's that. It's hard to write legal texts, and sometimes it's better to be vague, so the courts have some freedom when establishing jurisprudence.
Treaties can be written with vague wording to allow parties to sign it, even if there isn't 100% agreement. That's an old practice.
It is probably better to be intentionally and clearly unclear when you want to be, and clearly algorithmic when you want that, than just stir it all together in the name of judicial discretion.
On the contrary, it's much better to have very clear text, otherwise it will turn against the citizen.
Imagine that you have an income tax where "income" isn't clearly defined. Someone will end up with an audit and a lawsuit from the tax office because their definition will be, of course, extensive (every income, including non-realized capital gains) whereas most citizens would only consider salaries.
In the end, you create legal uncertainty, and give courts way too much power.
For the record, I used to work for my country's government, and had to evaluate some laws in making that were written in an abstruse way. When I asked why, the civil servant told me that it was so "they could pick the most favorable meaning in the case of a lawsuit".
It's a balance. If you get too specific then your laws quickly become outdated as technology and society evolve. Or you miss corner cases by not enumerating every little scenario.
So there are different tiers to deal with this.
- Constitution - Very abstract and very rarely changed.
- Statute - Sometimes abstract, sometimes specific.
- Administrative rules. Very technical but still intended for broad application.
That's far too reductive. The law is abstract, and still needs to be interpreted and prudentially applied to specific situations, and you cannot capture all of that in the law a priori. Furthermore, having a computer crunch through a bunch of predicates is easy compared to getting the facts expressed in a form that is crunchable. So for specific and narrow applications where such representations are not costly to produce or already exist, such an application of computational law is feasible. But broadly? No.
And then there's the distinction between lex and ius that I think needs to be considered in this context.
This is interesting, and not to criticize, but I wonder if transformer model's accuracy in interpreting law will obviate the need for something like this.
It would be interesting to train Large Language Transformer Models to generate this code for you based on the text in the laws. This way you have a deterministic testable output, without risk of hallucinations.
Oh, this again. I suppose this looks relatively harmless, but I'm always wary of "law is like computer code."
The impulse to think this can strongly solve any real problem in the law is intuitively attractive, but I strongly predict this mostly never happens; it's the law's job to be intensely practical in the face of hard-edged "computer-like" rules.
If anything, you get goofy confusion about what things "are?" My go-to on this is always the "smart contract" -- which can be useful little bits of automated robot money moving code, but emphatically are neither "smart" nor "contracts."
> If anything, you get goofy confusion about what things "are?" My go-to on this is always the "smart contract" -- which can be useful little bits of automated robot money moving code, but emphatically are neither "smart" nor "contracts."
They are contracts—just not legal contracts. One of many types of contracts in the world that are not legal constructs.
Software-interface contracts generally aren’t (cf. Design by Contract). The parent is correct insofar as the use of the word “contract” is not limited to contracts as defined by law.
It’s a contract (mutual agreement) between the client code and the implementation of the interface. The implementation fulfills certain obligations provided the client code fulfills certain other obligations. The interface defines what those obligations are. If the client code fails to meet its obligations, then the implementation of the interface isn’t bound to fulfill its obligations anymore either. The point is to think in terms of two parties, where the developer who is either using or implementing an interface takes on the role of one of the two contractual parties.
I can assure you that the person who wrote this is very well aware of the subtleties involved with formalising the law. Law + Programming is an active research field (https://popl23.sigplan.org/home/prolala-2023), and it is very far away from anything like smart contracts, it is full of brilliant people who have no pretension of replacing the law with computers, but simply be helpers where they can.
Sure, I think I posted my response not because "it could never solve ANY problems," but instead "way too many non-lawyers, especially techy-non-lawyers, have the deeply misplaced idea that is a very important, perhaps THE most important, problem to solve in the law." It's just not very high on the list at all.
Maybe not for lawyers, no. But as a citizen I'm expected to comply with the law, with many many laws. It'd actually be nice if law was slightly more formally verifiable, so it would be easier for me to understand what to comply with.
Being able to break down clauses into more logical normal forms would probably greatly enhance the possibility of compliance.
For every bit of gained clarity, you'd also gain a ton of people like the "sovereign whatever" idiots who just love trolling, with the added negative of them having more "formal proof" of their untenable silliness.
- your compiler was AI-complete and adversarial and hated you
- your compiler was also not bound by any hard rules and could emit undefined behavior at any time
- your job scheduling and orchestration system was AI-complete and adversarial and actively hated you
- your runtime library had 50 different incompatible canonical implementations and can only be run by being forked by publicly-elected officials who blindly merge patches from bad-faith lobbyists
- the IDE is Microsoft Word, and the linter is a summer associate on their tenth cup of coffee
- you will inevitably get a non-technical client who thinks that the more times you have "notwithstanding the foregoing" in your code the more you can call yourself Web Scale
I like to turn this argument around to see how absurd it is.
Why not just take the existing law, and have a machine execute it in the style of a computer program?
We wouldn’t need judges juries or lawyers. You’d just type the specifics of your case and any supporting documents/evidence into the computer and a verdict would pop out.
Of course, the system could be used for other stuff too, like checking building code compliance or engineering soundness, signing off on military and police action, setting the executive branch’s priorities, and so on.
Some people have argued that the fuzziness of the legal system can be a good feature for some reason, but you could always have a machine execute the law and a human make the final call. So you wouldn't need judges, juries, or lawyers, but you would need a team of legal shamans that sign off on verdicts
It is that the law would need to encode all the stuff I said, so it would need to be nuanced enough to replace all engineering, leadership and administration roles. (And also anything involving ethics.)
Not a lawyer. My thinking is very likely naive as I have no experience in this matter.
I see two potential issues:
- Picking evidences. "Evaluating" the law might need access to all the possible evidences that could exist, but that would certainly never be true, so you'd need someone to know which evidences to present. You probably cannot rely on some interactive process asking you such and such evidences because it would be presenting evidence that would trigger evaluations of chunks of laws. I would guess a lawyer with good knowledge of the law would probably be needed for this.
- Setting precedents. Wouldn't the "automated" law evaluation run into unprecedented cases all the time? You'd need someone to constantly issue a verdict on unforeseen situations all the time, and I guess you'd need a judge for this.
Maybe it could work on many "trivial" cases though.
This is a problem, but not one that Catala suffers from on a first reading.
Some elements of law are amenable to translation into source code, and indeed anyone working in fintech will probably have done that at some point. If the law gives a threshold for a tax allowance, for example, you need to encode that requirement in accordance with the law. Being able to mark up the text of each regulation should make it much easier to be confident you've not missed anything.
Trying to write non-financial regulation as code is pretty much doomed to failure. But to the extent that tax or benefits regulations set out numbers that we have to translate into code anyway, it's good to have that code be verifiable against the specific regulatory text.
> Hasn't Cyc impressively demonstrated just how incredibly difficult and costly it is to formalize even the most basic matters of daily life?
I would offer that the "cost/benefit" analysis for such a formalism exists on at least two axes: the concept domain which one is attempting to formalize, and the benefit (and/or size of consumers) of any such working system
I can wholly understand that trying to translate the entirety of English into a formal logic system sounds overwhelming. But to side with a sibling commenter, why not at least start with the tax code which is a personal pain point, has (presumably) a correct outcome for some cases, and is mostly algorithms-in-English
And then, for the consumer side: ok, if I snapped my fingers and Cyc existed and worked I struggle to think how exactly my life would change. If the formally-specified tax code existed and worked I wouldn't have to rage-upvote almost every comment on the annual tax hatred thread
I would even offer that an incomplete version could still be useful if one left "fuzzy" variables in the corpus, and said "welp, we can't define what a $Person is because of the hundreds of years of precedent, so you'll need an actual Judge for that". I don't meant to say that 50% of the corpus can be undefined variables, that's just silly, but I'd hope the tax code isn't built upon 50% undefined behavior, even if accountants want you to think it is
There have been many such attempts (e.g. NKRL by Zarri et al., also funded by EU). There are even societies that have been dealing with such issues for many decades (e.g. http://www.iaail.org). The formalization of law and language is only one of the issues. Like many previous attempts, this one suffers from the fuzziness of human language (even in the case of tax code). Fuzziness is not a drawback; it is what makes it possible to communicate efficiently in the first place. In order for us to communicate effectively, we need an enormous amount of tacit knowledge about our environment that our culture and life experience brings. If one tries to formalize the language, as in the present approach, one must also take this knowledge into account, down to the last detail (an "upper ontology" is by far not sufficient for this, and Cyc after decades is still not finished). And the tacit knowledge and also the moral valuation of the same change over time. And there are things like https://en.wikipedia.org/wiki/Sorites_paradox which stand in the way of a complete formalization. Lenat's 1990 book addressed many of the issues, but also his more recent talks are very informative where he demonstrates how they had to extend the Cyc representation language to cope with the problem, and why e.g. RDF triples are not enough.
how many times have you fought in court to argue about "the spirit of the law"? I, for one, don't really care about this lang or "law is computer code" thing. just wanted to know lawyers life, I guess.
What problem does this solve? It appears to add precision where it's mostly already clear - perhaps it can enforce some kind of rigor... but then like the example given uses "fair market value" as a term which I'd expect to be the kind of thing that's in contention, rather than any of the actual "logic", and it doesn't help with that.
The reason we have courts and lawyers is because of the need for interpretation beyond just writing good logic, so I don't see how this can really do anything. Or is it for something else?
>It appears to add precision where it's mostly already clear - perhaps it can enforce some kind of rigor...
I'd argue that the imprecision of law is more feature than bug. Rules as written have edge cases and, as long as the law is written in natural language, you can get a feel for their intent and that helps Judges decide what to do in those situations.
Catala still produces plaintext legal documents at the end of the day but can be seen as a markup language for those documents. But because that markup language is a whole lot more precise than the legal text itself, it can be a bit more versatile.
Examples of how this could be useful:
- Reducing the overhead for maintaining a list of semantic translations of that legal code into other languages. Of course the official language is the only one that is "legal" but the other translations should be close enough to effectively express the nuance provided the language outputs are maintained by people who can actually speak those languages.
- Producing machine executable proof or simulation code. This could be used for "fuzzing" the legal code to identify loopholes or unintended outcomes so that legislators can then propose improved terms to avoid those issues. This is by no means "making code law" but it provides an additional tool for understanding the law and how the many different parts of the legal code interact with each other.
- Adding on to the previous example, sim code could be integrated into complex models for simulating the impact of legal changes on the economy at large or specific segments.
- Finance related code can be used to generate a tool or API for validating tax, accounting, and compliance documents (as a first pass to catch errors early and reduce overhead) as well as to even prepare some of those documents. These tools often already exist but they are one or more steps removed from the actual legal definition which increases the risk of error as well as the overhead of maintaining them (which can potentially encourage rent seeking behavior by commercial providers of these tools).
France actually is already doing this to a reasonable degree albeit the "codified" version is based on the law rather than the codified version producing plaintext law. The DGFiP [1] maintains a gitlab organisation [2] that includes both Catala and MLang [3] representations of different parts of the french legal code for exactly these purposes.
> Of course the official language is the only one that is "legal"
If only! Here in Canada there are two official languages. All laws are drafted, and enacted, in both English and French. Both versions are equally valid, equally binding. And, sometimes, they don't say the same thing.
Yeah that's common in a number of other countries as well. I should have probably said "the official languages are the only ones that are legal" instead. In which case a tool like this could be useful for helping maintain that equivalence.
Catholic Canon Law is drafted and coded in Latin, which is supposedly the only official and binding version. However, this is translated into hundreds of vernaculars! People often read it in their native language for convenience, even lawyers, but this can be fraught with peril.
According to the example in the readme, it's specially for text law that produce codes… So it should be a road to some literal programming or implementation proven.
Example of text law that should/may become code somewhere: the senate vote to give pension to veterans that meet some criteria… But there already exist less known rules for some cases and they may be incompatible.
I think that coupled with some kind of prolog, it may help detecting inconsistencies early.
I don't think there's much of a problem with actually reasoning about a law's text that a computer can help solve. The complicated bit is weighing equities, which still requires humans and lawyers.
Absolutely. Although the clarity by creating algorithms from tax tables can be helpful, and sometimes the wording seems ambiguous. Although you probably also need lots and lots of examples. (It is as if you need unit tests!)
Most tax-related rules in the US are specified in an XML-based business rules language. That's partly how tax prep companies are able to get rules that don't finalize until 12/31 into products that have to ship 6 weeks later.
+1. I see one benefit of this language -- it could make it much easier to write programs to compute taxes and benefits. Beyond that I don't see what it could possibly offer.
Are there any lawmakers, lawyers or judges excited about this, or is it only programmers?
Gödel’s theorems don’t imply inconsistency for all large systems (unless “large” is taken to mean something strange), just for systems which are both not super-weak in what they can say, and complete (or if they have their own consistency as a theorem).
I don’t think Gödel’s theorems particularly support the claim you’re making.
In fact, here is an argument that a consistent rule-set (either can be extended to something consistent and complete, or ) can be extended to be made arbitrarily large and consistent:
take a ruleset which is consistent, but for which there is something for which it has no prescription one way or the other (neither explicitly nor implied collectively by other rules) (I.e. “not complete”). Then, add a rule specifying that thing and nothing else which isn’t implied by that thing. This will be consistent, as if it were not, then the negation of the rule added would have already been an implication.
This will either yield a larger ruleset of the same kind (consistent and incomplete), or it will yield one which is consistent and complete. Gödel’s theorems show that if the ruleset is an axiom system which is sufficiently expressive (e.g. contains Peano arithmetic) then the latter cannot be the result. So in this case, there are arbitrarily large extensions of the rule-set.
If it isn’t an axiom system, or is one for a rather weak system, then the “the result is a consistent and complete system” option,
well, why would you want it to be larger?
Edit: perhaps what you are calling “inconsistencies” are what I would just call “exceptions”/“exceptional cases”?
To my mind, “embracing an inconsistency” doesn’t seem to make much sense in the case of law? Something has to be what actually happens. We (whether fortunately or unfortunately) cannot bring an actual contradiction into reality.
Well, I suppose if one takes a sub-truth(not sure if this is the right terminology? I mean the opposite of super-truth) approach to vague statements, one might say that a somewhat-bald man causes the statement “that man is bald, and also that man is not bald” to be true (and also false), and as such “bring a contradiction into reality”, but that’s not what I mean by the phrase.
I mean there is no full precise-ification of any statement, which we can cause to be simultaneously true and false irl.
Those acting as agents of the law must behave in some particular way.
When legal requirements contradict, people will not satisfy both of them. Perhaps one will be considered to take priority. Perhaps a compromise position between the requirements will be sought. Perhaps it will be left to the judgement of those following it in a case-by-case basis.
But in none of these cases is a contradiction implemented. Can they really be said to be embracing the contradiction?
Upon writing this edit I realize that I’m probably misinterpreting that part of your comment. I suppose the thing you are saying to embrace is not the individual contradictions themselves, so much as the system’s rules-as-written having contradictions, and therefore the necessity of dealing with such contradictions when implementing the rules, as the scenarios to which the contradictory statements apply, occur.
I think having a "linter" for laws can be beneficial. It can help producing laws that are easier to read and understand.
Having a "compiler" for laws can help identifying conflicts between different codes of law. e.g.: Imagine having a compiler error when a law is unconstitutional from a logical standpoint.
But verifying the "business logic" (e.g.: what is the spirit or intent of the law?) of the law will remain a human intelligence task.
I think what I'd rather see is a standardize test suite format for laws that spells out the intentions.
Once I lived in a state that proposed a very simple anti-child porn law with good intent, but it was too simple. It read sort of like "anyone sending explicit pictures of minors from a cell phone will be guilty of conveying child porn". It was written in the proper legal jargon, but wasn't a whole lot more detailed than that. I called the sponsor of the bill and asked if that meant if my hypothetical daughter sent a naked picture of herself to her boyfriend, then wouldn't she be a felon under his new law? He had an "oh, crap, that's not what I meant!" reaction and ended up withdrawing the bill so it could be re-written. (Aside: I felt pretty good about that. Props to the legislator for being quick to understand and respond appropriately!)
Imagine if that were handled like program code, with a test like:
* This law does not apply to minors sending pictures of themselves.
That would do a few big things:
It would make legislators be clear about what they mean. "Oh, we'd never use this online child safety law to ban pro-trans content from the Internet!" "Great! Let's add that as a test case then." I confess that this is a deal breaker: politicians don't like being pinned down like that.
It would probably make it easier to write laws that reflect those intentions. "Hey, that law as written would apply to a 15 year old sexting her boyfriend! The code doesn't pass the tests."
Future courts could use that to evaluate a law's intent. "The wording says it applies to 15 year olds sending selfies, but the tests are explicit that it wasn't meant to. Not guilty."
I'm sure this couldn't happen for a hundred reasons, but I can dream.
The courts have to evaluate what they think the law's drafters meant: Yeah, it says this, but it's obvious the legislators didn't mean for it to be read that way. It'd be nice if there were footnotes that expounded on what the authors were trying to accomplish to help courts interpret the laws.
At least in the US, it's not the drafters' intent that matters, but the intent of the legislators who voted on it. (Legislators actually have lawmaking power. Drafters are usually unelected staff or even lobbyists.)
When a statute is ambiguous, courts do sometimes look at the congressional record (eg floor debates) to determine intent.
Yeah, there’s no way that a modern computer could outdo the logical accuracy and processing power of our 300 year old legal system. Court rooms and arguing and paperwork, much more efficient than silicon.
Trying to measure it for "logical accuracy" and using ideas like "processing power" so very deeply demonstrates how little you understand what actually is happening.
You have a bunch of judges, none of which are immune to racism and corruption, giving out their version of the law from big oak benches while a suspect is held against their will in jail for however long. I think a computer can do better.
I don't want me or my male family members to be labelled sex-offenders whilst you "test" the "court system" to see if the laws work as intended. All because some overzealous prosecutor wanted to be "tough" on "toxic masculinity".
Oh, I mean, Black man here -- I 100% agree with you that there are serious and deep problems with how things are done now; I just have very little faith that any hypothetical nerd testing like we're talking about here will do much better.
law tests would be good, though they probably have to be "evaled" via the same mechanism which would apply them. Meaning, courts :\
I personally would be happy if any country would attach rationale for the law to the law itself. And possibly some KPI to see if it works. So the law could be reevaluated later, to see if it works at all, or maybe counterproductive, or maybe some major actual application of the law is not why it was introduced.
I think for something like this to be effective, you need the actual intent encoded correctly (so this use case wouldn’t have been solved), and lawmakers acting in good faith (i.e., not drafting legislation that’s intentionally vague such that it can cast a wide net and force people to use the courts to dispute things).
Yeah, uhh, having seen some of the hearings in recent state legislatures regarding abortion, that’s some flawed thinking. Lawmakers are intentionally vague throughout the entire process sometimes.
You don't need those voting for the bill to act in good faith if you have as part of the system of passing bills that the opposition gets to write the (adversarial part of the) test suite.
Then either that forces any loopholes (or other undesirable effects) to be: updated as explicitly intended (with bad publicity and potential for reversion upon a change of government); or taken into account and the bill updated to reflect that, or left in the test case for case law to cite as intended.
Either way you really want intent to be encoded somehow.
> Writing tests for laws should totally be a thing.
It is a thing already. In both the US and Germany it is common for lawmakers and regulators (e.g. the FCC which was here on HN to solicit comments a few days ago) to provide drafts of laws and regulations to interest groups so that these can raise issues they find.
99% of the work is in coming up with the edge cases, and in law the most common thing to do with edge cases is call them out explicitly. I imagine the legislator went back and added a clause to the law that specified "it shall not be considered a violation of this section for a minor to send photos of themselves".
Laws don't need to be computer-executable, they're about intent and the interpretation thereof, so the test suite itself is really part of the law and may as well just be embedded in it.
It's great that your congressperson was enlightened enough to pull the bill. Some states (such as Minnesota) apparently actively prosecute children for sexting.
Minnesota is so bizarrely, irrationally wrong on that one. That poor kid needs an adult to sit her down and explain why sending out nude pics as a minor is a really bad idea, not to label her as a sex offender. Now, if someone (especially an adult) received those pics and shared them, go ahead and charge that person.
Completely unrelated to Catalan (Català), the language spoken in Catalonia (Catalunya). I think if someone wants to google a question about this, "catala language beginner hello world" won't help them much.
I can only conclude that they didn't know that. It's such a bad name; we won't even be able to google "catala lang" because ... Catala is also a "lang"!
Imagine someone creates a programming language called Russian. Good luck googling "russian lang".
> given that the major contributors seems to be from paris / bordeaux i am pretty sure they know about catalan.
Yes, but did they know that català is Catalan for Catalan? In French, as in English, it is catalan instead (well, English always capitalises it, French doesn't, but the spelling is identical).
Started something like this years ago with a company that ended up pivoting to a slightly different direction after a while. glad to see something in open source space.
It would be interesting to also "weave" in test cases. The workface of logic statements is exactly where bugs are introduced.
Especially around temporal events, and that goes to formal models (and even more bugs).
Typically, if there is a rule around height, there would be at least three tests¹: one taller, one equal to, and one shorter. (Without types or something, then also negative, null, and max/min boundary inputs too.)
So you could have tests based on timelines, like
Given a regulation is passed in 3 months
And parties are prevented from exercising B
But "17 tons" of waste are dumped anyway
And ...
When ...
Then ...
Having a model checker integrated would be a boon. Maybe we could have DevOps-like pipelines in formally-verified legislature (or at least the encoding of language to code).
Many laws are written with a lot of double meaning (recent eu regulations on allowing or not allowing russian cars is a good example).
Though, it could be a good idea to find all the possible double meanings or vague definition when trying to "digitise" the laws into the programming language.
Right, some laws are just ftp-dragged & dropped to prod, understanding that it doesn't compile yet. But if legislator managed to express the _intention_ the courts will over time add and make all test cases pass.
I'm sure the mentality of a PHP developer running a successful but insane legacy site is a better model for this than a perfect OCAML project :)
This is great. I often look at unit tests to understand how to use legacy code. Seeing a law come with concrete examples that are part of the legal text, would allow us to test if a rule is logically consistent, and test our understanding as well. Sort of how you want to convince your reviewer that your code works by proving it with a unit/integration/e2e test.
Games are activities bound by rules. Laws are rules for government/governed.
AFAIK There's not really a programming language specific for describing how players interact in a game, so although there's no reason you couldn't implement it in any old programming language. I guess the same thing could be said of the law too until Catala.
On the one hand, I think it would be fantastic, if you had automated tests for the law. For example, when German politicians introduced the "hacker law", you could have pointed out that "This new law would break the 'security researchers need to be allowed to do penetration testing' test".
On the other hand, "Brexit is in conflict with the Good Friday Agreement, we need a solution for Nothern Ireland." was known without machine readable laws and test, but politicians ignored it anyway.
Maybe what's needed is a law that outlaws test-breaking laws and requires politicians to fix the tests first, but I bet that would just result in a lot of "commented" tests.
I’m really interested in this project as another way to computationally express and use law. For more color on the project, here is a demo and discussion “Idea Flow” session I did with the project leads: https://law.mit.edu/pub/ideaflow8
300 comments
[ 72.1 ms ] story [ 1575 ms ] thread> 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. The research group that he led in the late 1960s, the Centre d’études et de traitement de l’information juridique (CETIJ), has also influenced the creation by state conselor Lucien Mehl of the Centre de recherches et développement en informatique juridique (CENIJ), which eventually transformed into the entity managing the LegiFrance website, acting as the public service of legislative documentation.
'à' has a grave accent, not an acute accent.
I imagine that they find their naming choices amusing.
Treaties can be written with vague wording to allow parties to sign it, even if there isn't 100% agreement. That's an old practice.
Imagine that you have an income tax where "income" isn't clearly defined. Someone will end up with an audit and a lawsuit from the tax office because their definition will be, of course, extensive (every income, including non-realized capital gains) whereas most citizens would only consider salaries.
In the end, you create legal uncertainty, and give courts way too much power.
For the record, I used to work for my country's government, and had to evaluate some laws in making that were written in an abstruse way. When I asked why, the civil servant told me that it was so "they could pick the most favorable meaning in the case of a lawsuit".
So there are different tiers to deal with this.
- Constitution - Very abstract and very rarely changed.
- Statute - Sometimes abstract, sometimes specific.
- Administrative rules. Very technical but still intended for broad application.
- Individual court cases. Can be hyper specific.
Programming tends to use less understandable but more precise verbiage in general.
And then there's the distinction between lex and ius that I think needs to be considered in this context.
It would be interesting to train Large Language Transformer Models to generate this code for you based on the text in the laws. This way you have a deterministic testable output, without risk of hallucinations.
Oh, this again. I suppose this looks relatively harmless, but I'm always wary of "law is like computer code."
The impulse to think this can strongly solve any real problem in the law is intuitively attractive, but I strongly predict this mostly never happens; it's the law's job to be intensely practical in the face of hard-edged "computer-like" rules.
If anything, you get goofy confusion about what things "are?" My go-to on this is always the "smart contract" -- which can be useful little bits of automated robot money moving code, but emphatically are neither "smart" nor "contracts."
They are contracts—just not legal contracts. One of many types of contracts in the world that are not legal constructs.
It's like calling a hopefully-completed-circuit in some device an "electric contract" or something like that.
I think this proves op’s point of goofy confusion for what things are.
Maybe not for lawyers, no. But as a citizen I'm expected to comply with the law, with many many laws. It'd actually be nice if law was slightly more formally verifiable, so it would be easier for me to understand what to comply with.
Being able to break down clauses into more logical normal forms would probably greatly enhance the possibility of compliance.
For every bit of gained clarity, you'd also gain a ton of people like the "sovereign whatever" idiots who just love trolling, with the added negative of them having more "formal proof" of their untenable silliness.
- your compiler was AI-complete and adversarial and hated you
- your compiler was also not bound by any hard rules and could emit undefined behavior at any time
- your job scheduling and orchestration system was AI-complete and adversarial and actively hated you
- your runtime library had 50 different incompatible canonical implementations and can only be run by being forked by publicly-elected officials who blindly merge patches from bad-faith lobbyists
- the documentation for any of those 50 runtime libraries is paywalled per page behind https://pacer.uscourts.gov/pacer-pricing-how-fees-work if you're lucky
- the IDE is Microsoft Word, and the linter is a summer associate on their tenth cup of coffee
- you will inevitably get a non-technical client who thinks that the more times you have "notwithstanding the foregoing" in your code the more you can call yourself Web Scale
There are some areas where automating things can be effective – e.g. tax systems.
Why not just take the existing law, and have a machine execute it in the style of a computer program?
We wouldn’t need judges juries or lawyers. You’d just type the specifics of your case and any supporting documents/evidence into the computer and a verdict would pop out.
Of course, the system could be used for other stuff too, like checking building code compliance or engineering soundness, signing off on military and police action, setting the executive branch’s priorities, and so on.
It is that the law would need to encode all the stuff I said, so it would need to be nuanced enough to replace all engineering, leadership and administration roles. (And also anything involving ethics.)
I see two potential issues:
- Picking evidences. "Evaluating" the law might need access to all the possible evidences that could exist, but that would certainly never be true, so you'd need someone to know which evidences to present. You probably cannot rely on some interactive process asking you such and such evidences because it would be presenting evidence that would trigger evaluations of chunks of laws. I would guess a lawyer with good knowledge of the law would probably be needed for this.
- Setting precedents. Wouldn't the "automated" law evaluation run into unprecedented cases all the time? You'd need someone to constantly issue a verdict on unforeseen situations all the time, and I guess you'd need a judge for this.
Maybe it could work on many "trivial" cases though.
Some elements of law are amenable to translation into source code, and indeed anyone working in fintech will probably have done that at some point. If the law gives a threshold for a tax allowance, for example, you need to encode that requirement in accordance with the law. Being able to mark up the text of each regulation should make it much easier to be confident you've not missed anything.
Trying to write non-financial regulation as code is pretty much doomed to failure. But to the extent that tax or benefits regulations set out numbers that we have to translate into code anyway, it's good to have that code be verifiable against the specific regulatory text.
"To a man with a hammer, everything looks like a nail." (Twain?)
Hasn't Cyc impressively demonstrated just how incredibly difficult and costly it is to formalize even the most basic matters of daily life?
There already was a discussion two years ago: https://news.ycombinator.com/item?id=27059899
I would offer that the "cost/benefit" analysis for such a formalism exists on at least two axes: the concept domain which one is attempting to formalize, and the benefit (and/or size of consumers) of any such working system
I can wholly understand that trying to translate the entirety of English into a formal logic system sounds overwhelming. But to side with a sibling commenter, why not at least start with the tax code which is a personal pain point, has (presumably) a correct outcome for some cases, and is mostly algorithms-in-English
And then, for the consumer side: ok, if I snapped my fingers and Cyc existed and worked I struggle to think how exactly my life would change. If the formally-specified tax code existed and worked I wouldn't have to rage-upvote almost every comment on the annual tax hatred thread
I would even offer that an incomplete version could still be useful if one left "fuzzy" variables in the corpus, and said "welp, we can't define what a $Person is because of the hundreds of years of precedent, so you'll need an actual Judge for that". I don't meant to say that 50% of the corpus can be undefined variables, that's just silly, but I'd hope the tax code isn't built upon 50% undefined behavior, even if accountants want you to think it is
There have been many such attempts (e.g. NKRL by Zarri et al., also funded by EU). There are even societies that have been dealing with such issues for many decades (e.g. http://www.iaail.org). The formalization of law and language is only one of the issues. Like many previous attempts, this one suffers from the fuzziness of human language (even in the case of tax code). Fuzziness is not a drawback; it is what makes it possible to communicate efficiently in the first place. In order for us to communicate effectively, we need an enormous amount of tacit knowledge about our environment that our culture and life experience brings. If one tries to formalize the language, as in the present approach, one must also take this knowledge into account, down to the last detail (an "upper ontology" is by far not sufficient for this, and Cyc after decades is still not finished). And the tacit knowledge and also the moral valuation of the same change over time. And there are things like https://en.wikipedia.org/wiki/Sorites_paradox which stand in the way of a complete formalization. Lenat's 1990 book addressed many of the issues, but also his more recent talks are very informative where he demonstrates how they had to extend the Cyc representation language to cope with the problem, and why e.g. RDF triples are not enough.
The reason we have courts and lawyers is because of the need for interpretation beyond just writing good logic, so I don't see how this can really do anything. Or is it for something else?
I'd argue that the imprecision of law is more feature than bug. Rules as written have edge cases and, as long as the law is written in natural language, you can get a feel for their intent and that helps Judges decide what to do in those situations.
- help in quickly testing whether newly drafted laws contradict existing laws(without needing to memorize the existing legal code)
- check for redundancies
- checking whether removing one law affects any others
- statistically analyze legal systems in different countries
Assuming any of those are important issues in law. I'm not sure
Examples of how this could be useful:
- Reducing the overhead for maintaining a list of semantic translations of that legal code into other languages. Of course the official language is the only one that is "legal" but the other translations should be close enough to effectively express the nuance provided the language outputs are maintained by people who can actually speak those languages.
- Producing machine executable proof or simulation code. This could be used for "fuzzing" the legal code to identify loopholes or unintended outcomes so that legislators can then propose improved terms to avoid those issues. This is by no means "making code law" but it provides an additional tool for understanding the law and how the many different parts of the legal code interact with each other.
- Adding on to the previous example, sim code could be integrated into complex models for simulating the impact of legal changes on the economy at large or specific segments.
- Finance related code can be used to generate a tool or API for validating tax, accounting, and compliance documents (as a first pass to catch errors early and reduce overhead) as well as to even prepare some of those documents. These tools often already exist but they are one or more steps removed from the actual legal definition which increases the risk of error as well as the overhead of maintaining them (which can potentially encourage rent seeking behavior by commercial providers of these tools).
France actually is already doing this to a reasonable degree albeit the "codified" version is based on the law rather than the codified version producing plaintext law. The DGFiP [1] maintains a gitlab organisation [2] that includes both Catala and MLang [3] representations of different parts of the french legal code for exactly these purposes.
1. https://fr.wikipedia.org/wiki/Direction_g%C3%A9n%C3%A9rale_d...
2. https://gitlab.adullact.net/dgfip
3. https://github.com/MLanguage/mlang
If only! Here in Canada there are two official languages. All laws are drafted, and enacted, in both English and French. Both versions are equally valid, equally binding. And, sometimes, they don't say the same thing.
Example of text law that should/may become code somewhere: the senate vote to give pension to veterans that meet some criteria… But there already exist less known rules for some cases and they may be incompatible.
I think that coupled with some kind of prolog, it may help detecting inconsistencies early.
https://virtuale.unibo.it/pluginfile.php/1273247/mod_unibore...
No, I don't have a lot of faith in our legal system. Why do you ask?
Are there any lawmakers, lawyers or judges excited about this, or is it only programmers?
Humans (or, well, AI) is needed to cope with inconsistencies.
That said, pointing out the fact of existence of inconsistencies could be very valuable. But a system needs to embrace them, not fight them.
I don’t think Gödel’s theorems particularly support the claim you’re making.
In fact, here is an argument that a consistent rule-set (either can be extended to something consistent and complete, or ) can be extended to be made arbitrarily large and consistent:
take a ruleset which is consistent, but for which there is something for which it has no prescription one way or the other (neither explicitly nor implied collectively by other rules) (I.e. “not complete”). Then, add a rule specifying that thing and nothing else which isn’t implied by that thing. This will be consistent, as if it were not, then the negation of the rule added would have already been an implication.
This will either yield a larger ruleset of the same kind (consistent and incomplete), or it will yield one which is consistent and complete. Gödel’s theorems show that if the ruleset is an axiom system which is sufficiently expressive (e.g. contains Peano arithmetic) then the latter cannot be the result. So in this case, there are arbitrarily large extensions of the rule-set.
If it isn’t an axiom system, or is one for a rather weak system, then the “the result is a consistent and complete system” option, well, why would you want it to be larger?
Edit: perhaps what you are calling “inconsistencies” are what I would just call “exceptions”/“exceptional cases”?
To my mind, “embracing an inconsistency” doesn’t seem to make much sense in the case of law? Something has to be what actually happens. We (whether fortunately or unfortunately) cannot bring an actual contradiction into reality.
Well, I suppose if one takes a sub-truth(not sure if this is the right terminology? I mean the opposite of super-truth) approach to vague statements, one might say that a somewhat-bald man causes the statement “that man is bald, and also that man is not bald” to be true (and also false), and as such “bring a contradiction into reality”, but that’s not what I mean by the phrase.
I mean there is no full precise-ification of any statement, which we can cause to be simultaneously true and false irl.
Those acting as agents of the law must behave in some particular way.
When legal requirements contradict, people will not satisfy both of them. Perhaps one will be considered to take priority. Perhaps a compromise position between the requirements will be sought. Perhaps it will be left to the judgement of those following it in a case-by-case basis.
But in none of these cases is a contradiction implemented. Can they really be said to be embracing the contradiction?
Upon writing this edit I realize that I’m probably misinterpreting that part of your comment. I suppose the thing you are saying to embrace is not the individual contradictions themselves, so much as the system’s rules-as-written having contradictions, and therefore the necessity of dealing with such contradictions when implementing the rules, as the scenarios to which the contradictory statements apply, occur.
Having a "compiler" for laws can help identifying conflicts between different codes of law. e.g.: Imagine having a compiler error when a law is unconstitutional from a logical standpoint.
But verifying the "business logic" (e.g.: what is the spirit or intent of the law?) of the law will remain a human intelligence task.
Once I lived in a state that proposed a very simple anti-child porn law with good intent, but it was too simple. It read sort of like "anyone sending explicit pictures of minors from a cell phone will be guilty of conveying child porn". It was written in the proper legal jargon, but wasn't a whole lot more detailed than that. I called the sponsor of the bill and asked if that meant if my hypothetical daughter sent a naked picture of herself to her boyfriend, then wouldn't she be a felon under his new law? He had an "oh, crap, that's not what I meant!" reaction and ended up withdrawing the bill so it could be re-written. (Aside: I felt pretty good about that. Props to the legislator for being quick to understand and respond appropriately!)
Imagine if that were handled like program code, with a test like:
* This law does not apply to minors sending pictures of themselves.
That would do a few big things:
It would make legislators be clear about what they mean. "Oh, we'd never use this online child safety law to ban pro-trans content from the Internet!" "Great! Let's add that as a test case then." I confess that this is a deal breaker: politicians don't like being pinned down like that.
It would probably make it easier to write laws that reflect those intentions. "Hey, that law as written would apply to a 15 year old sexting her boyfriend! The code doesn't pass the tests."
Future courts could use that to evaluate a law's intent. "The wording says it applies to 15 year olds sending selfies, but the tests are explicit that it wasn't meant to. Not guilty."
I'm sure this couldn't happen for a hundred reasons, but I can dream.
When a statute is ambiguous, courts do sometimes look at the congressional record (eg floor debates) to determine intent.
They are horrible at everything else.
As for test suites and courts - the two are complementary so there's need to compare them to one another.
I personally would be happy if any country would attach rationale for the law to the law itself. And possibly some KPI to see if it works. So the law could be reevaluated later, to see if it works at all, or maybe counterproductive, or maybe some major actual application of the law is not why it was introduced.
Either way you really want intent to be encoded somehow.
It is a thing already. In both the US and Germany it is common for lawmakers and regulators (e.g. the FCC which was here on HN to solicit comments a few days ago) to provide drafts of laws and regulations to interest groups so that these can raise issues they find.
Laws don't need to be computer-executable, they're about intent and the interpretation thereof, so the test suite itself is really part of the law and may as well just be embedded in it.
[1] https://www.aclu.org/news/juvenile-justice/minnesota-prosecu...
Minnesota is so bizarrely, irrationally wrong on that one. That poor kid needs an adult to sit her down and explain why sending out nude pics as a minor is a really bad idea, not to label her as a sex offender. Now, if someone (especially an adult) received those pics and shared them, go ahead and charge that person.
Imagine someone creates a programming language called Russian. Good luck googling "russian lang".
Yes, but did they know that català is Catalan for Catalan? In French, as in English, it is catalan instead (well, English always capitalises it, French doesn't, but the spelling is identical).
Especially around temporal events, and that goes to formal models (and even more bugs).
Typically, if there is a rule around height, there would be at least three tests¹: one taller, one equal to, and one shorter. (Without types or something, then also negative, null, and max/min boundary inputs too.)
So you could have tests based on timelines, like
Having a model checker integrated would be a boon. Maybe we could have DevOps-like pipelines in formally-verified legislature (or at least the encoding of language to code).¹ https://en.m.wikipedia.org/wiki/Equivalence_partitioning
Many laws are written with a lot of double meaning (recent eu regulations on allowing or not allowing russian cars is a good example).
Though, it could be a good idea to find all the possible double meanings or vague definition when trying to "digitise" the laws into the programming language.
I'm sure the mentality of a PHP developer running a successful but insane legacy site is a better model for this than a perfect OCAML project :)
Or take it a step further, write a test suite and automatically generate a range of possible laws that satisfy the tests.
End to end tests for legal frameworks?
AFAIK There's not really a programming language specific for describing how players interact in a game, so although there's no reason you couldn't implement it in any old programming language. I guess the same thing could be said of the law too until Catala.
On the one hand, I think it would be fantastic, if you had automated tests for the law. For example, when German politicians introduced the "hacker law", you could have pointed out that "This new law would break the 'security researchers need to be allowed to do penetration testing' test".
On the other hand, "Brexit is in conflict with the Good Friday Agreement, we need a solution for Nothern Ireland." was known without machine readable laws and test, but politicians ignored it anyway.
Maybe what's needed is a law that outlaws test-breaking laws and requires politicians to fix the tests first, but I bet that would just result in a lot of "commented" tests.
Catala: a programming language for socio-fiscal legislative literate programming - https://news.ycombinator.com/item?id=24948342 - Oct 2020 (37 comments)
an example of the game rules: https://agoranomic.org/ruleset/slr.txt
In the context of this thread, I'm sad that the game rules don't appear to be in a constrained vocabulary