SlideShare una empresa de Scribd logo
1 de 60
Equivalence with FA
* Any Regex can be converted to FA and vice versa,
because:
* Regex and FA are equivalent in their descriptive
power
** Regular language is one that is recognized by
some FA, remember?
Hence: (Lemma) if a language is described by a
RegEx, then it is a regular language.
See Proof: P.67, example 1.56
11/25/13
Lemma: If a language is regular, then it is
descried by a RegEx.
Because A is regular, it is accepted by a DFA. We
describe a procedure for converting DFAs into
equivalent RegEx.
Breaking the procedure into 2 parts, using a new
type of FA called Generalized Nondeterministic
Finite Automaton (GNFA)
Hence, 1st convert DFA to GNFA, then GNFA to
RegEx

11/25/13
GNFA is NFA, but Regex could be used as labels
on arrows. Figure 1.61 P.70 shows an example of
GNFA, which is on the special form that it should
ALWAYS have.

11/25/13
To convert a NFA to GNFA (and
keep the special form)
Add a new start state with ε arrow to the old start
Add a new accept state with ε arrow coming from
the old accept state.
If any arrow has more than one label, or there
are more than one arrow between two states on
the same direction, replace with one arrow and
“union” the labels
If two states have no arrows between them, add
an arrow with Φ label
11/25/13
Convert the GNFA to RegEx
In GNFA, the start and accept states are must,
and they're different, hence no. of states (k) of
any GNFA is always >=2.
If k>2, then GNFA is constructed by reducing the
number to k=2 (an arrow form start to accept
states) whose label is the RegEx.
Example, converting a 3 state DFA to RegEx.
3k DFA > 5k GNFA > 4k GNFA > 3k GNFA > 2k
GNFA > RegEx
11/25/13
Convert the GNFA to RegEx
The Challenge in reducing the states if greater than
2, by Ripping the a state out of the machine
(other than the start, accept states), we call it q rip ,
we repair the machine by altering the removed
qrip with labeled arrow. The label should cover the
absence of qrip .The new label form start to accept
states is the RegEx.
Figure 1.63 P. 72

11/25/13
Formal definition of GNFA
Just like the DFA, it's a 5-tuple with same parameters
except for δ, which can be given as:
δ: (Q - {qaccept }) X (Q – {qstart}) → R
R is the collection of all RegEx over the alphabet ∑,
The domain of the transition function is (Q - {qaccept })
X (Q – {qstart}) simply because in GNFA, an arrow
connects every state to every other state, except no
arrows are coming from qaccept or going to qstart.
Read: P.73 - 76

11/25/13
Nonregular Languages
Some languages cannot be recognized by any
FA (a limitation of FA)
Assume the language B = {0n1n | n>=0}. No DFA
can recognize it because the resulting number of
0s is unlimited, and therefore no DFA can
remember this number of possibilities.
But just because the language appears to require
unbounded memory doesn't mean it's nonregular.
So we need a method to prove the nonregularity
11/25/13
Nonregular Languages
Assume we have 2 languages C and D, over the
alphabet ∑ = {0,1}, where:
C = { w | w has an equal no. of 0s and 1s}, and
D = { w | w has an equal number of occurrences of
01 and 10 as substrings}
Which one is nonregular?
See problem 1.48
>> Difficult? We need a mathematical proof for
certainty.
11/25/13
The pumping lemma for regular
languages
Theorem (Pumping Lemma): “All regular
languages have a special property, if a language
doesn't have that property, it is not regular”.
The property states that all strings in the
language can be “pumped” if they are at least as
long as a certain special value called the
“pumping length”. In other words:
Such string contains a section that can be repeated
any number of times with the resulting string
remaining in the language
11/25/13
Pumping lemma: if A is a regular language, then
there is a number p (the pumping length) where,
if s is any string in A of length at least p, then s
may be divided into three pieces, s=xyz,
satisfying the conditions:
1- for each i>=0, xyiz ∈ A
2- |y| >0, and
3- |xy| <= p.
Figure 1.71 P.78
11/25/13
Non­regular languages

n

{a b : n≥ 0}
vv

R

:

Regular languages
a∗b

b∗c + a

b + c ( a + b )∗¿
¿

etc . ..

11/25/13

n

v ∈ {a , b }
∗¿
¿
¿
¿
How can we prove that a language L
is not regular?
Prove that there is no DFA or NFA or RE 
that accepts L 
Difficulty: this is not easy to prove
(since there is an infinite number
 of them)
Solution: use the Pumping Lemma !!!
11/25/13
The Pigeonhole Principle

11/25/13
4

3

11/25/13

pigeons

pigeonholes
A pigeonhole must
contain at least two pigeons

11/25/13
n

pigeons
...........

m

pigeonholes
...........

11/25/13

n> m
The Pigeonhole Principle

pigeons

n

pigeonholes

m

n> m

There is a pigeonhole
with at least 2 pigeons

...........

11/25/13
The Pigeonhole Principle
and
DFAs

11/25/13
Consider a DFA with 4
b

q1

b

b

a

q2

a

a
11/25/13

states

b

q3
a

q4
aaaab
Consider the walk of a “long’’ string:

(length at least 4)

A state is repeated in the walk of aaaab
a

q1

q2

b

q1

a

q3

a

a

q3

b

a

q2

b

q4
b

a

a

11/25/13

q2

q3

b

a

q4
The state is repeated as a result of 
the pigeonhole principle

Walk of
Pigeons:

(walk states)

q1

a

q2

a

q3

a

aaaab
q2

a

q3

b

q4

Are more than

q1

Nests:
(Automaton states)

11/25/13

q2

q3
Repeated
state

q4
aabb
Consider the walk of a “long’’ string:
(length at least 4)

Due to the pigeonhole principle:
A state is repeated in the walk of aabb
a

q1

q2

b

a

q3

b

q4

b

q4

b

b

q1

a

q2

a

a
11/25/13

q3

b

a

q4
The state is repeated as a result of
the pigeonhole principle
aabb

Walk of
Pigeons:

q1

a

a

q2

q3

b

q4

b

q4

(walk states)

Are more than

Nests:
(Automaton states)
11/25/13

q1

q2

q3

Automaton States

q4
Repeated
state
In General:

If ∣w∣ ≥ #states of DFA,
by the pigeonhole principle,
a state is repeated in the walk

Walk of
q1

σ1

σ2

....

σi

w = σ 1 σ 2 ⋯σ k
qi

σ i +1

σj

....

qi

σ j+1

....

σk

Arbitrary DFA
q1
11/25/13

σ1

σ2

w

......

qi

......

Repeated state

σk

qz

qz
∣w∣ ≥ #states of DFA =m

Pigeons: (walk states)
....
q1

Walk of
qi

....

w

qi

....

qz

Are
more
than
Nests:

q1

q2

(Automaton states)
11/25/13

....

qi

....

A state is
repeated

q m−1

qm
The Pumping Lemma

11/25/13
Take an infinite regular language

L

(contains an infinite number of strings)

There exists a DFA that accepts

L

m

states
11/25/13
Take string

w ∈L

∣w∣ ≥ m

with

(number of
states of DFA)

then, at least one state is repeated
in the walk of w
Walk in DFA of
w = σ 1 σ 2 ⋯σ k
σ1

σ2

......

q

......

σk

Repeated state in DFA
11/25/13
There could be many states repeated
Take q to be the first state repeated
One dimensional projection of walk

w
:

First
occurrence
σ1

σ2

....

σi

Second
occurrence

q

σ i +1

Unique states
11/25/13

....

σj

q

σ j+1

....

σk
We can write

w = xyz

One dimensional projection of walk

w
:

First
occurrence
σ1

σ2

....

x=σ 1 ⋯σ i
11/25/13

σi

Second
occurrence

q

σ i +1

....

y =σ i +1 ⋯σ j

σj

q

σ j+1

....

σk

z=σ j +1 ⋯σ k
In DFA:

w=x y z

contains only
first occurrence of

y

...

σj

...

σ1

11/25/13

x

σi

σ i +1

q

σ j+1

...

...
z

σk

q
Observation:

length

∣x y∣ ≤ m

number
of states
of DFA

y

...
Unique States
σj

...

σ1

11/25/13

x

σi

σ i +1

q

Since, in xy no
state is repeated
(except q)
Observation:

length

∣ y∣ ≥ 1

Since there is at least one transition in loop
y

...

σj

σ i +1

q

11/25/13
We do not care about the form of string

z

x
may actually overlap with the paths of

y

...
z

...
11/25/13

x

q

z

y
and
Additional string:

The string
is accepted

Do not follow loop

x z

y

...

σj

...

σ1

11/25/13

x

σi

σ i +1

q

σ j+1

...

...
z

σk
Additional string:

The string
is accepted

Follow loop
2 times

y

...

σj

...

σ1

11/25/13

x y y z

x

σi

σ i +1

q

σ j+1

...

...
z

σk
The string
is accepted

Additional string:

