Answer the question
In order to leave comments, you need to log in
How to correctly set the target in turbo prolog?
Hello, I can’t find anywhere how to set a target for searching for a brother in the knowledge base of family relations using Turbo Prolog.
domains
a=symbol
predicates
parent(a,a)
sex(a,a)
mother(a,a)
father(a,a)
brother(a,a)
son(a,a)
nephew(a,a)
grandma(a,a)
grandfa(a,a)
grandson(a,a)
clauses
sex(vyacheslav1,man).
sex(vladimir,man).
sex(gennady,man).
sex(vadim,man).
sex(kirill,man).
sex(vyacheslav2,man).
sex(natalia,woman).
sex(lyubov,woman).
sex(oksana,woman).
sex(polina,woman).
parent(gennady,vyacheslav1).
parent(gennady,lyubov).
parent(oksana,vladimir).
parent(oksana,natalia).
parent(vadim,gennady).
parent(vadim,oksana).
parent(kirill,gennady).
parent(kirill,oksana).
parent(vyacheslav2,vadim).
parent(vyacheslav2,polina).
mother(X,Y):-parent(X,Y),sex(Y,woman).
father(X,Y):-parent(X,Y),sex(Y,man).
brother(X,Y):-parent(Z,X),parent(Z,Y),sex(Z,man).
son(X,Y):-parent(Y,X),sex(X,man).
nephew(X,Y):-son(X,Z),brother(Z,Y).
grandma(X,Y):-parent(X,Z),parent(Z,Y),sex(X,woman).
grandfa(X,Y):-parent(X,Z),parent(Z,Y),sex(X,man).
grandson(X,Y):-parent(X,Z),parent(Z,Y),sex(Y,man).
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question