# Modal Combat for arbitrary games

Modal combat has, as far as I know, only been studied in the context of the prisoner's dilemma, but it can also be used for other games. The definition of modal agent for an arbitrary game will be similar to the definition of modal agent for the prisoner's dilemma given in Robust Cooperation in the Prisoner's Dilemma, except that since different players can have different sets of available actions, a modal agent must know which position it is playing in, and since players can have more than two available actions, multiple formulas will be needed to express what action the agent takes. Formally, let be a game with players , where each player has a set of available actions (), and for each player , the function describes the payoff for player for each possible combination of actions. A modal agent for of player type and rank consists of a finite sequence of triples , where , is either or a modal agent of player type and rank , and , together with fully modalized formulas such that Godel-Lob logic proves that exactly one of holds. By definition, in a game played by modal agents , where is of player type , takes action (an event denoted as ) iff holds. (We could also allow modal agents to consider what happens if players other than themselves are replaced by modal agents of lower rank. Making this change would not affect anything in this post, and I didn't allow for that mainly because the definition is already a mouthful and I didn't want it to get any worse). The modal combat version of is the game in which each player submits a modal agent for of player type , and gets the payoff that their agent does when the modal agents play with each other.

A strong Nash equilibrium is a Nash equilibrium in which there is no non-empty coalition of players that could achieve a Pareto improvement for themselves (not including players outside the coalition) by switching strategies, while the strategies of the other players are held fixed. (Note: "Pareto improvement" is ambiguous as to whether it requires at least one person to become strictly better off while everyone stays at least as well off, or requires everyone to become strictly better off. Everything in this post should make sense using either definition). The prisoner's dilemma is a famous game in which there is no strong Nash equilibrium, since the only Nash equilibrium is for both players to defect, but the coalition consisting of both players could achieve a Pareto improvement by both cooperating instead. The modal combat version of the prisoner's dilemma, in which each player submits a modal agent to play on their behalf, does have strong Nash equilibria (for instance, one player using FairBot while the other uses PrudentBot), and this is part of what makes modal combat appealing. Since the presence of strong Nash equilibria in the modal combat version of the prisoner's dilemma is a selling point for modal combat, a natural question is whether or not all modal combat games have strong Nash equilibria. The answer is no. A natural followup question is whether or not all modal combat games at least have Pareto optimal Nash equilibria (equivalent to strong Nash equilibrium for 2-player games). The answer is still no, but in the second section of this post, I'll consider a better version of the question to which the answer is either "no" or "it's complicated", and I haven't yet figured out which. Let's run through a few examples.

In matching pennies, there are two players, each of which can play or . If both players do the same thing, then player 1 wins, and if they do opposite things, then player 2 wins. This is a zero-sum game, and hence so is its modal combat version. In two-player zero-sum games, every Nash equilibrium is a strong Nash equilibrium. However,

Theorem 1: In the modal combat version of matching pennies, for any strategy (i.e. probability distribution over modal agents) for either player, there is a strategy for the other player that gets their probability of victory arbitrarily close to . Consequently, there is no Nash equilibrium.

Proof: Lemma: For any finite set of modal agents of one player type, there is a modal agent of the other player type that wins against all of them.

LemmaTheorem 1: Since there are only countably many modal agents to choose from, for any mixed strategy, there must be a finite set of modal agents such that the probability of playing an agent from the set exceeds . The other player can play a modal agent that defeats all of these, and thus wins with probability greater than . Thus a Nash equilibrium would have to allow both players to win with probability , which is impossible.

Sublemma: In the Kripke frame with worlds such that is accessible to iff , the behavior of a modal agent must be eventually constant, no matter how the other player behaves in each world.

SublemmaLemma: Consider the agent PerseveranceBot, which, in , takes the action that would defeat what its opponent did in . PerseveranceBot is not a modal agent, but if it plays against a modal agent, then its opponent, and consequently PerseveranceBot, will behave in a way that is eventually constant. Thus, for any finite set of modal agents, there is some such that against any of the agents in the set, PerseveranceBot behaves the same in and whenever . Let PerseveranceBot be the agent which, in , takes the action that would defeat what its opponent did in . PerseveranceBot can be implemented as a modal agent, and behaves identically to PerseveranceBot against its finite set of opponents, thus defeating all of them.

