Proof Verification of Schröder–Bernstein theorem So I've spent some time studying the Schröder–Bernstein theorem, but I'm trying to do the exercise in "Naive Set Theory" by Paul Halmos regarding the theorem. The exercise is finding an alternative proof using the images of the functions. Here is my, attempt:

I'll show that if $f: A \to B$ and $g: B \to A$ are both injective, then there exists a bijection between $A$ and $B$. 
Note that $g^{-1}: g(B) \to B$. Let $G = \{x \in A : g^{-1}(x) \in B \backslash f(A) \}$. Thus, consider
$$ h(x) = \begin{cases} 
       g^{-1}(x) & x \in G \\
      f(x) & x \in A\backslash G
   \end{cases} $$
I'll do three verifications. That the domain of $h$ is $A$, and that $h$ is both injective and surjective. 
First, $h$ is defined for $x \in G$ and $x \in A\backslash G$. If $G = \emptyset$, then $f$ is already a bijection. Otherwise, $A \backslash G \cup G = A$ so every $x \in A$ is evaluated by $h$.
Secondly, I'll show $h$ is injective. Suppose there exists $x_1 \neq x_2 \in A$ with $h(x_1) = h(x_2)$. Because $g^{-1}$ and $f$ are injective, with loss of generality, I can let $g^{-1}(x_1) \in B \backslash f(A)$ and $g^{-1}(x_2) \in f(A)$. Since $g^{-1}(x_2) \in f(A)$, $h(x_2) = f(x_2)$. 
Then by our assumption, since $h(x_1) = h(x_2)$, we have $g^{-1}(x_1) = f(x_2)$. But this implies that $g^{-1}(x_2) \in f(A)$ which is a contradiction.
* This contradiction is my first concern. My contradiction does not actually show that $x_1 = x_2$. Seems off.*
For the surjection, let $y \in B$. There are two cases. First, if $y \in B \backslash f(A)$, then $g(y) = x \implies g^{-1}(x) = y$. And $g^{-1}(x) \in B \backslash f(A)$, so $h(x) = y$.
Next, let $y \in f(A)$. Because $g: B \to A$, there exists $x_1,x_2 \in A$ such that $f(x_1) = y$ and $g(y) = x_2 \implies g^{-1}(x_2) = y$. But $g^{-1}(x_2) \in f(A)$ so $y = h(x_1)$. 
* Major red flag for me here. It seems weird that there are two potential candidates for the the $x$ mapped to $y$. *

Despite my concerns, I can't see exactly what the problem is. I've tried searching for solutions and alternative proofs, but most online seem to use some variation of the König proof, as shown here:
http://en.wikipedia.org/wiki/Schr%C3%B6der%E2%80%93Bernstein_theorem

Okay, so I've found this answer to another question: https://math.stackexchange.com/a/225633/135367
I think this resolves my question, but I do not understand it. He says that my function is not bijective. In particular, he says "namely the values of $f(x)$ where $x \in g(B\backslash f(A))$ but $f(x) \notin B \backslash f(A)$."
However,


*

*$f(x) \notin B \backslash f(A)$ is always true.

*And if $x \in g(B\backslash f(A))$, then $g^{-1}(x) \in B\backslash f(A)$ so $g^{-1}(x) = h(x)$. 
So I don't understand how there is anything left.
 A: Your argument is fine up to the point at which you try to prove surjectivity of $h$. Here’s an actual counterexample to that part of the argument.

Let $A=B=\Bbb N$, and let $f,g:\Bbb N\to\Bbb N:n\mapsto 2n$; these are certainly injections. Now carry out your construction.
$$\begin{align*}
G&=\{n\in\Bbb N:g^{-1}(n)\in\Bbb N\setminus f[\Bbb N]\}\\
&=\left\{n\in\Bbb N:\frac{n}2\text{ is odd}\right\}\\
&=\{n\in\Bbb N:n\equiv2\!\!\!\pmod4\}\;
\end{align*}$$
so
$$h:\Bbb N\to\Bbb N:n\mapsto\begin{cases}
g^{-1}(n)=\frac{n}2,&\text{if }n\equiv2\pmod4\\
f(n)=2n,&\text{otherwise}\;.
\end{cases}$$
The first clause of the definition of $h$ ensures that $h[\Bbb N]$ contains every odd natural number. Now suppose that $n\in\Bbb N\setminus G$. Then $n$ is congruent to $0,1$, or $3$ modulo $4$. If $n\equiv0\pmod4$, then $h(n)=2n\equiv0\pmod8$, and in the other two cases $n$ is odd, so $2n\equiv 2\pmod4$. Thus, no natural number congruent to $4$ modulo $8$ is in the range of $h$. In particular, $4\notin h[\Bbb N]$.

Your first concern is not a problem. What you’ve shown is that assuming that $x_1$ and $x_2$ fall into different cases of the definition of $h$ leads to a contradiction. Therefore they must fall into the same case, and then it does indeed follow that $x_1=x_2$.
