2.1.2 Representing Simple Formulae

How to represent simple first-order formulae in Prolog.

Let us now decide how to represent first-order formulae in Prolog. But before that, there's one thing we still have to say: How do we represent first-order variables? We make the following choice:

Variables.

First-order variables will be represented by distinct Prolog atoms. To distinguish them from constant and predicate symbols, we will assert a term of the form

fovar(x).

to the database for each variable x, along with the vocabulary (maybe var/1 would have been a more obvious choice of name, but that would be in conflict with Prolog's built-in predicate named var/1). The variables x,y,z,u,v,w are defined in signature.pl and can be used right away.

Atomic Formulae.

Next, we must decide how to represent constant and predicate symbols. We do so in the obvious way: a first-order constant will be represented by the Prolog atom c, and a first-order predicate symbol will be represented by the Prolog atom p.

Given this convention, it is obvious how atomic formulae should be represented. For example, would be represented by the Prolog term love(john,mary), and would be represented by hate(peter,x).


Aljoscha Burchardt, Stephan Walter, Alexander Koller, Michael Kohlhase, Patrick Blackburn and Johan Bos
Version 1.2.5 (20030212)