I understand the definition of characteristic function and order-preserving, but I don't know how to prove the exercise.
Definition. We write $\mathbf{2}$ to denote the chain obtened by giving $P$ the order in which $0 < 1 < 2$.
Prove that a subset $U$ of an ordered set $P$ is an up-set if and only if its characteristic function $\mathscr{X}_U : P \rightarrow \mathbf{2}$ is order-preserving. (Here $\mathscr{X}_U (x) = 1$ if $x \in U$ and $\mathscr{X}_U (x) = 0$ if $x \notin U$.)
Thanks in advance.
For a function $f:P\to \{0<1\}$ to be order-preserving is equivalent to the statement
if $f(x)=1$ and $x<y$ then $f(y)=1$
which is the same as
if $x\in f^{-1}(1)$ and $x<y$ then $y\in f^{-1}(1)$
which is the same as that $f^{-1}(1)$ is an up-set.
(Your definition of 2 is confusing, normally 2 denotes the order $\{0<1\}$.)