  The recent discovery and initial characterization of sub-Neptune-sized
exoplanets that receive stellar irradiance of approximately Earth's raised the
prospect of finding habitable planets in the coming decade, because some of
these temperate planets may support liquid water oceans if they do not have
massive H2/He envelopes and are thus not too hot at the bottom of the
envelopes. For planets larger than Earth, and especially planets in the 1.7-3.5
R_Earth population, the mass of the H2/He envelope is typically not
sufficiently constrained to assess the potential habitability. Here we show
that the solubility equilibria vs. thermochemistry of carbon and nitrogen gases
results in observable discriminators between small H2 atmospheres vs. massive
ones, because the condition to form a liquid-water ocean and that to achieve
the thermochemical equilibrium are mutually exclusive. The dominant carbon and
nitrogen gases are typically CH4 and NH3 due to thermochemical recycling in a
massive atmosphere of a temperate planet, and those in a small atmosphere
overlying a liquid-water ocean are most likely CO2 and N2, followed by CO and
CH4 produced photochemically. NH3 is depleted in the small atmosphere by
dissolution into the liquid-water ocean. These gases lead to distinctive
features in the planet's transmission spectrum, and a moderate number of
repeated transit observations with the James Webb Space Telescope should tell
apart a small atmosphere vs. a massive one on planets like K2-18 b. This method
thus provides a way to use near-term facilities to constrain the atmospheric
mass and habitability of temperate sub-Neptune exoplanets.
