Search⌘ K

Chomsky Normal Form Rules

Explore how to transform context-free grammars into Chomsky Normal Form by applying specific rule restrictions and transformations. Learn to handle terminals, variables, and lambda removals to simplify grammars, aiding in clearer understanding and analysis of context-free languages.

We'll cover the following...

Converting a grammar to CNF

When a grammar does not use lambda in any rule and has no unit productions, it is ready to convert to Chomsky normal form (CNF). CNF allows rules of only two types:

  • Xc,where XV,and cΣX\to c, \text{where }X\in V, \text{and }c\in \Sigma
  • XYZ,where X,Y,ZVX\to YZ, \text{where }X,Y,Z \in V

In other words, right-hand sides can only have a single (nonempty) terminal symbol or exactly two variables. If applicable, we can retain the empty string with the rule SλS\to \lambda, but only if SS does not appear on the right-hand side of any rule.

Sometimes we can remove ...