AI & Law: Law As Code

Casting the law as though it was programming code

by Dr. Lance B. Eliot

For a free podcast of this article, visit this link or find our AI & Law podcast series on Spotify, iTunes, iHeartRadio, plus on other audio services. For the latest trends about AI & Law, visit our website

Key briefing points about this article:

  • There is a great deal of effort aiming toward “law as code” (it is headline-making)
  • The gist is to somehow convert laws into programming code, allowing for digital usage
  • This is much more than simply textual aspects and requires runnable capacities too
  • A tremendous stumbling block is the inherent semantic indeterminism of the law
  • Suggestions that we change our laws to be amenable to coding are brazen and unlikely


Law as code.

You are likely to see references to the popular phrase “law as code” in nearly any legal industry newspaper or social media posting that foretells the future of the law. Generally, the notion underlying law as code is that we ought to embody the law into some form of computer program coding and thus we will more readily be able to utilize and leverage the law via digital capabilities.

This abundantly makes sense.

Today’s laws are only digitally proficient to the degree that we are increasingly able to post textual narratives and snippets online, but they lack any semblance of action or functionality per se. Text is flat and unmoving. Programming code offers the possibility of being active and performance-based.

Let’s pursue that thinking a bit further.

By transforming the law into something more robust and able to be used for legal reasoning, we could use computers to aid lawyers and jurists in ways that are currently relatively untenable. The hope is that the law as code would be runnable, doing so in the same manner that you can run an everyday ordinary program or app on your laptop or smartphone.

Adding icing on top of this cake, we could potentially interject Artificial Intelligence (AI) into the embodiment of law as code too. Without AI, the rudimentary variant of law as code would consist of the law in disparately coded fragments and be somewhat scattered and only usable at a lower level of legal reasoning. Infusing AI would help in turning the fragments into a cohesive whole, as though a human lawyer was able to bring a bigger picture to the code and orchestrate it into larger legal arguments and legal postures.

For details on this and other AI and law topics, see my book entitled “AI and Legal Reasoning Essentials” at this link here:

Because the word “law” in the phrasing of law as code seems potentially confusing, suggesting merely the static text of laws, some prefer to speak of rules as code, a shorthand for legal rules as code. This clears up some of the wonderment as to why we cannot just dump the text of laws into computer databases and be done with the seemingly banal chore. The reason this is so darned hard is that the law consists of rules, sometimes readily apparent and in other instances hidden or insidiously assumed.

Referring to the law as legal rules is an important indicator and handily reveals why law as code has not yet been solved.

It is principally due to legal rules being semantically indeterminate.

What’s that?

We all know that a so-called natural language such as English allows for tremendous latitude in what you mean when making statements of nearly any kind. Recall the legal arguments over the word “is” that took place about testimony given by President Clinton, and you immediately realize that words and sentences are imprecise and fluid in their semantic meaning. A more formal way to emphasize this vagueness or leeway is to say that English is semantically indeterminate. There is nearly always more room to be had in any utterance and we can attach or find meaning to our heart’s content.

In fact, it is the role and duty of a lawyer to seek out that semantic indeterminate semblances of a case and leverage it within the confines of their responsibilities as an officer of the court.

The overarching point is that law as code, when cast more adroitly as legal rules as code, means that we want to take something as source input that is semantically indeterminate and convert or transform it into an equal in all respects that can be expressed and utilized in a computer. This usually implies that we have to resolve the indeterminate aspects since the resulting transformed law has to now be runnable such that it purports to exactly represent what the law portends.

That is the gotcha in law as code.

Semantics As Three Hundred Pound Gorilla

Semantics is a tall order, a grand hill to be climbed, a daunting challenge to be conquered.

Supreme Court Justice Felix Frankfurter had eloquently stated: “All our work, our whole life, is a matter of semantics because words are the tools with which we work, the material out of which laws are made, out of which the Constitution was written. Everything depends on our understanding of them. So it’s useless to say, `Oh well, that’s just a matter of semantics’” (as quoted in Miller v. United States, Civ. A. №66–188, April 19, 1967).

When a lawyer looks at a snippet of the law, they bring to the inspection an entire vastness of semantic understanding. Somehow, the knowledge or intelligence underlying that semantic “conversion” is needed when attempting to transform the law into a computer program code. Not only is the conversion per se arduous, the target language that the resulting code consists of will make-or-break the viability of such a conversion.

Anthropological studies rooted in the research of Professor Franz Boas have indicated that Eskimo-Aleut languages have many more words for “snow” than does conventional English (there is controversy on this point, but nonetheless meritoriously is worth considering). Trying to convert any of those words for snow into English entails adding a lot of additional wording to seemingly grasp the same connotation as the original word. Even by those supplemental words, the original semantic intent is generally lost or at least likely misshapen.

The same can happen when trying to generate law as code.

Some suggest that we ought to change how we craft the law. In essence, to make the conversion easier, simply change the way we use our natural language and how we express laws in English. Furthermore, this would presumably eliminate any ambiguity about the laws and make adjudication straightforward and decidedly crisp.


In the struggle between whether to get lawyers and jurists to entirely and forever forward craft and recraft the law so that it is amenable to coding, versus finding some as yet unknown way to programmatically translate the law into code, you would be safer to bet on the side of devising a clever approach to a likely AI-based converter rather than getting humans and human behavior on such a large scale to change.

Both of those approaches are hard, and so it is a proverbial question of the lesser of two evils as to which will rue the day.

For the latest trends about AI & Law, visit our website

Additional writings by Dr. Lance Eliot:

And to follow Dr. Lance Eliot (@LanceEliot) on Twitter use:

Copyright © 2020 Dr. Lance Eliot. All Rights Reserved.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store