Solution (source code)

= Solution

Fix $b\in B$. Since $g\circ f$ is <surjective>, there is $a\in A$ with $g(f(a))=g(b)$. <Injectivity> of $g$ gives $f(a)=b$, proving that $f$ is <surjective>. All five conclusions are instances of <injectivity and surjectivity under composition>.