Type inference for light affine logic via constraints on words.