%\chapter{Modalities}\label{chap:modalities}

\section{Modalities}\label{sec:modal-refl-subun}

In this section we will introduce the following four notions of modality
and prove that they are all equivalent:
\begin{enumerate}
\item Higher modalities
\item Uniquely eliminating modalities
\item $\Sigma$-closed reflective subuniverses
\item Stable orthogonal factorization systems
\end{enumerate}
After their equivalence has been established, we will call all of them simply \emph{modalities}.

The first three definitions have the following data in common: by a \define{modal operator} we mean a function $\modal:\UU\to\UU$, and by a \define{modal unit} we mean a family of functions $\modalunit^\modal:\prd*{A:\UU}A\to\modal A$.
Given these data, we say a type $X$ \define{is modal} if $\modalunit[X]:X\to\modal X$ is an equivalence, and we write $\UU_\modal \defeq \sm{X:\UU} \ismodal(X)$ for the \define{subuniverse of modal types}.

\begin{defn}\label{defn:highermod}
A \define{higher modality} consists of a modal operator and modal unit together with
\begin{enumerate}
\item for every $A:\UU$ and every dependent type $P:\modal A\to\UU$, a
function
\begin{equation*}
\mathsf{ind}_{\modal A}:\big(\prd{a:A}\modal(P(\eta(a)))\big)\to\prd{z:\modal A}\modal(P(z)).
\end{equation*}
\item An identification
\begin{equation*}
\mathsf{comp}_{\modal A}(f,x):\id{\mathsf{ind}_{\modal A}(f)(\eta(x))}{f(x)}
\end{equation*}
for each $f:\prd{x:A}\modal(P(\eta(x)))$.
\item For any $x,y:\modal A$ the modal unit $\modalunit[(\id{x}{y})]:\id{x}{y}\to \modal(\id{x}{y})$ is an equivalence.
\end{enumerate}
\end{defn}

\begin{defn}\label{defn:modunique}
A \define{uniquely eliminating modality} consists of
a modal operator and modal unit such that the function
\begin{equation*}
\lam{f} f\circ\modalunit[A] : (\prd{x:\modal A}\modal(P(x)))\to(\prd{a:A}\modal(P(\modalunit[A](a))))
\end{equation*}
is an equivalence for any $A$ and any $P:\modal A\to\UU$.
\end{defn}

\begin{defn}\label{defn:ssrs}
A reflective subuniverse $L$ is said to be \define{$\Sigma$-closed} if $\sm{x:X}P(x)$ is $L$-local for every family $P:X\to \UU_L$ of $L$-local types over an $L$-local type $X$.
\end{defn}

Note that unlike \cref{defn:highermod,defn:modunique}, in \cref{defn:ssrs} the notion of ``modal type'' is part of the data.
However, we will show in \cref{thm:subuniv-modal} that $\ismodal(A)$ if and only if $\modalunit[A]$ is an equivalence.

\begin{defn}\label{defn:sofs}
An \define{orthogonal factorization system} consists of
predicates $\mathcal{L},\mathcal{R}:\prd*{A,B:\UU} (A\to B)\to\prop$ such that
\begin{enumerate}
\item $\mathcal{L}$ and $\mathcal{R}$ are closed under composition and contain all identities (i.e.\ they are subcategories of the category of types that contain all the objects), and
\item the type $\fact_{\mathcal{L},\mathcal{R}}(f)$ of factorizations
\begin{equation*}
\begin{tikzcd}
A \arrow[rr,"f"] \arrow[dr,swap,"f_{\mathcal{L}}"] & & B \\
& \im_{\mathcal{L},\mathcal{R}}(f) \arrow[ur,swap,"f_{\mathcal{R}}"]
\end{tikzcd}
\end{equation*}
of $f$, with $f_{\mathcal{L}}$ in $\mathcal{L}$ and $f_{\mathcal{R}}$ in $\mathcal{R}$, is contractible.
\end{enumerate}
More precisely, the type $\fact_{\mathcal{L},\mathcal{R}}(f)$ is defined to
be the type of
tuples
\begin{equation*}
(\im_{\mathcal{L},\mathcal{R}}(f),(f_{\mathcal{L}},p),(f_{\mathcal{R}},q),h)
\end{equation*}
consisting of a type $\im_{\mathcal{L},\mathcal{R}}(f)$, a function $f_{\mathcal{L}}:A\to \im_{\mathcal{L},\mathcal{R}}(f)$ with
$p:\mathcal{L}(f_{\mathcal{L}})$, a function $f_{\mathcal{R}}:\im_{\mathcal{L},\mathcal{R}}(f)\to B$ with $q:\mathcal{R}(f_{\mathcal{R}})$, and an identification $h:\id{f}{f_{\mathcal{R}}\circ f_{\mathcal{L}}}$. The type $\im_{\mathcal{L},\mathcal{R}}(f)$ is called
the \define{$(\mathcal{L},\mathcal{R})$-image of $f$}.

A type $X$ is said to be \define{$(\mathcal{L},\mathcal{R})$-modal} if
the map $!:X\to\unit$ is in $\mathcal{R}$ (and hence $!_\mathcal{L}$
is an equivalence).

An orthogonal factorization system is said to be \define{stable} if the class
$\mathcal{L}$ is stable under pullbacks (By
\autoref{lem:ofs_rightstable}, $\mathcal{R}$ is always stable under pullbacks).
\end{defn}

\begin{rmk}
  By univalence, the fact that $\mathcal{L}$ and $\mathcal{R}$ contain all identities implies that they each contain all equivalences.
  Conversely, if $f\in \mathcal{L}\cap\mathcal{R}$, then $(\idfunc,f)$ and $(f,\idfunc)$ are both $(\mathcal{L},\mathcal{R})$-factorizations of $f$, and hence equal; which implies that $f$ is an equivalence.
  Thus, $\mathcal{L}\cap\mathcal{R}$ consists exactly of the equivalences.
\end{rmk}

We now consider a few examples.
Since we will eventually prove all the definitions to be equivalent, we can use any one of them to describe any particular example.

\begin{eg}
  The prime example is the \textbf{$n$-truncation modality} $\truncf n$ as studied in~\cite[Chapter 7]{hottbook}.
  This can be given as a higher modality, using its induction principle and the fact that $\trunc n A$ is an $n$-type and the identity types of an $n$-type are again $n$-types (indeed, $(n-1)$-types).
  The corresponding stable orthogonal factorization system, consisting of $n$-connected and $n$-truncated maps, is also constructed in~\cite[Chapter 7]{hottbook}; our construction in \cref{thm:sofs_from_ssrs} will be a generalization of this.
\end{eg}

