If a function $f$ is defined as
$$f:X\to Y$$
We say the domain is $X$, and the codomain is $Y$.
However, it seems the image is distinct from codomain, and only coincides with $Y$ if $f$ is surjective.
Question 1: Why is there this distinction? Why is it convenient to define a function's "target" as a super-set of its strict image? For example, why would we say $f(x)=x^2$ is $f:\mathbb{R} \to \mathbb{R}$ and not $f: \mathbb{R} \to \mathbb{R}^{+}$ ?
Question 2: Similarly, if we are content to make a distinction between image and codomain, why do we insist the domain is actually the pre-image and not a superset? That is, why do we say $f(x)=\log(x)$ is $f:\mathbb{R}^{+} \to \mathbb{R}$ and not $f:\mathbb{R} \to \mathbb{R}$ ?
This question asks the same but there is no marked answer, and reading through it, none seemed convincing. The same for this one too.