On Mon, 7 Jun 1999, S.D.Mechveliani wrote:
> One more question on the program simplification and `bottom'.
>
> People say, that the transformations like x - x -> 0 :: Integer
>
> are hardly ever applicable, because x may occur `undefined'.
There is another problem lurking here as well. Namely space issues.
Consider the following program. It runs in constant space.
let xs = 1..n
x = head xs
in x - x + last xs + x
Now transforming it using
M - M -> 0 and
0 + M -> M
yields
let xs = 1..n
x = head xs
in last xs + x
which needs space proportional to n.
Regards,
Jörgen Gustavsson.