Papers
Topics
Authors
Recent
Search
2000 character limit reached

Bidirectional Elaborators à la Carte

Published 10 Jul 2026 in cs.PL and cs.LO | (2607.09564v2)

Abstract: Surface syntax in proof assistants like Rocq, Lean, Agda, and Idris is highly implicit, lacking many details that are needed for user-written code to denote precisely defined mathematical objects. Elaboration is an algorithm that accounts for these details by translating surface syntax to an explicit enough core syntax. The reliability and predictability of elaboration relies on several critical properties of the core type system, including decidability of judgemental equality and the injectivity of type constructors; these dependencies are witnessed in a concrete system by explicit calls to conversion checking and weak-head reduction subroutines. We introduce a dependently typed monadic domain specific language for the executable specification of correct-by-construction elaboration algorithms that is abstracted from any particular representation of normal forms or algorithm for conversion checking. In particular, we represent a bidirectionally typed surface language for Martin-Löf type theory by shallow embedding in this DSL so that the translation of surface terms into core terms amounts to elementary equational calculation. This translation is correct by construction in the sense that it cannot produce ill-typed terms, and is automatically stable under judgemental equality of core terms and even under substitution; from the latter property, we obtain a new denotational interpretation of the suspension of elaboration problems. Finally, a concrete elaboration algorithm is extracted by algebraic means from a presheaf model of the DSL built out of the bi-initial natural model of Martin-Löf type theory.

Summary

  • The paper introduces a monadic DSL built on a partiality monad to construct elaborators that are correct-by-construction and support compositional reasoning.
  • The paper demonstrates robust handling of variable scopes, substitution stability, and error suspension through presheaf semantics and modular combinators.
  • The paper connects algebraic, categorical, and operational perspectives to enhance reliability and extensibility in dependent type theory-based proof assistants.

Executable Semantics for Modular Bidirectional Elaboration

Introduction

"Bidirectional Elaborators à la Carte" (2607.09564) develops a modular, semantic framework for specifying and reasoning about bidirectional elaboration algorithms in proof assistants based on dependent type theory. The authors present a functional, compositional semantics for elaboration, instead of a logic programming or rule-based operational approach. Their methodology leverages a monadic domain-specific language (DSL) built upon a partiality monad internal to a topos, allowing elaborators that are correct-by-construction, stable under substitution, and robust to the specific syntactic representation of core terms.

Background and Motivation

The gap between implicit, user-centric "surface" languages in proof assistants and the explicit, well-formed "core" languages required for machine reasoning necessitates a careful design of elaboration: the process that translates user code into precise mathematical objects. The authors highlight that the design and reliability of such elaborators depend critically on key metatheoretical properties—e.g., decidability of judgmental equality or injectivity of type constructors—of the target core type theory.

A principal motivation is to avoid ad hoc, folklore-driven implementation practices and instead provide a flexible, precise, and modular mathematical theory of elaboration. The approach generalizes the concept of parser combinators from functional programming to elaborator combinators, underpinned by the metatheory of dependent types in the context of categories with families (CwF) and natural models. This modularity and abstraction aim to enable component-wise reasoning about correctness, definedness, and structural properties of elaborate processes.

Semantic Model: Partiality Monad and Monad-Based DSL

The core technical contribution is a DSL for specifying elaborators within a partiality monad PMC\mathsf{PMC}. This monad encapsulates fallibility (i.e., partiality or potential for failure/suspension) via a pair: a support (an open proposition) and a function defined on that support. Crucially, the support is not restricted to booleans but lies in a dominance—a universe of proof-irrelevant, possibly non-classical, open propositions in a topos.

The DSL provides semantic domains:

  • TypScript=PMC(Tp)\mathsf{TypScript} = \mathsf{PMC}(\mathsf{Tp}) for type scripts,
  • SynScript=PMC(Tm~)\mathsf{SynScript} = \mathsf{PMC}(\widetilde{\mathsf{Tm}}) for synthesizing terms with their types,
  • ChkScript=(α:Tp)PMC(Tm(α))\mathsf{ChkScript} = (\alpha:\mathsf{Tp}) \to \mathsf{PMC}(\mathsf{Tm}(\alpha)) for checking-mode terms.

Binding and scope are handled via higher-arity lax monoidal structure operators, enabling compositional reasoning about variable scopes, hypothetical judgments, and the denotation of surface binders. Suspension of elaboration problems (as required for handling unsolved metavariables) is naturally interpreted using presheaf semantics, where conditions on supports are sieves stable under substitution.

