Decidability and Reducibility, Study Guides, Projects, Research of Theory of Automata

Advance Theory of Automata topic decidebality and reducibality

Typology: Study Guides, Projects, Research

2018/2019

Uploaded on 05/26/2019

samishaikh
samishaikh 🇵🇰

1 document

1 / 47

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Computer
Computer
Language Theory
Language Theory
Chapter 4: Decidability
Chapter 4: Decidability
Last modified
3/24/19
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f

Partial preview of the text

Download Decidability and Reducibility and more Study Guides, Projects, Research Theory of Automata in PDF only on Docsity!

Computer

Computer

Language Theory

Language Theory

Chapter 4: Decidability

Chapter 4: Decidability

Last modified

3/24/

Limitations of Algorithmic

Limitations of Algorithmic

Solvability

Solvability

In this chapter we investigate the power of

In this chapter we investigate the power of

algorithms to solve problems

algorithms to solve problems

Some can be solved algorithmically and some

Some can be solved algorithmically and some

cannot

cannot

Why we study unsolvability

Why we study unsolvability

Useful because then can realize that searching for

Useful because then can realize that searching for

an algorithmic solution is a waste of time

an algorithmic solution is a waste of time

Perhaps the problem can be simplified

Perhaps the problem can be simplified

Gain an perspective on computability and its limits

Gain an perspective on computability and its limits

In my view also related to complexity (Chapter 7)

In my view also related to complexity (Chapter 7)

First we study whether there is an algorithmic solution andFirst we study whether there is an algorithmic solution and

then we study whether there is an “efficient” (polynomial-

then we study whether there is an “efficient” (polynomial-

time) one

time) one

Decidable Languages

Decidable Languages

We start with problems that are

We start with problems that are

decidable

decidable

We first look at problems concerning

We first look at problems concerning

regular languages and then those for

regular languages and then those for

context-free languages

context-free languages

Decidable Problems for Regular

Decidable Problems for Regular

Languages

Languages

We give algorithms for testing whether a finite

We give algorithms for testing whether a finite

automaton accepts a string, whether the language of a

automaton accepts a string, whether the language of a

finite automaton is empty, and whether two finite

finite automaton is empty, and whether two finite

automata are equivalent

automata are equivalent

We represent the problems by

We represent the problems by languages

languages (not FAs)

(not FAs)

Let A

Let A

DFA

DFA

={(B, w)|B is a DFA that accepts string w}

={(B, w)|B is a DFA that accepts string w}

The problem of testing whether a DFA B accepts aThe problem of testing whether a DFA B accepts a

specific input w is the same as testing whether (B,w) is a specific input w is the same as testing whether (B,w) is a

member of the language A

member of the language A

DFA

DFA

.

.

Showing that the language is decidable is the same thing

Showing that the language is decidable is the same thing

as showing that the computational problem is decidable

as showing that the computational problem is decidable

So do you understand what A

So do you understand what A

DFADFA

represents? If you had to

represents? If you had to

list the elements of A

list the elements of A

DFADFA

what would they be?

what would they be?

Outline of Proof

Outline of Proof

Must take B as input, described as a string, and then

Must take B as input, described as a string, and then

simulate it

simulate it

This means the algorithm for simulating any DFA must be embodied

This means the algorithm for simulating any DFA must be embodied

in the TM’s state transitions

in the TM’s state transitions

Think about this. Given a current state and input symbol, scan the

Think about this. Given a current state and input symbol, scan the

tape for the encoded transition function and then use that info to

tape for the encoded transition function and then use that info to

determine new state

determine new state

The actual proof would describe how a TM simulates a DFAThe actual proof would describe how a TM simulates a DFA

Can assume B is represented by its 5 components and then we have

Can assume B is represented by its 5 components and then we have

w

w

Note that the TM must be able to handle

Note that the TM must be able to handle any

any DFA, not just this one

DFA, not just this one

Keep track of current state and position in w by writing on the tape

Keep track of current state and position in w by writing on the tape

Initially current state is q0 and current position is leftmost symbol of w

Initially current state is q0 and current position is leftmost symbol of w

The states and position are updated using the transition function

The states and position are updated using the transition function δ

δ

TM M’s

TM M’s δ

δ not the same as DFA B’s

not the same as DFA B’s δ

δ

When M finishes processing, accept if in an accept state; else reject.

When M finishes processing, accept if in an accept state; else reject.

The implementation will make it clear that will complete in finite

The implementation will make it clear that will complete in finite

time. time.

A

A

NFA

NFA

is a Decidable

is a Decidable

Language

Language

Proof Idea:

Proof Idea:

Because we have proven decidability for DFAs, all we

Because we have proven decidability for DFAs, all we

need to do is convert the NFA to a DFA.

need to do is convert the NFA to a DFA.

N = On input (B,w) where B is an NFA and w is a stringN = On input (B,w) where B is an NFA and w is a string

Convert NFA B to an equivalent DFA C, using the

Convert NFA B to an equivalent DFA C, using the

procedure for conversion given in Theorem 1.

procedure for conversion given in Theorem 1.

Run TM M on input (C,w) using the theorem we just

Run TM M on input (C,w) using the theorem we just

proved

proved

3.3. If M accepts, then accept; else rejectIf M accepts, then accept; else reject

Running TM M in step 2 means incorporating M into

Running TM M in step 2 means incorporating M into

the design of N as a subroutine

the design of N as a subroutine

Note that these proofs allow the TM to be described

Note that these proofs allow the TM to be described

at the highest of the 3 levels we discussed in Chapter

