The foundation of resource-bounded measure is Ville's formulation of martingales. A martingale is a function formula_3 such that, for all finite strings "w", (This is Ville's original definition of a martingale, later extended by Joseph Leo Doob.) A martingale "d" is said to succeed on a sequence formula_5 if formula_6 where formula_7 is the first "n" bits of "S". A martingale succeeds on a set of sequences formula_8 if it succeeds on every sequence in "X". Intuitively, a martingale is a gambler that starts with some finite amount of money (say, one dollar). It reads a sequence of bits indefinitely. After reading the finite prefix formula_9, it bets some of its current money that the next bit will be a 0, and the remainder of its money that the next bit will be a 1. It doubles whatever money was placed on the bit that appears next, and it loses the money placed on the bit that did not appear. It must bet all of its money, but it may "bet nothing" by placing half of its money on each bit. For a martingale "d", "d"("w") represents the amount of money "d" has after reading the string "w". Although the definition of a martingale has the martingale calculating how much money it will have, rather than calculating what bets to place, because of the constrained nature of the game, knowledge the values "d"("w"), "d"("w"0), and "d"("w"1) suffices to calculate the bets that "d" placed on 0 and 1 after seeing the string "w". The fact that the martingale is a function that takes as input the string seen so far means that the bets placed are solely a function of the bits already read; no other information may affect the bets (other information being the so-called "filtration" in the generalized theory of martingales). The key result relating measure to martingales is Ville's observation that a set formula_8 has Lebesgue measure 0 if and only if there is a martingale that succeeds on "X". Thus, we can define a measure 0 set to be one for which there exists a martingale that succeeds on all elements of the set. To extend this type of measure to complexity classes, Lutz considered restricting the computational power of the martingale.