The representation for array models is indeed a bit confusing. The meaning of
(define-fun some_array_1 () (Array Int Int)
(_ as-array k!0))
is that the model for array some_array_1
is the function k!0
which is to be interpreted as an array (signified by the call to as-array
. The latter is a parametric function, which has no arguments, therefore, to get at the actual definition of the model function for some_array_1, we have to look up which function as-array
calls. In the given example, we can do that as follows, first making sure that we actually have an array model in the expected format by checking a few of assertions:
assert(Z3_get_decl_kind(c, some_array_1_eval_func_decl) == Z3_OP_AS_ARRAY);
assert(Z3_is_app(c, some_array_1_eval));
assert(Z3_get_decl_num_parameters(c, some_array_1_eval_func_decl) == 1);
assert(Z3_get_decl_parameter_kind(c, some_array_1_eval_func_decl, 0) ==
Z3_PARAMETER_FUNC_DECL);
func_decl model_fd = func_decl(c,
Z3_get_decl_func_decl_parameter(c, some_array_1_eval_func_decl, 0));
The function declaration model_fd
then holds the actual function assigned by the model (k!0
) and we can get the function interpretation via
func_interp fun_interp = m.get_func_interp(model_fd);