A Criterion for the Convergence of Learning with Spike Timing Dependent Plasticity