% Colours
\newcommand{\Red}{{\color{red} R}}
\newcommand{\Blue}{{\color{blue} B}}
\newcommand{\Purple}{{\color{violet} P}}

\newcommand{\imp}[1]{{\color{grey} #1}}
% Basics
\newcommand{\D}[1]{#1\!#1}
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
%
\newcommand\restr[2]{{% we make the whole thing an ordinary symbol
  \left.\kern-\nulldelimiterspace % automatically resize the bar with \right
  #1 % the function
  \vphantom{\big|} % pretend it's a little taller at normal size
  \right|_{#2} % this is the delimiter
  }}
\newcommand{\Rho}{\mathrm{P}}
%
\DeclareMathOperator{\sgn}{sgn}
\newcommand{\leftindex}[2]{{_{#1}{#2}}}
\DeclareMathOperator{\lcm}{lcm}
\newcommand{\opn}[1]{\operatorname{#1}}
% Category Theory
\DeclareMathOperator{\ob}{Ob}
\DeclareMathOperator{\Ob}{Ob}
\DeclareMathOperator{\Mor}{Mor}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\cod}{cod}
\newcommand{\yo}{よ}
\newcommand{\colim}{\varinjlim}
\newcommand{\catlim}{\varprojlim}
\newcommand{\cat}[1]{\textsf{#1}}
\newcommand{\cop}[1]{#1^{\textbf{cop}}}
\newcommand{\op}[1]{#1^{\textbf{op}}}
\newcommand{\twoheadrightarrowtail}{⤖}
%% Functors
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\Iso}{Iso}
\DeclareMathOperator{\Aut}{Aut}\
\DeclareMathOperator{\Gal}{Gal}
\DeclareMathOperator{\End}{End}
\DeclareMathOperator{\Ext}{Ext}
\DeclareMathOperator{\Tor}{Tor}
\DeclareMathOperator{\Sk}{Sk}
%% Categories
\newcommand{\Set}{\cat{Set}}
\newcommand{\FinSet}{\cat{FSet}}
\newcommand{\Grp}{\cat{Grp}}
\newcommand{\FinGrp}{\cat{FGrp}}
\newcommand{\Grpd}{\cat{Grpd}}
\newcommand{\Cat}{\cat{Cat}}
\newcommand{\Ab}{\cat{Ab}}
\newcommand{\Hask}{\cat{Hask}}
\newcommand{\Vect}{\cat{Vect}}
\newcommand{\FinVect}{\cat{FVect}}
\newcommand{\Top}{\cat{Top}}
\newcommand{\hTop}{\cat{hTop}}
\newcommand{\Rep}{\cat{Rep}}
\newcommand{\Nat}{\cat{Nat}}
\newcommand{\Man}{\cat{Man}}
\newcommand{\Cov}{\cat{Cov}}
\newcommand{\Mod}{\cat{Mod}}
\newcommand{\lMod}[1]{\leftindex{\mathnormal{#1}}{\mathsf{Mod}}}
\newcommand{\rMod}[1]{\Mod_{#1}}
\newcommand{\bMod}[2]{\leftindex{\mathnormal{#1}} {\mathsf{Mod}_\mathnormal{#2}}}
\newcommand{\Ring}{\cat{Ring}}
\newcommand{\Mon}{\cat{Mon}}
\newcommand{\Smgr}{\cat{Smgr}}
\newcommand{\Fld}{\cat{Fld}}
% Topology
\DeclareMathOperator{\Int}{Int}
\DeclareMathOperator{\Cl}{Cl}
\DeclareMathOperator{\ex}{ex}
% Linear Algebra
\newcommand{\vab}[1]{\vec{\mathbf #1}}
\newcommand{\unitv}[1]{\hat{\mathbf #1}}
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert}
\newcommand{\tp}[1]{#1^\mathsf{T}}
\newcommand{\ntp}[1]{#1^{-\mathsf{T}}}
\DeclareMathOperator{\Span}{span}
\DeclareMathOperator{\colsp}{colsp}
\DeclareMathOperator{\rowsp}{rowsp}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\nullity}{nullity}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\coker}{coker}
%
\DeclareMathOperator{\Ann}{Ann}
\newcommand{\lAnn}[1]{\opn{\leftindex{\mathnormal{#1}}{Ann}}}
%
\DeclareMathOperator{\Tr}{tr}
\DeclareMathOperator{\Spec}{Spec}
%
\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\SL}{SL}
\DeclareMathOperator{\SO}{SO}
\DeclareMathOperator{\Sp}{Sp}
\DeclareMathOperator{\U}{U}
\DeclareMathOperator{\SU}{SU}
%% Representation and Lie theory
\DeclareMathOperator{\Ad}{Ad}
\DeclareMathOperator{\ad}{ad}
\DeclareMathOperator{\Ind}{Ind}
%% Vector shortcuts
\newcommand{\vtwo}[2]{
\begin{bmatrix}
	#1 \\
	#2
\end{bmatrix}
}
\newcommand{\vthree}[3]{
\begin{bmatrix}
	#1 \\
	#2 \\
	#3
\end{bmatrix}
}
% Group theory
\DeclareMathOperator{\Inn}{Inn}
\DeclareMathOperator{\Out}{Out}
\DeclareMathOperator{\Cent}{Cent}
% Ring theory
\DeclareMathOperator{\Frac}{Frac}
\DeclareMathOperator{\GF}{GF}
% Calculus
\newcommand{\jacob}{\mathbf{J}}
% \newcommand{\Lagr}{\mathcal{L}}
\DeclareMathOperator{\curl}{curl}
\DeclareMathOperator{\grad}{grad}
%
\newcommand{\oiint}{{\subset\!\supset} \llap{\iint}}
\newcommand{\oiiint}{{\Large{\subset\!\supset}} \llap{\iiint}}
% Complex Analysis
\DeclareMathOperator{\Res}{Res}
% Naïve set theory
\newcommand{\sube}{\subseteq}
\newcommand{\subne}{\subsetneq}
\newcommand{\supe}{\supseteq}
\newcommand{\supne}{\supsetneq}
\newcommand{\0}{\varnothing}
\DeclareMathOperator{\im}{im}
% Probability
\DeclareMathOperator{\Ex}{\mathbb{E}}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\Covar}{Cov}
\DeclareMathOperator{\Corr}{Corr}
%% Distributions
\DeclareMathOperator{\Bern}{Bern}
\DeclareMathOperator{\Bin}{Bin}
\DeclareMathOperator{\Un}{U}
\DeclareMathOperator{\N}{N}
\DeclareMathOperator{\Exp}{Exp}
% Spaced Characters
\newcommand{\sland}{\quad\land\quad}
\newcommand{\slor}{\quad\or\quad}
\newcommand{\smid}{\quad\mid\quad}
\newcommand{\scol}{\;:\;}
% Miscellaneous
\DeclareMathOperator{\inv}{inv}
\DeclareMathOperator{\gset}{graph}
\DeclareMathOperator{\wt}{wt}
% Physics
\newcommand{\Sr}{𝔯}
\newcommand{\SR}{𝖗}
\renewcommand{\dj}{đ}
% Geometry
\newcommand{\I}{\mathrel{\mathrm{I}}}
\newcommand{\notI}{\mathrel{\not{\mathrm{I}}}}
\newcommand{\obot}{\mathbin{⦹}}
% Set theory
\DeclareMathOperator{\shood}{\mathfrak{M}}
\DeclareMathOperator{\chood}{\mathfrak{Cls}}
\newcommand{\pchood}{\neg \ehood}
\DeclareMathOperator{\ehood}{\mathfrak{E}}
\DeclareMathOperator{\rhood}{\mathfrak{Rel}}
\DeclareMathOperator{\fhood}{\mathfrak{Fnc}}
% Lie theory
\DeclareMathOperator{\der}{\mathfrak{der}}
\DeclareMathOperator{\inder}{\mathfrak{inn}}