Computation and Complexity
What are recursive languages
- 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
How do you solve the reachability problem
- Any path within the graph that is longer than the number of vertices means there is a cycle in the path - A non-cyclic path must be shorter than the number of vertices and won't traverse 1 vertex twice - The machine guesses which vertex to traverse next, the machine also checks how many vertices have been traversed, if it becomes equal to the number of vertices we discard this path
How do you prove that if a language L is recursive its compliment is as well
- Create a Machine M1 that contains the machine for language L - All accepting states in machine ML are made un-accepting in M1 - Introduce a new accepting state r in M1 - For all combinationis (Q,S) for which there is no transition in ML, we put in M1 a transition to r - The result is a machine that accepts any string that ML would've rejected and rejects any string that ML would've accepted
What 3 elements make up each instantaneous description and how are they written
- 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
When does a non deterministic turing machine accept an input
- 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
How would you represent a Turing machine with multiple tracks with a Turing machine with memory in a state
- 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
How would you encode a transition function of a TM in a binary string
- 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
What are recursively enumerable languages
- The set of languages that can be recognised by a Turing machine. - A TM will stop to say yes and accept the input, however there is no guarantee that it will stop in finite time to say no and reject the input - Therefore these languages can be recognised but not decided
Prove the existence of undecidable problems
- 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
Why is reachability an NLSpace problem
- We only need to store the current number of vertices and won't traverse 1 vertex twice (no need to store the path as if the current vertices becomes equal to the destination at any time we return true, the problem only requires us to know if a path is possible, not what the path is)
How can you convert a non deterministic TM to a deterministic TM
- 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 can a multi-tape machine be represented by a multi-track machine
- 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.
What is a Turing Machine with multiple tracks
A Turing machine where the tape has multiple columns in it
What is NP-Hardness
A language L is NP-Hard if for all languages L1 in NP there exists a polynomial reduction from L1 to L
What is a Co-NP problem
A language L is in Co-NP if L is the complement of a language in NP
How can we define NP languages using a binary relation
A language is in NP if a relation as such can be defined
What is the worst case performance scenario for when a multi-track machine performs 1 step.
A 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.
How do we prove NP-Hardness
A 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
Why is QBF Pspace complete
A recursive procedure can solve it which will try all required combinations, a polynomial number of recursive calls is required that can be store in a polynomial space.
What is the independent set problem
A set of vertices on a graph that aren't connected by any edge is an independent set
What is the Kernel problem
A set of vertices such that no vertices are adjacent. But all other vertices in the graph are adjacent to at least one vertex in the kernel
Compare a Turing machine to a Deterministic finite state automata
A 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
What is Logspace
All problems solvable in logarithmic space
What is the class PSpace
All problems that can be solved using a deterministic TM with a worktape of polynomial size.
What is the meaning of the most common characters used in turing machine transition graphs
Alpha is commonly used to represent any character (althrough you should define which characeters at the start of the graph e.g. alpha = {a,b,c,d}) a b with a slash through it is the blank character
What is Complexity
Among solvable problems, which problems are easy and which are hard to solve. How much time and space is needed to solve them
Show that NP is a subset of Pspace, do we know if there are equal
An 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
What are undecidable languages
Any languages that aren't recursive
What is the time complexity of the simulation of a multi-tape machine on a multi-track machine and how is it calculated
By 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 vertex cover problem
C 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 universal language
Each 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.
How would you prove that a language cannot be decided by a TM
Enumerate every possible TM and show that none of them accept the given language
How do you check if properties are non trivial
Essentially, in order to check if a property is trivial, just check if there is a TM that satisfies it and if there is a TM that does not satisfy it. If both kinds exist, then the property is nontrivial.
What are the consequences of P=NP
Every NP problem would be solvable by means of a polynomial time algorithm. Since finding the factors of a composite integer is NP, this means that currently secure cryptographic algorithms, which depend for their security on the impossibility of factoring large integers quickly, would become insecure. In general, in order to be able to find solutions effectively, it would be sufficient to be able to verify solutions efficiently (since this makes the problem NP and therefore P)
What is the Church-Turing thesis and has it been proved
Everything that can be computed can be computed by a Turing machine. It hasn't been proven
Give a Pspace complete problem that can be throught of as an instance of QBF
Generalised 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
What is a polynomial reduction
Given 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 the decision problem of an independent
Given a graph and a number k, is it true that a graph has an independent set of size at least k
What is the Halting Problem
Given a program and an input <P,I>. Is it true or not that this program P stops when given the input I. A program halts or stops when it enters a state where there is no move in that situation
What is the reachability problem
Given a source s and a destination vector t, determine whether a path between the 2 vectors exist
What is the design philosophy of ND TMs
Guess and Check. We guess a potential solution and then check if it is correct. If there is a guess that will fit the requirements then the machine will non deterministically choose that path and accept the input
Why are recursive languages called recursive languages
Historically a recursive algorithm was required to decide a language, if a recursive algorithm couldn't be found then they couldn't be decided
How do you prove that the diagonalisation language is undecidable
If there exists a Turing machine to decide Ld then the characteristic vector of the reversed diagonal would be found as a row in the table comparing all languages to all strings. However this is impossible because for every row of the table the ith character will be the opposite of the one found in the table, as Ld is the REVERSED diagonal.
What is the diagonalisation language
If we take the diagonal of the table comparing all languages to all strings and reverse it this can be interpreted as the characteristic vector of the language Ld.
How do you find the space used by a Turing machine in a calculation
In a Turing machine, the amount of cell used on the worktape is equal to the amount of space used
What is a complexity class
It is a set of languages
What is a binary relation
It is a set of pairs of strings
What is an instantaneous description
It is a way of representing the steps that a Turing machine would take when processing a specific input.
What is the complexity class of the simulation of a non det TM on a det TM
It is exponential, whereas the non det TM itself carries out the computation in polynomial time
What is the consensus on P=NP
It is generally believed that problems exist only in NP and not in P, however we cannot prove this
Is Ld's compliment in RE, and why
It is in RE. As you can simulate its computation using the universal machine which would answer yes in final time.
Is Lu's compliment in RE, and why not
It 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 halting problem comutable
It is not. We're unable to write an algorithm capable of checking whether a program will halt when given a specific input
What the QBF, quantified boolean formula problem
It 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 is the compliment of a language
It is the inverse of a language, every sting accepted be the original language will be rejected by the compliment and vice versa
What does M |= w mean
It means that a machine accepts a string w
What is the benefit of encoding TM's as binary strings
It means that we're able to enumerate every possible machine be enumerating binary numbers
How would you define the halting problem as a language
LH : {<P,I>} P is a program where I is an input that causes the program to halt
Is Lu in RE
Lu is in RE, it is able to answer yes in final time
How can we characterize NP problems
NP 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
What are the consequences of P != NP
No NP-complete problem would be solvable by means of a polynomial time algorithm. Currently secure cryptographic algorithms may remain secure (N.B integer factorisation is not currently known to be NP-complete, so this is not certain) Research effort should be devoted to looking for efficient algorithms which, while not guaranteed to deliver correct solutions in every case, are guaranteed either to deliver approximately correct solutions or to deliver correct solutions with high probability.
Can we prove that Pspace and Ptime aren't equal
No, a machine that solves a problem that is in Pspace but not in Ptime has never been found
Is the diagonalisation language RE
No, it isn't RE as no TM can accept it.
What is the space complexity of the reachability problem
Non deterministic log space problem
How does the definition of a non-det turing machine differ from a det turing machine
Non-det machines have a transition relation rather than a transition function. The different definitions are shown below
What is NPSpace, how does it relate to Pspace
Non-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 the time complexity upper bound
O(f(n)) if there exists an algorithm A solving P such that TA(n) is O(f(n))
What does the fact we can simulate non-det TMs as det TMs say about P=NP
Our simulation takes exponential time. so it doesn't prove that P=NP. However it doesn't prove the opposite as a different det TM could be used to solve the problem in polynomial time, it just shows that our simulation of a ND TM isn't good enough.
What are 3 conclusions about CO-NP problems and NP problems that are widely believed but we can't prove
P != NP, P = NP n CO-NP, NP = CO-NP
What is the relation between P, NP and Pspace
P is a subset of NP which is a subset of Pspace
What is Savitch's Theroem and what is the intuition behind it
PSpace = 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 are Pspace complete problems and give an example
Problems that are at least as difficult as all other Pspace problems. Quantified Boolean formula
What are search problems
Problems where you need to compute solution
What is the relationship between Pspace and Ptime
Ptime 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
Why should reductions be polynomial
So that we can draw conclusions about the complexity of the problems. This is because given all NP problems are in theory solvable in polynomial time, an exponential reduction doesn't allow us to easily compare the complexity of problems
What are decision problems
Something where 2 solutions are possible - yes or no
What is the property of transitivity of polynomial reductions
Taking 3 languages, if there is a reduction from 1 to 2, and 2 to 3 then there exists a reduction from 1 to 3.
Explain how you would build the TM for the universal language
Tape1: The machine and input pairs, distinguish between them by placing 3 1s between them Tape2: The input encoded as a series of 1s and 0s Tape3: The current state of the machine, in state qi there are i 0s after the first 1 Tape4: 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
What is the Antivirus problem
The 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:.
When is a language NP-complete
The language is in NP - membership condition L is NP-Hard - (Hardness condition)
Define the diagonalisation language using standard notation
The language that doesn't accept its own encoding as an input string. Given its own encoding can't be accepted by any TM
What is the running time of a non det TM
The maximum number of steps that could be carried out while processing an input - the deepest branch of the computational tree
What is the running time of a machine M over an input string W
The 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 property about the hardness of the problems in a reduction
The 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 important about logspace problems
The problems that can be solved efficiently by parallel machines are contained within Logspace. A very small subset of problems.
When is a binary relation polynomially balanced
The second column is at most a polynomial of the length of the item in the first column
How do we normally represent languages succinctly
The standard representation is infinite, so we use the Turing machine that accepts them instead
What is the time complexity of a machine M
The 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 are the advantages of multi-tape Turing machines
They are faster than standard machines
Can non-det turing machines exist
They cannot physically exist, they are simply a mathematical model of computation used to determine the computability of problems
What features defines Co-NP Problems
They have concise certificates where we can answer no in polynomial time. Rather than NP problems where we can answer yes
What do curly braces notate on Turing machine transition graph
They represent moves that are a valid transition and are mutually exclusive
What are multi-tape Turing machines
They support multiple tapes each with heads that can move independently. Tapes cannot be added during operations, they must be defined at design time.
How do you notate the transition graph for a Turing machine that stores a value in its state
This machine stores a value alpha, and only allows self-transitions within q1 is the value in the input is not equal to alpha. Then when the input is blank a final transition to the accepting state is made
What is the relation between vertex cover and independent set
Vertices 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.
How can we exploit the properties of compliment languages. When does this exploit not work giving an example.
We 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
What is the relation between Logspace and Pspace. What is important about this relation
We 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.
When does a deterministic turing machine accept an input
When a symbol halts in an accepting state after consuming all the input symbols
How do you write the transition graph for a turing machine with multiple tracks
Where each term within a square bracket is one track on the tape.
What is Computability
Whether a problem can be solved by an algorithm in feasible time. This allows us to distinguish between solvable and unsolvable problems
How do you define a language
Within a set of {} you initially define the elements of the language, then after a | you set out the rules that govern the language
If a language is recursive is its compliment
Yes it is recursive
Can a machine with memory in state be rewritten to a standard machine
Yes, both have the same computational power
How do you prove a reduction, giving an example
You need to prove that it works in both directions. For 3-col to SAT you need to prove: 1. given a 3-col graph, the reduction produces a satisfiable formula 2. if a sat formula is produced, prove that this must have been derived from a 3-col graph
When is a binary relation polynomially decidable
a pair (x,y) can be determined whether it is in R in polynomial time using a determinstic Turing machine
What is a property
a set of languages e.g. languages that can be defined by turing machines with 8 states
Explain the function of /s and arrows in Turing machines transition graphs
a slash represents a replacement, an arrow represents the head of the machine moving in a direction along a tape
How many steps can a Pspace machine support
an exponential amount of steps
What is the decision version of the vertex cover problem
is it true that there is a vertex cover smaller than size for graph g
What is the P complexity class
is the complexity class of decision problems that can be solved by deterministic TM in polynomial time, with respect to the size of the input
What is the NP (non-deterministic polynomial) complexity class
is the complexity class of decision problems that can be solved by non-deterministic TM in polynomial time, with respect to the size of the input
What is the characterisation vector of a language
it 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 NLSpace complexity class
non deterministic log space, all problems solvable by ND TMs in logarithmic space.
How would we represent all possible strings and TMs and compare them.
plot 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
What are the trivial properties of RE
the empty property containing no languages and the property containing all languages
What does L(M) means
the language accepted by a turing machine M
What is the meaning of w ɛ L(M) <-> M |= w
w is a member of the language accepted by turing machine M. If and only if w is accepted by the machine M
Given Rice's Theorem what properties are non trivial
where {0} is the empty language
Can you represent all decision problems as a language
yes
Write the formal definition of a Turing machine and its transition function
{R,L} represents right and left
What is the Library Problem
· An instance of the library problem is a set of people, a set of books, and a wishlist of books for each person and an integer k. An instance is positive if and only if there is a set of k people where all of their requests on their wishlists can be met without any clashes
Give the formal definition of reduction
· 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
What is the time complexity lower bound
Ω(f(n)) if given any algorithm to solve P, TA(n) is Ω(f(n))