Bidirectional Elaboration: Modular, Correct-by-Construction Combinators

The framework specifies universal combinators for all judgment forms in a dependently typed core theory: variable introduction, conversion, annotation, functions (lambda and application), dependent pairs, identity types, and so on. Each combinator is given as a semantic function—in the DSL monad—satisfying the following properties:

  • Total correctness: Only well-typed terms can be constructed.
  • Compatibility with substitution and judgmental equality: Reasoning is stable under core equivalence and substitutions.
  • Compositionality: Properties of elaboration combinators (such as definedness) are wholly determined by their arguments (formalized via multilinearity and multistrictness).

Notably, the framework provides a formal mechanism for reasoning not just about "definedness" but also about the propagation and suspension of partial definitions. This regularizes error handling, asynchronous elaboration, and stable resumptions—crucial for features such as holes or delayed constraints found in interactive proof development.

Abstract Metatheoretic Layer and Connections to Modern Type Theory

The semantics is not tied to any specific syntax for types or terms but is parametrized abstractly over any algebraic (especially SOGAT-based) type theory. The framework thus exploits metatheorems such as normalization, strengthening, and decidability as external parameters, making the semantics broad and robust to syntactic redesigns.

By employing presheaf models over the category of contexts of the bi-initial model of type theory, the authors cleanly separate synthetic elaborator semantics from concrete, rule-based implementations. Moreover, they highlight that their semantic interpretation does not depend on any one construction of the syntactic model but is invariant across representations—enabling their framework's use for alternate presentations of a type theory (cf. [uemura:2021:thesis], [sterling:2025:grothendieck]).

Technical Results

The DSL and semantic calculus are shown to satisfy several strong properties:

  • Multilinearity: All non-binding combinators, and bindings when strengthening holds, are multilinear as maps of algebras over the monad. Thus, the definedness and structure of any composite elaboration is strictly determined by those of its sub-terms.
  • Multistrictness: If any subterm is undefined, the composite is undefined.
  • Commutativity and Suspension: Since the partiality monad is commutative, the order of solving constraints and evaluating delayed elaborations is semantically irrelevant, modeling dynamic (partial) elaboration naturally.
  • Subject Reduction Inequalities: An inequational theory over surface syntax (e.g., β\beta- and η\eta-reductions and erase-annotation reductions hold as inequalities in the partiality poset semantics). This reflects elaboration's correctness in the presence of refactorings that reduce annotation or syntactic bureaucracy.

These properties are established for both the standard Martin-Löf type theory and its extensions via general second-order algebraic theories.

Practical and Theoretical Implications

The semantics developed support modular, compositional construction of correct-by-construction elaborators that can be extracted, verified, and reasoned about independently of syntactic details. The approach naturally accommodates extension to new type-theoretic features (such as universe hierarchies or polymorphism), is robust against evolving implementations, and facilitates stable, asynchronous, and dynamic metaprogramming with "holes" (i.e., metavariables).

On a theoretical level, the approach clarifies the relationships between algebraic, categorical, and operational presentations of type theories and may inform the design of generic frameworks for parser/elaborator generators in the style of both semantic (combinator-based) and syntactic (rule-based) frameworks.

Moreover, the framework provides a vehicle for future work integrating advanced evaluation-order and polarity systems (cf. call-by-push-value, enriched effect calculi), denotational resource analysis (cf. [danner-licata-ramyaa:2015], [kavvos-morehouse-licata-danner:2019]), and integration with real proof assistants ([synthlean:cpp]).

Future Directions

The framework admits several clear directions:

  • Extending to cumulative universe hierarchies, type class/implicit argument automation, and richer algebraic effects (notably in light of ongoing work on polynomial monads for metavariables).
  • Mechanized formalization in existing proof assistants (Agda, Lean, Rocq) as semantic, modular specifications of elaboration, guiding or certifying low-level implementations.
  • Further abstract investigation into the interaction between evaluation order, effectful metaprogramming, and higher-algebraic structure in elaboration/Eff calculi.

Conclusion

The work realizes a modular, highly structured, executably expressive semantics for bidirectional elaboration, achieving correctness-by-construction, stability, and compositionality at a level of generality apt for modern algebraic type theories. This closes a significant conceptual gap, elevating elaboration from folklore-based engineering to a subject of abstract mathematical investigation, supporting practical advances in the reliability and extensibility of dependent type theory-based proof assistants.

Reference:

