Extensional equality preservation and verified generic programming

08/05/2020
by   Nicola Botta, et al.
0

In verified generic programming, one cannot exploit the structure of concrete data types but has to rely on well chosen sets of specifications or abstract data types (ADTs). Functors and monads are at the core of many applications of functional programming. This raises the question of what useful ADTs for verified functors and monads could look like. The functorial map of many important monads preserves extensional equality. For instance, if f, g : A → B are extensionally equal, that is, ∀ x ∈ A, f x = g x, then map f : List A → List B and map g are also extensionally equal. This suggests that preservation of extensional equality could be a useful principle in verified generic programming. We explore this possibility with a minimalist approach: we deal with (the lack of) extensional equality in Martin-Löf's intensional type theories without extending the theories or using full-fledged setoids. Perhaps surprisingly, this minimal approach turns out to be extremely useful. It allows one to derive simple generic proofs of monadic laws but also verified, generic results in dynamical systems and control theory. In turn, these results avoid tedious code duplication and ad-hoc proofs. Thus, our work is a contribution towards pragmatic, verified generic programming.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/02/2022

Propositional Equality for Gradual Dependently Typed Programming

Gradual dependent types can help with the incremental adoption of depend...
research
07/17/2019

Typal Heterogeneous Equality Types

The usual homogeneous form of equality type in Martin-Löf Type Theory co...
research
07/20/2021

Verified Functional Programming of an Abstract Interpreter

Abstract interpreters are complex pieces of software: even if the abstra...
research
03/03/2021

Functional Extensionality for Refinement Types

Refinement type checkers are a powerful way to reason about functional p...
research
02/03/2021

A model of Clocked Cubical Type Theory

Guarded recursion is a powerful modal approach to recursion that can be ...
research
07/20/2020

Coinduction Plain and Simple

Coinduction refers to both a technique for the definition of infinite st...
research
08/05/2020

Semantic verification of dynamic programming

We prove that the generic framework for specifying and solving finite-ho...

Please sign up or login with your details

Forgot password? Click here to reset