In the following code, I get the error that "Assert might fail. Fraction wildcard might be negative.".
Changing the program (e.g. removing the trigger on the assert, and using the function call right before it, which is currently commented out) causes viper to verify it successfully.
While playing around with triggers can circumvent the problem, I do not see how wildcard permissions could ever be negative. So I think there might be a deeper issue than just triggers...
Since this is an excerpt from a bigger example, where I stumbled upon negative wildcards quite a few times, I would be interested to hear if this is some underlying bug, or if it can actually be possible that wildcards are negative in certain cases.
domain VCTArray[CT] {
function loc(a: VCTArray[CT], i: Int): CT
}
field bool_prop: Bool
field item: Ref
function alwaysTrue(v: Ref): Bool
ensures result == true
method some_method(trees: VCTArray[Ref], g: Int)
requires 0 < g
requires (forall i: Int :: {loc(trees, i).item} 0 <= i && i < g ==> acc(loc(trees, i).item, wildcard))
requires (forall i: Int :: {loc(trees, i).item.bool_prop} 0 <= i && i < g ==> acc(loc(trees, i).item.bool_prop, wildcard))
{
// assert alwaysTrue(loc(trees, 0).item)
assert forall j: Int :: {loc(trees, j).item.bool_prop} 0 <= j && j < g ==> acc(loc(trees, j).item.bool_prop, wildcard)
}
In the following code, I get the error that "Assert might fail. Fraction wildcard might be negative.".
Changing the program (e.g. removing the trigger on the assert, and using the function call right before it, which is currently commented out) causes viper to verify it successfully.
While playing around with triggers can circumvent the problem, I do not see how
wildcardpermissions could ever be negative. So I think there might be a deeper issue than just triggers...Since this is an excerpt from a bigger example, where I stumbled upon negative
wildcards quite a few times, I would be interested to hear if this is some underlying bug, or if it can actually be possible thatwildcards are negative in certain cases.