Optimal Control in Infinite Horizon Problems: A Sobolev Space Approach