7
votes

I find an issue as shown in the following simple SMT-LIB program.

The SMT-LIB code:

(declare-fun isDigit (Int) Bool)
(assert (forall ((x Int))
    (=>     (isDigit x)
        (and (>= x 0) (< x 10))
    )
  )
) 

(assert (forall ((x Int))   
    (=>     (and (>= x 12) (< x 15))
        (exists ((y Int))
            (and    (>= y 1) (< y 6)
                (isHost (- x y))
            )
        )
    )
  )
)

(check-sat)
(get-model)

This gives the following warning:

WARNING: failed to find a pattern for quantifier (quantifier id: k!18)
sat
........
........

I am wondering about the warning message. I know I am missing something, but I cannot understand. Can anyone help me in this issue?

1

1 Answers

3
votes

Z3 uses different engines for handling quantifiers (see Z3 guide). One of these engines is based on pattern matching (E-Matching). Z3 tries to infer patterns for each quantified formula. If it can't find one, it issues the warning message. The user may also provide patterns for each quantifier. The guide shows how to do it. The id k!18 is the default id created by Z3. It is based on the line number (line 18 in your case). You can also provide your own ids for quantifiers. The warning is just telling users that the E-matching engine will not be able to handle the specified quantifier.