Download presentation
Presentation is loading. Please wait.
1
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 1 Some tools Our circuit C will consist of T ( n ) levels. For each time step of the Turing machine M, one level of our circuit will emulate the behavior of M. Level l will contain the gates computing the Boolean function H ( i, l ), C ( i, j, l ), S ( k, l ) for 1 i T ( n ). Note that, we don’t know exactly how M recognizes L, but in our circuit C, we capture all possible steps of M at every level.
2
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 2 Some tools The number of gates at every level is T ( n ). We will first specify H ( i, 0 ), C ( i, j, 0 ), S ( k, 0 ). These are the inputs to our circuit. We will then show how to express H ( i, t + 1), C ( i, j, t + 1), S ( k, t + 1) in terms of H ( *, t ), C ( *, *, t ), S ( *, t ). This will give us a correct description of the circuit C.
3
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 3 Input gates for our circuit For t = 0, the tape head is scanning cell 1, the input bits are stored in cell 1 to n and M is in state q 1. H ( i, 0 ) = 1 if i = 1, 0 otherwise. Since, the head is scanning cell 1. C ( i, j, 0 ) = 1 if cell i contains initially a j. S ( k, 0 ) = 1, if k = 1, 0 otherwise.
4
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 4 Gates at a general level Let us consider constructing H ( i, t +1) when we know H ( *, t ), C ( *, *, t ), S ( *, t ). H ( i, t +1) = 1 if and only if the head scans cell i at time t +1. Since the Turing machine M moves its head only one cell at each time step, It must be either on cell i - 1 or on cell i + 1 at time t. Let us consider the case when the head is at cell i - 1 at time t
5
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 5 Gates at a general level H ( i, t +1) = 1 if and only if the head moves right and goes to cell i at time t +1. Suppose the content of cell i - 1 is a j and the Turing machine M is in state q k. Hence, to move the head to cell i, our transition function should be such that: ( q k, a j ) = ( , , R ). That is, if the current state is q k and cell i - 1 contains character a j, the head moves right.
6
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 6 Gates at a general level Suppose, I R is the set of all pairs {( k, j ) : ( q k, a j ) = ( , , R )}. We do not know the exact movement of the head of M when M recognizes L. So, we have to take into account all possible state transitions that may result in the head moving to cell i at time t + 1. Consider a pair ( k, j ) I R.
7
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 7 Gates at a general level For the pair ( k, j ) I R, the action of the Turing machine M can be written as: C ( i - 1, j, t ) S ( k, t ) Hence, if –the head of M is at cell i – 1 –cell i – 1 contains the character a j, and –M is in state q k, The head of M will move to the cell i if and only if: H ( i - 1, t ) ( C ( i - 1, j, t ) S ( k, t )).
8
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 8 Gates at a general level But we do not know the state of M or the content of cell i - 1 at time t. Hence, we have to consider all possible states and all possible characters in cell i - 1. We can write this as: This takes into account all possible characters a j in cell i - 1 and all possible states q k of M so that the head moves to cell i.
9
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 9 Gates at a general level Similarly, we have to take into account the cases when the head of M is in the cell i +1 at time t and moves to cell i at time t +1. The complete specification is:
10
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 10 A view of the circuit A view of the circuit for H(i,t+1) H(i,t+1)H(i+1,t+1)
11
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 11 Complexity of creating H(i,t +1) Hence, H ( i, t +1) can be expressed as a sequence of AND and OR gates of length O (| Q || |) = sm. If we consider the number of states | Q | = s of M and the size of the alphabet | | = m as constants. We can compute all the H ( i, t +1)s (remember, 1 i T ( n )) in O (1) time using ( T ( n )) 2 processors. This is clearly an NC algorithm.
12
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 12 C(i,j,t +1) Recall that C ( i, j, t +1) represents the fact that cell i contains a j at time t +1. Hence, C ( i, j, t +1) = 1 if either, –cell i contains a j and the tape head does not scan cell i at time t, or, –the tape head writes a j in cell i at time t +1.
13
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 13 C(i,j,t +1) Hence, C ( i, j, t +1) = where, Hence, C ( i, j, t +1) can be expressed as a constant-length sequence of AND and OR gates. All the C ( i, j, t +1) s can be computed in O (1) time using O (( T ( n )) 2 ) processors.
14
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 14 A view of the circuit A view of the circuit for C(i,j,t+1) C(i,j,t+1)C(i+1,j,t+1)
15
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 15 S(k,t +1) Recall that, S ( k, t +1) = 1 if and only if the state of M is q k at time t +1. Let ( k’, j ) is a pair such that,. In other words, if M is in state q k’, and the current character on the tape is a j, then M goes to state q k. Then,
16
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 16 S(k,t +1) Since, 1 i T ( n ), the function S ( k, t +1) can be expressed by a sequence of AND and OR gates of length T ( n ). Such sequences can be generated in O (1) time using O (( T ( n )) 2 ) processors. This concludes the construction of the CVP that is equivalent to a Turing machine M accepting an arbitrary language L P.
17
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 17 The value of the circuit The value of the circuit will be given by C (1, *, T ( n )). It is clear from the description that the circuit can be constructed by an NC algorithm, since T ( n ) is a polynomial in n. The output of the circuit is 1 if and only if M recognizes L. Since L is an arbitrary language in P, it follows that CVP is P-complete.
18
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 18 Implications If L 1 is NC-reducible to L 2 and L 2 is NC-reducible to L 3, then L 1 is NC-reducible to L 3. That is NC-reducibility is transitive. Let L be a P-complete problem. If L NC, then NC = P.
19
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 19 Proving other problems P- complete Let a language L be P-complete. If L is NC- reducible to another language L’ P, then L’ is also P-complete. This is used for proving P-completeness of many other problems. For example if we can reduce the CVP problem to another problem in P, that problem will also be P-complete. We conclude with a list of P-complete problems.
20
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 20 Proving other problems P- complete Ordered depth-first search : Given a directed graph G = ( V, E ) specified by adjacency lists and three vertices s, u, v, determine whether vertex u is visited before vertex v in the depth-first traversal of G starting at s.
21
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 21 Proving other problems P- complete Maximum flow : Given a network with integer-valued capacities and two distinguished vertices, the source s and the sink t, determine whether the value of the maximum flow is odd.
22
Advanced Topics in Algorithms and Data Structures Lecture 8.2 page 22 Proving other problems P- complete Linear inequalities : Given an n x m matrix, and an n -dimensional vector b, all entries being integers, determine whether there exists a rational vector x such that Ax b.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.