% !TEX root =  main.tex
\usepackage[english]{babel}

% Packages
\usepackage{enumitem}
\usepackage{type1cm} % type1 computer modern font
\usepackage{graphicx} % advanced figures
\usepackage{xspace} % fix space in macros
\usepackage{balance} % to better equalize the last page
\usepackage{booktabs} % nicer tables
\usepackage{multirow} % multi rows for tables
\usepackage{fontawesome5}
\usepackage[font={bf}, tableposition=top]{caption} % captions on top for tables
\usepackage{subcaption} % subfloats
\usepackage{bold-extra} % bold + {small capital, italic}
\usepackage[vlined,linesnumbered,ruled,noend]{algorithm2e} % algorithms
\usepackage{microtype} % compress text
\usepackage{siunitx} % \num for decimal grouping
\usepackage{xfrac} % nicer slanted fractions
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{bbm}
\usepackage[square,numbers]{natbib} % better references
\usepackage{cleveref} % smart references
\usepackage[hyperpageref]{backref} % back references
\usepackage{hyphenat} % name in single line
\usepackage{csquotes}
\usepackage[show]{chato-notes} % notes
\usepackage{authblk}
\usepackage{bm}
\usepackage{xspace}
\usepackage{physics}
\usepackage{newunicodechar}
\newunicodechar{⟓}{\ensuremath{\uplus}}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{bayesnet}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usetikzlibrary{fit}
\usepackage{tikz-cd}
\usepackage{bbold}
\usetikzlibrary{calc, positioning, arrows.meta, shapes.geometric, fit, backgrounds}
\usepackage{pgf}
\usepackage{thmtools,thm-restate}
\usepackage{tikz-3dplot}
\usepackage{tcolorbox}

