# How can I type a piecewise function inside ebproof's prooftree environment?

I want to type a piecewise function inside a prooftree as shown above. I have tried \begin{cases}.... But it does not work. Here is the code:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{ebproof}

\begin{document}
\begin{prooftree}
\Hypo{T' =
\begin{cases}
\text{SELF\_TYPE}_{C} & \text{if}\ T = \text{SELF\_TYPE} \\
\mbox{T} & otherwise
\end{cases}
}
\Infer1{O, M, C \vdash \text{new}\ T : T'}
\end{prooftree}
\end{document}


When I use pdflatex to process it, it produces the following error:

! Missing \cr inserted.
<inserted text>
\cr
l.12         }

• Welcome! Could you please provide a minimal working example, i.e., a piece of code that I could compile on my computer as it? Try to pinpoint the exact scope of your question, by not including useless packages or commands. – Clément Nov 1 '16 at 14:40
• @Clément, code added. – Jingguo Yao Nov 1 '16 at 14:51

Just brace the cases environment. I fixed a few things: \mbox{T} didn't seem appropriate, for instance.

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{ebproof}

\begin{document}

\begin{prooftree}
\Hypo{
T' =
{\begin{cases}
\text{SELF\_TYPE}_{C} & \text{if } T = \text{SELF\_TYPE} \\
T & \text{otherwise}
\end{cases}}
}
\Infer1{O, M, C \vdash \text{new}\ T : T'}
\end{prooftree}

\end{document}


• Sorry for including useless packages, I have removed them. Thanks a lot for your help. – Jingguo Yao Nov 1 '16 at 15:00
• @JingguoYao Oh, never mind! It was a good occasion for fixing a small (but not negligible) mistake in loading packages. It's best avoiding inessential packages in questions and answers here so the code can be more helpful to other readers that can spot the right dependencies. – egreg Nov 1 '16 at 15:11