Write a regular expression

Assignment Help Theory of Computation
Reference no: EM132780724

UU-COM-3001 Computational theory - Unicaf University

Assignment 3

Problem 1

Consider the following languages over Σ = {0,1}.

• L1 is the language described by (0+1)∗.

• L2 is the language of all strings that do not contain the pattern 00.

• L3 is the language of the DFA given by the following transition table:

 

0

1

→∗q0

q1

q0

∗q1

q2

q1

∗q2

q3

q2

q3

q3

q3

• L4 is the language described by ε +0+1+(ε +0+1) (ε +0+1) ∗ (ε +0+1).

• L5 is the language of all strings that have at most two 0s.

• L6 is the language of the NFA given by the following transition table:

 

0

1

→∗q0

{q0, q1}

{q0}

∗q1

{q2}

Φ

∗q2

Φ

Φ

• L7 is the language described by 1∗(011∗)∗ +1∗(011∗)∗0.

Which of these languages are the same and which are different? To show two languages are the same give a short proof, and to show two languages are different give a string that is in one but not by the other. (You must provide an explanation to get credit.)

Problem 2

This problem concerns languages over the alphabet Σ = {1}. For any two integers q,r ≥0, define the language Lr,q over Σ as Lr,q ={1mq+r : m ≥0}={1q,1q+r,12q+r,...}.

For instance, L1,3 ={1,1111,1111111,...}.

(a) Show that for every q and r, the language Lr,q is regular.

(b) Show that if L is a regular language over Σ, then L can be written as

L = Lr1,q ∪ Lr2,q ∪...∪ Lrk,q ∪ L0, where 0 ≤ r1 < ... < rk are integers and L0 is a finite set.

Problem 3:

Suppose the following PDA P = ({q, r}, {0,1}, {Z0, X}, δ, q, Z0, Φ) is given:

0, Z0/XZ0        1, Z0/∈
0, X /XX          1, X /XX
1, X /X            ∈, X/∈

1615_figure.jpg

Convert P to a PDA P′ with L(P′) = N(P).

Problem 4:

Convert the grammar
S → 0S1 | A
A → 1A0 | S | ∈
to a PDA that accepts the same language by empty stack.

Problem 5:

Consider the following grammar:
S → ASB | ∈

A → aAS | a
B → SbS | A | bb
a. Eliminate all ∈-productions.
b. Eliminate all unit productions from the resulting grammar in a).
c. Eliminate all useless symbols from the resulting grammar in b).
d. Put the resulting grammar in c) in Chomsky Normal Form.

Problem 6:

Context-free grammars are sometimes used to model natural languages. In this problem you will model a fragment of the English language using context-free grammars. Consider the following English sentences:

The girl is pretty.
The girl that the boy likes is pretty.
The girl that the boy that the clerk pushed likes is pretty.
The girl that the boy that the clerk that the girl knows pushed likes is pretty.

This is a special type of sentence built from a subject (The girl), a relative pronoun (that) followed by another sentence, a verb (is) and an adjective (pretty).

(a) Give a context-free grammar G that models this special type of sentence. Your terminals should be words or sequences of words like pretty or the girl.
(b) Is the language of G regular? If so, write a regular expression for it. If not, prove using the pumping lemma for regular languages.
(c) Can you give an example of a sentence that is in G but does not make sense in common English?

Your work needs to be well written and have quality information. Your work must be clear and has to be able to educate someone with no prior knowledge in Compiler design.

Attachment:- Computational theory Assignment 3.rar

Reference no: EM132780724

Questions Cloud

How is the audit report dated : Give the four basic reports which may be issued in an audit engagement. Identify the situations which warrant the issuance of each type of report.
What is the lowest price immanuel should accept : What is the lowest price Immanuel should accept on this special order without losing money. If Immanuel had regular sales of 71,000 bins per month
What tools does aws provide to help facilitate the move : Contoso Corp has decided that they would like to move their existing Hyper-V on-premise application servers to the cloud service provider Amazon Web Services.
What son and don capital balances will be : After admitting Ron to the partnership, Son's and Don's capital balances will be? Son and Don are partners who share profits and losses equally.
Write a regular expression : Model a fragment of the English language using context-free grammars - Context-free grammars are sometimes used to model natural languages
Which the amount will be credited to ron capital account : Which the amount will be credited to Ron's capital account? If the difference between Ron's investment and his recorded partnership equity is considered a bonus
What are reasons for the recent popularity of data mining : What are the main reasons for the recent popularity of data mining? Discuss what an organization should consider before making a decision to purchase data.
Record issuance of the bonds on december : Record issuance of the bonds on December 31, 2020, the payment of interest and amortization on June 30, 2021, and on December 31, 2021
Elements of the country transportation and energy : The term critical infrastructure refers to key elements of the country's transportation, energy, communications, and banking systems.

Reviews

Write a Review

Theory of Computation Questions & Answers

  Translate the following argument using truth tables

Translate the following argument and use truth tables to test for validity.

  List three major components of bell-lapadula model

List 3 major components of Bell-LaPadula Model. Provide specific examples to explain how these 3 major components work. What are the limitations of this model.

  Ms give and fa for each of the following languagesa all

give and fa for each of the following languages ltbrgt ltbrgta. all binary strings with at least three 13939s ltbrgtb.

  Find an explicit turing machine accepting the language

Find an explicit Turing machine accepting the language and Find an unrestricted grammar that generates

  Explanation of turing machine

Devise a Turing machine with input given in unary notation such that the equipments produces the following output, 0 if x is divisible by 4,

  Design mealy fsm with the input a and output z

Design a Mealy FSM with the input A and an output Z. If 10101 shows up on A, then in same cycle 1 must show up on Z, else Z is 0.

  Express set as regular expression

Express the following set as a regular expression: The set of all strings of length at least three over {0,1} such that every three consecutive.

  1let s1 and s2 be two strings of lengths m and n

1.let s1 and s2 be two strings of lengths m and n respectively. by de?nition a superstring of s1 and s2 is one which

  Construct a phrase-structure grammar

Construct a phrase-structure grammar for the set of all fractions of the form a/b, where a is a signed integer in decimal notation and b is a positive integer.

  Nondeterministic finite-state automaton

Show that every nondeterministic finite-state automaton is equivalent to another such automaton that has the property that its starting state.

  Find set of bit strings containing an even number of ones

Show that there is no finite-state automaton with three states that recognizes the set of bit strings containing an even number of 1s and an even number of 0s.

  Rice-s theorem for enumerable or non-re

We know by rice's theorem that none of the following problems are decidable. However,are they recursively enumerable,or non-RE? IS L(M) infinite?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd