Professional Documents
Culture Documents
Theory of Automata Lecture#2: by Riaz Ahmad Ziar R.ziar@kardan - Edu.af
Theory of Automata Lecture#2: by Riaz Ahmad Ziar R.ziar@kardan - Edu.af
Theory of Automata Lecture#2: by Riaz Ahmad Ziar R.ziar@kardan - Edu.af
Lecture#2nd
By
Riaz Ahmad Ziar
r.ziar@kardan.edu.af
Language definitions
Step 1: 1 is in INTEGER.
Step 2: If x is in INTEGER then x+1 and x-1 are also in INTEGER.
Step 3: No strings except those constructed in above, are allowed to be in INTEGER.
Even number example
Step 1: 2 is in EVEN.
Step 2: If x is in EVEN then x+2 and x-2 are also in EVEN.
Step 3: No strings except those constructed in above, are allowed to
be in EVEN.
Palindrome example
Step 1: a is in L
Step 2: if x is in L then s(x)a is also in L, where s belongs to Σ*
Step 3: No strings except those constructed in above, are allowed
to be in L.
Starting and ending with same letter
Defining the language L, starting and ending with the same letter defined over Σ={0,1}
Defining the language L containing at most one a defined over Σ={a, b}.
Step 1: a is in L
Step 2: s(a)s is also in L, where s belongs to b*
Step 3: No strings except those constructed in above, are allowed to be in L
Consisting of aa or bb
• We will always try to construct a regular expression from the standard operators. These
are as under:
1. Alternation: We also call it union, plus or bar operator denoted by U, + or |. But we
will always try to use the plus sign.
Exp: Regular expression for a string consisting of either a’s or b’s defined over Σ={a, b}.
(a|b) or (a+b) or (aUb)
2. Concatenation: The concatenation operator is denoted by dot. Also the absence of an
operator between two or more operands is considered to be concatenation.
Exp: Regular expression for string consisting of a and b a.b
Con’t
If a*=L1={Λ,a,aa,aaa,aaa,aaaa…………} and
a+=L2={a,aa,aaa,aaaa,aaaaa,………….} then it
should be noted that
a+=aa*=a*a=L2
Con’t
• Write down a RE for the language L define over Σ = {0, 1} where each string start with 1 and
end with 0 and vice versa.
• Write down a RE for the language L defined over Σ = {0, 1} where each string has odd length.
• Write down the RE for the language L defined over Σ = {a, b} where each string has even
length.
• Write down the RE for the language defined over Σ = {a, b} where each string consist of at
least one a and one b.
• Write down the RE for a language defined over Σ = {a, b}, of words starting with double a’s
and ending with double b’s.
• Write down the RE for a language L defined over Σ = {a, b, c} where each string do not start
with c.