我一直在使用 ConstInterp 来获取 expr 中常量文字的值。
model.ConstInterp(lit)
但是我遇到了一个奇怪的错误
... <body of some loop>
let x = model.ConstInterp(lit)
if solver.Check() == Status.SATISFIABLE
then model.ConstInterp(lit)
第二次调用 ConstInterp 产生错误
Unhandled Exception: Microsoft.Z3.Z3Exception: invalid argument
at Microsoft.Z3.Native.Z3_model_get_const_interp(IntPtr a0,IntPtr a1,IntPtr a2)
at Microsoft.Z3.Model.ConstInterp(FuncDecl f)
at Microsoft.Z3.Model.ConstInterp(Expr a)
但是,使用 Eval 而不是 ConstInterp 的相同代码很好。我是否错误地使用了 ConstInterp?