CSE 311: Foundations of Computing Fall 2014 Lecture 27: Cardinality.

Slides:



Advertisements
Similar presentations
Problem: Give as many proofs as you can for the Pythagorean Theorem. i.e., a 2 + b 2 = c 2 holds for any right triangle with sides a & b and hypotenuse.
Advertisements

1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 10 Cardinality Uncountability of the real numbers.
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
Introduction to Computability Theory
Great Theoretical Ideas in Computer Science.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Decidable and undecidable problems deciding regular languages and CFL’s Undecidable problems.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 19 Instructor: Paul Beame.
CHAPTER 4 Decidability Contents Decidable Languages
CS 310 – Fall 2006 Pacific University CS310 The Halting Problem Section 4.2 November 15, 2006.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 18 Instructor: Paul Beame.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
Lecture 27UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
2012: J Paul GibsonTSP: Mathematical FoundationsMAT7003/L5- CountingAndEnumeration.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul.
Cantor’s Legacy: Infinity And Diagonalization Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 25Apr 13, 2004Carnegie.
Cardinality of Sets Section 2.5.
Problem: Can 5 test tubes be spun simultaneously in a 12-hole centrifuge? What does “balanced” mean? Why are 3 test tubes balanced? Symmetry! Can you merge.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
1 Lecture 3 (part 3) Functions – Cardinality Reading: Epp Chp 7.6.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Cantor and Countability: A look at measuring infinities How BIG is big? = a Googol 10 googol = a Googolplex = one Tremilliomilliotrecentrecentre.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
Copyright © 2014 Curt Hill Cardinality of Infinite Sets There be monsters here! At least serious weirdness!
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
Relations, Functions, and Countability
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
COMPSCI 102 Introduction to Discrete Mathematics.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
Great Theoretical Ideas in Computer Science.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
Great Theoretical Ideas in Computer Science.
CSE 311 Foundations of Computing I Lecture 26 Cardinality, Countability & Computability Autumn 2011 CSE 3111.
Lecture 4 Infinite Cardinals. Some Philosophy: What is “2”? Definition 1: 2 = 1+1. This actually needs the definition of “1” and the definition of the.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 25 Pattern Matching, Cardinality, Computability Spring
CSE 311: Foundations of Computing Fall 2013 Lecture 26: Pattern matching, cardinality.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
To Infinity And Beyond! CS Lecture 11 The Ideal Computer: no bound on amount of memory Whenever you run out of memory, the computer contacts the.
Section 2.5. Cardinality Definition: A set that is either finite or has the same cardinality as the set of positive integers (Z + ) is called countable.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
Fall 2014 Lecture 29: Turing machines and more decidability CSE 311: Foundations of Computing.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
CSE 311: Foundations of Computing Fall 2014 Lecture 28: Undecidability.
1-1 Copyright © 2013, 2005, 2001 Pearson Education, Inc. Section 2.4, Slide 1 Chapter 2 Sets and Functions.
Great Theoretical Ideas In Computer Science
The Acceptance Problem for TMs
Discrete Mathematics CS 2610
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
This statement is false.
CSE 311 Foundations of Computing I
Lecture12 The Halting Problem
Cardinality of Sets Section 2.5.
Discrete Structures for Computer Science
CSE 311 Foundations of Computing I
Module #4.5, Topic #∞: Cardinality & Infinite Sets
Discrete Mathematics and its Applications
Discrete Math for CS CMPSC 360 LECTURE 43 Last time: Variance
CSE 311: Foundations of Computing
Formal Languages, Automata and Models of Computation
Intro to Theory of Computation
Module #4.5, Topic #∞: Cardinality & Infinite Sets
CS21 Decidability and Tractability
Cardinality Definition: The cardinality of a set A is equal to the cardinality of a set B, denoted |A| = |B|, if and only if there is a one-to-one correspondence.
CSE 311: Foundations of Computing
Instructor: Aaron Roth
Computability and Undecidability
Intro to Theory of Computation
Presentation transcript:

CSE 311: Foundations of Computing Fall 2014 Lecture 27: Cardinality

Cardinality and Computability Computers as we know them grew out of a desire to avoid bugs in mathematical reasoning

A brief history of reasoning Ancient Greece – Deductive logic Euclid’s Elements – Infinite things are a problem Zeno’s paradox -

A brief history of reasoning 1670’s-1800’s Calculus & infinite series – Suddenly infinite stuff really matters – Reasoning about the infinite still a problem Tendency for buggy or hazy proofs Mid-late 1800’s – Formal mathematical logic Boole Boolean Algebra – Theory of infinite sets and cardinality Cantor “There are more real #’s than rational #’s”

A brief history of reasoning 1900 – Hilbert's famous speech outlines goal: mechanize all of mathematics 23 problems 1930’s – Gödel, Turing show that Hilbert’s program is impossible. Gödel’s Incompleteness Theorem Undecidability of the Halting Problem Both use ideas from Cantor’s proof about reals & rationals

Starting with Cantor How big is a set? – If S is finite, we already defined |S| to be the number of elements in S. – What if S is infinite? Are all of these sets the same size? Natural numbers ℕ Even natural numbers Integers ℤ Rational numbers ℚ Real numbers ℝ

Cardinality Definition: Two sets A and B are the same size (same cardinality) iff there is a 1-1 and onto function f:A → B Also applies to infinite sets a b c d e f

Cardinality The natural numbers and even natural numbers have the same cardinality: n is matched with 2n

