Infer types based on lb and ub.