CS 172: Computability and Complexity - Homework 2 - Prof. S. A. Seshia, Assignments of Com, Exams of Computer Science

CS 172: Computability and Complexity - Homework 2 - Prof. S. A. Seshia, Assignments of Computer Science

Typology: Exams

2025/2026

Available from 11/20/2025

cecil27
cecil27 🇺🇸

1.6K documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Can a machine with memory in state be rewritten to a standard machine - correct
answerYes, both have the same computational power
Can non-det turing machines exist - correct answerThey cannot physically exist, they
are simply a mathematical model of computation used to determine the computability of
problems
Can we prove that Pspace and Ptime aren't equal - correct answerNo, a machine that
solves a problem that is in Pspace but not in Ptime has never been found
Can you represent all decision problems as a language - correct answeryes
Compare a Turing machine to a Deterministic finite state automata - correct answerA
turing machine is capable of moving forwards and backwards along the string. Unlike a
deterministic finite state automate which can only move forwards
A Turing Machine has memory in the form of its tape. Which a DFA does not
Define the diagonalisation language using standard notation - correct answerThe
language that doesn't accept its own encoding as an input string. Given its own
encoding can't be accepted by any TM
Draw a diagram showing the relation between NP, PSpace/NPSpace, Ptime, ogspace
and R - correct answer
Explain how you would build the TM for the universal language - correct answerTape1:
The machine and input pairs, distinguish between them by placing 3 1s between
themTape2: The input encoded as a series of 1s and 0sTape3: The current state of the
machine, in state qi there are i 0s after the first 1Tape4: Temporary tape used for
copying and other operations If the head on tape 3 is pointing to an accepting state then
the input is accepted
Explain the function of /s and arrows in Turing machines transition graphs - correct
answera slash represents a replacement, an arrow represents the head of the machine
moving in a direction along a tape
Give a Pspace complete problem that can be throught of as an instance of QBF -
correct answerGeneralised versions of games such as checkers where the board can
be any size. Given that my opponent does any move, does an exist a move that allows
me to win, this could be represented as a QBF instance
Give the formal definition of reduction - correct answer· Given Two languages L1 and
L2, we say that there is a reduction from L1 to L2 or equivalently we say that L1 reduces
to L2, if there exists a computable function f such that:
where computable means we could design a turing machine to compute it
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CS 172: Computability and Complexity - Homework 2 - Prof. S. A. Seshia, Assignments of Com and more Exams Computer Science in PDF only on Docsity!

Can a machine with memory in state be rewritten to a standard machine - correct answerYes, both have the same computational power Can non-det turing machines exist - correct answerThey cannot physically exist, they are simply a mathematical model of computation used to determine the computability of problems Can we prove that Pspace and Ptime aren't equal - correct answerNo, a machine that solves a problem that is in Pspace but not in Ptime has never been found Can you represent all decision problems as a language - correct answeryes Compare a Turing machine to a Deterministic finite state automata - correct answerA turing machine is capable of moving forwards and backwards along the string. Unlike a deterministic finite state automate which can only move forwards A Turing Machine has memory in the form of its tape. Which a DFA does not Define the diagonalisation language using standard notation - correct answerThe language that doesn't accept its own encoding as an input string. Given its own encoding can't be accepted by any TM Draw a diagram showing the relation between NP, PSpace/NPSpace, Ptime, ogspace and R - correct answer Explain how you would build the TM for the universal language - correct answerTape1: The machine and input pairs, distinguish between them by placing 3 1s between themTape2: The input encoded as a series of 1s and 0sTape3: The current state of the machine, in state qi there are i 0s after the first 1Tape4: Temporary tape used for copying and other operations If the head on tape 3 is pointing to an accepting state then the input is accepted Explain the function of /s and arrows in Turing machines transition graphs - correct answera slash represents a replacement, an arrow represents the head of the machine moving in a direction along a tape Give a Pspace complete problem that can be throught of as an instance of QBF - correct answerGeneralised versions of games such as checkers where the board can be any size. Given that my opponent does any move, does an exist a move that allows me to win, this could be represented as a QBF instance Give the formal definition of reduction - correct answer· Given Two languages L1 and L2, we say that there is a reduction from L1 to L2 or equivalently we say that L1 reduces to L2, if there exists a computable function f such that: where computable means we could design a turing machine to compute it

