Extend functionality for exporting rules to correctly handle cross-references.
Extend functionality for exporting rules to correctly handle
cross-references.

Note that in order for this algorithm to terminate, there must be no
circular dependencies between rules. I.e., the binary relation R over
the set of rules that contains all pairs of rules that (transitively)
reference each other must be asymmetric (anti-symmetric *and*
irreflexive/strict).

itsjeyd/ODE,itsjeyd/ODE,itsjeyd/ODE,itsjeyd/ODE