The main transformation for sorted elementary equations