Representing Legislative Rules as Code: Reducing the Problems of ‘Scaling Up’
19 Pages Posted: 14 Dec 2021
Date Written: December 9, 2021
Rules as Code (RaC) is a field of research into making human-made rules usable by machines, to perform useful results. The rules to which RaC can be applied include statutes, regulations and many other types of law-related rules, as well as organisational rules such as codes of practice, codes of conduct and business procedures.
This paper outlines an approach to modelling legal rules, particularly legislative rules, that focuses on representing legislation as a hierarchical set of propositions, recording both mechanical structure and real world meaning. It suggests a methodology for expressing these rules in a way that is machine consumable.
The paper describes the progress that has been made by AustLII’s DataLex project in leveraging this form of representation in several ways including automated conversion of existing legislative rules, which can also be described as ‘scaling up’ the production of ‘Rules as Code’. Based on this experience, the paper also demonstrates how the drafting of legislation could be changed to make it directly readable and understandable by humans and also usable by machines.
We explain a number of the conceptual and technical elements of this approach:
• We focus on what rules literally say (not what they do), and to represent that in code.
• yscript is a language used for representing and manipulating propositions, using a quasi-natural-language ‘English-like’ syntax. Syntactically correct yscript rules are able to be run by the yscript interpreter to engage a user in a consultation.
• A pre-processor program (ylegis) takes a section of legislation (or multiple sections) and converts it automatically into a ‘first draft’ of yscript code for those legislative provisions, which can immediately be run by the yscript interpreter.
• The formal mode of ylegis allows legislation to be written in a representation very close to statutory language, and thus able to be both legislation and code.
• There remain significant issues to be addressed in converting legislation where there is syntactical ambiguity, the subject of ongoing work.
• Semantic ambiguity, or the ‘open texture of legal language’, is not something that representation by itself can easily reduce. It is addressed through actively assisting users to locate the legal source materials on which interpretation must be based.
We conclude by suggesting that there is evidence these processes are potentially scaleable and able to deal with the conversion or production of significant sets of legislation. Further work is needed to investigate the extent to which the conversion and creation of ‘Rules as Code’ can be done at scale and applied to different types of legislation and other classes of legal rules.
Keywords: AI, artificial intelligence, law as code, rules as code, AustLII, RegTech
Suggested Citation: Suggested Citation