Countability Definition: A set is countable iff it is the same size as some subset of the natural numbers Equivalent: A set S is countable iff there is an onto function g: ℕ → S Equivalent: A set S is countable iff we can write S={s 1, s 2, s 3,...}

The set of all integers is countable

Is the set of positive rational numbers countable? We can’t do the same thing we did for the integers – Between any two rational numbers there are an infinite number of others

The set of positive rational numbers is countable 1/11/21/31/41/51/61/71/8... 2/12/22/32/42/52/62/72/8... 3/13/23/33/43/53/63/73/8... 4/14/24/34/44/54/64/74/8... 5/15/25/35/45/55/65/7... 6/16/26/36/46/56/6... 7/17/27/37/47/

1/11/21/31/41/51/61/71/8... 2/12/22/32/42/52/62/72/8... 3/13/23/33/43/53/63/73/8... 4/14/24/34/44/54/64/74/8... 5/15/25/35/45/55/65/7... 6/16/26/36/46/56/6... 7/17/27/37/47/ The set of positive rational numbers is countable

ℚ + = {1/1, 2/1,1/2, 3/1,2/2,1/3, 4/1,2/3,3/2,1/4, 5/1,4/2,3/3,2/4,1/5,...} List elements in order of – numerator+denominator – breaking ties according to denominator Only k numbers have total of k+1 Technique is called “dovetailing”

The Positive Rationals are Countable: Another Way public static rational o2o(nat n) { Set used = new HashSet (); nat i = 0; while (answer == null) { for (nat numer=1; ; numer++) { for (nat denom=1; denom <= numer; denom++) { Rational r = new Rational(numer, denom); if (!used.contains(r) && used.size() == i) { return new Rational(numer, denom); } else if (!used.contains(r)) { used.add(r); i++; }

Claim: Σ* is countable for every finite Σ

The set of all Java programs is countable

Georg Cantor Set theory Cardinality Continuum hypothesis

Georg Cantor He spent the last 30 years of his life battling depression, living often in “sanatoriums” (psychiatric hospitals) Cantor’s revolutionary ideas were not accepted by the mathematical establishment. Poincaré referred to them as a “grave disease infecting mathematics.” Kronecker fought to keep Cantor’s papers out of his journals.

What about the real numbers? Q: Is every set is countable? A: Theorem [Cantor] The set of real numbers (even just between 0 and 1) is NOT countable Proof is by contradiction using a new method called diagonalization

Proof by Contradiction Suppose that ℝ [0,1) is countable Then there is some listing of all elements ℝ [0,1) = { r 1, r 2, r 3, r 4,... } We will prove that in such a listing there must be at least one missing element which contradicts statement “ ℝ [0,1) is countable” The missing element will be found by looking at the decimal expansions of r 1, r 2, r 3, r 4,...

Real Numbers between 0 and 1: ℝ [0,1) Every number between 0 and 1 has an infinite decimal expansion: 1/2 = /3 = /7 = π -3 = /5 = =

Representations of real numbers as decimals Representation is unique except for the cases that decimal ends in all 0’s or all 9’s. x = x = x = 1.8 so x= Won’t allow the representations ending in all 9’s All other representations give different elements of ℝ [0,1)

Supposed listing of ℝ [0,1) r1r r2r r3r r4r r5r r6r r7r r8r

Supposed listing of ℝ [0,1) r1r r2r r3r r4r r5r r6r r7r r8r

Flipped Diagonal r1r r2r r3r r4r r5r r6r r7r r8r Flipping Rule: If digit is 5, make it 1 If digit is not 5, make it 5

Flipped Diagonal Number D D = But for all n, we have D  r n since they differ on n th digit (which is not 9) ⇒ list was incomplete ⇒ ℝ [0,1) is not countable D is in ℝ [0,1)

the set of all functions f : ℕ→ {0,1,...,9} is not countable

non-computable functions We have seen that – The set of all (Java) programs is countable – The set of all functions f : ℕ→ {0,1,...,9} is not countable So... – There must be some function f : ℕ→ {0,1,...,9} that is not computable by any program!

Back to the Halting Problem Suppose that there is a program H that computes the answer to the Halting Problem We will build a table with a row for each program (just like we did for uncountability of reals) If the supposed program H exists then the D program we constructed as before will exist and so have a row in the table We will see that D must have entries like the “flipped diagonal” – D can’t possibly be in the table. – Only assumption was that H exists. That must be false.

.... Some possible inputs x P1P2P3P4P5P6P7P8P9..P1P2P3P4P5P6P7P8P9.. programs P (P,x) entry is 1 if program P halts on input x and 0 if it runs forever

.... Some possible inputs x P1P2P3P4P5P6P7P8P9..P1P2P3P4P5P6P7P8P9.. programs P (P,x) entry is 1 if program P halts on input x and 0 if it runs forever

recall: code for D assuming subroutine H that solves the halting problem Function D(x): – if H(x,x)==true then while (true); /* loop forever */ – else return; /* do nothing and halt */ – endif

.... Some possible inputs x P1P2P3P4P5P6P7P8P9..P1P2P3P4P5P6P7P8P9.. programs P (P,x) entry is 1 if program P halts on input x and 0 if it runs forever D behaves like flipped diagonal

recall: code for D assuming subroutine H that solves the halting problem Function D(x): – if H(x,x)==true then while (true); /* loop forever */ – else return; /* do nothing and halt */ – endif If D existed it would have a row different from every row of the table – D can’t be a program so H cannot exist!