listing
The built-in meta-predicate listing can be used to check what is actually in the Prolog database during a Prolog session. It comes in two flavours: with no argument (listing/0) and with one argument (listing/1). With no arguments, it causes the contents of the Prolog database to be printed out. With one argument - the name of a procedure - it prints out just the rules and/or facts relating to that procedure. Examples, assuming you have started Prolog with a program file that contains the facts and rules
happy(ann). happy(tom). happy(X) :- rich(X). rich(fred).

?- listing.
happy(ann).
happy(tom).
happy(A) :-
        rich(A).

rich(fred).
true.
?- listing(happy).
happy(ann).
happy(tom).
happy(A) :-
        rich(A).
true.

In the case of listing/0, Prolog may also print out some internal house-keeping information.