When writing a large program, it is often practical to keep different parts of the code in different files. However, each procedure must be kept in its own file (a PROCEDURE is the complete set of facts and/or rules whose heads define one particular predicate).
If you do define the same predicate in two different files, the Prolog interpreter wants to use the definitions from one of the files only. This is what happens:
| ?- consult(file1).
{consulting file1...}
{file1 consulted, 10 msec 287 bytes}
yes
| ?- consult(file2).
{consulting file2...}
The procedure parent/2 is being redefined.
Old file: file1
New file: file2
Do you really want to redefine it? (y, n, p, or ?) ?
y redefine this procedure
n don't redefine this procedure
p redefine this procedure and don't ask again
? print this information
(y, n, p, or ?)
That is, only the definitions from one of the files can be used.
<a.von.klopp@bangor.ac.uk>