\newcommand{\term}[1]{\emph{#1}}
\newcommand{\true}{\textcolor{green}{\ensuremath{\mathbf{T}}}}
\newcommand{\false}{\textcolor{red}{\ensuremath{\mathbf{F}}}}

\newcommand{\SET}[1]{\textsc{#1}}
\newcommand{\STR}[1]{\texttt{#1}}
\newcommand{\CMD}[1]{\textsc{\bf#1}}

\newcommand{\edge}[2]{#1\text{---}#2}
\newcommand{\diredge}[2]{#1 \to #2}

%%% Text --- Abbreviations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\apriori}{\textit{a~priori}\xspace~}
\newcommand{\aposter}{\textit{a~posteriori}\xspace~}
\newcommand{\etal}{\textit{et~al}.\@\xspace}
\newcommand{\ie}{\textit{i.e.}\xspace,\xspace}
\newcommand{\eg}{\textit{e.g.}\xspace,\xspace}
%\newcommand{\etc}{\textit{etc}.\@\xspace}
\newcommand{\etc}{etc.\@\xspace}
\newcommand{\cf}{\textit{cf.}\xspace,\xspace}
\newcommand{\viz}{\textit{viz.}\xspace,\xspace}

%%% Text --- Constructs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\hint}{\emph{Hint: }}
\newcommand{\brule}[1]{\underline{\hspace{#1}}}
%\newenvironment{optional}[1]{\small [Optional] #1}{}
\newenvironment{optional}[1]{\footnotesize [Optional] #1}{}
%\newenvironment{optional}{\begin{quotation}\small [Optional]}{\end{quotation}}

%%% Math --- General %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\paren}[1]{\left(#1\right)}
\newcommand{\ang}[1]{\left\langle#1\right\rangle}
\newcommand{\brac}[1]{\left[#1\right]}
\newcommand{\mean}[1]{[\![#1]\!]}
\newcommand{\subst}[3]{#1[#2 := #3]}
\newcommand{\patch}[3]{#1[#2 \leftarrow #3]}

\newcommand{\suchthat}{\mid}
\newcommand{\eqdef}{\mathbin{::=}}
\renewcommand{\bar}[1]{\overline{#1}}

\newcommand{\mop}[1]{\mathop{#1}}
\newcommand{\mbin}[1]{\mathbin{#1}}
\newcommand{\mrel}[1]{\mathrel{#1}}
\newcommand{\mopt}[1]{\mathop{\mathrm{#1}}}
\newcommand{\mbint}[1]{\mathbin{\mathrm{#1}}}
\newcommand{\mrelt}[1]{\mathrel{\mathrm{#1}}}
\newcommand{\mtt}[1]{\mathtt{#1}}

%%% Math --- Logic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\And}{\wedge}
\newcommand{\conj}{\And}
\newcommand{\smand}{\And}
\newcommand{\AND}{\bigwedge}
\newcommand{\Land}{\AND}
\newcommand{\lgand}{\AND}

\newcommand{\Or}{\vee}
\newcommand{\disj}{\Or}
\newcommand{\smor}{\Or}
\newcommand{\OR}{\bigvee}
\newcommand{\Lor}{\OR} 
\newcommand{\lgor}{\OR}
\newcommand{\xor}{\oplus}

\renewcommand{\implies}{\longrightarrow}
\renewcommand{\iff}{\longleftrightarrow}
\newcommand{\bicond}{\longleftrightarrow}
\newcommand{\equivalent}{\Longleftrightarrow}
\newcommand{\qiff}{\quad \text{iff} \quad}
\newcommand{\qimplies}{\quad \text{implies} \quad}

\newcommand{\QOR}{\mbint{\textsc{or}}}
\newcommand{\QXOR}{\mbint{\textsc{xor}}}
\newcommand{\QAND}{\mbint{\textsc{and}}}
\newcommand{\QIMPLIES}{\mbint{\textsc{\,implies\,}}}
\newcommand{\QIMP}{\QIMPLIES}
\newcommand{\QIFF}{\mbint{\textsc{iff}}}
\newcommand{\QNOT}{\mopt{\textsc{not}}}

\newcommand{\nand}{\mathbin{\mid}}

%%% Math --- Set theory %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\card}[1]{\left|#1\right|}
\newcommand{\lnth}[1]{\left|#1\right|}
\newcommand{\ident}[1]{\text{Id}_{#1}}

\newcommand{\union}{\cup}
\newcommand{\lgunion}{\bigcup}
\newcommand{\intersect}{\cap}
\newcommand{\lgintersect}{\bigcap}
\newcommand{\cross}{\times}
\newcommand{\compose}{\circ}
\newcommand{\composition}{\circ} 
\newcommand{\power}{\mathcal{P}}
\newcommand{\restrict}{\upharpoonright}

\newcommand{\range}[1]{\mathop{\textup{range}}\nolimits\left(#1\right)}
\newcommand{\domain}[1]{\mathop{\textup{domain}}\nolimits\left(#1\right)}
\newcommand{\codomain}[1]{\mathop{\textup{codomain}}\nolimits\left(#1\right)}
\newcommand{\graph}[1]{\mathop{\textup{graph}}\nolimits\left(#1\right)}

\newcommand{\degr}[1]{\text{deg}(#1)}


%%% Math --- Languages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\emptystring}{\lambda}

%%% Math --- Famous sets %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\naturals}{\mathbb{N}}
\newcommand{\integers}{\mathbb{Z}}
\newcommand{\rationals}{\mathbb{Q}}
\newcommand{\reals}{\mathbb{R}}
\newcommand{\complexes}{\mathbb{C}}

%%% Math --- Arithmetic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
%\newcommand{\divides}{\mathbin{|}}
\newcommand{\divides}{\mid}

\newcommand{\rem}[2]{\operatorname{rem}(#1,#2)}
\newcommand{\remainder}{\mopt{remainder}}
\newcommand{\quotient}{\mopt{quotient}}
\newcommand{\lcm}{\mopt{lcm}}



%%%%%%%%%%%%%%%%%%%% Misc. - taken from ln and cp to avoid multiply def'd ref's
\newcommand{\corresp}{\ \longleftrightarrow\ }
\newcommand{\prq}{\rightarrow}  %prerequisite

%\newcommand{\prns}{\set{\, \mtt{)},\, \mtt{(}\,}^*}

\def\sg{\text{Sg}}

\def\GC{\mopt{GoodCount}}
\def\RM{\mopt{RecMatch}}
\def\ES{\mopt{Erasable}}

\newcommand{\prns}{\text{prns}}

\newcommand{\aexp}{\text{Aexp}}

\newcommand{\meval}{\mopt{eval}}
\newcommand{\msubst}[2]{\mopt{subst}(#1,#2)}  %#2[x \leftarrow #1]}

\newcommand{\prodsym}{\ast}
\newcommand{\minussym}{\mopt{--}}
\newcommand{\sumsym}{\mbint{+}}

\newcommand{\btg}{\text{binary-2PTG}}
\newcommand{\tg}{\text{2PTG}}
\newcommand{\ms}[1]{\mathop{\text{#1}}}

\providecommand{\sg}{\ms{sg}}
\providecommand{\ide}{\ms{id}}
\providecommand{\EF}{\ms{F18}}
\providecommand{\T}{\ms{ST}}

\def\lexle{\mathrel{\preceq_{\text{lex}}}}
\newcommand{\lexls}{\mathrel{\prec_{\text{lex}}}}
\newcommand{\lexgr}{\mathrel{\succ_{\text{lex}}}}
\def\lex<{\mathrel{\prec_{\text{lex}}}}
\def\coordle{\mathrel{\preceq_{\text{c}}}}
\def\coord<{\mathrel{\prec_{\text{c}}}}


\iffalse
\newcommand{\ms}[1]{\text{#1}}
\newcommand{\tg}{\text{2PTG}}
\newcommand{\bins}{\set{0,1}*}
\newcommand{\fstlist}{\text{list-first}}
\newcommand{\rstlist}{\text{list-rest}}
\newcommand{\nillist}{\text{()}}
\newcommand{\nillistq}{\text{list-nil?}}
\newcommand{\List}{\text{List}}
\newcommand{\mklist}{\text{makelist}}

\newcommand{\mktree}{\text{maketree}}
\newcommand{\subtrees}{\text{subtrees}}
\newcommand{\mkleaf}{\text{makeleaf}}
\newcommand{\leafv}{\text{leaf-value}}
\newcommand{\leafq}{\text{leaf?}}
\fi


%%% Math --- Probability %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\sspace}{\mathcal{S}}

\newcommand{\pr}[1]{\mathop{\textup{Pr}}\nolimits\left\{#1\right\}}
\newcommand{\prob}[1]{\pr{#1}}
\newcommand{\prsub}[2]{\mathop{\textup{Pr}_{#2}}\nolimits\left\{#1\right\}}
\newcommand{\prcond}[2]{%
  \ifinner \settoheight{\strutheight}{$#1 #2$}
  \else    \settoheight{\strutheight}{$\displaystyle#1 #2$} \fi%
  \mathop{\textup{Pr}}\nolimits\left\{
    #1\,\left|\protect\rule{0cm}{\strutheight}\right.\,#2
  \right\}}

\newcommand{\Ex}{\mathop{\textup{E}}\nolimits}
\newcommand{\Var}{\mathop{\textup{Var}}\nolimits}
\newcommand{\Cov}{\mathop{\textup{Cov}}\nolimits}
\newcommand{\expect}[1]{\Ex\left[#1\right]}
\newcommand{\expectsq}[1]{{\Ex}^2\left[#1\right]}
\newcommand{\expcond}[2]{\expect{#1\mid#2}}
\newcommand{\variance}[1]{\Var\left[#1\right]}
\newcommand{\varsq}[1]{{\Var}^2\left[#1\right]}
\newcommand{\covar}[1]{\Cov\left[#1\right]}
\newcommand{\covariance}[2]{\Cov\left[#1,#2\right]}
\newcommand{\pdf}{\textsc{PDF}}
\newcommand{\cdf}{\textsc{CDF}}

%%% Math --- Theorems & Proofs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{falsethm}[theorem]{False Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{falseclm}[theorem]{False Claim}
\newtheorem{rul}[theorem]{Rule}


\newtheorem{mathrule}{Rule}
\newtheorem*{mathrule*}{Rule}


\newtheorem*{theorem*}{Theorem}
\newtheorem*{falsethm*}{False Theorem}
\newtheorem*{lemma*}{Lemma}
\newtheorem*{proposition*}{Proposition}
\newtheorem*{corollary*}{Corollary}
\newtheorem*{claim*}{Claim}
\newtheorem*{falseclm*}{False Claim}
\newtheorem*{rul*}{Rule}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{axiom}[theorem]{Axiom}

\newtheorem*{definition*}{Definition}
\newtheorem*{fact*}{Fact}
\newtheorem*{axiom*}{Axiom}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{example}[theorem]{Example}
\newtheorem{xample}[theorem]{Example}

\newtheorem*{remark*}{Remark}
\newtheorem*{example*}{Example}
\newtheorem*{xample*}{Example}

\newenvironment{falseproof}
{\begin{proof}[False proof]}
{\end{proof}}

\newenvironment{bogusproof}
{\begin{proof}[Bogus proof]}
{\end{proof}}

\endinput