Finishing converting to Chomsky Normal Form from a CFG?

  • Context: MHB 
  • Thread starter Thread starter Lolligirl
  • Start date Start date
  • Tags Tags
    Form Normal
Click For Summary

Discussion Overview

The discussion revolves around converting a given context-free grammar (CFG) into Chomsky Normal Form (CNF). Participants are sharing their steps and reasoning while addressing issues related to the conversion process, including the removal of lambda productions and unit/chain rules.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents an initial CFG and outlines their steps in removing lambda productions, resulting in a new set of rules.
  • Another participant points out that the recycling of the variable S leads to a loss of language representation, indicating a potential error in the transformation process.
  • A subsequent participant suggests a modification to include the missing word 's' while expressing uncertainty about the correctness of the reduction of rules.
  • Another participant proposes an alternative approach to maintain the original meaning of S while introducing new variables for the transformations.

Areas of Agreement / Disagreement

Participants express differing opinions on the correctness of the transformations and the implications of their changes to the grammar. There is no consensus on the best approach to achieve CNF.

Contextual Notes

Participants highlight issues such as the loss of language representation and the need to maintain the recursive application of certain rules, indicating that the transformations may not fully adhere to CNF requirements.

Lolligirl
Messages
22
Reaction score
0
Hello everyone! Here is a question I am working on:

Consider the context-free grammar G = ( { S, B, E }, { 0, 1, i, e, s }, R, S ), where R is:

S --> iBSE | s
B --> 0 | 1
E --> lambda | eS

Convert this to Chomsky Normal Form, showing all steps.

Alrighty, so I removed the lambda and got:

S0 --> S
S --> iBS | iBSE | s
B --> 0 | 1
E --> eS

And now I'm trying to remove the unit/chain rules and the rest, and this is what I have so far:

S0 --> X
X --> YS
S --> BS
S --> BSE
S --> s
B --> 0
B --> 1
E --> ZS
Y --> i
Z --> e

But I know S0 --> X and S --> BSE are not valid. From here I am a bit unsure: How can I fix this? Can I do this?

S0 --> YS
S --> BS
S --> BT
S --> s
B --> 0
B --> 1
E --> ZS
T --> SE
Y --> i
Z --> e

Thank you for any help! :)
 
Last edited:
Technology news on Phys.org
Hi Lolligirl!

Are you still busy with this problem? (Wondering)

Lolligirl said:
S --> iBSE | s
B --> 0 | 1
E --> lambda | eS

Convert this to Chomsky Normal Form, showing all steps.

Alrighty, so I removed the lambda and got:
S0 --> S
S --> iBS | iBSE | s
B --> 0 | 1
E --> eS

And now I'm trying to remove the unit/chain rules and the rest, and this is what I have so far:
S0 --> X
X --> YS
S --> BS
S --> BSE
S --> s

Hmm... it looks like you have recycled S to mean something else now... (Worried)
But hold on!
The language in the previous step contained $S_0 \to S \to s$.
But your new language only contains the equivalent $S_0 \to X \to YS \to is$.
You have lost a word from your language! :eek:
 
Oh! Could I fix it by doing this?

S0 --> YS | s
S --> BS | BT
B --> 0 | 1
T --> SE
E --> ZS
Y --> i
Z --> eOr maybe I'm nuts. :o
 
Lolligirl said:
Oh! Could I fix it by doing this?

S0 --> YS | s
S --> BS | BT
B --> 0 | 1
T --> SE
E --> ZS
Y --> i
Z --> eOr maybe I'm nuts. :o

That would take care of the missing word 's'... but I do not think the reduction of the rules is right.

You started from:
S0 --> S
S --> iBS | iBSE | s

With your reduction, you no longer have the rule S-->s that could be applied recursively. Now it can only be applied once a the beginning. :eek:I think this will go better if you keep the meaning of S the same as it was.
Your might do for instance:
S0 --> S
S --> YU | YV | s
U --> BS
V --> BT
Y --> i
(Wasntme)
 

Similar threads

  • · Replies 29 ·
Replies
29
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 15 ·
Replies
15
Views
4K
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 0 ·
Replies
0
Views
1K