Professional Documents
Culture Documents
INTELLIGENCE 18CS753
Module-2:
KNOWLEDGE
REPRESENTATION ISSUES
By
Dr. Srividya R
Representations and Mapping
✔ There are variety of ways of representing knowledge (facts) used in
AI programs.
• Suppose there is a logical representation of fact that all dogs have tails:
x : dog(x) hastail(x)
✔ Knowledge about objects, their attributes, & their values may not be
simple.
✔ We can augment basic representation with inference mechanisms.
✔ one `of the most useful forms of inference is property inheritance
✔ Lines attributes
✔ Boxed nodes objects
✔ Boxed nodes values of attributes of objects
Inheritable Knowledge
✔ The structure shown in the figure is a slot-and-filler structure.
✔ Usually the use of the term frame system implies somewhat more
structure on the attributes & inference mechanisms than the term
semantic network.
Property Inheritance
✔ Idealized form of property inheritance algorithm is stated below:
Algorithm: Property Inheritance
▪ Batting-average(Three-Finger Brown)=0.106
No explicit batting average given. So follow instance attribute & extract
the value stored there.
▪ Bats(Three-Finger-Brown)= Right.
To get value for the attribute bats required going up the isa hierarchy to
the class Baseball-Player.
Inferential Knowledge
✔ Property inheritance is a powerful form of inference.
1. Inverses .
1. Single-valued attributes.
Inverses
✔ Entities in the world are related to each other in many different
ways.
Second: Use attributes that focus on a single entity but to use them in
pairs
One inverse of the other.
✔ Ex- baseball player @ any one time have single height value & can
be in only one team.
✔ We can write it as
Saw(agent(John), object(Sue), timespan(briefly)
• Or a single action
1. Cause hand/foot to move fast & crash into the window.
• Or a single action
1. Shut the window so hard that the glass breaks.
1. Some properties are true of sets but are not true of the individual
members of a set.
✔ And answer “yes” to the question- Did John eat dinner last night?
• How to find a better structure if the one chosen initially turns out not
to be appropriate.
Frame problem: The problem of representing the facts that change as well
as those that do not is know as the frame problem.
Frame Axioms: To support reasoning , some systems make use of explicit
set of axioms called frame axioms.
• We can write axioms as folows:
color(x,y,s1) Ʌ move(x,s1,s2) color(x,y,s2)
• An alternate assumption that can be made is “the only things that
change are the things that must”
INTRODUCTION TO ARTIFICIAL
INTELLIGENCE 18CS753
Module-2:
USING PREDICATE LOGIC
By
Dr. Srividya R
Representing Simple Facts In Logic
✔ Propositional logic is appealing because it is simple to deal with & a
decision procedure for it exists.
It is raining
RAINING
It is sunny
SUNNY
It is windy
WINDY
If it is raining, then it is not sunny
RAINING רSUNNY
7. People only try to assassinate rulers they are not loyal to.
V x: Vy: person(x) Ʌ ruler(y) Ʌ tryassassinate(x,y) רloyalto(x,y)
In order to prove the goal, use the rules of inference to transform it into
another goal.
Representing Simple Facts In Logic
Here an attempt is made to produce a proof of the goal.
The problem is that we do not have ways to conclude that Marcus was a
person.
• This representation says that one is dead in all years after the one in
which one died.
NOTE:
Modus ponens: a rule used to draw logical conclusions.
RESOLUTION
✔ Resolution is a procedure,
• hate Caesar Or
• Think that anyone who hates anyone is crazy.
The statements
Suppose all Romans who know Marcus either:
• hate Caesar Or
• Think that anyone who hates anyone is crazy.
2. Reduce the scope of each רto a single term, using the fact that ר(רp)=p
Vx: [רRoman (x)V רknow(x, Marcus)]V [hate(x,Caesar)V (Vy: Vz: רhate(y,z)) V
thinkcrazy(x,y))]
4. Move all quantifiers to left of the formula without changing their relative
order.
Algorithm: Convert to Clause Form
5. Eliminate existential quantifiers.
• After applying this entire procedure to set of wff’s , we will have clauses.
• The 2 clauses: winter and רwinter will produce the empty clause.
Resolution in Propositional Logic
• In propositional logic, the procedure for producing a proof is as follows:
1. Negate P (proposition) and convert the result to clause form. Add it to set
obtained in 1.
• Resolution process takes a set of clauses that are assumed to be true & it
generates new clauses.
Resolution in Propositional Logic
• In order for proposition 2 to be true : either רP, רQ or R must be true.
• If רR is assumed to be true, then either P or Q should be true for
proposition 2 to be true.
• Proposition 1 says P is true, then רP cannot be true.
• רQ is the only way for proposition 2 to be true.
• Proposition 4 can be true if רT or Q is true.
• WKT רQ is true ,
• The only way for proposition 4 to be true is רT .
• But proposition 5 says T is true.
• Thus there is no way for all these clauses to be true in single interpretation.
• Cannot be unified.
• If predicate match then arguments must be checked.
The Unification Algorithm
Complication :
To find a Single , Consistent substitution for the entire literal.
• For Example:
P(x,x) and P(y,z) // Two instances of P match
(Marcus/x,z/y)
(Marcus/x, y/z)
(Marcus/x, Caesar/y, Caesar/z)
(Marcus/x, Polonius/y, Polonius/z)
• Unify(L1,L2) procedure returns list of substitutions performed during
match.
Unification Algorithm: Unify(L1,L2)
Algorithm: Unify(L1,L2)
a. Call Unify with the ith argument of L1 and ith argument of L2, putting
result in S.
6. Return SUBST
1. Negate P (proposition) and convert the result to clause form. Add it to set
of clauses obtained in step 1.
✔ one of the clauses that is part of the statement we are trying to refute
or
1. man(Marcus).
2. Pompeian(Marcus).
3. רPompeian(x1) V Roman(x1)
4. ruler(Caesar)
5. רRoman(x2) V loyalto(x2, Caesar) V hate(x2,Caesar)
6. loyalto(x3,f(x3)) // every one is loyalto someone: loyalto(x,y)
7. רman(x4) V רruler(y1) V רtryassassinate(x4,y1) V רloyalto(x4,y1) .
8. tryassassinate(Marcus,Caesar)
Prove: hate(Marcus,Caesar)
Resolution in Predicate Logic
• Suppose our actual goal in proving the assertion
hate(Marcus, Caesar)
• Was to answer the question
“ Did Marcus hate Caesar ?”
empty clause.
The Need to Try Several Substitutions
• Resolution provides a very good way of finding a refutation proof
without actually trying all the substitution.
• Example:
hate(Marcus, Paulus)
hate(Marcus, Julian)
1. finding known statement that matches the terms given in the question
and
1. then responding with another piece of that statement that fills the slot.
• For Ex: to answer the question “ when did Marcus die?”, we need
statement of the form
died(Marcus,??)
• With ?? Actually filled in by some particular year.
• Since we can prove died(Marcus,79) we can respond with the answer 79.
Natural Deduction
Issues with Resolution:
Natural Deduction:
Another technique is
• Also suggest the way that those implications can be used in proofs.
INTRODUCTION TO ARTIFICIAL
INTELLIGENCE 18CS753
Module-2:
Representing Knowledge
Using Rules
By
Dr. Srividya R
Procedural Vs Declarative Knowledge
• Logical assertions can be viewed as declarative or procedural
representation.
Man(Marcus)
Man(Caesar)
Ɐx: man(x) person(x)
Person(Cleopatra)
Procedural Vs Declarative Knowledge
• To find answer to question
Ǝy: person(y)
• Viewed declaratively : this is the same knowledge base that we had before.
• now Marcus is found to satisfy subgoal & thus also the goal.
• HORN CLAUSE: it has at most one positive literal. Ex: p, רp V q and p q…
• The program is read top to bottom, left to right & search is performed
depth-first with backtracking.
• The first rule will fail because there are no assertions (belief) about the
predicate cat in the program.
• Second will eventually lead to success using the rule about dogs & poddles
and using the fact poodle(fluffy)
• Closed world assumption : it states that all real assertions are contained
in knowledge base or derived from assertions in knowledge base.
Logic Programming
Advantage
DIsAdvantage
A cut can be inserted into a rule to specify a point that may not be
backtracked over.
Forward Vs Backward Reasoning
• The objective of search procedure is to discover a path from an initial
configuration to a goal state.
3. Generate next level by taking each node generated at the previous level
and
• use the left sides to generate the nodes at this 2nd level of tree.
3. Generate next level by taking each node generated at the previous level
and
• Rules are matched with unification procedure and in the order they appear.
• Ex: suppose we sense searing heat near our hand we jerk our hand
away.
• In forward chaining rule systems, left sides of rules are matched against
the state description.
• Rules that match dump their right-hand side assertions into the state,
and the process repeats.
Forward-Chaining Rule Systems
• Matching is typically more complex for forward-chaining systems than
backward ones.
• Consider a rule that checks for some condition in the state description &
then adds an assertion.
• After the rule fires , its conditions are still valid, so it could fire again
immediately.
• Also supply several mechanisms for preferring one rule over another.
Combining Forward and Backward Reasoning
• Sometimes certain aspects of a problem are best handled via forward
chaining & other aspects by backward chaining.
• Then forward chain on those facts to deduce the nature / cause of the
disease.
• Suppose left side of rule was satisfied- say 9 of 10 preconditions are met
then backward chaining can be applied to satisfy 10th precondition.
• If arbitrary procedures are allowed as right side of rule then the rule
will not be reversible.
Clever search involves choosing from among the rules that can be
applied at a particular point
To extract from the entire collection of rules those that can be applied at
a given point requires
some kind of matching between the current state and the preconditions of
the rules.
Indexing
• 1-way to select applicable rules is to do a simple search through all the
rules , comparing each one’s preconditions to the current state and
extracting all the ones that match.
• There are 2 problems with this simple solution:
• All the rules that describe given board position will be stored under
same key & so will be found together.
• Rule based systems compute the whole set of rules, that match the
current state descriptions.
• For few problems, all action lies in matching of rules to the problem
state.
• ELIZA matched left sides of rules against user’s last sentence & using
appropriate right side to generate a response.
• Ex- “ my brother is mean to me”
“who else in your family is mean to you” or “tell me more about your
family”
1. First & simplest is, to consider the rules to have been specified in a
particular order.
2. Other scheme is to give priority to special case rules than general rules.
• So matcher is built to prevent this. Matcher rejects rules that are more
general.
Preference based on rule
• Now, how can the matcher decide whether its general or not.
1. If preconditions of one rule are the same as those of another except that
• ELIZA used the fact that some keywords are more significant than
others.
• Then, using heuristic function that can evaluate each of the resulting
states.
compare the merits of the results & select the preferred one.
• In SOAR:
1. All intermediate & final results of problem solving are remembered for
future
reference.
Control Knowledge-PRODIGY
• It’s a general purpose problem solving system.
• AI programs may paint first , later realize that sanding may remove the
paint if sanded after painting.
1. If subgoals include sealing and painting, then consider type of the object.
• If object is made of wood then seal it before painting.