constitutional-law legal-research legal-writing jurisprudence statutory-construction
LawTech: How to systematically express Positivist-Law frameworks as control flow algorithm systems and automate statutary-construction analysis?
<p>I'm a brick-and-mortar engineer with very cursory coding experience (pseudo-code algorithms, formal logic gates in printed circuits, and Matlab/Simulink), studying to be a Civil Servant in a Romance country where the law is extremely informed by what I understand is the Positivist mindset - tries to create a closed logical system where all possibilities are accounted for and judges have as little leeway of interpretation as possible.</p>
<p>A lot of it follows patterns such as</p>
<pre><code>#INCLUDE(CONSTITUTION) 
#INCLUDE(PARLIAMENTARY LAWS) 
#INCLUDE(GOVERNMENT REGULATIONS) 
#&quot;DEFINITIONS&quot; 
#IF A THEN 
    GOTO_LAW(B) 
    //as in, &quot;apply article 35 line 3 paragraph b 
    //of section A of book 1 of law 75/2003 of 
    //the National Assembly&quot;, for example 
ELSEIF C THEN 
    GOTO_LAW(D) 
ELSEIF NOT(A OR C) 
    DO ACTION_E
ENDIF

WHILE CONDITION_F=FALSE 
   DO ACTION_G
ENDWHILE
</code></pre>
<p>etc.</p>
<p>In my line of work, it often happens that a lower-tier, quick-release
Executive Regulation conflicts with a parliamentary Law or with the Constitution Itself. This can have dire business consequences and completely wreck a project's timeline, or budget, or sink it altogether. I understand that this is known as &quot;judicial insecurity&quot;, and it's tangibly damaging.</p>
<p>It would be nice if lawgivers were kind enough to decree airtight laws that, though one might argue they are more or less just or good, at least are formally consistent with each other, telling citizens and legal persons clearly what we can and cannot do. However, it's often up to lay citizens to notice these discrepancies and take them to court for appeal. Even when the cases are very clear-cut, it can take months or years, and by the time it's done, a whole new set of quick-and-dirty executive regulations may have come out.</p>
<p>I'd like to know if, given the at least attempted &quot;formal algorithm&quot; method of the law, there wouldn't be an automated method of parsing the laws for contradictions, formal inconsistencies, endless loops, or undesirable end-states. I'd likewise appreciate an automated system for parsing out the control flows in the laws and turning them into easily-readable, standardized diagrams and charts.</p>
<p>Now, However, I don't know enough about programming, particularly as applied to linguistics, to figure out what the best approach would be. If y'all got any insights, I'd strongly appreciate them.</p>
<p>The DEFINITIONS part is particularly tricky for me, as we've got, off the top of my head:</p>
<ol>
<li>Agents
<ul>
<li>Public ones: Courts, Legislative Assemblies, Administrations, Department, Position (distinct to the person of the civil servant in it), &quot;Organ&quot;, etc. (it's quite a tangled web of affiliations and dependencies, and liable to change quickly, too).</li>
<li>Private citizens, with the attributes thereof that are deemed relevant (nationals/EU citizens/foreign, major/minor, etc.)</li>
<li>Private associations: Privately or Publicly owned, For Profit or Non Profit, different types of corporation...</li>
</ul>
</li>
<li>Actions: For example, for a person to be [appointed to an Positon],
-Organ A [nominates],
-Organ B [introduces in the agenda],
-Organ C [votes],
-Organ D [vetoes or not],
-Organ E [signs the appointment],
-Organ F [publishes] in the official bulletin, etc.</li>
<li>Documents: just in the example above, each action or lack thereof is recorded (actively or by default) in a document (Nomination, Minutes, Appointment, the Bulletin, etc.). Then you have stuff like Registries and Records, which are compilations of documents, and need to be distinguished from the Organs named after them that are in charge of running them. You have Contracts, which are a whole Thing themselves. You have your specific Administrative Acts and your General Decrees. And, well, I can't help but think of the myriad types of documents, both formal and not, that are introduced in - discovery, was it? - as Evidence.</li>
<li>Dates and timestamps are very important, as are the specific windows and deadlines to perform this or that action.</li>
<li>Principles: they're very annoying because they're unevenly applied and usually not self explanatory, but they're supposed to inform all legislation and, when they're in the Consitution, they're meant to be very binding indeed. Legality, Rule of Law, State of Law, Non-Arbitrariness, Objectivity, Impartiality, Transparency, Non-Retroactiveness, General Interest, Cooperation, Coordination...
<ul>
<li>It's possible to go to the Doctrine (i.e., the opinions of Respected Legal Scholars) or to Case Law (which tend to rule on ambiguities of this type) to construct something resembling a useful formal definition, but it's usually very difficult to avoid a degree of &quot;fuzziness&quot; and &quot;gradient&quot; in the concept.</li>
<li>As such, my impression is that any formal tests that one could devise to make sure the laws apply those principles would fall under the header of operationalization, i.e. answering a difficult question with a similar, much simpler one.
<ul>
<li>The example I was given in Philosophy of Science class at Uni was: &quot;How much do you love your wife?&quot; vs. &quot;How high a voltage are you willing to be shocked with in order to guarantee that she herself does not get shocked?&quot;</li>
<li>Likewise, &quot;is this law impartial&quot; could be turned into &quot;in practice, what demographics are disproportionately favored by it and what aren't&quot;, although that requires going outside of the formal confines of the law. There's likely a way to formally test if, in theory, the law is impartial, but I can't think of one right now.</li>
<li>Similarly, the concept of &quot;General Interest&quot; is quite problematic
- a huge collection of subjective interests that seems incredibly hard to even <em>know</em> objectively, let alone turn into a set of quantitative criteria, or legislate for without biases or hidden assumptions,
- and yet &quot;the Administration serves the General Interest Objectively and Impartially&quot; is an actual article of Law that is in effect and which you could refer to in court when appealing an  administrative regulation or act that you have evidence serves Special Interests, is Subjective, or favors certain parties over others.</li>
</ul>
</li>
</ul>
</li>
</ol>
<p>I've been circling the problem, reading some law, attempting a chart and a pseudo-code, going to practical cases, reading some theory on the background thereof, learning about different coding languages and practicing simple exercises just to get the hang of them, etc. I'm slowly growing familiar with declarative, imperative, object-oriented, etc languages, as well as Controlled Natural Languages and attempts to make programming easy to parse for people and human language easy to parse for machine. I'm finding out about programs and AIs that are designed to parse language, and about statistical methods to hermeneutics and data analysis.</p>
<p>It's been quite haphazard and unstructured, and I feel like I may be wasting my time blindly touching an elephant's trunk and trying to figure out what sort of snake it is. But I'm afraid to raise my voice, explaining what I'm doing and ask, &quot;am I doing this right&quot; and of either being ignored or being told to ask a more specific and well-researched question. I'd really appreciate some guidance, though.</p>
<p>I guess, for now, I'd be content with tips on how to approach the following problems, in order of priority:</p>
<ul>
<li>automating the representation of laws as control flow charts</li>
<li>automating the discovery of
<ul>
<li>undesirable loops and end-states in said flow charts</li>
<li>fringe cases that are pedagogically optimal for explaining the nuts and bolts of the law to people learning it</li>
<li>ambiguous language: when a word means different things depending on which &quot;semantic field&quot; of law we're in - for example, &quot;convention&quot; can mean very different kinds of agreements in Civil Law, Administrative Law dealing with private entities, Administrative law dealing with different tiers of the Administration, and International Law, just to name a few.</li>
<li>formal contradictions between laws of equal and different tiers</li>
</ul>
</li>
</ul>
<p>That would be a good start - just a formal comprehension and testing of the law.</p>
<p>Other than that, I'm aware that LawTech firms <a href="https://www.legalgeek.co/startup-map/" rel="nofollow noreferrer">are developing some truly interesting applications</a> on a number of subjects, with particular attention paid to contract drafting and enforcement, and the automation thereof, as well as to the prediction of outcomes in lawsuits based on case analytics. I'm not, however, aware of the theoretical and skillset edifice upon which this kind of work is build - but it interests me a great deal. In fact, I'm finding Law so fascinating and vitally important that I'm actually considering getting a Law degree myself - I understand that STEM-trained folks are actually rather welcome in Law Schools? I'd strongly appreciate any guidance on how to build my knowledge and skills base to begin to be able to grapple with such problems - and, eventually, if I'm any good at it, offer useful billable expertise that clients would purchase, of course.</p>

<h2>You can’t have complete mathematics; you have no chance of a complete legal system</h2>
<p><a href="https://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems" rel="nofollow noreferrer">Godel’s incompleteness theorems</a> tell us that mathematics has no complete, consistent and finite set of axioms that can prove every correct statement. If we can’t do it for something as logical as maths, we certainly can’t do it for anything involving things as messy as people.</p>
<p>The solution that has been adopted in most jurisdictions is to give decision makers discretion and allow appeals. That’s pretty hard to turn into an algorithm.</p>
