KR
& R
© B
rach
man
& L
eves
que
200
51
Kn
ow
led
ge
Rep
rese
nta
tio
nan
dR
easo
nin
g
KR
& R
© B
rach
man
& L
eves
que
200
52
from
the
book
of t
he s
ame
nam
eby
Ron
ald
J. B
rach
man
and
Hec
tor
J. L
eves
que
Mor
gan
Kau
fman
n P
ublis
hers
, San
Fra
ncis
co, C
A, 2
004
KR
& R
© B
rach
man
& L
eves
que
200
53
1.
Intr
oduc
tion
KR
& R
© B
rach
man
& L
eves
que
200
54
Wh
at is
kn
ow
led
ge?
Eas
ier
ques
tion:
how
do
we
talk
abo
ut it
?
We
say
“Jo
hn k
now
s th
at ..
.” a
nd fi
ll th
e bl
ank
with
a p
ropo
sitio
n–
can
be tr
ue /
fals
e,
rig
ht /
wro
ng
Con
tras
t: “
John
fear
s th
at ..
.”–
sam
e co
nten
t, d
iffer
ent a
ttitu
de
Oth
er fo
rms
of k
now
ledg
e:•
know
how
, who
, wha
t, w
hen,
...
•se
nsor
imot
or:
typi
ng, r
idin
g a
bicy
cle
•af
fect
ive:
dee
p un
ders
tand
ing
Bel
ief:
not
nec
essa
rily
true
and
/or
held
for
appr
opria
te r
easo
nsan
d w
eake
r ye
t: “
John
sus
pect
s th
at ..
.”
Her
e: n
o di
stin
ctio
nta
king
the
wor
ld to
be
one
way
and
not
ano
ther
the
mai
n id
ea
KR
& R
© B
rach
man
& L
eves
que
200
55
Wh
at is
rep
rese
nta
tio
n?
Sym
bols
sta
ndin
g fo
r th
ings
in th
e w
orld
"Joh
n"
"Joh
n lo
ves
Mar
y"
firs
t aid
wom
en
John
the
prop
ositi
on th
at
John
love
s M
ary
Kno
wle
dge
repr
esen
tatio
n:sy
mbo
lic e
ncod
ing
of p
ropo
sitio
ns b
elie
ved
(by
som
e ag
ent)
KR
& R
© B
rach
man
& L
eves
que
200
56
Wh
at is
rea
son
ing
?
Man
ipul
atio
n of
sym
bols
enc
odin
g pr
opos
ition
s to
pro
duce
re
pres
enta
tions
of n
ew p
ropo
sitio
ns
Ana
logy
: ar
ithm
etic
“101
1” +
“10”
→→→→
“110
1”⇓
⇓
⇓
elev
en
tw
o
thirt
een
“Joh
n is
Mar
y's
fath
er”
⇓
“Joh
n is
an
adul
t m
ale”
⇓J
M
J
KR
& R
© B
rach
man
& L
eves
que
200
57
Wh
y kn
ow
led
ge?
For
suf
ficie
ntly
com
plex
sys
tem
s, it
is s
omet
imes
use
ful t
o de
scrib
e sy
stem
s in
term
s of
bel
iefs
, goa
ls, f
ears
, int
entio
ns
e.g.
in
a ga
me-
play
ing
prog
ram
“bec
ause
it b
elie
ved
its q
ueen
was
in d
ange
r, b
ut w
ante
d to
stil
l co
ntro
l the
cen
ter
of th
e bo
ard.
”
mor
e us
eful
than
des
crip
tion
abou
t act
ual t
echn
ique
s us
ed fo
rde
cidi
ng h
ow to
mov
e“b
ecau
se e
valu
atio
n pr
oced
ure
P u
sing
min
imax
ret
urne
d a
valu
e of
+7
for
this
pos
ition
= t
akin
g an
inte
ntio
nal s
tanc
e (
Dan
Den
nett)
Is K
R ju
st a
con
veni
ent w
ay o
f tal
king
abo
ut c
ompl
ex s
yste
ms?
•so
met
imes
ant
hrop
omor
phiz
ing
is in
appr
opria
tee.
g. t
herm
osta
ts
•ca
n al
so b
e ve
ry m
isle
adin
g!fo
olin
g us
ers
into
thin
king
a s
yste
m k
now
s m
ore
than
it d
oes
KR
& R
© B
rach
man
& L
eves
que
200
58
Wh
y re
pre
sen
tati
on
?
Not
e: in
tent
iona
l sta
nce
says
not
hing
abo
ut w
hat i
s or
is n
ot
repr
esen
ted
sym
bolic
ally
e.
g. i
n ga
me
play
ing,
per
haps
the
boar
d po
sitio
n is
rep
rese
nted
, but
the
goal
of
getti
ng a
kni
ght o
ut e
arly
is n
ot
KR
Hyp
othe
sis:
(B
rian
Sm
ith)
“Any
mec
hani
cally
em
bodi
ed in
telli
gent
pro
cess
will
be
com
pris
ed o
f str
uctu
ral
ingr
edie
nts
that
a)
we
as e
xter
nal o
bser
vers
nat
ural
ly ta
ke to
rep
rese
nt a
pr
opos
ition
al a
ccou
nt o
f the
kno
wle
dge
that
the
over
all p
roce
ss e
xhib
its, a
nd b
) in
depe
nden
t of s
uch
exte
rnal
sem
antic
attr
ibut
ion,
pla
y a
form
al b
ut c
ausa
l and
es
sent
ial r
ole
in e
ngen
derin
g th
e be
havi
our
that
man
ifest
s th
at k
now
ledg
e.”
Tw
o is
sues
: ex
iste
nce
of s
truc
ture
s th
at•
we
can
inte
rpre
t pro
posi
tiona
lly
•de
term
ine
how
the
syst
em b
ehav
es
Kno
wle
dge-
base
d sy
stem
: on
e de
sign
ed th
is w
ay!
KR
& R
© B
rach
man
& L
eves
que
200
59
Tw
o e
xam
ple
s
Exa
mpl
e 1
printColour(snow) :- !, write("It's white.").
printColour(grass) :- !, write("It's green.").
printColour(sky) :- !, write("It's yellow.").
printColour(X) :- write("Beats me.").
Exa
mpl
e 2
printColour(X) :- colour(X,Y), !,
write("It's "), write(Y), write(".").
printColour(X) :- write("Beats me.").
colour(snow,white).
colour(sky,yellow).
colour(X,Y) :- madeof(X,Z), colour(Z,Y).
madeof(grass,vegetation).
colour(vegetation,green).
Bot
h sy
stem
s ca
n be
des
crib
ed in
tent
iona
lly.
Onl
y th
e 2n
d ha
s a
sepa
rate
col
lect
ion
of s
ymbo
lic
stru
ctur
es à
la K
R H
ypot
hesi
s
its k
now
ledg
e ba
se (
or K
B)
∴
a sm
all k
now
ledg
e-ba
sed
syst
em
KR
& R
© B
rach
man
& L
eves
que
200
510
KR
an
d A
I
Muc
h of
AI i
nvol
ves
build
ing
syst
ems
that
are
kno
wle
dge-
base
dab
ility
der
ives
in p
art f
rom
rea
soni
ng o
ver
expl
icitl
y re
pres
ente
d kn
owle
dge
–la
ngua
ge u
nder
stan
ding
,
–pl
anni
ng,
–di
agno
sis,
–“e
xper
t sys
tem
s”,
etc.
Som
e, to
a c
erta
in e
xten
tga
me-
play
ing,
vis
ion,
e
tc.
Som
e, to
a m
uch
less
er e
xten
tsp
eech
, mot
or c
ontr
ol,
etc.
Cur
rent
res
earc
h qu
estio
n:ho
w m
uch
of in
telli
gent
beh
avio
ur is
kno
wle
dge-
base
d?
Cha
lleng
es: c
onne
ctio
nism
, oth
ers
KR
& R
© B
rach
man
& L
eves
que
200
511
Wh
y b
oth
er?
Why
not
“co
mpi
le o
ut”
know
ledg
e in
to s
peci
aliz
ed p
roce
dure
s?•
dist
ribut
e K
B to
pro
cedu
res
that
nee
d it
(as
in E
xam
ple
1)
•al
mos
t alw
ays
achi
eves
bet
ter
perf
orm
ance
No
need
to th
ink.
Just
do
it!–
ridin
g a
bike
–dr
ivin
g a
car
–pl
ayin
g ch
ess?
–do
ing
mat
h?
–st
ayin
g al
ive?
?
Ski
lls (
Hub
ert D
reyf
us)
•no
vice
s th
ink;
exp
erts
rea
ct
•co
mpa
re to
cur
rent
“ex
pert
sys
tem
s”:
know
ledg
e-ba
sed
!
KR
& R
© B
rach
man
& L
eves
que
200
512
Ad
van
tag
e
Kno
wle
dge-
base
d sy
stem
mos
t sui
tabl
e fo
r op
en-e
nded
tas
ksca
n st
ruct
ural
ly is
olat
e re
ason
s fo
r pa
rtic
ular
beh
avio
ur
Goo
d fo
r
•ex
plan
atio
n an
d ju
stifi
catio
n–
“Bec
ause
gra
ss is
a fo
rm o
f veg
etat
ion.
”
•in
form
abili
ty: d
ebug
ging
the
KB
–“N
o th
e sk
y is
not
yel
low
. It's
blu
e.”
•ex
tens
ibili
ty: n
ew r
elat
ions
–“C
anar
ies
are
yello
w.”
•ex
tens
ibili
ty: n
ew a
pplic
atio
ns–
retu
rnin
g a
list o
f all
the
whi
te th
ings
–pa
intin
g pi
ctur
es
KR
& R
© B
rach
man
& L
eves
que
200
513
Co
gn
itiv
e p
enet
rab
ility
Hal
lmar
k of
kno
wle
dge-
base
d sy
stem
:th
e ab
ility
to b
e to
ldfa
cts
abou
t the
wor
ld a
nd a
djus
t our
beh
avio
ur
corr
espo
ndin
gly
for
exam
ple:
rea
d a
book
abo
ut c
anar
ies
or r
are
coin
s
Cog
nitiv
e pe
netr
abili
ty (
Zen
on P
ylys
hyn)
actio
ns th
at a
re c
ondi
tione
d by
wha
t is
curr
ently
bel
ieve
d an
exa
mpl
e:
we
norm
ally
leav
e th
e ro
om if
we
hear
a fi
re a
larm
we
do n
ot le
ave
the
room
on
hear
ing
a fir
e al
arm
if
we
belie
ve th
at th
e al
arm
is b
eing
test
ed /
tam
pere
dca
n co
me
to th
is b
elie
f in
very
man
y w
ays
so th
is a
ctio
n is
cog
nitiv
ely
pene
trab
le
a no
n-ex
ampl
e:
blin
king
ref
lex
KR
& R
© B
rach
man
& L
eves
que
200
514
Wh
y re
aso
nin
g?
Wan
t kno
wle
dge
to a
ffect
act
ion
not
do a
ctio
n A
if se
nten
ce P
is in
KB
but
do a
ctio
n A
if w
orld
bel
ieve
d in
sat
isfie
s P
Diff
eren
ce:
Pm
ay n
ot b
e ex
plic
itly
repr
esen
ted
Nee
d to
app
ly w
hat i
s kn
own
in g
ener
al
to th
e pa
rtic
ular
s of
a g
iven
situ
atio
n
Exa
mpl
e: “P
atie
ntx
is a
llerg
ic to
med
icat
ion
m.”
“Any
body
alle
rgic
to m
edic
atio
n m
is a
lso
alle
rgic
to m
'.”
Is it
OK
to p
resc
ribe
m'
for
x?
Usu
ally
nee
d m
ore
than
just
DB
-sty
le r
etrie
val o
f fac
ts in
the
KB
KR
& R
© B
rach
man
& L
eves
que
200
515
En
tailm
ent
Sen
tenc
esP
1, P
2, ..
., P
nen
tail
sen
tenc
e P
iff t
he tr
uth
of P
isim
plic
it in
the
trut
h of
P1,
P2,
...,
Pn.
If th
e w
orld
is s
uch
that
it s
atis
fies
the
Pi t
hen
it m
ust a
lso
satis
fy P
.
App
lies
to a
var
iety
of l
angu
ages
(la
ngua
ges
with
trut
h th
eorie
s)
Infe
renc
e: th
e pr
oces
s of
cal
cula
ting
enta
ilmen
ts•
soun
d: g
et o
nly
enta
ilmen
ts
•co
mpl
ete:
get
all
enta
ilmen
ts
Som
etim
es w
ant u
nsou
nd /
inco
mpl
ete
reas
onin
gfo
r re
ason
s to
be
disc
usse
d la
ter
Logi
c: s
tudy
of e
ntai
lmen
t rel
atio
ns•
lang
uage
s
•tr
uth
cond
ition
s
•ru
les
of in
fere
nce
KR
& R
© B
rach
man
& L
eves
que
200
516
Usi
ng
log
ic
No
univ
ersa
l lan
guag
e / s
eman
tics
•W
hy n
ot E
nglis
h?
•D
iffer
ent t
asks
/ w
orld
s
•D
iffer
ent w
ays
to c
arve
up
the
wor
ld
No
univ
ersa
l rea
soni
ng s
chem
e•
Gea
red
to la
ngua
ge
•S
omet
imes
wan
t “ex
tral
ogic
al”
reas
onin
g
Sta
rt w
ith fi
rst-
orde
r pr
edic
ate
calc
ulus
(F
OL)
•in
vent
ed b
y ph
iloso
pher
Fre
ge fo
r th
e fo
rmal
izat
ion
of m
athe
mat
ics
•bu
t will
con
side
r su
bset
s / s
uper
sets
and
ver
y di
ffere
nt lo
okin
g re
pres
enta
tion
lang
uage
s
KR
& R
© B
rach
man
& L
eves
que
200
517
Kn
ow
led
ge
leve
l
Alle
n N
ewel
l's a
naly
sis:
•K
now
ledg
e le
vel:
dea
ls w
ith la
ngua
ge, e
ntai
lmen
t
•S
ymbo
l lev
el:
deal
s w
ith r
epre
sent
atio
n, in
fere
nce
Pic
king
a lo
gic
has
issu
es a
t eac
h le
vel
•K
now
ledg
e le
vel:
expr
essi
ve a
dequ
acy,
theo
retic
al c
ompl
exity
, ...
•S
ymbo
l lev
el:
arch
itect
ures
,da
ta s
truc
ture
s,
algo
rithm
ic c
ompl
exity
, ...
Nex
t: w
e be
gin
with
FO
L at
the
know
ledg
e le
vel
KR
& R
© B
rach
man
& L
eves
que
200
518
2.
The
Lan
guag
e of
Firs
t-or
der
Logi
c
KR
& R
© B
rach
man
& L
eves
que
200
519
Dec
lara
tive
lan
gu
age
Bef
ore
build
ing
syst
embe
fore
ther
e ca
n be
lear
ning
, rea
soni
ng, p
lann
ing,
expl
anat
ion
...
need
to b
e ab
le to
exp
ress
kno
wle
dge
Wan
t a p
reci
se d
ecla
rativ
e la
ngua
ge•
decl
arat
ive:
bel
ieve
P=
hol
d P
to b
e tr
ueca
nnot
bel
ieve
P w
ithou
t som
e se
nse
of
wha
t it w
ould
mea
n fo
r th
e w
orld
to s
atis
fy P
•pr
ecis
e: n
eed
to k
now
exa
ctly
w
hat s
trin
gs o
f sym
bols
cou
nt a
s se
nten
ces
wha
t it m
eans
for
a se
nten
ce to
be
true
(b
ut w
ithou
t hav
ing
to s
peci
fy w
hich
one
s ar
e tr
ue)
Her
e: l
angu
age
of fi
rst-
orde
r lo
gic
agai
n: n
ot th
e on
ly c
hoic
e
KR
& R
© B
rach
man
& L
eves
que
200
520
Alp
hab
et
Logi
cal s
ymbo
ls:
•P
unct
uatio
n: (
,),.
•C
onne
ctiv
es:
¬,∧
,∨,∀
, ∃, =
•V
aria
bles
:x,
x1,
x 2, .
.., x
', x"
, ...,
y, .
.., z
, ...
Fix
ed m
eani
ng a
nd u
se
like
keyw
ords
in a
pro
gram
min
g la
ngua
ge
Non
-logi
cal s
ymbo
ls•
Pre
dica
te s
ymbo
ls (
like
Dog
)N
ote
: not
trea
ting
= as
a p
redi
cate
•F
unct
ion
sym
bols
(li
ke b
estF
rien
dOf)
Dom
ain-
depe
nden
t mea
ning
and
use
like
iden
tifie
rs in
a p
rogr
amm
ing
lang
uage
Hav
e ar
ity:
num
ber
of a
rgum
ents
arity
0 p
redi
cate
s: p
ropo
sitio
nal s
ymbo
ls
arity
0 fu
nctio
ns: c
onst
ant s
ymbo
ls
Ass
ume
infin
ite s
uppl
y of
eve
ry a
rity
KR
& R
© B
rach
man
& L
eves
que
200
521
Gra
mm
ar
Ter
ms
1.E
very
var
iabl
e is
a te
rm.
2.If
t 1, t
2, ..
., t n
are
term
s an
d fi
s a
func
tion
of a
rity
n,th
enf(
t 1, t
2, ..
., t n
)is
a te
rm.
Ato
mic
wffs
(w
ell-f
orm
ed fo
rmul
a)
1.If
t 1, t
2, ..
., t n
are
term
s an
d P
is a
pre
dica
te o
f arit
y n,
then
P(t
1, t 2
, ...,
t n)
is a
n at
omic
wff.
2.If
t 1 a
nd t 2
are
term
s, th
en (
t 1=t
2) is
an
atom
ic w
ff.
Wffs 1
.Eve
ry a
tom
ic w
ff is
a w
ff.
2.If
α an
d β
are
wffs
, and
v is
a v
aria
ble,
then
¬α,
(α∧β
),(α
∨β),
∃v.α
, ∀v.
α ar
e w
ffs.
The
pro
posi
tiona
l sub
set:
no
term
s, n
o qu
antif
iers
Ato
mic
wffs
: on
ly p
redi
cate
s of
0-a
rity:
(p∧
¬(q
∨r))
KR
& R
© B
rach
man
& L
eves
que
200
522
No
tati
on
Occ
asio
nally
add
or
omit
(,),
.
Use
[,] a
nd {
,} a
lso.
Abb
revi
atio
ns:
(α ⊃
β)
for
(¬α
∨ β)
safe
r to
rea
d as
dis
junc
tion
than
as
“if
... th
en ..
.”
(α ≡
β)
for
((α⊃
β) ∧
(β⊃
α))
Non
-logi
cal s
ymbo
ls:
•P
redi
cate
s:
mix
ed c
ase
capi
taliz
ed
Pers
on, H
appy
, Old
erT
han
•F
unct
ions
(an
d co
nsta
nts)
: mix
ed c
ase
unca
pita
lized
fath
erO
f, s
ucce
ssor
, jo
hnSm
ith
KR
& R
© B
rach
man
& L
eves
que
200
523
Var
iab
le s
cop
e
Like
var
iabl
es in
pro
gram
min
g la
ngua
ges,
the
varia
bles
in F
OL
have
a s
cope
det
erm
ined
by
the
quan
tifie
rs
Lexi
cal s
cope
for
varia
bles
P(x
)∧
∃x[P
(x)
∨ Q
(x)]
free
boun
d
occu
rren
ces
of v
aria
bles
A s
ente
nce:
wff
with
no
free
var
iabl
es (
clos
ed)
Sub
stitu
tion:
α[v/
t] m
eans
α w
ith a
ll fr
ee o
ccur
renc
es o
f the
vre
plac
ed b
y te
rm t
Not
e: w
ritte
n α
els
ewhe
re (
and
in b
ook)
Als
o:α[
t 1,..
.,tn]
mea
nsα[
v 1/t
1,...
,vn/
t n]
v t
KR
& R
© B
rach
man
& L
eves
que
200
524
Sem
anti
cs
How
to in
terp
ret s
ente
nces
?•
wha
t do
sent
ence
s cl
aim
abo
ut th
e w
orld
?
•w
hat d
oes
belie
ving
one
am
ount
to?
With
out a
nsw
ers,
can
not u
se s
ente
nces
to r
epre
sent
kno
wle
dge
Pro
blem
:ca
nnot
fully
spe
cify
inte
rpre
tatio
n of
sen
tenc
es b
ecau
se n
on-lo
gica
l sy
mbo
ls r
each
out
side
the
lang
uage
So:
mak
e cl
ear
depe
nden
ce o
f int
erpr
etat
ion
on n
on-lo
gica
l sym
bols
Logi
cal i
nter
pret
atio
n:sp
ecifi
catio
n of
how
to u
nder
stan
d pr
edic
ate
and
func
tion
sym
bols
Can
be
com
plex
!
Dem
ocra
ticC
ount
ry, I
sAB
ette
rJud
geO
fCha
ract
erT
han,
favo
urite
IceC
ream
Flav
ourO
f, p
uddl
eOfW
ater
27
KR
& R
© B
rach
man
& L
eves
que
200
525
Th
e si
mp
le c
ase
The
re a
re o
bjec
ts.
som
e sa
tisfy
pre
dica
te P
; so
me
do n
ot
Eac
h in
terp
reta
tion
settl
es e
xten
sion
of P
.bo
rder
line
case
s ru
led
in s
epar
ate
inte
rpre
tatio
ns
Eac
h in
terp
reta
tion
assi
gns
to fu
nctio
n f
a m
appi
ng fr
om o
bjec
ts
to o
bjec
ts.
func
tions
alw
ays
wel
l-def
ined
and
sin
gle-
valu
ed
The
FO
L as
sum
ptio
n:th
is is
all
you
need
to k
now
abo
ut th
e no
n-lo
gica
l sym
bols
to
und
erst
and
whi
ch s
ente
nces
of F
OL
are
true
or
fals
e
In o
ther
wor
ds, g
iven
a s
peci
ficat
ion
of»
wha
t obj
ects
ther
e ar
e
»w
hich
of t
hem
sat
isfy
P
»w
hat m
appi
ng is
den
oted
by
f
it w
ill b
e po
ssib
le to
say
whi
ch s
ente
nces
of F
OL
are
true
KR
& R
© B
rach
man
& L
eves
que
200
526
Inte
rpre
tati
on
s
Tw
o pa
rts:
ℑ=
〈 D,I
〉
Dis
the
dom
ain
of d
isco
urse
can
be a
ny n
on-e
mpt
y se
t
not j
ust f
orm
al /
mat
hem
atic
al o
bjec
ts
e.g.
peop
le, t
able
s, n
umbe
rs, s
ente
nces
, uni
corn
s, c
hunk
s of
pea
nut b
utte
r,
situ
atio
ns, t
he u
nive
rse
I is
an
inte
rpre
tatio
n m
appi
ng
IfP
is a
pre
dica
te s
ymbo
l of a
rity
n,
I[P
] ⊆
D×D
× ...×
D
an n
-ary
rel
atio
n ov
er D
for
prop
ositi
onal
sym
bols
,
I[p]
= {
} o
rI[
p] =
{〈〉
}
In p
ropo
sitio
nal c
ase,
con
veni
ent t
o as
sum
e
ℑ
= I
∈ [
prop
. sym
bols
→ {
true
, fal
se}]
Iff
is a
func
tion
sym
bol o
f arit
y n,
I[f]
∈ [
D×D
× ...×
D→
D]
an n
-ary
func
tion
over
D
for
cons
tant
s,I[
c] ∈
D
KR
& R
© B
rach
man
& L
eves
que
200
527
Den
ota
tio
n
In te
rms
of in
terp
reta
tion
ℑ, t
erm
s w
ill d
enot
e el
emen
ts o
f the
do
mai
nD
.
will
writ
e el
emen
t as
||t|| ℑ
For
term
s w
ith v
aria
bles
, the
den
otat
ion
depe
nds
on th
e va
lues
of
varia
bles
will
writ
e as
||t|| ℑ
,µ
whe
reµ
∈ [
Var
iabl
es→
D],
calle
d a
varia
ble
assi
gnm
ent
Rul
es o
f int
erpr
etat
ion:
1.||v
|| ℑ,µ
= µ
(v).
2.||
f(t 1
, t2,
...,
t n) |
| ℑ,µ
= H
(d1,
d2,
...,
d n)
whe
reH
= I[
f]
and
d i=
||t i
|| ℑ,µ,
recu
rsiv
ely
KR
& R
© B
rach
man
& L
eves
que
200
528
Sat
isfa
ctio
n
In te
rms
of a
n in
terp
reta
tion
ℑ, s
ente
nces
of F
OL
will
be
eith
er
true
or
fals
e.
For
mul
as w
ith fr
ee v
aria
bles
will
be
true
for
som
e va
lues
of t
he
free
var
iabl
es a
nd fa
lse
for
othe
rs.
Not
atio
n:
will
writ
e as
ℑ,µ
= α
“α is
sat
isfie
d by
ℑ a
nd µ
”
whe
reµ
∈ [
Var
iabl
es→
D],
as b
efor
e
orℑ
= α
, w
hen
α is
a s
ente
nce
“
α is
true
und
er in
terp
reta
tion
ℑ”
orℑ
= S
, w
hen
S i
s a
set o
f sen
tenc
es
“the
ele
men
ts o
f S a
re tr
ue u
nder
inte
rpre
tatio
n ℑ
”
And
now
the
defin
ition
...
KR
& R
© B
rach
man
& L
eves
que
200
529
Ru
les
of
inte
rpre
tati
on
1.ℑ
,µ=
P(t
1, t 2
, ...,
t n)
iff
〈d1,
d2,
...,
d n〉
∈ R
whe
reR
= I
[P]
and
d i=
||t
i|| ℑ
,µ,
as o
n de
nota
tion
slid
e
2.ℑ
,µ=
(t 1
= t 2
) i
ff|| t
1|| ℑ
,µ i
s th
e sa
me
as ||
t 2|| ℑ
,µ
3.ℑ
,µ=
¬α
iff
ℑ,µ
≠α
4.ℑ
,µ=
(α∧
β)
iffℑ
,µ=
α a
ndℑ
,µ=
β
5.ℑ
,µ=
(α∨
β)
iffℑ
,µ=
α o
rℑ
,µ=
β
6.ℑ
,µ=
∃vα
iff
for
som
e d
∈ D
,ℑ
,µ{d
;v}
=α
7.ℑ
,µ=
∀vα
iff
fo
r al
l d∈
D,
ℑ,µ
{d;v
}=
αw
here
µ{d;
v} is
just
like
µ, e
xcep
t tha
t µ(v
)=d.
For
pro
posi
tiona
l sub
set:
ℑ=
piff
I[p]
≠ {
}an
d th
e re
st a
s ab
ove
KR
& R
© B
rach
man
& L
eves
que
200
530
En
tailm
ent
def
ined
Sem
antic
rul
es o
f int
erpr
etat
ion
tell
us h
ow to
und
erst
and
all w
ffs
in te
rms
of s
peci
ficat
ion
for
non-
logi
cal s
ymbo
ls.
But
som
e co
nnec
tions
am
ong
sent
ence
s ar
e in
depe
nden
t of t
he
non-
logi
cal s
ymbo
ls in
volv
ed.
e.g.
If α
is tr
ue u
nder
ℑ ,
then
so
is ¬
(β∧¬
α),
no m
atte
r w
hat ℑ
is,
why
α i
s tr
ue,
wha
t β is
, ...
S|=
α if
f fo
r ev
ery
ℑ ,
if ℑ
|=S
then
ℑ|=
α.S
ay th
at S
enta
ilsα
or α
is a
logi
cal c
onse
quen
ce o
f S:
In o
ther
wor
ds:
for
noℑ
,ℑ
|=S
∪ {
¬α}
.S
∪ {
¬α}
is u
nsat
isfia
ble
Spe
cial
cas
e w
hen
Sis
em
pty:
|=α
iff
for
ever
yℑ
,ℑ
|=α.
Say
that
α is
val
id.
Not
e:{α
1, α 2
, ...,
αn}
|=α
iff
|=(α
1 ∧ α
2∧
... ∧
αn)
⊃ α
finite
ent
ailm
ent r
educ
es to
val
idity
KR
& R
© B
rach
man
& L
eves
que
200
531
Wh
y d
o w
e ca
re?
We
do n
ot h
ave
acce
ss to
use
r-in
tend
ed in
terp
reta
tion
of n
on-
logi
cal s
ymbo
ls
But
, with
ent
ailm
ent ,
we
know
that
if S
is tr
ue in
the
inte
nded
in
terp
reta
tion,
then
so
is α
.If
the
user
's v
iew
has
the
wor
ld s
atis
fyin
g S
,the
n it
mus
t als
o sa
tisfy
α.
The
re m
ay b
e ot
her
sent
ence
s tr
ue a
lso;
but
α is
logi
cally
gua
rant
eed.
So
wha
t abo
ut o
rdin
ary
reas
onin
g?D
og(f
ido)
�
Mam
mal
(fid
o) ?
?
Not
ent
ailm
ent!
The
re a
re lo
gica
l int
erpr
etat
ions
whe
reI[
Dog
]⊄
I[M
amm
al]
incl
ude
such
con
nect
ions
exp
licitl
y in
S
∀x[
Dog
(x)
⊃ M
amm
al(x
)]
Get
:S
∪ {
Dog
(fid
o)}
|=M
amm
al(f
ido)
Key
idea
of K
R:
the
rest
is ju
stde
tails
...
KR
& R
© B
rach
man
& L
eves
que
200
532
Kn
ow
led
ge
bas
es
KB
is s
et o
f sen
tenc
esex
plic
it st
atem
ent o
f sen
tenc
es b
elie
ved
(incl
udin
g an
y as
sum
ed
conn
ectio
ns a
mon
g no
n-lo
gica
l sym
bols
)
KB
|=α
α is
a fu
rthe
r co
nseq
uenc
e of
wha
t is
belie
ved
•ex
plic
it kn
owle
dge:
K
B
•im
plic
it kn
owle
dge:
{ α
| K
B|=
α }
Ofte
n no
n tr
ivia
l: e
xplic
it�
impl
icit
Exa
mpl
e: Thr
ee b
lock
s st
acke
d.
Top
one
is g
reen
.
Bot
tom
one
is n
ot g
reen
.
Is th
ere
a gr
een
bloc
k di
rect
ly o
n to
p of
a n
on-g
reen
blo
ck?
A B C
gree
n
non-
gree
n
KR
& R
© B
rach
man
& L
eves
que
200
533
A f
orm
aliz
atio
n
S=
{On(
a,b)
,O
n(b,
c),
Gre
en(a
),¬
Gre
en(c
)}al
l tha
t is
requ
ired
α =
∃x∃y
[Gre
en(x
)∧
¬G
reen
(y)
∧ O
n(x,
y)]
Cla
im:
S|=
α
Pro
of:
Letℑ
be
any
inte
rpre
tatio
n su
ch th
at ℑ
|=S
.
Cas
e 1:
ℑ|=
Gre
en(b
).C
ase
2:ℑ
|≠ G
reen
(b).
∴ ℑ
|= G
reen
(b) ∧
¬G
reen
(c)
∧ O
n(b,
c).
∴ ℑ
|=¬
Gre
en(b
)
∴ ℑ
|=α
∴ ℑ
|=G
reen
(a) ∧
¬G
reen
(b)
∧ O
n(a,
b).
∴ ℑ
|=α
Eith
er w
ay,
for
any
ℑ,
ifℑ
|=S
then
ℑ|=
α.
So
S|=
α.
QE
D
KR
& R
© B
rach
man
& L
eves
que
200
534
Kn
ow
led
ge-
bas
ed s
yste
m
Sta
rt w
ith (
larg
e) K
B r
epre
sent
ing
wha
t is
expl
icitl
y kn
own
e.g.
wha
t the
sys
tem
has
bee
n to
ld o
r ha
s le
arne
d
Wan
t to
influ
ence
beh
avio
ur b
ased
on
wha
t is
impl
icit
in th
e K
B(o
r as
clo
se a
s po
ssib
le)
Req
uire
s re
ason
ing
dedu
ctiv
e in
fere
nce:
proc
ess
of c
alcu
latin
g en
tailm
ents
of K
B
i.e g
iven
KB
and
any
α, d
eter
min
e if
KB
|=α
Pro
cess
is s
ound
if w
hene
ver
it pr
oduc
es α
, the
n K
B |=
αdo
es n
ot a
llow
for
plau
sibl
e as
sum
ptio
ns th
at m
ay b
e tr
uein
the
inte
nded
inte
rpre
tatio
n
Pro
cess
is c
ompl
ete
if w
hene
ver
KB
|=α,
it p
rodu
ces
αdo
es n
ot a
llow
for
proc
ess
to m
iss
som
e α
or b
e un
able
to
dete
rmin
e th
e st
atus
of α
KR
& R
© B
rach
man
& L
eves
que
200
535
3.
Exp
ress
ing
Kno
wle
dge
KR
& R
© B
rach
man
& L
eves
que
200
536
Kn
ow
led
ge
eng
inee
rin
g
KR
is fi
rst a
nd fo
rem
ost a
bout
kno
wle
dge
mea
ning
and
ent
ailm
ent
find
indi
vidu
als
and
prop
ertie
s, t
hen
enco
de fa
cts
suffi
cien
t for
ent
ailm
ents
Bef
ore
impl
emen
ting,
nee
d to
und
erst
and
clea
rly•
wha
t is
to b
e co
mpu
ted?
•w
hy a
nd w
here
infe
renc
e is
nec
essa
ry?
Exa
mpl
e do
mai
n: s
oap-
oper
a w
orld
peop
le, p
lace
s, c
ompa
nies
, mar
riage
s, d
ivor
ces,
han
ky-p
anky
, dea
ths,
ki
dnap
ping
s, c
rimes
, ...
Tas
k: K
B w
ith a
ppro
pria
te e
ntai
lmen
ts•
wha
t voc
abul
ary?
•w
hat f
acts
to r
epre
sent
?
KR
& R
© B
rach
man
& L
eves
que
200
537
Vo
cab
ula
ry
Dom
ain-
depe
nden
t pre
dica
tes
and
func
tions
mai
n qu
estio
n: w
hat a
re th
e in
divi
dual
s?
here
: pe
ople
, pla
ces,
com
pani
es, .
..
nam
ed in
divi
dual
s jo
hn, s
leez
yTow
n, f
aulty
Insu
ranc
eCor
p, f
ic, j
ohnQ
smith
, ...
basi
c ty
pes
Pers
on, P
lace
, Man
, Wom
an, .
..
attr
ibut
esR
ich,
Bea
utif
ul, U
nscr
upul
ous,
...
rela
tions
hips
Liv
esA
t, M
arri
edT
o, D
augh
terO
f, H
adA
nAff
airW
ith,
Bla
ckm
ails
, ...
func
tions
fath
erO
f, c
eoO
f, b
estF
rien
dOf,
...
KR
& R
© B
rach
man
& L
eves
que
200
538
Bas
ic f
acts
Usu
ally
ato
mic
sen
tenc
es a
nd n
egat
ions
type
fact
sM
an(j
ohn)
,
Wom
an(j
ane)
,
Com
pany
(fau
ltyIn
sura
nceC
orp)
prop
erty
fact
sR
ich(
john
),
¬H
appi
lyM
arri
ed(j
im),
Wor
ksFo
r(jim
,fic
)
equa
lity
fact
sjo
hn =
ceo
Of(
fic)
,
fic
= f
aulty
Insu
ranc
eCor
p,
best
Frie
ndO
f(jim
) =
john
Like
a s
impl
e da
taba
se (
can
stor
e in
a ta
ble)
KR
& R
© B
rach
man
& L
eves
que
200
539
Co
mp
lex
fact
s
Uni
vers
al a
bbre
viat
ions
∀y[
Wom
an(y
)∧
y≠
jane
⊃ L
oves
(y,jo
hn)]
∀y[
Ric
h(y)
∧ M
an(y
)⊃
Lov
es(y
,jane
)]
∀x∀
y[L
oves
(x,y
)⊃
¬B
lack
mai
ls(x
,y)]
Inco
mpl
ete
know
ledg
eL
oves
(jan
e,jo
hn)
∨ L
oves
(jan
e,jim
)w
hich
?
∃x[A
dult(
x)∧
Bla
ckm
ails
(x,jo
hn)]
who
?
Clo
sure
axi
oms
∀x[
Pers
on(x
)⊃
x=
jane
∨ x=
john
∨ x=
jim ..
.]
∀x∀
y[M
arri
edT
o(x,
y)⊃
...
]
∀x[
x=fi
c ∨
x=ja
ne∨
x=jo
hn∨
x=jim
...]
also
use
ful t
o ha
ve j
ane
≠ jo
hn
...
poss
ible
to e
xpre
ss
with
out q
uant
ifier
s
cann
ot w
rite
dow
na
mor
e co
mpl
ete
vers
ion
limit
the
dom
ain
of d
isco
urse
KR
& R
© B
rach
man
& L
eves
que
200
540
Ter
min
olo
gic
al f
acts
Gen
eral
rel
atio
nshi
ps a
mon
g pr
edic
ates
. F
or e
xam
ple:
disj
oint
∀x[
Man
(x)
⊃ ¬
Wom
an(x
)]
subt
ype
∀x[
Sena
tor(
x)⊃
Leg
isla
tor(
x)]
exha
ustiv
e∀
x[A
dult(
x)⊃
Man
(x) ∨
Wom
an(x
)]
sym
met
ry∀
x∀y
[Mar
ried
To(
x,y)
⊃ M
arri
edT
o(y,
x)]
inve
rse
∀x∀
y[C
hild
Of(
x,y)
⊃ P
aren
tOf(
y,x)
]
type
res
tric
tion
∀x∀
y[M
arri
edT
o(x,
y)⊃
Pe
rson
(x)
∧ P
erso
n(y)
∧ O
ppSe
x(x,
y)]
Usu
ally
uni
vers
ally
qua
ntifi
ed c
ondi
tiona
ls o
r bi
cond
ition
als
som
etim
es
KR
& R
© B
rach
man
& L
eves
que
200
541
En
tailm
ents
: 1
Is th
ere
a co
mpa
ny w
hose
CE
O lo
ves
Jane
?
∃x[C
ompa
ny(x
)∧
Lov
es(c
eoO
f(x)
,jane
)] ?
?
Sup
pose
ℑ|=
KB
.T
hen
ℑ|=
Ric
h(jo
hn),
Man
(joh
n),
and
ℑ|=
∀y[
Ric
h(y)
∧ M
an(y
)⊃
Lov
es(y
,jane
)]
soℑ
|= L
oves
(joh
n,ja
ne).
Als
oℑ
|= j
ohn
= c
eoO
f(fi
c),
soℑ
|= L
oves
( ce
oOf(
fic)
,jane
).F
inal
lyℑ
|= C
ompa
ny(f
aulty
Insu
ranc
eCor
p),
and
ℑ|=
fic
= f
aulty
Insu
ranc
eCor
p,
soℑ
|= C
ompa
ny(f
ic).
Thu
s,ℑ
|= C
ompa
ny(f
ic)
∧ L
oves
( ce
oOf(
fic)
,jane
),
and
so
ℑ|=
∃x[C
ompa
ny(x
)∧
Lov
es(c
eoO
f(x)
,jane
)].
Can
ext
ract
iden
tity
of c
ompa
ny fr
om th
is p
roof
KR
& R
© B
rach
man
& L
eves
que
200
542
En
tailm
ents
: 2
If no
man
is b
lack
mai
ling
John
, the
n is
he
bein
g bl
ackm
aile
d by
so
meb
ody
he lo
ves?
∀x[
Man
(x)
⊃ ¬
Bla
ckm
ails
(x,jo
hn)]
⊃∃y
[Lov
es(j
ohn,
y)∧
Bla
ckm
ails
(y,jo
hn)]
??
Not
e:
KB
|=(α
⊃ β
) i
ff K
B ∪
{α}
|=β
Let:
ℑ|=
KB
∪ {
∀x[
Man
(x)
⊃¬
Bla
ckm
ails
(x,jo
hn)]
}S
how
:ℑ
|=∃y
[Lov
es(j
ohn,
y)∧
Bla
ckm
ails
(y,jo
hn)
Hav
e:∃x
[Adu
lt(x)
∧ B
lack
mai
ls(x
,john
)]an
d∀
x[A
dult(
x)⊃
Man
(x)
∨ W
oman
(x)]
so∃x
[Wom
an(x
)∧
Bla
ckm
ails
(x,jo
hn)]
.
The
n:∀
y[R
ich(
y)∧
Man
(y)
⊃ L
oves
(y,ja
ne)]
and
Ric
h(jo
hn)
∧ M
an(j
ohn)
soL
oves
(joh
n,ja
ne)!
But
:∀
y[W
oman
(y)
∧y
≠ ja
ne⊃
Lov
es(y
,john
)]an
d∀
x∀y[
Lov
es(x
,y)
⊃¬
Bla
ckm
ails
(x,y
)]so
∀y[
Wom
an(y
)∧
y≠
jane
⊃¬
Bla
ckm
ails
(y,jo
hn)]
and
Bla
ckm
ails
(jan
e,jo
hn)!
!
Fin
ally
:L
oves
(joh
n,ja
ne)
∧ B
lack
mai
ls(j
ane,
john
)so
:∃y
[Lov
es(j
ohn,
y)∧
Bla
ckm
ails
(y,jo
hn)]
KR
& R
© B
rach
man
& L
eves
que
200
543
Wh
at in
div
idu
als?
Som
etim
es u
sefu
l to
redu
ce n
-ary
pre
dica
tes
to 1
-pla
ce
pred
icat
es a
nd 1
-pla
ce fu
nctio
ns•
invo
lves
rei
fyin
g pr
oper
ties:
new
indi
vidu
als
•ty
pica
l of d
escr
iptio
n lo
gics
/ fr
ame
lang
uage
s
(la
ter)
Fle
xibi
lity
in te
rms
of a
rity:
Purc
hase
s(jo
hn,s
ears
,bik
e)or
Purc
hase
s(jo
hn,s
ears
,bik
e,fe
b14)
orPu
rcha
ses(
john
,sea
rs,b
ike,
feb1
4,$1
00)
Inst
ead:
intr
oduc
e pu
rcha
se o
bjec
ts
Purc
hase
(p)
∧ a
gent
(p)=
john
∧ o
bj(p
)=bi
ke∧
sour
ce(p
)=se
ars
∧ ..
.al
low
s pu
rcha
se to
be
desc
ribed
at v
ario
us le
vels
of d
etai
l
Com
plex
rel
atio
nshi
ps:
Mar
ried
To(
x,y)
vs.
ReM
arri
edT
o(x,
y)vs
. ...
Inst
ead
def
ine
mar
ital s
tatu
s in
term
s of
exi
sten
ce o
fm
arria
ge a
nd d
ivor
ce e
vent
s.
Mar
riag
e(m
)∧
hus
band
(m)=
x∧
wif
e(m
)=y
∧ d
ate(
m)=
...∧.
..
KR
& R
© B
rach
man
& L
eves
que
200
544
Ab
stra
ct in
div
idu
als
Als
o ne
ed in
divi
dual
s fo
r nu
mbe
rs, d
ates
, tim
es, a
ddre
sses
, etc
.ob
ject
s ab
out w
hich
we
ask
wh-
ques
tions
Qua
ntiti
es a
s in
divi
dual
sag
e(su
zy)
= 1
4
age-
in-y
ears
(suz
y) =
14
age-
in-m
onth
s(su
zy)
= 1
68
perh
aps
bette
r to
hav
e an
obj
ect f
or “
the
age
of S
uzy”
, who
se v
alue
in y
ears
is 1
4
year
s(ag
e(su
zy))
= 1
4
mon
ths(
x)=
12*
year
s(x)
cent
imet
ers(
x)=
100
*met
ers(
x)
Sim
ilarly
with
loca
tions
and
tim
esin
stea
d of
time(
m)=
"Jan
5 2
006
4:47
:03E
ST"
can
use
time(
m)=
t∧
yea
r(t)
=20
06∧
...
KR
& R
© B
rach
man
& L
eves
que
200
545
Oth
er s
ort
s o
f fa
cts
Sta
tistic
al /
prob
abili
stic
fact
s•
Hal
f of t
he c
ompa
nies
are
loca
ted
on th
e E
ast S
ide.
•M
ost o
f the
em
ploy
ees
are
rest
less
.
•A
lmos
t non
e of
the
empl
oyee
s ar
e co
mpl
etel
y tr
ustw
orth
y,
Def
ault
/ pro
toty
pica
l fac
ts•
Com
pany
pre
side
nts
typi
cally
hav
e se
cret
arie
s in
terc
eptin
g th
eir
phon
e ca
lls.
•C
ars
have
four
whe
els.
•C
ompa
nies
gen
eral
ly d
o no
t allo
w e
mpl
oyee
s th
at w
ork
toge
ther
to b
e m
arrie
d.
Inte
ntio
nal f
acts
•Jo
hn b
elie
ves
that
Hen
ry is
tryi
ng to
bla
ckm
ail h
im.
•Ja
ne d
oes
not w
ant J
im to
thin
k th
at s
he lo
ves
John
.
Oth
ers
...
KR
& R
© B
rach
man
& L
eves
que
200
546
4.
Res
olut
ion
KR
& R
© B
rach
man
& L
eves
que
200
547
Go
al
Ded
uctiv
e re
ason
ing
in la
ngua
ge a
s cl
ose
as p
ossi
ble
to fu
ll F
OL
¬,
∧, ∨
, ∃,
∀
Kno
wle
dge
Leve
l:gi
ven
KB
, α,
det
erm
ine
if K
B |=
α.
orgi
ven
an o
pen
α[x 1
,x2,
...x n
], fi
nd t 1
,t 2,..
.t n s
uch
that
KB
|=α[
t 1,t 2
,...t n
]
Whe
n K
B is
fini
te {
α 1, α
2, ...
, αk}
KB
|=α
iff|=
[(α 1
∧ α
2 ∧ ..
. ∧ α
k) ⊃
α]
iffK
B∪
{¬
α} i
s un
satis
fiabl
e
iff
KB
∪ {
¬α}
|=
FA
LSE
whe
re F
ALS
E is
som
ethi
ng li
ke ∃
x.(x
≠x)
So
wan
t a p
roce
dure
to te
st fo
r va
lidity
, or
satis
fiabi
lity,
or
for
enta
iling
FA
LSE
.
Will
now
con
side
r su
ch a
pro
cedu
re (
first
with
out q
uant
ifier
s)
KR
& R
© B
rach
man
& L
eves
que
200
548
Cla
usa
l rep
rese
nta
tio
n
For
mul
a =
set
of c
laus
es
Cla
use
= s
et o
f lite
rals
Lite
ral
= a
tom
ic s
ente
nce
or it
s ne
gatio
npo
sitiv
e lit
eral
and
neg
ativ
e lit
eral
Not
atio
n:If
ρis
a li
tera
l, th
en ρ
is it
s co
mpl
emen
t
p⇒
¬p
¬p
⇒ p
To
dist
ingu
ish
clau
ses
from
form
ulas
:
[ an
d ]
for
clau
ses:
[p, r
, s]
{ an
d }
for
form
ulas
:{
[p, r
, s],
[p,
r, s
], [
p]
}
[] i
s th
e em
pty
clau
se{}
is th
e em
pty
form
ula
So
{} is
diff
eren
t fro
m{[
]}!
Inte
rpre
tatio
n:F
orm
ula
und
erst
ood
as c
onju
nctio
n of
cla
uses
Cla
use
unde
rsto
od a
s di
sjun
ctio
n of
lite
rals
Lite
rals
und
erst
ood
norm
ally
{[p,
¬q]
, [r]
, [s]
}
repr
esen
ts
((p
∨ ¬
q)∧
r∧
s)
[ ]
repr
esen
ts
FAL
SE
KR
& R
© B
rach
man
& L
eves
que
200
549
CN
F a
nd
DN
F
Eve
ry p
ropo
sitio
nal w
ff α
can
be c
onve
rted
into
a fo
rmul
a α′
inC
onju
nctiv
e N
orm
al F
orm
(C
NF
) in
suc
h a
way
that
|=
α ≡
α′.
1.el
imin
ate
⊃ a
nd≡
usi
ng (
α ⊃
β)
� (
¬α
∨ β)
etc
.
2.pu
sh ¬
inw
ard
usi
ng¬
(α ∧
β)
� (
¬α
∨ ¬
β) e
tc.
3.di
strib
ute
∨ ov
er∧
usi
ng (
(α ∧
β)
∨ γ)
� (
(α ∨
γ)
∧ (β
∨ γ
))
4.co
llect
term
s u
sing
(α
∨ α)
� α
etc
.
Res
ult i
s a
conj
unct
ion
of d
isju
nctio
n of
lite
rals
.an
ana
logo
us p
roce
dure
pro
duce
s D
NF
, a
disj
unct
ion
of c
onju
nctio
n of
lite
rals
We
can
iden
tify
CN
F w
ffs w
ith c
laus
al fo
rmul
as(p
∨ ¬
q∨
r)∧
(s ∨
¬r)
�
{ [p
,¬q,
r],
[s,
¬r]
}
So:
giv
en a
fini
te K
B, t
o fin
d ou
t if K
B |=
α, i
t will
be
suffi
cien
t to
1.pu
t (K
B ∧
¬α)
into
CN
F, a
s ab
ove
2.de
term
ine
the
satis
fiabi
lity
of th
e cl
ause
s
KR
& R
© B
rach
man
& L
eves
que
200
550
Res
olu
tio
n r
ule
of
infe
ren
ce
Giv
en tw
o cl
ause
s, in
fer
a ne
w c
laus
e:F
rom
cla
use
{p
}∪
C1,
and
{¬
p}
∪ C
2,
infe
r cl
ause
C1
∪ C
2.
C1
∪ C
2 is
cal
led
a re
solv
ent o
f inp
ut c
laus
es w
ith r
espe
ct to
p.
Exa
mpl
e:cl
ause
s[w
,r, q
] a
nd[w
, s, ¬
r] h
ave
[w, q
, s]
as
reso
lven
t wrt
r.
Spe
cial
Cas
e:
[p]
and
[¬p]
res
olve
to [
] (
the
C1
and
C2
are
em
pty)
A d
eriv
atio
n of
a c
laus
e c
from
a s
et S
of c
laus
es is
a s
eque
nce
c 1, c
2, ..
., c n
of c
laus
es, w
here
cn
=c,
and
for
each
ci,
eith
er
1. c
i∈
S,
or
2. c
i is
a r
esol
vent
of t
wo
earli
er c
laus
es i
n th
e de
rivat
ion
Writ
e:S
→ c
if th
ere
is a
der
ivat
ion
KR
& R
© B
rach
man
& L
eves
que
200
551
Rat
ion
ale
Res
olut
ion
is a
sym
bol-l
evel
rul
e of
infe
renc
e, b
ut h
as a
co
nnec
tion
to k
now
ledg
e-le
vel l
ogic
al in
terp
reta
tions
Cla
im: R
esol
vent
is e
ntai
led
by in
put c
laus
es.
Sup
pose
ℑ|=
(p
∨ α)
and
ℑ|=
(¬
p∨
β)C
ase
1:ℑ
|=p
then
ℑ|=
β,
soℑ
|= (
α ∨
β).
Cas
e 2:
ℑ|≠
p
then
ℑ|=
α,
soℑ
|= (
α ∨
β).
Eith
er w
ay,
ℑ|=
(α
∨ β)
.
So:
{(p
∨ α)
, (¬
p∨
β)}
|= (
α ∨
β).
Spe
cial
cas
e:[p
] a
nd[¬
p] r
esol
ve to
[ ]
,
so{[
p],[
¬p]
}|=
FA
LSE
that
is:
{[p]
,[¬
p]}
is u
nsat
isfia
ble
KR
& R
© B
rach
man
& L
eves
que
200
552
Der
ivat
ion
s an
d e
nta
ilmen
t
Can
ext
end
the
prev
ious
arg
umen
t to
deriv
atio
ns:
IfS
→ c
the
n S
|= c
Pro
of:
by
indu
ctio
n on
the
leng
th o
f the
der
ivat
ion.
Sho
w (
by lo
okin
g at
the
two
case
s) th
at S
|= c
i.
But
the
conv
erse
doe
s no
t hol
d in
gen
eral
Can
hav
e S
|= c
with
out h
avin
gS
→ c
.
Exa
mpl
e:{[
¬p]
}|=
[¬
p,¬
q]i.e
.¬
p|=
(¬
p∨
¬q)
but n
o de
rivat
ion
How
ever
....
Res
olut
ion
isre
futa
tion
com
plet
e!
Th
eore
m:
S→
[]
iff
S |=
[]
Res
ult w
ill c
arry
ove
r to
qua
ntifi
ed c
laus
es (
late
r)
So
for
any
set S
of c
laus
es: S
is u
nsat
isfia
ble
iff
S→
[].
Pro
vide
s m
etho
d fo
r de
term
inin
g sa
tisfia
bilit
y: s
earc
h al
l der
ivat
ions
for
[].
So
prov
ides
a m
etho
d fo
r de
term
inin
g al
l ent
ailm
ents
soun
d an
d co
mpl
ete
whe
n re
stric
ted
to [
]
KR
& R
© B
rach
man
& L
eves
que
200
553
A p
roce
du
re f
or
enta
ilmen
t
To
dete
rmin
e if
KB
|=α,
•pu
t KB
, ¬α
into
CN
F to
get
S,
as b
efor
e
•ch
eck
if S
→ []
.
Non
-det
erm
inis
tic p
roce
dure
1.C
heck
if []
is in
S.
If ye
s, th
en r
etur
n U
NS
AT
ISF
IAB
LE
2.C
heck
if th
ere
are
two
clau
ses
in S
such
that
they
re
solv
e to
pro
duce
a c
laus
e th
at is
not
alre
ady
in S
.If
no, t
hen
retu
rn S
AT
ISF
IAB
LE
3.A
dd th
e ne
w c
laus
e to
S a
nd g
o to
1.
Not
e: n
eed
only
con
vert
KB
to C
NF
onc
e•
can
hand
le m
ultip
le q
uerie
s w
ith s
ame
KB
•af
ter
addi
tion
of n
ew fa
ct α
, can
sim
ply
add
new
cla
uses
α′ t
o K
B
So:
goo
d id
ea to
kee
p K
B in
CN
F
If K
B =
{},
then
we
are
test
ing
the
valid
ity o
f α
KR
& R
© B
rach
man
& L
eves
que
200
554
Exa
mp
le 1
Sho
w t
hat
KB
|= G
irl
[Fir
stG
rade
] [¬Fi
rstG
rade
, Chi
ld]
[¬C
hild
,¬Fe
mal
e, G
irl]
[¬C
hild
,¬M
ale,
Boy
]
[¬K
inde
rgar
ten,
Chi
ld]
[Fem
ale]
[¬G
irl]
[Chi
ld] [G
irl,
¬Fe
mal
e]
[Gir
l]
[]
nega
tion
of
quer
y
Der
ivat
ion
has
9 cl
ause
s, 4
new
Firs
tGra
de
Firs
tGra
de⊃
Chi
ld
Chi
ld∧
Mal
e ⊃
Boy
Kin
derg
arte
n⊃
Chi
ld
Chi
ld∧
Fem
ale
⊃ G
irl
Fem
ale
KB
KR
& R
© B
rach
man
& L
eves
que
200
555
Exa
mp
le 2
[Rai
n, S
un]
[¬
Sun,
Mai
l] [
¬R
ain,
Mai
l] [
¬M
ail]
[¬Sl
eet,
Mai
l]
[¬R
ain]
[¬Su
n]
[Rai
n]
[]N
ote:
eve
ry c
laus
e no
t in
Sha
s 2
pare
nts
Sho
w K
B |=
Mai
l(R
ain
∨ Su
n)
(Sun
⊃ M
ail)
((R
ain
∨ Sl
eet)
⊃ M
ail)
KB
Sim
ilarly
K
B |≠
Rai
nC
an e
num
erat
e al
l res
olve
nts
give
n ¬
Rai
n,an
d[]
will
not
be
gene
rate
d
KR
& R
© B
rach
man
& L
eves
que
200
556
Qu
anti
fier
s
Cla
usal
form
as
befo
re, b
ut a
tom
isP
(t1,
t 2, .
.., t n
), w
here
t i m
ay
cont
ain
varia
bles
Inte
rpre
tatio
n as
bef
ore,
but
var
iabl
es a
re u
nder
stoo
d un
iver
sally
Exa
mpl
e:{
[P(x
),¬
R(a
,f(b,
x))]
, [Q
(x,y
)] }
inte
rpre
ted
as
∀x∀
y{[R
(a,f(
b,x)
)⊃
P(x
)]∧
Q(x
,y)}
Sub
stitu
tions
:θ
={v
1/t 1
, v 2
/t2,
...,
v n/t n
}
Not
atio
n: I
f ρis
a li
tera
l and
θ is
a s
ubst
itutio
n, th
enρθ
is
the
resu
lt of
the
subs
titut
ion
(and
sim
ilarly
, cθ
whe
rec
is a
cla
use)
Exa
mpl
e:θ
={x
/a,y
/g(x
,b,z
)}
P(x
,z,f(
x,y)
)θ
=P
(a,z
,f(a,
g(x,
b,z)
))
A li
tera
l is
grou
nd if
it c
onta
ins
no v
aria
bles
.
A li
tera
l ρ is
an
inst
ance
of ρ
′, if
for
som
e θ,
ρ =
ρ′θ
.
KR
& R
© B
rach
man
& L
eves
que
200
557
Gen
eral
izin
g C
NF
Res
olut
ion
will
gen
eral
ize
to h
andl
ing
varia
bles
But
to c
onve
rt w
ffs to
CN
F, w
e ne
ed th
ree
addi
tiona
l ste
ps:
1.el
imin
ate
⊃ a
nd≡
2.pu
sh¬
inw
ard
usi
ng a
lso
¬∀
x.α
�
∃x.¬
α e
tc.
3.st
anda
rdiz
e va
riabl
es: e
ach
quan
tifie
r ge
ts it
s ow
n va
riabl
e
e.g.
∃x[P
(x)]
∧ Q
(x)
�
∃z[P
(z)]
∧ Q
(x)
whe
rez
is a
new
var
iabl
e
4. e
limin
ate
all e
xist
entia
ls(d
iscu
ssed
late
r)
5.m
ove
univ
ersa
ls to
the
fron
t us
ing
(∀
xα) ∧
β�
∀
x(α∧
β)
whe
reβ
does
not
use
x
6.di
strib
ute
∨ ov
er∧
7.co
llect
term
s
Get
uni
vers
ally
qua
ntifi
ed c
onju
nctio
n of
dis
junc
tion
of li
tera
lsth
en d
rop
all t
he q
uant
ifier
s...
Igno
re =
for
now
KR
& R
© B
rach
man
& L
eves
que
200
558
Fir
st-o
rder
res
olu
tio
n
Mai
n id
ea: a
lite
ral (
with
var
iabl
es)
stan
ds fo
r al
l its
inst
ance
s; s
o al
low
all
such
infe
renc
es
So
give
n [P
(x,a
),¬
Q(x
)]an
d[¬
P(b
,y),
¬R
(b,f(
y))]
,w
ant t
o in
fer
[¬Q
(b),
¬R
(b,f(
a))]
am
ong
othe
rssi
nce
[P(x
,a),
¬Q
(x)]
has
[P(b
,a),
¬Q
(b)]
and
[¬P
(b,y
),¬
R(b
,f(y
))]
has
[¬P
(b,a
),¬
R(b
,f(a)
)]
Res
olut
ion:
Giv
en c
laus
es:
{ρ1}
∪C
1 a
nd {
ρ 2}
∪C
2.
Ren
ame
varia
bles
, so
that
dis
tinct
in tw
o cl
ause
s.
For
any
θ s
uch
that
ρ1θ
=ρ 2
θ, c
an in
fer
(C1
∪C
2)θ.
We
say
that
ρ1
unifi
es w
ith ρ
2 an
d th
at θ
is a
uni
fier
of t
he tw
o lit
eral
s
Res
olut
ion
deriv
atio
n: a
s be
fore
Th
eore
m:
S→
[] i
ff S
|= [
]iff
S is
uns
atis
fiabl
eN
ote:
The
re a
re p
atho
logi
cal e
xam
ples
whe
re a
slig
htly
mor
e ge
nera
l de
finiti
on o
f Res
olut
ion
is r
equi
red.
We
igno
re th
em fo
r no
w...
KR
& R
© B
rach
man
& L
eves
que
200
559
Exa
mp
le 3
[¬H
ardW
orke
r(su
e)]
[¬St
uden
t(su
e)]
[¬G
radS
tude
nt(s
ue)]
[]
x/su
e
x/su
e
[¬St
uden
t(x)
, Har
dWor
ker(
x)]
[¬G
radS
tude
nt(x
), S
tude
nt(x
)]
[Gra
dStu
dent
(sue
)]
Labe
l eac
h st
epw
ith th
e un
ifier
Poi
nt to
rel
evan
tlit
eral
s in
cla
uses
∀x
Gra
dStu
dent
(x)
⊃ S
tude
nt(x
)
∀x
Stud
ent(
x)⊃
Har
dWor
ker(
x)
Gra
dStu
dent
(sue
)
KB
KB
|= H
ardW
orke
r(su
e)?
KR
& R
© B
rach
man
& L
eves
que
200
560
Th
e 3
blo
ck e
xam
ple
[On(
b,c)
]
[On(
a,b)
]
[¬O
n(x,
y),¬
Gre
en(x
), G
reen
(y)] [
Gre
en(a
)]
[¬G
reen
(c)]
[¬G
reen
(a),
Gre
en(b
)]
[¬G
reen
(b),
Gre
en(c
)]
[¬G
reen
(b)]
[Gre
en(b
)]
[]N
ote:
Nee
d to
use
O
n(x,
y)tw
ice,
for
2 ca
ses
{x/b
, y/c
}
{x/a
, y/b
}
KB
= {
On(
a,b)
, O
n(b,
c),
Gre
en(a
),¬
Gre
en(c
)}
Que
ry =
∃x∃y
[On(
x,y)
∧ G
reen
(x)
∧ ¬
Gre
en(y
)]N
ote:
¬Q
has
no
exis
tent
ials
, so
yiel
ds
alre
ady
in C
NF
KR
& R
© B
rach
man
& L
eves
que
200
561
Ari
thm
etic
[¬Pl
us(2
,3,u
)]
[¬Pl
us(1
,3,v
)]
[¬Pl
us(0
,3,w
)]
[]
x/3,
w/3
x/0,
y/3,
v/su
cc(w
),z/
w
x/1,
y/3,
u/su
cc(v
),z/
v
Can
find
the
answ
er in
the
deriv
atio
nu/
succ
(suc
c(3)
)
that
is:
u/5
Can
als
o de
rive
Plus
(2,3
,5)
Ren
ame
varia
bles
to
kee
p th
em d
istin
ct
[¬Pl
us(x
,y,z
), P
lus(
succ
(x),
y,su
cc(z
))]
[Plu
s(0,
x,x)
]
KB
:Pl
us(z
ero,
x,x)
Plus
(x,y
,z)
⊃ P
lus(
succ
(x),
y,su
cc(z
))
Q:
∃uPl
us(2
,3,u
)
For
rea
dabi
lity,
w
e us
e 0 fo
rze
ro,
1 fo
rsu
cc(z
ero)
,2
for
succ
(suc
c(ze
ro))
etc.
KR
& R
© B
rach
man
& L
eves
que
200
562
An
swer
pre
dic
ates
In fu
ll F
OL,
we
have
the
poss
ibili
ty o
f der
ivin
g∃x
P(x
)w
ithou
tbe
ing
able
to d
eriv
e P
(t)
for
any
t.e.
g. th
e th
ree-
bloc
ks p
robl
em
∃x∃y
[On(
x,y)
∧ G
reen
(x)
∧ ¬
Gre
en(y
)]
but c
anno
t der
ive
whi
ch b
lock
is w
hich
Sol
utio
n: a
nsw
er-e
xtra
ctio
n pr
oces
s•
repl
ace
quer
y ∃
xP(x
) by
∃x[
P(x
)∧
¬A
(x)]
whe
reA
is a
new
pre
dica
te s
ymbo
l cal
led
the
answ
er p
redi
cate
•in
stea
d of
der
ivin
g [
], d
eriv
e an
y cl
ause
con
tain
ing
just
the
answ
er p
redi
cate
•ca
n al
way
s co
nver
t to
and
from
a d
eriv
atio
n of
[]
Stud
ent(
john
)
[¬St
uden
t(x)
,¬H
appy
(x),
A(x
)]H
appy
(joh
n)
[¬St
uden
t(jo
hn),
A(j
ohn)
]
[A(j
ohn)
]{x/
john
}
⇓
An
answ
er is
: Joh
n
KB
:St
uden
t(jo
hn)
Stud
ent(
jane
)H
appy
(joh
n)
Q:
∃x[S
tude
nt(x
)∧
Hap
py(x
)]
KR
& R
© B
rach
man
& L
eves
que
200
563
Dis
jun
ctiv
e an
swer
s
[¬H
appy
(joh
n),A
(joh
n)]
[A(j
ane)
, A(j
ohn)
]
{x/jo
hn}
⇓[¬
Stud
ent(
x),¬
Hap
py(x
),A
(x)]
Stud
ent(
jane
)
[¬H
appy
(jan
e),A
(jan
e)]
{x/ja
ne}
[Hap
py(j
ohn)
, Hap
py(j
ane)
]
[Hap
py(j
ohn)
,A(j
ane)
]
Stud
ent(
john
)
An
answ
er is
: ei
ther
Jan
e or
Joh
n
KB
: Stud
ent(
john
)St
uden
t(ja
ne)
Hap
py(j
ohn)
∨ H
appy
(jan
e)
Que
ry:
∃x[S
tude
nt(