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

Similar documents
Decidability (intro.)

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

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

ACS2: Decidability Decidability

Theory of Computation (IX) Yijia Chen Fudan University

Computability Theory

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

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

Computability Theory

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

Theory of Computation

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

CSE 105 THEORY OF COMPUTATION

Decidability (What, stuff is unsolvable?)

CSE 105 THEORY OF COMPUTATION

V Honors Theory of Computation

Decidable and undecidable languages

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

Reducability. Sipser, pages

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

CSE 105 THEORY OF COMPUTATION

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

CS20a: Turing Machines (Oct 29, 2002)

Decidability and Undecidability

TURING MAHINES

Computability and Complexity

CS154, Lecture 10: Rice s Theorem, Oracle Machines

UNIT-VIII COMPUTABILITY THEORY

CSE 105 THEORY OF COMPUTATION

MA/CSSE 474 Theory of Computation

Computability and Complexity

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

CSE 105 THEORY OF COMPUTATION

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

1 Showing Recognizability

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

CSCC63 Worksheet Turing Machines

Intro to Theory of Computation

Introduction to Languages and Computation

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

Undecidable Problems and Reducibility

Homework Assignment 6 Answers

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Intro to Theory of Computation

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

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

MTAT Introduction to Theoretical Computer Science

CS20a: Turing Machines (Oct 29, 2002)

CpSc 421 Final Exam December 15, 2006

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Computation Histories

Lecture 12: Mapping Reductions

Decidable Languages - relationship with other classes.

CPSC 421: Tutorial #1

CSE 105 THEORY OF COMPUTATION

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

CS481F01 Solutions 8

CS21 Decidability and Tractability

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

CSCE 551 Final Exam, Spring 2004 Answer Key

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

Turing Machines. Lecture 8

NPDA, CFG equivalence

4.2 The Halting Problem

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

CpSc 421 Homework 9 Solution

CP405 Theory of Computation

CSE 105 Theory of Computation

CSE 105 THEORY OF COMPUTATION

Section 14.1 Computability then else

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

Turing Machines. Reading Assignment: Sipser Chapter 3.1, 4.2

Reading Assignment: Sipser Chapter 3.1, 4.2

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Automata and Computability. Solutions to Exercises

Lecture Notes: The Halting Problem; Reductions

Turing Machines Part III

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Automata and Computability. Solutions to Exercises

UNRESTRICTED GRAMMARS

CSE 105 THEORY OF COMPUTATION

Computational Models Lecture 8 1

Computational Models Lecture 8 1

Non-emptiness Testing for TMs

1 Unrestricted Computation

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

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

Theory of Computation Turing Machine and Pushdown Automata

Final exam study sheet for CS3719 Turing machines and decidability.

Transcription:

CS533 Class 04a: 1 c P. Heeman, 2017 Introduction: Decidability Overview Decidable Problems of Regular Languages Decidable Problems of Context-Free Languages Preliminaries to Halting Problem CS533 Class 04a: 2 c P. Heeman, 2017 Decidability With Turing machines, we have a precise model of what an algorithm is We can use it to determine what problems are solvable and what problems are not solvable - By problem, we mean determining if a string is in a certain language - By solvable, we mean whether a Turing machine can decide the language We will first prove that a number of problems are solvable - Could just build an algorithm, but will use a TM formalism instead Real power is in showing that a problem is not solvable

CS533 Class 04a: 3 c P. Heeman, 2017 Introduction: Decidability Overview Decidable Problems of Regular Languages Decidable Problems of Context-Free Languages Preliminaries to Halting Problem CS533 Class 04a: 4 c P. Heeman, 2017 Acceptance Problem for DFAs Is there an algorithm that when given a DFA and a word w can decide if the DFA will accept w Let s phrase this as a language that we need to decide - Both the DFA andw are part of the input that needs to be decided -A DFA = { B,w B is a DFA that accepts input string w} Prove that A DFA is a decidable language Intuitively, a DFA either accepts or rejects a string - Does so after w transitions of the DFA - So this should be a decidable language

CS533 Class 04a: 5 c P. Heeman, 2017 Proof Idea Proof Idea: build a TM M that uses the description of B and w on the input tape, and simulates DFA B on input w - At end of processingw, ifb is in an accept state then accept, otherwise reject - Note that it is not sufficient to build a Turing machine that corresponds to a specific DFA. It needs to simulate any DFA - We could do this proof by showing the existence of an algorithm, but we want practice with Turing machines CS533 Class 04a: 6 c P. Heeman, 2017 Proof We can assume that B is written as a list of its five components Q,Σ,δ,q 0 and F. When M receives its input, M first determines whether it properly represents a DFA and a string w. If not, M rejects. M writes start state on end of the tape, and marks start of input M then simulates B - Find the applicable transition: + Match current position of input and current state - Update state and current position When M finishes processing the last symbol of w -M accepts the input ifb is in an accepting state -M rejects the input ifb is in a non-accepting state

CS533 Class 04a: 7 c P. Heeman, 2017 Acceptance Problem for NFAs Is there an algorithm that when given an NFA and a word w can decide if the NFA will accept w -A NFA = { B,w B is a NFA that accepts input string w} Proof: the following TM decides language A NFA 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 in Chapter 1. 2. Run TM M from previous proof on input C,w. 3. If M accepts, accept; otherwise, reject. Running TM M in stage 2 means incorporating M into the design of N as a subprocedure CS533 Class 04a: 8 c P. Heeman, 2017 Acceptance Problem for Regular Expressions Is there an algorithm that when given a regular expression and a word w can decide if the regular expression will generate w -A REX = { R,w R is a regular expression that accepts input string w} Proof: the following TM decides A REX P = On input R, w where R is a regular expression, and w is a string 1. Convert R to an equivalent NFA C, using procedure in Chapter 1. 2. Run TM N from previous proof on input C,w. 3. If M accepts, accept; otherwise, reject. Existence of the 3 proofs shouldn t be too surprising, as we can convert between the 3 formalisms using an algorithm

