0% found this document useful (0 votes)
44 views4 pages

BLG311E Homework 3

This document contains 13 problems related to formal languages and automata. The problems cover topics such as regular and context-free languages, pushdown automata, Turing machines, grammars, and pumping lemma. Students are asked to prove/design various automata and languages, convert between models, and demonstrate computations.

Uploaded by

umutcalikkasap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

BLG311E Homework 3

This document contains 13 problems related to formal languages and automata. The problems cover topics such as regular and context-free languages, pushdown automata, Turing machines, grammars, and pumping lemma. Students are asked to prove/design various automata and languages, convert between models, and demonstrate computations.

Uploaded by

umutcalikkasap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Istanbul Technical University

Department of Computer Engineering


BLG 311E Formal Languages and Automata
Spring 2024

Assignment 3

For any questions, please contact:


Res. Assist. Meral Kuyucu [email protected]
Res. Assist. Batuhan Can [email protected]
May 11, 2024

1
Problem 1
Either prove or disprove the following languages are regular or irregular.

(a) L = {an bm : n ̸= m}

(b) L = {0n 1m : n > m}


(c) L = {ccr : c ∈ {0, 1}∗ }

Problem 2
Design a pushdown automaton (PDA) that recognizes the following language:

L(G) = {ak bm cn | k, m, n > 0 and k = 2m + n}

Problem 3
Convert the given CFG below to PDA.

S → aAA
A → aS | bS | a

Problem 4
Convert the given PDA below to CFG.

δ(q, 1, Z) = (q, XZ)

δ(q, 1, X) = (q, XX)


δ(q, 0, X) = (q, X)
δ(q, λ, X) = (q, λ)
δ(q, 0, Z) = (q, Z)

Problem 5
Claim if the following language can be recognized by a pushdown automata
(PDA). Prove/rationalize your claim.

L(G) = {ai bk ai bk | i, k > 0}

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

Note: You may assume that ∀x : x ̸= γ

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:

L={w | w is a binary string representing a number divisible by 3}

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.

You might also like