It's a very basic question, where does the relation $\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$$$\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$$ for any square integrable $\psi(x)$ come into existence.? Some texts I found states that the above relation comes as a consequence of momentum being defined as generator of translation. But what is the basis of this definition? If momentum were defined to be generator of other form of symmetry, then it wouldn't have had the form as it does now.
In some other text, it's the other way around. Namely the action of momentum on a wavefunction is defined to be $\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$$$\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$$ and thence it leads to momentum being the generator of translation.
Which one is the correct one? How was such action of momentum on wavefunction historically developed?