I
I
Intelix2022-04-21 09:52:52
Prolog
Intelix, 2022-04-21 09:52:52

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.

spoiler
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).

As a result, everyone on the Internet is exactly the same, but if I enter the target brother(X, kirill) it does not display anything.
Please help what is the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question