Professional Documents
Culture Documents
Hakim Temacini
February 2023
Q1
We are asked to check whether the following languages are regular or not
Qn
• {an! | n ≥ 1} where n! = i=1 i
Using the pumping lemma we prove that the set is not regular Given
k ≥ 0 we may choose string xyz = a(k+1)! , where x = a(k+1)!−k , y = ak
and z = ϵ. For any choice of u, v, w such that uvw = y and v ̸= ϵ
we must have u = al , v = ap , w = am where 0 < p ≤ k. Then by
construction xuvwz = a(k+1)! is in the set, but xuv 2 wz = a(k+1)!+p , where
(k + 1)! + p > (k + 1)! since p > 0 and (k + 1)! + p < (k + 2)! since
p < k + 1 < (k + 1)!(k + 1). Therefore we cannot have xuv 2 w in the set,
and therefore the set fails the criterion of the pumping lemma proving
irregularity.
• {x ∈ {a, b}∗ | x =rev(x)}
Using the pumping lemma, we may pump a section of string which makes
it not a palindrome anymore. Therefore this set is also not regular.
1
• {x ∈ {a, b}∗ | x contains the substring abb}
The regular expression (a + b)∗ abb(a + b)∗ completely describes the set
only. Therefore the set is regular
Q2
We minimize the DFA by using the minimzation procedure. Namely we first
start with a list of all our states, q0 , q1 , q2 , q3 , q4 , and mark all the states that
are not similar.
Trivially, our table first starts as below, because we mark all the states
that are final as not being similar to the ones that are not.
0
X 1
X 2
X X 3
X X 4
We then mark all the pairs of states that transition to states that are not
similar.
2
start q0
a b
a b
q1 q3
b a
q2
a, b
Q3
We design a context-free grammar for the language
A = {an cm dm bn | m, n ≥ 1}.
3
Q4
We design a grammar in Chomsky Normal Form for L(G) − {ϵ},
where G is the grammar defined as
S → aSbb | A
A → bAbb | S | ϵ
Since all the productions of S are the same as A we can safely combine these
two productions
S → aSbb | bSbb | bbb | abb
For each terminal symbol, we create new nonterminals and replace the pro-
ductions accordingly.
S → ASBB | BSBB | BBB | ABB
A→a
B→b
We then create new nonterminals and update the rules so we can adhere to
CNF. The final answer is then
S → AC | BC | BD | AD
C → SD
D → BB
A→a
B→b