"Bidirectional Elaborators à la Carte" (2607.09564)

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Explain it Like I'm 14

What this paper is about

This paper is about making “smart translators” for proof assistants and programming languages more trustworthy and easier to understand. When people write code or proofs in tools like Lean, Agda, or Coq, they often leave out lots of details because typing everything would be slow and annoying. A special program called an elaborator fills in those missing details and turns the “shorthand” code (the surface language) into a precise version (the core language) that a machine can check.

The authors build a mathematical framework and a small “programming language for elaborators” that guarantees, by its very design, that the translator is correct, predictable, and stable—even when the order of steps changes or some information is temporarily missing.

What questions the paper asks

The paper focuses on a few simple questions, stated in everyday terms:

  • How can we turn users’ shorthand code into fully detailed code in a way that always makes sense and never creates nonsense?
  • How can we design the translator so that it’s stable—meaning the final result doesn’t depend on the order we solve things in?
  • How can we let the translator pause when it doesn’t yet have enough information, then resume later without losing track?
  • Can we do all this in a clean, modular way that works for advanced type systems used in proof assistants?

How they approach the problem

To explain the approach, here are the big ideas with easy analogies:

  • Surface vs. core language: Think of the surface language as texting shorthand and the core language as full, formal sentences. The elaborator is the tool that expands the shorthand into proper, complete sentences.
  • Bidirectional typing: Sometimes you can guess what a piece of code means from how it’s used (like guessing a word from its sentence), and sometimes you need to check that a piece matches a known pattern. “Bidirectional” means the system can both “figure out” types (synthesis) and “check” against expected types.
  • A DSL for elaborators: The authors create a tiny programming language (a DSL) that lets you write elaborators as clear, composable building blocks called combinators. It’s like having Lego bricks that snap together to build a custom translator. Crucially, the types in this DSL are set up so that anything you build can’t produce bad results—this is “correct by construction.”
  • The partiality monad (“Await” and “Scope”): Imagine some steps can’t run until certain facts are known. Instead of crashing, the step can say “I’ll wait for this condition” using an Await marker. Scope collects multiple waiting steps and runs them together only when all are ready. This models pausing and resuming elaboration safely and predictably.
  • Presheaf semantics (contexts that can change): The paper interprets everything in a mathematical setting where information can grow over time. You can think of it as keeping a version of your proof for every “state of knowledge.” As new facts are learned (like solving a placeholder), you update. This neatly explains why pausing (Await) and reordering steps still lead to the same final result.
  • Using math properties of the core language: The approach relies on solid properties of the core type system, such as:
    • Injectivity of type constructors: If you know a function type, you can uniquely pick out its input and output parts.
    • Equality and normalization: The system can reliably tell when two things are definitionally equal, and terms can be simplified in a predictable way.

What they built and why it matters

Here are the main results, presented concisely:

  • A safe, modular way to write elaborators
    • The DSL ensures that elaboration scripts cannot produce ill-typed core terms.
    • The scripts are automatically compatible with the core language’s built-in notion of equality, so they don’t break when you replace equals with equals.
  • Stability under rearrangement and substitution
    • Because the “waiting” mechanism is built into the semantics, you can solve things in different orders without changing the final result (up to the system’s notion of equality). This supports the principle of stable elaboration.
  • Clear combinators for common tasks
    • Conversion: A combinator that says “check this term at that type, but only if they match,” written with an Await so it cleanly pauses when not enough info is present.
    • Application: A combinator that applies a function to an argument by first confirming the function really has a function type (using injectivity), then checking the argument at the right input type.
  • A principled notion of scope
    • A new “Scope” operator lets you handle binders (like function parameters) and their bodies as a single atomic unit, generalizing the usual ways of combining computations.
  • Reasoning about elaboration like algebra
    • Because everything has a clean, mathematical meaning, you can reason about elaboration scripts by simple equations and inequalities.
    • The paper shows “subject reduction” laws as safe rewrites: swapping one surface expression for another can only reduce the conditions needed to succeed, never add new ones—this guides safe optimization in the surface language.
  • A concrete model that runs on solid foundations
    • They interpret the whole setup in a well-understood mathematical universe called presheaves built from the initial model of Martin-Löf Type Theory (a standard foundation for proof assistants).
    • This model explains pausing/resuming (Await) as narrowing to those contexts where the needed condition holds, which matches how proof assistants fill in holes over time.

