Download presentation
Presentation is loading. Please wait.
Published byLuke Fitzgerald Modified over 8 years ago
1
CSCI 2670 Introduction to Theory of Computing October 13, 2005
2
2 Agenda Yesterday –Decidability and regular languages Today –Putting things in perspective –More on decidability and regular languages –Decidability and context free grammars
3
October 13, 20053 Course goals Theoretically explore the capabilities and limitations of computers –Complexity theory What makes some problems computationally hard and others easy? –Computability theory What problems can be solved by a computer? –Automata theory How can we mathematically model computation?
4
October 13, 20054 Some perspective Automata theory –Introduced DFA’s, NFA’s, RE’s Showed that they all accept the same class of languages –Introduced CFG’s, PDA’s PDA is essentially an NFA with a stack PDA’s and CFG’s accept the same class of languages
5
October 13, 20055 Perspective (cont.) Computability Theory –Introduced TM’s Like PDA’s with more general memory model –Importance of TM’s Church-Turing Thesis Any algorithm can be implemented on a TM –Use the TM model and Church-Turing Thesis to understand and classify languages Decidable languages Undecidable languages Recognizable languages Unrecognizable languages Complements of languages in these classes
6
October 13, 20056 Perspective (cont.) Complexity theory (later this semester) –Use TM model to determine how long an algorithm takes to run Function of input length –Classify algorithms according to their complexity
7
October 13, 20057 Decidable languages A language is decidable if some Turing machine decides it –Every string in * is either accepted or rejected
8
October 13, 20058 Some decidable languages A DFA = { | B is a DFA that accepts input string w} A NFA = { | B is an NFA that accepts input string w} A REX = { | R is a regular expression that generates string w} E DFA = { | A is a DFA and L(A) = } EQ DFA = { | A and B are DFA’s and L(A) = L(B)}
9
October 13, 20059 Question How would we show that the following language is decidable? ALL DFA = { | A is a DFA that recognizes * }
10
October 13, 200510 Another question Let L be any regular language How would we show L is decidable? –Assume L is described using a DFA
11
October 13, 200511 Deciders and CFG’s Consider the following language A CFG = { | G is a CFG that generates string w} Is A CFG decidable? –Problem: How can we get a TM to simulate a CFG? Must be certain CFG tries a finite number of steps! –Solution: Use Chomsky normal form
12
October 13, 200512 Chomsky normal form review All rules are of the form A → BC A → a Where A, B, and C are any variables (B and C cannot be the start variable) S → ε is the only εrule, where S is the start variable
13
October 13, 200513 How many steps to generate w? If |w| = 0 –1 step If |w| = n > 0? –2n – 1 steps
14
October 13, 200514 TM simulating A CFG M = “On input, where G is a CFG 1.Convert G into Chomsky normal form 2.If |w| = 0 If there is an S → εrule, accept Otherwise, reject 3.List all derivations with 2|w|-1 steps If any generate w, accept Otherwise, reject”
15
October 13, 200515 Empty CFG’s Consider the following language E CFG = { | G is a CFG and L(G) = } Theorem: E CFG is decidable Can we use the TM in A CFG to prove this? –No. There are infinitely many possible strings in Σ * –Instead, we need to check if there is any way to get from the start variable to some string of terminals
16
October 13, 200516 Work backwards B = “On input, where G is a CFG 1.Mark all terminals 2.Repeat until no new variables are marked Mark any variable A if G has a rule A → U 1 U 2 …U k where U 1, U 2, …, U k are all marked 3.If S is marked, reject 4.Otherwise, accept”
17
October 13, 200517 What about EQ CFG? Recall for EQ DFA, we considered (L(A) L(B)) (L(A) L(B)) Will this work for CFG’s? –No. CFG’s are not closed under complementation or intersection EQ CFG is not a decidable language! –We will see this later
18
October 13, 200518 Decidability of CFL’s Theorem: Every context-free language L is decidable Proof: For each w, we need to decide whether or not w is in L. Let G be a CFG for L. This problem boils down to A CFG, which we showed is decidable. Question: Why don’t we just make a TM that simulates a PDA?
19
October 13, 200519 Relationship of classes of languages Regular Context- free Decidable Turing- recognizable
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.