在 z3py 中使用余数运算时出错

Error when using remainder operation in z3py

做余数运算在 z3py 代码中出现错误

以下是我的代码

    x = Real("x")
    solve( x%2 == 3 )

代码给出以下错误:

    z3.z3types.Z3Exception: Z3 integer expression expected

而当我进行除法运算时它工作得很好

    solve( x/2 == 3 )

(答案为6)

z3不支持求余运算吗? 如果是怎么实现呢?

实数的模数没有意义;因为实值除法是精确的。

它对整数有意义。那是你想要的吗? (请注意您对 x 的定义是 Real。)