acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

Similar documents
ACS2: Decidability Decidability

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Decidability (intro.)

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Decidability (What, stuff is unsolvable?)

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

CSE 105 THEORY OF COMPUTATION

Intro to Theory of Computation

CSCE 551: Chin-Tser Huang. University of South Carolina

4.2 The Halting Problem

Decidability. Overview. Preliminaries to Halting Problem. Decidable Problems of Regular Languages. Decidable Problems of Context-Free Languages

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

Computability Theory

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

Decidable and undecidable languages

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

Computational Models Lecture 8 1

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Computational Models Lecture 8 1

Computational Models Lecture 8 1

Non-emptiness Testing for TMs

Theory of Computation (IX) Yijia Chen Fudan University

CSE 105 THEORY OF COMPUTATION

Computability Theory

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

CSE 105 THEORY OF COMPUTATION

CSCE 551: Chin-Tser Huang. University of South Carolina

Computation Histories

TURING MAHINES

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Reducability. Sipser, pages

Intro to Theory of Computation

Turing Machines, diagonalization, the halting problem, reducibility

1 Showing Recognizability

Undecidable Problems and Reducibility

CPSC 421: Tutorial #1

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Turing Machines Part III

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

CSE 105 THEORY OF COMPUTATION

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

UNIT-VIII COMPUTABILITY THEORY

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

V Honors Theory of Computation

Theory of Computation

Decidable Languages - relationship with other classes.

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Computability and Complexity

MTAT Introduction to Theoretical Computer Science

Part I: Definitions and Properties

A non-turing-recognizable language

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Computational Models Lecture 7, Spring 2009

CS20a: Turing Machines (Oct 29, 2002)

CP405 Theory of Computation

Computability and Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

From Fundamentele Informatica 1: inleverdatum 1 april 2014, 13:45 uur. A Set A of the Same Size as B or Larger Than B. A itself is not.

CSE 105 THEORY OF COMPUTATION

16.1 Countability. CS125 Lecture 16 Fall 2014

DM17. Beregnelighed. Jacob Aae Mikkelsen

CS20a: Turing Machines (Oct 29, 2002)

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

CpSc 421 Final Exam December 15, 2006

Introduction to the Theory of Computing

CSCE 551 Final Exam, Spring 2004 Answer Key

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Lecture Notes: The Halting Problem; Reductions

CS3719 Theory of Computation and Algorithms

Introduction to Languages and Computation

CSCI3390-Lecture 6: An Undecidable Problem

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

CS 361 Meeting 26 11/10/17

CSE 105 Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Decidability and Undecidability

CS481F01 Prelim 2 Solutions

Introduction to Turing Machines. Reading: Chapters 8 & 9

The Unsolvability of the Halting Problem. Chapter 19

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

NPDA, CFG equivalence

CS6901: review of Theory of Computation and Algorithms

Introduction to Automata

Decidability: Church-Turing Thesis

problem X reduces to Problem Y solving X would be easy, if we knew how to solve Y

1 Reducability. CSCC63 Worksheet Reducability. For your reference, A T M is defined to be the language { M, w M accepts w}. Theorem 5.

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Turing Machines. Reading Assignment: Sipser Chapter 3.1, 4.2

Reading Assignment: Sipser Chapter 3.1, 4.2

Decidability. William Chan

CSE 105 THEORY OF COMPUTATION

Transcription:

Decidability Andreas Karwath und Malte Helmert 1

Overview An investigation into the solvable/decidable Decidable languages The halting problem (undecidable) 2

Decidable problems? Acceptance problem : decide whether an automaton s a string Equivalence problem : Decide whether two automata are equivalent, i.e. the same language Emptiness testing problem : Decide whether the language of an automaton is empty Can be applied to DFA, NFA, REX, PDA, CFG, TM, 3

Acceptance problem for DFAs (T 4.1) To decide whether a particular DFA a given string w, we express this in a language: A DFA. A DFA contains the encodings of all DFAs together with the string w the DFAs : A = { Bw, Bis a DFA that s input string w} DFA The problem of testing whether a DFA B s w is the same as the problem of whether <B,w> is a member of language A DFA. Theorem 4.1 is a decidable language A DFA Proof M="On input B, w, where B is a DFA and w is a string: 1. Simulate B on input w. 2. If the simulation ends in an state,. If it ends in a noning state,." 4

Acceptance problem for NFAs (T 4.2) A = { Bw, Bis an NFA that s input string w} NFA Theorem 4.2 A NFA is a decidable language Proof N="On input B,w where B is an NFA, and w is a string: 1. Convert NFA B to an equivalent DFA C using the procedure for this conversion given in Theorem 1.19 (TS2, slide 30 ff ). 2. Run TM M from Theorem 4.1 on input C,w. 3. If M s, ; otherwise. " Running TM M in stage 2 means incorporating M into the design of N as a subprocedure. 5

Acceptance problem for Regular Expressions (T 4.3) A = { Rw, Ris a regular expression that generates input string w} REX Theorem 4.3 AREXis a decidable language Proof The following TM P decides A REX P="On input R,w where R is a regular expression and w is a string: 1. Convert regular expression R to an equivalent DFA A by using the procedure for this conversion given in Theorem 1.28. 2. Run TM M on input A,w. 3. If M s, ; if M s,. " 6

Emptiness testing problem for DFAs (T 4.4) E = { A A is DFA for which L( A) = } DFA Theorem 4.4 E is a decidable language DFA Proof A DFA s some string if and only if reaching an state from the start state by traveling along the arrows of the DFA is possible. To test this condition we can design a TM T that uses a marking algorithm similar to that used in the example about connected graphs in acs-06, slide 33. T="On input A where A is a DFA: 1. Mark the start state of A. 2. Repeat until no new states get marked: 3. Mark any state that has a transition coming into it from any state that is already marked. 4. If no state is marked, ; otherwise. " 7

Equivalence problem for DFAs (T 4.5) EQ = { A, B A and Bare DFAs and L( A) = L( B)} DFA Theorem 4.5 EQ DFA Proof is a decidable language L(C) = (L(A) L(B)) (L(A) L(B)) L(A) L(B) The symmetric difference of L(A) and L(B) This expression is sometimes called the symmetric difference of L( A ) and L( B ). Here L( A ) is the complement of L( A ). The symmetric difference is useful here because L( C ) = if and only if L( A ) = L( B ). One can construct C from A and B with the constructions for proving the class of regular languages are closed under the complement, union, and intersection. These constructions are algorithms that can be carried out by Turing machines. Once C has been constructed one can use Theorem 4.4 to test whether L(C) is empty. If it is empty, L( A ) and L( B ) must be equal. F="On input A,B, where A and B are DFA s: 1. Construct DFA C as described. 2. Run TM T from Theorem 4.4 on input C. 3. If T s,. If T s,. " 8

Acceptance problem for CFGs (T 4.6) A = { G, w G is a CFG that generates input string w} CFG Theorem 4.6 A is a decidable language CFG Proof Relies on the following property : If G is in Chomsky Normal Form, then any derivation of whas length at most 2 w 1 There are only finitely many derivations of length less than n. The TM S for A CFG follows. S="On input G,w, where G is a CFG and w is a string: 1. Convert G to an equivalent grammar in Chomsky normal form. 2. List all derivations with 2n 1 steps, where n is the length of w, except if n= 0, then instead list all derivations with 1 step. 3. If any of these derivations generate w, ; if not,. " 10

Emptiness testing problem for CFGs (T 4.7) E = { G Gis a CFG for which L( G) = } CFG Theorem 4.7 E is a decidable language CFG Proof Determine for each variable whether that variable is capable of generating a string of terminals R="On input G, where G is a CFG: 1. Mark all terminal symbols in G. 2. Repeat until no new variables get marked: 3. Mark any variable A where G has a rule A U1U 2...U k and each symbol U 1,...,U k has already been marked. 4. If the start symbol is not marked, ; otherwise. " 11

Equivalence problem for CFGs EQ = { G, H G and H are CFGs and L( G) = L( H)} CFG Theorem EQ CFG is not decidable Proof Follows later The problem with adapting the proof for DFAs is that the class of context free languages is not closed under complementation or intersection! 12

Every CFL is decidable (T 4.8) Theorem 4.8 Every context free language is decidable Proof Let G be a CFG for A and design a TM M that decides A. We build a copy of G into M. It works as follows. G G M G ="On input w: 1. Run TM S (from T4.6) on input Gw, 2. If this machine s, ; if it s,." 13

The relationship amoung classes of languages recognizable decidable Turing regular context free 14

The halting problem There is a specific problem that is algorithmically unsolvable (undecidable), e.g. the halting problem Philosophical implications : computers are fundamentally limited 15