Follow loop
3 times

y

...

σj

...

σ1

11/25/13

x y y y z

x

σi

σ i +1

q

σ j+1

...

...
z

σk
In General:

The string
is accepted

Follow loop
i times

xy z
i=0, 1, 2, . ..

y

...

σj

...

σ1

11/25/13

i

x

σi

σ i +1

q

σ j+1

...

...
z

σk
i

Therefore:

x y z ∈L

i=0, 1, 2, . ..

Language accepted by the DFA
y

...

σj

...

σ1

11/25/13

x

σi

σ i +1

q

σ j+1

...

...
z

σk
We just described:

The Pumping Lemma !!!

11/25/13
The Pumping Lemma:
• Given a infinite regular language
• there exists an integer
• for any string w ∈ L
• we can write

(critical length)

with length ∣w∣ ≥ m

w=x y z

• with ∣x y∣ ≤ m
• such that:
11/25/13

m

L

i

and

x y z ∈L

∣ y∣ ≥ 1

i=0, 1, 2, . ..
In the book:
Critical length m

11/25/13

p
= Pumping length
Applications
of
the Pumping Lemma

11/25/13
Observation:
Every language of finite size has to be regular
(we can easily construct an NFA
that accepts every string in the language)

Therefore, every non-regular language
has to be of infinite size
(contains an infinite number of strings)
11/25/13
Suppose you want to prove that
An infinite language L is not regular
1. Assume the opposite: L

is regular

2. The pumping lemma should hold forL
3. Use the pumping lemma to obtain a
contradiction
4. Therefore, L is not regular
11/25/13
Explanation of Step 3: How to get a contradiction
1. Let m

be the critical length for

2. Choose a particular stringw ∈ L
∣w∣≥m
the length condition
3. Write

L
which satisfies

w=xyz

4. Show that

'

i

w =xy z∉L

for some

5. This gives a contradiction, since from
'
i
pumping lemma

w =xy z∈L

11/25/13

i≠1
Note:

It suffices to show that
only one string w ∈ L
gives a contradiction

You don’t need to obtain
contradiction for everyw ∈ L

11/25/13
Example
Theorem: L = { 0 n 1 n | n ∈ N } is not regular.
Proof: By contradiction; assume L is regular. Let n
be the pumping length guaranteed by the
pumping lemma.
Consider the string w = 0 n 1 n . Then |w| = 2n ≥ n
and w ∈ L, so we can write
w = xyz such that y ≠ ε and for any natural
number i, xyiz ∈ L. We
consider three cases:
Case 1: y consists solely of 0s. Then xyiz = xz = 0 n - |y| 1 n ,
and since
|y| > 0, xz ∉ L.
Case 2: y consists solely of 1s. Then xy i z = xz = 0 n 1 n - |y| , and
since
|y| > 0, xz ∉ L.
Case 3: y consists of k 0s followed by m 1s. Then xy i z has
the
form 0 n 1 m 0 k 1 n + m , so xy i z ∉ L.
In all three cases we reach a contradiction, so our
assumption was
wrong and L is not regular. ■
Example of Pumping Lemma application

Theorem:

The language

n

n

L={a b : n≥0}
is not regular

Proof:

11/25/13

Use the Pumping Lemma
n

n

L={a b : n≥0}
Assume for contradiction
thatL
is a regular language

SinceL
is infinite
we can apply the Pumping Lemma
11/25/13
n

n

L={a b : n≥0}
Let

m

be the critical length for L

Pick a string

w

such that: w ∈ L
and length ∣w∣ ≥m
We pick

11/25/13

m

w=a b

m
From the Pumping Lemma:
m m

we can write

w=a b =x y z

with lengths

∣x y∣ ≤m , ∣ y∣≥1
m

w=

m

m m

xyz=a b = a ...aa ... aa .. . ab.. . b
x

11/25/13

Thus:

k

y

z

y =a , 1≤k ≤m
m m

k

y =a , 1≤k ≤m

x y z=a b

From the Pumping Lemma:

i

x y z ∈L
i=0, 1, 2, . ..

Thus:

11/25/13

2

x y z ∈L
m m

k

y =a , 1≤k ≤m

x y z=a b

2

x y z ∈L

From the Pumping Lemma:
m+k

m

2

xy z= a...aa...aa ...aa...ab...b ∈L
x

Thus:
11/25/13

y

a

y

m+k

z

m

b ∈L
a

BUT:

m+k

m

b ∈L

n

n

L={a b : n≥0}

a

m+k

m

b ∉L

CONTRADICTION!!!
11/25/13

k≥ 1
Therefore:

Our assumption thatL
is a regular language is not true

Conclusion: L

11/25/13

is not a regular language

END OF PROOF
Non-regular language

n n

{a b : n≥0}

Regular languages
¿ ¿

L(a b )

11/25/13
Read
P. 80 – 82 (examples)
Solve Exercises and Problems (P. 83 – 98)
Prepare for a quiz!

11/25/13

Más contenido relacionado

La actualidad más candente

Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsRushabh2428
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Srimatre K
 
Context free languages
Context free languagesContext free languages
Context free languagesJahurul Islam
 
Nondeterministic Finite Automata
Nondeterministic Finite Automata Nondeterministic Finite Automata
Nondeterministic Finite Automata parmeet834
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)Naman Joshi
 
NFA DFA Equivalence theorem
NFA DFA Equivalence theorem NFA DFA Equivalence theorem
NFA DFA Equivalence theorem niveditJain
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramAbdullah Jan
 
simple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonsimple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonkanikkk
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchySANUC2
 
Finite Automata
Finite AutomataFinite Automata
Finite Automataparmeet834
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFAkunj desai
 
Qtpvbscripttrainings
QtpvbscripttrainingsQtpvbscripttrainings
QtpvbscripttrainingsRamu Palanki
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Push down automata
Push down automataPush down automata
Push down automataSomya Bagai
 

La actualidad más candente (20)

Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite Acceptors
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
 
Context free languages
Context free languagesContext free languages
Context free languages
 
Nondeterministic Finite Automata
Nondeterministic Finite Automata Nondeterministic Finite Automata
Nondeterministic Finite Automata
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Unit iii
Unit iiiUnit iii
Unit iii
 
NFA DFA Equivalence theorem
NFA DFA Equivalence theorem NFA DFA Equivalence theorem
NFA DFA Equivalence theorem
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
 
simple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonsimple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilon
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
push down automata
push down automatapush down automata
push down automata
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
 
DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
 
Nfa to-dfa
Nfa to-dfaNfa to-dfa
Nfa to-dfa
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
Qtpvbscripttrainings
QtpvbscripttrainingsQtpvbscripttrainings
Qtpvbscripttrainings
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Push down automata
Push down automataPush down automata
Push down automata
 

Destacado

Finite automata intro
Finite automata introFinite automata intro
Finite automata introlavishka_anuj
 
Agricultural Productivity and Economic Development in Southern Africa
Agricultural Productivity and Economic Development in Southern AfricaAgricultural Productivity and Economic Development in Southern Africa
Agricultural Productivity and Economic Development in Southern AfricaJason Welker
 
An Agricultural Economics Research Agenda in Ethiopia – Some Reflections
An Agricultural Economics Research Agenda in Ethiopia – Some ReflectionsAn Agricultural Economics Research Agenda in Ethiopia – Some Reflections
An Agricultural Economics Research Agenda in Ethiopia – Some Reflectionsessp2
 
Drupal - A Web Based Content Management System
Drupal - A Web Based Content Management SystemDrupal - A Web Based Content Management System
Drupal - A Web Based Content Management SystemSudarshan Bengani
 
Selecting a content management system
Selecting a content management systemSelecting a content management system
Selecting a content management systemgmcinnis
 
How to fit a content management system in your digital strategy?
How to fit a content management system in your digital strategy?How to fit a content management system in your digital strategy?
How to fit a content management system in your digital strategy?Amplexor
 
Plataformas educativas
Plataformas educativasPlataformas educativas
Plataformas educativasJaime León
 
Food-Energy-Water Nexus Introduction
Food-Energy-Water Nexus IntroductionFood-Energy-Water Nexus Introduction
Food-Energy-Water Nexus IntroductionMeyer_IFPRI
 
Agricultural Economics Mid Term Progress Submission
Agricultural Economics Mid Term Progress SubmissionAgricultural Economics Mid Term Progress Submission
Agricultural Economics Mid Term Progress SubmissionAnirudh Jayaraman
 

Destacado (20)

Pda to cfg h2
Pda to cfg h2Pda to cfg h2
Pda to cfg h2
 
Finite automata intro
Finite automata introFinite automata intro
Finite automata intro
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
 
Agricultural Productivity and Economic Development in Southern Africa
Agricultural Productivity and Economic Development in Southern AfricaAgricultural Productivity and Economic Development in Southern Africa
Agricultural Productivity and Economic Development in Southern Africa
 
