jyoo980 / silver

Definition of the Viper intermediate verification language.
Mozilla Public License 2.0
0 stars 0 forks source link

adding initial implementation of permission passthrough #19

Closed jyoo980 closed 3 years ago

jyoo980 commented 3 years ago

Initial work for #9

Unit tested + tested via CLI with

field left: Int
field right: Int

predicate tuple(this: Ref)
{
    acc(this.left) && acc(this.right)
}

method addTuple(this: Ref)
  returns (sum: Int)
  requires acc(tuple(this), 1/2)
{
  unfold acc(tuple(this), 1/2)
  sum := this.left + this.right
}

expanding into

field left: Int

field right: Int

predicate tuple(this: Ref) {
  acc(this.left, write) && acc(this.right, write)
}

method addTuple(this: Ref) returns (sum: Int)
  requires acc(this.left, 1 / 2) && acc(this.right, 1 / 2)
{
  sum := this.left + this.right
}
ionathanch commented 3 years ago

Looks good to me!