Legal Drafting and Computer Programming
davidallengreen.com
davidallengreen.com
My answer: The meat of the job is basically the same thing. You spend a lot of time writing things in highly precise pseudo-English where syntax errors can get you in trouble.
The biggest difference is that with software, you spend a lot less time arguing what the code does. You just run the damn thing and observe the output. With law, that requires a multi-year journey through the court system.
(I forgot the source.)
And if we can dream about unambiguous law, we can dream bigger, about a compiler or linter that could extract more conceptual flaws, like "Warning: this law would facially violate the First Amendment", or "this law creates an incentive structure that may cancel its intentions."
This is probably too sci-fi to happen in my lifetime, but if I'm lucky maybe I'll live to see computer generated Friend of the Court briefs. We may be on the road to that with computer assisted analysis of historical language corpora to help determine original meanings.
With this in mind, a person could make a reasonable case that legal language is already a DSL implemented in a natural language.
Computers excel at the rote and structural. They really suck at substantive analysis, even with all the recent ML work I've seen...except where the substance in or out is rote or structural. You can probably get a model to read back effective dates or share prices out of a bucket of PDFs. First Amendment analysis? Is it going to predict Supreme Court cases for us, too?
The hard work in law is nearly always pattern matching---What law applies to this situation? Does the definition cover this case, given its language and purpose?---rather than calculating a bunch of deductive implications from neatly coded factual situations. A lot of the fights in law are about how to code the situation, because of how the law applies from there.
from law_of_england_and_wales import persons, contract, boilerplate, jurisdiction
define party1 = persons(type:ltd, with_registration_no: 12345)
define party2 = persons(type:natural, with_name:"Chris", with_address: "Acacia Avenue")
define term = 1 year
try:
while date < term
{
if party1.dosomethings
then party2.pay(agreed_price) && party2.dosomethings
}
catch breach:
party_at_fault=breach.causing_party()
party_not_at_fault=(if party_at_fault == party1 ? party1 : party2)
party_at_fault.pay(if damages < limitationofliability ? damages : limitationofliability)
if party_not_at_fault.chooses(terminate())
juridiction.set_jurisdiction(exclusive_mode)
boilerplate.apply
I could go all evening at expanding this. Anyone fancy adding obligations, termination, confi etc.?Source: I am a lawyer and a coder.
There are probably hundreds of obscure unintended consequences of laws not intended to have the effects they do in practice.
Figure out contract law and parse website TOS and EULAs for violations and you could probably make some money.
The biggest benefit of such a system, though, would be for actual legislators, so they could run simulations of proposals to get a sense of consequences in practice. Simulation and summarization could be very powerful.
Question: is there a bug for the assignment of party_not_at_fault? Would you want party2 to be selected if the condition is true?
Other languages I've used have the first part be the true branch, and the other the false branch.
I know people who can engage in free-form conversation in this manner. Not to say like a lawyer, but where there are no words missing, no words incorrect, and no words superflous. I've marvelled at that ability and find that style of speaking mesmerizing.
I find it quite ridiculous that we still expect humans - judges and lawyers - to research legal codes and case law in order to figure out the applicable rules. This is something that computers should be doing. So we can focus on the higher level decisions, i.e. extending the rules, or arguing over the interpretation of the facts of the case.
It‘s staggering how much time we‘re wasting researching legal questions whose answers are not only already „out there“, but are probably being researched over and over again each week by legal professionals across the country, because a human, unlike a computer, cannot possibly keep all of those rules in memory at the same time.
There are some areas where concepts from programming help. But in my experience, mostly with structural aspects, like drafting conventions---defined terms, cross-referencing, enumeration/tabulation---rather than with substantive rules about how to interpret legal texts. Apart from that, it's mostly been a matter of acculturation. Coders are good at writing for, and explaining to, other coders.
In the same way, I think mathematicians and logicians and linguists and finance people also make "some of the best" drafters---all dual-class builds are special, and none of them is. Because those disciplines also boast powerful tools, vocabularies, and tribal affiliations. Conversely, all these confident professionals running around with power tools and strong style preferences prove that much more liable to hammer-sees-nails syndrome, outside their native domains.
As for the interpretation rules---the "canons of construction"---I don't understand the rule against surplusage as the author does. At least in the US decisions I've read, that's about not interpreting language in ways that make some of its words meaningless. Not that every word has "precise" meaning. Spoiler Alert: They don't. They can't. It's natural language. About the real world.
As for "stress-testing", a lot of that happens within the legislative, regulatory, and litigation processes. Sure, some bills get rammed through in poor form for political or procedural reasons. But a good many bill trackers reveal initial drafts by lawyers working in affected constituencies, then amendments addressing unforeseen consequences and edge cases, as the bill gets shopped around. Codifications show new bills amending old to make still more tweaks.
When regulatory bodies make the rules, we have notice-and-comment, to which the public is even more explicitly invited. Very often, legislatures include bits in important new laws that require regulators to follow up with new rules, to fill out specifics. There are various reasons for this, but one is avoiding blowback from constituents who weren't involved and didn't mention how the law might hurt them during the legislative process. One of the functions of lawyers for all these potentially affected parties is to analyze hypothetical effects, instead of just waiting to see how things play out in practice.
Once law or reg does hit the books, we have cases in the courts, with limited power to interpret and adjust over time. Where a law seems busted beyond their powers to mend, judges can and do publish opinions that say, in essence, "This seems wrong, but I have to rule this way, because that's what the law says. If this isn't what the legislature wanted, they should really change the law, because I can't." Happens all the time.
I hear the similar claims from people who think AI is good enough for sentencing people, it's absolutely not, like contractual construction it's a process where human values are at the forefront. You can't throw law and facts at it and expect a sensible result.
Contract as code might have beguiling simplicity but really intractable complexity. At the heart of it is the issues caused by the challenging concept of fairness which is distinctly and exclusively human.