MHB Finishing converting to Chomsky Normal Form from a CFG?

  • Thread starter Thread starter Lolligirl
  • Start date Start date
  • Tags Tags
    Form Normal
Click For Summary
SUMMARY

The discussion revolves around converting a context-free grammar (CFG) to Chomsky Normal Form (CNF). The initial grammar provided is G = ( { S, B, E }, { 0, 1, i, e, s }, R, S ), with specific production rules. Participants detail the process of eliminating lambda productions and unit/chain rules, ultimately suggesting various forms of the grammar to maintain language equivalence while adhering to CNF requirements. Key insights include the importance of preserving all original language productions during the transformation process.

PREREQUISITES
  • Understanding of context-free grammars (CFG)
  • Familiarity with Chomsky Normal Form (CNF)
  • Knowledge of lambda calculus in grammar
  • Ability to manipulate production rules in formal languages
NEXT STEPS
  • Study the process of eliminating lambda productions in CFGs
  • Learn techniques for removing unit and chain rules in grammar
  • Explore examples of converting CFGs to Chomsky Normal Form
  • Investigate the implications of grammar transformations on language equivalence
USEFUL FOR

Students of formal languages, computer scientists working with compilers, and anyone involved in theoretical computer science who seeks to understand grammar transformations and their applications.

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)
 
We have many threads on AI, which are mostly AI/LLM, e.g,. ChatGPT, Claude, etc. It is important to draw a distinction between AI/LLM and AI/ML/DL, where ML - Machine Learning and DL = Deep Learning. AI is a broad technology; the AI/ML/DL is being developed to handle large data sets, and even seemingly disparate datasets to rapidly evaluated the data and determine the quantitative relationships in order to understand what those relationships (about the variaboles) mean. At the Harvard &...

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
3K
  • · Replies 15 ·
Replies
15
Views
4K
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K