summaryrefslogtreecommitdiff
path: root/Source/Model
diff options
context:
space:
mode:
authorGravatar Unknown <qadeer@GHALIB.redmond.corp.microsoft.com>2011-06-27 16:42:37 -0700
committerGravatar Unknown <qadeer@GHALIB.redmond.corp.microsoft.com>2011-06-27 16:42:37 -0700
commitcb3f17c366b126c8f5e859e07dcd38367d238a31 (patch)
tree743fc0a3f865a97d8bfa9a3e6696441c82db3f55 /Source/Model
parent90fbb72f2451e37c4c4c3ebb69a563b869bbaadc (diff)
ported all the counterexample code to Michal's new Model class; the goal is to eliminate the class ErrorModel from the codebase.
Diffstat (limited to 'Source/Model')
-rw-r--r--Source/Model/Model.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/Model/Model.cs b/Source/Model/Model.cs
index 98a67409..50a8f45c 100644
--- a/Source/Model/Model.cs
+++ b/Source/Model/Model.cs
@@ -254,6 +254,24 @@ namespace Microsoft.Boogie
}
/// <summary>
+ /// Look for function application with a subsequence of given arguments and return its value or null if no such application exists.
+ /// </summary>
+ public Element TryPartialEval(params Element[] args)
+ {
+ foreach (var tpl in apps) {
+ int j = 0;
+ for (int i = 0; i < args.Length; ++i) {
+ if (tpl.Args[j] == args[i]) {
+ j++;
+ if (j == tpl.Args.Length)
+ return tpl.Result;
+ }
+ }
+ }
+ return null;
+ }
+
+ /// <summary>
/// Short for TryEval(args) == (Element)true
/// </summary>
public bool IsTrue(params Element[] args)
@@ -515,6 +533,11 @@ namespace Microsoft.Boogie
return res;
}
+ public Func TryGetSkolemFunc(string name)
+ {
+ return Functions.Where(f => f.Name.StartsWith(name + "!")).FirstOrDefault();
+ }
+
public Element GetElement(string name)
{
Element res;
@@ -524,6 +547,11 @@ namespace Microsoft.Boogie
throw new KeyNotFoundException("element '" + name + "' undefined in the model");
}
+ public Element MkIntElement(int v)
+ {
+ return MkElement(v.ToString());
+ }
+
public void Write(System.IO.TextWriter wr)
{
wr.WriteLine("*** MODEL");