Algorithm Search⌘K

Theoremadvanced

Fages' theorem

Also called tight program theorem.

If no atom of a normal program depends positively on itself, the stable models of the program are exactly the models of its Clark completion, so a SAT solver can find them.

Fages' theorem says when the two main readings of negation as failure agree. Every stable model of a normal program is a model of its Clark completion, but the completion can have more models, because it accepts atoms that support each other in a positive cycle. Fages (1994) proved that if the program has no such cycles, the two sets of models are the same. The result is the reason why the stable models of many programs can be found by a SAT solver, and loop formulas extend it to all programs.

Statement

Let PP be a ground normal program over a set AA of atoms, possibly infinite. A rule has the form h←b1,…,bm,not c1,…,not ckh \leftarrow b_1, \ldots, b_m, \mathit{not}\ c_1, \ldots, \mathit{not}\ c_k, and Comp(P)\mathrm{Comp}(P) is its completion: for each a∈Aa \in A, the formula a↔⋁body(r)a \leftrightarrow \bigvee \mathrm{body}(r) over the rules rr with head aa, with ⋁∅=⊥\bigvee \emptyset = \bot.

PP is tight if there is a level mapping λ:A→N\lambda : A \to \mathbb{N} such that, for every rule of PP and every positive body atom bib_i of it, λ(h)>λ(bi)\lambda(h) > \lambda(b_i). For a finite program, this means that the positive dependency graph, with an edge from hh to each bib_i, has no cycle.

Theorem (Fages 1994). If PP is tight, then a set M⊆AM \subseteq A is a stable model of PP if and only if MM is a model of Comp(P)\mathrm{Comp}(P).

Negative body literals play no part in the hypothesis. Fages called such programs positive-order-consistent; the name tight is from Erdem and Lifschitz (2003), who proved a more general form (their Corollary 2 covers this case).

In plain words

A logic program can be read in two ways. In the first, an atom is true when one of its rules applies, and false when none does. In the second, which is the stable model reading, an atom is true only if it can be built up step by step from facts. The first reading allows a circle: "p because q, and q because p" makes both true with no outside reason. The second does not. If the program has no such circle among its positive conditions, the two readings give the same answers. Then each atom can be checked with a simple local rule, and a solver for plain logic formulas can do the work.

Proof

The proof has three steps. Write TP(M)T_P(M) for the set of heads of rules whose body is true in MM, and lm(PM)\mathrm{lm}(P^M) for the least model of the reduct of PP by MM.

Step 1: the models of the completion are the sets with M=TP(M)M = T_P(M). The formulas a←⋁body(r)a \leftarrow \bigvee \mathrm{body}(r) hold in MM exactly when TP(M)⊆MT_P(M) \subseteq M. The formulas a→⋁body(r)a \rightarrow \bigvee \mathrm{body}(r) hold exactly when each a∈Ma \in M is the head of a rule whose body is true in MM, that is M⊆TP(M)M \subseteq T_P(M). Such sets are the supported models.

Step 2: every stable model is supported, for any PP. Let M=lm(PM)M = \mathrm{lm}(P^M). If the body of a rule rr is true in MM, then no cjc_j is in MM, so PMP^M contains h←b1,…,bmh \leftarrow b_1, \ldots, b_m with all bi∈M=lm(PM)b_i \in M = \mathrm{lm}(P^M), and h∈Mh \in M. So TP(M)⊆MT_P(M) \subseteq M. If a∈M=lm(PM)a \in M = \mathrm{lm}(P^M), then some rule a←b1,…,bma \leftarrow b_1, \ldots, b_m of PMP^M has all bi∈Mb_i \in M. It comes from a rule of PP with no cj∈Mc_j \in M, so the body of that rule is true in MM and a∈TP(M)a \in T_P(M).

Step 3: if PP is tight, every supported model is stable. Let M=TP(M)M = T_P(M). First, lm(PM)⊆M\mathrm{lm}(P^M) \subseteq M, because MM is closed under the rules of PMP^M: such a rule comes from a rule rr of PP with no cj∈Mc_j \in M, and if its bib_i are in MM, the body of rr is true in MM, so its head is in TP(M)=MT_P(M) = M. Second, we show a∈lm(PM)a \in \mathrm{lm}(P^M) for each a∈Ma \in M, by induction on λ(a)\lambda(a). Since a∈TP(M)a \in T_P(M), some rule rr with head aa has its body true in MM. Its positive atoms bib_i are in MM and have λ(bi)<λ(a)\lambda(b_i) < \lambda(a), so by the induction hypothesis they are in lm(PM)\mathrm{lm}(P^M). No cjc_j is in MM, so a←b1,…,bma \leftarrow b_1, \ldots, b_m is in PMP^M, and a∈lm(PM)a \in \mathrm{lm}(P^M). The induction is valid because the levels are natural numbers. Hence M=lm(PM)M = \mathrm{lm}(P^M).

