Sharp conditions for the validity of the Bourgain–Brezis–Mironescu formula | Synapse