The halting problem (T 4.9) A = { M, w M is a TM that s w} A TM Theorem TM is Turing recognizable Proof Consider U : ( Universal Turing Machine) On input < M, w>, where M is a TM and wa string 1. Simulate M on w 2. If M ever enters its state,, if M ever enters its state, U loops when M does, the halting problem: Theorem A TM is undecidable shows that recognizers are more powerful than deciders requires quite involved proof 16

Diagonalization Georg Cantor 1873 Measure the size of (infinite) sets Consider the function f: A B f is injective (one-to-one), if f(a) f(b) whenever a b f is surjective (onto), if for every b B there is an a A: f(a) = b f is bijective (corresponence) if it is injective and surjective A and B are said to be the same size, if there exists a bijective function f, i.e. for every element in A there exists an unique element in B. n f(n)= 2n Example: f: N(natural numbers) E(even numbers) f(n) = 2n is a bijective function Both sets have the same size Definition: A set is countable, if it is finite or has thesamesizeas N. 1 2 3 I 2 4 6 2i 17

m Q= { m, n N} the positive rational numbers n Theorem Q is countable Proof idea 18

R is uncountable (T 4.14) R = the set of real numbers (have a decimal representation) Theorem (T 4.14) R is uncountable Proof idea We prove (by contradiction) that there is no correspondence between R Assume that there were a correspondence f We now construct an x R that is not paired with any element of N Choose i th fractional digit of xdifferent from i thfrac. digit of f( i) and N 19

Example n f(n) 1 3.1414 2 5.567 3 0.888888 x = 0.275 So, x f(n) for all n 20

B = the set of all infinite binary strings acs-07: Decidability Lemma B is uncountable Proof idea By analogy to R Let L be the set of all languages over Σ Lemma L is uncountable Proof idea We define a correspondence between L and B Let * Σ = * Σ = { s, s,...}; which is countable 1 2 Each language A in Lhas a unique characteristic sequence χ in Bdefined as follows { ε, 0, 1, 00, 01, 10, 11, 000, 001,... } ; A = { 0, 00, 01, 000, 001,... } ; χ A = 0 1 0 1 1 0 0 1 1.... A f : L B: f( A) = χ A is a correspondence 21

Some languages are not Turingrecognizable (T 4.15) Theorem (T4.15) Some languages are not Turing recognizable Proof There is a countable number of Turing Machines (Each Turing Machine can be encoded in a string; the set of all strings over a finite alphabet is countable; not all strings need to encode legal TMs) The set of all languages is uncountable Therefore there is no correspondence between the set of all TMs and the set of all languages. 22

A TM is undecidable (T4.9) A = { M, w M is a TM that s w} TM Theorem (T4.9) A TM is undecidable Proof by contradiction; assume Suppose His a decider for is decidable if M s w H( < M, w> ) = if M does not w A TM A TM 23

A TM is undecidable (T4.9) (cont.) Use H to define D: On input M, where M is a TM 1. Run H on input < M, < M >> 2. Output the opposite of what H outputs ; if M does not < M > So, D( < M > ) = if M s < M > and if D does not < D > D( < D> ) = if D s < D > This is impossible! Further Explanations H s M, w when M s w D s M when M s M D s D when Ds D 24

Entry i,j is if M i s <M j > <M1> <M2> <M3> <M4>... M1 M2 M3... M4 25

Entry i,j is the value of H on input <M i,<m j >> <M1> <M2> <M3> <M4>... M1 M2 M3... M4 26

What happens if D occurs? <M1> <M2> <M3> <M4>... <D>... M1 M2 M3...... M4 D? 27

T 4.16 A language is co-turing recognizable if it is the complement of a language that is Turing recognizable Theorem (T 4.16) A language is decidable if and only if it is both Turing-recognizable and co-turing recognizable Proof 1. If Ais decidable then A and A Turing recognizable Trivial 2. If A and A are Turing recognizable then Ais decidable Let M and M be TMs for A and A 1 2 Define M : M decides A On input w all strings are either in Aor A 1. Run both M1and M2on win parallel either M1 or M2 must any given string 2. If M1 s, then s; M always terminates with correct answer If M s, then ; 2 28

A TM is not Turing-recognizable Theorem (T4.17) A If TM Proof A TM A is not Turing-recognizable is Turing-recognizable TM were also Turing-recognizable Then A would be decidable. TM 29

Summary A DFA, A NFA, A REX, A CFG, E DFA, E CFG, EQ DFA A TM recognizable decidable Turing regular context free A TM The relationship amoung languages 30