Law Isn’t Code – And That’s A Good Thing

The law isn’t code, and that’s a good thing. Here is why.

Theory and Reality

From time to time you’ll hear the refrain that the law is just like computer code. The idea is that the law is a set of executable instructions and so is computer code, hence, technology should be able to generate useful results a lot easier here than in other sectors where the similarities between the language used and software are not so close.

And that’s a very alluring idea. If law is just code, i.e. a set of instructions that must be executed, then life would be so much easier – for humanity and creators of legal tech products, or at least that is the theory. The reality however is far from this.

Take for example, litigation research. In country X there is a law that forbids Y activity, and that breaking this law results in Z penalty. You want to create a searchable database that shows the details of these cases. In a world where the law was absolute, like computer code is, and without room for the subjective interpretation of people, then it would be simple.

A society that operated like a digital machine would not miss much. The data would be clear cut and easy to find. The cases themselves would be very short, perhaps taking a few minutes, as evidence would either immediately stand up the case or it wouldn’t. And as code cannot really handle subjective and non-precise things like intentionality, or accidental action, then the text of the case would be very brief. So, X meets the conditions to be charged with having broken Y rules and Z is the sentence – which also is absolute and cannot really be altered by any subjectivity, or X doesn’t.

The same goes for contracts. An agreement between two parties that sought ‘absolute truth’, treating different states of reality as either a One or a Zero, would be a very short contract with no wiggle room. It would also be a very blunt instrument and put the parties into a behavioural straight jacket, cutting off the potential for future change and unexpected events. But, wow, it would really make the world of contract analysis easier.

But, in reality where we see the law enforced in mechanical ways it causes a lot of unnecessary pain. To take a real life example, near where I live is a box junction. Five roads all lead into this junction and it is a very congested area. To stop congestion the local council has painted the junction in bright yellow diagonal lines and installed cameras. Any vehicle that stops in the box for more than a couple of seconds immediately gets a traffic ticket.

Sounds like a good idea until one sees the actual reality of this hard-coded legal system at work. Because of the complexity of the junction, lots of traffic, and human nature, which tends toward unpredictable behaviour, many drivers find themselves trapped in the box through no fault of their own.

Conversely, some drivers that seek to be extra cautious, jam on their brakes to stop from being forced into the box and end up creating accidents among the vehicles behind them. In short, the hard-coded system doesn’t work – if 100% accuracy is its goal. Humans don’t fit into the little box that the clever people at the council have created for them.

Why doesn’t it work? Because humans are not machines. We also live in a very complex world. A codified and automated rule that governs traffic movement sounds like a good idea until you see it in action. Now imagine something exponentially more complex such as a murder trial, or a fraud investigation.

The same goes for contracts. Absolute terms work well for things like direct payments. E.g. ‘Party X will pay $100 to party Y for the product Z’. But, get into things that represent extended and ongoing relationships, then absolutes, which operate as if the agreement is a set of orders to be executed without any equivocation – and that equally absolute evidence can be provided to prove execution of those orders – then things fall apart.

The reality is that contracts are not always followed to the letter, even when both parties intend to. And then there is interpretation at work, or a necessity to deviate from certain parts of the contract for an unexpected reason that common sense will allow. Perhaps even the parties don’t really mind that much about certain aspects of the agreement and only included those clauses because it is customary?

In short, if that contract had been computer code then it likely would not work, or if it did work it would impose strictures on the parties that perhaps neither wanted to abide by. Contracts are approximations of an agreement that will be expressed in the real world; they are compromises, they omit things, they include things that can be irrelevant, they are not exhaustive, they reduce risk – but not all risk – and sometimes add new risks; they are….human.

Human relationships are imprecise, always changing, and exist in a world where the situation is also constantly evolving. And so, it’s a good thing that our contracts are imprecise, flexible and open to interpretation. (Note: at least this is the case in Common Law).

Language Is Variety

Another aspect is not just that the directness and absoluteness of code is a poor substitute for natural language, but the fact that the varieties of saying the same thing in one particular computer code language is very limited. Whereas in the world of one human speaking to another human, variety and loquaciousness is the rule.

For example, ThoughtRiver, the NLP-driven doc review pioneer, did some research on variation in legal documents. They examined a sample of 1.4 million contracts from the US and UK (see main photo). As a test they tried to find out how many variations there were in the clause that set out the choice of law.

Now, all these contracts were in English, (British and American). They were also all in that one clause saying the same thing: what the choice of law was. But, ThoughtRiver found 335,000 notable variations of that clause.

Do we need 335,000 ways of saying the same simple thing? Probably not. But, the fact that it happens shows the human tendency towards originality of expression. Although lawyers are perhaps sometimes seen as ‘conformists’, the data shows that they very much like to put their own stamp on things, to express legal concepts in their own individual way.


As the OneNDA project has shown, when it comes to low risk and low complexity matters, then standardisation can work well.

It also makes the use of NLP tools a lot more effective. As, if every basic NDA that an NLP system had to read was fundamentally using the same language then it allows that machine learning software to rapidly achieve very high levels of accuracy. I.e. variation and random creativity in clause writing is the enemy of NLP – it’s what makes life hard for such tools, as well as the lawyers doing the review.

