Material from Recitation 1

Similar documents
Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Cardinality of Sets. Washington University Math Circle 10/30/2016

Lecture 5: The Halting Problem. Michael Beeson

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

Computer Sciences Department

Section 2.4 Sequences and Summations

Lambda Calculus and Computation

Recursively Enumerable Languages, Turing Machines, and Decidability

Cantor s Diagonal Argument for Different Levels of Infinity

A B. bijection. injection. Section 2.4: Countability. a b c d e g

Infinity and Uncountability. Countable Countably infinite. Enumeration

CS 531: Notes II. January 31, 2014

MITOCW watch?v=4dj1oguwtem

To illustrate what is intended the following are three write ups by students. Diagonalization

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions.

English for Computer Science

The Size of the Cantor Set

Enumerations and Turing Machines

Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml

CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

MATHEMATICS 191, FALL 2004 MATHEMATICAL PROBABILITY Outline #1 (Countability and Uncountability)

Let A(x) be x is an element of A, and B(x) be x is an element of B.

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in .

Comparing sizes of sets

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

UNIT 14C The Limits of Computing: Non computable Functions. Problem Classifications

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

CSE 120. Computer Science Principles

1.7 The Heine-Borel Covering Theorem; open sets, compact sets

Problems, Languages, Machines, Computability, Complexity

Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Today, we will dispel the notion that Java is a magical language that allows us to solve any problem we want if we re smart enough.

CS103 Handout 50 Fall 2018 November 30, 2018 Problem Set 9

Reflection in the Chomsky Hierarchy

Turing Machine Languages

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

EDAA40 At home exercises 1

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

Cardinality Lectures

CS103 Spring 2018 Mathematical Vocabulary

Lecture 1. 1 Notation

CS 125 Section #4 RAMs and TMs 9/27/16

14.1 Encoding for different models of computation

Slides for Faculty Oxford University Press All rights reserved.

Lecture 18: Turing Machines

p x i 1 i n x, y, z = 2 x 3 y 5 z

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

Notes on Turing s Theorem and Computability

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

Nonstandard Models of True Arithmetic. other models of true arithmetic (the set of sentences true in the standard model) that aren t

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Time Complexity of an Algorithm

Equivalence of NTMs and TMs

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

2.1 Sets 2.2 Set Operations

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

2. Functions, sets, countability and uncountability. Let A, B be sets (often, in this module, subsets of R).

Order from Chaos. University of Nebraska-Lincoln Discrete Mathematics Seminar

Topology and Topological Spaces

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

1 Introduction CHAPTER ONE: SETS

Order from Chaos. Nebraska Wesleyan University Mathematics Circle

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

The Big Picture. Chapter 3

Typing Control. Chapter Conditionals

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

Proofwriting Checklist

Nagual and Tonal Maths: Numbers, Sets, and Processes. Lukas A. Saul Oxford, England May, 2015

HW 1 CMSC 452. Morally DUE Feb 7 NOTE- THIS HW IS THREE PAGES LONG!!! SOLUTIONS THROUGOUT THIS HW YOU CAN ASSUME:

CS21 Decidability and Tractability

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

Chapter 3. Set Theory. 3.1 What is a Set?

6. Advanced Topics in Computability

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

Theory of Programming Languages COMP360

CISC 4090 Theory of Computation

Lecture 2 Finite Automata

Hinged Sets And the Answer to the Continuum Hypothesis

Theory of Computation

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem.

Lecture 1: Overview

We will show that the height of a RB tree on n vertices is approximately 2*log n. In class I presented a simple structural proof of this claim:

Using Arithmetic of Real Numbers to Explore Limits and Continuity

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

III. Supplementary Materials

Lecture 3: Constructing the Natural Numbers

THEORY OF COMPUTATION

CS402 - Theory of Automata Glossary By

Computability Summary

Transcription:

Material from Recitation 1 Darcey Riley Frank Ferraro January 18, 2011 1 Introduction In CSC 280 we will be formalizing computation, i.e. we will be creating precise mathematical models for describing computation. A large part of the course will involve developing these models. We will start out with extremely simple mathematical machines (finite automata) and work up to much more complex ones (Turing machines). Automata theory is the branch of CS theory which explores mathematical models of machines. Once we have made computation mathematically precise, we can prove various facts about what can and cannot be computed. One of the surprising facts that arises from this endeavor is that some problems are undecidable, which means roughly that you can t make a computer program to solve those problems. No matter how big, fast, or smart computers get, they will never be able to solve these undecidable problems. The branch of CS which studies which problems can be computed is, unsurprisingly, called computability theory. Of the problems which can be computed, some are easier to solve than others. Harder problems require more time and space to solve. Complexity theory is the branch of CS which studies how easily different problems can be solved. In CSC 280 you will be introduced to these three branches of computer science theory. 2 Undecidability and Diagonalization As noted in the previous section, some problems are undecidable. Here, we give a proof that undecidable problems exist. In the next section, we ll give an example of a famous undecidable problem known as the Halting Problem. The proof that undecidable problems exist relies on the concept of countable vs. uncountable infinite sets. 2.1 Countable and Uncountable Sets Suppose you want to determine whether two sets contain the same number of elements. For finite sets, this is easy - you can just count everything in the first set, then count everything in the second set, and see if those two numbers are equal. But this doesn t work for infinite sets, and so we have to develop a new way to compare the size of sets. We can do this by pairing up elements from each set. If every element in the first set corresponds to exactly one element in the second (mathematically we call this a bijection), then the two sets have the same number of elements. This is obvious for finite sets: given sets A = {a 1,., a n } and B = {b 1,., b n }, you can assign each element from B to a single element of A. 1

