Java z3解算器:使用;parseSMTLIB2String";vs.rise4fun在线工具

Java z3解算器:使用;parseSMTLIB2String";vs.rise4fun在线工具,java,z3,Java,Z3,我正在使用z3开发一个Java程序,但是当我使用“parseSMTLIB2String”方法和rise4fun在线工具测试一个非常简单的编码时,我得到了不同的结果 下面是我的测试编码: (declare-const s Bool) (assert (exists ((p Bool))(or (not s) p))) (check-sat) (get-model) 当我使用rise4fun在线工具进行测试时,它会给出以下结果: sat (model (define-fun s () Bool f

我正在使用z3开发一个Java程序,但是当我使用“parseSMTLIB2String”方法和rise4fun在线工具测试一个非常简单的编码时,我得到了不同的结果

下面是我的测试编码:

(declare-const s Bool)
(assert (exists ((p Bool))(or (not s) p)))
(check-sat)
(get-model)
当我使用rise4fun在线工具进行测试时,它会给出以下结果:

sat
(model
(define-fun s () Bool
false)
)
但当我尝试在Java中使用“parseSMTLIB2String”方法时,它给出了以下结果:

sat
(define-fun s () Bool
true)
所以我想知道为什么他们给了我不同的结果。
我是否以错误的方式使用了“parseSMTLIB2String”方法

下面是我的Java小测试类:

HashMap<String, String> cfg = new HashMap<String, String>();
cfg.put("model", "true");
@SuppressWarnings("resource")
Context ctx = new Context(cfg);

BoolExpr[] formula = ctx.parseSMTLIB2String("(declare-fun s () Bool)\n" + 
  "(assert (exists ((p Bool))(or (not s) p)))", null, null, null, null);

Solver s = ctx.mkSolver();
s.add(formula);

Status result = s.check();

if (result == Status.SATISFIABLE){  
  System.out.println("sat");
  Model m = s.getModel();
  System.out.println(m.toString());
}  
HashMap cfg=newhashmap();
cfg.put(“模型”、“真实”);
@抑制警告(“资源”)
上下文ctx=新上下文(cfg);
BoolExpr[]formula=ctx.parseSMTLIB2String(“(声明乐趣s()Bool)\n”+
“(assert(exists((p Bool))(或(nots)p))”,null,null,null,null);
解算器s=ctx.mkSolver();
s、 添加(公式);
状态结果=s.检查();
如果(result==Status.satisfable){
系统输出打印号(“sat”);
模型m=s.getModel();
System.out.println(m.toString());
}  

rise4fun不运行最新版本的Z3;很有可能这辆车现在已经很旧了。对于约束
(存在((p Bool))(或(非s)p))
true
false
都是
s
的正确解决方案

(仅供参考:
parseSMTLIB2String
只解析输入文件中的断言,这与在SMT2文件上运行命令行Z3完全不同。)