Electrochemical polymerization of dicarboxylic acids—VI. Mechanism of polymerization