  Lasers and Bose-Einstein condensates (BECs) exhibit macroscopic quantum
coherence in seemingly unrelated ways. Lasers possess a well-defined global
phase and are characterized by large fluctuations in the number of photons. In
BECs of atoms, instead, the number of particles is conserved and the global
phase is undefined. Here, we present a unified framework to simulate lasers and
BECs states in gate-based quantum computers, by mapping bosonic particles to
qubit excitations. Our approach relies on a scalable circuit that measures the
total number of particles without destroying long-range coherence. We introduce
complementary probes to measure the global and relative phase coherence of a
quantum state, and demonstrate their functionality on a Rigetti quantum
computer. Our work shows that particle-number conservation enhances long-range
phase coherence, highlighting a mechanism used by superfluids and
superconductors to gain phase stiffness.
