More Related Content
More from DrSamahAhmed (7)
Decision support systems (ch10) prolog
- 8. Start – All Program – Accessories - Notepad
الـ برنامج فتحNOTEPAD
- 13. EXAMPLE 3
prof(youssef,dss,1clook,m1).
prof(waffa,vb,3clook,m2).
prof(mona,nw,3clook,m1).
prof(hend,mm,5clook,m2).
prof(Youssef,net,4clook,m3).
- 14. Queries :-
1-?prof(M,N,X,Y).
2-?prof(M,N,_,_).
3-?prof(_,_,_,_).
4-?prof(M,dss,N,X).
5-?prof(youssef,B,N,H).
6-?Prof(M,dss,N,X).
7-?prof(hend,mm,5clook,m2).
8-?prof(Hend,mm,5clook,m2).
9-?prof(HEND,MM,5clook,m2).
- 15. EXAMPLE 4
A fast – car is fun.
A big – car is nice.
A little – car is practical.
Ali likes a car if the car is fun.
What does ail likes?
- 17. EXAMPLE 5
Ali likes Ahmed.
Ali likes dogs.
Salwa likes everything Ali likes.
What does salwa likes?
- 20. CONTINUE
sister(X,Y):-
parent(Z,X),parent(Z,Y),female(X),X=Y.
father(X,Y):-
parent(X,Y),male(X).
mother(X,Y):-
parent(X,Y),female(X).
brother(X,Y):-
parent(Z,X),parent(Z,Y),male(X),X=Y.
off(hany,hala).
off(hany,aly).
off(aml,hany).
off(yaser,hany).
off(X,Y):- parent(Y,X).X=Y.
- 21. gf(X,Z):-
parent(Y,Z),parent(X,Y),male(X),X=Y.
gm(X,Z):-
parent(Y,Z),parent(X,Y),female(X),X=Y.
CONTINUE
Queries :-
1-?sister(X,Y). 2-?brother(X,Y).
3-?father(X,Y). 4-?mother(X,Y).
5-?gf(X,Z). 6-?gm(X,Z). 7-?off(X,Y)