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...
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.
The following language over Σ = {1, #} contains #-separated lists of distinct unary values: A...
The following language over Σ = {1, #} contains #-separated lists of distinct unary values: A = {x1#x2# . . . #xk | k ≥ 0, xi = 1∗ for all i = 1 . . . k, xi 6= xj for all i 6= j} Use the pumping lemma to show A is not regular. In other words, give a string s ∈ A and argue that no matter how you partition s = xyz with |y| > 0,...
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x,...
Draw PDA transition diagram for the following language: The set of strings over the alphabet {x, y} where 2 * (# of x's) = 3 * (#y's) That is, if we let nx be the number of x's and ny be the number of y's, then the strings in these language are those where 2nx = 3ny Try to find a PDA that is as simple and elegant as possible (do not convert from CFG). ------------------------------------------------------------------------------------------------------------------ USE Notation between transition:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT