Professional Documents
Culture Documents
CENG 280
Formal Languages and Abstract Machines
Spring 2023-2024
Homework 1
Question 1
Give formal proofs to state whether the following sets are finite, countably infinite or
uncountably infinite. State any mapping explicitly and give clear references to known
theorems if used.
a) Intersection of the set of all strings on the alphabet Σ = {a, b, c} which are starting
with ab, ending with bc and the set of all strings on the same alphabet (Σ = {a, b, c})
which include the substring “aabbcc”.
b) The set of all regular languages on the binary alphabet Σ = {0, 1}.
∗
c) The set of all languages on the binary alphabet Σ = {0, 1}.(This is, 2{0,1} )
Hint: Cantor’s Diagonal Argument, regular expressions, closure properties may be helpful.
Question 2
• L01 = {ω ∈ {a, b}∗ | ω includes an odd number of aba substrings}
1
Question 3
a) Using subset construction algorithm 1 , construct an equivalent DFA for each of the
NFAs given below:
• N1 = {K1 , Σ1 , ∆1 , s1 , F1 } where
K1 = {q0 , q1 , q2 , q3 , q4 }, Σ1 = {a, b}, s1 = q0 , F1 = {q4 } and
∆1 = {
(q0 , a, q0 ), (q0 , a, q1 ), (q0 , b, q0 ),
(q1 , b, q2 ), (q1 , b, q3 ),
(q2 , a, q0 ), (q2 , ϵ, q3 ),
(q3 , a, q4 ),
(q4 , a, q4 ), (q4 , b, q4 )
}
• N2 = {K2 , Σ2 , ∆2 , s2 , F2 } where
K2 = {q0 , q1 , q2 , q3 , q4 }, Σ2 = {a, b}, s2 = q0 , F2 = {q3 } and
∆2 = {
(q0 , b, q1 ), (q0 , b, q3 ), (q0 , ϵ, q2 ),
(q1 , a, q1 ),
(q2 , a, q2 ), (q2 , b, q2 ), (q2 , a, q4 ),
(q3 , a, q1 ), (q3 , ϵ, q4 ),
(q4 , a, q2 ), (q4 , a, q3 ), (q4 , b, q4 )
}
b) Then, employing yields in one step relation2 (⊢) between configurations, trace the
string ω1 = "aba" on the given NFAs and on the equivalent DFAs you have constructed.
For each of those four finite automata, decide whether ω2 = "babb" is accepted by that
automaton or not.
Question 4
Give a DFA that recognizes the language;
b) For this DFA, trace the input abbaabab and write the computation. Does the DFA
accept the input?
Question 5
Let us define a language similar to Turkish.
2
• A syllable starts with either a constant or a vowel.
• If the first syllable of the word consists of one of a, ı, o, u vowels,then the other
syllabuses must contain these vowels also.
• Similarly, if the first syllable of the word consists of one of e, i, ö, ü vowels,then the
other syllabuses must contain these vowels also.
a) Give a NFA recognizes the language of strings which are valid syllables.
b) Write the regular expression for the set of the valid words according to given descrip-
tion.