Consider the two program segments below:
for i:=1 to f(x) by 1 do S end
i:=1; While i<=f(x) do S i:=i+1 end
Under what conditions are these two programs equivalent? Treat $S$ as any sequence of statement and f as a function.