I have some difficulties at solving a traditional problem where we have two hats, hat A and B, where there are black and white balls in each hats but the experimenter does not know the proportion of $\displaystyle $a$$ black balls in hat A and proportion $\displaystyle $b$$ for hat B. Let $\displaystyle $0 \le a, b \le 1$$ with $\displaystyle $a \ne b$$. The proportion of hat A is $\displaystyle $p_0 \in (0,1)$$. The experimenter draws randomly some balls (with replacement) to determine which of the hats he is drawing from. After each $\displaystyle $k$$ draws, the experimenter updates his beliefs using Bayes' rule. Denote $\displaystyle $p_k$$ where $\displaystyle $k=1,2,...,$$ the experimenter posterior probability after k balls have been drawn.

My questions are:

(1) why is $\displaystyle $p_k$$ a random variable that can take k+1 values? I don't see where the +1 comes from... that's probably because I am not sure how to define the probability space.

(2) is this a martingale due to the replacement of a ball back into the hat after each draws?