Proof of Sublemma: If is any formula, then the truth value of in can only change at most once as increases, since if , then for some , and hence for all . The behavior of a modal agent is given by some fully modalized formula (in terms of atomic formulas about its opponent's behavior). Since the formula is fully modalized, it is a Boolean combination of formulas of the form , and thus can only change truth-values finitely many times as increases.

It's clear what the problem is here: although the players can use randomness to select the modal agent they use, the modal agents themselves are deterministic. If a modal agent was allowed to randomize its move, it could play the Nash equilibrium for matching pennies (that is, equal probabilities of and ), and playing this modal agent would be a Nash equilibrium (and hence a strong Nash equilibrium) in the modal combat version of the game. This will be formalized in the second section of this post.

For a different example, which does not relate to mixed strategies, consider the game in which there are three pirates trying to decide how to divide ten gold coins between them. Each pirate proposes a way to divide the treasure, and if two of the pirates propose the same division of the treasure, the treasure is divided in the manner they propose (if no two pirates propose the same division of treasure, the treasure is dumped overboard). This game has no strong Nash equilibrium, because no matter what each pirate's strategy is, some pair of pirates would be able to make each of them better off by agreeing to steal the third pirate's share of the treasure and split it between them. The same is true in the modal combat version of the game, and will remain true when we allow modal agents to use mixed strategies. This example feels somehow unfair, like this alliance dynamic is legitimately trickier than just wanting everyone to be able to coordinate on a strategy that leaves all of them better off. This is why I thought it might be reasonable to only insist on Pareto optimal Nash equilibria, rather than strong Nash equilibria (these are equivalent in two-player games).

One more example: Consider the variant of the prisoner's dilemma in which, if both players defect, they both get a payoff of , if both cooperate, they both get a payoff of , and if one cooperates while the other defects, the cooperater gets nothing while the defecter gets a payoff of . In the modal combat version of this game, it is still a Nash equilibrium for both players to play PrudentBot, getting each of them a payoff of , but it is no longer Pareto optimal. Both players would get an expected payoff of if they each randomized between playing CooperateBot and DefectBot with equal probabilities, for instance. More generally, if both players cooperate with probability and defect with probability , then they each get an expected payoff of , which is maximized at , with a value of . Without modal combat, this would be Pareto optimal, since the players' mixed strategies are independent of each other, and thus they cannot coordinate on which of them cooperates and which defects. However, with modal combat, they can do even better, and each get an expected payoff of . To see this, there are modal agents , , , and , such that exploits , exploits , exploits , and exploits (`` exploits '' means that defects against while cooperates with ), so that by one player randomizing between and and the other randomizing between and , each of them gets an even chance at the payoff of .

Example of an implementation of this is (where and abbreviate cooperate and defect):

,

,

, and

.

However, this is not a Nash equilibrium, because, for example, player 2 could play a modal agent that exploits both and , like DefectBot. This technique for achieving coordination can be generalized, and in this particular game, can be done in a Nash equilibrium.

Theorem 2: In any game, any result that can be achieved with a joint probability distribution over the actions taken by each player can also be achieved with each player acting independently in the modal combat version of the game.

Proof: Assume without loss of generality that player 1 has at least 2 available actions. Player 1 has one modal agent for each element of , where is the set of actions available to player , and player 1 plays one of these agents at random according to the joint probability distribution given. The modal agent corresponding to should take action if , where , and, if , then it should act in a way that depends on the smallest such that , and which is used to encode . Players 2 through n each submit modal agents that read off the actions they are supposed to take from what player 1 would do if , and take those actions.

Theorem 3: In the modified prisoner's dilemma, there exists a Nash equilibrium in which each player gets an expected payoff of .

Proof: Let be sequences of modal agents defined by induction as

Note that testing other agents against its opponent isn't directly allowed for in the definition of modal agent, but theorem 4.6 in Robust Cooperation in the Prisoner's Dilemma shows that there are modal agents that are equivalent to these. is similar to above, except that it also defects against anything that is not exploited by for (analogous statements hold for , , and ). Suppose player 1 plays with probability for and , and player 2 plays with probability for and . Each player gets an expected payoff of , since if exploits iff , and otherwise exploits . We just need to show that neither player can find a modal agent that will get them an expected payoff greater than , holding the other player's strategy constant. Suppose player 1 finds a modal agent that gets an expected payoff greater than . Since it is impossible to get a payoff greater than without exploiting your opponent, must exploit some . If does not exploit for any , then it must exploit some , and hence all defect against it. Let be the supremum of . is exploited by for (probability , payoff ). can potentially exploit for (probability , payoff at most ). does not exploit for (probability , payoff at most ). And gets defected against by for (probability , payoff at most ). This gives an upper bound on total utility of , a contradiction. The cases when exploits some , and when player 2 finds a modal agent getting an expected payoff greater than , follow similarly.

Theorem 4: There is no Nash equilibrium in which either player gets an expected payoff greater than without playing modal agents of unboundedly high rank with nonzero probability.

Proof: In any Nash equilibrium in which some player gets an expected payoff greater than , suppose is a modal agent with maximal rank up to equivalence among those that the player plays with nonzero probability (by a modal agent's rank up to equivalence, I mean the lowest rank of a modal agent that proves it equivalent to). must get expected payoff greater than against the other player's strategy, so there must be some agent the the other player plays with nonzero probability such that exploits . If there is some modal agent that defects against and achieves the same outcome as against anything else that the first player might play, then would achieve a higher expected payoff than , contradicting the assumption that is played with nonzero probability in the Nash equilibrium. In fact, it is enough for to fail to achieve the same outcome as with sufficiently low probability, and the probability of failure can be driven arbitrarily low by ensuring that achieves the same outcome as against some finite set of modal agents that the first player might use. Let be the smallest set of agents containing and such that whenever any tests its opponent against some modal agent of lower rank than , then for some . This is finite, since each modal agent can only test its opponent against finitely many modal agents of lower rank. Since has maximal rank up to equivalence, no is equivalent to . Hence there are such that for each , for some . can be designed to test its opponent against , and do what would do unless there are accessible worlds in which its opponent acts differently from each of , in which case it defects. By induction on rank, achieves the same outcome as against , which include , and at some point distinguishes itself from each of on , so defects against .

# Mixed Strategy Modal Combat

The basic idea is that a mixed strategy model agent should be able to choose between finitely many mixed strategies, using what it can prove about what polynomial inequalities hold about the probabilities of other players taking various actions. One could probably come up with more flexible notions of mixed strategy modal combat than what I have here, but I expect it will not change any of my conclusions or the answers to my open questions. Formally, let be a game with players , where each player has a set of available actions (), and for each player , the function ( is the set of algebraic real numbers) describes the payoff for player for each possible combination of actions. A mixed strategy modal agent for of player type and rank consists of a finite sequence of triples , where , is either or a mixed strategy modal agent of player type and rank , and is an inequality between polynomials with variables and integer coefficients, together with some number fully modalized formulas such that Godel-Lob logic proves that exactly one of holds, and nonnegative algebraic numbers (, ) such that for each , . By definition, in a game played by mixed strategy modal agents , where is of player type , uses mixed strategy (an event denoted as ) iff holds. The mixed strategy modal combat version of is the game in which each player submits a mixed strategy modal agent for of player type , and gets the payoff that their agent does when the mixed strategy modal agents play with each other.

Mixed strategy modal agents are only allowed to use algebraic probabilities, and test for polynomial inequalities, because if they were allowed to use too general a class of probabilities, or test for too general a class of conditions, then it would not be possible to represent mixed strategy modal agents in a concrete way from which their behavior is decidable. Polynomial inequalities of algebraic numbers are decided by PA, so the Kripke frame method can be used in the same way that it was used for pure strategy modal agents. Furthermore, this is flexible enough that, provided the payoffs are algebraic, we're not going to be unable to achieve anything on account of not being able to use some particular number as a probability.

Theorem 5: All mixed strategy modal combat games have Nash equilibria. In fact, they have pure strategy Nash equilibria, in the sense that each player chooses their mixed strategy modal agent deterministically, not in the sense that the modal agents implement pure strategies.

Proof: The underlying ordinary game has finitely many players, each of which has finitely many available actions, so it has a Nash equilibrium. The existence of a Nash equilibrium for can be expressed as a first-order sentence in the language of ordered rings, and is an elementary substructure of , so must have a Nash equilibrium in ; that is, with each player assigning algebraic probabilities to each possible action. In the mixed strategy modal combat version of , each player can submit a modal agent that just uses the mixed strategy from the algebraic Nash equilibrium for (regardless of what it can prove about the other players). This is a Nash equilibrium.

This can be strengthened somewhat.

Theorem 6: All mixed strategy modal combat games have pure strategy Nash equilibria from which no Pareto improvement can be made without mixed strategies (again, in the sense that each player randomizes which mixed strategy modal agent they use, not that the model agents implement mixed strategies).

This theorem is not very satisfying, since I don't see a good reason to avoid mixed strategies, and that limitation prevents things like coordinating who gets exploited in the modified prisoner's dilemma so that each player gets an expected payoff of . What we really want is a Nash equilibrium that is Pareto optimal among all strategy profiles.

Proof: Start from a pure strategy Nash equilibrium in which player plays mixed strategy modal agent . Each player gets a certain expected payoff, and if this is not Pareto optimal, then there is a strategy profile in the underlying ordinary game that is a Pareto optimal Pareto improvement over it. The existence of a strategy profile in the underlying ordinary game that gives a Pareto optimal Pareto improvement can be expressed as a first-order sentence, so again it holds in , so there is a Pareto optimal Pareto improvement in which each player uses algebraic probabilities. Let be the mixed strategy modal agent of player type that follows the mixed strategy used by player in the Pareto optimal Pareto improvement in the underlying ordinary game. If each player plays , this results in a Pareto improvement over each player playing . In any pure strategy in modal combat, the mixed strategy modal agents end up implementing some particular mixed strategy in the underlying ordinary game when playing against each other, so any outcome that is achievable with a pure strategy in modal combat is achievable with a mixed strategy in the ordinary game. Thus it is Pareto optimal among pure strategy profiles for each player to play . However, it is not necessarily a Nash equilibrium. The goal is to find a modal agent such that acts like so long as the other modal agents are acting like for each , and if one of the other agents doesn't act like the corresponding , then should revert to acting like . The first condition is easier to implement: If there is a proof that all other agents use the mixed strategy used by the corresponding , then use the mixed strategy used by . By Lob's theorem, will act like around each other, given that they follow that condition. For the second condition, if one of the other players does not act like the corresponding , let be minimal such that in the Kripke frame, one of the other players fails to behave like in . Then we want to become and pretend never happened; that is, in , do what would have done in . To do this, define the relativization of a modal formula to a modal formula , denoted by induction on : , if is atomic, , , and . If there is no proof that the other players act like the corresponding , then implements , with the formulas in all relativized to the nonexistence of a proof that all the other players behave like the corresponding , and the agents that tests the other players against modified in the same way that was constructed from . This has the effect of cutting out worlds , as desired. If all but one of the players play their , and the remaining player plays an agent that does not act like around them, then it diverges from expected behavior on some , and everyone else reverts to acting like , which was a Nash equilibrium, so the player who did not use cannot benefit from doing this. Thus is a Nash equilibrium, and was already shown to be a Pareto improvement over and Pareto optimal among pure strategy profiles.

Theorem 7: The mixed strategy modal combat version of the prisoner's dilemma variant discussed in the previous section has no Pareto optimal Nash equilibrium with mixed strategy modal agents of bounded rank.

Proof: Any pair of expected payoffs for each player for any is achievable, for instance with one player playing from the previous section, and the other player playing with probability and with probability . That is, for any strategy profile on the Pareto frontier, the expected payoffs for each player sum to , and this can only happen if it is guaranteed that one player exploits the other. If either player uses, with nonzero probability, a mixed strategy modal agent that randomizes its action, then there must be a nonzero probability of neither agent exploiting the other. Thus, the Pareto frontier is only reachable with deterministic modal agents. But by theorem 4, no Nash equilibrium with deterministic modal agents of bounded rank gives either player an expected payoff greater than .

Open questions:

Is there a Nash equilibrium with agents of bounded rank in a mixed strategy modal combat game for which there is no pure strategy Nash equilibrium with the same expected payoffs for each player?

Does every mixed strategy modal combat game have a Pareto optimal Nash equilibrium?

I started out thinking that if all mixed strategy modal combat games had Pareto optimal Nash equilibria, then this would be a good sign for modal combat as a model for coordination between agents, and if there were mixed strategy modal combat games without Pareto optimal Nash equilibria, then this would suggest that perhaps modal combat is just a one-act pony that does not perform well outside of the prisoner's dilemma. As it is, it seems pretty plausible that every mixed strategy modal combat game has a Pareto optimal Nash equilibrium, but this can require using mixed strategy modal agents of unbounded rank. If that is the case, then I'm not really sure how to interpret it.