DOKK Library

Programming Languages and Law

Authors James Grimmelmann

License CC-BY-4.0

                                      Programming Languages and Law
                                                                 A Research Agenda
                                                                James Grimmelmann
                                                                  Cornell University
                                                             Law School and Cornell Tech
                                                               New York City, NY, USA

ABSTRACT                                                                                  I would like to argue that the computer-science field of program-
If code is law, then the language of law is a programming lan-                         ming-language (PL) theory speaks to law in both of these senses.
guage. Lawyers and legal scholars can learn about law by studying                      Not only is it indispensable for answering certain kinds of practical
programming-language theory, and programming-language tools                            legal questions, but its application can “illuminate the entire law.”
can be usefully applied to legal problems. This article surveys the                    [36] Just as microeconomics provides a new and illuminating way
history of research into programming languages and law and pre-                        to think about rights and remedies, and just as corpus linguistics
sents ten promising avenues for future efforts. Its goals are to ex-                   provides a new and illuminating way to think about legal inter-
plain how the combination of programming languages and law is                          pretation, PL theory provides new and illuminating ways to think
distinctive within the broader field of computer science and law,                      about familiar issues from all across the law.
and to demonstrate with concrete examples the remarkable power                            Consider, for example, the M++ project to formalize French tax
of programming-language concepts in this new domain.                                   law (described in more detail in Section 2.2). M++ is distinguished
                                                                                       from the kind of routine systems engineering that tax authorities
CCS CONCEPTS                                                                           around the world perform on their computer systems by its rig-
                                                                                       orous use of PL theory to design a new programming language
• Software and its engineering → General programming lan-
                                                                                       for describing the provisions of the French tax code. On the one
guages; Domain specific languages; • Social and professional
                                                                                       hand, M++ is useful because it is a clean, modern language that
topics → Computing / technology policy.
                                                                                       is amenable to correctness proofs, improving the reliability of tax
                                                                                       computations. On the other hand, M++ programs mirror the struc-
KEYWORDS                                                                               ture of the tax laws they formalize. Instead of treating the rules of
programming languages, law                                                             tax law as an ad hoc design document, M++ treats the tax code as
                                                                                       though they were itself a program, one meant to be “executed” by
ACM Reference Format:
James Grimmelmann. 2022. Programming Languages and Law: A Research                     lawyers and accountants. The goal is not just to do the same thing
Agenda. In Proceedings of the 2022 Symposium on Computer Science and Law               as the tax code, but to do it in the same way, section by section,
(CSLAW ’22), November 1–2, 2022, Washington, DC, USA. ACM, New York,                   clause by clause.
NY, USA, 11 pages.                                To generalize, PL theory has something unique to offer law be-
                                                                                       cause there is a crucial similarity between lawyers and program-
                                                                                       mers: the way they use words. Computer science and law are both
1    INTRODUCTION                                                                      linguistic professions. Programmers and lawyers use language to
Computer science contains multitudes. It ranges from pure math-                        create, manipulate, and interpret complex abstractions. A program-
ematics to quantum physics, from the heights of theory to the                          mer who uses the right words in the right way makes a computer
depths of systems engineering.                                                         do something. A lawyer who uses the right words in the right way
   Some of its subfields speak to urgent problems law faces. Crim-                     changes people’s rights and obligations. There is a nearly exact
inal procedure [60] and national security law [27] cannot regulate                     analogy between the text of a program and the text of a law.
the world as it exists without taking account of whether, when,                           This parallel creates a unique opportunity for PL theory as a dis-
and how data can be kept private. Other subfields provide new                          cipline to contribute to law. Some CS subfields, such as artificial in-
perspectives on law. The “law as data” movement [9, 75] uses com-                      telligence (AI), deal with legal structures. Others, such as natural
putational methods like topic modeling and decision-tree learning                      language processing (NLP), deal with legal language. But only PL
to analyze legal datasets in subjects as diverse as trademark in-                      theory provides a principled, systematic framework to analyze le-
fringement, [17] judicial rhetoric, [74] and the network structure                     gal structures in terms of the linguistic expressions lawyers use to
of the United States Code. [59]                                                        create them. PL abstractions have an unmatched expressive power
                                                                                       in capturing the linguistic abstractions of law.
                       This work is licensed under a Creative Commons Attribu-            Over a decade ago, Paul Ohm proposed a new research agenda
                       tion International 4.0 License.                                 for “computer programming and law,” describing in detail the value
                                                                                       of executable code for legal scholarship: by gathering and analyz-
CSLAW ’22, November 1–2, 2022, Washington, DC, USA
© 2022 Copyright held by the owner/author(s).                                          ing information about the law more efficiently, by communicating
ACM ISBN 978-1-4503-9234-1/22/11.

CSLAW ’22, November 1–2, 2022, Washington, DC, USA                                                                                James Grimmelmann

more effectively, and by writing programs to test and prove schol-             never be falsified by additional hypotheses. For this reason, it can
arly points. [87] More recently, Houman Shadab also called for le-             be hard to model legal reasoning in languages like Prolog whose
gal scholars to improve their research by learning to code. [99] In            semantics are monotonic. Capturing defeasible reasoning (for ex-
one sense, this article takes up their call: PL theory can help legal          ample in statute definitions with exceptions [71]) can require cum-
scholars write better code. In another, it makes a more ambitious              bersome circumlocutions.
claim: if code is law, [72] then understanding code is a way of un-               Thus, some researchers have developed their own legal program-
derstanding law, and vice versa. PL theorists understand code in               ming languages by adding defeasibility as a core language feature.
a profound and distinctive way; legal scholars understand law in               Catala provides a clean and rigorous semantics for defeasible rea-
a profound and distinctive way. They can and should learn from                 soning, which it uses to model statutory definitions with excep-
each other.                                                                    tions. [83] PROLEG implements default reasoning (in which con-
   Indeed, they already are. Some parts of this article are forward-           clusions have a default value even in the absence of evidence),
looking, describing the possibilities for what PL theory and law               which it uses to reason about issues governed by burdens of proof.
could become. But others are backward-looking, taking stock of                 [96]
what has already been accomplished. There is an active commu-                     Other legal logic programming languages add different features.
nity of PL theory and law researchers, drawing on experts from                 s(LAW) models legal ambiguity and administrative discretion by
both sides and building collaborations between the two. In Janu-               generating multiple answers, depending on the resolution of rele-
ary 2022, the ACM held the first Programming Languages and Law                 vant ambiguities. [8] LLD (a “Language for Legal Discourse”) is a
workshop (ProLaLa) as part of the annual ACM SIGPLAN Sympo-                    generic logic programming language enriched with temporal and
sium on Principles of Programming Languages (POPL). Much of                    deontic operators for reasoning about actions and obligations. [81,
the work I will describe was presented there; indeed, I gave an ear-           82]
lier version of this article as a ProLaLa talk.                                   One could regard these examples merely as attempts to solve
   This article will review three case studies of the use of PL the-           problems in AI and law. But I think it is telling that in so many
ory for law, and then present ten promising avenues of potential re-           cases the best way to solve a problem in AI and law has been to
search. Some of them are being actively pursued, others are promis-            create a programming language. It is a sign that there are aspects
ing speculations. I hope to make the case for the value of bringing            of legal reasoning that programming languages are uniquely well-
programming-language methods to bear on legal problems, and to                 suited to capture.
provide some examples of such problems as an enticement to re-
searchers.                                                                     2.2    The French Tax Code
                                                                               The French tax code consists of about 3,500 pages of text, which the
2     CASE STUDIES                                                             French tax authority (the DGFiP) must translate into an amount
To understand what PL theory and law could do, we should start                 due for each taxpayer. Like any other large modern bureaucracy
with what they have already done. Here are three examples of no-               with millions of tasks, it does so by means of a computer program.
table applications of programming-languages methods to law. The                But this program “relies on a legacy custom language [M] and com-
first – logic programming for law – shows how other advances in                piler originally designed in 1990, which unlike French wine, did not
CS and law often rest on a foundation of PL theory. The second –               age well with time.” [84] The system is fragile and hard to maintain,
a programming language for the French tax code – shows how a                   and may contain bugs and mistakes.
PL theory approach improves legal technology practice. And the                    A group of researchers are working with the DGFiP to transition
third – a programming language for a portion of property law –                 its tax-computation system to a modern programming language
shows how PL methods are a natural fit for many legal problems.                backed up by a modern toolchain. They have reverse engineered M
                                                                               and given it a formal semantics, developed a new language (M++)
