Algorithm Search⌘K

Theoremresearch

Strong equivalence of logic programs

Also called Lifschitz-Pearce-Valverde theorem.

Two programs have the same stable models in every context exactly when they have the same SE-models, which is the same as equivalence in the logic of here-and-there.

Two logic programs are strongly equivalent when one can replace the other inside any larger program without a change of the stable models. Ordinary equivalence, the same stable models, is not enough for this, because the stable model semantics is nonmonotonic: {p←not q}\{p \leftarrow \mathit{not}\ q\} and {p}\{p\} have the same stable model, but after adding the fact qq they do not. Lifschitz, Pearce and Valverde (2001) proved that strong equivalence is equivalence in the logic of here-and-there, a logic between intuitionistic and classical logic. Turner (2003) restated this with SE-models, built from the Gelfond-Lifschitz reduct, which is the form given here.

Statement

Let PP and QQ be finite ground normal programs, and let AA be the set of atoms that occur in PP or QQ. For a set YY of atoms, PYP^Y is the reduct of PP by YY, and "X⊨PX \models P" means that XX satisfies every rule of PP read as a classical implication.

  • An SE-model of PP is a pair (X,Y)(X, Y) with X⊆Y⊆AX \subseteq Y \subseteq A, Y⊨PY \models P and X⊨PYX \models P^Y. Write SE(P)\mathrm{SE}(P) for the set of SE-models.
  • PP and QQ are strongly equivalent if, for every normal program RR, the programs P∪RP \cup R and Q∪RQ \cup R have the same stable models.

Theorem (Lifschitz, Pearce and Valverde 2001; Turner 2003). PP and QQ are strongly equivalent if and only if SE(P)=SE(Q)\mathrm{SE}(P) = \mathrm{SE}(Q).

In the form of Lifschitz, Pearce and Valverde, the right side reads: PP and QQ, as sets of formulas with not\mathit{not} read as negation, are equivalent in the logic of here-and-there. An SE-model (X,Y)(X, Y) is a model of that logic, with XX the atoms true "here" and YY the atoms true "there". Both papers prove the theorem for much more general programs: nested expressions, disjunctive heads and, in the later literature, arbitrary propositional theories. The proof below shows that the extra program RR can always be chosen to consist of facts and rules a←ba \leftarrow b.

In plain words

Two pieces of a program can give the same answers when they stand alone, and still behave differently once other rules are added. One rule may say "p unless q", the other just "p". Alone, both give p. Add the fact q, and only the second still gives p. Strong equivalence asks for the same answers in every possible surrounding, which is what a programmer needs before replacing one piece by another. The theorem turns this question about all programs into a check on one finite list of pairs of sets of atoms for each program. The lists can be compared directly, or the check can be passed to a standard solver for logic formulas.

Proof

This is the proof through SE-models of Turner (2003). Lifschitz, Pearce and Valverde (2001) prove the same result in the logic of here-and-there.

Lemma 1. YY is a stable model of PP if and only if (Y,Y)∈SE(P)(Y, Y) \in \mathrm{SE}(P) and there is no (X,Y)∈SE(P)(X, Y) \in \mathrm{SE}(P) with X⊊YX \subsetneq Y.

First, Y⊨PY \models P if and only if Y⊨PYY \models P^Y: a rule of PP whose body is true in YY has no negative atom in YY, so its reduct is in PYP^Y with the same positive body, and conversely. So (Y,Y)∈SE(P)(Y, Y) \in \mathrm{SE}(P) means Y⊨PYY \models P^Y. Now Y=lm(PY)Y = \mathrm{lm}(P^Y) holds if and only if YY is a model of PYP^Y and no proper subset of YY is, because the least model is contained in every model.

Lemma 2. SE(P∪R)=SE(P)∩SE(R)\mathrm{SE}(P \cup R) = \mathrm{SE}(P) \cap \mathrm{SE}(R), for SE-models over the atoms of PP, QQ and RR.

This holds because (P∪R)Y=PY∪RY(P \cup R)^Y = P^Y \cup R^Y, and a set satisfies a union of rules exactly when it satisfies both parts.

If. If SE(P)=SE(Q)\mathrm{SE}(P) = \mathrm{SE}(Q), then by Lemma 2 SE(P∪R)=SE(Q∪R)\mathrm{SE}(P \cup R) = \mathrm{SE}(Q \cup R) for every RR, and by Lemma 1 the two programs have the same stable models. (An atom outside AA is in PP only through RR, and the SE-models of PP over a larger set of atoms are determined by those over AA, so the equality carries over.)

Only if. Suppose (X,Y)∈SE(P)∖SE(Q)(X, Y) \in \mathrm{SE}(P) \setminus \mathrm{SE}(Q); the other case is symmetric. We build RR such that YY is stable for exactly one of P∪RP \cup R and Q∪RQ \cup R.

Case 1: Y⊭QY \not\models Q. Let RR be the facts YY. Then (P∪R)Y=PY∪Y(P \cup R)^Y = P^Y \cup Y, and since Y⊨PYY \models P^Y, its least model is YY. So YY is stable for P∪RP \cup R. It is not stable for Q∪RQ \cup R, because YY does not satisfy QQ.

