Skip to content

get-value sometimes returns a quantified expression #7743

@tautschnig

Description

@tautschnig

Caveat: I don't know whether the following is intended behaviour or not.

With some satisfiable formulae containing quantifiers Z3 returns models where get-value for a Bool variable produces a quantified expression. The following is a reduced example:

(set-option :produce-models true)

(declare-fun |main::1::i!0@1#1| () (_ BitVec 32))
(declare-fun |main::1::2::1::j!0@1#1| () (_ BitVec 32))
(define-fun B4 () Bool (= (bvsrem |main::1::i!0@1#1| (_ bv2 32)) (_ bv0 32)))
(define-fun B5 () Bool (=> (and true B4) (not (let ((?sum (bvadd ((_ sign_extend 1) |main::1::2::1::j!0@1#1|) ((_ sign_extend 1) |main::1::2::1::j!0@1#1|)))) (not (= ((_ extract 32 32) ?sum) ((_ extract 31 31) ?sum)))))))
(declare-fun B6 () Bool)

(assert (= B6 (=> (and true B4) (exists ((|main::1::2::1::j!0@1#0| (_ BitVec 32))) (= |main::1::i!0@1#1| (bvadd |main::1::2::1::j!0@1#0| |main::1::2::1::j!0@1#0|))))))
(assert (or (not B5) (not B6)))

(check-sat)

(get-value (B4))
(get-value (B5))
(get-value (B6))
(get-value (|main::1::2::1::j!0@1#1|))
(get-value (|main::1::i!0@1#1|))

(exit)

Both Z3 4.8.12 and 4.13.4 produce exactly the same result as follows:

sat
((B4 true))
((B5 false))
((B6 (exists ((|main::1::2::1::j!0@1#0| (_ BitVec 32)))
  (= (bvmul #x00000002 |main::1::2::1::j!0@1#0|) #x00000000))))
((|main::1::2::1::j!0@1#1| #x40000000))
((|main::1::i!0@1#1| #x00000000))
  1. Is this behaviour expected?
  2. Is there a way to make Z3 evaluate the quantified expression before returning the model?
  3. Some related information:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions