An analytical theory of a gas-filled diode