Formal semantics for perceptual classification