forked from legalese/legalese.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
turing.html
404 lines (306 loc) · 38.1 KB
/
turing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="refresh" content="0; url=https://legalese.readme.io/v1.0/page/prior-art-and-alternatives" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>Legalese: Turing-Complete Contracts</title>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-63573011-4', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<header>
<div class="inner">
<h1>Legalese 2.0</h1>
<h2>Software is eating law.</h2>
<a href="https://github.com/legalese/" class="button"><small>View project on</small> GitHub</a>
</div>
</header>
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li><a href="index.html">Home</a></li>
<li>
<a target="_blank" href="tutorials.html">Tutorials <span class="arrow">▼</span></a>
<ul class="sub-menu">
<li> <a href="tutorials.html#t1">the EULA</a></li>
<li> <a href="tutorials.html#t2">Hello, World!</a></li>
<li> <a href="tutorials.html#t3">Send for Signature!</a></li>
<li> <a href="tutorials.html#t4">A Real Nondisclosure Agreement</a></li>
<li> <a href="tutorials.html#t5">What Docsets Are Available?</a></li>
<li> <a href="tutorials.html#t6">Generating Multiple Documents – Incorporation</a></li>
<li> <a href="tutorials.html#t7">Developing Your Own Templates</a></li>
</ul>
</li>
<li><a href="blog.html">Blog</a></li>
<li><a href="help.html">Help</a></li>
<li><a href="turing.html">Turing-Complete Contracts</a></li>
</ul>
</nav>
</div>
<div id="content-wrapper">
<div class="inner clearfix">
<section id="main-content">
<blockquote class="quotation">Everything “THEDAO” tried to be, it could have been correctly and in full compliance with the law. For this reason, what blockchain companies should be trying to do is take complex financial, business, and governance processes and turn them into machine-readable protocols that also tick all of the human requirements, legal or otherwise. A bit of code that does all those things is what a smart contract actually is.</blockquote>
<blockquote class="credit"><a href="https://prestonbyrne.com/2016/06/20/failing-fast-vs-failing-unnecessarily/"><em>Failing Fast vs Failing Unnecessarily</em>, Preston Byrne</a></blockquote>
<h2><a name="inspiration"></a>Inspiration and Motivation</h2>
<p>Once upon a time, a programmer received an investment contract containing the following text:</p>
<blockquote class="quotation smaller">If the investment for the purpose of the Series B Funding is valued at not more than S$32.5 Million, then the investors in the Note shall be entitled to convert the Note into Shares at a fixed valuation of S$27.5 million.</blockquote>
<blockquote class="quotation smaller">If the investment for the purpose of the Series B Funding is valued at less than S$ 40 million but not below S$32.5 million, investors in the Convertible Note will be entitled to convert the Note into Shares at a 15% discount over the valuation of the Series B Funding (for instance, if the series B Funding is at a valuation of S$35 million, then the investors in the Note shall be entitled to convert at a valuation of 35M less 15% discount);</blockquote>
<blockquote class="quotation smaller">If the investment for the purpose of the Series B Funding is valued at not less than S$ 40 million but less than S$47.06 million, investors in the Convertible Note will be entitled to convert the Note into Shares at a 15% discount over the valuation of the Series B Funding (for instance, if the series B Funding is at a valuation of S$47.06 million, then the investors in the Note shall be entitled to convert at a pre-money valuation of 40M i.e. S$47.06 million less 15% discount);</blockquote>
<blockquote class="quotation smaller">If the investment for the purpose of the Series B Funding is valued at not less than S$ 47.06 million but less than S$80 million, investors in the Convertible Note will be entitled to convert the Note into Shares at a fixed pre-money valuation of S$40 million;</blockquote>
<blockquote class="quotation smaller">If the investment for the purpose of the Series B Funding is valued at not less than S$80 million but less than S$100 million, investors in the Convertible Note will be entitled to convert the Note into Shares at a fixed pre-money valuation of S$45 million; and</blockquote>
<blockquote class="quotation smaller">If the investment for the purpose of the Series B Funding is valued at not less than S$100 million, investors in the Convertible Note will be entitled to convert the Note into Shares at a fixed pre-money valuation of S$50 million.</blockquote>
<p style="margin-top:1.6em">Ten minutes and a strong cup of tea later, the notes in the margin read:</p>
<code style="white-space: pre-wrap">// why isn't this just
if (seriesB < 32.5) { conversion = 27.5 }
else if (seriesB < 40) { conversion = seriesB * 0.85 }
else if (seriesB < 47.06) { conversion = seriesB * 0.85 } // then why the above line?
else if (seriesB < 80) { conversion = 40 }
else if (seriesB < 100) { conversion = 45 }
else { conversion = 50 }</code>
<p style="margin-top:1.6em">The next step is obvious: What if contracts could be written in a formal language first, and then compiled to natural language? A simple but powerful idea.</p>
<p>Imagine contracts in English, Spanish, French, German, Chinese – each translation provably identical to the others. Contracts amenable to <a href="http://www-verimag.imag.fr/~sifakis/TuringAwardPaper-Apr14.pdf">formal methods</a>: code verification can prove that a contract is internally consistent, free of contradiction, and complete. Contracts that execute themselves in software, integrated with business processes, interacting with other contracts. This vision has been expressed by <a href="http://szabo.best.vwh.net/contractlanguage.html">Nick Szabo (2002)</a>, by <a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2216866">Harry Surden (2012)</a>, by <a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2538224">Flood & Goodenough (2014)</a>, by <a href="http://arxiv.org/abs/1406.5691">Camilleri, Paganelli, & Schneider (2014)</a>, by <a href="http://link.springer.com/chapter/10.1007%2F978-3-540-72952-5_11">Prisacariu & Schneider (2007)</a>.</p>
<p>Implementing the vision is a <a href="http://www.catb.org/jargon/html/S/SMOP.html">simple matter of programming</a>!</p>
<h1>Premises and Postulates</h1>
<p>Consider what programmers do when they write programs.</p>
<p>Consider what lawyers do when they write contracts.</p>
<p>These two worlds are each rich with their own body of practice and disciplines of thought.</p>
<p>Yet the similarities are striking!</p>
<p>What would it take to wrestle these worlds into conjunction?</p>
<p>Law is Mars and software is Earth. Let's terraform law!</p>
<h1>Help Wanted: Multidisciplinarians</h1>
<p>The project needs contributors in these areas of computer science and law:</p>
<ol>
<li>Design and Implementation of Domain Specific Languages. Design a DSL suitable for drafting legal agreements and regulations. The users of the DSL -- its "programmers" -- may be lawyers or end-users.</li>
<li>Source-to-source translation. Write a compiler that reads the DSL and outputs to Haskell, Racket, or Elixir.</li>
<li>Library Creation. Develop a Creative Commons BY-SA-NC body of standard agreements and clauses in the DSL, adaptable for multiple jurisdictions.</li>
<li>Formal Methods: model checking, verification. Is the contract complete? Are there internal inconsistencies?</li>
<li>Data Visualization: show how the programs behave under different scenarios. What are the outcomes for different parties? What actions are required from parties in the future?</li>
<li>Natural Language Generation: Enhance the compiler to target English and at least one other natural language. Introduce an aggressive optimizer that matches patterns and substitutes terser alternatives without loss of semantics. The goal is to produce an isomorphism with the original legal text.</li>
<li>Natural Language Processing: Run the compiler in reverse. Read existing regulations and legal agreements. Write the isomorphic representation in the DSL.</li>
<li>Fintech/Blockchain: adapt the compiler to output to Ethereum language source or bytecode.</li>
</ol>
<h1>Formalizing Law</h1>
<p>The idea of developing calculi for the legal world goes back to the 1980s at least, when <a href="http://opim.wharton.upenn.edu/~sok/papers/s/p370-sergot.pdf">the British Nationality Act was encoded in Prolog</a>. We try to stand on the shoulders of giants.</p>
<p>Today, it is becoming increasingly evident that <a href="http://computationallegalstudies.com/2016/02/27/fin-legal-tech-laws-future-from-finances-past-an-expanded-version-of-the-deck/">LegalTech is the flip side of FinTech</a>.</p>
<h2>Modeling Entities</h2>
<ol>
<li>A corporation or a company may be completely represented as a data structure. More precisely: those aspects of a corporation which have to do with its nature as a legal entity may be captured by a data structure comprising state information. Over time, the state changes: as a corporation acquires directors, investors, employees, ESOPs, and other contractual counterparties, the data structure evolves. Such state changes to the data structure are analogous to git <em>commits</em> or to database <em>transactions</em>.</li>
<li>Each major change in the evolution of a corporation may be modeled with the language of git <em>releases</em> and <em>tags</em>. Each intended change may be modeled with the language of <em>issues</em> and <em>milestones</em>. What, in git, we call a <em>remote origin master</em> corresponds to, in corporate law, a <a href="http://www.acra.gov.sg/">state registry of corporate details</a>.</li>
<li>Alternatively, these changes can be modeled with a bitemporal database -- ACID CRUD. Either way, formal structure can apply.</li>
<li>Changes to the corporate data structure are formalized in shareholders' and directors' resolutions, and by executed contracts. Putting signatures on paper is <em>execution</em>.</li>
<li>Legalese talks about corporations. Similar modeling is also needed for trusts, non-profits, etc.</li>
</ol>
<h2>Modeling Execution (as in signing)</h2>
<ol>
<li>Automated legal reasoning is a hard problem. Corp sec is possibly the easiest practical domain of application.
<li>Corporate paperwork often requires signatures on multiple documents. Related documents may be modeled by a directed acyclic graph: if a prerequisite document is not signed, its dependents are invalid.</li>
<li>The DAG may be computed algorithmically. The paperwork may be generated automatically.</li>
<li>With the advent of electronic and digital signatures, the execution of such paperwork may be managed online. Reminders may be sent automatically. If execution is in progress, the state of the dependency graph may be examined in fine detail by parties at any time.</li>
<li>Execution may require the observation of certain <em>formalities</em> which shade into the content and structure of the contract. For example, a novation needs to have <i>n_orig</i> + <i>n_new</i> parties involved. A deed needs to be phrased in a particular archaic way (the <a href="https://www.youtube.com/watch?v=inXC_lab-34">"Stevie Wonder phrasing"</a>) to be valid.</li>
<li>A particular document may be a collection of <em>resolutions</em>, or a <em>contract</em>.
</ol>
<div class="li-inline">
<p>Prior art:</p>
<ul>
<li> <a href="https://play.google.com/store/books/details?id=ST2jBQAAQBAJ&rdid=book-ST2jBQAAQBAJ&rdot=1&source=gbs_vpt_read&pcampaignid=books_booksearch_viewport">Knowledge-Based Systems and Legal Applications</a></li>
<li> <a href="http://stashcrypto.com/smart-contracts-info">Stash</a> has self-executing smart contracts</li>
<li> <a href="https://ethereum.org/">Ethereum</a> is all over this.</li>
</ul>
</div>
<h2>Modeling Contracts: Drafting</h2>
<p>While execution is concerned with the relations between contracts, and does not look into the body of a contract beyond the parties and the signatures, drafting is concerned with the <em>content</em> of contracts.</p>
<ol>
<li>Natural-language contracts often look like somebody trying to program without knowing any programming languages.</li>
<li>To a programmer, the <a href="http://www.weagree.com/book/124-Structure+and+presentation+of+contracts.html">structure of a contract</a> reveals familiar ideas. The <em>preamble</em> is a high-level <a href="https://en.wikipedia.org/wiki/Comment_(computer_programming)">comment block</a> that may declare <a href="https://en.wikipedia.org/wiki/Assertion_(software_development)">assertions</a>. The <em>definitions</em> section declares <a href="https://en.wikipedia.org/wiki/Variable_(computer_science)">variables</a> and <a href="https://en.wikipedia.org/wiki/Constant_(computer_programming)">constants</a>. The <em>conditions precedent</em> define, well, <a href="https://en.wikipedia.org/wiki/Precondition">preconditions</a>. The <em>main clauses</em> describe the <a href="https://en.wikipedia.org/wiki/Happy_path">happy path</a>. The <em>breach</em> or <em>damages</em> clauses <a href="https://en.wikipedia.org/wiki/Exception_handling">handle exceptions</a>. The <em>term</em> clause defines a <a href="https://en.wikipedia.org/wiki/Timeout_(computing)">timeout</a>. And so on.</li>
<li>Few contracts use basic <a href="https://en.wikipedia.org/wiki/Structured_programming">structured programming</a> idioms. Most complex contracts read like <a href="https://en.wikipedia.org/wiki/Spaghetti_code">spaghetti code</a> – <a href="https://en.wikipedia.org/wiki/Object_code">object/machine code</a> whose control flow jumps all over the place, from one clause reference to another.</li>
<li>Some contracts are (inadvertently or deliberately) <a href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscated</a>.</li>
<li><a href="http://www.musicindie.com/news/1284">Imprecisions</a> abound. <a href="http://www.adamsdrafting.com/the-contract-drafting-error-that-gave-tommy-lee-jones-an-extra-10-million/">Bugs</a> result.</li>
<li>The idea of drafting agreements in a <a href="https://en.wikipedia.org/wiki/High-level_programming_language">high level language</a> is not new: in many situations, parties negotiate a <a href="https://en.wikipedia.org/wiki/Term_sheet">term sheet</a>; once agreement is reached, they hand it to a lawyer to expand into definitive documentation, which the parties sign without reading; the long-form version is only read when it is being executed in the context of conflict resolution.</li>
<li>If a contract could be written with the rigour of a software program, it would be amenable to <a href="https://en.wikipedia.org/wiki/Formal_methods">formal methods</a> and other value-adds, like graphing and scenario visualization.</li>
<li>A <em>Legalese contract</em> – one written in a high-level language – could be compiled to a natural language. Obviously, the situation calls for a <a href="https://en.wikipedia.org/wiki/Compiler">compiler</a>, perhaps paired with a <a href="https://en.wikipedia.org/wiki/Domain-specific_language">domain-specific language</a>.</li>
<li>Such a compiler would <a href="https://en.wikipedia.org/wiki/Natural_language_generation">produce natural language contracts</a> that were backward-compatible with the legacy industry. Such backward-compatibility is valuable for lawyers, judges, and laypeople who aren't able to read the high-level DSL.</li>
<li>A Legalese contract could be compiled to <em>multiple</em> natural languages. Each version would be provably identical. This would be valuable in <a href="http://europa.eu/pol/mult/index_en.htm">multilingual environments</a>.</li>
<li>A Legalese contract could be forward-compatible with the newfangled gewgaws coming down the pike, like <a href="http://ethereum.org/">Ethereum</a>.</li>
</ol>
<div class="li-inline" id="priorart">
<p>Prior art:</p>
<ul>
<li> <a href="http://compk.stanford.edu/">Stanford's Computable Contracts Initiative</a></li>
<li> <a href="http://arxiv.org/pdf/cs/0106005.pdf">The Representation of Legal Contracts by Daskalopulu & Sergot</a></li>
<li> <a href="https://spiral.imperial.ac.uk/bitstream/10044/1/529/1/Using%20the%20event%20calculus.pdf">Using the Event Calculus for Tracking the Normative State of Contracts</a></li>
<li> <a href="http://publicaciones.dc.uba.ar/Publications/2011/GMS11/gms_flacos-2011-tr.pdf">FormaLex – A Software Tool for Legal Drafting</a></li>
<li> <a href="http://www.cse.chalmers.se/~gersch/icail09.pdf">Abstract Specification of Legal Contracts, Prisacariu & Schneider</a>
<li> <a href="http://www.cse.chalmers.se/~gersch/slides-talks/slides-CL-ModelChecking.pdf">Towards a Formal Language for Electronic Contracts</a></li>
<li> <a href="http://www.diku.dk/hjemmesider/ansatte/hvitved/publications/hvitved12phd.pdf">Contract Formalisation and Modular Implementation of Domain-Specific Languages</a> is Tom Hvitved's 2012 PhD Thesis.</li>
<li> <a href="http://folk.uio.no/gerardo/ifm2009.pdf">Challenges in the Specification of Full Contracts</a></li>
<li> <a href="https://gupea.ub.gu.se/bitstream/2077/40725/1/gupea_2077_40725_1.pdf">Analysing Normative Contracts</a> by <a href="http://www.cse.chalmers.se/~cajohn/academic.html">John J. Camilleri</a></li>
<li> <a href="http://www.cse.chalmers.se/~gersch/my-publications.html">Many other publications by Gerardo Schneider</a></li>
<li> <a href="https://en.wikipedia.org/wiki/Attempto_Controlled_English">Attempto Controlled English</a> is an example of a formal/natural hybrid language which could be a compiler target.</li>
<li> <a href="https://en.wikipedia.org/wiki/Semantics_of_Business_Vocabulary_and_Business_Rules">Semantics of Business Vocabulary and Business Rules</a> is a hybrid formal/natural language for business operation and compliance which could also be a compiler target.</li>
<li> <a href="http://richard.myweb.cs.uwindsor.ca/PUBLICATIONS/NLI_LFP_SURVEY_DRAFT.pdf">Realization of Natural Language Interfaces Using Lazy Functional Programming</a></li>
<li> <a href="https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=legalruleml">LegalRuleML</a> is an OASIS Technical Committee.</li>
<li> <a href="http://www.estrellaproject.org/">The Estrella Project</a> attempted to "develop and validate an open, standards-based platform allowing public administrations to develop and deploy comprehensive legal knowledge management solutions."</li>
</ul>
<p>Other efforts:</p>
<ul>
<li> <a href="http://www.ibtimes.co.uk/barclays-smart-contract-templates-heralds-first-ever-public-demo-r3s-corda-platform-1555329">CLACK at UCL</a></li>
<li> <a href="https://medium.com/@ConsenSys/what-if-we-developed-legal-contracts-like-we-developed-software-applications-1b5bc8fbb915#.uoiiqx9ku">Joe Dewey's essay</a> on <a href="http://contractcode.meteor.com/">ContractCode</a>, April 6, 2016</li>
<li> <a href="http://commonform.github.io/">CommonForm</a></li>
<li> <a href="https://medium.com/@PaxDirectory/codex-a-legal-scripting-language-e3723cc76662#.neyprdp7o">Codex</a> by Pax is a scripting language for Ethereum; <a href="http://bitlegal.io/2016/03/03/codex-a-new-smart-contracts-language/">in concert with Pax Directory</a></li>
<li> <a href="http://www.restatement.org/">Restatement</a> by Jason Boehmig, Tim Hwang, and Paul Sawaya. (<a href="https://blog.law.cornell.edu/voxpop/2014/06/03/rough-consensus-running-standards-the-restatement-project/">intro essay</a>; see also <a href="https://github.com/legalese/legalese.com/blob/master/doc/modeling.org#background-reading">Modeling - Background Reading</a>)</li>
<li> <a href="http://www.commonaccord.org/">CommonAccord</a> has some <a href="https://docs.google.com/document/d/1jm9t61JnqLqsV50cD9Mzwyu8cXWRmVFaI2XK-UaFggk/pub">early thinking</a> online.</li>
<li><a href="http://law.mit.edu/">Law.MIT.edu</a> takes a social-science approach to examining law: see <a href="https://www.youtube.com/watch?v=G2_1I9aUwgs">Dazza's video</a>.</li>
<li> The urge to formalize goes back at least as far as <a href="https://en.wikipedia.org/wiki/Alphabet_of_human_thought">Leibniz</a>.</li>
</ul>
<p>Of course law firms think clarity and end-user empowerment are terrible ideas. You would too, if you had a busy contract drafting practice on the one hand, and an even busier dispute resolution practice on the other, both billed by the hour.</p>
</div>
<h2>Modeling Social Practice</h2>
<p>What if lawyers started working more like programmers?</p>
<blockquote class="quotation smaller">Software engineering teams often need to
integrate new team members, fix bugs, and refactor existing code, which are all
tasks that require a deep understanding of code written by others who are often no
longer available to provide support or clarification. These requirements suggest
that the tools used by software engineers to track progress, monitor potential
vulnerabilities, or simply gain an understanding of an existing software codebase
may be useful for serving the same functions when applied to legal code.</blockquote>
<blockquote class="quotation credit smaller">
<a href="https://mitsloan.mit.edu/shared/ods/documents/Lo_2014_LawIsCode.pdf&PubID=11133">Law is Code, 2015</a>
</blockquote>
<ol>
<li>Opensource dynamics might lead to the development of reusable, public, clause libraries, published under an MIT, BSD, GPL, or CC license.</li>
<li>Legal templates and precedents <a href="http://www.legal500.com/assets/pages/gc/summer-2015/business-thinking-github.html#sthash.3soEUMps.PmE2Gozv.dpbs">might end up on Github</a>.</li>
<li>End-users might bypass the priesthood of lawyers, and draft their own contracts.</li>
<li>Corporate secretaries could go the way of the <a href="http://www.boredpanda.com/extinct-jobs/">switchboard operator</a> or <a href="http://m.cfoinnovation.com/story/8229/future-work-death-accountant-and-auditor">tax preparer</a>.</li>
<li>Confidence in the codebase could arise from the bazaar model of contract development (<a href="https://en.wikipedia.org/wiki/Linus%27s_Law#By_Eric_Raymond">"given enough eyeballs, all bugs are shallow"</a>), from reputation systems, and other transparent, crowd-sourced mechanisms.</li>
</ol>
<h2>Modeling Regulations</h2>
<ol>
<li>As the richly interpretable saying goes, "Law is Code". (<a href="https://mitsloan.mit.edu/shared/ods/documents/Lo_2014_LawIsCode.pdf&PubID=11133">MIT 1</a>, <a href="http://courses.csail.mit.edu/iap/lawiscode/">MIT 2</a>) and, conversely, <a href="http://harvardmagazine.com/2000/01/code-is-law-html">Code is Law</a>.</li>
<li>Legislative and regulatory constraints may be modeled using a <a href="https://en.wikipedia.org/wiki/Declarative_programming">declarative language</a>.</li>
<li>Contracts and execution relations may be <a href="https://en.wikipedia.org/wiki/Automatic_programming">automatically produced</a> as satisfactions of constraints.</li>
<li><a href="http://www.oracle.com/us/products/applications/oracle-policy-automation/policy-automation/overview/index.html">Oracle Policy Automation</a> does this commercially. <a href="https://en.wikipedia.org/wiki/Carl_Malamud">Carl Malamud</a> and <a href="https://www.linkedin.com/in/tombruce/">Thomas Bruce</a> might argue that this should be done in an open way.</li>
<li><a href="http://xcential.com/">Xcential</a>'s <a href="http://xcential.com/legispro/">LegisPro</a> helps legislators get their words out in XML.</li>
</ol>
<div class="li-inline">
<p>Selected readings:</p>
<ul>
<li> <a href="http://www.let.rug.nl/basile/papers/WynerEtAlCCBoxerJURIX2012.pdf">An Empirical Approach to the Semantic Representation of Laws</a></li>
<li> <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.461.4022&rep=rep1&type=pdf">On Rule Extraction from Regulations</a></li>
<li> <a href="http://opim.wharton.upenn.edu/~sok/papers/s/p370-sergot.pdf">The British Nationality Act as a Logic Program</a></li>
<li> <a href="http://wyner.info/research/Papers/2012/WynerOnBench-CaponEtAl1987.pdf">Logic Programming for Large Scale Applications in Law</a></li>
<li> <a href="http://www.lrec-conf.org/proceedings/lrec2010/workshops/W23.pdf">LREC2010 Workshop Proceedings</a></li>
<li> Conferences include <a href="http://jurix.nl/">JURIX</a></li>
<li> <a href="http://www.iaail.org/">ICAIL (IAAIL)</a></li>
<li> <a href="https://www.youtube.com/watch?v=XQgqFr6JuTE">FutureLaw 2014: Forging an Open Legal Document Ecosystem</a></li>
<li> <a href="https://www.youtube.com/watch?v=KBI8_tv2VDM&list=PL48E61C121CAD0E1B&index=46">FutureLaw 2013: Computational Law and Contracts</a></li>
<li> <a href="https://www.youtube.com/watch?v=KLAE_SKMeAY">Harry Surden, Computable Contracts, 2011</a></li>
<li> <a href="https://www.youtube.com/watch?v=efr9VctcMe8">New Breakthroughs in Computational Law, 2013</a></li>
<li> <a href="https://www.youtube.com/watch?v=peU756mYfjQ">FutureLaw | The State of the Art of Legal Technology Circa 2015</a></li>
</ul>
<p>Prior Art:</p>
<ul>
<li> <a href="https://github.com/mpoulshock/HammurabiProject">Hammurabi Project</a> hosts its DSL in Wolfram Language (Mathematica). An <a href="https://github.com/mpoulshock/hammurabi">earlier version</a> developed a DSL called Akkadian.</li>
<li> You've heard of <a href="https://en.wikipedia.org/wiki/XBRL">XBRL</a>, now the SEC wants <a href="http://lambda-the-ultimate.org/node/3922">Python</a>.</li>
<li> Also <a href="https://en.wikipedia.org/wiki/FpML">FpML</a></li>
</ul>
</div>
<h2>Modeling Performance</h2>
<ul>
<li> <a href="https://pure.uvt.nl/portal/files/594971/xu.pdf">Monitoring multi-party contracts for e-business, Lai Xu</a></li>
<li> <a href="https://www.computer.org/csdl/proceedings/hicss/2007/2755/00/27550063b.pdf">Formal Specification of Web Service Contracts for Automated Contracting and Monitoring</a></li>
<li> <a href="http://homepages.cs.ncl.ac.uk/carlos.molina/home.formal/IoannisSfyrakisDissertation2012.pdf">A Contract Compliance Checker, Ioannis Sfyrakis</a> shows an Event-Condition-Action language called EROP</li>
<li> <a href="https://erisindustries.com/components/erislegal/">ERIS</a> brings compatibility with smart contracts</li>
</ul>
<h2>What We Don't Do</h2>
<ol>
<li> Legalese excludes the "computational legal argumentation" field well surveyed by <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29.1461">Prakken & Sartor 2001</a>. Defeasibility is essential to law, lest the law turn monstrous. However, it renders deductive logic <a href="https://newrepublic.com/article/106441/scalia-garner-reading-the-law-textual-originalism">futile</a>. We admire their <a href="http://www.sciencedirect.com/science/article/pii/S0004370207000677">prodigious display of brainpower</a>, wish them <a href="http://ejlt.org/article/view/13">good luck</a>, and retreat to the easier, more deterministic, less controversial end of the spectrum.</li>
<li> Legalese is not a tool that "allows non-programmers to program." This is <a href="https://books.google.de/books?id=ri1muolw_YwC&pg=PT95&lpg=PT95&dq=cobol+fallacy&source=bl&ots=7W7eh28mfd&sig=S-dTLMwtG6ZMTagTn5JrzY05zZc&hl=en&sa=X&ved=0ahUKEwjcjbz2nMzKAhULWBQKHZSgAKcQ6AEIKTAC#v=onepage&q=cobol%20fallacy&f=false">a fallacy</a>. See <a href="https://zompist.wordpress.com/2014/08/31/ask-zompist-programming-languages/">Essay by Zompist about Programming Languages</a> and Paul Ford's magnum opus, <a href="http://www.bloomberg.com/graphics/2015-paul-ford-what-is-code/">What is Code?</a> An expert who can write legal code in the Legalese DSL, by that act becomes a programmer, just as any magic-user who can <a href="http://www.amazon.com/Nature-Technology-What-How-Evolves-ebook/dp/B002ISDCKW/">combine two existing pieces of magic</a> to create an original third becomes, even in the smallest degree, a sorceror.</li>
<li> Legalese is not <a href="http://snip.ly/KjEi?utm_content=buffer1569f&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer#https://bol.bna.com/automating-legal-advice-ai-and-expert-systems/">an expert system that gives legal advice</a>.</li>
<li> Legalese does not fight to get existing legal materials online. That's the job of the <a href="https://library.columbia.edu/content/dam/librarywebsecure/behind_the_scenes/web_resource_collection/Carver%20-%20Columbia_Web_Archiving_Free_Law_Project.pdf">Free Law Project</a>, <a href="https://public.resource.org/">Public.Resource.Org</a>, <a href="http://www.falm.info/">FALM</a>, and the <a href="https://www.law.cornell.edu/world">LIIs</a>.</li>
<li> <a href="http://content.iospress.com/articles/semantic-web/sw224">Legal Ontologies</a> are a huge area of research which we would like to reuse, not reinvent.</li>
<li> <a href="http://www.rossintelligence.com/">Ross Intelligence</a> harnesses Watson to do cool things. We don't do deep learning, machine learning, or natural language processing to try to understand natural language contracts.</li>
</ol>
<h2>Nerds to Watch</h2>
<ol>
<li> <a href="https://twitter.com/leashless">Vinay Gupta</a></li>
<li> <a href="https://medium.com/@Physes/">Philip Saunders</a></li>
<li> <a href="https://twitter.com/HarrySurden">Harry Surden</a></li>
</ol>
<h1>Turing-Complete Contracts</h1>
<p>The Legalese team has started work on a (yet another) DSL for expressing regulations and contracts. This is a research project. Software eats law in a specific way: it gets <a href="http://kk.org/thetechnium/2008/03/turingd/">Turing'd</a>, by way of a domain-specific language. (Lawyers, don't worry; <a href="http://hodgen.com/questions-are-harder-than-answers/">you'll keep your jobs</a>.)</p>
<p>The goal? To enable a lawyer – better yet, a non-lawyer – to draft a contract more concisely and clearly than they could in a natural language, by writing what looks like computer code. The drafter gets to take advantage of all sorts of ideas from computer science: variables, functions, third-party libraries, syntax and type checking, unit testing, completeness, and consistency. And the drafting <em>community</em> can get ideas from software engineering, like collaborative version control and opensource community support practices. The contract can be tested by fuzzing against future scenarios of breach, possible legal challenges, and simulated courtrooms.</p>
<p>As Frederik Pohl might put it, <em>a good futurist predicts the car; a great futurist predicts the traffic jam</em>. If the car is a formal language for contracts and agreements (maybe even legislation), then a taxi service might be smart contracts integrated with cryptocurrencies and wholly automated business processes, exposed through legally binding APIs. The traffic jam? Maybe that's a DDOS in the form of micro-contract spam, a welter of frivolous lawsuits, or a zero-day exploit of an error enshrined in some old piece of paperwork that didn't get patched when the last novation service pack went around.</p>
<h1>The Innovation</h1>
<p>Very clever people have thought long and hard about a world in which computers execute contracts, where programs transfer money to people and people transfer money to programs, where decentralized cryptocurrencies disrupt banks and financial institutions. Very clever people will be involved in the effort to build a bridge between formal and natural languages. Many man-years will go into developing a Github/Wikipedia of legal templates that are freely available for all to use.</p>
<p>Legalese is clever in a different way. The business challenge of getting from the 20th century status quo to the 21st century promised land requires the ability to scout and climb a monotonically increasing path through multidimensional "value-proposition" space toward the global optimax. This is as much a logistical and business challenge as a computational linguistics challenge. That's why we've chosen to start with spreadsheets: we optimize for the power user while building a painless onboarding pathway for first-timers.</p>
<p>You know how some extreme runners run fifty marathons in fifty consecutive days? Actually running the marathons is one kind of challenge. Arranging the flights, travel, and accommodation so the runner gets from finish line in one city to starting line in another, is different kind of challenge. Developing a domain-specific language, or a library in which to model contracts, is the former kind of challenge. Making Legalese succeed as a business is the latter kind.</p>
<h1>Examples</h1>
<p>A company takes funding from an investor, who becomes a shareholder. This single <em>state change</em> requires seven sets of <em>resolutions</em> and at least one <em>contract</em>.</p>
<h2>Corporation's Data Structure (Before)</h2>
<p>A company called NewCo Inc. has two directors (Alice and Bob) and two shareholders (Bob and Carol). This simplified JSON represents the state of the company before it raises funding from the new investor, Donald.</p>
<!-- maybe we need something like https://highlightjs.org/ -->
<code>{ "entities" : {
"NewCo": {
"name" : "NewCo Inc.",
"entityType" : "corporation",
"jurisdiction" : "SG",
"externalId": { "id": "C12345678K", "idType": "UEN" },
"directors" : [ "Alice", "Bob" ],
"shareClasses" : { "ordinary": { } }
"shareholders" : { "Bob": { "shareClass": "ordinary", "num": 20 },
"Carol": { "shareClass": "ordinary", "num": 10 } },
},
"Alice": {
"name": "Alice Lovelace",
"entityType": "naturalPerson",
"externalId": { "id": "S11111111A", "idType": "NRIC" }
},
"Bob": {
"name": "Bob Dobbs, Jr.",
"entityType": "naturalPerson",
"externalId": { "id": "S22222222B", "idType": "NRIC" }
},
"Carol": {
"name": "Carol Choo-Choo",
"entityType": "naturalPerson",
"externalId": { "id": "S33333333C", "idType": "NRIC" }
}
} }
</code>
<h1>Natural Language Generation</h1>
<p>Text planning and interaction effects are critical to contract generation. One part of a contract may affect another. Sometimes these interactions are simple, and can be represented by a DAG. Sometimes these interactions are, superficially and conventionally, cyclic, and need to be decomposed with some clarity. Metaprogramming helps to correctly represent these interactions.</p>
<ul>
<li> <a href="http://www.cogentex.com/research/index.html">CoGenText</a> is an example of an NLG company.</li>
</ul>
<h1>More Science Fiction</h1>
<blockquote class="quotation">Amber fast-forwards through the dynamic chunks of the README – boring legal UML diagrams, mostly – soaking up the gist of the plan. Yemen is one of the few countries to implement traditional Sunni shari'a law and a limited liability company scam at the same time. Owning slaves is legal – the fiction is that the owner has an option hedged on the indentured laborer's future output, with interest payments that grow faster than the unfortunate victim can pay them off – and companies are legal entities. If Amber sells herself into slavery to this company, she will become a slave and the company will be legally liable for her actions and upkeep. The rest of the legal instrument – about ninety percent of it, in fact – is a set of self-modifying corporate mechanisms coded in a variety of jurisdictions that permit Turing-complete company constitutions, and which act as an ownership shell for the slavery contract. At the far end of the corporate shell game is a trust fund of which Amber is the prime beneficiary and shareholder. When she reaches the age of majority, she'll acquire total control over all the companies in the network and can dissolve her slave contract; until then, the trust fund (which she essentially owns) oversees the company that owns her (and keeps it safe from hostile takeover bids). Oh, and the company network is primed by an extraordinary general meeting that instructed it to move the trust's assets to Paris immediately. A one-way airline ticket is enclosed.</blockquote>
<blockquote class="credit"><em>Accelerando</em>, Charlie Stross</blockquote>
</section>
<aside id="sidebar">
<a href="https://docs.google.com/spreadsheets/d/1rBuKOWSqRE7QgKgF6uVWR9www4LoLho4UjOCHPQplhw/copy?id=1rBuKOWSqRE7QgKgF6uVWR9www4LoLho4UjOCHPQplhw©Collaborators=false©Comments=false&title=My%20Legalese%20Tutorial%202&usp=sheets_web" class="button">
<small>Install the</small>
Google App
</a>
<p class="repo-owner"><a href="https://github.com/legalese">Legalese</a> is a <a href="https://jfdi.asia/">JFDI.Asia</a> spinoff, initially hosted by <a href="https://github.com/cofounders">Cofounders</a> and later moved to its own project.</p>
<p>This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the Architect theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.</p>
</aside>
</div>
</div>
</body>
</html>