Question

In: Computer Science

Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules...

Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules for L1 are as follows:

S → TT
S → U
T → 0T
T → T0
T→ 1
U → 0U00
U → 1
Q → λ
P → QU

Transform this grammar into Chomsky Normal Form, consistent with the CNF specification in the Quick Reference, and using only Variables { S, T, U, V, W, X }.

Implement that CNF grammar in JFLAP

Solutions

Expert Solution

Here, we have Language L1 as:

Variables = { S, T, U ,V, W, X}

Terminals = { 0, 1 }

Start Symbo = S

S -> TT

S -> U

T -> 0T

T -> T0

T -> 1

U -> 0U00

U -> 1

Q ->

P -> QU

Now, we know that :

CNF stands for Chomsky normal form. A CFG(context free grammar) is in CNF(Chomsky normal form) if all production rules satisfy one of the following conditions:

  • Start symbol generating ε. For example, A → ε.
  • A non-terminal generating two non-terminals. For example, S → AB.
  • A non-terminal generating a terminal. For example, S → a.

Step 1: Here, there is a NULL value , we will remove  .

S -> TT

S -> U

T -> 0T

T -> T0

T -> 1

U -> 0U00

U -> 1

P -> QU

P -> U

Now , again,

S -> TT

T -> 0T

T -> T0

T -> 1

U -> 0U00

U -> 1

P -> QU

s -> U

S -> 1

unit removal is completed. Select proceed to begin removing useless production.

Let X -> 0

S ->TT

S -> U

T -> XT

T -> TX

T -> 1

U -> xUxx

U -> 1

P -> U

again,

Now let W -> XX, V -> UXX

S -> TT

S -> U

S -> 1

T -> XT

T -> TX

T ->  1

U - > XV

U -> 1

V -> UXX

W -> XX

X -> 0

Hence , final CNF grammar is

S ->TT

S -> XV

T -> XT

T ->1

U -> XV

U ->1

V -> UW

W -> XX

X -> 0

Now this is in Chomsky Normal Form (CNF).


Related Solutions

1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L = { aib2i : i > 0} 2) Prove the language M is not regular, over the alphabet Σ = {a, b}. M = { wwR : w is an element of Σ* i.e. w is any string, and wR means the string w written in reverse}. In other words, language M is even-length palindromes.
Determine if the language ?={?^?∶?=?^3????????≥0}over Σ={?}is regular.
Determine if the language ?={?^?∶?=?^3????????≥0}over Σ={?}is regular.
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is...
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is finite? How many such languages exist?
2. i. Consider a binary source alphabet where a symbol 0 is represented by 0 volt...
2. i. Consider a binary source alphabet where a symbol 0 is represented by 0 volt and a symbol 1 is represented by 1 volt. Assume these symbols are transmitted over a baseband channel having uniformly distributed noise with a probability density function:         px= {18 for-4≤x≤4 0 Assume that the single decision threshold T is in the range of 0 and l volt. If the symbols 0 and 1 are sent with probabilities p0 and 1- p0 respectively, derive...
Automata Question. Over the alphabet Σ = {a, b}: 1) Give a DFA, M1, that accepts...
Automata Question. Over the alphabet Σ = {a, b}: 1) Give a DFA, M1, that accepts a Language L1 = { w | w has exactly 2 a’s } 2) Give a DFA, M2, that accepts a Language L2 = { w | w has at least 2 b’s } 3) Give acceptor for L1 intersection L2 4) Give acceptor for L1 - L2
3. Are the following languages A and B over the alphabet Σ = {a, b, c,...
3. Are the following languages A and B over the alphabet Σ = {a, b, c, d} regular or nonregular? • For a language that is regular, give a regular expression that defines it. • For a nonregular language, using the pumping lemma prove that it is not regular. (a) A = {d 2j+1c k+1 | j ≥ k ≥ 0} · {c r+2b 2s+3 | r ≥ 0 and s ≥ 0} (b) B = {a 2j+2b k+3c j+1...
Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z,...
Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z, A, B, . . . , Z, 0, 1, . . . , 9} and let L be the language of all regular expressions over Σ: L = {w ∈ Σ ∪ {∅,(,), ∪, ·, * }* | w is a syntactically legal regular expression over Σ} Give an unambiguous context-free grammar that generates L. The grammar should use the following precedence levels, from...
2. Let S be the set of strings over the alphabet Σ = {a, b, c}...
2. Let S be the set of strings over the alphabet Σ = {a, b, c} defined recursively by (1) λ ∈ S and a ∈ S; and (2) if x ∈ S, then bxc ∈ S. Recall that λ denotes the empty string which has no letters and has length 0. List all strings of S which are length at most seven. 3. Prove the following theorem by induction: For every integer n ≥ 1, 1 · 2 +...
1. All questions assume the alphabet Σ = { a , b }. a) Give a...
1. All questions assume the alphabet Σ = { a , b }. a) Give a regular expression representing the language of all strings containing abab as a substring. b) Give a regular expression representing the language of all strings with an even number of a's or an odd number of b's, such as abab or baabaab. c) Give a regular expression representing the language of all strings of the form ambn, where m is even and n is odd....
Consider the standard normal curve, where μ=0 and σ=1. Find the value z so that 90%...
Consider the standard normal curve, where μ=0 and σ=1. Find the value z so that 90% of the area under the curve is between −z and z . Give your answer to 4 decimal places.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT