本文整理汇总了C#中Microsoft.Z3.Expr.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Expr.ToString方法的具体用法?C# Expr.ToString怎么用?C# Expr.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Z3.Expr
的用法示例。
在下文中一共展示了Expr.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LookupVarName
string LookupVarName(Expr var)
{
if (__lookupVarName == null)
return var.ToString();
else
return __lookupVarName(var);
}
示例2: DescribeExpr1
//.........这里部分代码省略.........
{
#region if-then-else term
string cond = DescribeExpr(subterms[0]);
string trueCase = DescribeExpr(subterms[1]);
string falseCase = DescribeExpr(subterms[2]);
if (cond == trueName)
return trueCase;
else if (cond == falseCase)
return falseCase;
else
{
if (!CSmode)
return string.Format("ite({0},{1},{2})", EliminateOuterParanthesis(cond), EliminateOuterParanthesis(trueCase), EliminateOuterParanthesis(falseCase));
else
return string.Format("({0} ? {1} : {2})", EliminateOuterParanthesis(cond), EliminateOuterParanthesis(trueCase), EliminateOuterParanthesis(falseCase));
}
#endregion
}
else if (dkind == Z3_decl_kind.Z3_OP_UNINTERPRETED)
{
#region function symbols, such as declared constants, Skolem functions, tuples, Lists, etc.
string f = z3p.GetDeclShortName(decl);
string f_fullname = z3p.GetDeclName(decl);
uint[] ps = z3p.GetDeclParameters(decl);
int arity = subterms.Length;
if (f.Equals("T0")) //the default empty tuple
return "T()";
if (f.Equals("hex")) //compute the hexadacimal digit encoder
{
if (ps.Length > 1)
throw new AutomataException(AutomataExceptionKind.InternalError);
uint k = (ps.Length == 0 ? 0 : ps[0]);
string c = (k == 0 ? DescribeExpr(subterms[0]) : string.Format("({0}>>{1})", DescribeExpr(subterms[0]), k * 4));
string res = (CSmode ? string.Format("(({0}&0xF)+(({0}&0xF)<=9 ? 48 : 55))", c) :
string.Format("(({0}&0xF)+ite(({0}&0xF)<=9, 48, 55))", c));
return res;
}
string tupleConstructorName = Z3Provider.tupleSortNamePrefix + arity.ToString();
bool isTupleConstr = false;
if (f.Equals(tupleConstructorName))
{
isTupleConstr = true;
f = ""; //ignore the tuple constructor
}
if (f.StartsWith("."))
//tuple projection: use postfix notation
return string.Format("{0}{1}", DescribeExpr(subterms[0]), f);
string str = null;
if (IsCocreteCharacterList(term, out str))
return str;
if (f == "bvurem_i")
{
return string.Format("({0}%{1})", DescribeExpr(subterms[0]), DescribeExpr(subterms[1]));
}
if (f == "bvudiv_i")
{
return string.Format("({0}/{1})", DescribeExpr(subterms[0]), DescribeExpr(subterms[1]));
}
if (subterms.Length == 0)
return f;
else
{
string s0 = (isTupleConstr ? "T(" : f + "(");
string s1 = (isTupleConstr ? ")" : ")");
for (int j = 0; j < ps.Length; j++)
{
s0 += (j > 0 ? "," : "");
s0 += ps[j];
}
if (ps.Length > 0 && subterms.Length > 0)
s0 += ",";
string s = s0 + EliminateOuterParanthesis(DescribeExpr(subterms[0]));
for (int i = 1; i < subterms.Length; i++)
s += ("," + EliminateOuterParanthesis(DescribeExpr(subterms[i])));
return s + s1;
}
#endregion
}
else if (dkind == Z3_decl_kind.Z3_OP_DT_ACCESSOR)
{
return string.Format("{0}.{1}", DescribeExpr(subterms[0]), z3p.GetDeclShortName(decl));
}
else
return term.ToString();
//throw new ArgumentException(string.Format("unexpected function declaration kind {0}", dkind), "term");
#endregion
}
else
{
throw new AutomataException(AutomataExceptionKind.UnexpectedExprKindInPrettyPrinter);
}
}
示例3: CheckString
public static void CheckString(Expr e, string s)
{
if (e.ToString() != s)
throw new TestFailedException("strings don't match");
}