\section{Differential cohesion}\label{sec:dc}

\Cref{thm:positions} was proved for a linear group acting freely and properly on an open subset of $\R^d$, by computation with matrices. Its
statements involve tangent vectors, and there are none in \cref{prop:atlas}. Two things are required for a general formulation: a tangent
functor that commutes with the formation of quotients, and a separation of the infinitesimal part of a symmetry from the rest. Both are part
of the structure of a differentially cohesive $\infty$-topos \cite{Schreiber,KhavkineSchreiber}.

\begin{definition}\label{def:dc}
A \defn{differentially cohesive $\infty$-topos with first-order infinitesimals} is an $\infty$-topos $\Hh$ with
\begin{enumerate}[label=\textup{(DC\arabic*)}]
\item an adjoint triple $\Re\dashv\Im\dashv\&$ of endofunctors, in which $\Im$ is an idempotent monad with unit $\eta$ and $\Re$ preserves finite products;
\item a $0$-truncated commutative ring object $R$ and a subobject $D\subseteq R$ containing $0$, with $\Re D\simeq\ast$, such that the functor $T=[D,-]$
preserves colimits;
\item the Kock--Lawvere property: $(a,b)\mapsto(d\mapsto a+bd)$ is an equivalence $R\times R\to[D,R]$.
\end{enumerate}
An object $A$ is \emph{coreduced} if $\eta_A$ is an equivalence, and a map $f\colon A\to B$ is \emph{formally \'etale} if the naturality square of $\eta$ is
a pullback, $A\simeq B\times_{\Im B}\Im A$. The projection $TA\to A$ is evaluation at $0$ and the zero section $A\to TA$ is restriction along $D\to\ast$. For a group
object $G$ with unit $e$, the kernel of $TG\to G$ is the group object $\fg=T_eG$, and the fibre of $\eta_G$ over the unit is the group object $\hat G$.
\end{definition}

The model, fixed from \cref{thm:dc-positions} on, is the $\infty$-topos of sheaves on the site of formal Cartesian spaces $\R^n\times\operatorname{Spec}W$,
with $W$ a Weil algebra and covers those of the factor $\R^n$. Here $R$ is the line, $D=\operatorname{Spec}\R[\varepsilon]/(\varepsilon^2)$,
$\Re(\R^n\times\operatorname{Spec}W)=\R^n$ and $(\Im A)(U)=A(\Re U)$. The functor $T$ is restriction along $U\mapsto U\times D$, under which the covers of $U$
and of $U\times D$ correspond, so $T$ has both adjoints. The $0$-truncated objects form the Cahiers topos \cite{Dubuc79,Kock}. Manifolds embed
fully faithfully, and $[D,M]$ is the tangent bundle of a manifold $M$. Smooth sets embed by a functor that preserves colimits and finite
products, and diffeological spaces embed through smooth sets. In the model $\eta_G$ is an effective epimorphism for every group object $G$,
since $\Re U$ is a retract of $U$ for every object $U$ of the site.

\begin{lemma}\label{lem:dc}
\begin{enumerate}[label=\textup{(\roman*)}]
\item $\Im$ and $T$ preserve limits and colimits.
\item $[D,\Im A]\simeq\Im A$ for every $A$: all tangent vectors of a coreduced object are zero.
\item Formally \'etale maps are stable under pullback, and every map between coreduced objects is formally \'etale.
\item If $f\colon A\to B$ is formally \'etale then $TA\simeq A\times_BTB$.
\end{enumerate}
\end{lemma}
\noindent The proof is \cref{exo:dc-lemma}.

\begin{proposition}[Tangent and infinitesimal shape of an atlas]\label{prop:dc-atlas}
Let $p\colon\Theta\to X$ be an effective epimorphism. Then $Tp$ and $\Im p$ are effective epimorphisms, with \v{C}ech nerves $T\check C(p)$ and $\Im\check C(p)$. For a
group object $G$ acting on $\Theta$,
\[
T(\Theta\hquot G)\simeq T\Theta\hquot TG,\qquad\Im(\Theta\hquot G)\simeq\Im\Theta\hquot\Im G .
\]
\end{proposition}
\begin{proof}
Both functors preserve colimits and limits (\cref{lem:dc}(i)), and the \v{C}ech nerve and the action groupoid are built from fibre products;
$TG$ and $\Im G$ are group objects because the functors preserve finite products.
\end{proof}

For a Lie group acting on a manifold, $T\Theta\hquot TG$ is the tangent stack of the quotient stack, and its sections are the vector fields on the
stack defined in \cite{Hepworth}.

\begin{theorem}[Infinitesimal and \'etale parts of a symmetry]\label{thm:dc-factorisation}
Let $G$ act on $\Theta$, $p\colon\Theta\to X=\Theta\hquot G$, and $\hat X=X\times_{\Im X}\Im\Theta$.
\begin{enumerate}[label=\textup{(\roman*)}]
\item $p$ factors as $\Theta\xrightarrow{\;e\;}\hat X\xrightarrow{\;\varepsilon\;}X$ with $\Im e$ an equivalence and $\varepsilon$ formally \'etale, and the factorisation with these properties
is unique \cite{CherubiniRijke}.
\item $\varepsilon$ is a principal bundle for the coreduced group $\Im G$: $X\simeq\hat X\hquot\Im G$, $\hat X\simeq(\Theta\times\Im G)\hquot G$ and $\hat X\times_X\Theta\simeq\Im G\times\Theta$. If
$\eta_G$ is an effective epimorphism, then $\hat X\simeq\Theta\hquot\hat G$.
\item $T\hat X\simeq\hat X\times_XTX$. Hence the relative tangent map $T\Theta\to\Theta\times_XTX$ of $p$ is the relative tangent map of $e$.
\item $\Im\hat G\simeq\ast$ and $T_e\hat G\simeq\fg$.
\item $p$ is formally \'etale if and only if $\eta_G\times\id\colon G\times\Theta\to\Im G\times\Theta$ is an equivalence. This holds when $G$ is coreduced, and then $\fg\simeq\ast$.
\end{enumerate}
\end{theorem}
\begin{proof}
(i) Let $e=(p,\eta_\Theta)$ and $\varepsilon=\pr_1$. Since $\Im$ preserves fibre products and is idempotent, $\Im\hat X\simeq\Im X\times_{\Im X}\Im\Theta\simeq\Im\Theta$, and $\Im e$ is the
identity under this equivalence. The map $\varepsilon$ is a pullback of $\Im p$, a map between coreduced objects, and is formally \'etale by
\cref{lem:dc}(iii). The $\Im$-equivalences and the formally \'etale maps are the two classes of an orthogonal factorisation system. (ii) and
(iii) are \cref{exo:dc-factorisation}. (iv) $\Im$ preserves finite products, so $\Im G$ is a group object and $\eta_G$ a homomorphism. $\Im\hat G$
is the fibre of $\Im\eta_G$, an equivalence. $T$ preserves fibres and $T\Im G\simeq\Im G$ by \cref{lem:dc}(ii), so
$T\hat G\simeq TG\times_{\Im G}\ast\simeq TG\times_G\hat G$, whose fibre over $e$ is $\fg$. (v) By uniqueness in (i), $p$ is formally \'etale if and only if $e$ is an
equivalence, which may be tested after pullback along the effective epimorphism $\hat X\times_X\Theta\to\hat X$. The pullback of $e$ is
$\Theta\times_X\Theta\simeq G\times\Theta\to\Im G\times\Theta$, the map $\eta_G\times\id$. If $G$ is coreduced, $TG\simeq[D,\Im G]\simeq\Im G\simeq G$ and the fibre of $TG\to G$ is a point.
\end{proof}

\begin{figure}[t]
\centering
\begin{tikzcd}[column sep=2.8em,row sep=2.6em]
\Theta \arrow[r,"e"] \arrow[d,"\eta"'] & \hat X \arrow[r,"\varepsilon"] \arrow[d,"\eta"'] \arrow[dr,phantom,"\lrcorner",very near start] & X \arrow[d,"\eta"]\\
\Im\Theta \arrow[r,"\simeq"'] & \Im\hat X \arrow[r,"\Im\varepsilon"'] & \Im X
\end{tikzcd}
\qquad\qquad
\begin{tikzcd}[column sep=2.8em,row sep=2.6em]
T\Theta \arrow[r,"Te"] \arrow[d] & T\hat X \arrow[r,"T\varepsilon"] \arrow[d] \arrow[dr,phantom,"\lrcorner",very near start] & TX \arrow[d]\\
\Theta \arrow[r,"e"'] & \hat X \arrow[r,"\varepsilon"'] & X
\end{tikzcd}
\caption{\Cref{thm:dc-factorisation}. The atlas of a quotient is the composite of a map inverted by $\Im$, the quotient by the formal group
$\hat G$, and a formally \'etale map, the quotient by the coreduced group $\Im G$, along which tangent objects are pulled back.}\label{fig:dc}
\end{figure}

So every statement about tangent vectors, vertical directions and connections for the atlas $p$ is a statement about $e\colon\Theta\to\hat X$, and
depends on $G$ through the formal group $\hat G$ only; the rest of the symmetry is in $\varepsilon$, along which there are no vertical tangent
directions. The object $\hat X$ is the formal completion of $X$ along $p$, and in derived algebraic geometry the maps $\Theta\to\hat X$ of this
kind are the Lie algebroids on $\Theta$ \cite{GaitsgoryRozenblyum}; here it is the action algebroid, whose anchor is the map $a$ of the next
proposition.

\begin{proposition}[The relative tangent sequence]\label{prop:dc-relative}
Let $G$ act on $\Theta$ with action map $\mathrm{act}$, $p\colon\Theta\to X=\Theta\hquot G$, and let $\fg$ act on $T\Theta$ by restriction of the action of $TG$.
\begin{enumerate}[label=\textup{(\roman*)}]
\item The relative tangent map $q\colon T\Theta\to\Theta\times_XTX$ is an effective epimorphism, and $\Theta\times_XTX\simeq T\Theta\hquot\fg$.
\item The fibre of $q$ over the zero section is $\fg\times\Theta$, with the map $a\colon\fg\times\Theta\to T\Theta$, $a(\xi,\theta)=T\mathrm{act}(\xi,0_\theta)$, the \emph{infinitesimal action}.
\item If $\Theta$ is a manifold, $\fg$ acts by translations: $\xi\cdot v=v+a(\xi,\theta)$ for $v$ over $\theta$.
\item Let $\Theta$ be a manifold with a Riemannian metric $g$, and $H\subseteq T\Theta$ the subobject of the vectors $v$ over $\theta$ with $g(a(\xi,\theta),v)=0$ for all
$\xi$. If $G$ is a Lie group and the action is locally free, then $H$ is a vector bundle and $q$ restricts to an equivalence $H\to\Theta\times_XTX$: a
splitting of the relative tangent map, the connection of \cref{thm:metric-connection}\textup{(i)}.
\end{enumerate}
\end{proposition}
\begin{proof}
(i) By \cref{prop:dc-atlas}, $T\Theta\times_{TX}T\Theta\simeq T(G\times\Theta)=TG\times T\Theta$, and the fibre product of $q$ with itself is the part of it over the diagonal
$\Theta\to\Theta\times_X\Theta\simeq G\times\Theta$, $\theta\mapsto(e,\theta)$, which is $\fg\times T\Theta$: the \v{C}ech nerve of $q$ is the action groupoid of $\fg$. The pullback of $q$ along
the effective epimorphism $\Theta\times_XT\Theta\to\Theta\times_XTX$ is the map $TG\times T\Theta\to G\times T\Theta$, which has a section, so $q$ is an effective epimorphism.
(ii) is the restriction of (i) to the zero section. (iii) In a chart, by the Kock--Lawvere property, a tangent vector of $G$ at $e$ acts as
$x\mapsto x+dF_1(x)$, and a tangent vector at $\theta$ is $d\mapsto\theta+dv$; the composite is $d\mapsto\theta+d\,(v+F_1(\theta))$ since $d^2=0$, and $F_1(\theta)=a(\xi,\theta)$. (iv) The map
$a$ is linear in $\xi$ and injective on fibres, with image a subbundle $E$. The action of $\fg$ on $T\Theta$ is free, its quotient is the vector bundle
$T\Theta/E$, and $H=E^\perp$ is a complement of $E$.
\end{proof}

So the pullback to $\Theta$ of the tangent object of the quotient is the quotient of the complex $\fg\times\Theta\to T\Theta$, for every group object and
without conditions on the action. A connection is a splitting of $q$, and a metric gives one when the rank of $a$ is constant. The next
theorem is \cref{thm:positions} in this generality: the group is an arbitrary group object of the model, the action need be neither free nor
proper, and the quotient is a stack.

\begin{theorem}[Positions in differential cohesion]\label{thm:dc-positions}
Let $\Hh$ be the model, $\Theta$ a manifold with a Riemannian metric $g$, $G$ a group object of $\Hh$ acting on $\Theta$, $p\colon\Theta\to X=\Theta\hquot G$, and $L\colon\Theta\to R$.
\begin{enumerate}[label=\textup{(\alph*)}]
\item \emph{Objective and connection.} $L=\ell\circ p$ for a unique $\ell\colon X\to R$ if and only if $L\circ\mathrm{act}=L\circ\pr_\Theta$. In that case
$g\bigl(\nabla L(\theta),a(\xi,\theta)\bigr)=0$ on $\fg\times\Theta$: the gradient is a section of $H$.
\item \emph{Exact part.} For a point $\xi$ of $\fg$ let $a_\xi=g(a(\xi,-),-)$, a $1$-form on $\Theta$. If $a_\xi=\dd Q_\xi$, then $Q_\xi$ is constant along the gradient
flow of every invariant $L$.
\item \emph{Invariant metric.} If $g\bigl(T\mathrm{act}(0_h,v),T\mathrm{act}(0_h,w)\bigr)=g(v,w)$ on $G\times(T\Theta\times_\Theta T\Theta)$ and $L$ is invariant, then $\nabla L$ is equivariant, and
there is a section $\sigma$ of $TX\to X$ with $\sigma\circ p=Tp\circ\nabla L$.
\item \emph{\'Etale symmetry.} If $G$ is coreduced, then $\fg\simeq\ast$, parts \textup{(a)} and \textup{(b)} are empty, $T\Theta\simeq\Theta\times_XTX$, and a vector field on $\Theta$
induces a section of $TX\to X$ if and only if it is $G$-equivariant.
\item \emph{General symmetry.} The objects $a$, $H$, $a_\xi$ and $Q_\xi$ of \textup{(a)} and \textup{(b)} depend on $G$ through $\hat G$ only, and $X\simeq\hat X\hquot\Im G$
with $\Im G$ coreduced and $T\hat X\simeq\hat X\times_XTX$.
\end{enumerate}
\end{theorem}
\begin{proof}
(a) $R$ is $0$-truncated, so the first statement is \cref{prop:atlas}(i). The differential of $L$ is $\dd L=\pr_2\circ TL\colon T\Theta\to R\times R\to R$, by the
Kock--Lawvere property, and $g(\nabla L,v)=\dd L(v)$. Then
\[
\dd L\bigl(a(\xi,\theta)\bigr)=\pr_2T(L\circ\mathrm{act})(\xi,0_\theta)=\pr_2T(L\circ\pr_\Theta)(\xi,0_\theta)=\pr_2TL(0_\theta)=0 .
\]
(b) Along an integral curve of $-\nabla L$ the derivative of $Q_\xi$ is $-\dd Q_\xi(\nabla L)=-g(a(\xi,-),\nabla L)$, which vanishes by (a). (c) Write $h_*=T\mathrm{act}(0_h,-)$
for a generalised element $h$ of $G$. For $w$ over $h\theta$,
$g(h_*\nabla L(\theta),w)=g(\nabla L(\theta),h^{-1}_*w)=\dd(L\circ h^{-1})(w)=\dd L(w)=g(\nabla L(h\theta),w)$, so $h_*\nabla L(\theta)=\nabla L(h\theta)$ by the non-degeneracy of $g$. Let $G$
act on $T\Theta$ through the zero section $G\to TG$, a homomorphism. For $0$-truncated objects with an action of $G$, a map that commutes with the
actions is equivariant, by descent along $\ast\to\mathbf{B}G$; so $\nabla L$ induces $\Theta\hquot G\to T\Theta\hquot G$, and $\sigma$ is its composite with the map
$T\Theta\hquot G\to T\Theta\hquot TG\simeq TX$ induced by the zero section. The composite of $\sigma$ with $TX\to X$ is induced by the identity of $\Theta$. (d) By
\cref{thm:dc-factorisation}(v), $p$ and all the face maps of its \v{C}ech nerve are formally \'etale, so by \cref{lem:dc}(iv) the simplicial
object $T\check C(p)$ is the pullback of $TX$ along $\check C(p)\to X$. By descent \cite{HTT} the sections of $TX\to X$ are the sections of $T\Theta\to\Theta$ with
descent data. Since $TG\simeq G$, the descent isomorphism over $G\times\Theta$ is $(h,v)\mapsto(h,h_*v)$, and for the $0$-truncated objects $\Theta$ and $T\Theta$ a descent
datum for a section is the property of equivariance. (e) The fibre of $T\hat G\to\hat G$ over $e$ is $\fg$, and the rest is
\cref{thm:dc-factorisation}(ii),(iii).
\end{proof}

\begin{table}[t]\centering\small
\begin{tabular}{@{}p{3.6cm}p{1.5cm}p{1.2cm}p{2.5cm}p{3.9cm}@{}}\toprule
symmetry $G$ & coreduced & $\fg$ & $\hat X$ & invariants of gradient flow\\\midrule
permutations of hidden units & yes & $0$ & $\Theta$ & none\\
$\Z+\alpha\Z$ acting on $\R$ & yes & $0$ & $\R$, with $X=\Tal$ & none\\
rescalings $(\R_{>0})^k$ & no & $\R^k$ & $\Theta\hquot\hat G$ & $\abs{w_{\mathrm{in}}}^2-\abs{w_{\mathrm{out}}}^2$ for each unit\\
$\GL_k$ between linear layers & no & $\mathfrak{gl}_k$ & $\Theta\hquot\hat G$ & $W_1W_1\transp-W_2\transp W_2$\\
rescalings with permutations & no & $\R^k$ & as for rescalings & the same, permuted by $S_k$\\\bottomrule
\end{tabular}
\caption{Symmetries of a parameter space and the two parts of their atlases. For a coreduced group the Lie algebra is trivial and there is
no conserved quantity; the conserved quantities of a general group are those of its formal group.}\label{tab:dc}
\end{table}

The positions of \cref{thm:positions} are recovered as follows. For a locally free action of a Lie group the restriction of $g$ to $H$ is a
metric on the pullback $\Theta\times_XTX$ of the tangent stack. It is a descent datum when the maps induced by $G$ on $H$ are isometries, in particular
in position (c), and it depends on the point of the fibre in general, which is the gauge dependence of \cref{thm:positions}(a). The slice
of position (b) is a level set of the functions $Q_\xi$ of part (b) together with \cref{prop:atlas}(iii), and the projection of position (d)
is the splitting of \cref{prop:dc-relative}(iv).

Three consequences are recorded. First, the remark after \cref{thm:noether}, that a discrete symmetry gives no conserved quantity, is part
(d): the atlas of a discrete symmetry is formally \'etale. Second, the irrational torus is the quotient of $\R$ by the coreduced group
$\Z+\alpha\Z$, so $\R\to\Tal$ is a formally \'etale atlas, $T\Tal\simeq\Tal\times R$, and the vector fields on $\Tal$ are the constants (\cref{exo:tangent-Talpha}): the
tangent object of a space on which every real function is constant is a line bundle with a one-dimensional space of sections. Third, for
a network with rescaling and permutation symmetries the hypothesis space is reached in two steps, $\Theta\to\hat X\to X$. The first is the quotient by the
formal group of the rescalings; the conservation laws and the choice of preconditioner of \cref{sec:acceleration} are statements about it.
The second is the quotient by the coreduced group $\Im G$, of which the permutations are a subgroup, and a dynamics descends along it when
it is equivariant.

