Decidability and Undecidability of Automata, Grammars & Languages in CSC 473, Study notes of Computer Science

Decidability and undecidability of various problems related to automata, grammars, and languages in the context of the csc 473 course on theory of computation. Decidability of membership problems for dfas, nfas, and regular expressions, as well as decidability of emptiness and equivalence problems for dfas. The document also introduces the concept of the halting problem and its undecidability.

Typology: Study notes

Pre 2010

Uploaded on 09/17/2009

koofers-user-5sr-1
koofers-user-5sr-1 🇺🇸

9 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSC 473 Automata, Grammars & Languages 10/31/2007
Lecture 06 1
C SC 473 Automata, Grammars & Languages
Theory of Computation
Lecture 06
Decidability
and
Undecidability
C SC 473 Automata, Grammars & Languages 2
Decidable Problems for Regular Languages
Theorem 4.1: (Membership/Acceptance Prob. for DFAs)
is a
decidable language.
Pf: A decider for the language is:
{ , | is a DFA and ( ) }
=
A A w A w L A
DFA
M= “On input <A,w>:
Simulate Aon w.
If the simulation reaches an
accept state, halt and accept. If it
ends (jams) in a non-accept state,
halt and reject.”
C SC 473 Automata, Grammars & Languages 3
Decidable—Regular Lang.s (cont’d)
Theorem 4.2: (Membership/Acceptance Prob. for NFAs)
is a
decidable language.
Pf: A decider for the language is:
{ , | is an NFA and ( ) }
= A N w N w L N
NFA
M= “On input <N,w>:
Use the Rabin-Scott algorithm
to convert Nto DFA A
Run the Theorem 4.1 algorithm
with input <A,w>.”
If that algorithm accepts, then
accept; otherwise reject.”
pf3
pf4
pf5

Partial preview of the text

Download Decidability and Undecidability of Automata, Grammars & Languages in CSC 473 and more Study notes Computer Science in PDF only on Docsity!

C SC 473 Automata, Grammars & Languages

Theory of Computation

Lecture 06

Decidability and Undecidability

C SC 473 Automata, Grammars & Languages 2

Decidable Problems for Regular Languages

  • Theorem 4.1: (Membership/Acceptance Prob. for DFAs) is a decidable language. Pf: A decider for the language is:

A DFA = { A w , | A is a DFA and w ∈ L A ( ) }

  • M = “On input :
    • Simulate A on w.
    • If the simulation reaches an accept state, halt and accept. If it ends (jams) in a non-accept state, halt and reject .” •

C SC 473 Automata, Grammars & Languages 3

Decidable—Regular Lang.s (cont’d)

  • Theorem 4.2: (Membership/Acceptance Prob. for NFAs) is a decidable language. Pf: A decider for the language is:

A NFA = { N w , | N is an NFA and wL N ( ) }

  • M = “On input :
    • Use the Rabin-Scott algorithm to convert N to DFA A
    • Run the Theorem 4.1 algorithm with input < A,w>.”
    • If that algorithm accepts, then accept; otherwise reject.” •

C SC 473 Automata, Grammars & Languages 4

Decidable—Regular Lang.s (cont’d)

  • Theorem 4.3: (Membership Prob. for RegEx’s) is a decidable language. Pf: Use the algorithm to convert R to an equivalent NFA N and use the algorithm of Theorem 4.2 with input __ •

A (^) REX= { R w , | R is a regular expression and wL R ( ) }

C SC 473 Automata, Grammars & Languages 5

Decidable—Regular Lang.s (cont’d)

  • Theorem 4.4: ( Emptiness Problem for DFAs) is a decidable language. Pf: A decider for the language is:

E (^) DFA= { A | A is a DFA and L A ( ) = ∅}

  • T = “On input :

    • repeat {
    • } until ( )
    • if accept; otherwise reject.”

{ | ( )( ) δ( , ) }

M S

S M q a p M p a q

S = M

S ←{ q 0 }

F ∩ M = ∅

C SC 473 Automata, Grammars & Languages 6

Decidable—Regular Lang.s (cont’d)

  • Theorem 4.5: ( Equivalence Problem for DFAs) is a decidable language. Pf: Observe that

Because of closure properties, there is an algorithm to construct a DFA C from A , B that accepts Use Theorem 4.4 with __ to test whether If that algorithm accepts, then accept; otherwise, reject.

EQ (^) DFA= { A B , | A B , are DFA and L A ( ) = ( L B )}

( ) ( ) ( ) ( ) where ( ) ( ) ( ( ) ( )) ( ( ) ( ))

L A L B L A L B
L A L B L A L B L A L B
L A ( ) ⊕ L B ( )
L C ( ) = ∅.

C SC 473 Automata, Grammars & Languages 10

The Halting Problem

  • Although the following language is TM-recognizable, we will show it is not decidable.
  • This is called the Membership Problem for TMs, and by some authors the Halting Problem for TMs: given a TM M and string w, does M accept w?
  • Why called “Halting Problem”? Given a TM M , can always alter it to an equivalent TM M ′ such that: M ′ halts on w iff M ′ accepts w (iff M accepts w ). Pf: For each undefined transition δ( q,a ) in M, M ′ will transition to a state and loop forever; also goes to the same loop state •
  • Thus acceptance can be made synonymous with halting

A (^) TM= { M w , | M is a TM and wL M ( )}

q (^) lo o p q re je c t

C SC 473 Automata, Grammars & Languages 11

The Halting Problem (cont’d)

  • Thm: is Turing-recognizable. Pf: Let U be a UTM. A recognizer for is:

A (^) TM= { M w , | M is a TM and wL M ( )}

U

yes

no

M w , ∈ L R ( ) ⇔ M w , ∈ L U ( ) ⇔ wL M ( ) ⇔ M w , ∈ A 

TM

yes M w , no

A TM

R

C SC 473 Automata, Grammars & Languages 12

The Halting Problem (cont’d)

  • Thm: is undecidable. Pf: Proof by contradiction. Assume that is decidable. Then it has a decider; call it H. H behaves as follows:

Construct a TM D that calls H as a subroutine. On input 〈 M 〉, D runs H on 〈 M , 〈 M 〉〉. That is, D determines if M accepts or rejects its own description as input. If M accepts 〈 M 〉, then D rejects; If M rejects 〈 M 〉, then D accepts. Here is the picture of how D behaves:

A (^) TM= { M w , | M is a TM and wL M ( )}

H

{ if M accepts w }

accept M w , reject

A TM

{ if M does not accept w }

C SC 473 Automata, Grammars & Languages 13

The Halting Problem (cont’d)

  • What happens if we run D on its own description 〈 D 〉? Set 〈 M 〉 = 〈 D 〉 in the above. Then This contradiction shows that decider H cannot exist. •

H

{ if M acceptsM 〉 } accept M reject { if M does not acceptM 〉 }

M , M

D accept

reject

{ if M does not acceptM 〉 }

{ if M acceptsM 〉 } ML D ( ) ⇔ ML M ( )

D ∈ L D ( ) ⇔ D ∉ L D ( ).

C SC 473 Automata, Grammars & Languages 14

“Diagonalization”—Why called?

1 2 3 1 1 1 2 1 3 1 2 1 2 2 2 3 2 3 1 3 2 3 3 3

M M M
M M M M M M M
M M M M M M M
M M M M M M M
D D ( D )

is D ( D ) = accept or reject?

D

D ( Mi ) = accept ⇔ Mi ( M i )= reject

D ( D ) = accept ⇔ D ( D )= reject

D computes the opposite of the diagonal entries

TMs →

Encodings

(^) →

C SC 473 Automata, Grammars & Languages 15

Decidable vs Recognizable Sets: Basics

  • Theorem: decidable decidable Proof: If L is decidable, it has a decider M. The decider halts for every input in either the accepting halt state or in the rejecting halt state. Construct from M as follows: make the accepting halt state the rejecting state and the rejecting halt state the accepting state. Then that is, •
⇒ L

q accept

M

wL ( M )⇔ wL ( M ), L ( M )= L ( M ).

L

q reject