%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Basic packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath,amsthm,amssymb}
\usepackage{mathtools}
\usepackage{etoolbox}
\usepackage{mathpartir}
\usepackage{verse}
\usepackage{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theorem-like environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\theoremstyle{plain}% default
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{task}{Task}
\newtheorem{bonus}{Bonus Task}
\newenvironment{hint}{\noindent{\bf (Hint)}}{}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{remark}
\newtheorem*{remark}{Remark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ITT + HoTT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newrobustcmd*{\ctx}{\Gamma}
\newrobustcmd*{\entails}{\vdash}
\newrobustcmd*{\comp}{\mathbin{\circ}}
\newrobustcmd*{\jdeq}{\equiv} %%% judgmental equality
\newrobustcmd*{\defeq}{\vcentcolon\equiv} %%% definition. Sorry I screwed this up.
\newrobustcmd*{\id}{\mathtt{id}}
\newrobustcmd*{\dummy}{\underline{\hspace{0.5em}}}
\newrobustcmd*{\unknown}{\text{--}}
\newrobustcmd*{\blank}{\underline{\hspace{2em}}}
% Units
\newrobustcmd*{\triv}{\langle\rangle}
%\newrobustcmd*{\triv}{\star} -- the star version
% Bottoms
\newrobustcmd*{\abort}{\mathtt{abort}}
% Products
\newrobustcmd*{\fst}{\mathtt{fst}}
\newrobustcmd*{\snd}{\mathtt{snd}}
\newrobustcmd*{\pair}[2]{\langle #1,#2\rangle}
\newrobustcmd*{\tuple}[2]{\langle #1,#2\rangle} % alternative
\newrobustcmd*{\tuplepair}[2]{\langle #1,#2\rangle} % alternative
% Sums
\newrobustcmd*{\inl}{\mathtt{inl}}
\newrobustcmd*{\inr}{\mathtt{inr}}
\newrobustcmd*{\case}{\mathtt{case}}
% Natural numbers
\newrobustcmd*{\rec}{\mathtt{rec}}
\newrobustcmd*{\zero}{\mathtt{zero}}
\newrobustcmd*{\suc}{\mathtt{suc}}
\newrobustcmd*{\N}{\mathbb{N}}
\newrobustcmd*{\nat}{\mathtt{nat}}
% Identities
\newrobustcmd*{\Id}{\mathtt{Id}}
\newrobustcmd*{\refl}{\mathtt{refl}}
\newrobustcmd*{\J}{\mathsf{J}}
\newrobustcmd*{\sym}{\mathtt{sym}}
\newrobustcmd*{\trans}{\mathtt{trans}}
\newrobustcmd*{\ap}{\mathtt{ap}}
\newrobustcmd*{\tr}{\mathtt{tr}}
%%% Path concatenation
\newrobustcmd*{\concat}{%
  \mathchoice{\mathbin{\raisebox{0.5ex}{$\displaystyle\centerdot$}}}%
  {\mathbin{\raisebox{0.5ex}{$\centerdot$}}}%
  {\mathbin{\raisebox{0.25ex}{$\scriptstyle\,\centerdot\,$}}}%
  {\mathbin{\raisebox{0.1ex}{$\scriptscriptstyle\,\centerdot\,$}}}
}
% Universes
\newrobustcmd*{\U}{\mathcal{U}}
% Equivalences
\newrobustcmd*{\eqv}{\simeq} % from HoTT-book
\newrobustcmd*{\qinv}{\mathsf{qinv}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Names of lemmas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mathchardef\mhyphen="2D
\newrobustcmd*{\apconcat}{\mathtt{ap\mhyphen concat}}
\newrobustcmd*{\apid}{\mathtt{ap\mhyphen id}}
\newrobustcmd*{\apcomp}{\mathtt{ap\mhyphen comp}}
\newrobustcmd*{\lemmaone}{\mathtt{lemma}_1}
\newrobustcmd*{\lemmatwo}{\mathtt{lemma}_2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Equational reasoning
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newrobustcmd*{\reason}[1]{=\hspace{-0.5em}\langle\hspace{0.2em} #1 \hspace{0.2em}\rangle}
\newrobustcmd*{\concatassoc}{\mathtt{concat\mhyphen assoc}}
