betaFeedback

WorksComputer Science

Formal Explanations for Linear Temporal Logic over Finite Traces

Abstract

Linear Temporal Logic over Finite Traces (LTLf) 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 LTLf. 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.

Figure 1

Figure 1. AXps (sufficient reasons) and CXps (minimal outcome-flipping interventions) for φ\varphi on a compliant trace π1\pi_1 and a violating trace π2\pi_2. Sets are listed state by state; e.g. {},{low}\{\},\{low\} denotes {low1}\{low_1\}.

Introduction

Linear Temporal Logic over Finite Traces [10] (LTLf\textsf{LTL}_f) is a popular formalism for temporal reasoning in AI. It has been successfully applied to several domains, such as reinforcement learning [8], planning [2, 9], robotics [26] and business process management [40, 7].

In applications, LTLf\textsf{LTL}_f 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 π\pi satisfies a formula φ\varphi, we say that π\pi 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 φ=G (req→F deliver)∧G (low→X charge),\varphi = \textsf{G}\ (\mathit{req} \rightarrow \textsf{F}\ \mathit{deliver}) \wedge \textsf{G}\ (\mathit{low} \rightarrow \textsf{X}\ \mathit{charge}), which requires every request to be eventually served and every low-battery to be immediately followed by charging. The trace π1\pi_1 (of Figure 1) satisfies φ\varphi, 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 π1\pi_1, the absence of low\mathit{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\mathit{low} to the first time instant of π\pi not followed by charge\mathit{charge} turns it into a violating trace. Conversely, π2\pi_2 violates φ\varphi: here a sufficient reason guarantees the violation (e.g., knowing only that low\mathit{low} holds at the second time instant and charge\mathit{charge} is absent at the third time instant makes every trace agreeing with these two observations violate φ\varphi), 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) [25, 39]: 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 [24, 37], which also supports effective enumeration algorithms [27]. In principle, an LTLf\textsf{LTL}_f 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 LTLf\textsf{LTL}_f is missing. Existing approaches capture either sufficient reasons for satisfaction [12] or counterfactual causes of violation [33], 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 LTLf\textsf{LTL}_f specifications, directly over finite traces; (ii) we prove that this characterization is equivalent to the classifier-based one, establish the hitting-set duality between AXps and CXps for LTLf\textsf{LTL}_f, and show that CXps coincide with the temporal causes of [33] 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) [19, 4], and evaluate it on real-world event logs.

Formal Explanations.

Our work instantiates the general framework of abductive and contrastive explanations [39, 25, 24, 6] in the setting of LTLf\textsf{LTL}_f. However, the standard formulation treats the object being explained as a classifier over features. While this viewpoint is formally applicable to LTLf\textsf{LTL}_f, it is not natural for temporal-logic practitioners. We therefore provide an equivalent characterization stated directly in terms of LTLf\textsf{LTL}_f formulas and finite traces. Similar specializations have been developed for settings in which the object being explained is not naturally represented as a classifier, such as ranking functions [5] and finite-state machines [20]. Our work follows the same direction by providing a specialization for LTLf\textsf{LTL}_f formulas.

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 [24]. In LTL, temporal implicants have only been studied under infinite-trace semantics [12], 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 [33] proposes a revised version of cause for LTLf\textsf{LTL}_f, specializing the Halpern’s [22]. It extends earlier works [3] 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 [28, 32] are at the base of our implementation. LTLf\textsf{LTL}_f admits notions of unsatisfiable cores [38], whose computation has been the focus of recent works [38, 34, 15, 23]. 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 [21, 31]. Our implementation is based on bounded LTLf\textsf{LTL}_f satisfiability [14], obtaining AXps and CXps as unsatisfiable cores and correction sets of a logic program [1]. The underlying solver is based on SAT techniques [27].

Answer Set Programming

An atom is an expression of the form p(t1,…,tn)p(t_1,\ldots,t_n) where pp is a predicate, t1,…,tnt_1,\ldots,t_n are terms (i.e., constants, integer numbers, strings or variables), and nn is known as arity of the predicate. A literal is either an atom aa or its negation nota\mathop{not}a, where not\mathop{not} denotes the negation as failure. A rule rr is an expression of the form h←b1,…,bnh \leftarrow b_1,\ldots,b_n where hh is an atom referred to as head, denoted by HrH_r, that can also be omitted, n≥0n\geq 0, and b1,…,bnb_1,\ldots,b_n is a conjunction of literals referred to as body, denoted by BrB_r. In particular, a rule is said to be a constraint if its head is omitted, while it is said to be a fact if n=0n=0. A rule rr is safe if each variable appears at least in one positive literal in the body of rr. A program in ASP is a finite set of safe rules. Given a program PP, and r∈Pr \in P, ground(r)ground(r) is the set of ground instantiations of rr obtained by replacing variables in rr with constants in PP; whereas ground(P)ground(P) is the union of ground instantiations of rules in PP. Given a program PP, the Herbrand’s base of PP, denoted by BP\mathcal{B}_P, is the set of atoms constructible from constants and predicate names occurring in PP. An interpretation II for PP is a subset of BP\mathcal{B}_P, which is an answer set of PP if (i) II is a model, i.e., for each rule r∈ground(P)r \in ground(P) either the head of rr is true wrt II or the body of rr is false wrt II; and (ii) II is a minimal model of its GL-reduct [19].

Minimal Unsatisfiable Subprograms.

Consider a program PP and a set of objective atoms O⊆BPO \subseteq \mathcal{B}_P. For S⊆OS \subseteq O, enforce(P,O,S)\text{enforce}(P,O,S) is the program obtained from PP by adding a choice over atoms in OO (i.e., oi:- noio_i \texttt{:- } no_i noi:- oino_i \texttt{:- } o_i, for i∈[1,n]i\in [1,n]) and a set of constraints of the form :- noto\texttt{:- } \mathop{not}o, for every o∈So \in S. Intuitively, enforce(P,O,S)\text{enforce}(P,O,S) augments the program PP in such a way that the objective atoms can be arbitrarily chosen (i.e. either as true or false) but the atoms in SS are enforced to be true. An unsatisfiable subset for PP wrt the set of objective atoms OO is a set of atoms U⊆OU \subseteq O such that enforce(P,O,U)\text{enforce}(P,O,U) is incoherent [1]. US(P,O)US(P,O) denotes the set of unsatisfiable subsets of PP wrt OO. An unsatisfiable subset U∈US(P,O)U \in US(P,O) is a minimal unsatisfiable subset (MUS) of PP wrt OO iff for every U′⊂UU' \subset U, U′∉US(P,O)U' \notin US(P,O). An answer set MM of PP is minimal wrt O⊂BPO \subset \mathcal{B_P} iff there exist no other answer set M′M' of PP such that (M∩O)⊂(M′∩O)(M \cap O) \subset (M' \cap O) [1].

More details on ASP are available in [19, 4, 17, 29].

Linear Temporal Logic on Finite Traces

Linear Temporal Logic on Finite Traces (LTLf\textsf{LTL}_f) [10] is a variant of Linear Temporal Logic (LTL\text{LTL}) [36] where the models, called traces, are assumed to be finite. An LTLf{\textsf{LTL}_f} formula over the alphabet A\mathcal{A} is defined according to the following grammar:

φ::=a∈A∣¬φ∣φ∧φ∣X φ∣φ U φ\varphi ::= a \in \mathcal{A}\mid \lnot \varphi \mid \varphi \land \varphi \mid \textsf{X}\ \varphi \mid \varphi \ \textsf{U}\ \varphi

