Container (type theory)

Container (type theory)

In type theory, containers are abstractions which permit various different "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

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

\lambda\left(s,f\right).\left(s,g\circ f\right)

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

Indexed containers

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.

References

  1. ^ a b Michael Abbott, Thorsten Altenkirch and Neil Ghani (2005). "Containers: Constructing strictly positive types". Theoretical Computer Science 342 (1): 3–27. doi:10.1016/j.tcs.2005.06.002. 
  2. ^ Thorsten Altenkirch, Neil Ghani, Peter Hancock, Conor McBride, and Peter Morris (PDF). Indexed Containers. Unpublished manuscript. http://strictlypositive.org/indexed-containers.pdf. Retrieved 2008-10-30. 



Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Container — may refer to: Items used to contain, store, and transport products, such as: Carton Bottle Can (disambiguation), several meanings Shipping containers include Crate Wooden box Intermodal container, aka Ship container or Cargo container Twenty foot …   Wikipedia

  • Container (data structure) — For the abstract notion of containers in Type theory, see Container (Type theory). In computer science, a container is a class, a data structure[1][2], or an abstract data type (ADT) whose instances are collections of other objects. In other… …   Wikipedia

  • Piaget's theory of cognitive development — For more information, see Neo Piagetian theories of cognitive development. Piaget s theory of cognitive development is a comprehensive theory about the nature and development of human intelligence first developed by Jean Piaget. It is primarily… …   Wikipedia

  • Atomic theory — Atomic model redirects here. For the unrelated term in mathematical logic, see Atomic model (mathematical logic). This article is about the historical models of the atom. For a history of the study of how atoms combine to form molecules, see… …   Wikipedia

  • Abstract data type — In computing, an abstract data type (ADT) is a specification of a set of data and the set of operations that can be performed on the data. Such a data type is abstract in the sense that it is independent of various concrete implementations. The… …   Wikipedia

  • Combinatorial species — In combinatorial mathematics, the theory of combinatorial species is an abstract, systematic method for analysing discrete structures in terms of generating functions. Examples of discrete structures are (finite) graphs, permutations, trees, and… …   Wikipedia

  • statistics — /steuh tis tiks/, n. 1. (used with a sing. v.) the science that deals with the collection, classification, analysis, and interpretation of numerical facts or data, and that, by use of mathematical theories of probability, imposes order and… …   Universalium

  • Time — This article is about the measurement. For the magazine, see Time (magazine). For other uses, see Time (disambiguation). The flow of sand in an hourglass can be used to keep track of elapsed time. It also concretely represents the present as… …   Wikipedia

  • Шаблоны C++ — У этого термина существуют и другие значения, см. Шаблон. Шаблоны (англ. template)  средство языка C++, предназначенное для кодирования обобщённых алгоритмов, без привязки к некоторым параметрам (например, типам данных, размерам буферов …   Википедия

  • Rhetoric — This article is about the art of rhetoric in general. For the work by Aristotle, see Rhetoric (Aristotle). Painting depicting a lecture in a knight academy, painted by Pieter Isaacsz or Reinhold Timm for Rosenborg Castle as part of a series of… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”