0
votes

In the code below, i'm getting error in sister function that "Illegal character" in **

Blockquote

Person \= P1** (\= is for not equal to)

Blockquote

DOMAINS Person = SYMBOL

PREDICATES parent(Person,Person) female(Person) male(Person) mother(Person,Person) father(Person,Person) grandfather(Person,Person) grandmother(Person,Person) sister(Person,Person)

CLAUSES female(merry). female(syndra). female(juliet). female(lisa).

male(parker).
male(peter).
male(herry).
male(bob).
male(paul).

parent(juliet,lisa).
parent(bob,lisa).
parent(bob,paul).
parent(bob,merry).

parent(juliet,paul).
parent(juliet,merry).
parent(peter,herry).
parent(lisa,herry).
parent(merry,parker).
parent(merry,syndra).

father(X,Person):-parent(X,Person) , male(X).
mother(X,Person):-parent(X,Person) , female(X).

grandfather(X,Person):-parent(Y,Person),father(X,Y).
grandmother(X,Person):-parent(Y,Person),mother(X,Y).

sister(X,Person):-parent(Z,X),parent(Z,Person),Person \= P1,female(Person).
1

1 Answers

0
votes

not sure about, and I can't try because I don't have Turbo Prolog right now, but I vaguely remember that Variables doesn't need to be declared.

And I suspect that Child should be Person instead (after all, a Child is a Person). Try to simplify in this way

DOMAINS

Person = SYMBOL

PREDICATES

parent(Person,Person)
female(Person)
male(Person)
mother(Person,Person)
...