  We derive an exact p-value for testing a global null hypothesis in a general
adaptive regression problem. The general approach uses the Kac-Rice formula, as
described in (Adler & Taylor 2007). The resulting formula is exact in finite
samples, requiring only Gaussianity of the errors. We apply the formula to the
lasso, group lasso, and principal components and matrix completion problems. In
the case of the lasso, the new test relates closely to the recently proposed
covariance test of Lockhart et al. (2013).
