prof. busch - rpi1 decidable problems of regular languages
TRANSCRIPT
Prof. Busch - RPI 1
Decidable Problemsof
Regular Languages
Prof. Busch - RPI 2
Membership Question
Question: Given regular languageand string how can we check if ?
L
Lw w
Answer: Take the DFA that acceptsand check if is accepted
Lw
Prof. Busch - RPI 3
DFA
Lw
DFA
Lw
w
w
Prof. Busch - RPI 4
Given regular languagehow can we checkif is empty: ?
L
L
Take the DFA that accepts
Check if there is any path from the initial state to an accepting state
L
)( L
Question:
Answer:
Prof. Busch - RPI 5
DFA
L
DFA
L
Prof. Busch - RPI 6
Given regular languagehow can we checkif is finite?
L
L
Take the DFA that accepts
Check if there is a walk with cyclefrom the initial state to a final state
L
Question:
Answer:
Prof. Busch - RPI 7
DFA
L is infinite
DFA
L is finite
Prof. Busch - RPI 8
Given regular languages and how can we check if ?
1L 2L
21 LL Question:
)()( 2121 LLLLFind ifAnswer:
Prof. Busch - RPI 9
)()( 2121 LLLL
21 LL 21 LLand
21 LL
1L 2L 1L2L
21 LL 12 LL 2L 1L
Prof. Busch - RPI 10
)()( 2121 LLLL
21 LL 21 LLor
1L 2L 1L2L
21 LL 12 LL
21 LL
Prof. Busch - RPI 11
Decidable Problemsof
Context-Free Languages
Prof. Busch - RPI 12
Membership Question:
for context-free grammarfind if string
G)(GLw
Membership Algorithms: Parsers
• Exhaustive search parser
• CYK parsing algorithm
Prof. Busch - RPI 13
Empty Language Question:
for context-free grammar find if
G)(GL
Algorithm:
S
1. Remove useless variables
2. Check if start variable is useless
Prof. Busch - RPI 14
Infinite Language Question:
for context-free grammar find if is infinite
G)(GL
Algorithm:
1. Remove useless variables
2. Remove unit and productions
3. Create dependency graph for variables
4. If there is a loop in the dependency graph then the language is infinite
Prof. Busch - RPI 15
Example:
cBSC
bbbBB
aaCbA
ABS
|
|
S
A
B
C
Dependency graph Infinite language
Prof. Busch - RPI 16
cBSC
bbbBB
aaCbA
ABS
|
|
acbbSbbbacBSbBaCbBABS
ii bbbSacbb
bbbSacbbacbbSbbbS
)()(
)()( 22