  The rare kaon decays $K\to\pi\ell^+\ell^-$ and $K\to\pi\nu\bar{\nu}$ are
flavor changing neutral current (FCNC) processes and hence promising channels
with which to probe the limits of the standard model and to look for signs of
new physics. In this paper we demonstrate the feasibility of lattice
calculations of $K\to\pi\ell^+\ell^-$ decay amplitudes for which long-distance
contributions are very significant. We show that the dominant finite-volume
corrections (those decreasing as powers of the volume) are negligibly small and
that, in the four-flavor theory, no new ultraviolet divergences appear as the
electromagnetic current $J$ and the effective weak Hamiltonian $H_W$ approach
each other. In addition, we demonstrate that one can remove the unphysical
terms which grow exponentially with the range of the integration over the time
separation between $J$ and $H_W$. We will now proceed to exploratory numerical
studies with the aim of motivating further experimental measurements of these
decays. Our work extends the earlier study by Isidori, Turchetti and Martinelli
which focussed largely on the renormalization of ultraviolet divergences. In a
companion paper we discuss the evaluation of the long-distance contributions to
$K\to\pi\nu\bar{\nu}$ decays; these contributions are expected to be at the
level of a few percent for $K^+$ decays.
