A morphism in a category needs to bem well defined? We know from basic math that we have a function $f:X \rightarrow Y$ if $x \in X$ maps to exactly one element in the codomain Y.
My question is that if we consider the morphism in categories as a generalization of function, a morphism had to be the condiction of well defined?
I don't know if this is a stupid question, but it raises when i'm reading about posets categories. If we see the partial order $\leq$ as a morphism in a partial ordered set, then a element in this set maps not necessary maps to just one element. In other words, if we have the set X={1,2,3,4) and the partial order $\leq$, we have that $1 \leq 2$ and $1 \leq 3$, etc.
The partial order above is a morphism? This morphism needs to be well defined?
 A: While your question has been addressed pretty well in the comments, I wanted to address the question with examples, but also provide a possible way of seeing morphisms as functions as well.
First, as the comments have mentioned, the morphisms of a category certainly do not have to be "functions" like they are in the category $\mathbf{Set}$ of sets; all that's necessary is that the morphisms satisfy the appropriate axioms (i.e., they have an associative composition, and there exist identity morphisms).

*

*first, like the family of examples you mentioned, a poset $P$ can be viewed as a category whose objects are the elements of $P$, where there is a (unique) morphism $x\to y$ iff $x\preceq y$ in the partial order on $P$. If we wanted $x\to y$ to be a "function", then it would have to send "elements" of $x$ to "elements" of $y$... but what are "elements" of $x$?

*however, even if we have a readily-available notion of "element" (inherited from set theory), the morphisms still need not be functions. For example, consider the category $\mathbf{Rel}$ whose objects are sets, and whose morphisms $X\to Y$ are relations (i.e., the morphisms $X\to Y$ are the subsets of $X\times Y$). Despite the fact that $X$ and $Y$ actually do have elements, the morphisms are not functions of these elements.

*

*for example, we always have the empty relation on $X\times Y$, which says that no $x\in X$ is related to any $y\in Y$. This is a morphism $X\to Y$ in $\mathbf{Rel}$, but how could this be seen as a function?



So, in summary, morphisms of a category are not functions in the naïve interpretation. However, there is a way to make them look like functions, and the way to do this is to rephrase what you mean by "elements."
To illustrate what I mean, consider $\mathbf{Set}$ (where the morphisms are precisely the functions of sets). Let $X$ be a set, then there is a natural correspondence between elements $x\in X$ and functions $\bar x:*\to X$ (where $*$ is a fixed choice of one-element set). If we think of elements as maps $*\to X$, then given a function $f:X\to Y$, "evaluation at $x$" translates to "composition with $\bar x$": the element $*\to Y$ corresponding to $f(x)$ is precisely $f\circ\bar x:*\to X\to Y$.
We can play a similar game with the category $\mathbf{Ab}$ of abelian groups and group homomorphisms. Fix an abelian group $A$. Since there is only one morphism $\{0\}\to A$, we have to use a different domain than the trivial group, but it can still be done: elements $g\in A$ correspond to group homomorphisms $\bar g:\Bbb Z\to A$ (here, the correspondence has $\bar g(1):=g$). Therefore, we can think of morphisms $\varphi:A\to B$ as functions mapping "elements" $\Bbb Z\to A$ to "elements" $\Bbb Z\to B$.
In a general category $\mathcal C$, we can't expect that exactly this story works: there won't always exist some object $S\in\mathcal C$ so that elements of any $X\in\mathcal C$ correspond to morphisms $S\to\mathcal C$ (like I mentioned before, there isn't even a good reason to expect that objects of $\mathcal C$ has elements), but why restrict ourselves to just one object $S$? This is where the perspective of generalised elements comes to play: we can think of morphisms $S\to X$ as "$S$-shaped elements" of $X$.
Now, given an object $X$ and a morphism $f:X\to Y$, we can think of $f$ as a function of "$S$-shaped elements $x:S\to X$" into "$S$-shaped elements $f\circ x:S\to Y$", allowing ourselves to vary $S$ freely. This perspective can sometimes come in handy when looking at certain constructions and definitions in category theory: for example, a morphism $f:X\to Y$ is monic (the categorical analogue of "injective") if it is injective as a function of $S$-shaped elements in $X$ for all $S$: given $x,y:S\to X$, if $f\circ x=f\circ y$, then $x=y$.
This is also a helpful perspective for limits. For example, given two objects $X$ and $Y$, their product is the object $X\times Y$ such that for any pair of $S$-shaped elements $x:S\to X$ and $y:S\to Y$, there is a unique $S$-shaped element $(x,y):S\to X\times Y$ whose components are $x$ and $y$. This reveals how the categorical product corresponds to the Cartesian product in $\mathbf{Set}$!
Finally, I want to mention that this perspective is not magical, but is really a way of interpreting the Yoneda embedding: you can think of an object $X\in\mathcal C$ as an $\operatorname{Ob}(\mathcal C)$-indexed collection of "sets" $\operatorname{Hom}_{\mathcal C}(S,X)$ (the set of $S$-shaped elements in $X$), and in this way, a morphism $X\to Y$ is an $\operatorname{Ob}(\mathcal C)$-indexed collection of "functions" $\operatorname{Hom}_{\mathcal C}(S,f):\operatorname{Hom}_{\mathcal C}(S,X)\to\operatorname{Hom}_{\mathcal C}(S,Y)$.
