Langlib

Langlib.Grammars.ContextFree.Definition

Context-Free Grammar Definitions #

This file defines context-free grammars, their derivation relation, and the induced language predicate.

Main declarations #

structure CF_grammar (T : Type) :

Context-free grammar that generates words over the alphabet T (a type of terminals).

Instances For
    def CF_transforms {T : Type} (g : CF_grammar T) (w₁ w₂ : List (symbol T g.nt)) :

    One step of context-free transformation.

    Equations
    Instances For
      def CF_derives {T : Type} (g : CF_grammar T) :
      List (symbol T g.nt)List (symbol T g.nt)Prop

      Any number of steps of context-free transformation; reflexive+transitive closure of CF_transforms.

      Equations
      Instances For
        def CF_generates_str {T : Type} (g : CF_grammar T) (s : List (symbol T g.nt)) :

        Accepts a string (a List of symbols) iff it can be derived from the initial nonterminal.

        Equations
        Instances For
          def CF_generates {T : Type} (g : CF_grammar T) (w : List T) :

          Accepts a word (a List of terminals) iff it can be derived from the initial nonterminal.

          Equations
          Instances For
            def CF_language {T : Type} (g : CF_grammar T) :

            The Set of words that can be derived from the initial nonterminal.

            Equations
            Instances For