If $r$ is such that $r^2$ is an integer, is this expression true for all real $R$? ($r$ and $R$ are always positive) $$ r < R \iff r^2 < \lceil R^2 \rceil $$

It is for programming a script in which pixels around a central pixel are classified by their squared radius $r^2$ (always whole), and only those where the radius $r$ is less than a given value $R$ (can be fractional) should be selected.

Is there an easy way to prove this equivalence (going from right to left) algebraically?


Lemma: If $i,j \in \mathbb Z$ and $i < j$ then $i\le j-1$.

Pf by contradiction: Assume not. Assume $i> j-1$. But we know $i < j$ so we have $j-1 < i < j$. But $j\in \mathbb Z$. Those there are no integers between $j-1$ and $j$. ($j$ is the successor of $j-1$ and there are no integers between an integer and it's successor.) So $i$ is not an integer thus we have a contradiction.

Thus:

If $r \ge 0$ and $R \ge 0$ and $r^2 \in \mathbb Z$ and $r^2 < \lceil R^2 \rceil$ then $r < R$.

Pf:

By definition $ \lceil R^2 \rceil\in \mathbb Z$ and $ \lceil R^2 \rceil- 1 < R^2 \le \lceil R^2 \rceil$.

Thus if $r^2 \in \mathbb Z$ and $r^2 < \lceil R^2 \rceil$ then by the lemma we have

$r^2 \le \lceil R^2 \rceil-1$. And thus $0 \le r^2 \le \lceil R^2 \rceil-1 < R^2$ or $0 < r^2 < R^2$.

As $0\ge r$ and $R\ge 0$ we have $r \le R \iff r^2 < R^2$ so we have $r < R$.

....

Lemma (if you need it): If $r, R$ are both positive then $r < R \iff r^2 < R^2$.

Pf: If $0 \le r < R$ then $r^2 = r\cdot r < r\cdot R < R\cdot R = R^2$.

Contrapositively, if $R \le r$ (but $r, R$ are positive) then $R^2 = R\cdot R \le r\cdot R \le r\cdot r = r^2$ so $R^2 \le r^2$ and $r^2 < R^2$ is impossible. So $r^2 < R^2 \implies r < R$.