Normally, clause expansion is performed implicitly by the compiler. For certain meta-programming applications (e.g. for writing other compilers) it can be performed explicitly using expand_clause/2. Clause expansion is the second transformation which is applied during the compilation process: macro expansion, then clause expansion, then goal inlining expansion.
Note that the result of clause transformation can be either a single clause or a list of clauses. Transformed clauses should all be standard clauses, i.e. either facts or rules with toplevel functor :-/2.
% A grammar rule is an example of a predefined clause transformation: ?- expand_clause((p --> q, [tok]), C). C = p(_263, _258) :- q(_263, _278), 'C'(_278, tok, _258) yes.