Flattening (command: flatten) replaces embedded subexpressions in the premises (both body and foot) by newly generated variables and associates these with each other through preceding is-calls.
For example, one can employ child as a binary operator defined by
child(john,lucy) :- & ann. child(john,mary) :- & bob.in calls like child(P,Q), evaluating to P and Q's children. An embedding of such an evaluative formula into another evaluative formula makes the main formula nested. Thus, the cares body of the footened form (cf. subsection 3.2.7)
parental(P) :- cares(P,child(P,Q)) & true.will be flattened to
parental(P) :- _1 is child(P,Q), cares(P,_1) & true.
Sample dialog (nested foots would also work):
rfi-p> az f(k[]) :- g(h()) & j(k[]). rfi-p> flatten rfi-p> listing f(k[]) :- _1 is h(), g(_1) & j(k[]).