diff options
author | Rustan Leino <leino@microsoft.com> | 2012-01-10 13:23:20 -0800 |
---|---|---|
committer | Rustan Leino <leino@microsoft.com> | 2012-01-10 13:23:20 -0800 |
commit | a95e7d5e1172d19df14623014ead072924e1af4c (patch) | |
tree | 626706eca3463a60a89a3afeaaadfde08a450e4f /Test/dafny0/Predicates.dfy | |
parent | c7b6946ca6368f6ec307802b82b4e44a6cab83cd (diff) |
Dafny: added predicates
Diffstat (limited to 'Test/dafny0/Predicates.dfy')
-rw-r--r-- | Test/dafny0/Predicates.dfy | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Test/dafny0/Predicates.dfy b/Test/dafny0/Predicates.dfy new file mode 100644 index 00000000..76666ef0 --- /dev/null +++ b/Test/dafny0/Predicates.dfy @@ -0,0 +1,31 @@ +module A {
+ class C {
+ var x: int;
+ predicate P()
+ reads this;
+ {
+ x < 100
+ }
+ method M()
+ modifies this;
+ ensures P();
+ {
+ x := 28;
+ }
+ method N()
+ modifies this;
+ ensures P();
+ {
+ x := -28;
+ }
+ }
+}
+
+module B refines A {
+ class C {
+ predicate P()
+ {
+ 0 <= x
+ }
+ }
+}
|