BLG311E Homework 3
BLG311E Homework 3
BLG311E Homework 3
Assignment 3
1
Problem 1
Either prove or disprove the following languages are regular or irregular.
(a) L = {an bm : n ̸= m}
Problem 2
Design a pushdown automaton (PDA) that recognizes the following language:
Problem 3
Convert the given CFG below to PDA.
S → aAA
A → aS | bS | a
Problem 4
Convert the given PDA below to CFG.
Problem 5
Claim if the following language can be recognized by a pushdown automata
(PDA). Prove/rationalize your claim.
2
Problem 6
Prove the language below is not context-free.
L = {0n 1n 2n | n ≥ 0}
Problem 7
Consider a Turing Machine (TM) designed to operate on inputs from the alpha-
bet {0, 1}. This TM is tasked with duplicating the input string. An example
execution is provided below, where w represents any string in {0, 1}∗ :
#w# → #w#w#
Compute the following:
(a) State transition diagram.
(b) State transition table.
(c) Demonstrate the steps for the following execution: #010# → #010#010#.
Note: You may introduce additional characters to the working alphabet
if deemed necessary for your solution.
Problem 8
Design a Turing Machine (TM) that counts the number of a’s in a given input
string. It should do this by writing a string containing as many I’s as there
are a’s following the input string. The initial configuration of the machine is
#xax . . . xax . . . # where x’s represent symbols other than a’s. Assuming there
are a total of n a’s, the transformation can be represented as:
#xax . . . xax . . . # → #xax . . . xax . . . # |IIIIIIII
{z } #
n
Problem 9
Design a Turing machine that calculates the modulo 3 equivalent of a given
number represented using I’s, where the count of I’s indicates the number itself.
Initially, the tape head will be positioned on the blank symbol # before the
number. At the completion of execution, the machine will append I’s to the
number to represent the result.
The following example demonstrates the initial and final configurations for 5 ≡ 2
(mod 3).
# IIIII
| {z } # |IIIIIII
{z } #
5 5+2
3
Problem 10
Consider the following context-free grammar (CFG) G, with start symbol S:
S → AB|BC
A → a|λ
B→b
C → c|λ
Convert the given CFG G into Chomsky Normal Form (CNF). Provide the
resulting grammar with all necessary productions. Explain how you applied the
CNF conversion rules. Show how the string ”ab” can be derived using the CNF
grammar, if possible.
Problem 11
Suppose we have a grammar G with n productions, none of them λ-productions,
and convert this grammar to CNF. Show that the CNF grammar has at most
O(n2 ) productions.
Problem 12
Design a context-free language L such that any string in L consists of a balanced
combination of parentheses, square brackets, and curly braces. Then, demon-
strate how to apply the Pumping Lemma for Context-Free Languages to prove
that L is indeed context-free. Additionally, provide an explanation of how the
Pumping Lemma could be used to show that a language containing strings of
the form {an bn cn | n ≥ 0} is not context-free.
Problem 13
Design a Turing decider M that accepts the language L defined as follows:
Your Turing decider should take as input a binary string and halt in an accept-
ing state if the input represents a number divisible by 3, and halt in a rejecting
state otherwise.
You may assume that the input binary string will be given on the tape, with
the head initially positioned at the leftmost bit of the input.