# Regular Grammars Generate Regular Languages 1 Theorem Regular

- Slides: 44

Regular Grammars Generate Regular Languages 1

Theorem Regular grammars generate exactly the class of regular languages: If is a regular grammar then is a regular language If is a regular language then there is a regular grammar with 2

Proof First we prove: If is a regular grammar then is a regular language can be: Right-linear grammar or Left-linear grammar 3

The case of Right-Linear Grammars Let be a right-linear grammar We will show: is regular The proof: We will construct an NFA with 4

Grammar is right-linear Example: 5

Construct NFA such that every state is a variable: special final state 6

Add edges for each production: 7

8

9

10

11

12

NFA Grammar 13

In General A right-linear grammar has variables: and productions: or 14

We construct the NFA each variable such that: corresponds to a node: 15

For each production: we add transitions and intermediate nodes ……… 16

For each production: we add transitions and intermediate nodes ……… 17

Resulting NFA looks like this: 18

Now, we need to show: 19

The Case: Take We will show: there is a path with label from state to state in ………… 20

Grammar looks like: strings 21

22

Since: …… …… We have: 26

Since: We have: and …… We have: 27

The Case: Take We will show that in 28

Since there is a path …… 29

Write: There is a path …… …… 30

Since: …… …… This derivation is possible 31

Since: We have: 32

The Case of Left-Linear Grammars Let be a left-linear grammar We will show: is regular The proof: We will construct a right-linear grammar with 33

Since is left-linear grammar the productions look like: 34

Construct right-linear grammar In : 35

In : 36

It is easy to see that: Since is right-linear, we have: is regular language (homework) is regular language 37

Proof - Part 2 Now we will prove: If is a regular language then there is a regular grammar with Proof outline: we will take an NFA for and convert it to a regular grammar 38

Since is regular There is an NFA such that Example: 39

Convert to a right-linear grammar 40

41

42

We can generalize this process for any regular language : For any regular language we obtain an right-linear grammar with 43

Since is right-linear grammar is also a regular grammar with 44

- Regular grammars generate regular languages.
- Questions on context free grammar
- How to remove epsilon productions from grammar
- Type 0 grammar example
- What is unrestricted grammar
- Green theorem is the relation between
- Properties of regular languages
- Closure under union
- Regular and irregular languages
- Pumping lemma non regular languages examples
- Decision properties of regular languages
- Right linear grammar
- Cs
- Decision properties of regular languages
- Decision properties of regular languages
- Decision properties of regular language
- What is the remainder theorem formula
- Linear factors theorem and conjugate zeros theorem
- Factor theorem and remainder theorem
- Conjugate theorem
- What is the remainder theorum
- Rational root therom
- Program to generate triangular wave in 8051
- Random sample sas
- Generate sha-1 android studio
- Search by image
- The five axioms of urban economics
- Generate and develop artistic ideas
- What is tpin in sharekhan
- Udin verification
- Udin generate icsi
- Contoh generate and test
- Eclipse generate jpa entities from database
- Frequency synonyms
- Purdom power plant
- Concept generation in product design
- Generate number club080
- Generate synonyms
- Generate eft file dynamics gp
- Strong thesis statement
- Verilog # parameter
- Bulk sms hsn code
- Design process used in ied
- Cobol xml
- Searching