Mathematical foundations of Quantum Machine Learning