Value representation theorem for countable set How can we prove the following:  if a relation $R$ is a weak order on a set $X$ and $X_\sim$ is finite, then there exist a function $v:X\to \mathbb{N}$, which is a value representation of preference relation $R$.

Here I know the construction of the function $v$ when the range is the set of real numbers (as $X_\sim$ is countable). But,I am confused  when the range of $v$ is the set of natural numbers.

Could anyone please help me?
I use the usual notation $(\succeq,\succ,\sim)$ instead of $R$. I assume that $X_{\sim}$ in your question is the set of equivalence classes of $\sim$ on $X$.

Suppose that the cardinality of $X_{\sim}$ is equal to $n \geq 1$. There exist $x_1\cdots,x_n$ such that $x_1 \prec \cdots \prec x_n$. Define $v(x_1)=1,v(x_2)=2,\cdots,v (x_n)=n$. 

Since $\sim$ has $n$ equivalence classes, for any $y \notin \{x_1,\cdots,x_n\}$ there exists a unique $x \in \{x_1,\cdots,x_n\}$ such that $y \sim x$. Define $v (y)=v(x)$.

The function $v$ defined on $X$ takes values in $\mathbb{N}$. I leave it to you to check that $v$ is a utility representation of $\succeq $.