where X \textsf{X}\ (“Next”) and  U \ \textsf{U}\ (“Until”) are temporal operators. Standard propositional boolean (∨\lor, →\rightarrow, ↔\leftrightarrow, ⊤\top, ⊥\bot), and temporal (e.g., Eventually F, Always G, Weak Next Xw_w and Release R) shorthands are defined as usual. An interpretation is a finite trace π=π0π1⋯πn−1\pi = \pi_0 \pi_1 \cdots \pi_{n-1}, with πi⊆A\pi_i \subseteq \mathcal{A}. ∣π∣=n|\pi| = n is the trace length, and π(i)=πi\pi(i) = \pi_i is the ii-th state of π\pi. The satisfaction relation π,i⊨φ\pi, i \models \varphi is defined inductively as follows:

  • π,i⊨a\pi, i \models a iff a∈π(i)a \in \pi(i)

  • π,i⊨¬φ\pi, i \models \lnot \varphi iff π,i⊭φ\pi, i \not\models \varphi

  • π,i⊨φ∧ψ\pi, i \models \varphi \land \psi iff π,i⊨φ\pi, i \models \varphi and π,i⊨ψ\pi, i \models \psi

  • π,i⊨X φ\pi, i \models \textsf{X}\ \varphi iff i+1<∣π∣i+1 < |\pi| and π,i+1⊨φ\pi, i+1 \models \varphi

  • π,i⊨φ U ψ\pi, i \models \varphi \ \textsf{U}\ \psi iff there exists kk with i≤k<∣π∣i \le k < |\pi| such that π,k⊨ψ\pi, k \models \psi and for all jj with i≤j<ki \le j < k, π,j⊨φ\pi, j \models \varphi

π\pi is a model of φ\varphi if π,0⊨φ\pi, 0 \models \varphi, denoted as π⊨φ\pi \models \varphi. We denote by Mod(φ)\mathsf{Mod}(\varphi) the set of models of φ\varphi, that is Mod(φ)={π∈(2A)∗:π⊨φ}\mathsf{Mod}(\varphi )= \{\pi \in (2^\mathcal{A})^*: \pi\models\varphi\}. The satisfiability problem for LTLf\textsf{LTL}_f, i.e., deciding whether there exists a trace π\pi such that π⊨φ\pi \models \varphi, is PSPACE-complete [10]. Complexity drops to NP-complete restricting the problem to traces of bounded length [13].

Formal Explanations

Let F\mathcal{F} be a finite set of features. Each feature i∈Fi \in \mathcal{F} is associated to a finite domain DiD_i. The corresponding feature space F\mathbb{F} is the Cartesian product of the feature domains, F=∏i∈FDi\mathbb{F} = \prod_{i \in \mathcal{F}} D_i. Each element α∈F\alpha \in \mathbb{F} is a total assignment of values to the features, with α(i)∈Di\alpha(i) \in D_i for every i∈Fi \in \mathcal{F}. We refer to such an assignment as an instance. A classifier is a total function f:F↦Kf: \mathbb{F} \mapsto \mathcal{K}, where K\mathcal{K} is a finite set of class labels. Given S⊆F\mathcal{S} \subseteq \mathcal{F} and two instances α,β∈F\alpha,\beta \in \mathbb{F}, we say α\alpha and β\beta are compatible in S\mathcal{S} and write α≡Sβ\alpha \equiv_{\mathcal{S}} \beta if, and only if, α(i)=β(i) for every i∈S.\alpha(i)=\beta(i) \text{ for every } i \in \mathcal{S}.

An explanation problem is a tuple (f,α,c)(f,\alpha,c), where f:F↦Kf: \mathbb{F} \mapsto \mathcal{K} is a classifier, α∈F\alpha \in \mathbb{F} is an instance, and c∈Kc \in \mathcal{K} is a class label such that f(α)=cf(\alpha)=c. Two main types of formal explanations are in the literature: abductive (AXp) and contrastive (CXp) explanations. An abductive explanation for (f,α,c)(f,\alpha,c) answers the question Why was class cc assigned to α\alpha?, while a contrastive explanation addresses the question Why was α\alpha not assigned a class different from cc?.

Weak Abductive Explanations (WAXp).

We say that X⊆F\mathcal{X} \subseteq \mathcal{F} is a WAXp for (f,α,c)(f,\alpha,c) if the following holds:

∀β∈F. β≡Xα  ⟹  f(β)=c\forall \beta \in \mathbb{F}.\ \beta \equiv_{\mathcal{X}} \alpha \implies f(\beta) = c
Weak Contrastive Explanations (WCXp).

We say that Y⊆F\mathcal{Y} \subseteq \mathcal{F} is a WCXp for (f,α,c)(f,\alpha,c) if the following holds:

∃β∈F. β≡F∖Yα∧f(β)≠c\exists \beta \in \mathbb{F}.\ \beta \equiv_{\mathcal{F}\setminus\mathcal{Y}} \alpha \land f(\beta) \ne c

Intuitively, an abductive explanation identifies a set of feature values that is sufficient to guarantee the prediction cc, that is once the feature in X\mathcal{X} are fixed to the values they assume in α\alpha, every compatible instance is still classified as cc. 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\mathcal{Y} fixed to the values in α\alpha, there exists an assignment to the features in Y\mathcal{Y} for which the classifier outputs a class different from cc. 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 [24].

AXp and CXp for LTLf\textsf{LTL}_f

In this section, we reformulate abductive and contrastive explanations for LTLf\textsf{LTL}_f. In the rest of the paper, we fix a finite alphabet A\mathcal{A} and a trace length n∈Nn \in \mathbb{N}. We assume all traces are sequences in (2A)n(2^\mathcal{A})^n.

Notation. We adopt a set-based representation of traces based on temporal literals. Let Vars={ai:a∈A, 0≤i<n}\mathsf{Vars}= \{a_i : a \in \mathcal{A},\ 0 \le i < n\} denote the set of time-indexed atoms, where aia_i indicates that aa holds at time instant ii. The set of temporal literals is defined as Lits=⋃ai∈Vars{ai,¬ai}.\mathsf{Lits}= \bigcup_{a_i \in \mathsf{Vars}} \{a_i, \lnot a_i\}. For every temporal literal ℓ∈Lits\ell \in \mathsf{Lits}, we denote by var(ℓ)\mathsf{var}(\ell) its underlying time-indexed atom, i.e., var(ai)=ai\mathsf{var}(a_i)=a_i and var(¬ai)=ai\mathsf{var}(\lnot a_i)=a_i. Similarly, ℓ‾\overline{\ell} denotes the opposite literal, that is, ai‾=¬ai\overline{a_i}=\lnot a_i and ¬ai‾=ai\overline{\lnot a_i}=a_i. A set of temporal literals E⊆LitsE \subseteq \mathsf{Lits} is said to be invalid if it contains both a literal and its complement, valid otherwise, and complete if, for every ai∈Varsa_i \in \mathsf{Vars}, exactly one of aia_i or ¬ai\lnot a_i belongs to EE. A trace π\pi is represented by the valid, complete set of temporal literals:

L(π)=⋃i({ai:a∈π(i)}∪{¬ai:a∉π(i)}).\mathsf{L}(\pi) = \bigcup_i\left(\{a_i: a \in \pi(i)\} \cup \{\lnot a_i: a\not\in \pi(i)\}\right).

For instance, the violating trace π2\pi_2 of Figure 1, of length n=2n=2, is represented by L(π2)={req0,req1,low1}∪{¬deliver0,¬low0,¬charge0,¬deliver1,¬charge1}\mathsf{L}(\pi_2) = \{\mathit{req}_0, \mathit{req}_1, \mathit{low}_1\} \cup \{\lnot\mathit{deliver}_0, \lnot\mathit{low}_0, \lnot\mathit{charge}_0, \lnot\mathit{deliver}_1, \lnot\mathit{charge}_1\}. Given a set of temporal literals EE, two traces π\pi and τ\tau are compatible on EE if they agree on every literal in EE, that is, E⊆L(π)∩L(τ)E \subseteq \mathsf{L}(\pi) \cap \mathsf{L}(\tau). Accordingly, we define the set of all traces compatible with π\pi on EE as:

