94 views

Uploaded by Prashant Singh

This is an automata algrithm.

This is an automata algrithm.

© All Rights Reserved

- CloudFuze DataSheet
- SAP Investment Management (IM) Overview
- Hw5f03 Sol Post
- Tutorials Matlab Simulink
- Guide_to_reading_MIVR_logs_for_Telephony_Issues_-_IVR_Call_Flow.pdf
- Studying on the Compatibility Factor
- Computer Practical List 1
- Resume Online Final
- Multi Sever Queue Printout
- gs_pfile
- R code NB
- 3G NPM Activities (2)
- Output
- coding for the alien nation
- Datamato Agenda
- Lecture10-Parsing1afe
- JAVASCRIPTI.docx
- Java Prog 2 Assignment Question
- 1. Data Preparation.docx
- SPMS Computation Sheet

You are on page 1of 30

David Rodriguez-Velazquez

CS 6800

Summer I - 2009

The membership problem:

Problem:

Given a context-free grammar G and a string w

G = (V, ,P , S) where

V finite set of variables

(the alphabet) finite set of terminal symbols

P finite set of rules

S start symbol (distinguished element of V)

V and are assumed to be disjoint

G is used to generate the string of a language

Question:

Is w in L(G)?

J. Cocke

D. Younger,

T. Kasami

Independently developed an algorithm to answer

this question.

The Structure of the rules in a Chomsky Normal

Form grammar

Uses a dynamic programming or table-filling

algorithm

Normal Form is described by a set of

conditions that each rule in the grammar must

satisfy

Context-free grammar is in CNF if each rule

has one of the following forms:

A BC

A a, or

S

where B, C

terminal symbol

null string

V {S}

Each row corresponds to one length of

substrings

Bottom Row Strings of length 1

Second from Bottom Row Strings of length 2

.

.

Top Row string w

Xi, i is the set of variables A such that

A wi is a production of G

computed sets:

(Xi, i , Xi+1, j ), (Xi, i+1 , Xi+2, j ) (Xi, j-1 , Xj, j )

X1, 5

X1, 4

X1, 3

X1, 2

X1, 1

X2, 5

X2, 4

X2, 3

X2, 2

X3, 5

X3, 4

X3, 3

X4, 5

X4, 4

X5, 5

w1

w2

w3

w4

w5

X1, 5

X1, 4

X1, 3

X1, 2

X1, 1

X2, 5

X2, 4

X2, 3

X2, 2

X3, 5

X3, 4

X3, 3

X4, 5

X4, 4

X5, 5

w1

w2

w3

w4

w5

Show the CYK Algorithm with the following

example:

CNF grammar G

S AB | BC

A BA | a

B CC | b

C AB | a

w is baaba

Question Is baaba in L(G)?

S AB | BC

A BA | a

B CC | b

C AB | a

{B}

{A, C}

{A, C}

{B}

{A, C}

X1 , 2 = (Xi , i ,Xi+1 , j) = (X1 , 1 , X2 , 2)

{B}{A,C} = {BA, BC}

Steps:

Look for production rules to generate BA or BC

There are two: S and A

X1 , 2 = {S, A}

S AB | BC

A BA | a

B CC | b

C AB | a

{S, A}

{B}

{A, C}

{A, C}

{B}

{A, C}

X2 , 3 = (Xi , i ,Xi+1 , j) = (X2 , 2 , X3 , 3)

{A, C}{A,C} = {AA, AC, CA, CC} = Y

Steps:

Look for production rules to generate Y

There is one: B

S AB | BC

X2 , 3 = {B}

A BA | a

B CC | b

C AB | a

{S, A}

{B}

{B}

{A, C}

{A, C}

{B}

{A, C}

X3 , 4 = (Xi , i ,Xi+1 , j) = (X3 , 3 , X4 , 4)

{A, C}{B} = {AB, CB} = Y

Steps:

Look for production rules to generate Y

There are two: S and C

S AB | BC

X3 , 4 = {S, C}

A BA | a

B CC | b

C AB | a

{S, A}

{B}

{B}

{A, C}

{S, C}

{A, C}

{B}

{A, C}

X4 , 5 = (Xi , i ,Xi+1 , j) = (X4 , 4 , X5 , 5)

{B}{A, C} = {BA, BC} = Y

Steps:

Look for production rules to generate Y

There are two: S and A

S AB | BC

X4 , 5 = {S, A}

A BA | a

B CC | b

C AB | a

{S, A}

{B}

{B}

{A, C}

{S, C}

{A, C}

{S, A}

{B}

{A, C}

X1 , 3

= (X1 , 1 , X2 , 3) , (X1 , 2 , X3 , 3)

Steps:

Look for production rules to generate Y

S AB | BC

There are NONE: S and A

A BA | a

B CC | b

X1 , 3 =

C AB | a

no elements in this set (empty set)

{S, A}

{B}

{B}

{A, C}

{S, C}

{A, C}

{S, A}

{B}

{A, C}

X2 , 4

= (X2 , 2 , X3 , 4) , (X2 , 3 , X4 , 4)

Steps:

Look for production rules to generate Y

S AB | BC

There is one: B

A BA | a

B CC | b

X2 , 4 = {B}

C AB | a

{S, A}

{B}

{B}

{B}

{A, C}

{S, C}

{A, C}

{S, A}

{B}

{A, C}

X3 , 5

= (X3 , 3 , X4 , 5) , (X3 , 4 , X5 , 5)

{A,C}{S,A} U {S,C}{A,C}

= {AS, AA, CS, CA, SA, SC, CA, CC} = Y

Steps:

Look for production rules to generate Y

There is one: B