2.1    Legal Logic Programming Languages                                       with better formal properties and cleaner syntax, written a com-
                                                                               piler (MLang) that supports both M and M++, and are using it to
There is an extensive subfield of AI and law. [9, 19, 34, 35, 38, 50,          speed up, audit, debug, and ultimately prove correct the algorith-
75, 80, 89, 93, 98, 120] Its research program goes back nearly half a          mic implementation of the tax laws.[84] The following is a short
century, and it has its own dedicated association (the International           fragment of a tax computation in M++ taken from their work:
Association for Artificial Intelligence and Law), conference series
(the International Conference on Artificial Intelligence and Law),             compute_benefits () :
and journal (Artificial Intelligence and Law). One of the major lines            exists ( taxbenefit ) or exists ( deposit ) :
of research in AI and law is legal logic programing: representing                  V_INDTEO = 1
formal deductive legal reasoning using propositions expressed in
                                                                                   V_CALCUL_NAPS = 1
a logic-programming language. [22, 53, 80, 98]
                                                                                   partition with taxbenefit :
   As researchers have discovered, however, general-purpose logic
programming languages do not always capture the distinctive char-                    NAPSANSPENA , IAD11 , INE , IRE , PREM8_11
acteristics of legal reasoning. For example, many legal conclusions                         <- call_m () iad11 = cast ( IAD11 )
are defeasible: they are valid on the basis of present knowledge, but              ire = cast ( IRE )
could fail if a known exception turns out to be the case. [67] But                 ine = cast ( INE )
classical logic is monotonic: once a conclusion is established, it can             prem = cast ( PREM8_11 )

Programming Languages and Law                                                                         CSLAW ’22, November 1–2, 2022, Washington, DC, USA

      V_CALCUL_NAPS = 0                                                         3.1    Legal Domain-Specific Languages
      V_IAD11TEO = iad11                                                        New programming languages can provide formal models of
      V_IRETEO = ire                                                            specific legal subfields.
      V_INETEO = ine                                                               While the most familiar programming languages, like Java and
      PREM8_11 = prem                                                           C, are general-purpose langauges that can be used for a wide range
                                                                                of tasks, a domain-specific language (DSL) is specialized to meet
                                                                                the challenges of a specific problem domain. [40, 118] For example,
There are two levels of insight here. The surface level is that MLang           the R programming language for statistical analysis and data visu-
will make tax computations more reliable. But the deeper level is               alization includes operators for performing calculations on arrays
that because M++ makes it possible to express French tax law in a               of data, while the Ink programming language for interactive fiction
new way, it also makes it possible to understand, reason about, and             includes features that select which scene the player will experience
debate French tax law in new ways. This is a classic programming-               next.
languages story about replacing an ad hoc system with one that                     ”Law” as a whole is much too large for a DSL (at least for now),
rests on a firm theoretical and engineering foundation. M++ has                 but many legal subfields are the right size for a DSL. PROLEG, LLD,
rigorously specified semantics and its entire toolchain is built to             and s(LAW) are programming languages for legal logic program-
support these semantics.                                                        ming. M++ is a DSL for tax law. Orlando is a DSL for future inter-
                                                                                ests in property law.
                                                                                   The areas of law most amenable to formalization with DSLs are
2.3    Future Interests                                                         those where legal texts already already partly program-like. They
                                                                                are distinguished by three features. First they use rules rather than
Orlando is a programming language for future interests in real
                                                                                standards, so that they are amenable to formalization at all. Sec-
estate.[14, 49] Its surface syntax is a stylized subset of the con-
                                                                                ond, their participants highly value clarity, so that formalization
structs used by lawyers to write conveyances like “O conveys to
                                                                                offers real benefits. And third, they have recurring patterned struc-
A for life, then to B so long as B does not marry” that
                                                                                tures, so that programming-language tools capture their modular
create and transfer property interests. An accompanying imple-
                                                                                generativity. [49, 101]
mentation, Littleton, compiles these quasi-natural-langauge “pro-
                                                                                   Transactional private-law fields are the most obvious low-hang-
grams” to a tree-based data structure modeling the different inter-
                                                                                ing fruit. It is not a coincidence that there are now numerous con-
ests in a piece of property (here there are three: A’s life estate, B’s
                                                                                tract DSLs. [6, 11, 12, 39, 56] Will drafting, for example, often in-
remainder, and O’s possibility of reverter). Orlando has an oper-
                                                                                volves the creation of trusts with common structures that have
ational semantics that specifies how those interests change over
                                                                                to be plugged together to fit the details of different family situa-
time in response to events (e.g. “A dies”). And Littleton can rea-
                                                                                tions. Similarly, IP licensing breaks up rights into fairly standard
son about the interests in an Orlando tree to do things like correctly
                                                                                elements, but the precise combination varies extensively from deal
name interests and apply the Rule Against Perpetuities. Littleton
                                                                                to deal. And many parts of property law have an underlying doctri-
is is not the only tool or heuristic for visualizing future interests,
                                                                                nal structure that is itself recurring and patterned; programming
[7, 16, 91] but it uses the formal power of a programming-language
                                                                                languages for subareas like title assurance and land-use planning
approach to provide a clean and extensible system.
                                                                                would take advantage of that structure.
    On the most basic level, Orlando is useful as a teaching tool for
exploring the consequences of particular conveyances. A student
can tweak a conveyance to see what difference a wording change                  3.2    Hybrid Contracts
makes, or try out different sequences of events to see how the state            Programming languages for contracts can combine the ad-
of title evolves, or even turn on and off doctrines like the Rule in            vantages of legally enforceable human-readable contracts
Shelley’s Case. A teacher can put examples up on the screen and                 and technically enforceable machine-readable code.
walk through them step by step, instantly updating based on ques-                  One of the most promising domains for legal DSLs is contracts,
tions and hypotheticals.                                                        in part because here is where the most work has already been done.
    But on a deeper level, Orlando’s syntax and semantics them-                 There has been extensive research products to model the deontic,
selves are are a scholarly claim about the underlying structure of              multi-party, and event-driven structure of contracts. [6, 10–12, 24]
the law of future interests. They are based on the rules codified               More recently, the rise of blockchain-based smart contracts has
in the Restatement (First) of Property [90] and glossed in genera-              driven extensive interest in developing good PLs for expressing
tions of treatises and study aids. [20, 37, 88, 106, 121] They make             them. [1, 65, 76, 104]
precise, testable claims about property doctrines. Disagreements                   This last convergence suggests that there may be substantial
about property law can be reformulated as different rules in a for-             conceptual and practical payoffs to developing systems that seam-
mal semantics.                                                                  lessly hybridize human-readable terms and machine-readable logic.
                                                                                Users of such a system could write contractual terms once and
                                                                                them compile them both to “legal code” for humans and “com-
3     RESEARCH TOPICS                                                           puter code” for automated execution. [76, 110] [73] Carla Reyes
Let us turn to what PL theory has to offer to law – and what law                has proposed (and written code for) a form that produces both an
has to offer to PL theory.                                                      executable smart contract that can be run on a blockchain and a

CSLAW ’22, November 1–2, 2022, Washington, DC, USA                                                                                 James Grimmelmann

legally effective financing statement that can be filed with a state              A profitable line of research would be to identify additional le-
office.[92] This approach could help solve one of the most vexing              gal primitives and to systematize their relationships to each other.
problems in smart-contract drafting: what to do when the actual                Existing examples already discussed include the sequencing and
code of a smart contract and its human-readable summary diverge?               termination of legal interests (as in Orlando), the conjunction and
Drafting the two together helps prevent such divergences from oc-              disjunction of legal relationships (as in Composing Contracts), de-
curring in the first place.                                                    faults and exceptions (as in Catala and PROLEG), and legal obli-
   Another advantage of hybrid contracts is that formalizing the               gations and entitlements (as in LLD). This last example has a par-
