Skip to main content
QUICK REVIEW

[Paper Review] Logical Relations as Types: Proof-Relevant Parametricity for Program Modules

Jonathan Sterling, Robert Harper|arXiv (Cornell University)|Oct 16, 2020
Logic, programming, and type systemsComputer Science142 references22 citations
TL;DR

This paper introduces a synthetic type-theoretic framework, ModTT, that treats program modules as fundamental constructs, using modalities to encode the phase distinction between static and dynamic computation. It presents a proof-relevant parametricity theory via 'parametricity structures'—a generalization of logical relations that tracks non-trivial evidence of program relatedness—yielding a simplified, type-theoretically grounded abstraction theorem for modules with computational effects and generativity.

ABSTRACT

The theory of program modules is of interest to language designers not only for its practical importance to programming, but also because it lies at the nexus of three fundamental concerns in language design: the phase distinction, computational effects, and type abstraction. We contribute a fresh "synthetic" take on program modules that treats modules as the fundamental constructs, in which the usual suspects of prior module calculi (kinds, constructors, dynamic programs) are rendered as derived notions in terms of a modal type-theoretic account of the phase distinction. We simplify the account of type abstraction (embodied in the generativity of module functors) through a lax modality that encapsulates computational effects. Our main result is a (significant) proof-relevant and phase-sensitive generalization of the Reynolds abstraction theorem for a calculus of program modules, based on a new kind of logical relation called a parametricity structure. Parametricity structures generalize the proof-irrelevant relations of classical parametricity to proof-relevant families, where there may be non-trivial evidence witnessing the relatedness of two programs -- simplifying the metatheory of strong sums over the collection of types, for although there can be no "relation classifying relations", one easily accommodates a "family classifying small families". Using the insight that logical relations/parametricity is itself a form of phase distinction between the syntactic and the semantic, we contribute a new synthetic approach to phase separated parametricity based on the slogan "logical relations as types", iterating our modal account of the phase distinction. Then, to construct a simulation between two implementations of an abstract type, one simply programs a third implementation whose type component carries the representation invariant.

Motivation & Objective

  • To provide a synthetic, type-theoretic foundation for program modules that unifies phase distinction, computational effects, and type abstraction.
  • To replace ad hoc notions like projectibility with a lax modality that naturally enforces generativity in module functors.
  • To formalize proof-relevant parametricity for modules using parametricity structures, generalizing classical Reynolds-style abstraction theorems.
  • To show that parametricity itself can be modeled as a phase distinction via 'logical relations as types', enabling iterative, higher-order reasoning.

Proposed method

  • Introduces ModTT, a dependent type theory with two pairs of complementary modalities: (syntactic, semantic) and (static, dynamic), to model phase separation.
  • Uses a lax modality (3) to encapsulate computational effects and enforce generativity in module functors, replacing projectibility as a derived concept.
  • Defines 'parametricity structures' as proof-relevant families of relations between programs, generalizing proof-irrelevant relations in classical parametricity.
  • Applies the topos-theoretic Artin gluing construction to axiomatize a dependent type theory of parametricity structures.
  • Constructs simulations between module implementations by programming a third implementation whose type carries the representation invariant.
  • Iterates the phase distinction via modalities to model higher-order parametricity, such as between syntactic and semantic levels.

Experimental results

Research questions

  • RQ1How can the phase distinction in programming languages be formalized synthetically using modal type theory?
  • RQ2How can generativity and computational effects in module functors be captured without ad hoc notions like projectibility?
  • RQ3Can proof-relevant parametricity be formalized in a type-theoretic framework that supports strong sums and type abstraction?
  • RQ4How can logical relations be treated as types to enable a uniform, compositional account of parametricity?
  • RQ5What is the role of modalities in unifying abstraction, effects, and phase separation in module systems?

Key findings

  • The paper establishes a proof-relevant generalization of Reynolds' abstraction theorem for program modules, where relatedness of programs is witnessed by non-trivial evidence.
  • Generativity in module functors is naturally modeled as a function of type σ ⇒ 3τ, where 3 is a lax modality, eliminating the need for projectibility.
  • Parametricity structures provide a type-theoretic foundation for reasoning about program equivalence that supports families classifying small families.
  • The approach simplifies the metatheory of strong sums by avoiding the need for a 'relation classifying relations' via proof-relevant families.
  • The framework enables formalization of parametricity theorems using standard type-theoretic reasoning, amenable to proof assistants like Coq or Agda.
  • The authors demonstrate that phase distinctions can be iterated, with logical relations themselves being modeled as a phase separation between syntactic and semantic levels.

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.