Knowledge Representation
École
Supérieure
Polytechnique
Dakar, Senegal
Winter 2011
by Fabian M.
Suchanek
This document is available under a
Creative Commons Attribution Non

Commercial License
Organisation
•
1h class on Knowledge Representation
•
Slides are available at the Web

site
http://suchanek.name/work/teaching
•
Language of the Slides is English,
lecturer will do his best to talk in French,
questions are welcome throughout the session in French or English
2
Check
3
To help assess your background knowledge, please answer
the following questions on a sheet of paper:
1.
say “All men are mortal” in first
order logic.
2.
reduce
~
x
:
y
: (
loves(x,y
) &
married(x,y
))
3.
write a rule in PROLOG.
4.
what is the minimum of
f(x
)=x
2
?
Do not worry if you cannot answer. Hand in your answers
anonymously. This check just serves to adjust the level of the
lecture. You will not be graded.
E A
Definition of KR
4
Knowledge representation
(KR) is a research field
of artificial intelligence that aims to formalize information
so that it can be used for automated reasoning.
Motivation
5
Is Elvis Presley
still alive?
alive(Elvis) ?
sings(Elvis
)
bornIn(Elvis
, Tupelo)
locatedIn(Tupelo
,
USA)
sings(X
) =>
alive(X
)
…
Elvis is alive / not alive
formalization
reasoning
KR is required to find formal answers to questions:
Big Picture
6
Is Elvis Presley
still alive?
Knowledge Base (KB)
facts /
assertions
query
rules / formulas
implied / deduced
facts / statements
inference
alive(Elvis
)
sings(Elvis
)
bornIn(Elvis
, Tupelo)
locatedIn(Tupelo
,
USA)
sings(X
) =>
alive(X
)
…
Query Answering
7
Is Elvis Presley
still alive?
Knowledge Base (KB)
query
alive(Elvis
)
Answering a query
:
Finding out whether
the query or its
contrary can be
deduced from the KB
sings(Elvis
)
bornIn(Elvis
, Tupelo)
locatedIn(Tupelo
,
USA)
sings(X
) =>
alive(X
)
…
KR Formalism
8
Knowledge Base (KB)
KR formalism
:
The language of the KB
sings(Elvis
)
bornIn(Elvis
, Tupelo)
locatedIn(Tupelo
,
USA)
sings(X
) =>
alive(X
)
…
KR Formalisms, 1/2
9
There are different ways to represent knowledge:
•
PROLOG

like:
alive(Elvis), is(Elvis, alive)
•
graphically
•
in natural language
“Elvis is alive”
is
alive
•
in propositional logic
elvis_alive
.
KR Formalisms, 2/2
10
•
in a programming language
elvis.alive
=true
•
in first order logic
x:
rocksinger
(x) => alive(x)
A
•
in a mathematical notation
elvis
Alive
•
in completely different formalism
ф
elvis
→
☺☺☺
Canonicity
11
A KR formalism is
canonic
if one piece of knowledge
can be represented in only one way
alive(Elvis)
is(Elvis, alive)
alive(Elvis, true)
vivant(Elvis)
not very canonic
Canonicity is Desirable
12
Canonicity is in general desirable
because it facilitates co

operation
by different people
alive(Elvis) ?
is(Elvis, alive)
is(Elvis, alive) !
no
Achieving Canonicity
13
A formalism can be made more canonic by
•
restricting it
e.g., by allowing only unary predicates:
alive(Elvis)
is(Elvis, alive)
•
providing best practice guidelines
e.g., by prescribing certain conventions:
alive(Elvis)
Alive(elvis
)
•
providing standard vocabularies
e.g., by listing predicates that should be used
in a certain domain:
{alive, dead, young, old, happy, sad}
Expressiveness
14
A KR formalism is
more expressive
than another one
if we can say things in the first formalism
that we cannot say in the second.
First order logic
x:
rocksinger
(x) => alive(x)
A
Propositional logic
?
Expressiveness is Desirable
15
In general, a higher expressiveness is desirable
from a modeling point of view
x: alive(x)
A
… but it comes at a cost…
Decidability
16
A KR formalism is
decidable
, if there is an algorithm
(computer program) that can answer any query
on a knowledge base in that formalism.
Some formalisms are so expressive
that they are
undecidable
:
Is sentence (*) true?
(Technically: A logical system is decidable
iff
there is an effective method for determining
whether arbitrary formulas are theorems of the logical system.)
(*) This sentence is false.
•
Natural language is
undecidable
Decidability of FOL
17
•
First order logic is also
undecidable
First order logic is so powerful
that it can express sentences
of which it is impossible to determine
whether they are true or not.
This means that there are some first