% Paragraphs
\newcommand{\spara}[1]{\smallskip\noindent\textbf{#1}}
\newcommand{\mpara}[1]{\medskip\noindent\textbf{#1}}
\newcommand{\para}[1]{\noindent\textbf{#1}}

% Squishlist
\newenvironment{squishlist}
{\begin{list}{$\bullet$}
 {\setlength{\itemsep}{0pt}
     \setlength{\parsep}{1.5pt}
     \setlength{\topsep}{1.5pt}
     \setlength{\partopsep}{0pt}
     \setlength{\leftmargin}{1em}
     \setlength{\labelwidth}{1em}
     \setlength{\labelsep}{0.5em} } }
{\end{list}}

% Backreferences
\renewcommand*\backref[1]{\ifx#1\relax \else (Cited on #1) \fi}

% Colorlinks
\hypersetup{
   bookmarks, pdftex,
   colorlinks=true,
   pagebackref=true, backref=page,
   linkcolor={red!50!black},
   filecolor={green!50!black},
   citecolor={green!50!black}, 
   urlcolor={green!40!black},
}

\graphicspath{{fig}}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % THEOREMS
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define a custom theorem style:
\newtheoremstyle{mytheoremstyle}%
  {2pt}    % Space above
  {2pt}    % Space below
  {\itshape}  % Body font
  {}          % Indent amount
  {\bfseries} % Theorem head font
  {}          % Punctuation after theorem head
  { }         % Space after theorem head
  {}          % Theorem head specification

% Apply the style:
\theoremstyle{mytheoremstyle}
\newtheorem{theorem}{Theorem}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{problem}{Problem}
\newtheorem{corollary}{Corollary}
\newtheorem{definition}{Definition}
\newtheorem{assumption}{Assumption}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}


% Utils
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}

% Math
\newcommand{\nat}{\ensuremath{\mathbb{N}}\xspace}
\newcommand{\integer}{\ensuremath{\mathbb{Z}}\xspace}
\newcommand{\reall}{\ensuremath{\mathbb{R}}\xspace}
\newcommand{\prob}{\ensuremath{\mathbb{P}}\xspace}

\newcommand{\psd}{\ensuremath{\mathcal{S}_{+}}\xspace}
\newcommand{\pd}{\ensuremath{\mathcal{S}_{++}}\xspace}
\newcommand{\zeros}{\ensuremath{\boldsymbol{0}}\xspace}
\newcommand{\ones}{\ensuremath{\boldsymbol{1}}\xspace}
\newcommand{\identity}{\ensuremath{\mathbf{I}}\xspace}
\newcommand{\catidentity}{\ensuremath{\mathrm{Id}}\xspace}
\newcommand{\parents}{\ensuremath{\mathcal{P}}\xspace}
\newcommand{\myendogenous}{\ensuremath{\mathcal{X}}\xspace}
\newcommand{\myexogenous}{\ensuremath{\mathcal{Z}}\xspace}
\newcommand{\myfunctional}{\ensuremath{\mathcal{F}}\xspace}
\newcommand{\mymixing}{\ensuremath{\mathcal{M}}\xspace}
\newcommand{\vertexset}{\ensuremath{\mathcal{V}}\xspace}
\newcommand{\edgeset}{\ensuremath{\mathcal{E}}\xspace}
\newcommand{\stiefel}[2]{\ensuremath{\mathrm{St}({#1},{#2})}\xspace}
\newcommand{\data}{\ensuremath{\mathbf{X}}\xspace}
\newcommand{\causalcoeff}{\ensuremath{\mathbf{C}}\xspace}
\newcommand{\mixing}{\ensuremath{\mathbf{M}}\xspace}
\newcommand{\noise}{\ensuremath{\mathbf{Z}}\xspace}
\newcommand{\Vect}{\ensuremath{\mathsf{Vect}_{\reall}}\xspace}
\newcommand{\tangentspace}[2]{\ensuremath{T_{#1}{#2}}\xspace}
\newcommand{\normalspace}[2]{\ensuremath{N_{#1}{#2}}\xspace}
\newcommand{\projectiontangentspace}[2]{\ensuremath{\mathrm{Proj}_{#1}{#2}}\xspace}
\newcommand{\sym}[1]{\ensuremath{\mathrm{Sym}({#1})}\xspace}
\newcommand{\basisN}[1]{\ensuremath{\mathcal{B}_{#1}}\xspace}
\newcommand{\basisNelement}[1]{\ensuremath{\mathbf{B}^{#1}}\xspace}
\newcommand{\Retr}[3]{\ensuremath{\mathrm{R}^{#1}_{#2}\left( #3 \right)}\xspace}
\newcommand{\Egrad}[2]{\ensuremath{\nabla_{#1} #2}\xspace}
\newcommand{\Rgrad}[2]{\ensuremath{\widetilde{\nabla}_{#1} #2}\xspace}
\newcommand{\Esubgrad}[2]{\ensuremath{\partial_{#1} #2}\xspace}
\newcommand{\Rsubgrad}[2]{\ensuremath{\widetilde{\partial}_{#1} #2}\xspace}
\newcommand{\frob}[1]{\ensuremath{\norm{#1}_{\mathrm{F}}}\xspace}
\newcommand{\F}{\ensuremath{\mathbf{F}}\xspace}
\newcommand{\Eprod}[3]{\ensuremath{\langle #1, \, #2 \rangle_{#3}}\xspace}
\newcommand{\restrictionmap}[2]{\ensuremath{\mathbf{F}^{ #1 \trianglelefteq #2 }}\xspace}
\newcommand{\restrictionmapD}[2]{\ensuremath{\mathbf{D}^{ #1 \trianglelefteq #2 }}\xspace}
\newcommand{\vectorspace}[1]{\ensuremath{\mathcal{F}(#1)}\xspace}
\newcommand{\Hilb}{\ensuremath{\mathsf{Hilb}_{\reall}}\xspace}
\newcommand{\IPVect}{\ensuremath{\mathsf{preHilb}_{\reall}}\xspace}
\newcommand{\hilbertspace}[1]{\ensuremath{\mathcal{H}(#1)}\xspace}
\newcommand{\Top}{\ensuremath{\mathsf{Top}}\xspace}
\newcommand{\Poset}{\ensuremath{(\mathcal{P}, \leqslant)}\xspace}
\newcommand{\CSprob}{\ensuremath{\mathsf{CSprob}}\xspace}
\newcommand{\CSNI}{\ensuremath{\mathsf{CSNI}}\xspace}
\newcommand{\CK}[1]{\ensuremath{\mathsf{CK}\left(#1\right)}\xspace}
\newcommand{\faceincidenceposet}{\ensuremath{(\Pi,\trianglelefteq)}\xspace}

\newcommand{\x}{\ensuremath{\mathbf{x}}\xspace}
\newcommand{\X}{\ensuremath{\mathbf{X}}\xspace}
\newcommand{\z}{\ensuremath{\mathbf{z}}\xspace}
\newcommand{\Z}{\ensuremath{\mathbf{Z}}\xspace}
\newcommand{\Lapl}{\ensuremath{\mathbf{L}}\xspace}
\newcommand{\B}{\ensuremath{\mathbf{B}}\xspace}
\newcommand{\G}{\ensuremath{\mathbf{G}}\xspace}

\newcommand{\scm}[1]{\ensuremath{\mathsf{M}^{#1}}\xspace}
\newcommand{\intervention}{\ensuremath{\mathcal{I}}\xspace}
\newcommand{\tauomega}{\ensuremath{(\tau$-$\omega)}\xspace}
\newcommand{\hard}{\ensuremath{\mathcal{H}}\xspace}
\newcommand{\soft}{\ensuremath{\mathcal{S}}\xspace}

\newcommand{\indicatorf}[2]{I_{#1}\left(#2\right)}
\newcommand{\sgets}{\ensuremath{{\scriptscriptstyle \gets}}\xspace}

\newcommand{\dotarrow}{\ensuremath{\xrightarrow{\bullet}}\xspace}

\newcommand{\blfootnote}[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}
\newcommand{\cyan}[1]{\textcolor{cyan}{#1}}
\newcommand{\red}[1]{\textcolor{red}{#1}}

\newcommand{\myendogenousvals}{\ensuremath{\mathcal{V}}\xspace}
\newcommand{\myexogenousvals}{\ensuremath{\mathcal{U}}\xspace}
\newcommand{\Prob}{\ensuremath{\mathsf{Prob}}\xspace}
\newcommand{\Meas}{\ensuremath{\mathsf{Meas}}\xspace}
\newcommand{\I}{\ensuremath{\mathsf{I}}\xspace}
\newcommand{\ancestors}{\ensuremath{\mathcal{A}}\xspace}
\newcommand{\SCMcat}{\ensuremath{\mathsf{SCM}(\I,\Prob)}\xspace}
\newcommand{\linSCMcat}{\ensuremath{\mathsf{LinSCM}(\I,\Prob)}\xspace}
\newcommand{\NI}{\ensuremath{\mathsf{NI}(\I,\Prob)}\xspace}
\newcommand{\Ccat}{\ensuremath{\mathsf{C}}\xspace}
\newcommand{\Dcat}{\ensuremath{\mathsf{D}}\xspace}

\newcommand{\abst}{\ensuremath{\boldsymbol{\alpha}}\xspace}
\newcommand{\Rset}{\ensuremath{\mathcal{R}}\xspace}
\newcommand{\Qset}{\ensuremath{\mathcal{Q}}\xspace}
\newcommand{\amap}{\ensuremath{a}\xspace}
\newcommand{\alphamap}[1]{\ensuremath{\alpha_{#1}}\xspace}
\newcommand{\alphaabs}{\ensuremath{\abst\text{-abstraction}}\xspace}
\newcommand{\betamap}[1]{\ensuremath{\beta_{#1}}\xspace}

\newcommand{\st}[1]{%
  \text{\rlap{\red{\rule[0.5ex]{\widthof{#1}}{0.4pt}}}#1}%
}


\definecolor{ck}{RGB}{184, 84, 80}
\definecolor{backbone}{RGB}{108, 142, 191}
\definecolor{system}{RGB}{215, 155, 10}
\definecolor{cochain}{RGB}{150, 115, 166}
