1 . , , :
childless(X) :- \+ hasChild(X, _).
"true" , . "" , , , , , . , , Prolog - .:)
2 once:
parent(A) :- once(hasChild(A, _)).
cut, :
parent(A) :- hasChild(A, _), !.
: parent/1 , . :
?- parent(X).
X = person1.
, person4.
?- childless(person4).
true.
, , " " Prolog, . - . !
, ( /) - . , , ( ?), "" . , , setof/3, :
parent(Person) :-
setof(X, C^hasChild(X, C), People),
member(Person, People).
C^hasChild(X, C) Prolog, C - ; , hasChild/2, People. , ! , member/2 , :
?- parent(person4).
true.
?- parent(X).
X = person1 ;
X = person4.
? . ? . , ? , . , .:)
Prolog not/1 \+/1; , -ISO- : not(X) \+ X.:)