In Terry Tao's textbook on measure theory and integration, he notes that, given an elementary set $A$, the length of $A$, denoted $|A|$, may be written discretely as
$$|A| = \lim_{n \to \infty}\frac{1}{n} \#\left(A \cap \frac{\mathbb{Z}}{n}\right).$$ Intuitively, this makes sense for intervals of whole numbers... Obviously an interval of length 1 contains 1 integer, etc. But, I don't quite see how to prove this explicitly, or how it works for an interval, say $[e,\pi]$.
How can one go about explicitly proving this discrete notion of length?
Here, $\#$ denotes cardinality. Moreover, $$\frac{\mathbb{Z}}{n} : = \{ \frac{a}{n} \, : \, a \in \mathbb{Z} \}.$$
Suppose that $\#\left(A\cap\frac{\Bbb Z}n\right)=k$, where $(a,b)\subseteq A\subseteq[a,b]$; then
$$\frac{k-1}n\le b-a\le\frac{k+1}n\;.$$
(The extremes are when $A=\left[\frac{m}n,\frac{m+k-1}n\right]$ for some $m\in\Bbb Z$, and when $A=\left(\frac{m}n,\frac{m+k+1}n\right)$ for some $m\in\Bbb Z$.) Equivalently,
$$n(b-a)-1\le\#\left(A\cap\frac{\Bbb Z}n\right)\le n(b-a)+1\;,$$
or
$$b-a-\frac1n\le\frac1n\#\left(A\cap\frac{\Bbb Z}n\right)\le b-a+\frac1n\;.$$
Now just take the limit as $n\to\infty$.