Algorithm Search⌘K

Definitioncore

Choice rule

Also called cardinality constraint rule, weight constraint rule.

An ASP rule whose head lets a solver include any subset of a set of atoms, within lower and upper bounds, when the body holds.

A choice rule is the "guess" part of most answer set programs. When its body holds, it lets an answer set contain any subset of its head atoms, and the optional bounds limit the size of that subset. It was introduced with the smodels system and its semantics is due to Simons, Niemelä and Soininen (2002). A choice rule can be rewritten as normal rules with new atoms, so it adds convenience but no expressive power over normal programs.

Definition

Let AA be a set of atoms. A choice rule is an expression

{a1,…,ak}←b1,…,bm,not c1,…,not cn\{a_1, \ldots, a_k\} \leftarrow b_1, \ldots, b_m, \mathit{not}\ c_1, \ldots, \mathit{not}\ c_n

with atoms ai,bi,cj∈Aa_i, b_i, c_j \in A and k≥1k \geq 1. Write B+={b1,…,bm}B^+ = \{b_1, \ldots, b_m\}, B−={c1,…,cn}B^- = \{c_1, \ldots, c_n\} and H={a1,…,ak}H = \{a_1, \ldots, a_k\}. A cardinality rule with bounds is

l {a1,…,ak} u←b1,…,bm,not c1,…,not cnl\ \{a_1, \ldots, a_k\}\ u \leftarrow b_1, \ldots, b_m, \mathit{not}\ c_1, \ldots, \mathit{not}\ c_n

with integers 0≤l≤u≤k0 \leq l \leq u \leq k. A missing ll means 00 and a missing uu means kk.

Let PP be a finite ground program of normal rules h←b1,…,bm,not c1,…,not cnh \leftarrow b_1, \ldots, b_m, \mathit{not}\ c_1, \ldots, \mathit{not}\ c_n, constraints and choice rules, and let M⊆AM \subseteq A. The reduct PMP^M is the positive program obtained as follows.

  1. Delete every rule and constraint whose B−B^- meets MM.
  2. In the other normal rules, delete the negative literals, as in the Gelfond-Lifschitz reduct.
  3. Replace each remaining choice rule by the rules a←b1,…,bma \leftarrow b_1, \ldots, b_m, one for each a∈H∩Ma \in H \cap M.

MM is an answer set of PP if MM is the least model of the positive part of PMP^M and MM violates no constraint. For a cardinality rule, MM must also satisfy l≤∣H∩M∣≤ul \leq |H \cap M| \leq u whenever B+⊆MB^+ \subseteq M and B−∩M=∅B^- \cap M = \emptyset.

Normal translation. The choice rule above has the same answer sets, restricted to AA, as the 2k2k normal rules

ai←b1,…,bm,not aˉi,aˉi←not ai(1≤i≤k),a_i \leftarrow b_1, \ldots, b_m, \mathit{not}\ \bar{a}_i, \qquad \bar{a}_i \leftarrow \mathit{not}\ a_i \qquad (1 \leq i \leq k),

where the aˉi\bar{a}_i are new atoms and BB is the body. The upper bound becomes one constraint ←B,ai1,…,aiu+1\leftarrow B, a_{i_1}, \ldots, a_{i_{u+1}} for each set of u+1u + 1 head atoms, and the lower bound becomes one constraint ←B,not ai1,…,not aik−l+1\leftarrow B, \mathit{not}\ a_{i_1}, \ldots, \mathit{not}\ a_{i_{k-l+1}} for each set of k−l+1k - l + 1 head atoms. This direct translation has (ku+1)+(kk−l+1)\binom{k}{u+1} + \binom{k}{k-l+1} constraints, so solvers handle the bounds natively or use counter atoms of polynomial size instead.

Examples and non-examples

  • Free choice. The program {a,b,c}←\{a, b, c\} \leftarrow has 88 answer sets, all subsets of {a,b,c}\{a, b, c\}. For M={a,c}M = \{a, c\}, the reduct is a←a \leftarrow, c←c \leftarrow, whose least model is MM.
  • Bounds. The program 1 {a,b,c} 2←1\ \{a, b, c\}\ 2 \leftarrow has 66 answer sets: {a},{b},{c},{a,b},{a,c},{b,c}\{a\}, \{b\}, \{c\}, \{a, b\}, \{a, c\}, \{b, c\}. The same answer sets come from {a,b,c}←\{a, b, c\} \leftarrow with the constraints ←a,b,c\leftarrow a, b, c and ←not a,not b,not c\leftarrow \mathit{not}\ a, \mathit{not}\ b, \mathit{not}\ c.
  • Conditional choice. The program {p}←q\{p\} \leftarrow q, q←not rq \leftarrow \mathit{not}\ r has the answer sets {q}\{q\} and {p,q}\{p, q\}. For M={p,q}M = \{p, q\}, the reduct is q←q \leftarrow, p←qp \leftarrow q, whose least model is {p,q}\{p, q\}. The atom pp is never chosen without qq.
  • Choice gives support to a cycle. The program {a}←\{a\} \leftarrow, b←ab \leftarrow a, a←ba \leftarrow b has the answer sets ∅\emptyset and {a,b}\{a, b\}. Without the choice rule, the positive cycle alone gives only ∅\emptyset, because nothing outside the cycle supports it.
  • Non-example: disjunction. The disjunctive rule a∨b←a \vee b \leftarrow is not a choice rule. Its answer sets are {a}\{a\} and {b}\{b\}, because a disjunctive answer set must be a minimal model, while {a,b}←\{a, b\} \leftarrow has the four answer sets ∅,{a},{b},{a,b}\emptyset, \{a\}, \{b\}, \{a, b\}, and 1 {a,b} 1←1\ \{a, b\}\ 1 \leftarrow has {a}\{a\} and {b}\{b\}.
  • Non-example: a choice is not a fact. The rule {a}←\{a\} \leftarrow does not make aa true. If no other rule mentions aa, the answer sets with and without aa both exist. A program that needs aa in every answer set uses the fact a←a \leftarrow.
  • Non-example: unsupported atoms. An atom in MM that is in the head of a choice rule whose body is false in MM is not justified by that rule. For example, {p}←q\{p\} \leftarrow q with no rule for qq has only the answer set ∅\emptyset.
  • Weight rule. A weight constraint l [a1=w1,…,ak=wk,not c1=v1,…] ul\ [a_1 = w_1, \ldots, a_k = w_k, \mathit{not}\ c_1 = v_1, \ldots]\ u counts the weights of the true literals instead of their number, and may contain negative literals. A cardinality constraint is the special case with all weights 11. Simons, Niemelä and Soininen (2002) define the stable models of programs with weight constraints in heads and bodies with one reduct. A weight rule is more general than a choice rule, so the alias "weight constraint rule" names a larger class than this page.
  • Cardinality constraint in a body. The literal l {a1,…,ak} ul\ \{a_1, \ldots, a_k\}\ u in a rule body is true in MM when l≤∣{a1,…,ak}∩M∣≤ul \leq |\{a_1, \ldots, a_k\} \cap M| \leq u. Unlike the head form, it only tests and never chooses.
  • Constraint. A rule ←B\leftarrow B with an empty head removes every candidate in which BB holds. Choice rules generate and constraints test, which is the generate-and-test pattern of ASP.
  • Disjunctive rule. A head a1∨⋯∨aka_1 \vee \cdots \vee a_k asks for a minimal set of true head atoms. It raises the complexity of existence to Σ2p\Sigma_2^p (Eiter and Gottlob), while choice rules keep it in NP.

References

  1. Patrik Simons, Ilkka Niemelä and Timo Soininen, Extending and implementing the stable model semantics, Artificial Intelligence 138(1-2), 181 to 234 (2002), the definitions of choice rules, cardinality constraints and weight constraints, and the reduct that defines their stable models
  2. Ilkka Niemelä, Logic programs with stable model semantics as a constraint programming paradigm, Annals of Mathematics and Artificial Intelligence 25(3-4), 241 to 273 (1999), the use of choice and cardinality constructs to encode NP search problems
  3. Martin Gebser, Roland Kaminski, Benjamin Kaufmann and Torsten Schaub, Answer Set Solving in Practice, Morgan and Claypool (2012), the introduction of choice rules and cardinality constraints in the input language

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