Given Rice's Theorem what properties are non trivial - correct answerwhere {0} is the empty language How can a multi-tape machine be represented by a multi-track machine - correct answer- You can do this by having a multi-track machine that has double the amount of tracks as you had tapes on your multi-tape machine

  • 2 tracks are needed for each tape as one track is used to keep track of where the head of that tape on the multi-tape machine would have been. How can we characterize NP problems - correct answerNP problems can be solved using a guess + check method where the check can be carried out in linear time. All NP problems have a certification (correct solution) instance of the problem if their solvable. This certificate is concise and polynomially verifiable How can we define NP languages using a binary relation - correct answerA language is in NP if a relation as such can be defined How can we exploit the properties of compliment languages. When does this exploit not work giving an example. - correct answerWe can make recursively enumerable languages recursive. The machines for the compliment and base language can see if a string is accepted in final time. If the compliment's machine accepts the string then we can say that it is not a member of the base language.The fact we can say this makes the language decidable so it is recursive. Given both languages are recursively enumerable this guarantees that one of the machines will terminate.If a language is RE, it is not guaranteed that its compliment will be in RE as well. So this may not work, as is the case for the language Ld, where it is not RE, but its compliment is RE How can you convert a non deterministic TM to a deterministic TM - correct answer- We use 2 tapes- Copy the instantaneous description at the current state onto the second tape. If the current state is accepting you accept. If not then you add the instantaneous description of each possible next state transition from the current state onto tape 1. You then delete the current state from tape 2 and move the mark on tape 1 forwards to be just before the next state- This is essentially carrying out a breadth first search of all possible ways of traversing the non deterministic TM tree. How do we normally represent languages succinctly - correct answerThe standard representation is infinite, so we use the Turing machine that accepts them instead How do we prove NP-Hardness - correct answerA problem L is NP-Hard, if there exists an NP-Complete problem L1 such that L1 polynomially reduces to L. This works as if every NP-Complete can be reduced to L1 (given it is NP-Complete) then showing that L1 can be reduced to L shows that L is at least as hard as all NP problems so is NP- Hard

How does the definition of a non-det turing machine differ from a det turing machine - correct answerNon-det machines have a transition relation rather than a transition function. The different definitions are shown below How many steps can a Pspace machine support - correct answeran exponential amount of steps How would we represent all possible strings and TMs and compare them. - correct answerplot them on a table, with machines on one axis and strings on another. put 1 in a cell if a machine accepts a string and a 0 if it doesn't How would you define the halting problem as a language - correct answerLH : {<P,I>} P is a program where I is an input that causes the program to halt How would you encode a transition function of a TM in a binary string - correct answer- Start encoding with 1- Use a 1 to separate each step of the encoding- You need to encode the current state and input, then the new state, output and direction- Each rule is separate by two ones How would you prove that a language cannot be decided by a TM - correct answerEnumerate every possible TM and show that none of them accept the given language How would you represent a Turing machine with multiple tracks with a Turing machine with memory in a state - correct answer- Putting characters that are on multiple tracks next to each other on a single track. You then move between all those characters, storing them in memory. Then you can make a decision and move one.

  • You could also encode all possible pairs/tuples of symbols as a more complex language, which we could interpret on a single track machine If a language is recursive is its compliment - correct answerYes it is recursive Is Ld's compliment in RE, and why - correct answerIt is in RE. As you can simulate its computation using the universal machine which would answer yes in final time. Is Lu in RE - correct answerLu is in RE, it is able to answer yes in final time Is Lu's compliment in RE, and why not - correct answerIt is not in RE. Given Lu is in RE, if both were in RE then the language would be recursive, as you could combine the 2 machines to get a yes or no answer in final time. Is the diagonalisation language RE - correct answerNo, it isn't RE as no TM can accept it.

