Equation generatation for sorted equations