order

logic
sentences, which we can never prove or disprove.
Worse, we cannot even determine whether
a given sentence is of this type.
Achieving Decidability
18
In general, decidability is desirable. But the more expressive
a formalism is, the more likely it is to be
undecidable
.
Some formalisms can be made decidable by restricting
them
•
Propositional logic is decidable
•
First order logic is decidable
if all formulae are of the following form:
x, y,…. z, q,… : p(
x,y
) … => …
A
E
existential universal arbitrary formula
quantifiers
quantifiers
without quantifiers
and function symbols
Closed World Assumption
19
A KR formalism follows the
closed world assumption (CWA)
,
if any statement that cannot be proven
is assumed to be false.
PROLOG, e.g., follows the CWA:
?

assert(
bornIn
(Elvis, Tupelo)).
yes
?

alive(Elvis).
no
Open World Assumption
20
In many contexts, the open world assumption (OWA) is
more appropriate.
Under the OWA, a statement can be
•
provably false
•
provable true
•
unknown
?

alive(Elvis).
I have no clue
Reification
21
A KR formalism allows
reification
,
if it can treat statements like entities.
thinks(Fabian, alive(Elvis)).
=>
alive(Elvis)
reification, a statement
appears as argument
Modal Logic
22
Modal logic
allows talking about necessity and
possibility
“It is possible that Elvis is alive”
a汩癥v䕬癩v)
T桵h, 浯摡氠汯杩挠i浰汥浥湴猠愠⡲敳a物捴敤c 瑹灥映
牥rfi捡c楯渮
Unique Name Assumption
23
A KR formalism follows the
unique name assumption (UNA)
,
if different names always refer to different objects.
Elvis
The King
The King
Unique
Name Assumption
24
The UNA is not useful if different people want to use
different identifiers:
alive(TheKing
)
TheKing
=Elvis
=>
alive(Elvis
)
Elvis
The King
Schema
25
A KR formalism is
schema

bound
, if one has to decide
upfront which entities can have which properties.
In schema

bound formalisms, one has to decide a
priori for classes of things and their properties:
person:
•
alive/dead
•
birthday
•
profession
camera:
•
resolution
•
shutter speed
•
weight
•
gender
Advantages of Schemas
26
?

assert(alive(Elvis)).
yes
?

assert(hasResolution(Elvis,five_megapixel
))
yes
PROLOG is schema

free, any entity can have any
property:
A schema

bound formalism puts more modeling
constraints, but can exclude non

sensible statements.
Databases
27
Databases
are a particular schema

bound KR formalism.
A database can be seen as a set of
tables
.
Name
Profession
Birth
Elvis
Singer
1935
Obama
President
1961
…
…
=
…
=
each table corresponds to one class of things
Person
each column is
one property
each row is
one thing
SQL
28
A database can be queried in the Structured Query Language (
SQL
).
SELECT name, birth
FROM person
WHERE profession=‘Singer’
AND birth>1930
Elvis, 1935
JohnLennon
, 1940
…
Name
Profession
Birth
Elvis
Singer
1935
Obama
President
1961
…
…
=
…
=
Uses of Databases
29
Databases are used in practically every major
enterprise, with the main database systems being
•
Oracle
•
Microsoft SQL Server
•
IMB’s DB2
•
Postgres
•
MySQL
Headquarters of Oracle in
Redwood Shores, CA, USA
Inheritance
30
A KR formalism supports
inheritance
, if properties
specified for one class of things can be automatically
transferred to a more specific class.
person:
•
name
•
birthday
•
gender
singer:
•
name
•
birthday
•
gender
•
instrument
Inheritance
31
person:
•
name
•
birthday
•
gender
singer:
inherits from person
•
instrument
more general class,
fewer properties
more specific class,
more properties
additional
properties
Restrictions
32
person:
•
name
•
birthday
•
gender
•
profession
singer:
inherits from person
•
profession=singer
•
instrument
restriction
The more specific class can restrict properties inherited
from the more general class.
Object Oriented Languages
33
Object

oriented programming languages
(such as e.g., Java)
support inheritance.
public class
Person {
String
name;
String
profession;
}
public class
Singer
extends
Person {
String
profession=“Singer”;
String
instrument;
}
Singer
elvis
=
new
Singer();
elvis.name=“Elvis”;
elvis.instrument
=“guitar”;
System.out.println
(
elvis.profession
)
Singer
super

