Learning from comparison in algebra