Is the halting problem computable - correct answerIt is not. We're unable to write an algorithm capable of checking whether a program will halt when given a specific input Prove that the halting problem is not computable - correct answer Prove the existence of undecidable problems - correct answer- We can write a number of algorithms equal to the set of natural numbers- Because machines are enumerable that means that 1 number can be associated with 1 natural number - so they are the same size- Languages/Problems can be represented as a characteristic vector. There are 2^(set of natural numbers) possible characteristic vectors - as there are 2 choices for each character in the vector and the size of the string can be up to the size of the set of natural numbers. Therefore there are 2^(set of natural numbers) problems. Which can be proved to be the size of the set of real numbers- Therefore there are more problems that algorithms so there will always be decidable problems Show that NP is a subset of Pspace, do we know if there are equal - correct answerAn ND TM takes a maximum of polynomial time. We can simulate one attempt on the non- det machine in polynomial space, if it doesn't work we can try again using the same space. Therefore NP is in Pspace. We don't know if these classes are equal Show the hierarchy of complexities - correct answer What 3 elements make up each instantaneous description and how are they written - correct answer- Current state

  • Current head position
  • Current input symbol The current state label moves along the input showing where the head is located on the input tape What are 3 conclusions about CO-NP problems and NP problems that are widely believed but we can't prove - correct answerP != NP, P = NP n CO-NP, NP = CO-NP What are decision problems - correct answerSomething where 2 solutions are possible - yes or no What are multi-tape Turing machines - correct answerThey support multiple tapes each with heads that can move independently. Tapes cannot be added during operations, they must be defined at design time. What are Pspace complete problems and give an example - correct answerProblems that are at least as difficult as all other Pspace problems. Quantified Boolean formula What are recursive languages - correct answer- A language for which a turing machine, given an input statement is always capable of saying yes or no in finite time, they are decidable and recognisable- An algorithm exists for these languages

What features defines Co-NP Problems - correct answerThey have concise certificates where we can answer no in polynomial time. Rather than NP problems where we can answer yes What is a binary relation - correct answerIt is a set of pairs of strings What is a Co-NP problem - correct answerA language L is in Co-NP if L is the complement of a language in NP What is a complexity class - correct answerIt is a set of languages What is a polynomial reduction - correct answerGiven 2 languages L1,L2 there is a polynomial reduction from L1 to L2 denoted by L1 ≤ L2, if there exists a function f() computable in polynomial time such that What is a property - correct answera set of languages e.g. languages that can be defined by turing machines with 8 states What is a Turing Machine with multiple tracks - correct answerA Turing machine where the tape has multiple columns in it What is an instantaneous description - correct answerIt is a way of representing the steps that a Turing machine would take when processing a specific input. What is Big Θ Notation - correct answer What is Complexity - correct answerAmong solvable problems, which problems are easy and which are hard to solve. How much time and space is needed to solve them What is Computability - correct answerWhether a problem can be solved by an algorithm in feasible time. This allows us to distinguish between solvable and unsolvable problems What is important about logspace problems - correct answerThe problems that can be solved efficiently by parallel machines are contained within Logspace. A very small subset of problems. What is Logspace - correct answerAll problems solvable in logarithmic space What is NP-Hardness - correct answerA language L is NP-Hard if for all languages L1 in NP there exists a polynomial reduction from L1 to L What is NPSpace, how does it relate to Pspace - correct answerNon-deterministic polynomial space. Problems decided by ND TMs using polynomial space. Pspace is a subset of NPSpace as ND TMs can always be simulated by deterministic TMs

What is Rice's Theorem, what is the language of a generic property of RE - correct answer What is Savitch's Theroem and what is the intuition behind it - correct answerPSpace = NPSpace. We can keep trying different branches of the ND TM reusing the same space each time. It can be shown that the simulation of an ND TM can be done in O(P(n)^2) space where the ND TM takes up O(p(N)) space What is the Antivirus problem - correct answerThe Antivirus (A) problem is defined as follows: give a Java function C, decide whether C is a virus or not. In order to decide whether a piece of code is a virus or not, we need to define what a virus is. For simplicity, we assume that a virus is a piece of code doing something "nasty". In this case, the nasty behaviour will be formatting the system hard-drive C:. What is the benefit of encoding TM's as binary strings - correct answerIt means that we're able to enumerate every possible machine be enumerating binary numbers What is the characterisation vector of a language - correct answerit is a binary vector which states which strings (from the enumerated list of all possible strings) are contained within a language, a character is 0 if the string is contained and 1 if it isn't. e.g. string 1 in the example is not contained What is the Church-Turing thesis and has it been proved - correct answerEverything that can be computed can be computed by a Turing machine. It hasn't been proven What is the class PSpace - correct answerAll problems that can be solved using a deterministic TM with a worktape of polynomial size. What is the complexity class of the simulation of a non det TM on a det TM - correct answerIt is exponential, whereas the non det TM itself carries out the computation in polynomial time What is the compliment of a language - correct answerIt is the inverse of a language, every sting accepted be the original language will be rejected by the compliment and vice versa What is the consensus on P=NP - correct answerIt is generally believed that problems exist only in NP and not in P, however we cannot prove this What is the decision problem of an independent - correct answerGiven a graph and a number k, is it true that a graph has an independent set of size at least k What is the decision version of the vertex cover problem - correct answeris it true that there is a vertex cover smaller than size for graph g

