Deriving Law-Abiding Instances

08/07/2017
by   Ryan Scott, et al.
0

Liquid Haskell's refinement-reflection feature augments the Haskell language with theorem proving capabilities, allowing programmers to retrofit their existing code with proofs. But many of these proofs require routine, boilerplate code that is tedious to write. Moreover, many such proofs do not scale well, as the size of proof terms can grow superlinearly with the size of the datatypes involved in the proofs. We present a technique for programming with refinement reflection which solves this problem by leveraging datatype-generic programming. Our observation is that we can take any algebraic datatype, generate an equivalent representation type, and have Liquid Haskell automatically construct (and prove) an isomorphism between the original type and the representation type. This reduces many proofs down to easy theorems over simple algebraic "building block" types, allowing programmers to write generic proofs cheaply and cheerfully.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/09/2017

Refinement Reflection: Complete Verification with SMT

We introduce Refinement Reflection, a new framework for building SMT-bas...
research
03/24/2021

New Proofs of the Basel Problem using Stochastic Processes

The number π ^2/6 is involved in the variance of several distributions i...
research
09/11/2019

The Marriage of Univalence and Parametricity

Reasoning modulo equivalences is natural for everyone, including mathema...
research
09/29/2020

Generating Mutually Inductive Theorems from Concise Descriptions

We describe defret-mutual-generate, a utility for proving ACL2 theorems ...
research
08/01/2023

Top-down Automated Theorem Proving (Notes for Sir Timothy)

We describe a "top down" approach for automated theorem proving (ATP). R...
research
05/21/2018

One Monad to Prove Them All (Functional Pearl)

One Monad to Prove Them All is a modern fairy tale about curiosity and p...
research
03/03/2021

Functional Extensionality for Refinement Types

Refinement type checkers are a powerful way to reason about functional p...

Please sign up or login with your details

Forgot password? Click here to reset