See https://math.stackexchange.com/questions/447524/why-does-zero-derivative-imply-a-function-is-locally-constant