Model Explanation via Support Graphs

In this note, we introduce the notion of support graph to define explanations for any model of a logic program. An explanation is an acyclic support graph that, for each true atom in the model, induces a proof in terms of program rules represented by labels. A classical model may have zero, one or several explanations: when it has at least one, it is called a justified model. We prove that all stable models are justified whereas, in general, the opposite does not hold, at least for disjunctive programs. We also provide a meta-programming encoding in Answer Set Programming that generates the explanations for a given stable model of some program. We prove that the encoding is sound and complete, that is, there is a one-to-one correspondence between each answer set of the encoding and each explanation for the original stable model.


Introduction
In the past few years, Artificial Intelligence (AI) systems have made great advancements, generally at the cost of increasing their scale and complexity.Although symbolic AI approaches have the advantage of being verifiable, the number and size of possible justifications generated to explain a given result may easily exceed the capacity of human comprehension.Consider, for instance, the case of Answer Set Programming (ASP) Brewka et al. (2011), a successful logic programming paradigm for practical Knowledge Representation and problem solving.Even for a positive program, whose answer set is unique, the number of proofs for an atom we can form using modus ponens can be exponential.It makes sense, then, to generate explanations through the typical ASP problem solving orientation.Namely, we may consider each explanation individually as one solution to the "explainability problem" (that is, explaining a model) and let the user decide to generate one, several or all of them, or perhaps to impose additional preference conditions as done with optimisation problems in ASP.
In this technical note, we describe a formal characterisation of explanations in terms of graphs constructed with atoms and program rule labels.Under this framework, models may be justified, meaning that they have one or more explanations, or unjustified otherwise.We prove that all stable models are justified whereas, in general, the opposite does not hold, at least for disjunctive programs.We also provide an ASP encoding to generate the explanations of a given answer set of some original program, proving the soundness and completeness of this encoding.
The rest of this note is structured as follows.Section 2 contains the formal definitions for explanations and their properties with respect to stable models.Section 3 describes the ASP encoding and proves its soundness and completeness.Section 4 briefly comments on related work and, finally, Section 5 concludes the paper.

