Structure of the gradient critical set of a generic function