# Creating a box framework for inside the formula environment

For a list of things to be used inside the formula environment, I want to create boxes stacked over each other. I basically want to write

$$A := "Box with lines like 'A is a number', 'A is bigger than 3',... "$$


What I come up with is is

\newcommand{\mybox}[2]{\stackrel{\fbox{$#1$}}{\fbox{$#2$}}}


but it pretty much sucks when it comes to what I really want. It's only two boxes and they don't even touch each other. Their length depends on the content. It should look more like a shelf. The length of all boxes should fit (the height might depend on the content). Also, the box should be oriented such that the := is in the vertical center. But if I want to use my construction for more than two boxes I have to do stupid things like

\mybox{statement 1}{\mybox{and statement 2}{statement 3}}


-

\documentclass{article}
\usepackage{colonequals}

\begin{document}

$$A \colonequals \begin{tabular}{|c|} \hline statement 1\\\hline and statement 2\\\hline statement 3\\\hline \end{tabular}$$

\end{document}


Result:

Edit: Making a n-ary function:

\documentclass{article}
\usepackage{colonequals}

\usepackage{kvsetkeys}

\makeatletter
\newcommand*{\boxes}[1]{%
\begingroup
\toks@={%
\begin{tabular}{|c|}%
\hline
}%
\comma@parse{#1}\box@entry
\the\toks@
\end{tabular}%
\endgroup
}
\newcommand*{\box@entry}[1]{%
\toks@=\expandafter{\the\toks@
#1\tabularnewline
\hline
}%
}
\makeatother

\begin{document}

$$A \colonequals \boxes{ statement 1, and statement 2, {statement 3, 4 and 5},% comma needs to be protected by braces another statement, }$$

\end{document}


Result:

The contents of the tabular is first written in a token register. That avoids trouble with cell groups and empty lines at the end.