A dependently typed low-level target language can provide strong guarantees about compiled code, specifying both the types of program fragments and the exact values they compute. Although recent advances in type-preserving compilation of dependently typed languages have yielded a variety of intermediate languages for closure conversion, CPS, defunctionalization, and A-normal form, there is no low-level target language to date that supports fully dependent types with large elimination.
We introduce a principle for developing dependently typed abstract machines in which instructions are typed as transformers of abstract stacks of terms drawn from a specification calculus. We apply the principle to develop two machines — the dependent SECD machine and the TAL-style dependent abstract machine (DAM) — that enjoy \emph{total correctness}: every well-typed machine halts with exactly the value specified by its type. Finally, we give a type-preserving translation targeting DAM which, combined with existing work on defunctionalization, yields the first type-preserving compiler for a fully dependently typed language, with whole-program and separate compilation correctness checkable by type checking the compiled instructions, independently of the compiler or source code that produced them.