diff options
author | rustanleino <unknown> | 2010-02-04 22:14:26 +0000 |
---|---|---|
committer | rustanleino <unknown> | 2010-02-04 22:14:26 +0000 |
commit | f7250b98f91a9e81069b0dc2c7b9c16b36633dfc (patch) | |
tree | debfee9c44a08b59528d861f550b28a9036a2b1b /Binaries | |
parent | 1f481fb44bfce9fd0684e9d59e324db248b798ff (diff) |
Dafny: Added if-then-else expressions (replacing and extending the previous boolean-only if-then-else expressions)
Dafny: Added 'class' functions and methods (i.e., functions and methods with a receiver parameter)
Dafny grammar changes: Tthe 'use' keyword now goes before 'function' (akin to 'ghost' and 'class'), and quantifier triggers now go before the '::'
Dafny: Check for division-by-zero for both '/' and '%'
Diffstat (limited to 'Binaries')
-rw-r--r-- | Binaries/DafnyPrelude.bpl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Binaries/DafnyPrelude.bpl b/Binaries/DafnyPrelude.bpl index 60de3d84..50433b54 100644 --- a/Binaries/DafnyPrelude.bpl +++ b/Binaries/DafnyPrelude.bpl @@ -153,6 +153,14 @@ axiom (forall<T> s: Seq T, n: int, j: int :: { Seq#Index(Seq#Drop(s,n), j) } Seq#Index(Seq#Drop(s,n), j) == Seq#Index(s, j+n));
// ---------------------------------------------------------------
+// -- If then else -----------------------------------------------
+// ---------------------------------------------------------------
+
+function $ite<T>(bool, T, T): T;
+axiom (forall<T> g: bool, a,b: T :: { $ite(g,a,b) }
+ (g ==> $ite(g,a,b) == a) && (!g ==> $ite(g,a,b) == b));
+
+// ---------------------------------------------------------------
// -- Boxing and unboxing ----------------------------------------
// ---------------------------------------------------------------
|