formalizable parts of them would help prevent – or at least detect             ticularly distinguished heritage in law, as Hohfeld’s system of ju-
– bugs in their logic. A human might miss an inconsistency in the              ral opposites and jural correlatives is in a sense an informal and
natural-language version of a payment schedule, but a computer                 very early legal calculus. [51, 52] It has been the foundation for
running the right algorithm over a software-language version of                numerous efforts in AI and law, [4] and the interlocking nature of
the same schedule would have a chance at flagging the problem.                 claim-rights and duties is essential to a programming language for
In addition, it would become more possible to automate execution               contracts of any complexity. Other legal concepts that might use-
of part of a contract, with responsibility for its successful perfor-          fully be translated into programming-language features include
mance being handled collaboratively by computers and humans.                   the creation and combination of entities in business associations
   More broadly, having a good programming-language-driven ap-                 law, hierarchies of authority among sources of law, the movement
proach to hybrid contracts would help enormously in solving the                of jurisdiction over a case among courts during litigation, counter-
difficult doctrinal problems they create. [3, 29, 47] It would help            factuals and hypotheticals, and concepts of transfer and notice in
lawyers and judges conceptualize and answer questions about the                commercial law.
legal effects of executing the automated part, and about the tech-                Any such effort needs to answer similar questions. First and
nical effects of legal enforcement.                                            foremost is the quest for clean minimal formalizations. This can
                                                                               be a difficult enterprise. Jones, Eber, and Seward observe:
                                                                                      Identifying the “right” primitive combinators is quite
3.3    Orthogonal Legal Primitives
                                                                                      a challenge. For example, it was a breakthrough to
Which legal concepts are simple and pervasive enough to                               identify and separate the two forms of choice or and
serve as building blocks for legal programming languages?                             anytime, and encapsulate those choices (and nothing
   There is a striking underlying simplicity in attempts to model                     else) in two combinators.
distinctive features of legal reasoning. Orlando compiles an enor-
mous range of property conveyances like “to Alice for life, then to            Second, there is orthogonality. Consider, for example, the prob-
Bob” to a small number of operators. It boils down the effects of              lem of combining deontic operators with operators for transferring
a conveyance (rather than the language of the conveyance itself)               property. Do the transferor’s obligations “run with the land” to a
into (1) the termination of interests under specified conditions (”to          transferee? In law, the answer is sometimes yes and sometimes
Alice for life”), and (2) the sequencing of interests (”to Alice …then         no. Thus, obligation and transfer are not fully orthogonal; any sys-
to Bob”). Similarly, although Catala has a rich syntax of scopes,              tem with both sets of operators must also have mechanisms to deal
contexts, and definitions to allow users to track the structure of             with their interaction by marking which obligations do and do not
statutes, its semantics are built around extending standard lambda             follow an interest in property. This is a hard problem, and that is
calculus with a single new feature: exceptions. It is defaults done            part of what makes it interesting.
right for the lambda calculus.                                                    Third, the possibility that many legal concepts can be realized as
   Beneath each of these legal programming languages, then, is a               programming-language primitives implies that different legal lan-
legal calculus: “a language with well-defined syntax and seman-                guages will often have common features. Thus, perhaps it would be
tics that has features whose main purpose is to model particular               useful to build legal-specific back-end support into the compiler
aspects of its [legal] target domain.” [15] The crown jewel of legal           toolchain, not to support any particular legal programming lan-
calculi is the Haskell-based language used by Jones, Eber, and Se-             guage but instead to support a range of projects using different
ward in Composing Contracts to model financial option contracts.               languages. At the moment, the most common way to implement
[56] It has combinators for fundamental contractual operations                 a legal programming language is to compile it to an off-the-shelf
like allowing a party to choose one of two obligations to take on              back-end. Is there enough in common among different legal PLs to
(or) and allowing a party to choose when to take on an obligation              justify adding law-specific features (e.g. for defaults or obligations)
(anytime). Its minimal set of ten combinators is both powerful and             to one of those off-the-shelf back ends? I do not know the answer,
elegant; they carve up option contracts along the joints.                      but the question seems worth asking.
   There is something fruitful about the exercise of identifying a
legal concept and isolating it as a specific language feature. In the          3.4    Legal Drafting Languages
programming-language world, a language’s elegance is often char-               Legal drafting could be made clearer and less error-prone by
acterized in terms of the degree to which it is built from orthogonal          incorporating concepts from PL theory.
primitives. [66, 108] Each of these features should be “primitive” in             Programming-language theory helps programmers write better
that it cannot be further decomposed, and the features should be               programs by giving them languages with features that promote
“orthogonal” to each other in that they have simple and easily pre-            clear and correct code. Perhaps PL theory can do the same for law.
dictable interactions.                                                         While some legal programming languages are designed to model

Programming Languages and Law                                                                          CSLAW ’22, November 1–2, 2022, Washington, DC, USA

legal relationships that already exist,PL concepts could also be use-                Counterfactuals and hypotheticals Legal drafting is full of
ful in improving legal drafting, where clarity and correctness are                     counterfactuals and hypotheticals. For example, a party may
already important goals. [78, 107]                                                     be obligated to take action 𝑥 if failing to do so would result
   For example, Sarah Lawsky observes that the scope of statu-                         in some state of affairs 𝑦. This type for hypothetical rea-
tory definitions is often ambiguous. [70] To be sure, some legal                       soning is one of the basic skills taught in law school, and
language is deliberately vague (e.g., “within a reasonable time”),                     lawyers rely on it extensively. PL theory has tools for rea-
but the scope of a statutory definition should be wholly unambigu-                     soning about possible executions of a program, such model
ous: either the definition of “home equity indebtedness” under the                     checking. And some language features, such as reflection,
Internal Revenue Code should include the 1 million limitation on                       enable programs to reason about themselves. A good legal-
“acquisition indebtedness” or it should not. But the way the defini-                   drafting programming language might include features for
tions are drafted does not resolve the issue. Lawsky proposes that                     compactly stating counterfactuals and hypotheticals.
legislative drafters should formalize their statutory definitions us-                Substitution Lawyers who use search-and replace to amend
ing first-order predicate logic, and then use those formalizations to                  legal documents are already familiar with the concept of
guide their legislative drafting to make explicit the intended scope                   substitution. Sometimes it is explicitly a feature of the docu-
of each definition.                                                                    ments themselves, as when “in the case of an Adverse Event,
   In other words, Lawsky proposes using first-order logic as a                        all deadlines hereunder shall be extended for ten days.” On
kind of programming language for legal drafting. This language has                     the computer-science side, substitution is absolutely funda-
a feature – explicit scoping – that promotes clear and correct le-                     mental to lambda-calculus based semantics. PL theory has
gal code. It is actually impossible to draft a tax provision in first-                 both a rich mathematical theory of substitution and an ex-
order logic with ambiguous scope, because that provision will vi-                      tensive arsenal of techniques and tools to employ substitu-
olate simple and easily checked syntactic requirements that the                        tion in a principled way when constructing and reasoning
language imposes on programs written in it. And once the provi-                        about programs.
sion is drafted in a logical form, it can then be “compiled” to the                  Abstraction From polymorphism to virtual base classes, from
native format of the legal system – natural language – through a                       abstract data types to functors, PL theory as a field is char-
straightforward process that hopefully will not introduce errors of                    acterized by the deployment of powerful abstractions that
this sort. While, other scholars have addressed the value of logical                   massively generalize common programming patterns. Legal
formalization for legal reasoning and legal drafting, [5] Lawsky’s                     drafting’s embrace of abstraction has been much more ten-
analysis focuses attention on the way in which this formalization                      tative; lawyers find themselves writing the same legal code
benefits from an appropriate programming language.                                     over and over with minute variations. Good PL techniques
   The power of this example prompts the question: what other                          for managing systematic abstractions could help lawyers
