Sealing Pointer-Based Optimizations Behind Pure Functions

03/03/2020
by   Daniel Selsam, et al.
0

Functional programming languages are particularly well-suited for building automated reasoning systems, since (among other reasons) a logical term is well modeled by an inductive type, traversing a term can be implemented generically as a higher-order combinator, and backtracking is dramatically simplified by persistent datastructures. However, existing pure functional programming languages all suffer a major limitation in these domains: traversing a term requires time proportional to the tree size of the term as opposed to its graph size. This limitation would be particularly devastating when building automation for interactive theorem provers such as Lean and Coq, for which the exponential blowup of term-tree sizes has proved to be both common and difficult to prevent. All that is needed to recover the optimal scaling is the ability to perform simple operations on the memory addresses of terms, and yet allowing these operations to be used freely would clearly violate the basic premise of referential transparency. We show how to use dependent types to seal the necessary pointer-address manipulations behind pure functional interfaces while requiring only a negligible amount of additional trust. We have implemented our approach for the upcoming version (v4) of Lean, and our approach could be adopted by other languages based on dependent type theory as well.

READ FULL TEXT
research
02/09/2021

Native Type Theory

We present a method to construct "native" type systems for a broad class...
research
03/29/2021

A simpler encoding of indexed types

In functional programming languages, generalized algebraic data types (G...
research
11/09/2017

Cons-free Programming with Immutable Functions

We investigate the power of non-determinism in purely functional program...
research
08/23/2021

The Multiverse: Logical Modularity for Proof Assistants

Proof assistants play a dual role as programming languages and logical s...
research
11/22/2018

Automated Amortised Resource Analysis for Term Rewrite Systems

In this paper we establish an automated amortised resource analysis for ...
research
03/22/2023

Practical compilation of fexprs using partial evaluation: Fexprs can performantly replace macros in purely-functional Lisp

Macros are a common part of Lisp languages, and one of their most lauded...
research
10/03/2022

Reflections on existential types

Existential types are reconstructed in terms of small reflective subuniv...

Please sign up or login with your details

Forgot password? Click here to reset