Manuscript Offprint
arXiv:2610.35169Formal Explanations for Linear Temporal Logic over Finite Traces
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Linear Temporal Logic over Finite Traces (LTL ) is widely used in Artificial Intelligence to specify desired temporal behavior and determine whether finite traces satisfy or violate it. Explaining these outcomes is essential for debugging and trust. However, existing approaches typically capture either sufficient reasons or counterfactual causes, without clarifying their relationship. We introduce a native characterization of abductive (AXps) and contrastive (CXps) explanations directly over finite traces, based on locking and unlocking time-indexed events. We prove its equivalence to the classifier-based formulation, and show that CXps coincide with a recently proposed temporal causality semantics for LTL . This characterization enables an efficient implementation based on the enumeration of minimal unsatisfiable cores and minimal correction sets of ASP programs. Experiments on real-world event logs demonstrate the effectiveness of the approach.
Introduction
Linear Temporal Logic over Finite Traces (De Giacomo and Vardi 2013) (LTL ) is a popular formalism for temporal reasoning in AI. It has been successfully applied to several domains, such as reinforcement learning (De Giacomo et al. 2019), planning (Bacchus and Kabanza 1998; De Giacomo and Rubin 2018), robotics (Kress-Gazit, Fainekos, and Pappas 2009) and business process management (van der Aalst, Pesic, and Schonenberg 2009; De Giacomo et al. 2014).
In applications, formulas are used to describe desired behavior. A formula may describe the dynamics of a system, or the goals driving an agent's behavior. Traces (interpretations) represents states of a system over time, or a sequence of actions performed by an agent. When a trace satisfies a formula , we say that complies with the specification; otherwise, it violates it. In either case, being able to explain why is important.
Figure 1 illustrates the explanation problem via an autonomous delivery agent subject to (req F deliver) (low X charge), which requires every request to be eventually served and every low-battery to be immediately followed by charging. The trace (of Figure 1) satisfies , but this alone does not explain why. We focus on two complementary kinds of explanation. A sufficient reason is a set of time-indexed events and non-events that guarantees satisfaction: for , the absence of low throughout the trace already guarantees satisfaction of the charging obligation, no matter how the remaining observations are altered. A minimal intervention is a minimal set of observations whose change flips the outcome: adding low to the first time instant of not followed by charge turns it into a violating trace. Conversely, violates : here a sufficient reason guarantees the violation (e.g., knowing only that low holds at the second time instant and charge is absent at the third time instant makes every trace agreeing with these two observations violate ), while minimal interventions restore satisfaction. Thus the explanation problem answers two complementary questions: why does the trace satisfy or violate the specification? and what must change to obtain the opposite outcome?
These two kinds of explanation are precisely the central notions of formal explainable AI (FXAI) (Ignatiev, Narodytska, and Marques-Silva 2019; Shih, Choi, and Darwiche 2018): abductive (AXps) and contrastive (CXps) explanations. Given a classifier and an input instance, an abductive explanation is a subset of feature values sufficient to guarantee the predicted class, whereas a contrastive explanation is a subset of features whose change yields a different class. Importantly, subset-minimal abductive and contrastive explanations are related by hitting-set duality (Ignatiev et al. 2020; Reiter 1987), which also supports effective enumeration algorithms (Liffton et al. 2016). In principle, an LTL formula can be cast as a binary classifier over time-indexed propositions, making these notions formally applicable. However, this encoding is not the usual way temporal formulas are understood and makes it harder to see explanations as observations that are kept fixed or allowed to change. Thus, a native characterization of AXps and CXps for LTL is missing. Existing approaches capture either sufficient reasons for satisfaction (Ferrère, Maler, and Ničković 2015) or counterfactual causes of violation (Meng and Alrajeh 2025), but none connects the two perspectives or grounds them in hitting-set duality. We fill this gap through the simple operations of locking and unlocking temporal observations: locked observations play the role of the feature values an AXp keeps fixed, whereas unlocked ones are those a CXp is allowed to alter. AXps and CXps are thus defined directly over finite traces, with no classifier-based reformulation. Our contributions are threefold: (i) we characterize AXps and CXps for the satisfaction and violation of LTL specifications, directly over finite traces; (ii) we prove that this characterization is

Figure 1: AXps (sufficient reasons) and CXps (minimal outcome-flipping interventions) for on a compliant trace and a violating trace . Sets are listed state by state; e.g. , denotes .
equivalent to the classifier-based one, establish the hitting-set duality between AXps and CXps for , and show that CXps coincide with the temporal causes of (Meng and Alrajeh 2025) under fixed-length interventions; (iii) we reduce their computation to the enumeration of minimal unsatisfiable subsets and minimal correction sets, implement the approach in Answer Set Programming (ASP) (Gelfond and Lifschitz 1991; Brewka, Eiter, and Truszczynski 2011), and evaluate it on real-world event logs.
Temporal Implicants & Temporal Causality. Implicants are partial interpretations guaranteeing a propositional formula's truth or falsity and, for propositional binary classifiers, coincide with abductive explanations (Ignatiev et al. 2020). In LTL, temporal implicants have only been studied under infinite-trace semantics (Ferrère, Maler, and Ničković 2015), and implemented with a greedy algorithm computing a single, possibly non-minimal implicant. The connection to unsatisfiable cores is mentioned as a related problem but not further developed. We instead address finite traces, recast the problem in the FXAI framework, and provide an efficient implementation based on unsatisfiable cores and correction sets.
A recent work by (Meng and Alrajeh 2025) proposes a revised version of cause for , specializing the Halpern's (Halpern 2016). It extends earlier works (Beer et al. 2009) that considers only singleton causes, to conjunctive causes. Neither line addresses the dual notion of sufficient reasons for satisfaction or violation. We will prove that this notion is closely related to CXps.
Unsatisfiable Cores in Temporal Reasoning. Minimal unsatisfiable cores and correction sets (Liffton and Sakallah 2008; Marques-Silva, Janota, and Mencía 2017) are at the base of our implementation. admits notions of unsatisfiable cores (Roveri et al. 2024), whose computation has been the focus of recent works (Roveri et al. 2024; Niu et al. 2024; Fionda, Ielo, and Ricca 2026; Ielo et al. 2026). Unsatisfiable cores explain why a formula is unsatisfiable, whereas abductive explanations answer why a trace violates/satisfies a formula. The first is a form of global explanation, the latter is a form of local explanation (Guidotti et al. 2019; Marques-Silva and Ignatiev 2022). Our implementation is based on bounded satisfiability (Fionda, Ielo, and Ricca 2024), obtaining AXps and CXps as unsatisfiable cores and correction sets of a logic program (Alviano et al. 2023). The underlying solver is based on SAT techniques (Liffton et al. 2016).
Answer Set Programming
An atom is an expression of the form where is a predicate, are terms (i.e., constants, integer numbers, strings or variables), and is known as arity of the predicate. A literal is either an atom or its negation not , where not denotes the negation as failure. A rule is an expression of the form where is an atom referred to as head, denoted by , that can also be omitted, , and is a conjunction of literals referred to as body, denoted by . In particular, a rule is said to be a constraint if its head is omitted, while it is said to be a fact if . A rule is safe if each variable appears at least in one positive literal in the body of . A program in ASP is a finite set of safe rules. Given a program , and , ground( ) is the set of ground instantiations of obtained by replacing variables in with constants in ; whereas ground( ) is the union of ground instantiations of rules in . Given a program , the Herbrand's base of , denoted by , is the set of atoms constructible from constants and predicate names occurring in . An interpretation for is a subset of , which is an answer set of if (i) is a model, i.e., for each rule either the head of is true wrt or the body of is false wrt ; and (ii) is a minimal model of its GL-reduct (Gelfond and Lifschitz 1991).
Minimal Unsatisfiable Subprograms. Consider a program and a set of objective atoms . For , enforce is the program obtained from by adding a choice over atoms in (i.e., , for ) and a set of constraints of the form: - not , for every . Intuitively, enforce augments the program in such a way that the objective atoms can be arbitrarily chosen (i.e. either as true or false) but the atoms in are enforced to be true. An unsatisfiable subset for wrt the set of objective atoms is a set of atoms such that enforce is incoherent (Alviano et al. 2023). US denotes the set of unsatisfiable subsets of wrt . An unsatisfiable subset is a minimal unsatisfiable subset (MUS) of wrt iff for every , . An answer set of is minimal wrt iff there exist no other answer set of such that (Alviano et al. 2023).
More details on ASP are available in (Gelfond and Lifschitz 1991; Brewka, Eiter, and Truszczynski 2011; Gebser et al. 2012; Lifschitz 2019).
Linear Temporal Logic on Finite Traces
Linear Temporal Logic on Finite Traces (LTL ) (De Giacomo and Vardi 2013) is a variant of Linear Temporal Logic (LTL) (Pnueli 1977) where the models, called traces, are assumed to be finite. An LTL formula over the alphabet A is defined according to the following grammar:
where X (“Next”) and U (“Until”) are temporal operators. Standard propositional boolean ( , , , , ), and temporal (e.g., Eventually F, Always G, Weak Next and Release R) shorthands are defined as usual. An interpretation is a finite trace , with . is the trace length, and is the -th state of . The satisfaction relation is defined inductively as follows:
is a model of if , denoted as . We denote by the set of models of , that is . The satisfiability problem for , i.e., deciding whether there exists a trace such that , is PSPACE-complete (De Giacomo and Vardi 2013). Complexity drops to NP-complete restricting the problem to traces of bounded length (Fionda and Greco 2018).
Formal Explanations
Let be a finite set of features. Each feature is associated to a finite domain . The corresponding feature space is the Cartesian product of the feature domains, . Each element is a total assignment of values to the features, with for every . We refer to such an assignment as an instance. A classifier is a total function , where is a finite set of class labels. Given and two instances , we say and are compatible in and write if, and only if, for every .
An explanation problem is a tuple , where is a classifier, is an instance, and is a class label such that . Two main types of formal explanations are in the literature: abductive (AXp) and contrastive (CXp) explanations. An abductive explanation for answers the question Why was class assigned to , while a contrastive explanation addresses the question Why was not assigned a class different from .
Weak Abductive Explanations (WAXp). We say that is a WAXp for if the following holds:
Weak Contrastive Explanations (WCXp). We say that is a WCXp for if the following holds:
Intuitively, an abductive explanation identifies a set of feature values that is sufficient to guarantee the prediction c, that is once the feature in X are fixed to the values they assume in , every compatible instance is still classified as c. Instead, a contrastive explanation identifies a set of features whose values can be changed to alter the prediction, that is, keeping all features outside Y fixed to the values in , there exists an assignment to the features in Y for which the classifier outputs a class different from c. Subset-minimal WAXp and WCXp are called abductive explanations (AXp) and contrastive explanations (CXp), respectively. AXps and CXps are related by hitting-set duality: every AXp is a minimal hitting set of the set of all CXps, and vice versa (Ignatiev et al. 2020).
AXp and CXp for LTL
In this section, we reformulate abductive and contrastive explanations for . In the rest of the paper, we fix a finite alphabet A and a trace length . We assume all traces are sequences in .
Notation. We adopt a set-based representation of traces based on temporal literals. Let denote the set of time-indexed atoms, where indicates that holds at time instant . The set of temporal literals is defined as . For every temporal literal , we denote by its underlying time-indexed atom, i.e., and . Similarly, denotes the opposite literal, that is, and . A set of temporal literals is said to be invalid if it contains both a literal and its complement, valid otherwise, and complete if, for every , exactly one of or belongs to . A trace is represented by the valid, complete set of temporal literals:
For instance, the violating trace of Figure 1, of length , is represented by . Given a set of temporal literals , two traces and are compatible on if they agree on every literal in , that is, . Accordingly, we define the set of all traces compatible with on as:
Intuitively, consists of all traces having the same length of that preserve the behavior of specified by E in terms of events happening (positive literals) and not happening (negative literals). Since E is not required to be complete, only the events explicitly described by its literals are fixed, while all remaining propositions at all time instants are left unconstrained.
Explanation problem. An explanation problem is a tuple , where is a trace and is an formula. We now reformulate weak abductive and weak contrastive explanations using the notation introduced above. Since , we focus on explanation settings such that without loss of generality. The complementary case is handled by replacing with . Intuitively, a set identifies the temporal literals that are locked, i.e., forced to retain the truth value they have in , while all literals outside are unlocked and free to change: is precisely the set of traces obtained by locking . An abductive explanation locks enough observations to make the violation unavoidable; a contrastive explanation unlocks enough observations to make satisfaction possible.
Definition 1 (WAXp). Let be an explanation problem. We say that is a WAXp for if: and
Definition 2 (WCXp). Let be an explanation problem. We say that is a WCXp for if: and
Definition 3 (AXp, CXp). Let be an explanation problem. A set is an AXp (resp. CXp) for if it is a WAXp (resp. WCXp) and no is a WAXp (resp. WCXp).
Example 1. Consider and from Figure 1. The set is an AXp for : locking is enough, since every trace of length 2 in which low holds at the last instant violates , regardless of all other observations; and is minimal, as the empty set is not a WAXp. Dually, is a CXp: unlocking these three literals admits a model of , where deliver is added at instant 0 and req, low are removed at instant 1, and no proper subset is a WCXp.
Equivalence to Classifier Explanations
In this section, we formalize the LTL -as-binary-classifier setting, establish a correspondence between classifier-based explanations and our reformulation, and prove that the two formulations are equivalent.
Encoding LTL Formulas as Binary Classifiers
Let be binary features, each with domain that is, we associate one Boolean feature with each time-indexed atom -and let . A trace is represented by the assignment defined by . We denote by the set of such assignments. Conversely, every assignment introduces a trace , that is .
Every LTL formula induces a binary classifier , defined by
As in the previous section, we restrict our attention to instances satisfying , since iff .
A set is a WAXp for if:
A set is a WCXp for if:
Both formulations use the same names; they are distinguished by their arguments, as a WAXp (WCXp) for is a set of features, whereas a WAXp (WCXp) for , as per Definitions 1 and 2, is a set of temporal literals. When needed, we call the former classifier-based and the latter trace-based.
To relate the two formulations, we introduce two mappings between sets of features and sets of temporal literals. Given a trace and a set of feature , we denote by the set of literals of over the features in , that is,
Conversely, for a set of temporal literals , we denote by feat(E) the corresponding set of features:
Observe that, by construction, for every trace and every , the following properties hold:
-
feat(lit ) = ;
-
, and
-
The equivalence proofs rely on the following observation: agreement between assignments corresponds to compatibility between the corresponding traces. More precisely, if two assignments agree on a set of features S, then the corresponding traces share the temporal literals in .
Proposition 1. Let be traces and let . Then
Proof. ( ) Assume that . By definition, . Hence, every temporal literal in belongs to both and . Since , every feature in is assigned the same truth value by and . Therefore, . ( ) Assume that . Then, for every feature , the assignments and are the same. Since , each literal in also belongs to . Thus, , which implies that .
Using Proposition 1, we can now prove the equivalence of the two notions of explanation. We start with WAXps.
Proposition 2. Let be an explanation problem such that , and let . Then is a WAXp for if and only if is a WAXp for .
Proof. ( ) Assume that is a WAXp for , and let . By Proposition 1, . Since , we obtain . Because is a WAXp, , which implies . Therefore, , and hence is a WAXp for . ( ) Assume that is a WAXp for . Let be such that . Let . Since , Proposition 1 implies that . Because is a WAXp for , . Hence , which proves that is a WAXp for .
An analogous correspondence holds for WCXp.
Proposition 3. Let be an explanation problem such that and let . Then is a WCXp for if and only if is a WCXp for .
Proof. ( ) Assume that is a WCXp for . Then there exists such that and . Let . By Proposition 1, that is equivalent to (property 3 above). Moreover, implies . Hence , which proves that is a WCXp for . ( ) Assume being a WCXp for . Then there exists . By property 3 above, . By Proposition 1, . Since (property 1), we have . Finally, implies , and thus is a WCXp for .
The previous propositions establish a bijective correspondence between the two formulations, i.e. each set that is a WAXp (WCXp, respectively) for can be decoded into the set that is a WAXp (WCXp, respectively) for . The result holds since and . Moreover, from the fact that both preserve subsets, we have that the statements also hold for AXp and CXp.
Corollary 1. Let be an explanation problem with . Then is an AXp (resp. CXp) for if and only if is an AXp (resp. CXp) for .
By AXp/CXp duality (Ignatiev et al. 2020) and since is an intersection- and inclusion-preserving bijection between and , the following result holds.
Corollary 2 (Duality). Let be an explanation problem with . Then every AXp for is a minimal hitting set of the set of all CXps for , and viceversa.
Relationship with Temporal Causality
Meng et al. (Meng and Alrajeh 2025) recently proposed a causality-based framework for explaining finite counterexamples to specifications. Their notion of explanation is based on Halpern's causality, that is a cause is a minimal set of interventions that transform a counterexample trace into a model of the specification. In this section we reformulate their framework using our notation and prove its formal relationship with our characterization of AXps and CXps.
Let be a trace, and let be a formula. A candidate causal set is a set . Given , the alteration trace is a trace obtained by replacing every literal of that occurs in with their opposite. More formally, if , then . A minimal cause for violation is defined as follows:
Definition 4 (Minimal cause for violation). Let be a trace and a formula with . A set is a minimal cause for violation of in counterexample if and no proper subset is such that .
Let denote the set of alteration traces obtained by intervening on over subsets of . The following lemma establishes the correspondence between alteration and compatible traces.
Lemma 1. Let be a trace and let . Then .
Proof. ( ) Let . Then there exists such that . By definition, . Since , every literal in is left unchanged. Hence, that implies . ( ) Let . Consider the set . Since we have that . Therefore, . Moreover, because the intervention flips exactly the literals on which and differ. Hence, .
Now we are ready to establish the relationships.
Proposition 4. A set is a minimal cause for the violation of if and only if is a CXp for .
Proof. ( ) Let be a minimal cause for violation of the formula in the counterexample trace . By definition, . By Lemma 1, . Since and , we have that . Hence, is a WCXp. Suppose that is not a CXp, then there exists a that is also a WCXp. By Lemma 1 , hence there exists such that . Since , this contradicts the minimality of . ( ) Let be a CXp (hence also a WCXp), so . By Lemma 1, , hence there exists with . Take such an that is subset-minimal (it exists, as is finite). Every also satisfies , hence \pi^X' \not\models \varphi by minimality of ; therefore is a minimal cause for violation. By direction ( ), is a CXp; since and is a CXp, subset-minimality gives . Therefore, is a minimal cause.
Unlike Meng and Alrajeh, our approach makes AXp/CXp duality explicit and enables efficient cause computation.
Complexity
We analyze the complexity of deciding whether a given set of temporal literals is a WAXp or WCXp. Trace length is fixed as part of the explanation setting and the decision problems amount to searching for models of formulas over traces of bounded length. This reduces the complexity of satisfiability from PSPACE-complete to NP-complete.
Proposition 5. Checking whether is a WCXp for an explanation problem is NP-complete.
Proof (Sketch). [Membership.] A certificate is a trace . One can check in polynomial time that both and . If both conditions hold, then and is a WCXp.
[Hardness.] Hardness is shown by a reduction from the Boolean satisfiability problem (Garey and Johnson 1979). Let be a CNF formula over the variables , and let be a fresh variable. Set and . We map to the instance where:
Note that , so contains every trace of length 1 over ; hence is a WCXp iff some length-1 trace satisfies . The conjunct ensures , so is a well-formed explanation problem.
(→) Let satisfy , and set . Then , so and is a WCXp. () Let be a WCXp, witnessed by . Since , we have ; the assignment iff satisfies .
The complexity of WAXp checking follows by duality. is a WAXp for if and only if no trace in satisfies , that is, is not a WCXp for . WAXp checking is thus the complement of WCXp checking, and Proposition 5 yields the following.
Corollary 3. Checking whether is a WAXp for an explanation problem is coNP-complete.
Given the coNP (resp. NP) complexity of checking whether a set is a WAXp (resp. WCXp), a deletion-based procedure that removes literals one by one computes an AXp (resp. CXp) with a polynomial (linear) number of oracle calls, which matches general results for AXps/CXps (Marques-Silva and Ignatiev 2022).
Next, we show that checking whether a set is an AXp (CXp) is DP-complete (coNP-complete) by reduction from MUS-checking (UNSAT) of a propositional formula. Let be an unsatisfiable propositional formula in 3-CNF with clauses , and let be fresh propositional symbols, one per clause. Set and . Over the alphabet , the formula is an formula and , with , is a trace of length one; since is unsatisfiable, . Keeping false forces to be satisfied through ; accordingly, we identify a set of clauses with the temporal literals . This yields the key correspondence: for every ,
Recall that is an MUS if is unsatisfiable and every proper subset is satisfiable; is a maximal satisfiable subset (MSS) if is satisfiable and is unsatisfiable for every ; and is an MCS if is an MSS, i.e., a minimal set of clauses whose removal restores satisfiability.
Proposition 6. S is an MUS of if and only if is an AXp for .
Proof. ( ) Let be an MUS. By (), unsatisfiable gives , so is a WAXp; and for every , satisfiable gives, again by (), that is not a WAXp. These are exactly the proper subsets of ; hence is an AXp. ( ) Symmetric, reading each implication of (*) in the opposite direction.
Proposition 7. Checking whether is an AXp for is DP-complete.
Proof. Membership. E is an AXp iff (a) E is a WAXp and (b) no is a WAXp. Condition (a) is in coNP (Corollary 3); (b) is in NP, as a certificate is, for some , a trace in . Hence the problem is in DP. Hardness. By Proposition 6, since MUS-checking is DP-hard (MINIMAL UNSATISFIABILITY; (Papadimitriou and Wolfe 1988; Marques-Silva, Janota, and Mencia 2017)).
Checking a CXp, on the other hand, is coNP-complete:
Proposition 8. Checking whether is a CXp for is coNP-complete.
Proof. [Membership.] By Proposition 4, is a CXp if and only if (a) and (b) for every . Condition (a) is a single model check on a fixed trace, feasible
Table 1: Per-instance AXp/CXp counts (top) and AXp/CXp explanation sizes in literals (bottom), by log. : instances (C=complete, T=timeout). Column refers to the -th quantile of the distributions, with P50 being the median. Max., min. refers to the maximum and minimum observed statistics.
| Log | N | AXp | CXp | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| C | T | Complete | Timeout | Complete | Timeout | |||||||||||||||||
| Min | P25 | P50 | P75 | Max | Min | P25 | P50 | P75 | Max | Min | P25 | P50 | P75 | Max | Min | P25 | P50 | P75 | Max | |||
| Per-instance counts | ||||||||||||||||||||||
| bpi2020-domdecl | 81 | 8 | 1 | 10 | 21 | 82 | 441 | 567 | 578 | 588 | 647 | 834 | 1 | 1 | 3 | 5 | 19 | 18 | 23 | 28 | 35 | 70 |
| bpi2020-intdecl | 181 | 552 | 6 | 54 | 83 | 193 | 621 | 81 | 186 | 249 | 344 | 784 | 4 | 19 | 38 | 62 | 220 | 0 | 9 | 38 | 91 | 908 |
| bpi2020-permlog | 312 | 1166 | 4 | 40 | 177 | 443 | 1087 | 80 | 294 | 426 | 597 | 1253 | 2 | 15 | 51 | 143 | 366 | 0 | 9 | 70 | 223 | 885 |
| bpi2020-prepcost | 180 | 18 | 1 | 16 | 43 | 155 | 797 | 323 | 432 | 508 | 591 | 754 | 1 | 2 | 4 | 7 | 26 | 6 | 14 | 17 | 21 | 36 |
| bpi2020-reqpay | 79 | 1 | 1 | 6 | 12 | 62 | 937 | 829 | 829 | 829 | 829 | 829 | 1 | 1 | 2 | 4 | 26 | 88 | 88 | 88 | 88 | 88 |
| sepsis | 220 | 624 | 1 | 13 | 24 | 110 | 618 | 43 | 216 | 326 | 435 | 931 | 2 | 18 | 50 | 121 | 415 | 0 | 26 | 96 | 192 | 725 |
| Explanation sizes | ||||||||||||||||||||||
| bpi2020-domdecl | 81 | 8 | 1 | 3 | 4 | 4 | 5 | 1 | 4 | 4 | 5 | 6 | 1 | 10 | 14 | 16 | 24 | 18 | 22 | 24 | 30 | 38 |
| bpi2020-intdecl | 181 | 552 | 1 | 4 | 6 | 7 | 10 | 1 | 7 | 8 | 10 | 29 | 2 | 10 | 14 | 16 | 22 | 6 | 14 | 18 | 20 | 40 |
| bpi2020-permlog | 312 | 1166 | 1 | 5 | 6 | 7 | 11 | 1 | 5 | 6 | 8 | 55 | 2 | 18 | 20 | 20 | 24 | 16 | 24 | 26 | 30 | 144 |
| bpi2020-prepcost | 180 | 18 | 1 | 3 | 4 | 4 | 6 | 1 | 4 | 4 | 4 | 6 | 1 | 14 | 18 | 20 | 30 | 20 | 24 | 24 | 26 | 36 |
| bpi2020-reqpay | 79 | 1 | 1 | 3 | 4 | 4 | 6 | 1 | 4 | 4 | 4 | 7 | 1 | 10 | 16 | 20 | 24 | 24 | 26 | 26 | 28 | 30 |
| sepsis | 220 | 624 | 1 | 5 | 6 | 7 | 11 | 1 | 7 | 9 | 10 | 54 | 1 | 10 | 12 | 14 | 22 | 4 | 14 | 16 | 18 | 50 |
in polynomial time (Fionda and Greco 2018). Condition (b) is in coNP since a counterexample is a set with , that can be checked in polynomial time.
[Hardness.] We reduce from UNSAT. Let be a CNF formula over . We assume w.l.o.g. that the all-true assignment does not satisfy , this can be checked in polynomial time, and if it does, we output a fixed instance that is not a CXp (e.g. any with ). Set with fresh, , , and . Since is false in , , so is a well-formed explanation problem. Let , we claim is a CXp for iff is unsatisfiable. Since sets every atom to true, : holds and the antecedent is false. By Proposition 4, is a CXp iff no proper subset satisfies ; we show this holds iff is unsatisfiable.
Suppose is unsatisfiable. Take any . If , then stays false and . If , then since is proper some stays false, so the antecedent holds and would require ; but is unsatisfiable, so no such exists. Hence no proper subset satisfies , and is a CXp.
Suppose is satisfiable. By the w.l.o.g. assumption, it has a model different from all-true. Let . Then , and . Thus a proper subset satisfies , and is not a CXp.
Computing AXps and CXps in ASP
We build upon the approach of (Fionda, Ielo, and Ricca 2026), that describes an Answer Set Programming (ASP) logic program , such that its stable models correspond one-to-one to traces such that and . is a typical guess-and-check ASP encoding, with a guess program that generates candidate traces, and a check program that discards traces that are not models of . More in detail, is a stratified logic program that evaluates the syntactic tree of in a bottom-up fashion over a guessed trace in , discarding answer sets that encode traces that are not models of .
We briefly describe the original encoding for bounded satisfiability.
Formulae & traces Consider a formula , and suppose each node in its syntax tree is assigned a unique integer. We can reify into ASP facts by means of predicates until/3, negate/2, conjunction/2, atomic/2, next/2, true/1, where the first term always refers to the unique identifier of the subformula and the other terms refer to identifiers of the most immediate subformulae (children). Predicate names are self-explanatory, and correspond to the given temporal/propositional operator.
Wlog, the root of is identified by 0. We denote this set of facts as . For example, the formula would be encoded as: until(0,1,2). negate(1,3). atomic(3,a). next(2,4). atomic(4,b). root(0).
A trace can be encoded by means of facts if , and if , where holds if , and if and . For example, the trace is encoded as: time (0..2). trace (0, a). trace (0, b). trace (2, c). We denote this set of facts as .
Semantics of temporal operators The ASP encoding of temporal operators makes use of predicates with signature holds/2, trace/2, and time/1. An atom holds(t, x) models that the subformula rooted in x is true at time t. The atom time(i) states that the trace has an i-th state, i.e. it has length at least i. The following logic program models the semantics of temporal operators:
holds(T,X) :- atomic(X,A), trace(T,A). holds(T,X) :- next(X,F), holds(T+1,F). holds(T,X) :- conjunction(X,_), time(T), holds(T,F): conjunction(X,F). holds(T,X) :- negate(X,F), time(T), not holds(T,F). holds(T,X) :- until(X,F,G), holds(T,G). holds(T,X) :- until(X,F,G), holds(T,F), holds(T+1,X).
sat :- holds(0,X), root(X).
Each rule closely mirrors the definition of the next normal form transformation of each temporal operator, so correctness follows from previous results (Fionda and Greco 2018); since this is a locally stratified logic program (Gebser et al. 2012), it admits a unique answer set containing sat iff .
Search for a model The above encoding evaluates the formula over a trace , so it is sufficient to replace the set of facts by some choice rules that generates all possible traces to lift it for checking bounded satisfiability. Consider the following logic program :
symbol(X) :- atomic(_,X). { lastInstant(T): T=0..k-1 } = 1. time(0..T) :- lastInstant(T). { trace(T,A): symbol(A) } :- time(T). :- not sat.
Above, k is a runtime CLINGO constant which denotes the search bounds. The first choice rule yields the length of the guessed trace, lastInstant/1, whereas the second one generates all possible states (given symbols that appear in ), for each time point, thus all possible traces of length up to k. The constraint discards traces which are not models of . If the above logic program is satisfiable, projecting answer sets on predicates trace/2, time/1 allows one to obtain satisfying traces.
Thus, for the purposes of our paper, we have that , and .
To apply our approach, we require to edit on , so that we fix the input trace as the unique model of the guess program. This is done as follows.
Let . The program containing a pair of rules of the form:
trace(t, a) :- not ntrace(t, a). ntrace(t, a) :- not trace(t, a).
for each , guesses the possible interventions on an input trace , that is an arbitrary trace of length by Lemma 1 with .
Let's introduce the set of constraints . Intuitively, these constraints lock certain events in the models of , playing the same role as .
Proposition 9. Let be a trace over , . Models of are in one-to-one correspondence with .
Proof (Sketch). By construction observing that generates and constraints in force the occurrence/absence of the temporal literals .
The logic program of the original encoding of (Fionda, Ielo, and Ricca 2024) models the satisfaction of , thus:
Proposition 10. Answer sets of are in one-to-one correspondence with traces in .
Note also that whenever , the program admits an unique model, that is the trace . Thus, if , we have that is incoherent. Consequently, it admits unsatisfiable cores and correction sets (Alviano et al. 2023). In particular, we are interested in MUSes and MCSes in terms of the constraints in .
Let be a set of fresh objective atoms. Let . Intuitively, each acts as a selector to include/exclude a constraint in , effectively locking certain temporal literals to assume the same value as in .
Proposition 11. Let . Let . We have that enforce( ) is incoherent if and only if is a WAXp.
Proof (Sketch). Follows from observing that including or excluding objective atoms in U respectively forces or forbids the corresponding temporal literals to match .
Notice this also implies the results holds for MUSes and AXps, since those are minimal unsatisfiable cores and minimal WAXps. The analogous for MCSes follows trivially from minimal hitting set dualities between MUSes/MCSes in ASP programs (Alviano et al. 2023), and AXps/CXps (Ignatiev et al. 2020):
Proposition 12. Let . Let . We have that enforce( ) is coherent if and only if is a WCXp.
Experiments
We evaluate the effectiveness of MUSes/MCSes enumeration for computing AXps and CXps of specifications.
Implementation. Our implementation is a Python script that parses explanation problems of the form into a logic program, and then applies the MARCO (Liffton et al. 2016) algorithm for ASP (Alviano et al. 2023), to jointly enumerate MUSes (AXps) and MCSes (CXps). We use the clingo (Gebser et al. 2019) ASP solver.
Execution Environment. Experiments were run on a machine equipped with a 13th Gen Intel(R) Core(TM) i7-13700 CPU and 32 GB of RAM, with 16 physical cores and 24 logical CPUs, running Ubuntu 22.04. In the experiments, we set a CPU-time limit of 10 seconds, a wall-clock timeout of 20 seconds, and a memory limit of 2 GB of RAM.
Data. Our benchmark is built from Declare (van der Aalst, Pesic, and Schonenberg 2009), a declarative process modeling language based on a set of templates whose semantics is given in . In this setting, process discovery algorithms learn Declare models—that one can translate in formulas—from event logs, i.e., multi-sets of traces recording real process executions. We choose Declare because it is a major application of and, to the best of our knowledge, the only domain providing both real-world traces and formulas that are learned from data rather than hand-crafted. We consider a collection of 6 real-world event logs (from the BPI Challenge 2020 (van Dongen 2020), and the Sepsis event log (Mannhardt and Blinde 2017)). For each event log, we learn a Declare model using the Declare4Py library (Donadello et al. 2022), which we translate into an LTL formula . For each variant (i.e., unique trace) in the event log, we generate one explanation problem: when , and when . We obtain a total of 3467 explanation problems, and we discard 45 where the corresponding LTL formula is incoherent—which would admit a single (empty) AXp and no CXps. This yields a total of 3422 instances.
Results. Table 1 reports statistics on the number, size of AXps and CXps found by our approach, partitioned by corresponding event log. Top-half reports the number of AXps/CXps found; bottom-half their size. We distinguish between complete instances, where enumeration terminates and incomplete instances where it does not terminate . The approach is effective, as in a short timeout we are able to complete about 30% of the instances, while on the remaining incomplete instances we are still able to output several CXps and AXps, with a few exceptions (155) where we find zero CXps. However, this is due to the fact that the enumeration algorithm jointly enumerates CXps and AXps, and those instances contain a large amount of AXps. Additionally, we report no memory out errors, and an average (median) time-to-first AXp of (0.09s) and an average time-to-first CXp of (0.41s).
Comparison with Meng and Alrajeh (2025). The only existing tool that can compute our CXps is caupybara (Meng and Alrajeh 2025), which computes causes (equivalent to CXps) by brute-force. Candidate sets of increasing size (up to a user-provided upper bound on size) are enumerated, and checked for being a cause. As one may notice in Table 1, CXps of large size are not unlikely in real-world event logs. Thus, it is expected the approach scales poorly, as the size of causes increases. We highlight this limitation with a synthetic formula. Let , , and , where the final empty state ensures the last weak next is not trivially satisfied. Every conjunct is violated, so , and the instance has exactly AXps of size 2 (each pairing the presence of with the absence of ) and, by hitting-set duality, CXps of size . Altering the trace to satisfy must satisfy each , choosing for each whether to remove or add . Thus, one needs to enumerate up to . Note that the conjunct is not a “pathological” formula, but a rather common specification pattern in specifications (“every time happens, either the trace concludes or happens next”). In particular, this is known as Chain Response in Declare (with a strong next replacing the weak).
Figure 2 reports the time to compute one and all CXps as N grows, under the same 10-second budget as before, with caupybara run at bound = N. caupybara exceeds the budget beyond N=4, even for a single CXp. Our approach, instead, manages to enumerate all CXps up to N=12, while also computing AXps. A CXp-only variant of our approach (enumerating minimal stable models (Alviano et al. 2023))

