The Mathematics of Comparing Objects