Sum-of-squares decompositions for a family of noncontextuality inequalities and self-testing of quantum devices
Violation of a noncontextuality inequality or the phenomenon referred to `quantum contextuality' is a fundamental feature of quantum theory. In this article, we derive a novel family of noncontextuality inequalities along with their sum-of-squares decompositions in the simplest (odd-cycle) sequential-measurement scenario capable to demonstrate Kochen-Specker contextuality. The sum-of-squares decompositions allow us to obtain the maximal quantum violation of these inequalities and a set of algebraic relations necessarily satisfied by any state and measurements achieving it. With their help, we prove that our inequalities can be used for self-testing of three-dimensional quantum state and measurements. Remarkably, the presented self-testing results rely on weaker assumptions than the ones considered in Kochen-Specker contextuality.