onvert these rules to CNF. A → ABA| B|a|ab B→BCB|C|b|bc|e C→CD|DC|c D→D E
onvert these rules to CNF. A → ABA| B|a|ab B→BCB|C|b|bc|e C→CD|DC|c D→D E
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![**Converting Grammar Rules to Chomsky Normal Form (CNF)**
In this lesson, we will focus on converting the given set of grammar rules to Chomsky Normal Form (CNF). CNF is a type of context-free grammar where each rule is of the form:
1. \( A \rightarrow BC \) (where \( A \), \( B \), and \( C \) are non-terminal symbols, and \( B \) and \( C \) are not start symbols)
2. \( A \rightarrow a \) (where \( A \) is a non-terminal symbol and \( a \) is a terminal symbol)
Given grammar rules:
\[ A \rightarrow ABA \ | \ B \ | \ a \ | \ ab \]
\[ B \rightarrow BCB \ | \ C \ | \ b \ | \ bc \ | \ \epsilon \]
\[ C \rightarrow CD \ | \ DC \ | \ c \]
\[ D \rightarrow D \ | \ \epsilon \]
Here are the steps involved in converting these rules to CNF:
1. **Remove ε-productions**: Get rid of productions that produce an empty string (ε), except when the start symbol itself can generate ε.
2. **Remove unit productions**: Productions where one non-terminal goes to another non-terminal.
3. **Eliminate useless symbols**: Remove any non-terminal symbols that do not appear in any derivations of terminal strings.
4. **Break down long productions**: Ensure that each production has at most two non-terminals on the right-hand side, or a single terminal.
### Explanation
#### Step 1: Remove ε-productions
- From \( B \rightarrow \epsilon \)
- From \( D \rightarrow \epsilon \)
#### Step 2: Remove unit productions
Unit productions such as \( A \rightarrow B \), \( B \rightarrow C \), etc., need to be replaced with equivalent productions without chaining single non-terminal to another.
#### Step 3: Eliminate long Productions
- Productions like \(A \rightarrow ABA \), \( BCB \) need to be decomposed to follow CNF rules.
Here is the systematic approach to convert it to CNF:
#### Intermediate Grammars Post Transformation:
1. **Eliminating ε-productions:**
We introduce new rules for possibilities without ε.
For \( B \rightarrow b \mid C \mid bC \mid b \](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F02653cd8-bf86-4163-910a-cf0838bd0b6e%2F3b7bc329-880a-4bdf-8c6c-c1b56a2e7119%2Fk1fhxumj_processed.png&w=3840&q=75)
Transcribed Image Text:**Converting Grammar Rules to Chomsky Normal Form (CNF)**
In this lesson, we will focus on converting the given set of grammar rules to Chomsky Normal Form (CNF). CNF is a type of context-free grammar where each rule is of the form:
1. \( A \rightarrow BC \) (where \( A \), \( B \), and \( C \) are non-terminal symbols, and \( B \) and \( C \) are not start symbols)
2. \( A \rightarrow a \) (where \( A \) is a non-terminal symbol and \( a \) is a terminal symbol)
Given grammar rules:
\[ A \rightarrow ABA \ | \ B \ | \ a \ | \ ab \]
\[ B \rightarrow BCB \ | \ C \ | \ b \ | \ bc \ | \ \epsilon \]
\[ C \rightarrow CD \ | \ DC \ | \ c \]
\[ D \rightarrow D \ | \ \epsilon \]
Here are the steps involved in converting these rules to CNF:
1. **Remove ε-productions**: Get rid of productions that produce an empty string (ε), except when the start symbol itself can generate ε.
2. **Remove unit productions**: Productions where one non-terminal goes to another non-terminal.
3. **Eliminate useless symbols**: Remove any non-terminal symbols that do not appear in any derivations of terminal strings.
4. **Break down long productions**: Ensure that each production has at most two non-terminals on the right-hand side, or a single terminal.
### Explanation
#### Step 1: Remove ε-productions
- From \( B \rightarrow \epsilon \)
- From \( D \rightarrow \epsilon \)
#### Step 2: Remove unit productions
Unit productions such as \( A \rightarrow B \), \( B \rightarrow C \), etc., need to be replaced with equivalent productions without chaining single non-terminal to another.
#### Step 3: Eliminate long Productions
- Productions like \(A \rightarrow ABA \), \( BCB \) need to be decomposed to follow CNF rules.
Here is the systematic approach to convert it to CNF:
#### Intermediate Grammars Post Transformation:
1. **Eliminating ε-productions:**
We introduce new rules for possibilities without ε.
For \( B \rightarrow b \mid C \mid bC \mid b \
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education