Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect model when quantifying over polymorphic type #7102

Closed
dewert99 opened this issue Jan 26, 2024 · 0 comments
Closed

Incorrect model when quantifying over polymorphic type #7102

dewert99 opened this issue Jan 26, 2024 · 0 comments

Comments

@dewert99
Copy link

Running the following smt2 file

(declare-type-var T)
(declare-fun f (T) Bool)
(declare-var b Bool)
(assert (forall ((x T)) (f x)))
(assert (= b (f 0)))
(check-sat)
(get-model)
(assert (not b))
(check-sat)

produces the output:

sat
(
  ;; universe for T:
  ;;   T!val!0 
  ;; -----------
  ;; definitions for universe elements:
  (declare-fun T!val!0 () T)
  ;; cardinality constraint:
  (forall ((x T)) (= x T!val!0))
  ;; -----------
  (define-fun b () Bool
    false)
  (define-fun f ((x!0 T)) Bool
    true)
  (define-fun f ((x!0 Int)) Bool
    false)
)
unsat

In particular the model produced for b is false even though after the first check-sat, b must be true. Interestingly after asserting (not b) (which agrees with the previous model) z3 correctly reports unsat.

z3 also gives the expected model when the quatifier is (forall ((x Int)) (f x)) instead of (forall ((x T)) (f x))

This is with Z3 version 4.12.5 - 64 bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant