summaryrefslogtreecommitdiff
path: root/Source/Provers
diff options
context:
space:
mode:
authorGravatar tabarbe <unknown>2010-07-21 15:33:48 +0000
committerGravatar tabarbe <unknown>2010-07-21 15:33:48 +0000
commitbb83c917b6d5ebc0f2daa14d7c03ffff9ffec838 (patch)
treeef92254d30863f62b368b0f4ed8523358291fd96 /Source/Provers
parentd08525270f09c4a43b0122aa23e5c8ace1ac9161 (diff)
Boogie: Forgot this file when I checked in the port of Z3. (cce = Code Contracts Extensions - utility methods for the port that are not present in Code Contracts.)
Diffstat (limited to 'Source/Provers')
-rw-r--r--Source/Provers/Z3/cce.cs81
1 files changed, 81 insertions, 0 deletions
diff --git a/Source/Provers/Z3/cce.cs b/Source/Provers/Z3/cce.cs
new file mode 100644
index 00000000..ad0b7152
--- /dev/null
+++ b/Source/Provers/Z3/cce.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;
+using System.Text;
+using Microsoft.Boogie;
+
+ /// <summary>
+ /// A class containing static methods to extend the functionality of Code Contracts
+ /// </summary>
+
+public static class cce {
+ [Pure]
+ public static T NonNull<T>(T t) {
+ Contract.Assert(t != null);
+ return t;
+ }
+ [Pure]
+ public static bool NonNullElements<T>(IEnumerable<T> collection) {
+ return collection != null && Contract.ForAll(collection, c => c != null);
+ }
+
+ [Pure]
+ public static bool NonNullElements<TKey, TValue>(IDictionary<TKey, TValue> collection) {
+ return collection != null && NonNullElements(collection.Keys) && NonNullElements(collection.Values);
+ }
+ [Pure]
+ public static bool NonNullElements(VariableSeq collection) {
+ return collection != null && Contract.ForAll(0, collection.Length, i => collection[i] != null);
+ }
+
+ public class UnreachableException : Exception {
+ public UnreachableException() {
+ }
+ }
+
+ [Pure]
+ public static void BeginExpose(object o) {
+ }
+ [Pure]
+ public static void EndExpose() {
+ }
+
+ public static bool IsPeerConsistent(this object o) {
+ return true;
+ }
+
+ public static bool IsConsistent(this object o) {
+ return true;
+ }
+
+ public static bool IsExposable(this object o) {
+ return true;
+ }
+ public static class Owner {
+ [Pure]
+ public static bool Same(object o, object p) {
+ return true;
+ }
+ public static void AssignSame(object o, object p) {
+ }
+ public static object ElementProxy(object o) {
+ return o;
+ }
+ public static bool None(object o) {
+ return true;
+ }
+ }
+
+ internal static void LoopInvariant(bool p) {
+ Contract.Assert(p);
+ }
+}
+
+public class PeerAttribute : System.Attribute {
+}
+public class RepAttribute : System.Attribute {
+}
+public class CapturedAttribute : System.Attribute {
+}
+public class NotDelayedAttribute : System.Attribute {
+} \ No newline at end of file