Introduction and overview


  1. This report offers analysis of whether computer systems and computing principles can be used to improve the delivery of law and policy. While it has accounted for literature and developments from all around the world, it is primarily interested in the New Zealand legal system, constitution, and policymaking process. These insights will be applicable elsewhere.

  2. The report was prompted by two phenomena within the New Zealand policy and legal space: the “Better Rules” programme and its range of potential outputs; and international discussion about “rules as code” approaches, where “rules”, including legislation, are translated or modelled in code.

  3. In Part One, we begin by giving some context to the topic and attempting to define our terms of discussion. There are a variety of alternative terms in-use to describe this topic, and law as code programs and applications come in many shades.

  4. In Part Two, we describe our understanding of what a “better rules approach” entails by comparison with what we say is another label for law as code: “rules as code”. We state our conclusions on the merits of a better rules approach and foreshadow the reasons for our concern about “rules as code” approaches. In particular, our main concerns arise from any suggestion by “rules as code” or “better rules” advocates that legislation itself should be written in code, or that code could or should have an equal authority to legislation itself. We have included excerpts in an Appendix to illustrate situations where we believe advocates are explicitly or impliedly arguing in support of such a scenario.

  5. In Part Three, we justify our concerns about why code should not be law, and why the notion of one-to-one translation of legislation into code without altering the law’s effect or meaning is extremely difficult to accept. We avoid diving too deeply into “what law is”, but we discuss in depth the way that written legislation and statutory interpretation are fundamental to the rule of law and separation of powers. We note that “ascertaining the meaning” of the law is a complex interpretive exercise that draws from multiple different sources of the law and unstated legal principles. The different institutions and sources of the law are all important to its democratic operation. Interpretation is an essential element of the law, and moreover, an essential role reserved for the Judiciary, by comparison with the Executive and the Legislature. If legislation were to be written in code with a view to removing all interpretation from written (coded) legislation, this risks excluding the Judiciary from performing its constitutional role as interpreter of legislative language. We say legislation should not be written in code and urge extreme caution.

  6. In Part Four, we salvage the best of “law as code” approaches in light of the conclusions we have reached on the notion of “legislation as code”. We describe the ways that we believe a better rules approach and “rules as code” instruments (or computational models of the law) can nevertheless be created and deployed by government in ways that respect the separation of powers. We argue a better rules approach in particular could increase the “reasonable reliability” of “automated electronic systems” (AES) used to perform legal tasks.1 We point to a specific example of how “interpretation as code” instruments could be used for public and private benefit. We also apply our conclusions to a piece of legislation currently before the House of Representatives dealing with the use of electronic systems for internet filtering.

  7. Part Five of our report states our conclusions and recommendations on how law as code initiatives should proceed in New Zealand.

Background to “law and/as code”

  1. The notion of integrating law and computer systems prompts vastly different ideas in different people. These phenomena may range from interactive models that help citizens to navigate the requirements of the legal system, all the way to legislation written in machine readable languages and implemented in automatic, computer executable forms.

  2. Setting aside visions of Robocop (though “robodebt” and electronic “cops in the back seat” are a distinct possibility), our focus is on a handful of immediate things.2

  3. The first is to acknowledge that the current relationship between the legal system and the society it governs leaves much to be desired. Loevinger, writing in 1949, said that: 3

    It is one of the greatest anomalies of modern times that the law, which exists as a public guide to conduct, has become such a recondite mystery that is incomprehensible to the public and scarcely intelligible to its own votaries.

  4. Law is still arcane and inscrutable to many people. Across the common law world there have been many investigations and statements of public concern over decades about the complexity of the law and sheer number of legal instruments that describe it.

  5. The legal system and its processes are lethargic while people’s demands are vigorous. The barriers to effectively accessing the justice system are many. Overall, the legal and administrative systems which citizens must engage with to pursue their visions of the good life are so often painstakingly slow and costly, both to the individual and to the government that administers them.

  6. Further, there is a long history of examining the way that law as an ostensibly neutral system may be used to authorise, conceal, and justify discriminatory or unjust practices. 4 While the rule of law seeks a degree of impartiality between individuals and groups, frequently, it is perceived with some justification as a tool used by powerful groups to legitimise and maintain existing power structures.

  7. It is against this backdrop that interest in the question of whether and how legal effects can be better achieved using computation has grown for many decades. It is an admirable area of investigation, usually spurred by commitment to the public interest.

  8. Nevertheless, there are risks to careless adoption of law as code approaches. While we agree that law as code applications can be valuable, we are particularly focussed on risks that are less obvious or a lesser priority, particularly when they are being championed by those working within Executive government – constitutional risks, for example.

  9. We understand that some of these risks may seem abstract, remote, or unimportant – particularly where civil servants are tasked with simply finding a way to operationalise whatever Parliament has set out in legislation. Nevertheless, we hope to demonstrate that these risks are unavoidable and significant.

  10. As authors, we are conscious of the amount of thought and effort that continues to be invested in this area. We have included a brief appendix with current international research efforts that New Zealand should monitor.


  1. At this stage it is necessary to define the terms we use to describe this subject. This is because ambiguity of language sits at the heart of this topic. Further, it is impossible to communicate our conclusions for the benefit of a multidisciplinary audience without pinning down what we mean.

