I'm trying to use pattern matching in z3 to work with algebraic datatypes. I'm exactly following the syntax given in the SMTLib standard on page 27, but z3 is giving me a syntax error. For example in the following program:
(declare-datatype Dyn ((a) (b)))
(define-fun foo ((x Dyn)) Int (
match x (
(a 1)
(b 2)
)
))
(assert (= (foo a) (1)))
(check-sat)
it gives me the error "line 4 column 7: variable symbol expected". As far as I can tell I'm following the specified syntax exactly. How do I fix this?