Case 2: Y⊨QY \models Q. Then (Y,Y)∈SE(Q)(Y, Y) \in \mathrm{SE}(Q), so X≠YX \neq Y, and (Y,Y)∈SE(P)(Y, Y) \in \mathrm{SE}(P) as well. Let RR be the facts XX together with all rules a←ba \leftarrow b for a,b∈Y∖Xa, b \in Y \setminus X. The reduct of RR is RR, and a set ZZ with X⊆Z⊆YX \subseteq Z \subseteq Y satisfies RR exactly when Z=XZ = X or Z=YZ = Y, since one atom of Y∖XY \setminus X forces all the others. So the SE-models of RR with second part YY are (X,Y)(X, Y) and (Y,Y)(Y, Y). By Lemma 2, P∪RP \cup R has both, so YY is not stable for it by Lemma 1. Q∪RQ \cup R has (Y,Y)(Y, Y) but not (X,Y)(X, Y), so YY is stable for it.

A check by hand. Take P={p←not q}P = \{p \leftarrow \mathit{not}\ q\} and Q={p}Q = \{p\} over A={p,q}A = \{p, q\}. For QQ, a pair needs p∈Xp \in X, which gives ({p},{p})(\{p\}, \{p\}), ({p},{p,q})(\{p\}, \{p, q\}) and ({p,q},{p,q})(\{p, q\}, \{p, q\}). For PP and Y={q}Y = \{q\}, the reduct PYP^Y is empty, so (∅,{q})(\emptyset, \{q\}) is an SE-model of PP; and Y={q}Y = \{q\} does not satisfy QQ. This is Case 1: with R={q}R = \{q\}, the program P∪RP \cup R has the stable model {q}\{q\}, while Q∪RQ \cup R has the stable model {p,q}\{p, q\}. In all, PP has four SE-models that QQ lacks: (∅,{q})(\emptyset, \{q\}), ({q},{q})(\{q\}, \{q\}), (∅,{p,q})(\emptyset, \{p, q\}) and ({q},{p,q})(\{q\}, \{p, q\}).

Consequences

  • Safe simplification. A rule whose head is also in its positive body, such as p←p,qp \leftarrow p, q, can be deleted from any program, and so can a rule with both bb and not b\mathit{not}\ b in its body: in both cases the empty program has the same SE-models. Optimizers and grounders of answer set programming use such strong equivalences to rewrite rules.
  • Positive parts. {a←b, b←a, a}\{a \leftarrow b,\ b \leftarrow a,\ a\} is strongly equivalent to {a, b}\{a,\ b\}: both have the single SE-model ({a,b},{a,b})(\{a, b\}, \{a, b\}). For programs without negation, strong equivalence is the same as classical equivalence.
  • Complexity. To decide whether two finite programs are strongly equivalent is coNP-complete. A pair (X,Y)(X, Y) in one set but not the other is a short certificate of non-equivalence. Lin (2002) reduced the problem to classical entailment over the atoms and a primed copy of each, so a SAT solver can check it.
  • A logical view of rules. The theorem gives answer set programs a monotonic logic, here-and-there, in which replacement of equivalents is valid, although the stable model semantics itself is nonmonotonic. Pearce's equilibrium logic defines stable models as particular models of this logic.

Tightness

The class of added programs matters. With RR ranging only over the empty program, the condition is ordinary equivalence, and {p←not q}\{p \leftarrow \mathit{not}\ q\} and {p}\{p\} pass it. With RR ranging over sets of facts, the condition is uniform equivalence, which is strictly weaker. For example, P={a}P = \{a\} and Q={a←not b, a←b}Q = \{a \leftarrow \mathit{not}\ b,\ a \leftarrow b\} have the same stable models after adding any set of facts. They are not strongly equivalent: (∅,{a,b})(\emptyset, \{a, b\}) is an SE-model of QQ, because Q{a,b}={a←b}Q^{\{a, b\}} = \{a \leftarrow b\}, but not of PP. Case 2 of the proof gives R={a←b, b←a}R = \{a \leftarrow b,\ b \leftarrow a\}: then P∪RP \cup R has the stable model {a,b}\{a, b\} and Q∪RQ \cup R has no stable model. The proof shows that facts and rules with one positive body atom are always enough.

The theorem is about the stable model semantics. It does not carry over to the completion: {p←p}\{p \leftarrow p\} and the empty program are strongly equivalent, but their completions, p↔pp \leftrightarrow p and ¬p\neg p, have different models.

History

Pearce introduced equilibrium logic in the 1990s, which defines stable models within the logic of here-and-there. Lifschitz, Pearce and Valverde (2001) used it to characterize strong equivalence. Turner gave the SE-model form in a conference paper in 2001, and in the journal paper of 2003 cited here he extended it to nested expressions and weight constraints. Lin (2002) gave the reduction to classical logic, and the coNP-completeness was shown in the same period by several groups. Uniform equivalence and relativized notions, where RR is restricted to some atoms, were studied later.

References

  1. Vladimir Lifschitz, David Pearce and Agustín Valverde, Strongly equivalent logic programs, ACM Transactions on Computational Logic 2(4), 526 to 541 (2001), the definition of strong equivalence and the main theorem on equivalence in the logic of here-and-there
  2. Hudson Turner, Strong equivalence made easy: nested expressions and weight constraints, Theory and Practice of Logic Programming 3(4-5), 609 to 622 (2003), the definition of SE-models and the characterization of strong equivalence by them
  3. Fangzhen Lin, Reducing strong equivalence of logic programs to entailment in classical propositional logic, in Proceedings of the Eighth International Conference on Principles of Knowledge Representation and Reasoning (KR 2002), Morgan Kaufmann, 170 to 176 (2002), the reduction to classical entailment and the coNP-completeness of the check
  4. Vladimir Lifschitz, Answer Set Programming, Springer (2019), the section on strong equivalence and its use to simplify programs

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/R3JT14/text.yaml