  On a five dimensional simply connected Sasaki-Einstein manifold, one can
construct Yang-Mills theories coupled to matter with at least two
supersymmetries. The partition function of these theories localises on the
contact instantons, however the contact instanton equations are not elliptic.
It turns out that these equations can be embedded into the Haydys-Witten
equations (which are elliptic) in the same way the 4D anti-self-dual instanton
equations are embedded in the Vafa-Witten equations. We show that under some
favourable circumstances, the latter equations will reduce to the former by
proving some vanishing theorems. It was also known that the Haydys-Witten
equations on product manifolds $M_5=M_4\times \mathbb{R}$ arise in the context
of twisting the 5D maximally supersymmetric Yang-Mills theory. In this paper,
we present the construction of twisted $N=2$ Yang-Mills theory on
Sasaki-Einstein manifolds, and more generally on $K$-contact manifolds. The
localisation locus of this new theory thus provides a covariant version of the
Haydys-Witten equation.
