XAI-LAW: A Logic Programming Tool for Modeling, Explaining, and Learning Legal Decisions

Agostino Dovier Talissa Dreossi Andrea Formisano Benedetta Strizzolo · 2026

Read XAI-LAW: A Logic Programming Tool for Modeling, Explaining, and Learning Legal Decisions by Agostino Dovier Talissa Dreossi Andrea Formisano Benedetta Strizzolo (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-03844.txt.

Introduction

Agostino Dovier and three co-authors built XAI-LAW, a tool that models parts of the Italian Criminal Code in answer set programming and learns legal rules from past verdicts. The aim is to support legal experts during the criminal trial phase with reasoning support and possible outcomes for new cases. Articles covering crimes against the person and property offenses were analyzed and encoded as logic rules.

The model is validated against previous verdicts and refined where it disagrees. Contradictions that surface during encoding are handled by the system, which can also generate possible decisions for new cases. Explanations come from the supportedness structure of stable models, letting users see why an outcome follows. A further component semi-automatically learns rules from example decisions, keeping human jurists in charge of the final encoding.

Catalog record

CREATORAgostino Dovier Talissa Dreossi Andrea Formisano Benedetta Strizzolo
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE39 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-03844

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

XAI-LAW: A Logic Programming Tool for Modeling, Explaining, and Learning Legal Decisions Thanks: Research partially supported by Interdepartment Project on AI (Strategic Plan of UniUD-22-25) Agostino Dovier Talissa Dreossi Andrea Formisano Benedetta Strizzolo Abstract We propose an approach to model articles of the Italian Criminal Code (ICC), using Answer Set Programming (ASP), and to semi-automatically learn legal rules from examples based on prior judicial decisions. The developed tool is intended to support legal experts during the criminal trial phase by providing reasoning and possible legal outcomes. The methodology involves analyzing and encoding articles of the ICC in ASP, including “crimes against the person” and property offenses. The resulting model is validated on a set of previous verdicts and refined as necessary. During the encoding process, contradictions may arise; these are properly handled by the system, which also generates possible decisions for new cases and provides explanations through a tool that leverages the “supportedness” of stable models. The automatic explainability offered by the tool can also be used to clarify the logic behind judicial decisions, making the decision-making process more interpretable. Furthermore, the tool integrates an inductive logic programming system for ASP, which is employed to generalize legal rules from case examples. 1 Introduction The desire of delegating legal decisions to an automated formal system can be traced back (at least) to Leibniz’s dream. In spite of Gödel incompleteness results, holding in a more general context, several efforts have been posed in this direction since the birth of artificial intelligence, earlier expert systems, and logic programming. From the 1950s, Allen and Saxon [ 2 , 3 ] paved the way for the application of logic programming in the legal field, by interpreting legal documents, and by outlining what is necessary for encoding legal rules in logic. Two of the main challenges in this area concern the inherent ambiguity of natural language (NL) and the applicability of legal rules. The first notable attempt to encode laws in logic was undertaken by Kowalski et al. [ 36 , 25 , 26 ] , who formalised part of the British Nationality Act. They introduced a specialised language, called Logical English, which consists of a controlled natural language (CNL), i.e. a language that easily allows English sentences to be translated into logic programs such as Prolog, Datalog, or Answer Set Programming (ASP) [ 26 ] . In this field, progress has been made through the development of systems that automatically translate NL into CNL and then into ASP code [ 9 ] . Similarly, Large Language Models (LLMs) can be employed to directly translate NL into ASP [ 23 , 11 ] . A further step was to combine LLM-based semantic parsers with a learning module, such as in the aforementioned paper by Kareem et al. [ 23 ] . In that study, ILASP, which is also used in this paper, was employed to learn the ASP programs generated by LLMs. While LLMs are valuable tools for processing text and converting it into corresponding logical encodings, their primary limitation lies in the granularity of the generated encodings. In particular, a common challenge with legal rules is the occurrence of distinct terms that share the same meaning. To address this issue, it is necessary to either distinguish between or unify these terms based on their meaning, as well as establish possible co-references within the text. At the beginning Prolog was the language employed in legal reasoning; however due to its limited capabilities on commonsense/non-monotonic reasoning and in particular in handling exceptions, belief revision, default negation, ASP offers a more appropriate alternative [ 8 ] . As an example, Athakravi et al. [ 7 ] proposed a logic-based approach to generate a declarative model of judgments from past legal cases, capturing legal reasoning through rules and exceptions. In contrast, s(CASP), used by Sartor et al. [ 35 ] , follows a top-down goal-oriented strategy. It includes an explanation tool that traces the paths leading to the solution; however, it does not provide a comprehensive model of the ASP encoding. Top-down approaches, however, are generally less suitable for legal reasoning due to scalability issues and may yield to conclusions even when applied to inconsistent programs, i.e. those that do not admit any stable model. Similarly, the tool developed by Arias et al. [ 5 ] uses s(CASP), and hence it must operate under the assumption that the system is consistent; as a matter of fact, it may return an answer even when the program does not admit any stable model. One key advantage of ASP is its explainability in contrast to black-box algorithms, which present four different issues: opacity, strangeness, unpredictability, and justification [ 10 ] . Notably, even individuals involved in the penal system, such as police officers, have expressed scepticism towards opaque tools [ 37 ] . An example of a widely discussed black-box system in the legal domain is COMPAS (Correctional Offender Management Profiling for Alternative Sanctions) [ 38 ] , a proprietary risk assessment tool used in the United States to predict the likelihood of criminal reoffending. It has been heavily criticised for its lack of transparency and potential biases, particularly regarding race and socioeconomic status. In this context, Inductive Learning of Answer Set Programs (ILASP), an Inductive Logic Programming (ILP) framework [ 27 ] , offers a novel approach for learning legal reasoning, while ensuring interpretability. The reason why we chose this approach is that it employs ASP, allowing the development of a non-monotonic reasoning system. In this study, we exploit ASP, for encoding immutable legal rules, and a Conflict-Driven Clause Learning (CDCL) bottom-up ASP solver, to derive stable models. In previous work [ 17 ] we focused on the law encodings in particular on how dealing the notion of vagueness; in [ 12 ] the basis of the project later developed for this paper were presented. In this work, we finalized that studies by augmenting the set of encoded articles from the Italian penal code, applying ILASP (version 4) to derive rules explaining judges’ reasoning patterns. Moreover, since ASP by itself produces stable models but does not show the rules that were triggered to get those results, as explained by [ 34 ] , in this paper we propose the use of xASP [ 4 ] . XASP is a tool that allows us to interpret and understand the reasoning behind the stable models generated by the ASP solvers by constructing a Directed Acyclic Graph (DAG). The integration of ILP framework and xASP has already been proved to work in a similar study applied to a different field [ 19 ] . This approach enables the system to compute scenarios of plausible decisions, each accompanied by an explanation, which can then be reviewed by a judge to inform her/his final decision. Alternatively, it can be used to generate a logical explanation for decisions autonomously made by a judge. Although, in principle, the system could be used for autonomous decision-making, the authors would suggest its use as a decision support system. The paper is organized as follows. In Section 2 we briefly recall the basic notions on ASP and ILP. Section 3 describes the main aspects of our ASP encoding of the Italian

Read the complete text