0% found this document useful (0 votes)
27 views5 pages

Ai Chapter 5

This document discusses different ways of representing knowledge using rules. It describes procedural knowledge as embedding control information within the knowledge itself, like in programs, while declarative knowledge specifies facts without indicating how to use them. Logic programming uses logical assertions as programs, with PROLOG representing facts as Horn clauses to allow for efficient and decidable interpretation. Knowledge can be reasoned with forward from initial states or backward from goals, and production systems view these as symmetric processes. Factors like start/goal set sizes, branching, and triggering events influence the choice of reasoning direction.

Uploaded by

d2gb6whnd9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views5 pages

Ai Chapter 5

This document discusses different ways of representing knowledge using rules. It describes procedural knowledge as embedding control information within the knowledge itself, like in programs, while declarative knowledge specifies facts without indicating how to use them. Logic programming uses logical assertions as programs, with PROLOG representing facts as Horn clauses to allow for efficient and decidable interpretation. Knowledge can be reasoned with forward from initial states or backward from goals, and production systems view these as symmetric processes. Factors like start/goal set sizes, branching, and triggering events influence the choice of reasoning direction.

Uploaded by

d2gb6whnd9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

5 – Representing Knowledge Using Rules

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.

Procedural versus Declarative Knowledge


Procedural Knowledge
• A representation in which the control information that is necessary to use the knowledge is
embedded in the knowledge itself for e.g. computer programs, directions, and recipes;
these indicate specific use or implementation;
• The real difference between declarative and procedural views of knowledge lies in where
control information reside.
• For example, consider the following
Man (Marcus)
Man (Caesar)
Person (Cleopatra)
∀ x: Man(x) → Person(x)
Now, try to answer the question. ?Person(y)
The knowledge base justifies any of the following answers.
Y=Marcus
Y=Caesar
Y=Cleopatra
• We get more than one value that satisfies the predicate.
• If only one value is needed, then the answer to the question will depend on the order in
which the assertions are examined during the search for a response.
• If the assertions are declarative then they do not themselves say anything about how they
will be examined. In case of procedural representation, they say how they will be examined.
Declarative Knowledge
• A statement in which knowledge is specified, but the use to which that knowledge is to be
put is not given.
• For example, laws, people's name; these are the facts which can stand alone, not dependent
on other knowledge;
• So to use declarative representation, we must have a program that explains what is to be
done to the knowledge and how.
• For example, a set of logical assertions can be combined with a resolution theorem prover
to give a complete program for solving problems but in some cases the logical assertions can
be viewed as a program rather than data to a program.
• Hence the implication statements define the legitimate reasoning paths and automatic

Gopi Sanghani, CE Department | 2180703 – Artificial Intelligence 1


5 – Representing Knowledge Using Rules
assertions provide the starting points of those paths.
• These paths define the execution paths which is similar to the ‘if then else “in traditional
programming.
• So logical assertions can be viewed as a procedural representation of knowledge.

Differences Between Declarative knowledge and procedural knowledge


Procedural knowledge Declarative knowledge
High efficiency Higher level of abstraction
Low modifiability Good modifiability and good
readability
Low perceptive adequacy (better for Suitable for independent facts
knowledge engineers)
Produces creative, reflective thought and Good cognitive matching (better for
promoters critical thinking and independent domain experts and end-users) and
decision making low computational efficiency.

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.

Gopi Sanghani, CE Department | 2180703 – Artificial Intelligence 2


5 – Representing Knowledge Using Rules
• For example the PROLOG clause P(x): - Q(x, y) is equal to logical expression x: y: Q (x, y) →
P(x).
• The difference between the logic and PROLOG representation is that the PROLOG
interpretation has a fixed control strategy and so the assertions in the PROLOG program
define a particular search path to answer to any question.
• But, the logical assertions define only the set of answers but not about how to choose
among those answers if there is more than one.
• Consider the following example:
A. Logical representation
x : pet(x) ۸ small (x) → apartmentpet(x)
 x : cat(x) ۷ dog(x) → pet(x)
