Fall 2011
Decidability
Week-7b
[21 Oct 2011]
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:
DFA
w w L
DFA
w w L
5
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?
1. 2.
Do two regular expressions define the same language? Do two finite automata accept the same language?
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:
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
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
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
b b a
+
b b
a b a
+
Question:
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:
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
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
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