TITLE: Defining $SU(n)$ in HoTT
QUESTION [34 upvotes]: From a recent answer by Mike Shulman, I read:

"HoTT is (among other things) a foundational theory, on roughly the same ontological level as ZFC, whose basic objects can be regarded as $\infty$-groupoids"

Now, $\infty$-groupoids are the same thing as spaces, and I have a couple of spaces which I like.
Here's one which I like a lot: the Lie group $SU(n)$.

Question: How do I say "let $X:=SU(n)$" in HoTT?
  Here, $n$ can be either a variable, or a definite number (say $3$).

Disclaimer: I (unfortunately) don't know much about HoTT. So please be gentle.

REPLY [8 votes]: As time passes I've become increasingly unhappy with my original answer, so I want to give a new one.
One of the most interesting things about HoTT is that it lets you ask questions of a logical flavor about homotopy theory.  For example, I was on Robert Rose's defense committee where the thesis problem was suppose you look at a version of HoTT where you don't assume you have the natural numbers, but you do have the circle, what can you still say?  Can you still show that you have infinite sets?  In what sense of the word infinite?  How much number theory do you still get?  These are interesting questions about the logic of homotopy theory that you can't even ask in the usual space-based foundations (classically how are you going to even define the circle without having access to infinite sets?).
So what I'd say now is that the question of whether (and how) you can define BSU(n) in book HoTT is an extremely interesting "logical" question about homotopy theory.  As Mike explains you can certainly do this if you give yourself a stronger type theory than book HoTT, so if your goal is to just give yourself these tools you can do so, but it's still interesting to ask whether you can do this with the weaker book HoTT.
In particular, as you well know, classically there's a homotopy coherent action of SO(n) on n-loops via the geometric action on $E_n$-algebras.  But this definition is highly geometric, which makes it difficult in practice to understand what this action actually looks like.  For example, you might want to understand the action of $SO(4)$ on 4-loops in an $\infty$-groupoid well enough to be able to write down the generator of $\pi_7(S^4)$ algebraically.  Furthermore, you might want to know whether you can keep doing this in general.  The question of whether you can define the group $SO(n)$ in book HoTT and define its action on $\Omega^n S^n$ in book HoTT gives you a logical framework for asking this question!  So the fact that you can't easily define the group $SO(n)$ in book HoTT is a feature, not a bug, because it lets you precisely phrase this very interesting mathematical question.  (Of course, since it's an interesting difficult question, simply stating the question doesn't get you very far towards solving it.)