Let $X$ be a scheme, and $k$ be a field.
What does it mean by $X(k)$?
The reason I am asking this is that there seems to be several definition(or convention) on it, and I can't see why they lead to the same set.
First definition is: $$X(k)=\{p\in X | \kappa(p)\simeq k\}.$$ Here, of course $\kappa(p)$ denotes the residue field $\mathcal{O}_{p}/\mathfrak{m}_p$.
The other definition concerns general rings $R$, or if $X$ is defined over a field $k$, algebras $R$ over $k$. $$X(R)=\mathrm{Hom}(\mathrm{Spec} R,X).$$
Are they equivalent? If $G$ is a group scheme, it easily follows from the second definition that $G(k)$ has a group structure. Multiple elements in $\mathrm{Hom}(\mathrm{Spec}K,X)$ can correspond to a single element in $X$, because of the existence of automorphisms of $K$, so I am hesitant to use an element of this set like an actual point of $X$.
Let $k$ be a commutative ring. If $X$ is a $k$-scheme and $R$ is a commutative $k$-algebra, then one defines $X(R)$ to be the set of $k$-morphisms $\mathrm{Spec}(R) \to X$. If $k$ is a field, and $R=k$, the set of $k$-morphisms $\mathrm{Spec}(k) \to X$ identifies with the set of points $x \in X$ whose residue field extension $k \to k(x)$ is trivial. Notice that we have a canonical homomorphism $k \to k(x)$ and that one is supposed to be an isomorphism! If $R$ is a field extension of $k$, then the set of $k$-morphisms $\mathrm{Spec}(R) \to X$ identifies with the set of points $x \in X$ equipped with (!) a $k$-algebra homomorphism $k(x) \to R$. The proof is straight forward; it even works if $X$ is any locally ringed space over $k$.