Convert R and S into nondeterministic finite automata N1 and N2. Given a string s, if we know the states N1 and N2 may reach when s[1...i] has been read, we are able to derive the states N1 and N2 may reach when s[1...i+1] has been read. Consider the following nondeterministic Turing machine M which tries to guess a string on which exactly one of N1 and N2 accepts. Instead of storing the guessed string, M keeps guessing the next bit of the string and forget about its previous bits. Upon guessing the next bit, M updates the states N1 and N2 may reach after reading the string guessed so far. If after guessing some bit, M finds that exactly one of N1 and N2 may reach an accepting state while the other cannot, M declares N1 and N2 are different and accepts. Note that M runs in polynomial space although it may fail to halt. Clearly N1 and N2 differ if and only if M(R,S) has an accepting
computation branch. Applying Savitch's theorem that NPSPACE=PSPACE=coNPSPACE will do the job. Solution: To show GM PSPACE, we assume that P is a grid of X,O and empty with input length is O(n 2 ). Now we will write algorithm, it accept incase of winning strategy for player X with starting point is P. Algorithm: 1. Potential X moves without marking on all spaces i in position P.
i. Change the position to p by putting the X marker on space i. if there is 5 X s in a row, accept (good move), if board is full now and no one is winner, reject. ii. else Potential O moves without marking on all spaces j in position P. a. Change the position to P by putting the O on space j. if there is 5 O s in a row or board full and no one is winner then loop to next i, move to step1, poor move by putting an X on i. b. else run GM(p ). if accept then loop to next j and go to step b.,if iii. rejects then loop to the next I and go to step1. If GM(p ) accept due to all j, i good move for X, all possible O moves has been covered, accept. 2. Reject, if no i in step 1 causes accept, bad move from this point, hence reject. We can reuse the space, so O(n 2 ) deep. We require to store configurations P,P at each level, it means we need O(n 2 ) space for maximum n 2 moves. Total space required is O (n 4 ) for polynomial time input length O (n 2 ). Now consider the given problem with 19 X19 grid mean 19 2 spaces on the board with 3 19X19 configurations. It is a big enough. In complexity theory even though a number is too bigger but any expression without variable is just a small constant. We can fit things into our complexity classes by generalizing things to variable length. So we prefer to generalize things to variable length. We have risk of input too small if configuration down as n. if we want to know winning strategy from the start because no markers have been placed. There is required to much space to write down the number n with input length log n. Might be O(n 4 ) spaces are still required for algorithm but it exponential in our input length, this shows that GM PSPACE Solutions: P NP P-SPACE NP P-SPACE Given every NP-Hard language is also PSPACE-Hard want to show that NP =PSPACE. From our assumption we know that if every NP-Hard is also PSPACEHard we know that then every NP-Complete language is also PSPACE-Hard since NP-Hard contains all of the NP-complete problems by definition. So we also know that SAT is PSPACE-Hard. And from the assumption that for any A in PSPACE, A reduces to SAT. Claim then we can solve A in NP. Create a TM, N as follows. on input x, do Compute f(x), the poly-time reduction between A and SAT. Decide whether f(x) is satisfiable, if so, accept, otherwise reject. Claim N decides A since x is in A iff f(x) is in SAT. Also notice that N is an NP machine since computing SAT is in NP
Solution: We will reduce TQBF to PUZZLE. Consider any TQBF instance in its CNF form. Let m denote the number of clauses and n denote the number of variables. We will consider an instance of PUZZLE with n cards, each of which corresponds to one of the variables and in the same order as the quantifiers in the TQBF instance. The box have m holes all on the right column. We will define each card as follows: For each row i, the card would have exactly one hole on the right for row i if letting the variable to be true would satisfies the i th clause; it would have exactly one hole on the left if letting the variable to be false would satisfies the clause; let there be two holes otherwise. Each step, the player chooses one side of the cards and hence choose the truth assignment for the corresponding variable (front for true, and back for false). The TQBF instance is satisfied if-and-only-if for each row at least one of the cards blocks the hole, that is, at least one of the literals in the clause has value true.
Solution: We first note that the game can have only 2n 2 configurations, defined by position of the cat, position of the mouse and if it is cat s turn. So, we can construct a directed graph consisting of 2n 2 nodes where each node corresponds to a game configuration and there is an edge from node u to node v, if we can go from configuration corresponding to u to configuration corresponding to v in one move. Now following algorithm solves HAPPY-CAT. 1. Mark all nodes (a, a, x) where a is a node in G, and x {true, false}. 2. If for a node u = (a, b, ture), there is a node v = (c, b, false) which is marked and (u, v) is an edge then mark u. 3. If for a node u = (a, b, false), all nodes v = (a, c, false) are marked and (u, v) is an edge then mark u. 4. Repeat steps 2 and 3 until no new nodes are marked. 5. Accept if start node s = (c, m, true) is marked. The algorithm takes O(n 2 ) time to perform step 1, O(n 2 ) time per iteration of the loop and loop is executed O(n 2 ) times. Hence runs in polynomial time. Solution. We know that the class L contains all problems requiring only a fixed number of counters/pointers to solve them. The language A requires one counter. Initially, the counter is 0, and, as the head moves to the right along the tape, the counter is incremented by 1 if the symbol read is (, and it is decremented by 1 if the symbol read is ). If the counter ever becomes negative we reject the string (more closing parentheses then opening ones). If the counter is positive after reading the last symbol in the string, we reject (more opening parentheses then closing ones). Otherwise, we accept.
Solution I show that BIPARTITE NL. Since NL = conl, the desired result follows. An undirected graph G is not bipartite, if and only if G contains an odd cycle. Given G, we then search for odd cycles non deterministically using log-space. First nondeterministically choose a vertex u V(G) and remember u till the end of all branches of computation originating from the selection of u. Also maintain a current vertex v and a count i. Initially set v := u and i := 0. While i < m (where m is the number of vertices in G) repeat: If v has degree 0, reject, else nondeterministically choose an edge (v, v0) E(G). Increment i and set v := v0. If i is odd and v = u, accept. Otherwise, repeat the loop with the new v. If the loop terminates (i.e., if i > m), reject. It is clear that this nondeterministic algorithm detects odd cycles in G. On the other hand, if G does not contain an odd cycle, all branches of computation reject. We need to provide storage only for the vertices u, v, v 0 and for the counter i. This can be achieved in log-space only.
First, A_NFA is in NL, as we can, on input NFA M and x, non deterministically choose one next state transition. The variables recording "how much of x has been read" and "what state M is in" are only logarithmically long. To show A_NFA NL-hard, we need only show that PATH log-space reduces to A_NFA: Given as input a directed graph G=(V,E) and two of its nodes, x and y, we construct an NFA N with its states corresponding to G's nodes, its transitions under alphabet 0 corresponding to G's directed edges. Then, for N's accepting state (the state representing y), we let it go back to itself on all input alphabets, and, for other states, upon reading a 1, we go into a "trap" state which is deemed to reject. It can now be shown that x goes to y in G iff on input 00...000 ( V of 0's), N accepts. This completes the proof.