The government’s much-criticised Intercity Express Programme (IEP) of new long-distance trains is emerging as the key to electrifying lines.