X3 , 5 = {B}

S AB | BC

A BA | a

B CC | b

C AB | a

{S, A}

{B}

{B}

{B}

{A, C}

{B}

{S, C}

{A, C}

{S, A}

{B}

{A, C}

{S, A, C}

{S, A}

{B}

X1, 5

{S, A, C}

{B}

{B}

{A, C}

{B}

{S, C}

{A, C}

{S, A}

{B}

{A, C}

- The algorithm populates the triangular table

Example (Result)

Is baaba in L(G)?

Yes

We can see the S in the set X1n where n = 5

We can see the table

the cell X15 = (S, A, C) then

if S X15 then baaba L(G)

Theorem

The CYK Algorithm correctly computes X i j for

all i and j; thus w is in L(G) if and only if S is in

X1n.

The running time of the algorithm is O(n3).

References

J. E. Hopcroft, R. Motwani, J. D. Ullman,

Introduction to Automata Theory, Languages

and Computation, Second Edition, Addison

Wesley, 2001

T.A. Sudkamp, An Introduction to the Theory

of Computer Science Languages and

Machines, Third Edition, Addison Wesley,

2006

Question

Show the CYK Algorithm with the following example:

CNF grammar G

S AB | BC

A BA | a

B CC | b

C AB | a

w is ababa

Question Is ababa in L(G)?

The Structure of the rules in a Chomsky Normal Form grammar

Uses a dynamic programming or table-filling algorithm

Complexity O(n3)

- CloudFuze DataSheetUploaded byRahul Moondra
- SAP Investment Management (IM) OverviewUploaded byLuisAlonsoHerreroScotto
- Hw5f03 Sol PostUploaded byRoland Raymond Dino
- Tutorials Matlab SimulinkUploaded byVõ Thanh Liêm
- Guide_to_reading_MIVR_logs_for_Telephony_Issues_-_IVR_Call_Flow.pdfUploaded bynguyen
- Studying on the Compatibility FactorUploaded bysocialmediabuzz
- Computer Practical List 1Uploaded byHello
- Resume Online FinalUploaded bymkrajkumar2003
- Multi Sever Queue PrintoutUploaded byMahesh Abnave
- gs_pfileUploaded byjonhinno
- R code NBUploaded bybrahmesh_sm
- 3G NPM Activities (2)Uploaded bylugano
- OutputUploaded byAgung Mukhlis Widodo
- coding for the alien nationUploaded byapi-294052132
- Datamato AgendaUploaded bymuscdalife
- Lecture10-Parsing1afeUploaded bypritorius789
- JAVASCRIPTI.docxUploaded byMalvina Latifaj
- Java Prog 2 Assignment QuestionUploaded bySaran Raj Retnam
- 1. Data Preparation.docxUploaded byAldo Addoodle
- SPMS Computation SheetUploaded bytin del rosario
- Admin Console QuickStartUploaded byabctester2552
- Workshop Windows PowerShell Scripting Language Workshop for Beginners [en]Uploaded byBarbi
- Ajit TimeTableUploaded byghodke_a527
- ARSTECHIUploaded byDivya Joshi
- RtmUploaded byGlutton Arch
- output_log.txtUploaded byGuillermo Nauds
- QuestUploaded bySayan Chakraborty
- 20, 21 Operator and Task AssignmentUploaded byAkash Tripathi
- New Error Codes 16sep2004Uploaded byCaroline Martinez
- HTML2Uploaded bySantos Antonio Abad

- lesson plan dos word finalUploaded byapi-249460707
- Wiki Archlinux OrgUploaded byoniromante
- Principles of Alternating CurrentUploaded byChris Osea Alvarez
- 06 Process CostingUploaded byJohn Glenn Lambayon
- Ps21867 p OriginalUploaded byOmar Leon
- Mquay ChilledUploaded byRidwan Pramudya
- IS-8329-1994Uploaded byMadanlal Varada
- Y6 Unit Plan SpreadsheetsUploaded byVamshi Krishna
- Application Note Component Selection and PCB LayoutUploaded byheocuibap
- Indian Economic Development NCERT Class XIUploaded byguru1241987babu
- Data communications and Network communicationsUploaded byJoshiAbhishek
- CH10AUploaded bynikowawa
- List of is StandardsUploaded bytceterex
- MGMT3052 Taxation & Tax Management (UWI)Uploaded bypayel02000
- AVR 254 Owners ManualUploaded bymini5robot
- Rules of Subject Verb Agreement in Standard EnglishUploaded byPRINTDESK by Dan
- Deep Underground Military Bases and the Black BudgetUploaded byOCTAGONUL
- Implementation of Dynamic Time Warping for Video IndexingUploaded byijcsis
- DOC-20180626-WA0018Uploaded bymanto
- 2012_60_02_P2Uploaded byheryjh
- Ernst And Young Report on Winnipeg Real EstateUploaded byTessa Vanderhart
- Gravimetric ChlorideUploaded bymarinegirl67
- FLIR-T420-T440-62101-XXXX-62102-XXXX-ManualUploaded byjuniornouchi
- The technically impossible HolocaustUploaded byHuckelberry
- Rufus Short Resume[2]Uploaded byStacy Elliott
- The History of Life Insurance Companies in India Began With the Establishment of Oriental Life Insurance Company in the Year 1818 in CalcuttaUploaded byPappu Jaiswal
- 200610Uploaded byAnonymous 9ufCY3
- Crisil Cement Industry Report.pdfUploaded byParr
- The World Conference On Laser, Optic Science & Photonics (LSP 2020) - SponUploaded byHazel Group
- Bone formation -ossification 2.pdfUploaded byalan