INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Slides:



Advertisements
Similar presentations
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
Advertisements

Computing functions with Turing machines
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
CSCI 2670 Introduction to Theory of Computing October 19, 2005.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
Decidability. Why study un-solvability? When a problem is algorithmically unsolvable, we realize that the problem must be simplified or altered before.
Recursively Enumerable and Recursive Languages
Decidable and undecidable problems deciding regular languages and CFL’s Undecidable problems.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
CHAPTER 4 Decidability Contents Decidable Languages
CS 310 – Fall 2006 Pacific University CS310 Decidability Section 4.1/4.2 November 10, 2006.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
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.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Computer Language Theory
A Universal Turing Machine
Decidable languages Section 4.1 CSC 4170 Theory of Computation.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
CSCI 2670 Introduction to Theory of Computing October 12, 2005.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Recursively Enumerable and Recursive Languages
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
1 Recursively Enumerable and Recursive Languages.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
The Acceptance Problem for TMs
A Universal Turing Machine
Recursively Enumerable and Recursive Languages
CSCI 2670 Introduction to Theory of Computing
Lecture12 The Halting Problem
Reductions Costas Busch - LSU.
BCS 2143 Theory of Computer Science
MCC 2093 Advanced Theoretical Computer Science
Decidable Languages Costas Busch - LSU.
CS21 Decidability and Tractability
Formal Languages, Automata and Models of Computation
CS21 Decidability and Tractability
Theory of Computability
Theory of Computability
Instructor: Aaron Roth
Automata, Grammars and Languages
Intro to Theory of Computation
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

Definition: A Turing Machine is a 7-tuple T = (Q, Σ, Γ, , q 0, q accept, q reject ), where: Q is a finite set of states Γ is the tape alphabet, where   Γ and Σ  Γ q 0  Q is the start state Σ is the input alphabet, where   Σ  : Q  Γ → Q  Γ  {L,R} q accept  Q is the accept state q reject  Q is the reject state, and q reject  q accept

The language L is Turing-recognizable or recursively enumerable if some TM accepts all and only the strings in L. A language is called decidable or recursive if some TM accepts all the strings in L and rejects all the strings not in L. recursive languages r.e. languages

THE CHURCH-TURING THESIS L is recognized by a program for some computer* ⇔ L is recognized by a TM * The computer must be “reasonable”

The Church-Turing Thesis is “consistent” with all known “reasonable” computers. SCRATCH: R1: R2:  RAM: 1111… … … #1011# # #...# Programs for a computer have instructions like ADD R1, R2, R3; LOAD R1, R2; STORE R1,R2; MUL R1, R2, R2; BRANCH R1, X;…

Programming languages like Java, Python, Scheme, C, … are equivalent to TMs We call such languages Turing complete. Corollary. If two programming languages are Turing complete, then they can recognize exactly the same set of languages.

We can encode a TM as a string of 0s and 1s… 0 n 10 m 10 k 10 s 10 t 10 r 10 u 1… n states m tape symbols (first k are input symbols) start state accept state reject state blank symbol 〈 (p,a), (q,b,L) 〉 = 0 p 10 a 10 q 10 b 10

Since TMs and other languages are equivalent we can also express TMs as programs. Since programs are strings, we can consider languages whose elements are programs. We let 〈 M 〉 denote the encoding of TM M. Theorem. We can make a Universal TM, a TM that takes any 〈 M 〉 and any string w as input and simulates the computation of M on w.

Similarly, we can encode DFAs, NFAs, CFGs, etc into strings of 0s and 1s A DFA = { 〈 B,w 〉 | B is a DFA that accepts string w } A NFA = { 〈 N,w 〉 | N is an NFA that accepts string w } A CFG = { 〈 G,w 〉 | G is a CFG that generates string w } So we can define the following languages:

A DFA = { 〈 B,w 〉 | B is a DFA that accepts string w } Theorem: A DFA is decidable Proof Idea: Simulate B on w A CFG = { 〈 G,w 〉 | G is a CFG that generates string w } Theorem: A CFG is decidable Proof Idea: Transform G into CNF. Try all derivations of length 2|w|-1 Corollary: A NFA is decidable

E DFA = { 〈 B 〉 | B is a DFA and L(B) = Ø} Theorem: E DFA is decidable Proof Idea: Let B = (Q, ,δ,q 0,F) and L(B)=Ø. 1.Set MARK := {q 0 } 2.Repeat until MARK is unchanged: MARK := MARK ∪ δ(MARK,Σ) 3.If F ∩ MARK = Ø, accept, else reject. ALL DFA = { 〈 B 〉 | B is a DFA and L(B) = Σ*} Theorem: ALL DFA is decidable Proof Idea: If L(B) = Σ* then L(¬B) = Ø

INFINITE DFA = { 〈 B 〉 | B is a DFA and L(B) is infinite} Theorem: INFINITE DFA is decidable Proof Idea: Let B = (Q, ,δ,q 0,F). Suppose ∃ w ∈ L(B) : |w| ≥ |Q|. 1.Let C be a DFA for {w : |w| ≥ |Q|}. 2.Build a DFA D for L(C) ∩ L(B). 3.If D ∈ E DFA then reject, else accept. FINITE DFA = { 〈 B 〉 | B is a DFA and L(B) is finite} Corollary: FINITE DFA is decidable

The language L is undecidable if there is no TM that decides L. If L is undecidable, then every TM must either: 1. Accept (infinitely many) strings s ∉ L. 2. Reject (infinitely many) strings s ∈ L. 3. Loop forever on (infinitely many) strings.

UN DECIDABILITY We will prove that there are some undecidable languages – i.e., problems that a program can’t solve no matter how long it computes. The proof is “simple:” There are more languages than there are Turing Machines.

POP QUIZ Let ℕ = {0,1,2,…} be the Natural Numbers. Let = {0,2,4,6,…} be the Even Numbers. Let ℤ = {…,-2,-1,0,1,2,…} be the Integers. Which is biggest, | ℕ |, ||, or | ℤ |?

Are there more blue or yellow dots? ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●

SET THEORY 101 A function ƒ : A → B is: 1-1 (or injective) if onto (or surjective) if bijective if it is 1-1 and onto. ∀ x ∈ A : ƒ(x) is unique. ∀ y ∈ B : y ∈ ƒ(A) 1-1 then |A| |B| onto then |A| |B| bijective then |B| |A|. ƒ can help us count. If ƒ is: ≤ ≥ =

COUNTABLE SETS We say a set Y is countable if |Y| ≤ | ℕ |. Some countable sets: = {0,2,4,6,…} = {1,3,5,7,…} SQUARES = {0,1,4,9,16,25…} |POWERS| = |SQUARES| = || = || = | ℕ | POWERS = {1,2,4,8,16,32…} Ø, {0}, {0,1}, {0,1, …, 255}

There exists a bijection between ℕ and ℕ ℕ. (0,0) (0,1) (0,2) (0,3) (0,4) … (1,0) (1,1) (1,2) (1,3) (1,4) … (2,0) (2,1) (2,2) (2,3) (2,4) … (3,0) (3,1) (3,2) (3,3) (3,4) … (4,0) (4,1) (4,2) (4,3) (4,4) …

{0,1}* is countable { 〈 M 〉 | M is a TM } is countable ℚ + = { p/q | p,q ∈ ℤ + } is countable! Is any set uncountable?

Theorem: There is no onto function from the positive integers to the real interval (0,1) 12345:12345: … … … … … : Proof:Suppose ƒ is such a function: [ n-th digit of r ] = if [ n-th digit of f(n) ]  1 2otherwise For all n, ƒ(n)  r

The process of constructing a counterexample by “contradicting the diagonal” is called DIAGONALIZATION

Prove that |(-1,1)| = |(0,1)| = | ℝ | Prove that |ℝ ℝ| = ℝ Is there a set bigger than ℝ ?

Let L be any set and (L) be the power set of L Theorem: There is no onto map from L to (L) Proof: Assume, for a contradiction, that there is an onto map ƒ : L  (L) Let D ƒ = { x  L | x  ƒ(x) } If D ƒ = ƒ(y) then y  D ƒ if and only if y  D ƒ We construct a set D ƒ that cannot be the image, ƒ(y) for any y  L. D ƒ is called the diagonal set for ƒ.

How is that diagonalization? x y 1 ∈ f(x)?y 2 ∈ f(x)?y 3 ∈ f(x)?y 4 ∈ f(x)? … y1y1 YNYY y2y2 NYNY y3y3 NNNN y4y4 YNNY  Y Y Y N (y i ∈ D) = Y iff (y i ∈ f(y i )) = N

EXAMPLE Let L = {0,1,2}. Then (L) = {Ø, {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, {0,1,2}} Let ƒ(0) = {1}, ƒ(1) = Ø, ƒ(2) = {0,2}. Then: x 0 ∈ ƒ(x)?1 ∈ ƒ(x)?2 ∈ ƒ(x)? 0NYN 1NNN 2YNY D ƒ ={0,1} Characteristic sequence for ƒ(2)={0,2}

No matter what, (L) always has more elements than L

Not all languages over {0,1} are decidable Turing Machines Strings of 0s and 1s Sets of strings of 0s and 1s Languages over {0,1} L(L)