The output randomness from a random number generator can be certified by observing the violation of quantum contextuality inequalities based on the Kochen-Specker theorem. Contextuality can be tested in a single quantum system, which significantly simplifies the experimental requirements to observe the violation comparing to the ones based on nonlocality tests. However, it is not yet resolved as to how to ensure compatibilities for sequential measurements that is required in contextuality tests. Here, we employ a modified Klyachko-Can-Binicio\ifmmode \breve{g}\else \u{g}\fi{}lu-Shumovsky contextuality inequality, which can ease the strict compatibility requirement on measurements. On a trapped single
138Ba+ ion system, we experimentally demonstrate violation of the contextuality inequality and realize quantum random number expansion by closing detection loopholes. We perform $1.29\ifmmode\times\else\texttimes\fi{}{10}^{8}$ trials of experiments and extract a randomness of $5.28\ifmmode\times\else\texttimes\fi{}{10}^{5}$ bits with a speed of $270\phantom{\rule{0.2em}{0ex}}\mathrm{bits}\phantom{\rule{0.2em}{0ex}}{\mathrm{s}}^{\ensuremath{-}1}$. Our demonstration paves the way for practical high-speed spot-checking quantum random number expansion and other secure information processing applications.
Everyday experience supports the existence of physical properties independent of observation in strong contrast to the predictions of quantum theory. In particular, the existence of physical properties that are independent of the measurement context is prohibited for certain quantum systems. This property is known as contextuality. This Rapid Communication studies whether the process of decay in space-time generally destroys the ability of revealing contextuality. We find that in the most general situation the decay property does not diminish this ability. However, applying certain constraints due to the space-time structure either on the time evolution of the decaying system or on the measurement procedure, the criteria revealing contextuality become inherently dependent on the decay property or an impossibility. In particular, we derive how the context-revealing setup known as Bell's nonlocality tests changes for decaying quantum systems. Our findings illustrate the interdependence between hidden and local hidden parameter theories and the role of time.