I have a hard time creating some relationships. Here is the table:
homem(jose).
homem(ananias).
homem(helio).
homem(jurandir).
homem(valdir).
homem(delio).
homem(fabiano).
homem(willian).
homem(diego).
homem(mateus).
homem(henrique).
mulher(generosa).
mulher(tereza).
mulher(maria).
mulher(nilzete).
mulher(ildete).
mulher(jaqueline).
mulher(gislaine).
mulher(jaqueline).
mulher(livia).
mulher(isabela).
mulher(maria_e).
casado(jose, generosa).
casado(ananias, tereza).
casado(delio, maria).
casado(jurandir, nilzete).
casado(delio, ildete).
casado(willian, jaqueline).
casado(diego, gislaine).
progenitor(jose, helio).
progenitor(generosa, helio).
progenitor(jose, jurandir).
progenitor(generosa, jurandir).
progenitor(ananias, nilzete).
progenitor(tereza, nilzete).
progenitor(ananias, valdir).
progenitor(tereza, valdir).
progenitor(ananias, ildete).
progenitor(tereza, ildete).
progenitor(helio, fabiano).
progenitor(maria, fabiano).
progenitor(jurandir, willian).
progenitor(nilzete, willian).
progenitor(jurandir, gislaine).
progenitor(nilzete, gislaine).
progenitor(delio, jaqueline).
progenitor(ildete, jaqueline).
progenitor(willian, henrique).
progenitor(jaqueline, henrique).
progenitor(willian, livia).
progenitor(jaqueline, livia).
progenitor(diego, isabela).
progenitor(gislaine, isabela).
progenitor(diego, maria_e).
progenitor(gislaine, maria_e).
progenitor(fabiano, mateus).
I need the following relationship rule: Father, mother, paternal grandmother, brothers, brother, full brothers, father-in-law, uncle, grandson, ancestor relationship.
Father and mother I'm doing it this way:
pai(X,Y) :- homem(Y), progenitor(Y,X).
mae(X,Y) :- mulher(Y), progenitor(Y,X).
But after returning to the parent, it has a false
return.
Brothers I did this:
irmao(X,Y) :- progenitor(HOMEM,X), progenitor(HOMEM,Y), X \== Y.
But in this case, only the parent returns sibling. I need a rule to return a brother with at least one parent-to-parent relationship.