Reference. Intrinsic Verification of Parsers and Formal Grammar Theory in Dependent Lambek Calculus
We present Dependent Lambek Calculus (Lambek), a domain-specific dependent type theory for verified parsing and formal grammar theory. In Lambek, linear types are used as a syntax for formal grammars, and parsers can be written as linear terms. The linear typing restriction provides a form of intrinsic verification that a parser yields only valid parse trees for the input string. We demonstrate the expressivity of this system by showing that the combination of inductive linear types and dependency on non-linear data can be used to encode commonly used grammar formalisms such as regular and context-free grammars as well as traces of various types of automata. Using these encodings, we define parsers for regular expressions using deterministic automata, as well as examples of verified parsers of context-free grammars.
We present a denotational semantics of our type theory that interprets the linear types as functions from strings to sets of abstract parse trees and terms as parse transformers. Based on this denotational semantics, we have made a prototype implementation of Lambek using a shallow embedding in the Agda proof assistant. All of our examples parsers have been implemented in this prototype implementation.
Cite
Cited by (1)
Intrinsically Correct Algorithms and Recursive Coalgebras alexandruIntrinsicallyCorrectAlgorithms2025-preprint
Cites 39 works (30 here)
With notes (30)
ACGtk: A toolkit for developing and running abstract categorial grammars Guillaume2024
Quantitative Polynomial Functors nakov_quantitative_2022
Symbolic and automatic differentiation of languages elliottSymbolicAutomaticDifferentiation2021
Multimodal Dependent Type Theory gratzerNutyzBirkedal2021
CoStar: A verified ALL(*) parser lasserCoStarVerifiedALL2021
Zippy LL(1) parsing with derivatives EdelmannZippy2020
Cubical Agda: A Dependently Typed Programming Language with Univalence and Higher Inductive Types VezzosiMortbergAbel2019
Substructural calculi with dependent types luo
In this paper, we investigate how to introduce dependent types into the substructural calculi such as the Lambek calculus and linear logic. The motivations of such a move include facilitating a closer correspondence between syntax and semantics in natural language analysis and developing promising applications such as that to concurrency through dependent session types.
We shall present two substructural calculi with dependent types: the first containing dependent Lambek types and the second dependent linear types. Technically, the former adheres to the usual assumption that types do not depend on substructural variables (in this case, the Lambek variables), which makes the technical development easier, while the latter allows type dependency on linear variables, which makes the development more challenging as well as more interesting in applications.
Higher-order ghost state jung_higher-order_2016
Indexed containers altenkirch_indexed_2015
Integrating Linear and Dependent Types krishnaswami_integrating_2015
Validating LR(1) Parsers jourdanValidatingLRParsers2012
Regular expression containment: Coinductive axiomatization and computational interpretation henglein_regular_2011
Finding and Understanding Bugs in C Compilers yangFindingUnderstandingBugs
Total parser combinators danielssonTotalParserCombinators2010
A monadic parser combinator library which guarantees termination of parsing, while still allowing many forms of left recursion, is described. The library’s interface is similar to those of many other parser combinator libraries, with two important differences: one is that the interface clearly specifies which parts of the constructed parsers may be infinite, and which parts have to be finite, using dependent types and a combination of induction and coinduction; and the other is that the parser type is unusually informative.
The library comes with a formal semantics, using which it is proved that the parser combinators are as expressive as possible. The implementation is supported by a machine-checked correctness proof.
Formal verification of a realistic compiler leroy_formal_2009
Greedy regular expression matching frischCardelli
Wellfounded Trees and Dependent Polynomial Functors gambino_wellfounded_2004
Type Logics in Grammar buszkowskiTypeLogicsGrammar2003
Separation logic: A logic for shared mutable data structures reynolds_separation_2002
Syntax and semantics of dependent types Hofmann_1997
A mixed linear and non-linear logic: Proofs, terms and models: Extended abstract bentonMixedLinearNonlinear1995
Towards Kleene Algebra with recursion leis_towards_1992
Categorial and categorical grammars lambek1988categorial
Linear logic girard_linear_1987
Programming Techniques: Regular expression search algorithm thompsonProgrammingTechniquesRegular1968
Finite Automata and Their Decision Problems rabinFiniteAutomataTheir1959
External (9)
- Agda Formalization of "Intrinsic Verification of Parsers and Formal Grammar Theory in Dependent Lambek Calculus" (2025)
- Intrinsic Verification of Parsers and Formal Grammar Theory in Dependent Lambek Calculus (Extended Version) (2025)
- Cubical Agda Library (The Agda Community) (2024)
- A Categorical Semantics for Linear Logical Frameworks (2015)
- Presheaf model of type theory (Coquand, note) (2013)
- Grammatical Framework: Programming with Multilingual Grammars (Ranta) (2011)
- Introduction to distributive categories (1993)
- Construction of biclosed categories (Day, PhD thesis, UNSW) (1970)
- Formal Properties of Grammars (Chomsky, Handbook of Mathematical Psychology II) (1963)