Answer Set Programming for Legal Analysis
This blog post was inspired by a paper presented at ICAIL 2025 by Josephine Dik and Réka Markovich, called “Judicial Discretion as Normative Reasoning: Deontic Characterization of Judicial Decision Making with Answer Set Programming”. It describes the use of the clingo Answer Set Programming (ASP) solver to weigh various considerations in a hypothetical child custody case and to prescribe a suggested exercise of discretion for the judge.
Unfortunately I don’t know of any way to read this year’s ICAIL papers, even through a library, other than requesting access to the preprint. But I’d still like to comment about the paper a little because I think of answer set programming as a slightly enigmatic and under-documented part of the Python world, but still one that could be promising for legal analysis. The logic program from the paper is on GitHub.
The answer set program in the Dix and Markovich paper defines a model in which a set of judges can each determine “each parent’s properties, whether these are relevant, if so, whether they are positive or negative, and how relevant these properties are.” The conclusions that the “judges” reach in the program are defeasible, which means the model can reach a conclusion based on incomplete information, and that adding new facts to the model can change the conclusion. The paper gives the example of reaching a conclusion on child custody in the mother’s favor, but then adding the fact “the mother is in jail” to change the outcome.
The ASP system supports both strong and weak negation, represented by a minus sign and the word “not” respectively. The paper suggests that these forms of negation should be used to represent the concepts “a judge has stated that a fact is false” and “a judge has not stated that a fact is true.” Apparently, because the formal logic statements include a reference to the judge, it’s possible to use some “negation” statements to describe the point of view of one judge, while using other negation statements for other judges. I wasn’t really able to understand the paper well enough to know if this is viable or not, but it seems odd. It’s easier for me to imagine the negation operators creating statements like “it’s false that the judge has stated that the fact is true” and “it’s not known that the judge has stated that the fact is true.”
I think the “judges” in the ASP system should be thought of as agents in a very abstract simulation, so the model doesn’t include a very complete depiction of the actions a judge might take in real life. But the paper does describe a way for one “judge” to be considered the “appellate judge” that “reviews” the decisions of the other judges.
Whether or not this model is adequate to describe what happens in real courtrooms, I think there’s a lot of potential in using answer set programming to discover possible outcomes given a set of legal “facts” or “statements”. The most accessible presentation I’ve seen about using solvers in Python (not specific to the legal domain) was Raymond Hettinger’s PyCon talk “Modern solvers: Problems well-defined are problems solved” (presentation at https://rhettinger.github.io/). But even that deals primarily with SAT solvers, not ASP solvers.
I’m left with a few questions:
-
How can legal analysts put themselves in enough of a “logic programming” mindset to recognize when solvers are a good solution for a problem?
-
Does legal procedure require so many changes of frame of reference that it can’t usefully fit into a logic programming model?
-
Can we break down small parts of legal analysis tasks to be handled with solvers, while still doing most of our data modeling with traditional imperative programming (preferably in Python)?