ASP / Clingo Flashcards
What does ASP stand for?
Answer Set Programming
Define an atom in the context of ASP.
An atom is a basic unit of meaning in ASP, usually representing a proposition.
What is a literal?
A literal is an atom or its negation.
Identify the atoms in the following ASP statement: a :- b, not c.
The atoms are a, b, and c.
What is Clingo?
Clingo is a software package that includes an ASP grounder (gringo) and solver (clasp). It’s used to find stable models of logic programs.
Name a primary function of Clingo’s grounder (gringo).
It converts a high-level logic program into a ground (variable-free) format.
Name a primary function of Clingo’s solver (clasp).
It finds the stable models of a ground logic program.
Define a rule in ASP.
A rule in ASP is a statement of the form head <- body, where head is an atom and body is a conjunction of literals.
What does the head of a rule represent?
The head represents what is derived when the body of the rule is satisfied.
What does the body of a rule represent?
The body represents the conditions that must be satisfied for the head to be derived.
Identify the head and body in the following ASP rule: a :- b, not c.
The head is a and the body is b, not c.
What is a stable model?
A stable model is a set of atoms that represents a possible world where all the rules of the program are satisfied.
How does a stable model relate to ground instances?
A stable model is a set of ground instances of atoms that make the program self-consistent.
Are stable models unique?
No, an ASP program can have multiple stable models, or none at all.
What are ground instances in ASP?
Ground instances are specific atoms that result from substituting all variables in a rule with concrete terms. For example, for the rule p(X) :- q(X, Y), r(Y). and terms X = 1, Y = 2, the ground instance is p(1) :- q(1, 2), r(2).
What does negation as failure mean in the context of stable models?
Negation as failure, denoted as not a, means that a is not part of the stable model. In other words, not a is true in a stable model if a cannot be derived from the program rules given the stable model.
How would you write a rule to express that if a is true then b must be true?
b :- a.
How would you write a rule to express that c is true only if a and b are false?
c :- not a, not b.