|logic||category theory||type theory|
|true||terminal object/(-2)-truncated object||h-level 0-type/unit type|
|false||initial object||empty type|
|proposition||(-1)-truncated object||h-proposition, mere proposition|
|cut rule||composition of classifying morphisms / pullback of display maps||substitution|
|cut elimination for implication||counit for hom-tensor adjunction||beta reduction|
|introduction rule for implication||unit for hom-tensor adjunction||eta conversion|
|logical conjunction||product||product type|
|disjunction||coproduct ((-1)-truncation of)||sum type (bracket type of)|
|implication||internal hom||function type|
|negation||internal hom into initial object||function type into empty type|
|universal quantification||dependent product||dependent product type|
|existential quantification||dependent sum ((-1)-truncation of)||dependent sum type (bracket type of)|
|equivalence||path space object||identity type|
|equivalence class||quotient||quotient type|
|induction||colimit||inductive type, W-type, M-type|
|higher induction||higher colimit||higher inductive type|
|completely presented set||discrete object/0-truncated object||h-level 2-type/preset/h-set|
|set||internal 0-groupoid||Bishop set/setoid|
|universe||object classifier||type of types|
|modality||closure operator, (idemponent) monad||modal type theory, monad (in computer science)|
|linear logic||(symmetric, closed) monoidal category||linear type theory/quantum computation|
|proof net||string diagram||quantum circuit|
|(absence of) contraction rule||(absence of) diagonal||no-cloning theorem|
|synthetic mathematics||domain specific embedded programming language|
Viewed as a syntactic framework, we can identify a subset of Haskell called that is often used to identify concepts used in basic category theory. One considers Haskell types as objects of a category whose morphisms are extensionally identified Haskell functions.
With and etc., we can work almost as if it was even a Cartesian closed cateogry. A particular problem is the polymorphic term , which is defined to be term of every type. It prevents, for example, initial objects (i.e. there’s no analog of the empty set). Or, when it comes to setting up the categorical product, the projections and couldn’t distinguish between and just , spoiling uniqueness. A related deficit is that when it comes to passing functions as arguments, Haskell sees more than just Hask morphisms.
The standard notion of functors in Haskell are not terms of a Hask type but operate on one level above those, the kind level. If ‘7’ is of type ‘Int’ and ‘Int’ is of kind ‘U’, then a functor corresponds to a map ‘U U U’. Functors form a class, in the sense used in computer science, i.e. a standardly employed abstraction or interface.
The object mappings of functors in Haskell are type formers (e.g. mapping a type of integers to the type of lists of such integers) and these is often used without any reference to the arrow mappings in the code. For each declaration of a functor, the user must code its action on the arrows (a function called ‘fmap’), which here are Haskell function terms. It must be noted that all algebraic laws (e.g. compatibility of functors with function concatenation in the sense of the definition of functors) are not checked or enforced by the Haskell compiler. That is to say, in this language, its written code is only checked for the arrow mapping of a user defined functor is well-typed, while the user could, in principle, declare a “‘Functor’” that doesn’t actually fulfill all the defining properties of a functor. Today, there are also software modules that implement category theoretical notions more abractly, i.e. one may set up categories in which the arrows are not necessarily Haskell functions.
Haskell is famous for its use of monads (in computer science), a subclass of functors. Here, the unit (called ‘return’) and co-unit must be implemented. However, stemming from the way that monads are actually used by programmers, rather it is standard to implement the function ‘return’ and another function called ‘bind’, with infix ‘»=’, which is a composite of the functor and the two natural transformations and which can be derived from the others.
A wiki platform based on Haskell, running texmath
The use of Haskell in mathematics is discussed in the following references.
haskellwiki, Haskell and mathematics
category theory, in haskellwiki, wiki
Jan van Eijck, The Haskell Road to Logic, Maths and Programming
Dan Piponi, “What Category do Haskell Types and Functions Live In?”, October 13, 2009.