Container (type theory)

In type theory, a discipline within mathematical logic, containers are abstractions which permit various "collection types", such as lists and trees, to be represented in a uniform way. A (unary) container is defined by a type of shapes S and a type family of positions P, indexed by S. The extension of a container is a family of dependent pairs consisting of a shape (of type S) and a function from positions of that shape to the element type. Containers can be seen as canonical forms for collection types.[1]

For lists, the shape type is the natural numbers (including zero). The corresponding position types are the types of natural numbers less than the shape, for each shape.

For trees, the shape type is the type of trees of units (that is, trees with no information in them, just structure). The corresponding position types are isomorphic to the types of valid paths from the root to particular nodes on the shape, for each shape.

Note that the natural numbers are isomorphic to lists of units. In general the shape type will always be isomorphic to the original non-generic container type family (list, tree etc.) applied to unit.

One of the main motivations for introducing the notion of containers is to support generic programming in a dependently typed setting.[1]

## Categorical aspects

[edit]

This section needs expansion. You can help by adding to it. (October 2008)

|

The extension of a container is an endofunctor. It takes a function `g` to

λ ( s , f ) . ( s , g ∘ f ) {\displaystyle \lambda (s,f).(s,g\circ f)}

This is equivalent to the familiar `map g` in the case of lists, and does something similar for other containers.

## Indexed containers

[edit]

This section needs expansion. You can help by adding to it. (October 2008)

|

Indexed containers (also known as dependent polynomial functors) are a generalisation of containers, which can represent a wider class of types, such as vectors (sized lists).[2]

The element type (called the input type) is indexed by shape and position, so it can vary by shape and position, and the extension (called the output type) is also indexed by shape.

## See also

[edit]

* Container (abstract data type)
* Polynomial functor (type theory)

## References

[edit]

1. ^ a b Michael Abbott; Thorsten Altenkirch; Neil Ghani (2005). "Containers: Constructing strictly positive types". Theoretical Computer Science. 342 (1): 3–27. CiteSeerX 10.1.1.166.34. doi:10.1016/j.tcs.2005.06.002.
2. ^ Thorsten Altenkirch, Neil Ghani, Peter Hancock, Conor McBride, and Peter Morris. "Indexed Containers" (PDF). Unpublished manuscript. Retrieved 2008-10-30. `{{cite journal}}`: Cite journal requires `|journal=` (help)CS1 maint: multiple names: authors list (link)

## External links

[edit]

* Container Types blog

Γ ⊢ {\displaystyle \Gamma \\!\vdash } |

This programming language theory or type theory-related article is a stub. You can help Wikipedia by expanding it.

|

* v
* t
* e

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template