其他分享
首页 > 其他分享> > 人工智能

人工智能

作者:互联网

 

domains 
    name=symbol. 
predicates 
    mother(name,name). 
    father(name,name). 
    grandfather(name,name). 
    grandmother(name,name). 
    sister(name,name). 
    aunt(name,name). 
goal 
    grandmother(a,X),write("X=",X),nl, 
    father(b,Y),write("Y=",Y),nl, 
    sister(d,Z),write("Z=",Z),nl, 
    aunt(d,T),write("T=",T). 
clauses 
    mother(a,c). 
    mother(a,d). 
    mother(c,g). 
    mother(c,f). 
    father(b,c). 
    father(b,d). 
    father(e,g). 
    father(e,f). 
    grandfather(X,Z):-father(X,Z),father(Y,Z). 
    grandmother(X,Z):-mother(X,Y),mother(Y,Z). 
    sister(X,Y):-mother(Z,X),mother(Z,Y). 
    aunt(X,Y):-mother(Z,Y),sister(Z,X). 

 

标签:sister,nl,name,人工智能,father,write,mother
来源: https://www.cnblogs.com/wkfvawl/p/11567529.html