Explanations as Support Graphs
We start from a finite1 signature At, a non-empty set of propositional atoms.A (labelled) rule is an implication of the form: Given a rule r like (1), we denote its label as Lb(r) df = ℓ.We also call the disjunction in the consequent p 1 ∨• • •∨p m the head of r, written Head (r), and denote the set of head atoms as H (r) df = {p 1 , . . ., p m }; the conjunction in the antecedent is called the body of r and denoted as Body (r).We also define the positive and negative parts of the body respectively as the conjunctions Body + (r) The atoms in the positive body are represented as B + (r) df = {q 1 , . . ., q n }.As usual, an empty disjunction (resp.conjunction) stands for ⊥ (resp.⊤).A rule r with empty head H (r) = ∅ is called a constraint.On the other hand, when H (r) = {p} is a singleton, B + (r) = ∅ and Body − (r) = ⊤ the rule has the form ℓ : p ← ⊤ and is said to be a fact, simply written as ℓ : p.The use of double negation in the body allows representing elementary choice rules.For instance, we will sometimes use the abbreviation ℓ : {p} ← B to stand for ℓ : p ← B ∧ ¬¬p.A (labelled) logic program P is a set of labelled rules where no label is repeated.Note that P may still contain two rules r, r ′ with same body and head Body (r) = Body (r ′ ) and H (r) = H (r ′ ), but different labels Lb(r) = Lb(r ′ ).A program P is positive if Body − (r) = ⊤ for all rules r ∈ P .A program P is nondisjunctive if |H (r)| ≤ 1 for every rule r ∈ P .Finally, P is Horn if it is both positive and non-disjunctive: note that this may include (positive) constraints ⊥ ← B.
A propositional interpretation I is any subset of atoms I ⊆ At.We say that a propositional interpretation is a model of a labelled program P if I |= Body (r) → Head (r) in classical logic, for every rule r ∈ P .The reduct of a labelled program P with respect to I, written P I , is a simple extension of the standard reduct by Gelfond and Lifschitz (1988) that collects now the labelled positive rules: As usual, an interpretation I is a stable model (or answer set ) of a program P if I is a minimal model of P I .Note that, for the definition of stable models, the rule labels are irrelevant.We write SM (P ) to stand for the set of stable models of P .
We define the rules of a program P that support an atom p under interpretation I as SUP(P, I, p) df = {r ∈ P | p ∈ H (r), I |= Body(r)} that is, rules with p in the head whose body is true w.r.t.I.The next proposition proves that, given I, the rules that support p in the reduct P I are precisely the positive parts of the rules that support p in P .
Proposition 1 For any model I |= P of a program P and any atom p ∈ I: SUP(P I , I, p) = SUP(P, I, p) I .
For the ⊆ direction, take any r ′ ∈ SUP(P I , I, p).By definition of reduct, we know that r ′ is a positive rule and that there exists some r ∈ P where Lb(r) = Lb(r ′ ), H (r) = H (r ′ ), B + (r) = B + (r ′ ) and I |= Body − (r).Consider any rule r satisfying that condition (we could have more than one): we will prove that r ∈ SUP(P, I, p).Since r ′ ∈ SUP(P I , I, p), we get I |= Body (r ′ ) but this is equivalent to I |= Body + (r).However, as we had I |= Body − (r), we conclude I |= Body(r) and so r is supported in P given I.
Definition 1 (Support Graph/Explanation) Let P be a labelled program and I a classical model of P .A support graph G of I under P is a labelled directed graph G = I, E, λ whose vertices are the atoms in I, the edges in E ⊆ I × I connect pairs of atoms, the function λ : I → Lb(P ) assigns a label to each atom, and G further satisfies: (i) λ is injective (ii) for every p ∈ I, the rule r such that Lb(r) = λ(p) satisfies: r ∈ SUP (P, I, p) and B + (r) = {q | (q, p) ∈ E}.
A support graph G is said to be an explanation if it additionally satisfies: (iii) G is acyclic.
Condition (i) means that there are no repeated labels in the graph, i.e., λ(p) = λ(q) for different atoms p, q ∈ I. Condition (ii) requires that each atom p in the graph is assigned the label ℓ of some rule with p in the head, with a body satisfied by I and whose atoms in the positive body form all the incoming edges for p in the graph.Intuitively, labelling p with ℓ means that the corresponding (positive part of the) rule has been fired, "producing" p as a result.Since a label cannot be repeated in the graph, each rule can only be used to produce one atom, even though the rule head may contain more than one (when it is a disjunction).It is not difficult to see that an explanation G = I, E, λ for a model I is uniquely determined by its atom labelling λ.This is because condition (ii) about λ in Definition 1 uniquely specifies all the incoming edges for all the nodes in the graph.On the other hand, of course, not every arbitrary atom labelling corresponds to a well-formed explanation.We will sometimes abbreviate an explanation G for a model I by just using its labelling λ represented as a set of pairs of the form λ(p) : p with p ∈ I.
Definition 2 (Supported/Justified model ) A classical model I of a labelled program P if I |= P is said to be a supported model of P if there exists some support graph of I under P .Moreover, I is said to be a justified model of P if there exists some explanation G (i.e.acyclic support graph) of I under P .We write SPM (P ) and JM (P ) to respectively stand for the set of supported and justified models of P .
Obviously all justified models are supported JM (P ) ⊆ SPM (P ) but, in general, the opposite does not hold, as we will see later.Our main focus, however, is on justified models, since we will relate them to proofs, that are always acyclic.We can observe that not all models are justified, whereas a justified model may have more than one explanation, as we illustrate next.
Example 1 Consider the labelled logic program P No model I |= P with c ∈ I is justified since c does not occur in any head, so its support is always empty SUP(P, I, c) = ∅ and c cannot be labelled.The models of P without c are {b}, {a, d}, {b, d} and {a, b, d} but only the first two are justified.The explanation for I = {b} corresponds to the labelling {(ℓ 1 : b)} (it forms a graph with a single node).Model I = {a, d} has the two possible explanations:

Definition 3 (Proof of an atom)
Let I be a model of a labelled program P , G = I, E, λ an explanation for I under P and let p ∈ I.The proof for p induced by G, written π G (p), is the derivation: where, if r ∈ P is the rule satisfying Lb(r) = λ(p), then {q 1 , . . ., q n } = B + (r).When n = 0, the derivation antecedent π G (q 1 ) . . .π G (q n ) is replaced by ⊤ (corresponding to the empty conjunction).

Example 2
Let P be the labelled logic program: P has a unique justified model {p, q, r} whose explanation is shown in Figure 1 (left) whereas the induced proof for atom r is shown in Figure 1 (right).
The next proposition trivially follows from the definition of explanations: Explanation Proof for atom r Fig. 1.Some results for model {p, q, r} of program in Example 2.
If P is a Horn program, and G is an explanation for a model I of P then, for every atom, p ∈ I, π G (p) corresponds to a Modus Ponens derivation of p using the rules in P .
It is worth mentioning that explanations do not generate any arbitrary Modus Ponens derivation of an atom, but only those that are globally "coherent" in the sense that, if any atom p is repeated in a proof, it is always justified repeating the same subproof.
In the previous examples, justified and stable models coincided: one may wonder whether this is a general property.As we see next, however, every stable model is justified but, in general, the opposite may not hold.To prove that stable models are justified, we start proving a correspondence between explanations for any model I of P and explanations under P I .

Proposition 3
Let I be a model of program P .Then G is an explanation for I under P iff G is an explanation for I under P I .

Proof
By Proposition 1, for any atom p ∈ I, the labels in SUP (P, I, p) and SUP(P I , I, p) coincide, so there is no difference in the ways in which we can label p in explanations for P and for P I .On the other hand, the rules in SUP (P I , I, p) are the positive parts of the rules in SUP(P, I, p), so the graphs we can form are also the same.

Proof
Let I be a stable model of P .To prove that there is an explanation G for I under P , we can use Proposition 1 and just prove that there is some explanation G for I under P I .We will build the explanation with a non-deterministic algorithm where, in each step i, we denote the graph G i as G i = I i , E i , λ i and represent the labelling λ i as a set of pairs of the form (ℓ : p) meaning ℓ = λ(p).The algorithm proceeds as follows: Pick an atom p ∈ I ∩ H (r) 7: The existence of a rule r ∈ P I in line 5 is guaranteed because the while condition asserts I i |= P I and so there must be some rule whose positive body is satisfied by I i but its head is not satisfied.We prove next that the existence of an atom p ∈ I ∩ Head (r) (line 5) is also guaranteed.First, note that the while loop maintains the invariant I i ⊆ I, since I 0 = ∅ and I i only grows with atoms p (line 7) that belong to I (line 6).Therefore, I i |= Body (r) implies I |= Body(r), but since I |= P I , we also conclude I |= r and thus I |= Head (r) that is I ∩H (r) = ∅, so we can always pick some atom p in that intersection.Now, note that the algorithm stops because, in each iteration, I i grows with exactly one atom from I that was not included before, since I i |= ¬Head (r), and so, this process will stop provided that I is finite.The while stops satisfying I i |= P I for some value i = n.Moreover, I n = I, because otherwise, as I i ⊆ I is an invariant, we would conclude I n ⊂ I and so I would not be a minimal model of P I , which contradicts that I is a stable model of P .We remain to prove that the final G n = I n , E n , λ n is a correct explanation for I under P I .As we said, the atoms in I are the graph nodes I n = I.Second, we can easily see that G n is acyclic because each iteration adds a new node p and links this node to previous atoms from B + (r) ⊆ I i (remember I i |= Body(r)) so no loop can be formed.Third, no rule label can be repeated, because we go always picking a rule r that is new, since it was not satisfied in I i but becomes satisfied in I i+1 (the rule head Head (r) becomes true).Last, for every p ∈ I, it is not hard to see that the (positive) rule r ∈ P I such that Lb(r) = λ n (p) satisfies p ∈ H (r) and B + (r) = {q | (q, p) ∈ E} by the way in which we picked r and inserted p in I i , whereas I |= Body (r) because I i |= Body (r), r is a positive rule and I i ⊆ I.
As a result, we get SM (P ) ⊆ JM (P ) ⊆ SPM (P ), that is, justified models lay in between stable and supported.

Proposition 4
If P is a consistent Horn program then it has a unique justified model I that coincides with the least model of P .

