2. Knowledge Representation
• An artificial intelligence system is capable
of not only storing and manipulating data,
but also of acquiring, representing, and
manipulating knowledge.
3. Knowledge Representation
In automated AI systems, key issues:
• Knowledge acquisition:
The transformation of potential problem-
solving expertise from some knowledge source
to a program.
• Knowledge representation:
As a set of sentences of first order logic
symbolic encoding of propositions
4. • Knowledge reasoning:
Deducing logical consequences
manipulation of symbols encoding propositions
to produce representations of new
propositions.
5. Knowledge Representation
• Knowledge representation concerns the
mismatch between human and computer
'memory’.
• We call these representations knowledge
bases, and the operations on these
knowledge bases, inference engine
6. What to Represent?
• Facts: truths about the real world and what
we represent.
• Representation of the facts:
Which we manipulate. We define the
representation in terms of symbols that
can be manipulated by programs.
7. Knowledge Representation
Four major representation types
• Logical Representations(First order logic)
• Semantic Networks
• Production Rules
• Frames
9. First-order logic
• Whereas propositional logic assumes the
world contains facts,
• first-order logic (like natural language)
assumes the world contains
– Objects: people, houses, numbers, colors,
baseball games, wars, …
– Relations: has brother of, bigger than,…
– Functions: has father, plus, angle in cosine …
10. Example
• “One plus two equals three”
– Objects: One, Two, Three
– Relation: equals
– Function: plus
• “Evil King John ruled England in 1200”
– Objects: John, England, 1200
– Relation: ruled
– Properties: evil, King
11. First-order logic
• In proposition logic every expression is a
sentence which represent a fact
• FOL also has sentences, but it also has
• Terms which represents objects
12. Syntax of FOL: Basic elements
• Constants KingJohn, A, B, 2...
– An interpretation must specify which object in
the world is referred to by each constant.
– Each constant symbol names exactly one
object
– But not all the objects need to have names
– Some have several names. For example, the
symbol john in one particular interpretation
might refers to evil King John, King of
England from 1199 to 1216 and younger
brother of Richard the Lionheart.
13. Syntax of FOL: Basic elements
• Predicates Brother, >,...
– An interpretation specifies that a predicate symbol
refers to a particular relation in the model
– For example, the Brother symbol might refer to the
relation of brotherhood
– In a given model, the relation is defined by the set of
tuples of objects that satisfy it
– For example, in the model containing two objects
John and Richard, relation of brotherhood is defined
by set of tuples
{(John, Richard), (Richard, John)}
14. Syntax of FOL: Basic elements
• Functions Sqrt, LeftLegOf,...
– Functional relation are those in which any given object is related
to one other object by the relation
– For example, angle has only one number that is its cosine or any
person has only one person that is his or her father
– Unlike predicate symbols which are used to state that relations
hold among certain objects, functional symbols are used to refer
to particular objects without using their names
• Variables x, y, a, b,...
• Connectives , , , ,
• Equality =
• Quantifiers ,
15. Syntax of FOL
• Nor
• implies
• and
• or
• if and only if
16. Universal and Existential
• Universal quantification – (x)P(x) means
that P holds for all values of x in the
domain associated with that variable –
E.g., (x) dolphin(x) # mammal(x)
• Existential quantification – (x)P(x) means
that P holds for some value of x in the
domain associated with that variable –
E.g., ( x) mammal(x) ! lays-eggs(x) –
Permits one to make a statement about
some object without naming it/
17. FOL
• It is raining.
RAINING
• It is sunny.
SUNNY
• It is windy.
WINDY
• If it is raining, then it is not sunny.
RAINING SUNNY
21. Atomic sentences
Atomic sentence = predicate (term1,...,termn)
or term1 = term2
Term = function (term1,...,termn)
or constant or variable
• E.g., Brother(KingJohn,RichardTheLionheart)
• > (Length(LeftLegOf(Richard)),
Length(LeftLegOf(KingJohn)))
22. Complex sentences
• Complex sentences are made from atomic
sentences using connectives
•
S, S1 S2, S1 S2, S1 S2, S1 S2,
E.g. Sibling(KingJohn,Richard)
Sibling(Richard,KingJohn)
>(2,1) ≤ (1,2)
>(2,1) >(1,2)
23. Truth in first-order logic
• Sentences are true with respect to a model and an interpretation
• Model contains objects (domain elements) and relations among
them
•
• Interpretation specifies referents for
constant symbols → objects
predicate symbols → relations
function symbols → functional relations
• An atomic sentence predicate(term1,...,termn) is true
iff the objects referred to by term1,...,termn
are in the relation referred to by predicate
26. Universal quantification
<variables> <sentence>
Everyone at NUS is smart:
x At(x,NUS) Smart(x)
x P is true in a model m iff P is true with x being each
possible object in the model
Roughly speaking, equivalent to the conjunction of
instantiations of P
At(KingJohn,NUS) Smart(KingJohn)
At(Richard,NUS) Smart(Richard)
At(NUS,NUS) Smart(NUS)
...
27. A common mistake to avoid
• Typically, is the main connective with
• Common mistake: using as the main
connective with :
x At(x,NUS) Smart(x)
means “Everyone is at NUS and everyone is smart”
28. Existential quantification
• <variables> <sentence>
• Someone at NUS is smart:
• x At(x,NUS) Smart(x)
• x P is true in a model m iff P is true with x being some
possible object in the model
• Roughly speaking, equivalent to the disjunction of
instantiations of P
At(KingJohn,NUS) Smart(KingJohn)
At(Richard,NUS) Smart(Richard)
At(NUS,NUS) Smart(NUS)
...
29. Another common mistake to
avoid
• Typically, is the main connective with
• Common mistake: using as the main
connective with :
x At(x,NUS) Smart(x)
is true if there is anyone who is not at NUS!
30. Equality
• term1 = term2 is true under a given interpretation
if and only if term1 and term2 refer to the same
object
• E.g., definition of Sibling in terms of Parent:
x,y Sibling(x,y) [(x = y) m,f (m = f)
Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]
31. Using FOL
The kinship domain:
• Brothers are siblings
x,y Brother(x,y) Sibling(x,y)
• One's mother is one's female parent
m,c Mother(c) = m (Female(m) Parent(m,c))
• “Sibling” is symmetric
x,y Sibling(x,y) Sibling(y,x)
32. Interacting with FOL KBs
Substituting Values of Variables:
• Given a sentence S and a substitution σ,
• Sσ denotes the result of plugging σ into S; e.g.,
– S = Smarter(x,y)
– σ = {x/Hillary,y/Bill}
– Sσ = Smarter(Hillary,Bill)
33. GOLDEN PEARL 4
• LOG TAREEF K BHOOKY HOTY HAIN.
KHUSH AMAD SE BACHTY HOY LOGON
KI DIL KHOL K TAREEF KAREN.
• JO IS ASOOL PE AMAL KARY GA
DUNIYA US K SATH HO GE JO SATH
NAHI DY SKTA USY TANHA CHOR DIA
JAY GA.