  We introduce and study the minimum distance function of a graded ideal in a
polynomial ring with coefficients in a field, and show that it generalizes the
minimum distance of projective Reed-Muller-type codes over finite fields. This
gives an algebraic formulation of the minimum distance of a projective
Reed-Muller-type code in terms of the algebraic invariants and structure of the
underlying vanishing ideal. Then we give a method, based on Groebner bases and
Hilbert functions, to find lower bounds for the minimum distance of certain
Reed-Muller-type codes. Finally we show explicit upper bounds for the number of
zeros of polynomials in a projective nested cartesian set and give some support
to a conjecture of Carvalho, Lopez-Neumann and Lopez.