class
* declares two properties
sub

class
* overwrites a property
* adds a property
Elvis is a singer
* but he inherited properties
* and has predefined values
Object Oriented Languages
34
Most programming languages support object

orientation
today, with the most important ones being
•
Java
•
C++
•
C#
•
Visual Basic
•
Python
•
Ruby
Monotonicity
35
A KR formalism is
monotonous
, if adding new knowledge
does not undo deduced facts.
elvis_is_person
elvis_alive
elvis_dead
=> ~
elvis_alive
+
Monotonicity
can be very counter

intuitive.
It requires everything to be known upfront.
First order logic and propositional logic are monotonous:
=>
elvis_alive
elvis_is_person
elvis_alive
elvis_dead
=> ~
elvis_alive
elvis_is_dead
=>
elvis_alive
=>
m_jackson_alive
=>
elvis_is_dead
Default Logic
36
Default logic
is not monotonous:
elvis_is_person
:
elvis_is_alive
elvis_is_alive
=>
elvis_is_alive
elvis_is_dead
~
elvis_is_alive
if Elvis is a person
and nothing says he’s
not alive then he is alive
if Elvis is dead
then he is not alive
elvis_is_person
elvis_is_dead
+
prerequisite
conclusion
justification
Fuzziness
37
A KR formalism is
fuzzy
, if certain statements
can hold to a certain degree.
fantastic(Bush
)
0.1
fantastic(Madonna)
0.8
fantastic(Elvis)
1.0
The opposite of fuzzy is
crisp
.
First order logic, PROLOG and propositional logic are all crisp.
Fuzzy Logic
38
Fuzzy logic
is a fuzzy KR formalism.
rainy =>
bad_weather
rainy (0.8)
bad_weather
(0.8)
Fuzzy Logic Operators
39
rainy
\
/ windy =>
bad_weather
rainy (0.8)
bad_weather
(
??
)
windy(1.0)
Fuzzy logic defines how to compute fuzzy values
for complex combinations of fuzzy predicates, e.g.
•
OR is computed as maximum
•
AND is computed as minimum
•
NOT is computed as 1

x
1.0
Contradictions
40
A KR formalism is
tolerant to contradictions
if it allows
contradictions in the knowledge base.
Elvis is alive
Elvis is not alive
Knowledge base
Elvis is a person
Madonna is alive
FOL & Contradictions
41
alive(Elvis).
~alive(Elvis).
=>
life_is_beautiful
First order logic and propositional logic are not tolerant to
contradictions:
ex
falso
quod
libet
…
Some domains require handling of contradictions
(e.g. information extraction from the Web)
Elvisfans.com:
Elvis is alive
Wikipedia:
Elvis is dead.
Possible Worlds
42
Given propositional predicates, a
possible world
is an
assignment of truth values to the predicates.
w1:
elvis_alive
elvis_dead
w2:
elvis_alive
elvis_dead
w4:
elvis_alive
elvis_dead
w3:
elvis_alive
elvis_dead
Given the predicates
elvis_alive
,
elvis_dead
there are 4 possible worlds:
Markov Logic
43
f1:
elvis_alive
[0.8]
f2:
elvis_dead
=> ~
elvis_alive
[0.5]
f3:
elvis_dead
[0.6]
A
Markov Logic Network
is a set of propositional logic
formulas with weights:
A Markov Logic Network assigns a probability to each
possible world:
P(w) ~
Π
e
weight(f
)
satisfied formula
f
w1:
elvis_alive
elvis_dead
f1 satisfied, f2 satisfied, f3 not satisfied
P(w1) ~ e
0.8
.
e
0.5
= 3.6
Markov Logic Example
44
f1:
elvis_alive
[0.8]
f2:
elvis_dead
=> ~
elvis_alive
[0.5]
f3:
elvis_dead
[0.6]
w1:
elvis_alive
elvis_dead
w2:
elvis_alive
elvis_dead
w4:
elvis_alive
elvis_dead
w3:
elvis_alive
elvis_dead
f1,f2
f2
f2,f3
f1,f3
Satisfied formulas:
Markov Logic Network:
Possible worlds:
3.6
1.6
3.0
4.1
Markov Logic Summary
45
A Markov Logic Network is a KR formalism that allows
contradictions.
It assigns a probability to all possible worlds:
•
larger probabilities for worlds that satisfy more constraints
•
smaller values for worlds that violate more constraints
Explicitness
46
A KR formalism is
explicit
, if it can explain
why a certain statement was deduced.
rich(
BillGates
)
rich(X) => happy(X)
rich(
BillGates
) => happy(
BillGates
)
happy(
BillGates
)
Instantiation
Modus Ponens
Logic

