Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

lab4 Name: Abiral Pokbre

RolIno: 4
. Facts:
Luther visited Rme in 1S11.
Heory made Defender of faith in 1S71
Vasco da hama dled
1S24. in
htorge killed at Paris in 1S29.
Keopenng of War in 1s40.
Wite a rule query to ask for date and dis play the result
a
oas
following
followi ng (om poring tbe entere d dqBe in the know le
dge ba
Event ha ppened in
year-Das
-

assgert (event " lu ther visited Rome", 1511).


-

asser t l event
(°"Henry made Defender of fai h", 1S71)).
-

CISSert levent ("vas(o da


nana die d ", 1S24)).
asser t event ( "heorge
kilkd at Paris", 1S29)).
assett even t "
Recp ning of war", 1546).
write (" En
ter q date 1S11,
1S21, 1s294,1529, 1Sg
read Date), event
(E,Oate), write l "E
40): ")
vent
was "), write (E). happened in year"),
write Date), urite
Enter a
datel 1S11,JS21,1s2 4, 15 29,
Event happened in year 1S 24 1S46): 1S2 4
was Vaseo da
hamg died
92, heory of List
Assert (man
man (X)-
[vam,sam, gopaJ.
shouis list
Man[XIY1)-> Xman,
lSam,gopal1. X represents Head and represent ai
man [ XIC Y1Z)-> X=ran, Y Sam, 7 gopal :

manlyI12J) -> X=ram, y =gopal.


assert t man [ram, sa m, gopall).
manx)
X =
(ram, sam, gopall
man [X(YJ).
X =rgm
Y:Tsam,gopal] d
man [
XILY1ZI] foe
X =ram
Sam
2 gopal
03. Hnd he total (ost of a list of items:
ost data (facts).
Cost cornfla kes, 2 30).
(ost lcoke, 21 6).
ost Cchocolate, 25O).
Cost (crisps, 190).
Rules:
total-cost ([I, o)
total -(ost ( [Item| Rest3, (os t) :-
(ost (Ttem, Jtem(ast),
total-cost lRest, lostOfRest),
(ost 1s Jeml ast + lostof Rest

Sample u w
n: total-cost ( I cor nf laks, trips], X ).
Y 420
hatsys tem.pl
alter ([do, you, know, french3,X)
X Ino,i, know,
gevman)
X[no, i, knou, Frenc h]
Xino, Lam, no1, know,
fren ch)
Xno, you, knod,g
erman]
X Uno, you, kooo,
frene h]
X=ldo, ),kno, gerranJ)
X [do,
h know, Freneh];
X
Ido, lam,not1, KDow,
Y [do,[am, not], know, german)
French]
5
-maletX), Father.of joe, 1), X==Y, write
joe"),nl , mother.of (Jane, z), X), orite "
is the son of
X= =
z, wri te
Son of jane ). Y), write "is He
Paulis son of joe.
Paul is Sone of jan e
X:1,Y=2, 1 pau
false
7-femal eX), father.of (joe, 1Y =Y, write l "
i, a daughter of joc "),
ntmother. of (jane, 2), Xzz 2, write tY), write ("is the daughter
of jone "),
mary is daughter of jan e.

mar s daughter of joe al


X=Y,Y 2, 2 Mary
hope is daughter or joe
hope is coughter ot jone
X=YV2, z=hope,
-Female tA), male lc)
mo her of (Jane , A), mother of ljane, ), father of U ane, A,
tather of
joe, c), A1= C, writel A) , write t"is sibling o"]
wrte ( t
Mary is si
bing oF paul
Amary
Cpaul
hope s sibling of paul
A ho Pe,
C paul;
false
-fermalelA), female (c), mother of (Jane, A), mother of
Father of Uoe, A ), ta tder- of CJoe, t), (Jae, U,
wrile LA) write l "is Alz=l,
siblipg of *), writet C).
mary is si bling oF bope.
Amar
C hope
hope is sibllhg ot mary
Ahope
mary
false

You might also like