The quantum analogue of the constraint satisfaction problem is the fundamental physics question of finding the minimal energy state of a local Hamiltonian each term of the Hamiltonian specifies a local constraint whose violation contributes to the energy of the given quantum state. However, in general it is not meaningful to ask for the probability that a given quantum state violates at least one constraint; the difficulty being that the terms of the Hamiltonian do not commute. We show how to make sense of this notion under mild restrictions on the form of the Hamiltonian. We then provide two main results. We first prove the quantum detectability lemma, which states that the probability of detecting a violation of a constraint in a local Hamiltonian system is bounded from below by some constant times the minimal energy of the system. The proof reveals some intrinsic structure of the Hilbert space of local Hamiltonians, which is captured in the "exponential decay" lemma, and formalized using a novel decomposition of the Hilbert space called the XY decomposition. As an application of the detectability lemma, we prove our second main result: a quantum analogue of the classical gap amplification lemma using random walks over expander graphs, which was the seed for Dinur's celebrated new proof of the PCP theorem . We hope that these results will pave the way to better understandings of the computational properties of local Hamiltonians systems and Hamiltonian complexity.