CSE322 Normal Forms: CNF & GNF
22 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the name of the first step to convert a CFL grammar to CNF?

Arrange that all bodies of length 2 or more to consist only of variables.

What is the goal of the second step to convert a CFL grammar to Chomsky Normal Form (CNF)?

Break bodies of length 3 or more into a cascade of productions, each with a body consisting of two variables.

What are the three preliminary simplifications for converting a context-free grammar to Chomsky Normal Form (CNF)?

  • Reduce useless productions, Reduce epsilon productions, Reduce unit productions
  • Eliminate empty productions, Eliminate unit productions, Eliminate useless symbols (correct)
  • Eliminate useless symbols, Eliminate ε productions, Eliminate unit productions (correct)
  • Eliminate ε productions, Eliminate unit productions, Eliminate Useless Symbols
  • Remove useless symbols, Remove ε-productions, Remove unit productions
  • In the context of a grammar, unit productions are essential for generating the language.

    <p>False</p> Signup and view all the answers

    A grammar is considered to be in Chomsky Normal Form (CNF) if all productions are in the form A -> BC or A -> a, where A, B, and C are non-terminal symbols, and a is a terminal symbol.

    <p>True</p> Signup and view all the answers

    Describe the concept of 'generating' a symbol in the context of eliminating useless symbols.

    <p>A symbol X is generating if it can derive a terminal string w.</p> Signup and view all the answers

    Explain the concept of 'reachable' symbol in the context of eliminating useless symbols.

    <p>A symbol X is reachable if there is a derivation that starts with the start symbol and ends with a string containing X.</p> Signup and view all the answers

    What is the difference between generating and reachable symbols?

    <p>A generating symbol can produce a terminal string, while a reachable symbol can be derived from the start symbol.</p> Signup and view all the answers

    The order in which useless symbols are removed (first non-reachable, then non-generating) is crucial and cannot be reversed.

    <p>True</p> Signup and view all the answers

    A grammar is in Chomsky Normal Form if it has no unit productions.

    <p>False</p> Signup and view all the answers

    What is a unit production?

    <p>A unit production is a production of the form A → B, where both A and B are non-terminal symbols.</p> Signup and view all the answers

    What are the final steps involved in converting a CFL grammar to Chomsky Normal Form (CNF)?

    <p>The final steps involve ensuring that all bodies of length 2 or more consist only of variables and then breaking down bodies of length 3 or more into a cascade of productions, each with a body consisting of two variables.</p> Signup and view all the answers

    A grammar in Chomsky Normal Form (CNF) has productions only in the format A → BC or A → a.

    <p>True</p> Signup and view all the answers

    What is the central idea behind converting a CFL grammar to Chomsky Normal Form (CNF)?

    <p>The central idea is to ensure that all productions in the grammar have at most two symbols in their body, either two non-terminals or a single terminal.</p> Signup and view all the answers

    A context-free grammar is in Greibach Normal Form (GNF) if all productions are in the form A → aX, where A is a non-terminal symbol, a is a terminal symbol, and X is a sequence of (possibly empty) non-terminal symbols.

    <p>True</p> Signup and view all the answers

    What is the key difference in format between Chomsky Normal Form (CNF) and Greibach Normal Form (GNF)?

    <p>In CNF, each production has at most two symbols in its body, while in GNF, the body must start with a single terminal symbol, followed by a (possibly empty) string of non-terminals.</p> Signup and view all the answers

    The Chomsky Normal Form (CNF) can be used as a starting point for the CYK parsing algorithm.

    <p>True</p> Signup and view all the answers

    What is a derivation tree in the context of parsing a grammar?

    <p>A derivation tree represents the steps of parsing a string, showing how the start symbol is transformed into the target string through a series of productions.</p> Signup and view all the answers

    A derivation tree in a Chomsky Normal Form (CNF) grammar is a binary tree.

    <p>True</p> Signup and view all the answers

    Any string of length 'n' in a grammar in Greibach Normal Form (GNF) can be derived in exactly 'n' steps.

    <p>True</p> Signup and view all the answers

    Grammars in normal form (CNF or GNF) can facilitate the process of proving properties related to languages generated by the grammar.

    <p>True</p> Signup and view all the answers

    The Chomsky Normal Form (CNF) removes all the productions in a grammar that have ε symbols in their body.

    <p>True</p> Signup and view all the answers

    Study Notes

    CSE322 Normal Forms: CNF & GNF

    • The lecture covers Chomsky Normal Form (CNF) and Greibach Normal Form (GNF) for context-free grammars.
    • A presentation outline includes introduction, Chomsky normal form, preliminary simplifications, final steps, Greibach Normal Form, algorithm example, and summary.
    • A grammar is defined as G = (V, T, P, S), where:
      • V is a set of variables.
      • T is a set of terminals.
      • P is a set of productions.
      • S is the start symbol.
    • An example grammar is provided, with terminals T = {a, b}, variables V = {A, B, C}, start symbol S, and production P = S → A.
    • A grammar example illustrates how a grammar generates strings, such as L = {anbncn | n ≥ 1}.
    • Context-free grammar: the head of any production contains only one non-terminal symbol. -Example S→P; P→aPb; P→ε; L = {anbn | n ≥ 0}
    • Chomsky Normal Form: all productions are either A → BC or A → a, where A, B, and C are non-terminal symbols and a is a terminal symbol.
    • Preliminary simplifications for CNF include eliminating useless symbols, ε productions, and unit productions.
    • Useless symbols are identified by generating and reachable symbols. A symbol is generating if it can derive a terminal string. A symbol is reachable if it can be derived from the start symbol.
    • ε productions are productions that produce the empty string.
      • Create two versions of the production, one with the nullable variable and one without.
      • Eliminate productions with empty bodies.
    • Unit productions are productions of the form A → B where A and B are variables.
      • Identify unit pairs
      • Replace every occurrence of B with ω.
    • Steps to convert a grammar to CNF:
      • Arrange all bodies of length 2 or more to consist only of variables.
      • Break bodies of length 3 or more into a cascade of productions, each with a body consisting of two variables.
    • Greibach Normal Form: all productions are of the form A → aX, where A is a non-terminal symbol, a is a terminal symbol, and X is a sequence of non-terminal symbols (possibly empty).
    • Example of removing non-generating and non-reachable symbols are given.
    • Steps for finding generating and reachable symbols.
    • Examples for ε productions and unit productions are shown.
    • Summary of the properties of CNF and GNF, including how derivation trees are structured, how string lengths relate to derivation steps, and how normal forms facilitate proofs.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    This quiz covers Chomsky Normal Form (CNF) and Greibach Normal Form (GNF) as they apply to context-free grammars. It includes explanations of grammar definitions, production examples, and the rules governing normal forms. Test your understanding of these crucial concepts in formal language theory.

    More Like This

    Chomsky's Theory of Universal Grammar
    3 questions
    Chomsky's Language Acquisition Model
    57 questions
    SOC 102 - Chomsky and Sports
    35 questions
    Sintassi e Linguaggio secondo Chomsky
    185 questions
    Use Quizgecko on...
    Browser
    Browser