User:Michael Gelfond/Draft ASProlog
Answer Set Prolog
[edit]Introduction
[edit]Answer Set Prolog (also known as A-Prolog or ASP-Prolog) is a language for knowledge representation and reasoning based on the answer set semantics of logic programs. The language has its roots in declarative programming, the syntax and semantics of standard Prolog, disjunctive databases and non-monotonic logic. Answer Set Prolog allows the expression of disjunction and "classical" or "strong" negation, and has the ability to represent and reason about many important kinds of statements including defaults (statements of the form Elements of class C normally satisfy property P) and exceptions to defaults, causal effects of actions (statement F becomes true as a result of performing an action a), statements expressing lack of information (it is not known if statement P is true or false), various completeness assumptions (statements not entailed by the knowledgebase are false), recursive definitions, etc.
Syntax and Informal Semantics
[edit]A logic program of Answer Set Prolog is a collection of rules of the form:
where 's are literals (an atom or its negation ). Connectives and are called negation as failure or default negation, and epistemic disjunction respectively. The connective is used instead of the classical '' to stress the difference between the two connectives. A rule with variables (written in uppercase) is viewed as a set of its ground instantiations - rules obtained from by replacing 's variables by constants.
Rules of a logic program can be viewed as a collection of constraints that must be satisfied by the beliefs of a rational reasoner associated with . A set of beliefs satisfies a rule if whenever to belong to and none of to belong to , then at least one of to belong to .
The answer set semantics assigns to a logic program a collection of answer sets: Sets of literals from corresponding to possible sets of beliefs built by a rational reasoner on the basis of the rules of . In the construction of such a set of beliefs , the reasoner is assumed to be guided by the following informal principles:
- must satisfy the rules of
- The reasoner should adhere to the rationality principle, which says: one shall not believe anything one is not forced to believe.
Programs of Answer Set Prolog can have one, many, or zero answer sets.
Examples
[edit]Example : Defaults
[edit]Normally, computers come preloaded with software. Brand x computers are an exception to this rule, they may or may not come loaded with software. Computers assembled from parts do not come preloaded with software.
The following logic program represents the above knowledge
This program has one answer set which includes:
.
Notice that neither nor
is concluded.
This example underscores the difference between and with respect to an answer set
. The former corresponds to a belief that is false (),
while the later only asserts the absence of belief in ().
Example : Actions and their effects
[edit]In a room are two bulbs each connected to a swich. Switching a bulb's switch turns the bulb on. At timestep 0 both bulbs are off, and bulb #2 is switched.
The following program represents this knowledge
This program has one answer set which includes
.
The last rule of the program effectively represents the law of inertia: bulbs remain off unless they are explicitly turned on.
Example : Multimple answer sets
[edit]Cars have manual or automatic transmissions.
The corresponding program:
has two answer sets,
and
Example : Incomplete information
[edit]Objects whose location is unknown are missing.
As in the following example program:
The program has one answer set that includes,
.
Inference Engines
[edit]There exists a comparatively large number of inference engines (program that compute answer sets) associated with Answer Set Prolog. Systems based on goal-oriented SLDNF-resolution of "classical" Prolog and its variants are sound with respect to the answer set semantics. The same is true for fix-point computations of deductive databases. These systems can be used for answering queries to a subset of Answer Set Prolog which does not contains disjunction, "strong" negation, and rules with empty heads. Recently, inference engines with specialized algorithms aimed at computing the answer sets of arbitrary Answer Set Prolog programs have come of age. These engines are often referred as answer set solvers. Another recently developed approach reduces the computation of answer sets to (possible multiple) calls to satisfiability solvers.
List of Inference Engines:
Extensions
[edit]There is substantial and mathematically elegant extensions of the original Answer Set Prolog. Expanding answer set programming by aggregates - functions on sets - is approaching its final solution. Weak constraints and consistency restoring rules have been introduced to deal with possible inconsistencies. Also, the rules of the language have been generalized to allow nested logical connectives and various means to express preferences between answer sets. The logical reasoning of Answer Set Prolog has also been combined with probabilistic reasoning and with qualitative optimization. All these languages have at least experimental implementations and an emerging theory and methodology of use.