\begin{eg}\label{eg:open}
  Let $Q$ be a mere proposition.
  The \textbf{open modality} determined by $Q$ is defined by $\open Q A = (Q\to A)$, with unit $\modalunit[A](x) = \lam{\nameless}x : A \to (Q \to A)$.
  To show that this is a higher modality, suppose we have $P: (Q\to A) \to \UU$ and $f:\prd{a:A} Q \to P(\lam{\nameless} a)$.
  Then for any $z:Q\to A$ and $q:Q$ we have $f(z(q),q) : P(\lam{\nameless} z(q))$.
  And since $Q$ is a mere proposition, we have $z(q) = z(q')$ for any $q':Q$, hence $e(z,q) : (\lam{\nameless} z(q)) = z$ by function extensionality.
  This gives
  \[ \lam{z}{q} \trans{e(z,q)}{(f(z(q),q))} : \prd{z:Q\to A} Q \to P(z) \]
  For the computation rule, we have
  \begin{align*}
    (\lam{z}{q} \trans{e(z,q)}{(f(z(q),q))})(\lam{\nameless} a) &= \lam{q} \trans{e(\lam{\nameless} a,q)}{(f(a,q))}\\
    &= \lam{q} f(a,q) = f(a)
  \end{align*}
  by function extensionality, since $e(\lam{\nameless} a,q) = \refl{}$.
  Finally, if $x,y:Q\to A$, then $(x=y) \simeq \prd{q:Q} x(q) = y(q)$, and the map
  \[ \Big(\prd{q:Q} x(q) = y(q)\Big) \to \Big( Q \to \prd{q:Q} x(q) = y(q)\Big) \]
  is (by currying) essentially precomposition with a product projection $Q\times Q\to Q$, and that is an equivalence since $Q$ is a mere proposition.
\end{eg}

\begin{eg}\label{eg:closed}
  Again, let $Q$ be a mere proposition.
  The \textbf{closed modality} determined by $Q$ is defined by $\closed Q A = Q \ast A$, the \emph{join} of $Q$ and $A$ (the pushout of $Q$ and $A$ under $Q\times A$).
  We show that this is a $\Sigma$-closed reflective subuniverse.
  Define a type $B$ to be modal if $Q \to \iscontr(B)$, and note that it is indeed the case that $Q\to\iscontr(Q\ast A)$, for any type $A$.
  By the universal property of pushouts, a map $Q \ast A \to B$ consists of a map $f:A\to B$ and a map $g:Q\to B$ and for any $a:A$ and $q:Q$ an identification $p:f(a)=g(q)$.
  But if $Q \to \iscontr(B)$, then $g$ and $p$ are uniquely determined, so this is just a map $A\to B$.
  Thus $(\closed Q A \to B) \to (A\to B)$ is an equivalence, so we have a reflective subuniverse.
  It is $\Sigma$-closed since the dependent sum of a contractible family of types over a contractible base is contractible.
\end{eg}

\begin{eg}\label{eg:dneg}
  The \textbf{double negation modality} is defined by $A\mapsto \neg\neg A$, i.e.\ $(A\to \emptyt)\to \emptyt$, with $\modalunit(a) = \lam{g} g(a)$.
  We show that this is a uniquely eliminating modality.
  Since the map $\lam{f}f\circ \modalunit[A]$ that must be an equivalence has mere propositions as domain and codomain, it suffices to give a map in the other direction.
  Thus, let $P: \neg\neg A \to \UU$ and $f:\prd{a:A} \neg \neg P(\lam{g} g(a))$; given $z:\neg\neg A$ we must derive a contradiction from $g:\neg P(z)$.
  Since we are proving a contradiction, we can strip the double negation from $z$ and assume given an $a:A$.
  And since $\neg\neg A$ is a mere proposition, we have $z = \lam{g} g(a)$, so that we can transport $f(a)$ to get an element of $\neg\neg P(z)$, contradicting $g$.
\end{eg}

\begin{eg}
  The \textbf{trivial modality} is the identity function on $\UU$.
  It coincides with $\open \top$ and with $\closed\bot$.

  Dually, the \textbf{zero modality} sends all types to $\unit$.
  It is equivalently the $(-2)$-truncation, and coincides with $\open\bot$ and with $\closed \top$.
\end{eg}

\paragraph*{Summary.}
In each of \autoref{defn:highermod,defn:modunique,defn:ssrs,defn:sofs}
we have defined what it means for a type to be modal. In each case, being
modal is a family of mere propositions indexed by the universe, i.e.~a subuniverse.
We will show in \autoref{thm:subuniv-highermod,thm:subuniv-modunique,thm:subuniverse-rs,thm:subuniv-sofs} that each kind of structure is completely determined by this subuniverse.
(\autoref{thm:subuniverse-rs} is more general, not requiring $\Sigma$-closedness.)

It follows that the type of all modalities of each
kind is a subset of the set $\UU\to\prop$ of all subuniverses, and in particular is a set.
This makes it easier to establish
the equivalences of the different kinds of modalities.
It suffices
to show that any modality of one kind determines a modality of the next kind
with the same modal types, which we will do as follows:
\begin{center}
\begin{tikzcd}
  & \text{higher modality} \ar[dr,bend left,"\text{\autoref{thm:modunique_from_highermod}}"] \\
  \parbox{3cm}{\centering stable factorization system} \ar[ur,bend left,"\text{\autoref{thm:highermod_from_sofs}}"] &&
  \parbox{3cm}{\centering uniquely eliminating modality} \ar[dl,bend left,"\text{\autoref{thm:ssrs_from_modunique}}"] \\
  & \parbox{3cm}{\centering $\Sigma$-closed reflective subuniverse} \ar[ul,bend left,"\text{\autoref{thm:sofs_from_ssrs}}"]
\end{tikzcd}
\end{center}
Before \autoref{thm:sofs_from_ssrs} we take the opportunity to develop a bit more theory of reflective subuniverses, including closure under identity types (\autoref{lem:rs_idstable}) and dependent products
(\autoref{lem:modal-Pi}), along with several equivalent characterizations of $\Sigma$-closedness (\autoref{thm:ssrs-characterize}).

Of these equivalences, the most surprising is that a stable factorization system is uniquely determined by its underlying reflective subuniverse of types.
This is false for stable factorization systems on arbitrary categories; the reason it holds here is that we are talking \emph{in type theory} about factorization systems \emph{on the category of types}.
An analogous fact is true in classical set-based mathematics for stable factorization systems on the category of sets (although in that case there are much fewer interesting examples).
We \cite{RijkeShulmanSpitters} we also observe that when type theory is interpreted in a higher category, the data of a reflective subuniverse or modality has to be interpreted ``fiberwise'', giving a richer structure than a single reflective subcategory.

\subsection{Higher modalities}
\label{sec:higher-modalities}

We start by showing that a higher modality is determined by its modal types, and gives rise to a uniquely eliminating modality.

\begin{lem}
If $\modal$ is a higher modality, then any type of the form $\modal X$ is modal.
\end{lem}

\begin{proof}
  We want to show that the modal unit $\modalunit[\modal X]:\modal X\to\modal\modal X$
is an equivalence. By the induction principle and the computation rule for
higher modalities, we find a function $f:\modal \modal X\to\modal X$ with
the property that $f\circ \modalunit[\modal X]\htpy\idfunc[\modal X]$. We wish to
show that we also have $\modalunit[\modal X]\circ f\htpy\idfunc$. Since identity
types of types of the form $\modal Y$ are declared to be modal, it is
equivalent to find a term of type
\begin{equation*}
\prd{x:\modal \modal X}\modal(\modalunit[\modal X](f(x))=x).
\end{equation*}
Now we are in the position to use the induction principle of higher modalities
again, so it suffices to show that $\modalunit(f(\modalunit(x)))=\modalunit(x)$
for any $x:\modal X$. This follows from the fact that $f\circ\modalunit=\idfunc$.
\end{proof}

\begin{thm}\label{thm:subuniv-highermod}
The data of two higher modalities $\modal$ and $\modal'$
are identical if and only if they have the same modal types.
\end{thm}

\begin{proof}
Another way of stating this, is that the function from the type of \emph{all}
modalities on $\UU$ to the type $\UU\to\prop$ of predicates on $\UU$, given
by mapping a modality to the predicate $\ismodal$, is an embedding. Thus, we
need to show that for any predicate $\mathcal{M}:\UU\to\prop$, we can find at
most one modality for which $\mathcal{M}$ is the class of modal types. This
follows, once we demonstrate that,
\begin{quote}
for any $\mathcal{M}:\UU\to\prop$ closed under identity types,
and for any type $X$, the type of tuples $(Y,p,\pi,I,C)$ ---
consisting of a type $Y$ with $p$ witnessing that $Y$
satisfies $\mathcal{M}$, a function $\pi:X\to Y$, a function
\begin{equation*}
I_P:(\prd{x:X} P(\pi(x)))\to(\prd{y:Y} P(y))
\end{equation*}
for every $P:Y\to\UU_{\mathcal{M}}$,
which is a right inverse of precomposing with $\pi$, as is witnessed by the
term $C$ --- is a mere proposition.
\end{quote}

We prove this statement in two parts. First, we show that the
type of pairs $(I,C)$, with $I$ and $C$ of the indicated types, is a mere
proposition for any $(Y,p,\pi)$. After that, we show that the type of triples
$(Y,p,\pi)$ is also a mere proposition. These two facts combined prove the
statement.

Consider a type $Y$ satisfying $\mathcal{M}$, and a function $\pi:X\to Y$, and
let $(I,C)$ and $(I',C')$ be two terms witnessing that $Y$ satisfies an induction
principle with a computation rule. We want to show that $(I,C)=(I',C')$, and of
course it suffices to show that $(I(s),C(s))=(I'(s),C(s))$ for any
$P:Y\to\UU_{\mathcal{M}}$ and $s:\prd{x:X}P(\pi(x))$.

To show that $I(s,y)=I'(s,y)$ for any $y:Y$, we use
the induction principle $(I,C)$. So it suffices to show that
$I(s,\pi(x))=I'(s,\pi(x))$. Both of these terms are equal to $s(x)$. Thus,
we obtain a proof $J(s,y)$ that $I(s,y)=I'(s,y)$, with the property that
$J(s,\pi(x))=\ct{C(s,x)}{\inv{C'(s,x)}}$.
Now we need to show that $\trans{J(s)}{C(s)}=C'(s)$, which is equivalent
to the property we just stated. This finishes the proof that the type of
the induction principle and computation rule is a mere proposition.

It remains to show that $(Y,\pi)=(Y',\pi')$, provided that $Y$ and $Y'$ are both
in $\mathcal{M}$, and that both sides satisfy
the induction principle and computation rule. It suffices to find an equivalence
$f:Y\to Y'$ such that $f\circ \pi=\pi'$.

From the induction principles of $Y$ resp. $Y'$, we obtain a function
$f:Y\to Y'$ with the property that $f\circ \pi=\pi'$, and a function
$f':Y'\to Y$ with the property that $f'\circ \pi'=\pi$.
To show that $f'\circ f=\idfunc$ we use the induction principle
of $Y$. Since the type $f'(f(y))=y$ is in $\mathcal{M}$, it suffices to show that
$f'(f(\pi(y)))=\pi(y)$. This readily follows from the defining properties of $f$
and $f'$. Similarly, we have $f\circ f'=\idfunc$.
\end{proof}

\begin{thm}\label{thm:modunique_from_highermod}
A higher modality is a uniquely eliminating modality, with the
same modal types.
\end{thm}

\begin{proof}
Let $\modal$ be a modality with modal units $\modalunit[A]$. Our goal is to show
that the pre-composition map
\begin{equation*}
\lam{s}s\circ\modalunit[A]:(\prd{x:\modal A}\modal(P(x)))\to(\prd{a:A}\modal(P(\modalunit[A](a))))
\end{equation*}
is an equivalence for each $A:\UU$ and $P:\modal A\to\UU$.
By the given induction principle and computation rule, we obtain a
right inverse $\mathsf{ind}_{\modal A}$ of $\blank\circ\modalunit[A]$.

To show that it is a left inverse, consider $s:\prd{x:\modal A}\modal(P(x))$.
We need to find a homotopy
\begin{equation*}
\prd{x:\modal A}\id{s(x)}{\mathsf{ind}_{\modal A}(s\circ \modalunit_A)(x)}.
\end{equation*}
By assumption we have that $P(x)$ is
modal for each $z:\modal A$ and hence it follows that $\id{s(x)}{\mathsf{ind}_{\modal A}(s\circ \modalunit_A)(x)}$
is modal for each $x$. Hence it suffices to find a function of type
\begin{equation*}
\prd{a:A}\id{s(\modalunit_A(a))}{\mathsf{ind}_{\modal A}(s\circ \modalunit_A)(\modalunit_A(a))}.
\end{equation*}
This follows straight from the computation rule of higher modalities.
\end{proof}

\subsection{Uniquely eliminating modalities}
\label{sec:uniq-elim}

Next, we show that a uniquely eliminating modality is determined by its modal types, and gives rise to a $\Sigma$-closed reflective subuniverse.

\begin{lem}
Given a uniquely eliminating modality, $\modal X$ is modal for any type $X$.
\end{lem}

\begin{proof}
Using the elimination principle of $\modal \modal X$, we find a function
$f:\modal \modal X\to\modal X$ and an identification $f\circ\modalunit[\modal X]=\idfunc[\modal X]$.
By the uniqueness property, the type
\begin{equation*}
\sm{g:\modal \modal X\to\modal \modal X} g\circ\modalunit[\modal X]=\modalunit[\modal X]
\end{equation*}
is contractible. Since both $\idfunc[\modal \modal X]$ and $\modalunit[\modal X]\circ f$
are in this type (with suitable identifications), we find that $f$ is also the
right inverse of $\modalunit[\modal X]$. This shows that $\modalunit[\modal X]$ is an
equivalence, so $\modal X$ is modal.
\end{proof}

\begin{thm}\label{thm:subuniv-modunique}
The data of two uniquely eliminating modalities $\modal$ and $\modal'$ are equivalent if and only if both have the same modal types.
\end{thm}

\begin{proof}
We need to show that the type of uniquely eliminating modalities
with a given class $\mathcal{M}:\UU\to\prop$ of modal types
is a mere proposition. Since the types of the form $\modal X$ are modal,
it suffices to show for any class $\mathcal{M}
:\UU\to\prop$ and any type $X$, that
\begin{quote}
the type of tuples $(Y,p,\pi,H)$ --- consisting of a type $Y$
with $p$ witnessing that $Y$ is in $\mathcal{M}$, a function $\pi:X\to Y$, and
for each $P:Y\to\UU$ a term $H_P$ witnessing that the function
\begin{equation*}
\lam{s}s\circ \pi:(\prd{y:Y}\modal(P(y)))\to(\prd{x:X}\modal(P(\pi(x))))
\end{equation*}
is an equivalence --- is a mere proposition.
\end{quote}
Let $(Y,p,\pi,H)$ and $(Y',p',\pi',H')$ be such tuples. To show that they are
equal, it suffices to show that $(Y,\pi)=(Y',\pi')$ because the other things
in the list are terms of mere propositions. Furthermore, showing that
$(Y,\pi)=(Y',\pi')$ is equivalent to finding an equivalence $f:\eqv{Y}{Y'}$ with
the property that $f\circ\pi=\pi'$. By $H$, there is such a function, and by
$H'$ there is a function $f':Y'\to Y$ such that $f'\circ\pi'=\pi$. Now the
uniqueness gives that $f'\circ f$ is the only function from $Y$ to $Y$ such
that $f'\circ f\circ\pi=\pi$ and of course $\idfunc[Y]$ is another such function.
Therefore it follows that $f'\circ f=\idfunc$, and similarly it follows that
$f\circ f'=\idfunc$.
\end{proof}

\begin{thm}\label{thm:ssrs_from_modunique}
Any uniquely eliminating modality determines a $\Sigma$-closed reflective
subuniverse with the same modal types.
\end{thm}

\begin{proof}
It is immediate from the definition of uniquely eliminating modalities
that every map $f:A\to B$ into a modal type $B$ has a homotopy unique extension to $\modal A$
along the modal unit:
\begin{equation*}
\begin{tikzcd}
A \arrow[dr,"f"] \arrow[d,swap,"\modalunit_A"] \\ \modal A \arrow[r,densely dotted,swap,"\tilde f"] & B
\end{tikzcd}
\end{equation*}
Since the types of the form $\modal X$ are modal, we obtain a reflective subuniverse.
It remains to verify  that the type $\sm{x:\modal X}\modal(P(x))$ is modal for
any type $X$ and $P:X\to\UU$. We have the function
\begin{equation*}
\varphi\defeq\lam{m}\pairr{f(m),g(m)}:\modal(\sm{x:\modal X}\modal(P(x)))\to\sm{x:\modal X}\modal(P(x)),
\end{equation*}
where
\begin{align*}
f & \defeq \ind{\modal}(\lam{x}{u} x) & & : \modal(\sm{x:\modal X}\modal(P(x)))\to \modal X \\
g & \defeq \ind{\modal}(\lam{x}{u} u) & & : \prd{w:\modal(\sm{x:\modal X}\modal(P(x)))} \modal(P(f(w)))
\end{align*}
Our goal is to show that $\varphi$ is an inverse to the modal unit.

Note that
\begin{equation*}
\varphi(\modalunit(x,y)) \jdeq \pairr{f(\modalunit(x,y)),g(\modalunit(x,y))} \jdeq \pairr{x,y},
\end{equation*}
so we see immediately that $\varphi$ is a left inverse of $\modalunit$.

To show that $\varphi$ is a right inverse of $\modalunit$, note that the type
of functions $h$ fitting in a commuting square of the form
\begin{equation*}
\begin{tikzcd}[column sep=-3em]
\modal(\sm{x:\modal X}\modal(P(x))) \arrow[rr,densely dotted,"h"] & & \modal(\sm{x:\modal X}\modal(P(x))) \\
& \sm{x:\modal X}\modal(P(x)) \arrow[ul,"\modalunit"] \arrow[ur,swap,"\modalunit"]
\end{tikzcd}
\end{equation*}
is contractible, and it contains the identity function. Therefore, it suffices
to show that $(\modalunit\circ\varphi)\circ\modalunit=\modalunit$, but this follows
from the fact that $\varphi$ is a left inverse of the modal unit.
\end{proof}

\subsection{\texorpdfstring{$\Sigma$}{Σ}-closed reflective subuniverses}
\label{sec:ssrs}

Now we study reflective subuniverses in a bit more detail, and end by
showing that $\Sigma$-closed ones give rise to stable factorization
systems. $\Sigma$-closure is used in \autoref{thm:sofs_from_ssrs} to
show that left maps and right maps are closed under composition.

\subsubsection{\texorpdfstring{$\Sigma$}{Σ}-closed reflective subuniverses}
\label{sec:sigma-closed}

\begin{defn}\label{defn:connected}
Let $\mathcal{M}:\UU\to\prop$ be a reflective subuniverse with modal
operator $\modal$. We say
that a type $X$ is \define{$\modal$-connected} if $\modal X$ is contractible,
and we say that a function $f:X\to Y$ is \define{$\modal$-connected} if each
of its fibers is. Similarly, we say that $f$ is \define{modal} if each of its
fibers is.
\end{defn}

Note that a type $X$ is modal or $\modal$-connected just when the map $X\to\unit$ is.

\begin{eg}\label{eg:closed-connected}
  Recall from \cref{eg:open} that the open modality associated to a proposition $Q$ is defined by $\open Q(A) \defeq (Q\to A)$.
  We claim that $A$ is $\open Q$-connected if and only if $Q \to\iscontr(A)$.
  In other words, $(Q \to\iscontr(A))\eqvsym \iscontr(Q\to A)$.
  For on the one hand, if $Q\to \iscontr(A)$, then $Q\to A$; while any two $f,g:Q\to A$ can be shown equal by function extensionality, since if $Q$ then $A$ is contractible.
  But on the other hand, if $\iscontr(Q\to A)$ and $Q$, then $\eqv{(Q\to A)}{A}$, hence $\iscontr(A)$.

  Note that $Q \to\iscontr(A)$ is also the defining condition for the $\closed Q$-modal types from \cref{eg:closed}.
  That is, the $\open Q$-connected types coincide with the $\closed Q$-modal types.
\end{eg}

The following theorem combines Lemma 7.5.7 and Theorem 7.7.4 of \cite{hottbook}.

\begin{thm}\label{thm:ssrs-characterize}
Given a reflective universe with modal operator $\modal$,
the following are equivalent:
\begin{enumerate}
\item It is $\Sigma$-closed.
\item It is uniquely eliminating.
\item The modal units are $\modal$-connected.
\end{enumerate}
\end{thm}

\begin{proof}
Suppose first that $\modal$ is $\Sigma$-closed, let $X$ be a type and let
$P:\modal X\to\UU_\modal$, i.e.\ $P(x)$ is modal for each $x:\modal X$.
To show that $\modal$ is uniquely eliminating, we want
\begin{equation*}
\lam{s}s\circ\modalunit[X]:(\prd{x:\modal X}P(x))\to(\prd{x:X}P(\modalunit(x)))
\end{equation*}
to be an equivalence. Since the type $\prd{a:A}B(a)$ is equivalent to the type
of functions $f:A\to\sm{a:A}B(a)$ such that $\proj1\circ f=\idfunc[A]$, we
get the desired equivalence if the pre-composition map $\lam{j}j\circ\modalunit$
gives an equivalence from diagonal fillers of the square
\begin{equation*}
\begin{tikzcd}
X \arrow[r,densely dotted] \arrow[d,swap,"\modalunit"] & \sm{x:\modal X}P(x) \arrow[d,"\proj1"] \\
\modal X \arrow[ur,densely dotted,"j"] \arrow[r,equals] & \modal X
\end{tikzcd}
\end{equation*}
to the type of maps $X\to\sm{x:\modal X}P(x)$ such that the indicated square
commutes.  But this is true by the universal property of $\modalunit$, since $\sm{x:\modal X}P(x)$ is modal by $\Sigma$-closedness.

Now suppose that $\modal$ is uniquely eliminating.
To show that the modal units are connected, we want a term of type
\begin{equation*}
\prd{x:\modal X}\iscontr(\modal(\fib{\modalunit}{x})).
\end{equation*}
Using the dependent eliminators, it is easy to find a term
$s:\prd{x:\modal X}\modal(\fib{\modalunit}{x})$ with the property that
$s\circ\modalunit(x)=\modalunit(x,\refl{\modalunit(x)})$. Now we need to show
that
\begin{equation*}
\prd{x:\modal X}{w:\modal(\fib{\modalunit}{x})}w=s(x).
\end{equation*}
Since the type $w=s(x)$ is modal, this is equivalent to
\begin{equation*}
\prd{x:\modal X}{x':X}{p:\modalunit(x')=x} \modalunit(x',p)=s(x).
\end{equation*}
Moreover, the type $\sm{x:\modal X}\modalunit(x')=x$ is contractible, so this
is equivalent to
\begin{equation*}
\prd{x':X} \modalunit(x',\refl{\modalunit(x')})=s(\modalunit(x')),
\end{equation*}
of which we have a term by the defining property of $s$.

Finally, suppose that all the modal units are $\modal$-connected, let $X$ be modal and let $P:X\to\UU_\modal$.
To show that $\sm{x:X}P(x)$ is modal, we show that
$\modalunit:(\sm{x:X}P(x))\to\modal(\sm{x:X}P(x))$ is an equivalence.
Since $X$ is modal, we can extend $\proj 1$ along $\modalunit$ as indicated
in the diagram
\begin{equation*}
\begin{tikzcd}
\sm{x:X}P(x) \arrow[d,"\modalunit"] \arrow[dr,"\proj 1"] \\
\modal(\sm{x:X}P(x)) \arrow[r,densely dotted,swap,"p"] & X
\end{tikzcd}
\end{equation*}
The type of maps
\begin{equation*}
f:\modal(\sm{x:X}P(x))\to \sm{x:X}P(x)
\end{equation*}
such that $\proj1\circ f=p$ is equivalent to the type $\prd{z:\modal(\sm{x:X}P(x))}P(p(z))$.
Using the assumption that $\modalunit$ is connected, we calculate
\begin{align*}
\prd{z:\modal(\sm{x:X}P(x))}P(p(z))
& \eqvsym \prd{z:\modal(\sm{x:X}P(x))} \modal(\fib{\modalunit}{z})\to P(p(z)) \\
& \eqvsym \prd{z:\modal(\sm{x:X}P(x))} \fib{\modalunit}{z}\to P(p(z)) \\
& \eqvsym \prd{\pairr{x,y}:\sm{x:X}P(x)} P(x)
\end{align*}
We have the second projection $\proj 2$ of the latter type. We obtain a term
\begin{equation*}
q : \prd{z:\modal(\sm{x:X}P(x))}P(p(z))
\end{equation*}
such that $q(\eta(x,y))=y$. Therefore, we get the map $\pairr{p,q}:\modal(\sm{x:X}P(x))\to \sm{x:X}P(x)$ for which the diagram
\begin{equation*}
\begin{tikzcd}
\sm{x:X}P(x) \arrow[dr,"\modalunit"] \arrow[ddr,bend right=15,swap,"\proj 1"] \arrow[rr,"\idfunc"] & & \sm{x:X}P(x) \arrow[ddl,bend left=15,"\proj 1"] \\
& \modal(\sm{x:X}P(x)) \arrow[d,swap,"p"] \arrow[ur,densely dotted,"\pairr{p,q}"] \\
& X
\end{tikzcd}
\end{equation*}
commutes. In particular, $\pairr{p,q}$ is a left inverse of the modal unit.
To see that it is also a right inverse, note that $\modalunit\circ\pairr{p,q}\circ\modalunit=\modalunit=\idfunc\circ\modalunit$; thus $\modalunit\circ\pairr{p,q}=\idfunc$ follows by uniqueness.
Hence $\sm{x:X}P(x)$ is modal.
\end{proof}

\begin{thm}\label{thm:sofs_from_ssrs}
A $\Sigma$-closed reflective subuniverse determines a stable orthogonal factorization system with the same
modal types.
\end{thm}

\begin{proof}
Define $\mathcal{L}$ to be the class of $\modal$-connected
maps and $\mathcal{R}$ to be the class of modal maps.
We first show that both $\mathcal{L}$ and $\mathcal{R}$ are closed under
composition. Recall that for $f:X\to Y$ and $g:Y\to Z$, one has
$\fib{g\circ f}{z}=\sm{p:\fib{g}{z}}\fib{f}{\proj1(p)}$.
Thus, by $\Sigma$-closedness, if $f$ and $g$ are both in $\mathcal{R}$ then so is $g\circ f$, so $\cR$ is closed under composition; while \cref{thm:rsu-compose-cancel} implies that $\cL$ is closed under composition.
And since the fibers of an identity map are contractible, and contractible types are both modal and $\modal$-connected, both $\mathcal{L}$ and $\mathcal{R}$ contain all identities.

% Next, we need to show that $\mathcal{L}(f)\land\mathcal{R}(f)\leftrightarrow
% \isequiv(f)$. Since a function is an equivalence if and only if its fibers are
% contractible, and since the contractible types are modal in any reflective
% universe, it follows that $\isequiv(f)\to\mathcal{L}(f)\land\mathcal{R}(f)$.
% Now suppose that $f$ is in $\mathcal{L}$ and in $\mathcal{R}$. Then its fibers
% are modal, and the modal operator applied to its fibers results in a contractible
% type, so it is an equivalence.

To obtain a factorization system,
it remains to show that the type of
$(\mathcal{L},\mathcal{R})$-factorizations of any function $f$ is contractible.
Since $\pairr{X,f}=\pairr{\sm{y:Y}\fib{f}{y},\proj1}$, it is sufficient to
show that $\fact_{\mathcal{L},\mathcal{R}}(\proj1)$ is contractible for any
$\proj1:\sm{y:Y}P(y)\to Y$. But $\proj1$ factors as
\begin{equation*}
\begin{tikzcd}
\sm{y:Y}P(y) \arrow[r,"p_\mathcal{L}"] & \sm{y:Y}\modal(P(y)) \arrow[r,"p_\mathcal{R}"] & Y
\end{tikzcd}
\end{equation*}
where $p_\mathcal{L}\defeq\total{\modalunit[P(\blank)]}$ and $p_\mathcal{R}\defeq\proj1$.
The fibers of $p_\mathcal{R}$ are $\modal(P(\blank))$, so it follows
immediately that $p_\mathcal{R}$ is in $\mathcal{R}$.
Moreover, since
$\eqv{\fib{\total{\modalunit}}{\pairr{y,u}}}{\fib{\modalunit[P(y)]}{u}}$ and each $\modalunit$ is $\modal$-connected, it follows that $p_\mathcal{L}$ is in
$\mathcal{L}$.

Now consider any other factorization $(g,h,H)$ of $\proj1$ into
an $\cL$-map $g:(\sm{y:Y}P(y))\to I$ followed by an $\cR$-map $h:I\to Y$. Since
$I=\sm{y:Y}\fib{h}{y}$, we have a commuting square
\begin{equation*}
\begin{tikzcd}
\sm{y:Y}P(y) \arrow[r,"g"] \arrow[d,swap,"{\total{\gamma}}"]
  & I \arrow[d,"h"] \\
\sm{y:Y}\fib{h}{y} \arrow[ur,equals] \arrow[r,swap,"\proj1"] & Y
\end{tikzcd}
\end{equation*}
in which $\gamma(y,u)\defeq \pairr{g(y,u),H(y,u)}$.
It follows that $(g,h,H)=(\total{\gamma},\proj1,\nameless)$.
Thus suffices to show that there is a commuting triangle
\begin{equation*}
\begin{tikzcd}[column sep=0]
& P(y) \arrow[dl,swap,"\modalunit"] \arrow[dr,"{\gamma_y}"] \\
\modal(P(y)) \arrow[rr,equals] & & \fib{h}{y}
\end{tikzcd}
\end{equation*}
We will do this using \cref{lem:reflective_uniqueness}, by showing that $\gamma_y$ has the same universal property as $\modalunit[P(y)]$.
This follows from the following calculation:
\begin{align*}
(\fib{h}{y}\to Z) & \eqvsym ((\sm{w:\fib{h}{y}}\modal(\fib{g}{\proj1(w)}))\to Z) \\
& \eqvsym ((\sm{w:\fib{h}{y}}\fib{g}{\proj1(w)})\to Z) \\
& \eqvsym (\fib{h\circ g}{y}\to Z) \\
& \eqvsym (P(y)\to Z).
\end{align*}
which we can verify is given by precomposition with $\gamma_y$.

It remains to show that our orthogonal factorization system is stable. Consider a pullback diagram
\begin{equation*}
\begin{tikzcd}
A' \arrow[d,swap,"k"] \arrow[r,"f"] & A \arrow[d,"l"] \\
B' \arrow[r,swap,"g"] & B
\end{tikzcd}
\end{equation*}
in which $l$ is in $\mathcal{L}$. By the pasting lemma for pullbacks, it
follows that $\fib{k}{b}=\fib{l}{g(b)}$ for each $b:B'$. Thus, it follows that
$k$ is in $\mathcal{L}$.
\end{proof}

\subsection{Stable orthogonal factorization systems}

To complete \cref{sec:modal-refl-subun}, we will show that stable orthogonal factorization systems are also determined by their modal types, and give rise to higher modalities.

\subsubsection{Orthogonal factorization systems}

In classical category theory, orthogonal factorization systems are equivalently characterized by a unique lifting property.
We begin with the analogue of this in our context.

\begin{defn}
Let $(\mathcal{L},\mathcal{R})$ be an orthogonal factorization system, and
consider a commutative square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f"] \arrow[d,swap,"l"] \ar[dr,phantom,"\scriptstyle S"] & X \arrow[d,"r"] \\
B \arrow[r,swap,"g"] & Y
\end{tikzcd}
\end{equation*}
(i.e.\ paths $S : r\circ f = g\circ l$)
for which $l$ is in $\mathcal{L}$ and $r$ is in $\mathcal{R}$. We define
$\fillers S$ to be the type of \define{diagonal fillers}
of the above diagram, i.e.~the type of tuples $(j,H_f,H_g,K)$ consisting of
$j:B\to X$, $H_f:j\circ l=f$ and $H_g:r\circ j=g$ and an equality $K : r\circ H_f = \ct S{(H_g \circ l)}$.
\end{defn}

\begin{lem}\label{lem:diagonal_fillers}
Let $(\mathcal{L},\mathcal{R})$ be an orthogonal factorization system, and
consider a commutative square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f"] \arrow[d,swap,"l"] \ar[dr,phantom,"\scriptstyle S"] & X \arrow[d,"r"] \\
B \arrow[r,swap,"g"] & Y
\end{tikzcd}
\end{equation*}
for which $l$ is in $\mathcal{L}$ and $r$ is in $\mathcal{R}$. Then the type
$\fillers S$ of diagonal fillers is contractible.
\end{lem}

\begin{proof}
By the fact that every morphism factors uniquely as a left map followed by a
right map, we may factorize $f$ and $g$ in $(\mathcal{L},\mathcal{R})$ as $H_f : f = f_\cR \circ f_\cL$ and $H_g : g = g_\cR \circ g_\cL$, obtaining the diagram
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f_{\mathcal{L}}"] \arrow[d,swap,"l"] & \im(f) \arrow[r,"f_{\mathcal{R}}"] & X \arrow[d,"r"] \\
B \arrow[r,swap,"g_{\mathcal{L}}"] & \im(g) \arrow[r,swap,"g_{\mathcal{R}}"] & Y
\end{tikzcd}
\end{equation*}
Now both $(r\circ f_{\mathcal{R}})\circ f_{\mathcal{L}}$ and
$g_{\mathcal{R}}\circ(g_{\mathcal{L}}\circ l)$ are factorizations
of the same function $r\circ f:A\to Y$.
Since $\fact_{\mathcal{L},\mathcal{R}}(r\circ f)$ is contractible, so is its identity type
\[ (\im(f), f_\cL, r\circ f_\cR, r\circ H_f) = (\im(g), g_\cL \circ l, g_\cR, \ct{S}{(H_g\circ l)}). \]
This identity type is equivalent to
\begin{multline*}
\sm{e:\im(f) \simeq \im(g)}{H_\cL : g_\cL \circ l = e\circ f_\cL}{H_\cR : r\circ f_\cR = g_\cR\circ e}\\
(\ct{(r\circ H_f)}{(H_\cR \circ f_\cL)} = \ct S{\ct{(H_g \circ l)}{(g_\cR \circ H_\cL)}})
\end{multline*}
Now since $\fact_{\cL,\cR}(f)$ and $\fact_{\cL,\cR}(g)$ are also contractible, we can sum over them to get that the following type is contractible:
\begin{multline*}
  \sm{\im(f):\UU}{f_\cL : A \to \im(f)}{f_\cR : \im(f) \to X}{H_f : f = f_\cR \circ f_\cL}\\
  \sm{\im(g):\UU}{g_\cL : B \to \im(g)}{g_\cR : \im(g) \to Y}{H_g : g = g_\cR \circ g_\cL}\\
\sm{e:\im(f) \simeq \im(g)}{H_\cL : g_\cL \circ l = e\circ f_\cL}{H_\cR : r\circ f_\cR = g_\cR\circ e}\\
(\ct{(r\circ H_f)}{(H_\cR \circ f_\cL)} = \ct S{\ct{(H_g \circ l)}{(g_\cR \circ H_\cL)}})
\end{multline*}
(omitting the hypotheses that $f_\cL,g_\cL\in\cL$ and $f_\cR,g_\cR\in\cR$).
Reassociating and removing the contractible type $\sm{\im(g):\UU}(\im(f) \simeq \im(g))$, and renaming $\im(f)$ as simply $I$, this is equivalent to
\begin{multline*}
  \sm{I:\UU}{f_\cL : A \to I}{f_\cR : I \to X}{H_f : f = f_\cR \circ f_\cL}\\
  \sm{g_\cL : B \to I}{g_\cR : I \to Y}{H_g : g = g_\cR \circ g_\cL}{H_\cL : g_\cL \circ l = f_\cL}{H_\cR : r\circ f_\cR = g_\cR}\\
(\ct{(r\circ H_f)}{(H_\cR \circ f_\cL)} = \ct S{\ct{(H_g \circ l)}{(g_\cR \circ H_\cL)}})
\end{multline*}
Removing the contractible $\sm{f_\cL : A \to I} (g_\cL \circ l = f_\cL)$ and $\sm{g_\cR : I \to Y} (r\circ f_\cR = g_\cR)$, this becomes
\begin{multline*}
  \sm{I:\UU}{f_\cR : I \to X}{g_\cL : B \to I}{H_f : f = f_\cR \circ g_\cL \circ l}{H_g : g = r\circ f_\cR \circ g_\cL}\\
(r\circ H_f = \ct S{(H_g \circ l)})
\end{multline*}
Inserting a contractible $\sm{j:B\to X} (f_\cR \circ g_\cL = j)$, and reassociating more, we get
\begin{multline*}
  \sm{j:B\to X}{I:\UU}{f_\cR : I \to X}{g_\cL : B \to I}{H_j:f_\cR \circ g_\cL = j}\\
  \sm{H_f : f = f_\cR \circ g_\cL \circ l}{H_g : g = r\circ f_\cR \circ g_\cL}
  (r\circ H_f = \ct S{(H_g \circ l)})
\end{multline*}
But now $\sm{I:\UU}{f_\cR : I \to X}{g_\cL : B \to I}{H_j:f_\cR \circ g_\cL = j}$ is just $\fact_{\cL,\cR}(j)$, hence contractible.
Removing it, we get
\begin{equation*}
  \sm{j:B\to X}{H_f : f = j \circ l}{H_g : g = r\circ j}(r\circ H_f = \ct S{(H_g \circ l)})
\end{equation*}
which is just $\fillers S$.
Therefore, this is also contractible.
\end{proof}

\begin{defn}\label{defn:orthogonal}
For any class $\mathcal{C}:\prd*{A,B:\UU}(A\to B)\to\prop$ of maps, we define
\begin{enumerate}
\item $^{\bot}\mathcal{C}$ to be the class of maps with \define{(unique) left lifting
property} with respect to all maps in $\mathcal{C}$: the mere proposition
$^\bot\mathcal{C}(l)$ asserts that for every commutative square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f"] \arrow[d,swap,"l"] \ar[dr,phantom,"S"] & X \arrow[d,"r"] \\
B \arrow[r,swap,"g"] & Y
\end{tikzcd}
\end{equation*}
with $r$ in $\mathcal{C}$, the type $\fillers S$ of diagonal fillers is contractible.
\item $\mathcal{C}^\bot$ to be the class of maps with the dual \define{(unique) right lifting
property} with respect to all maps in $\mathcal{C}$.
\end{enumerate}
\end{defn}

\begin{lem}\label{lem:ofs_lifting}
In an orthogonal factorization system $(\mathcal{L},\mathcal{R})$, one has
$\mathcal{L}={^\bot\mathcal{R}}$ and $\mathcal{L}^\bot=\mathcal{R}$.
\end{lem}

\begin{proof}
We first show that $\mathcal{L}={^\bot\mathcal{R}}$, i.e.~we show that
$\mathcal{L}(f)\leftrightarrow {^\bot\mathcal{R}}(f)$ for any map $f$. Note
that the implication $\mathcal{L}(f)\to {^\bot\mathcal{R}}(f)$ follows from
\autoref{lem:diagonal_fillers}.

Let $f:A\to B$ be a map in ${^\bot\mathcal{R}}$.
We wish to show that $\mathcal{L}(f)$. Consider the factorization
$(f_{\mathcal{L}},f_{\mathcal{R}})$ of $f$. Then the square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f_{\mathcal{L}}"] \arrow[d,swap,"f"] & \mathsf{im}_{\mathcal{L},\mathcal{R}}(f) \arrow[d,"f_{\mathcal{R}}"] \\
B \arrow[r,swap,"\idfunc"] & B
\end{tikzcd}
\end{equation*}
commutes. Since $f$ has the left lifting property, the type of diagonal fillers
of this square is contractible. Thus we have a section $j$ of $f_{\mathcal{R}}$.
The map $j\circ f_\mathcal{R}$ is then a diagonal filler of the square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f_{\mathcal{L}}"] \arrow[d,swap,"f_{\mathcal{L}}"] & \mathsf{im}_{\mathcal{L},\mathcal{R}}(f) \arrow[d,"f_{\mathcal{R}}"] \\
\mathsf{im}_{\mathcal{L},\mathcal{R}}(f) \arrow[r,swap,"f_{\mathcal{R}}"] & B
\end{tikzcd}
\end{equation*}
Of course, the identity map $\idfunc[\mathsf{im}_{\mathcal{L},\mathcal{R}}(f)]$
is also a diagonal filler for this square, so the fact that the type of
such diagonal fillers is contractible implies that $j\circ f_{\mathcal{R}}=\idfunc$.
Thus, $j$ and $f_\cR$ are inverse equivalences, and so the pair $(B,f)$ is equal to the pair $(\mathsf{im}_{\mathcal{L},\mathcal{R}}(f),f_\cL)$.
Hence $f$, like $f_\cL$, is in $\cL$.

Similarly, \autoref{lem:diagonal_fillers} also implies that $\mathcal{R}(f)\to \mathcal{L}^\bot(f)$
for any map $f$, while we can prove $\mathcal{L}^\bot(f)\to\mathcal{R}(f)$ analogously to ${^\bot\mathcal{R}}(f)\to\mathcal{L}(f)$.
\end{proof}

\begin{cor}\label{lem:sofs_req}
The data of two orthogonal factorization systems $(\mathcal{L},\mathcal{R})$ and
$(\mathcal{L}',\mathcal{R}')$ are identical if and only if
$\mathcal{R}=\mathcal{R}'$.
\end{cor}
\begin{proof}
  ``Only if'' is obvious.
  Conversely, if $\mathcal{R}=\mathcal{R}'$, then by \cref{lem:ofs_lifting} we have $\cL = \cL'$, and the remaining data of an orthogonal factorization system is a mere proposition.
\end{proof}

\begin{comment}
\begin{lem}[Unfinished]
For each $l:X\to Y$ such that $\mathcal{L}(l)$ and each type $Z$, the function
\begin{equation*}
\lam{g} g\circ l: (\sm{g:Y\to Z}\mathcal{R}(g))\to(\sm{f:X\to Z}\mathcal{R}(f))
\end{equation*}
is a monomorphism. Also, for each $r:X\to Y$ such that $\mathcal{R}(r)$ and
each type $Z$, the function
\begin{equation*}
\lam{f} r\circ f : (\sm{f:Z\to X}\mathcal{L}(f))\to(\sm{g:Z\to Y}\mathcal{L}(g))
\end{equation*}
is a monomorphism.
\end{lem}

\begin{proof}
We prove the first statement. Suppose $g,g':Y\to Z$ are two $\mathcal{R}$-maps
such that $H:g\circ l=f$ and $H':g'\circ l=f$. Then we obtain two  ...
\end{proof}
\end{comment}

\begin{comment}
\begin{thm}
From every orthogonal factorization system we obtain a reflective subcategory with the same modal types.
\end{thm}

\begin{proof}
We define $P(A)$ to be the proposition that the unique map $A\to\unit$ is in
$\mathcal{R}$.
For any type $A$, there is a unique factorization
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"{\modalunit[A]}"] & \modal A \arrow[r] & \unit
\end{tikzcd}
\end{equation*}
of the unique map $A\to\unit$, where $\modalunit[A]$ is in $\mathcal{L}$. This
defines the operation $\modal$ and the modal units.

Now let $A:\UU$ and $B:\UU_P$, and consider $f:A\to B$. We have to show that
the type of extensions of $f$ along $\modalunit$ is contractible.
It is immediate that the type of such extensions is equivalent to the type
$\mathsf{fill}_{\mathcal{L},\mathcal{R}}(f,g)$ of diagonal fillers
of the square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"f"] \arrow[d,swap,"{\modalunit[A]}"] & B \arrow[d] \\
\modal A \arrow[r,swap,"g"] & \unit
\end{tikzcd}
\end{equation*}
By \autoref{lem:diagonal_fillers}, the assumption that $P(B)$ holds and the fact that $\modalunit[A]$ is
in $\mathcal{L}$, we know that this type of diagonal fillers is contractible.
\end{proof}
\end{comment}

\begin{lem}\label{lem:ofs_rightstable}
Let $(\mathcal{L},\mathcal{R})$ be an orthogonal factorization system. Then
the class $\mathcal{R}$ is stable under pullbacks.
\end{lem}

\begin{proof}
Consider a pullback diagram
\begin{equation*}
\begin{tikzcd}
A \arrow[d,swap,"k"] \arrow[r,"g"] & X \arrow[d,"h"] \\
B \arrow[r,swap,"f"] & Y
\end{tikzcd}
\end{equation*}
where $h:X\to Y$ is assumed to be in $\mathcal{R}$, and let $k=k_{\mathcal{R}}\circ k_\mathcal{L}$ be a factorization of $h$.
Then the outer rectangle in the diagram
\begin{equation*}
\begin{tikzcd}
A \arrow[r,equals] \arrow[d,swap,"k_{\mathcal{L}}"] & A \arrow[d,swap,"k"] \arrow[r,"g"] & X \arrow[d,"h"] \\
\im_{\mathcal{L},\mathcal{R}}(k) \arrow[r,swap,"k_{\mathcal{R}}"] & B \arrow[r,swap,"f"] & Y
\end{tikzcd}
\end{equation*}
commutes, so by the universal property of pullbacks we obtain a unique map $j:\im_{\mathcal{L},\mathcal{R}}(k)\to A$ such that $j\circ k_{\mathcal{L}}=\idfunc$ and $k\circ j=k_{\mathcal{R}}$.
It suffices to show that $k_{\mathcal{L}}$ is an equivalence, and since we already have that $j\circ k_{\mathcal{L}}=\idfunc$ we only need to show that $k_{\mathcal{L}}\circ j=\idfunc$.

We do this using the contractibility of the type of diagonal fillers. Consider the square
\begin{equation*}
\begin{tikzcd}
A \arrow[r,"k_{\mathcal{L}}"] \arrow[d,swap,"k_{\mathcal{L}}"] & \im_{\mathcal{L},\mathcal{R}}(k) \arrow[d,"k_{\mathcal{R}}"] \\
\im_{\mathcal{L},\mathcal{R}}(k) \arrow[r,swap,"k_{\mathcal{R}}"] & B,
\end{tikzcd}
\end{equation*}
for which $\idfunc:\im_{\mathcal{L},\mathcal{R}}(k)\to \im_{\mathcal{L},\mathcal{R}}(k)$ (with the trivial homotopies) is a diagonal filler. However, we also have the homotopies $k_{\mathcal{L}}\circ j\circ k_{\mathcal{L}} \htpy k_{\mathcal{L}}$ and $k_{\mathcal{R}}\circ k_{\mathcal{L}}\circ j\htpy k\circ j\htpy k_{\mathcal{R}}$. This shows that we have a second diagonal filler, of which the underlying map is $k_{\mathcal{L}}\circ j$. Since the type of diagonal fillers is contractible, it follows that $k_{\mathcal{L}}\circ j=\idfunc$, as desired.
\end{proof}

\subsubsection{Stable orthogonal factorization systems}

\begin{lem}\label{lem:fill_compute}
Given $l,r,f,g$ and a homotopy $S : r \circ f = g  \circ l$, consider as $b:B$ varies all the diagrams of the form
\begin{equation*}
\begin{tikzcd}
\fib{l}{b} \arrow[r,"i_b"] \arrow[d,"!"'] & A \arrow[d,swap,"l"] \arrow[r,"f"] \ar[dr,phantom,"S"] & X \arrow[d,"r"] \\
\unit \arrow[r,swap,"b"] & B \arrow[r,swap,"g"] & Y
\end{tikzcd}
\end{equation*}
and write $S_b : r \circ (f \circ i_b) = (g\circ b) \circ \mathord !$ for the induced commutative square.
(Note that the square on the left commutes judgmentally.)
Then the map
\begin{equation*}
\fillers{S} \to \prd{b:B}\fillers{S_b},
\end{equation*}
defined by precomposition with $b$, is an equivalence.
\end{lem}

\begin{proof}
It suffices to show that the map on total spaces
\begin{equation}
  \Big(\sm{S:r\circ f = g\circ l} \fillers{S}\Big) \to \Big( \sm{S:r\circ f = g\circ l} \prd{b:B}\fillers{S_b}\Big)\label{eq:fill-total}
\end{equation}
is an equivalence.
The domain of~\eqref{eq:fill-total} can be computed as
\begin{align*}
  &\hspace{-1cm}\sm{S:r\circ f = g\circ l}{j:B\to X}{H_f :j\circ l=f}{H_g:r\circ j=g} \ct{(r\circ H_f)}{(H_g\circ l)^{-1}} = S\\
  &\eqvsym \sm{j:B\to X}(j\circ l=f)\times (r\circ j=g)
\end{align*}
by contracting a based path space.
On the other hand, note that
\begin{align*}
  (r\circ f = g\circ l)
  &\eqvsym
  \prd{a:A} r(f(a)) = g(l(a))\\
  &\eqvsym
  \prd{a:A}{b:B}{l(a)=b} r(f(a)) = g(l(a))\\
  &\eqvsym
  \prd{b:B}{u:\fib l b} r(f(i_b(a))) = g(l(i_b(a)))\\
  &\eqvsym
  \prd{b:B}{u:\fib l b} r(f(i_b(a))) = g(b)\\
  &\eqvsym
  \prd{b:B} (r \circ (f \circ i_b) = (g\circ b) \circ \mathord !)
\end{align*}
That is, to give $S$ is the same as to give each $S_b$.
Thus the codomain of~\eqref{eq:fill-total} can be computed as
\begin{align*}
  &\hspace{-1cm}\sm{S:r\circ f = g\circ l} \prd{b:B}\fillers{S_b}\\
  &\eqvsym \sm{S:\prd{b:B} (r \circ (f \circ i_b) = (g\circ b) \circ \mathord !)} \prd{b:B}\fillers{S_b}\\
  &\eqvsym \prd{b:B}\sm{S_b:r \circ (f \circ i_b) = (g\circ b) \circ \mathord !} \fillers{S_b}\\
  &\eqvsym \prd{b:B}\sm{j_b:\unit\to X}(j_b=f\circ i_b)\times (r\circ j_b=g(b))
\end{align*}
using the same argument as above for $S$.
Now we can compute
\begin{align*}
&\hspace{-1cm}\prd{b:B}\sm{j_b:\unit\to X}(j_b=f\circ i_b)\times(r\circ j_b=g\circ b) \\
& \eqvsym
\prd{b:B}\sm{j_b:X}(\lam{x}j_b=f\circ i_b)\times(r(j_b)=g(b)) \\
& \eqvsym
\sm{j:B\to X}\prd{b:B}(\lam{\nameless}j(b)=f\circ i_b)\times(r(j(b))=g(b)) \\
& \eqvsym
\sm{j:B\to X}(\prd{b:B}\lam{\nameless}j(b)=f\circ i_b)\times(\prd{b:B}r(j(b))=g(b)) \\
& \eqvsym
\sm{j:B\to X}(\prd{b:B}\lam{\nameless}j(b)=f\circ i_b)\times(r\circ j=g) \\
& \eqvsym
\sm{j:B\to X}(\prd{b:B}\prd{a:A}{p:l(a)=b}j(b)=f(a))\times(r\circ j=g) \\
& \eqvsym
\sm{j:B\to X}(\prd{a:A}j(l(a))=f(a))\times(r\circ j=g) \\
& \eqvsym
\sm{j:B\to X}(j\circ l=f)\times(r\circ j=g)
\end{align*}
which is what we computed as the domain of~\eqref{eq:fill-total} above.
\end{proof}

\begin{cor}
In any orthogonal factorization system
$(\mathcal{L},\mathcal{R})$, if
$l:A\to B$ is a map such that $\fib{l}{b} \to \unit$ is in $\cL$ for each $b:B$, then also $l$ itself is in $\cL$.
\end{cor}
\begin{proof}
  By \cref{lem:ofs_lifting}, $l$ is in $\cL$ iff $\fillers S$ is contractible for each $r\in\cR$ and $S$ as in \cref{lem:fill_compute}, while similarly $\fib{l}{b} \to \unit$ is in $\cL$ iff $\fillers {S_b}$ is contractible.
  But the product of contractible types is contractible.
\end{proof}

\begin{cor}\label{thm:detect-right-by-fibers}
  In any stable orthogonal factorization system, if $l\perp r$ for all maps $l\in\cL$ of the form $l:A\to \unit$, then $r\in\cR$.
  In particular, for any modality $\modal$, if $X\to (A\to X)$ is an equivalence for all $\modal$-connected types $A$, then $X$ is modal.
\end{cor}
\begin{proof}
  By \cref{lem:fill_compute}, for any $l\in\cL$ and commutative square $S$ from $l$ to $r$, we have $\fillers{S} \eqvsym \prd{b:B}\fillers{S_b}$.
  Since $(\cL,\cR)$ is stable, each map $\mathord{!}_b:\fib{l}{b}\to \unit$ is also in $\cL$, so that $\mathord{!}_b\perp r$ by assumption.
  Thus $\fillers{S_b}$ is contractible for all $b$, hence so is $\fillers{S}$.

  For the second statement, the type $f:A\to X$ is equivalent to the type of commutative squares
  \[
  \begin{tikzcd}
    A \ar[r,"f"] \ar[d] & X \ar[d] \\ \unit\ar[r] & \unit
  \end{tikzcd}
  \]
  and the type of fillers for such a square is equivalent to the type of $x:X$ such that $f(a) = x$ for all $a:A$, i.e.\ the fiber of $X\to (A\to X)$ over $f$.
  Thus, the assumption ensures that all such types of fillers are contractible, i.e.\ $l\perp r$ for all $\modal$-connected maps of the form $l:A\to \unit$, so the first statement applies.
\end{proof}

\begin{lem}\label{lem:sofs_rfib}
Let $(\mathcal{L},\mathcal{R})$ be a stable orthogonal factorization system.
Then a map $r:X\to Y$ is in $\mathcal{R}$ if and only if $\fib{r}{y}$
is $(\mathcal{L},\mathcal{R})$-modal for each $y:Y$.
\end{lem}

\begin{proof}
The class of right maps is stable under pullbacks by \autoref{lem:ofs_rightstable},
so it suffices to show that any map with modal fibers is in $\mathcal{R}$.

Let $r:X\to Y$ be a map with modal fibers. Our goal is to show that
$r$ is in $\mathcal{R}$. By \autoref{lem:ofs_lifting} it suffices to show that
$r$ has the right lifting property with respect to the left maps.
Consider a diagram of the form
\begin{equation*}
\begin{tikzcd}
A \arrow[d,swap,"l"] \arrow[r,"f"] & X \arrow[d,"r"] \\
B \arrow[r,swap,"g"] & Y
\end{tikzcd}
\end{equation*}
in which $l$ is a map in $\mathcal{L}$.
We wish to show that the type of diagonal fillers is contractible.
By \autoref{lem:fill_compute}, the type of diagonal fillers of the above diagram
is equivalent to the dependent product of the types of fillers of
\begin{equation*}
\begin{tikzcd}
\fib{l}{b} \arrow[d] \arrow[r,"f\circ i_b"] & X \arrow[d,"r"] \\
\unit \arrow[r,swap,"g(b)"] & Y
\end{tikzcd}
\end{equation*}
indexed by $b:B$. Thus, it suffices that the type of diagonal fillers for this
square is contractible for each $b:B$. Since any filler factors uniquely through
the pullback $\unit\times_Y X$, which is $\fib{r}{g(b)}$, the type of diagonal
fillers of the above square is equivalent to the type of diagonal fillers of the
square
\begin{equation*}
\begin{tikzcd}
\fib{l}{b} \arrow[d] \arrow[r,densely dotted] & \fib{r}{g(b)} \arrow[d] \\
\unit \arrow[r,equals] & \unit
\end{tikzcd}
\end{equation*}
where the dotted map, is the unique map into the pullback $\fib{r}{g(b)}$. In
this square, the left map is in $\mathcal{L}$ because $\mathcal{L}$ is assumed
to be stable under pullbacks, and the right map is in $\mathcal{R}$ by assumption,
so the type of diagonal fillers is contractible.
\end{proof}

\begin{thm}\label{thm:subuniv-sofs}
Any two stable orthogonal factorization systems with the same modal types are
equal.
\end{thm}

\begin{proof}
By \autoref{lem:sofs_req} it follows that any orthogonal factorization system
is completely determined by the class of right maps.
By \autoref{lem:sofs_rfib} it follows that in a stable orthogonal factorization
system, the class of right maps is completely determined by the modal types.
\end{proof}

\begin{thm}\label{thm:highermod_from_sofs}
Any stable orthogonal factorization system determines a higher modality with
the same modal types.
\end{thm}

\begin{proof}
For every type $X$ we have the $(\cL,\cR)$-factorization $X\to\modal X\to\unit$ of the
unique map $X\to\unit$. This determines the modal unit
$\modalunit:X\to\modal X$ which is in $\mathcal{L}$, and the
unique map $\modal X\to\unit$ is in $\mathcal{R}$, i.e.\ $\modal X$ is $(\cL,\cR)$-modal.

To show the induction principle, let $P:\modal X\to\UU$ and $f:\prd{x:X} \modal(P(\eta(x)))$.
Then we have a (judgmentally) commutative square
\begin{equation*}
\begin{tikzcd}
X \arrow[r,"f"] \arrow[d,swap,"\modalunit"] & \sm{x:\modal X}\modal(P(x)) \arrow[d,"\proj1"] \\
\modal X \arrow[r,equals] & \modal X.
\end{tikzcd}
\end{equation*}
Note that by \autoref{lem:sofs_rfib},
the projection $\proj1:(\sm{x:\modal X}\modal(P(x)))\to\modal X$ is in $\mathcal{R}$
because its fibers are modal. Also, the modal unit
$\modalunit:X\to\modal X$ is in $\mathcal{L}$.
Thus, by \cref{defn:orthogonal}, the type of fillers of this square is contractible.
Such a filler consists of a function $s$ and homotopies filling the two triangles
\begin{equation*}
\begin{tikzcd}
X \arrow[r,"f"] \arrow[d,swap,"\modalunit"] & \sm{x:\modal X}\modal(P(x)) \arrow[d,"\proj1"] \\
\modal X \arrow[r,equals] \arrow[ur,densely dotted] & \modal X
\end{tikzcd}
\end{equation*}
whose composite is reflexivity, i.e.\ the type
\begin{multline*}
\sm{s:\modal X \to \sm{x:\modal X}\modal(P(x))}{H:\prd{x:\modal X} \proj1(s(x))=x}{K:\prd{x:X} s(\modalunit(x))=f(x)}\\
\prd{x:X} \proj1(K(x)) = H(\modalunit(x)).
\end{multline*}
If we decompose $s$, $f$, and $K$ by their components, we get
\begin{multline*}
\sm{s_1:\modal X \to \modal X}{s_2:\prd{x:\modal X} \modal(P(s_1(x)))}{H:\prd{x:\modal X} s_1(x)=x}\\
\sm{K_1:\prd{x:X} s_1(\modalunit(x))=f_1(x)}{K_2 :\prd{x:X} s_2(\modalunit(x)) =_{K_1(x)} f_2(x)}\\
\prd{x:X} K_1(x) = H(\modalunit(x)).
\end{multline*}
Now we can contract $s_1$ and $H$, and also $K_1$ with the final unnamed homotopy, to get
\begin{equation*}
\sm{s_2:\prd{x:\modal X} \modal(P(x))}  \prd{x:X} s_2(\modalunit(x)) =_{K_1(x)} f_2(x).
\end{equation*}
But this is just the type of extensions of $f$ along $\modalunit$, i.e.\ the fiber of precomposition by $\modalunit$.
Thus, precomposition by $\modalunit$ is an equivalence, so in fact that we have a uniquely eliminating modality.
By \cref{lem:rs_idstable}, the identity types of $\modal X$ are modal, so we have a higher modality as well.
\end{proof}

\section{Accessible reflective subuniverses}\label{sec:accessible}

\begin{defn}
Given a family $f:\prd{i:I}A_i\to B_i$ of maps, a type $X$ is said to be \define{$f$-local} if the precomposition map
\begin{equation*}
\precomp{f_i}:(B_i\to X)\to (A_i\to X)
\end{equation*}
is an equivalence, for each $i:I$. The family $f$ is said to be a \define{presentation} of a reflective subuniverse $L$ if the subuniverses of $f$-local types and $L$-local types coincide. A reflective subuniverse is said to be \define{accessible} if there exists a presentation for it.
\end{defn}

In \cite{RijkeShulmanSpitters} it is shown that the subuniverse of $f$-local types is always a reflective subuniverse, provided that sufficiently many higher inductive types are available. However, it is not clear whether their construction is possible in our current setting, where the only higher inductive types that are assumed to exist are homotopy pushouts. In this section we will establish general properties of accessible reflective subuniverses. We will show in \cref{chap:compact} that for any family $f$ of maps between \emph{compact} types, the subuniverse of $f$-local types is indeed reflective.

\begin{rmk}
Note that being accessible is structure; different families can present the same reflective subuniverse or modality.
As a trivial example, note that localizing at the empty
type, and localizing at the type family on $\bool$ defined by
$\bfalse\mapsto \emptyt$ and $\btrue\mapsto \unit$ both map all types to contractible types.

However, we are usually only interested in properties of presentations insofar as they determine properties of subuniverses.
For instance, by \cref{thm:acc-modal}, a reflective subuniverse is a modality exactly when it has a presentation in which each $C(a)=\unit$.
\end{rmk}

\begin{eg}\label{thm:trunc-acc}
The trivial modality $\truncf{(-2)}$ is presented by $\emptyt$, while the propositional truncation modality $\truncf{(-1)}$ is presented by $\bool$.  More generally, the
$n$-truncation modality $\truncf{n}$ is presented by the $(n+1)$-sphere $\Sn^{n+1}$.
\end{eg}

\begin{eg}\label{thm:open-acc}
For every mere proposition $P$, the open modality $\open P (X) \defeq (P\to X)$ from \cref{eg:open} is
presented by the singleton type family $P$.
To see this, note that $\modalunit[X] : X \to (P\to X)$ is the same as the map in the definition of locality, so that $X$ is modal for the open modality on $P$ if and only if it is $P$-local.
(If $P$ is not a mere proposition, however, then $X\mapsto (P\to X)$ is not a modality, and in particular does not coincide with localization at $P$.)
\end{eg}

\begin{eg}\label{thm:closed-acc}
  The closed modality $\closed P$ from \cref{eg:closed} associated to a mere proposition $P$ is presented by the type family $\lam{x} \emptyt : P \to \UU$.
  For by definition, $A$ is null for this family if and only if for any $p:P$ the map $A \to (\emptyt \to A)$ is an equivalence.
  But $\emptyt \to P$ is contractible, so this says that $P\to\iscontr(A)$, which was the definition of $\closed P$-modal types from \cref{eg:closed}.
\end{eg}

\begin{lem}\label{lemma:characterizationsigmaflocal}
    Let $f:\prd{i:I}A_i\to B_i$ be a family of maps. Denote the family consisting of the suspensions
    of the functions by $\susp{f} : \prd{i:I} \susp{A_i} \to \susp{B_i}$.
    A type $X$ is $\suspsym f$-local if and only if for every $x,y : X$, the type
    $x =_X y$ is $f$-local.
    In other words, $L_{\susp{f}} = (L_{f})'$.
\end{lem}

\begin{proof}
    By the induction principle for suspension and naturality, we obtain for each $i : I$ a commutative square
\[
  \begin{tikzcd}
    (\susp{B_i} \to X) \arrow[r,"\simeq"] \arrow[d] & \left( \sm{x,y:X} (B_i \to x = y) \right) \arrow[d] \\
    (\susp{A_i} \to X) \arrow[r,"\simeq"] & \left( \sm{x,y:X} (A_i \to x = y) \right)
  \end{tikzcd}
\]
in which the horizontal maps are equivalences.
So $X$ is $\suspsym f$-local if and only if the right vertical map is an equivalence
for every $i : I$, if and only if for each $x,y : X$, the type $x = y$ is $f_i$-local
for every $i : I$.
\end{proof}

A general localization is only a reflective subuniverse, but there is a convenient sufficient condition for it to be a modality: if each $C(a)=\unit$.
A localization modality of this sort is called \emph{nullification}.

\begin{thm}\label{thm:nullification_modality}
  If $F:\prd{a:A} B(a) \to C(a)$ is such that each $C(a)=\unit$, then localization at $F$ is a modality, called \define{nullification at $B$}.
\end{thm}
\begin{proof}
  It suffices to show that for any $B:A\to\UU$, the $B$-null types are $\Sigma$-closed.
  Thus, let $X:\UU$ and $Y:X\to \UU$ be such that $X$ and each $Y(x)$ are $B$-null.
  Then
  \begin{align*}
    (B\to \sm{x:X} Y(x))
    &\eqvsym \sm{g:B\to X} \prd{b:B} Y(g(b)) \\
    &\eqvsym \sm{x:X} B \to Y(x) \\
    &\eqvsym \sm{x:X} Y(x)
  \end{align*}
  with the inverse equivalence being given by constant maps.
  Thus, $\sm{x:X} Y(x)$ is $B$-null.
\end{proof}

Of course, it might happen that $\localization{F}$ is a modality even if $F$ doesn't satisfy the condition of \cref{thm:nullification_modality}.
For instance, if $B:A\to \UU$ has a section $s:\prd{a:A} B(a)$, then localizing at the family $s' : \prd{a:A} \unit \to B(a)$ is equivalent to nullifying at $B$, since in a section-retraction pair the section is an equivalence if and only if the retraction is.
However, we can say the following.

\begin{lem}\label{thm:acc-modal}
  If $F:\prd{a:A} B(a)\to C(a)$ is such that $\localization{F}$ is a modality, then there exists a family $E:D\to \UU$ such that $\localization{F}$ coincides with nullification at $E$.
\end{lem}
\begin{proof}
  Write $\modal\defeq\localization{F}$ and $\modalunit$ for its modal unit.
  Define $D = \sm{a:A} (\modal (B(a)) + \modal(C(a)))$, and $E:D\to \UU$ by
  \begin{align*}
    E(a,\inl(b)) &\defeq \fib{\modalunit[B(a)]}{b}\\
    E(a,\inr(c)) &\defeq \fib{\modalunit[C(a)]}{c}.
  \end{align*}
  Then since $\modalunit$ is $\modal$-connected, each $E(d)$ is $\modal$-connected, and hence every $F$-local type is $E$-null.

  On the other hand, suppose $X$ is an $E$-null type.
  Each $\modalunit[B(a)]$ and $\modalunit[C(a)]$ is $\localization{E}$-connected, since their fibers are $\localization{E}$-connected (by definition); thus $X$ is also $\modalunit[B(a)]$-local and $\modalunit[C(a)]$-local.
  But we have the following commutative square:
  \[
  \begin{tikzcd}[column sep=large]
    B(a) \ar[r,"{\modalunit[B(a)]}"] \ar[d,"F(a)"'] & \modal(B(a)) \ar[d,"{\modal(F(a))}"]\\
    C(a) \ar[r,"{\modalunit[C(a)]}"'] & \modal(C(a))
  \end{tikzcd}
  \]
  and ${\modal(F(a))}$ is an equivalence; thus $X$ is also $F(a)$-local.
  So the $F$-local types coincide with the $E$-null types.
\end{proof}

This shows that the following definition of accessible modality is consistent with our terminology of accessible reflective subuniverse.

\begin{defn}\label{defn:accessible}
A modality $\modal$ on $\UU$ is said to be \define{accessible} if it is the nullification at a family of types in $\UU$, indexed by a type in $\UU$.
A \define{presentation} of a modality $\modal$ consists of a family of types $B: A\to\UU$, where $A:\UU$, such that the subuniverse of modal types coincides with the subuniverse of $B$-null types.
\end{defn}

\begin{egs}
  Our characterizations of the truncation and open and closed modalities in \cref{thm:trunc-acc,thm:open-acc,thm:closed-acc} made no reference to the ambient universe.
\end{egs}

\begin{eg}
  By contrast, the double-negation modality $\neg\neg$ \emph{is} defined in a polymorphic way on all universes, but in general there seems no reason for it to be accessible on any of them.
  However, if propositional resizing holds, then it is the nullification at $\bool$ together with all propositions $P$ such that $\neg\neg P$ holds, and hence accessible.

  Whether or not any inaccessible modalities remain after imposing propositional resizing may depend on large-cardinal principles.
  It is shown in~\cite{css:large-cardinal} that this is the case for the analogous question about reflective sub-$(\infty,1)$-categories of the $(\infty,1)$-category of $\infty$-groupoids.
\end{eg}

\begin{rmk}\label{rmk:extend-oops}
  It is tempting to think that \emph{any} reflective subuniverse $\modal$ on $\UU$ could be extended to an accessible one on $\UU'$ by localizing at the family of \emph{all} functions in $\UU$ that are inverted by $\modal$ (or nullifying at the family of all $\modal$-connected types in $\UU$, in the case of modalities), which is a $\UU'$-small family though not a $\UU$-small one.
  This does produce an accessible reflective subuniverse $\modal'$ of $\UU'$ such that the $\modal'$-modal types in $\UU$ coincide with the $\modal$-modal ones, but there seems no reason why the modal \emph{operators} $\modal'$ and $\modal$ should agree on types in $\UU$.
\end{rmk}

\endinput
\section{Left exact modalities}\label{sec:left-exact-modal}

We have seen that the modal operator of any reflective subuniverse preserves products, but even for a modality it does not generally preserve pullbacks.
If it does, we call the modality ``left exact'' or just ``lex''.

\begin{thm}\label{thm:lex-modalities}
  For a modality $\modal$, the following are equivalent.
  \begin{enumerate}
  \item If $A$ is $\modal$-connected, then so is $(x=y)$ for any $x,y:A$.\label{item:mu0}
  \item Whenever $A$ and $\sm{x:A}B(x)$ are $\modal$-connected, then so is $B(x)$ for all $x:A$.\label{item:mu1}
  \item Any map between $\modal$-connected types is $\modal$-connected.\label{item:mu1a}
  \item Any $\modal$-modal function between $\modal$-connected types is an equivalence.\label{item:mu1b}
  \item If $f:A\to B$ and $\total g:(\sm{x:A} P(x)) \to (\sm{y:B} Q(y))$ are $\modal$-connected, then so is $g_a:P(a)\to Q(fa)$ for each $a:A$.\label{item:mu3b}
  \item If $S:k\circ g = f\circ h$ is a commutative square in which $f$ and $g$ are $\modal$-connected, then for any $a$ the induced map $\fib{h}{a} \to \fib{k}{fa}$ is $\modal$-connected.\label{item:mu3c}
  \item If $S:k\circ g = f\circ h$ is a commutative square in which $f$ and $g$ are $\modal$-connected and $h$ and $k$ are $\modal$-modal, then the square is a pullback.\label{item:mu3d}
  \item For any $f:A\to B$ and $b:B$, the evident map $\fib{f}{b} \to \fib{\modal f}{\modalunit b}$ is $\modal$-connected.\label{item:mu3a}
  \item For any $A$ and $x,y:A$, the induced map $\modal(x=y) \to (\modalunit[A](x) = \modalunit[A](y))$ is an equivalence.\label{item:mu6}
  \item The functor $\modal$ preserves pullbacks.\label{item:mu3}
  \item $\modal$-connected maps satisfy the 2-out-of-3 property.\label{item:mu4}
  \item If $\modal f: \modal A\to \modal B$ is an equivalence, then $f$ is $\modal$-connected.\label{item:mu5}
  \item For any $\modal$-connected type $A$ and any $P:A\to \modaltype$, there is a $Q:\modaltype$ such that $P(a)\eqvsym Q$ for all $a:A$.\label{item:mu2}
  \end{enumerate}
  When they hold, we say that $\modal$ is \define{lex}.
\end{thm}

\begin{proof}
  The equivalence~\ref{item:mu1}$\Leftrightarrow$\ref{item:mu1a} is easy, using the definition of $\modal$-connected maps and the fact that any function is equivalent to a fibration.
  And~\ref{item:mu0}$\Rightarrow$\ref{item:mu1a} since $\fib f b \jdeq \sm{a:A} (f(a)=b)$ and $\modal$-connected types are closed under $\Sigma$ (since $\modal$-connected maps are closed under composition, being the left class of a factorization system).

  Condition~\ref{item:mu1b} is a special case of~\ref{item:mu1a}, since a function that is both modal and connected is an equivalence.
  But assuming~\ref{item:mu1b}, if $f:A\to B$ is any function between $\modal$-connected types, then in its $(\cL,\cR)$-factorization $A\xrightarrow{e} I\xrightarrow{m} B$ the type $I$ is also connected by right cancellation.
  Thus~\ref{item:mu1b} implies that $m$ is an equivalence; thus $f$, like $e$, is $\modal$-connected, giving~\ref{item:mu1a}.

  Assuming~\ref{item:mu1a}, the $3\times 3$ lemma allows us to identify the fiber of $g_a$ over $q:Q(fa)$ with a fiber of the induced map $\fib{\total{g}}{(a,q)} \to \fib{f}{fa}$:
  \begin{equation}
  \begin{tikzcd}[column sep=large]
  \bullet \arrow[r] \arrow[d]
    & P(a) \arrow[r] \arrow[d]
    & Q(f(a)) \arrow[d] \\
  \fib{\total{g}}{(a,q)} \arrow[r] \arrow[d]
    & \sm{x:A}P(x) \arrow[r,"{\total{g}}"] \arrow[d,swap,"{\proj1}"]
    & \sm{y:B}Q(y) \arrow[d,"{\proj1}"] \\
  \fib{f}{f(a)} \arrow[r]
    & A \arrow[r,swap,"f"]
    & B
  \end{tikzcd}%
  \end{equation}
  Since $f$ and $\total g$ are $\modal$-connected by assumption, their fibers are $\modal$-connected, and hence by~\ref{item:mu1a} so is this fiber; thus~\ref{item:mu3b} holds.

  Now assuming~\ref{item:mu3b}, we can deduce~\ref{item:mu3c} by replacing the maps $h$ and $k$ by equivalent dependent projections.
  If in addition $h$ and $k$ are $\modal$-modal, then $\fib{h}{a} \to \fib{k}{fa}$ is a function between $\modal$-modal types, hence itself $\modal$-modal as well as $\modal$-connected and thus an equivalence; thus~\ref{item:mu3c}$\Rightarrow$\ref{item:mu3d}.
  On the other hand, the special case of~\ref{item:mu3d} in which $f$ and $g$ have codomain $\unit$ reduces to~\ref{item:mu1b}.

  Applying~\ref{item:mu3c} instead to the commutative square
  \begin{equation}
  \begin{tikzcd}
  A \arrow[r,"{\modalunit[A]}"] \arrow[d,swap,"f"]
    & \modal(A) \arrow[d,"\modal(f)"] \\
  B \arrow[r,swap,"{\modalunit[B]}"]
    & \modal(B)
  \end{tikzcd}
  \end{equation}
  for any $f:A\to B$ yields~\ref{item:mu3a}.
  % \begin{equation}
  % \vcenter{\xymatrix{
  %     \bullet\ar[r]\ar[d] &
  %     \fib{f}{b}\ar[r]\ar[d] &
  %     \fib{\modal f}{\modalunit b}\ar[d]\\
  %     \fib{\modalunit[A]}{u}\ar[r]\ar[d] &
  %     A\ar[r]^{\modalunit[A]}\ar[d]_f &
  %     \modal A\ar[d]^{\modal f}\\
  %     \fib{\modalunit[B]}{(\modal f)(u)}\ar[r] &
  %     B\ar[r]_{\modalunit[B]} &
  %     \modal B
  %     }}
  % \end{equation}
  And as a special case of~\ref{item:mu3a}, if $A\defeq \unit$ and $B$ is $\modal$-connected, we find that $\apfunc{\modalunit}$ is $\modal$-connected.
  Since $\modal$-connected maps are inverted by $\modal$, this implies~\ref{item:mu6}.
  Conversely, if~\ref{item:mu6} holds, if $A$ is $\modal$-connected then $(\modalunit(x)=\modalunit(y))$ is contractible, hence $(x=y)$ is $\modal$-connected, giving~\ref{item:mu0}.
  Thus~\ref{item:mu0} through~\ref{item:mu6} are equivalent.

  Assuming these equivalent conditions, for a cospan $A\xrightarrow{f}C \xleftarrow{g} B$ the map of pullbacks
  \begin{equation}
    \sm{a:A}{b:B} (fa=gb) \longrightarrow \sm{x:\modal A}{y:\modal B} ((\modal f)(x) = (\modal g)(y))\label{eq:pbpres}
  \end{equation}
  is equivalent to the map on total spaces induced by $\modalunit[A]:A\to\modal A$ and the fiberwise transformation
  \[ h : \prd{a:A} \left(\fib{g}{fa} \to \fib{\modal g}{(\modal f)(\modalunit a)}\right). \]
  But since $(\modal f)(\modalunit a) = \modalunit(fa)$, by~\ref{item:mu3a} each $h_a$ is $\modal$-connected.
  Since $\modalunit[A]$ is also $\modal$-connected, by \cref{lem:nconnected_postcomp_variation} so is~\eqref{eq:pbpres}.
  Hence the induced map
  \[ \modal\left(\sm{a:A}{b:B} (fa=gb)\right) \longrightarrow \sm{x:\modal A}{y:\modal B} ((\modal f)(x) = (\modal g)(y))\]
  (which exists since the codomain is $\modal$-modal) is an equivalence, yielding~\ref{item:mu3}.

  On the other hand, if~\ref{item:mu3}, then $\modal$ preserves any pullback
  \begin{equation}
  \begin{tikzcd}
  (x=y) \arrow[r] \arrow[d]
    & \unit \arrow[d,"x"] \\
  \unit \arrow[r,"y"']
    & A
  \end{tikzcd}
  \end{equation}
  yielding~\ref{item:mu6}.

  For~\ref{item:mu4}, two-thirds of the 2-out-of-3 property holds for any modality, so it remains to show that for $f:A\to B$ and $g:B\to C$, if $g\circ f$ and $g$ are $\modal$-connected, so is $f$.
  However, the unstable octahedral axiom~(\cite[ex4.4]{hottbook}) implies that for any $b:B$, the fiber $\fib f b$ is equivalent to the fiber of the induced map $\fib{g\circ f}{gb} \to \fib{g}{gb}$.
  These two types are $\modal$-connected since $g\circ f$ and $g$ are; thus~\ref{item:mu1a}$\Rightarrow$\ref{item:mu4}.
  Conversely,~\ref{item:mu1a} is clearly a special case of~\ref{item:mu4}.

  Since $\modalunit[A] : A\to \modal A$ is $\modal$-connected, easily~\ref{item:mu4}$\Rightarrow$\ref{item:mu5}.
  On the other hand, if $g\circ f$ and $g$ are $\modal$-connected, then they are both inverted by $\modal$, and hence so is $f$; thus~\ref{item:mu5}$\Rightarrow$\ref{item:mu4}.

  Next we assume~\ref{item:mu4} and show \ref{item:mu2}.
  Suppose $A$ is $\modal$-connected and $P:A\to\modaltype$, and define
  \[ Q \defeq \modal\left(\sm{a:A} P(a)\right),\]
  and $g:\prd{a:A} P(a) \to Q$ by $g(a,u) \defeq \modalunit(a,u)$.
  We will show $g$ to be a family of equivalences.

  Since $P(a)$ and $Q$ are both $\modal$-modal, for $g_a$ to be an equivalence, it suffices for it to be $\modal$-connected.
  We will prove this by showing that the induced map $\total g:(\sm{a:A} P(a)) \to (\sm{a:A} Q)$ is $\modal$-connected.
  By the assumed 2-out-of-3 property, for this it suffices to show that the other two maps in the following commutative triangle are $\modal$-connected:
  \begin{equation}
  \begin{tikzcd}
  \sm{a:A} P(a) \arrow[r,"{\total g}"] \arrow[dr,swap,"{\modalunit}"]
    & \sm{a:A} Q \mathrlap{\,\jdeq A\times Q} \arrow[d,"\proj2"] \\
  & Q
  \end{tikzcd}
  \end{equation}
  But the right-hand vertical map is $\modal$-connected since its fiber is the $\modal$-connected type $A$,
  and the diagonal map is $\modal$-connected since it is simply $\modalunit$.
  This completes the proof of~\ref{item:mu4}$\Rightarrow$\ref{item:mu2}.

  Finally, we prove~\ref{item:mu2}$\Rightarrow$\ref{item:mu0}.
  Suppose $A$ is $\modal$-connected and $x:A$.
  Then $\lam{y} \modal(x=y) : A \to \modaltype$ so there is a $Q_x:\modaltype$ such that $\modal(x=y)\eqvsym Q_x$ for all $y:A$.
  It follows that transport in the type family $\lam{y} \modal(x=y)$ is constant, i.e.\ if $p,q:y=z$ and $u:\modal(x=y)$ then $\trans p u = \trans q u$.
  Now for any $p:x=y$, we have $\trans p {\modalunit(\refl x)} = \modalunit(p)$; hence for any $p,q:x=y$ we have $\modalunit(p)=\modalunit(q)$.
  By $\mathsf{ind}^\modal$, it follows that for any $u,v:\modal(x=y)$ we have $u=v$, i.e.\ $\modal(x=y)$ is a mere proposition.
  But $\modal(x=x)$ is inhabited by $\modalunit(\refl x)$, hence $Q_x$ is also inhabited, and thus so is $\modal(x=y)$ for all $y$; thus it is contractible.
\end{proof}

Note that~\ref{item:mu3a} and~\ref{item:mu3} both imply that a lex modality preserves fibers: given $f:A\to B$ and $b:B$, the map $\modal(\fib{f}{b}) \to \fib{\modal f}{\modalunit b}$ is an equivalence.
In fact, this property (and hence also~\ref{item:mu3}) characterizes lex modalities even among reflective subuniverses.

\begin{thm}\label{thm:rsu-lex}
  If $\modal$ is a reflective subuniverse such that for any $f:A\to B$ and $b:B$, the map $\modal(\fib{f}{b}) \to \fib{\modal f}{\modalunit b}$ is an equivalence, then $\modal$ is $\Sigma$-closed (and hence a lex modality).
\end{thm}
\begin{proof}
  Suppose $A$ and each $B(a)$ are $\modal$-modal.
  We have a commutative square
  \[
  \begin{tikzcd}
    \sm{a:A}B(a) \ar[r,"\modalunit"] \ar[d,"\proj1"'] &
    \modal(\sm{a:A}B(a)) \ar[d,"\modal \proj1"] \\
    A \ar[r,"\modalunit"',"\sim"] & \modal A
  \end{tikzcd}
  \]
  in which the bottom map is an equivalence.
  Thus, to show that the top map is an equivalence it suffices to show that the induced map on each fiber $B(a) \to \fib{\modal \proj1}{\modalunit a}$ is an equivalence.
  But this map factors through the equivalence $B(a) \eqvsym \modal B(a)$ by the map $\modal B(a) \to \fib{\modal \proj1}{\modalunit a}$, which is an equivalence by assumption.
\end{proof}

A particularly useful corollary of \cref{thm:lex-modalities} is the following.

\begin{cor}\label{modaln-truncated}
  A lex modality preserves $n$-truncated maps for all $n$.
\end{cor}
\begin{proof}
  We first argue by induction on $n$ that a lex modality $\modal$ preserves $n$-types for all $n$.
  The base case is \cref{lem:modal-pres-prop}.
  For the inductive step, suppose $\modal$ is lex and preserves $n$-types, and $A$ is an $(n+1)$-type.
  Then for $u,v:\modal A$ the proposition that $u=v$ is an $n$-type is $\modal$-modal, since it is constructed inductively using $\Sigma$, $\Pi$, and identity types.
  Thus, we can prove it by $\modal$-induction on $u,v$.
  But for $x,y:A$ the type $\modalunit(x)=\modalunit(y)$ is equivalent to $\modal(x=y)$ by \cref{thm:lex-modalities}\ref{item:mu6}, hence is an $n$-type by the inductive hypothesis.

  Now if $f:A\to B$ is $n$-truncated, to show that $\modal f$ is $n$-truncated we must show that $\fib{\modal f}{y}$ is an $n$-type for all $y:\modal B$.
  Again, by $\modal$-induction we can reduce to the case $y\defeq \modalunit(b)$ for some $b:B$, in which case \cref{thm:lex-modalities}\ref{item:mu3a} implies that $\fib{\modal f}{\modalunit(b)} \eqvsym \modal(\fib f b)$, which is an $n$-type since $f$ is $n$-truncated and $\modal$ preserves $n$-types.
\end{proof}

Not every modality satisfying \cref{modaln-truncated} is lex.
For instance, the $m$-truncation modality preserves $n$-types for all $n$, but is not lex for $m\ge -1$.
(To see that it is not lex, consider an Eilenberg--MacLane space $K(G,m+1)$~\cite{FinsterLicata}; this is $m$-connected, but its loop space is $K(G,m)$ which is not $m$-connected.
Alternatively, we can use \cref{thm:acc-lex} below together with the fact that the universe of $m$-types in the $m^{\mathrm{th}}$ universe is not an $m$-type~\cite{ks:u-not-ntype}.)

We do know at least one example of a lex modality.

\begin{eg}
  For any mere proposition $P$, the open modality $\open P \defeq \lam{X} (P\to X)$ is lex.
  This is easy to see since mapping out of $P$ is a right adjoint, hence preserves all limits, including pullbacks.
\end{eg}

However, constructing lex modalities in general, such as by localization, is somewhat tricky.
Unlike the characterization of modalities as $\Sigma$-closed reflective subuniverses, which refers only to the \emph{modal types} and hence was easy to prove in \cref{thm:nullification_modality}, all the characterizations of lex-ness refer explicitly or implicitly to the \emph{modal operator} $\modal$, and not just by way of its ``mapping out'' universal property but saying something about its identity types.
In general, saying anything about the identity types of a higher inductive type (such as localization) requires some amount of univalence, and the present case is no exception (although we do not need a full ``encode-decode'' type argument).

\begin{thm}\label{thm:acc-lex}
  Let $\modal$ be an accessible modality; the following are equivalent.
  \begin{enumerate}
  \item $\modal$ is lex.\label{item:al1}
  \item $\modal$ has a presentation $B:A\to \UU$ such that for any $a:A$ and any $P:B(a)\to \modaltype$, there is a $Q:\modaltype$ such that $P(b)\eqvsym Q$ for all $b:B(a)$.\label{item:al2}
  \item The universe $\modaltype \defeq \{A:\type | A \text{ is $\modal$-modal}\}$ of modal types is $\modal'$-modal, where $\modal'$ is the canonical accessible extension of $\modal$ to a universe $\UU'$ containing $\UU$, as in \cref{thm:acc-extend}.\label{item:al3}
  \end{enumerate}
\end{thm}
\begin{proof}
  Assuming~\ref{item:al1}, condition~\ref{item:al2} holds for \emph{any} presentation: it is just a special case of \cref{thm:lex-modalities}\ref{item:mu2}, since each $B(a)$ is $\modal$-connected.

  Now assume~\ref{item:al2} for some presentation $B:A\to\UU$.
  By definition of $\modal'$, it suffices to show that $\modaltype$ is $B(a)$-null for all $a:A$, i.e.\ that the ``constant functions'' map
  \[ \modaltype \to (B(a) \to \modaltype) \]
  is an equivalence for all $a:A$.
  The assumption~\ref{item:al2} says that this map has a section, and hence in particular is surjective.
  Thus, it suffices to show it is an embedding, i.e.\ that for any $X,Y:\modaltype$ the map
  \[ (X=Y) \to ((\lam{b} X)= (\lam{b} Y)) \]
  is an equivalence.
  But by univalence and function extensionality, this map is equivalent to
  \[ (X\eqvsym Y) \to (B(a) \to (X\eqvsym Y)), \]
  which is an equivalence by \cref{connectedtotruncated} since $X\eqvsym Y$ is $\modal$-modal and $B(a)$ is $\modal$-connected.

  Finally, if we assume~\ref{item:al3}, then for any $\modal$-connected type $A:\UU$ the map
  \[ \modaltype \to (A\to\modaltype) \]
  is an equivalence.
  In particular, it has a section, proving \cref{thm:lex-modalities}\ref{item:mu2}.
\end{proof}

\begin{cor}\label{thm:prop-loc-lex}
  Let $B:A\to\prop$ be a family of mere propositions.
  If the subuniverse of $B$-null types is a reflective subuniverse, then nullification at $B$ is a lex modality. Modalities of this form are called \define{topological}
\end{cor}
\begin{proof}
  We prove condition~\ref{item:al2} of \cref{thm:acc-lex}.
  Given $P:B(a) \to \modaltype$, define $Q \defeq \prd{b:B(a)} P(b)$.
  This lies in $\modaltype$ since modal types are always closed under dependent function types.
  And if we have any $b:B(a)$, then $B(a)$ is an inhabited proposition and hence contractible,
  and a product over a contractible type is equivalent to any of the fibers.
\end{proof}

\begin{eg}
  For any mere proposition $Q$, the closed modality $\closed Q \defeq \lam{X} Q\ast X$ is topological, since it is presented by the family $\lam{x:P} \emptyt$.
  Thus, by \cref{thm:prop-loc-lex}, it is lex.
\end{eg}

\section{Accessible reflective subuniverses}\label{sec:accessible}

\begin{defn}
Given a family $f:\prd{i:I}A_i\to B_i$ of maps, a type $X$ is said to be \define{$f$-local} if the precomposition map
\begin{equation*}
\precomp{f_i}:(B_i\to X)\to (A_i\to X)
\end{equation*}
is an equivalence, for each $i:I$. The family $f$ is said to be a \define{presentation} of a reflective subuniverse $L$ if the subuniverses of $f$-local types and $L$-local types coincide. A reflective subuniverse is said to be \define{accessible} if there exists a presentation for it.
\end{defn}

In \cite{RijkeShulmanSpitters} it is shown that the subuniverse of $f$-local types is always a reflective subuniverse. However, it is not clear whether their construction is possible in our current setting, where the only higher inductive types that are assumed to exist are homotopy pushouts. In this section we will establish general properties of accessible reflective subuniverses. We will show in \cref{chap:compact} that for any family $f$ of maps between \emph{compact} types, the subuniverse of $f$ is indeed reflective.

\begin{rmk}
Note that being accessible is structure; different families can present the same reflective subuniverse or modality.
As a trivial example, note that localizing at the empty
type, and localizing at the type family on $\bool$ defined by
$\bfalse\mapsto \emptyt$ and $\btrue\mapsto \unit$ both map all types to contractible types.

However, we are usually only interested in properties of presentations insofar as they determine properties of subuniverses.
For instance, by \cref{thm:acc-modal}, a reflective subuniverse is a modality exactly when it has a presentation in which each $C(a)=\unit$.
Similarly, in \cref{sec:lex-top-cotop} we will define a modality to be ``topological'' if it has a presentation in which each $C(a)=\unit$ and each $B(a)$ is a mere proposition.
\end{rmk}

\begin{eg}\label{thm:trunc-acc}
The trivial modality $\truncf{(-2)}$ is presented by $\emptyt$, while the propositional truncation modality $\truncf{(-1)}$ is presented by $\bool$.  More generally, the
$n$-truncation modality $\truncf{n}$ is presented by the $(n+1)$-sphere $\Sn^{n+1}$.
\end{eg}

\begin{eg}\label{thm:open-acc}
For every mere proposition $P$, the open modality $\open P (X) \defeq (P\to X)$ from \cref{eg:open} is
presented by the singleton type family $P$.
To see this, note that $\modalunit[X] : X \to (P\to X)$ is the same as the map in the definition of locality, so that $X$ is modal for the open modality on $P$ if and only if it is $P$-local.
(If $P$ is not a mere proposition, however, then $X\mapsto (P\to X)$ is not a modality, and in particular does not coincide with localization at $P$.)
\end{eg}

\begin{eg}\label{thm:closed-acc}
  The closed modality $\closed P$ from \cref{eg:closed} associated to a mere proposition $P$ is presented by the type family $\lam{x} \emptyt : P \to \UU$.
  For by definition, $A$ is null for this family if and only if for any $p:P$ the map $A \to (\emptyt \to A)$ is an equivalence.
  But $\emptyt \to P$ is contractible, so this says that $P\to\iscontr(A)$, which was the definition of $\closed P$-modal types from \cref{eg:closed}.
\end{eg}

\begin{lem}\label{lemma:characterizationsigmaflocal}
    Let $f:\prd{i:I}A_i\to B_i$ be a family of maps. Denote the family consisting of the suspensions
    of the functions by $\susp{f} : \prd{i:I} \susp{A_i} \to \susp{B_i}$.
    A type $X$ is $\suspsym f$-local if and only if for every $x,y : X$, the type
    $x =_X y$ is $f$-local.
    In other words, $L_{\susp{f}} = (L_{f})'$.
\end{lem}

\begin{proof}
    By the induction principle for suspension and naturality, we obtain for each $i : I$ a commutative square
\[
  \begin{tikzcd}
    (\susp{B_i} \to X) \arrow[r,"\simeq"] \arrow[d] & \left( \sm{x,y:X} (B_i \to x = y) \right) \arrow[d] \\
    (\susp{A_i} \to X) \arrow[r,"\simeq"] & \left( \sm{x,y:X} (A_i \to x = y) \right)
  \end{tikzcd}
\]
in which the horizontal maps are equivalences.
So $X$ is $\suspsym f$-local if and only if the right vertical map is an equivalence
for every $i : I$, if and only if for each $x,y : X$, the type $x = y$ is $f_i$-local
for every $i : I$.
\end{proof}