Let $T$ be a ergodic automorphism of a non-atomic Lebesgue probability space $(X, \mathcal{A}, \mu)$.

The celebrated Rokhlin tower lemma says that given an integer $n>0$ and $0 < \epsilon < 1$, there exists $B \in \mathcal{A}$ such that the sets $B$, $TB$, ..., $T^{n-1} B$ are disjoint and their union (called a *tower* of height $n$) has measure $>1-\epsilon$.

Here's an equivalent formulation of the conclusion of Rokhlin's lemma: the return time function $R_B \colon B \to \{1,2,\dots, \infty\}$ satisfies:

- $R_B \ge n$;
- $\int_B (R_B - n) d\mu < \epsilon$.

(To see that the integral is the measure of the complement of the Rokhlin tower, thing about the Kakutani skyscraper with base $B$.)

My question is: Can we replace the constant $n$ above by a function $N$?

More precisely: Given an arbitrary measurable function $N : X \to \{1,2,\dots\}$, and $0 < \epsilon < 1$, is there a set $B \in\mathcal{A}$ such that:

- $R_B(x) \ge N(x)$ for all $x\in B$;
- $\int_B (R_B - N) d\mu < \epsilon$ ?

Note that the integral is the measure of the *error set* $\{T^i(x) \mid x\in B, N(x) \le i < R_B(x) \}$.

If $N$ is assumed to be *bounded* then the answer is *yes*. Here's the proof, an easy adaptation of the usual proof of the Rokhlin lemma. Suppose $N$ is bounded by a constant $n$. Take $m > n/\epsilon$. Since the set of periodic points has zero measure, we can take a positive measure set $E$ such that the return time $R_E$ is $\ge m$. Consider the Kakutani skyscraper with base $E$, which by ergodicity covers a full measure set. For each point $x_0$ in the base $E$, color blue each of the points $x_0$, $x_1:=T^{N(x_0)}(x_0)$ (which is at height $N(x_0)$), $x_2:=T^{N(x_1)}(x_1)$ (which is at height $N(x_0)+N(x_1)$), etc., stopping when the height becomes $\ge r_E(x_0) - n$ (i.e., when we first reach the floors of the skyscraper $n$-away from the top). Let $B$ be the set of blue points, which is measurable and satisfies $R_B \ge N$. The error set is contained in the region within height $n$ from the top of the skyscraper, and therefore has measure $<n/m<\epsilon$, as we wanted to show.

I haven't checked, but a similar construction seems to work if the function $N$ is integrable over $X$.

So the main question is: Is this generalized Rokhlin lemma true for

non-integrable$N$, or is there a counter-example?

Rem.: Since $R_B$ is always integrable (Kac's lemma), the restriction of $N$ to $B$ should be integrable.