summaryrefslogtreecommitdiff
path: root/Test/dafny0/Refinement.dfy
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2013-07-29 14:35:27 -0700
committerGravatar Rustan Leino <unknown>2013-07-29 14:35:27 -0700
commit059ee1934382d1f2332b478d79b8a364ce8a002e (patch)
tree961592fb7b7c5f7e352e132034d1fb4dded021a3 /Test/dafny0/Refinement.dfy
parentfb6c171957142ce6119a7363d3cec66799b9966a (diff)
Make functions and predicates be opaque outside the defining module -- only their specifications (e.g., ensures clauses) are exported.
Diffstat (limited to 'Test/dafny0/Refinement.dfy')
-rw-r--r--Test/dafny0/Refinement.dfy17
1 files changed, 10 insertions, 7 deletions
diff --git a/Test/dafny0/Refinement.dfy b/Test/dafny0/Refinement.dfy
index e5c06a5e..3c7563a0 100644
--- a/Test/dafny0/Refinement.dfy
+++ b/Test/dafny0/Refinement.dfy
@@ -101,7 +101,7 @@ module Abstract {
class MyNumber {
ghost var N: int;
ghost var Repr: set<object>;
- predicate Valid
+ predicate Valid()
reads this, Repr;
{
this in Repr && null !in Repr
@@ -109,20 +109,20 @@ module Abstract {
constructor Init()
modifies this;
ensures N == 0;
- ensures Valid && fresh(Repr - {this});
+ ensures Valid() && fresh(Repr - {this});
{
N, Repr := 0, {this};
}
method Inc()
- requires Valid;
+ requires Valid();
modifies Repr;
ensures N == old(N) + 1;
- ensures Valid && fresh(Repr - old(Repr));
+ ensures Valid() && fresh(Repr - old(Repr));
{
N := N + 1;
}
method Get() returns (n: int)
- requires Valid;
+ requires Valid();
ensures n == N;
{
var k; assume k == N;
@@ -135,7 +135,7 @@ module Concrete refines Abstract {
class MyNumber {
var a: int;
var b: int;
- predicate Valid
+ predicate Valid()
{
N == a - b
}
@@ -172,7 +172,7 @@ module IncorrectConcrete refines Abstract {
class MyNumber {
var a: int;
var b: int;
- predicate Valid
+ predicate Valid()
{
N == 2*a - b
}
@@ -191,3 +191,6 @@ module IncorrectConcrete refines Abstract {
}
}
}
+
+// ------------- visibility checks -------------------------------
+