Functional Pearl: Dependent type inference via free higher-order unification

04/12/2022
by   Nikolai Kudasov, et al.
0

Many type theories rely significantly on dependent types. Implementing a proof assistant or a programming language based on such a theory is often challenging, as type inference is notoriously hard in the presence of dependent types. The cornerstone of dependent type inference is higher-order unification. Even though many algorithms exist, state-of-the-art is implementing it directly for a particular proof assistant. We propose a novel approach for abstract syntax representation, which we call free scoped monads. This approach capitalizes on the ideas of free monads and Swierstra's data types à la carte, combining them with intrinsically well-scoped term representation via Bird and Patterson's de Bruijn notation as nested data types. These constructions allow us to handle scopes in a language-agnostic way and provide generic higher-order unification algorithms, which serve as a foundation for dependent type inference. Using the Haskell programming language, we apply this approach to simply typed lambda calculus and Martin Löf Type Theory. We show that our approach is transparent for the user, yet provides non-trivial type inference almost for free.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/10/2019

Gemini: A Functional Programming Language for Hardware Description

This paper presents Gemini, a functional programming language for hardwa...
research
04/30/2018

Proof-relevant Horn Clauses for Dependent Type Inference and Term Synthesis

First-order resolution has been used for type inference for many years, ...
research
12/15/2022

Higher-order Games with Dependent Types

This paper generalises the notion of a higher-order game, by accounting ...
research
07/05/2021

A Theory of Higher-Order Subtyping with Type Intervals (Extended Version)

The calculus of Dependent Object Types (DOT) has enabled a more principl...
research
11/28/2018

Adventures in Formalisation: Financial Contracts, Modules, and Two-Level Type Theory

We present three projects concerned with applications of proof assistant...
research
12/17/2021

About a Proof Pearl: A Purported Solution to a POPLMARK Challenge Problem that is Not One

The POPLMARK Challenge comprises a set of problems intended to measure t...
research
07/16/2021

Touring the MetaCoq Project (Invited Paper)

Proof assistants are getting more widespread use in research and industr...

Please sign up or login with your details

Forgot password? Click here to reset