This report aims to provide a basis for senior decision-makers in New Zealand to critically assess and act upon the potential of law-as-code initiatives. It was stimulated by the growing attention to the “Better Rules” programme, a “better rules approach”, and international “rules as code” efforts. From this starting point we investigated the wider field of “law as code” to assess feasibility, risks, and benefits.
There is extensive research underpinning the many different aspects of this topic. Describing this research in sufficient detail would require the use of complex domain-specific language that is only reasonably understood by those with robust knowledge of linguistics, law, computer science, and other topics. Instead, we have aimed to share key conclusions for non-experts and to justify our recommendations.
Law-as-code approaches have significant potential benefits that are supported by an extensive history of academic legal and computational research and practice.
By contrast, the claims and aspirations of some advocates of “legislation as code” approaches are unjustifiably optimistic about the capacity of code to have equal status to the law, or the benefits of removing legal interpretation from the way legislation works.
Despite this, we identify clear opportunities with public and private benefits for proportionate and effective use of law-as-code approaches to policy development, as well as the use of computational models of legal instruments.
We identify two existing statutory frameworks for incorporating both a “better rules approach” and “rules as code” models into existing government administration:
Legislation can be revised and clarified through the legislation revision programme under the Legislation Act 2019 where shortcomings are identified in legislation through a better rules approach; and
We identify a pattern of statutory drafting that authorises identifiable people to delegate statutory powers and functions to “automated electronic systems”, enabling computational models of the law to be deployed in defined circumstances.
On this basis, law-as-code approaches should be explored further in New Zealand, particularly in relation to current internet filtering legislation, and in the re-write of the Resource Management Act 1991. We also propose an incubator (or similar) involving both government and non-government actors. Trust, confidence and reliability in law as code approaches can be built through transparent, multi-stakeholder collaborations on use cases and public sharing of case studies.
We address two recent phenomena within the New Zealand context that have come to be known as “better rules” and “rules as code”. These labels have become conflated and confused. We think it necessary to maintain a distinction between these two phenomena, and we articulate that distinction in Part 2.
The distinction is best understood by considering how Better Rules brings a service design methodology to policy development, with rules-as-code being one potential output of a Better Rules process. “Rules-as-code” is a wider concept encompassing all things related to the capturing of rules (including law) in code.
In short, “a better rules approach” is a policy development method and “rules as code” is a topic of investigation that encompasses the full history of scholarship detailing historic and contemporary attempts to model legal systems in machine-executable languages (code).
A “better rules approach” (discussed in greater detail at Part 2) is a method for supporting policy development with clear contemplation of how the policy will be implemented and delivered using digital systems. The capacity for policy, regulation and legislation to be implemented in digital systems is fundamental and only growing in importance. We recommend using a better rules approach when it is likely that government or non-government actors will use an automated (or semi-automated) electronic system to give effect to the law.
Independently of whether policy is eventually operationalised in digital systems, a better rules approach produces more conceptually coherent and logically consistent policy through the application of service design techniques, and through concept modelling and computational testing. This makes the task of a legislative drafter easier because of the way a drafter is presented with a fully formed, logically coherent policy to reflect in legislative drafting.
If a better rules approach is made sufficiently open to non-government actors, it enables the policy, the legal instrument, and the computational model of that policy to be scrutinised by a range of actors and institutions before it is implemented. This would be complemented by existing Select Committee processes, and would contribute to the production of better, more reliable policy.
We identified other situations where, in substance, the key aspects of a better rules approach were being explored. This gives us confidence in the universality and essential merits of a better rules approach.
In both “better rules” and “rules as code” discussions, there is frequent reference to the concept of “legislation as code”, as well as the idea of “translating” law into code. By way of illustration, we include excerpts from public materials around better rules and rules as code in an Appendix. In Part 3, we critically assess the notion of “legislation as code” and reach our most important conclusions.
We have been unable to identify anything that would prevent the New Zealand Parliament enacting legislation that is written in code, consistent with the principle of Parliamentary Sovereignty. Any legislation produced according to the correct procedure is valid, even if the content and effect of that legislation is morally repugnant, or its form and symbolic medium is highly irregular. Neither would change the fact that it is the law of the land. Other constitutional actors, including Executive and Judicial branches would be obliged to give effect to such a legal instrument in the usual way.
However, we conclude that for both pragmatic and principled reasons, rules written in code (i.e. machine-executable languages) should never be given the status of legislation. Importantly, at the level of principle, enacting code creates serious constitutional confusion and risks undermining the separation of powers between the Executive, Judicial and Legislative branches of government. At a pragmatic level, incorporating code directly into legislation would be a departure from recent moves to make legislation clearer and more concise by avoiding excessive detail and prescriptive drafting, as well as esoteric expression.
Code should remain subordinate to legislation. “Translation” is not a useful concept when describing the relationship between legislation and code. Instead, coded models are better understood as a an interpretation of what the law requires. The fact they are computational models does not change this, even where parallel drafted. Further, in practice, most computational models will draw on a wide range of legal sources, and the notion that a single model will represent a single legal instrument is difficult to sustain.
Some advocates of rules as code or better rules approaches appear to argue that parallel drafting a legal instrument and a computational model of that instrument during the policy development process will lead to “isomorphism” between the two. In context, this appears to be understood by some as meaning a perfect correspondence of meaning between the two instruments (the law and the code) with no further need for “interpretation” or “translation” between natural language and machine language “versions” of legislation.
It is largely accepted that perfect correspondence of meaning between machine and natural languages is an impossible goal. Isomorphism is best understood as “traceability” between the legal source being modelled and the expression of the rule within the model itself. This traceability acknowledges that computational models of a rule are not the same as the rule itself.
Even where natural language and machine language rules are drafted simultaneously in parallel, they can still diverge in their meaning and effect. Once a legal instrument is passed in natural language, the rule of law (and specific legislative guidance in the Legislation Act 2019) requires that the natural language of the legal instrument be interpreted based on its text, purpose, and context. The meaning of this text can and should be allowed to diverge from the policy intent of the Executive. This means that the policy intent as captured in a coded model can be inconsistent with the way natural language rules are eventually interpreted. This is necessary from a constitutional perspective, as we explain in Part 3.
Even where parallel drafted, a computational model of the law or a regulatory system is only an illustration of Executive policy intent. There is no guarantee the model has identical effect to the legislation.
Taking a better rules approach (including parallel drafting) anticipates the way that legislative drafting will need to be interpreted and then operationalised in digital systems. As a result, it is likely to reduce the frequency of situations where it is not clear to end-users how legislation should be interpreted for implementation in computational systems. However, this general improvement in digital interpretability should not be confused with the idea that no interpretation is taking place. Parallel drafting can minimise interpretive gaps between English drafting and computational model, but it cannot remove them entirely.
While our findings in Part 3 undermine the suggestion that there could or should be authoritative or ultimate “legislation as code” deployed in New Zealand, that does not mean that highly reliable interpretations of the law, deployed in code at scale, could not be useful.
In Part 4, we explain why we think computational models of the law are still useful, even if they are only interpretations of the law. This is true whether they are produced as part of a better rules policy development approach, or whether they are produced later once legislation has already been passed.
Once laws have been modelled in machine-executable languages, they can be tested for their logical and conceptual coherence, just like any piece of software. There are a range of software development approaches (such as test suites) that can be used to test the computational model.
Importantly, such computational models are only useful if they are reliable: that is, they must be legally correct. It must be possible to assess how the law has been interpreted and modelled. If correct, these models can be useful for certain purposes. For instance, they can provide guidance to citizens about how the law applies to them and their activities, to better understand relationships between different legal instruments, or even to be incorporated directly into software systems used in operational tasks.
We point to the Auckland District Law Society’s Sale and Purchase agreement as an example of the potential that reliable, reusable, and authoritative interpretations of the law can have on access to justice and access to the law. We suggest that natural language legal documents of this kind be emulated when it comes to considering how computational models are created, maintained, and deployed.
Greater consideration should be given to how coded models of the law can be created in open ways that generate confidence in their reliability as a faithful and reliable legal interpretation. A better rules approach is a good way of achieving this, particularly where it emphasises greater inclusion of non-government stakeholders.
These models are not the law or equivalent to the law. They are only interpretations of the law and must be subjected to the same scrutiny as all non-judicial interpretations of the law. Their accuracy is a matter of case-by-case analysis. Moreover, they are always open to being challenged as being incorrect, and there must be a clear and reliable process for doing so.
Government ought to play a role in the creation of reliable computational models of the law, but the most important thing is that there must always be an avenue for non-Government actors to advance their own interpretation of the law, including through judicial processes. This may mean that a coded model is deemed unreliable by comparison to a superior model, even where the former was produced through parallel drafting.
In Part 4 we identify a pattern of statutory drafting that authorises people to delegate legal tasks to “automated electronic systems” (AES). We explain this drafting pattern and make recommendations about how it could be more widely adopted, as well as recommendations for enhancing the regime if coded models of the law are to be deployed.
Legislation requires that the “reasonable reliability” of AES in particular statutory contexts is assessed by a nominated person. This preserves an agency’s ability to use code in optimally efficient ways to achieve an agency’s best interpretation of the law governing its operations. It also means any agency responsible for operationalising a coded model of the law would carry responsibility for the reliability of that model and the context in which it is deployed. It would be up to that agency and that accountable person at the Chief Executive level to create institutional systems and processes to maintain the model’s reliability both legally and substantively. There would be clear accountability on that person for any failures.
The pattern of statutory drafting around AES should be bolstered by greater Parliamentary guidance around assessing the reasonable reliability of a model operationalised in an AES. Subsequently, that legislative approach could be adopted more widely through the statute book where agencies wish to operationalise coded models of the law.
Depending on the context of the legislation and the computational model intended to give effect to that legislation, there is scope for Parliament to indicate more explicitly what it expects Chief Executives to assess when they certify a system’s “reasonable reliability”.
Civil servants should also bear in mind that, in relation to an AES, the standard of “reasonable reliability” must be interpreted by reference to the text, purpose, and context of the relevant legislation.
It is important to guard against the risk that, over time, these models are treated as being superior to the primary source materials upon which they are based. There is a risk that the interpretation codified in the model is preferred to the law itself when Executive government perceives the model better achieves the intent of a policy than the legislation upon which the model is based.
There must be clear mechanisms (with access to justice supports) for challenging the accuracy of these interpretations. The final decision on the accuracy of the interpretation will be settled by a judge, or other empowered legal tribunal. Where the judge errs, the error may be corrected by appeal. In short, the judiciary still interprets legislation, and has the final word on such matters.
The merits of law-as-code approaches will strongly benefit from being anchored to real world applications. The relatively abstract theoretical issues that dominate scholarship in this area may or may not arise in practice in a particular operational context. But it is still essential that those issues be explored and debated to build confidence.
For this reason, we recommend that parties with a positive or negative interest in the adoption of law-as-code approaches collaborate to foster development of actual case studies.
We recommend that this be facilitated through a kind of incubator or sandbox that incorporates government, private sector, NGO, and academic input. Similar initiatives have been deployed in the Fintech and Regtech fields around the world, and Legal Hackers NZ has also organised hackathons with a similar function on a case-by-case basis.