Beruflich Dokumente
Kultur Dokumente
REGULAR EXPRESSION
Regular Expressions
Examples
0 + 1 represents the set {0, 1}
1 represents the set {1}
0 represents the set {0}
(0 +1)1 represents the set {01, 11}
(a+b)⋅(b+c) represents the set {ab, bb, ac, bc}
(0 + 1)* = ∈+ (0 + 1) + (0 + 1) (0 + 1)..........= Σ*
(0 + 1 )+ =(0 +1) (0 +1)*= Σ+ =Σ*- {ε}
Building Regular Expressions
To say zero or more ab’s, i.e.,{λ, ab,abab........,} you need to say (ab)*.
One or more: Since a* means zero or more a’s, you can use aa*
(or equivalently a*a) to mean one or more a’s.
Similarly to describe ‘one or more ab’s”, that is {ab, abab, ababab,
.........}, you can use ab (ab)*.
a (aa)*
FINITE AUTOMATA WITH OUTPUT
iii. The language over the alphabet {0,1} where strings contain
an even number of 0’s can be constructed by
(1*((01*)(01*))*) or simply 1*(01* 01*)*.
PROPERTIES OF REGULAR LANGUAGES
Theorem
Let L be a regular language. Then there exists a constant ‘c’ such that
for every string w in L −
|w| ≥ c
We can break w into three strings,
w = xyz, such that −
|y| > 0
|xy| ≤ c
For all k ≥ 0, the string xykz is also in L.
The “pumping lemma” for regular languages is another way of
showing that a given infinite language is not regular.
Applications of Pumping Lemma
Method to prove that a language L is not regular
Now we will swap its accepting states with its non-accepting states
and vice versa and will get the following −