SLAW Article: Digitizing Law

. writes

 

P1050763 Louvre code Hammurabi face rwk
One of the first instances of recorded law we are aware of is the Code of Hammurabi. It was literally etched in stone. If you read about it, what strikes you is how little has changed about how we record laws in roughly 3700 years. We learned to put laws on parchment. Then paper. Then typesetting, and photocopying. Eventually, we began to digitize images of the pieces of paper on which the law was written. But all of these were just different ways of recording the etchings in the stone so people could use them.

While significant progress has been made on digitizing documents, allowing us to create and change and analyse them, relatively little has been accomplished in the realm of digitizing laws so that computers can use them.

Imagine that you have a document that sets out the rules of rock, paper, scissors. A computer can easily help you change the font, print it, export it in various formats, etc. But a computer cannot, on the basis of that document, easily play a game, or tell you which player won a game that you describe to it.

At least, not yet.

Introducing the SMU Centre for Computational Law

I recently began working on a contract basis as a researcher in symbolic artificial intelligence with Singapore Management University’s Centre for Computational Law. This brand-new Centre is hosted at the SMU School of Law, funded by Singapore’s National Research Foundation and Infocomm Media Development Authority, and led by Assistant Professor of Law and Information Systems, Lim How Khang.

The Centre’s first five-year project is a Research Programme in Computational Law that is working to build an open source programming language for law. The research is led by Principal Investigator Wong Meng Weng and Industry Director Alexis Chun, who have been working for several years as principals for the computational law startup Legalese.

The Centre is unique in at least two significant ways. It is interdisciplinary, and it is committed to open source technology.

Interdisciplinarity

The programme is still in the process of recruiting and on-boarding staff, a task that has been made more difficult by the travel restrictions imposed by Covid-19. But already there are technology entrepreneurs, lawyers, law professors, computer science professors, programmers, and linguists, and most of us fall into more than one of those categories. The project is not designed to conform to the norms of a given academic discipline. It approaches real world use-cases from different perspectives, trying things in public, making mistakes, and learning fast by doing.

Open Source

The research programme aims to create an open source programming language for law. It names access to justice and efficient regulatory services as two of the potential benefits. Both of those objectives make the Centre’s commitment to open source software critical. In the access to justice realm, open source software reduces the cost of automating. And in the administrative law realm, open source software provides the transparency and accountability that is critical for use by public bodies in a world increasingly and justifiably skeptical of automated public services.

The programme also hopes to benefit from synergy with legal open source tools and communities that already exist, such as the EU’s LEOS (Legislative Editing Open Software), or Docassemble, a tool for online interviews and automated document generation.

Docassemble recently held its third annual user converence (virtually, due to the pandemic), and the Centre was there to contribute. The programme’s first published open source contribution is docassemble-DADataType. DADataType is an expansion for Docassemble that allows for rapid prototyping of online interviews on the basis of nothing more than the name and datatype (e.g. “age, which is a number”) of the information that needs to be collected.

This tool will allow the programme (and anyone else who cares to try) to instantly generate interactive web interviews that can collect information, send that information to automated legal reasoners, provide useful answers, and explain those answers, all on the basis of little more than the encoded rules themselves.

The programme is also currently working on an open source tool called dmnmd (which stands for Decision Modelling Notation in Markdown) that will allow people to write DMN decision table-style “rules” inside editors that use the popular “markdown” text formatting language.

What is a Programming Language for Law?

Whenever you use a computer to do something, like write a Microsoft Word document, there are various languages being used to represent information in a way that is helpful. For example, the .docx at the end of your Word files refers to the variant of XML (eXtensible Markup Language) that Microsoft Word uses to save your document. That is a programming language. Then, when you send the document to your printer, it is converted into a language called PostScript, which is used to tell printers how to generate documents. PostScript is a programming language. When you export it to a PDF, you are translating the document from DOCX to the “Portable Document Format,” which is another programming language.

Do we need programming languages for writing and printing and sharing documents? Yes, lots of them. But we don’t usually directly use any of them. We use software that uses them. And they generally aren’t thought of as programming languages, because they are not designed with human users in mind, and they can’t be used to do anything other than the task for which they were designed. But that doesn’t make them not programming languages. It just makes them “domain specific.”

In the same way that these “domain specific” programming languages make it easier to record the structure of documents to allow computers to do things like create, print, and share documents, we need domain specific programming languages that make it easier to record legislation, regulation, contracts, and other sorts of rules in a way that will allow computers to do things like ask users for relevant information, answer and explain the answers to legal questions, and analyse rules to see if they work properly or conflict with other rules.

This has two major benefits.

Making Legal Apps Better

Legal rules have features that other sorts of rules don’t have. First, they are normative. They do not describe what will happen, every single time. Instead, they describe what was supposed to happen, and perhaps what happens when that expectation is violated. So they make use of counterfactuals, exceptions, and prescriptive concepts like obligations, prohibitions, penalties, and rights.

It’s possible to express those sorts of ideas in a programming language not built specifically for it, but it’s not easy. And then, inevitably, the rules change. And however difficult it was to encode your legal rules, it becomes exponentially more difficult to maintain them.

So programming languages for law simplify the process of creating legal apps, and improve their quality. It is hoped a higher quantity and quality of legal apps will have benefits for access to justice and the efficient administration of public law.

Making Laws Better

But surprisingly, the benefits in quality go in both directions. The Rules as Code movement, which I have written about on Slaw before, seeks to encode legislation and regulation at the time of drafting, so the encoded version of the rules can improve the quality of the authoritative legal text itself, and make it easier to automate those rules with confidence because the rules are clearer.

Past, Present and Future

The use of programming languages to represent legal rules is not a new idea, by a long shot. Richard Susskind wrote his PhD thesis and first book on the topic in the mid-80s. The idea has a long history. But the Centre and the Programme seem to arrive at a moment of resurgence of interest in encoding legal rules.

The rise of blockchain technology has led to a renewed interest in “smart contracts,” which require exactly these sorts of programming languages (e.g. Accord Project). The OECD’s Observatory for Public Sector Innovation is working on a draft primer on Rules as Code. The draft document notes that the ideal programming languages for Rules as Code do not yet exist, and encourages research. Banking associations, struggling to keep pace with the rate of change in their regulatory environment, have been calling for the encoding of regulatory requirements in places like the UK, the EU, and Australia. And the Australian Prime Minister in the last year has touted the benefits of encoding legislation at its source.

Closer to home in Canada, the Canadian Community of Federal Regulators had a Rules as Code session at the last FWD50 public sector technology conference in Ottawa. The Canadian Institute for Administrative Justice will have a panel on Rules as Code at their next legislative drafting conference. And Service Canada, in what strikes me as something of a coup, has recruited one of the world’s foremost experts in Rules as Code in public administration, Pia Andrews.

There is a lot of work to be done, and it will take a long time. The tools we need don’t exist yet, and we don’t yet know what would make them ideal. But the long term goal is to give legislative drafters, lawyers, legal services providers, courts, and other justice workers tools that are as indispensable, powerful, and easy to use and learn as word processors have become.

The research programme is also currently seeking partners who have use cases in the realms of expert systems, automated document assembly, rules as code, and smart contracts.

If you are interested in the details, the Centre has a GitHub account where all of their software is published.

If you are interested in following along with my work with the Centre, I will be posting more frequently on my Medium page, or you can follow me on Twitter.

The research programme is supported by the National Research Foundation, Singapore under its Industry Alignment Fund – Pre-positioning (IAF-PP) Funding Initiative. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of National Research Foundation, Singapore.