AUTHOR=He Suirong , Li Yufen , Liang J. Q. , Wei L. F. TITLE=Quantum coherence and the bell inequality violation: a numerical experiment with the cavity QEDs JOURNAL=Frontiers in Physics VOLUME=Volume 13 - 2025 YEAR=2025 URL=https://www.frontiersin.org/journals/physics/articles/10.3389/fphy.2025.1541888 DOI=10.3389/fphy.2025.1541888 ISSN=2296-424X ABSTRACT=Bell inequality violation has been widely tested by using the bipartite entangled pure states and properly encoding the local observables in various experimental platforms, and the detector-, local-, and random loopholes have already been closed. A natural question is, how to deliver the Bell inequality violation by properly encoding the local observables? Here, we show that the Bell inequality violation is directly related to the coherence degree, which is controllable by encoding the different local observables into the entangled state. With the usual space-like correlation detections, we show that the coherence degree can be measured and thus the Bell nonlocality can be tested. The feasibility of the proposal is demonstrated by a numerical experiment typically with the cavity quantum electrodynamic system, in which the coherence degrees of the locally encoded bipartite entangled state can be conveniently measured by the spectral detection of the driven cavity. The present work might provide a feasible approach to verify the Gisin theorem, i.e., Bell inequality can be violated for any bipartite entangled pure state, once the local observables are properly encoded into the entangled state for keeping the desirable coherence.