Creating explicit martingale descriptions for the Monkey typing ABRACADABRA

martingalesprobabilityprobability theorystopping-times

I realise this problem has been covered many times here (this question for example describes the set up as well as the standard solution). I'm looking to find an explicit description of the martingales involved, in terms of various predictable processes and the letters appearing in this case, as opposed to a verbal description of the strategies of gamblers.

My attempt at translating the problem mathematically:
If we write $X_n$ the $n$th letter typed by the monkey, and the betting strategy of the $i$th entering gambler as $V^{i}_n$ (seeking this to be a predictable process). We'll write $M_n$ the earnings of the casino at time $n$, and $B_n^{i}$ the earnings of the $n$th gambler, each $B^{i}_n$ has $B^i_0 = 0$, and we're seeking $M_n = – \sum _{k=1}^n B^i_k$, so it's now enough to construct each $B^i_n$.

My instincts are that this should be a discrete stochastic integral of some sort, but I can't seem to find an appropriate description of it. Something along the lines of repetitive products with (for $L^i_n$ the letter that gambler $i$ wants, needing to be defined only when the gambler is betting)
$$
B^i_n = (V^i_n \circ \mathbb P(X_n = L^i_n))_n = \sum _{k=1}^n 26 \cdot V^i_k
$$

but this doesn't capture the multiplicativity of the earnings being reinvested.

(After this, we then stop at $\tau = \inf \{ n \geq 0 : (X_{n-l}, \dots, X_n) = (A,B,…,R,A)\}$ with finite expectation and consider $M_{n\wedge \tau}$ for the result.)

I'm also interested in a more general problem than this with patterns, where the letters (or general symbols) are picked according to some probability mass function that isn't necessarily uniform. I again understand how to set up the gamblers descriptively in a very similar way to this problem, where the reward is a fair return, but would like a mathematically precise description of the processes involved.

Best Answer

I think starting at $0$ may have been not the correct approach. If instead we take $w_j$ the $j$th letter of ABRACADABRA, writing $A^i_n = \{ X_n = w_{n-i+1} \}$, where $w_j$ is the $j$th letter of ABRACADABRA (defining this more explicitely as that's what I'm seeking, and so that $A^i_n$ corresponds to the next letter gambler $i$ is seeking at time $n$) and $l$ the length of the word (here $l = 11$) $$ B^i_n := \begin{cases} 1 & \text{if $n < i$} \\ B^i_{n-1} \cdot 26 \cdot \textbf{1}_{A^i_n} & \text{if $i \leq n \leq i+l$} \\ B^i_{n-1} & \text{otherwise} \end{cases} $$ easily seen to be a martingale before $i$ and after $n+l$ and since for $i \leq n \leq i+l$ we have (writing $\mathcal F_n = \sigma(X_1, \dots, X_n)$ filtration determined by the typed letters) $$ \begin{align*} \mathbb E\left[B_n \mid \mathcal F_{n-1} \right] & =\mathbb E[B^i_{n-1} \cdot 26 \cdot \textbf{1}_{A^i_n} \mid \mathcal F_{n-1}]\\ &= B^i_{n-1} \cdot 26 \cdot\mathbb E[ \textbf{1}_{A^i_n} \mid \mathcal F_{n-1}]\\ &= B^i_{n-1} \end{align*} $$ where we take out what is known then use independence for $\mathbb E[ \textbf{1}_{A^i_n} \mid \mathcal F_{n-1}] = \mathbb P(A^i_n) = 1/26$

We then have a problem that our expression for $M$ would be complicated as just a partial sum of $B^i$, but instead consider $$ E^i_n := B^i_n - 1 $$ a sum of two martingales so also a martingale (corresponding to the earnings of the $i$th gambler). Then we can immediately let $$ M_n : = \sum_{i=1}^n E^i_n = \sum_{i=1}^\infty E^i_n $$ since $E^i_n = 0$ if $i > n$.

Here we can say that $M_n$ is a martingale: (I can't tell whether these steps are necessary - for the infinite sum we don't have boundedness or non-decreasing since the sequence will appear infinitely often, so I'm not sure what theorems we can apply? DCT and MCT might not apply immediately.)

$$ \begin{align*} \mathbb E[M_n - M_{n-1} \mid \mathcal F_{n-1}] &= \sum_{i=1}^{n-1} \mathbb E[B^i_n - B^i_{n-1} \mid \mathcal F_{n-1}] + (n-1) - (n-1) + \mathbb E[B^n_n - 1 \mid \mathcal F_{n-1}]\\ &= 0 + E[B^n_n - B^n_{n-1} \mid \mathcal F_{n-1}] \\ &= 0 \end{align*} $$ since $B^i_n$ is a martingale.

Writing out for completeness: considering independent sequences $$ \mathbb P(\tau \geq l*n) \leq (1-26^{-l})^n $$ so $$ \begin{align*} \mathbb E[\tau] &= \sum_{k=1}^\infty \mathbb P(\tau \geq k) \\ & \leq l * \sum_{k=0}^\infty (1-26^{-l})^k < \infty \end{align*} $$ and applying Doob's Optional Stopping gives $$ \begin{align*} 0 & = \mathbb E[M_0] = \mathbb E[M_\tau]\\ &= \mathbb E[\sum_{k=1}^\tau (B^i_k - 1)]\\ &= \mathbb E[\sum_{k=1}^\tau B^i_k] - \mathbb E[\tau] \\ &= 26^{11} + 26^4 + 26^1 - \mathbb E[\tau] \end{align*} $$

Generalisation

We can also then we can generalise the definition of $B^i_n$: for $S$ a countable set of possible symbols, each with probability $p(s)$ of appearing, seeking pattern $\mathbf w = (w_1,\dots,w_l)$ then let $$ B^i_n := \begin{cases} 1 & \text{if $n < i$} \\ B^i_{n-1} \cdot p(w_{n-i+1})^{-1} \cdot \textbf{1}\{X_n = w_{n-i+1}\} & \text{if $i \leq n \leq i+l$} \\ B^i_{n-1} & \text{otherwise} \end{cases} $$ a martingale exactly as above, then $E^i_n := B^i_n - 1$ and $M_n := \sum_{i=1}^\infty E^i_n$, with $\mathbb E[\tau] < \infty$ in the same way comparing to geometric trials, then apply OST.