Swarm Robotics: A Formal Approach