Intro to Theory of Computation

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Advertisements

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Reducibility Sipser 5.1 (pages ). CS 311 Fall Reducibility.
Introduction to Computability Theory
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
CS5371 Theory of Computation
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.
CS 310 – Fall 2006 Pacific University CS310 Decidability Section 4.1/4.2 November 10, 2006.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 6 Decidability Jan Maluszynski, IDA, 2007
Foundations of (Theoretical) Computer Science Chapter 4 Lecture Notes (Section 4.1: Decidable Languages) David Martin With modifications.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
Computability Construct TMs. Decidability. Preview: next class: diagonalization and Halting theorem.
Decidable languages Section 4.1 CSC 4170 Theory of Computation.
CSCI 2670 Introduction to Theory of Computing October 12, 2005.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 20 Last time Mapping reductions Computation history method Today Computation history method.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Busch Complexity Lectures: Reductions
Reductions.
Reductions Costas Busch - LSU.
Intro to Theory of Computation
CSE 105 theory of computation
BCS 2143 Theory of Computer Science
CS154, Lecture 7: Turing Machines.
CSE 105 theory of computation
CSE 2001: Introduction to Theory of Computation Fall 2013
CSCI 2670 Introduction to Theory of Computing
Intro to Theory of Computation
Intro to Theory of Computation
Intro to Theory of Computation
CSE 105 theory of computation
Intro to Theory of Computation
Jaya Krishna, M.Tech, Assistant Professor
Intro to Theory of Computation
Intro to Theory of Computation
Automata and Formal Languages (Final Review)
Decidable Languages Costas Busch - LSU.
CSC 4170 Theory of Computation Decidable languages Section 4.1.
Decidable and undecidable languages
CSCI 2670 Introduction to Theory of Computing
CS21 Decidability and Tractability
CSCI 2670 Introduction to Theory of Computing
Intro to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
Theory of Computability
CSE 105 theory of computation
CSE 105 theory of computation
Theory of Computability
Instructor: Aaron Roth
Theory of Computability
Intro to Theory of Computation
CSE 105 theory of computation
Automata, Grammars and Languages
Intro to Theory of Computation
Intro to Theory of Computation
Intro to Theory of Computation
Intro to Theory of Computation
Intro to Theory of Computation
Intro to Theory of Computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Intro to Theory of Computation LECTURE 14 Last time Turing Machine Variants Church-Turing Thesis Today Universal TM Decidable languages Designing deciders CS 464 Homework 5 due Homework 6 out Sofya Raskhodnikova 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

L is recognized by a program The Church-Turing Thesis (1936) L is recognized by a program for some computer* ↕ L is recognized by a TM History 23 Hilbert’s problems (1900) stated at International Congress of Mathematicians 10th problem: Give a procedure for determining if a polynomial in k variables has an integral root. * The computer must be “reasonable” 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

I-clicker problem (frequency: AC) The language corresponding to Hilbert’s 10th problem is not Turing-recongnizable Turing-recognizable, but not decidable decidable regular More than one choice above works. {madam, dad, but, tub, book}

