The mean increment is , so is a martingale. Applying the bounded optional stopping theorem at gives
The terminal sums are bounded by the exit-state bounds from (b), while increases to the integrable stopping time . The dominated convergence theorem on the left and the monotone convergence theorem on the right therefore prove
This is also Wald's equation here. In fact, the stopped identity already implies from , giving another direct finite-expectation justification.
Let be the natural filtration. An integer-valued random variable is a stopping time with respect to when
Thus whether one has stopped by time can be decided from the first observations, without seeing future variables. Equivalently, .
Write the stopped sum as
The event depends only on , so its indicator and are independent random variables. Since and , Tonelli theorem gives
We may consequently exchange expectation and summation. Using the tail-sum formula for proves Wald's equation:
For the renewal process, put and . The random variable is a stopping time. Since , Wald's equation gives
and hence
For , set and . Wald's equation still applies to the stopping time and the independent variables . Because ,
Therefore
By the monotone convergence theorem, as . Combining the bounds proves the elementary renewal theorem
For a fixed word over equally likely symbols, the waiting time for a word in independent uniform symbols has mean , where runs through the lengths of the borders of a word, including the full word. The word lava' has no proper nonempty border, so $$ \boxed{\mathbb E\tau_{\mathtt{lava}}=100^4=100\,000\,000}. $$ The word aa' has borders of lengths and , so
For a direct check, let be the expected remaining time with no trailing a' and $E_1$ with one trailing a'. Then
which gives .