how to use elim-quantifiers using .net API in Z3?

北城以北 提交于 2019-12-23 04:02:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!