问题
I can not find .net api for (elim-quantifiers (exists ((x Int)) (and (< t1 x) (< x t2))))
is it a Tactic? Could someone help me using .net API of Z3 to implement the following scripts?
(declare-const t1 Int)
(declare-const t2 Int)
(elim-quantifiers (exists ((x Int)) (and (< t1 x) (< x t2))))
回答1:
Yes, you can use a tactic. Here is an example using the .NET API (I didn't run this particular example so it may need some minor modification, but I use roughly the same in a program of mine).
// (exists ((x Int)) (and (< t1 x) (< x t2))))
Context z3 = new Context();
Expr t1 = z3.MkIntConst("t1");
Expr t2 = z3.MkIntConst("t2");
Expr x = z3.MkIntConst("x");
Expr p = z3.MkAnd(z3.MkLt((ArithExpr)t1, (ArithExpr)x), z3.MkLt((ArithExpr)x, (ArithExpr)t2));
Expr ex = z3.MkExists(new Expr[] { x }, p);
Goal g = z3.MkGoal(true, true, false);
g.Assert((BoolExpr)ex);
Tactic tac = Instance.Z3.MkTactic("qe"); // quantifier elimination
ApplyResult a = tac.Apply(g); // look at a.Subgoals
来源:https://stackoverflow.com/questions/12301908/how-to-use-elim-quantifiers-using-net-api-in-z3