SWI-Prolog 7.1.16 Reference Manual: Section 4.5

## 4.5 List the program, predicates or clauses

listing(:Pred)
  List predicates specified by Pred. Pred may be a predicate name (atom), which lists all predicates with this name, regardless of their arity. It can also be a predicate indicator (<name>/<arity> or <name>//<arity>), possibly qualified with a module. For example: `?- listing(lists:member/2).`.

  A listing is produced by enumerating the clauses of the predicate using clause/2 and printing each clause using portray_clause/1. This implies that the variable names are generated (A, B, ... ) and the layout is defined by rules in portray_clause/1.

listing
  List all predicates from the calling module using listing/1. For example, `?- listing.` lists clauses in the default `user` module and `?- lists:listing.` lists the clauses in the module `lists`.
portray_clause(+Clause)
  Pretty print a clause. A clause should be specified as a term ``<Head> :- <Body>`'. Facts are represented as ``<Head> :- true`' or simply `<Head>`. Variables in the clause are written as A, B, ... . Singleton variables are written as `_`. See also portray_clause/2.
portray_clause(+Stream, +Clause)
  Pretty print a clause to Stream. See portray_clause/1 for details.