0% found this document useful (0 votes)
80 views

COMP 3803 - Assignment 3

This document provides instructions for Assignment 3 in COMP 3803. It is due on March 28th by 23:59 and must be submitted as a single PDF file with a specific naming convention. Late assignments will not be accepted. Students are encouraged to collaborate but must write their own solutions. Effort on the assignments is important for learning the material. The assignment contains 6 questions involving context-free grammars, context-free languages, and pushdown automata.

Uploaded by

Nizam CAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

COMP 3803 - Assignment 3

This document provides instructions for Assignment 3 in COMP 3803. It is due on March 28th by 23:59 and must be submitted as a single PDF file with a specific naming convention. Late assignments will not be accepted. Students are encouraged to collaborate but must write their own solutions. Effort on the assignments is important for learning the material. The assignment contains 6 questions involving context-free grammars, context-free languages, and pushdown automata.

Uploaded by

Nizam CAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMP 3803 — Assignment 3

Due: Sunday March 28, 23:59.


Assignment Policy:

• Your assignment must be submitted as one single PDF file through cuLearn.

Use the following format to name your file:

LastName StudentId a3.pdf

• Late assignments will not be accepted. I will not reply to emails of the
type “my internet connection broke down at 23:57” or “my scanner stopped
working at 23:58”, or “my dog ate my laptop charger”.

• You are encouraged to collaborate on assignments, but at the level of discussion only.
When writing your solutions, you must do so in your own words.

• Past experience has shown conclusively that those who do not put adequate effort into
the assignments do not learn the material and have a probability near 1 of doing poorly
on the exams.

• When writing your solutions, you must follow the guidelines below.

– You must justify your answers.


– The answers should be concise, clear and neat.
– When presenting proofs, every step should be justified.

Question 1: Write your name and student number.

Question 2: Give context-free grammars that generate the following languages. For each
case, justify your answer.
(2.1) {02n 1n |n ≥ 0}. The set Σ of terminals is equal to {0, 1}.
(2.2) {w|w starts and ends with different symbols}. The set Σ of terminals is equal to
{0, 1}.
(2.3) {w| w is a palindrome}. The set Σ of terminals is equal to {0, 1}.
A palindrome is a string w having the property that w = wR , i.e., reading w from left to
right gives the same result as reading w from right to left. For example, the four binary
strings , 1, 0110, and 10101 are palindromes.
(2.4) {am bn cn |m ≥ 0, n ≥ 0}. The set Σ of terminals is equal to {a, b, c}.

1
Question 3: Let L and L0 be context-free languages over the same alphabet Σ.
(3.1) Prove that the union L ∪ L0 of L and L0 is also context-free.
(3.2) Prove that the concatenation LL0 of L and L0 is also context-free.
(3.3) Prove that the star L∗ of L is also context-free.

Question 4: Give (deterministic or nondeterministic) pushdown automata that accept the


following languages. For each pushdown automaton, start by explaining the algorithm in
plain English, then mention the states that you are going to use, then explain the meaning
of these states, and finally give the list of instructions.
(4.1) {02n 1n |n ≥ 0}.
(4.2) {wwR |w ∈ {0, 1}∗ }.
(If w = w1 . . . wn , then wR = wn . . . w1 .)

Question 5: Prove that the following languages are not context-free:


(5.1) {0n 1 02n 1 03n |n ≥ 0}.
(5.2)
{ w ∈ {a, b, c}∗ | w contains more b’s than a’s and
w contains more c’s than a’s }.

Question 6: In Question 1, you have shown that

L = {am bn cn |m ≥ 0, n ≥ 0}

is a context-free language. By a symmetric argument, the language

L0 = {am bm cn |m ≥ 0, n ≥ 0}

is context-free.
(6.1) Argue that the intersection of two context-free languages is not necessarily context-free.
(You may use any result that was proven in class.)
(6.2) Argue that the complement of a context-free language is not necessarily context-free.

You might also like