An epistemic logic for formalizing group dynamics of agents