Talk at AIM XXXIV
Jesper Cockx
9 June 2021
With Agda, we can write verified functional programs (hooray!)
However, not everyone uses Agda (booh!)
How can we give the benefits of verified code to those poor people??
Agda2Hs is an Agda backend that maps a subset of Agda to readable Haskell code.
How to use Agda2Hs:
How feasible is it to verify Haskell libraries using Agda2Hs?
Sub-questions: how hard is it to…
3rd year Bsc students work on research project for 10 weeks in groups of 5.
Each student works individually on a sub-question
In this case: Each student works on porting and verifying one existing Haskell library with Agda2Hs.
Students had basic knowledge of Haskell + Agda from FP course, but no other previous experience.
Data.Map
: maps implemented as binary search treesData.Sequence
: lists implemented as finger treesData.Graph
: algebraic graphs implemented as patricia treesQuadTree
: regions of 2D spaceRangedSet
: unions of continuous ranges of numbersThere are plenty of sources for properties to prove:
Large and commonly used library, so it has lots of functions and low-level optimizations.
Finger trees use heterogeneous recursion: The type of elements changes in each step.
The agl
library defines both an abstract interface for working with algebraic graphs, and an implementation of this interface using Patricia trees.
This library relies heavily on lenses: functional getter/setter pairs which should satisfy a bunch of laws.
Many functions on ranged sets do not actually preserve all invariants, so the result needs to be normalised first.
IsTrue : Bool -> Set
.cong
.