How do we formally regard a function that takes a lookup set as a parameter?
Your $\phi$ is stateful; the value of $\phi(x,A)$ depends on what parameters you have previously evaluated it with.  As such, it is not a mathematical function.  Mathematical functions are stateless.

Formalization serves a purpose: to describe clearly and precisely.  It's not to blindly follow rules, but to serve as an aid to communication.  As long as you have described what you want clearly and precisely,  in a way that a reader is likely to understand, you are good.  So, don't call $\phi$ a function, as that will confuse readers; but you can describe the intended semantics of what you want the procedure $\phi$ to return, in terms of its parameters and its state.