Closed ionathanch closed 3 years ago
Ideally we want the following program transformation
field left: Int
field right: Int
method addTuple(this: Ref)
returns (sum: Int)
requires acc(tuple(this), 1/2)
{
unfold acc(tuple(this), 1/2)
sum := this.left + this.right
}
should expand into
method addTuple(this: Ref)
returns (sum: Int)
requires acc(this.left, 1/2) && acc(this.right, 1/2)
{
sum := this.left + this.right
}
Resolved by #19
Consider this modified example from the tutorial:
We currently expand this (I think) into the following:
This is incorrect because if we call
addTuple
like this:After inlining,
callAddTupleTwice
will fail to verify. During expansion, we need to propagate permission values (or yeet the problem into Future Work).I'm also wary about removing things like
[un]fold acc(tuple(this), 1/2)
, there might be some intricacies with partial (un)folding we might not be aware of, but I haven't come up with any counterexamples yet.