Computability and Complexity 2 1 Problems and Languages
Computability and Complexity 2 -1 Problems and Languages Computability and Complexity Andrei Bulatov
Computability and Complexity 2 -2 Math Prerequisites —— Alphabets and Languag An alphabet is a (finite) set of symbols, e. g. ={0, 1}, ={0, 1, …, 9}, ={A, F, G, T}, ={a, b, c, …, z}, A string (or a word) over an alphabet is a (finite) sequence of symbols from , e. g. =0010110111, =314159, =FAGFTTAGT, =turingmachine Length of a string is the number of symbols in , denoted ( ). Empty is a string containing no symbols. The setstring of all non-empty strings over is denoted by The set of all strings over (including the empty string) is denoted b A language over alphabet is any subset of *, e. g.
Computability and Complexity Models of Computation To make statements about what can and cannot be computed we need to define a scientific model of computation We start with a very simple model which identifies 3 aspects of any computation: input proce ss output 2 -3
Computability and Complexity Input and Output We shall also make some other simplifying assumptions: Input is a sequence of symbols in some fixed alphabet. This means we need to define some way of encoding the description of our problem as a sequence of symbols Output is either: • A single bit indicating yes or no; (In this model we consider only decision problems — that is, problems which require a yes/no answer) • A sequence of symbols from the same alphabet as the input. (In this model we also allow search and optimisation 2 -4
Computability and Complexity Decision Problems In the first part of this course we will focus on decision problems The standard way to define a decision problem is to describe a generic instance, and a yes/no question about each instance. Reachability Instance: A finite directed graph G and vertices s and t Question: Is there a path from s to t? 2 -5
Computability and Complexity Examples — Graph Problems Euler Circuit Instance: A finite graph G. Question: Does G have an Euler Curcuit? - i. e. , a cycle that goes through each edge exactly once Euler, 1736 Hamilton Circuit Instance: A finite graph G. Question: Does G have a Hamilton Curcuit? - i. e. , a cycle that goes through each vertex exactly once Hamilton, 1850 2 -6
Computability and Complexity Examples — Graph Problems Clique Instance: A finite graph G and an integer K. Question: Does G have a clique of size K? - i. e. , a set of K vertices that are fully connected Colouring Instance: A finite graph G and an integer K. Question: Does G have a colouring with K colours? - i. e. , an assignment of colours to vertices such that adjacent vertices have different colours 2 -7
Computability and Complexity 2 -8 A Graph Problem Instance 1 2 10 3 4 5 6 7 8 9 • Does this graph have an Euler Circuit? • Does this graph have a Hamilton Circuit? • Does it have a clique of size 4? • Does it have a 3 -colouring?
Computability and Complexity 2 -9 Example Linear Programming Instance: An integer m n matrix M, vectors , and an integer B. Question: Is there a rational vector , and ? , such that
Computability and Complexity 2 -10 Example Travelling Salesperson(D) Instance: A finite set of cities , a positive integer distance between each pair , and an integer B. Question: Is there a permutation of such that
Computability and Complexity 2 -11 Encodings To input problems to a computer, each instance must be encoded in a string of symbols over some alphabet. To do this we need an encoding scheme. To ensure that encoding the problem does not change its essential nature, an encoding scheme must be concise: • Not add unnecessary information, or padding (e. g. the solu • Represent numerical information efficiently (not in base 1!)
Computability and Complexity Question What is a suitable encoding scheme for graphs? 2 -12
Computability and Complexity Languages For a decision problem , and an encoding scheme e with alphabet , the set of strings corresponding to instances with answer yes is denoted L( , e) and called the language associated with and e. Note that L( , e) * For decision problems we just want to decide if a given string belongs to L( , e) 2 -13
Computability and Complexity 2 -14 What is a computation? Alan Turing considered this question in 1936 He argued that any computation can be done using the following s • Concentrate on one part of the problem (for example, one piece of paper, one arithmetic operation, etc. ) • Depending on this, and present state of the computer: - Modify this part of problem; - Move to another part of problem; - Change into a new state. • Repeat this until finished.
Computability and Complexity Implications • If the computation can be described in a finite space, then there can be only a finite number of different situations to deal with • Therefore, there can be only a finite number of “states” and a finite number of “symbols”. • But note that the computation might continue forever and never finish, and it might use (potentially) infinite storage space 2 -15
- Slides: 15