That said, a standard clause is not the same as code. Similarity of human language doesn’t mean absolutes like they do in code. It remains open to interpretation. All a standard is saying is that ‘we agree to this compromise’. I.e. Standardisation is still human, it just leans towards common sense over variation.

Finally we have the concept of highly structured contracts. And we see that often in relation to ‘smart contracts’. Here standardisation would help, so too the ability to extract key data at the point of creation.

However, if a contract is complex and has terms that involve interpretation, then there is a limit to this as well. You can extract data from a contract with a view to building a dashboard for the limited parts of it that do operate as if it were code. E.g. payment terms or the limit of the contract. But, beyond that we are back into the realm of subjective human language and the vagueness of human intention.

And, the more complex the agreement, and the more caveats and carveouts it has, the less useful is the data that has been extracted at the point of creation.

A rubric that governed contract termination dates and showed the data in a dashboard is only useful if all those contracts displayed don’t have, for example, a clause floating around on page 37 of the document that notes the contract termination date can be extended under certain special conditions to be determined by mutual consent at a later date. As if they do, then the termination dates are not set in stone, they are not codifiable with absolute certainty. They are not like the products of computer code.


Does this mean we should not try to find ways to make life easier for everyone, and to better enable the use of legal tech tools – as well as be more efficient and save money in legal processes? Of course we should.

But, the challenge is in finding ways through the reality of human language via the medium of technology that drives the efficiency we want, while also preserving the essential human subjectivity and subtleness of the law as it exists in the real world.

The success of legal tech will have to be a compromise between the absolutism of computer code and the subjectivity and variability of human language. And that’s a good thing, as it will preserve those unique qualities that make us what we are: random, living, evolving, changeable people in a world that is also always changing.

By Richard Tromans, Founder, Artificial Lawyer, Sept 2021.

[ P.S. I was just editing out a couple of typos in the above text, for example using ‘none precise’, rather than ‘non-precise’, and this perhaps ironically underlines just how much computer code and natural language are different. ‘None precise’ as code would simply not work, as it’s a grammatical error, it would not compute based on any known and expressed rules. But, readers’ eyes and brains may have skipped over it without even noticing, as they knew from context what the words meant. Or, even if they did notice they also could see the meaning from the context without faltering in their perusal.

Of course you could train an NLP system to accept this error, or errors like it, but then we are into a different side of legal tech, i.e. the understanding of the natural language output, rather than the input coding of the ‘program’. ]


  1. Great article! This leaves room for contract rules codification where these rules can operate as guiding principles and default rules since parties cannot foresee all potential contingencies.
    Principle-based codified rules can create that certainty that parties require and ‘rules as code’ is less likely to provide.
    Codified contract rules can better support the operation of contract review software that compares your contract against a database of boilerplate/standardised contract clauses.
    See my article on LinkedIn

  2. Laws and contracts do actually follow the pattern of natural language, the (sometimes recursive) use of requirements, applicability, selections and exceptions. RASE. This exposes the logic and the terms. It’s the terms that may be well defined or loose, which is a choice by the author/drafter. So law and contracts can be automated fully: it’s whether you ask a database or persons or arbitrator for the deciding data.

  3. I tend to agree, but think you aren’t taking into account all the smart contracts that are already in place and the changes public blockchains will cause.

  4. This discussion reflects the fundamental differences between expert systems based on deductive reasoning and data-driven AI inductive reasoning. However, each reflects its virtuous cycle. Together their promise is potentially transformative.

    Pure AI systems seek to generalize and extrapolate meaning from a broad set of data to discern issues, anomalies, insights, and guidance from what otherwise appears to be data chaos. Training AI systems involves both machine learning and guidance from domain expert lawyers and skilled programmers.

    Expert systems enable both simple and highly complex document drafting based on precise data in syntax and interpretation of semantics coupled with a structured analysis of decision-making and workflow and relating corresponding outputs. Designing and deploying expert systems also requires careful collaboration between domain-expert lawyers and skilled programmers – far more so as the complexity of data and the documents increase.

    Expert systems are currently more mature than pure AI systems. However, the potential for transformative benefit lies in the eventual combination of the two (e.g., AI analysis of a lender’s underwriting and approval documents to populate the corresponding expert system that drives the entire document set). Unfortunately, I have yet to see this. Does anyone know otherwise?

    • “This discussion reflects the fundamental differences between expert systems based on deductive reasoning and data-driven AI inductive reasoning.” I think this hits the nail on the head and it is very interesting to my PhD research, do you know of any research papers that explicate this? Many thanks in advance!

  5. Very interesting. I’m a machine learning engineer in a legal tech startup. I particularly like thinking about whether problems are “deep but narrow” (like AlphaGo by DeepMind) or “wide and shallow” (“should this person go to prison?”). Sure, AlphaGo is very good at Go, a deeply complicated task, but its world is restricted to 19×19 squares which can be 1’s or 0’s. Sentencing and other legal tasks are often very prescriptive and straight forward (shallow complexity), but have to draw context from a wide and sparsely distributed context. I recently write an article on some other challenged Maybe context should be added to the list now!

1 Trackback / Pingback

  1. ‘Moneyball For Law’ Prediction Startup, Ex Parte, Bags $7.5m – Artificial Lawyer

Comments are closed.