Langlib

Langlib.Classes.ContextFree.Basics.EncodedCFG

Encoded Context-Free Grammars and Uniform Computability of Emptiness #

This file introduces a concrete encoded representation of context-free grammars (EncodedCFG) that is Primcodable, enabling a genuine uniform computability theorem for CFG emptiness where the grammar itself is the argument.

Encoding #

An EncodedCFG T is a triple (numNT, initial, rules) where:

The underlying type is ℕ × ℕ × List (ℕ × List (ℕ ⊕ T)), which inherits Primcodable from the standard Mathlib instances for products, sums, lists, and (plus Primcodable T). It is Primcodable because each component is: has Primcodable.nat, has Primcodable.sum, List has Primcodable.list, and × has Primcodable.prod.

Main results #

The Encoded Grammar Type #

def EncodedCFG (T : Type) :

An encoded context-free grammar over terminal alphabet T.

Equations
Instances For
    def EncodedCFG.numNT {T : Type} (G : EncodedCFG T) :
    Equations
    Instances For
      Equations
      Instances For
        Equations
        Instances For
          Equations
          Instances For
            def EncodedCFG.toNT {T : Type} (G : EncodedCFG T) (k : ) :
            Equations
            Instances For
              def EncodedCFG.toSymbol {T : Type} (G : EncodedCFG T) :
              Tsymbol T (Fin G.ntCount)
              Equations
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For