A Mathematical Formalization of HTM's Spatial Pooler