Reverse of a regular language
Download
1 / 75

Reverse of a Regular Language - PowerPoint PPT Presentation


  • 223 Views
  • Uploaded on

Reverse of a Regular Language. Proof idea:. Construct NFA that accepts :. invert the transitions of the NFA that accepts. Theorem:. The reverse of a regular language is a regular language. Proof. Since is regular, there is NFA that accepts. Example:.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Reverse of a Regular Language' - hollie


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Proof idea:

Construct NFA that accepts :

invert the transitions of the NFA

that accepts

Theorem:

The reverse of a regular language

is a regular language


Proof
Proof

Since is regular,

there is NFA that accepts

Example:







Grammars1
Grammars

  • Grammars express languages

  • Example: the English language




L = { “a boy runs”,

“a boy walks”,

“the boy runs”,

“the boy walks”,

“a dog runs”,

“a dog walks”,

“the dog runs”,

“the dog walks” }


Notation
Notation

Variable

or

Non-terminal

Terminal

Production

rule


Another example
Another Example

  • Grammar:

  • Derivation of sentence :





More notation
More Notation

  • Grammar

Set of variables

Set of terminal symbols

Start variable

Set of Production rules


Example
Example

  • Grammar :


More notation1
More Notation

  • Sentential Form:

  • A sentence that contains

  • variables and terminals

  • Example:

Sentential Forms

sentence





Example1
Example

Grammar

Derivations


Example

Grammar

Derivations


Another grammar example
Another Grammar Example

  • Grammar :

Derivations:



Language of a grammar
Language of a Grammar

  • For a grammar

  • with start variable :

String of terminals


Example2
Example

  • For grammar :

Since:




Linear grammars1
Linear Grammars

  • Grammars with

  • at most one variable at the right side

  • of a production

  • Examples:




Right linear grammars
Right-Linear Grammars

  • All productions have form:

  • Example:

or


Left linear grammars
Left-Linear Grammars

  • All productions have form:

  • Example:

or



Regular grammars1
Regular Grammars

  • A regular grammaris any

  • right-linear or left-linear grammar

  • Examples:


Observation
Observation

  • Regular grammars generate regular languages

  • Examples:


Regular grammars generate regular languages

Regular Grammars GenerateRegular Languages


Theorem
Theorem

Languages

Generated by

Regular Grammars

Regular

Languages


Theorem - Part 1

Languages

Generated by

Regular Grammars

Regular

Languages

Any regular grammar generates

a regular language


Theorem - Part 2

Languages

Generated by

Regular Grammars

Regular

Languages

Any regular language is generated

by a regular grammar


Proof part 1
Proof – Part 1

Languages

Generated by

Regular Grammars

Regular

Languages

The language generated by

any regular grammar is regular


The case of right linear grammars
The case of Right-Linear Grammars

  • Let be a right-linear grammar

  • We will prove: is regular

  • Proof idea: We will construct NFA

  • with



special

final state



NFA

Grammar


In general
In General

  • A right-linear grammar

  • has variables:

  • and productions:

or


special

final state


………


………



The case of left linear grammars
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


Since is left-linear grammar

the productions look like:




Regular

Language

Regular

Language

Regular

Language


Proof part 2
Proof - Part 2

Languages

Generated by

Regular Grammars

Regular

Languages

Any regular language is generated

by some regular grammar


Any regular language is generated

by some regular grammar

Proof idea:

Let be the NFA with .

Construct from a regular grammar

such that


Example:



In general1
In General

For any transition:

Add production:

variable

terminal

variable


For any final state:

Add production:



ad