  A Gabor system generated by a window function $\phi$ and a rectangular
lattice $a \Z\times \Z/b$ is given by $${\mathcal G}(\phi, a \Z\times
\Z/b):=\{e^{-2\pi i n t/b} \phi(t- m a):\ (m, n)\in \Z\times \Z\}.$$ One of
fundamental problems in Gabor analysis is to identify window functions $\phi$
and time-frequency shift lattices $a \Z\times \Z/b$ such that the corresponding
Gabor system ${\mathcal G}(\phi, a \Z\times \Z/b)$ is a Gabor frame for
$L^2(\R)$, the space of all square-integrable functions on the real line $\R$.
In this paper, we provide a full classification of triples $(a,b,c)$ for which
the Gabor system ${\mathcal G}(\chi_I, a \Z\times \Z/b)$ generated by the ideal
window function $\chi_I$ on an interval $I$ of length $c$ is a Gabor frame for
$L^2(\R)$. For the classification of such triples $(a, b, c)$ (i.e., the
$abc$-problem for Gabor systems), we introduce maximal invariant sets of some
piecewise linear transformations and establish the equivalence between Gabor
frame property and triviality of maximal invariant sets. We then study dynamic
system associated with the piecewise linear transformations and explore various
properties of their maximal invariant sets. By performing holes-removal surgery
for maximal invariant sets to shrink and augmentation operation for a line with
marks to expand, we finally parameterize those triples $(a, b, c)$ for which
maximal invariant sets are trivial. The novel techniques involving
non-ergodicity of dynamical systems associated with some novel non-contractive
and non-measure-preserving transformations lead to our arduous answer to the
$abc$-problem for Gabor systems.