Water-Food-Energy Nexus in the context of groundwater use in India: Experienc...
Water-Food-Energy Nexus in the context of groundwater use in India: Experienc...Water-Food-Energy Nexus in the context of groundwater use in India: Experienc...
Water-Food-Energy Nexus in the context of groundwater use in India: Experienc...
 
Chapter 01 Foundation
Chapter 01 FoundationChapter 01 Foundation
Chapter 01 Foundation
 
An Agricultural Economics Research Agenda in Ethiopia – Some Reflections
An Agricultural Economics Research Agenda in Ethiopia – Some ReflectionsAn Agricultural Economics Research Agenda in Ethiopia – Some Reflections
An Agricultural Economics Research Agenda in Ethiopia – Some Reflections
 
Drupal - A Web Based Content Management System
Drupal - A Web Based Content Management SystemDrupal - A Web Based Content Management System
Drupal - A Web Based Content Management System
 
Selecting a content management system
Selecting a content management systemSelecting a content management system
Selecting a content management system
 
How to fit a content management system in your digital strategy?
How to fit a content management system in your digital strategy?How to fit a content management system in your digital strategy?
How to fit a content management system in your digital strategy?
 
Modeling the water food-energy nexus in the arab world: River basin modeling ...
Modeling the water food-energy nexus in the arab world: River basin modeling ...Modeling the water food-energy nexus in the arab world: River basin modeling ...
Modeling the water food-energy nexus in the arab world: River basin modeling ...
 
Plataformas educativas
Plataformas educativasPlataformas educativas
Plataformas educativas
 
Ceu lecture 5
Ceu lecture 5Ceu lecture 5
Ceu lecture 5
 
Food-Energy-Water Nexus Introduction
Food-Energy-Water Nexus IntroductionFood-Energy-Water Nexus Introduction
Food-Energy-Water Nexus Introduction
 
CEU lecture 3 2016
CEU lecture 3 2016CEU lecture 3 2016
CEU lecture 3 2016
 
The Water Energy and Food Security Nexus - is it really new?
The Water Energy and Food Security Nexus - is it really new?The Water Energy and Food Security Nexus - is it really new?
The Water Energy and Food Security Nexus - is it really new?
 
Proof in Mathematics
Proof in MathematicsProof in Mathematics
Proof in Mathematics
 
CEU lecture 6
CEU lecture 6CEU lecture 6
CEU lecture 6
 
Ceu lecture 4
Ceu lecture 4Ceu lecture 4
Ceu lecture 4
 
Agricultural Economics Mid Term Progress Submission
Agricultural Economics Mid Term Progress SubmissionAgricultural Economics Mid Term Progress Submission
Agricultural Economics Mid Term Progress Submission
 

Similar a Theory of Computation - Lectures 6 & 7

MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptxamara jyothi
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! EdholeEdhole.com
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! EdholeEdhole.com
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...ArjunMehra32
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptxEzhumalai p
 
ECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docx
ECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docxECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docx
ECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docxSALU18
 
CS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptxCS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptxALIZAIB KHAN
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computationprasadmvreddy
 
Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1bolovv
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauagesdanhumble
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghggggggggggggggggggggggggggggggggggadugnanegero
 
Regular expression
Regular expressionRegular expression
Regular expressionRajon
 

Similar a Theory of Computation - Lectures 6 & 7 (20)

MidtermI-review.pptx
MidtermI-review.pptxMidtermI-review.pptx
MidtermI-review.pptx
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! Edhole
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptx
 
Alofairi Adel
Alofairi  AdelAlofairi  Adel
Alofairi Adel
 
Unit ii
Unit iiUnit ii
Unit ii
 
RegexCat
RegexCatRegexCat
RegexCat
 
ECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docx
ECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docxECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docx
ECS140A-F16-07 October 27, 2016ASSIGNMENT 5 LISPDue .docx
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
CS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptxCS911-Lecture-13_34826.pptx
CS911-Lecture-13_34826.pptx
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1
 
re1.ppt
re1.pptre1.ppt
re1.ppt
 
Re1 (3)
Re1 (3)Re1 (3)
Re1 (3)
 
re1.ppt
re1.pptre1.ppt
re1.ppt
 
re1.ppt
re1.pptre1.ppt
re1.ppt
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauages
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Regular expression
Regular expressionRegular expression
Regular expression
 

Más de Dr. Maamoun Ahmed

Minimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithmsMinimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithmsDr. Maamoun Ahmed
 
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approachFinding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approachDr. Maamoun Ahmed
 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsDr. Maamoun Ahmed
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Dr. Maamoun Ahmed
 
