(Co)-Inductive Data Types

Well-founded Trees and Corecursion in Martin-Löf Type Theory with Fixpoint

Article

Denis StoyanovMaxim SokhatskyDATE: 19 OCT 2017

Abstract

This work shows how to encode inductive types using recursion schemes.
Unlike Church-Boem-Berarducci encoding, that can encode inductive types
without fixpoint, recursion shcemes require the fixpoint constructor
in the typechecker core in order to express this encoding.
We will use cubicaltype
checker from Mortberg et all. You may want
to try this in Agda, Idris, Coq or any MLTT prover.

Fixpoint

The core fixpoint reflection type is parametrized by functor
and has only one contructor with value of this functor applied to fixpoint itself.

data fix (F: U -> U) = Fix (point: F (fix F))

We also need functions for projecting and embedding valued to/from
fixpoint functiorial stream.

F-Algebra

F-Algebras gives us a categorical understanding recursive types.
Let $F : C \rightarrow C$ be an endofunctor on category $C$.
An F-algebra is a pair $(A, \varphi)$, where A
is an object and $\varphi\ : F\ A \rightarrow A$
is an morphism in the category $C$. The object A is the carrier and the functor
F is the signature of the algebra. Reversing arrows gives us F-coalgebra.