AI Glossary / Graphs and symbolic AI / Advanced
Answer sets
Definition
Answer sets are the stable models of a logic program used in answer set programming. Each answer set specifies a collection of ground atoms, or appropriately represented literals, that satisfies the program's stable-model semantics. In a problem-solving encoding, an answer set can represent one admissible schedule, configuration, plan, or other solution.
What it means
An answer set is a formal interpretation of rules, not a list of sentences written in response to questions. Its elements might include assigned(task1,morning) or selected(componentA), depending on the vocabulary of the program.
Several answer sets can describe alternative solutions. An atom appearing in one alternative need not hold in every alternative. This distinction is important when an application presents what is possible versus what is unavoidable under the model.
The word stable has a mathematical meaning here. It does not mean that the solution is resistant to changing inputs, psychologically consistent, or safe for deployment. Changing a fact or rule can change which answer sets exist.
How it works
For a finite ground normal logic program without strong negation, a standard test starts with a candidate set M of atoms. Remove each rule whose body contains default negation not A when A belongs to M. In the remaining rules, remove the default-negated body conditions.
The resulting positive program is called the reduct. Compute its least model: the atoms forced by its facts and rules. M is a stable model when it is exactly that least model. This prevents a candidate from adding unsupported atoms merely because ordinary implications do not forbid them.
This introductory construction has a defined scope. Richer ASP languages include disjunctions, choice rules, aggregates, and other constructs with corresponding semantic definitions. Their details should not be inferred by applying a simplified recipe indiscriminately.
In practical use, a solver finds answer sets rather than asking a person to try every candidate manually. The reduct is useful for understanding what the outputs mean, even when the implementation uses more sophisticated search methods.
Three practical examples
1. A scheduling model has two answer sets representing different feasible allocations. A coordinator can compare the alternatives instead of treating the first as the only possible schedule.
2. A configuration model produces no answer set after incompatible requirements are added. The team investigates the requirements and encoding rather than assuming the solver has selected an empty product.
3. A reasoning application asks whether a property appears in every answer set or only in some. These questions distinguish necessary consequences from possible outcomes within the program.
Think of it this way
Think of answer sets as internally justified completed versions of a rule-governed worksheet. Each version fills in a coherent combination supported by the rules.
The analogy is limited because stable-model semantics is stricter than simply avoiding visible contradictions on a form. A candidate can satisfy ordinary implications yet fail the stability test because some entries lack the required support. The formal definition determines which completed versions count.
Worked example
Consider an original two-rule program: day holds if night is not selected, and night holds if day is not selected. In conventional notation, these are day :- not night and night :- not day.
Test M = {day}. The first rule remains and becomes the fact day, because night is absent from M. The second rule is removed because its condition not day conflicts with day being in M. The reduct's least model is {day}, so M is stable.
By the same reasoning, {night} is stable. The empty candidate is not stable: both rules become facts, so the least model is {day, night}. The candidate {day, night} is also not stable: both rules disappear, leaving the empty least model.
Thus the program has exactly two answer sets, {day} and {night}. It has no rule assigning probabilities to them. Calling one a 50% outcome would add an assumption absent from the program. The names day and night are toy symbols, not a model of astronomical time.
Illustrative case study
Fictional case: Fern Events uses a small ASP model to choose one of two permitted room layouts. Both answer sets satisfy the stated capacity rules, but only one includes a particular aisle arrangement.
The interface initially describes that aisle as required. Reviewers correct the wording: it is present in one feasible alternative, not in every alternative. This invented case illustrates interpretation of multiple models; it reports no deployed system or measured improvement.
Common misconceptions and mistakes
An empty answer set and no answer sets are different. The former is a valid model containing no atoms; the latter means that no stable model exists for the program.
Do not combine all atoms from different answer sets and assume the union is another valid answer set. Alternative solutions may contain mutually incompatible choices.
Default negation is also distinct from explicit negative information. The meaning of not approved differs from a separately represented claim that approval is false. Finally, a displayed subset of atoms may hide other atoms in the full model, so output filtering should not be confused with the underlying semantics.
Business use
Understanding answer sets helps business users interpret outputs from symbolic decision-support tools. The relevant question is whether the system found one feasible option, all requested alternatives, or an option proved optimal under an objective.
Reviewers should also distinguish properties common to all solutions from choices specific to one. A decision may depend on flexibility that a single displayed model conceals. When a solver stops early, its partial search record does not justify claims about every possible answer set. The program's assumptions and the solver's completion status should accompany consequential conclusions.
People also ask
Must an answer set contain every true-looking atom?
No. Membership is governed by the program's stable-model semantics, including support requirements.
Do two answer sets have equal probability?
Not by default. A set of alternatives is not automatically a probability distribution.
Is an empty answer set a failure?
Not necessarily. It can be a valid stable model; having no answer set is a different result.
Check your understanding
One answer set contains red and another contains blue. Does that show red holds in every answer set?
Answer: No. It establishes red in one alternative only; a claim about all alternatives requires checking all relevant models.
Related terms
- Answer set programming
- Reduct
- Grounding
- stable-model semantics
- default negation
- least model
- skeptical reasoning
- credulous reasoning
Learn next
Next, compute reducts for a few tiny normal programs. Include a program with one empty answer set and a program with none, then explain the operational difference without relying on output labels alone.
More in Graphs and symbolic AI
- Angelic nondeterminism - Angelic nondeterminism interprets an unresolved choice as one that can be made in favor of achieving a specified objective.
- Angelic semantics - Angelic semantics gives a high-level planning action meaning in terms of the states reachable by at least one permitted refinement into primitive actions.
- Answer literal - An answer literal is a specially introduced logical literal that carries the values of query variables through a resolution proof.
- Anytime A* - Anytime A* is a form of heuristic search that retains a solution once one is found and continues searching for better solutions when more computation time...
- Anytime algorithm - An anytime algorithm is designed to provide a usable result within a flexible computation budget and improve result quality when more computation is available.
- Apprenticeship Learning - Apprenticeship learning is learning to perform a task from demonstrations of an expert's behavior.
Sources
Ferraris, Lee, and Lifschitz, Stable Models and Circumscription: https://www.cs.utexas.edu/~ai-lab/pubs/smcirc.pdf
Vladimir Lifschitz, What Is Answer Set Programming?: https://www.cs.utexas.edu/~vl/papers/wiasp.pdf
Primary semantic accounts read. The reduct walkthrough is explicitly restricted to ground normal rules; examples and interpretations are original.
Previous: Answer set programming Next: Ant Colony Optimization