280 likes | 399 Views
CSCI 2670 Introduction to Theory of Computing. October 18, 2005. Agenda. Last week Decidable problems involving regular languages, finite automata, and CFG’s One undecidable language EQ CFG This week Undecidable languages Techniques for showing a languages is not decidable. Announcements.
E N D
CSCI 2670Introduction to Theory of Computing October 18, 2005
Agenda • Last week • Decidable problems involving regular languages, finite automata, and CFG’s • One undecidable language • EQCFG • This week • Undecidable languages • Techniques for showing a languages is not decidable October 18, 2005
Announcements • Quiz tomorrow • Enumerators, definition of algorithm, decidable languages • Recommended problems • 4.6, 4.7, 4.22, 4.25, 4.26 October 18, 2005
Context-free Turing-recognizable Decidable Regular Relationship of classes of languages October 18, 2005
Group project 1 FDFA = {<A> | A is a DFA and L(A) is finite} October 18, 2005
Group project 2 PRIME = { n | n is a prime number} October 18, 2005
Group project 3 CONN = {<G> | G is a connected graph} October 18, 2005
Group project 4 L10DFA = {D | D is a DFA that accepts every string w with |w| = 10} October 18, 2005
Group project 5 INTCFG = {<G1, G2, w> | G1 and G2 are CFG’s and w is accepted by both} October 18, 2005
Group project 6 INTLCFG = L(G1 G2), where G1 and G2 are CFG’s October 18, 2005
Turing machine acceptance problem • Consider the following language ATM={<M,w> | M is a TM that accepts w} Theorem: ATM is Turing-recognizable Theorem: ATM is undecidable Proof: The universal Turing machine recognizes, but does not decide, ATM October 18, 2005
The universal Turing machine U = “On input <M, w>, where M is a TM and w is a string: • Simulate M on input w • If M ever enters its accept state, accept • If M ever enters its reject state, reject” October 18, 2005
Why can’t U decide ATM? • Intuitively, if M never halts on w, then U never halts on <M,w> • This is also known as the halting problem • Given a TM M and a string w, does M halt on input w? • Undecidable • We will prove this more rigorously later • Need some new tools for proving properties of languages October 18, 2005
Comparing the size of infinite sets • Given two infinite sets A and B, is there any way of determining if |A|=|B| or if |A|>|B|? • Yes! • Functional correspondence can show two infinite sets have the same number of elements • Diagonalization can show one infinite set has more elements than another October 18, 2005
Functional correspondence • Let f be a function from A to B • f is called one-to-one if … • f(a1) ≠ f(a2) whenever a1 ≠ a2 • f is called onto if … • For every b B, there is some a A such that f(a) = b • f is called a correspondence if it is one-to-one and onto • A correspondence is a way to pair elements of the two sets October 18, 2005
Example correspondence • Consider f:Z*→ P, where Z*= {0,1,2,…} and P = {positive squares} • P = {1, 4, 9, 16, 25, …} • f(x) = (x+1)2 • Is f one-to-one? • Yes • Is f onto? • Yes • Therefore |Z| = |P| October 18, 2005
Countable sets • Let N = {1, 2, 3, …} be the set of natural numbers • The set A is countable if … • A is finite, or • |A| = |N| • Some example of countable sets • Integers • {x | x Z and x = 1 (mod 3)} October 18, 2005
The positive rational numbers • Is Q = {m/n | m,n N} countable? • Yes! Etc… October 18, 2005
The real numbers • Is R+ (the set of positive real numbers) countable? • No! X = 4.1337… Diagonalization October 18, 2005
The set of all infinite binary strings • Is the set of all infinite binary strings countable? • No • Diagonalization also works to prove this is not countable • On the other hand, the set of finite length binary strings is countable! • Let xb be the binary representation of x • f(x) = xb is 1-to-1 and onto function from N to the set of finite binary strings October 18, 2005
Is the set of all languages in Σ* countable? • No • This set has the same cardinality as the set of binary strings Σ* = {ε, a, b, aa, ab, ba, bb, aaa, aab, …} A = { a, ab, aaa, …} A = 0 1 0 0 1 0 0 1 … October 18, 2005
Σ* vs. languages in Σ* • The set Σ* is countable • Let |Σ| = n • Every string in Σ* can be associated with a unique number, y, in base-(n+1) • E.g., if Σ = {a, b, c}, we can associate the string acba with the value 1*43+3*42+2*41+1*40 = 121 • Let f(x) be the string associated with x • The set of all languages in Σ*is the power set of Σ* October 18, 2005
Is the set of all TM’s countable? • Yes • Since all Turing machines can be represented by a string, the set of all Turing machines are countable Theorem: Some languages are not Turing-recognizable Proof: There are more languages than there are Turing machines October 18, 2005
Undecidability of halting problem Theorem: ATM is undecidable Proof: (By contradiction) Assume ATM is decidable and let H be a decider for ATM H(<M,w>) = { accept if M accepts w reject if M does not accept w October 18, 2005
Proof (cont.) • Consider the TM D that submits the string <M> as input to the TM M D = “On input <M>, where M is a TM: • Run H on input <M,<M>> • If H accepts <M,<M>>, reject • If H rejects <M,<M>>, accept • Since H is a decider, it must accept or reject • Therefore, D is a decider as well October 18, 2005
Proof (cont.) • What happens if D’s input is <D>? D(<D>) = { • D cannot exist! • Therefore, H cannot exist – i.e., ATM is undecidable reject if D accepts <D> accept if D does not accept <D> October 18, 2005
Recap • Assume H decides ATM • H(<M,w>) = accept if TM M accepts w, reject otherwise • Define D using H • D(<M>) returns opposite of H(<M,<M>>) • Consider D(<D>) • D accepts <D> if and only if D rejects <D> October 18, 2005