z3 produces unknown for assertions without quantifiers

前端 未结 2 1854
面向向阳花
面向向阳花 2021-01-15 01:56

I have some simple constraints involving multiplication of reals in z3 that are producing unknown. The problem seems to be that they are wrapped in a datatype,

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 02:47

    Yes, Z3 can return unknown in quantifier-free problems. Here are the main reasons:

    • Run out of time or memory

    • The quantifier-free fragment is undecidable (e.g., nonlinear integer arithmetic)

    • The quantifier-free fragment is too expensive, and/or the procedure implemented in Z3 is incomplete.

    Your problems are in a decidable fragment, and the unknown is due to the incomplete procedure for nonlinear arithmetic used in Z3. Z3 4.0 has a complete procedure for nonlinear real arithmetic, but it is still not integrated with the other theories. So, it will not help in the first problem.

    The different in behavior in the first and second queries is due to different strategies used for each query. Z3 has a new framework for defining custom strategies. You can get sat for the first query by using the command

    (check-sat-using (then simplify solve-eqs smt))
    

    instead of

    (check-sat)
    

    The first command forces Z3 to eliminate variables by solving equalities (i.e., tactic solve-eqs). It will eliminate the equality (= c (NUM (* (n a) (n b)))). This tactic is automatically used in the second problem in Z3 3.x. Note that this tactic will not help if we replace the equality with (>= c (NUM (* (n a) (n b)))).

    Moreover, the second problem contains only nonlinear arithmetic. So, in Z3 4.0, the new (and complete) solver for nonlinear real arithmetic will be automatically used.

    You can learn about the new strategy framework at http://rise4fun.com/Z3/tutorial/strategies, http://rise4fun.com/Z3Py/tutorial/strategies

提交回复
热议问题