Page 88 - DCAP506_ARTIFICIAL_INTELLIGENCE
P. 88
Artificial Intelligence
Notes where the conclusion H is an atomic formula and the conditions Bi are literals, which are either
atomic formulas or the negations of atomic formulas. All variables are implicitly generally
quantified in front of the conditional. Conditionals in logic programs are also known as clauses.
Horn clauses are the particular case where all of the conditions are atomic formulae. Details are
the special case where n = 0 (there are no conditions) and there are no variables. At times clauses
that are not facts are also known as rules, inviting confusion with production rules.
Goals (or queries) are combination of literals, syntactically just like the conditions of clauses.
Though, all variables are unreservedly existentially quantified, and the purpose of the goal is to
discover an instantiation of the variables that makes the objective hold.
Example: Consider the three sentences:
If you contain the bus fare and you catch a bus and not something goes wrong with the bus
voyage, then you will go home for the weekend. ‘If you have the bus fare and you catch a bus’,
‘then you will go home for the weekend’; ‘You have the bus fare’ are a clause, a Horn clause, and
a fact correspondingly.
Observe that the second sentence can be considered as an imprecise version of the first sentence.
Observe too that the first two clauses both express “strong” domain-specific knowledge, instead
of the kind of weak knowledge that would be essential for general-purpose planning.
The sentence you will go home for the weekend is a simple, atomic goal.
Backward reasoning (from conclusions to conditions) considers conditionals as objective-
reduction procedures: to show/solve H, show/solve B1 …. Bn.
For instance, backward reasoning turns the conditionals:
If you study late in the library then you will finish the essay.
If you have the bus fare and you catch a bus, then you will go home for the weekend into the procedures:
To complete the essay, study late in the library.
To go home for the weekend, verify that you have the bus fare, and catch a bus.
Since conditionals in normal logic programming are utilized only backwards, they are usually
written backwards:
H if B1 …. Bn
So that backward reasoning is correspondent to “forward chaining” in the direction in which the
conditional is written. The Prolog syntax for clauses:
H :- B1 ,… , Bn
is intentionally ambiguous, so that clauses can be read either declaratively as conditionals
written backwards or procedurally as goal-reduction procedures implemented forwards.
While positive, atomic goals and sub-goals are resolved by backward reasoning, negative goals
and sub-goals of the form not G, where G is an atomic sentence, are resolved by negation as
failure: not G succeeds if and only if backward reasoning with the sub-goal G does not succeed.
Negation as failure makes logic programming a non-monotonic logic.
Example: Given only the clauses:
An object is red if the object appears red and not the object is illuminated by a red light.
82 LOVELY PROFESSIONAL UNIVERSITY