Logic programming represents knowledge and queries through logical clauses, letting an inference procedure search for substitutions making a query true. A fact such as parent(ada, ben) and a rule saying that a parent of a parent is a grandparent can answer a grandparent query without listing every answer explicitly. Prolog commonly combines unification with ordered goal search and backtracking. Declarative meaning and execution strategy must be distinguished: two logically equivalent rule orders can have different termination behaviour. The method connects mathematical logic to executable symbolic inference.
Negation as failure interprets failure of a specified proof search as a negative result. In the Prolog operation \+ Goal, the negative goal succeeds when trying Goal fails in finite time; it fails when Goal succeeds. A search that never finishes does not establish the negative result.[ref]
For example, suppose a finite knowledge base records penguin(opus) and has no rule capable of deriving penguin(robin). A search for penguin(robin) finitely fails, so its negation succeeds under this operational rule. That result relies on the chosen knowledge base and search semantics. Adding the missing fact changes the result; an unrecorded fact in the outside world has not been independently disproved.
Stable model semantics gives a related model-based interpretation for negative rule premises through the stable model reduct. The rules and have two stable models, and : in either candidate, the surviving rule forces exactly its one member. Neither atom follows by skeptical entailment. Operational finite failure and a chosen model semantics must therefore be distinguished when interpreting a negative rule.
Rule evaluation that repeatedly adds consequences of premises already known to hold. Positive Datalog evaluation computes its least Herbrand model in this way.
Goal-directed rule evaluation that replaces a goal by premises of a matching rule. Shared variables require consistent answer first-order substitutions across the premises.
A function-free rule language based on definite first-order Horn clauses, normally with safety conditions on rule variables. Positive Datalog has a least Herbrand model obtained by forward chaining.
Datalog allowing disjunctions of positive atoms in rule heads. A satisfiable program can have incomparable minimal Herbrand models and no least Herbrand model.
Datalog with negative body premises. Its meaning depends on the specified semantics, such as stable model semantics or evaluation of a stratified Datalog program.
A Datalog with negation program whose predicates can be assigned levels so that positive premises do not exceed their head's level and negative premises have strictly lower levels. Finite programs of this form can be evaluated stratum by stratum and have a unique stable model.
A semantics in which an interpretation must equal the least Herbrand model of its own stable model reduct. Some programs have no stable model, and others have several.
A consequence holds skeptically if it is true in every admitted model, in particular every stable model when using stable model semantics. Exhibiting one supporting stable model establishes only existence of support, not skeptical entailment.
Ground the rules, delete every rule having a negative body atom true in the candidate , and remove all remaining negative premises. The result is a positive program whose least Herbrand model is compared with .
A Herbrand interpretation equal to the least Herbrand model of the positive reduct obtained relative to that interpretation.

Articles by others on the same topic (1)

Logic programming is a programming paradigm that is based on formal logic. In this paradigm, programs are expressed in terms of relations, represented as facts and rules, rather than through imperative commands that explicitly detail a sequence of operations. The central concept in logic programming is that of a logical statement, which can be expressed in terms of predicates and logical connectives.