Contract As Automaton: The Computational Representation Of Financial Agreements

Mark D. Flood

Office of Financial Research

[email protected]

Oliver R. Goodenough

Office of Financial Research and Vermont Law School

[email protected]

[email protected]


We show that the fundamental legal structure of a well-written financial contract follows a state-transition logic that can be formalized mathematically as a finite-state machine (also known as a finite-state automaton). The automaton defines the states that a financial relationship can be in, such as “default,” “delinquency,” “performing,” etc., and it defines an “alphabet” of events that can trigger state transitions, such as “payment arrives,” “due date passes,” etc. The core of a contract describes the rules by which different sequences of event arrivals trigger particular sequences of state transitions in the relationship between the counterparties. By conceptualizing and representing the legal structure of a contract in this way, we expose it to a range of powerful tools and results from the theory of computation. These allow, for example, automated reasoning to determine whether a contract is internally coherent and whether it is complete relative to a particular event alphabet. We illustrate the process by representing a simple loan agreement as an automaton.

Contract as Automaton: The Computational Representation of Financial Agreements – Introduction

Computing has revolutionized one sector of human activity after another over the past half-century. Until recently, however, this process had limited impact on law. The power of automation has made human lawyers more efficient in their traditional roles of drafting, research, negotiation, and advocacy, but the human brain has remained the central processor in understanding and applying the logical structure that informs legal rules and obligations. We argue that legal logic at a deeper level aspires to the requisite characteristics of rigorous definition and internal consistency that should make it accessible to formal computational tools. Lessig’s famous formulation is “code is law.”1 We invert this formulation and assert that, in fact, law is computation. In particular, we argue that a well-written financial contract follows a state-transition logic (usually implicit). Moreover, this logic is typically sufficiently streamlined and regular that we can represent it with a simple but important computational formalism, namely a “finite state machine.” We demonstrate this process with a concrete example in Sections IV and V.

We argue that a well-written financial contract is a “finite state machine” in a formal sense, and demonstrate the process in Sections IV and V below.2 The structure of a contract employs legalese — a form of controlled natural language expression lawyers use in formal documents — to encode a finite set of states that can describe the relationship between the counterparties at a given point in the life of the contract. Moreover, the contract also encodes explicit transition rules for shifting the relationship from one state to another, based on the realization of certain predefined events, such as performance by the counterparties themselves or the occurrence of particular contingencies that may be within or outside their control. Locating legal rules in computational form will have early benefits in the fields of private contracting in general and of financial contracting in particular.

The theory of automata is fundamental to computer science. By formalizing contracts according to rules of the literature on computability, we expose them to a wealth of powerful machinery from that domain, such as programmatic testing for legal completeness and computational complexity, and tools for simplification, visualization, and even the automated generation of legalese. Conversely, forcing a contract to adhere to the prerequisites of the state machine model — especially the finiteness of states and events and the independence of states from one another — imposes valuable discipline on the legal artisan and suggests a normative argument for how contracts should be crafted.

Many readers from a legal or economic background will be new to computation theory in general and finite automata in particular. It is indeed not (yet) commonplace to think of financial agreements as automata. However, the formalism introduced in Sections IV and V below is not a dull technical digression. Putting the familiar (the natural language version of a financial contract) into the unfamiliar (the computational representation) is the core exercise of this paper. To understand it fully, there is no substitute for taking the time to assimilate the basics and work though the details of the argument and examples. As with other interdisciplinary approaches to the law — for example, adapting the tools of economics, sociology, or neuroscience — the shift in perspective will likely improve with repetition and reflection. Those who make the effort will not look at the law quite the same again.



See full PDF below.