Compπ(E)={τ∈(2A)∣π∣:E⊆L(π)∩L(τ)}.\mathsf{Comp}_{\pi}(E) = \{\tau \in (2^\mathcal{A})^{|\pi|}: E \subseteq \mathsf{L}(\pi) \cap \mathsf{L}(\tau)\}.

Intuitively, Compπ(E)\mathsf{Comp}_{\pi}(E) consists of all traces having the same length of π\pi that preserve the behavior of π\pi specified by EE in terms of events happening (positive literals) and not happening (negative literals). Since EE 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 (π,φ)(\pi,\varphi), where π∈(2A)n\pi \in (2^\mathcal{A})^n is a trace and φ\varphi is an LTLf\textsf{LTL}_f formula. We now reformulate weak abductive and weak contrastive explanations using the notation introduced above. Since π⊭φ⇔π⊨¬φ\pi\not\models\varphi \Leftrightarrow \pi\models\lnot\varphi, we focus on explanation settings (π,φ)(\pi,\varphi) such that π⊭φ\pi\not\models\varphi without loss of generality. The complementary case is handled by replacing φ\varphi with ¬φ\neg\varphi. Intuitively, a set E⊆L(π)E \subseteq \mathsf{L}(\pi) identifies the temporal literals that are locked, i.e., forced to retain the truth value they have in π\pi, while all literals outside EE are unlocked and free to change: Compπ(E)\mathsf{Comp}_{\pi}(E) is precisely the set of traces obtained by locking EE. An abductive explanation locks enough observations to make the violation unavoidable; a contrastive explanation unlocks enough observations to make satisfaction possible.

Equivalence to Classifier Explanations

In this section, we formalize the LTLf\textsf{LTL}_f-as-binary-classifier setting, establish a correspondence between classifier-based explanations and our reformulation, and prove that the two formulations are equivalent.

Encoding LTLf\textsf{LTL}_f Formulas as Binary Classifiers

Let F=Vars\mathcal{F} = \mathsf{Vars} be binary features, each with domain {⊥,⊤}\{\bot, \top\}–that is, we associate one Boolean feature with each time-indexed atom aia_i–and let K={0,1}\mathcal{K} = \{0, 1\}. A trace π∈(2A)n\pi \in (2^\mathcal{A})^n is represented by the assignment απ\alpha_{\pi} defined by απ(ai)=⊤⇔a∈π(i)\alpha_{\pi}(a_i) = \top \Leftrightarrow a \in \pi(i). We denote by F\mathbb{F} the set of such assignments. Conversely, every assignment α∈F\alpha \in \mathbb{F} introduces a trace πα\pi_{\alpha}, that is πα(i)={a∈A:α(ai)=⊤}\pi_{\alpha}(i) = \{a \in \mathcal{A}: \alpha(a_i) = \top\}.

Every LTLf\textsf{LTL}_f formula φ\varphi induces a binary classifier fφ:F↦{0,1}f_\varphi: \mathbb{F} \mapsto \{0,1\}, defined by

fφ(α)={1if πα⊨φ,0otherwise.f_\varphi(\alpha)= \begin{cases} 1 & \text{if }\pi_{\alpha}\models\varphi,\\ 0 & \text{otherwise.} \end{cases}

As in the previous section, we restrict our attention to instances satisfying fφ(απ)=0f_\varphi(\alpha_{\pi})=0, since π⊭φ\pi\not\models\varphi iff π⊨¬φ\pi\models\neg\varphi.

A set X⊆F\mathcal{X} \subseteq \mathcal{F} is a WAXp for fφ(απ)=0f_\varphi(\alpha_{\pi}) = 0 if:

∀(α∈F). α≡Xαπ  ⟹  fφ(α)=0.\forall(\alpha \in \mathbb{F}).\ \alpha \equiv_{\mathcal{X}} \alpha_{\pi} \implies f_\varphi(\alpha) = 0.

A set Y⊆F\mathcal{Y} \subseteq \mathcal{F} is a WCXp for fφ(απ)=0f_\varphi(\alpha_{\pi}) = 0 if:

∃(α∈F). α≡F∖Yαπ ∧fφ(α)=1.\exists(\alpha \in \mathbb{F}).\ \alpha \equiv_{\mathcal{F}\setminus\mathcal{Y}} \alpha_{\pi}\ \land f_\varphi(\alpha) = 1.

Both formulations use the same names; they are distinguished by their arguments, as a WAXp (WCXp) for fφ(απ)=0f_\varphi(\alpha_{\pi})=0 is a set of features, whereas a WAXp (WCXp) for (π,φ)(\pi,\varphi), as per Definitions def:waxp and def:wcxp, 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 π\pi and a set of feature S⊆F\mathcal{S} \subseteq \mathcal{F}, we denote by litπ(S)\mathsf{lit}_{\pi}(\mathcal{S}) the set of literals of π\pi over the features in S\mathcal{S}, that is,

litπ(S)={ℓ∈L(π):var(ℓ)∈S}.\mathsf{lit}_{\pi}(\mathcal{S}) = \{\ell \in \mathsf{L}(\pi): \mathsf{var}(\ell) \in \mathcal{S}\}.

Conversely, for a set of temporal literals E⊆L(π)E\subseteq\mathsf{L}(\pi), we denote by feat(E)\mathsf{feat}(E) the corresponding set of features:

feat(E)={var(ℓ):ℓ∈E}.\mathsf{feat}(E) = \{\mathsf{var}(\ell): \ell \in E\}.

Observe that, by construction, for every trace π\pi and every S⊆F\mathcal S\subseteq\mathcal F, the following properties hold:

  1. feat(litπ(S))=S\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{S})) = \mathcal{S};

  2. litπ(feat(E))=E\mathsf{lit}_{\pi}(\mathsf{feat}(E)) = E, and

  3. L(π)∖litπ(S)=litπ(F∖S).\mathsf{L}(\pi)\setminus\mathsf{lit}_{\pi}(\mathcal S)=\mathsf{lit}_{\pi}(\mathcal F\setminus\mathcal S).

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\mathcal{S}, then the corresponding traces share the temporal literals in litπ(S)\mathsf{lit}_{\pi}(\mathcal S).

Proof. (→)(\rightarrow) Assume that τ∈Compπ(E)\tau \in \mathsf{Comp}_{\pi}(E). By definition, E⊆L(π)∩L(τ)E \subseteq \mathsf{L}(\pi)\cap\mathsf{L}(\tau). Hence, every temporal literal in EE belongs to both L(π)\mathsf{L}(\pi) and L(τ)\mathsf{L}(\tau). Since E⊆L(π)E \subseteq \mathsf{L}(\pi), every feature in feat(E)\mathsf{feat}(E) is assigned the same truth value by απ\alpha_{\pi} and ατ\alpha_{\tau}. Therefore, ατ≡feat(E)απ\alpha_{\tau} \equiv_{\mathsf{feat}(E)} \alpha_{\pi}. (←)(\leftarrow) Assume that ατ≡feat(E)απ\alpha_{\tau} \equiv_{\mathsf{feat}(E)} \alpha_{\pi}. Then, for every feature ai∈feat(E)a_i \in \mathsf{feat}(E), the assignments απ\alpha_{\pi} and ατ\alpha_{\tau} are the same. Since E⊆L(π)E \subseteq \mathsf{L}(\pi), each literal in EE also belongs to L(τ)\mathsf{L}(\tau). Thus, E⊆L(π)∩L(τ)E \subseteq \mathsf{L}(\pi)\cap\mathsf{L}(\tau), which implies that τ∈Compπ(E)\tau \in \mathsf{Comp}_{\pi}(E). ◻