Sofya Raskhodnikova; based on slides by Nick Hopper A universal Turing Machine Since TMs and programming languages are equivalent, we can think of TMs as programs. Since programs are strings, we can consider languages whose elements are programs. 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Can we encode a Turing Machine as a string of 0s and 1s? 〈O〉denotes an encoding of object O as a string start state reject state states Q={0,1,…,n-1} 0n10m10k10s10t10r10u1…〈  〉 tape symbols Γ={0,1…,m-1} (first k are input symbols) blank symbol accept state  :〈(p,a), (q,b,L)〉 = 0p10a10q10b10 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper A universal Turing Machine Since TMs and programming languages are equivalent, we can think of TMs as programs. Since programs are strings, we can consider languages whose elements are programs. 〈M〉denotes an encoding of a TM M as a string Theorem. We can make a Universal TM, a TM that takes any TM description〈M〉 and any string w as input and simulates the computation of M on w. FINITE CONTROL tape contents state encoding of M 〈w〉 〈M〉 〈q0〉 〈w〉= 〈w1,…,wn〉 = 0w110w21…0wn 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Encodings of DFAs, NFAs, CFGs, etc Similarly, we can encode DFAs, NFAs, regular expressions, PDAs, CFGs, etc into strings of 0s and 1s. We can define the following languages: ADFA = { 〈D,w〉 | D is a DFA that accepts string w } ANFA = { 〈N,w〉 | N is an NFA that accepts string w } ACFG = { 〈G,w〉 | G is a CFG that generates string w } 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. ADFA is decidable. Proof: The following TM M decides ADFA. M = `` On input 〈𝑫,𝑤〉, where 𝑫 is a DFA and 𝑤 is a string: Check if input (to M) is legal, reject if not. Simulate 𝑫 on 𝑤. Accept if 𝐷 ends in an accept state. O.w. reject.’’ (This step is assumed to be the first step of every algorithm.) 𝐷 𝑤 M Current state of 𝐷 Corollary. ANFA is decidable. (1. Convert input NFA 𝑵 to an equivalent DFA 𝑫.) 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. ACFG is decidable. ACFG = { 〈G,w〉 | G is a CFG that generates string w } 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Chomsky Normal Form for CFGs Can have a rule 𝑆→ε. All remaining rules are of the form 𝐴→ 𝐵𝐶 𝐴, 𝐵, 𝐶∈ 𝑉 𝐴→𝑎 𝑎∈Σ Cannot have 𝑆 on the RHS of any rule. Lemma. Any CFG can be converted into an equivalent CFG in Chomsky normal form. (Proof in Sipser.) Lemma. If G is in Chomsky normal form, any derivation of string w of length 𝑛 in G has 2𝑛−1 steps. 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Chomsky Normal Form for CFGs Lemma. If G is in Chomsky normal form, any derivation of string 𝑤 of length 𝑛 in G has 2𝑛−1 steps. Proof idea: Only rules of the form 𝐴→ 𝐵𝐶 increase the number of symbols: need to apply rules of this form 𝑛−1 times. Only rules of the form 𝐴→𝑎 replace variables with terminals: need to apply rules of this form 𝑛 times. 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. ACFG is decidable. ACFG = { 〈G,w〉 | G is a CFG that generates string w } Proof: The following TM M decides ACFG. M = `` On input 〈𝑮,𝑤〉, where 𝑮 is a CFG and 𝑤 is a string: Convert G to Chomsky normal form. Let 𝑛=|𝑤|. Test all derivations with 2𝑛−1 steps. Accept if any derived 𝒘. O.w. reject.’’ 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Examples of decidable languages ADFA = { 〈D,w〉 | D is a DFA that accepts string w } ANFA = { 〈N,w〉 | N is an NFA that accepts string w } ACFG = { 〈G,w〉 | G is a CFG that generates string w } 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper More decidable languages EDFA = { 〈D〉 | D is a DFA that recognizes the empty language } EQDFA = { 〈 𝐷 1 , 𝐷 2 〉 | 𝐷 1 , 𝐷 2 are DFAs and 𝐿(𝐷 1 )=𝐿( 𝐷 2 ) } ECFG = { 〈G〉 | G is a CFG that generates the empty language} 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. EDFA is decidable. EDFA = { ⟨𝑫⟩ | 𝑫 is a DFA that recognizes ∅.} Proof: The following TM M decides EDFA. M = `` On input 〈𝑫〉, where 𝑫 is a DFA: Use BFS to determine if an accepting state of D is reachable from from its start state. Accept if not. O.w. reject.’’ 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. EQDFA is decidable. EQDFA = { ⟨ 𝑫 𝟏 , 𝑫 𝟐 ⟩| 𝑫 𝟏 , 𝑫 𝟐 are DFAs & 𝑳 𝑫 𝟏 =𝑳( 𝑫 𝟐 )} Proof: The following TM M decides EQDFA. M = `` On input 〈 𝑫 𝟏 , 𝑫 𝟐 〉, where 𝑫 𝟏 , 𝑫 𝟐 are DFAs: Construct a DFA D that recognizes the set difference of 𝑳 𝑫 𝟏 and 𝑳( 𝑫 𝟐 ). Run the decider for EDFA on <D>. If it accepts, accept. O.w. reject.’’ (on the board) 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. ECFG is decidable. ECFG = { ⟨𝑮⟩ | 𝑮 is a CFG that recognizes ∅.} Proof: The following TM M decides ECFG. M = `` On input 〈𝑮〉, where 𝑮 is a CFG: Mark all terminals in G. Repeat until no new variable is marked: Mark any variable A where G has a rule A→… and each variable/terminal on the RHS is already marked. Accept if the start variable is unmarked. O.w. reject.’’ 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

Sofya Raskhodnikova; based on slides by Nick Hopper Exercises Prove that the following language is decidable: Formulate the following problem as a language and prove that it is decidable: Given a PDA and a string, determine if the PDA accepts the string. Can a TM just simulate P on w, accept if it accepts and reject o.w.? RDFA = { 〈D,w〉 | D is a DFA that rejects string w } APDA = { 〈P,w〉 | P is a PDA that accepts string w } 11/19/2018 Sofya Raskhodnikova; based on slides by Nick Hopper

I-clicker problem (frequency: AC) A decider for APDA can, on input <P, w> simulate P on w, accept if it accepts and reject o.w. convert P to an equivalent CFG G and then run a decider for ACFG, accept if it accepts and reject o.w. convert P to an equivalent CFG G and then run a decider for ACFG, accept if it rejects and accept o.w. None of the above. More than one choice above works. {madam, dad, but, tub, book}