This is an old revision of the document!
Predikat sister(X, Y)
velja natanko takrat, kadar je X
sestra od Y
. Primer klica:
?- sister(X, patricia). X = vanessa.
Povezave so podane s predikatom parent/2
. Predikata male/1
in female/1
določata spol vsake osebe (vozlišča).
parent(tina,william). male(william). parent(thomas,william). male(thomas). parent(thomas,sally). male(jeffrey). parent(thomas,jeffrey). male(andrew). parent(sally,andrew). male(steve). parent(sally,melanie). male(patrick). parent(andrew,joanne). male(john). parent(jill,joanne). male(michael). parent(joanne,steve). male(frank). parent(william,vanessa). male(george). parent(william,patricia). male(morty). parent(vanessa,susan). male(jerry). parent(patrick,susan). male(kramer). parent(patricia,john). male(aleksandr). parent(john,michael). male(alessandro). parent(john,michelle). male(aleksander). parent(frank,george). female(tina). parent(estelle,george). female(sally). parent(morty,jerry). female(melanie). parent(helen,jerry). female(joanne). parent(jerry,anna). female(jill). parent(elaine,anna). female(vanessa). parent(elaine,kramer). female(patricia). parent(george,kramer). female(susan). female(michelle). parent(margaret,nevia). female(estelle). parent(margaret,alessandro). female(helen). parent(ana,aleksander). female(elaine). parent(aleksandr,aleksander). female(anna). parent(nevia,luana). female(margaret). parent(aleksander,luana). female(ana). parent(nevia,daniela). female(nevia). parent(aleksander,daniela). female(luana). female(daniela).
sister(X, Y) :- parent(Z, X), parent(Z, Y), female(X), X \== Y.
# | Namig |
---|---|
1 | X in Y morata imeti (vsaj enega) skupnega starša. |
2 | X mora biti ženskega spola. |
3 | X ne more biti sestra sama sebi. |
nex(sister(vanessa, andrew)) nex(sister(elaine, george)) nex(sister(sally, thomas))
nex(sister(andrew, melanie)) nex(sister(patrick, vanessa)) nex(sister(michael, michelle))
nex(sister(vanessa, vanessa)) nex(sister(sally, sally)) nex(sister(daniela, daniela))