Why these results are important

  • Reliability: By building elaborators that are correct by construction, we reduce bugs and surprises in proof assistants and typed languages—tools people use to do serious math and software verification.
  • Predictability and user experience: Stable elaboration means users don’t have to worry about the “order of operations” when writing proofs or code. The machine will fill in details in a consistent way.
  • Clearer design: The DSL and its math semantics make it easier for designers and engineers to add features or reason about changes without breaking everything.
  • Bridges theory and practice: Using presheaves and partiality isn’t just abstract math; it directly models how real systems need to suspend and resume tasks while types and placeholders are solved.

Final takeaway

The paper offers a clean, math-backed way to write and reason about elaborators—the automatic detail-fillers in proof assistants and typed languages. It shows how to:

  • build elaboration scripts that can’t go wrong by design,
  • pause and resume safely when information is missing,
  • keep results stable no matter the order of steps,
  • and reason about the whole process using simple algebra-like laws.

If adopted, these ideas could make future proof assistants and typed languages more robust, predictable, and pleasant to use.

Knowledge Gaps

Knowledge gaps, limitations, and open questions

The paper proposes a denotational framework and DSL for correct-by-construction bidirectional elaboration using a partiality monad on presheaves, but several theoretical and practical aspects remain incomplete or unexplored. The following gaps identify concrete avenues for future work:

  • Specify and justify a concrete dominance OProp for executable elaboration:
    • Which subuniverse of propositions ensures effective computability while supporting required closure properties (e.g., under universal quantification, pullback, finite products) in a presheaf topos?
    • How to instantiate OProp so that equality tests and “preimage-of-constructor” checks are computationally realisable?
  • Characterize compact types needed by the Scope combinator:
    • Precisely identify which non-finite types arising from syntax (e.g., presheaves of terms, contexts, or telescopes) are provably compact in the intended model.
    • Provide proofs or counterexamples of compactness under the chosen dominance, and alternatives if compactness fails.
  • Move from extensional to intensional metalanguage:
    • Develop the entire framework (including Await/Scope and equational reasoning) in intensional type theory without equality reflection, as foreshadowed in the footnote.
    • Clarify which results depend on extensionality/equality reflection and how to recover them in an intensional setting.
  • Make metavariables and constraint solving explicit:
    • Formalize metavariable creation, instantiation, and resumption within the presheaf/partiality semantics (beyond the current high-level “suspension” intuition).
    • Design and prove properties of a constraint solver (fairness, termination, confluence) compatible with the commutative monad semantics.
  • Provide a concrete, effective conversion/normalization procedure:
    • Give an explicit algorithm for judgmental equality/whnf and its realization under OProp in the presheaf model.
    • Analyze complexity and predictability of conversion checks, including handling of β/η for functions and pairs.
  • Extend the elementary core to realistic features:
    • Universes (levels, cumulativity, polymorphism) and their interaction with injectivity and conversion.
    • Inductive families, pattern matching, recursion, and possibly higher inductives; characterize injectivity/“preimage” predicates for these constructors.
    • Eta-rules for additional types (e.g., records) and their effect on synthesis/checking combinators.
  • Address nondeterminism and search:
    • Model overloading, coercion insertion, and typeclass/instance resolution (currently no nondeterminism or backtracking in the monad).
    • Integrate algebraic effects or a suitable search monad while preserving stability/commutativity guarantees.
  • Clarify completeness of elaboration:
    • Beyond “correct-by-construction” soundness, state and prove precise completeness conditions: which well-typed surface terms must elaborate successfully under the provided combinators?
  • Formalize and verify the “mild strengthening” assumption:
    • Precisely state the strengthening property used to obtain multilinearity and prove it holds in the presheaf model; characterise when it fails.
  • Systematize subject-reduction inequations:
    • Provide the full inequational theory for the surface calculus (beyond the function-application case), including criteria for when inequalities collapse to equalities.
    • Investigate confluence/normal forms of the surface-level rewriting guided by the inequational semantics.
  • Error reporting and diagnostics from partial supports:
    • Devise a method to translate sieves/support propositions (often non-boolean) into actionable, localized user error messages and counterexamples.
    • Explore how to aggregate multiple suspended conditions into comprehensible feedback.
  • Scheduling and performance of suspension/resumption:
    • Develop strategies for ordering/eliding Await constraints, caching sieves, and incremental elaboration without breaking commutativity guarantees.
    • Evaluate the scalability of presheaf-based suspension on large developments.
  • Integration with existing assistants:
    • Map the framework to cores with idiosyncrasies (e.g., Lean’s non-transitive definitional equality) and determine minimal metatheoretic requirements.
    • Identify compatibility constraints and migration paths for Agda/Lean/Coq cores with universes and advanced features.
  • Specify and implement the “algebraic extraction” pipeline:
    • Detail how to extract a concrete, terminating elaborator from the presheaf model and certify its totality/termination.
    • Provide an end-to-end mechanized development linking semantics to executable code.
  • Name resolution and module/namespace mechanisms:
    • Incorporate resolution of identifiers, modules, and implicit parameters into the DSL in a way compatible with substitution stability and Scope.
  • Coercions and subtyping-like mechanisms:
    • Extend the combinator set to support coercion search/insertion and reason about interaction with Await (e.g., expressing subtyping constraints as sieves).
  • Quantify stability-under-substitution/reordering:
    • Give full formal proofs (and mechanization) that elaboration is stable under core substitution and reordering of actions across all combinators.
  • Clarify call-by-value hypothesis semantics:
    • Assess limitations of HypScript as strictly typed values (not computations) for binders; determine implications for let-generalization and sharing.
  • Broaden η-handling claims:
    • Demonstrate η-support beyond Π/Σ (e.g., records, implicit arguments), and analyze impacts on type synthesis and conversion.
  • Generalize beyond MLTT:
    • Investigate whether the framework survives extensions such as function extensionality, univalence, or observational type theory, and how these affect injectivity/decidability assumptions.

