use aggregate instead of foldLeft in Σ and Π