Langlib

Langlib.Classes.ContextSensitive.Definition

Context-Sensitive Languages #

This file defines the class of context-sensitive languages via unrestricted grammars: all rules are non-contracting, except for an optional distinguished start rule S → ε.

def initial_epsilon_rule {T : Type} (g : grammar T) (r : grule T g.nt) :

The distinguished empty-word rule S → ε.

Equations
Instances For
    def grule_noncontracting {T N : Type} (r : grule T N) :

    The non-contracting rule condition for a single unrestricted grammar rule.

    Equations
    Instances For
      def initial_not_on_rhs {T : Type} (g : grammar T) :

      The start symbol does not occur on the right-hand side of any rule.

      Equations
      Instances For

        An unrestricted grammar is context-sensitive if every rule is either the optional distinguished rule S → ε or is non-contracting, and — whenever the S → ε rule is present — the start symbol S never occurs on a right-hand side.

        The right-hand-side restriction is part of the standard definition of a context-sensitive grammar: it guarantees that S only ever appears as the initial sentential form, so that the erasing rule S → ε contributes exactly the empty word (and nothing else). Without it, rules such as S → SS together with S → ε would allow contracting derivations of non-empty words, taking the grammar outside the context-sensitive (linear-bounded) class.

        Equations
        Instances For

          Every non-contracting grammar is context-sensitive: it has no S → ε rule, so the right-hand-side restriction is vacuous.

          def is_CS {T : Type} (L : Language T) :

          Predicate that a language is context-sensitive.

          Equations
          Instances For

            Every non-contracting language is context-sensitive.

            def is_CS_via_csg {T : Type} (L : Language T) :

            Characterization of context-sensitive languages via ε-free context-preserving grammars.

            Equations
            Instances For
              def CS {T : Type} :

              The class of context-sensitive languages.

              Equations
              Instances For