  As a first step towards a mathematically rigorous understanding of adaptive
spectral/$hp$ discretizations of elliptic boundary-value problems, we study the
performance of adaptive Legendre-Galerkin methods in one space dimension. These
methods offer unlimited approximation power only restricted by solution and
data regularity. Our investigation is inspired by a similar study that we
recently carried out for Fourier-Galerkin methods in a periodic box. We first
consider an "ideal" algorithm, which we prove to be convergent at a fixed rate.
Next we enhance its performance, consistently with the expected fast error
decay of high-order methods, by activating a larger set of degrees of freedom
at each iteration. We guarantee optimality (in the non-linear approximation
sense) by incorporating a coarsening step. Optimality is measured in terms of
certain sparsity classes of the Gevrey type, which describe a (sub-)exponential
decay of the best approximation error.
