Langlib

Langlib.Classes.ContextFree.Inclusion.ContextSensitive

Context-Free Inclusions #

This file relates the project's context-free grammars to context-sensitive, unrestricted, and mathlib formulations.

Main declarations #

def CF_no_epsilon' {T : Type} (g : CF_grammar T) :

A context-free grammar has no ε-productions (every rule has a non-empty right-hand side).

Equations
Instances For
    def csg_of_cfg {T : Type} (g : CF_grammar T) (hne : CF_no_epsilon' g) :

    Convert a context-free grammar without ε-productions to a context-sensitive grammar. The CS rules have empty context (α = β = []) and γ = rule output.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem is_CS_of_is_CF {T : Type} {L : Language T} (h : is_CF L) :

      Context-free languages are context-sensitive.

      Context-sensitive grammars require non-empty rule outputs, so the ε-productions of the context-free grammar are first removed (ContextFreeGrammar.eliminateEmpty), yielding a non-contracting grammar for L \ {ε}. The empty word is re-adjoined when ε ∈ L using is_CS_insert_empty_of_CS_grammar.

      theorem CF_subclass_CS {T : Type} :

      Context-free languages form a subclass of the context-sensitive languages.