substitution in Z3Py

独自空忆成欢 提交于 2019-12-11 04:18:55

问题


It seems that the substitute(f,t) function in Z3Py performs simplification on f first before doing the substitution. Is there a way to disallow this?

I would like the following behavior to occur:

f = And(x,Not(x))
result = substitute(f,*[(Not(x),BoolVal(True))])  #sub Not(x) => True
#if we simplify f first then the result = False,  but if we do the substitution first then result = x

回答1:


Unfortunately, the substitute procedure is implemented using the simplifier which can apply substitutions during the simplification. The substitute Python procedure invokes the Z3 C API Z3_substitute in the file api_ast.cpp. Internally, the simplifier is called th_rewriter (theory rewriter).

That being said, I agree this is not nice and may be very inconvenient in some cases. I will change that for the next release.



来源:https://stackoverflow.com/questions/14163518/substitution-in-z3py

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