A mathematical approach to the effective Hamiltonian in perturbed periodic problems