I was looking for an R-package that would reduce matrices to row-echelon form, but Google was not my friend; any leads? If not, I wonder if the problem could be expressed in terms of constraint satisfaction...