Can anyone help me with this program? I am new to Dafny. I just need to know what will be invariant and decreases values. Thanks in advance
method MultiplyTwoNumber(N: int, M: nat) returns (Result: int)
ensures Result == M*N;
requires N>=0 && M>=0;
{
var a := N;
var b := M;
var x := 0;
var i :=0;
while (b > 0)
invariant ?? // what will be the invariant value
decreases ?? // what will be the decreases value
{
while (b % 15 != 0)
invariant ?? // what will be the invariant value
decreases ?? what will be the decreases value
{
x := x + a;
b := b - 1;
}
a := 15 * a;
b := b / 15;
}
Result := x;
}