Given a definite program, how can I obtain its Herbrand base?
For instance, given the program $P$ below, what is its Herbrand base $B_P$?
$p(f(x)) \leftarrow p(x)$
$q(a) \leftarrow p(x)$
I know the definition of Herbrand base for a first-order language $L$, which relies on the concept of a Herbrand universe for $L$ (I am putting them below), but I don't know the connection with a Herbrand base of a program.
Herbrand base. Let $L$ be a first-order language. The Herbrand base $B_L$ is the set of all ground atoms which can be formed by using predicate symbols from $L$ with ground terms from the Herbrand universe as arguments.
Herbrand universe. The Herbrand universe $U_L$ for $L$ is the set of all ground terms, which can be formed out of constants and function symbols appearing in $L$. (In the case that $L$ has no constants, we add some constant, say $a$ to form ground terms.)