Expressions that are variables don't have names directly associated with them.
The way we access the names is by maintaining a stack of the names from the
quantifiers that were traversed on the way down.
So maintain a vector (stack/list) of symbols, and whenever you
traverse a quantifier push the bound names from the quantifier onto the vector.
You will have to pop the names after you are done traversing the quantifier.
You use the following APIs to access the names of bound variables:
unsigned Z3_API Z3_get_quantifier_num_bound(__in Z3_context c, __in Z3_ast a);
Z3_symbol Z3_API Z3_get_quantifier_bound_name(__in Z3_context c, __in Z3_ast a, unsigned i);
Note that indices of quantified variables are ordered right-to-left.
So if Z3_get_quantifier_num_bound(context, expr) returns 2, and
x = Z3_get_quantifier_bound_name(context, expr, 0)
y = Z3_get_quantifier_bound_name(context, expr, 1)
then y has index 0 and x has index 1.