Using Proposition prop:compat-agreement, we can now prove the equivalence of the two notions of explanation. We start with WAXps.

Proof. (→)(\rightarrow) Assume that X\mathcal{X} is a WAXp for fφ(απ)=0f_\varphi(\alpha_{\pi})=0, and let τ∈Compπ(litπ(X))\tau\in\mathsf{Comp}_{\pi}(\mathsf{lit}_{\pi}(\mathcal{X})). By Proposition prop:compat-agreement, ατ≡feat(litπ(X))απ\alpha_{\tau} \equiv_{\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{X}))} \alpha_{\pi}. Since feat(litπ(X))=X\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{X}))=\mathcal{X}, we obtain ατ≡Xαπ\alpha_{\tau} \equiv_{\mathcal{X}} \alpha_{\pi}. Because X\mathcal{X} is a WAXp, fφ(ατ)=0f_\varphi(\alpha_{\tau})=0, which implies τ⊭φ\tau\not\models\varphi. Therefore, Compπ(litπ(X))∩Mod(φ)=∅\mathsf{Comp}_{\pi}(\mathsf{lit}_{\pi}(\mathcal{X}))\cap\mathsf{Mod}(\varphi)=\emptyset, and hence litπ(X)\mathsf{lit}_{\pi}(\mathcal{X}) is a WAXp for (π,φ)(\pi,\varphi). (←)(\leftarrow) Assume that litπ(X)\mathsf{lit}_{\pi}(\mathcal{X}) is a WAXp for (π,φ)(\pi,\varphi). Let α∈F\alpha\in\mathbb{F} be such that α≡Xαπ\alpha \equiv_{\mathcal{X}} \alpha_{\pi}. Let τ=πα\tau=\pi_{\alpha}. Since feat(litπ(X))=X\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{X})) = \mathcal{X}, Proposition prop:compat-agreement implies that τ∈Compπ(litπ(X))\tau\in\mathsf{Comp}_{\pi}(\mathsf{lit}_{\pi}(\mathcal{X})). Because litπ(X)\mathsf{lit}_{\pi}(\mathcal{X}) is a WAXp for (π,φ)(\pi,\varphi), τ⊭φ\tau\not\models\varphi. Hence fφ(α)=0f_\varphi(\alpha)=0, which proves that X\mathcal{X} is a WAXp for fφ(απ)=0f_\varphi(\alpha_{\pi})=0. ◻

An analogous correspondence holds for WCXp.

Proof. (→)(\rightarrow) Assume that Y\mathcal{Y} is a WCXp for fφ(απ)=0f_\varphi(\alpha_{\pi}) = 0. Then there exists α∈F\alpha \in \mathbb{F} such that α≡F∖Yαπ\alpha \equiv_{\mathcal{F}\setminus\mathcal{Y}} \alpha_{\pi} and fφ(α)=1f_\varphi(\alpha)=1. Let τ=πα\tau=\pi_{\alpha}. By Proposition prop:compat-agreement, τ∈Compπ(litπ(F∖Y))\tau \in \mathsf{Comp}_{\pi}(\mathsf{lit}_{\pi}(\mathcal{F}\setminus\mathcal{Y})) that is equivalent to τ∈Compπ(L(π)∖litπ(Y))\tau\in\mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus\mathsf{lit}_{\pi}(\mathcal{Y})) (property 3 above). Moreover, fφ(α)=1f_\varphi(\alpha)=1 implies τ⊨φ\tau\models\varphi. Hence Compπ(L(π)∖litπ(Y))∩Mod(φ)≠∅\mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus\mathsf{lit}_{\pi}(\mathcal{Y}))\cap\mathsf{Mod}(\varphi)\ne\emptyset, which proves that litπ(Y)\mathsf{lit}_{\pi}(\mathcal{Y}) is a WCXp for (π,φ)(\pi,\varphi). (←)(\leftarrow) Assume litπ(Y)\mathsf{lit}_{\pi}(\mathcal{Y}) being a WCXp for (π,φ)(\pi,\varphi). Then there exists τ∈Compπ(L(π)∖litπ(Y))∩Mod(φ)\tau \in \mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus\mathsf{lit}_{\pi}(\mathcal{Y}))\cap\mathsf{Mod}(\varphi). By property 3 above, τ∈Compπ(litπ(F∖Y))\tau\in\mathsf{Comp}_{\pi}(\mathsf{lit}_{\pi}(\mathcal{F}\setminus\mathcal{Y})). By Proposition prop:compat-agreement, ατ≡feat(litπ(F∖Y))απ\alpha_{\tau} \equiv_{\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{F}\setminus\mathcal{Y}))} \alpha_{\pi}. Since feat(litπ(F∖Y))=F∖Y\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{F}\setminus\mathcal{Y}))=\mathcal{F}\setminus\mathcal{Y} (property 1), we have ατ≡F∖Yαπ\alpha_{\tau} \equiv_{\mathcal{F}\setminus\mathcal{Y}} \alpha_{\pi}. Finally, τ⊨φ\tau\models\varphi implies fφ(ατ)=1f_\varphi(\alpha_{\tau})=1, and thus Y\mathcal{Y} is a WCXp for fφ(απ)=0f_\varphi(\alpha_{\pi})=0. ◻

The previous propositions establish a bijective correspondence between the two formulations, i.e. each set E⊆L(π)E \subseteq \mathsf{L}(\pi) that is a WAXp (WCXp, respectively) for (π,φ)(\pi,\varphi) can be decoded into the set feat(E)⊆F\mathsf{feat}(E) \subseteq \mathcal{F} that is a WAXp (WCXp, respectively) for fφ(απ)=0f_\varphi(\alpha_{\pi})=0. The result holds since feat(litπ(S))=S\mathsf{feat}(\mathsf{lit}_{\pi}(\mathcal{S}))=\mathcal{S} and litπ(feat(E))=E\mathsf{lit}_{\pi}(\mathsf{feat}(E))=E. Moreover, from the fact that both preserve subsets, we have that the statements also hold for AXp and CXp.

By AXp/CXp duality [24] and since litπ(⋅)\mathsf{lit}_{\pi}(\cdot) is an intersection- and inclusion-preserving bijection between F\mathcal{F} and L(π)\mathsf{L}(\pi), the following result holds.

Relationship with Temporal Causality

Meng et al. [33] recently proposed a causality-based framework for explaining finite counterexamples to LTLf\textsf{LTL}_f 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 π\pi be a trace, and let φ\varphi be a formula. A candidate causal set is a set C⊆L(π)C \subseteq \mathsf{L}(\pi). Given C⊆L(π)C \subseteq \mathsf{L}(\pi), the alteration trace πC\pi^C is a trace obtained by replacing every literal of π\pi that occurs in CC with their opposite. More formally, if C⊆L(π)C \subseteq \mathsf{L}(\pi), then L(πC)=(L(π)∖C)∪C‾\mathsf{L}(\pi^C) = (\mathsf{L}(\pi) \setminus C) \cup \overline{C}. A minimal cause for violation is defined as follows:

Let Altπ(C)={πX:X⊆C}Alt_\pi(C) = \{\pi^X: X \subseteq C\} denote the set of alteration traces obtained by intervening on π\pi over subsets of CC. The following lemma establishes the correspondence between alteration and compatible traces.

