I can’t answer your overarching question, but I think this will answer what you really want:
every thing has a number called size. The size of a thing is usually 5.
Definition: A thing is small if its size is 4 or less. [If you don't want to use the "small" property the number doesn't matter, all that matters is that it says "or less" rather than "or more."]
And now you can automagically say “the smallest thing in the box.” See sections 6.7 and 6.8 of the documentation.
EDIT: More here.