Games Episode 6 Games as models of interactive computational tasks Constant games Prefixation Traditional computational problems as games Departing from functionality Departing from the input-output scheme Departing from the depth-2 restriction Propositions as games Not-necessarily-constant games Games as generalized predicates Substitution of variables in games
COMPUTATION INPUT (Question) OUTPUT (Answer) Computing agent (Machine) Does the Church-Turing thesis in its traditional form really provide an ultimate answer to what computability means? 6.1 Yes and no. “Yes”, because all effective functions can indeed be computed by Turing machines. “No”, because apparently not all computational problems are functions. Functions are only special cases of computational problems, assuming a very simple interface between a computing agent and its environment, consisting in receiving an input (question) and generating an output (answer): COMPUTATION (the outside world is fully shut out during this process) INPUT (Question) (Environment’s action) OUTPUT (Answer) (Agent’s action) Computing agent (Machine) O u t s i d e w o r l d (E n v i r o n m e n t)
... Interaction Outside world Computing agent The reality 6.2 Most tasks that real computers or humans perform, however, are interactive, with multiple and/or continuous “inputs” and “outputs” interleaved in some complex fashion. Interaction Outside world Computing agent ... Imagine a robot taxi driver. Its brain is a computer, so, whatever task it performs is a computational task (problem). But is that task a function? What is input and what is output here? Rather, input comes to the robot (through its perceptrons) continuously and is interleaved with the computation process and “output” (robot’s actions) steps. The environment remains active during computation, that is. Part of computation involves watching environment’s actions, making decisions regarding whether to react or wait for more input, etc. The environment, in turn, does not wait till the robot reacts before providing more input. Trouble. The traditional understanding of computational problems as functions appears to be too narrow. Instead, we suggest to understand computational problems as games. This is where computability logic starts.
Computational problems --- games between two players 6.3 MACHINE (⊤, Green, Computer, Robot, Agent) ENVIRONMENT (⊥, Red, User, Nature, Devil) Players: good guy bad guy algorithmic arbitrary Behavior: (strategy) 3
Why should our sympathies be with ⊤ (machine)? 6.4 “The reason why I should be a fan [迷] of the machine even --- in fact especially --- when it is playing against me is that the machine is a tool, and what makes it valuable as such is exactly its winning the game, i.e. its not being malfunctional [故障的] (it is precisely losing by a machine the game that it was supposed to win what in everyday language is called malfunctioning). Let me imagine myself using a computer for computing the “28% of x” function in the process of preparing my federal tax return. This is a game where the first move is mine, consisting in inputting a number m and meaning asking ⊤ the question “what is 28% of m?”. The machine wins iff it answers by the move/output n such that n=0.28m. Of course, I do not want the machine to tell me that 27,000 is 28% of 100,000. In other words, I do not want to win against the machine. For then I could lose the more important game against Uncle Sam [山姆大叔].” From “In the beginning was game semantics”.
Moves, labeled moves, runs, positions 6.5 The machine and the environment interact with each other through (observable) actions. We will be using the term “move” instead of “action”. Going back to the ordinary Turing machine model, it is for games where only two moves are made: the first move, called “input”, is by the environment, and the second move, called “output”, is by the machine. We agree on the following: A move is any finite string over the keyboard alphabet. We will be using , , as metavariables for moves. A labeled move is a move prefixed with the label ⊤ or ⊥, indicating who has made the move. We will be using as a metavariable for labeled moves. In this PowerPoint presentation, usually green will be written instead of ⊤, and red instead of ⊥. A run is any sequence of labeled moves. We will be using , , as metavariables for runs. A position is any finite run. We will be using , , as metavariables for positions. We will be writing runs and positions as ⊥, ⊥, ⊤, , , , ⊥, , etc. thus stands for the empty position.
We extend gamestructures to include infinite runs as well, by 6.6 Definition 6.1. A gamestructure, or simply structure, is a nonempty set Lr of positions, called legal positions, such that the following condition is satisfied: We extend gamestructures to include infinite runs as well, by stipulating that an infinite run is in Lr iff so is every finite initial segment of . If ,Lr, then Lr. Intuitively, Lr is the set of legal runs. The runs that are not in Lr are illegal. An illegal (labeled) move is one adding which to a given position makes it illegal. The player who has made the first illegal move in a given run is called the offender. Condition 1 says that every initial segment of a legal position is also legal. Some intuitions associated with illegal moves: (1) Moves that can or should never be made; (2) Moves that cause the system crash (e.g., requesting to divide a number by 0).
Visualizing gamestructures 6.7 s stand for legal positions. Edges stand for labeled moves, with their color indicating who moves. Lr= { Who is the offender in , , , , (= ⊥, ⊤, ⊥, ⊤, ⊤ )? , , , , ,, ,, ,, ,, ,, ,, ,,, ,,, ,,, ,,, ,,, ,, } Environment offending move (first illegal move)
Definition 6.2. Let Lr be a gamestructure. A content on Lr is a Constant games 6.8 Definition 6.2. Let Lr be a gamestructure. A content on Lr is a function Wn: Lr {⊤, ⊥}. When Wn =⊤, we say that is won by ⊤ (and lost by ⊥); and when Wn =⊥, we say that is won by ⊥ (and lost by ⊤). We extend the domain of Wn to all runs by stipulating that an illegal run is always lost by the offender. Definition 6.3. A constant game A is a pair (LrA,WnA), where LrA is a gamestructure, and WnA is a content on LrA.
Example of a winning strategy 6.9 Notice that strategies cannot be defined as functions from positions to moves, because, in some positions (such as the root position in this example) both players have legal moves, and which of them acts faster may determine what will be the next move. The exact meaning of “strategy” will be defined a few lectures later, but whatever it means, we can see that the machine has a winning strategy in this game: “Regardless of what the adversary is doing or has done, go ahead and make move ; make as your second move if and when you see that the adversary has made move , no matter whether this happened before or after your first move”. Does this strategy guarantee that the machine will not offend? What legal runs are consistent (could be generated) with this strategy? Sure. There are 5 such runs: ; ,; ,; ,,; ,,. All won by machine.
A Definition 6.4. Let A be a constant game, and be a legal position Prefixation 6.10 Definition 6.4. Let A be a constant game, and be a legal position of A (i.e., LrA). The game A, called the -prefixation of A, is defined by: LrA = { | , LrA} WnA =WnA , ,A ,,A A
Traditional computational problems as games 6.11 As noted in Episode 3, computational problems in the traditional sense are nothing but functions (to be computed). Such problems can be seen as the following types of depth-2 games: Input 1 2 ... Output ... ... ... 1 2 3 1 2 3 1 2 3 It corresponds to the situation when there was no input. The machine has nothing to answer for, so it wins. Why is the root green? Why are the 2nd-level nodes red? Why does each group of 3rd-level nodes have exactly one green node? What particular function is this game about? They correspond to situations when there was an input but no output was generated by the machine. So the machine loses. Because a function has exactly one (“correct”) value for each argument. The successor function: f(n)=n+1.
Departing from functionality 6.12 Once we agree that computational problems are nothing but games, the difference in the degrees of generality and flexibility between the traditional approach to computational problems and our approach becomes apparent and appreciable. What we see below is indeed a very special sort of games, and there is no good call for confining ourselves to its limits. In fact, staying within those limits would seriously retard any more or less advanced and systematic study of computability. 1 2 ... ... ... ... 1 2 3 1 2 3 1 2 3 First of all, one would want to get rid of the “one green node per sibling group” restriction for the third-level nodes. Many natural problems, such as the problem of finding a prime integer between n and 2n, or finding an integral root of x2-2n=0, may have more than one as well as less than one solution. That is, there can be more than one as well as less than one “right” output on a given input n.
Departing from the input-output scheme 6.13 And why not further get rid of any remaining restrictions on the colors of whatever-level nodes and whatever-level arcs. One can easily think of natural situations when, say, some inputs do not obligate the machine to generate an output and thus the corresponding second-level nodes should be green. An example would be the case when the machine is computing a partially-defined function f and receives an input n on which f is undefined. 1 3 1 2 ... ... ... ... 1 2 3 1 2 3 1 2 3
Departing from the depth-2 restriction 6.14 So far we have been talking about generalizations within the depth-2 restriction, corresponding to viewing computational problems as very short dialogues between the machine and its environment. Permitting longer-than-2 or even infinitely long branches would allow us to capture problems with arbitrarily high degrees of interactivity and arbitrarily complex interaction protocols. The task performed by a network server is an example of an infinite dialogue between the server and its environment --- the collection of clients, or let us just say the rest of the network. 1 3 1 2 ... ... ... ... 1 2 3 1 2 3 1 2 3 5 1 2 8 3 ...
Elementary games; propositions as games 6.15 It also makes sense to consider “dialogues” of lengths less than 2. Games of depth 0 are said to be elementary. There are exactly two elementary constant games. We identify them with the propositions ⊥ and ⊤. Games ⊥ and ⊤: Snow is black 2+2=5 Snow is white 2+2=4 1 1 2 ... Remember: Elementary games are games without any moves, automatically won or lost by the machine. Proposition ⊤ is the elementary game won by the machine, and ⊥ is the elementary game lost by the machine. Constant games are generalized propositions. ... ... ... 1 2 3 1 2 3 3 1 2 3 5 1 2 8 3 ...
Not-necessarily-constant games 6.16 “Variable”, “constant”, “valuation”, “predicate” mean the same as in Episode 5. Remember that predicates are functions of the type {valuations} {propositions}, and propositions, in turn, are nothing but “constant predicates”. Similarly, we define (not-necessarily-constant) games as functions of the type {valuations} {constant games}: Definition 6.5. A game is a function A that assigns a constant game e[A] to each valuation e. We call such an e[A] an instance of A. We will typically write LreA and WneA instead of Lre[A] and Wne[A]. We say that a game is elementary iff all of its instances are so (in the sense of Slide 6.15). We understand each predicate p as the elementary game such that, for any valuation e, Wne[p] = e[p]. Remember: A predicate p is the elementary game whose any instance e[p] is won by the machine if p is true at e, and lost by the machine if p is false at e. Games generalize constant games in the same sense as predicates generalize constant predicates ( = propositions). Games generalize predicates in the same sense as constant games generalize propositions.
An example of a non-constant game 6.17 The game of Slide 6.11 is a constant one. It is about computing the function f defined by f(n)=n+1. As this is a one fixed function, the game does not depend on any variables. Now we turn it into a non-constant game A(x) which depends on x. Specifically, for every e, the game is about computing the function fe, defined by fe(n)=n+e(x) (note that we have different functions and thus different constant games for different es). A(x) ⊤ ⊤ 1 1 2 1 1 ... ... ... ... ⊥ ⊥ ⊥ ⊥ ... ... ... ... ... ... ... ... ... 1 1 1 1 2 3 2 2 2 1 2 3 1 1 1 2 2 2 1 2 3 0=0+x ⊥ 1=0+x ⊤ 2=0+x ⊥ 0=1+x ⊥ 1=1+x ⊥ 2=1+x ⊤
Substitution of variables 6.18 When A(x1,...,xn) is a game and t1,...,tn are any terms, A(t1,...,tn) is written to mean the game such that, for any valuation e, we have e[A(t1,...,tn)]=e’[A(x1,...,xn)], where e’ is the valuation satisfying the following two conditions: e’(x1)=e(t1), ..., e’(xn)=e(tn); e’ agrees with e on all other variables. A(x) ⊤ 1 ... ⊥ ⊥ ... ... 1 2 1 2 0=0+x 1=0+x 2=0+x 0=1+x 1=1+x 2=1+x Remember: Substitution of variables for games works in exactly the same way as for predicates (Episode 5). We use the same notational conventions for games as for predicates.
Substitution of variables 6.18 When A(x1,...,xn) is a game and t1,...,tn are any terms, A(t1,...,tn) is written to mean the game such that, for any valuation e, we have e[A(t1,...,tn)]=e’[A(x1,...,xn)], where e’ is the valuation satisfying the following two conditions: e’(x1)=e(t1), ..., e’(xn)=e(tn); e’ agrees with e on all other variables. A(0) ⊤ 1 ... ⊥ ⊥ ... ... 1 2 1 2 0=0+0 1=0+0 2=0+0 0=1+0 1=1+0 2=1+0 Remember: Substitution of variables for games works in exactly the same way as for predicates (Episode 5). We use the same notational conventions for games as for predicates.
Substitution of variables 6.18 When A(x1,...,xn) is a game and t1,...,tn are any terms, A(t1,...,tn) is written to mean the game such that, for any valuation e, we have e[A(t1,...,tn)]=e’[A(x1,...,xn)], where e’ is the valuation satisfying the following two conditions: e’(x1)=e(t1), ..., e’(xn)=e(tn); e’ agrees with e on all other variables. A(1) ⊤ 1 ... ⊥ ⊥ ... ... 1 2 1 2 0=0+1 1=0+1 2=0+1 0=1+1 1=1+1 2=1+1 Remember: Substitution of variables for games works in exactly the same way as for predicates (Episode 5). We use the same notational conventions for games as for predicates.
Substitution of variables 6.18 When A(x1,...,xn) is a game and t1,...,tn are any terms, A(t1,...,tn) is written to mean the game such that, for any valuation e, we have e[A(t1,...,tn)]=e’[A(x1,...,xn)], where e’ is the valuation satisfying the following two conditions: e’(x1)=e(t1), ..., e’(xn)=e(tn); e’ agrees with e on all other variables. A(1) ⊤ 1 ... ⊥ ⊥ ... ... 1 2 1 2 ⊥ ⊤ ⊥ ⊥ ⊥ ⊤ Remember: Substitution of variables for games works in exactly the same way as for predicates (Episode 5). We use the same notational conventions for games as for predicates.
Substitution of variables 6.18 When A(x1,...,xn) is a game and t1,...,tn are any terms, A(t1,...,tn) is written to mean the game such that, for any valuation e, we have e[A(t1,...,tn)]=e’[A(x1,...,xn)], where e’ is the valuation satisfying the following two conditions: e’(x1)=e(t1), ..., e’(xn)=e(tn); e’ agrees with e on all other variables. A(1) 1 ... ... ... 1 2 1 2 Remember: Substitution of variables for games works in exactly the same way as for predicates (Episode 5). We use the same notational conventions for games as for predicates.