Practical Applications

Immediate Applications

The paper proposes a dependently typed, monadic DSL for correct-by-construction elaboration, supported by a partiality monad with Await/Scope combinators and a presheaf (Kripke) semantics. The following applications can be prototyped or deployed in research and tooling today:

  • Stable, a la carte elaborators for MLTT fragments
    • Sectors: software (proof assistants, PL research), academia.
    • Use case: Rapidly prototype elaboration strategies for dependent function/pair/identity types with β/η-laws, and verify stability properties by construction.
    • Tools/products/workflows: A library implementing the DSL (ElabConv, ElabApp, ElabPi, Await, Scope) in Agda/Coq/Lean as a research artifact; extract concrete elaborators from a presheaf model of MLTT’s initial (bi-initial) model.
    • Assumptions/dependencies: Availability of an intensional TT host to implement the DSL; a dominance (subuniverse of propositions) and proof-irrelevant supports; a conversion checker/normalizer for the core language; currently limited to the paper’s fragment (Π, Σ, Id, base type).
  • Equational, step-by-step exploration of elaboration for teaching and debugging
    • Sectors: education, academia, software tooling.
    • Use case: Use the DSL’s denotational, equational nature to unfold surface terms into their core outputs (via monad laws), explaining elaborator behavior in lectures or interactive notebooks.
    • Tools/products/workflows: “ElabTrace” visualizer that shows Await’ed conditions and Scope-bound hypotheses; lecture materials and unit tests for bidirectional type checking.
    • Assumptions/dependencies: Small fragments first; equational reasoning shown on simple surface terms.
  • Safe refactoring/optimization of surface code via inequational reasoning
    • Sectors: software (IDE tooling for Agda/Lean/Idris).
    • Use case: Automatically replace certain surface β-redex patterns with more complete terms that are guaranteed not to change the elaborated core term but strictly improve completeness (using the paper’s subject-reduction inequalities).
    • Tools/products/workflows: “ElabRefactor” that applies proven inequalities in SynScript/ChkScript to upgrade user code; conservative, semantics-preserving IDE actions.
    • Assumptions/dependencies: Mappings from concrete surface syntax to DSL terms; limited to patterns proven in the paper’s fragment.
  • Better error messages and diagnostics from partial supports
    • Sectors: software (developer experience for proof assistants).
    • Use case: Surface the precise condition under which elaboration would succeed (“awaited” definitional equality, injectivity preimage, etc.), instead of opaque failure.
    • Tools/products/workflows: Attach the support sieve/constraint (e.g., “expected a Π-type; awaiting injectivity witness for type T”) to error locations in IDEs.
    • Assumptions/dependencies: Integration into existing error-reporting pipelines; expressing presheaf sieves/conditions as user-facing diagnostics.
  • Asynchronous elaboration experiments with suspension/resumption
    • Sectors: software (IDEs, proof assistant front-ends), academia.
    • Use case: Treat elaboration as a pipeline of Await-based suspendable steps; defer constraints (e.g., unknown metavariables’ types) and resume when information arrives—without depending on order.
    • Tools/products/workflows: Prototype event-loop elaboration in test IDEs (e.g., for Agda/Idris VSCode extensions), using the commutativity of the partiality monad to ensure order independence.
    • Assumptions/dependencies: Basic metavariable plumbing; paper notes metavariables are only partially addressed; initial scope for well-understood fragments.
  • Static sanity checks for elaboration scripts (multilinearity)
    • Sectors: software (elaborator engineering), academia.
    • Use case: Lint elaboration combinators for multilinearity/multistrictness (ensuring constraints arise only from subterms and undefinedness is preserved).
    • Tools/products/workflows: “ElabLint” to detect anti-patterns (e.g., combinators discarding arguments), integrated into CI for elaborator libraries.
    • Assumptions/dependencies: Formalized DSL combinators annotated with algebra structure; mild strengthening property as in the paper.
  • Rapid A/B testing of surface-annotation schemes
    • Sectors: academia, software (language design).
    • Use case: Swap in/out combinators (e.g., alternate conversion or application strategies) and measure elaboration predictability/robustness under stable elaboration principles.
    • Tools/products/workflows: “ElabKit” playground where design variants are written as scripts and validated against the same core semantics.
    • Assumptions/dependencies: Baseline conversion for the core; domain-specific tests.