Theory of Computation - Lecture 3
Theory of Computation - Lecture 3Theory of Computation - Lecture 3
Theory of Computation - Lecture 3Dr. Maamoun Ahmed
 
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
Theory of Computation  - Strings and Languages and Proofs (Lecture 2)Theory of Computation  - Strings and Languages and Proofs (Lecture 2)
Theory of Computation - Strings and Languages and Proofs (Lecture 2)Dr. Maamoun Ahmed
 

Más de Dr. Maamoun Ahmed (7)

A* - Astar - A-Star
A* - Astar - A-StarA* - Astar - A-Star
A* - Astar - A-Star
 
Minimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithmsMinimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithms
 
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approachFinding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relations
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
Theory of Computation - Lecture 3
Theory of Computation - Lecture 3Theory of Computation - Lecture 3
Theory of Computation - Lecture 3
 
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
Theory of Computation  - Strings and Languages and Proofs (Lecture 2)Theory of Computation  - Strings and Languages and Proofs (Lecture 2)
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
 

Último

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Último (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Theory of Computation - Lectures 6 & 7

  • 1. Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language is one that is recognized by some FA, remember? Hence: (Lemma) if a language is described by a RegEx, then it is a regular language. See Proof: P.67, example 1.56 11/25/13
  • 2. Lemma: If a language is regular, then it is descried by a RegEx. Because A is regular, it is accepted by a DFA. We describe a procedure for converting DFAs into equivalent RegEx. Breaking the procedure into 2 parts, using a new type of FA called Generalized Nondeterministic Finite Automaton (GNFA) Hence, 1st convert DFA to GNFA, then GNFA to RegEx 11/25/13
  • 3. GNFA is NFA, but Regex could be used as labels on arrows. Figure 1.61 P.70 shows an example of GNFA, which is on the special form that it should ALWAYS have. 11/25/13
  • 4. To convert a NFA to GNFA (and keep the special form) Add a new start state with ε arrow to the old start Add a new accept state with ε arrow coming from the old accept state. If any arrow has more than one label, or there are more than one arrow between two states on the same direction, replace with one arrow and “union” the labels If two states have no arrows between them, add an arrow with Φ label 11/25/13
  • 5. Convert the GNFA to RegEx In GNFA, the start and accept states are must, and they're different, hence no. of states (k) of any GNFA is always >=2. If k>2, then GNFA is constructed by reducing the number to k=2 (an arrow form start to accept states) whose label is the RegEx. Example, converting a 3 state DFA to RegEx. 3k DFA > 5k GNFA > 4k GNFA > 3k GNFA > 2k GNFA > RegEx 11/25/13
  • 6. Convert the GNFA to RegEx The Challenge in reducing the states if greater than 2, by Ripping the a state out of the machine (other than the start, accept states), we call it q rip , we repair the machine by altering the removed qrip with labeled arrow. The label should cover the absence of qrip .The new label form start to accept states is the RegEx. Figure 1.63 P. 72 11/25/13
  • 7. Formal definition of GNFA Just like the DFA, it's a 5-tuple with same parameters except for δ, which can be given as: δ: (Q - {qaccept }) X (Q – {qstart}) → R R is the collection of all RegEx over the alphabet ∑, The domain of the transition function is (Q - {qaccept }) X (Q – {qstart}) simply because in GNFA, an arrow connects every state to every other state, except no arrows are coming from qaccept or going to qstart. Read: P.73 - 76 11/25/13
  • 8. Nonregular Languages Some languages cannot be recognized by any FA (a limitation of FA) Assume the language B = {0n1n | n>=0}. No DFA can recognize it because the resulting number of 0s is unlimited, and therefore no DFA can remember this number of possibilities. But just because the language appears to require unbounded memory doesn't mean it's nonregular. So we need a method to prove the nonregularity 11/25/13
  • 9. Nonregular Languages Assume we have 2 languages C and D, over the alphabet ∑ = {0,1}, where: C = { w | w has an equal no. of 0s and 1s}, and D = { w | w has an equal number of occurrences of 01 and 10 as substrings} Which one is nonregular? See problem 1.48 >> Difficult? We need a mathematical proof for certainty. 11/25/13
  • 10. The pumping lemma for regular languages Theorem (Pumping Lemma): “All regular languages have a special property, if a language doesn't have that property, it is not regular”. The property states that all strings in the language can be “pumped” if they are at least as long as a certain special value called the “pumping length”. In other words: Such string contains a section that can be repeated any number of times with the resulting string remaining in the language 11/25/13
  • 11. Pumping lemma: if A is a regular language, then there is a number p (the pumping length) where, if s is any string in A of length at least p, then s may be divided into three pieces, s=xyz, satisfying the conditions: 1- for each i>=0, xyiz ∈ A 2- |y| >0, and 3- |xy| <= p. Figure 1.71 P.78 11/25/13
  • 12. Non­regular languages n {a b : n≥ 0} vv R : Regular languages a∗b b∗c + a b + c ( a + b )∗¿ ¿ etc . .. 11/25/13 n v ∈ {a , b } ∗¿ ¿ ¿ ¿
  • 16. A pigeonhole must contain at least two pigeons 11/25/13
  • 18. The Pigeonhole Principle pigeons n pigeonholes m n> m There is a pigeonhole with at least 2 pigeons ........... 11/25/13
  • 20. Consider a DFA with 4 b q1 b b a q2 a a 11/25/13 states b q3 a q4
  • 21. aaaab Consider the walk of a “long’’ string: (length at least 4) A state is repeated in the walk of aaaab a q1 q2 b q1 a q3 a a q3 b a q2 b q4 b a a 11/25/13 q2 q3 b a q4
  • 23. aabb Consider the walk of a “long’’ string: (length at least 4) Due to the pigeonhole principle: A state is repeated in the walk of aabb a q1 q2 b a q3 b q4 b q4 b b q1 a q2 a a 11/25/13 q3 b a q4
  • 24. The state is repeated as a result of the pigeonhole principle aabb Walk of Pigeons: q1 a a q2 q3 b q4 b q4 (walk states) Are more than Nests: (Automaton states) 11/25/13 q1 q2 q3 Automaton States q4 Repeated state
  • 25. In General: If ∣w∣ ≥ #states of DFA, by the pigeonhole principle, a state is repeated in the walk Walk of q1 σ1 σ2 .... σi w = σ 1 σ 2 ⋯σ k qi σ i +1 σj .... qi σ j+1 .... σk Arbitrary DFA q1 11/25/13 σ1 σ2 w ...... qi ...... Repeated state σk qz qz
  • 26. ∣w∣ ≥ #states of DFA =m Pigeons: (walk states) .... q1 Walk of qi .... w qi .... qz Are more than Nests: q1 q2 (Automaton states) 11/25/13 .... qi .... A state is repeated q m−1 qm
  • 28. Take an infinite regular language L (contains an infinite number of strings) There exists a DFA that accepts L m states 11/25/13
  • 29. Take string w ∈L ∣w∣ ≥ m with (number of states of DFA) then, at least one state is repeated in the walk of w Walk in DFA of w = σ 1 σ 2 ⋯σ k σ1 σ2 ...... q ...... σk Repeated state in DFA 11/25/13
  • 30. There could be many states repeated Take q to be the first state repeated One dimensional projection of walk w : First occurrence σ1 σ2 .... σi Second occurrence q σ i +1 Unique states 11/25/13 .... σj q σ j+1 .... σk
  • 31. We can write w = xyz One dimensional projection of walk w : First occurrence σ1 σ2 .... x=σ 1 ⋯σ i 11/25/13 σi Second occurrence q σ i +1 .... y =σ i +1 ⋯σ j σj q σ j+1 .... σk z=σ j +1 ⋯σ k
  • 32. In DFA: w=x y z contains only first occurrence of y ... σj ... σ1 11/25/13 x σi σ i +1 q σ j+1 ... ... z σk q
  • 33. Observation: length ∣x y∣ ≤ m number of states of DFA y ... Unique States σj ... σ1 11/25/13 x σi σ i +1 q Since, in xy no state is repeated (except q)
  • 34. Observation: length ∣ y∣ ≥ 1 Since there is at least one transition in loop y ... σj σ i +1 q 11/25/13
  • 35. We do not care about the form of string z x may actually overlap with the paths of y ... z ... 11/25/13 x q z y and
  • 36. Additional string: The string is accepted Do not follow loop x z y ... σj ... σ1 11/25/13 x σi σ i +1 q σ j+1 ... ... z σk
  • 37. Additional string: The string is accepted Follow loop 2 times y ... σj ... σ1 11/25/13 x y y z x σi σ i +1 q σ j+1 ... ... z σk
  • 38. The string is accepted Additional string: Follow loop 3 times y ... σj ... σ1 11/25/13 x y y y z x σi σ i +1 q σ j+1 ... ... z σk
  • 39. In General: The string is accepted Follow loop i times xy z i=0, 1, 2, . .. y ... σj ... σ1 11/25/13 i x σi σ i +1 q σ j+1 ... ... z σk
  • 40. i Therefore: x y z ∈L i=0, 1, 2, . .. Language accepted by the DFA y ... σj ... σ1 11/25/13 x σi σ i +1 q σ j+1 ... ... z σk
  • 41. We just described: The Pumping Lemma !!! 11/25/13
  • 42. The Pumping Lemma: • Given a infinite regular language • there exists an integer • for any string w ∈ L • we can write (critical length) with length ∣w∣ ≥ m w=x y z • with ∣x y∣ ≤ m • such that: 11/25/13 m L i and x y z ∈L ∣ y∣ ≥ 1 i=0, 1, 2, . ..
  • 43. In the book: Critical length m 11/25/13 p = Pumping length
  • 45. Observation: Every language of finite size has to be regular (we can easily construct an NFA that accepts every string in the language) Therefore, every non-regular language has to be of infinite size (contains an infinite number of strings) 11/25/13
  • 46. Suppose you want to prove that An infinite language L is not regular 1. Assume the opposite: L is regular 2. The pumping lemma should hold forL 3. Use the pumping lemma to obtain a contradiction 4. Therefore, L is not regular 11/25/13
  • 47. Explanation of Step 3: How to get a contradiction 1. Let m be the critical length for 2. Choose a particular stringw ∈ L ∣w∣≥m the length condition 3. Write L which satisfies w=xyz 4. Show that ' i w =xy z∉L for some 5. This gives a contradiction, since from ' i pumping lemma w =xy z∈L 11/25/13 i≠1
  • 48. Note: It suffices to show that only one string w ∈ L gives a contradiction You don’t need to obtain contradiction for everyw ∈ L 11/25/13
  • 49. Example Theorem: L = { 0 n 1 n | n ∈ N } is not regular. Proof: By contradiction; assume L is regular. Let n be the pumping length guaranteed by the pumping lemma. Consider the string w = 0 n 1 n . Then |w| = 2n ≥ n and w ∈ L, so we can write w = xyz such that y ≠ ε and for any natural number i, xyiz ∈ L. We consider three cases:
  • 50. Case 1: y consists solely of 0s. Then xyiz = xz = 0 n - |y| 1 n , and since |y| > 0, xz ∉ L. Case 2: y consists solely of 1s. Then xy i z = xz = 0 n 1 n - |y| , and since |y| > 0, xz ∉ L. Case 3: y consists of k 0s followed by m 1s. Then xy i z has the form 0 n 1 m 0 k 1 n + m , so xy i z ∉ L. In all three cases we reach a contradiction, so our assumption was wrong and L is not regular. ■
  • 51. Example of Pumping Lemma application Theorem: The language n n L={a b : n≥0} is not regular Proof: 11/25/13 Use the Pumping Lemma
  • 52. n n L={a b : n≥0} Assume for contradiction thatL is a regular language SinceL is infinite we can apply the Pumping Lemma 11/25/13
  • 53. n n L={a b : n≥0} Let m be the critical length for L Pick a string w such that: w ∈ L and length ∣w∣ ≥m We pick 11/25/13 m w=a b m
  • 54. From the Pumping Lemma: m m we can write w=a b =x y z with lengths ∣x y∣ ≤m , ∣ y∣≥1 m w= m m m xyz=a b = a ...aa ... aa .. . ab.. . b x 11/25/13 Thus: k y z y =a , 1≤k ≤m
  • 55. m m k y =a , 1≤k ≤m x y z=a b From the Pumping Lemma: i x y z ∈L i=0, 1, 2, . .. Thus: 11/25/13 2 x y z ∈L
  • 56. m m k y =a , 1≤k ≤m x y z=a b 2 x y z ∈L From the Pumping Lemma: m+k m 2 xy z= a...aa...aa ...aa...ab...b ∈L x Thus: 11/25/13 y a y m+k z m b ∈L
  • 57. a BUT: m+k m b ∈L n n L={a b : n≥0} a m+k m b ∉L CONTRADICTION!!! 11/25/13 k≥ 1
  • 58. Therefore: Our assumption thatL is a regular language is not true Conclusion: L 11/25/13 is not a regular language END OF PROOF
  • 59. Non-regular language n n {a b : n≥0} Regular languages ¿ ¿ L(a b ) 11/25/13
  • 60. Read P. 80 – 82 (examples) Solve Exercises and Problems (P. 83 – 98) Prepare for a quiz! 11/25/13