I’m a wretched Prolog beginner who likes to sometimes tackle the hardest books just to see how difficult, how high up in the clouds it can all get. So I’m looking at Logic, Programming and Prolog (2nd edition) from Nilsson and Maluszynski, and right on page 5 I’m in trouble with the idea of a functor versus a predicate:
…Assume now that there is a ternary functor family
, a binary functor child
and a constant none
. The family consisting of the parents Bill and Mary and children Tom and Alice can now be represented by the construction:
family(bill, mary, child(tom,child(alice,none)))
Such a construction is called a compound term.
Wow. So this child
expression/form reminds me of Lisp and the linked list cons
cell idea, not Prolog. I guess I don’t understand the difference between a functor and a predicate? The way I understand Prolog so far is if Bill and Mary have two immediate offspring Tom and Alice we maybe should have
family(bill, mary, child(tom), child(alice))
as in “Bill, Mary, child(tom), child(alice) is/are a family.” I’m confused about the establishing facts here as well. Do we presume bill
and mary
were established as parents
before, i.e., parents of Tom and Alice?
Trying to firm up my understanding of what a predicate was, I got confused when I read Logical Reasoning: A First Course from Nederpelt and Kamareddine where in Chapter 8 they introduce the concept of predicates saying that with, e.g., 3m + n \gt 3 the truth of such a proposition cannot be determined until we know what m and n are. Good. But then it then says
a predicate like 3m + n \gt 3 only becomes a proposition after the filling of number-values for m and n.
Again, this seems to be a more general concept of a what a predicate is than what I’ve seen in my Prolog first chapter books so far. How can a math formula be a predicate? I researched this to the Wikipedia page on Propositional function, which further confuses with…
…As a mathematical function, A(x) or A(x1, x2, ..., xn), the propositional function is abstracted from predicates or propositional forms. As an example, consider the predicate scheme, “x is hot”…
So what is meant by a “predicate scheme?” It hyperlinks predicate in this sentence to another page that gets into “predicates are interpreted as relations” … and there goes another rabbit hole to fall down.
Any enlightenment on all this would be appreciated.