Quantum mechanics from an equivalence principle