something is a person if it is either Adam or Eve, or if it has a mother. We can express this in a single rule as follows:
person(X) :- (X=adam; X=eve; mother(X, Y)).
something is a person if it is either Adam or Eve, or if it has a mother. We can express this in a single rule as follows:
person(X) :- (X=adam; X=eve; mother(X, Y)).
I’ll admit I don’t speak prolog but doesn’t this definition lack a recursive case to ensure that the mother is either Eve or a descendent of Eve? And there should probably be a father case in there as well?
Depends on how you want to define your domain knowledge.
The thing you need to define for sure is the predicate
mother/2
(Which has arity 2, or in other words, two arguments). From then on, multiple options are available:mother(X, Y)
as an “axiom”, and define mother terms for all elements:mother(abel, eve). mother(isaac, sarah).
mother(X, Y)
fromfemale(X)
andparent(X, Y)
terms.mother(X, Y) :- parent(X, Y), female(Y).
parent/2
terms instead ofmother/2
andfather/2
.I never saw such a potent combination of gender politics and prolog
We don’t see the definition of
mother
. It might already encode that Y is a person.While every person does also have a father, it’s completely redundant, since being a person can fully be described by [Edit:
beinghaving] a mother (or being Adam or Eve).Can you explain how this is?
Thanks for catching that. I fixed my comment.