at the highest of the 3 levels we discussed in Chapter

3 (and even then, without most of the details!).

3 (and even then, without most of the details!).

EQ

EQ

DFA

DFA

is a Decidable

is a Decidable

Language

Language

EQ

EQ

DFA

DFA

={(A,B)|A and B are DFAs and L(A)=L(B)}

={(A,B)|A and B are DFAs and L(A)=L(B)}

Proof idea

Proof idea

Construct a DFA C from A and B, where C accepts only those

Construct a DFA C from A and B, where C accepts only those

strings accepted by either A or B but not both (symmetric

strings accepted by either A or B but not both (symmetric

difference)

difference)

If A and B accept the same language, then C will accept nothingIf A and B accept the same language, then C will accept nothing

and we can use the previous proof (for

and we can use the previous proof (for

E

E

DFA)

DFA)

to check for this.

to check for this.

So, the proof is:So, the proof is:

F = On input (A,B) where A and B are DFAs:

F = On input (A,B) where A and B are DFAs:

Construct DFA C that is the symmetric difference of A and

Construct DFA C that is the symmetric difference of A and

B (details on how to do this on next slide) B (details on how to do this on next slide)

Run TM T from the proof from last slide on input (C)

Run TM T from the proof from last slide on input (C)

If T accepts (sym. diff=

If T accepts (sym. diff= 

) then accept. If T rejects then

) then accept. If T rejects then

reject

reject

How to Construct C

How to Construct C

L(C) = (L(A) ∩ L(B)’)

L(C) = (L(A) ∩ L(B)’) 

(L(A)’ ∩ L(B))

(L(A)’ ∩ L(B))

We used proofs by construction that regular

We used proofs by construction that regular

languages are closed under

languages are closed under  , ∩ , and

, ∩ , and

complement

complement

We can use those constructions to construct a

We can use those constructions to construct a

FA that accepts L(C)

FA that accepts L(C)

Wait a minute! The book is quite cavalier! We never

Wait a minute! The book is quite cavalier! We never

proved regular languages are closed under ∩

proved regular languages are closed under ∩

L(A

L(B)

Complement

symbol

A

A

CFG

CFG

is a Decidable

is a Decidable

Language

Language

Proof Idea:

Proof Idea:

For CFG G and string w want to determine

For CFG G and string w want to determine

whether G generates w. One idea is to use G to

whether G generates w. One idea is to use G to

go through all derivations. This will not work,

go through all derivations. This will not work,

why?

why?

Because this method a best will yield a TM that is a

Because this method a best will yield a TM that is a

recognizer, not a decider. Can generate infinite strings

recognizer, not a decider. Can generate infinite strings

and if not in the language, will never know it.

and if not in the language, will never know it.

But since we know the length of w, we can exploit this.

But since we know the length of w, we can exploit this.

How?

How?

A string w of length n will have a derivation that uses

A string w of length n will have a derivation that uses

2n-1 steps if the CFG is in Chomsky-Normal Form.

2n-1 steps if the CFG is in Chomsky-Normal Form.

So first convert to Chomsky-Normal Form

So first convert to Chomsky-Normal Form

Then list all derivations of length 2n-1 steps. If any

Then list all derivations of length 2n-1 steps. If any

generates w, then accept, else reject. generates w, then accept, else reject.

This is a variant of breadth first search, but instead ofThis is a variant of breadth first search, but instead of

extended the depth 1 at a time we allow it to go 2n-1 at a

extended the depth 1 at a time we allow it to go 2n-1 at a

time. As long as finite depth extension, we are okay time. As long as finite depth extension, we are okay

E

E

CFG

CFG

is a Decidable

is a Decidable

Language (cont)

Language (cont)

Proof Idea:

Proof Idea:

Can the start variable generate a string of

Can the start variable generate a string of

terminals?

terminals?

Determine for each variable if it can generate

Determine for each variable if it can generate

any string of terminals and if so, mark it

any string of terminals and if so, mark it

Keep working backwards so that if the right-side

Keep working backwards so that if the right-side

of any rule has only marked items, then mark

of any rule has only marked items, then mark

the LHS

the LHS

For example, if X

For example, if X YZ and Y and Z are marked, then

YZ and Y and Z are marked, then

mark X mark X

If you mark S, then done; if nothing else to mark and

If you mark S, then done; if nothing else to mark and

S not marked, then reject

S not marked, then reject

You start by marking all terminal symbols

You start by marking all terminal symbols

EQ

EQ

CFG

CFG

is not a Decidable

is not a Decidable

Language

Language

We cannot reuse the reasoning to

We cannot reuse the reasoning to

show that EQ

show that EQ

DFA

DFA

is a decidable

is a decidable

language since CFGs are not closed

language since CFGs are not closed

under complement and intersection

under complement and intersection

As it turns out, EQ

As it turns out, EQ

CFG

CFG

is not

is not

decidable!

decidable!

We will learn in Chapter 5 how to

We will learn in Chapter 5 how to

prove things undecidable

prove things undecidable

Hierarchy of Classes of

Hierarchy of Classes of

Languages

Languages

Regular

Context-

Free

Decidable

Turing-

recognizable

We proved Regular  Context-

free since we can convert a FA

into a CFG

We just proved that every

Context-free language is

decidable

From the definitions in

Chapter 3 it is clear that every

Decidable language is trivially

Turing-recognizable. We

hinted that not every Turing-

recognizable language is

Decidable. Next we prove that!

Chapter 4.

Chapter 4.

The Halting Problem

The Halting Problem