Figure 2: Time to the first and to all CXps on , , for caupybara, our full approach, and a CXp-only variant. Dashed: first CXp; solid: all CXps. 10 seconds timeout.
to obtain MCSes/CXps, rather than applying MARCO-style joint MUS/MCS enumeration) matches caupybara's task exactly, and finds a first CXp in under 0.1s, but performs worse in enumeration, completing only up to N=10, overall slowing down in the CXp enumeration task.
Conclusion
In this paper, we specialize abductive and contrastive explanations to . We provide an idiomatic definition that side-steps the classifier view the original definitions require, prove the two equivalent, and prove contrastive explanations equivalent to a recently-proposed notion of temporal causality. This characterization lets us enumerate explanations efficiently by exploiting MUS-MCS duality, which we instantiate in Answer Set Programming. Experiments show the approach is effective on real-world event logs.
References
Alviano, M.; Dodaro, C.; Fiorentino, S.; Previti, A.; and Ricca, F. 2023. ASP and subset minimality: Enumeration, cautious reasoning and MUSes. Artif. Intell., 320: 103931.
Bacchus, F.; and Kabanza, F. 1998. Planning for temporally extended goals. Annals of Mathematics and Artificial Intelligence, 22: 5–27.
Beer, I.; Ben-David, S.; Chockler, H.; Orni, A.; and Trefler, R. J. 2009. Explaining Counterexamples Using Causality. In CAV, volume 5643 of Lecture Notes in Computer Science, 94–108. Springer.
Brewka, G.; Eiter, T.; and Truszczynski, M. 2011. Answer set programming at a glance. Commun. ACM, 54(12): 92–103.
Chiariello, F.; and Marques-Silva, J. 2025. Formal Explanations of Black-Box Ranking Functions. In JELIA (1), volume 16093 of Lecture Notes in Computer Science, 28–44. Springer.
Darwiche, A.; and Hirth, A. 2023. On the (Complete) Reasons Behind Decisions. J. Log. Lang. Inf., 32(1): 63–88.
De Giacomo, G.; De Masellis, R.; Grasso, M.; Maggi, F. M.; and Montali, M. 2014. Monitoring business metaconstraints based on LTL and LDL for finite traces. In Business
MARCO is an anytime algorithm, outputs AXps/CXps as soon as they are found, and terminates when all CXps/AXps are found.
Process Management: 12th International Conference, 1–17. Springer.
De Giacomo, G.; Iocchi, L.; Favorito, M.; and Patrizi, F. 2019. Foundations for restraining bolts: Reinforcement learning with LTLf/LDLf restraining specifications. In Proceedings of the international conference on automated planning and scheduling, volume 29, 128–136.
De Giacomo, G.; and Rubin, S. 2018. Automata-Theoretic Foundations of FOND Planning for LTLf and LDLf Goals. In Proc. of IJCAI, 4729–4735.
De Giacomo, G.; and Vardi, M. Y. 2013. Linear Temporal Logic and Linear Dynamic Logic on Finite Traces. In IJCAI, 854–860.
Donadello, I.; Riva, F.; Maggi, F. M.; and Shikhizada, A. 2022. Declare4Py: A Python Library for Declarative Process Mining. BPM (PhD/Demos), 3216: 117–121.
Ferrère, T.; Maler, O.; and Ničković, D. 2015. Trace diagnostics using temporal implicants. In International Symposium on Automated Technology for Verification and Analysis, 241–258. Springer.
Fionda, V.; and Greco, G. 2018. LTL on Finite and Process Traces: Complexity Results and a Practical Reasoner. J. Artif. Intell. Res., 63: 557–623.
Fionda, V.; Ielo, A.; and Ricca, F. 2024. LTLf2ASP: LTLf Bounded Satisfiability in ASP. In LPNMR, volume 15245 of Lecture Notes in Computer Science, 373–386. Springer.
Fionda, V.; Ielo, A.; and Ricca, F. 2026. Computing Syntax Tree-based Minimal Unsatisfiable Cores of LTLf Formulas. In AAAI, 19073–19081. AAAI Press.
Garey, M. R.; and Johnson, D. S. 1979. Computers and Intractability: A Guide to the Theory of NP-Completeness (Series of Books in the Mathematical Sciences). W. H. Freeman.
Gebser, M.; Kaminski, R.; Kaufmann, B.; and Schaub, T. 2012. Answer Set Solving in Practice. Synthesis Lectures on Artificial Intelligence and Machine Learning. Morgan & Claypool Publishers.
Gebser, M.; Kaminski, R.; Kaufmann, B.; and Schaub, T. 2019. Multi-shot ASP solving with clingo. Theory Pract. Log. Program., 19(1): 27–82.
Gelfond, M.; and Lifschitz, V. 1991. Classical Negation in Logic Programs and Disjunctive Databases. New Gener. Comput., 9(3/4): 365–386.
Granada, J. C.; Ignatiev, A.; and Stuckey, P. J. 2026. A Formal Framework for the Explanation of Finite Automata Decisions. CoRR, abs/2602.13351.
Guidotti, R.; Monreale, A.; Ruggieri, S.; Turini, F.; Giannotti, F.; and Pedreschi, D. 2019. A Survey of Methods for Explaining Black Box Models. ACM Comput. Surv., 51(5): 93:1–93:42.
Halpern, J. Y. 2016. Actual Causality. MIT Press.
Ielo, A.; Mazzotta, G.; Peñaloza, R.; and Ricca, F. 2026. Enumerating Minimal Unsatisfiable Cores of LTLf Formulae. In AAAI, 19160–19168. AAAI Press.
Ignatiev, A.; Narodytska, N.; Asher, N.; and Marques-Silva, J. 2020. From Contrastive to Abductive Explanations and Back Again. In AI*IA, volume 12414 of Lecture Notes in Computer Science, 335–355. Springer.
Ignatiev, A.; Narodytska, N.; and Marques-Silva, J. 2019. Abduction-Based Explanations for Machine Learning Models. In AAAI, 1511–1519. AAAI Press.
Kress-Gazit, H.; Fainekos, G. E.; and Pappas, G. J. 2009. Temporal-logic-based reactive mission and motion planning. IEEE transactions on robotics, 25(6): 1370–1381.
Liffiton, M. H.; Previti, A.; Malik, A.; and Marques-Silva, J. 2016. Fast, flexible MUS enumeration. Constraints An Int. J., 21(2): 223–250.
Liffiton, M. H.; and Sakallah, K. A. 2008. Algorithms for Computing Minimal Unsatisfiable Subsets of Constraints. J. Autom. Reason., 40(1): 1–33.
Lifschitz, V. 2019. Answer Set Programming. Springer.
Mannhardt, F.; and Blinde, D. 2017. Analyzing the Trajectories of Patients with Sepsis using Process Mining. In RADAR+EMISA@CAiSE, volume 1859 of CEUR Workshop Proceedings, 72–80. CEUR-WS.org.
Marques-Silva, J.; and Ignatiev, A. 2022. Delivering Trustworthy AI through Formal XAI. In AAAI, 12342–12350. AAAI Press.
Marques-Silva, J.; Janota, M.; and Mencía, C. 2017. Minimal sets on propositional formulae. Problems and reductions. Artif. Intell., 252: 22–50.
Meng, H.; and Alrajeh, D. 2025. Causal Detection in Linear Temporal Counterexamples. In Proceedings of the 33rd ACM International Conference on the Foundations of Software Engineering, 1418–1423.
Niu, T.; Xiao, S.; Zhang, X.; Li, J.; Huang, Y.; and Shi, J. 2024. Computing minimal unsatisfiable core for LTL over finite traces. J. Log. Comput., 34(7): 1274–1294.
Papadimitriou, C. H.; and Wolfe, D. 1988. The Complexity of Facets Resolved. J. Comput. Syst. Sci., 37(1): 2–13.
Pnueli, A. 1977. The Temporal Logic of Programs. In 18th Annual Symposium on Foundations of Computer Science, Providence, Rhode Island, USA, 31 October - 1 November 1977, 46–57. IEEE Computer Society.
Reiter, R. 1987. A theory of diagnosis from first principles. Artificial intelligence, 32(1): 57–95.
Roveri, M.; Ciccio, C. D.; Francescomarino, C. D.; and Ghidini, C. 2024. Computing Unsatisfiable Cores for LTLf Specifications. J. Artif. Intell. Res., 80: 517–558.
Shih, A.; Choi, A.; and Darwiche, A. 2018. A Symbolic Approach to Explaining Bayesian Network Classifiers. In IJCAI, 5103–5111. ijcai.org.
van der Aalst, W. M. P.; Pesic, M.; and Schonenberg, H. 2009. Declarative workflows: Balancing between flexibility and support. Comput. Sci. Res. Dev., 23(2): 99–113.
van Dongen, B. F. 2020. BPI Challenge 2020. Dataset.