summaryrefslogtreecommitdiff
path: root/Binaries
diff options
context:
space:
mode:
authorGravatar rustanleino <unknown>2010-02-04 22:14:26 +0000
committerGravatar rustanleino <unknown>2010-02-04 22:14:26 +0000
commita4765e1bd6f66b4571760f60883270df02025882 (patch)
tree3ab0f5d5425473d299bb4728ed8d7c09e5d88908 /Binaries
parent08e368784c1ae629d870db6b09edadbef306e1d6 (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.bpl8
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 ----------------------------------------
// ---------------------------------------------------------------