Langlib

Langlib.Classes.ContextFree.Pumping.ParseTree

Parse Trees for Chomsky Grammars #

This file defines parse trees and proves the basic height and yield lemmas used in the pumping argument.

Main declarations #

inductive ChomskyNormalFormGrammar.parseTree {T : Type uT} {g : ChomskyNormalFormGrammar T} :
g.NTType (max uN uT)

A parseTree n encodes a ChomskyNormalFormGrammar derivation of a word from a nonterminal n

Instances For

    The yield of a tree is the word the tree derives

    Equations
    Instances For

      The height of a tree

      Equations
      Instances For
        inductive ChomskyNormalFormGrammar.parseTree.IsSubtreeOf {T : Type uT} {g : ChomskyNormalFormGrammar T} {n₁ n₂ : g.NT} :
        parseTree n₁parseTree n₂Prop

        IsSubTreeOf p₁ p₂ encodes that p₁ is a subtree of p₂

        Instances For
          theorem ChomskyNormalFormGrammar.parseTree.subtree_decomposition {T : Type uT} {g : ChomskyNormalFormGrammar T} {n₁ n₂ : g.NT} {p₁ : parseTree n₁} {p₂ : parseTree n₂} (hpp : p₂.IsSubtreeOf p₁) :
          theorem ChomskyNormalFormGrammar.parseTree.IsSubtreeOf.trans {T : Type uT} {g : ChomskyNormalFormGrammar T} {n₁ n₂ n₃ : g.NT} {p₁ : parseTree n₁} {p₂ : parseTree n₂} {p₃ : parseTree n₃} (hp₁ : p₁.IsSubtreeOf p₂) (hp₂ : p₂.IsSubtreeOf p₃) :
          p₁.IsSubtreeOf p₃
          theorem ChomskyNormalFormGrammar.parseTree.subtree_height {T : Type uT} {g : ChomskyNormalFormGrammar T} {n₁ n₂ : g.NT} {p₁ : parseTree n₁} {p₂ : parseTree n₂} (hpp : p₁.IsSubtreeOf p₂) :
          p₁.height p₂.height
          theorem ChomskyNormalFormGrammar.Produces.rule {T : Type uT} {g : ChomskyNormalFormGrammar T} {n : g.NT} {u : List (Symbol T g.NT)} (hnu : g.Produces [Symbol.nonterminal n] u) :
          rg.rules, r.input = n r.output = u