programming-language features would promote clear and unambigu-                        avoid the tedium and risk of error that come from doing
ous drafting? A few possible answers include:                                          a hundred times what could be done once.

    Variables and binding The inverse problem of specifying the                3.5      Legal Design Patterns
      scope of use of a given definition is specifying which bind-             Common patterns in legal drafting and design should be sys-
      ing a given reference refers to. PL theory has a rich col-               tematically isolated and described, much as common pat-
      lection of concepts (e.g., lexical versus dynamic scope), al-            terns in software design already are.
      gorithms (e.g., data-flow analysis), and programming tech-                  In software engineering, a design pattern is a general, reusable
      niques (e.g., marking variables as global) to manage this                template for solutions to a commonly occurring class of design
      problem. Legal drafters have their own rules of thumb to                 problems. [42] The problems are not standardized enough that one
      manage the problem. For example, patent drafters write “a”               can use a literally identical solution: if that were the case, one could
      when introducing a new claim element and to write “the”                  simply reuse an existing library. Nor are they so diverse that each
      when referring to that element subsequently, to make clear               requires a bespoke solution from scratch. Rather, design patterns
      the distinction between binding and reference.                           are useful in the middle ground, where the same kinds of problems
    Cross-referencing Statutes and contracts are liberally sprin-              recur, but the details are a little different each time. If this strikes
      kled with cross-references (e.g. “for the purposes of sub-               you as being a lot like legal work, you are not wrong.
      paragraph (e), ’days’ shall mean business days”). But cross-                The roots of design patterns lie in the work of the architectural
      references are fragile. As texts are amended, drafters may               theorist Christopher Alexander and his collaborators; their 1977
      fail to catch all of the references to a renumbered section, re-         book A Pattern Language described patterns like ”light on two sides
      sulting in mistaken or nonsensical cross-references. This too            of every room”and argued that they fit into an interlocking, mutu-
      is a problem that programmers contend with, and numer-                   ally reinforcing structure. [2] These ideas were carried over into
      ous programming-language features promote correct coor-                  the software engineering literature by developers and designers
      dination between different parts of a program. Function dec-             who appreciated its connections to modularity and the way that
      larations, module systems, preprocessor includes, and type               object-oriented programming, in particular, could be used to im-
      checking all enable coordination while trying to prevent the             plement patterns. [41, 42] There and in related fields, such as user
      kinds of mistakes that it can introduce.                                 interface design, they have built up rich libraries of design patterns.

CSLAW ’22, November 1–2, 2022, Washington, DC, USA                                                                                    James Grimmelmann

[32, 111] There is a close connection between design patterns and                help drafters be more precise. Ideal contract terms are not just mod-
PL theory, because languages are frequently created to make cer-                 ular but compositional: combining them produces no unexpected
tain types of design patterns easy to employ.                                    interactions, and replacing one adverse-events clause with another,
    There is a nascent literature on legal design patterns, which iden-          say, should affect other parts of the contract. The breakdown of
tifies some common patterns in legal drafting. [33, 44, 94] This lit-            a contract into different kinds of clauses (representations versus
erature draws both on the original architectural theory and on the               promises, for example) is about typing, and a type-safe drafting
idea of design patterns in software.                                             framework would actually prevent drafters from using one in place
    A more ambitious agenda would seek to craft pattern languages                of the other by mistake.
for specific legal areas. In a sense, this is what some of the the form-            Corporate law uses modularity in concentrating legal relation-
books and drafting manuals used by legal practitioners are getting               ships within discrete units; Coase’s Nature of the Firm is in essence
at: they break contracts, licenses, settlements, security interests,             an argument about the optimal size of modules.[28] Corporate law
regulations, and many other types of legal documents down into                   also makes heavy use of extensibility in providing a set of default
semi-standard parts, explain what each of those parts can do, and                classes for corporate forms that can be extended with custom le-
show how to fit them together. But this process can be system-                   gal logic. Commercial law’s treatment of transferrable obligations
atized and scaled up. What are the proxies, decorators, and sin-                 is modular and recursive: the passage of warranties along a chain
gletons in complex corporate transactions? What is the complete                  of transfers is a recursive solution to the trust problem of dealing
pattern language of will drafting?                                               with strangers. The Federal Rules of Evidence’s open-ended dele-
    A promising example of this approach is the United Kingdom’s                 gation of authority to the federal courts to make privilege rules is
Office of the Parliamentary Counsel’s Common Legislative Solu-                   an extensibility framework. Other examples await those who are
tions, which provides a catalog of recurring solutions in regula-                willing to go in search of them.
tory design.[30] It follows the Pattern Language format, giving a
high-level description of each pattern (e.g. “establish a statutory
corporation”), followed by a detailed list of sub-elements requiring
attention (e.g., “Should the statutory corporation have the power                3.7    An IDE for Lawyers
to borrow money?”) and examples of the pattern in action (e.g., the              Lawyers could benefit from drafting tools as sophisticated
Oil and Gas Authority and the Scottish Land Commission). More                    as those that programmers enjoy.
like this, please.                                                                  There was a time when programming a computer meant punch-
                                                                                 ing holes in paper cards, flipping switches for every bit, or even
                                                                                 hand-wiring the program into physical connections between com-
3.6    Design Principles                                                         ponents. But one of the great accomplishments of computer sci-
Broad design principles from programming-language the-                           ence has been the conversion of programming from an arduous
ory are recognizable throughout the law.                                         and punishing task into a process for leveraging human creativity.
   Design patterns are solutions to specific commonly occurring                  The modern toolchain supporting programmers – including tools
problems. At a higher level of abstraction are design principles: gen-           for code editing, compilation, version control, code analysis, de-
eral features of good software design that promote reliable, main-               bugging, testing, and analytics – is powerful and extensive.
tainable, and efficient code.                                                       At the center of the toolchain are integrated development envi-
   A key example is modularity: the decomposition of a system into               ronments (IDEs) like Visual Studio Code, xCode, Eclipse, and Sub-
subsystems that are weakly coupled to each other. The theory of                  lime Text. Consider just a few ways an IDE supports effective pro-
modularity is rooted in cybernetics, [100] but has become a central              gramming. As the programmer types, their code is automatically
principle of computer system design. [13] It is often achieved with              color-coded to keep the program’s structure clear. The IDE sug-
explicit programming-language features. Programming-language                     gests sensible auto-completions based not just on a static dictio-
support for separate compilation modules, for example, is literally              nary but on the rest of the program’s code. The programmer can
about modularity: it’s right there in the name. Other examples in-               click on any function or variable to get more information about it
clude functions, abstract data types, and objects.                               (e.g. its type) and jump to other places it is used. With another click,
   Modularity in particular has already been fruitfully applied to               they can reformat their code to make it easier to read. They can
legal theory. Henry Smith, who holds a Ph.D. in linguistics and                  browse past versions of a code block to see how it has changed over
draws heavily on the cybernetic theory of modularity, has shown                  time, and save changes to a shared repository. They can launch the
how the boundaries of property (both physical and intellectual)                  program, set a breakpoint, and step through the code line by line
are often drawn in modular ways to manage the information costs                  to see how it behaves and where it goes wrong.
of dealing with other people’s rights in things. [85, 102, 103] He                  Now compare the legal drafting toolchain. By far the most com-
and other scholars have applied modularity theory to legislative                 mon IDE for lawyers is Microsoft Word, and the most common
drafting, contracts, and internet regulation. [21, 54, 55, 101, 119,             version-control system is saving drafts as files with names like RMD
123]                                                                             Agreement 3.2 MH Final 2 USE THIS ONE. If you are lucky, you
   Other examples of broad programming-language design princi-                   might use a specialized XML-based tool.[95] If you are very un-
ples that may be relevant for law include recursion, compsition-                 lucky, you are still stuck with WordPerfect. The state of the art
ality, type-safety, and extensibility. Legal drafting already makes              for most lawyers is track changes and a handful of Word plugins
ad hoc use of all of these principles, and systematizing them could              to assist with tasks like formatting citations. Other parts of the

Programming Languages and Law                                                                          CSLAW ’22, November 1–2, 2022, Washington, DC, USA

toolchain are evolving quickly, especially case and document man-              syntax works; Shawn Bayern’s future-interests tool uses branch-
agement. But the IDE lags behind.                                              ing arrows. [16, 49] The two kinds of visualization are complemen-
   What might a true modern IDE for drafting structured legal doc-             tary, both to each other and to the textual formulations used by
uments look like?                                                              lawyers and law students. The use of programming-language tech-
                                                                               niques provides a more principled foundation than the informal
      • It would feature syntax highlighting to distinguish different
                                                                               diagrams drawn by generations of Property teachers. [7]
        kinds of text, and automatic formatting for the structural
                                                                                   Another great advantage of programming-language techniques
        framework of documents.
                                                                               is interactivity. Unlike a static tutorial with a finite pre-canned set
      • It would use linting, type-checking, and other static analy-
                                                                               of examples, an interactive PL-based system can adapt on the fly
        ses to enforce important invariants (e.g. that every defined
                                                                               to the user’s queries, allowing in-depth exploration and the ability
        term actually have exactly one definition) and to find com-
                                                                               to test one’s understanding with variations. Littleton and Bayern’s
        mon errors.
                                                                               interpreter both allow users to try a conveyance, examine the out-
      • It would detect and flag law smells, i.e., “patterns in legal
                                                                               put, vary its details, try it again, and so on, creating a tight feed-
        texts that pose threats to the comprehensibility and main-
                                                                               back loop. [16, 49] Lawsky Practice Problems uses programming-
        tainability of the law.” [31]
                                                                               language techniques to generate an unlimited number of different
      • It would integrate directly to version control systems with
                                                                               tax practice problems, with the names, numbers, and doctrinal clas-
        easy-to-use features like branches, diffs, merges, and pull
                                                                               sification varying each time. [69]
                                                                                   Another way of integrating programming languages and law
      • It would integrate into project management systems so that
                                                                               to improve understanding is through literate legal drafting. Liter-
        team members could file to-dos against specific blocks of
                                                                               ate programming is a style of programming in which a natural-
        text, and into bug-tracking systems so that they could close
                                                                               language explanation of a program’s functionality is interleaved
        out bug reports with the patches that fix them.
                                                                               with and generates the code implementing that functionality. [64]
      • It would also be integrated into knowledge-management
                                                                               This vision inspires several recent projects in PL theory and law.
        systems used by law firms, agencies, and other institutions
                                                                               The Catala project is working on having lawyers and programmers
        tracking immense quantities of documents.
                                                                               collaborate in a kind of pair programming, with the legal specifi-
      • It would perform unit tests against any changes to ensure
                                                                               cation and program logic tightly integrated. [43, 84, 122] Similarly,
        that they don’t break existing features, and carry out fuzz
                                                                               the Accord Project’s Cicero templating system is designed to em-
        testing with possible sequences of events to ensure robust-
                                                                               bed machine-executable logic inline in the language of contracts.
        ness against unexpected contingencies.
      • It would provide interactive simulation and debugging tools
                                                                                   An ambitious goal combining visualization, interactivity, and
        like visualization and breakpoints so that drafters could test
                                                                               literate programming would be to create the legal equivalent of a
        out what the instrument they were creating will actually do
                                                                               Jupyter notebook. [57] Such a notebook would freely intermingle
        in various situations.
                                                                               natural-language text addressed to humans with executable seg-
                                                                               ments addressed to computers, allow users to visualize legal struc-
3.8     Jupyter Notebooks for Law                                              tures using PL concepts like abstract syntax trees and control-flow
Interactive visual tools for experimenting with code could                     graphs, and tighten the feedback loop between writing legal text
be as powerful in law as they are in programming.                              and seeing what it does to a matter of seconds or less.
   A great advantage of programming-language approaches is that
they often improve understanding. Subsymbolic AI is notorious for              3.9     The Law of Software
having an explainability problem, [58, 97, 109] but for the most
                                                                               Programming-language theory can answer doctrinal ques-
part not so PL theory. A good compiler’s report of a type conflict
                                                                               tions about software by describing what programs are and
directs the programmer’s attention to a comprehensible and fixable
                                                                               how they work.
mistake in their assumptions. Again, it is PL theory’s embrace of
                                                                                  Programming is not a regulated profession like medicine. But
the structure of programs that provides a foundation for making
                                                                               programs are subject to law in many ways. Here are just a few of
that structure comprehensible.
                                                                               the many doctrinal questions whose answers depend in part on
   Within law and PL theory, a number of projects aim to present
                                                                               questions about which programming-language theorists have rel-
legal structures in an especially human-comprehensible way. Some
                                                                               evant expertise.
of them are teaching tools for students and professors in a class-
room setting, others are modeling tools for practitioners in a real-                 • The patentability of an invention turns on whether it is an
world setting, a few are both. As Lawsky observes, the modern tax                      “abstract idea,” and if so, whether it adds something “signif-
form is in a sense a synthesis of formal and informal approaches,                      icantly more”to the idea. [116] The inherent abstraction of
but it should be possible to do much better. [68]                                      software means that this two-step inquiry is in play in any
   One way in which programming-language techniques can help                           case claiming software functionality.
is visualization: although lawyers are notoriously verbal thinkers,                  • Also in patent law, infringement occurs when a defendant
sometimes a good diagram is worth a thousand words. For exam-                          supplies “components” of an invention in the United States
ple, Littleton displays future interests using a “railroad diagrams”                   for “combination” abroad.”The Supreme Court held that a
library originally created to show how a programming language’s                        CD-ROM of Microsoft Windows was not a “component” of

CSLAW ’22, November 1–2, 2022, Washington, DC, USA                                                                                  James Grimmelmann

        a patented invention, because only the abstract software on            a topic of interest. A deeper understanding of interpretation is not
        the CD-ROM, not the CD-ROM itself, was installed on com-               just of practical use in applying programming-language methods
        puters to make an infringing combination. [115]                        to legal problems: it can help theorists in both fields understand
    •   The Copyright Act protects computer programs as literary               their fields better.
        works. But not all programming languages are straightfor-                  As we have seen, many doctrinal questions in PL theory and
        wardly textual; in visual programming languages such as                law are at the boundary between computer science and philosophy:
        Scratch, a programmer manipulates graphical elements in                what is a program, how does it work, and what does it mean? For
        two dimensions. Even in more traditional programming en-               example, the claim that software consist entirely of mathematics
        vironments like Apple’s Xcode, developers frequently com-              and is therefore not properly patentable or copyrightable [63, 86]
        bine program text with visual interface designs.                       is grounded in programming-language theories of the semantics
    •   Copyright protection does not extend to elements of a pro-             of programming languages. But this is not the only possible way
        gram that are “dictated by efficiency,” by “external factors”          to conceive of software, [79] and the field of PL theory and law has
        such as compatibility, or by “widely accepted programming              much to contribute in complicating, challenging, and fleshing out
        practices.” [113]                                                      this picture.
    •   The Supreme Court has held that it is fair use to copy an                  The fundamental theoretical question of PL theory and law is
        application programming interface (API). [117] Dividing a              what is the difference between how people and computers interpret
        program into “interface” and “implementation” requires de-             texts? [48, 77] Answers to this question tell us both what law and
        tailed engagement with the details of the language in which            programming languages can do (because there are relevant sim-
        it is written, and determining what elements are required for          ilarities) and what it cannot (because there are unbridgeable dif-
        compatibility also requires considering how that language              ferences). It tells us about what is truly fundamental about legal
        is compiled or interpreted.                                            interpretation, and what is a historical accident of the fact that it
    •   The First Amendment covers the publication of software as a            developed in a pre-computer age. It tells us what changes about a
        means of communicating ideas to other programmers. [114]               rule when it is formalized, and it tells us about what the Church-
        But using software for its functional effects, for example to          Turing thesis means for society.
        spy on one’s spouse, is not automatically protected. Draw-                 The fundamental practical question of PL theory and law is how
        ing the line requires a theory of what constitutes the expres-         (if at all) should the availability of computers change how legal texts
        sive speech in software. [112]                                         are written and interpreted? I have argued that some (not all) legal
    •   Similarly, there may be a right not to write software; Ap-             rules should be made more formal, and that the legal drafting pro-
        ple has argued that being required to write code to unlock             cess should be more like the software development process. One
        an iPhone would violate the First Amendment right against              could go much further: delegating more of the drafting process
        compelled speech. This argument would obviously fail if Ap-            to computers, and using algorithms to interpret and apply laws.
        ple were required to open a physical vault, so again one               [18, 25, 26, 105] Of course, just because something can be done,
        needs a theory of what is expressive and what is functional            doesn’t mean it should. [23, 62] But this is a question that the legal
        about software.                                                        profession urgently needs to ask itself, and programming-language
    •   Smart contracts are intended to supplement or replace le-              scholars and software developers are in a prime position to help
        gal contracts. Courts have a rich theory of how to inter-              think through the possibilities and their consequences.
        pret human-readable legal contracts, and they will need a
        similarly rich theory of how to interpret machine-readable
        smart contracts. [3, 47, 61]                                           4   CLOSING THOUGHTS
    •   The Computer Fraud and Abuse Act prohibits some uses                   Building a field of law and programming languages will not be
        of computers “without authorization.” Under some circum-               easy; interdisciplinary work never is. Beyond the obvious point
        stances, what counts as “authorization” is determined by the           that each field has its own rich set of concepts and immense litera-
        program itself. [45, 46] (For example, a website authorizes            ture, the disciplines differ in more subtle ways. They have different
        or prohibits access by comparing a user-entered password               research methods:
        to the password stored in its user database.) Again, there are            They have different research methods: PL researchers mostly
        interpretive questions that one needs a theory of computer-            build new things in teams, while legal researchers mostly study
        program meaning to answer.                                             existing things alone. They have different standards of rigor: to car-
                                                                               icature just a little, a PL paper is done when the proofs are filled in,
                                                                               a law paper when the footnotes are filled in. They have different
3.10     Philosophical Questions                                               authorities: “because Congress said so” is a good answer in law, but
Lawyers and programmers can learn from each other what                         not in PL And they have different writing styles: to a PL scholar,
it means to interpret a text.                                                  the typical law-review article is shockingly long and repeats far
   Legal and programming-language scholars both study interpre-                too much that everyone already knows, while to a legal scholar,
tation: how to understand what a text means. The kinds of texts                the typical PL paper is shockingly short and omits essential back-
they study are different, but as we have seen repeatedly, this shared          ground and context.
focus on text and its meaning is a large part of what makes their                 One particular challenge is that scholars can be overconfident
collaboration so fruitful. Indeed, this shared focus on text is itself         amateurs outside of their own field. The phrase “law-office history”

Programming Languages and Law                                                                                              CSLAW ’22, November 1–2, 2022, Washington, DC, USA

is usually a pejorative: it implies that legal scholars do poor his-                            [3] Jason G. Allen. 2018. Wrapped and Stacked: ‘Smart Contracts’ and the Interac-
tory because they lack the training, the patience, and the motiva-                                  tion of Natural and Formal Language. Eur. Rev. Cont. L. 14, 4 (2018), 307.
                                                                                                [4] Layman E. Allen. 1974. Formalizing Hohfeldian Analysis to Clarify the Multiple
tion to get history right on its own terms. Of course, the reverse                                  Senses to Legal Right: A Powerful Lens for the Electronic Age. S. Cal. L. Rev. 48
is also true: microeconomists sometimes get a bad rap in the legal                                  (1974), 428.
                                                                                                [5] Layman E. Allen and C. Rudy Engholm. 1977. Normalized Legal Drafting and
academy for bursting in to long-running debates like the Kool-Aid                                   the Query Method. J. Legal Educ. 29 (1977), 380.
Man, supremely confident that their stylized models hold all the                                [6] Jesper Andersen, Ebbe Elsborg, Fritz Henglein, Jakob Grue, and Christian Ste-
answers.                                                                                            fansen. 2006. Compositional Specification of Commercial Contracts. Int’l J. on
                                                                                                    Software Tools for Tech. Transfer 8 (2006), 485.
    Some of the answers to these challenges are the same in pro-                                [7] Roger W. Andersen. 1995. Present and Future Interests: A Graphic Explanation.
gramming languages and law as they are in any interdisciplinary                                     Seattle U. L. Rev. 19 (1995), 101.
project. Collaboration will be essential, and some of the most in-                              [8] Joaquín Arias, Mar Moreno-Rebato, Jose A Rodriguez-García, and Sascha Os-
                                                                                                    sowski. 2021. Modeling administrative discretion using goal-directed answer
teresting research efforts in the space involve teams with lead re-                                 set programming. In Conference of the Spanish Association for Artificial Intelli-
searchers from both programming languages and law. In addition,                                     gence. Springer, 258–267.
                                                                                                [9] Kevin D. Ashley. 2017. Artificial Intelligence and Legal Analytics: New Tools for
dual training in law and CS, although rare, is immensely helpful                                    Law Practice in the Digital Age. Cambridge University Press.
in bridging the two fields. There is a slow but growing trickle of                             [10] Shaun Azzopardi, Gordon J. Pace, and Fernando Schapachnik. 2018. On Ob-
researchers with knowledge of both, who have an important role                                      serving Contracts: Deontic Contracts Meet Smart Contracts. In Proc. 31st Int’l
                                                                                                    Conf. on Legal Knowledge & Info. Systems (JURIX 2018). IOS Press, 21.
in training the next generation of law and programming-language                                [11] Shaun Azzopardi, Gordon J. Pace, Fernando Schapachnik, and Gerardo Schnei-
researchers. [87, 99]                                                                               der. 2016. Contract Automata. Artificial Intelligence & L. 24 (2016), 203.
    I wish to close where I started, by asking again the question, why                         [12] Patrick Bahr, Jost Berthold, and Martin Elsman. 2015. Certified Symbolic Man-
                                                                                                    agement of Financial Multi-Party Contracts. In Proc. 20th ACM SIGPLAN Int’l
these two fields? Why law and programming languages? What do                                        Conf. on Functional Programming. Association for Computing Machinery, 315.
they have in common that other pairs of fields do not?                                         [13] Carliss Y. Baldwin and Kim B. Clark. 2000. Design Rules: The Pwer of Modularity.
                                                                                                    MIT Press.
    The answer, as I have emphasized throughout, is that law and                               [14] Shrutarshi Basu, Nate Foster, and James Grimmelmann. 2019. Property Con-
programming languages share a common focus on how profession-                                       veyances as a Programming Language. In Proceedings of the 2019 ACM SIGPLAN
als use precisely structured linguistic constructions to do things                                  International Symp. on New Ideas New Paradigms & Reflections on Programming
                                                                                                    & Software (Onward!). Association for Computing Machinery, 128.
in the world. Law has good reason to be interested in many CS                                  [15] Shrutarshi Basu, Anshuman Mohan, Nate Foster, and James Grimmelmann.
fields, from cryptography to machine learning, but within CS, it                                    2022. Legal Calculi. In Programming Languages and the Law (ProLaLa). As-
is programming languages that most shares law’s linguistic focus.                                   sociation for Computing Machinery.
                                                                                               [16] Shawn J. Bayern. 2010. A Formal System for Analyzing Conveyances of Prop-
And programming-language techniques can usefully be applied to                                      erty Under the Common Law. JURIX 23 (2010), 139.
many problem domains, but law happens to be particularly rich in                               [17] Barton Beebe. 2006. An empirical study of the multifactor tests for trademark
                                                                                                    infringement. Calif. L. Rev. 94 (2006), 1581.
the kind of problems for which programming-linguistic solutions                                [18] Omri Ben-Shahar and Ariel Porat. 2021. Personalized Law: Different Rules for
can be useful. Historians and sociologists have their own interest-                                 Different People. Oxford University Press.
ing and important problems, but by and large they are not the kind                             [19] J.M. Trevor Bench-Capon, Gwen O. Robinson, Tom W. Routen, and Marek J.
                                                                                                    Sergot. 1987. Logic Programming for Large Scale Applications in Law: A For-
of problems that a programming language can help solve.                                             malisation of Supplementary Benefit Legislation. In Proc. 1st Int’l Conf. on Arti-
    If there is a lesson to take from the history of law and program-                               ficial Intelligence & L. Association for Computing Machinery, 190.
ming languages’s engagement, it is that principled methods are                                 [20] Thomas F. Bergin and Paul G. Haskell. 1984. Preface to Estates in Land and
                                                                                                    Future Interests (2nd ed. ed.). Foundation Press.
often superior to ad hoc ones. PL theory has a long and impressive                             [21] Thomas F. Blackwell. 2000. Finally Adding Method to Madness: Applying Prin-
history of developing concepts, languages, and tools to tame the                                    ciples of Object-Oriented Analysis and Design to Legislative Drafting. NYU. J.
                                                                                                    Legis. & Pub. Pol’y 3 (2000), 227.
chaos of coding. Law and legal tech, which are engaged in their                                [22] Marc A Borrelli. 1989. Prolog and the law: Using expert systems to perform
own eternal struggle to clean up the Augean stables of law and                                      legal analysis in the uk. Software LJ 3 (1989), 687.
life, should welcome all the help they can get. Formalizing a body                             [23] Dan L Burk. 2019. Algorithmic fair use. U. Chi. L. Rev. 86 (2019), 283.
                                                                                               [24] John J. Camilleri, Gabriele Paganelli, and Gerardo Schneider. 2014. A CNL for