Proof. (→)(\rightarrow) Let τ∈Altπ(L(π)∖E)\tau \in Alt_\pi(\mathsf{L}(\pi) \setminus E). Then there exists X⊆L(π)∖EX \subseteq \mathsf{L}(\pi) \setminus E such that τ=πX\tau = \pi^X. By definition, L(τ)=L(πX)=(L(π)∖X)∪X‾\mathsf{L}(\tau) = \mathsf{L}(\pi^X) = (\mathsf{L}(\pi) \setminus X) \cup \overline{X}. Since X∩E=∅X\cap E=\emptyset, every literal in EE is left unchanged. Hence, E⊆L(π)∩L(τ)E \subseteq \mathsf{L}(\pi)\cap \mathsf{L}(\tau) that implies τ∈Compπ(E)\tau \in \mathsf{Comp}_{\pi}(E). (←)(\leftarrow) Let τ∈Compπ(E)\tau \in \mathsf{Comp}_{\pi}(E). Consider the set X=L(π)∖L(τ)X = \mathsf{L}(\pi) \setminus \mathsf{L}(\tau). Since E⊆L(π)∩L(τ)E\subseteq \mathsf{L}(\pi)\cap\mathsf{L}(\tau) we have that X∩E=∅X\cap E=\emptyset. Therefore, X⊆L(π)∖EX \subseteq \mathsf{L}(\pi) \setminus E. Moreover, τ=πX\tau = \pi^X because the intervention flips exactly the literals on which π\pi and τ\tau differ. Hence, τ∈Altπ(L(π)∖E)\tau \in Alt_\pi(\mathsf{L}(\pi) \setminus E). ◻

Now we are ready to establish the relationships.

Proof. (→)(\rightarrow) Let CC be a minimal cause for violation of the formula φ\varphi in the counterexample trace π\pi. By definition, πC⊨φ\pi^C \models \varphi. By Lemma lemma:tc, Altπ(C)=Compπ(L(π)∖C)Alt_\pi(C) = \mathsf{Comp}_{\pi}(\mathsf{L}(\pi) \setminus C). Since πC∈Altπ(C)\pi^C \in Alt_\pi(C) and πC⊨φ\pi^C \models \varphi, we have that Compπ(L(π)∖C)∩Mod(φ)≠∅\mathsf{Comp}_{\pi}(\mathsf{L}(\pi) \setminus C)\cap \mathsf{Mod}(\varphi)\neq\emptyset. Hence, CC is a WCXp. Suppose that CC is not a CXp, then there exists a C′⊂CC'\subset C that is also a WCXp. By Lemma lemma:tc Altπ(C′)=Compπ(L(π)∖C′)Alt_\pi(C') = \mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus C'), hence there exists X⊆C′X\subseteq C' such that πX⊨φ\pi^{X}\models \varphi. Since X⊆C′⊂CX\subseteq C'\subset C, this contradicts the minimality of CC. (←)(\leftarrow) Let CC be a CXp (hence also a WCXp), so Compπ(L(π)∖C)∩Mod(φ)≠∅\mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus C)\cap\mathsf{Mod}(\varphi)\neq\emptyset. By Lemma lemma:tc, Compπ(L(π)∖C)=Altπ(C)\mathsf{Comp}_{\pi}(\mathsf{L}(\pi) \setminus C) = Alt_\pi(C), hence there exists X⊆CX \subseteq C with πX⊨φ\pi^X \models \varphi. Take such an XX that is subset-minimal (it exists, as L(π)\mathsf{L}(\pi) is finite). Every X′⊂XX' \subset X also satisfies X′⊆CX' \subseteq C, hence πX′⊭φ\pi^{X'} \not\models \varphi by minimality of XX; therefore XX is a minimal cause for violation. By direction (→)(\rightarrow), XX is a CXp; since X⊆CX \subseteq C and CC is a CXp, subset-minimality gives X=CX = C. Therefore, CC is a minimal cause. ◻

Unlike [33], our approach makes AXp/CXp duality explicit and enables efficient cause computation.

NNAXpCXp
CompleteTimeoutCompleteTimeout
LogCTMinP25P50P75MaxMinP25P50P75MaxMinP25P50P75MaxMinP25P50P75Max
Per-instance counts
bpi2020-domdecl81811021824415675785886478341135191823283570
bpi2020-intdecl18155265483193621811862493447844193862220093891908
bpi2020-permlog31211664401774431087802944265971253215511433660970223885
bpi2020-prepcost1801811643155797323432508591754124726614172136
bpi2020-reqpay7911612629378298298298298291124268888888888
sepsis22062411324110618432163264359312185012141502696192725
Explanation sizes
bpi2020-domdecl81813445144561101416241822243038
bpi2020-intdecl1815521467101781029210141622614182040
bpi2020-permlog312116615671115685521820202416242630144
bpi2020-prepcost1801813446144461141820302024242636
bpi2020-reqpay79113446144471101620242426262830
sepsis2206241567111791054110121422414161850

Table 1. Per-instance AXp/CXp counts (top) and AXp/CXp explanation sizes in literals (bottom), by log. NN: instances (C=complete, T=timeout). Column PxPx refers to the xx-th quantile of the distributions, with P50 being the median. Max., min. refers to the maximum and minimum observed statistics.

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 LTLf\textsf{LTL}_f formulas over traces of bounded length. This reduces the complexity of satisfiability from PSPACE-complete to NP-complete.

Proof (Sketch). [Membership.] A certificate is a trace τ∈(2A)∣π∣\tau\in (2^\mathcal{A})^{|\pi|}. One can check in polynomial time that both τ∈Compπ(L(π)∖E)\tau \in \mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus E) and τ⊨φ\tau \models \varphi. If both conditions hold, then Compπ(L(π)∖E)∩Mod(φ)≠∅\mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus E)\cap\mathsf{Mod}(\varphi)\neq\emptyset and EE is a WCXp.

[Hardness.] Hardness is shown by a reduction from the Boolean satisfiability problem [16]. Let ϕ\phi be a CNF formula over the variables X={x1,...,xn}X=\{x_1,...,x_n\}, and let q∉Xq\not\in X be a fresh variable. Set A=X∪{q}\mathcal{A}=X\cup\{q\} and ∣π∣=1|\pi|=1. We map ϕ\phi to the instance (π,φ,E)(\pi,\varphi,E) where:

φ=q∧ϕ,π(0)=∅,E=L(π).\varphi = q\land \phi, \qquad \pi(0)=\emptyset, \qquad E=\mathsf{L}(\pi).

Note that L(π)∖E=∅\mathsf{L}(\pi)\setminus E=\emptyset, so Compπ(∅)\mathsf{Comp}_{\pi}(\emptyset) contains every trace of length 11 over A\mathcal{A}; hence EE is a WCXp iff some length-11 trace satisfies φ\varphi. The conjunct qq ensures π⊭φ\pi\not\models\varphi, so (π,φ)(\pi,\varphi) is a well-formed explanation problem.

(→\rightarrow) Let MM satisfy ϕ\phi, and set τ(0)={xi∣M(xi)=true}∪{q}\tau(0)=\{x_i\mid M(x_i)=\text{true}\}\cup\{q\}. Then τ⊨q∧ϕ\tau\models q\land\phi, so Compπ(L(π)∖E)∩Mod(φ)≠∅\mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus E)\cap\mathsf{Mod}(\varphi)\neq\emptyset and EE is a WCXp. (←\leftarrow) Let EE be a WCXp, witnessed by τ∈Compπ(L(π)∖E)∩Mod(φ)\tau\in\mathsf{Comp}_{\pi}(\mathsf{L}(\pi)\setminus E)\cap\mathsf{Mod}(\varphi). Since φ=q∧ϕ\varphi=q\land\phi, we have τ⊨ϕ\tau\models\phi; the assignment M(xi)=trueM(x_i)=\text{true} iff xi∈τ(0)x_i\in\tau(0) satisfies ϕ\phi. ◻

