Ошибка программы 1010 Пролог
PREDICATES
nondeterm male(symbol)
nondeterm female(symbol)
nondeterm wife(symbol,symbol)
nondeterm mother(symbol,symbol)
nondeterm father(symbol,symbol)
nondeterm brother(symbol,symbol)
nondeterm sister(symbol,symbol)
nondeterm sonInLaw(symbol,symbol)
nondeterm brotherInLaw(symbol,symbol)
nondeterm uncle(symbol,symbol)
nondeterm sibling(symbol,symbol)
nondeterm grandson(symbol,symbol)
nondeterm grandfather(symbol,symbol)
Clauses
male(mark).
male(ahmed).
male(zeeshan).
male(summer).
female(sara).
female(sana).
wife(sara,mark).
wife(sana,ahmed).
mother(X,Y):-female(X),father(Z,Y),wife(X,Z),X<>Y.
mother(sara,sana).
father(X,Y):-male(X),mother(Z,Y),wife(Z,X),X<>Y.
brother(X,Y):-male(X),father(Z,X),father(Z,Y),X<>Y.
sister(X,Y):-female(X),father(Z,X),father(Z,Y),X<>Y.
sonInLaw(X,Y):-male(X),father(Y,Z),wife(Z,X) ; male(X),mother(Y,Z),wife(Z,X),X<>Y.
brotherInLaw(X,Y):-male(X),sister(Z,X),wife(Z,Y).
sibling(X,Y):-brother(X,Y);sister(X,Y),X<>Y.
uncle(X,Y):- sibling(X,Z),father(Z,Y),X<>Y.
grandfather(X,Y):- father(X,Z), father(Z,Y);father(X,Z), mother(Z,Y),X<>Y.
grandson(X,Y):- father(Z,X), father(Y,Z);father(Z,X), mother(Y,Z),X<>Y.
Goal
uncle(mark,sana).
Мой Пролог дает мне ошибку 1010.
1 ответ
Это должно работать В WIP7 это работает
class predicates
male:(symbol) procedure (x).
female:(symbol) procedure (x).
wife:(symbol,symbol) procedure (x,y).
mother:(symbol,symbol) procedure (x,y).
father:(symbol,symbol) procedure (x,y).
brother:(symbol,symbol) procedure (x,y).
sister:(symbol,symbol) procedure (x,y).
sonInLaw:(symbol,symbol) procedure (x,y).
brotherInLaw:(symbol,symbol) procedure (x,y).
uncle:(symbol,symbol) procedure (x,y).
sibling:(symbol,symbol) procedure (x,y).
grandson:(symbol,symbol) procedure (x,y).
grandfather:(symbol,symbol) procedure (x,y).
clauses
male(mark).
male(ahmed).
male(zeeshan).
male(summer).
female(sara).
female(sana).
wife(sara,mark).
wife(sana,ahmed).
mother(X,Y):-female(X),father(Z,Y),wife(X,Z),X<>Y.
mother(sara,sana).
father(X,Y):-male(X),mother(Z,Y),wife(Z,X),X<>Y.
brother(X,Y):-male(X),father(Z,X),father(Z,Y),X<>Y.
sister(X,Y):-female(X),father(Z,X),father(Z,Y),X<>Y.
sonInLaw(X,Y):-male(X),father(Y,Z),wife(Z,X);male(X),mother(Y,Z), wife(Z,X),X<>Y.
brotherInLaw(X,Y):-male(X),sister(Z,X),wife(Z,Y).
sibling(X,Y):-brother(X,Y);sister(X,Y),X<>Y.
uncle(X,Y):- sibling(X,Z),father(Z,Y),X<>Y.
grandfather(X,Y):-father(X,Z),father(Z,Y);father(X,Z),mother(Z,Y), X<>Y.
grandson(X,Y):- father(Z,X), father(Y,Z);father(Z,X), mother(Y,Z),X<>Y.
clauses
run():-
console::init(),
uncle(mark,sana),
programControl::sleep(1000).
Я думаю, что с VIP 5.1 вы можете поставить
check_determ