  In this paper, a link between polymatroid theory and locally repairable codes
(LRCs) is established. The codes considered here are completely general in that
they are subsets of $A^n$, where $A$ is an arbitrary finite set. Three classes
of LRCs are considered, both with and without availability, and for both
information-symbol and all-symbol locality. The parameters and classes of LRCs
are generalized to polymatroids, and a general- ized Singelton bound on the
parameters for these three classes of polymatroids and LRCs is given. This
result generalizes the earlier Singleton-type bounds given for LRCs. Codes
achieving these bounds are coined perfect, as opposed to the more common term
optimal used earlier, since they might not always exist. Finally, new
constructions of perfect linear LRCs are derived from gammoids, which are a
special class of matroids. Matroids, for their part, form a subclass of
polymatroids and have proven useful in analyzing and constructing linear LRCs.