A B a 1 b 1 a n b n It is equally intuitive that the set of positive integers is the same size as the set of negative integers. + 1 1 2 2 3 3 This bijection corresponds to the function f(x) = x. However, there are also some completely counterintuitive results. For instance, it turns out that there are just as many positive even integers as positive integers. This seems strange, since the first is a strict subset of the second. But the bijection f(x) = 2x pairs every element from the positive integers with exactly one element from the even positive integers: All Even 1 2 2 4 3 6 Even stranger, it turns out that the set of rational numbers has the same size as the set of integers, even though there are infinitely many rational numbers between every pair of integers. If the rationals have the same cardinality as the positive integers, we might start to think that all infinite sets are the same size. But it turns out that this isn t the case. It can be proven that there is no bijection from the positive integers to the real numbers. We call all infinite sets which have a bijection to the positive integers countable; we call those which do not uncountable. We ll prove that there are some problems that can t be solved by a program by showing that there are uncountably many problems, but only countably many programs. First, however, we need to determine a mathematically precise definition of problem and program. We will represent programs as unique binary strings, kind of like byte code after a high-level program has been compiled. To represent problems, we need to define formal languages. 2.2 Formal Languages A formal language is just a set of strings. These strings, like the strings you ve seen in Java and C, are finite sequences of characters. The characters are taken from some alphabet, which we denote Σ. 2

If a formal language contains only finitely many strings, we can describe the language by listing every string. Alternatively, for languages with an infinite number of strings, we can describe the language by explaining which strings it contains. Here are some examples of formal languages over the alphabet Σ = {0, 1}: {0, 1, 01, 11, 000} The set of all strings with an even number of 0s. The set of all strings whose first character is 1. In 173, you saw that some formal languages can be represented using regular expressions. For instance, the set of all strings whose first character is 1 could be written as 1Σ. This same language could also be recognized by a finite automaton. In CS theory, we like to represent all problems as formal languages, although most of these formal languages require more complicated descriptions than regular expressions can provide. Similarly, we like to represent all programs as machines which accept some formal language (and reject any string not in that formal language), although most of these machines are more complicated than finite automata. If all formal languages were decidable by some machine (i.e. if all problems could be solved by some computer program), then there would exist some bijection between formal languages and programs. We will prove that such a bijection cannot exist. 2.3 Diagonalization Proof that Some Formal Languages are Undecidable First we will show that there are a countably infinite number of programs. Then we will prove that there are an uncountably infinite number of formal languages. The proofs given here are rather informal. Theorem: The set of all programs is countably infinite. Proof: There are infinitely many programs, but each program has finite length, and there are only finitely many programs of each length. Thus, to create a bijection between programs and positive integers, we can first list all the programs of length 1, then list all the programs of length 2, and so on. Theorem: The set of all formal languages is uncountably infinite. Proof: First note that the set of all finite strings is countably infinite, for the same reason that the set of all programs is countably infinite. Thus, we can list all the finite strings in an infinite list: 0 1 00 01 10 11 000. We can describe a formal language using an infinite binary string. The nth bit of the string will be 1 if the language contains the nth string in the list above, and 0 if it does not. The language containing all strings whose first character is 1 would look like this: 0 1 00 01 10 11 000. 0 1 0 0 1 1 0. If the set of all formal languages were countably infinite, then we could list all of the formal languages in a table, like this: 3

0 1 00 01 10 11 000. 1 1 1 0 1 0 1 1. 2 0 0 1 0 0 0 0. 3 0 1 0 0 1 1 0.... To show that it is in fact uncountably infinite, we need to construct a formal language that can t possibly be in this table. This formal language will need to differ from each formal language in the table in at least one place. We accomplish this by making a new language, where the nth bit is the opposite of the nth bit of the nth language in the table: 0 1 00 01 10 11 000. 1 1 1 0 1 0 1 1. 2 0 0 1 0 0 0 0. 3 0 1 0 0 1 1 0. 0 1 1. Here, the red row at the bottom is the language that cannot possibly be contained in the table. Thus it is impossible to create a bijection between the positive integers and the set of all formal languages, so the set of all formal languages is uncountable. The technique used to prove this is called diagonalization, and it was first used by Cantor to show that the real numbers are uncountable. In fact, Cantor was the one who discovered uncountably infinite sets. Because there are countably many programs, and uncountably many formal languages, there must be some formal languages which cannot be recognized by any program. These languages are called undecidable. 3 Example: The Halting Problem The most famous example of an undecidable problem is the Halting Problem; its undecidability was proven by Turing. Consider the formal language A T M = {< M, x > M halts on x}. Here, < M, x > is the binary representation of a machine M, followed by x, a binary string. The string < M, x > is in the language if and only if machine M halts when run on x. We will prove by contradiction that A T M is undecidable. First we assume that A T M is in fact decidable. If this is the case, then we can build a machine H that decides A T M. H will return true if M halts on x, and false otherwise. Now construct a second machine, D, which takes as input a machine < M > and works like this: Run H on < M, < M >> If H returns true, loop forever. If H returns false, halt and return true. 4

Basically, D takes a machine M and checks, using H, whether M halts when run on the binary representation of itself; then it does the opposite of whatever M does when run on itself. If M halts on itself, D will loop forever, and if M loops forever, D will halt. Now suppose we run D on itself. This creates a paradox: If D halts when run on itself, D will loop forever when run on itself. If D loops forever when run on itself, then D will halt when run on itself. Clearly, D cannot exist! We arrived at this paradox by assuming that H existed, since the existence of H allowed us to build D. Since we can t build D, H must not exist! Thus, the language A T M, often known as the Halting Problem, is undecidable. 5