What is the property about the hardness of the problems in a reduction - correct answerThe problem that the initial one is reduced to must be at least as hard as the initial problem. Note that this is not a reversable property. ONLY THE FINAL PROPERTY IS AT LEAST AS HARD AS THE INITIAL. The problems are not as hard as each otherq What is the property of transitivity of polynomial reductions - correct answerTaking 3 languages, if there is a reduction from 1 to 2, and 2 to 3 then there exists a reduction from 1 to 3. What is the reachability problem - correct answerGiven a source s and a destination vector t, determine whether a path between the 2 vectors exist What is the relation between Logspace and Pspace. What is important about this relation - correct answerWe can say that logspace is a strict subset of Pspace, meaning that they are not equal to each other. Every other relation to reach this conclusion is not strict, or can't be proved to be strict. at some point in the image this relation becomes strict, but that point is unknown. What is the relation between P, NP and Pspace - correct answerP is a subset of NP which is a subset of Pspace What is the relation between vertex cover and independent set - correct answerVertices not in a vertex cover form an independent set, as in order for a vertex cover to be valid, 2 vertices outside of the cover cannot be connected, otherwise an edge would exist that isn't within the vertex cover. What is the relationship between Pspace and Ptime - correct answerPtime is a subset of Pspace. Because in Ptime it would be impossible if only a polynomial operations are carried out to use up more than polynomial amount of space What is the running time of a machine M over an input string W - correct answerThe number of steps that M performs while processing w before m stops. If M doesn't stop on W, then the running time of M over W is infinite What is the running time of a non det TM - correct answerThe maximum number of steps that could be carried out while processing an input - the deepest branch of the computational tree What is the space complexity of the reachability problem - correct answerNon deterministic log space problem What is the time complexity lower bound - correct answerΩ(f(n)) if given any algorithm to solve P, TA(n) is Ω(f(n))

What is the time complexity of a machine M - correct answerThe time complexity of a machine M is a function Tm(n) that is the maximum running time of M over any input string of length n What is the time complexity of the simulation of a multi-tape machine on a multi-track machine and how is it calculated - correct answerBy showing that the complexity calculated be each successive function is greater than the previous, we can state that the time complexity is at maximum the complexity of the final function, O(N^2) - polynomial What is the time complexity upper bound - correct answerO(f(n)) if there exists an algorithm A solving P such that TA(n) is O(f(n)) What is the universal language - correct answerEach pair is M, a string encoding of a TM and a string w which a machine accepts. A machine for this language would be able to say whether or not a machine would accept a given string. What is the vertex cover problem - correct answerC is a vertex cover of a graph g if for all edges of the graph, one end of each edge is in the set C What is the worst case performance scenario for when a multi-track machine performs 1 step. - correct answerA multi-track machine may have to perform 4m+2k steps. M is the maximum distance from the middle of the tape to the end. k is the total number of marks found on the tapes (the X marks used to mark the position of simulated heads). This is because if the machine has to move all the way from one end of the tape to the other and back again this takes 4m steps. Then if the mark has to be moved in the opposite direction to where it is travelling next it will move backwards then forwards, taking 2 moves. This may have to occur for each mark, so 2k. What the QBF, quantified boolean formula problem - correct answerIt is the Sat problem but with parameters placed onto finding satisfying assignments. e.g. the second instance in the example asks, regardless of what variable x is, y and z can be assigned in such a way to satify the formula What would be the stages to proving that all problems in NP belong to P - correct answer When does a deterministic turing machine accept an input - correct answerWhen a symbol halts in an accepting state after consuming all the input symbols When does a non deterministic turing machine accept an input - correct answer- If there is at least 1 way of processing the input in the machine that halts in an accepting state- Vice versa, if there is no way of processing the input that halts in an accepting state, then the input is not accepted