class: center, middle # AI in Digital Entertainment ### Beliefs and Intentions --- class: center, middle # Intentions --- # Dennett: Intentional Systems The philosopher Daniel Dennett described three "stances" which humans use to view a complex system: - The Physical Stance: The domain of physics and chemistry - The Design Stance: The domain of biology and engineering - The Intentional Stance: The domain of the mind He also argued that there might be a fourth stance, "the personal stance" --- # How about AI? When applied to an agent playing chess, these views could correspond to: - The Physical Stance: How do signals travel the circuits, how do the electrons interact with the silicon, etc. - The Design Stance: What are the instructions the programmer put into the program to make it play well - The Intentional Stance: What are the goals of the agent (e.g. "take the bishop"), and how is it pursuing those --- # Why do we care about Intentionality? * Humans typically try to explain (complex) behavior in terms of intentions * Intentional behavior is therefore a *human expectation* * By making agents that behave intentionally, we can make them appear more believable --- class: center, middle # What is an intention? --- # Bratman: Intentions, Plans and Practical Reason * Intentions are **goals** that the agent needs to determine how to achieve (e.g. by using a planner) * Once adopted, intentions provide a **screen of admissibility** for new intentions (they must not contradict each other) * The agent tracks if the actions in their plan succeed, or if they need to come up with a new plan --- class: center, middle # Example: Willie, A Service Robot --- class: medium # Scenario 1 * You: "Willie, bring me a beer from the fridge" * Willie: "OK!" * 20 minutes pass * You: "Willie, where is my beer?" * Willie: "I intended to do it, but I then decided to do something else" --- class: medium # Scenario 1 * You: "Willie, bring me a beer from the fridge" * Willie: "OK!" * 20 minutes pass * You: "Willie, where is my beer?" * Willie: "I intended to do it, but I then decided to do something else" Problem: Willie is not committed to its intentions --- class: medium # Scenario 2 * You: "Willie, bring me a beer from the fridge" * Willie: "Sure thing" * You: "Which kind of beer do we have?" * Willie: "Guinness" * You: "Oh, never mind, then" * Willie: "Here is your beer!" --- class: medium # Scenario 2 * You: "Willie, bring me a beer from the fridge" * Willie: "Sure thing" * You: "Which kind of beer do we have?" * Willie: "Guinness" * You: "Oh, never mind, then" * Willie: "Here is your beer!" Problem: Willie is *too* committed --- class: medium # Scenario 3 * You: "Willie, bring me a beer from the fridge" * Willie: "Sure thing" * Willie goes to the fridge, and takes out the last bottle of beer. It then raises the bottle over its head, and throws it to the floor, where it shatters. * You: "Why did you do that?" * Willie: "Intentions must be kept until the become achieved or impossible to achieve" --- class: medium # Scenario 3 * You: "Willie, bring me a beer from the fridge" * Willie: "Sure thing" * Willie goes to the fridge, and takes out the last bottle of beer. It then raises the bottle over its head, and throws it to the floor, where it shatters. * You: "Why did you do that?" * Willie: "Intentions must be kept until the become achieved or impossible to achieve" Problem: Willie performed actions that interfered with its own intentions --- # Cohen and Levesque * Intention is choice with **commitment** * This means that agents decide between candidate intentions ("desires") * When the agent has made a choice it stays committed to that intention * The agent will not drop the intention unless necessary, but also will not perform actions that interfere with it --- class: mmedium # A Formal Model of Intentions Agent x intends p, unless q, iff: * They have a goal of achieving p * They believe that p is currently false * They believe that before they drop the goal one of three things will happen: - p will be true - p will never be true again - q will be true * They believe that their planned actions will cause p to become true --- # Representation Requirements * Intentions are achieved through plans * We talk about "currently" and "will be", so we need some concept of time * We talk about "the agent believes", so we need a concept of beliefs * p and q are conditions, so all of this should be based on some logical framework --- # Representation Assumptions: * We use discrete time steps * Each time step corresponds to one state, each action turns one state into another state * Plans are sequences of such actions that transform one state into another state (through multiple steps) * Now we "only" need some representation for beliefs --- class: center, middle # Beliefs --- # Beliefs * Agent beliefs are often represented using "possible worlds" * There is an "actual world", with the things that are factually true * Each agent then has a set of worlds that they consider possible, but they don't know which of these worlds is the actual one (if any) * For example: I secretly flip a coin, and look at it. Now you consider two worlds possible: One in which the coin shows heads, and one in which it shows tails --- class: medium # Beliefs about Beliefs * Now consider my beliefs about your beliefs * I know what the coin shows, so I only consider one world possible, but I know that you consider two worlds possible * Likewise, for each of the worlds you consider possible, you know that I know what the coin shows, i.e. that I only consider one world possible * We can draw such relationships in diagrams, with one node for each possible world, and arrows that show which worlds are considered possible by each agent --- # A Diagram of the Coins Example
--- # A Diagram of the Coins Example
--- class: center, middle # Epistemic Logic --- # Epistemic Logic * We call what is represented by such a diagram an *epistemic state* * Just like with propositional states, we can use these states to determine which formulas it models * Regular formulas are just interpreted using the actual world * We just need some way to talk about beliefs to "access" the possible worlds --- # The Belief Modality Beliefs are usually represented using the modal operator `\(\Box\)` (pronounced "box"). For example: $$ \Box_M H $$ "M believes that H holds" $$ \Box_M \Box_Y (H \vee T) $$ "M believes that Y believes that H or T holds" How do we interpret this operator? When does someone believe something? -- When it holds in **all** worlds they consider possible. --- # Some more examples .left-column[
] .right-column[ $$ \models \Box_M H $$ $$ \not \models \Box_Y H $$ $$ \not \models \Box_Y \neg H $$ $$ \models \Box_M \Box_Y (H \vee T) $$ $$ \not \models \Box_M ((\Box_Y H) \vee (\Box_Y T)) $$ ] --- class: middle, center # Dynamic Epistemic Logic --- class: medium # Dynamic Epistemic Logic * Now that we have a representation for static beliefs, we just need to figure out how to change them * We need some sort of action language * Idea: Treat actions similar to states * There is an "actual action", and a set of "possible actions" for each agent (the *appearance* of an action to an agent) * For example: If I draw a card from a deck, the actual action is "draw the ace of spades", but each other agent (that does not see the card) believes it's possible that I have drawn any card remaining in the deck --- class: medium # Action Language * The basic action we have is `flip`, which changes the truth value of some atomic proposition * By default, actions are not visible to any agent, and only change the actual world * The action token `\((a)^x\)` means that agent `x` believes that action `a` happens (but it does not actually happen) * We can combine two actions sequentially: `\( a \cdot b \)` * We can combine two actions as alternatives: `\( a + b \)` * Actions can have *preconditions* of the form `\(?p \)` --- # For Example $$ \text{flip}\: p \cdot (\text{flip} \: q + \text{flip} \: q)^x $$
--- class: medium # So how does this actually work? * An *Epistemic State* consists of worlds that each agent considers possible * An *Epistemic Action* consists of actions that each agent considers possible * If an action appears as multiple possibilities to an agent, they will end up with *more* worlds they consider possible (one for each possible action) * However, if some of these appearances have preconditions, they can only be applied to worlds in which these preconditions hold, and other worlds will be eliminated --- class: medium # An Example * I draw a card (the ace of spades) from the deck * You don't know which card I drew, so now you have 52 possible worlds (one for each possible card) * I then show you the ace of spades: This action has the precondition that I actually have the ace of spades * Since you know that I show you the ace of spades, you can try to apply that action in every world you consider possible, but it will not be applicable in worlds in which you consider it possible that I have a different card, and these worlds will be eliminated --- class: medium # Challenges * Now we have an action language! * But all it can do is check and flip atomic propositions, i.e. single bits of information * Most (interesting) games have states consisting of many bits * For example: Say I can perform an action in which I exchange two other player's cards without looking at them * I would basically have to consider it possible that they have any combination of two cards before I perform the action to determine all possible outcomes --- class: medium # Challenges Assuming there are only 8 different cards:
--- class: medium # Better? ```C causeTrouble(p: Players, a(p): Players, b(p): Players) { card(tmp) = card(a); card(a) = role(b); card(b) = role(tmp); } ``` [Ostari](https://aaai.org/ocs/index.php/AIIDE/AIIDE17/paper/view/15813) --- # Intentional Agents for Doxastic Games * How can we use this to play games? * And how does it enable intentional behavior? -- * One of the challenges with intentionality is the "commitment" part (remember the robot?) * Epistemic Logic gives us a way to estimate how likely something is true (by counting the possible worlds) --- class: medium # One Night Ultimate Werewolf * One Night Ultimate Werewolf (ONUW) is a social deduction game * Each player gets a card with a role on it, with about 1/3 of the players being assigned the Werewolf role * The game then consists of a night phase, in which each role can perform a special action, and a day phase, during which the non-Werewolf players have to figure out who the Werewolves are by discussion * Some roles may secretly exchange role cards between players, and each player becomes the role of their new card, often *without their knowledge* --- class: medium # One Night Ultimate Werewolf * When the cards are dealt, each agent will have one possible world for each possible assignment of cards to the other players * When an action is performed, the agents consider all possible outcomes: The agent who performs the actions knows the targets, the other players don't even know for sure that the action happened (but assume it could have) * During the discussion phase, each agent comes up with an intention of what they want the other players to believe, and form a plan using communicative actions to achieve that goal --- class: medium # Truth or Lies? * When an agent says something, the other players may not believe it. The communication model assumes that players are more likely to tell the truth than to lie, though, and the agents use this fact to estimate how likely someone else is telling the truth. * For example: A world which is consistent with the statements from 5 other players is more likely to be true than a world which contradicts four of these statements. * The agents can also use these likelihoods to determine when they should drop their intentions, when it becomes less likely that they can convince the other players of their story. --- class: medium # One Night Ultimate Werewolf
--- class: medium # One Night Ultimate Werewolf
--- class: small # Other Approaches * Dynamic Epistemic Logic is *very* expressive * Any circumstance in which actions are performed in secret, or partially observable, can be expressed in some way * As we saw, writing these actions might be a bit cumbersome * However, even with a system like Ostari to make actions more succinct there is still a problem: Combinatorial explosion * Eight cards result in a bit more than 40 000 possible worlds * An actual deck of cards with 52 cards has more than 8e67 possible arrangements --- class: small # Other Approaches * Instead of having different possible worlds, assume that each agent considers exactly *one* world possible * They may, of course, be wrong, but they are not uncertain about anything * Alternatively, certain facts can be marked as "uncertain", kind of like a tri-state logic * Actions that happen may then *change* what the agent believes, and/or remove/introduce such uncertainty * Less expressive, but more efficient --- # Resources * [Dennett: Intentional Systems](http://web.csulb.edu/~cwallis/382/readings/483/dennett.intentional.systems.1971.pdf) * [Dennett: Intentional Systems Theory](https://ase.tufts.edu/cogstud/dennett/papers/intentionalsystems.pdf) * [Intention is Choice with Commitment](https://cs.stanford.edu/~epacuit/classes/lori-spr09/cohenlevesque-intention-aij90.pdf), Philip R. Cohen, Hector J. Levesque * [Intentional Agents for Doxastic Games](https://repository.lib.ncsu.edu/handle/1840.20/35747) * [A Logic For Suspicious Players](https://www.vub.ac.be/CLWF/SS/BER.pdf) * [A Possible Worlds Model of Belief for State-Space Narrative Planning](https://www.rac7hel.com/2017/11/20/belief-model/)