02qbank PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

COMP3721 Question Bank #2

Pumping Theorem for Regular Languages


Question 1
Are the following languages over alphabet Σ = {a, b} regular? Prove your answers.
a) {ai ba2i : i ≥ 1}
i i
b) {(bab) (babbab) : i ≥ 1}
c) {ai bj : i < j , i, j ≥ 1}
d) {ai bj : i > j , i, j ≥ 1}

Question 2
Using the pumping theorem, prove that the following languages are not regular:
a) {wwR : w ∈ {a, b}∗ }

b) {ww : w ∈ {a, b} }

Minimum-state DFA
Question 1
Find the minimum-state equivalent deterministic finite automaton for each of the
following finite automata (deterministic in Figure 1 and nondeterministic in Figure
2).
a

b
a, b
a
e b
a, b
b b
b a e
a, b a, b
a
Figure 1: DFA Figure 2: NFA

Uncountability, Finite representation


Question 1
Problem 1.5.7 in Lewis and Papadimitriou (2nd. Edition).
Suppose we try to prove, by an argument exactly parallel to the proof of Theorem
1.5.2, that the set of all finite subsets of N is uncountable. What goes wrong?

1
Question 2
Problem 1.5.8 in Lewis and Papadimitriou (2nd. Edition).
Give examples to show that the intersection of two countably infinite sets can be
either finite or countably infinite, and that the intersection of two uncountable sets
can be finite, countably infinite, or uncountable.

Question 3
Let N ={0, 1, 2,..} be the set of whole numbers and Z = {.., -2, -1, 0, 1, 2 ..} be
the set of all integers.
Give a bijection between N and Z.

Question 4
Show that Z × Z is countable.

Question 5
Prove that:
a) The set of rational numbers, Q, is countably infinite
p
(Hint: every rational number can be expressed as q, where p ∈ Z, q ∈ N ,
q 6= 0, and p, q are relatively prime)
b) (Q. 1.5.11 in textbook) The set of all real numbers in the interval [0, 1] is
uncountable
(Hint: refer to the hint in textbook)

Context-free Grammars
Question 1
Show that the following languages are context-free by exhibiting context-free gram-
mars generating each.

(a) {am bn : m ≥ n}
(b) {am bn cp dq : m + n = p + q}
(c) {w ∈ {a, b}∗ : w has twice as many b’s as a’s}
(d) {w ∈ {a, b}∗ : w has equal number of a’s and b’s}
(e) {w ∈ {a, b}∗ : w = wR }

Question 2
Let G = (V, Σ, R, S), where V = {a, b, S}, Σ = {a, b}, and R = {S → aSb, S →
aSa, S → bSa, S → bSb, S → e}. Show that L(G) = {w ∈ {a, b}∗ : w has even length}.

2
Question 3
Prove that all regular languages are context-free.
(Hint: Recall that in class we showed how to construct the context-free grammar
corresponding to a particular DFA. You need to prove that the construction always
works correctly.)

Question 4
Construct a pushdown automaton that accepts the language {ai bj : i ≤ 2j}

Question 5
Construct a pushdown automaton that accepts the language {ai bj ck : i = j + k}

Pushdown Automata
Question 1
Consider the alphabet Σ = {a, b, (, ), ∪, ∗ , ∅}. Construct a context-free grammar
which generates all strings in Σ∗ that are regular expressions over {a, b}.

Question 2
Construct a pushdown automaton that accepts the following language:

{w ∈ {a, b}∗ : w has twice as many b’s as a’s}

Question 3
Use closure under union to show that the following languages are context-free.

a) {am bn : m 6= n}

b) {w ∈ {a, b}∗ : w = wR }

c) {am bn cp dq : n = q OR m ≤ p OR m + n = p + q}

d) {a, b} − {an bn : n ≥ 0}

Question 4
In the proof of Theorem 3.5.2, why did we assume that M2 was deterministic?

Closure Properties & Pumping Theorem for CFLs


Question 1
Use the pumping theorem for CFLs to show that the following languages are not
context free.
2
a) {an : n ≥ 0}
b) {ww : w ∈ {0, 1}∗}

3
Question 2
You are told that the language L = {an bn cn : n ≥ 0} is not context-free. Prove
that the following language is also not context-free:

{w ∈ {a, b, c}∗ : w has equal number of a’s, b’s, and c’s}

Question 3
Suppose that L is context-free and R is regular. Are the following languages neces-
sarily context free? If yes, prove it; if not, give a counter-example.

a) L − R

b) R − L

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy