Epoch of reionization window. I. Mathematical formalism | Synapse