70 likes | 79 Views
Learn the intuitive notion of algorithms, their structure, encoding methods, Turing machines, and the Church-Turing thesis in CSC 4170. Dive into formal descriptions, implementation guidance, and high-level views. Understand the significance of algorithms in various tasks.
E N D
CSC 4170 Theory of Computation The definition of algorithm Section 3.3
3.3.a The intuitive notion of algorithms: An algorithm (procedure, recipe) is a collection of simple instructions for carrying out some task. Algorithms • Examples: • The elementary school algorithms for adding, subtracting, multiplying, • etc.; • Converting an NFA to an equivalent DFA, or a RE to NFA, or an • NFA to RE, etc.; • Calculating students’ GPAs; • Sorting algorithms; • Any other procedures Dr. Levitin taught you. To carry out an algorithm, you only need to mechanically (blindly) follow its instructions. No understanding of the objects you are manipulating, no understanding of what you are doing is needed! We need a strict mathematical definition of an algorithm. The above “definition” obviously does not qualify.
3.3.b The structure of an algorithm: Input(s) Output or Input(s) Yes (accept) or No (reject) Algorithms should deal with strings The attempt to formalize the notion of algorithm should start from strictly specifying what kind of objects can be inputs/outputs. These are going to be only. strings No loss of generality: non-string objects can be easily represented with strings. A tuple of such objects can also be represented with a (one single) string. After all, computers exclusively deal with strings --- strings over the alphabet {0,1} !
3.3.c Encoding Encoding--- representing objects as strings in some standard way. There are usually many ways to encode; as one encoding can be easily (algorithmically) converted into another, it does not matter which encoding we choose. Encoding numbers:0,1,2,3,…,34,…, or 0,1,10,11,…,100010,… Encoding pairs of numbers:(4,2), (1,3), …, or 4#2, 1#3,…, or aaabb, abbb, … Encoding people:“David Stewart”, “Dongfei Wei”, …, or “Stewart, David”, “Wei, Dungfei”, or 315-21-5541, 326-11-1521… Encoding assembly language instructions: Their machine language equivalents. If O is an object, <O> will stand for a (the) encoding of O.
3.3.d Encoding graphs 1 2 3 G = <G> = (1,2,3,4,5)((1,4),(1,5),(2,3),(4,5)) 4 5 Algorithm M for checking if a graph is connected: M = “On input <G>, the encoding of a graph G: 1. Select the first node of G and mark it. 2. Repeat the following stage until no new nodes are marked: 3. For each node in G, mark it if it is attached by an edge to a node that is already marked. 4. Scan all the nodes of G to determine whether they all are marked. If they are, accept; otherwise reject.”
3.3.e The Church-Turing thesis The Church-Turing thesis: (the intuitive notion of) Algorithm Turing machine = It can never be mathematically proven! Importance: Without the Church-Turing thesis, you can never prove that a certain problem has no algorithmic solution. Example - Hilbert’s 10th problem (see page 182).
3.3.f 1. Formal description: The TM is fully described, say, by giving a transition diagram, or list of states, input/tape alphabets, a table for the transition function. Examples: Slides 3.1.b, 3.1.f, etc. The three levels of TM descriptions 2. Implementation description: English is used to describe the way that the machine moves its head and stores data on its tape. Details of states or transition functions are not given. Example: Slide 3.1.h 3. High-level description: English is used to describe the algorithm, without worrying about implementation-level details. There is no mention of head, tape etc. Example: Slide 3.3d; All the algorithms taught in CSC 1700