Formalization of recognition, affordances and learning in isolated or interacting animats