Language around this topic is ambiguous

  1. Law as code is a complex subject matter. It includes aspects of computer science, jurisprudence, logic, linguistics, legal drafting, statutory interpretation, legal practice, political science, social policy, economic policy, and the process of making policy generally.

  2. We are acutely conscious of how this makes collaborative discussion of the topic more difficult. The word “code”, for example, is a homonym with alternative meanings in law, communication theory, and computer science. Each of these disciplines represents a different community of language users, often with their own technical vocabulary (sometimes described as a “domain specific language”).

  3. For good reason, linguistic precision is paramount to the communities associated with each of these disciplines. In legal systems and in computer systems, extremely minor examples of incorrect expression can be catastrophic (or at least render an entire system ineffective). Each of the disciplines referred to above has a justifiable measure of confidence that the approach taken toward these issues by their own community is pre-eminent, and that people from other disciplines do not understand, or should defer to their leadership.

  4. In summary, the current discourse around this topic can be convoluted. Not only is the topic indistinct but the issues raised by it are interdisciplinary. Participants are applying different interpretative biases to the propositions of their interlocutors, depending on what community of language users each belongs to. The result is that participants talk past one another or perceive inaccuracies where there are none.

  5. To complicate matters further, even where they are talking about the same thing, the members of these different communities often have divergent assumptions and expectations about what features of a process or end goal are desirable or not. This results in fundamental disagreement about what a process or output is meant to achieve, whether legal or computational. This is partly explained by the differing interests each community has in how those processes affect them. For example, groups may sometimes hold mutually exclusive expectations of government services, computer programs, legislation or litigation – what these things are meant to do, according to what priority, and for whom. We cannot resolve these differing priorities, but we can offer our perspective on legal and constitutional matters that should be considered.

  6. Finally, we note that the language available for speaking and writing about this area suffers from the same core problem area in this space – the careful deployment or eradication of ambiguity and the endless scope for linguistic interpretation presented by natural language.

  7. We note these points because they have also impacted on the writing of this report. There is simply no one correct way of describing the topic. Further, these factors have strongly influenced one of our core recommendations: that future work in New Zealand on law as code be anchored to tangible use cases, rather than ungrounded, theoretical discussion.

Terminology used in this report

  1. In this report we use the phrase “law as code” to refer collectively to a bundle of phenomena that share the fuzzy goal of using computational modelling in relation to tasks traditionally associated with the law. Generally speaking, we seldom refer to bare “legal information retrieval”.

  2. When we are writing specifically about one of these subsidiary phenomena, we endeavour to do so at the exclusion of other phenomena within the wider “law as code” area. At the same time, we acknowledge that these phenomena tend to overlap at many points. Differences as well as similarities are important to us.

  3. Where we use a more precise term than “law as code”, we do so deliberately in order to refer to that specific subsidiary phenomenon. We offer some examples below by way of illustration.

    1. Subsidiaries of law include legislation, case law, secondary legislation, contracts or similar. A broader term might be regulation, which also includes regulatory instruments that might not have legal status except by incorporation or reference, or other non-legal means of shaping behaviour.

    2. We never use the word “code” to refer to legal codes.5

    3. In terms of the word code, we sometimes distinguish between machine-readable and machine-executable languages. Code can refer to a range of machine-executable digital data which algorithmically instructs a CPU how to conduct computational operations on other data. In this way, code is used to refer to higher or lower-level programming languages, from machine code to Prolog and even Javascript.

    4. Our references to law as “code” should not be taken to deliberately exclude “law as data” either. Machine code, i.e. binary notation, is a form of digital data. Once law has been coded, it is a source of data for other systems.

    5. Finally, when we say “law as code”, the word “as” could imply a logical equivalence. A number of other logical connectors could be used to describe specific relationships between law and code, such as “law in code”, “law and code”, and so on. The subject of our study is to test the extent to which law and code can be equivalent. For this reason, we have used the word “as”, bearing in mind that we do not exclude other possible relationships between law and code from our investigation, as discussed in more detail in Part 4.