Long-Term Applications

With further research and engineering—extending to richer features (inductives, universes, typeclass/instance search, coercions), efficient conversion checking, and full metavariable solving—the framework supports the following broader outcomes:

  • Production-grade, stable elaboration kernels for proof assistants
    • Sectors: software (Lean, Agda, Coq, Idris ecosystems).
    • Use case: Replace or augment current elaborators with correct-by-construction kernels that guarantee termination, respect judgemental equality and η, and are stable under substitution and reordering.
    • Tools/products/workflows: “StableElab” kernel module; certifying elaborators targeting a natural model; shared DSL across projects.
    • Assumptions/dependencies: Efficient implementations in intensional TT; coverage of all language features; performance parity; robust metavariable resolution integrated with presheaf semantics.
  • A portable elaboration standard for cross-system interoperability
    • Sectors: academia, standards bodies, open-source governance.
    • Use case: Use the DSL (and its algebraic laws) as a common contract for surface-to-core translation, enabling portable elaboration semantics across systems and formal libraries.
    • Tools/products/workflows: Spec and conformance tests; “ElabSpec” standard and adapters to multiple cores.
    • Assumptions/dependencies: Community agreement; mapping to non-MLTT cores requires abstractions or extensions; handling universe polymorphism and effects.
  • Semantic backends for “typechecker generators”
    • Sectors: software tooling, academia.
    • Use case: Equip syntactic typechecker generators with a denotational backend that handles η-laws and dependent binders via Scope, overcoming past limitations.
    • Tools/products/workflows: Integrations with emerging frameworks (e.g., McBride/Felicissimo-style), using the partiality monad/presheaf semantics as the backend.
    • Assumptions/dependencies: Stable APIs between syntactic frontends and semantic backends; performance engineering.
  • Asynchronous, incremental, and parallel elaboration at scale
    • Sectors: software (IDEs, CI/CD for formal projects).
    • Use case: Exploit commutativity of the monad to reorder, parallelize, and incrementally resume elaboration tasks; cache supports and resume when constraints become true (“Good Bye, Lenin!” problem).
    • Tools/products/workflows: “MetaSuspender” task scheduler for elaboration; build-system-like dependency graphs of Await’ed conditions.
    • Assumptions/dependencies: Full integration with metavariable solving; efficient sieve propagation in presheaf model; robust concurrency controls.
  • Safer domain-specific dependently-typed languages and toolchains
    • Sectors: safety-critical software (aerospace, automotive, medical), cryptography, finance (regulatory proof pipelines).
    • Use case: Guarantee predictable, objective compilation and verification pipelines for DSLs with dependent types; auditable elaboration correctness and stability.
    • Tools/products/workflows: DSL-specific elaborator generators using the combinator library; certifiable toolchain documentation based on algebraic semantics.
    • Assumptions/dependencies: Regulatory acceptance of formal semantics; integration with existing verification tools and proof artifact management.
  • Automated refactoring and optimization of large formal codebases
    • Sectors: software (proof engineering at scale), education.
    • Use case: Apply inequational subject-reduction laws as semantics-preserving rewrites that strictly improve completion; normalize surface code for robustness and maintainability.
    • Tools/products/workflows: IDE-integrated batch transformations guided by the DSL’s partial order; “ElabOptimize” passes for libraries.
    • Assumptions/dependencies: Expanded catalog of proven inequalities; trust in transformations requires mechanized proofs.
  • AI-assisted proof authoring constrained by elaboration semantics
    • Sectors: software, education.
    • Use case: Couple LLM-based assistants to the DSL, using Await to expose missing constraints and Scope to drive binder-aware synthesis, ensuring generated code is checkable and stable.
    • Tools/products/workflows: “ElabCopilot” that proposes surface terms and justifications, then uses the DSL to validate/repair interactively.
    • Assumptions/dependencies: Interfaces between LLMs and formal semantics; performance of repeated semantic checks.
  • Policy and standards for verifiable, objective proof tooling
    • Sectors: policy/regulation, standards consortia, procurement.
    • Use case: Codify stable elaboration (order independence, equality/η-respect) as requirements; mandate correct-by-construction elaborators in high-assurance contexts.
    • Tools/products/workflows: Conformance test suites derived from the DSL laws; procurement checklists and audit guidelines.
    • Assumptions/dependencies: Consensus in research and industry; evidence of scalability and performance.
  • Extending the framework to richer type theories and features
    • Sectors: academia, advanced tool vendors.
    • Use case: Adapt combinators and metatheory to universes, inductive/coinductive types, pattern matching, typeclass search, effects, and HoTT/cubical features.
    • Tools/products/workflows: Libraries of sector-specific elaboration combinators; reusable derivations of injectivity/decidability assumptions where applicable.
    • Assumptions/dependencies: New metatheoretic proofs (e.g., normalization, injectivity) per feature; compactness/dominance adaptations; efficient algorithms for conversion.
  • Verified extraction to efficient kernels and proof supply chains
    • Sectors: software (foundational libraries, cloud proof services).
    • Use case: Mechanize the entire elaborator (and its metatheory) in a proof assistant, then extract efficient kernels integrated into cloud or on-prem proof infrastructures with reproducible builds.
    • Tools/products/workflows: Mechanized Agda/Coq developments; verified code generation; “ElabCI” for regression and stability testing across versions.
    • Assumptions/dependencies: Alignment between mechanized model and runtime performance; scalable normalization/convertibility implementations.

