News for hackers. Stuff that matters.

Ask HN: Has anyone tried to rewrite a law in Prolog?

Curious if it is possible and if it makes sense to define everything in a law or constitutional act as logical rules using a logic-based programming language such as Prolog.

It'd be really fun to simply type a logical question and directly see whether it is legal or illegal based on all the definitions.

( 5 comments | 4 points | on HN )
Re:Ask HN: Has anyone tried to rewrite a law in Prolog? by anigbrowl on Tuesday December 27, 2022 @06:35PM (#34155416)
Possible yes, sensible no. Any logical outcome can be set aside on fundamentally arbitrary bases, and as soon as you start trying to maintain compatibility with precedent or enforce some sort of axiomatic consistency the whole thing will collapse.
Re:Ask HN: Has anyone tried to rewrite a law in Prolog? by MrLeap on Tuesday December 27, 2022 @07:30PM (#34155899)
Represent the model probabilistically, like with markov chains or similar.
Re:Ask HN: Has anyone tried to rewrite a law in Prolog? by triska on Tuesday December 27, 2022 @06:14PM (#34155188)
A classic reference: The British Nationality Act as a Logic Program:

https://www.doc.ic.ac.uk/~rak/papers/British%20Nationality%2...

Parts of the constitution of Japan in Prolog:

https://github.com/bitlaw-jp/the-constitution-of-japan

A recent project involving the formalization and automated analysis of criteria for grants:

https://www.brz.gv.at/en/BRZ-Tech-Blog/Tech-Blog-7-Symbolic-...

Re:Ask HN: Has anyone tried to rewrite a law in Prolog? by tannhaeuser on Tuesday December 27, 2022 @06:12PM (#34155175)
Re:Ask HN: Has anyone tried to rewrite a law in Prolog? by cratermoon on Tuesday December 27, 2022 @06:11PM (#34155158)
Interestingly, the law is not what's written in the Constitution, U.S. Code, state laws, or other legislative produces.