Orientation toward New Zealand

  1. This research was prompted by law as code developments within New Zealand. Despite our geographic and jurisdictional focus, these developments influence (and are influenced by) similar developments in other countries, within the private sector as well as government.

  2. The primary objective of this report is to guide New Zealand’s senior decisionmakers to make informed decisions about the development and deployment of law as code applications. We provide a legal and constitutional perspective.

  3. Given this is a report about Legislation as Code in New Zealand, it is important to acknowledge the way we have approached this research within a predominantly European world view. Speaking generally, but particularly given its geographic scope, this subject would benefit from investigation from a te Ao Māori perspective and Māori values. This is particularly so given the central role of Executive government and the Crown in policy-making, the passage of legislation, and delivery of government services.

Increasing imperatives toward digitalisation of law and policy

  1. Government will increasingly develop and deliver its services through computational systems. At the policy level, and frequently at the Executive level, there is vocal interest in improving the accessibility and quality of government digital services. These services are almost invariably governed by various kinds of laws, which confer powers and obligations on the Executive branch of government. As larger populations require access to more complex government services, it tends to become harder for the state to provide those services with acceptable accuracy in an acceptable timeframe. Subsequently, Executive agencies must figure out how to deliver more, sometimes with less resourcing.

  2. The use of digital computational systems presents one way of achieving more with less in high volumes (at scale). Digital systems enable the use of automation. The practical impediment to this is that the application of laws is rarely suitable for automation. Simply put, they were not written for that purpose – semantically or syntactically. They usually require a person to exercise some judgement. Some of the possible solutions to this are to rewrite the law in various ways, or to write new laws according to a process that is more likely to generate a computer-implementable output.

  3. Each of these options generates its own benefits and trade-offs. In New Zealand, a programme known as “Better Rules” aims to do some combination of the two. This programme is discussed in much greater detail later in Part 2. Our investigation is prompted by this attempt to create “better rules”,6 and a wider international movement to create “rules as code”.7

  4. These contemporary movements are not the first time it has been suggested that law and computer code could interact for the public benefit. There are decades of previous research that inform the topic in various ways. Moreover, if research on formal logic or mathematical expression is included as the foundation of computer science and clear expression in argument, then the history of the topic could be measured in centuries.8

  5. With this historical foundation in mind, the report sets out two things:

    1. In Part 2, the authors’ understanding of the suggested processes and implementations that comprise the “better rules” and “rules as code” processes, and the broader aim to produce machine-executable versions of legal instruments.

    2. In Part 3, the author’s conclusions on the potential benefits and risks of producing legal instruments in both natural language and machine-consumable languages. In particular we critically examine the claim that all ambiguity can and should be removed from legal instruments and that machine-consumable models of legal instruments can be direct one-to-one translations.

  6. We perceive that the greatest risks of adopting “law as code” practices, or in attempting to implement legal objectives through code, will arise from uncritical adoption which fails to account for the variety of disruptions that may occur, and the theory and rationale which underpins the contemporary legal system. These risks are significant enough to outweigh any benefits foregone by adopting a precautionary approach.

  1. These are statutory phrases drawn from pieces of legislation we identify in Part 4. ↩︎

  2. See Genesereth, M “Computational Law: The Cop in the Backseat” (2015) White Paper, CodeX: The Center for Legal Informatics Stanford University. See also Whiteford, P “Robodebt was a policy fiasco with a human cost we have yet to fully appreciate” 16 November 2020: <>. ↩︎

  3. Loevinger, L “Jurimetrics: The Next Step Forward” (1949) Minnesota Law Review; reproduced (1971) 12 Jurimetrics Journal 3 to 41: <>. ↩︎

  4. See generally the work of the legal realists in legal philosophy. We also discuss the role of law in enabling the Crown to breach the Treaty of Waitangi in Part 3. ↩︎

  5. In law, a “code” can be a statement of rules, usually in a civil law tradition, whose purpose is to fully and completely state the law. To “codify” the law has a particular meaning in law, which refers to taking a sometimes sprawling set of sources that state the law in cases or other sources, and reducing them to a single statement of rules. ↩︎

  6. See, for example, Service Innovation Lab “Better Rules and Legislation as Code” (accessed 25 November 2020): <>; see also Better Rules Discovery Report: <>. ↩︎

  7. See, for example, James Mohun, Alex Roberts Cracking the Code OPSI Innovation Primer on Rules as Code (OECD, 14 October 2020): <>. ↩︎

  8. See M H Hoeflich “Law & Geometry: Legal Science from Leibniz to Langdell” (1986) 30(2) The American Journal of Legal History 95. ↩︎