这是一个非常小的例子,它显示了我遇到的一个问题:
class Z3Tester
{
private Context cICtx;
private Solver cISolver;
static void Main(string[] args)
{
Z3Tester lZ3Tester = new Z3Tester();
lZ3Tester.Test_Z3();
}
public void Test_Z3()
{
BoolExpr lA = cICtx.MkBoolConst("A");
BoolExpr lB = cICtx.MkBoolConst("B");
cISolver.Push();
BoolExpr lConstraint1 = cICtx.MkBoolConst("Constraint1");
cISolver.AssertAndTrack(lA, lConstraint1);
cISolver.ToString();
cISolver.Check(lConstraint1);
}
public Z3Tester()
{
cICtx = new Context(new Dictionary<string, string>() { { "proof", "true" } });
using (cICtx)
this.cISolver = cICtx.MkSolver("QF_FD");
在这段代码中,当我来到cISolver.Check(lConstraint1);
行时,我得到了AccessViolationException ......。
答案 0 :(得分:0)
Context对象中有一个方法(在Context.cs中):
public Solver MkSolver(string logic)
它创建一个使用指定逻辑配置的求解器对象。