---
abstract: 'We present an approach to develop folds for nested data types using dependent types. We call such folds *dependently typed folds*, they have the following properties. (1) Dependently typed folds are defined by well-founded recursion and they can be defined in a total dependently typed language. (2) Dependently typed folds do not depend on maps, map functions and many terminating functions can be defined using dependently typed folds. (3) The induction principles for nested data types follow from the definitions of dependently typed folds and the programs defined by dependently typed folds can be formally verified. (4) Dependently typed folds exist for any nested data types and they can be specialized to the traditional *higher-order folds*. Using various of examples, we show how to program and reason about dependently typed folds. We also show how to obtain dependently typed folds in general and how to specialize them to the corresponding higher-order folds.'
author:
- Peng Fu
- Peter Selinger
bibliography:
- 'dep.bib'
title: Dependently Typed Folds for Nested Data Types
---

&lt;ccs2012&gt; &lt;concept&gt; &lt;concept\_id&gt;10011007.10011006.10011008&lt;/concept\_id&gt; &lt;concept\_desc&gt;Software and its engineering General programming languages&lt;/concept\_desc&gt; &lt;concept\_significance&gt;500&lt;/concept\_significance&gt; &lt;/concept&gt; &lt;concept&gt; &lt;concept\_id&gt;10003456.10003457.10003521.10003525&lt;/concept\_id&gt; &lt;concept\_desc&gt;Social and professional topics History of programming languages&lt;/concept\_desc&gt; &lt;concept\_significance&gt;300&lt;/concept\_significance&gt; &lt;/concept&gt; &lt;/ccs2012&gt;

Introduction {#intro}