of law well enough to turn it into a programming language forces                                    Contract-Oriented Diagrams. Controlled Nat. Language (2014), 135.
you to understand it in a far deeper way – and it is that hard-earned                          [25] Anthony J Casey and Anthony Niblett. 2016. Self-driving laws. University of
insight that law and programming languages promises.                                                Toronto Law Journal 66, 4 (2016), 429–442.
                                                                                               [26] Anthony J Casey and Anthony Niblett. 2017. Self-driving contracts. J. Corp. L.
                                                                                                    43 (2017), 1.
ACKNOWLEDGMENTS                                                                                [27] Robert Chesney. 2021. Cybersecurity Law, Policy, and Institutions. https:
This work was supported by NSF Award FMitF-2019313. My thanks                                  [28] Ronald Harry Coase. 1937. The Nature of the Firm. Economica 4, 16 (1937),
to the anonymous reviewers, to the organizers of and participants                                   386–405.
                                                                                               [29] Shaanan Cohney and David A. Hoffman. 2020. Transactional Scripts in Con-
in the ProLaLa 2022 workshop, where I delivered an earlier ver-                                     tract Stacks. Minn. L. Rev. 105 (2020), 319.
sion of this article as a talk, and to Aislinn Black, Shrutarshi Basu,                         [30] The Parliamentary Counsel. 2022. Common Legislative Solutions: A Guide
and Sarah Lawsky. This article may be freely reused under the                                       to Tackling Recurring Policy Issues in Legislation. Technical Report. Cabinet
terms of the Creative Commons Attribution 4.0 International li-                                     solutions-a-guide-to-tackling-recurring-policy-issues-in-legislation
cense,                                            [31] Corinna Coupette, Dirk Hartung, Janis Beckedorf, Maximilian Böther, and
                                                                                                    Daniel Martin Katz. 2022. Law Smells. Artificial Intelligence and Law (2022),
REFERENCES                                                                                     [32] Christian Crumlish and Erin Malone. 2009. Designing social interfaces: Princi-
 [1] Accord Project [2022]. Accord Project. Accord Project.              https://docs.              ples, patterns, and practices for improving the user experience. ” O’Reilly Media”.                                                                         [33] Lawrence A. Cunningham. 2006. Language, Deals, and Standards: The Future
 [2] Christopher Alexander, Sara Ishikawa, Murray Silverstein, Max Jacobson, In-                    of XML Contracts. Wash. U. L. Rev. 84 (2006), 313.
     grid Fiksdahl-King, Angel Shlomo, et al. 1977. A Pattern Language: Towns, Build-
     ings, Construction. Vol. 2. Oxford University Press.

CSLAW ’22, November 1–2, 2022, Washington, DC, USA                                                                                                                James Grimmelmann

 [34] Cary G. Debessonet and George R. Cross. 1986. An Artificial Intelligence Ap-               [73] Matt Levine. 2016. Blockchain Company’s Smart Contracts Were Dumb.
      plication in the Law: CCLIPS, A Computer Program that Processes Legal Infor-                    Bloomberg Opinion (2016).
      mation. High Tech. L.J. 1 (1986), 329.                                                          06-17/blockchaincompany-s-smart-contracts-were-dumb
 [35] Phan Minh Dung and Giovanni Sartor. 2011. The Modular Logic of Private                     [74] Michael A Livermore, Allen B Riddell, and Daniel N Rockmore. 2017. The
      International Law. Artificial Intelligence & L. 19 (2011), 233.                                 Supreme Court and the judicial genre. Ariz. L. Rev. 59 (2017), 837.
 [36] Frank H Easterbrook. 1996. Cyberspace and the Law of the Horse. University                 [75] Michael A. Livermore and Daniel N. Rockmore. 2019. Law as Data: Computa-
      of Chicago Legal Forum 1996 (1996), 207.                                                        tion, Text, & the Future of Legal Analysis. SFI Press.
 [37] Linda Edwards. 2009. Estates in Land and Future Interests: A Step-by-Step Guide            [76] Megan Ma. 2020. Writing in Sign: Code as the Next Contract Language?
      (3rd ed. ed.). Wolters Kluwer.                                                             [77] Megan Ma, Dmitriy Podkopaev, Avalon Campbell-Cousins, and Adam Nicholas.
 [38] John P .Finan. 1981. LAWGICAL: Jurisprudential and Logical Considerations.                      2020. Deconstructing legal text_Object oriented design in legal adjudication.
      Akron L. Rev. 15 (1981), 675.                                                                   arXiv preprint arXiv:2009.06054 (2020).
 [39] Financial Domain-Specific Language Listing. [2022]. .               [78] Megan Ma and Bryan Wilson. 2021. The Legislative Recipe: Syntax for Machine-
      resources.html                                                                                  Readable Legislation. Nw. J. Tech. & Intell. Prop. 19 (2021), 107.
 [40] Martin Fowler. 2010. Domain-Specific Languages. Addison-Wesley.                            [79] Donald MacKenzie. 2001. Mechanizing Proof. MIT Press.
 [41] Richard P Gabriel. 1996. Patterns of Software. Oxford University Press.                    [80] L. Thorne McCarty. 1976. Reflections on TAXMAN: An Experiment In Artificial
 [42] Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. 1995. Design                      Intelligence And Legal Reasoning. Harv. L. Rev. 90 (1976), 837.
      Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley.                    [81] L Thorne McCarty. 1989. A language for legal discourse i. basic features. In
 [43] Jason Garber. 2020. Practical pair programming. A Book Apart.                                   Proceedings of the 2nd international conference on Artificial intelligence and law.
 [44] Erik F. Gerding. 2013. Contract as Pattern Language. Wash. L. Rev. 88 (2013),                   Association for Computing Machinery, 180–189.
      1323.                                                                                      [82] L Thorne McCarty. 2022. Position Paper: LLD is All You Need. In Programming
 [45] James Grimmelmann. 2013. Computer Crime Law Goes to the Casino. https://                        Languages and the Law (ProLaLa). Association for Computing Machinery.                           [83] Denis Merigoux and Liane Huttner. 2020. Catala: Moving Towards the Future
 [46] James Grimmelmann. 2016. Consenting to Computer Use. Geo. Wash. L. Rev.                         of Legal Expert Systems. (2020).
      84 (2016), 1500.                                                                           [84] Denis Merigoux, Raphaël Monat, and Jonathan Protzenko. 2021. A Modern
 [47] James Grimmelmann. 2019. All Smart Contracts Are Ambiguous. J. L. & Inno-                       Compiler for the French Tax Code. In Proceedings of the 30th ACM SIGPLAN
      vation 2 (2019), 1.                                                                             International Conference on Compiler Construction (Virtual, Republic of Korea)
 [48] James Grimmelmann. 2022. The Structure and Legal Interpretation of Com-                         (CC 2021). Association for Computing Machinery, New York, NY, USA, 71–82.
      puter Programs. Journal of Cross-Disciplinary Research in Computer Science            
      and Law (2022), to appear.                                                                 [85] Thomas W. Merrill and Henry E. Smith. 2000. Optimal Standarization in the
 [49] James Grimmelmann, Shrutarshi Basu, Nate Foster, Shan Parikh, and Ryan                          Law of Property: the Numerus Clausus Principle. Yale L.J. 110 (2000), 1.
      Richardson. 2022. A Programming Language for Estates and Future Interests.                 [86] Eben Moglen. 1999. Anarchism Triumphant: Free Software and the Death of
      Yale Journal of Law and Technology 24 (2022), to appear.                                        Copyright. First Monday 4 (1999).
 [50] Richard S. Gruner. 1989. Sentencing Advisor: An Expert Computer System for                      article/view/684/594
      Federal Sentencing Analyses. Santa Clara Computer & High Tech. L.J. 5 (1989),              [87] Paul Ohm. 2009. Computer Programming and The Law: A New Research
      51.                                                                                             Agenda. Vilanova L. Rev. 54 (2009), 117.
 [51] Wesley Newcomb Hohfeld. 1913. Some Fundamental Legal Conceptions as                        [88] Richard R. Powell. 1949. The Law of Real Property. Matthew Bender & Company.
      Applied in Judicial Legal Reasoning. Yale L.J. 16 (1913), 28–59.                           [89] Henry Prakken and Giovanni Sartor. 2015. Law and Logic: A Review From an
 [52] Wesley Newcomb Hohfeld. 1917. Fundamental legal conceptions as applied in                       Argumentation Perspective. Artificial Intelligence 227 (2015), 214.
      judicial reasoning. The Yale Law Journal 26, 8 (1917), 710–770.                            [90] 1936. Restatement (First) of Property.
 [53] Nils Holzenberger, Andrew Blair-Stanek, and Benjamin Van Durme. 2020. A                    [91] Mark Reutlinger. 1994. When Words Fail Me: Diagramming The Rule Against
      Dataset for Statutory Reasoning in Tax Law Entailment and Question Answer-                      Perpetuities. Mo. L. Rev. 59 (1994), 157.
      ing. In Proc. 2020 Nat. Legal Language Processing (NLLP) Workshop. Association             [92] Carla L Reyes. 2021. Creating Cryptolaw for the Uniform Commercial Code.
      for Computational Linguistics, 31.                                                              Wash. & Lee L. Rev. 78 (2021), 1521.
 [54] Cathy Hwang. 2015. Unbundled Bargains: Multi-Agreement Dealmaking in                       [93] Edwina L. Rissland. 1990. Artificial Intelligence and Law: Stepping Stones to a
      Complex Mergers and Acquisitions. U. Pa. L. Rev. 164 (2015), 1403.                              Model of Legal Reasoning. Yale L.J. 99, 8 (1990), 1957.
 [55] Cathy Hwang and Matthew Jennejohn. 2018. Deal Structure. Nw. U. L. Rev. 113                [94] Matthew Roach. 2016. Toward A New Language Of Legal Drafting. J. High
      (2018), 279.                                                                                    Tech. L. 17 (2016), 43.
 [56] Simon Peyton Jones, Jean-Marc Eber, and Julian Seward. 2000. Composing con-                [95] Giovanni Sartor, Monica Palmirani, Enrico Francesconi, and Maria Angela Bi-
      tracts: an adventure in financial engineering (functional pearl). ACM SIGPLAN                   asiotti (Eds.). 2011. Legislative XML for the semantic web: principles, models,
      Notices 35, 9 (2000), 280–292.                                                                  standards for document management. Springer Science & Business Media.
 [57] Project Jupyter [2022]. Project Jupyter. Project Jupyter.              [96] Ken Satoh, Kento Asai, Takamune Kogawa, Masahiro Kubota, Megumi Naka-
 [58] Margot E Kaminski. 2019. The right to explanation, explained. Berkeley Tech.                    mura, Yoshiaki Nishigai, Kei Shirakawa, and Chiaki Takano. 2010. PROLEG:
      LJ 34 (2019), 189.                                                                              an implementation of the presupposed ultimate fact theory of Japanese civil
 [59] Daniel Martin Katz and Michael James Bommarito. 2014. Measuring the Com-                        code by PROLOG technology. In JSAI international symposium on artificial in-
      plexity of the Law: The United States Code. Artificial Intelligence & L. 22, 4                  telligence. Springer, 153–164.
      (2014), 337.                                                                               [97] Andrew D Selbst and Solon Barocas. 2018. The intuitive appeal of explainable
 [60] Orin S Kerr. 2018. Computer Crime Law (4 ed.). Thomson/West.                                    machines. Fordham L. Rev. 87 (2018), 1085.
 [61] Gregory Klass. 2022. How to Interpret a Vending Machine: Smart Contracts                   [98] Marek J. Sergot, Fariba Sadri, Robert A. Kowalski, Frank Kriwaczek, Peter Ham-
      and Contract Law. (2022).                     mond, and H. Terese Cory. 1986. The British Nationality Act as a Logic Program.
      id=4045711                                                                                      Comm. ACM 29 (1986), 370.
 [62] Gregory Klass. 2022. Tailoring ex Machina: Perspectives on Personalized Law.               [99] Houman B. Shadab. 2020. Software is Scholarship. Technical Report. MIT Com-
      U. Chi. L. Rev. Online (2022).                                                                  putational Law Report.
 [63] Ben Klemens. 2005. Math You Can’t Use: Patents, Copyright, and Software. Brook-                 3632464
      ings Institution Press.                                                                   [100] Herbert A Simon. 1996. The Sciences of the Artificial (3rd ed. ed.). MIT Press.
 [64] Donald Ervin Knuth. 1984. Literate Programming. Computer J. 27, 2 (1984), 97.             [101] Henry E. Smith. 2006. ModularIty in Contracts: Boilerplate and Information
 [65] Jan Ladleif and Mathias Weske. 2019. A Unifying Model of Legal Smart Con-                       Flow. Mich. L. Rev. 104 (2006), 1175.
      tracts. In Proc. Int’l Conf. on Conceptual Modeling. 323.                                 [102] Henry E. Smith. 2011. Standardization in Property Law. Edward Elgar, 148.
 [66] Peter J. Landin. 1966. The Next 700 Programming Languages. Comm. ACM 9,                   [103] Henry E. Smith. 2012. Property as the Law of Things. Harv. L. Rev. 125 (2012),
      3 (1966), 157.                                                                                  1691.
 [67] Sarah Lawsky. 2017. Nonmonotonic Logic and Rule-Based Legal Reasoning. Ph. D.             [104] 2022. Solidity Documentation (release 0.8.12 ed.).
      Dissertation. University of California, Irvine.         [105] Lawrence B Solum. 2014. Artificial meaning. Wash. L. Rev. 89 (2014), 69.
      59j2j45w                                                                                  [106] John G. Sprankling. 2017. Understanding Property Law (4th ed. ed.). Carolina
 [68] Sarah Lawsky. 2020. Form as Formalization. Ohio St. Tech. L.J. 16 (2020), 114.                  Academic Press.
 [69] Sarah Lawsky. [2022].           Lawsky Practice Problems.           https://www.          [107] Tina L Stark. 2013. Drafting contracts: How and why lawyers do what they do.                                                                      Wolters Kluwer.
 [70] Sarah B. Lawsky. 2016. Formalizing the Code. Tax L. Revieew 70 (2016), 377.               [108] Guy L. Steele, Jr. 1998. Growing a Language. (1998). http://www.cs.virginia.
 [71] Sarah B. Lawsky. 2017. A Logic for Statutes. Fla. Tax Rev. 21 (2017), 60.                       edu/~evans/cs655/readings/steele.pdf
 [72] Lawrence Lessig. 1999. Code: And Other Laws of Cyberspace.

Programming Languages and Law                                                                                               CSLAW ’22, November 1–2, 2022, Washington, DC, USA

[109] Katherine J Strandburg. 2019. Rulemaking and inscrutable automated decision              [117] United States Supreme Court. 2021. Google LLC v. Oracle America, Inc., 141 S.
      tools. Columbia Law Review 119, 7 (2019), 1851–1886.                                           Ct. 1183.
[110] Harry Surden. 2012. Computable Contracts. U.C. Davis L. Rev. 46 (2012), 629.             [118] Arie van Deursen, Paul Klint, and Joost Visser. June 2000. Domain-Specific
[111] Jenifer Tidwell, Charles Brewer, and Aynne Valencia. 2020. Designing interfaces:               Languages: An Annotated Bibliography. SIGPLAN Notices. (June 2000), 26.
      Patterns for effective interaction design (3 ed.). ”O’Reilly Media”.                     [119] Barbara van Schewick. 2012. Internet Architecture and Innovation. MIT Press.
[112] Lee Tien. 2000. Publishing Software As A Speech Act. Berk. Tech. L.J. 15 (2000),         [120] John T. Welch. 1981. LAWGICAL: An Approach to Computer-Aided Legal Anal-
      629.                                                                                           ysis. Akron L. Rev. 15 (1981), 655.
[113] United States Court of Appeals for the Second Circuit. 1992. Computer Asso-              [121] Peter T. Wendell. 2007. Possessory Estates and Future Interests Primer (3d ed. ed.).
      ciates Intern., Inc. v. Altai, Inc., 982 F.2d 693.                                             West Academic Publishing.
[114] United States Court of Appeals for the Sixth Circuit. 2000. Junger v. Daley, 209         [122] Laurie Williams and Robert R Kessler. 2003. Pair programming illuminated.
      F.3d 481.                                                                                      Addison-Wesley Professional.
[115] United States Supreme Court. 2007. Microsoft Corp. v. AT&T Corp., 550 U.S.               [123] Christopher S. Yoo. 2016. Modularity Theory and Internet Regulation. U. Ill. L.
      437.                                                                                           Rev. 2016 (2016), 1.
[116] United States Supreme Court. 2014. Alice Corp. Pty. Ltd. v. CLS Bank Intern.,
      573 U.S. 208.