Your g is not reversible though, its input space must be the same dimension than its output space. On the other hand, you're correct in that any irreversible function can be extended to a reversible one, although the process isn't always straightforward. The general way is to do somthing like:
f: V -> V
g: V x A -> V x A
with g(x, a) = g(f(x), b) for some value(s) of a. And b cannot be set to x, because then you can't find a back with g', and your function is not invertible.
Let f: V -> V
g: V -> V x V is reversable form of f, where g(v) = (v, f(v))
g'((v, w)) = v
g' can be "fooled" with a fake w, but that is of no concern here. We trust our own chip!