x : poodle (x) → dog (x) ۸ small (x)
poodle (fluffy)
B. Prolog representation
apartmentpet (x) : -- pet(x), small (x)
pet (x): -- cat (x)
pet (x) :-- dog(x)
dog(x) :-- poodle (x)
small (x) :-- poodle(x)
poodle (fluffy)

Forward versus Backward Reasoning


• A search procedure must find a path between initial and goal states.
• There are two directions in which a search process could proceed.
• The two types of search are:
1. Forward search which starts from the start state
2. Backward search that starts from the goal state
• The production system views the forward and backward as symmetric processes.
• Consider a game of playing 8 puzzles. The rules defined are
o Square 1 empty and square 2 contains tile n. →
▪ Square 2 empty and square 1 contains the tile n.
o Square 1 empty Square 4 contains tile n. →
▪ Square 4 empty and Square 1 contains tile n.
• We can solve the problem in 2 ways:
1. Reason forward from the initial state
o Step 1. Begin building a tree of move sequences by starting with the initial
configuration at the root of the tree.
o Step 2. Generate the next level of tree by finding all rules whose left hand side
matches against the root node. The right hand side is used to create new

Gopi Sanghani, CE Department | 2180703 – Artificial Intelligence 3


5 – Representing Knowledge Using Rules
configurations.
o Step 3. Generate the next level by considering the nodes in the previous level and
applying it to all rules whose left hand side match.
2. Reasoning backward from the goal states:
o Step 1. Begin building a tree of move sequences by starting with the goal node
configuration at the root of the tree.
o Step 2. Generate the next level of tree by finding all rules whose right hand side
matches against the root node. The left hand side is used to create new
configurations.
o Step 3. Generate the next level by considering the nodes in the previous level and
applying it to all rules whose right hand side match.
• The same rules can be used in both cases.
• In forward reasoning the left hand sides of the rules are matched against the current state
and right sides are used to generate the new state.
• In backward reasoning the right hand sides of the rules are matched against the current
state and left sides are used to generate the new state.
• There are four factors influencing the type of reasoning. They are,
1. Are there more possible start or goal state? We move from smaller set of sets to the
longer.
2. In what direction is the branching factor greater? We proceed in the direction with
the lower branching factor.
3. Will the program be asked to justify its reasoning process to a user? If, so then it is
selected since it is very close to the way in which the user thinks.
4. What kind of event is going to trigger a problem-solving episode? If it is the arrival of
a new factor, forward reasoning makes sense. If it is a query to which a response is
desired, backward reasoning is more natural.
• Example 1: It is easier to drive from an unfamiliar place from home, rather than from home
to an unfamiliar place. If you consider a home as starting place an unfamiliar place as a goal
then we have to back track from unfamiliar place to home.
• Example 2: Consider a problem of symbolic integration. The problem space is a set of
formulas, which contains integral expressions. Here START is equal to the given formula with
some integrals. GOAL is equivalent to the expression of the formula without any integral.
Here we start from the formula with some integrals and proceed to an integral free
expression rather than starting from an integral free expression.
• Example 3: The third factor is nothing but deciding whether the reasoning process can
justify its reasoning. If it justifies then it can be applied. For example, doctors are usually
unwilling to accept any advice from diagnostics process because it cannot explain its
reasoning.
• Example 4: Prolog is an example of backward chaining rule system. In Prolog rules are
restricted to Horn clauses. This allows for rapid indexing because all the rules for deducing a

Gopi Sanghani, CE Department | 2180703 – Artificial Intelligence 4


5 – Representing Knowledge Using Rules
given fact share the same rule head. Rules are matched with unification procedure.
Unification tries to find a set of bindings for variables to equate a sub-goal with the head of
some rule. Rules in the Prolog program are matched in the order in which they appear.

Combining Forward and Backward Reasoning


• Instead of searching either forward or backward, you can search both simultaneously.
• That is, start forward from a stating state and backward from a goal state simultaneously
until the paths meet.
• This strategy is called Bi-directional search. The following figure shows the reason for Bi-
directional search to be ineffective.

• 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.

Forward Reasoning (goal driven) Backward Reasoning (data driven)

Gopi Sanghani, CE Department | 2180703 – Artificial Intelligence 5

You might also like