Costas Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:

Slides:



Advertisements
Similar presentations
Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
Advertisements

Prof. Busch - LSU1 Simplifications of Context-Free Grammars.
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.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Costas Busch - RPI1 Grammars. Costas Busch - RPI2 Grammars Grammars express languages Example: the English language.
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.
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 Regular Grammars Generate Regular Languages. 2 Theorem Regular grammars generate exactly the class of regular languages: If is a regular grammar then.
Costas Busch - RPI1 The Pumping Lemma for Context-Free Languages.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
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 2006Costas Busch - RPI1 PDAs Accept Context-Free Languages.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
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.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Regular Expressions Costas Busch - LSU.
Costas Busch - LSU1 Properties of Context-Free languages.
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.
Costas Busch - LSU1 Pumping Lemma for Context-free Languages.
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 The Post Correspondence Problem.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Costas Busch - LSU1 PDAs Accept Context-Free Languages.
1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:
Costas Busch - LSU 1 More NP-complete Problems. Costas Busch - LSU 2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible.
Non-regular languages
Standard Representations of Regular Languages
PDAs Accept Context-Free Languages
More NP-complete Problems
Properties of Regular Languages
Busch Complexity Lectures: Reductions
Undecidable Problems Costas Busch - LSU.
Reductions Costas Busch - LSU.
NPDAs Accept Context-Free Languages
Simplifications of Context-Free Grammars
NPDAs Accept Context-Free Languages
Language Recognition (12.4)
CSE322 LEFT & RIGHT LINEAR REGULAR GRAMMAR
Regular Expressions Prof. Busch - LSU.
DPDA Deterministic PDA
More NP-complete Problems
Non-Deterministic Finite Automata
Properties of Regular Languages
Non-Deterministic Finite Automata
The Post Correspondence Problem
Pumping Lemma for Context-free Languages
Elementary Questions about Regular Languages
Non-regular languages
Undecidable problems:
Properties of Context-Free languages
More Applications of the Pumping Lemma
Language Recognition (12.4)
DPDA Deterministic PDA
The Chomsky Hierarchy Costas Busch - LSU.
Presentation transcript:

Costas Busch - LSU1 Linear Grammars Grammars with at most one variable at the right side of a production Examples:

Costas Busch - LSU2 A Non-Linear Grammar Grammar : Number of in string

Costas Busch - LSU3 Another Linear Grammar Grammar :

Costas Busch - LSU4 Right-Linear Grammars All productions have form: Example: or string of terminals

Costas Busch - LSU5 Left-Linear Grammars All productions have form: Example: or string of terminals

Costas Busch - LSU6 Regular Grammars

Costas Busch - LSU7 Regular Grammars A regular grammar is any right-linear or left-linear grammar Examples:

Costas Busch - LSU8 Observation Regular grammars generate regular languages Examples:

Costas Busch - LSU9 Regular Grammars Generate Regular Languages

Costas Busch - LSU10 Theorem Languages Generated by Regular Grammars Regular Languages

Costas Busch - LSU11 Theorem - Part 1 Languages Generated by Regular Grammars Regular Languages Any regular grammar generates a regular language

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

Costas Busch - LSU13 Proof – Part 1 Languages Generated by Regular Grammars Regular Languages The language generated by any regular grammar is regular

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

Costas Busch - LSU15 Grammar is right-linear Example:

Costas Busch - LSU16 Construct NFA such that every state is a grammar variable: special final state

Costas Busch - LSU17 Add edges for each production:

Costas Busch - LSU18

Costas Busch - LSU19

Costas Busch - LSU20

Costas Busch - LSU21

Costas Busch - LSU22

Costas Busch - LSU23 Grammar NFA

Costas Busch - LSU24 In General A right-linear grammar has variables: and productions: or

Costas Busch - LSU25 We construct the NFA such that: each variable corresponds to a node: special final state

Costas Busch - LSU26 For each production: we add transitions and intermediate nodes ………

Costas Busch - LSU27 For each production: we add transitions and intermediate nodes ………

Costas Busch - LSU28 Resulting NFA looks like this: It holds that:

Costas Busch - LSU29 The case of Left-Linear Grammars Let be a left-linear grammar We will prove: is regular Proof idea: We will construct a right-linear grammar with

Costas Busch - LSU30 Since is left-linear grammar the productions look like:

Costas Busch - LSU31 Construct right-linear grammar Left linear Right linear

Costas Busch - LSU32 Construct right-linear grammar Left linear Right linear

Costas Busch - LSU33 It is easy to see that: Since is right-linear, we have: Regular Language Regular Language Regular Language

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

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

Costas Busch - LSU36 Since is regular there is an NFA such that Example:

Costas Busch - LSU37 Convert to a right-linear grammar

Costas Busch - LSU38

Costas Busch - LSU39

Costas Busch - LSU40

Costas Busch - LSU41 In General For any transition: Add production: variableterminalvariable

Costas Busch - LSU42 For any final state: Add production:

Costas Busch - LSU43 Since is right-linear grammar is also a regular grammar with