MoL-2023-03: Implementing a definitional (co)datatype package in Lean 4, based on quotients of polynomial functors

MoL-2023-03: Keizer, Alex C. (2023) Implementing a definitional (co)datatype package in Lean 4, based on quotients of polynomial functors. [Report]

[thumbnail of MoL-2023-03.text.pdf] Text
MoL-2023-03.text.pdf - Published Version

Download (289kB)

Abstract

Coinduction is the dual of induction. While inductive types are ubiquitous in functional programming languages, coinductive types, also known as codatatypes, are considerably less well-supported. Notably, Lean 4, the latest edition of an interactive theorem prover and dependently typed functional programming language developed at Microsoft Research, lacks support for coinduction.
I have implemented a (co)datatype package for Lean 4, which compiles high-level, definitional specifications for types, which may mix induction, coinduction and quotients, into a definition of that type in terms of quotients of polynomial functors. These QPFs were previously formalized in Lean 3, which I took as a starting point and ported to Lean 4. This thesis describes how the compilation procedure works, and dives into technical details of the Lean meta-programming system that influenced the implementation. The package adds data and codata commands for specifications of inductive, respectively coinductive, types. Additionally, a qpf command exposes a specific part of the procedure, called the composition pipeline, that is used to define new QPFs composed of other QPFs.

Item Type: Report
Report Nr: MoL-2023-03
Series Name: Master of Logic Thesis (MoL) Series
Year: 2023
Subjects: Computation
Logic
Depositing User: Dr Marco Vervoort
Date Deposited: 20 Mar 2023 12:25
Last Modified: 20 Mar 2023 12:25
URI: https://eprints.illc.uva.nl/id/eprint/2239

Actions (login required)

View Item View Item