Extend the InvertRelation[] function such that it can deal with
matrix products (in the SARAH notation).