1 / 75

# Reverse of a Regular Language - PowerPoint PPT Presentation

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:.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
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

### Reverse of a Regular Language

Construct NFA that accepts :

invert the transitions of the NFA

that accepts

Theorem:

The reverse of a regular language

is a regular language

Since is regular,

there is NFA that accepts

Example:

is regular

### 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” }

Variable

or

Non-terminal

Terminal

Production

rule

• Grammar:

• Derivation of sentence :

• Grammar

Set of variables

Set of terminal symbols

Start variable

Set of Production rules

• Grammar :

• Sentential Form:

• A sentence that contains

• variables and terminals

• Example:

Sentential Forms

sentence

Grammar

Derivations

Grammar

Derivations

• Grammar :

Derivations:

• For a grammar

• with start variable :

String of terminals

• For grammar :

Since:

### Linear Grammars

• Grammars with

• at most one variable at the right side

• of a production

• Examples:

Grammar :

• Grammar :

• All productions have form:

• Example:

or

• All productions have form:

• Example:

or

### Regular Grammars

• A regular grammaris any

• right-linear or left-linear grammar

• Examples:

• Regular grammars generate regular languages

• Examples:

### Regular Grammars GenerateRegular Languages

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

Languages

Generated by

Regular Grammars

Regular

Languages

The language generated by

any regular grammar is regular

• Let be a right-linear grammar

• We will prove: is regular

• Proof idea: We will construct NFA

• with

special

final state

Grammar

• A right-linear grammar

• has variables:

• and productions:

or

special

final state

………

………

• Let be a left-linear grammar

• We will prove: is regular

• Proof idea:

• We will construct a right-linear

• grammar with

the productions look like:

In :

In :

Regular

Language

Regular

Language

Regular

Language

Proof - Part 2

Languages

Generated by

Regular Grammars

Regular

Languages

Any regular language is generated

by some regular grammar

by some regular grammar

Proof idea:

Let be the NFA with .

Construct from a regular grammar

such that

Example:

For any transition:

Add production:

variable

terminal

variable

Add production: