
Ask HN: Government law as code? - brianclements
I&#x27;m curious if there is research, startups, open-source projects, etc., pertaining to this topic which has intrigued me for a while.<p>Law and code are very similar conceptually it seems: they outline variables, environments, conditions, then execute procedures. The big difference being computers do one, and people do the other. Politics discusses this notion of &quot;efficient&quot; government and I want to take it even further. I&#x27;m curious about a world where, let&#x27;s take property taxes for example, we can search repositories for every implementation (procedure&#x2F;function) of property tax law (code) in a given country (within all states&#x2F;counties), and not only see it publicly (open source), but be able to use the code for testing (how effective is this &quot;algorithm&quot; for a given outcome?), RFC&#x27;s, forking across localities, tweaking, and all the other processes that work so well in software design.<p>Efficiency and smart management in software is modularization, clear roles for parts, and easy ways to plug things together (and avoid NIH syndrome) I feel like (in a programming analogy) every single city&#x2F;county&#x2F;state rewrites everything scratch all the time!<p>Of course maybe these are just different mediums that allow for very similar processes and I&#x27;m just amazed by that. But I can&#x27;t help but think there is something here.<p>So here&#x27;s the question: If in the future, a very progressive group of technophiles wanted to start a new country from scratch on a moon or space station somewhere, do you think they would do everything on a github style medium with software design type methods? Should they? Could they? Do you always need humans to enforce&#x2F;interpret the laws?
======
amptorn
Yes, you do always need humans to enforce/interpret the laws. Don't be absurd.

The alternative is kind of like that scene in Robocop, except ED-209 is a
judge instead of a robot, it sentences you to death rather than killing you
directly (the bailiff obeys unquestioningly), and instead of frantically
trying to shut the machine down, everybody in the room agrees that you were
indeed carrying the gun, and almost certainly still are.

You ask for a retrial and it takes 1/50th of a second to spit out exactly the
same response. The rationale for the verdict is a procedurally generated AST
running to 5200 pages, which is incoherent not only to you but also to lawyers
and programmers alike. (You are given a copy of it on a USB stick, but no
computer to read it with.)

A country where laws are applied with absolutely no nuance, context,
consideration, empathy or judgement is a petrifying hellscape. A pretty good
Black Mirror episode, in fact.

E: this is all ignoring how _awful_ human beings are at software development.

~~~
brianclements
I grant you the absurdity of enforcing _all_ laws with
machines/computers/robots. I don't think I was as clear as intended. But I do
feel that there are plenty of processes and certain law _domains_ that are
equally absurd when you make humans enforce them. These would be things like
financial regulation, taxes, immigration maybe? Domains where our nuance,
context, and consideration (read: bias) can actually prevent and corrupt the
enforcement of these laws. Now granted, this depends on the availability of
data infrastructure among other things, but if I could clarify the question,
I'm thinking about what lessons learned and processes from software
development can bring about efficiencies in government that we haven't
considered yet. Not some type of absolute computer takeover of government.

------
bachback
Bitcoin + consensus + smart contracts

Bitcoin already enforces practical law in some sense. If you dig into this it
all comes down to property rights, which now can be implemented on the net
with blockchains. Ethereum attempts to go a step further along these lines,
but its not practical yet IMO. You're right, this is a very fertile ground.

------
BWStearns
There's a lawyer at the MIT media lab named Dazza Greenwood who is working on
projects along these lines. My understanding is that he's already working with
Boston to get any city ordinances that are amenable to the challenge to also
be published with valid code of some sort. He has really worked through a lot
of the issues and is really open about talking on the subject.

The formalization of all law into code fully is probably not fully achievable
in the near term since there are many component parts of legal tests that are
not really deterministically resolvable, and I think it would be a hard sell
that justice is properly served if a call to rand() played a part in
adjudication or sentencing.

I think a more profitable way to start integrating code is within the realm of
contract law. A contract described in code has some advantages over even a
well written legal prose contract: it's testable, components could be more
easily reusable, in some circumstances it could self-monitor for breach, it's
easily diffable. Such contracts could be made to be more transparent (assuming
good faith and code-literacy) and less prone to purposely unenforcible clauses
etc (law linter?). Some such contracts might be progressively abstracted into
a genuine and good faith "standard contract" for [thing]. Of course now you
need two lawyers who both can also program comfortably in the same programming
language and I have to imagine the first judge to interpret such a contract is
going to be pissed as hell (or more optimistically intrigued).

As far as starting from scratch all the time, we don't really do that. The US
legal system was basically just forked from England at first, and within the
US we have a lot of model laws that are more or less universal (look at the
[https://en.wikipedia.org/wiki/Uniform_Law_Commission](https://en.wikipedia.org/wiki/Uniform_Law_Commission)),
but we do sometimes have some weird holdouts (pretty sure Louisiana still uses
some Napoleonic code instead of UCC stuff).

Edit: sorry for the wall-o-text, also just thought of IoT/semi-autonomous
agents that might require the autonomy to decide whether or not to enter into
a legally binding agreement on behalf of the operator without necessarily
knowing ahead of time the counterparty or the exact terms. It would be a lot
easier for these kind of bots if there were some generic contracting
convention or DSL or something. I'm thinking trading bots and maybe of an
intelligent shopping bot.

~~~
brianclements
Thanks for the leads. Very informative.

Contracts make sense, and will probably be the first experiments with this.
That seems to be what blockchain tech is tapping into first. I would think
though that new languages developed for this would emphasize readability.
Perhaps a wiki-style top layer for regular human reading where the
definitions, terms, and links can be defined and standardized as code
underneath and can do things like call to state or federal entities for rates,
dates, numbers, or jurisdiction domains etc. upon "enforcement" (runtime).

Now your edit was really interesting. International trade/shipping might be
ripe for automation in the future. Boats and drones might be able to simply
upload the most recent contract and parse it into actionable rules, or, act on
behalf of parameters set via the contract. Maybe delivery drones check local
law dynamically on sale of weapons etc. so that it doesn't need to get hard-
coded into the operating system.

------
bobinator606
the AI and law movement began more than 40 years ago. There's an AI and law
journal, a bi-annual international conference (ICAIL) and tons of other work
(such as LDRI from the UK National Archives and the automated legal reasoning
research from Stanford, CMU, and MIT.

[http://sites.sandiego.edu/icail/](http://sites.sandiego.edu/icail/)

------
detaro
Laws already struggle when words meet reality, code would even more. So, no,
outside of very specific cases with a lot of conventional law to define the
interfaces.

Law can already be kind of algorithmic, but it (IMHO) doesn't make much sense
to have computers execute it.

------
minimaxir
No. Watch a few science fiction films. :p

