Analytic study of mode locking with a nonlinear mirror