I have a program, where I should find a loop invariant and then provide a proof.
{x>=0 && y>=0} // precondition
res:=0;
i:=0;
while (i<y) do
res:=res+x;
i:=i+1;
od
{res:=x*y} //postcondition
The only logical loop invariant for me is res<=x*y
, which is straightforward from postcondition, but I dont think that it the best one to go on with. Maybe any other suggestions?