Cross-cutting assumptions and dependencies

  • Core language constraints: The approach relies on metatheorems (normalization, decidable judgemental equality, injectivity of type constructors) holding for the target core; deviations (e.g., non-transitive definitional equality) undermine guarantees or require adaptation.
  • Metalanguage/host: The paper’s metalanguage is extensional MLTT; a practical implementation requires intensional TT and careful engineering.
  • Computability: The dominance must be chosen to ensure effective executability; equality checks and normal forms must be provided algorithmically in concrete deployments.
  • Metavariables: Full support for metavariables and unification is only partially addressed; industrial-strength systems need deeply integrated constraint solving and resumption.
  • Performance/scalability: Monadic combinators and presheaf semantics must be implemented efficiently to match or improve upon current elaboration performance.

Glossary

  • (2,1)-category: a 2-category in which all 2-morphisms are invertible; used to classify models up to equivalence. "gives rise to a (2,1)-category of models"
  • Bi-initial model: an initial object up to equivalence in a 2-category, serving as the canonical “syntax” model. "The bi-initial model of a given SOGAT plays the r^ole of syntax,"
  • Bidirectional elaboration: elaboration approach that translates between separate synthesis and checking modes in a surface language. "a bidirectional elaborator translates the surface terms to core language terms"
  • Bidirectional type checking: a typing discipline where types flow out of neutrals and into normals. "bidirectional type checking~\citep{coquand:1996,pierce-turner:2000}"
  • Call-by-value: evaluation strategy that evaluates arguments before function application. "in keeping with the call-by-value interpretation of elaboration scripts"
  • Category theoretic glueing method: a categorical construction used to prove normalization and related results. "the category theoretic glueing method"
  • Categories with families (CwF): a categorical structure modeling dependent type theory’s syntax and semantics. "CwF~\citep{dybjer:1996} or natural model"
  • Commutative monad: a monad whose effects commute, allowing reordering without changing results. "because it is a commutative monad"
  • Conversion checking: the process of verifying definitional equality (convertibility) of terms or types. "calls to conversion checking"
  • Definitional equality: equality by computation/conversion in type theory. "the relation of definitional equality fails to be transitive;"
  • Denotational semantics: assigning mathematical meanings to terms in a compositional way. "we are giving a direct and compositional denotational semantics"
  • Dependent function types: Π-types; functions whose codomain can depend on the input. "Dependent function types"
  • Dependent pair types: Σ-types; dependent pairs with a first component and a type family for the second. "Dependent pair types"
  • Dominance: a class of “open” propositions supporting partiality and partial maps in a topos. "equipped with a dominance"
  • Equality reflection: principle allowing one to treat proofs of equality as definitional equalities in a given scope. "by equality reflection in the metalanguage"
  • Extensional type theory: a variant of type theory validating extensional equalities (e.g., η for functions). "extensional Martin-L\"of type theory"
  • Hausdorff type: a type whose equality relation is closed (in the internal topology). "A type XX is called Hausdorff when its equality predicate is closed."
  • Injectivity of type constructors: property that equal constructed types imply equality of their parameters. "injectivity of type constructors"
  • Intensional identity types: identity (equality) types with the J eliminator, without collapsing all equalities. "Intensional identity types"
  • Judgemental equality: definitional equality of terms/types in the judgemental (meta-level) sense. "decidability of judgemental equality"
  • Kleisli extension: the operation f ↦ f that lifts functions into monadic computations. "the Kleisli extension"
  • Kripke-style interpretation: semantics parameterized by “worlds” or contexts, supporting variation over substitutions. "must involve a Kripke-style interpretation of the function space."
  • Lax monoidal structure: a weakening of monoidal structure supporting combination of effects (here, partial computations). "lax monoidal structure at compact arity"
  • Locally cartesian closed category: a category whose slice categories are cartesian closed, supporting dependent types. "locally cartesian closed category"
  • Monadic domain specific language (DSL): a DSL whose constructs are monadic computations and combinators. "a dependently typed monadic domain specific language"
  • Monomorphism: a categorical injective map (mono). "is a monomorphism."
  • Multilinearity: property that an operator is linear (strict and monotone) in each argument independently. "Multilinearity in the context of elaboration combinators"
  • Multistrictness: strictness in all arguments simultaneously (undefined inputs remain undefined). "it implies multistrictness, i.e.\ the preservation of undefined elements"
  • Natural model: Awodey’s categorical structure equivalent to CwF for modeling dependent type theory. "natural model of Martin-L\"of type theory"
  • Neutral term: a term that cannot reduce further because its head is a variable or stuck eliminator. "neutral and normal forms"
  • Normal form: a term with no further reductions possible. "neutral and normal forms"
  • Normalisation: the property that every term reduces to a normal form. "normalisation"
  • Open proposition: a proposition in the chosen dominance class, used as supports for partial elements. "open propositions"
  • Open-subsingleton subset: a subset with at most one element whose existence is open. "open subsingleton subset"
  • Partial element classifier: the type of pairs (support, value-on-support) representing partial computations. "The partial element classifier functor"
  • Partiality monad: a monad modeling partial computations with logical supports (conditions). "partiality monad"
  • Polynomial extension functor: a functor induced by a container/shape describing dependent data. "determines a polynomial extension functor"
  • Presheaf: a contravariant set-valued functor on a category (of contexts), modeling varying data with substitution. "we have exactly the notion of a presheaf."
  • Presheaf model: interpreting syntax/semantics in the category of presheaves over contexts. "a presheaf model of the DSL"
  • Representable sort: a sort allowing variables to range over its elements (admitting dependent arguments). "when the domain sort is designated as representable."
  • Sieve: a downward-closed set of arrows in a category; here, a way to interpret propositions internally. "a proposition denotes a sieve"
  • Stable elaboration: elaboration whose outcome is invariant under reordering and delayed solutions. "stable elaboration as a design principle"
  • Strengthening: a metatheorem allowing removal of unused hypotheses from contexts. "strengthening"
  • Subject reduction: the property that reduction steps preserve typing. "subject reductions"
  • Suspension (of elaboration problems): deferring an obligation until sufficient information becomes available. "the suspension of elaboration problems."
  • Telescopes (of representable sorts): sequences of dependent bindings forming contexts. "They are given by telescopes of representable sorts."
  • Topos: a category with set-like internal logic supporting higher-order reasoning (e.g., presheaves form a topos). "the partiality monad of a topos"
  • Weak-head reduction: a strategy reducing only the outermost redex, not under lambdas. "weak-head reduction subroutines"

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

HackerNews

  1. Bidirectional Elaborators à la Carte (3 points, 0 comments) 

Reddit

  1. Bidirectional Elaborators à la Carte (24 points, 4 comments)