In discrete time, the bounded-time optional stopping theorem says that an integrable supermartingale and bounded stopping times satisfy . For a martingale there is equality. The assertion at a possibly unbounded, almost-surely finite stopping time also holds with if is uniformly integrable: then is integrable and , with equality for a martingale. Boundedness of or the stated integrability condition cannot in general be omitted.
For the increment hypothesis here, implies almost surely, and telescoping gives
The right-hand side is an integrable random variable. Applying bounded-time optional stopping to and then the dominated convergence theorem proves
This is bounded-increment optional stopping with integrable time; the same reasoning gives equality for a martingale.
Put and first assume . Let be the first occurrence time of the specified seven-letter word. Its probability in a prescribed block is . Disjoint seven-flip blocks are independent, and a match in one forces to have occurred by its end. Consequently and ; this establishes the integrability needed for stopping before computing its value.
Start a new gambler with unit capital immediately before each flip. A gambler bets all current capital on the next required letter of the word, receives capital divided by for a correct head or by for a correct tail, and receives zero on failure. After completing all seven bets, the gambler retains the winnings without further betting. Each individual bet preserves its conditional expected capital. If is the total capital of all gamblers who have entered through flip , then is a martingale.
At any time at most seven gamblers are still betting, and each one's capital is at most , since probabilities of shorter prefixes are at least the full-word probability. Completed winnings do not change. Thus the increments of have a deterministic bound, for example . The preceding optional-stopping argument therefore gives .
At the first full match, no earlier gambler has completed the word. A surviving gambler who has placed successful bets corresponds to a suffix of the completed word which is also its length- prefix, namely a border of a word. The only such lengths are and : the shorter common string is HHT. Their capitals are and , respectively. Hence is this deterministic sum and
For a fair coin this is 136 flips. This is a waiting time for a word in independent nonuniform symbols; the overlap contribution is essential. If or , the word cannot occur because it contains both types of flip, so the expected waiting time is infinite.