A mathematical description of glitches in neutron stars