based formalisms are usually explicit:
Explicitness
47
Explicitness may not always be useful, consider
pattern recognition:
a
a
a
a
a
a
... or image recognition:
Elvis Presley
Neural Networks
48
A
neural network
is a a non

explicit KR formalism.
It tries to model the human brain.
connections
neuron
(nerve cell)
Perceptrons
49
A
perceptron
is a simplified model of a nerve cell (neuron).
It is defined by a vector of
n
real

valued weights, w
1
,...,
w
n
.
It can be visualized as follows:
nerve cell
x
1
x
2
...
x
n
input values
perceptron
y
real

valued
output value
w
1
w
2
...
w
n
weights
Perceptron
Function
50
A
perceptron
computes a function
R
n
{0,1}
from the
n
input
values to the set {0,1} as follows:
1
if
w
i
∙ x
i
> 0
0 else
x
1
x
2
...
x
n
y
=
w
1
w
2
...
w
n
Perceptron
Example 1
51
x
1
x
2
x
3
0.3 0.8 0.2
w
i
∙ x
i
= 0.3∙ 1 + 0.8∙ 2 + 0.2∙ 1
= 2.1
> 0
~~~~> Output
y
=1
1
if
w
i
∙ x
i
> 0
0 else
y
=
input: 1 2 1
Perceptron
Example 2
52
x
1
x
2
x
3
0.3 0.8 0.2
w
i
∙ x
i
= 0.3∙ 0 + 0.8∙

2 + 0.2∙ 0
=

0.8
< 0
~~~~> Output
y
=0
1
if
w
i
∙ x
i
> 0
0 else
y
=
input: 0

2 0
Combining
Perceptrons
53
final output of the neural network
1
Perceptrons
can be combined to a
neural network
.
input of the neural network
output of one
perceptron
is
the input for another one
Imitating the Retina
54
imitation of
our eye retina
1
Network Training
55
1
net will also
recognize this one
a
Given examples:
a
a
a
a
a
...adjust the weights so that
the output is 1 for all examples
(=
training the net
).
Then the net will also recognize
similar inputs:
Neural Networks
56
1
A Neural Network is a
non

explicit KR model.
Neural Networks are used,
e.g
,
•
to recognize postal codes on
letters
•
to optimize search engine results
This network “knows”
what the letter “a” is.
But this knowledge is not explicit.
Distributedness
57
A KR formalism is
distributed
, if it encourages use
and co

operation by different people and systems
across different places and organizations.
Every rock
singer is alive!
The King is a
rock singer.
I am Elvis,
the King.
Elvis is alive
The Semantic Web
58
The
Semantic Web
is a distributed KR formalism.
1935
Grammy
Award
sameAs
born
won
KR Design: Summary
59
In general, a KR formalism serves to
•
represent knowledge
•
infer facts from that knowledge
•
answer queries on the knowledge
KR Design: Summary
60
There are many KR formalisms with different properties:
•
Canonicity
(does the formalism allow only one form
to represent a statement?)
•
Expressiveness
(how powerful is the formalism)
•
Decidability
(can every query be answered?)
•
Closed World
(does the formalism assume
that everything unknown is false?)
•
Unique Name
(do two names always mean two different things?)
KR Design: Summary
61
•
Schema

bound
(do we have to decide upfront
on properties of things?)
Databases/SQL is a schema

bound KR formalism
•
Inheritance
(can properties be transferred
from one class to another?)
Object

oriented programming languages
support inheritance
•
Monotonicity
(will new knowledge never undo existing knowledge?)
Default logic allows non

monotonicity
KR Design: Summary
62
•
Fuzziness
(can properties be
fufilled
to a certain degree?)
Fuzzy logic is a fuzzy KR formalism
•
Tolerance to contradictions
(is it OK to have a contradiction in the KB?)
Markov Logic Networks can deal with contradictions
•
Explicitness
(is knowledge always explainable?)
Neural Networks store knowledge only implicitly
•
Distributedness
(can the knowledge be distributed over sources?)
The Semantic Web is a distributed formalism
Comments 0
Log in to post a comment