Anda di halaman 1dari 23

Theory of Automata

Fall 2011
Decidability
Week-7b
[21 Oct 2011]

Chapter 11: Decidability

A problem is called a decision problem if its solution is either YES or NO.

Definition: a decision problem is decidable, or effectively solvable, if there is an algorithm that can find the answer for any input in a finite number of steps.
2

Decision Problems

Membership: Does w L Do two regular expressions define the same language? Do two finite automata accept the same language? Is L Empty? Is L finite or infinite?

Membership Question
Question: Given regular language L and string w how can we check if w L ?

Answer:

Take the DFA that accepts and check if w is accepted

DFA

w w L

DFA

w w L
5

Chapter 11: Decidability

Three important questions: 1. Do two regular expressions define the same language? 2. Do two finite automata accept the same language? 3. Does the language defined by a finite automaton have a finite number of words? Infinite? None?

Chapter 11: Decidability

1. 2.

Do two regular expressions define the same language? Do two finite automata accept the same language?

Problems 1 and 2 are equivalent:


It is enough to transfer the two regular expressions into equivalent finite automata (it could be done in a finite number of steps) and then resolve Problem 2. Or we can transfer the two finite automata into regular expressions (it could be done in a finite number of steps) and then resolve Problem 1.
7

Chapter 11: Decidability

Problem 2: Finite algorithm


From two finite automata that accept languages L1 and L2, we construct a finite automaton that accepts (L1 L2) + (L2 L1) L1 and L2 are equivalent if and only if this language is ..??

Method 1: Convert this finite automaton into a regular


expression (using the finite algorithm defined in the proof of Kleenes theorem). If you end up with a regular expression then the language is not empty, otherwise it is empty.
8

Chapter 11: Decidability

If the algorithm leads to:

Then the finite automaton accepts at least one word If the algorithm leads to:
a,b

a,b
+

OR similar case Then the finite automaton does not accept any word
9

Question:

Given regular language L how can we check if L empty: is ( L?= )

Answer:

Take the DFA that accepts Check if there is any path from the initial state to a final state

10

DFA

DFA

L=
11

Chapter 11: Decidability

Method: Answer the question: is there any path from to +? The Blue Paint Algorithm: 1. Mark the start state. (Paint it blue.) 2. From every blue state, follow every arrow that goes out of the state, and paint the destination state blue. Delete each arrow that was followed. 3. Repeat step 2 until there are no new blue states. 4. If there is any final state that is blue, then there are words in the language accepted by the finite automaton. If not, the language is empty.
12

Chapter 11: Decidability

a a,b a b b

a b a b b a b b b a
+

b a
+

a b a b a
+

a,b

a
13

Chapter 11: Decidability

b b a
+

b b

a b a
+

The language is empty.


14

Question:

Given regular language how can we check if L finite? is

Answer:

Take the DFA that accepts Check if there is a walk with cycle from the initial state to a final state

15

DFA

is infinite

DFA

is finite
16

Question:

L1 Given regular languages and how can we check if L1 ? L2 =

L2

Answer:

Find if

( L1 L2 ) ( L1 L2 ) =

17

( L1 L2 ) ( L1 L2 ) = L1 L2 =
and

L1 L2 =

L1

L2 L 2

L2

L1 L1

L1 L2 L1 = L2

L2 L1

18

( L1 L2 ) ( L1 L2 ) L1 L2
or

L1 L2

L1

L2

L2

L1

L1 L2 L1 L2

L2 L1

19

Chapter 11: Decidability

Theorem: Let F be a finite automaton with N states. If the language accepted by F is not empty, then it contains at least one word with N or fewer letters. Method 3. Try all words with N and fewer letters. If the finite automaton accepts none of them, then the language accepted by this automaton is empty.

20

Chapter 11: Decidability

Problem 3. Does the language defined by a finite automaton has a finite number of words? Infinite? None? None? Done previously. Finite or Infinite language? Solution 1: Does corresponding RE contain * ? Solution 2: Use the following theorem.

21

Infinite language???
Theorem. Let F be a finite automaton with N states. F accepts a word w such that N length(w) < 2N if and only if the language accepted by F is infinite. Proof: Apply Pumping lemma. If w, N length(w) is accepted then w created loop while following N states pumping lemma creates infinite number of accepted words If language accepted by F is infinite then consider any accepted word with length > N. This word creates loop in FA. Shorten the word by cutting one loop, it will be reduced by length up to N. Repeat until length falls between N and 2N.
22

SUMMARY

Membership: Does w L Do two regular expressions define the same language? Do two finite automata accept the same language? Is L Empty? Is L finite or infinite?

23

Anda mungkin juga menyukai