I am trying to describe that given information about the result of $f(x),$ a $y$ exists such that for all $x$ with that result for $f(x),$ we have $g(x) = g(y)$. Only specific information about $x$ (namely the value of $f(x)$) may be used when constructing the $y$. Symbolically: $$ \forall z: \exists y: \forall x: (z = f(x) \implies g(x) = g(y)). $$
However, from this formula, it is not immediately clear that that is what is meant, so I was wondering if there is a way to state this formula more clearly?
Edit 2: Removed the previous example in favour of a more conceptual example:
We explain three examples, and the third is an example of our problem:
For every jar there is a lid that fits: $ \forall j \in \text{Jar}: \exists l \in \text{Lid}: \text{fits}(j, l)$.
There is a lid that fits on every jar: $\exists l \in \text{Lid}: \forall j \in \text{Jar}: \text{fits}(j, l)$.
For every diameter there exists a lid that fits on every jar of such diameter: $\forall d: \exists l \in \text{Lid}: \forall j \in \text{Jar}: (\text{diam}(j) = d \implies \text{fits}(j, l))$.
The question is: is there a clearer way to describe the last sentence in a logical statement?