rewritten in C++: rel_reduction_transitive()