Skip to main content
QUICK REVIEW

[Paper Review] Generic Description of Well-Scoped, Well-Typed Syntaxes

Gergő Érdi|ArXiv.org|Mar 31, 2018
Logic, programming, and type systemsComputer Science15 references3 citations
TL;DR

This paper introduces a generic framework for describing well-scoped, well-typed syntaxes in dependently typed languages using descriptions within a universe, enabling type-generic programming. It implements type-preserving renaming and substitution for all such languages in a single, reusable Agda library with formal proofs, achieving a 'once and for all' solution across diverse typed languages with binders.

ABSTRACT

We adapt the technique of type-generic programming via descriptions pointing into a universe to the domain of typed languages with binders and variables, implementing a notion of "syntax-generic programming" in a dependently typed programming language. We present an Agda library implementation of type-preserving renaming and substitution (including proofs about their behaviour) "once and for all" over all applicable languages using our technique.

Motivation & Objective

  • To address the repetitive implementation of type-preserving operations like renaming and substitution across different typed languages with binders.
  • To provide a generic, reusable framework that applies uniformly to all well-scoped, well-typed syntaxes in a dependently typed setting.
  • To formalize and verify the correctness of renaming and substitution operations once and for all, independent of any specific language.
  • To demonstrate that descriptions in a universe can effectively encode the structure of typed syntaxes with variable scoping and type safety.
  • To enable systematic, modular construction of language-specific components using a single, unified foundation.

Proposed method

  • Using a universe of descriptions to represent syntax trees with binding structures in a type-generic way.
  • Encoding well-scoping and well-typing constraints directly within the description framework to ensure type safety by construction.
  • Defining generic operations—renaming and substitution—over the description-based syntax using dependent types.
  • Proving that renaming and substitution preserve types and scope conditions using Agda’s dependent type system.
  • Leveraging Agda’s support for inductive families and dependent pattern matching to ensure correctness by construction.
  • Abstracting over language-specific syntax by parameterizing the framework on a description of the language’s grammar and typing rules.

Experimental results

Research questions

  • RQ1Can a single, generic framework describe well-scoped, well-typed syntaxes across diverse typed languages with binders?
  • RQ2How can type-preserving renaming and substitution be implemented generically, with formal proofs, across all such languages?
  • RQ3To what extent can descriptions in a universe capture the structural and typing constraints of typed languages with variables and binders?
  • RQ4Can the correctness of renaming and substitution be proven once and for all, rather than per language?
  • RQ5What is the role of dependent types in enabling such generic, correct-by-construction implementations?

Key findings

  • The framework successfully encodes well-scoped, well-typed syntaxes using descriptions within a universe, ensuring type safety by construction.
  • Renaming and substitution are implemented generically across all supported languages, with full formal proofs of their type-preserving and scope-preserving behavior.
  • The Agda library demonstrates that these operations can be defined once and reused across multiple languages without re-implementation.
  • The use of descriptions enables a modular and extensible approach to language description, separating syntax structure from type constraints.
  • The approach reduces boilerplate and error-prone code in language implementations by abstracting over language-specific details.
  • The framework supports a systematic, reusable, and formally verified foundation for building typed languages with binders.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.