CSE 120. Computer Science Principles

Similar documents
Infinity and Uncountability. Countable Countably infinite. Enumeration

Material from Recitation 1

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

Recursively Enumerable Languages, Turing Machines, and Decidability

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

14.1 Encoding for different models of computation

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

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

Section 2.4 Sequences and Summations

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

MITOCW watch?v=4dj1oguwtem

What Every Programmer Should Know About Floating-Point Arithmetic

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

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

1 Elementary number theory

Phil 320 Chapter 1: Sets, Functions and Enumerability I. Sets Informally: a set is a collection of objects. The objects are called members or

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

Notes on Turing s Theorem and Computability

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

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

Lambda Calculus and Computation

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

CS 531: Notes II. January 31, 2014

Math Circles: Pigeons and Rams(ey)

CSE 105 THEORY OF COMPUTATION

Time Complexity of an Algorithm

Lecture 3: Recursion; Structural Induction

SECTION A (40 marks)

Introduction to the Theory of Computation, Sipser, PWS, ISBN X, 1996

Lec-5-HW-1, TM basics

CSE 105 THEORY OF COMPUTATION

Chapter 4. Number Theory. 4.1 Factors and multiples

Ramsey s Theorem on Graphs

Discrete Mathematics and Probability Theory Spring 2017 Rao Midterm 2

Chapter 1. Math review. 1.1 Some sets

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

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

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.

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

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

Theory of Languages and Automata

CSE 20 DISCRETE MATH WINTER

MATH 54 - LECTURE 4 DAN CRYTSER

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

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

Simple Graph. General Graph

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #17. Loops: Break Statement

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

4.1 Review - the DPLL procedure

Math Introduction to Advanced Mathematics

6. Advanced Topics in Computability

1 Elementary number theory

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

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

CS402 - Theory of Automata Glossary By

Divisibility Rules and Their Explanations

CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4

Lecture 7: the quotient topology

Lecture T4: Computability

Section 1.2 Fractions

Limits at Infinity

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

(Refer Slide Time 3:31)

Actually talking about Turing machines this time

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Plane Tilings. Richard P. Stanley M.I.T. Plane Tilings p.

Slides for Faculty Oxford University Press All rights reserved.

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

CS61A Lecture 38. Robert Huang UC Berkeley April 17, 2013

Chapter 1: Number and Operations

6th Bay Area Mathematical Olympiad

Problem One: A Quick Algebra Review

Iron County Schools. Yes! Less than 90 No! 90 No! More than 90. angle: an angle is made where two straight lines cross or meet each other at a point.

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

1.7 Limit of a Function

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

Turing Machine Languages

Definition MATH Benjamin V.C. Collins, James A. Swenson MATH 2730

Theory of Computations Spring 2016 Practice Final Exam Solutions

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion

4&5 Binary Operations and Relations. The Integers. (part I)

Chapter 12. Computability Mechanizing Reasoning

THE HALTING PROBLEM. Joshua Eckroth Chautauqua Nov

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

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?

CSE 505: Concepts of Programming Languages

1 Algorithm and Proof for Minimum Vertex Coloring

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Lecture 4 CSE July 1992

CSC-461 Exam #2 April 16, 2014

Lecture Transcript While and Do While Statements in C++

Denotational semantics

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

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

(Refer Slide Time: 0:19)

Lecture 4 Hierarchical clustering

CSE 417 Network Flows (pt 4) Min Cost Flows

Algorithms. Chapter 8. Objectives After studying this chapter, students should be able to:

Transcription:

Adam Blank Lecture 17 Winter 2017 CSE 120 Computer Science Principles

CSE 120: Computer Science Principles Proofs & Computation e w h e q 0 q 1 q 2 q 3 h,e w,e w,h w,h q garbage w,h,e

CSE = Abstraction 1

CSE = Abstraction 2 At the very lowest level is hardware which Justin has talked about. At the very highest level is Theory which is what today is about!

To Infinity And Beyond! 3 In this lecture, we will explore the abstract! And we will apply it to computation! But we start simple... How many numbers are there?

To Infinity And Beyond! 3 In this lecture, we will explore the abstract! And we will apply it to computation! But we start simple... How many numbers are there?... Infinity, of course!

The Biggest Number Ever 4 What s the biggest number you can name?

The Biggest Number Ever 4 What s the biggest number you can name? 0, 1, 2,..., 4000000000000000,... If you give me a number, I can get a bigger one by adding 1: x x+1 If we collect all of these numbers together, we call the resulting set the natural numbers.

Listing Out Numbers 5 Imagine an incredibly large (infinite, actually) index of numbers: 0: 1: 2: 3: 4: 5: 6: 7:... We say a set of numbers is countable (or the same size as the natural numbers) whenever we can list them out.

Even Numbers 6 Obvious Theorem There are as many even numbers as odd numbers.

Even Numbers 6 Obvious Theorem There are as many even numbers as odd numbers. 0: 1: 2: 3: 4: 5: 6: 7: Are there more even numbers than natural numbers?

0: 1: 2: 3: 4: 5: 6: 7: 8:... Integers 7 Are there more integers than natural numbers?

0: 1: 2: 3: 4: 5: 6: 7: 8:... Fractions 8 Are there more fractions than natural numbers?

Strings 9 Program Are there more Strings than natural numbers? 1 List out Strings of length 1: 0 a 1 b 2 c 3... 2 List out Strings of length 2: 4 aa 5 ab 6 ac 7... 3 List out Strings of length 3: 4... 7 aaa 8 aab 9 aac 10...

