Quantifying artificial intelligence through algebraic generalization