The complexity of WAXp checking follows by duality. E⊆L(π)E\subseteq\mathsf{L}(\pi) is a WAXp for (π,φ)(\pi,\varphi) if and only if no trace in Compπ(E)\mathsf{Comp}_{\pi}(E) satisfies φ\varphi, that is, L(π)∖E\mathsf{L}(\pi)\setminus E is not a WCXp for (π,φ)(\pi,\varphi). WAXp checking is thus the complement of WCXp checking, and Proposition prop:wcxp-np yields the following.

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 [31].

Next, we show that checking whether a set EE is an AXp (CXp) is DP-complete (coNP-complete) by reduction from MUS-checking (UNSAT) of a propositional formula. Let ϕ\phi be an unsatisfiable propositional formula in 3-CNF with clauses c1,…,cmc_1,\dots,c_m, and let R={r1,…,rm}R=\{r_1,\dots,r_m\} be fresh propositional symbols, one per clause. Set ci′=ri∨cic'_i = r_i \lor c_i and ϕ′=⋀i=1mci′\phi' = \bigwedge_{i=1}^{m} c'_i. Over the alphabet A=vars(ϕ)∪R\mathcal{A}= \mathrm{vars}(\phi)\cup R, the formula ϕ′\phi' is an LTLf\textsf{LTL}_f formula and π\pi, with π(0)=∅\pi(0)=\emptyset, is a trace of length one; since ϕ\phi is unsatisfiable, π⊭ϕ′\pi\not\models\phi'. Keeping rir_i false forces ci′c'_i to be satisfied through cic_i; accordingly, we identify a set of clauses S⊆{c1,…,cm}S\subseteq\{c_1,\dots,c_m\} with the temporal literals λ(S)={¬ri:ci∈S}⊆L(π)\lambda(S) = \{\lnot r_i : c_i\in S\}\subseteq\mathsf{L}(\pi). This yields the key correspondence: for every S⊆{c1,…,cm}S\subseteq\{c_1,\dots,c_m\},

