Reputation: 1
I am very new to Dafny. It is complaining here that there is an assertion error:
method Fred () returns (result : int) {
var number : int;
result := number * number;
assert result > 0;
}
I am trying to write an assertion that expresses the following statement: the square of any integer is non-negative
Upvotes: 0
Views: 72
Reputation: 5663
The assertion passes if you change it to result >= 0
. Is that what you meant? If number
is 0, then result
will be 0 too.
Upvotes: 1