\usepackage[usenames, dvipsnames]{color}
\usepackage[rgb]{xcolor}
\usepackage{tikz}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{soul}
\usepackage{url}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{extramarks}
\usepackage{chngpage}
\usepackage{footnote}
% \usepackage[colorlinks=true, urlcolor=blue, linkcolor=blue, citecolor=blue]{hyperref}
\usepackage{minted}
\usepackage{xfrac}
\usepackage{enumerate}
\usepackage{centernot}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{extarrows}
\usepackage{ifthen}
\usepackage{xparse}
\usepackage{logicproof}
\usepackage{ebproof}
\usepackage{prftree}
\usepackage{cancel}
\usepackage{subcaption}

\let\MOD\relax
\let\C\relax
\let\E\relax
\let\EXP\relax
\let\p\relax
\let\R\relax
\let\A\relax
\let\G\relax
\usepackage[classfont=sanserif, langfont=sanserif, funcfont=sanserif]{complexity}
\renewcommand{\E}{{\mathbb E}}

\usemintedstyle{colorful}
\setminted{obeytabs=true, tabsize=4, xleftmargin=20pt, linenos, breaklines}

\usetikzlibrary{arrows,arrows.meta,automata,positioning}

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}

\newcommand{\xbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}

\newcommand{\TT}{\class{Truth}\text{-}\class{Table}}
\newclass{\Res}{Res}
\newclass{\TreeRes}{TreeRes}
\newclass{\Frege}{Frege}
\newclass{\EF}{EF}
\newlang{\PHP}{PHP}

\newcommand{\gens}[1]{\left< #1 \right>}
\newcommand{\genr}[1]{\left( #1 \right)}
\newcommand{\ord}[1]{\left\lvert #1 \right\rvert}
\newcommand{\Set}[1]{\left\{ #1 \right\}}
\newcommand{\Aut}[1]{\mathop{\mathrm{Aut}} \left( #1 \right)}
\newcommand{\Inn}[1]{\mathop{\mathrm{Inn}} \left( #1 \right)}
\newcommand{\Char}{\mathrel{\mathrm{char}}}
\newcommand{\pr}[1]{\left( #1 \right)}
\newcommand{\Syl}[2]{\mathop{Syl}_{#1} \left( #2 \right)}
\newcommand{\Com}[2]{\left[ #1, #2 \right]}
\newcommand{\im}{\mathop{\mathrm{Im}}}
\newcommand{\fch}[1]{\mathrm{ch}\pr{#1}}
\newcommand{\reldeg}[2]{\left[ #1 : #2 \right]}
\newcommand{\isomap}{\xrightarrow{\sim}}
\newcommand{\Gal}[1]{\mathrm{Gal} \left( #1 \right)}
\newcommand{\code}[1]{\left\langle #1 \right\rangle}

\newcommand{\caC}{\mathcal{C}}
\newcommand{\caR}{\mathcal{R}}
\newcommand{\fkF}{\mathfrak{F}}
\newcommand{\fkM}{\mathfrak{M}}
\newcommand{\sfF}{\mathsf{F}}
\newcommand{\sfM}{\mathsf{M}}
\newcommand{\bo}{\ensuremath{\square}}
\newcommand{\di}{\ensuremath{\scalebox{0.7071}{\rotatebox{45}{$\square$}}}}
\newcommand{\defas}{\mathrel{::=}}
\newcommand{\dom}{\mathop{\mathrm{dom}}}
\newcommand{\PV}{\mathcal{PV}}
\newcommand{\cons}{\Vdash}
\newcommand{\modeleq}{\leftrightsquigarrow}
\newcommand{\bmor}{\twoheadrightarrow}
\newcommand{\submodel}{\rightarrowtail}
\newcommand{\proves}{\vdash}
\newcommand{\imply}{\mathrel{\vdash}}

\newcommand{\bunderline}[1]{\mkern2mu\underline{\mkern-2mu #1\mkern-2mu}\mkern2mu}
\newcommand{\bunderlinelrarrow}{\bunderline{\leftrightarrow}}
\newcommand{\blrarrow}{\mathpalette\raiseblrarrow\relax}
\newcommand{\raiseblrarrow}[2]{\raisebox{0.5\depth}{$#1\bunderlinelrarrow$}}
\newcommand{\bis}{\mathrel{\blrarrow}}

\newcommand{\height}{\mathrm{ht}}

\newcommand{\ps}{\mathcal{P}}

\renewcommand{\phi}{\varphi}

% Author notes
\def\ShowAuthNotes{1}   
\ifnum\ShowAuthNotes=1
\newcommand{\authnote}[2]{\ \\ \textcolor{red}{\parbox{0.9\linewidth}{[{\footnotesize {\bf #1:} { {#2}}}]}}\newline}
\else
\newcommand{\authnote}[2]{}
\fi

\newcommand{\dummycommand}{}

\makeatletter
\newcommand{\defnote}[2]{
\long\csdef{#2star}##1{}
\long\csdef{#2nostar}##1{\authnote{#2}{##1}}
\newcommand{#1}{\@ifstar{\@nameuse{#2star}}{\@nameuse{#2nostar}}}
}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter
\newcommand{\customlabel}[2]{%
   \protected@write \@auxout {}{\string \newlabel {#1}{{#2}{\thepage}{#2}{#1}{}} }%
   \hypertarget{#1}{}%
}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ebproofset{separation=3em, rule margin=1ex, label separation=1em, right label template=\inserttext}

\newcommand{\discharge}[1]{[#1]}
\newcommand{\printassump}[2]{\ifthenelse{\equal{#1}{}}{#2}{#2^#1}}
\newcommand{\assumpstar}[2][]{\printassump{#1}{\discharge{#2}}}
\newcommand{\assumpnostar}[2][]{\printassump{#1}{#2}}
\makeatletter
\newcommand{\assump}{\@ifstar\assumpstar\assumpnostar}
\makeatother
\newcommand{\hypostar}[2][]{\hypo{\assumpstar[#1]{#2}}}
\newcommand{\hyponostar}[2][]{\hypo{\assumpnostar[#1]{#2}}}
\makeatletter
\newcommand{\hyp}{\@ifstar\hypostar\hyponostar}
\makeatother

\NewDocumentCommand{\Inf}{m O{} m}{\ifthenelse{\equal{#2}{}}{\infer{#1}{#3}}{\infer{#1}[($#2$)]{#3}}}
% \newcommand{\inf1}[2][]{\ifthenelse{\equal{#1}{}}{\infer1{#2}}{\infer1{($#1$)}{#2}}}
% \newcommand{\inf2}[2][]{\ifthenelse{\equal{#1}{}}{\infer2{#2}}{\infer2{($#1$)}{#2}}}
% \newcommand{\inf3}[2][]{\ifthenelse{\equal{#1}{}}{\infer3{#2}}{\infer3{($#1$)}{#2}}}
% \newcommand{\inf4}[2][]{\ifthenelse{\equal{#1}{}}{\infer4{#2}}{\infer4{($#1$)}{#2}}}
% \newcommand{\inf5}[2][]{\ifthenelse{\equal{#1}{}}{\infer5{#2}}{\infer5{($#1$)}{#2}}}

\patchcmd{\logicproof}{\center}{\flushleft}{}{}
\patchcmd{\endlogicproof}{\endcenter}{\endflushleft}{}{}

\makeatletter
\renewcommand{\lp@start@proof@line}{%
  \stepcounter{lp@line}%
  (\arabic{lp@line})%
  &%
  \lp@continue@proof@line%
}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

