Logical Models for Cognitive Agents and Social Institutions