Real Numbers 10 Are there more real numbers than natural numbers?

Describable Numbers 11 Incredibly, this is enough machinery to prove interesting results.

Describable Numbers 11 Incredibly, this is enough machinery to prove interesting results. Definition (Describable) A number is describable when it can unambiguously be described by some String. Example one

Describable Numbers 11 Incredibly, this is enough machinery to prove interesting results. Definition (Describable) A number is describable when it can unambiguously be described by some String. Example one two

Describable Numbers 11 Incredibly, this is enough machinery to prove interesting results. Definition (Describable) A number is describable when it can unambiguously be described by some String. Example one two π

Describable Numbers 11 Incredibly, this is enough machinery to prove interesting results. Definition (Describable) A number is describable when it can unambiguously be described by some String. Example one two π the smallest number with four million digits

Describable Numbers 11 Incredibly, this is enough machinery to prove interesting results. Definition (Describable) A number is describable when it can unambiguously be described by some String. Example one two π the smallest number with four million digits

Describable Numbers 12 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property.

Describable Numbers 12 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Example 0 is interesting because it s the smallest non-negative number

Describable Numbers 12 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Example 0 is interesting because it s the smallest non-negative number 1 is interesting because it s 1 x = x for all x

Describable Numbers 12 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Example 0 is interesting because it s the smallest non-negative number 1 is interesting because it s 1 x = x for all x 2 is interesting because it s the smallest prime number

Describable Numbers 13 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Questions

Describable Numbers 13 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Questions What is the smallest uninteresting number?

Describable Numbers 13 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Questions What is the smallest uninteresting number? Is every interesting number describable?

Describable Numbers 13 Definition (Describable) A number is describable when it can unambiguously be described by some String. Definition (Interesting) A number is interesting when it s the smallest number with some interesting property. Questions What is the smallest uninteresting number? Is every interesting number describable? Is every real number describable?

Computable Numbers 14 Definition (Computable) A number is computable when it can unambiguously printed out by some program. Example Question 0 is interesting because text("0", 0, 0) 1 is interesting because text("1", 0, 0) π is interesting because... Is every number computable?

Computability 15 We now know there is something that isn t computable. But can we find something specific?

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running?

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running? It turns out the answer is no!

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running? It turns out the answer is no! The Idea Hypothetically, consider what would happen if someone really smart has written a program:

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running? It turns out the answer is no! The Idea Hypothetically, consider what would happen if someone really smart has written a program: HALT(P) which returns true when P finishes and false if it doesn t.

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running? It turns out the answer is no! The Idea Hypothetically, consider what would happen if someone really smart has written a program: HALT(P) which returns true when P finishes and false if it doesn t. Then, we will find a program CONFUSE which will confuse the HALT program...

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running? It turns out the answer is no! The Idea Hypothetically, consider what would happen if someone really smart has written a program: HALT(P) which returns true when P finishes and false if it doesn t. Then, we will find a program CONFUSE which will confuse the HALT program... which means it doesn t work.

Computability 15 We now know there is something that isn t computable. But can we find something specific? Halting Problem Given a program P as input, can we determine if it ever finishes running? It turns out the answer is no! The Idea Hypothetically, consider what would happen if someone really smart has written a program: HALT(P) which returns true when P finishes and false if it doesn t. Then, we will find a program CONFUSE which will confuse the HALT program... which means it doesn t work. So, it can t be written!

Halting Problem 16 Suppose we have a program HALT such that: HALT(P) returns true when P finishes and false if it doesn t. Our Program 1 void CONFUSE() { 2 if (HALT(SOURCE_CODE(CONFUSE))) { 3 while (true) { 4 text("ha ha", 0, 0); 5 } 6 } 7 else { 8 return; 9 } 10 }

A Flow Chart 17 Input: 0 1 1 0 1 0 1 1 0 1 Work: read 0,1 input 0 0, Read Input input 1 1, input Erase and Store read 1, read 0, Match 0 read read 0,1 Match 1 read read read accept At Left, Match 0 read At Left, Match 1 read 1 read 0 read 0, fail read 1, read 0,1 Goto End read

This is a Turing Machine! 18 Some infinite tapes:

This is a Turing Machine! 18 Some infinite tapes: (how many doesn t matter; one tape for input and work, etc.) Input: 0 1 1 0 1 0 1 1 0 1 Work:

This is a Turing Machine! 18 Some infinite tapes: (how many doesn t matter; one tape for input and work, etc.) Input: 0 1 1 0 1 0 1 1 0 1 Work: A finite-state controller: read 0,1 input 0 0, Read Input input 1 1, input Erase and Store read 0 read 1,, Match 0 read read 0,1 Match 1 read At Left, Match 0 read accept read read At Left, Match 1 read 1 read 0 read 0, fail read 1, read 0,1 Goto End read

This is a Turing Machine! 18 Some infinite tapes: (how many doesn t matter; one tape for input and work, etc.) Input: 0 1 1 0 1 0 1 1 0 1 Work: A finite-state controller: read 0,1 input 0 0, Read Input input 1 1, input Erase and Store read 0 read 1,, Match 0 read read 0,1 Match 1 read At Left, Match 0 read accept read read At Left, Match 1 read 1 read 0 read 0, fail read 1, read 0,1 Goto End read That s it. These things can decide exactly the same languages as register machines, and lambda calculus.