A Codatatype of Formal Languages


Title: A Codatatype of Formal Languages
Author: Dmitriy Traytel (traytel /at/ inf /dot/ ethz /dot/ ch)
Submission date: 2013-11-15

We define formal languages as a codataype of infinite trees branching over the alphabet. Each node in such a tree indicates whether the path to this node constitutes a word inside or outside of the language. This codatatype is isormorphic to the set of lists representation of languages, but caters for definitions by corecursion and proofs by coinduction.

Regular operations on languages are then defined by primitive corecursion. A difficulty arises here, since the standard definitions of concatenation and iteration from the coalgebraic literature are not primitively corecursive-they require guardedness up-to union/concatenation. Without support for up-to corecursion, these operation must be defined as a composition of primitive ones (and proved being equal to the standard definitions). As an exercise in coinduction we also prove the axioms of Kleene algebra for the defined regular operations.

Furthermore, a language for context-free grammars given by productions in Greibach normal form and an initial nonterminal is constructed by primitive corecursion, yielding an executable decision procedure for the word problem without further ado.

  author  = {Dmitriy Traytel},
  title   = {A Codatatype of Formal Languages},
  journal = {Archive of Formal Proofs},
  month   = nov,
  year    = 2013,
  note    = {\url{http://isa-afp.org/entries/Coinductive_Languages.html},
            Formal proof development},
  ISSN    = {2150-914x},
License: BSD License
Status: [ok] This is a development version of this entry. It might change over time and is not stable. Please refer to release versions for citations.