I'm trying to understand the necessary condition of
f is injective iff f∘g1=f∘g2 implies g1=g2
in terms of concrete examples and was wondering if you could point out the error in this counter counter argument.
let $\ f : [0,1] \rightarrow [0,1] $ be the identify function and $\ g_1,g_2 : [0,1] \rightarrow [0,1] $ where $\ g_1 $ is also the identify function and $\ g_2 $ is a constant 1.
Then isn't it true $\ f(g_1(1)) = f(g_2(0))$ yet $\ g_1 \neq g_2 $ ?
In other words, $\ f $ seems to be an injective function yet it can't seem to be generalized to the monomorphic defintion.
Careful! Proving that $f(g_1(1)) = f(g_2(1))$ doesn't imply that $f \circ g_1 = f \circ g_2$. As an even more obvious example, letting $f(x)=x$ and $h(x)=x^2$, we have $f(0)=h(0)$ (and even $f(1)=h(1)$) but $f \ne h$.
For two functions to be equal, their values must be equal on all elements of their domain, and that is not the case for these functions since, $f(g_1(x)) \ne f(g_2(x))$ for any $0 \le x < 1$.
To see that $f$ injective $\Rightarrow$ $f$ monic, assume that $f \circ g_1 = f \circ g_2$. Then note that $f(g_1(x)) = f(g_2(x))$ for each $x$ in the domain of $g_1,g_2$, and apply injectivity of $f$ to deduce that $g_1 = g_2$.
To see that $f$ monic $\Rightarrow$ $f$ injective, take $x,y \in \mathrm{dom}(f)$ and let $g_1,g_2$ be constant functions whose values are $x$ and $y$, respectively.