Proof
Since P is Horn and consistent (all constraints are satisfied) its unique stable model is the least model I.By Theorem 1, I is also justified by some explanation G.We remain to prove that I is the unique justified model.Suppose there is another model J ⊃ I (remember I is the least model) justified by an explanation G and take some atom p ∈ J \I.Then, by Proposition 2, the proof for p induced by G, π G (p), is a Modus Ponens derivation of p using the rules in P .Since Modus Ponens is sound and the derivation starts from facts in the program, this means that p must be satisfied by any model of P , so p ∈ I and we reach a contradiction.
In general, the number of explanations for a single justified model can be exponential, even when the program is Horn, and so, has a unique justified and stable model corresponding to the least classical model, as we just proved.As an example2 : Example 3 (A chain of firing squads) Consider the following variation of the classical Firing Squad Scenario introduced by Pearl (1999) for causal counterfactuals (although we do not use it for that purpose here).We have an army distributed in n squads of three soldiers each, a captain and two riflemen for each squad.We place the squads in a sequence of n consecutive hills i = 0, . . ., n − 1.An unfortunate prisoner is at the last hill n − 1, and is being aimed at by the last two riflemen.At each hill i, the two riflemen a i and b i will fire if their captain c i gives a signal to fire.But then, captain c i+1 will give a signal to fire if she hears a shot from the previous hill i in the distance.Suppose captain c 0 gives a signal to fire.Our logic program would have the form: i+1 : signal i+1 ← fireB i for all i = 0, . . ., n − 1 where we assume (for simplicity) that signal n represents the death of the prisoner.This program has one stable model (the least model) making true the 3n + 1 atoms occurring in the program.However, this last model has 2 n explanations because to derive signal i+1 from level i, we can choose between any of the two rules a ′ i or b ′ i (corresponding to the two riflemen) in each explanation.In many disjunctive programs, justified and stable models coincide.For instance, the following example is an illustration of a program with disjunction and head cycles.
However, in the general case, not every justified model is a stable model: we provide next a simple counterexample.Consider the program P : whose classical models are the five interpretations: {a}, {a, c}, {a, b}, {b, c} and {a, b, c}.
The last one {a, b, c} is not justified, since we would need three different labels and we only have two rules.Each model {a, c}, {a, b}, {b, c} has a unique explanation corresponding to the atom labellings {(ℓ 1 : a), (ℓ 2 : c)}, {(ℓ 1 : b), (ℓ 2 : a)} and {(ℓ 1 : b), (ℓ 2 : c)}, respectively.On the other hand, model {a} has two possible explanations, corresponding to {(ℓ 1 : a)} and {(ℓ 2 : a)}.Notice that, in the definition of explanation, there is no need to fire every rule with a true body in I -we are only forced to explain every true atom in I.Note also that only the justified models {a} and {b, c} are also stable: this is due to the minimality condition imposed by stable models on positive programs, getting rid of the other two justified models {a, b} and {a, c}.The following theorem asserts that, for non-disjunctive programs, every justified model is also stable.

Theorem 2
If P is a non-disjunctive program, then SM (P ) = JM (P ).

Proof
Given Theorem 1, we must only prove that, for non-disjunctive programs, every justified model is also stable.Let I be a justified model of P .By Proposition 3, we also know that I is a justified model of P I .P I is a positive program and is non-disjunctive (since P was non-disjunctive) and so, P is a Horn program.By Proposition 4, we know I is also the least model of P I , which makes it a stable model of P .
Moreover, for non-disjunctive programs, we can prove that our definition of supported model, coincides with the traditional one in terms of fixpoints of the immediate consequences operator van Emden and Kowalski (1976) or as models of completion Clark (1978).Given a non-disjunctive program P , let T P (I) be defined as {p | r ∈ P, I |= Body(r), Head (r) = p}.

Theorem 3
If P is a non-disjunctive program, then I = T P (I) iff I ∈ SPM (P ).

Proof
For left to right, suppose I = T P (I).It is easy to see that this implies I |= P .By definition of T P , for each atom p there exists some rule r with Head (r) = p and I |= Body (r).Let us arbitrarily pick one of those rules r p for each p.Then we can easily form a support graph where λ(p) = Lb(r p ) and assign all the incoming edges for p as (q, p) such that q ∈ Body + (r p ).
For right to left, suppose I |= P and there is some support graph G of I under P .We prove both inclusion directions for I = T P (I).For ⊆, suppose p ∈ I. Then p is a node in G and there is a rule r such that λ(p) = Lb(r), p = Head (r) (P is non-disjunctive) and I |= Body(r).But then p ∈ T P (I).For ⊇, take any p ∈ T P (I) and suppose p ∈ I.Then, we have at least some rule r ∈ P with I |= Body (r) and I |= Head (r)(= p), something that contradicts I |= P .
To illustrate supported models in the disjunctive case, consider the program: The only justified model of this program is ∅ which is also stable and supported.Yet, we also obtain a second supported model {b, c} that is justified by the (cyclic) support graph with labelling {ℓ 1 : b, ℓ 2 : c}.

