prof. busch - rpi1 decidable problems of regular languages

16
Prof. Busch - RPI 1 Decidable Problems of Regular Languages

Upload: magnus-gibbs

Post on 22-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 1

Decidable Problemsof

Regular Languages

Page 2: Prof. Busch - RPI1 Decidable Problems of 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

Page 3: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 3

DFA

Lw

DFA

Lw

w

w

Page 4: Prof. Busch - RPI1 Decidable Problems of Regular Languages

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:

Page 5: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 5

DFA

L

DFA

L

Page 6: Prof. Busch - RPI1 Decidable Problems of Regular Languages

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:

Page 7: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 7

DFA

L is infinite

DFA

L is finite

Page 8: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 8

Given regular languages and how can we check if ?

1L 2L

21 LL Question:

)()( 2121 LLLLFind ifAnswer:

Page 9: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 9

)()( 2121 LLLL

21 LL 21 LLand

21 LL

1L 2L 1L2L

21 LL 12 LL 2L 1L

Page 10: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 10

)()( 2121 LLLL

21 LL 21 LLor

1L 2L 1L2L

21 LL 12 LL

21 LL

Page 11: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 11

Decidable Problemsof

Context-Free Languages

Page 12: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 12

Membership Question:

for context-free grammarfind if string

G)(GLw

Membership Algorithms: Parsers

• Exhaustive search parser

• CYK parsing algorithm

Page 13: Prof. Busch - RPI1 Decidable Problems of Regular Languages

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

Page 14: Prof. Busch - RPI1 Decidable Problems of Regular Languages

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

Page 15: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 15

Example:

cBSC

bbbBB

aaCbA

ABS

|

|

S

A

B

C

Dependency graph Infinite language

Page 16: Prof. Busch - RPI1 Decidable Problems of Regular Languages

Prof. Busch - RPI 16

cBSC

bbbBB

aaCbA

ABS

|

|

acbbSbbbacBSbBaCbBABS

ii bbbSacbb

bbbSacbbacbbSbbbS

)()(

)()( 22