Ai Chapter 5
Ai Chapter 5
Introduction
• We have discussed various search techniques in previous units. Now we would consider a
set of rules that represents,
i. Knowledge about relationships in the world and
ii. Knowledge about how to solve problem using the content of the rules.
Logic Programming
• Logic programming is a programming paradigm in which logical assertions are viewed as
programs.
• These are several logic programming systems, PROLOG is one of them.
• A PROLOG program consists of several logical assertions where each is a horn clause i.e. a
clause with at most one positive literal.
Ex : P, P V Q, P → Q
• The facts are represented on Horn Clause for two reasons.
i. Because of a uniform representation, a simple and efficient interpreter can be
written.
ii. The logic of Horn Clause is decidable.
• The first two differences are from the fact that PROLOG programs are actually sets of Horn
clause that have been transformed as follows:-
1. If the Horn Clause contains no negative literal then leave it as it is.
2. Otherwise rewrite the Horn clauses as an implication, combining all of the negative
literals in to the antecedent of the implications and the single positive literal into the
consequent.
• This procedure causes a clause which originally consisted of a disjunction of literals (one of
them was positive) to be transformed into a single implication whose antecedent is a
conjunction universally quantified.
• But when we apply this transformation, any variables that occurred in negative literals and
so now occur in the antecedent become existentially quantified, while the variables in the
consequent are still universally quantified.
• The two searches may pass each other resulting in more work.
• Based on the form of the rules one can decide whether the same rules can be applied for
both forward and backward reasoning.
• If left hand side and right of the rule contain pure assertions then the rule can be reversed.
And so the same rule can be applied for both types of reasoning.
• If the right side of the rule contains an arbitrary procedure then the rule cannot be reversed.
• In this case while writing the rule the commitment to direction of reasoning must be made.
•