CS533 Class 04a: 9 c P. Heeman, 2017 Does a DFA accept no strings? Formulate as a language -E DFA = { A Ais a DFA andl(a) = } Is E DFA decidable? Proof: 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. For each state that is not marked 4. Mark it if has a transition into it from any state that is already marked 5. If no accept state is marked, accept; otherwise reject. CS533 Class 04a: 10 c P. Heeman, 2017 Do two DFAs accept the same language? Is EQ DFA = { A,B A and B are DFAs and L(A) = L(B)} Proof Idea: L(A) = L(B) iff L(A) xor L(B) = - Construct DFAC that accepts xor of two DFAs + Similar to how we did union/intersection of two DFAs + Take cross product of states and simulate A and B + Only accept if just one of the two DFAs is in an accept state - Test ifc accepts the empty set T = On input A,B whereaandb are a DFAs 1. Construct DFAC as described above. 2. Run TMT from previous proof on input C 3. If T accepts, accept; otherwise reject.

CS533 Class 04a: 11 c P. Heeman, 2017 Introduction: Decidability Overview Decidable Problems of Regular Languages Decidable Problems of Context-Free Languages Preliminaries to Halting Problem CS533 Class 04a: 12 c P. Heeman, 2017 Acceptance Problem for CFGs A CFG = { G,w G is a CFG that generates string w} One idea is to use G to go through all derivations to determine whether any is a derivation of w - But,Gmight have infinitely many derivations - IfGdoes not generatew, this algorithm would never halt - This would just be a recognizer, not a decider

CS533 Class 04a: 13 c P. Heeman, 2017 Proof If grammar is in Chomsky normal form, any derivation of w has 2n-1 steps, where n = w - So, just need to check derivations up to2n-1 steps - Only finitely many such derivations exist S = On input G,w wheregis a CFG anw is a string: 1. ConvertGto Chomsky normal form 2. List all derivations with2n 1 steps, wheren = w, except ifn=0, then instead list all derivations with 1 step (this is because grammar generatesǫusing one rules ǫ) 3. If any of these derivations generatew, accept; if not, reject. CS533 Class 04a: 14 c P. Heeman, 2017 Does a CFG accept no strings? E CFG = { G G is a CFG and L(G) = } One idea is to use S, which can test whether a CFG generates some particular string w - Would need to check this with all possiblew, but infinitely many If a CFG generates a string, we know there is a derivation. e.g. S ab abced abced abced - If we take the last derivation, we see that there is a variable that is capable of generating a string (e.g. E) - As we move backwards through the derivation, we get more and more variables that can generate a string (e.g. C,B,S) - Until we reach the start symbol

CS533 Class 04a: 15 c P. Heeman, 2017 Construction R = On input G wheregis a CFG anw: 1. Mark all terminal symbols in G 2. Repeat until no new variables get marked: 3. Mark any variableawhereghas a rulea U 1 U 2...U k and each symbolu 1,...U k has already been marked 4. If the start symbol is not marked, accept; otherwise, reject. CS533 Class 04a: 16 c P. Heeman, 2017 Every Context-Free Language is Decidable Given a context-free language, can we build a TM machine that will accept it? - This is different from the acceptance problem, as here we just have to prove that for a given CFL we can build a TM - We can build a different TM for every different language Proof: Let G be a CFG for A and design a TM M G that decides A. We build a copy of G into M G. It works as follows: M G = On input w 1. Run TMS on input G,w 2. If this machine accepts, accept; otherwise reject.

CS533 Class 04a: 17 c P. Heeman, 2017 Introduction: Decidability Overview Decidable Problems of Regular Languages Decidable Problems of Context-Free Languages Preliminaries to Halting Problem CS533 Class 04a: 18 c P. Heeman, 2017 Introduction We have shown a number of problems to be decidable (solvable by an algorithm or Turing machine) - But, part of the reason for introducing this machinery was to show that there are problems that are not decidable What kind of problems are not decidable? - Are there any useful ones?

CS533 Class 04a: 19 c P. Heeman, 2017 The Halting Problem A TM = { M,w M is a TM and M accepts w} Given a Turing machine M and an input w, can we determine whether M will accept w? This is the acceptance problem for TMs - Previously showed acceptance problem for DFA and CFG are decidable We will eventually show that A TM is undecidable CS533 Class 04a: 20 c P. Heeman, 2017 A TM is Turing-Recognizable Proof: U = On input M,w where M is a TM and w is a string 1. Simulate M on input w 2. IfM ever enters its accept state, accept; if M ever enters its reject state, reject. Note that U loops forever on w if M loops forever on w, - So this construction just showsa TM is Turing recognizable, and not necessarily decidable - IfU had a way to tell ifm was looping forever, it could reject, which is whya TM is called the halting problem

CS533 Class 04a: 21 c P. Heeman, 2017 Universal Turing Machine U is interesting in its own right - It is an example of a universal Turing machine - Capable of simulating any other Turing machine from a description of that machine