| ▲ | ndriscoll 5 hours ago | ||||||||||||||||
But f's codomain is B, and g isn't a function on B, so you can't compose them in the first place. And saying "well yeah but you could compose f's restriction" is exactly making f surjective. The basic result here is every function factors as a surjection (collapsing to the quotient) followed by an isomorphism (with the image) followed by an injection (enlarging the codomain). The surjection and injection are "trivial" and the isomorphism is the part that "does something" (permuting your thing somehow). | |||||||||||||||||
| ▲ | troethe 5 hours ago | parent [-] | ||||||||||||||||
Of course I can compose `f: A -> B` and `g: f(A) -> A`. The composition maps a `x` from `A` to `g(f(x))` which is well defined. Therefore the composition is a function. `g` and `f` aren't functions in a programming language and `A` and `B` are not types. There is nothing like a type checker forbidding you from composing `f: A -> B` and `g: f(A) -> A`. | |||||||||||||||||
| |||||||||||||||||