A theoretical case study of the generalization of machine-learned potentials