How to prove $f(n)=\lceil\frac{n}{2}\rceil$ is one-to-one and onto? Edit:  Both domain and codomain are the set of all integers ($\mathbb{Z}$)
I proved $f(n) = \lceil\frac{n}{2}\rceil$ was one-to-one this way:
$\forall{x_1}\forall{x_2}[(f(x_1) = f(x_2)) \to(x_1 = x_2)]$
Let $f(n) = f(x) = y$
Let $x_1 = 2$ and Let $x_2 = 1$
Then $f(x_1) = \lceil\frac{x_1}{2}\rceil$ and $f(x_2) = \lceil\frac{x_2}{2}\rceil$
$f(x_1) = f(x_2)$ becomes $\lceil\frac{2}{2}\rceil = \lceil\frac{1}{2}\rceil$, which in turn becomes $1 = 1$, but $x_1\neq x_2$.
$\therefore$ this function is not one-to-one.
1 -- Is this proof coherent and correct?
2 -- Next, I'm trying to prove onto by letting $f(x) = y = f(n)$ and $x=n$, then solving for $x$ in $y=\lceil\frac{x}{2}\rceil$.  But I don't know how to do this, because I'm not sure if the ceiling function allows associativity, nor how that would work if it does.
I've been trying to prove this based on the (book's) logical definition of onto as $\forall{y}\in{Y}\exists{x}\in{X}|[f(x)=y]$ but have been coming up short.
Any help would be greatly appreciated.

In general when you prove functions are 1-1 and onto, you need to start by specifying the domain and codomain for your function. In this case both your domain and codomain are $\mathbb{Z}$, so you can write your ceiling function as $f:\mathbb{Z} \to \mathbb{Z}$.
To prove $f$ is onto, you want to show for any number $y$ in the codomain, there exists a preimage $x$ in the domain mapping to it. To show this, start by taking an arbitrary $y \in \mathbb{Z}$. Does $y$ have something in the domain mapping to it? Sure, take $x=2y$ (which we know is in the domain, because if $y$ is an integer, then so is $2y$), and observe that
\begin{equation*}f(x)=\lceil \frac{x}{2} \rceil = \lceil \frac{(2y)}{2} \rceil = \lceil y \rceil =y
\end{equation*}
as desired.
