natural deduction metalanguage, practical foundations
type theory (dependent, intensional, observational type theory, homotopy type theory)
computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory
In type theory, a type may be classified by its “polarity”, either positive or negative, according to whether its term constructors or its term eliminators are regarded as primary, respectively. The idea is due to Jean-Marc Andreoli and Jean-Yves Girard.
Positive types are inductively defined by their term introduction rules and correspond, under categorical semantics, to objects defined as covariant representable functors ($C \to Set$) such as colimits and left adjoints.
On the other hand, negative types are coinductively defined by their term elimination rules and correspond under categorical semantics to objects defined as contravariant representable functors ($C^{op} \to Set$) such as limits and right adjoints.
Note that polarity is not so much a property of the types themselves, but rather of their presentation by introduction and elimination rules: It may happen that a positive and a negative type are equivalent (this is the case, for example, for the product type in simply typed lambda calculus). In terms of categorical semantics this is simply the fact that a single object may exhibit multiple universal properties.
Generally, in effectful languages, the positive types are better behaved in call-by-value? evaluation strategies and negative types are better behaved in call-by-name? and other lazy evaluation? strategies. A category-theoretic explanation of this fact is that call-by-value? languages can be modeled by the Kleisli category of a monad $T$ on a category $C$. Usually, the category $C$ will have both limits (negatives) and colimits (positives), however the canonical functor $F \colon C \to C_T$ is a left adjoint so it only generally preserves the colimits (positives). Dually, call-by-name languages can be modeled by the Kleisli category of a comonad $W$ and the canonical functor $U \colon C \to C_W$ is a right adjoint, and so preserves limits (negatives).
Noam Zeilberger, The Logical Basis of Evaluation Order and Pattern-Matching, (pdf)
Robert Harper, Polarity in Type Theory, (blog post)
Last revised on December 17, 2022 at 15:25:56. See the history of this page for a list of all contributions to it.