Many-body theory of degenerate systems