
%% $Id$
%%
%% Isar language elements
%%

\usepackage{ifthen}

\newcommand{\isarkeyword}[1]{{\mathord{\mathbf{#1}}}}

\newcommand{\indexoutertoken}[1]{\index{#1 (syntax)|bold}}
\newcommand{\indexouternonterm}[1]{\index{#1 (syntax)|bold}}
\newcommand{\indexisarcmd}[1]{\index{#1 (command)|bold}}
\newcommand{\indexisarmeth}[1]{\index{#1 (method)|bold}}
\newcommand{\indexisaratt}[1]{\index{#1 (attribute)|bold}}

\newcommand{\isarcmd}[1]{\isarkeyword{#1}}
\newcommand{\isartrans}[2]{#1 \mathbin{\,\to\,} #2}
\newcommand{\isarkeep}[1]{#1 \mathbin{\,\to\,} #1}
\newcommand{\isarmeth}{method}
\newcommand{\isaratt}{attribute}

\newcommand{\I@optname}[1]{\ifthenelse{\equal{}{#1}}{}{~#1\colon}}
\newcommand{\I@optoptname}[1]{\ifthenelse{\equal{}{#1}}{}{~[#1\colon]}}
\newcommand{\I@optmeth}[1]{\ifthenelse{\equal{}{#1}}{}{~(#1)}}
\newcommand{\I@optoptmeth}[1]{\ifthenelse{\equal{}{#1}}{}{~[(#1)]}}

\newcommand{\LEMMANAME}{\isarkeyword{lemma}}
\newcommand{\THEOREMNAME}{\isarkeyword{theorem}}
\newcommand{\NOTENAME}{\isarkeyword{note}}
\newcommand{\FROMNAME}{\isarkeyword{from}}
\newcommand{\WITHNAME}{\isarkeyword{with}}
\newcommand{\FIXNAME}{\isarkeyword{fix}}
\newcommand{\ASSUMENAME}{\isarkeyword{assume}}
\newcommand{\PRESUMENAME}{\isarkeyword{presume}}
\newcommand{\HAVENAME}{\isarkeyword{have}}
\newcommand{\SHOWNAME}{\isarkeyword{show}}
\newcommand{\HENCENAME}{\isarkeyword{hence}}
\newcommand{\THUSNAME}{\isarkeyword{thus}}
\newcommand{\PROOFNAME}{\isarkeyword{proof}}
\newcommand{\QEDNAME}{\isarkeyword{qed}}
\newcommand{\BYNAME}{\isarkeyword{by}}
\newcommand{\ISNAME}{\isarkeyword{is}}
\newcommand{\CONCLNAME}{\isarkeyword{concl}}
\newcommand{\LETNAME}{\isarkeyword{let}}
\newcommand{\DEFNAME}{\isarkeyword{def}}
\newcommand{\SUFFNAME}{\isarkeyword{suffient}}
\newcommand{\CMTNAME}{\isarkeyword{-{}-}}

\newcommand{\THEORY}{\isarkeyword{theory}}
\newcommand{\CONTEXT}{\isarkeyword{context}}
\newcommand{\END}{\isarkeyword{end}}

\newcommand{\TYPES}{\isarkeyword{types}}
\newcommand{\CONSTS}{\isarkeyword{consts}}
\newcommand{\DEFS}{\isarkeyword{defs}}
\newcommand{\TEXT}{\isarkeyword{text}}
\newcommand{\TXT}{\isarkeyword{txt}}
\newcommand{\NOTE}[2]{\NOTENAME\ifthenelse{\equal{}{#1}}{}{~#1=}#2}
\newcommand{\FROM}[1]{\FROMNAME~#1}
\newcommand{\WITH}[1]{\WITHNAME~#1}
\newcommand{\FIX}[1]{\FIXNAME~#1}
\newcommand{\ASSUME}[2]{\ASSUMENAME\I@optname{#1}~#2}
\newcommand{\PRESUME}[2]{\PRESUMENAME\I@optname{#1}~#2}
\newcommand{\THEN}{\isarkeyword{then}}
\newcommand{\BG}{\{\{}
\newcommand{\EN}{\}\}}
\newcommand{\HAVE}[2]{\isarkeyword{have}\I@optname{#1}~#2}
\newcommand{\SHOW}[2]{\isarkeyword{show}\I@optname{#1}~#2}
\newcommand{\HENCE}[2]{\isarkeyword{hence}\I@optname{#1}~#2}
\newcommand{\THUS}[2]{\isarkeyword{thus}\I@optname{#1}~#2}
\newcommand{\LEMMA}[2]{\LEMMANAME\I@optname{#1}~#2}
\newcommand{\THEOREM}[2]{\THEOREMNAME\I@optname{#1}~#2}
\newcommand{\PROOF}[1]{\PROOFNAME\I@optmeth{#1}}
\newcommand{\PPROOF}[1]{\PPROOFNAME\I@optmeth{#1}}
\newcommand{\QED}[1]{\QEDNAME\I@optmeth{#1}}
\newcommand{\BY}[1]{\BYNAME\I@optmeth{#1}}
\newcommand{\BYY}[2]{\BYNAME\I@optmeth{#1}\I@optmeth{#2}}
\newcommand{\DOT}{\isarkeyword{.}}
\newcommand{\DDOT}{\isarkeyword{.\,.}}
\newcommand{\DDDOT}{\dots}
\newcommand{\IS}[1]{(\ISNAME~#1)}
\newcommand{\LET}[1]{\LETNAME~#1}
\newcommand{\LETT}[1]{\LETNAME~#1\dt\;}
\newcommand{\DEF}[2]{\DEFNAME\I@optname{#1}~#2}
\newcommand{\SUFF}[1]{\SUFFNAME~#1}
\newcommand{\ATT}[1]{\ap [#1]}
\newcommand{\CMT}[1]{\CMTNAME~\text{#1}}
\newcommand{\ALSO}{\isarkeyword{also}}
\newcommand{\FINALLY}{\isarkeyword{finally}}
