Do not create redundant subtractions in toScalExp.
Do not apply more than one simplification rule at a time.

The reason is that the simplification engine itself cannot update the
symbol table, so it ends up having incomplete information.  This can
cause strange effects.
Clean up getIds.