I have a statement to prove:

If f: A-->B is onto ... then prove that there exists a function g: B-->A such that g is one-to-one.

.

.

What i've come up with as a proof is the following:

Let xeA, and yeB, and f(x)=y, and g(y)=x (e is "element of")

Then suppose f is onto.

Thus: For all y there exists some x s.t. f(x)=y

Thus: There exists a y s.t. f(x*)=y or there exists a y s.t. f(x**)=y

Thus: If there exists a y s.t. f(x*)=y=f(x**); then by definition of a function, we know that x*=x**

Thus: for all x s.t. f(x)=y, then f(x*)=f(x**) means that x*=x**

...Aplying the equivalences given at the beggining:

if y*=y** then we can deduce that g(y*)=g(y**)

Thus: (with insecurity =( ...) There exists a function g: B-->A such that g is one-to-one.

I know i am commiting logical errors, but i cant seem to find another way to do this proof. Any suggestions will be greatly appreciated!