Langlib

Langlib.Classes.Linear.Definition

Linear Languages #

This file defines the class of linear languages. A linear grammar is a context-free grammar in which every production has at most one nonterminal on the right-hand side. Equivalently, every rule has the form A → w or A → u B v where u, v are terminal strings and B is a nonterminal.

Linear languages sit strictly between the regular and the context-free languages in the Chomsky hierarchy:

Regular ⊊ Linear ⊊ Context-Free

Main declarations #

def linear_output {T N : Type} (s : List (symbol T N)) :

A symbol string has linear output form if it contains at most one nonterminal. Concretely, it is either a purely terminal string or can be decomposed as map terminal u ++ [nonterminal B] ++ map terminal v.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    def grammar_linear {T : Type} (g : grammar T) :

    An unrestricted grammar is linear if every rule is context-free (empty left/right context) and has linear output.

    Equations
    Instances For
      def is_Linear {T : Type} (L : Language T) :

      A language is linear if it is generated by some linear unrestricted grammar.

      Equations
      Instances For
        def Linear {T : Type} :

        The class of linear languages.

        Equations
        Instances For