nLab modality



Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logiccategory theorytype theory
trueterminal object/(-2)-truncated objecth-level 0-type/unit type
falseinitial objectempty type
proposition(-1)-truncated objecth-proposition, mere proposition
proofgeneralized elementprogram
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
cut elimination for implicationcounit for hom-tensor adjunctionbeta reduction
introduction rule for implicationunit for hom-tensor adjunctioneta conversion
logical conjunctionproductproduct type
disjunctioncoproduct ((-1)-truncation of)sum type (bracket type of)
implicationinternal homfunction type
negationinternal hom into initial objectfunction type into empty type
universal quantificationdependent productdependent product type
existential quantificationdependent sum ((-1)-truncation of)dependent sum type (bracket type of)
equivalencepath space objectidentity type/path type
equivalence classquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
completely presented setdiscrete object/0-truncated objecth-level 2-type/set/h-set
setinternal 0-groupoidBishop set/setoid
universeobject classifiertype of types
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels


Modalities, Closure and Reflection



A modality in philosophy and formally in formal logic/type theory expresses a certain mode (or “moment” as in Hegel 12) of being.

In philosophy

According to (Kant 1900) (see WP) the four “categories” are

  1. Quantity

  2. Quality

  3. Relation

  4. Modality

and the modalities contain the three pairs of opposites

In formal logic and type theory

In formal logic and type theory modalities are formalized by modal operators or closure operators \sharp, that send propositions/types XX to new propositions/types X\sharp X, satisfying some properties.

Adding such modalities to propositional logic or similar produces what is called modal logic. Here operators that are meant to formalize necessity and possibility (S4 modal logic) are maybe most famous. Adding modalities more generally to type theory and homotopy type theory yields modal type theory and modal homotopy type theory. See there for more details.

The categorical semantics of these modalities is that \sharp is interpreted as an idempotent monad/comonad on the category of contexts.

This has a refinement to homotopy type theory, where the categorical semantics of a higher modality or homotopy modality as an idempotent (infinity,1)-monad (Shulman 12, Rijke, Shulman, Spitters ).

More in detail, there are a number of different but equivalent ways to define a modality in homotopy type theory (see at modal homotopy type theory). From Rijke, Shulman, Spitters 17:

  • Higher modality: A modality consists of a modal operator L:TypeTypeL : {Type} \to {Type} and for every type XX a modal unit () L:XLX(-)^L : X \to LX together with
  1. an induction principle of type

    ind:((a:A)LB(a L))((u:LA)LB(u))\text{ind} : ((a : A) \to LB(a^L)) \to ((u : LA) \to LB(u))

    for any type AA and type BB depending on LALA

  2. a computation rule

    com:ind(f)(a L)=f(a).\text{com} : \text{ind}(f)(a^L) = f(a).
  3. a witness that for any x,y:LAx, y : LA, the modal unit () L:(x=y)L(x=y)(-)^L : (x = y) \to L(x = y) is an equivalence.

  • Uniquely eliminating modality: A modality consists of a modal operator and modal unit such that operation

    ff() L:((u:LA)LB(u))((a:A)LB(a L))f \mapsto f \circ (-)^L : ((u : LA) \to LB(u)) \to ((a : A) \to LB(a^L))

    is an equivalence for all types AA and types BB depending on LALA.

  • Σ\Sigma-closed reflective subuniverse (aka localization): A reflective subuniverse (a.k.a. localization) consists of a proposition isLocal:TypePropisLocal : {Type} \to {Prop} together with an operator L:TypeTypeL : {Type} \to {Type} and a unit () L:XLX(-)^L : X \to LX such that LXLX is local for any type XX and for any local type ZZ, then function

    ff() L:(LAZ)(AZ)f \mapsto f \circ (-)^L : (LA \to Z) \to (A \to Z)

    is an equivalence. A localization is Σ\Sigma-closed if whenever AA is local and for all a:Aa : A, B(a)B(a) is local, then the dependent sum Σ a:AB(a)\Sigma_{a : A} B(a) is local.

  • Stable factorization systems: A modality consists of an orthogonal factorization system (,)(\mathcal{L}, \mathcal{R}) in which the left class is stable under pullback.

  • A localization (reflective subuniverse) whose units () L:XLX(-)^L : X \to LX are LL-connected.

We say that a type XX is LL-modal if the unit () L:XLX(-)^L : X \to LX is an equivalence. We say a type XX LL-connected if LXLX is contractible.

In terms of the other structure, the stable factorization system associated to a modality LL has

  • left class the LL-connected maps, whose fibers are LL-connected.

  • right class the LL-modal maps, whose fibers are LL-modal.

Conversely, given a stable factorization system, the modal operator and unit are given by factorizing the terminal map.


Typical notation (e.g. SEP, Reyes 91, but not Hermida 10) is as follows:

When adjunctions between modalities matter (adjoint modalities), then some authors (Reyes 91, p. 367 RRZ 04, p. 116, Hermida 10, p.11) use \lozenge for a left adjoint of a \Box. That leaves \bigcirc as the natural choice of notation for a right adjoint (if any) of a \Box-modality.

This way for instance for cohesion with shape modality \dashv flat comodality \dashv sharp modality the generic notation would be:

monad comonad monad shape flat sharp ʃ \array{ monad && comonad && monad \\ \lozenge &\dashv& \Box &\dashv& \bigcirc \\ \\ shape && flat && sharp \\ ʃ &\dashv& \flat &\dashv& \sharp }



In philosopy

Origin in philosophy:

In formal logic

Discussion in formal logic, type theory and homotopy type theory (fot more see at modal logic, modal type theory and modal homotopy type theory):

In category theory

Discussion in category theory (fot more see at modal operator):

  • Gonzalo Reyes, A topos-theoretic approach to reference and modality, Notre Dame J. Formal Logic Volume 32, Number 3 (1991), 359-391 (Euclid)

  • Reyes/Reyes/Zolfaghari, Generic Figures and Their Glueings 2004, Polimetrica

  • Claudio Hermida, section 3.3. of A categorical outlook on relational modalities and simulations, 2010 (pdf)

Last revised on July 23, 2022 at 14:16:44. See the history of this page for a list of all contributions to it.