RaideR
RaideR

Reputation: 937

Prolog: Coming up with Herbrand Universe and Herbrand Base

I have serious problems to understand the concept of Prolog and the corresponding Herbrand Universe, Herbrand Base and so on. For example if I have a Prolog program:

p(X,Y) :- q(X,Y), q(Y,X).
s(a).
s(b).
s(c).
q(a,b).
q(b,a).
q(a,c).

I mean - I know what the Prolog program is supposed to do, but I cannot come up with the corresponding Herbrand Universe or Herbrand Base.

For the Herbrand Universe I have to search all variable-free constructor terms.

  1. What are constructors in this context?

  2. I would simply guess that HU = {a,b,c, s(a), s(b), s(c), q(a,a), q(a,b), q(b,a)... p(a,a), p(a,b), ... s(s(a))....}

  3. How to come up with the Herbrand Base?

I'm sorry for all the questions, but I think I'm mixing so many different "Herbrand" things up :-(.

Can anyone help me and explain things to me?

Thank you.

Upvotes: 2

Views: 886

Answers (1)

Will Ness
Will Ness

Reputation: 71119

Wikipedia says, "a Herbrand universe ... is defined starting from the set of constants and function symbols in a set of clauses."

So if we follow this definition, here it would consist of atoms a, b, c and compound terms with functors s/1, q/2, p/2 and arguments which are in the Herbrand universe themselves:

hu(a).
hu(b).
hu(c).
hu(s(Y)):- hu(Y).
hu(q(Y,Z)):- hu(Y), hu(Z).
hu(p(Y,Z)):- hu(Y), hu(Z).

"The set of all ground atoms that can be formed from predicate symbols from S and terms from H is called the Herbrand base":

hb(s(Y)):- hu(Y).
hb(q(Y,Z)):- hu(Y), hu(Z).
hb(p(Y,Z)):- hu(Y), hu(Z).

Upvotes: 1

Related Questions