An algebraic characterization of quantifiers