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 modal logic a modality expresses a “way of being true” and a modal proposition (or stable proposition) is a proposition which is indeed true in the given way (for instance being necessarily true or possibly true, in S4 modal logic ).
As one passes from logic to (homotopy) type theory and hence from modal logic to modal type theory, then being true is just the lowest stage of a hierarchy of truncated types (“h-level”). Hence for a general type/homotopy type then a modality expresses just a “way of being”.
For instance if $C$ is a discrete finite type (h-set) thought of as a type of “colors” and one term $g \colon C$ of it is thought of as the color “green”, then the $C$-dependent types may be thought of as colored types; and so there is a modal operator whose modal types are those which are unicolored in green. Hence here the “way of being” expressed by the modality is “being green”. (Formally, $g: 1 \to C$ induces $g^{\ast}: \mathbf{H}/C \to \mathbf{H}$ selecting the $g$-fiber of a $C$-colored type. Then composition with its left adjoint, dependent sum, $\sum_g: \mathbf{H} \to \mathbf{H}/C$, yields the comonadic modal operator, $\sum_g \cdot g^{\ast}$, on $\mathbf{H}/C$, which acts on a colored type to filter out non-green entities.)
More practical examples arise for instance in cohesive homotopy type theory, where for instance the flat modality expresses the “way of being geometrically discrete” and the sharp modality expresses the “way of being codiscrete”.
If one also regards non-idempotent (co-)monads as modal operators then the “way of being” expressed by them may involve structure and not just property. For instance the modal types of the maybe monad are the pointed objects and hence the maybe modality expresses the “way of being pointed”.
Given a modal type theory, hence type theory equipped with a closure operator modality $\Diamond$ (idempotent monadic) or $\Box$ (idempotent comonadic), a type $X$ is modal with respect to $\Diamond$/$\Box$ if
the unit $\eta \colon X \to \Diamond X$
or the counit $\epsilon \colon \Box X \to X$
is an equivalence.
The collection of modal types forms the closure of the given closure operator.
Under propositions as types a proposition that is modal is also called a stable proposition.
By the discussion at idempotent monad – Properties – Eilenberg-Moore category of algebra the modal types over an idempotent (co-)modality are precisely the types which are (co-)algebras over the given (co-)monad. Hence more generally it makes sense to regard a not-necessarily idempotent (co-)monad as a modal operator and regard its algebras as the corresponding modal types.