Towards a mathematical theory of trajectory inference