Тема: кто кому приходится свекром и свекровью
кто кому приходится свекром и свекровью
predicates
parent(symbol,symbol)
woman(symbol)
man(symbol)
father(symbol,symbol)
mother(symbol,symbol)
spouse(symbol,symbol)
fatherinlaw(symbol,symbol)
motherinlaw(symbol,symbol)
clauses
parent(barbara,liza).
parent(liza,alex).
parent(alex,kostya).
parent(anna,katya).
parent(katya,juli).
parent(juli,lyuda).
parent(anna,petr).
parent(petr,alex).
parent(petr,alexandr).
parent(alexandr,lyuda).
parent(sergey,katya).
parent(sergey,petr).
parent(tatiana,mihail).
parent(dmitriy,mihail).
parent(mihail,juli).
parent(valera,nikolay).
parent(nikolay,raisa).
parent(raisa,kostya).
woman(barbara).
woman(liza).
woman(anna).
woman(katya).
woman(juli).
woman(lyuda).
woman(tatiana).
woman(raisa).
man(alex).
man(kostya).
man(petr).
man(alexandr).
man(sergey).
man(mihail).
man(dmitriy).
man(valera).
man(nikolay).
spouse(liza,petr).
spouse(juli,alexandr).
spouse(katya,mihail).
spouse(anna,sergey).
spouse(tatiana,dmitriy).
spouse(raisa,alex).
father(X,Y):-
parent(X,Y),
man(X).
mother(X,Y):-
parent(X,Y),
woman(X).
fatherinlaw(X,Y):-
spouse(Y,Z),
father(X,Z).
motherinlaw(X,Y):-
spouse(Y,Z),
mother(X,Z).
goal
fatherinlaw(Sv,Dev),
write(Sv," father-in-low ",Dev," || ");
motherinlaw(Sv,Dev),
write(Sv," mother-in-law ",Dev," || ").