1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:

Slides:



Advertisements
Similar presentations
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.
Advertisements

Fall 2006Costas Busch - RPI1 Regular Expressions.
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
What is the next line of the proof? a). Let G be a graph with k vertices. b). Assume the theorem holds for all graphs with k+1 vertices. c). Let G be a.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Costas Busch - RPI1 Grammars. Costas Busch - RPI2 Grammars Grammars express languages Example: the English language.
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.
Is the following graph Hamiltonian- connected from vertex v? a). Yes b). No c). I have absolutely no idea v.
1 Regular Grammars Generate Regular Languages. 2 Theorem Regular grammars generate exactly the class of regular languages: If is a regular grammar then.
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.
1 Non-Deterministic Automata Regular Expressions.
Prof. Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
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 7 Mälardalen University 2010.
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.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
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.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
Costas Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
 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.
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
More NP-complete Problems
Properties of Regular Languages
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Reductions Costas Busch - LSU.
NPDAs Accept Context-Free Languages
Formal Language & Automata Theory
PDAs Accept Context-Free Languages
What is the next line of the proof?
NPDAs Accept Context-Free Languages
Single Final State for NFA
Language Recognition (12.4)
REGULAR LANGUAGES AND REGULAR GRAMMARS
CSE322 LEFT & RIGHT LINEAR REGULAR GRAMMAR
DPDA Deterministic PDA
Regular Grammar.
More NP-complete Problems
Non-Deterministic Finite Automata
Non Deterministic Automata
Deterministic PDAs - DPDAs
The Post Correspondence Problem
Elementary Questions about Regular Languages
Non-regular languages
Language Recognition (12.4)
DPDA Deterministic PDA
Chapter 1 Regular Language
Kleene’s Theorem (Part-3)
NFAs accept the Regular Languages
Normal Forms for Context-free Grammars
Presentation transcript:

1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:

2 A Non-Linear Grammar Grammar :

3 Another Linear Grammar Grammar :

4 Right-Linear Grammars All productions have form: Example: or

5 Left-Linear Grammars All productions have form: Example: or

6 Regular Grammars

7 A regular grammar is any right-linear or left-linear grammar Examples:

8 Observation Regular grammars generate regular languages Examples:

9 Regular Grammars Generate Regular Languages

10 Theorem Languages Generated by Regular Grammars Regular Languages

11 Theorem - Part 1 Languages Generated by Regular Grammars Regular Languages Any regular grammar generates a regular language

12 Theorem - Part 2 Languages Generated by Regular Grammars Regular Languages Any regular language is generated by a regular grammar

13 Proof – Part 1 Languages Generated by Regular Grammars Regular Languages The language generated by any regular grammar is regular

14 The case of Right-Linear Grammars Let be a right-linear grammar We will prove: is regular Proof idea: We will construct NFA with

15 Grammar is right-linear Example:

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

17 Add edges for each production:

18

19

20

21

22

23 Grammar NFA

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

25 We construct the NFA such that: each variable corresponds to a node: special final state

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

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

28 Resulting NFA looks like this: It holds that:

29 Proof - Part 2 Languages Generated by Regular Grammars Regular Languages Any regular language is generated by some regular grammar

30 Proof idea: Let be the NFA with. Construct from a regular grammar such that Any regular language is generated by some regular grammar

31 Since is regular there is an NFA such that Example:

32 Convert to a right-linear grammar

33

34

35

36 In General For any transition: Add production: variableterminalvariable

37 For any final state: Add production:

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