Title: predicates
1(No Transcript)
2predicates nondeterm isa(symbol,symbol) nondeterm
hasprop(symbol,symbol,symbol). nondeterm
hasproperty(symbol,symbol,symbol). clauses isa(ca
nary,bird). isa(robin,bird). isa(ostrich,bird). is
a(bird,animal). isa(opus,penguin). isa(penguin,bir
d). isa(fish,animal). isa(tweety,canary). hasprop
(tweety,color,white). hasprop(robin,color,red). ha
sprop(canary,color,yellow). hasprop(penguin,color,
brown). hasprop(bird,travel,fly).
Implementing inference using inheretance
hasprop(fish,travel,swim). hasprop(ostrich,travel,
walk). hasprop(penguin,travel,walk). hasprop(robin
,sound,sing). hasprop(canary,sound,sing). hasprop(
bird,cover,feather). hasprop(animal,cover,skin).
hasproperty(Obj,Pr,Val)-hasprop(Obj,Pr,Val). hasp
roperty(Obj,Pr,Val)-isa(Obj,Parent),hasproperty(P
arent,Pr,Val). goal hasproperty(Obj,Pr,fly).
3Namebird
Nameanimal
Isa animal
Isa animate
Propflies,feather
Propeats,skin
Default
Default
Nametweety
Namecanary
Isa canary
Isa bird
Prop color(yellow),sound(sing)
Prop color(yellow),sound(sing)
Defaultcolor(white)
Defaultsize(small)
Frames from a knowledge base of birds
4domains objsymbol proptravel(symbol)color(symbo
l)call(symbol)size(symbol)cover(symbol)action(
symbol) listpprop namename(obj) isaisa(obj) pr
edicates nondeterm frame(name,isa,listp,listp) non
determ get(prop,obj) nondeterm member(prop,listp)
nondeterm memberf(prop,listp) nondeterm
uget(obj,listp) nondeterm equal(prop,prop) print(l
istp) clauses frame(name(bird),isa(animal),travel
(flies),cover(feathers),). frame(name(penguin),
isa(bird),color(brown),travel(walks)). frame(n
ame(canary),isa(bird),color(yellow),call(sing),
size(small)). frame(name(tweety),isa(canary),,
color(white)). equal(travel(_),travel(_)).
equal(color(_),color(_)). equal(call(_),call(_)).
equal(size(_),size(_)). equal(cover(_),cover(_
)). equal(action(_),action(_)).
5memberf(P,H_)-equal(P,H). memberf(Pro,_T)-
memberf(Pro,T). member(P,H_)-PH. member(Pro,
_T)-member(Pro,T). get(Pro,Obj)-frame(name(O
bj),_,LP,_),member(Pro,LP). get(Pro,Obj)-frame(na
me(Obj),_,_,LD),member(Pro,LD). get(Pro,Obj)-fra
me(name(Obj),isa(Parent),_,_),get(Pro,Parent). ug
et(Obj,L)-get(H,Obj),NOT(memberf(H,L)),uget(Obj,
HL). uget(Obj,L)-write(Obj),write(""),print(L)
. print(). print(HT)-write(H),print(T). goa
l uget(tweety,).
tweetycover("feathers")travel("flies")size("small
")call("sing")color("white")yes