SlideShare a Scribd company logo
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

More Related Content

PPT
Nondeterministic Finite Automata
PPT
Lec 3 ---- dfa
PPTX
1.3.2 non deterministic finite automaton
PPT
Finite automata
PDF
Finite automata
PPT
NFA or Non deterministic finite automata
PPTX
Unit iv
PPT
Nfa egs
Nondeterministic Finite Automata
Lec 3 ---- dfa
1.3.2 non deterministic finite automaton
Finite automata
Finite automata
NFA or Non deterministic finite automata
Unit iv
Nfa egs

What's hot (20)

PDF
Theory of Computation Basics of Finite Acceptors
PDF
Formal Languages and Automata Theory Unit 1
PPT
Context free languages
PDF
Nondeterministic Finite Automata
PPT
Finite automata(For college Seminars)
PDF
PDF
Unit iii
PDF
NFA DFA Equivalence theorem
PPTX
NFA Converted to DFA , Minimization of DFA , Transition Diagram
PPTX
simple problem to convert NFA with epsilon to without epsilon
PDF
Chomsky hierarchy
PPT
Finite Automata
PPTX
push down automata
PPT
Chapt 06
PPT
DFA Minimization
PDF
Nfa to-dfa
PPT
Minimization of DFA
PPT
Qtpvbscripttrainings
PPT
Mba admission in india
PPTX
Push down automata
Theory of Computation Basics of Finite Acceptors
Formal Languages and Automata Theory Unit 1
Context free languages
Nondeterministic Finite Automata
Finite automata(For college Seminars)
Unit iii
NFA DFA Equivalence theorem
NFA Converted to DFA , Minimization of DFA , Transition Diagram
simple problem to convert NFA with epsilon to without epsilon
Chomsky hierarchy
Finite Automata
push down automata
Chapt 06
DFA Minimization
Nfa to-dfa
Minimization of DFA
Qtpvbscripttrainings
Mba admission in india
Push down automata
Ad

Viewers also liked (20)

PPT
Pda to cfg h2
PPT
Finite automata intro
PPT
Kleene's theorem
PPTX
Agricultural Productivity and Economic Development in Southern Africa
PDF
Water-Food-Energy Nexus in the context of groundwater use in India: Experienc...
PPT
Chapter 01 Foundation
PPT
An Agricultural Economics Research Agenda in Ethiopia – Some Reflections
PPTX
Drupal - A Web Based Content Management System
PPTX
Selecting a content management system
PDF
How to fit a content management system in your digital strategy?
PPTX
Plataformas educativas
PPTX
Ceu lecture 5
PPTX
Food-Energy-Water Nexus Introduction
PPT
CEU lecture 3 2016
PPTX
The Water Energy and Food Security Nexus - is it really new?
PPT
Proof in Mathematics
PPTX
CEU lecture 6
PPT
Ceu lecture 4
PDF
Agricultural Economics Mid Term Progress Submission
PPT
Evaluating economic impacts of agricultural research ciat
Pda to cfg h2
Finite automata intro
Kleene's theorem
Agricultural Productivity and Economic Development in Southern Africa
Water-Food-Energy Nexus in the context of groundwater use in India: Experienc...
Chapter 01 Foundation
An Agricultural Economics Research Agenda in Ethiopia – Some Reflections
Drupal - A Web Based Content Management System
Selecting a content management system
How to fit a content management system in your digital strategy?
Plataformas educativas
Ceu lecture 5
Food-Energy-Water Nexus Introduction
CEU lecture 3 2016
The Water Energy and Food Security Nexus - is it really new?
Proof in Mathematics
CEU lecture 6
Ceu lecture 4
Agricultural Economics Mid Term Progress Submission
Evaluating economic impacts of agricultural research ciat
Ad

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

PPT
xcjkfvhdfjlkghfkjbnfkbnfgbnklnbknbmcvbnlkcnb
PPTX
AUTOMATA AUTOMATA Automata5Chapter4.pptx
PPTX
RegularLanguageProperties.pptx
PPTX
toc Properties of Regular Languages .pptx
PPTX
Pumming Lemma
PDF
09.LearningMaterial_Sample.pdf
PDF
Pumping lema topic of theory of automata
PDF
Chapter 3 REGULAR EXPRESSION.pdf
PPT
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT
non regular language updated theory of automata.ppt
PPT
non regular language and pumping lemma toc
PPTX
Pumping lemma for regular set h1
PDF
Lecture-8-Pumpdndndndndnddndning Lemma.pdf
PPT
Class6
PPTX
Theory of Automata and formal languages unit 2
PDF
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
PDF
Mba ebooks ! Edhole
PDF
Free Ebooks Download ! Edhole
DOCX
Regular Expression .docx
PDF
Regular pumping
xcjkfvhdfjlkghfkjbnfkbnfgbnklnbknbmcvbnlkcnb
AUTOMATA AUTOMATA Automata5Chapter4.pptx
RegularLanguageProperties.pptx
toc Properties of Regular Languages .pptx
Pumming Lemma
09.LearningMaterial_Sample.pdf
Pumping lema topic of theory of automata
Chapter 3 REGULAR EXPRESSION.pdf
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
non regular language updated theory of automata.ppt
non regular language and pumping lemma toc
Pumping lemma for regular set h1
Lecture-8-Pumpdndndndndnddndning Lemma.pdf
Class6
Theory of Automata and formal languages unit 2
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Mba ebooks ! Edhole
Free Ebooks Download ! Edhole
Regular Expression .docx
Regular pumping

More from Dr. Maamoun Ahmed (7)

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

Recently uploaded (20)

PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Classroom Observation Tools for Teachers
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
01-Introduction-to-Information-Management.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Classroom Observation Tools for Teachers
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Cell Types and Its function , kingdom of life
01-Introduction-to-Information-Management.pdf
Complications of Minimal Access Surgery at WLH
GDM (1) (1).pptx small presentation for students
Module 4: Burden of Disease Tutorial Slides S2 2025
VCE English Exam - Section C Student Revision Booklet
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Microbial diseases, their pathogenesis and prophylaxis
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
202450812 BayCHI UCSC-SV 20250812 v17.pptx
O7-L3 Supply Chain Operations - ICLT Program
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
O5-L3 Freight Transport Ops (International) V1.pdf
Final Presentation General Medicine 03-08-2024.pptx

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