1 Regular Grammars Generate Regular Languages. 2 Theorem Regular grammars generate exactly the class of regular languages: If is a regular grammar then.

Slides:



Advertisements
Similar presentations
Lecture 11 Context-Free Grammar. Definition A context-free grammar (CFG) G is a quadruple (V, Σ, R, S) where V: a set of non-terminal symbols Σ: a set.
Advertisements

PDAs => CFGs Sipser 2.2 (pages ). Last time…
PDAs => CFGs Sipser 2.2 (pages ). Last time…
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Fall 2006Costas Busch - RPI1 Regular Expressions.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Costas Busch - RPI1 Grammars. Costas Busch - RPI2 Grammars Grammars express languages Example: the English language.
1 Converting NPDAs to Context-Free Grammars. 2 For any NPDA we will construct a context-free grammar with.
Fall 2006Costas Busch - RPI1 The Post Correspondence Problem.
Courtesy Costas Busch - RPI
1 Grammars. 2 Grammars express languages Example: the English language.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
Fall 2004COMP 3351 NPDA’s Accept Context-Free Languages.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
1 Reverse of a Regular Language. 2 Theorem: The reverse of a regular language is a regular language Proof idea: Construct NFA that accepts : invert the.
Courtesy Costas Busch - RPI1 Non-regular languages.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
1 Non-Deterministic Automata Regular Expressions.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Fall 2006Costas Busch - RPI1 PDAs Accept Context-Free Languages.
Prof. Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
Fall 2003Costas Busch - RPI1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 5 Mälardalen University 2005.
Theory of Languages and Automata
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Regular Grammars Chapter 7. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
Lecture # 12. Nondeterministic Finite Automaton (NFA) Definition: An NFA is a TG with a unique start state and a property of having single letter as label.
Conversions & Pumping Lemma CPSC 388 Fall 2001 Ellen Walker Hiram College.
Regular Expressions Costas Busch - LSU.
Lecture 8 Context-Free Grammar- Cont.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
Regular Grammars Reading: 3.3. What we know so far…  FSA = Regular Language  Regular Expression describes a Regular Language  Every Regular Language.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Costas Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
Costas Busch - LSU1 The Post Correspondence Problem.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Costas Busch - LSU1 PDAs Accept Context-Free Languages.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
Non-regular languages
Standard Representations of Regular Languages
Non Deterministic Automata
NPDAs Accept Context-Free Languages
NPDAs Accept Context-Free Languages
Single Final State for NFA
Chapter 2 FINITE AUTOMATA.
Language Recognition (12.4)
DPDA Deterministic PDA
CSE322 PROPERTIES OF REGULAR LANGUAGES
Chapter 7 Regular Grammars
Non Deterministic Automata
Elementary Questions about Regular Languages
Non-regular languages
Language Recognition (12.4)
DPDA Deterministic PDA
Kleene’s Theorem (Part-3)
NFAs accept the Regular Languages
Presentation transcript:

1 Regular Grammars Generate Regular Languages

2 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

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

4 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

5 Grammar is right-linear Example:

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

7 Add edges for each production:

8

9

10

11

12

13 Grammar NFA

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

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

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

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

18 Resulting NFA looks like this:

19 Now, we need to show:

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

21 strings Grammar looks like:

22

23 ……

24 ……

25 ……

26 Since: We have: ……

27 Since: We have: …… and

28 The Case: Take We will show that in

29 Since there is a path ……

30 Write: There is a path ……

31 Since: This derivation is possible ……

32 Since: We have:

33 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

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

35 Construct right-linear grammar In :

36 In :

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

38 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

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

40 Convert to a right-linear grammar

41

42

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

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