Law Might Be Code

Larry Lessig is famous for, among many other things, his dictum that “Code is law,” meaning that code in both legal and computer senses is a means of social control. Turns out, unsurprisingly, that people at his former home of Stanford University are working to see if they can actually make laws into computer code.

The wonderfully named Hammurabi Project from Stanford’s Center for Computers and Law is converting a few patches of U.S. legislation into machine readable C# in an attempt to express the logic and relationships of those provisions in a way that might allow facts to be plugged in and a useful conclusion to be emitted.

I’m going to quote the Project Rationale in full, because I think it expresses well the sense of frustration anyone must feel coming to law from the outside (or, in many cases, even as an insider) and encountering its hypercomplexity:

Around the world, there are millions of pages of law – constitutions, statutes, regulations, case law, and interpretive decisions – with which societies are expected to comply. This mass of material is logically complicated, referentially byzantine, terminologically inaccessible, difficult to contextualize, and sometimes vague and ambiguous. Aside from the ethical issues caused by this complexity, it is grossly inefficient as an information system. The capital required for an actor to understand a legal right or obligation is a wasted resource that creates drag on individual, corporate, and social progress.

Though not often thought of this way, law is inherently computational. It is a set of algorithms that prescribe how various computations are to be carried out. What is my standard (tax) deduction? Am I eligible for family and medical leave? On what day did I become liable for unemployment taxes? Determinations such as these are like mathematical functions: given various inputs, they produce corresponding outputs.

The Hammurabi Project provides a vehicle for representing portions of the law in an executable format, so that the process of logical inference can be offloaded from human to machine. Once executable, it can be embedded into our computing infrastructure where it can drive other applications.

Information technology and computational power have become increasingly sophisticated, almost exponentially so; and it would be a fool who said that this thing will never fly. And it does represent one scenario for the “end game,” as it were, of ever increasing legal complexity, the alternative being collapse of the system. So put this in the back of your minds while you’re debating whether or not to abandon hourly billing or to build a client portal.

The coders are coming, the coders are coming.

[hat tip: @SapnaLawPC]


  1. David Collier-Brown

    As a programmer and logician who chancesto have legal draftspersons as friends, the law looks to me like a “semi-infinite set of co-routines, all executing concurrently, using a small integer number of global variables”.

    I think it’s a cool project: I fear it might be computationally infeasible (;-))


  2. Robert Richards

    Mr. Poulshock has written more on his approach to legal technology in in post entitled “Rule-based Legal Information Systems,” at VoxPopuLII:

  3. Dave

    Areas of law are certainly “computationally feasible” – nice term (g). Law itself? It’s currently as computationally infeasible” – nicer term – as religion, for the same reason. An explanation of that reason? That reason? I recommend David Gerrold’s, When HARLIE Was One: Release 2.0

  4. The kinds of examples given in the Stanford text are the easy ones: does someone meet a specified criterion, or set of criteria? It will be harder when one gets to standards of reasonability, in part because people often have an incentive to test the boundaries of reasonableness. Also, facts can be complicated. So deciding if someone has taken reasonable steps to avoid a reasonably foreseeable harm will be hard to program.

    To some extent as well, the law relies on human judgment, not only among judges, but among juries – counting on them to be humane not just rational. I don’t think C# has the empathy function yet. That’s not just a matter of computational infeasability, i.e. lack of processing power available in the relevant future. In other words, it’s not just a practical difficulty, it’s a theoretical difference.

    There are other reasons why law may be inexact, including the inability or unwillingness of lawmakers to be as precise as possible. Precision is only one possible value in lawmaking.

    We’ve certainly learned in my lifetime in the law that computers can be hugely useful to some formss of legal analysis, so the Stanford project is worth pursuing. We should not expect it to produce a Code that is comprehensive.