Steps 1 and 2 give "stable implies a model of the completion" for every program, and Steps 1 and 3 give the converse for tight programs. This is the argument of Fages (1994); Erdem and Lifschitz (2003) give the same structure in a more general setting.

A check by hand. Take p←not qp \leftarrow \mathit{not}\ q, q←not pq \leftarrow \mathit{not}\ p, r←p,not sr \leftarrow p, \mathit{not}\ s. The only positive edge is r→pr \to p, so the program is tight. The completion is p↔¬qp \leftrightarrow \neg q, q↔¬pq \leftrightarrow \neg p, r↔p∧¬sr \leftrightarrow p \wedge \neg s, ¬s\neg s. Its models are {q}\{q\} and {p,r}\{p, r\}. The reduct by {q}\{q\} is {q, r←p}\{q,\ r \leftarrow p\} with least model {q}\{q\}, and the reduct by {p,r}\{p, r\} is {p, r←p}\{p,\ r \leftarrow p\} with least model {p,r}\{p, r\}, so both are stable, as the theorem says.

Consequences

  • Answer sets by SAT. For a finite tight program, the clausal form of the completion, which is linear in the size of the program after one new atom per rule body, is a SAT instance whose models are the stable models. The first answer set solvers built on SAT solvers used this for tight programs.
  • Consistency. The title of Fages' paper: a tight program has a stable model if and only if its completion is consistent.
  • The search problem stays hard. Tight programs are enough to encode SAT: for each variable xx, the rules x←not xˉx \leftarrow \mathit{not}\ \bar{x} and xˉ←not x\bar{x} \leftarrow \mathit{not}\ x, and for each clause a constraint that is violated when all its literals are false. The program is tight, so deciding whether a tight program has a stable model is still NP-complete.
  • Testing the hypothesis. Tightness of a finite program is decided in linear time by a search for a cycle in the positive dependency graph, for example with the strongly connected components.
  • Programs with loops. For a program that is not tight, the stable models are the models of the completion that also satisfy the loop formulas of Lin and Zhao (2004). Fages' theorem is the case in which there are no loops.

Tightness

The hypothesis cannot be dropped. The program p←pp \leftarrow p has the positive cycle p→pp \to p. Its completion p↔pp \leftrightarrow p has the models ∅\emptyset and {p}\{p\}, while the only stable model is ∅\emptyset.

For infinite programs, an acyclic positive dependency graph is not enough. The program pi←pi+1p_i \leftarrow p_{i+1} for i=0,1,2,…i = 0, 1, 2, \ldots has no cycle, but it has no level mapping into N\mathbb{N}, because λ(p0)>λ(p1)>⋯\lambda(p_0) > \lambda(p_1) > \cdots is impossible. Its completion has the model in which every pip_i is true, while the only stable model is ∅\emptyset. The induction of Step 3 needs a well-founded order.

The condition is sufficient, not necessary: {p←p, p}\{p \leftarrow p,\ p\} is not tight, but its completion and its stable models are both {p}\{p\}. Erdem and Lifschitz (2003) weaken the hypothesis to tightness on a set XX of atoms, which constrains only the rules whose head and positive body atoms lie in XX; the conclusion then holds for the models contained in XX.

History

Clark (1978) defined the completion, and Gelfond and Lifschitz (1988) defined stable models. Fages (1994) proved that the two agree on positive-order-consistent programs. Erdem and Lifschitz (2003) gave the name tight programs, and extended the result to programs with nested expressions and to tightness relative to a set of atoms. Lin and Zhao (2004) removed the hypothesis by adding loop formulas to the completion.

References

  1. François Fages, Consistency of Clark's completion and existence of stable models, Methods of Logic in Computer Science 1(1), 51 to 60 (1994), the main theorem on positive-order-consistent programs
  2. Esra Erdem and Vladimir Lifschitz, Tight logic programs, Theory and Practice of Logic Programming 3(4-5), 499 to 518 (2003), Corollary 2
  3. Keith L. Clark, Negation as failure, in Hervé Gallaire and Jack Minker (eds.), Logic and Data Bases, Plenum Press, New York, 293 to 322 (1978), the definition of the completion
  4. Michael Gelfond and Vladimir Lifschitz, The stable model semantics for logic programming, in Robert A. Kowalski and Kenneth A. Bowen (eds.), Logic Programming: Proceedings of the Fifth International Conference and Symposium, MIT Press, 1070 to 1080 (1988), the definition of stable models
  5. Fangzhen Lin and Yuting Zhao, ASSAT: computing answer sets of a logic program by SAT solvers, Artificial Intelligence 157(1-2), 115 to 137 (2004), the generalization of the theorem to programs with loops

Where this leads

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/YYCJPC/text.yaml