Compπ(λ(S))∩Mod(ϕ′)≠∅  ⟺  ⋀ci∈Sci is satisfiable.(∗)\mathsf{Comp}_{\pi}(\lambda(S))\cap\mathsf{Mod}(\phi')\neq\emptyset \iff \textstyle\bigwedge_{c_i\in S} c_i \text{ is satisfiable.}(\ast)

Recall that S⊆ϕS\subseteq\phi is an MUS if SS is unsatisfiable and every proper subset is satisfiable; SS is a maximal satisfiable subset (MSS) if SS is satisfiable and S∪{c}S\cup\{c\} is unsatisfiable for every c∈ϕ∖Sc\in\phi\setminus S; and SS is an MCS if ϕ∖S\phi\setminus S is an MSS, i.e., a minimal set of clauses whose removal restores satisfiability.

Proof. (→)(\rightarrow) Let SS be an MUS. By (∗)(\ast), SS unsatisfiable gives Compπ(λ(S))∩Mod(ϕ′)=∅\mathsf{Comp}_{\pi}(\lambda(S))\cap\mathsf{Mod}(\phi')=\emptyset, so λ(S)\lambda(S) is a WAXp; and for every S′⊂SS'\subset S, S′S' satisfiable gives, again by (∗)(\ast), that λ(S′)\lambda(S') is not a WAXp. These λ(S′)\lambda(S') are exactly the proper subsets of λ(S)\lambda(S); hence λ(S)\lambda(S) is an AXp. (←)(\leftarrow) Symmetric, reading each implication of (∗)(\ast) in the opposite direction. ◻

Proof. Membership. EE is an AXp iff (a) EE is a WAXp and (b) no E∖{e}E\setminus\{e\} is a WAXp. Condition (a) is in coNP (Corollary prop:waxp-conp); (b) is in NP, as a certificate is, for some e∈Ee\in E, a trace in Compπ(E∖{e})∩Mod(φ)\mathsf{Comp}_{\pi}(E\setminus\{e\})\cap\mathsf{Mod}(\varphi). Hence the problem is in DP. Hardness. By Proposition prop:mus-axp, since MUS-checking is DP-hard (MINIMAL UNSATISFIABILITY; [35, 32]). ◻

Checking a CXp, on the other hand, is coNP-complete:

Proof. [Membership.] By Proposition prop:causes, CC is a CXp if and only if (a) πC⊨φ\pi^C \models \varphi and (b) πC′⊭φ\pi^{C'} \not\models \varphi for every C′⊂CC' \subset C. Condition (a) is a single model check on a fixed trace, feasible in polynomial time [13]. Condition (b) is in coNP since a counterexample is a set C′⊂CC' \subset C with πC′⊨φ\pi^{C'} \models \varphi, that can be checked in polynomial time.

[Hardness.] We reduce from UNSAT. Let ϕ\phi be a CNF formula over X={x1,…,xk}X=\{x_1,\dots,x_k\}. We assume w.l.o.g. that the all-true assignment does not satisfy ϕ\phi, this can be checked in polynomial time, and if it does, we output a fixed instance that is not a CXp (e.g. any (π,φ)(\pi,\varphi) with π⊨φ\pi\models\varphi). Set A=X∪{q}\mathcal{A}= X\cup\{q\} with qq fresh, ∣π∣=1|\pi|=1, π(0)=∅\pi(0)=\emptyset, and ψ=q∧(¬(x1∧⋯∧xk)→ϕ)\psi = q \land \big(\lnot(x_1\land\dots\land x_k)\rightarrow\phi\big). Since qq is false in π\pi, π⊭ψ\pi\not\models\psi, so (π,ψ)(\pi,\psi) is a well-formed explanation problem. Let C=L(π)C=\mathsf{L}(\pi), we claim CC is a CXp for (π,ψ)(\pi,\psi) iff ϕ\phi is unsatisfiable. Since πC\pi^C sets every atom to true, πC⊨ψ\pi^C\models\psi: qq holds and the antecedent ¬(⋀ixi)\lnot(\bigwedge_i x_i) is false. By Proposition prop:causes, CC is a CXp iff no proper subset X′⊂CX'\subset C satisfies πX′⊨ψ\pi^{X'}\models\psi; we show this holds iff ϕ\phi is unsatisfiable.

(→)(\rightarrow) Suppose ϕ\phi is unsatisfiable. Take any X′⊂CX'\subset C. If q∉X′q\notin X', then qq stays false and πX′⊭ψ\pi^{X'}\not\models\psi. If q∈X′q\in X', then since X′X' is proper some xix_i stays false, so the antecedent ¬(⋀ixi)\lnot(\bigwedge_i x_i) holds and πX′⊨ψ\pi^{X'}\models\psi would require πX′⊨ϕ\pi^{X'}\models\phi; but ϕ\phi is unsatisfiable, so no such X′X' exists. Hence no proper subset satisfies ψ\psi, and CC is a CXp.

(←)(\leftarrow) Suppose ϕ\phi is satisfiable. By the w.l.o.g. assumption, it has a model MM different from all-true. Let X′={q}∪{xi:M(xi)=true}X'=\{q\}\cup\{x_i : M(x_i)= true\}. Then X′⊂CX'\subset C, and πX′⊨ψ\pi^{X'}\models\psi. Thus a proper subset satisfies ψ\psi, and CC is not a CXp. ◻

Computing AXps and CXps in ASP

We build upon the approach of [15], that describes an Answer Set Programming (ASP) logic program Πk(φ)\Pi^k(\varphi), such that its stable models correspond one-to-one to traces π\pi such that ∣π∣≤k|\pi| \le k and π⊨φ\pi\models\varphi. Πk(φ)\Pi^k(\varphi) is a typical guess-and-check ASP encoding, with a guess program ΠGk(φ)\Pi^k_G(\varphi) that generates candidate traces, and a check program ΠCk(φ)\Pi^k_C(\varphi) that discards traces that are not models of φ\varphi. More in detail, ΠCk(φ)\Pi^k_C(\varphi) is a stratified logic program that evaluates the syntactic tree of φ\varphi in a bottom-up fashion over a guessed trace in ΠGk(A)\Pi^k_G(\mathcal{A}), discarding answer sets that encode traces that are not models of φ\varphi.

We briefly describe the original encoding for bounded LTLf\textsf{LTL}_f satisfiability.

Formulae & traces

Consider a formula φ\varphi, and suppose each node in its syntax tree is assigned a unique integer. We can reify φ\varphi into ASP facts by means of predicates until/3until/3, negate/2negate/2, conjunction/2conjunction/2, atomic/2atomic/2, next/2next/2, true/1true/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 φ\varphi is identified by 0. We denote this set of facts as [φ][\varphi]. For example, the formula ¬aU(Xb)\lnot a {\textsf{U}}({\textsf{X}} b) would be encoded as: until(0,1,2). negate(1,3). atomic(3,a). next(2,4). atomic(4,b). root(0).

A trace π\pi can be encoded by means of facts trace(t,a)trace(t,a) if a∈σta \in \sigma_t, and time(t)time(t) if t<∣π∣t < |\pi|, where trace(t,a)trace(t,a) holds if a∈π(t)a \in \pi(t), and time(i)time(i) if ∣π∣=k|\pi| = k and 0≤i≤k−10 \le i \le k-1. For example, the trace {a,b}⋅{}⋅{c}\{a,b\}\cdot\{\}\cdot\{c\} is encoded as: time(0..2). trace(0,a). trace(0,b). trace(2,c). We denote this set of facts as [π][\pi].

Semantics of temporal operators

The ASP encoding of temporal operators makes use of predicates with signature holds/2holds/2, trace/2trace/2, and time/1time/1. An atom holds(t,x)holds(t,x) models that the subformula rooted in xx is true at time tt. The atom time(i)time(i) states that the trace has an ii-th state, i.e. it has length at least ii. The following logic program ΠLTLf\Pi_{LTLf} 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 [13]; since this is a locally stratified logic program [17], it admits a unique answer set containing satsat iff π⊨φ\pi \models \varphi.

Search for a model

The above encoding evaluates the formula φ\varphi over a trace π\pi, so it is sufficient to replace the set of facts [π][\pi] by some choice rules that generates all possible traces to lift it for checking bounded satisfiability. Consider the following logic program ΠSearchk\Pi_{Search}^k:

symbol(X) :- atomic(_,X).
{ last_instant(T): T=0..k-1 } = 1.
time(0..T) :- last_instant(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, last_instant/1last\_instant/1, whereas the second one generates all possible states (given symbols that appear in φ\varphi), for each time point, thus all possible traces of length up to kk. The constraint discards traces which are not models of φ\varphi. If the above logic program is satisfiable, projecting answer sets on predicates trace/2trace/2, time/1time/1 allows one to obtain satisfying traces.

Thus, for the purposes of our paper, we have that ΠGk(φ)=ΠSearchk\Pi^k_G(\varphi) = \Pi^k_{Search}, and ΠCk(φ)=[φ]∪ΠLTLf\Pi^k_C(\varphi) = [\varphi] \cup \Pi_{LTLf}.

To apply our approach, we require to edit on ΠGk(φ)\Pi^k_G(\varphi), so that we fix the input trace π\pi as the unique model of the guess program. This is done as follows.

Let π∈(2A)t\pi \in (2^\mathcal{A})^t. The program G(π)G(\pi) containing a pair of rules of the form:

    trace(t,a) :- not ntrace(t,a).
    ntrace(t,a) :- not trace(t,a).

for each (a,t)∈A×{0,…,∣π∣−1}(a, t) \in \mathcal{A} \times \{0, \dots, |\pi|-1\}, guesses the possible interventions on an input trace π\pi, that is an arbitrary trace of length kk by Lemma lemma:tc with E=∅E=\emptyset.

Let’s introduce the set of constraints C(S)={:- not trace(t,a):at∈S}∪{:- not ntrace(t,a):¬at∈S}C(S) = \{\texttt{:- not trace(t,}a\texttt{)}: a_t \in S\} \cup \{\texttt{:- not ntrace(t,}a\texttt{)}: \lnot a_t \in S\}. Intuitively, these constraints lock certain events in the models of G(π)G(\pi), playing the same role as Compπ(⋅)\mathsf{Comp}_{\pi}(\cdot).

Proof (Sketch).. By construction observing that G(π)G(\pi) generates (2A)t(2^\mathcal{A})^t and constraints in C(S)C(S) force the occurrence/absence of the temporal literals ℓt∈S\ell_t \in S. ◻

The logic program ΠCk(φ)\Pi^k_C(\varphi) of the original encoding of [14] models the satisfaction of φ\varphi, thus:

Note also that whenever S=L(π)S = \mathsf{L}(\pi), the program G(π)∪C(S)G(\pi) \cup C(S) admits an unique model, that is the trace π\pi. Thus, if π⊭φ\pi\not\models\varphi, we have that G(π)∪C(L(π))∪ΠCk(φ)G(\pi) \cup C(\mathsf{L}(\pi)) \cup \Pi^k_C(\varphi) is incoherent. Consequently, it admits unsatisfiable cores and correction sets [1]. In particular, we are interested in MUSes and MCSes in terms of the constraints in C(S)C(S).

Let O={o(t,a):a∈A,0≤t<∣π∣}O = \{o(t,a): a \in \mathcal{A}, 0 \le t < |\pi|\} be a set of fresh objective atoms. Let C∗(S)={:- o(t,a), not trace(t,a):at∈S}∪{:- o(t,a), not ntrace(t,a):¬at∈S}C^*(S) = \{\texttt{:- o(t,a), not trace(t,}a\texttt{)}: a_t \in S\} \cup \{\texttt{:- o(t,a), not ntrace(t,}a\texttt{)}: \lnot a_t \in S\}. Intuitively, each o(t,a)∈Oo(t,a) \in O acts as a selector to include/exclude a constraint in C(S)C(S), effectively locking certain temporal literals to assume the same value as in π\pi.

Proof (Sketch).. Follows from observing that including or excluding objective atoms in UU respectively forces or forbids the corresponding temporal literals to match π\pi. ◻

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 [1], and AXps/CXps [24]:

Experiments

We evaluate the effectiveness of MUSes/MCSes enumeration for computing AXps and CXps of LTLf\textsf{LTL}_f specifications.

Implementation.

Our implementation is a Python script that parses explanation problems of the form (π,φ)(\pi,\varphi) into a logic program, and then applies the MARCO [27] algorithm for ASP [1], to jointly enumerate MUSes (AXps) and MCSes (CXps). We use the clingo [18] 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 [40], a declarative process modeling language based on a set of templates whose semantics is given in LTLf\textsf{LTL}_f. In this setting, process discovery algorithms learn Declare models—that one can translate in LTLf\textsf{LTL}_f formulas—from event logs, i.e., multi-sets of traces recording real process executions. We choose Declare because it is a major application of LTLf\textsf{LTL}_f and, to the best of our knowledge, the only domain providing both real-world traces and LTLf\textsf{LTL}_f 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 [41], and the Sepsis event log [30]). For each event log, we learn a Declare model using the Declare4Py library [11], which we translate into an LTLf\textsf{LTL}_f formula φ\varphi. For each variant π\pi (i.e., unique trace) in the event log, we generate one explanation problem: (π,φ)(\pi,\varphi) when π⊭φ\pi\not\models\varphi, and (π,¬φ)(\pi,\lnot\varphi) when π⊨φ\pi\models\varphi. We obtain a total of 34673467 explanation problems, and we discard 45 where the corresponding LTLf\textsf{LTL}_f 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 terminate1. 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.091±0.0320.091 \pm 0.032s (0.09s) and an average time-to-first CXp of 1.05±1.581.05 \pm 1.58s (0.41s).

Comparison with [33].

The only existing tool that can compute our CXps is caupybara [33], 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 p(i)=G (ai→Xw  bi)p(i) = \textsf{G}\ (a_i \rightarrow \textsf{X}_w\ \, b_i), P(N)=⋀i=1Np(i)P(N) = \bigwedge_{i=1}^{N} p(i), and τN={a1}{a2}⋯{aN}{}\tau_N = \{a_1\}\{a_2\}\cdots\{a_N\}\{\}, where the final empty state ensures the last weak next is not trivially satisfied. Every conjunct p(i)p(i) is violated, so τN⊭P(N)\tau_N \not\models P(N), and the instance has exactly NN AXps of size 2 (each pairing the presence of aia_i with the absence of bib_i) and, by hitting-set duality, 2N2^N CXps of size NN. Altering the trace to satisfy P(N)P(N) must satisfy each p(i)p(i), choosing for each ii whether to remove aia_i or add bib_i. Thus, one needs to enumerate up to NN. Note that the conjunct p(i)p(i) is not a “pathological” formula, but a rather common specification pattern in LTLf\textsf{LTL}_f specifications (“every time aia_i happens, either the trace concludes or bib_i 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 NN grows, under the same 10-second budget as before, with caupybara run at bound=N\mathit{bound}=N. caupybara exceeds the budget beyond N=4N{=}4, even for a single CXp. Our approach, instead, manages to enumerate all CXps up to N=12N{=}12, while also computing AXps. A CXp-only variant of our approach (enumerating minimal stable models [1] 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.10.1s, but performs worse in enumeration, completing only up to N=10N{=}10, overall slowing down in the CXp enumeration task.

Figure 2. Time to the first and to all CXps on P(N)P(N), τN\tau_N, for caupybara, our full approach, and a CXp-only variant. Dashed: first CXp; solid: all CXps. 10 seconds timeout.

Conclusion

In this paper, we specialize abductive and contrastive explanations to LTLf\textsf{LTL}_f. 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

  1. [1]Alviano, Dodaro, Fiorentino, Previti, & Ricca. (2023). ASP and subset minimality: Enumeration, cautious reasoning and MUSes.
  2. [2]Bacchus, & Kabanza. (1998). Planning for temporally extended goals.
  3. [3]Beer, Ben-David, Chockler, Orni, & Trefler. (2009). Explaining Counterexamples Using Causality.
  4. [4]Brewka, Eiter, & Truszczynski. (2011). Answer set programming at a glance.
  5. [5]Chiariello, & Marques-Silva. (2025). Formal Explanations of Black-Box Ranking Functions.
  6. [6]Darwiche, & Hirth. (2023). On the (Complete) Reasons Behind Decisions.
  7. [7]De Giacomo, De Masellis, Grasso, Maggi, & Montali. (2014). Monitoring business metaconstraints based on LTL and LDL for finite traces.
  8. [8]De Giacomo, Iocchi, Favorito, & Patrizi. (2019). Foundations for restraining bolts: Reinforcement learning with LTLf/LDLf restraining specifications.
  9. [9]De Giacomo, & Rubin. (2018). Automata-Theoretic Foundations of FOND Planning for LTLf and LDLf Goals.
  10. [10]De Giacomo, & Vardi. (2013). Linear Temporal Logic and Linear Dynamic Logic on Finite Traces.
  11. [11]Donadello, Riva, Maggi, & Shikhizada. (2022). Declare4Py: A Python Library for Declarative Process Mining.
  12. [12]Ferrère, Maler, & Ničković. (2015). Trace diagnostics using temporal implicants.
  13. [13]Fionda, & Greco. (2018). LTL on Finite and Process Traces: Complexity Results and a Practical Reasoner.
  14. [14]Fionda, Ielo, & Ricca. (2024). LTLf2ASP: LTLf Bounded Satisfiability in ASP.
  15. [15]Fionda, Ielo, & Ricca. (2026). Computing Syntax Tree-based Minimal Unsatisfiable Cores of LTLf Formulas.
  16. [16]Garey, & Johnson. (1979). Computers and Intractability: A Guide to the Theory of NP-Completeness (Series of Books in the Mathematical Sciences).
  17. [17]Gebser, Kaminski, Kaufmann, & Schaub. (2012). Answer Set Solving in Practice.
  18. [18]Gebser, Kaminski, Kaufmann, & Schaub. (2019). Multi-shot ASP solving with clingo.
  19. [19]Gelfond, & Lifschitz. (1991). Classical Negation in Logic Programs and Disjunctive Databases.
  20. [20]Granada, Ignatiev, & Stuckey. (2026). A Formal Framework for the Explanation of Finite Automata Decisions. https://arxiv.org/abs/2602.13351
  21. [21]Guidotti, Monreale, Ruggieri, Turini, Giannotti, & Pedreschi. (2019). A Survey of Methods for Explaining Black Box Models.
  22. [22]Halpern. (2016). Actual Causality.
  23. [23]Ielo, Mazzotta, Peñaloza, & Ricca. (2026). Enumerating Minimal Unsatisfiable Cores of LTLf Formulae.
  24. [24]Ignatiev, Narodytska, Asher, & Marques-Silva. (2020). From Contrastive to Abductive Explanations and Back Again.
  25. [25]Ignatiev, Narodytska, & Marques-Silva. (2019). Abduction-Based Explanations for Machine Learning Models.
  26. [26]Kress-Gazit, Fainekos, & Pappas. (2009). Temporal-logic-based reactive mission and motion planning.
  27. [27]Liffiton, Previti, Malik, & Marques-Silva. (2016). Fast, flexible MUS enumeration.
  28. [28]Liffiton, & Sakallah. (2008). Algorithms for Computing Minimal Unsatisfiable Subsets of Constraints.
  29. [29]Lifschitz. (2019). Answer Set Programming.
  30. [30]Mannhardt, & Blinde. (2017). Analyzing the Trajectories of Patients with Sepsis using Process Mining.
  31. [31]Marques-Silva, & Ignatiev. (2022). Delivering Trustworthy AI through Formal XAI.
  32. [32]Marques-Silva, Janota, & Mencía. (2017). Minimal sets on propositional formulae. Problems and reductions.
  33. [33]Meng, & Alrajeh. (2025). Causal Detection in Linear Temporal Counterexamples.
  34. [34]Niu, Xiao, Zhang, Li, Huang, & Shi. (2024). Computing minimal unsatisfiable core for LTL over finite traces.
  35. [35]Papadimitriou, & Wolfe. (1988). The Complexity of Facets Resolved.
  36. [36]Pnueli. (1977). The Temporal Logic of Programs.
  37. [37]Reiter. (1987). A theory of diagnosis from first principles.
  38. [38]Roveri, Ciccio, Francescomarino, & Ghidini. (2024). Computing Unsatisfiable Cores for LTLf Specifications.
  39. [39]Shih, Choi, & Darwiche. (2018). A Symbolic Approach to Explaining Bayesian Network Classifiers.
  40. [40]van der Aalst, Pesic, & Schonenberg. (2009). Declarative workflows: Balancing between flexibility and support.
  41. [41]van Dongen. (2020). BPI Challenge 2020.

Paper details

vlnc:W_fkckbj3t
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents