The new SMT-LIB standard allows for a function defintion command of the form:
(define-fun f ((x1 σ1) · · · (xn σn)) σ t)
The spec clarifies that this is semantically equivalent to
(declare-fun f (σ1 · · · σn) σ)
(assert (forall ((x1 σ1) · · · (xn σn)) (= ( f x1 · · · xn) t))
At the moment I would define a function using the Python z3 API as follows:
s = z3.Solver()
f = z3.Function("f", [σ1 ... σn, σ])
s.add(z3.ForAll([x1, ...,xn], t == f(x1, ..., xn)))
Is that the cannonical way of doing it or is there a more straightforward or efficient way of handling this?