An ASP encoding to compute explanations
In this section, we focus on the computation of explanations for a given stable model.We assume that we use an ASP solver to obtain the answer sets of some program P and that we have some way to label the rules.For instance, we may use the code line number (or another tag specified by the user), followed by the free variables in the rule and some separator.In that way, after grounding, we get a unique identifier for each ground rule.
To explain the answer sets of P we may build the following (non-ground) ASP program x(P ) that can be fed with the (reified) true atoms in I to build the ground program x(P, I).As we will prove, the answer sets of x(P, I) are in one-to-one correspondence with the explanations of I.The advantage of this technique is that, rather than collecting all possible explanations in a single shot, something that results too costly for explaining large programs, we can perform regular calls to an ASP solver for x(P, I) to compute one, several or all explanations of I on demand.Besides, this provides a more declarative approach that can be easily extended to cover new features (such as, for instance, minimisation among explanations).
For each rule in P of the form (1), x(P ) contains the set of rules: for all i, h = 1 . . .m and i = h, and, additionally x(P ) contains the rules: As we can see, x(P ) reifies atoms in P using three predicates: as(A) which means that atom A is in the answer set I, so it is an initial assumption; f (L, A) means that rule with label L has been "fired" for atom A, that is, λ(A) = L; and, finally, f (A) that just means that there exists some fired rule for A or, in other words, we were able to derive A. Predicate sup(ℓ) tells us that the body of the rule r with label ℓ is "supported" by I, that is, I |= Body (r).Given any answer set I of P , we define the program x(P, I) It is easy to see that x(P, I) becomes equivalent to the ground program containing the following rules: for each rule r ∈ P like (1), for each rule r ∈ P like (1), Theorem 4 (Soundness) Let I be an answer set of P .For every answer set J of program x(P, I) there exists an explanation G = I, E, λ of I under P such that λ(a) = ℓ iff f (ℓ, a) ∈ J.

Proof
We have to prove that J induces a valid explanation G. Let us denote At(J) 12) is the only rule for f (a), we can apply completion to conclude that f (a) ∈ J iff f (ℓ, a) ∈ J for some label ℓ.So, the set At(J) contains the set of atoms for which J assigns some label: we will prove that this set coincides with I. We may observe that I ⊆ At(J) because for any a ∈ I we have the constraint (13) forcing f (a) ∈ J. On the other hand, At(J) ⊆ I because the only rules with f (a) in the head are (12) and these are only defined for atoms a ∈ I. To sum up, in any answer set J of x(P, I), we derive exactly the original atoms in I, At(J) = I and so, the graph induced by J has exactly one node per atom in I.
Constraint ( 14) guarantees that atoms f (ℓ, a) have a functional nature, that is, we never get two different labels for a same atom a.This allows defining the labelling function λ(a) = ℓ iff f (ℓ, a) ∈ J.We remain to prove that conditions (i)-(iii) in Definition 1 hold.Condition (i) requires that λ is injective, something guaranteed by (11).Condition (ii) requires that, informally speaking, the labelling for each atom a corresponds to an activated, supported rule for a.That is, if λ(a) = ℓ, or equivalently f (ℓ, a), we should be able to build am edge (q, a) for each atom in the positive body of ℓ so that atoms q are among the graph nodes.This is guaranteed by that fact that rule ( 10) is the only one with predicate f (ℓ, a) in the head.So, if that ground atom is in J, it is because f (q i ) are also in J i.e. q i ∈ I, for all atoms in the positive body of rule labelled with ℓ.Note also that ( 10) is such that I |= Body (r), so the rule supports atom p under I, that is, r ∈ SUP (P, I, p).Let us call E to the set of edges formed in this way.Condition (iii) requires that the set E of edges forms an acyclic graph.To prove this last condition, consider the reduct program x(P, I) J .The only difference of this program with respect to x(P, I) is that rules (10) have now the form: for each rule r ∈ P like (1), I |= Body(r), p ∈ H (r)∩I as before, but additionally f (ℓ, p) ∈ J so the rule is kept in the reduct.Yet, the last condition is irrelevant since f (ℓ, p) ∈ J implies f (p) ∈ J so p ∈ At(J) = I.Thus, we have exactly one rule (15) in x(P, I) J per each choice (10) in x(P, I).Now, since J is an answer set of x(P, I), by monotonicity of constraints, it (11), ( 13) and ( 14) and is an answer set of the rest of the program P ′ formed by rules ( 15) and ( 11).This means that J is a minimal model of P ′ .Suppose we have a cycle in E, formed by the (labelled) nodes and edges (ℓ 1 : Since J is a minimal for P ′ there must be some rule ( 15) or ( 11) not satisfied by J ′ .Suppose J ′ does not satisfy some rule (11) so that f (a) ∈ J ′ but f (ℓ, a) ∈ J ′ ⊆ J.This means we had f (a) ∈ J since the rule was satisfied by J so a is one of the removed atoms p i belonging to the cycle.But then f (ℓ, a) should have been removed f (ℓ, a) ∈ J ′ and we reach a contradiction.Suppose instead that J ′ does not satisfy some rule (15), that is, f (ℓ, p) ∈ J ′ and {f (q 1 ), . . ., f (g n )} ⊆ J ′ ⊆ J. Again, since the body holds in J, we get f (ℓ, p) ∈ J and so, f (ℓ, p) is one of the atoms in the cycle we removed from J ′ .Yet, since (ℓ : p) is in the cycle, there is some incoming edge from some atom in the cycle and, due to the way in which atom labelling is done, this means that this edge must come from some atom q i with 1 ≤ i ≤ n in the positive body of the rule whose label is ℓ.But, since this atom is in the cycle, this also means that f (q i ) ∈ J ′ and we reach a contradiction.
Theorem 5 (Completeness) Let I be an answer set of P .For every explanation G = I, E, λ of I under P there exists some answer set J of program x(P, I) where f (ℓ, a) ∈ J iff λ(a) = ℓ in G.

Proof
Take I an answer set of P and G = I, E, λ some explanation for I under P and let us define the interpretation: We will prove that J is an answer set of x(P, I) or, in other words, that J is a minimal model of x(P, I) J .First, we will note that J satisfies x(P, I) J rule by rule.For the constraints, J obviously satisfy (7) because it contains an atom f (a) for each a ∈ I.We can also see that J satisfies (11) because graph G does not contain repeated labels, so we cannot have two different atoms with the same label.The third constraint ( 14) is also satisfied by J because atoms f (ℓ, a), f (ℓ ′ , a) are obtained from λ(a) that is a function that cannot assign two different labels to a same atom a. Satisfaction of ( 11) is guaranteed since the head of this rule f (a) is always some atom a ∈ I and therefore f (a) ∈ J.For the remaining rule, (10), we have two cases.If f (ℓ, p) ∈ J then the rule is not included in the reduct and so there is no need to be satisfied.Otherwise, if f (ℓ, p) ∈ J then the rule in the reduct corresponds to (15) and is trivially satisfied by J because its only head atom holds in that interpretation.Finally, to prove that J is a minimal model of x(P, I) J , take the derivation tree π G (a) for each atom a ∈ I. Now, construct a new tree π where we replace each atom p in π G (a) by an additional derivation from f (ℓ, p) to f (p) through rule (12).It is easy to see that π constitutes a Modus Ponens proof for f (a) under the Horn program x(P, I) J and the same reasoning can be applied to atom f (ℓ, a) ∈ J that is derived in the tree π for f (a).Therefore, all atoms in J must be included in any model of x(P, I) J .

Related work
The current approach constitutes the formal basis of the new version of the explanation tool xclingo Cabalar and Muñiz (2023) which also uses the ASP encoding from Section 3 to compute the explanations.Theorems 4 and 5 prove, in this way, that the tool is sound and complete with respect to the definition of explanation provided in the current paper.There exist many other approaches for explanation and debugging in ASP (see the survey Fandinno and Schulz (2019)).The closest approach to the current work is clearly the one based on causal graphs Cabalar et al. (2014).Although we conjecture that a formal relation can be established (we plan this for future work), the main difference is that causal graphs are "atom oriented" whereas the current approach is model oriented.For instance, in the firing squads example, the causal-graph explanation for the derivations of atoms signal 4 and signal 8 would contain algebraic expressions with all the possible derivations for each one of those atoms.In the current approach, however, we would get an individual derivation in each case, but additionally, the proof we get for signal 4 has to be the same one we use for that atom inside the derivation of signal 8 .
Justifications based on the positive part of the program were also used before in Erdem and Oztok (2013).There, the authors implemented an ad-hoc approach to the problem of solving biomedical queries, rather than a general ASP explanation tool.
Other examples of general approaches are the formal theory of justifications Denecker et al. (2015), off-line justifications Pontelli and Son (2006), LABAS Schulz and Toni (2016) (based on argumentation theory Bondarenko et al. (1997); Dung et al. (2009)) or s(CASP) Arias et al. (2020).All of them provide graph or tree-based explanations for an atom to be (or not) in a given answer set.The formal theory of justifications was also extended to deal with nested graph based justifications Marynissen (2022) and is actually a more general framework that allows covering other logic programming semantics.System xASP Trieu et al. ( 2022) generates explanation graphs from Pontelli and Son (2006) and also uses an ASP meta-programming encoding.In the case of s(CASP), it proceeds in a top-down manner, building the explanation as an ordered list of literals extracted from the goal-driven satisfaction of the query.An important difference with respect to this last group of approaches is that their explanations consider dependences through default negation.To illustrate the effect, take the program: The only stable model is {switch, light} and its unique explanation is the support graph ℓ 1 : switch −→ ℓ 2 : light that is, the light is on because we toggled the switch.Adding negative information would lead us to explain not ab and obtain two explanations: one in which we also add that there is no blown fuse, no broken bulb and no blackout; the second one is similar, but instead of no blackout, we have a doubly negative dependence on generator: i.e. nothing prevents having a generator, even though we do not have it.Note how these explanations may easily get complicated: we could have to negate multiple alternative ways of breaking the bulb, even when none of them have happened3 .Our approach consists, instead, in explaining the information that currently holds, assuming that other states of affairs will arise in terms of other alternative answer sets.In other words, we refrain from using facts for which we have no evidence or reason to believe in our current model.
Another distinctive feature of our approach is that it provides explanations for disjunctive programs and, moreover, it has also allowed us to define supported and justified models for that case.In fact, we plan to study potential connections between justified models and other approaches for disjunction not based in minimal models such as Aguado et al. (2017) or Shen and Eiter (2019).
Other ASP explanation approaches have to do with comparing stable models or explaining their non-existence.For instance, Gebser et al. (2008) uses a meta-programming technique to explain why a given model is not an answer set of a given program.More recently, Eiter et al. (2019) considered the explanation of ASP programs that have no answer sets in terms of the concept of abstraction Saribatur et al. (2021).This allows spotting which parts of a given domain are actually relevant for rising the unsatisfiability of the problem.We plan to explore formal relations to these approaches or to study potential combinations with some of them.

Conclusions
We have introduced the notion of explanation of a model of a logic program as some kind of (acyclic) labelled graph we called support graph.We have have defined justified models as those that have at least one explanation and proved that all stable models are justified, whereas the opposite does not hold, at least for disjunctive programs.We also provided a meta-programming encoding in ASP that generates the explanations of a given stable model.We formally proved a one-to-one correspondence between the answer sets of the encoding and the explanations of the original stable model.Since this encoding constitutes the basis of the tool xclingo 2.0, we provide in this way a formal proof of correctness for this system.A system description of the tool is left for a forthcoming document.Future work includes the comparison to other approaches, the explanation of unsatisfiable programs and the minimisation or even the specification of preferences among explanations.
Model I = {b, d} is not justified: we have no support for d given I, SUP(P, I, d) = ∅, because I satisfies neither bodies of ℓ 2 nor ℓ 3 .On the other hand, model {a, b, d} is not justified either, because SUP(P, I, a) = SUP(P, I, b) = {ℓ 1 } and we cannot use the same label ℓ 1 for two different atoms a and b in a same explanation (condition (i) in Def. 1).