|
| 1 | +// Any copyright is dedicated to the Public Domain. |
| 2 | +// http://creativecommons.org/publicdomain/zero/1.0/ |
| 3 | + |
| 4 | +predicate p(a: Ref, b: Ref) |
| 5 | + |
| 6 | +method m(x: Ref, s: Set[Ref], t: Seq[Ref]) { |
| 7 | + //:: ExpectedOutput(exhale.failed:qp.not.injective) |
| 8 | + //:: ExpectedOutput(exhale.failed:insufficient.permission) |
| 9 | + //:: MissingOutput(exhale.failed:insufficient.permission, /silicon/issue/34/) |
| 10 | + exhale forall a: Int, b: Ref :: b in s && 0 <= a && a < |t| ==> p(t[a], b) // might not be injective |
| 11 | +} |
| 12 | + |
| 13 | + |
| 14 | +method m2(x: Ref, s: Set[Ref], t: Seq[Ref]) { |
| 15 | + //:: ExpectedOutput(inhale.failed:qp.not.injective) |
| 16 | + inhale forall a: Int, b: Ref :: b in s && 0 <= a && a < |t| ==> p(t[a], b) // might not be injective |
| 17 | +} |
| 18 | + |
| 19 | +field f: Int |
| 20 | + |
| 21 | +domain Array { |
| 22 | + function loc(a: Array, i: Int): Ref |
| 23 | + |
| 24 | + function loc_inv1(r: Ref): Array |
| 25 | + function loc_inv2(r: Ref): Int |
| 26 | + |
| 27 | + axiom { |
| 28 | + forall a: Array, i: Int :: {loc(a, i)} loc_inv2(loc(a, i)) == i |
| 29 | + } |
| 30 | +} |
| 31 | + |
| 32 | +method m3(x: Ref, s: Set[Ref], t: Seq[Ref]) { |
| 33 | + //:: ExpectedOutput(exhale.failed:qp.not.injective) |
| 34 | + //:: ExpectedOutput(exhale.failed:insufficient.permission) |
| 35 | + //:: MissingOutput(exhale.failed:insufficient.permission, /silicon/issue/34/) |
| 36 | + exhale forall a: Array, i: Int :: i >= 0 && i < 10 ==> acc(loc(a, i).f) |
| 37 | +} |
| 38 | + |
| 39 | +method m4(x: Ref, s: Set[Ref], t: Seq[Ref]) { |
| 40 | + //:: ExpectedOutput(inhale.failed:qp.not.injective) |
| 41 | + inhale forall a: Array, i: Int :: i >= 0 && i < 10 ==> acc(loc(a, i).f) |
| 42 | +} |
| 43 | + |
| 44 | + |
0 commit comments